tokentracker-cli 0.79.9 → 0.80.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-B1WOPlu0.js → AchievementBadge-D617bvS9.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-9kHEQicS.js → AchievementsPage-mzE76Ah9.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-Dw05PYPr.js → AchievementsSection-8CYGBoPJ.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-DaWgiijJ.js → BadgeDetailModal-DM3veVmW.js} +1 -1
- package/dashboard/dist/assets/{Card-DYhrLLM4.js → Card-DWONuizy.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BLy2LUKz.js → ClawdAnimated-CGQXyWuH.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CWYqfht3.js → CommunityStatsModal-B5yDmJ0o.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DcE2C24Y.js → ConfirmModal-d4wpsMPW.js} +1 -1
- package/dashboard/dist/assets/{Controls-CI7qw0-b.js → Controls-CMSqknaB.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-CAlgaBa7.js → DashboardPage-Cw6lmVSg.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DinOyaeN.js → DevicePage-CsPSjSLH.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-CjfSDrLo.js → DialogClose-Cbs-z783.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-B0fmBJxQ.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-f7gNmCca.js → DialogTitle-C4mJiIQW.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-D_5w0Qh0.js → FadeIn-xOJwCmZ8.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DTZyNKyL.js → HeaderGithubStar-oRz4rfC8.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-D8CViF98.js → IpCheckPage-CTwL-Zmz.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CqN5KEjV.js → LandingPage-CqYJ3sZh.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-CwUVO4wn.js → LeaderboardAvatar-CuF6Kzkj.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-B12HJ9LA.js → LeaderboardPage-BvOPIj-b.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-DFzPpsnV.js → LeaderboardProfileModal-DVXuKkRN.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-Z0ZYpNFd.js → LeaderboardProfilePage-RE1CPqzM.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-BpwioIa-.js → LimitsPage-BovkRgac.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-Covi6zdt.js → LocalOnlyNotice-CTFFU_ip.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-CRqbhwCx.js → LoginPage-mguBCTBZ.js} +1 -1
- package/dashboard/dist/assets/{PetPage-BY_yObVj.js → PetPage-C5KLH6Fm.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-B2dE3Ary.js → PopoverPopup-CLDh5yIk.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-C8IEJbVc.js → ResetPasswordPage-DnhgHQrV.js} +1 -1
- package/dashboard/dist/assets/{Select-BmRLYSqA.js → Select-DPSaPIlz.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-FC46bk8b.js → SelectItemText-jIBbXpqi.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DipzOQVg.js → SettingsPage-BK0IqSjg.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-CziypUTf.js → SkillsPage-BQNoMpL2.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CJegJhVR.js → WidgetsPage-308d8icu.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DcMiKvzf.js → WrappedPage-T720sQ9S.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-S7bF1LwW.js → agent-logos-Blo5C96d.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-D0yeL56y.js → arrow-up-right-DKz2Ua6U.js} +1 -1
- package/dashboard/dist/assets/check-fF6lQGN-.js +1 -0
- package/dashboard/dist/assets/{copy-D-z9ZtIu.js → copy-DcUFG0PD.js} +1 -1
- package/dashboard/dist/assets/{download-Dwxnd3QG.js → download-CNK1wtxV.js} +1 -1
- package/dashboard/dist/assets/{flame-Bdqk9A75.js → flame-BEhJZRaZ.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DNVcCRwm.js → format-tokens-Bsfbd8nj.js} +1 -1
- package/dashboard/dist/assets/{info-CMLT6oUI.js → info-DRJLv-aV.js} +1 -1
- package/dashboard/dist/assets/{link-2-BmiHu726.js → link-2-C0GdaANY.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-CXVUQtzm.js → loader-circle-F9ymYeor.js} +1 -1
- package/dashboard/dist/assets/{main-B9m79io-.js → main-CThKxvKx.js} +3 -3
- package/dashboard/dist/assets/{provider-display-BoAesdke.js → provider-display-D4NdFjHN.js} +1 -1
- package/dashboard/dist/assets/{trash-2-C9Rh2DAL.js → trash-2-D9vulGMW.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-aZwYxrXR.js → use-community-stats-BU4dXEOM.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-tJKR83RT.js → use-limits-display-prefs-Bx2VJhwl.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-PjfJPK5v.js → use-native-settings-BSXaxaTC.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-D1QFmZUY.js → use-ordered-list-OA0HwwEL.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-4N3Su4wC.js → use-quality-per-dollar-pref-Bqooc4FA.js} +1 -1
- package/dashboard/dist/assets/{use-transform-D9nurInL.js → use-transform-CZ9FdRGw.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DapTpi_6.js → use-usage-limits-Ct_A4wTr.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B0DH9ZZA.js → useCurrency-D4bvdaFB.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-DijV6DYS.js → useScrollLock-ZsWO-GoL.js} +1 -1
- package/dashboard/dist/assets/useTokenFormat-B3huMEws.js +1 -0
- package/dashboard/dist/assets/{zap-BVfhR3Ck.js → zap-C9Mp-GNU.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +607 -6
- package/src/commands/sync.js +176 -7
- package/src/lib/codex-config.js +135 -40
- package/src/lib/codex-context-breakdown.js +123 -43
- package/src/lib/codex-rollout-parser.js +329 -32
- package/src/lib/local-api.js +11 -5
- package/src/lib/openclaw-session-plugin.js +13 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +230 -10
- package/src/lib/usage-limits.js +9 -5
- package/dashboard/dist/assets/DialogDescription-DWs-KIUA.js +0 -1
- package/dashboard/dist/assets/check-Dn9BLYEf.js +0 -1
- package/dashboard/dist/assets/useTokenFormat-nxdG6gi9.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LimitsPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LimitsPage-BovkRgac.js","assets/use-usage-limits-Ct_A4wTr.js","assets/use-limits-display-prefs-Bx2VJhwl.js","assets/Card-DWONuizy.js","assets/FadeIn-xOJwCmZ8.js","assets/LocalOnlyNotice-CTFFU_ip.js","assets/arrow-up-right-DKz2Ua6U.js","assets/download-CNK1wtxV.js","assets/LeaderboardPage-BvOPIj-b.js","assets/Select-DPSaPIlz.js","assets/SelectItemText-jIBbXpqi.js","assets/useScrollLock-ZsWO-GoL.js","assets/check-fF6lQGN-.js","assets/use-ordered-list-OA0HwwEL.js","assets/useCurrency-D4bvdaFB.js","assets/useTokenFormat-B3huMEws.js","assets/LeaderboardAvatar-CuF6Kzkj.js","assets/AchievementBadge-D617bvS9.js","assets/zap-C9Mp-GNU.js","assets/flame-BEhJZRaZ.js","assets/use-community-stats-BU4dXEOM.js","assets/DashboardPage-Cw6lmVSg.js","assets/provider-display-D4NdFjHN.js","assets/info-DRJLv-aV.js","assets/DialogTitle-C4mJiIQW.js","assets/DialogClose-Cbs-z783.js","assets/PopoverPopup-CLDh5yIk.js","assets/use-transform-CZ9FdRGw.js","assets/loader-circle-F9ymYeor.js","assets/ClawdAnimated-CGQXyWuH.js","assets/use-quality-per-dollar-pref-Bqooc4FA.js","assets/agent-logos-Blo5C96d.js","assets/AchievementsPage-mzE76Ah9.js","assets/AchievementsSection-8CYGBoPJ.js","assets/format-tokens-Bsfbd8nj.js","assets/LandingPage-CqYJ3sZh.js","assets/HeaderGithubStar-oRz4rfC8.js","assets/copy-DcUFG0PD.js","assets/LeaderboardProfilePage-RE1CPqzM.js","assets/LeaderboardProfileModal-DVXuKkRN.js","assets/link-2-C0GdaANY.js","assets/SettingsPage-BK0IqSjg.js","assets/Controls-CMSqknaB.js","assets/use-native-settings-BSXaxaTC.js","assets/ConfirmModal-d4wpsMPW.js","assets/DialogDescription-B0fmBJxQ.js","assets/SkillsPage-BQNoMpL2.js","assets/trash-2-D9vulGMW.js","assets/WidgetsPage-308d8icu.js","assets/PetPage-C5KLH6Fm.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function dR(t,e){for(var n=0;n<e.length;n++){const a=e[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(a,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function NS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function uR(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return t[a]}})}),n}var Tg={exports:{}},Oc={},Eg={exports:{}},ut={};var lw;function hR(){if(lw)return ut;lw=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.iterator;function v(O){return O===null||typeof O!="object"?null:(O=m&&O[m]||O["@@iterator"],typeof O=="function"?O:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function P(O,Y,ae){this.props=O,this.context=Y,this.refs=x,this.updater=ae||y}P.prototype.isReactComponent={},P.prototype.setState=function(O,Y){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Y,"setState")},P.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function T(){}T.prototype=P.prototype;function L(O,Y,ae){this.props=O,this.context=Y,this.refs=x,this.updater=ae||y}var E=L.prototype=new T;E.constructor=L,b(E,P.prototype),E.isPureReactComponent=!0;var A=Array.isArray,D=Object.prototype.hasOwnProperty,B={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function S(O,Y,ae){var _e,fe={},ve=null,Ne=null;if(Y!=null)for(_e in Y.ref!==void 0&&(Ne=Y.ref),Y.key!==void 0&&(ve=""+Y.key),Y)D.call(Y,_e)&&!j.hasOwnProperty(_e)&&(fe[_e]=Y[_e]);var Oe=arguments.length-2;if(Oe===1)fe.children=ae;else if(1<Oe){for(var Ie=Array(Oe),St=0;St<Oe;St++)Ie[St]=arguments[St+2];fe.children=Ie}if(O&&O.defaultProps)for(_e in Oe=O.defaultProps,Oe)fe[_e]===void 0&&(fe[_e]=Oe[_e]);return{$$typeof:t,type:O,key:ve,ref:Ne,props:fe,_owner:B.current}}function N(O,Y){return{$$typeof:t,type:O.type,key:Y,ref:O.ref,props:O.props,_owner:O._owner}}function U(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Q(O){var Y={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(ae){return Y[ae]})}var ee=/\/+/g;function ce(O,Y){return typeof O=="object"&&O!==null&&O.key!=null?Q(""+O.key):Y.toString(36)}function le(O,Y,ae,_e,fe){var ve=typeof O;(ve==="undefined"||ve==="boolean")&&(O=null);var Ne=!1;if(O===null)Ne=!0;else switch(ve){case"string":case"number":Ne=!0;break;case"object":switch(O.$$typeof){case t:case e:Ne=!0}}if(Ne)return Ne=O,fe=fe(Ne),O=_e===""?"."+ce(Ne,0):_e,A(fe)?(ae="",O!=null&&(ae=O.replace(ee,"$&/")+"/"),le(fe,Y,ae,"",function(St){return St})):fe!=null&&(U(fe)&&(fe=N(fe,ae+(!fe.key||Ne&&Ne.key===fe.key?"":(""+fe.key).replace(ee,"$&/")+"/")+O)),Y.push(fe)),1;if(Ne=0,_e=_e===""?".":_e+":",A(O))for(var Oe=0;Oe<O.length;Oe++){ve=O[Oe];var Ie=_e+ce(ve,Oe);Ne+=le(ve,Y,ae,Ie,fe)}else if(Ie=v(O),typeof Ie=="function")for(O=Ie.call(O),Oe=0;!(ve=O.next()).done;)ve=ve.value,Ie=_e+ce(ve,Oe++),Ne+=le(ve,Y,ae,Ie,fe);else if(ve==="object")throw Y=String(O),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return Ne}function re(O,Y,ae){if(O==null)return O;var _e=[],fe=0;return le(O,_e,"","",function(ve){return Y.call(ae,ve,fe++)}),_e}function te(O){if(O._status===-1){var Y=O._result;Y=Y(),Y.then(function(ae){(O._status===0||O._status===-1)&&(O._status=1,O._result=ae)},function(ae){(O._status===0||O._status===-1)&&(O._status=2,O._result=ae)}),O._status===-1&&(O._status=0,O._result=Y)}if(O._status===1)return O._result.default;throw O._result}var ie={current:null},$={transition:null},X={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:$,ReactCurrentOwner:B};function W(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:re,forEach:function(O,Y,ae){re(O,function(){Y.apply(this,arguments)},ae)},count:function(O){var Y=0;return re(O,function(){Y++}),Y},toArray:function(O){return re(O,function(Y){return Y})||[]},only:function(O){if(!U(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},ut.Component=P,ut.Fragment=n,ut.Profiler=r,ut.PureComponent=L,ut.StrictMode=a,ut.Suspense=u,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X,ut.act=W,ut.cloneElement=function(O,Y,ae){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var _e=b({},O.props),fe=O.key,ve=O.ref,Ne=O._owner;if(Y!=null){if(Y.ref!==void 0&&(ve=Y.ref,Ne=B.current),Y.key!==void 0&&(fe=""+Y.key),O.type&&O.type.defaultProps)var Oe=O.type.defaultProps;for(Ie in Y)D.call(Y,Ie)&&!j.hasOwnProperty(Ie)&&(_e[Ie]=Y[Ie]===void 0&&Oe!==void 0?Oe[Ie]:Y[Ie])}var Ie=arguments.length-2;if(Ie===1)_e.children=ae;else if(1<Ie){Oe=Array(Ie);for(var St=0;St<Ie;St++)Oe[St]=arguments[St+2];_e.children=Oe}return{$$typeof:t,type:O.type,key:fe,ref:ve,props:_e,_owner:Ne}},ut.createContext=function(O){return O={$$typeof:l,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:s,_context:O},O.Consumer=O},ut.createElement=S,ut.createFactory=function(O){var Y=S.bind(null,O);return Y.type=O,Y},ut.createRef=function(){return{current:null}},ut.forwardRef=function(O){return{$$typeof:c,render:O}},ut.isValidElement=U,ut.lazy=function(O){return{$$typeof:p,_payload:{_status:-1,_result:O},_init:te}},ut.memo=function(O,Y){return{$$typeof:h,type:O,compare:Y===void 0?null:Y}},ut.startTransition=function(O){var Y=$.transition;$.transition={};try{O()}finally{$.transition=Y}},ut.unstable_act=W,ut.useCallback=function(O,Y){return ie.current.useCallback(O,Y)},ut.useContext=function(O){return ie.current.useContext(O)},ut.useDebugValue=function(){},ut.useDeferredValue=function(O){return ie.current.useDeferredValue(O)},ut.useEffect=function(O,Y){return ie.current.useEffect(O,Y)},ut.useId=function(){return ie.current.useId()},ut.useImperativeHandle=function(O,Y,ae){return ie.current.useImperativeHandle(O,Y,ae)},ut.useInsertionEffect=function(O,Y){return ie.current.useInsertionEffect(O,Y)},ut.useLayoutEffect=function(O,Y){return ie.current.useLayoutEffect(O,Y)},ut.useMemo=function(O,Y){return ie.current.useMemo(O,Y)},ut.useReducer=function(O,Y,ae){return ie.current.useReducer(O,Y,ae)},ut.useRef=function(O){return ie.current.useRef(O)},ut.useState=function(O){return ie.current.useState(O)},ut.useSyncExternalStore=function(O,Y,ae){return ie.current.useSyncExternalStore(O,Y,ae)},ut.useTransition=function(){return ie.current.useTransition()},ut.version="18.3.1",ut}var cw;function Kd(){return cw||(cw=1,Eg.exports=hR()),Eg.exports}var dw;function pR(){if(dw)return Oc;dw=1;var t=Kd(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(c,u,h){var p,m={},v=null,y=null;h!==void 0&&(v=""+h),u.key!==void 0&&(v=""+u.key),u.ref!==void 0&&(y=u.ref);for(p in u)a.call(u,p)&&!s.hasOwnProperty(p)&&(m[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)m[p]===void 0&&(m[p]=u[p]);return{$$typeof:e,type:c,key:v,ref:y,props:m,_owner:r.current}}return Oc.Fragment=n,Oc.jsx=l,Oc.jsxs=l,Oc}var uw;function fR(){return uw||(uw=1,Tg.exports=pR()),Tg.exports}var R=fR(),k=Kd();const Cl=NS(k),OS=dR({__proto__:null,default:Cl},[k]);var hh={},Ag={exports:{}},ga={},Rg={exports:{}},Lg={};var hw;function mR(){return hw||(hw=1,(function(t){function e($,X){var W=$.length;$.push(X);e:for(;0<W;){var O=W-1>>>1,Y=$[O];if(0<r(Y,X))$[O]=X,$[W]=Y,W=O;else break e}}function n($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var X=$[0],W=$.pop();if(W!==X){$[0]=W;e:for(var O=0,Y=$.length,ae=Y>>>1;O<ae;){var _e=2*(O+1)-1,fe=$[_e],ve=_e+1,Ne=$[ve];if(0>r(fe,W))ve<Y&&0>r(Ne,fe)?($[O]=Ne,$[ve]=W,O=ve):($[O]=fe,$[_e]=W,O=_e);else if(ve<Y&&0>r(Ne,W))$[O]=Ne,$[ve]=W,O=ve;else break e}}return X}function r($,X){var W=$.sortIndex-X.sortIndex;return W!==0?W:$.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var u=[],h=[],p=1,m=null,v=3,y=!1,b=!1,x=!1,P=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E($){for(var X=n(h);X!==null;){if(X.callback===null)a(h);else if(X.startTime<=$)a(h),X.sortIndex=X.expirationTime,e(u,X);else break;X=n(h)}}function A($){if(x=!1,E($),!b)if(n(u)!==null)b=!0,te(D);else{var X=n(h);X!==null&&ie(A,X.startTime-$)}}function D($,X){b=!1,x&&(x=!1,T(S),S=-1),y=!0;var W=v;try{for(E(X),m=n(u);m!==null&&(!(m.expirationTime>X)||$&&!Q());){var O=m.callback;if(typeof O=="function"){m.callback=null,v=m.priorityLevel;var Y=O(m.expirationTime<=X);X=t.unstable_now(),typeof Y=="function"?m.callback=Y:m===n(u)&&a(u),E(X)}else a(u);m=n(u)}if(m!==null)var ae=!0;else{var _e=n(h);_e!==null&&ie(A,_e.startTime-X),ae=!1}return ae}finally{m=null,v=W,y=!1}}var B=!1,j=null,S=-1,N=5,U=-1;function Q(){return!(t.unstable_now()-U<N)}function ee(){if(j!==null){var $=t.unstable_now();U=$;var X=!0;try{X=j(!0,$)}finally{X?ce():(B=!1,j=null)}}else B=!1}var ce;if(typeof L=="function")ce=function(){L(ee)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,re=le.port2;le.port1.onmessage=ee,ce=function(){re.postMessage(null)}}else ce=function(){P(ee,0)};function te($){j=$,B||(B=!0,ce())}function ie($,X){S=P(function(){$(t.unstable_now())},X)}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($){$.callback=null},t.unstable_continueExecution=function(){b||y||(b=!0,te(D))},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function($){switch(v){case 1:case 2:case 3:var X=3;break;default:X=v}var W=v;v=X;try{return $()}finally{v=W}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function($,X){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var W=v;v=$;try{return X()}finally{v=W}},t.unstable_scheduleCallback=function($,X,W){var O=t.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?O+W:O):W=O,$){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=W+Y,$={id:p++,callback:X,priorityLevel:$,startTime:W,expirationTime:Y,sortIndex:-1},W>O?($.sortIndex=W,e(h,$),n(u)===null&&$===n(h)&&(x?(T(S),S=-1):x=!0,ie(A,W-O))):($.sortIndex=Y,e(u,$),b||y||(b=!0,te(D))),$},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function($){var X=v;return function(){var W=v;v=X;try{return $.apply(this,arguments)}finally{v=W}}}})(Lg)),Lg}var pw;function gR(){return pw||(pw=1,Rg.exports=mR()),Rg.exports}var fw;function vR(){if(fw)return ga;fw=1;var t=Kd(),e=gR();function n(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,r={};function s(i,o){l(i,o),l(i+"Capture",o)}function l(i,o){for(r[i]=o,i=0;i<o.length;i++)a.add(o[i])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[: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]*$/,p={},m={};function v(i){return u.call(m,i)?!0:u.call(p,i)?!1:h.test(i)?m[i]=!0:(p[i]=!0,!1)}function y(i,o,d,f){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return f?!1:d!==null?!d.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,o,d,f){if(o===null||typeof o>"u"||y(i,o,d,f))return!0;if(f)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function x(i,o,d,f,g,_,C){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=f,this.attributeNamespace=g,this.mustUseProperty=d,this.propertyName=i,this.type=o,this.sanitizeURL=_,this.removeEmptyString=C}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){P[i]=new x(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];P[o]=new x(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){P[i]=new x(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){P[i]=new x(i,2,!1,i,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(i){P[i]=new x(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){P[i]=new x(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){P[i]=new x(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){P[i]=new x(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){P[i]=new x(i,5,!1,i.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function L(i){return i[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(i){var o=i.replace(T,L);P[o]=new x(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(T,L);P[o]=new x(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(T,L);P[o]=new x(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){P[i]=new x(i,1,!1,i.toLowerCase(),null,!1,!1)}),P.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){P[i]=new x(i,1,!1,i.toLowerCase(),null,!0,!0)});function E(i,o,d,f){var g=P.hasOwnProperty(o)?P[o]:null;(g!==null?g.type!==0:f||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(b(o,d,g,f)&&(d=null),f||g===null?v(o)&&(d===null?i.removeAttribute(o):i.setAttribute(o,""+d)):g.mustUseProperty?i[g.propertyName]=d===null?g.type===3?!1:"":d:(o=g.attributeName,f=g.attributeNamespace,d===null?i.removeAttribute(o):(g=g.type,d=g===3||g===4&&d===!0?"":""+d,f?i.setAttributeNS(f,o,d):i.setAttribute(o,d))))}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),B=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),Q=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),$=Symbol.iterator;function X(i){return i===null||typeof i!="object"?null:(i=$&&i[$]||i["@@iterator"],typeof i=="function"?i:null)}var W=Object.assign,O;function Y(i){if(O===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);O=o&&o[1]||""}return`
|
|
3
3
|
`+O+i}var ae=!1;function _e(i,o){if(!i||ae)return"";ae=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(J){var f=J}Reflect.construct(i,[],o)}else{try{o.call()}catch(J){f=J}i.call(o.prototype)}else{try{throw Error()}catch(J){f=J}i()}}catch(J){if(J&&f&&typeof J.stack=="string"){for(var g=J.stack.split(`
|
|
4
4
|
`),_=f.stack.split(`
|
|
@@ -39,7 +39,7 @@ Please change the parent <Route path="${P}"> to <Route path="${P==="/"?"*":`${P}
|
|
|
39
39
|
`))}logResponse(t,e,n,a,r){if(!this.enabled)return;const s=[`← ${t} ${e} ${n} (${a}ms)`],l=mx(pd(r));if(l){const c=l.length>1e3?l.slice(0,1e3)+"... [truncated]":l;s.push(` Body: ${c}`)}n>=400?this.error(s.join(`
|
|
40
40
|
`)):this.log(s.join(`
|
|
41
41
|
`))}},l0="insforge_csrf_token";function aC(){if(typeof document>"u")return null;const t=document.cookie.split(";").find(e=>e.trim().startsWith(`${l0}=`));return t&&t.split("=")[1]||null}function rC(t){if(typeof document>"u")return;const e=10080*60,n=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${l0}=${encodeURIComponent(t)}; path=/; max-age=${e}; SameSite=Lax${n}`}function iC(){if(typeof document>"u")return;const t=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${l0}=; path=/; max-age=0; SameSite=Lax${t}`}var sC=class{constructor(){this.accessToken=null,this.user=null,this.onTokenChange=null}saveSession(t){const e=t.accessToken!==this.accessToken;this.accessToken=t.accessToken,this.user=t.user,e&&this.onTokenChange&&this.onTokenChange()}getSession(){return!this.accessToken||!this.user?null:{accessToken:this.accessToken,user:this.user}}getAccessToken(){return this.accessToken}setAccessToken(t){const e=t!==this.accessToken;this.accessToken=t,e&&this.onTokenChange&&this.onTokenChange()}getUser(){return this.user}setUser(t){this.user=t}clearSession(){const t=this.accessToken!==null;this.accessToken=null,this.user=null,t&&this.onTokenChange&&this.onTokenChange()}},JM=new Set([500,502,503,504]),QM=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),XM=class{constructor(t,e,n){if(this.userToken=null,this.autoRefreshToken=!0,this.isRefreshing=!1,this.refreshPromise=null,this.refreshToken=null,this.baseUrl=t.baseUrl||"http://localhost:7130",this.autoRefreshToken=t.autoRefreshToken??!0,this.fetch=t.fetch||(globalThis.fetch?globalThis.fetch.bind(globalThis):void 0),this.anonKey=t.anonKey,this.defaultHeaders={...t.headers},this.tokenManager=e??new sC,this.logger=n||new nC(!1),this.timeout=t.timeout??3e4,this.retryCount=t.retryCount??3,this.retryDelay=t.retryDelay??500,!this.fetch)throw new Error("Fetch is not available. Please provide a fetch implementation in the config.")}buildUrl(t,e){const n=new URL(t,this.baseUrl);return e&&Object.entries(e).forEach(([a,r])=>{if(a==="select"){let s=r.replace(/\s+/g," ").trim();s=s.replace(/\s*\(\s*/g,"(").replace(/\s*\)\s*/g,")").replace(/\(\s+/g,"(").replace(/\s+\)/g,")").replace(/,\s+(?=[^()]*\))/g,","),n.searchParams.append(a,s)}else n.searchParams.append(a,r)}),n.toString()}isRetryableStatus(t){return JM.has(t)}computeRetryDelay(t){const n=this.retryDelay*Math.pow(2,t-1)*(.85+Math.random()*.3);return Math.round(n)}async handleRequest(t,e,n={}){const{params:a,headers:r={},body:s,signal:l,...c}=n,u=this.buildUrl(e,a),h=Date.now(),m=QM.has(t.toUpperCase())||n.idempotent===!0?this.retryCount:0,v={...this.defaultHeaders},y=this.userToken||this.anonKey;y&&(v.Authorization=`Bearer ${y}`);let b;s!==void 0&&(typeof FormData<"u"&&s instanceof FormData?b=s:(t!=="GET"&&(v["Content-Type"]="application/json;charset=UTF-8"),b=JSON.stringify(s))),r instanceof Headers?r.forEach((P,T)=>{v[T]=P}):Array.isArray(r)?r.forEach(([P,T])=>{v[P]=T}):Object.assign(v,r),this.logger.logRequest(t,u,v,b);let x;for(let P=0;P<=m;P++){if(P>0){const E=this.computeRetryDelay(P);if(this.logger.warn(`Retry ${P}/${m} for ${t} ${u} in ${E}ms`),l?.aborted)throw l.reason;await new Promise((A,D)=>{const B=()=>{clearTimeout(j),D(l.reason)},j=setTimeout(()=>{l&&l.removeEventListener("abort",B),A()},E);l&&l.addEventListener("abort",B,{once:!0})})}let T,L;if((this.timeout>0||l)&&(T=new AbortController,this.timeout>0&&(L=setTimeout(()=>T.abort(),this.timeout)),l))if(l.aborted)T.abort(l.reason);else{const E=()=>T.abort(l.reason);l.addEventListener("abort",E,{once:!0}),T.signal.addEventListener("abort",()=>{l.removeEventListener("abort",E)},{once:!0})}try{const E=await this.fetch(u,{method:t,headers:v,body:b,...c,...T?{signal:T.signal}:{}});if(this.isRetryableStatus(E.status)&&P<m){L!==void 0&&clearTimeout(L),await E.body?.cancel(),x=new rt(`Server error: ${E.status} ${E.statusText}`,E.status,"SERVER_ERROR");continue}if(E.status===204){L!==void 0&&clearTimeout(L);return}let A;const D=E.headers.get("content-type");try{D?.includes("json")?A=await E.json():A=await E.text()}catch(B){throw L!==void 0&&clearTimeout(L),new rt(`Failed to parse response body: ${B?.message||"Unknown error"}`,E.status,E.ok?"PARSE_ERROR":"REQUEST_FAILED")}if(L!==void 0&&clearTimeout(L),!E.ok){if(this.logger.logResponse(t,u,E.status,Date.now()-h,A),A&&typeof A=="object"&&"error"in A){!A.statusCode&&!A.status&&(A.statusCode=E.status);const B=rt.fromApiError(A);throw Object.keys(A).forEach(j=>{j!=="error"&&j!=="message"&&j!=="statusCode"&&(B[j]=A[j])}),B}throw new rt(`Request failed: ${E.statusText}`,E.status,"REQUEST_FAILED")}return this.logger.logResponse(t,u,E.status,Date.now()-h,A),A}catch(E){if(L!==void 0&&clearTimeout(L),E?.name==="AbortError")throw T&&T.signal.aborted&&this.timeout>0&&!l?.aborted?new rt(`Request timed out after ${this.timeout}ms`,408,"REQUEST_TIMEOUT"):E;if(E instanceof rt)throw E;if(P<m){x=E;continue}throw new rt(`Network request failed: ${E?.message||"Unknown error"}`,0,"NETWORK_ERROR")}}throw x||new rt("Request failed after all retry attempts",0,"NETWORK_ERROR")}async request(t,e,n={}){try{return await this.handleRequest(t,e,{...n})}catch(a){if(a instanceof rt&&a.statusCode===401&&a.error==="INVALID_TOKEN"&&this.autoRefreshToken)try{const r=await this.handleTokenRefresh();return this.setAuthToken(r.accessToken),this.tokenManager.saveSession(r),r.csrfToken&&rC(r.csrfToken),r.refreshToken&&this.setRefreshToken(r.refreshToken),await this.handleRequest(t,e,{...n})}catch(r){throw this.tokenManager.clearSession(),this.userToken=null,this.refreshToken=null,iC(),r}throw a}}get(t,e){return this.request("GET",t,e)}post(t,e,n){return this.request("POST",t,{...n,body:e})}put(t,e,n){return this.request("PUT",t,{...n,body:e})}patch(t,e,n){return this.request("PATCH",t,{...n,body:e})}delete(t,e){return this.request("DELETE",t,e)}setAuthToken(t){this.userToken=t}setRefreshToken(t){this.refreshToken=t}getHeaders(){const t={...this.defaultHeaders},e=this.userToken||this.anonKey;return e&&(t.Authorization=`Bearer ${e}`),t}async handleTokenRefresh(){return this.isRefreshing?this.refreshPromise:(this.isRefreshing=!0,this.refreshPromise=(async()=>{try{const t=aC(),e=this.refreshToken?{refreshToken:this.refreshToken}:void 0;return await this.handleRequest("POST","/api/auth/sessions/current",{body:e,headers:t?{"X-CSRF-Token":t}:{},credentials:"include"})}finally{this.isRefreshing=!1,this.refreshPromise=null}})(),this.refreshPromise)}},p_="insforge_pkce_verifier";function oC(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function e7(){const t=new Uint8Array(32);return crypto.getRandomValues(t),oC(t)}async function t7(t){const n=new TextEncoder().encode(t),a=await crypto.subtle.digest("SHA-256",n);return oC(new Uint8Array(a))}function n7(t){typeof sessionStorage<"u"&&sessionStorage.setItem(p_,t)}function a7(){if(typeof sessionStorage>"u")return null;const t=sessionStorage.getItem(p_);return t&&sessionStorage.removeItem(p_),t}function Ea(t,e){return t instanceof rt?{data:null,error:t}:{data:null,error:new rt(t instanceof Error?t.message:e,500,"UNEXPECTED_ERROR")}}function gx(...t){if(typeof window>"u")return;const e=new URL(window.location.href);t.forEach(n=>e.searchParams.delete(n)),window.history.replaceState({},document.title,e.toString())}var r7=class{constructor(t,e,n={}){this.http=t,this.tokenManager=e,this.options=n,this.authCallbackHandled=this.detectAuthCallback()}isServerMode(){return!!this.options.isServerMode}saveSessionFromResponse(t){if(!t.accessToken||!t.user)return!1;const e={accessToken:t.accessToken,user:t.user};return!this.isServerMode()&&t.csrfToken&&rC(t.csrfToken),this.isServerMode()||this.tokenManager.saveSession(e),this.http.setAuthToken(t.accessToken),this.http.setRefreshToken(t.refreshToken??null),!0}async detectAuthCallback(){if(!(this.isServerMode()||typeof window>"u"))try{const t=new URLSearchParams(window.location.search),e=t.get("error");if(e){gx("error"),console.debug("OAuth callback error:",e);return}const n=t.get("insforge_code");if(n){gx("insforge_code");const{error:a}=await this.exchangeOAuthCode(n);a&&console.debug("OAuth code exchange failed:",a.message);return}}catch(t){console.debug("OAuth callback detection skipped:",t)}}async signUp(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/users?client_type=mobile":"/api/auth/users",t,{credentials:"include"});return e.accessToken&&e.user&&this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Ea(e,"An unexpected error occurred during sign up")}}async signInWithPassword(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/sessions?client_type=mobile":"/api/auth/sessions",t,{credentials:"include"});return this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Ea(e,"An unexpected error occurred during sign in")}}async signOut(){try{try{await this.http.post(this.isServerMode()?"/api/auth/logout?client_type=mobile":"/api/auth/logout",void 0,{credentials:"include"})}catch{}return this.tokenManager.clearSession(),this.http.setAuthToken(null),this.http.setRefreshToken(null),this.isServerMode()||iC(),{error:null}}catch{return{error:new rt("Failed to sign out",500,"SIGNOUT_ERROR")}}}async signInWithOAuth(t){try{const{provider:e,redirectTo:n,skipBrowserRedirect:a}=t,r=encodeURIComponent(e.toLowerCase()),s=e7(),l=await t7(s);n7(s);const c={code_challenge:l};n&&(c.redirect_uri=n);const h=Rf.options.includes(r)?`/api/auth/oauth/${r}`:`/api/auth/oauth/custom/${r}`,p=await this.http.get(h,{params:c});return!this.isServerMode()&&typeof window<"u"&&!a?(window.location.href=p.authUrl,{data:{},error:null}):{data:{url:p.authUrl,provider:r,codeVerifier:s},error:null}}catch(e){return e instanceof rt?{data:{},error:e}:{data:{},error:new rt("An unexpected error occurred during OAuth initialization",500,"UNEXPECTED_ERROR")}}}async exchangeOAuthCode(t,e){try{const n=e??a7();if(!n)return{data:null,error:new rt("PKCE code verifier not found. Ensure signInWithOAuth was called in the same browser session.",400,"PKCE_VERIFIER_MISSING")};const a={code:t,code_verifier:n},r=await this.http.post(this.isServerMode()?"/api/auth/oauth/exchange?client_type=mobile":"/api/auth/oauth/exchange",a,{credentials:"include"});return this.saveSessionFromResponse(r),{data:r,error:null}}catch(n){return Ea(n,"An unexpected error occurred during OAuth code exchange")}}async signInWithIdToken(t){try{const{provider:e,token:n}=t,a=await this.http.post("/api/auth/id-token?client_type=mobile",{provider:e,token:n},{credentials:"include"});return this.saveSessionFromResponse(a),a.refreshToken&&this.http.setRefreshToken(a.refreshToken),{data:a,error:null}}catch(e){return Ea(e,"An unexpected error occurred during ID token sign in")}}async refreshSession(t){try{if(this.isServerMode()&&!t?.refreshToken)return{data:null,error:new rt("refreshToken is required when refreshing session in server mode",400,"REFRESH_TOKEN_REQUIRED")};const e=this.isServerMode()?null:aC(),n=await this.http.post(this.isServerMode()?"/api/auth/refresh?client_type=mobile":"/api/auth/refresh",this.isServerMode()?{refresh_token:t?.refreshToken}:void 0,{headers:e?{"X-CSRF-Token":e}:{},credentials:"include"});return n.accessToken&&this.saveSessionFromResponse(n),{data:n,error:null}}catch(e){return Ea(e,"An unexpected error occurred during session refresh")}}async getCurrentUser(){await this.authCallbackHandled;try{if(this.isServerMode()){const e=this.tokenManager.getAccessToken();return e?(this.http.setAuthToken(e),{data:{user:(await this.http.get("/api/auth/sessions/current")).user??null},error:null}):{data:{user:null},error:null}}const t=this.tokenManager.getSession();if(t)return this.http.setAuthToken(t.accessToken),{data:{user:t.user},error:null};if(typeof window<"u"){const{data:e,error:n}=await this.refreshSession();if(n)return{data:{user:null},error:n};if(e?.accessToken)return{data:{user:e.user??null},error:null}}return{data:{user:null},error:null}}catch(t){return t instanceof rt?{data:{user:null},error:t}:{data:{user:null},error:new rt("An unexpected error occurred while getting user",500,"UNEXPECTED_ERROR")}}}async getProfile(t){try{return{data:await this.http.get(`/api/auth/profiles/${t}`),error:null}}catch(e){return Ea(e,"An unexpected error occurred while fetching user profile")}}async setProfile(t){try{const e=await this.http.patch("/api/auth/profiles/current",{profile:t}),n=this.tokenManager.getUser();return!this.isServerMode()&&n&&e.profile!==void 0&&this.tokenManager.setUser({...n,profile:e.profile}),{data:e,error:null}}catch(e){return Ea(e,"An unexpected error occurred while updating user profile")}}async resendVerificationEmail(t){try{return{data:await this.http.post("/api/auth/email/send-verification",t),error:null}}catch(e){return Ea(e,"An unexpected error occurred while sending verification email")}}async verifyEmail(t){try{const e=await this.http.post(this.isServerMode()?"/api/auth/email/verify?client_type=mobile":"/api/auth/email/verify",t,{credentials:"include"});return this.saveSessionFromResponse(e),e.refreshToken&&this.http.setRefreshToken(e.refreshToken),{data:e,error:null}}catch(e){return Ea(e,"An unexpected error occurred while verifying email")}}async sendResetPasswordEmail(t){try{return{data:await this.http.post("/api/auth/email/send-reset-password",t),error:null}}catch(e){return Ea(e,"An unexpected error occurred while sending password reset email")}}async exchangeResetPasswordToken(t){try{return{data:await this.http.post("/api/auth/email/exchange-reset-password-token",t),error:null}}catch(e){return Ea(e,"An unexpected error occurred while verifying reset code")}}async resetPassword(t){try{return{data:await this.http.post("/api/auth/email/reset-password",t),error:null}}catch(e){return Ea(e,"An unexpected error occurred while resetting password")}}async getPublicAuthConfig(){try{return{data:await this.http.get("/api/auth/public-config"),error:null}}catch(t){return Ea(t,"An unexpected error occurred while fetching auth configuration")}}};function i7(t,e){return async(n,a)=>{const r=typeof n=="string"?n:n.toString(),s=new URL(r),l=s.pathname.slice(1),c=l.match(/^rpc\/(.+)$/),u=c?`/api/database/rpc/${c[1]}`:`/api/database/records/${l}`,h=`${t.baseUrl}${u}${s.search}`,p=e.getAccessToken(),m=t.getHeaders(),v=p||m.Authorization?.replace("Bearer ",""),y=new Headers(a?.headers);return v&&!y.has("Authorization")&&y.set("Authorization",`Bearer ${v}`),await fetch(h,{...a,headers:y})}}var s7=class{constructor(t,e){this.postgrest=new eM("http://dummy",{fetch:i7(t,e),headers:{}})}from(t){return this.postgrest.from(t)}rpc(t,e,n){return this.postgrest.rpc(t,e,n)}},o7=class{constructor(t,e){this.bucketName=t,this.http=e}async upload(t,e){try{const n=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:t,contentType:e.type||"application/octet-stream",size:e.size});if(n.method==="presigned")return await this.uploadWithPresignedUrl(n,e);if(n.method==="direct"){const a=new FormData;return a.append("file",e),{data:await this.http.request("PUT",`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`,{body:a,headers:{}}),error:null}}throw new rt(`Unsupported upload method: ${n.method}`,500,"STORAGE_ERROR")}catch(n){return{data:null,error:n instanceof rt?n:new rt("Upload failed",500,"STORAGE_ERROR")}}}async uploadAuto(t){try{const e=t instanceof File?t.name:"file",n=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:e,contentType:t.type||"application/octet-stream",size:t.size});if(n.method==="presigned")return await this.uploadWithPresignedUrl(n,t);if(n.method==="direct"){const a=new FormData;return a.append("file",t),{data:await this.http.request("POST",`/api/storage/buckets/${this.bucketName}/objects`,{body:a,headers:{}}),error:null}}throw new rt(`Unsupported upload method: ${n.method}`,500,"STORAGE_ERROR")}catch(e){return{data:null,error:e instanceof rt?e:new rt("Upload failed",500,"STORAGE_ERROR")}}}async uploadWithPresignedUrl(t,e){try{const n=new FormData;t.fields&&Object.entries(t.fields).forEach(([r,s])=>{n.append(r,s)}),n.append("file",e);const a=await fetch(t.uploadUrl,{method:"POST",body:n});if(!a.ok)throw new rt(`Upload to storage failed: ${a.statusText}`,a.status,"STORAGE_ERROR");return t.confirmRequired&&t.confirmUrl?{data:await this.http.post(t.confirmUrl,{size:e.size,contentType:e.type||"application/octet-stream"}),error:null}:{data:{key:t.key,bucket:this.bucketName,size:e.size,mimeType:e.type||"application/octet-stream",uploadedAt:new Date().toISOString(),url:this.getPublicUrl(t.key)},error:null}}catch(n){throw n instanceof rt?n:new rt("Presigned upload failed",500,"STORAGE_ERROR")}}async download(t){try{const e=await this.http.post(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}/download-strategy`,{expiresIn:3600}),n=e.url,a={};e.method==="direct"&&Object.assign(a,this.http.getHeaders());const r=await fetch(n,{method:"GET",headers:a});if(!r.ok)try{const l=await r.json();throw rt.fromApiError(l)}catch{throw new rt(`Download failed: ${r.statusText}`,r.status,"STORAGE_ERROR")}return{data:await r.blob(),error:null}}catch(e){return{data:null,error:e instanceof rt?e:new rt("Download failed",500,"STORAGE_ERROR")}}}getPublicUrl(t){return`${this.http.baseUrl}/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`}async list(t){try{const e={};return t?.prefix&&(e.prefix=t.prefix),t?.search&&(e.search=t.search),t?.limit&&(e.limit=t.limit.toString()),t?.offset&&(e.offset=t.offset.toString()),{data:await this.http.get(`/api/storage/buckets/${this.bucketName}/objects`,{params:e}),error:null}}catch(e){return{data:null,error:e instanceof rt?e:new rt("List failed",500,"STORAGE_ERROR")}}}async remove(t){try{return{data:await this.http.delete(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(t)}`),error:null}}catch(e){return{data:null,error:e instanceof rt?e:new rt("Delete failed",500,"STORAGE_ERROR")}}}},l7=class{constructor(t){this.http=t}from(t){return new o7(t,this.http)}},c7=class{constructor(t){this.http=t,this.chat=new d7(t),this.images=new p7(t),this.embeddings=new h7(t)}},d7=class{constructor(t){this.completions=new u7(t)}},u7=class{constructor(t){this.http=t}async create(t){const e={model:t.model,messages:t.messages,temperature:t.temperature,maxTokens:t.maxTokens,topP:t.topP,stream:t.stream,webSearch:t.webSearch,fileParser:t.fileParser,thinking:t.thinking,tools:t.tools,toolChoice:t.toolChoice,parallelToolCalls:t.parallelToolCalls};if(t.stream){const r=this.http.getHeaders();r["Content-Type"]="application/json";const s=await this.http.fetch(`${this.http.baseUrl}/api/ai/chat/completion`,{method:"POST",headers:r,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw new Error(l.error||"Stream request failed")}return this.parseSSEStream(s,t.model)}const n=await this.http.post("/api/ai/chat/completion",e),a=n.text||"";return{id:`chatcmpl-${Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:n.metadata?.model,choices:[{index:0,message:{role:"assistant",content:a,...n.tool_calls?.length&&{tool_calls:n.tool_calls},...n.annotations?.length&&{annotations:n.annotations}},finish_reason:n.tool_calls?.length?"tool_calls":"stop"}],usage:n.metadata?.usage||{prompt_tokens:0,completion_tokens:0,total_tokens:0}}}async*parseSSEStream(t,e){const n=t.body.getReader(),a=new TextDecoder;let r="";try{for(;;){const{done:s,value:l}=await n.read();if(s)break;r+=a.decode(l,{stream:!0});const c=r.split(`
|
|
42
|
-
`);r=c.pop()||"";for(const u of c)if(u.startsWith("data: ")){const h=u.slice(6).trim();if(h)try{const p=JSON.parse(h);if((p.chunk||p.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{content:p.chunk||p.content},finish_reason:null}]}),p.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{tool_calls:p.tool_calls},finish_reason:"tool_calls"}]}),p.done){n.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",h)}}}}finally{n.releaseLock()}}},h7=class{constructor(t){this.http=t}async create(t){const e=await this.http.post("/api/ai/embeddings",t);return{object:e.object,data:e.data,model:e.metadata?.model,usage:e.metadata?.usage?{prompt_tokens:e.metadata.usage.promptTokens||0,total_tokens:e.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},p7=class{constructor(t){this.http=t}async generate(t){const e=await this.http.post("/api/ai/image/generation",t);let n=[];return e.images&&e.images.length>0?n=e.images.map(a=>({b64_json:a.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:e.text})):e.text&&(n=[{content:e.text}]),{created:Math.floor(Date.now()/1e3),data:n,...e.metadata?.usage&&{usage:{total_tokens:e.metadata.usage.totalTokens||0,input_tokens:e.metadata.usage.promptTokens||0,output_tokens:e.metadata.usage.completionTokens||0}}}}},f7=class lC{constructor(e,n){this.http=e,this.functionsUrl=n||lC.deriveSubhostingUrl(e.baseUrl)}static deriveSubhostingUrl(e){try{const{hostname:n}=new URL(e);return n.endsWith(".insforge.app")?`https://${n.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(e,n={}){const{method:a="POST",body:r,headers:s={}}=n;if(this.functionsUrl)try{return{data:await this.http.request(a,`${this.functionsUrl}/${e}`,{body:r,headers:s}),error:null}}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l;if(!(l instanceof rt&&l.statusCode===404))return{data:null,error:l instanceof rt?l:new rt(l instanceof Error?l.message:"Function invocation failed",500,"FUNCTION_ERROR")}}try{const l=`/functions/${e}`;return{data:await this.http.request(a,l,{body:r,headers:s}),error:null}}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l;return{data:null,error:l instanceof rt?l:new rt(l instanceof Error?l.message:"Function invocation failed",500,"FUNCTION_ERROR")}}}},vx=1e4,m7=class{constructor(t,e,n){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=t,this.tokenManager=e,this.anonKey=n,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(t,e){const n=this.eventListeners.get(t);if(n)for(const a of n)try{a(e)}catch(r){console.error(`Error in ${t} callback:`,r)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((t,e)=>{const n=this.tokenManager.getAccessToken()??this.anonKey;this.socket=Xh(this.baseUrl,{transports:["websocket"],auth:n?{token:n}:void 0});let a=!0,r=null;const s=()=>{r&&(clearTimeout(r),r=null)};r=setTimeout(()=>{a&&(a=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,e(new Error(`Connection timeout after ${vx}ms`)))},vx),this.socket.on("connect",()=>{s();for(const l of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:l});this.notifyListeners("connect"),a&&(a=!1,this.connectPromise=null,t())}),this.socket.on("connect_error",l=>{s(),this.notifyListeners("connect_error",l),a&&(a=!1,this.connectPromise=null,e(l))}),this.socket.on("disconnect",l=>{this.notifyListeners("disconnect",l)}),this.socket.on("realtime:error",l=>{this.notifyListeners("error",l)}),this.socket.onAny((l,c)=>{l!=="realtime:error"&&this.notifyListeners(l,c)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const t=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=t?{token:t}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(t){if(this.subscribedChannels.has(t))return{ok:!0,channel:t};if(!this.socket?.connected)try{await this.connect()}catch(e){const n=e instanceof Error?e.message:"Connection failed";return{ok:!1,channel:t,error:{code:"CONNECTION_FAILED",message:n}}}return new Promise(e=>{this.socket.emit("realtime:subscribe",{channel:t},n=>{n.ok&&this.subscribedChannels.add(t),e(n)})})}unsubscribe(t){this.subscribedChannels.delete(t),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:t})}async publish(t,e,n){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:t,event:e,payload:n})}on(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,new Set),this.eventListeners.get(t).add(e)}off(t,e){const n=this.eventListeners.get(t);n&&(n.delete(e),n.size===0&&this.eventListeners.delete(t))}once(t,e){const n=a=>{this.off(t,n),e(a)};this.on(t,n)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},g7=class{constructor(t){this.http=t}async send(t){try{return{data:await this.http.post("/api/email/send-raw",t),error:null}}catch(e){if(e instanceof Error&&e.name==="AbortError")throw e;return{data:null,error:e instanceof rt?e:new rt(e instanceof Error?e.message:"Email send failed",500,"EMAIL_ERROR")}}}},v7=class{constructor(t={}){const e=new nC(t.debug);this.tokenManager=new sC,this.http=new XM(t,this.tokenManager,e),t.edgeFunctionToken&&(this.http.setAuthToken(t.edgeFunctionToken),this.tokenManager.setAccessToken(t.edgeFunctionToken)),this.auth=new r7(this.http,this.tokenManager,{isServerMode:t.isServerMode??!1}),this.database=new s7(this.http,this.tokenManager),this.storage=new l7(this.http),this.ai=new c7(this.http),this.functions=new f7(this.http,t.functionsUrl),this.realtime=new m7(this.http.baseUrl,this.tokenManager,t.anonKey),this.emails=new g7(this.http)}getHttpClient(){return this.http}};function _7(t){return new v7(t)}const c0={VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"},cC="https://srctyff5.us-east.insforge.app",y7="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY";function Yr(){const t=typeof import.meta<"u"?c0:void 0;return(t?.VITE_INSFORGE_BASE_URL||t?.VITE_TOKENTRACKER_BACKEND_BASE_URL||cC).trim()}function dC(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return window.location.origin;const e=typeof import.meta<"u"?c0:void 0;return(e?.VITE_INSFORGE_BASE_URL||e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||cC).trim()}function Gl(){const t=typeof import.meta<"u"?c0:void 0;return(t?.VITE_INSFORGE_ANON_KEY||t?.VITE_TOKENTRACKER_BACKEND_ANON_KEY||y7).trim()}function f_(){return!!dC()}let $g=null;function b7(){return f_()?($g||($g=_7({baseUrl:dC(),anonKey:Gl()||void 0,autoRefreshToken:!0})),$g):null}const k7="modulepreload",w7=function(t){return"/"+t},_x={},In=function(e,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");r=u(n.map(h=>{if(h=w7(h),h in _x)return;_x[h]=!0;const p=h.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":k7,p||(v.as="script"),v.crossOrigin="",v.href=h,c&&v.setAttribute("nonce",c),document.head.appendChild(v),p)return new Promise((y,b)=>{v.addEventListener("load",y),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return r.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})},uC="tokentracker_cloud_sync_enabled",x7="tokentracker_cloud_device_session_v1",d0="tokentracker_cloud_last_sync_ts";let u0=null;function h0(){try{localStorage.removeItem(x7)}catch{}}function Rp(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Lp(){try{const t=localStorage.getItem(uC);return t===null||t===""?!1:t==="1"||t==="true"}catch{return!1}}function P7(t){try{localStorage.setItem(uC,t?"1":"0")}catch{}hC(t);try{typeof window<"u"&&window.dispatchEvent(new Event("tt.cloudSyncChanged"))}catch{}}async function hC(t){if(Rp())try{const{getLocalApiAuthHeaders:e}=await In(async()=>{const{getLocalApiAuthHeaders:a}=await Promise.resolve().then(()=>f9);return{getLocalApiAuthHeaders:a}},[]),n=await e();await fetch("/functions/tokentracker-cloud-sync-pref",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n},cache:"no-store",body:JSON.stringify({enabled:t})})}catch{}}function S7(){hC(Lp())}function pC(){return h0(),u0}function C7(t){u0=t,h0()}function fC(){u0=null;try{localStorage.removeItem(d0)}catch{}h0()}function T7(){try{const t=Number(localStorage.getItem(d0));return Number.isFinite(t)?t:0}catch{return 0}}function mC(t){try{localStorage.setItem(d0,String(t))}catch{}}function ss(t){if(typeof t!="string")return null;const e=t.trim();return e.length>0?e:null}function E7(t){const e=ss(t);if(!e)return null;const n=e.split(".");if(n.length<2)return null;const a=n[1];try{const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("utf8"),c=JSON.parse(s)?.exp;return typeof c!="number"||!Number.isFinite(c)||c<=0?null:Math.floor(c*1e3)}catch{return null}}function If(t){const e=ss(t);if(!e)return!1;const n=e.split(".");if(n.length!==3)return!1;try{for(let a=0;a<2;a++){const r=n[a];if(!/^[A-Za-z0-9_-]+$/.test(r))return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),l=typeof atob=="function"?atob(s):Buffer.from(s,"base64").toString("utf8");a===1&&JSON.parse(l)}return!0}catch{return!1}}function A7(t,e=3e4){const n=E7(t);return n?n<=Date.now()+Math.max(0,Number(e)||0):!1}async function R7(t){if(!t)return null;if(typeof t=="string")return ss(t);if(typeof t=="function")try{const e=await t();return ss(e)}catch{return null}if(typeof t=="object"){if(typeof t.getAccessToken=="function"){try{const e=await t.getAccessToken(),n=ss(e);if(n)return n}catch{}return ss(t.accessToken)}return null}return ss(t)}async function qK(t,e={}){const n=Math.max(1,Math.min(12,Math.floor(Number(e.maxAttempts)||8))),a=Math.max(20,Math.floor(Number(e.baseDelayMs)||50));for(let r=0;r<n;r++){const s=await R7(t);if(s)return s;r<n-1&&await new Promise(l=>setTimeout(l,a*(r+1)))}return null}function KK(t){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")||typeof t=="function"||t&&typeof t=="object"&&typeof t.getAccessToken=="function"?!0:!!ss(t)}function YK(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function ZK(t=new Date){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return 0;const n=e.getTimezoneOffset();return Number.isFinite(n)?-n:0}function gC(t){if(!Number.isFinite(t)||t===0)return"UTC";const e=t>=0?"+":"-",n=Math.abs(t),a=String(Math.floor(n/60)).padStart(2,"0"),r=String(n%60).padStart(2,"0");return`UTC${e}${a}:${r}`}function JK({timeZone:t,offsetMinutes:e}={}){const n=gC(e);return t&&t!=="UTC"?`${t} (${n})`:n}function QK({timeZone:t,offsetMinutes:e}={}){return Number.isFinite(e)?gC(e):t||"UTC"}function XK({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const a=n instanceof Date?n:new Date(n);if(!Number.isFinite(a.getTime()))return"";if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(a).reduce((p,m)=>(m.type&&m.value&&(p[m.type]=m.value),p),{}),c=l.year,u=l.month,h=l.day;if(c&&u&&h)return`${c}-${u}-${h}`}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(a.getTime()+e*6e4);return D7(r)}return I7(a)}function L7({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const a=n instanceof Date?n:new Date(n);if(!Number.isFinite(a.getTime()))return null;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(a).reduce((p,m)=>(m.type&&m.value&&(p[m.type]=m.value),p),{}),c=Number(l.year),u=Number(l.month),h=Number(l.day);if(Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(h))return{year:c,month:u,day:h}}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(a.getTime()+e*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}}return{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}}function eY({timeZone:t,offsetMinutes:e}={}){return t?`tz:${t}`:typeof e=="number"&&Number.isFinite(e)?`offset:${Math.trunc(e)}`:"utc"}function D7(t){const e=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),a=String(t.getUTCDate()).padStart(2,"0");return`${e}-${n}-${a}`}function I7(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${a}`}function Kt(t){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).toISOString().slice(0,10)}function Xr(t){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return"";const n=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${a}-${r}`}function M7(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const a=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const l=new Date(Date.UTC(a,r,s));return Number.isFinite(l.getTime())&&Kt(l)===e?l:null}function N7(t){if(!t)return"";const e=t.year,n=String(t.month).padStart(2,"0"),a=String(t.day).padStart(2,"0");return!e||!n||!a?"":`${e}-${n}-${a}`}function O7(t,{timeZone:e,offsetMinutes:n,now:a}={}){const r=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,s=L7({timeZone:e,offsetMinutes:n,date:r});if(!s){const u=Xr(new Date);return{from:u,to:u}}const l=N7(s),c=M7(l);if(!c)return{from:l,to:l};if(t==="day")return{from:l,to:l};if(t==="week"){const u=new Date(c),p=(u.getUTCDay()+6)%7;u.setUTCDate(u.getUTCDate()-p);const m=new Date(u);return m.setUTCDate(m.getUTCDate()+6),{from:Kt(u),to:Kt(m)}}if(t==="month"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1)),h=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()+1,0));return{from:Kt(u),to:Kt(h)}}if(t==="total"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()-23,1));return{from:Kt(u),to:l}}return O7("week")}function vC(){return typeof window>"u"?null:window.localStorage||null}function _C(){return typeof navigator>"u"?null:navigator.clipboard||null}function j7(){return typeof window>"u"?null:window.ClipboardItem||null}function fd(t,{storage:e}={}){const n=e??vC();if(!n||typeof n.getItem!="function")return null;try{return n.getItem(t)}catch{return null}}function md(t,e,{storage:n}={}){const a=n??vC();if(!a||typeof a.setItem!="function")return!1;try{return a.setItem(t,e),!0}catch{return!1}}async function tY(t,{clipboard:e}={}){const n=e??_C();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function nY(t,{clipboard:e}={}){const n=e??_C(),a=j7();if(!t||!n||typeof n.write!="function"||!a)return!1;try{const r=t.type||"image/png",s=t.type&&t.type!==r?t.slice(0,t.size,r):t.type?t:t.slice(0,t.size,r),l=new a({[r]:s});return await n.write([l]),!0}catch{return!1}}const Id="USD",p0=["USD","EUR","GBP","CNY","JPY","HKD"],yC={USD:{symbol:"$",labelKey:"settings.appearance.currency.opt.usd"},EUR:{symbol:"€",labelKey:"settings.appearance.currency.opt.eur"},GBP:{symbol:"£",labelKey:"settings.appearance.currency.opt.gbp"},CNY:{symbol:"¥",labelKey:"settings.appearance.currency.opt.cny"},JPY:{symbol:"¥",labelKey:"settings.appearance.currency.opt.jpy"},HKD:{symbol:"HK$",labelKey:"settings.appearance.currency.opt.hkd"}},f0={USD:1,EUR:.92,GBP:.79,CNY:7.2,JPY:155,HKD:7.8},bC="tokentracker-currency",kC="tokentracker-exchange-rates",wC="tokentracker-exchange-rate-source",xC="tokentracker-exchange-rate-fetched-at";function Dp(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function m0(t){if(typeof t!="string")return Id;const e=t.trim().toUpperCase();return p0.includes(e)?e:Id}function ep(t){const e=typeof t=="string"?t.trim().toUpperCase():Id;return yC[e]?.symbol??"$"}function aY(){return p0.map(t=>({code:t,...yC[t]}))}function z7(){return m0(fd(bC))}function F7(t){return md(bC,m0(t))}function PC(t){return t==="fetched"?"fetched":"default"}function U7(t){if(t==null)return null;try{const e=JSON.parse(String(t));if(!e||typeof e!="object")return null;const n={};for(const[a,r]of Object.entries(e)){const s=Number(r);Number.isFinite(s)&&s>0&&(n[a.toUpperCase()]=s)}return n}catch{return null}}function B7(){const t=U7(fd(kC)),e=fd(xC),n=e==null?NaN:Number(e),a=Number.isFinite(n)&&n>0?n:null,r=fd(wC),s=PC(r);return t&&Object.keys(t).length>0?{rates:{USD:1,...t},source:s,fetchedAt:a}:{rates:{...f0},source:"default",fetchedAt:null}}function $7(t){const{rates:e,source:n,fetchedAt:a}=t;if(!e||typeof e!="object")return!1;const r=md(kC,JSON.stringify(e)),s=md(wC,PC(n)),l=a?md(xC,String(a)):!0;return r&&s&&l}function Vg(t,e){if(e===Id)return 1;const n=t?.[e];if(Dp(n))return n;const a=f0[e];return Dp(a)?a:1}function SC(t){if(t==null)return"-";try{if(typeof t=="bigint")return new Intl.NumberFormat().format(t);if(typeof t=="number")return new Intl.NumberFormat().format(t);const e=String(t).trim();return/^[0-9]+$/.test(e)?new Intl.NumberFormat().format(BigInt(e)):e}catch{return String(t)}}function V7(t,{thousandSuffix:e="K",millionSuffix:n="M",billionSuffix:a="B",decimals:r=1}={}){const s=Number(String(t));if(!Number.isFinite(s))return"-";const l=s<0?"-":"",c=Math.abs(s),u=Math.max(0,Math.min(6,Math.floor(r)));if(c<1e3)return`${l}${String(c)}`;const h=(y,b)=>{const x=y.toFixed(u),P=Number(x).toString();return`${l}${P}${b}`},p=(y,b,x)=>{const P=y.toFixed(u),T=Number(P);return x&&T>=1e3?h(T/1e3,x):`${l}${T.toString()}${b}`};if(c>=1e9)return h(c/1e9,a);if(c>=1e6)return p(c/1e6,n,a);const m=c/1e3,v=Number(m.toFixed(u));return v>=1e3?h(v/1e3,n):h(v,e)}function CC(t){const e=Number(String(t));return Number.isFinite(e)?e:null}function rY(t,e={}){const{decimals:n=2,currency:a="USD",rate:r=1}=e;if(t==null||typeof t=="string"&&t.trim()==="")return"-";let s;if(typeof t=="number")s=t;else if(typeof t=="bigint")s=Number(t);else{const P=String(t).trim(),T=Number(P);if(!Number.isFinite(T))return P;s=T}if(!Number.isFinite(s))return String(t);const l=ep(a);a!=="USD"&&typeof r=="number"&&Number.isFinite(r)&&r>0&&(s=s*r);const u=s.toFixed(6).match(/^(-?\d+)(?:\.(\d+))?$/);if(!u)return`${l}${String(s)}`;const h=u[1],p=u[2]||"";let m=h;try{m=new Intl.NumberFormat().format(BigInt(h))}catch{m=h}const v=Math.max(0,Math.min(6,Math.floor(n))),y=v?p.slice(0,v).padEnd(v,"0"):"",b=h.startsWith("-")?"-":"",x=v?`${m.replace("-","")}.${y}`:m.replace("-","");return`${b}${l}${x}`}function Ip(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),a=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,a,r));return Number.isFinite(s.getTime())&&Kt(s)===t.trim()?s:null}function Js(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function H7(t,e){const n=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.floor(n/864e5)}function Hg(t,e){if(!Array.isArray(t)||t.length===0)return 0;const n=t.length,a=(n-1)*e,r=Math.floor(a),s=a-r,l=t[r]??t[n-1],c=t[Math.min(n-1,r+1)]??t[n-1];return Math.round(l+(c-l)*s)}function W7(t){return t<=0?0:t>=4?4:t}function TC({weeks:t=52,now:e,weekStartsOn:n="sun"}={}){const a=e instanceof Date&&Number.isFinite(e.getTime())?e:new Date,r=Xr(a),s=Ip(r)||new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate())),l=n==="mon"?1:0,c=s.getUTCDay(),u=Js(s,-((c-l+7)%7)),h=Js(u,-7*(Math.max(1,t)-1));return{from:Kt(h),to:r}}function G7({dailyRows:t,weeks:e=52,to:n,weekStartsOn:a="sun"}={}){const r=Ip(n)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:s}=TC({weeks:e,now:r,weekStartsOn:a}),l=Ip(s)||Js(r,-(e*7-1)),c=(()=>{const A=(l.getUTCDay()-(a==="mon"?1:0)+7)%7;return Js(l,-A)})(),u=new Map;for(const L of Array.isArray(t)?t:[]){const E=typeof L?.day=="string"?L.day:null;if(!E)continue;const A=CC(L?.billable_total_tokens??L?.total_tokens)??0;u.set(E,{value:Math.max(0,A),models:L?.models||null})}const h=H7(c,r)+1,p=Math.ceil(h/7),m=[];for(let L=0;L<h;L++){const E=Js(c,L),A=Kt(E),D=u.get(A),B=D?D.value:0;B>0&&m.push(B)}m.sort((L,E)=>L-E);const v=Hg(m,.5),y=Hg(m,.75),b=Hg(m,.9);function x(L){return!L||L<=0?0:L<=v?1:L<=y?2:L<=b?3:4}const P=[];for(let L=0;L<p;L++){const E=[];for(let A=0;A<7;A++){const D=L*7+A,B=Js(c,D);if(B.getTime()>r.getTime()){E.push(null);continue}const j=Kt(B),S=u.get(j),N=S?S.value:0,U=S?S.models:null;E.push({day:j,value:N,level:W7(x(N)),models:U})}P.push(E)}const T=P.length>e?P.slice(P.length-e):P;return{from:s,to:Kt(r),weeks:T,thresholds:{t1:v,t2:y,t3:b}}}function q7({dailyRows:t,to:e}={}){const n=Ip(e)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),a=new Map;for(const s of Array.isArray(t)?t:[]){const l=typeof s?.day=="string"?s.day:null;if(!l)continue;const c=CC(s?.billable_total_tokens??s?.total_tokens)??0;a.set(l,Math.max(0,c))}let r=0;for(let s=0;s<370;s++){const l=Kt(Js(n,-s));if((a.get(l)??0)>0){r+=1;continue}break}return r}const Mf={},EC="tokentracker",m_=["tokentracker/tokentracker","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],yx=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function bn(){if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock")||"").toLowerCase();if(e==="0"||e==="false"||e==="off"||e==="no")return!1;if(e==="1"||e==="true"||e==="on"||e==="yes")return!0}if(typeof import.meta<"u"&&Mf){const t="".toLowerCase();if(t==="1"||t==="true")return!0}return!1}function K7(){if(typeof import.meta<"u"&&Mf){const t="".trim();if(t)return t;const e="".trim();if(e)return e}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_now")||"").trim();if(e)return e;const n=String(t.get("mock_today")||"").trim();if(n)return n}return""}function Y7(t){if(!t)return null;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[a,r,s]=e.split("-").map(Number);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const l=new Date(a,r-1,s,12,0,0);return Number.isFinite(l.getTime())?l:null}const n=new Date(e);return Number.isFinite(n.getTime())?n:null}function iY(){return bn()?Y7(K7()):null}function Z7(){if(typeof import.meta<"u"&&Mf){const t="".trim();if(t)return t}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_seed")||"").trim();if(e)return e}return EC}function J7(){if(typeof import.meta<"u"&&Mf){const t="".trim(),e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_missing")||"").trim(),n=Number(e);if(Number.isFinite(n)&&n>0)return Math.floor(n)}return 0}function ql(t){return(t==null?Z7():String(t)).trim()||EC}function mo(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function oa(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),a=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,a,r));return Number.isFinite(s.getTime())&&Kt(s)===t.trim()?s:null}function Md(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function AC(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+e,1))}function Q7(t){return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}`}function Ll({from:t,to:e,seed:n}){const a=oa(Xr(new Date))||new Date,r=oa(t)||a,s=oa(e)||r,l=[],c=ql(n),u=Math.floor((Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())-Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()))/864e5)+1;for(let h=0;h<u;h+=1){const p=Md(r,h),m=Kt(p),v=mo(`${c}:${m}`),y=v%1e3/1e3,b=.6+.4*Math.sin(h/6*Math.PI*.5),x=p.getUTCDay()===0||p.getUTCDay()===6?.65:1,P=18e3+Math.round(12e3*y),T=Math.max(0,Math.round(P*b*x)),L=Math.round(T*.46),E=Math.round(T*.34),A=Math.round(T*.14),D=Math.max(0,T-L-E-A),B={};if(T>0){const j=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],S=1+v%3;let N=T;for(let U=0;U<S;U++){const Q=j[(v+U)%j.length];if(U===S-1)B[Q]=N;else{const ee=Math.round(N*(.3+.4*((v+U*17)%10)/10));B[Q]=ee,N-=ee}}}l.push({day:m,total_tokens:T,billable_total_tokens:T,input_tokens:L,output_tokens:E,cached_input_tokens:A,reasoning_output_tokens:D,conversation_count:1+v%5,models:B})}return l}function X7({day:t,seed:e}){const n=oa(t)||oa(Xr(new Date))||new Date,a=Kt(n),r=ql(e),s=Array.from({length:48},(c,u)=>{const h=Math.floor(u/2),p=u%2===0?0:30,m=mo(`${r}:${a}:${h}:${p}`),v=m%1e3/1e3,y=(h+p/60)/24,b=.4+.6*Math.sin(y*Math.PI*2),x=900+Math.round(700*v),P=Math.max(0,Math.round(x*b)),T=Math.round(P*.46),L=Math.round(P*.34),E=Math.round(P*.14),A=Math.max(0,P-T-L-E),D={};if(P>0){const B=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],j=1+m%2;let S=P;for(let N=0;N<j;N++){const U=B[(m+N)%B.length];if(N===j-1)D[U]=S;else{const Q=Math.round(S*(.3+.4*((m+N*17)%10)/10));D[U]=Q,S-=Q}}}return{hour:`${a}T${String(h).padStart(2,"0")}:${String(p).padStart(2,"0")}:00`,total_tokens:P,billable_total_tokens:P,input_tokens:T,output_tokens:L,cached_input_tokens:E,reasoning_output_tokens:A,models:D}}),l=Math.max(0,Math.min(48,J7()));if(l>0){const c=Date.now(),u=s.map((m,v)=>{const y=Date.parse(m.hour);return Number.isFinite(y)&&y<=c?{index:v,ts:y}:null}).filter(Boolean),h=Math.max(0,u.length-l),p=u.slice(h);for(const m of p){const v=s[m.index];v&&(s[m.index]={...v,missing:!0})}}return s}function e9({months:t=24,to:e,seed:n}){const a=oa(e)||oa(Xr(new Date))||new Date,r=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1)),s=ql(n),l=[];for(let c=t-1;c>=0;c-=1){const u=AC(r,-c),h=Q7(u),p=mo(`${s}:${h}`),m=p%1e3/1e3,v=.7+.3*Math.sin(l.length/6*Math.PI*.5),y=36e4+Math.round(2e5*m),b=Math.max(0,Math.round(y*v)),x=Math.round(b*.46),P=Math.round(b*.34),T=Math.round(b*.14),L=Math.max(0,b-x-P-T),E={};if(b>0){const A=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],D=1+p%3;let B=b;for(let j=0;j<D;j++){const S=A[(p+j)%A.length];if(j===D-1)E[S]=B;else{const N=Math.round(B*(.3+.4*((p+j*17)%10)/10));E[S]=N,B-=N}}}l.push({month:h,total_tokens:b,billable_total_tokens:b,input_tokens:x,output_tokens:P,cached_input_tokens:T,reasoning_output_tokens:L,models:E})}return l}function g0(t){return t.reduce((e,n)=>(e.total_tokens+=Number(n.total_tokens||0),e.billable_total_tokens+=Number(n.billable_total_tokens||n.total_tokens||0),e.input_tokens+=Number(n.input_tokens||0),e.output_tokens+=Number(n.output_tokens||0),e.cached_input_tokens+=Number(n.cached_input_tokens||0),e.reasoning_output_tokens+=Number(n.reasoning_output_tokens||0),e.conversation_count+=Number(n.conversation_count||0),e),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function t9(t,e=1.75){const n=Number(t||0);return!Number.isFinite(n)||n<=0?"0.000000":(n*e/1e6).toFixed(6)}function bx(t,e){const n=Number.isFinite(e)?e:0;return{total_tokens:Math.max(0,Math.round(t.total_tokens*n)),billable_total_tokens:Math.max(0,Math.round((t.billable_total_tokens??t.total_tokens)*n)),input_tokens:Math.max(0,Math.round(t.input_tokens*n)),output_tokens:Math.max(0,Math.round(t.output_tokens*n)),cached_input_tokens:Math.max(0,Math.round(t.cached_input_tokens*n)),reasoning_output_tokens:Math.max(0,Math.round(t.reasoning_output_tokens*n))}}function g_(t){return{...t,total_cost_usd:t9(t.total_tokens)}}function n9({from:t,to:e,seed:n}={}){const a=Ll({from:t,to:e,seed:n});return{from:t,to:e,data:a}}function a9({day:t,seed:e}={}){const n=oa(t)||new Date,a=Kt(n),r=X7({day:a,seed:e});return{day:a,data:r}}function r9({months:t=24,to:e,seed:n}={}){const a=oa(e)||oa(Xr(new Date))||new Date,r=Kt(a),s=e9({months:t,to:r,seed:n}),l=AC(new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1)),-(t-1));return{from:Kt(l),to:r,months:t,data:s}}function i9({from:t,to:e,seed:n,rolling:a=!0}={}){const r=Ll({from:t,to:e,seed:n}),s=g0(r),l=g_(s),c=a?s9({to:e,seed:n}):null;return{from:t,to:e,days:r.length,totals:l,...c?{rolling:c}:{}}}function s9({to:t,seed:e}={}){const n=oa(t)||oa(Xr(new Date))||new Date,a=Kt(n),r=Kt(Md(n,-6)),s=Kt(Md(n,-29)),l=Ll({from:r,to:a,seed:e}),c=Ll({from:s,to:a,seed:e});return{last_7d:kx({rows:l,from:r,to:a}),last_30d:kx({rows:c,from:s,to:a})}}function kx({rows:t,from:e,to:n}={}){const a=g0(t||[]),r=(t||[]).filter(l=>Number(l.billable_total_tokens??l.total_tokens)>0).length,s=r>0?Math.floor(a.billable_total_tokens/r):0;return{from:e,to:n,totals:{billable_total_tokens:a.billable_total_tokens,conversation_count:a.conversation_count},active_days:r,avg_per_active_day:s}}const wx=["claude","codex","gemini","cursor","opencode","kilo"];function RC(t,e,n){const a=mo(`${n}:${t}`),r=12e4+a%9e5,s=e%4*4200,l=Math.max(0,r+s),c=Math.max(0,Math.round(l*.96)),u=1+a%4;let h=l;const p=Array.from({length:u},(b,x)=>{const T=x===u-1?h:Math.floor(h*(.4+(a>>x)%3*.1));return h-=T,{source:wx[(a+x)%wx.length],total_tokens:T}}).sort((b,x)=>x.total_tokens-b.total_tokens),m=Math.floor(l*.7),v=Math.floor(l*.12),y=Math.floor(l*.1);return{project_key:t,project_ref:`https://github.com/${t}`,total_tokens:String(l),billable_total_tokens:String(c),input_tokens:v,output_tokens:y,cached_input_tokens:m,cache_creation_input_tokens:Math.floor(l*.06),reasoning_output_tokens:Math.floor(l*.02),conversation_count:5+a%120,mockDayCount:1+a%14,sources:p}}function o9({seed:t,limit:e=3}={}){const n=ql(t),a=m_.map((r,s)=>{const{mockDayCount:l,...c}=RC(r,s,n);return c}).sort((r,s)=>Number(s.billable_total_tokens)-Number(r.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(e)||3))));return{generated_at:new Date().toISOString(),entries:a}}function l9({projectKey:t,from:e,to:n}={}){const a=typeof t=="string"&&t?t:m_[0],r=Math.max(0,m_.indexOf(a)),s=RC(a,r,ql(a)),l=Number(s.total_tokens),c=s.mockDayCount,u=new Date,h=Array.from({length:c},(p,m)=>{const v=new Date(u.getTime()-(c-1-m)*864e5),y=mo(`${a}:${m}`),b=Math.floor(l/c*(.4+y%120/100)),x=s.sources[0]?.source||"claude",P=s.sources[1]?.source,T={[x]:Math.floor(b*.8)};return P&&(T[P]=b-T[x]),{day:v.toISOString().slice(0,10),total_tokens:b,billable_total_tokens:b,input_tokens:Math.floor(b*.12),output_tokens:Math.floor(b*.1),cached_input_tokens:Math.floor(b*.7),cache_creation_input_tokens:Math.floor(b*.06),reasoning_output_tokens:Math.floor(b*.02),conversation_count:1+y%20,models:T}});return{generated_at:new Date().toISOString(),from:e||h[0]?.day||"",to:n||h[h.length-1]?.day||"",project_key:a,project_ref:s.project_ref,totals:{total_tokens:l,billable_total_tokens:Number(s.billable_total_tokens),input_tokens:s.input_tokens,output_tokens:s.output_tokens,cached_input_tokens:s.cached_input_tokens,cache_creation_input_tokens:s.cache_creation_input_tokens,reasoning_output_tokens:s.reasoning_output_tokens,conversation_count:s.conversation_count},days_active:c,range_total_tokens:l*3,daily:h,sources:s.sources.map((p,m)=>({source:p.source,total_tokens:p.total_tokens,conversation_count:1+mo(`${a}:src:${m}`)%60,days_active:Math.max(1,c-m)}))}}function c9(t){const e=oa(Xr(new Date))||new Date,n=String(t).trim().toLowerCase()||"week";if(n==="total")return{from:"1970-01-01",to:"9999-12-31"};if(n==="month"){const l=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),c=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0));return{from:Kt(l),to:Kt(c)}}const a=e.getUTCDay(),r=Kt(Md(e,-a)),s=Kt(Md(e,-a+6));return{from:r,to:s}}const xx=["token_titan","big_day","wordsmith","marathoner","streak","weekend_warrior","momentum","polyglot","trendsetter","multitool","podium","veteran"];function Px(t){const e=t%4,n=[];for(let a=0;a<e;a+=1){const r=xx[(t*3+a*5)%xx.length];n.some(s=>s.id===r)||n.push({id:r,tier:4-a>0?(t+a)%4+1:1})}return n.sort((a,r)=>r.tier-a.tier)}function v0(){const t=Date.now(),e=a=>new Date(t-a*864e5).toISOString(),n=(a,r,s,l,c={})=>{const u=!["project_hopper","project_devotion","night_owl"].includes(a);return{id:a,tier:r,metric_value:s,thresholds:l,lower_is_better:a==="podium",next_threshold:r>=4?null:l[r],achieved:{bronze:r>=1?e(90):null,silver:r>=2?e(45):null,gold:r>=3?e(12):null,diamond:r>=4?e(2):null},serials:u?{bronze:r>=1?127+a.length:null,silver:r>=2?64+a.length:null,gold:r>=3?18+a.length:null,diamond:r>=4?3+a.length:null}:void 0,meta:c}};return{generated_at:new Date(t).toISOString(),achievements:[n("token_titan",3,245e8,[1e8,1e9,1e10,1e11]),n("big_day",1,92e6,[1e7,1e8,5e8,3e9],{date:e(12).slice(0,10)}),n("wordsmith",2,31e6,[5e6,25e6,1e8,3e8]),n("marathoner",2,61,[7,30,100,365]),n("streak",1,5,[3,7,30,100]),n("weekend_warrior",2,26,[5,20,50,100]),n("momentum",0,1.2,[2,6,15,40]),n("polyglot",1,11,[5,15,30,60],{favorite_model:"claude-opus-4-7"}),n("trendsetter",2,7,[2,5,10,20]),n("multitool",3,7,[2,4,6,10]),n("podium",1,42,[100,30,10,3]),n("veteran",2,132,[30,90,180,365],{first_day:e(132).slice(0,10)}),n("project_hopper",2,6,[3,5,10,20]),n("project_devotion",3,24e7,[1e6,1e7,1e8,1e9],{project_key:"mock"}),n("night_owl",1,9,[5,20,60,150])]}}function LC({seed:t,period:e,metric:n,limit:a=20,offset:r=0}={}){const s=ql(t),l=Math.max(1,Math.min(100,Math.floor(Number(a)||20))),c=Math.max(0,Math.min(1e4,Math.floor(Number(r)||0))),u=String(n||"all").trim().toLowerCase()||"all",h=String(e||"week").trim().toLowerCase()||"week",p=h==="month"||h==="total"||h==="week"?h:"week",{from:m,to:v}=c9(p),y=250,b=y>0?Math.ceil(y/l):0,x=Math.floor(c/l)+1,P=Array.from({length:y},(j,S)=>{const N=S+1,U=`00000000-0000-0000-0000-${String(N).padStart(12,"0")}`,Q=yx[N%yx.length],ce=18e4+mo(`${s}:${Q}:${N}`)%9e5,le=Math.max(0,ce+N*1200),re=Math.floor(le*.28),te=Math.floor(le*.18),ie=Math.floor(le*.1),$=Math.floor(le*.1),X=Math.floor(le*.08),W=Math.floor(le*.03),O=Math.floor(le*.02),Y=Math.floor(le*.04),ae=Math.floor(le*.03),_e=Math.max(0,le-re-te-ie-$-X-W-O-Y-ae),fe=N%7!==0;return{id:N,user_id:U,is_public:fe,is_me:!1,display_name:fe?Q:"Anonymous",avatar_url:null,gpt_tokens:re,claude_tokens:te,gemini_tokens:ie,cursor_tokens:$,opencode_tokens:X,openclaw_tokens:_e,hermes_tokens:W,kiro_tokens:O,copilot_tokens:Y,kimi_tokens:ae,other_tokens:0,total_tokens:le}}),T=Math.max(0,Math.min(y-1,Math.floor(y*.8)));P[T]&&(P[T].is_me=!0);const L=u==="gpt"||u==="codex"?"gpt_tokens":u==="claude"?"claude_tokens":u==="gemini"?"gemini_tokens":u==="cursor"?"cursor_tokens":u==="opencode"?"opencode_tokens":u==="openclaw"?"openclaw_tokens":u==="hermes"?"hermes_tokens":u==="kiro"?"kiro_tokens":u==="copilot"?"copilot_tokens":u==="kimi"?"kimi_tokens":"total_tokens",E=P.slice().sort((j,S)=>Number(S[L])-Number(j[L])||j.id-S.id).map((j,S)=>({user_id:j.is_public?j.user_id:null,rank:S+1,is_me:!!j.is_me,display_name:j.display_name,avatar_url:j.avatar_url,gpt_tokens:String(j.gpt_tokens),claude_tokens:String(j.claude_tokens),gemini_tokens:String(j.gemini_tokens),cursor_tokens:String(j.cursor_tokens),opencode_tokens:String(j.opencode_tokens),openclaw_tokens:String(j.openclaw_tokens),hermes_tokens:String(j.hermes_tokens??0),kiro_tokens:String(j.kiro_tokens??0),copilot_tokens:String(j.copilot_tokens??0),kimi_tokens:String(j.kimi_tokens??0),other_tokens:String(j.other_tokens??0),total_tokens:String(j.total_tokens),is_public:!!j.is_public,github_url:j.id%3===0?"https://github.com/mm7894215/TokenTracker":null,badges:Px(j.id),badge_count:Px(j.id).length})),A=E.find(j=>j?.is_me)||null,D=A?{rank:A.rank,gpt_tokens:A.gpt_tokens,claude_tokens:A.claude_tokens,gemini_tokens:A.gemini_tokens,cursor_tokens:A.cursor_tokens,opencode_tokens:A.opencode_tokens,openclaw_tokens:A.openclaw_tokens,hermes_tokens:A.hermes_tokens,kiro_tokens:A.kiro_tokens,copilot_tokens:A.copilot_tokens,kimi_tokens:A.kimi_tokens,other_tokens:A.other_tokens,total_tokens:A.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",gemini_tokens:"0",cursor_tokens:"0",opencode_tokens:"0",openclaw_tokens:"0",hermes_tokens:"0",kiro_tokens:"0",copilot_tokens:"0",kimi_tokens:"0",other_tokens:"0",total_tokens:"0"},B=E.slice(c,c+l);return{period:p,metric:u,from:m,to:v,generated_at:new Date().toISOString(),page:x,limit:l,offset:c,total_entries:y,total_pages:b,entries:B,me:D}}function d9({weeks:t=52,to:e,weekStartsOn:n="sun",seed:a}={}){const r=TC({weeks:t,now:oa(e)||oa(Xr(new Date))||new Date,weekStartsOn:n}),s=Ll({from:r.from,to:r.to,seed:a});return{...G7({dailyRows:s,weeks:t,to:r.to,weekStartsOn:n}),week_starts_on:n,active_days:s.filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,streak_days:q7({dailyRows:s,to:r.to})}}function u9({from:t,to:e,seed:n}={}){const a=Ll({from:t,to:e,seed:n}),r=g0(a),l=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(c=>{const u=bx(r,c.weight),h=c.models.map(p=>{const m=bx(u,p.weight);return{model:p.model,model_id:p.model_id||p.model,totals:g_(m)}});return{source:c.source,totals:g_(u),models:h}});return{from:t,to:e,days:a.length,sources:l,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:Xr(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}function h9({from:t,to:e,source:n="claude"}={}){if(n==="codex")return{from:t,to:e,source:"codex",scope:"supported",totals:{input_tokens:142e4,cached_input_tokens:588e4,cache_creation_input_tokens:92e4,output_tokens:256e4,reasoning_output_tokens:61e4,total_tokens:1078e4},session_count:188,message_count:5436,tool_calls_breakdown:{categories:[{name:"Execution",calls:742,totals:{input_tokens:32e4,cached_input_tokens:104e4,cache_creation_input_tokens:11e4,output_tokens:46e4,reasoning_output_tokens:12e4,total_tokens:193e4},tools:[{name:"exec_command",calls:510,totals:{input_tokens:25e4,cached_input_tokens:82e4,cache_creation_input_tokens:8e4,output_tokens:37e4,reasoning_output_tokens:9e4,total_tokens:152e4}},{name:"write_stdin",calls:232,totals:{input_tokens:7e4,cached_input_tokens:22e4,cache_creation_input_tokens:3e4,output_tokens:9e4,reasoning_output_tokens:3e4,total_tokens:41e4}}]},{name:"Browser",calls:406,totals:{input_tokens:21e4,cached_input_tokens:88e4,cache_creation_input_tokens:9e4,output_tokens:42e4,reasoning_output_tokens:1e5,total_tokens:17e5},tools:[{name:"take_snapshot",calls:180,totals:{input_tokens:1e5,cached_input_tokens:4e5,cache_creation_input_tokens:4e4,output_tokens:18e4,reasoning_output_tokens:4e4,total_tokens:76e4}},{name:"click",calls:126,totals:{input_tokens:6e4,cached_input_tokens:25e4,cache_creation_input_tokens:3e4,output_tokens:12e4,reasoning_output_tokens:35e3,total_tokens:495e3}},{name:"evaluate_script",calls:100,totals:{input_tokens:5e4,cached_input_tokens:23e4,cache_creation_input_tokens:2e4,output_tokens:12e4,reasoning_output_tokens:25e3,total_tokens:445e3}}]}],tools_total:363e4,privacy:{includes_inputs:!1,note:"Aggregated tool names only; no tool arguments or outputs are included."}},exec_command_breakdown:{by_type:[{name:"test",calls:168,failures:14,duration_ms:482e3,max_duration_ms:18400,output_chars:45e4,output_lines:8600,totals:{input_tokens:9e4,cached_input_tokens:32e4,output_tokens:16e4,reasoning_output_tokens:42e3,total_tokens:612e3}},{name:"build",calls:116,failures:9,duration_ms:392e3,max_duration_ms:22100,output_chars:31e4,output_lines:5200,totals:{input_tokens:7e4,cached_input_tokens:24e4,output_tokens:13e4,reasoning_output_tokens:3e4,total_tokens:47e4}}],by_exit:[{name:"completed:0",calls:438,failures:0,duration_ms:104e4,max_duration_ms:22100,output_chars:83e4,output_lines:13100,totals:{input_tokens:22e4,cached_input_tokens:78e4,output_tokens:35e4,reasoning_output_tokens:82e3,total_tokens:1432e3}},{name:"completed:1",calls:72,failures:72,duration_ms:155e3,max_duration_ms:11800,output_chars:12e4,output_lines:2300,totals:{input_tokens:3e4,cached_input_tokens:11e4,output_tokens:55e3,reasoning_output_tokens:8e3,total_tokens:195e3}}]}};if(n!=="claude")return{from:t,to:e,source:n,scope:"unsupported",totals:{input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0},categories:["system_prefix","conversation_history","user_input","tool_calls","subagents","reasoning","assistant_response"].map(l=>({key:l,totals:{input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0},percent:0})),session_count:0,message_count:0};const a=[{key:"system_prefix",total:12896539},{key:"conversation_history",total:320207200},{key:"user_input",total:998025},{key:"tool_calls",total:4808739},{key:"subagents",total:1022828},{key:"reasoning",total:11073118},{key:"assistant_response",total:1289174}],r=a.reduce((l,c)=>l+c.total,0),s=a.map(({key:l,total:c})=>({key:l,totals:{input_tokens:l==="user_input"?c:0,cached_input_tokens:l==="conversation_history"?Math.round(c*.95):0,cache_creation_input_tokens:l==="system_prefix"?c:l==="conversation_history"?Math.round(c*.05):0,output_tokens:["tool_calls","subagents","reasoning","assistant_response"].includes(l)?c:0,reasoning_output_tokens:l==="reasoning"?c:0,total_tokens:c},percent:Number((c/r*100).toFixed(2))}));return{from:t,to:e,source:"claude",scope:"supported",totals:{input_tokens:998025,cached_input_tokens:Math.round(320207200*.95),cache_creation_input_tokens:12896539+Math.round(320207200*.05),output_tokens:18193859,reasoning_output_tokens:11073118,total_tokens:r},categories:s,session_count:312,message_count:12046}}let tp=null;function DC(){tp=null}async function p9(t=fetch){if(tp)return tp;const e=await t("/api/local-auth",{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!e.ok)throw new Error(`Local auth request failed with HTTP ${e.status}`);const n=await e.json().catch(()=>null),a=typeof n?.token=="string"?n.token.trim():"";if(!a)throw new Error("Local auth token missing from response");return tp=a,a}async function eu(t=fetch){return{"x-tokentracker-local-auth":await p9(t)}}const f9=Object.freeze(Object.defineProperty({__proto__:null,clearLocalApiAuthToken:DC,getLocalApiAuthHeaders:eu},Symbol.toStringTag,{value:"Module"})),yh=new Map;function v_(t,e){const n=yh.get(t);if(n)return n;const a=e();yh.set(t,a);const r=()=>{yh.get(t)===a&&yh.delete(t)};return a.then(r,r),a}const ba={usageSummary:"tokentracker-usage-summary",usageDaily:"tokentracker-usage-daily",usageHourly:"tokentracker-usage-hourly",usageMonthly:"tokentracker-usage-monthly",usageHeatmap:"tokentracker-usage-heatmap",usageModelBreakdown:"tokentracker-usage-model-breakdown",usageCategoryBreakdown:"tokentracker-usage-category-breakdown",projectUsageSummary:"tokentracker-project-usage-summary",projectUsageDetail:"tokentracker-project-usage-detail",achievements:"tokentracker-achievements",userStatus:"tokentracker-user-status",localSync:"tokentracker-local-sync",usageLimits:"tokentracker-usage-limits",outcomes:"tokentracker-outcomes"},m9={"tokentracker-usage-summary":"tokentracker-account-summary","tokentracker-usage-daily":"tokentracker-account-daily","tokentracker-usage-hourly":"tokentracker-account-hourly","tokentracker-usage-monthly":"tokentracker-account-monthly","tokentracker-usage-heatmap":"tokentracker-account-heatmap","tokentracker-usage-model-breakdown":"tokentracker-account-model-breakdown"};function g9(){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")}async function Ma(t,e,n){const a=n?.accessToken,r=m9[t];if(!g9()&&a&&r){const u=Yr().replace(/\/$/,""),h=new URL(`${u}/functions/${r}`);if(e)for(const[v,y]of Object.entries(e))y!=null&&y!==""&&h.searchParams.set(v,String(y));const p={Accept:"application/json"},m=Gl();return m&&(p.apikey=m),If(a)&&(p.Authorization=`Bearer ${a}`),v_(`${h.toString()}\0${a}`,async()=>{const v=await fetch(h.toString(),{headers:p,cache:"no-store"});if(!v.ok){const y=new Error(`Request failed with HTTP ${v.status}`);throw y.status=v.status,y}return v.json()})}const s=new URL(`/functions/${t}`,window.location.origin);if(e)for(const[u,h]of Object.entries(e))h!=null&&h!==""&&s.searchParams.set(u,String(h));const{accessToken:l,...c}=n||{};return v_(s.toString(),async()=>{const u=await fetch(s.toString(),{headers:{Accept:"application/json"},cache:"no-store",...c});if(!u.ok){const h=new Error(`Request failed with HTTP ${u.status}`);throw h.status=u.status,h}return u.json()})}function $n({timeZone:t,tzOffsetMinutes:e}={}){const n={},a=typeof t=="string"?t.trim():"";return a&&(n.tz=a),Number.isFinite(e)&&(n.tz_offset_minutes=String(Math.trunc(e))),n}function ka({source:t,model:e,device:n}={}){const a={},r=typeof t=="string"?t.trim().toLowerCase():"";r&&(a.source=r);const s=typeof e=="string"?e.trim():"";s&&(a.model=s);const l=typeof n=="string"?n.trim():"";return l&&(a.device_id=l),a}async function sY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,rolling:c=!1,accessToken:u}={}){if(bn())return i9({from:t,to:e,seed:u,rolling:c});const h=$n({timeZone:s,tzOffsetMinutes:l}),p=ka({source:n,model:a,device:r}),m=c?{rolling:"1"}:{};return Ma(ba.usageSummary,{from:t,to:e,...p,...h,...m},{accessToken:u})}async function oY({from:t,to:e,source:n,limit:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return o9({seed:l,limit:a});const c=$n({timeZone:r,tzOffsetMinutes:s}),h={...ka({source:n}),...c};return t&&(h.from=t),e&&(h.to=e),a!=null&&(h.limit=String(a)),Ma(ba.projectUsageSummary,h)}async function lY({projectKey:t,from:e,to:n,timeZone:a,tzOffsetMinutes:r}={}){if(bn())return l9({projectKey:t,from:e,to:n});const s=$n({timeZone:a,tzOffsetMinutes:r}),l={project_key:t,...s};return e&&(l.from=e),n&&(l.to=n),Ma(ba.projectUsageDetail,l)}async function cY({timeZone:t,tzOffsetMinutes:e}={}){return bn()?v0():Ma(ba.achievements,$n({timeZone:t,tzOffsetMinutes:e}))}async function ei(t,e={}){const n=Yr();if(!n)throw new Error("InsForge base URL not configured");const a=n.replace(/\/$/,""),r=new URL(`${a}/functions/${t}`);if(e.params)for(const[u,h]of Object.entries(e.params))h!=null&&h!==""&&r.searchParams.set(u,String(h));const s={Accept:"application/json","Content-Type":"application/json"},l=Gl();l&&(s.apikey=l),e.accessToken&&If(e.accessToken)&&(s.Authorization=`Bearer ${e.accessToken}`);const c=await fetch(r.toString(),{method:e.method||"GET",headers:s,...e.body!=null?{body:JSON.stringify(e.body)}:{}});if(!c.ok){const u=new Error(`Request failed with HTTP ${c.status}`);throw u.status=c.status,u}return c.json()}async function v9({accessToken:t,userId:e,period:n,metric:a,limit:r,offset:s}={}){return bn()?LC({seed:t||e,period:n,metric:a,limit:r,offset:s}):ei("tokentracker-leaderboard",{params:{period:n,limit:r,offset:s,user_id:e}})}async function dY(){return bn()?{top_models:[]}:ei("tokentracker-community-models",{})}async function Sx({accessToken:t}={}){return ei("tokentracker-public-visibility",{accessToken:t,method:"GET"})}async function uY({accessToken:t,enabled:e,anonymous:n,display_name:a,github_url:r,show_github_url:s}={}){const l={};return e!==void 0&&(l.enabled=!!e),n!==void 0&&(l.anonymous=!!n),a!==void 0&&(l.display_name=String(a)),r!==void 0&&(l.github_url=r===null?null:String(r)),s!==void 0&&(l.show_github_url=!!s),ei("tokentracker-public-visibility",{accessToken:t,method:"POST",body:l})}async function hY({accessToken:t,period:e,source:n}={}){const a={};return e&&(a.period=e),typeof n=="string"&&n.trim()&&(a.source=n.trim()),ei("tokentracker-leaderboard-refresh",{accessToken:t,method:"POST",body:a})}async function pY({accessToken:t,userId:e,period:n}={}){if(bn()){const a=LC({seed:t,period:n,metric:"all",limit:250,offset:0}),r=Array.isArray(a?.entries)?a.entries:[],s=r.find(p=>p?.user_id===e)||r[0]||null,l=Number(s?.total_tokens)||0,c=new Date,u=Array.from({length:365}).map((p,m)=>{const v=new Date(c);return v.setUTCDate(v.getUTCDate()-(364-m)),{date:v.toISOString().slice(0,10),total_tokens:m%7===0?Math.floor(l/365):0}}),h=u.slice(-7);return{user:{user_id:e,display_name:s?.display_name||"Mock User",avatar_url:s?.avatar_url||null,github_url:s?.github_url||null,is_anonymous:!1,rank:s?.rank??null},period:{kind:n||"week",from:a?.from??null,to:a?.to??null,generated_at:a?.generated_at??new Date().toISOString()},totals:{total_tokens:l,estimated_cost_usd:Number(s?.estimated_cost_usd)||0,active_days:53,avg_per_day_usd:0},streak:{current_days:3,longest_days:12},best_day:l?{date:c.toISOString().slice(0,10),total_tokens:Math.floor(l/30),estimated_cost_usd:0}:null,models:{count:5,favorite:{model_name:"claude-opus-4-7",total_tokens:Math.floor(l/2)}},by_provider:[],heatmap:u,daily_trend:h,badges:v0().achievements.filter(p=>p.tier>=1&&!["project_hopper","project_devotion","night_owl"].includes(p.id)),badges_include_unearned:!1}}return ei("tokentracker-leaderboard-profile",{accessToken:t,params:{user_id:e,period:n}})}async function fY({accessToken:t,userId:e}={}){return bn()?{badges:v0().achievements.filter(n=>!["project_hopper","project_devotion","night_owl"].includes(n.id)),badges_include_unearned:!0}:ei("tokentracker-leaderboard-profile",{accessToken:t,method:"GET",params:{user_id:e,view:"badges"}})}function IC(t){if(!t)return 0;let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e%165)+24}async function mY({userId:t,anonId:e,accessToken:n}={}){return bn()?{count:IC(t),liked:!1}:ei("tokentracker-profile-likes",{accessToken:n,params:{target_user_id:t,anon_id:e}})}async function gY({userId:t,action:e,anonId:n,accessToken:a}={}){if(bn()){const r=e==="like";return{count:Math.max(0,IC(t)+(r?1:0)),liked:r}}return ei("tokentracker-profile-likes",{accessToken:a,method:"POST",body:{target_user_id:t,action:e,anon_id:n}})}async function vY(t={}){if(bn()){const e=new Date().toISOString();return{user_id:"local-user",created_at:e,pro:{active:!1,sources:[],expires_at:null,partial:!1,as_of:e},subscriptions:{partial:!1,as_of:e,items:[]},install:{partial:!1,as_of:e,has_active_device_token:!1,has_active_device:!1,active_device_tokens:0,active_devices:0,latest_token_activity_at:null,latest_device_seen_at:null}}}return Ma(ba.userStatus)}async function _Y({signal:t,auto:e=!1,background:n=!1,allLocalSources:a=!1,drain:r=!1}={}){const s=await eu(),l={};r?l.drain=!0:e&&(l.auto=!0,n&&(l.background=!0,a&&(l.allLocalSources=!0)));const c=await fetch(`/functions/${ba.localSync}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...s},body:JSON.stringify(l),cache:"no-store",signal:t}),u=await c.json().catch(()=>({ok:!1,error:`Local sync request failed with HTTP ${c.status}`}));if(!c.ok||u?.ok===!1){const h=u?.error||u?.message||`Local sync request failed with HTTP ${c.status}`,p=new Error(h);throw p.status=c.status,p}return u}async function yY({from:t,to:e,source:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return u9({from:t,to:e,seed:l});const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:n,device:a});return Ma(ba.usageModelBreakdown,{from:t,to:e,...u,...c},{accessToken:l})}async function bY({from:t,to:e,source:n,device:a,accessToken:r}={}){if(bn())return{available:!1,by_model:[],by_tool:[],totals:null};const s=ka({source:n,device:a});return Ma(ba.outcomes,{from:t,to:e,...s},{accessToken:r})}async function kY({from:t,to:e,source:n="claude",timeZone:a,tzOffsetMinutes:r}={}){if(bn())return h9({from:t,to:e,source:n});const s=$n({timeZone:a,tzOffsetMinutes:r});return Ma(ba.usageCategoryBreakdown,{from:t,to:e,source:n,...s})}async function wY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){if(bn())return n9({from:t,to:e,seed:c});const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return Ma(ba.usageDaily,{from:t,to:e,...h,...u},{accessToken:c})}async function xY({day:t,source:e,model:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return a9({day:t,seed:l});const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:e,model:n,device:a}),h=t?{day:t,...u,...c}:{...u,...c};return Ma(ba.usageHourly,h,{accessToken:l})}async function PY({months:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){if(bn())return r9({months:t,to:e,seed:c});const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return Ma(ba.usageMonthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...h,...u},{accessToken:c})}async function SY(t={}){const e=t?.refresh?{refresh:"1"}:void 0;return Ma(ba.usageLimits,e)}async function CY({weeks:t,to:e,weekStartsOn:n,source:a,model:r,device:s,timeZone:l,tzOffsetMinutes:c,accessToken:u}={}){if(bn())return d9({weeks:t,to:e,weekStartsOn:n,seed:u});const h=$n({timeZone:l,tzOffsetMinutes:c}),p=ka({source:a,model:r,device:s});return Ma(ba.usageHeatmap,{weeks:String(t),to:e,week_starts_on:n,...p,...h},{accessToken:u})}const yo={summary:"tokentracker-account-summary",daily:"tokentracker-account-daily",hourly:"tokentracker-account-hourly",monthly:"tokentracker-account-monthly",heatmap:"tokentracker-account-heatmap",modelBreakdown:"tokentracker-account-model-breakdown",devices:"tokentracker-account-devices"};async function bo(t,e,n){if(!n||!If(n)){const u=new Error("Account view requires a signed-in user");throw u.status=401,u}const a=Yr();if(!a){const u=new Error("InsForge base URL not configured");throw u.status=0,u}const r=a.replace(/\/$/,""),s=new URL(`${r}/functions/${t}`);if(e)for(const[u,h]of Object.entries(e))h!=null&&h!==""&&s.searchParams.set(u,String(h));const l={Accept:"application/json",Authorization:`Bearer ${n}`},c=Gl();return c&&(l.apikey=c),v_(`${s.toString()}\0${n}`,async()=>{const u=await fetch(s.toString(),{method:"GET",headers:l,cache:"no-store"});if(!u.ok){const h=new Error(`Request failed with HTTP ${u.status}`);throw h.status=u.status,h}return u.json()})}async function TY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,rolling:c=!1,accessToken:u}={}){const h=$n({timeZone:s,tzOffsetMinutes:l}),p=ka({source:n,model:a,device:r}),m=c?{rolling:"1"}:{};return bo(yo.summary,{from:t,to:e,...p,...h,...m},u)}async function EY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return bo(yo.daily,{from:t,to:e,...h,...u},c)}async function AY({day:t,source:e,model:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:e,model:n,device:a}),h=t?{day:t,...u,...c}:{...u,...c};return bo(yo.hourly,h,l)}async function RY({months:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return bo(yo.monthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...h,...u},c)}async function LY({weeks:t,to:e,weekStartsOn:n,source:a,model:r,device:s,timeZone:l,tzOffsetMinutes:c,accessToken:u}={}){const h=$n({timeZone:l,tzOffsetMinutes:c}),p=ka({source:a,model:r,device:s});return bo(yo.heatmap,{weeks:String(t),to:e,week_starts_on:n,...p,...h},u)}async function DY({from:t,to:e,source:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:n,device:a});return bo(yo.modelBreakdown,{from:t,to:e,...u,...c},l)}async function IY({from:t,to:e,timeZone:n,tzOffsetMinutes:a,accessToken:r}={}){const s=$n({timeZone:n,tzOffsetMinutes:a});return bo(yo.devices,{from:t,to:e,...s},r)}async function MY({deviceId:t,name:e,accessToken:n}={}){if(!n||!If(n)){const a=new Error("Account view requires a signed-in user");throw a.status=401,a}return ei("tokentracker-device-rename",{accessToken:n,method:"POST",body:{device_id:t,device_name:e}})}const Cx="tokentracker_native_app";let MC=null;const __=new Set;typeof window<"u"&&window.addEventListener("native:systemAppearanceChanged",t=>{const e=t?.detail?.isDark;if(typeof e=="boolean"){MC=e;try{const n=document.documentElement;e?n.classList.add("dark"):n.classList.remove("dark")}catch{}__.forEach(n=>{try{n(e)}catch{}})}});function Tx(){return MC}function _9(t){return __.add(t),()=>__.delete(t)}function Nf(){if(typeof window>"u")return!1;try{if(new URLSearchParams(window.location.search).get("app")==="1"){try{window.localStorage.setItem(Cx,"1")}catch{}return!0}return window.localStorage.getItem(Cx)==="1"}catch{return!1}}function Ga(){return typeof window>"u"?!1:!!window.webkit?.messageHandlers?.nativeBridge}function Of(){return typeof window>"u"?!1:!!window.chrome?.webview&&Nf()}function NC(){return typeof window>"u"?null:window.webkit?.messageHandlers?.nativeBridge??null}function NY(){return!!NC()}function tu(t){const e=NC();if(!e)return!1;try{return e.postMessage(t),!0}catch(n){return console.warn("[tokentracker] nativeBridge post failed:",n),!1}}function OY(){return tu({type:"getSettings"})}function gd(t,e){return tu({type:"setSetting",key:t,value:e})}function jY(t){return tu({type:"action",name:t})}function y9(){return tu({type:"getSystemAppearance"})}function b9(t,e){if(!Ga())return;tu({type:"setChromeAppearance",isDark:t==="dark",theme:e??"system"})}function zY(t){if(typeof window>"u")return()=>{};const e=n=>{n&&n.detail&&typeof n.detail=="object"&&t(n.detail)};return window.addEventListener("native:settings",e),()=>window.removeEventListener("native:settings",e)}function FY(){return typeof window>"u"?!1:!!(window.webkit?.messageHandlers?.nativeBridge||window.chrome?.webview)}function OC(t){if(typeof window>"u")return!1;const e=window.webkit?.messageHandlers?.nativeBridge;if(e)try{return e.postMessage(t),!0}catch{return!1}if(window.chrome?.webview)try{return window.chrome.webview.postMessage(JSON.stringify(t)),!0}catch{return!1}return!1}function UY(){return OC({type:"getPetSettings"})}function BY(t,e){return OC({type:"setPetSetting",key:t,value:e})}function $Y(t){if(typeof window>"u")return()=>{};const e=n=>{n?.detail&&typeof n.detail=="object"&&t(n.detail)};return window.addEventListener("native:petSettings",e),()=>window.removeEventListener("native:petSettings",e)}const jC=k.createContext(null);function k9(t){if(!t||typeof t!="object")return"";const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},a=e.full_name||e.name||n.name||e.user_name||e.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Ex(t){if(!t||typeof t!="object")return null;const e=t,n=e.session&&typeof e.session=="object"?e.session:null,a=typeof e.accessToken=="string"&&e.accessToken||typeof e.access_token=="string"&&e.access_token||n&&typeof n.accessToken=="string"&&n.accessToken||n&&typeof n.access_token=="string"&&n.access_token||null;return a&&a.length>0?a:null}async function Wg(t,e={}){if(!t)return null;const n=Math.max(0,Math.floor(Number(e.skewMs)||6e4)),a=t.tokenManager,r=()=>a?.getAccessToken?.()??a?.getSession?.()?.accessToken??null;let s=r();if(!s||A7(s,n)){const{data:l}=await t.auth.refreshSession();if(s=r()??Ex(l)??null,!s&&typeof t.auth.getCurrentUser=="function")try{await t.auth.getCurrentUser(),s=r()??Ex(l)??null}catch{}}return s||null}function w9({children:t}){const[e,n]=k.useState(null),[a,r]=k.useState(null),[s,l]=k.useState(!0);k.useEffect(()=>{if(!f_()){n(null),r(null),l(!1);return}n(b7())},[]),k.useEffect(()=>{if(!e)return;let N=!0;return l(!0),(async()=>{try{let{data:U,error:Q}=await e.auth.getCurrentUser();if(!N)return;if(!Q&&!U?.user){if(await new Promise(ce=>setTimeout(ce,150)),!N)return;const ee=await e.auth.getCurrentUser();U=ee.data,Q=ee.error}if(Q){r(null);return}r(U?.user??null)}catch{N&&r(null)}finally{N&&l(!1)}})(),()=>{N=!1}},[e]);const c=k.useCallback(async()=>{if(e)try{let{data:N,error:U}=await e.auth.getCurrentUser();if(!U&&!N?.user){await new Promise(ee=>setTimeout(ee,150));const Q=await e.auth.getCurrentUser();N=Q.data,U=Q.error}if(U){r(null);return}r(N?.user??null)}catch{r(null)}},[e]),u=k.useCallback(async(N,U)=>{if(!e)return{error:new Error("InsForge client not configured")};const Q=typeof window<"u"&&window.webkit?.messageHandlers?.nativeOAuth;if(Q){const le=Of()?`${window.location.origin}/auth/callback`:typeof U=="string"&&U.trim()?U.trim():`${window.location.origin}/auth/callback`,re=await e.auth.signInWithOAuth({provider:N,redirectTo:le,skipBrowserRedirect:!0});if(re.data?.url){try{const te=await eu();await fetch("/api/auth-bridge/verifier",{method:"PUT",headers:{"Content-Type":"application/json",...te},body:JSON.stringify({native:!0})})}catch{}Q.postMessage(re.data.url)}return re}const ee=typeof U=="string"&&U.trim()?U.trim():typeof window<"u"?`${window.location.origin}/dashboard`:void 0;return await e.auth.signInWithOAuth({provider:N,redirectTo:ee})},[e]),h=k.useCallback(async N=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:Q}=await e.auth.signInWithPassword(N);return U?.user&&r(U.user),{data:U,error:Q}},[e]),p=k.useCallback(async N=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:Q}=await e.auth.signUp(N);return U?.user&&U?.accessToken&&r(U.user),{data:U,error:Q}},[e]),m=k.useCallback(async N=>e?e.auth.sendResetPasswordEmail(N):{data:null,error:new Error("InsForge client not configured")},[e]),v=k.useCallback(async N=>e?e.auth.exchangeResetPasswordToken(N):{data:null,error:new Error("InsForge client not configured")},[e]),y=k.useCallback(async N=>e?e.auth.resetPassword(N):{data:null,error:new Error("InsForge client not configured")},[e]),b=k.useCallback(async()=>e?e.auth.getPublicAuthConfig():{data:null,error:new Error("InsForge client not configured")},[e]),x=k.useCallback(async()=>{e&&(await e.auth.signOut(),fC(),P7(!1),DC(),r(null))},[e]),P=k.useCallback(async()=>Wg(e),[e]),[T,L]=k.useState(null),[E,A]=k.useState(!1),D=k.useMemo(()=>k9(a),[a]);k.useEffect(()=>{if(!a||!e){L(null),A(!1);return}let N=!0;return(async()=>{try{const U=await Wg(e);if(!N||!U){N&&A(!0);return}const Q=await Sx({accessToken:U});N&&Q?.display_name&&L(Q.display_name)}catch{}N&&A(!0)})(),()=>{N=!1}},[a,e]);const B=E?T||D:"",j=k.useCallback(async()=>{if(e)try{const N=await Wg(e);if(!N)return;const U=await Sx({accessToken:N});U?.display_name&&L(U.display_name)}catch{}},[e]),S=k.useMemo(()=>!f_()||!e?{enabled:!1,client:null,user:null,signedIn:!1,loading:!1,displayName:"",refreshUser:async()=>{},refreshDisplayName:async()=>{},signInWithOAuth:async()=>({error:new Error("InsForge not configured")}),signInWithPassword:async()=>({data:null,error:new Error("InsForge not configured")}),signUp:async()=>({data:null,error:new Error("InsForge not configured")}),sendResetPasswordEmail:async()=>({data:null,error:new Error("InsForge not configured")}),exchangeResetPasswordToken:async()=>({data:null,error:new Error("InsForge not configured")}),resetPassword:async()=>({data:null,error:new Error("InsForge not configured")}),getPublicAuthConfig:async()=>({data:null,error:new Error("InsForge not configured")}),signOut:async()=>{},getAccessToken:async()=>null}:{enabled:!0,client:e,user:a,signedIn:!!a,loading:s,displayName:B,refreshUser:c,refreshDisplayName:j,signInWithOAuth:u,signInWithPassword:h,signUp:p,sendResetPasswordEmail:m,exchangeResetPasswordToken:v,resetPassword:y,getPublicAuthConfig:b,signOut:x,getAccessToken:P},[e,a,s,B,c,j,u,h,p,m,v,y,b,x,P]);return R.jsx(jC.Provider,{value:S,children:t})}function ko(){return k.useContext(jC)}const zC=k.createContext(null),Ax="tt.cloudSyncChanged";function x9({children:t}){const e=ko(),n=!!e?.signedIn,a=!!e?.enabled,r=!!e?.loading,[s,l]=k.useState(()=>Rp()),[c,u]=k.useState(()=>Lp()),[h,p]=k.useState(0);k.useEffect(()=>{l(Rp()),S7()},[]),k.useEffect(()=>{if(typeof window>"u")return;const P=()=>{const T=Lp();u(L=>L===T?L:T)};return window.addEventListener(Ax,P),window.addEventListener("storage",P),()=>{window.removeEventListener(Ax,P),window.removeEventListener("storage",P)}},[]);const m=k.useMemo(()=>!a||!n?!1:s?c:!0,[a,n,s,c]),v=Cl.useRef(m);k.useEffect(()=>{v.current!==m&&(v.current=m,p(P=>P+1))},[m]);const b=r&&(a&&(!s||c)),x=k.useMemo(()=>({accountView:m,revision:h,localHost:s,resolving:b}),[m,h,s,b]);return R.jsx(zC.Provider,{value:x,children:t})}function VY(){const t=k.useContext(zC);return t||{accountView:!1,revision:0,localHost:!0,resolving:!1}}const P9=`key,module,page,component,slot,text,notes,status
|
|
42
|
+
`);r=c.pop()||"";for(const u of c)if(u.startsWith("data: ")){const h=u.slice(6).trim();if(h)try{const p=JSON.parse(h);if((p.chunk||p.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{content:p.chunk||p.content},finish_reason:null}]}),p.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e,choices:[{index:0,delta:{tool_calls:p.tool_calls},finish_reason:"tool_calls"}]}),p.done){n.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",h)}}}}finally{n.releaseLock()}}},h7=class{constructor(t){this.http=t}async create(t){const e=await this.http.post("/api/ai/embeddings",t);return{object:e.object,data:e.data,model:e.metadata?.model,usage:e.metadata?.usage?{prompt_tokens:e.metadata.usage.promptTokens||0,total_tokens:e.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},p7=class{constructor(t){this.http=t}async generate(t){const e=await this.http.post("/api/ai/image/generation",t);let n=[];return e.images&&e.images.length>0?n=e.images.map(a=>({b64_json:a.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:e.text})):e.text&&(n=[{content:e.text}]),{created:Math.floor(Date.now()/1e3),data:n,...e.metadata?.usage&&{usage:{total_tokens:e.metadata.usage.totalTokens||0,input_tokens:e.metadata.usage.promptTokens||0,output_tokens:e.metadata.usage.completionTokens||0}}}}},f7=class lC{constructor(e,n){this.http=e,this.functionsUrl=n||lC.deriveSubhostingUrl(e.baseUrl)}static deriveSubhostingUrl(e){try{const{hostname:n}=new URL(e);return n.endsWith(".insforge.app")?`https://${n.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(e,n={}){const{method:a="POST",body:r,headers:s={}}=n;if(this.functionsUrl)try{return{data:await this.http.request(a,`${this.functionsUrl}/${e}`,{body:r,headers:s}),error:null}}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l;if(!(l instanceof rt&&l.statusCode===404))return{data:null,error:l instanceof rt?l:new rt(l instanceof Error?l.message:"Function invocation failed",500,"FUNCTION_ERROR")}}try{const l=`/functions/${e}`;return{data:await this.http.request(a,l,{body:r,headers:s}),error:null}}catch(l){if(l instanceof Error&&l.name==="AbortError")throw l;return{data:null,error:l instanceof rt?l:new rt(l instanceof Error?l.message:"Function invocation failed",500,"FUNCTION_ERROR")}}}},vx=1e4,m7=class{constructor(t,e,n){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=t,this.tokenManager=e,this.anonKey=n,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(t,e){const n=this.eventListeners.get(t);if(n)for(const a of n)try{a(e)}catch(r){console.error(`Error in ${t} callback:`,r)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((t,e)=>{const n=this.tokenManager.getAccessToken()??this.anonKey;this.socket=Xh(this.baseUrl,{transports:["websocket"],auth:n?{token:n}:void 0});let a=!0,r=null;const s=()=>{r&&(clearTimeout(r),r=null)};r=setTimeout(()=>{a&&(a=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,e(new Error(`Connection timeout after ${vx}ms`)))},vx),this.socket.on("connect",()=>{s();for(const l of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:l});this.notifyListeners("connect"),a&&(a=!1,this.connectPromise=null,t())}),this.socket.on("connect_error",l=>{s(),this.notifyListeners("connect_error",l),a&&(a=!1,this.connectPromise=null,e(l))}),this.socket.on("disconnect",l=>{this.notifyListeners("disconnect",l)}),this.socket.on("realtime:error",l=>{this.notifyListeners("error",l)}),this.socket.onAny((l,c)=>{l!=="realtime:error"&&this.notifyListeners(l,c)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const t=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=t?{token:t}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(t){if(this.subscribedChannels.has(t))return{ok:!0,channel:t};if(!this.socket?.connected)try{await this.connect()}catch(e){const n=e instanceof Error?e.message:"Connection failed";return{ok:!1,channel:t,error:{code:"CONNECTION_FAILED",message:n}}}return new Promise(e=>{this.socket.emit("realtime:subscribe",{channel:t},n=>{n.ok&&this.subscribedChannels.add(t),e(n)})})}unsubscribe(t){this.subscribedChannels.delete(t),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:t})}async publish(t,e,n){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:t,event:e,payload:n})}on(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,new Set),this.eventListeners.get(t).add(e)}off(t,e){const n=this.eventListeners.get(t);n&&(n.delete(e),n.size===0&&this.eventListeners.delete(t))}once(t,e){const n=a=>{this.off(t,n),e(a)};this.on(t,n)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},g7=class{constructor(t){this.http=t}async send(t){try{return{data:await this.http.post("/api/email/send-raw",t),error:null}}catch(e){if(e instanceof Error&&e.name==="AbortError")throw e;return{data:null,error:e instanceof rt?e:new rt(e instanceof Error?e.message:"Email send failed",500,"EMAIL_ERROR")}}}},v7=class{constructor(t={}){const e=new nC(t.debug);this.tokenManager=new sC,this.http=new XM(t,this.tokenManager,e),t.edgeFunctionToken&&(this.http.setAuthToken(t.edgeFunctionToken),this.tokenManager.setAccessToken(t.edgeFunctionToken)),this.auth=new r7(this.http,this.tokenManager,{isServerMode:t.isServerMode??!1}),this.database=new s7(this.http,this.tokenManager),this.storage=new l7(this.http),this.ai=new c7(this.http),this.functions=new f7(this.http,t.functionsUrl),this.realtime=new m7(this.http.baseUrl,this.tokenManager,t.anonKey),this.emails=new g7(this.http)}getHttpClient(){return this.http}};function _7(t){return new v7(t)}const c0={VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"},cC="https://srctyff5.us-east.insforge.app",y7="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY";function Yr(){const t=typeof import.meta<"u"?c0:void 0;return(t?.VITE_INSFORGE_BASE_URL||t?.VITE_TOKENTRACKER_BACKEND_BASE_URL||cC).trim()}function dC(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return window.location.origin;const e=typeof import.meta<"u"?c0:void 0;return(e?.VITE_INSFORGE_BASE_URL||e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||cC).trim()}function Gl(){const t=typeof import.meta<"u"?c0:void 0;return(t?.VITE_INSFORGE_ANON_KEY||t?.VITE_TOKENTRACKER_BACKEND_ANON_KEY||y7).trim()}function f_(){return!!dC()}let $g=null;function b7(){return f_()?($g||($g=_7({baseUrl:dC(),anonKey:Gl()||void 0,autoRefreshToken:!0})),$g):null}const k7="modulepreload",w7=function(t){return"/"+t},_x={},In=function(e,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");r=u(n.map(h=>{if(h=w7(h),h in _x)return;_x[h]=!0;const p=h.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":k7,p||(v.as="script"),v.crossOrigin="",v.href=h,c&&v.setAttribute("nonce",c),document.head.appendChild(v),p)return new Promise((y,b)=>{v.addEventListener("load",y),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return r.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})},uC="tokentracker_cloud_sync_enabled",x7="tokentracker_cloud_device_session_v1",d0="tokentracker_cloud_last_sync_ts";let u0=null;function h0(){try{localStorage.removeItem(x7)}catch{}}function Rp(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Lp(){try{const t=localStorage.getItem(uC);return t===null||t===""?!0:t==="1"||t==="true"}catch{return!0}}function P7(t){try{localStorage.setItem(uC,t?"1":"0")}catch{}hC(t);try{typeof window<"u"&&window.dispatchEvent(new Event("tt.cloudSyncChanged"))}catch{}}async function hC(t){if(Rp())try{const{getLocalApiAuthHeaders:e}=await In(async()=>{const{getLocalApiAuthHeaders:a}=await Promise.resolve().then(()=>f9);return{getLocalApiAuthHeaders:a}},[]),n=await e();await fetch("/functions/tokentracker-cloud-sync-pref",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n},cache:"no-store",body:JSON.stringify({enabled:t})})}catch{}}function S7(){hC(Lp())}function pC(){return h0(),u0}function C7(t){u0=t,h0()}function fC(){u0=null;try{localStorage.removeItem(d0)}catch{}h0()}function T7(){try{const t=Number(localStorage.getItem(d0));return Number.isFinite(t)?t:0}catch{return 0}}function mC(t){try{localStorage.setItem(d0,String(t))}catch{}}function ss(t){if(typeof t!="string")return null;const e=t.trim();return e.length>0?e:null}function E7(t){const e=ss(t);if(!e)return null;const n=e.split(".");if(n.length<2)return null;const a=n[1];try{const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("utf8"),c=JSON.parse(s)?.exp;return typeof c!="number"||!Number.isFinite(c)||c<=0?null:Math.floor(c*1e3)}catch{return null}}function If(t){const e=ss(t);if(!e)return!1;const n=e.split(".");if(n.length!==3)return!1;try{for(let a=0;a<2;a++){const r=n[a];if(!/^[A-Za-z0-9_-]+$/.test(r))return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),l=typeof atob=="function"?atob(s):Buffer.from(s,"base64").toString("utf8");a===1&&JSON.parse(l)}return!0}catch{return!1}}function A7(t,e=3e4){const n=E7(t);return n?n<=Date.now()+Math.max(0,Number(e)||0):!1}async function R7(t){if(!t)return null;if(typeof t=="string")return ss(t);if(typeof t=="function")try{const e=await t();return ss(e)}catch{return null}if(typeof t=="object"){if(typeof t.getAccessToken=="function"){try{const e=await t.getAccessToken(),n=ss(e);if(n)return n}catch{}return ss(t.accessToken)}return null}return ss(t)}async function qK(t,e={}){const n=Math.max(1,Math.min(12,Math.floor(Number(e.maxAttempts)||8))),a=Math.max(20,Math.floor(Number(e.baseDelayMs)||50));for(let r=0;r<n;r++){const s=await R7(t);if(s)return s;r<n-1&&await new Promise(l=>setTimeout(l,a*(r+1)))}return null}function KK(t){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")||typeof t=="function"||t&&typeof t=="object"&&typeof t.getAccessToken=="function"?!0:!!ss(t)}function YK(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function ZK(t=new Date){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return 0;const n=e.getTimezoneOffset();return Number.isFinite(n)?-n:0}function gC(t){if(!Number.isFinite(t)||t===0)return"UTC";const e=t>=0?"+":"-",n=Math.abs(t),a=String(Math.floor(n/60)).padStart(2,"0"),r=String(n%60).padStart(2,"0");return`UTC${e}${a}:${r}`}function JK({timeZone:t,offsetMinutes:e}={}){const n=gC(e);return t&&t!=="UTC"?`${t} (${n})`:n}function QK({timeZone:t,offsetMinutes:e}={}){return Number.isFinite(e)?gC(e):t||"UTC"}function XK({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const a=n instanceof Date?n:new Date(n);if(!Number.isFinite(a.getTime()))return"";if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(a).reduce((p,m)=>(m.type&&m.value&&(p[m.type]=m.value),p),{}),c=l.year,u=l.month,h=l.day;if(c&&u&&h)return`${c}-${u}-${h}`}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(a.getTime()+e*6e4);return D7(r)}return I7(a)}function L7({timeZone:t,offsetMinutes:e,date:n=new Date}={}){const a=n instanceof Date?n:new Date(n);if(!Number.isFinite(a.getTime()))return null;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(a).reduce((p,m)=>(m.type&&m.value&&(p[m.type]=m.value),p),{}),c=Number(l.year),u=Number(l.month),h=Number(l.day);if(Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(h))return{year:c,month:u,day:h}}catch{}if(typeof e=="number"&&Number.isFinite(e)){const r=new Date(a.getTime()+e*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}}return{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}}function eY({timeZone:t,offsetMinutes:e}={}){return t?`tz:${t}`:typeof e=="number"&&Number.isFinite(e)?`offset:${Math.trunc(e)}`:"utc"}function D7(t){const e=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),a=String(t.getUTCDate()).padStart(2,"0");return`${e}-${n}-${a}`}function I7(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${a}`}function Kt(t){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())).toISOString().slice(0,10)}function Xr(t){const e=t instanceof Date?t:new Date(t);if(!Number.isFinite(e.getTime()))return"";const n=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${a}-${r}`}function M7(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const a=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const l=new Date(Date.UTC(a,r,s));return Number.isFinite(l.getTime())&&Kt(l)===e?l:null}function N7(t){if(!t)return"";const e=t.year,n=String(t.month).padStart(2,"0"),a=String(t.day).padStart(2,"0");return!e||!n||!a?"":`${e}-${n}-${a}`}function O7(t,{timeZone:e,offsetMinutes:n,now:a}={}){const r=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,s=L7({timeZone:e,offsetMinutes:n,date:r});if(!s){const u=Xr(new Date);return{from:u,to:u}}const l=N7(s),c=M7(l);if(!c)return{from:l,to:l};if(t==="day")return{from:l,to:l};if(t==="week"){const u=new Date(c),p=(u.getUTCDay()+6)%7;u.setUTCDate(u.getUTCDate()-p);const m=new Date(u);return m.setUTCDate(m.getUTCDate()+6),{from:Kt(u),to:Kt(m)}}if(t==="month"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1)),h=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()+1,0));return{from:Kt(u),to:Kt(h)}}if(t==="total"){const u=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth()-23,1));return{from:Kt(u),to:l}}return O7("week")}function vC(){return typeof window>"u"?null:window.localStorage||null}function _C(){return typeof navigator>"u"?null:navigator.clipboard||null}function j7(){return typeof window>"u"?null:window.ClipboardItem||null}function fd(t,{storage:e}={}){const n=e??vC();if(!n||typeof n.getItem!="function")return null;try{return n.getItem(t)}catch{return null}}function md(t,e,{storage:n}={}){const a=n??vC();if(!a||typeof a.setItem!="function")return!1;try{return a.setItem(t,e),!0}catch{return!1}}async function tY(t,{clipboard:e}={}){const n=e??_C();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function nY(t,{clipboard:e}={}){const n=e??_C(),a=j7();if(!t||!n||typeof n.write!="function"||!a)return!1;try{const r=t.type||"image/png",s=t.type&&t.type!==r?t.slice(0,t.size,r):t.type?t:t.slice(0,t.size,r),l=new a({[r]:s});return await n.write([l]),!0}catch{return!1}}const Id="USD",p0=["USD","EUR","GBP","CNY","JPY","HKD"],yC={USD:{symbol:"$",labelKey:"settings.appearance.currency.opt.usd"},EUR:{symbol:"€",labelKey:"settings.appearance.currency.opt.eur"},GBP:{symbol:"£",labelKey:"settings.appearance.currency.opt.gbp"},CNY:{symbol:"¥",labelKey:"settings.appearance.currency.opt.cny"},JPY:{symbol:"¥",labelKey:"settings.appearance.currency.opt.jpy"},HKD:{symbol:"HK$",labelKey:"settings.appearance.currency.opt.hkd"}},f0={USD:1,EUR:.92,GBP:.79,CNY:7.2,JPY:155,HKD:7.8},bC="tokentracker-currency",kC="tokentracker-exchange-rates",wC="tokentracker-exchange-rate-source",xC="tokentracker-exchange-rate-fetched-at";function Dp(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function m0(t){if(typeof t!="string")return Id;const e=t.trim().toUpperCase();return p0.includes(e)?e:Id}function ep(t){const e=typeof t=="string"?t.trim().toUpperCase():Id;return yC[e]?.symbol??"$"}function aY(){return p0.map(t=>({code:t,...yC[t]}))}function z7(){return m0(fd(bC))}function F7(t){return md(bC,m0(t))}function PC(t){return t==="fetched"?"fetched":"default"}function U7(t){if(t==null)return null;try{const e=JSON.parse(String(t));if(!e||typeof e!="object")return null;const n={};for(const[a,r]of Object.entries(e)){const s=Number(r);Number.isFinite(s)&&s>0&&(n[a.toUpperCase()]=s)}return n}catch{return null}}function B7(){const t=U7(fd(kC)),e=fd(xC),n=e==null?NaN:Number(e),a=Number.isFinite(n)&&n>0?n:null,r=fd(wC),s=PC(r);return t&&Object.keys(t).length>0?{rates:{USD:1,...t},source:s,fetchedAt:a}:{rates:{...f0},source:"default",fetchedAt:null}}function $7(t){const{rates:e,source:n,fetchedAt:a}=t;if(!e||typeof e!="object")return!1;const r=md(kC,JSON.stringify(e)),s=md(wC,PC(n)),l=a?md(xC,String(a)):!0;return r&&s&&l}function Vg(t,e){if(e===Id)return 1;const n=t?.[e];if(Dp(n))return n;const a=f0[e];return Dp(a)?a:1}function SC(t){if(t==null)return"-";try{if(typeof t=="bigint")return new Intl.NumberFormat().format(t);if(typeof t=="number")return new Intl.NumberFormat().format(t);const e=String(t).trim();return/^[0-9]+$/.test(e)?new Intl.NumberFormat().format(BigInt(e)):e}catch{return String(t)}}function V7(t,{thousandSuffix:e="K",millionSuffix:n="M",billionSuffix:a="B",decimals:r=1}={}){const s=Number(String(t));if(!Number.isFinite(s))return"-";const l=s<0?"-":"",c=Math.abs(s),u=Math.max(0,Math.min(6,Math.floor(r)));if(c<1e3)return`${l}${String(c)}`;const h=(y,b)=>{const x=y.toFixed(u),P=Number(x).toString();return`${l}${P}${b}`},p=(y,b,x)=>{const P=y.toFixed(u),T=Number(P);return x&&T>=1e3?h(T/1e3,x):`${l}${T.toString()}${b}`};if(c>=1e9)return h(c/1e9,a);if(c>=1e6)return p(c/1e6,n,a);const m=c/1e3,v=Number(m.toFixed(u));return v>=1e3?h(v/1e3,n):h(v,e)}function CC(t){const e=Number(String(t));return Number.isFinite(e)?e:null}function rY(t,e={}){const{decimals:n=2,currency:a="USD",rate:r=1}=e;if(t==null||typeof t=="string"&&t.trim()==="")return"-";let s;if(typeof t=="number")s=t;else if(typeof t=="bigint")s=Number(t);else{const P=String(t).trim(),T=Number(P);if(!Number.isFinite(T))return P;s=T}if(!Number.isFinite(s))return String(t);const l=ep(a);a!=="USD"&&typeof r=="number"&&Number.isFinite(r)&&r>0&&(s=s*r);const u=s.toFixed(6).match(/^(-?\d+)(?:\.(\d+))?$/);if(!u)return`${l}${String(s)}`;const h=u[1],p=u[2]||"";let m=h;try{m=new Intl.NumberFormat().format(BigInt(h))}catch{m=h}const v=Math.max(0,Math.min(6,Math.floor(n))),y=v?p.slice(0,v).padEnd(v,"0"):"",b=h.startsWith("-")?"-":"",x=v?`${m.replace("-","")}.${y}`:m.replace("-","");return`${b}${l}${x}`}function Ip(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),a=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,a,r));return Number.isFinite(s.getTime())&&Kt(s)===t.trim()?s:null}function Js(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function H7(t,e){const n=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.floor(n/864e5)}function Hg(t,e){if(!Array.isArray(t)||t.length===0)return 0;const n=t.length,a=(n-1)*e,r=Math.floor(a),s=a-r,l=t[r]??t[n-1],c=t[Math.min(n-1,r+1)]??t[n-1];return Math.round(l+(c-l)*s)}function W7(t){return t<=0?0:t>=4?4:t}function TC({weeks:t=52,now:e,weekStartsOn:n="sun"}={}){const a=e instanceof Date&&Number.isFinite(e.getTime())?e:new Date,r=Xr(a),s=Ip(r)||new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate())),l=n==="mon"?1:0,c=s.getUTCDay(),u=Js(s,-((c-l+7)%7)),h=Js(u,-7*(Math.max(1,t)-1));return{from:Kt(h),to:r}}function G7({dailyRows:t,weeks:e=52,to:n,weekStartsOn:a="sun"}={}){const r=Ip(n)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:s}=TC({weeks:e,now:r,weekStartsOn:a}),l=Ip(s)||Js(r,-(e*7-1)),c=(()=>{const A=(l.getUTCDay()-(a==="mon"?1:0)+7)%7;return Js(l,-A)})(),u=new Map;for(const L of Array.isArray(t)?t:[]){const E=typeof L?.day=="string"?L.day:null;if(!E)continue;const A=CC(L?.billable_total_tokens??L?.total_tokens)??0;u.set(E,{value:Math.max(0,A),models:L?.models||null})}const h=H7(c,r)+1,p=Math.ceil(h/7),m=[];for(let L=0;L<h;L++){const E=Js(c,L),A=Kt(E),D=u.get(A),B=D?D.value:0;B>0&&m.push(B)}m.sort((L,E)=>L-E);const v=Hg(m,.5),y=Hg(m,.75),b=Hg(m,.9);function x(L){return!L||L<=0?0:L<=v?1:L<=y?2:L<=b?3:4}const P=[];for(let L=0;L<p;L++){const E=[];for(let A=0;A<7;A++){const D=L*7+A,B=Js(c,D);if(B.getTime()>r.getTime()){E.push(null);continue}const j=Kt(B),S=u.get(j),N=S?S.value:0,U=S?S.models:null;E.push({day:j,value:N,level:W7(x(N)),models:U})}P.push(E)}const T=P.length>e?P.slice(P.length-e):P;return{from:s,to:Kt(r),weeks:T,thresholds:{t1:v,t2:y,t3:b}}}function q7({dailyRows:t,to:e}={}){const n=Ip(e)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),a=new Map;for(const s of Array.isArray(t)?t:[]){const l=typeof s?.day=="string"?s.day:null;if(!l)continue;const c=CC(s?.billable_total_tokens??s?.total_tokens)??0;a.set(l,Math.max(0,c))}let r=0;for(let s=0;s<370;s++){const l=Kt(Js(n,-s));if((a.get(l)??0)>0){r+=1;continue}break}return r}const Mf={},EC="tokentracker",m_=["tokentracker/tokentracker","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],yx=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function bn(){if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock")||"").toLowerCase();if(e==="0"||e==="false"||e==="off"||e==="no")return!1;if(e==="1"||e==="true"||e==="on"||e==="yes")return!0}if(typeof import.meta<"u"&&Mf){const t="".toLowerCase();if(t==="1"||t==="true")return!0}return!1}function K7(){if(typeof import.meta<"u"&&Mf){const t="".trim();if(t)return t;const e="".trim();if(e)return e}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_now")||"").trim();if(e)return e;const n=String(t.get("mock_today")||"").trim();if(n)return n}return""}function Y7(t){if(!t)return null;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[a,r,s]=e.split("-").map(Number);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const l=new Date(a,r-1,s,12,0,0);return Number.isFinite(l.getTime())?l:null}const n=new Date(e);return Number.isFinite(n.getTime())?n:null}function iY(){return bn()?Y7(K7()):null}function Z7(){if(typeof import.meta<"u"&&Mf){const t="".trim();if(t)return t}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_seed")||"").trim();if(e)return e}return EC}function J7(){if(typeof import.meta<"u"&&Mf){const t="".trim(),e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}if(typeof window<"u"){const t=new URLSearchParams(window.location.search),e=String(t.get("mock_missing")||"").trim(),n=Number(e);if(Number.isFinite(n)&&n>0)return Math.floor(n)}return 0}function ql(t){return(t==null?Z7():String(t)).trim()||EC}function mo(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function oa(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=Number(e[1]),a=Number(e[2])-1,r=Number(e[3]),s=new Date(Date.UTC(n,a,r));return Number.isFinite(s.getTime())&&Kt(s)===t.trim()?s:null}function Md(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function AC(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+e,1))}function Q7(t){return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}`}function Ll({from:t,to:e,seed:n}){const a=oa(Xr(new Date))||new Date,r=oa(t)||a,s=oa(e)||r,l=[],c=ql(n),u=Math.floor((Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())-Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()))/864e5)+1;for(let h=0;h<u;h+=1){const p=Md(r,h),m=Kt(p),v=mo(`${c}:${m}`),y=v%1e3/1e3,b=.6+.4*Math.sin(h/6*Math.PI*.5),x=p.getUTCDay()===0||p.getUTCDay()===6?.65:1,P=18e3+Math.round(12e3*y),T=Math.max(0,Math.round(P*b*x)),L=Math.round(T*.46),E=Math.round(T*.34),A=Math.round(T*.14),D=Math.max(0,T-L-E-A),B={};if(T>0){const j=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],S=1+v%3;let N=T;for(let U=0;U<S;U++){const Q=j[(v+U)%j.length];if(U===S-1)B[Q]=N;else{const ee=Math.round(N*(.3+.4*((v+U*17)%10)/10));B[Q]=ee,N-=ee}}}l.push({day:m,total_tokens:T,billable_total_tokens:T,input_tokens:L,output_tokens:E,cached_input_tokens:A,reasoning_output_tokens:D,conversation_count:1+v%5,models:B})}return l}function X7({day:t,seed:e}){const n=oa(t)||oa(Xr(new Date))||new Date,a=Kt(n),r=ql(e),s=Array.from({length:48},(c,u)=>{const h=Math.floor(u/2),p=u%2===0?0:30,m=mo(`${r}:${a}:${h}:${p}`),v=m%1e3/1e3,y=(h+p/60)/24,b=.4+.6*Math.sin(y*Math.PI*2),x=900+Math.round(700*v),P=Math.max(0,Math.round(x*b)),T=Math.round(P*.46),L=Math.round(P*.34),E=Math.round(P*.14),A=Math.max(0,P-T-L-E),D={};if(P>0){const B=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],j=1+m%2;let S=P;for(let N=0;N<j;N++){const U=B[(m+N)%B.length];if(N===j-1)D[U]=S;else{const Q=Math.round(S*(.3+.4*((m+N*17)%10)/10));D[U]=Q,S-=Q}}}return{hour:`${a}T${String(h).padStart(2,"0")}:${String(p).padStart(2,"0")}:00`,total_tokens:P,billable_total_tokens:P,input_tokens:T,output_tokens:L,cached_input_tokens:E,reasoning_output_tokens:A,models:D}}),l=Math.max(0,Math.min(48,J7()));if(l>0){const c=Date.now(),u=s.map((m,v)=>{const y=Date.parse(m.hour);return Number.isFinite(y)&&y<=c?{index:v,ts:y}:null}).filter(Boolean),h=Math.max(0,u.length-l),p=u.slice(h);for(const m of p){const v=s[m.index];v&&(s[m.index]={...v,missing:!0})}}return s}function e9({months:t=24,to:e,seed:n}){const a=oa(e)||oa(Xr(new Date))||new Date,r=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1)),s=ql(n),l=[];for(let c=t-1;c>=0;c-=1){const u=AC(r,-c),h=Q7(u),p=mo(`${s}:${h}`),m=p%1e3/1e3,v=.7+.3*Math.sin(l.length/6*Math.PI*.5),y=36e4+Math.round(2e5*m),b=Math.max(0,Math.round(y*v)),x=Math.round(b*.46),P=Math.round(b*.34),T=Math.round(b*.14),L=Math.max(0,b-x-P-T),E={};if(b>0){const A=["gpt-4o","claude-3.5-sonnet","gemini-1.5-pro","deepseek-coder"],D=1+p%3;let B=b;for(let j=0;j<D;j++){const S=A[(p+j)%A.length];if(j===D-1)E[S]=B;else{const N=Math.round(B*(.3+.4*((p+j*17)%10)/10));E[S]=N,B-=N}}}l.push({month:h,total_tokens:b,billable_total_tokens:b,input_tokens:x,output_tokens:P,cached_input_tokens:T,reasoning_output_tokens:L,models:E})}return l}function g0(t){return t.reduce((e,n)=>(e.total_tokens+=Number(n.total_tokens||0),e.billable_total_tokens+=Number(n.billable_total_tokens||n.total_tokens||0),e.input_tokens+=Number(n.input_tokens||0),e.output_tokens+=Number(n.output_tokens||0),e.cached_input_tokens+=Number(n.cached_input_tokens||0),e.reasoning_output_tokens+=Number(n.reasoning_output_tokens||0),e.conversation_count+=Number(n.conversation_count||0),e),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function t9(t,e=1.75){const n=Number(t||0);return!Number.isFinite(n)||n<=0?"0.000000":(n*e/1e6).toFixed(6)}function bx(t,e){const n=Number.isFinite(e)?e:0;return{total_tokens:Math.max(0,Math.round(t.total_tokens*n)),billable_total_tokens:Math.max(0,Math.round((t.billable_total_tokens??t.total_tokens)*n)),input_tokens:Math.max(0,Math.round(t.input_tokens*n)),output_tokens:Math.max(0,Math.round(t.output_tokens*n)),cached_input_tokens:Math.max(0,Math.round(t.cached_input_tokens*n)),reasoning_output_tokens:Math.max(0,Math.round(t.reasoning_output_tokens*n))}}function g_(t){return{...t,total_cost_usd:t9(t.total_tokens)}}function n9({from:t,to:e,seed:n}={}){const a=Ll({from:t,to:e,seed:n});return{from:t,to:e,data:a}}function a9({day:t,seed:e}={}){const n=oa(t)||new Date,a=Kt(n),r=X7({day:a,seed:e});return{day:a,data:r}}function r9({months:t=24,to:e,seed:n}={}){const a=oa(e)||oa(Xr(new Date))||new Date,r=Kt(a),s=e9({months:t,to:r,seed:n}),l=AC(new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1)),-(t-1));return{from:Kt(l),to:r,months:t,data:s}}function i9({from:t,to:e,seed:n,rolling:a=!0}={}){const r=Ll({from:t,to:e,seed:n}),s=g0(r),l=g_(s),c=a?s9({to:e,seed:n}):null;return{from:t,to:e,days:r.length,totals:l,...c?{rolling:c}:{}}}function s9({to:t,seed:e}={}){const n=oa(t)||oa(Xr(new Date))||new Date,a=Kt(n),r=Kt(Md(n,-6)),s=Kt(Md(n,-29)),l=Ll({from:r,to:a,seed:e}),c=Ll({from:s,to:a,seed:e});return{last_7d:kx({rows:l,from:r,to:a}),last_30d:kx({rows:c,from:s,to:a})}}function kx({rows:t,from:e,to:n}={}){const a=g0(t||[]),r=(t||[]).filter(l=>Number(l.billable_total_tokens??l.total_tokens)>0).length,s=r>0?Math.floor(a.billable_total_tokens/r):0;return{from:e,to:n,totals:{billable_total_tokens:a.billable_total_tokens,conversation_count:a.conversation_count},active_days:r,avg_per_active_day:s}}const wx=["claude","codex","gemini","cursor","opencode","kilo"];function RC(t,e,n){const a=mo(`${n}:${t}`),r=12e4+a%9e5,s=e%4*4200,l=Math.max(0,r+s),c=Math.max(0,Math.round(l*.96)),u=1+a%4;let h=l;const p=Array.from({length:u},(b,x)=>{const T=x===u-1?h:Math.floor(h*(.4+(a>>x)%3*.1));return h-=T,{source:wx[(a+x)%wx.length],total_tokens:T}}).sort((b,x)=>x.total_tokens-b.total_tokens),m=Math.floor(l*.7),v=Math.floor(l*.12),y=Math.floor(l*.1);return{project_key:t,project_ref:`https://github.com/${t}`,total_tokens:String(l),billable_total_tokens:String(c),input_tokens:v,output_tokens:y,cached_input_tokens:m,cache_creation_input_tokens:Math.floor(l*.06),reasoning_output_tokens:Math.floor(l*.02),conversation_count:5+a%120,mockDayCount:1+a%14,sources:p}}function o9({seed:t,limit:e=3}={}){const n=ql(t),a=m_.map((r,s)=>{const{mockDayCount:l,...c}=RC(r,s,n);return c}).sort((r,s)=>Number(s.billable_total_tokens)-Number(r.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(e)||3))));return{generated_at:new Date().toISOString(),entries:a}}function l9({projectKey:t,from:e,to:n}={}){const a=typeof t=="string"&&t?t:m_[0],r=Math.max(0,m_.indexOf(a)),s=RC(a,r,ql(a)),l=Number(s.total_tokens),c=s.mockDayCount,u=new Date,h=Array.from({length:c},(p,m)=>{const v=new Date(u.getTime()-(c-1-m)*864e5),y=mo(`${a}:${m}`),b=Math.floor(l/c*(.4+y%120/100)),x=s.sources[0]?.source||"claude",P=s.sources[1]?.source,T={[x]:Math.floor(b*.8)};return P&&(T[P]=b-T[x]),{day:v.toISOString().slice(0,10),total_tokens:b,billable_total_tokens:b,input_tokens:Math.floor(b*.12),output_tokens:Math.floor(b*.1),cached_input_tokens:Math.floor(b*.7),cache_creation_input_tokens:Math.floor(b*.06),reasoning_output_tokens:Math.floor(b*.02),conversation_count:1+y%20,models:T}});return{generated_at:new Date().toISOString(),from:e||h[0]?.day||"",to:n||h[h.length-1]?.day||"",project_key:a,project_ref:s.project_ref,totals:{total_tokens:l,billable_total_tokens:Number(s.billable_total_tokens),input_tokens:s.input_tokens,output_tokens:s.output_tokens,cached_input_tokens:s.cached_input_tokens,cache_creation_input_tokens:s.cache_creation_input_tokens,reasoning_output_tokens:s.reasoning_output_tokens,conversation_count:s.conversation_count},days_active:c,range_total_tokens:l*3,daily:h,sources:s.sources.map((p,m)=>({source:p.source,total_tokens:p.total_tokens,conversation_count:1+mo(`${a}:src:${m}`)%60,days_active:Math.max(1,c-m)}))}}function c9(t){const e=oa(Xr(new Date))||new Date,n=String(t).trim().toLowerCase()||"week";if(n==="total")return{from:"1970-01-01",to:"9999-12-31"};if(n==="month"){const l=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),c=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0));return{from:Kt(l),to:Kt(c)}}const a=e.getUTCDay(),r=Kt(Md(e,-a)),s=Kt(Md(e,-a+6));return{from:r,to:s}}const xx=["token_titan","big_day","wordsmith","marathoner","streak","weekend_warrior","momentum","polyglot","trendsetter","multitool","podium","veteran"];function Px(t){const e=t%4,n=[];for(let a=0;a<e;a+=1){const r=xx[(t*3+a*5)%xx.length];n.some(s=>s.id===r)||n.push({id:r,tier:4-a>0?(t+a)%4+1:1})}return n.sort((a,r)=>r.tier-a.tier)}function v0(){const t=Date.now(),e=a=>new Date(t-a*864e5).toISOString(),n=(a,r,s,l,c={})=>{const u=!["project_hopper","project_devotion","night_owl"].includes(a);return{id:a,tier:r,metric_value:s,thresholds:l,lower_is_better:a==="podium",next_threshold:r>=4?null:l[r],achieved:{bronze:r>=1?e(90):null,silver:r>=2?e(45):null,gold:r>=3?e(12):null,diamond:r>=4?e(2):null},serials:u?{bronze:r>=1?127+a.length:null,silver:r>=2?64+a.length:null,gold:r>=3?18+a.length:null,diamond:r>=4?3+a.length:null}:void 0,meta:c}};return{generated_at:new Date(t).toISOString(),achievements:[n("token_titan",3,245e8,[1e8,1e9,1e10,1e11]),n("big_day",1,92e6,[1e7,1e8,5e8,3e9],{date:e(12).slice(0,10)}),n("wordsmith",2,31e6,[5e6,25e6,1e8,3e8]),n("marathoner",2,61,[7,30,100,365]),n("streak",1,5,[3,7,30,100]),n("weekend_warrior",2,26,[5,20,50,100]),n("momentum",0,1.2,[2,6,15,40]),n("polyglot",1,11,[5,15,30,60],{favorite_model:"claude-opus-4-7"}),n("trendsetter",2,7,[2,5,10,20]),n("multitool",3,7,[2,4,6,10]),n("podium",1,42,[100,30,10,3]),n("veteran",2,132,[30,90,180,365],{first_day:e(132).slice(0,10)}),n("project_hopper",2,6,[3,5,10,20]),n("project_devotion",3,24e7,[1e6,1e7,1e8,1e9],{project_key:"mock"}),n("night_owl",1,9,[5,20,60,150])]}}function LC({seed:t,period:e,metric:n,limit:a=20,offset:r=0}={}){const s=ql(t),l=Math.max(1,Math.min(100,Math.floor(Number(a)||20))),c=Math.max(0,Math.min(1e4,Math.floor(Number(r)||0))),u=String(n||"all").trim().toLowerCase()||"all",h=String(e||"week").trim().toLowerCase()||"week",p=h==="month"||h==="total"||h==="week"?h:"week",{from:m,to:v}=c9(p),y=250,b=y>0?Math.ceil(y/l):0,x=Math.floor(c/l)+1,P=Array.from({length:y},(j,S)=>{const N=S+1,U=`00000000-0000-0000-0000-${String(N).padStart(12,"0")}`,Q=yx[N%yx.length],ce=18e4+mo(`${s}:${Q}:${N}`)%9e5,le=Math.max(0,ce+N*1200),re=Math.floor(le*.28),te=Math.floor(le*.18),ie=Math.floor(le*.1),$=Math.floor(le*.1),X=Math.floor(le*.08),W=Math.floor(le*.03),O=Math.floor(le*.02),Y=Math.floor(le*.04),ae=Math.floor(le*.03),_e=Math.max(0,le-re-te-ie-$-X-W-O-Y-ae),fe=N%7!==0;return{id:N,user_id:U,is_public:fe,is_me:!1,display_name:fe?Q:"Anonymous",avatar_url:null,gpt_tokens:re,claude_tokens:te,gemini_tokens:ie,cursor_tokens:$,opencode_tokens:X,openclaw_tokens:_e,hermes_tokens:W,kiro_tokens:O,copilot_tokens:Y,kimi_tokens:ae,other_tokens:0,total_tokens:le}}),T=Math.max(0,Math.min(y-1,Math.floor(y*.8)));P[T]&&(P[T].is_me=!0);const L=u==="gpt"||u==="codex"?"gpt_tokens":u==="claude"?"claude_tokens":u==="gemini"?"gemini_tokens":u==="cursor"?"cursor_tokens":u==="opencode"?"opencode_tokens":u==="openclaw"?"openclaw_tokens":u==="hermes"?"hermes_tokens":u==="kiro"?"kiro_tokens":u==="copilot"?"copilot_tokens":u==="kimi"?"kimi_tokens":"total_tokens",E=P.slice().sort((j,S)=>Number(S[L])-Number(j[L])||j.id-S.id).map((j,S)=>({user_id:j.is_public?j.user_id:null,rank:S+1,is_me:!!j.is_me,display_name:j.display_name,avatar_url:j.avatar_url,gpt_tokens:String(j.gpt_tokens),claude_tokens:String(j.claude_tokens),gemini_tokens:String(j.gemini_tokens),cursor_tokens:String(j.cursor_tokens),opencode_tokens:String(j.opencode_tokens),openclaw_tokens:String(j.openclaw_tokens),hermes_tokens:String(j.hermes_tokens??0),kiro_tokens:String(j.kiro_tokens??0),copilot_tokens:String(j.copilot_tokens??0),kimi_tokens:String(j.kimi_tokens??0),other_tokens:String(j.other_tokens??0),total_tokens:String(j.total_tokens),is_public:!!j.is_public,github_url:j.id%3===0?"https://github.com/mm7894215/TokenTracker":null,badges:Px(j.id),badge_count:Px(j.id).length})),A=E.find(j=>j?.is_me)||null,D=A?{rank:A.rank,gpt_tokens:A.gpt_tokens,claude_tokens:A.claude_tokens,gemini_tokens:A.gemini_tokens,cursor_tokens:A.cursor_tokens,opencode_tokens:A.opencode_tokens,openclaw_tokens:A.openclaw_tokens,hermes_tokens:A.hermes_tokens,kiro_tokens:A.kiro_tokens,copilot_tokens:A.copilot_tokens,kimi_tokens:A.kimi_tokens,other_tokens:A.other_tokens,total_tokens:A.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",gemini_tokens:"0",cursor_tokens:"0",opencode_tokens:"0",openclaw_tokens:"0",hermes_tokens:"0",kiro_tokens:"0",copilot_tokens:"0",kimi_tokens:"0",other_tokens:"0",total_tokens:"0"},B=E.slice(c,c+l);return{period:p,metric:u,from:m,to:v,generated_at:new Date().toISOString(),page:x,limit:l,offset:c,total_entries:y,total_pages:b,entries:B,me:D}}function d9({weeks:t=52,to:e,weekStartsOn:n="sun",seed:a}={}){const r=TC({weeks:t,now:oa(e)||oa(Xr(new Date))||new Date,weekStartsOn:n}),s=Ll({from:r.from,to:r.to,seed:a});return{...G7({dailyRows:s,weeks:t,to:r.to,weekStartsOn:n}),week_starts_on:n,active_days:s.filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,streak_days:q7({dailyRows:s,to:r.to})}}function u9({from:t,to:e,seed:n}={}){const a=Ll({from:t,to:e,seed:n}),r=g0(a),l=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(c=>{const u=bx(r,c.weight),h=c.models.map(p=>{const m=bx(u,p.weight);return{model:p.model,model_id:p.model_id||p.model,totals:g_(m)}});return{source:c.source,totals:g_(u),models:h}});return{from:t,to:e,days:a.length,sources:l,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:Xr(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}function h9({from:t,to:e,source:n="claude"}={}){if(n==="codex")return{from:t,to:e,source:"codex",scope:"supported",totals:{input_tokens:142e4,cached_input_tokens:588e4,cache_creation_input_tokens:92e4,output_tokens:256e4,reasoning_output_tokens:61e4,total_tokens:1078e4},session_count:188,message_count:5436,tool_calls_breakdown:{categories:[{name:"Execution",calls:742,totals:{input_tokens:32e4,cached_input_tokens:104e4,cache_creation_input_tokens:11e4,output_tokens:46e4,reasoning_output_tokens:12e4,total_tokens:193e4},tools:[{name:"exec_command",calls:510,totals:{input_tokens:25e4,cached_input_tokens:82e4,cache_creation_input_tokens:8e4,output_tokens:37e4,reasoning_output_tokens:9e4,total_tokens:152e4}},{name:"write_stdin",calls:232,totals:{input_tokens:7e4,cached_input_tokens:22e4,cache_creation_input_tokens:3e4,output_tokens:9e4,reasoning_output_tokens:3e4,total_tokens:41e4}}]},{name:"Browser",calls:406,totals:{input_tokens:21e4,cached_input_tokens:88e4,cache_creation_input_tokens:9e4,output_tokens:42e4,reasoning_output_tokens:1e5,total_tokens:17e5},tools:[{name:"take_snapshot",calls:180,totals:{input_tokens:1e5,cached_input_tokens:4e5,cache_creation_input_tokens:4e4,output_tokens:18e4,reasoning_output_tokens:4e4,total_tokens:76e4}},{name:"click",calls:126,totals:{input_tokens:6e4,cached_input_tokens:25e4,cache_creation_input_tokens:3e4,output_tokens:12e4,reasoning_output_tokens:35e3,total_tokens:495e3}},{name:"evaluate_script",calls:100,totals:{input_tokens:5e4,cached_input_tokens:23e4,cache_creation_input_tokens:2e4,output_tokens:12e4,reasoning_output_tokens:25e3,total_tokens:445e3}}]}],tools_total:363e4,privacy:{includes_inputs:!1,note:"Aggregated tool names only; no tool arguments or outputs are included."}},exec_command_breakdown:{by_type:[{name:"test",calls:168,failures:14,duration_ms:482e3,max_duration_ms:18400,output_chars:45e4,output_lines:8600,totals:{input_tokens:9e4,cached_input_tokens:32e4,output_tokens:16e4,reasoning_output_tokens:42e3,total_tokens:612e3}},{name:"build",calls:116,failures:9,duration_ms:392e3,max_duration_ms:22100,output_chars:31e4,output_lines:5200,totals:{input_tokens:7e4,cached_input_tokens:24e4,output_tokens:13e4,reasoning_output_tokens:3e4,total_tokens:47e4}}],by_exit:[{name:"completed:0",calls:438,failures:0,duration_ms:104e4,max_duration_ms:22100,output_chars:83e4,output_lines:13100,totals:{input_tokens:22e4,cached_input_tokens:78e4,output_tokens:35e4,reasoning_output_tokens:82e3,total_tokens:1432e3}},{name:"completed:1",calls:72,failures:72,duration_ms:155e3,max_duration_ms:11800,output_chars:12e4,output_lines:2300,totals:{input_tokens:3e4,cached_input_tokens:11e4,output_tokens:55e3,reasoning_output_tokens:8e3,total_tokens:195e3}}]}};if(n!=="claude")return{from:t,to:e,source:n,scope:"unsupported",totals:{input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0},categories:["system_prefix","conversation_history","user_input","tool_calls","subagents","reasoning","assistant_response"].map(l=>({key:l,totals:{input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0},percent:0})),session_count:0,message_count:0};const a=[{key:"system_prefix",total:12896539},{key:"conversation_history",total:320207200},{key:"user_input",total:998025},{key:"tool_calls",total:4808739},{key:"subagents",total:1022828},{key:"reasoning",total:11073118},{key:"assistant_response",total:1289174}],r=a.reduce((l,c)=>l+c.total,0),s=a.map(({key:l,total:c})=>({key:l,totals:{input_tokens:l==="user_input"?c:0,cached_input_tokens:l==="conversation_history"?Math.round(c*.95):0,cache_creation_input_tokens:l==="system_prefix"?c:l==="conversation_history"?Math.round(c*.05):0,output_tokens:["tool_calls","subagents","reasoning","assistant_response"].includes(l)?c:0,reasoning_output_tokens:l==="reasoning"?c:0,total_tokens:c},percent:Number((c/r*100).toFixed(2))}));return{from:t,to:e,source:"claude",scope:"supported",totals:{input_tokens:998025,cached_input_tokens:Math.round(320207200*.95),cache_creation_input_tokens:12896539+Math.round(320207200*.05),output_tokens:18193859,reasoning_output_tokens:11073118,total_tokens:r},categories:s,session_count:312,message_count:12046}}let tp=null;function DC(){tp=null}async function p9(t=fetch){if(tp)return tp;const e=await t("/api/local-auth",{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!e.ok)throw new Error(`Local auth request failed with HTTP ${e.status}`);const n=await e.json().catch(()=>null),a=typeof n?.token=="string"?n.token.trim():"";if(!a)throw new Error("Local auth token missing from response");return tp=a,a}async function eu(t=fetch){return{"x-tokentracker-local-auth":await p9(t)}}const f9=Object.freeze(Object.defineProperty({__proto__:null,clearLocalApiAuthToken:DC,getLocalApiAuthHeaders:eu},Symbol.toStringTag,{value:"Module"})),yh=new Map;function v_(t,e){const n=yh.get(t);if(n)return n;const a=e();yh.set(t,a);const r=()=>{yh.get(t)===a&&yh.delete(t)};return a.then(r,r),a}const ba={usageSummary:"tokentracker-usage-summary",usageDaily:"tokentracker-usage-daily",usageHourly:"tokentracker-usage-hourly",usageMonthly:"tokentracker-usage-monthly",usageHeatmap:"tokentracker-usage-heatmap",usageModelBreakdown:"tokentracker-usage-model-breakdown",usageCategoryBreakdown:"tokentracker-usage-category-breakdown",projectUsageSummary:"tokentracker-project-usage-summary",projectUsageDetail:"tokentracker-project-usage-detail",achievements:"tokentracker-achievements",userStatus:"tokentracker-user-status",localSync:"tokentracker-local-sync",usageLimits:"tokentracker-usage-limits",outcomes:"tokentracker-outcomes"},m9={"tokentracker-usage-summary":"tokentracker-account-summary","tokentracker-usage-daily":"tokentracker-account-daily","tokentracker-usage-hourly":"tokentracker-account-hourly","tokentracker-usage-monthly":"tokentracker-account-monthly","tokentracker-usage-heatmap":"tokentracker-account-heatmap","tokentracker-usage-model-breakdown":"tokentracker-account-model-breakdown"};function g9(){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1")}async function Ma(t,e,n){const a=n?.accessToken,r=m9[t];if(!g9()&&a&&r){const u=Yr().replace(/\/$/,""),h=new URL(`${u}/functions/${r}`);if(e)for(const[v,y]of Object.entries(e))y!=null&&y!==""&&h.searchParams.set(v,String(y));const p={Accept:"application/json"},m=Gl();return m&&(p.apikey=m),If(a)&&(p.Authorization=`Bearer ${a}`),v_(`${h.toString()}\0${a}`,async()=>{const v=await fetch(h.toString(),{headers:p,cache:"no-store"});if(!v.ok){const y=new Error(`Request failed with HTTP ${v.status}`);throw y.status=v.status,y}return v.json()})}const s=new URL(`/functions/${t}`,window.location.origin);if(e)for(const[u,h]of Object.entries(e))h!=null&&h!==""&&s.searchParams.set(u,String(h));const{accessToken:l,...c}=n||{};return v_(s.toString(),async()=>{const u=await fetch(s.toString(),{headers:{Accept:"application/json"},cache:"no-store",...c});if(!u.ok){const h=new Error(`Request failed with HTTP ${u.status}`);throw h.status=u.status,h}return u.json()})}function $n({timeZone:t,tzOffsetMinutes:e}={}){const n={},a=typeof t=="string"?t.trim():"";return a&&(n.tz=a),Number.isFinite(e)&&(n.tz_offset_minutes=String(Math.trunc(e))),n}function ka({source:t,model:e,device:n}={}){const a={},r=typeof t=="string"?t.trim().toLowerCase():"";r&&(a.source=r);const s=typeof e=="string"?e.trim():"";s&&(a.model=s);const l=typeof n=="string"?n.trim():"";return l&&(a.device_id=l),a}async function sY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,rolling:c=!1,accessToken:u}={}){if(bn())return i9({from:t,to:e,seed:u,rolling:c});const h=$n({timeZone:s,tzOffsetMinutes:l}),p=ka({source:n,model:a,device:r}),m=c?{rolling:"1"}:{};return Ma(ba.usageSummary,{from:t,to:e,...p,...h,...m},{accessToken:u})}async function oY({from:t,to:e,source:n,limit:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return o9({seed:l,limit:a});const c=$n({timeZone:r,tzOffsetMinutes:s}),h={...ka({source:n}),...c};return t&&(h.from=t),e&&(h.to=e),a!=null&&(h.limit=String(a)),Ma(ba.projectUsageSummary,h)}async function lY({projectKey:t,from:e,to:n,timeZone:a,tzOffsetMinutes:r}={}){if(bn())return l9({projectKey:t,from:e,to:n});const s=$n({timeZone:a,tzOffsetMinutes:r}),l={project_key:t,...s};return e&&(l.from=e),n&&(l.to=n),Ma(ba.projectUsageDetail,l)}async function cY({timeZone:t,tzOffsetMinutes:e}={}){return bn()?v0():Ma(ba.achievements,$n({timeZone:t,tzOffsetMinutes:e}))}async function ei(t,e={}){const n=Yr();if(!n)throw new Error("InsForge base URL not configured");const a=n.replace(/\/$/,""),r=new URL(`${a}/functions/${t}`);if(e.params)for(const[u,h]of Object.entries(e.params))h!=null&&h!==""&&r.searchParams.set(u,String(h));const s={Accept:"application/json","Content-Type":"application/json"},l=Gl();l&&(s.apikey=l),e.accessToken&&If(e.accessToken)&&(s.Authorization=`Bearer ${e.accessToken}`);const c=await fetch(r.toString(),{method:e.method||"GET",headers:s,...e.body!=null?{body:JSON.stringify(e.body)}:{}});if(!c.ok){const u=new Error(`Request failed with HTTP ${c.status}`);throw u.status=c.status,u}return c.json()}async function v9({accessToken:t,userId:e,period:n,metric:a,limit:r,offset:s}={}){return bn()?LC({seed:t||e,period:n,metric:a,limit:r,offset:s}):ei("tokentracker-leaderboard",{params:{period:n,limit:r,offset:s,user_id:e}})}async function dY(){return bn()?{top_models:[]}:ei("tokentracker-community-models",{})}async function Sx({accessToken:t}={}){return ei("tokentracker-public-visibility",{accessToken:t,method:"GET"})}async function uY({accessToken:t,enabled:e,anonymous:n,display_name:a,github_url:r,show_github_url:s}={}){const l={};return e!==void 0&&(l.enabled=!!e),n!==void 0&&(l.anonymous=!!n),a!==void 0&&(l.display_name=String(a)),r!==void 0&&(l.github_url=r===null?null:String(r)),s!==void 0&&(l.show_github_url=!!s),ei("tokentracker-public-visibility",{accessToken:t,method:"POST",body:l})}async function hY({accessToken:t,period:e,source:n}={}){const a={};return e&&(a.period=e),typeof n=="string"&&n.trim()&&(a.source=n.trim()),ei("tokentracker-leaderboard-refresh",{accessToken:t,method:"POST",body:a})}async function pY({accessToken:t,userId:e,period:n}={}){if(bn()){const a=LC({seed:t,period:n,metric:"all",limit:250,offset:0}),r=Array.isArray(a?.entries)?a.entries:[],s=r.find(p=>p?.user_id===e)||r[0]||null,l=Number(s?.total_tokens)||0,c=new Date,u=Array.from({length:365}).map((p,m)=>{const v=new Date(c);return v.setUTCDate(v.getUTCDate()-(364-m)),{date:v.toISOString().slice(0,10),total_tokens:m%7===0?Math.floor(l/365):0}}),h=u.slice(-7);return{user:{user_id:e,display_name:s?.display_name||"Mock User",avatar_url:s?.avatar_url||null,github_url:s?.github_url||null,is_anonymous:!1,rank:s?.rank??null},period:{kind:n||"week",from:a?.from??null,to:a?.to??null,generated_at:a?.generated_at??new Date().toISOString()},totals:{total_tokens:l,estimated_cost_usd:Number(s?.estimated_cost_usd)||0,active_days:53,avg_per_day_usd:0},streak:{current_days:3,longest_days:12},best_day:l?{date:c.toISOString().slice(0,10),total_tokens:Math.floor(l/30),estimated_cost_usd:0}:null,models:{count:5,favorite:{model_name:"claude-opus-4-7",total_tokens:Math.floor(l/2)}},by_provider:[],heatmap:u,daily_trend:h,badges:v0().achievements.filter(p=>p.tier>=1&&!["project_hopper","project_devotion","night_owl"].includes(p.id)),badges_include_unearned:!1}}return ei("tokentracker-leaderboard-profile",{accessToken:t,params:{user_id:e,period:n}})}async function fY({accessToken:t,userId:e}={}){return bn()?{badges:v0().achievements.filter(n=>!["project_hopper","project_devotion","night_owl"].includes(n.id)),badges_include_unearned:!0}:ei("tokentracker-leaderboard-profile",{accessToken:t,method:"GET",params:{user_id:e,view:"badges"}})}function IC(t){if(!t)return 0;let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e%165)+24}async function mY({userId:t,anonId:e,accessToken:n}={}){return bn()?{count:IC(t),liked:!1}:ei("tokentracker-profile-likes",{accessToken:n,params:{target_user_id:t,anon_id:e}})}async function gY({userId:t,action:e,anonId:n,accessToken:a}={}){if(bn()){const r=e==="like";return{count:Math.max(0,IC(t)+(r?1:0)),liked:r}}return ei("tokentracker-profile-likes",{accessToken:a,method:"POST",body:{target_user_id:t,action:e,anon_id:n}})}async function vY(t={}){if(bn()){const e=new Date().toISOString();return{user_id:"local-user",created_at:e,pro:{active:!1,sources:[],expires_at:null,partial:!1,as_of:e},subscriptions:{partial:!1,as_of:e,items:[]},install:{partial:!1,as_of:e,has_active_device_token:!1,has_active_device:!1,active_device_tokens:0,active_devices:0,latest_token_activity_at:null,latest_device_seen_at:null}}}return Ma(ba.userStatus)}async function _Y({signal:t,auto:e=!1,background:n=!1,allLocalSources:a=!1,drain:r=!1}={}){const s=await eu(),l={};r?l.drain=!0:e&&(l.auto=!0,n&&(l.background=!0,a&&(l.allLocalSources=!0)));const c=await fetch(`/functions/${ba.localSync}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...s},body:JSON.stringify(l),cache:"no-store",signal:t}),u=await c.json().catch(()=>({ok:!1,error:`Local sync request failed with HTTP ${c.status}`}));if(!c.ok||u?.ok===!1){const h=u?.error||u?.message||`Local sync request failed with HTTP ${c.status}`,p=new Error(h);throw p.status=c.status,p}return u}async function yY({from:t,to:e,source:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return u9({from:t,to:e,seed:l});const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:n,device:a});return Ma(ba.usageModelBreakdown,{from:t,to:e,...u,...c},{accessToken:l})}async function bY({from:t,to:e,source:n,device:a,accessToken:r}={}){if(bn())return{available:!1,by_model:[],by_tool:[],totals:null};const s=ka({source:n,device:a});return Ma(ba.outcomes,{from:t,to:e,...s},{accessToken:r})}async function kY({from:t,to:e,source:n="claude",timeZone:a,tzOffsetMinutes:r}={}){if(bn())return h9({from:t,to:e,source:n});const s=$n({timeZone:a,tzOffsetMinutes:r});return Ma(ba.usageCategoryBreakdown,{from:t,to:e,source:n,...s})}async function wY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){if(bn())return n9({from:t,to:e,seed:c});const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return Ma(ba.usageDaily,{from:t,to:e,...h,...u},{accessToken:c})}async function xY({day:t,source:e,model:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){if(bn())return a9({day:t,seed:l});const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:e,model:n,device:a}),h=t?{day:t,...u,...c}:{...u,...c};return Ma(ba.usageHourly,h,{accessToken:l})}async function PY({months:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){if(bn())return r9({months:t,to:e,seed:c});const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return Ma(ba.usageMonthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...h,...u},{accessToken:c})}async function SY(t={}){const e=t?.refresh?{refresh:"1"}:void 0;return Ma(ba.usageLimits,e)}async function CY({weeks:t,to:e,weekStartsOn:n,source:a,model:r,device:s,timeZone:l,tzOffsetMinutes:c,accessToken:u}={}){if(bn())return d9({weeks:t,to:e,weekStartsOn:n,seed:u});const h=$n({timeZone:l,tzOffsetMinutes:c}),p=ka({source:a,model:r,device:s});return Ma(ba.usageHeatmap,{weeks:String(t),to:e,week_starts_on:n,...p,...h},{accessToken:u})}const yo={summary:"tokentracker-account-summary",daily:"tokentracker-account-daily",hourly:"tokentracker-account-hourly",monthly:"tokentracker-account-monthly",heatmap:"tokentracker-account-heatmap",modelBreakdown:"tokentracker-account-model-breakdown",devices:"tokentracker-account-devices"};async function bo(t,e,n){if(!n||!If(n)){const u=new Error("Account view requires a signed-in user");throw u.status=401,u}const a=Yr();if(!a){const u=new Error("InsForge base URL not configured");throw u.status=0,u}const r=a.replace(/\/$/,""),s=new URL(`${r}/functions/${t}`);if(e)for(const[u,h]of Object.entries(e))h!=null&&h!==""&&s.searchParams.set(u,String(h));const l={Accept:"application/json",Authorization:`Bearer ${n}`},c=Gl();return c&&(l.apikey=c),v_(`${s.toString()}\0${n}`,async()=>{const u=await fetch(s.toString(),{method:"GET",headers:l,cache:"no-store"});if(!u.ok){const h=new Error(`Request failed with HTTP ${u.status}`);throw h.status=u.status,h}return u.json()})}async function TY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,rolling:c=!1,accessToken:u}={}){const h=$n({timeZone:s,tzOffsetMinutes:l}),p=ka({source:n,model:a,device:r}),m=c?{rolling:"1"}:{};return bo(yo.summary,{from:t,to:e,...p,...h,...m},u)}async function EY({from:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return bo(yo.daily,{from:t,to:e,...h,...u},c)}async function AY({day:t,source:e,model:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:e,model:n,device:a}),h=t?{day:t,...u,...c}:{...u,...c};return bo(yo.hourly,h,l)}async function RY({months:t,to:e,source:n,model:a,device:r,timeZone:s,tzOffsetMinutes:l,accessToken:c}={}){const u=$n({timeZone:s,tzOffsetMinutes:l}),h=ka({source:n,model:a,device:r});return bo(yo.monthly,{...t?{months:String(t)}:{},...e?{to:e}:{},...h,...u},c)}async function LY({weeks:t,to:e,weekStartsOn:n,source:a,model:r,device:s,timeZone:l,tzOffsetMinutes:c,accessToken:u}={}){const h=$n({timeZone:l,tzOffsetMinutes:c}),p=ka({source:a,model:r,device:s});return bo(yo.heatmap,{weeks:String(t),to:e,week_starts_on:n,...p,...h},u)}async function DY({from:t,to:e,source:n,device:a,timeZone:r,tzOffsetMinutes:s,accessToken:l}={}){const c=$n({timeZone:r,tzOffsetMinutes:s}),u=ka({source:n,device:a});return bo(yo.modelBreakdown,{from:t,to:e,...u,...c},l)}async function IY({from:t,to:e,timeZone:n,tzOffsetMinutes:a,accessToken:r}={}){const s=$n({timeZone:n,tzOffsetMinutes:a});return bo(yo.devices,{from:t,to:e,...s},r)}async function MY({deviceId:t,name:e,accessToken:n}={}){if(!n||!If(n)){const a=new Error("Account view requires a signed-in user");throw a.status=401,a}return ei("tokentracker-device-rename",{accessToken:n,method:"POST",body:{device_id:t,device_name:e}})}const Cx="tokentracker_native_app";let MC=null;const __=new Set;typeof window<"u"&&window.addEventListener("native:systemAppearanceChanged",t=>{const e=t?.detail?.isDark;if(typeof e=="boolean"){MC=e;try{const n=document.documentElement;e?n.classList.add("dark"):n.classList.remove("dark")}catch{}__.forEach(n=>{try{n(e)}catch{}})}});function Tx(){return MC}function _9(t){return __.add(t),()=>__.delete(t)}function Nf(){if(typeof window>"u")return!1;try{if(new URLSearchParams(window.location.search).get("app")==="1"){try{window.localStorage.setItem(Cx,"1")}catch{}return!0}return window.localStorage.getItem(Cx)==="1"}catch{return!1}}function Ga(){return typeof window>"u"?!1:!!window.webkit?.messageHandlers?.nativeBridge}function Of(){return typeof window>"u"?!1:!!window.chrome?.webview&&Nf()}function NC(){return typeof window>"u"?null:window.webkit?.messageHandlers?.nativeBridge??null}function NY(){return!!NC()}function tu(t){const e=NC();if(!e)return!1;try{return e.postMessage(t),!0}catch(n){return console.warn("[tokentracker] nativeBridge post failed:",n),!1}}function OY(){return tu({type:"getSettings"})}function gd(t,e){return tu({type:"setSetting",key:t,value:e})}function jY(t){return tu({type:"action",name:t})}function y9(){return tu({type:"getSystemAppearance"})}function b9(t,e){if(!Ga())return;tu({type:"setChromeAppearance",isDark:t==="dark",theme:e??"system"})}function zY(t){if(typeof window>"u")return()=>{};const e=n=>{n&&n.detail&&typeof n.detail=="object"&&t(n.detail)};return window.addEventListener("native:settings",e),()=>window.removeEventListener("native:settings",e)}function FY(){return typeof window>"u"?!1:!!(window.webkit?.messageHandlers?.nativeBridge||window.chrome?.webview)}function OC(t){if(typeof window>"u")return!1;const e=window.webkit?.messageHandlers?.nativeBridge;if(e)try{return e.postMessage(t),!0}catch{return!1}if(window.chrome?.webview)try{return window.chrome.webview.postMessage(JSON.stringify(t)),!0}catch{return!1}return!1}function UY(){return OC({type:"getPetSettings"})}function BY(t,e){return OC({type:"setPetSetting",key:t,value:e})}function $Y(t){if(typeof window>"u")return()=>{};const e=n=>{n?.detail&&typeof n.detail=="object"&&t(n.detail)};return window.addEventListener("native:petSettings",e),()=>window.removeEventListener("native:petSettings",e)}const jC=k.createContext(null);function k9(t){if(!t||typeof t!="object")return"";const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},a=e.full_name||e.name||n.name||e.user_name||e.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Ex(t){if(!t||typeof t!="object")return null;const e=t,n=e.session&&typeof e.session=="object"?e.session:null,a=typeof e.accessToken=="string"&&e.accessToken||typeof e.access_token=="string"&&e.access_token||n&&typeof n.accessToken=="string"&&n.accessToken||n&&typeof n.access_token=="string"&&n.access_token||null;return a&&a.length>0?a:null}async function Wg(t,e={}){if(!t)return null;const n=Math.max(0,Math.floor(Number(e.skewMs)||6e4)),a=t.tokenManager,r=()=>a?.getAccessToken?.()??a?.getSession?.()?.accessToken??null;let s=r();if(!s||A7(s,n)){const{data:l}=await t.auth.refreshSession();if(s=r()??Ex(l)??null,!s&&typeof t.auth.getCurrentUser=="function")try{await t.auth.getCurrentUser(),s=r()??Ex(l)??null}catch{}}return s||null}function w9({children:t}){const[e,n]=k.useState(null),[a,r]=k.useState(null),[s,l]=k.useState(!0);k.useEffect(()=>{if(!f_()){n(null),r(null),l(!1);return}n(b7())},[]),k.useEffect(()=>{if(!e)return;let N=!0;return l(!0),(async()=>{try{let{data:U,error:Q}=await e.auth.getCurrentUser();if(!N)return;if(!Q&&!U?.user){if(await new Promise(ce=>setTimeout(ce,150)),!N)return;const ee=await e.auth.getCurrentUser();U=ee.data,Q=ee.error}if(Q){r(null);return}r(U?.user??null)}catch{N&&r(null)}finally{N&&l(!1)}})(),()=>{N=!1}},[e]);const c=k.useCallback(async()=>{if(e)try{let{data:N,error:U}=await e.auth.getCurrentUser();if(!U&&!N?.user){await new Promise(ee=>setTimeout(ee,150));const Q=await e.auth.getCurrentUser();N=Q.data,U=Q.error}if(U){r(null);return}r(N?.user??null)}catch{r(null)}},[e]),u=k.useCallback(async(N,U)=>{if(!e)return{error:new Error("InsForge client not configured")};const Q=typeof window<"u"&&window.webkit?.messageHandlers?.nativeOAuth;if(Q){const le=Of()?`${window.location.origin}/auth/callback`:typeof U=="string"&&U.trim()?U.trim():`${window.location.origin}/auth/callback`,re=await e.auth.signInWithOAuth({provider:N,redirectTo:le,skipBrowserRedirect:!0});if(re.data?.url){try{const te=await eu();await fetch("/api/auth-bridge/verifier",{method:"PUT",headers:{"Content-Type":"application/json",...te},body:JSON.stringify({native:!0})})}catch{}Q.postMessage(re.data.url)}return re}const ee=typeof U=="string"&&U.trim()?U.trim():typeof window<"u"?`${window.location.origin}/dashboard`:void 0;return await e.auth.signInWithOAuth({provider:N,redirectTo:ee})},[e]),h=k.useCallback(async N=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:Q}=await e.auth.signInWithPassword(N);return U?.user&&r(U.user),{data:U,error:Q}},[e]),p=k.useCallback(async N=>{if(!e)return{data:null,error:new Error("InsForge client not configured")};const{data:U,error:Q}=await e.auth.signUp(N);return U?.user&&U?.accessToken&&r(U.user),{data:U,error:Q}},[e]),m=k.useCallback(async N=>e?e.auth.sendResetPasswordEmail(N):{data:null,error:new Error("InsForge client not configured")},[e]),v=k.useCallback(async N=>e?e.auth.exchangeResetPasswordToken(N):{data:null,error:new Error("InsForge client not configured")},[e]),y=k.useCallback(async N=>e?e.auth.resetPassword(N):{data:null,error:new Error("InsForge client not configured")},[e]),b=k.useCallback(async()=>e?e.auth.getPublicAuthConfig():{data:null,error:new Error("InsForge client not configured")},[e]),x=k.useCallback(async()=>{e&&(await e.auth.signOut(),fC(),P7(!1),DC(),r(null))},[e]),P=k.useCallback(async()=>Wg(e),[e]),[T,L]=k.useState(null),[E,A]=k.useState(!1),D=k.useMemo(()=>k9(a),[a]);k.useEffect(()=>{if(!a||!e){L(null),A(!1);return}let N=!0;return(async()=>{try{const U=await Wg(e);if(!N||!U){N&&A(!0);return}const Q=await Sx({accessToken:U});N&&Q?.display_name&&L(Q.display_name)}catch{}N&&A(!0)})(),()=>{N=!1}},[a,e]);const B=E?T||D:"",j=k.useCallback(async()=>{if(e)try{const N=await Wg(e);if(!N)return;const U=await Sx({accessToken:N});U?.display_name&&L(U.display_name)}catch{}},[e]),S=k.useMemo(()=>!f_()||!e?{enabled:!1,client:null,user:null,signedIn:!1,loading:!1,displayName:"",refreshUser:async()=>{},refreshDisplayName:async()=>{},signInWithOAuth:async()=>({error:new Error("InsForge not configured")}),signInWithPassword:async()=>({data:null,error:new Error("InsForge not configured")}),signUp:async()=>({data:null,error:new Error("InsForge not configured")}),sendResetPasswordEmail:async()=>({data:null,error:new Error("InsForge not configured")}),exchangeResetPasswordToken:async()=>({data:null,error:new Error("InsForge not configured")}),resetPassword:async()=>({data:null,error:new Error("InsForge not configured")}),getPublicAuthConfig:async()=>({data:null,error:new Error("InsForge not configured")}),signOut:async()=>{},getAccessToken:async()=>null}:{enabled:!0,client:e,user:a,signedIn:!!a,loading:s,displayName:B,refreshUser:c,refreshDisplayName:j,signInWithOAuth:u,signInWithPassword:h,signUp:p,sendResetPasswordEmail:m,exchangeResetPasswordToken:v,resetPassword:y,getPublicAuthConfig:b,signOut:x,getAccessToken:P},[e,a,s,B,c,j,u,h,p,m,v,y,b,x,P]);return R.jsx(jC.Provider,{value:S,children:t})}function ko(){return k.useContext(jC)}const zC=k.createContext(null),Ax="tt.cloudSyncChanged";function x9({children:t}){const e=ko(),n=!!e?.signedIn,a=!!e?.enabled,r=!!e?.loading,[s,l]=k.useState(()=>Rp()),[c,u]=k.useState(()=>Lp()),[h,p]=k.useState(0);k.useEffect(()=>{l(Rp()),S7()},[]),k.useEffect(()=>{if(typeof window>"u")return;const P=()=>{const T=Lp();u(L=>L===T?L:T)};return window.addEventListener(Ax,P),window.addEventListener("storage",P),()=>{window.removeEventListener(Ax,P),window.removeEventListener("storage",P)}},[]);const m=k.useMemo(()=>!a||!n?!1:s?c:!0,[a,n,s,c]),v=Cl.useRef(m);k.useEffect(()=>{v.current!==m&&(v.current=m,p(P=>P+1))},[m]);const b=r&&(a&&(!s||c)),x=k.useMemo(()=>({accountView:m,revision:h,localHost:s,resolving:b}),[m,h,s,b]);return R.jsx(zC.Provider,{value:x,children:t})}function VY(){const t=k.useContext(zC);return t||{accountView:!1,revision:0,localHost:!0,resolving:!1}}const P9=`key,module,page,component,slot,text,notes,status
|
|
43
43
|
header.auth.sign_in_aria,shared,*,InsforgeUserHeaderControls,sign_in_aria,"Sign in",,active
|
|
44
44
|
login.back_home,shared,LoginPage,LoginPage,back_home,"Back to home",,active
|
|
45
45
|
login.cloud_only,shared,LoginPage,LoginPage,cloud_only,"Cloud sign-in is not configured. Use the local dashboard on localhost.",,active
|
|
@@ -1245,5 +1245,5 @@ achievements.page.suggest_link,dashboard,AchievementsPage,AchievementsPage,sugge
|
|
|
1245
1245
|
${A}px !important;
|
|
1246
1246
|
${D}px !important;
|
|
1247
1247
|
}
|
|
1248
|
-
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),j.contains(B)&&j.removeChild(B)}},[e]),R.jsx(gU,{isPresent:e,childRef:c,sizeRef:u,pop:s,children:s===!1?t:k.cloneElement(t,{ref:m})})}const _U=({children:t,initial:e,isPresent:n,onExitComplete:a,custom:r,presenceAffectsLayout:s,mode:l,anchorX:c,anchorY:u,root:h})=>{const p=S0(yU),m=k.useId(),v=k.useRef(n),y=k.useRef(a);C0(()=>{v.current=n,y.current=a});let b=!0,x=k.useMemo(()=>(b=!1,{id:m,initial:e,isPresent:n,custom:r,onExitComplete:P=>{p.set(P,!0);for(const T of p.values())if(!T)return;a&&a()},register:P=>(p.set(P,!1),()=>{p.delete(P),!v.current&&!p.size&&y.current?.()})}),[n,p,a]);return s&&b&&(x={...x}),k.useMemo(()=>{p.forEach((P,T)=>p.set(T,!1))},[n]),k.useEffect(()=>{!n&&!p.size&&a&&a()},[n]),t=R.jsx(vU,{pop:l==="popLayout",isPresent:n,anchorX:c,anchorY:u,root:h,children:t}),R.jsx(zf.Provider,{value:x,children:t})};function yU(){return new Map}function E5(t=!0){const e=k.useContext(zf);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=e,s=k.useId();k.useEffect(()=>{if(t)return r(s)},[t]);const l=k.useCallback(()=>t&&a&&a(s),[s,a,t]);return!n&&a?[!1,l]:[!0]}const xh=t=>t.key||"";function O2(t){const e=[];return k.Children.forEach(t,n=>{k.isValidElement(n)&&e.push(n)}),e}const A5=({children:t,custom:e,initial:n=!0,onExitComplete:a,presenceAffectsLayout:r=!0,mode:s="sync",propagate:l=!1,anchorX:c="left",anchorY:u="top",root:h})=>{const[p,m]=E5(l),v=k.useMemo(()=>O2(t),[t]),y=l&&!p?[]:v.map(xh),b=k.useRef(!0),x=k.useRef(v),P=S0(()=>new Map),T=k.useRef(new Set),[L,E]=k.useState(v),[A,D]=k.useState(v);C0(()=>{b.current=!1,x.current=v;for(let S=0;S<A.length;S++){const N=xh(A[S]);y.includes(N)?(P.delete(N),T.current.delete(N)):P.get(N)!==!0&&P.set(N,!1)}},[A,y.length,y.join("-")]);const B=[];if(v!==L){let S=[...v];for(let N=0;N<A.length;N++){const U=A[N],Q=xh(U);y.includes(Q)||(S.splice(N,0,U),B.push(U))}return s==="wait"&&B.length&&(S=B),D(O2(S)),E(v),null}const{forceRender:j}=k.useContext(P0);return R.jsx(R.Fragment,{children:A.map(S=>{const N=xh(S),U=l&&!p?!1:v===A||y.includes(N),Q=()=>{if(T.current.has(N))return;if(P.has(N))T.current.add(N),P.set(N,!0);else return;let ee=!0;P.forEach(ce=>{ce||(ee=!1)}),ee&&(j?.(),D(x.current),l&&m?.(),a&&a())};return R.jsx(_U,{isPresent:U,initial:!b.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:h,onExitComplete:U?void 0:Q,anchorX:c,anchorY:u,children:S},N)})})},R5=k.createContext({strict:!1}),j2={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let z2=!1;function bU(){if(z2)return;const t={};for(const e in j2)t[e]={isEnabled:n=>j2[e].some(a=>!!n[a])};i5(t),z2=!0}function L5(){return bU(),rF()}function kU(t){const e=L5();for(const n in t)e[n]={...e[n],...t[n]};i5(e)}const wU=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Yp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||wU.has(t)}let D5=t=>!Yp(t);function xU(t){typeof t=="function"&&(D5=e=>e.startsWith("on")?!Yp(e):t(e))}try{xU(require("@emotion/is-prop-valid").default)}catch{}function PU(t,e,n){const a={};for(const r in t)r==="values"&&typeof t.values=="object"||Un(t[r])||(D5(r)||n===!0&&Yp(r)||!e&&!Yp(r)||t.draggable&&r.startsWith("onDrag"))&&(a[r]=t[r]);return a}const $f=k.createContext({});function SU(t,e){if(Bf(t)){const{initial:n,animate:a}=t;return{initial:n===!1||jd(n)?n:void 0,animate:jd(a)?a:void 0}}return t.inherit!==!1?e:{}}function CU(t){const{initial:e,animate:n}=SU(t,k.useContext($f));return k.useMemo(()=>({initial:e,animate:n}),[F2(e),F2(n)])}function F2(t){return Array.isArray(t)?t.join(" "):t}const X0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function I5(t,e,n){for(const a in e)!Un(e[a])&&!h5(a,n)&&(t[a]=e[a])}function TU({transformTemplate:t},e){return k.useMemo(()=>{const n=X0();return Z0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function EU(t,e){const n=t.style||{},a={};return I5(a,n,t),Object.assign(a,TU(t,e)),a}function AU(t,e){const n={},a=EU(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=a,n}const M5=()=>({...X0(),attrs:{}});function RU(t,e,n,a){const r=k.useMemo(()=>{const s=M5();return p5(s,e,m5(a),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};I5(s,t.style,t),r.style={...s,...r.style}}return r}const LU=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function eb(t){return typeof t!="string"||t.includes("-")?!1:!!(LU.indexOf(t)>-1||/[A-Z]/u.test(t))}function DU(t,e,n,{latestValues:a},r,s=!1,l){const u=(l??eb(t)?RU:AU)(e,a,r,t),h=PU(e,typeof t=="string",s),p=t!==k.Fragment?{...h,...u,ref:n}:{},{children:m}=e,v=k.useMemo(()=>Un(m)?m.get():m,[m]);return k.createElement(t,{...p,children:v})}function IU({scrapeMotionValuesFromProps:t,createRenderState:e},n,a,r){return{latestValues:MU(n,a,r,t),renderState:e()}}function MU(t,e,n,a){const r={},s=a(t,{});for(const v in s)r[v]=cp(s[v]);let{initial:l,animate:c}=t;const u=Bf(t),h=a5(t);e&&h&&!u&&t.inherit!==!1&&(l===void 0&&(l=e.initial),c===void 0&&(c=e.animate));let p=n?n.initial===!1:!1;p=p||l===!1;const m=p?c:l;if(m&&typeof m!="boolean"&&!Uf(m)){const v=Array.isArray(m)?m:[m];for(let y=0;y<v.length;y++){const b=B0(t,v[y]);if(b){const{transitionEnd:x,transition:P,...T}=b;for(const L in T){let E=T[L];if(Array.isArray(E)){const A=p?E.length-1:0;E=E[A]}E!==null&&(r[L]=E)}for(const L in x)r[L]=x[L]}}}return r}const N5=t=>(e,n)=>{const a=k.useContext($f),r=k.useContext(zf),s=()=>IU(t,e,a,r);return n?s():S0(s)},NU=N5({scrapeMotionValuesFromProps:J0,createRenderState:X0}),OU=N5({scrapeMotionValuesFromProps:g5,createRenderState:M5}),jU=Symbol.for("motionComponentSymbol");function zU(t,e,n){const a=k.useRef(n);k.useInsertionEffect(()=>{a.current=n});const r=k.useRef(null);return k.useCallback(s=>{s&&t.onMount?.(s),e&&(s?e.mount(s):e.unmount());const l=a.current;if(typeof l=="function")if(s){const c=l(s);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):l(s);else l&&(l.current=s)},[e])}const O5=k.createContext({});function dl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function FU(t,e,n,a,r,s){const{visualElement:l}=k.useContext($f),c=k.useContext(R5),u=k.useContext(zf),h=k.useContext(Q0),p=h.reducedMotion,m=h.skipAnimations,v=k.useRef(null),y=k.useRef(!1);a=a||c.renderer,!v.current&&a&&(v.current=a(t,{visualState:e,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:p,skipAnimations:m,isSVG:s}),y.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const b=v.current,x=k.useContext(O5);b&&!b.projection&&r&&(b.type==="html"||b.type==="svg")&&UU(v.current,n,r,x);const P=k.useRef(!1);k.useInsertionEffect(()=>{b&&P.current&&b.update(n,u)});const T=n[WT],L=k.useRef(!!T&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(T)&&window.MotionHasOptimisedAnimation?.(T));return C0(()=>{y.current=!0,b&&(P.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),L.current&&b.animationState&&b.animationState.animateChanges())}),k.useEffect(()=>{b&&(!L.current&&b.animationState&&b.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(T)}),L.current=!1),b.enteringChildren=void 0)}),b}function UU(t,e,n,a){const{layoutId:r,layout:s,drag:l,dragConstraints:c,layoutScroll:u,layoutRoot:h,layoutAnchor:p,layoutCrossfade:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:j5(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!l||c&&dl(c),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:a,crossfade:m,layoutScroll:u,layoutRoot:h,layoutAnchor:p})}function j5(t){if(t)return t.options.allowProjection!==!1?t.projection:j5(t.parent)}function iv(t,{forwardMotionProps:e=!1,type:n}={},a,r){a&&kU(a);const s=n?n==="svg":eb(t),l=s?OU:NU;function c(h,p){let m;const v={...k.useContext(Q0),...h,layoutId:BU(h)},{isStatic:y}=v,b=CU(h),x=l(h,y);if(!y&&typeof window<"u"){$U();const P=VU(v);m=P.MeasureLayout,b.visualElement=FU(t,x,v,r,P.ProjectionNode,s)}return R.jsxs($f.Provider,{value:b,children:[m&&b.visualElement?R.jsx(m,{visualElement:b.visualElement,...v}):null,DU(t,h,zU(x,b.visualElement,p),x,y,e,s)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=k.forwardRef(c);return u[jU]=t,u}function BU({layoutId:t}){const e=k.useContext(P0).id;return e&&t!==void 0?e+"-"+t:t}function $U(t,e){k.useContext(R5).strict}function VU(t){const e=L5(),{drag:n,layout:a}=e;if(!n&&!a)return{};const r={...n,...a};return{MeasureLayout:n?.isEnabled(t)||a?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function HU(t,e){if(typeof Proxy>"u")return iv;const n=new Map,a=(s,l)=>iv(s,l,t,e),r=(s,l)=>a(s,l);return new Proxy(r,{get:(s,l)=>l==="create"?a:(n.has(l)||n.set(l,iv(l,void 0,t,e)),n.get(l))})}const WU=(t,e)=>e.isSVG??eb(t)?new kF(e):new mF(e,{allowProjection:t!==k.Fragment});class GU extends vs{constructor(e){super(e),e.animationState||(e.animationState=CF(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Uf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let qU=0;class KU extends vs{constructor(){super(...arguments),this.id=qU++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;if(e&&a===!1){if(this.isExitComplete){const{initial:s,custom:l}=this.node.getProps();if(typeof s=="string"||typeof s=="object"&&s!==null&&!Array.isArray(s)){const c=so(this.node,s,l);if(c){const{transition:u,transitionEnd:h,...p}=c;for(const m in p)this.node.getValue(m)?.jump(p[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const YU={animation:{Feature:GU},exit:{Feature:KU}};function su(t){return{point:{x:t.pageX,y:t.pageY}}}const ZU=t=>e=>W0(e)&&t(e,su(e));function bd(t,e,n,a){return zd(t,e,ZU(n),a)}const z5=({current:t})=>t?t.ownerDocument.defaultView:null,U2=(t,e)=>Math.abs(t-e);function JU(t,e){const n=U2(t.x,e.x),a=U2(t.y,e.y);return Math.sqrt(n**2+a**2)}const B2=new Set(["auto","scroll"]);class F5{constructor(e,n,{transformPagePoint:a,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:l=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ph(this.lastRawMoveEventInfo,this.transformPagePoint));const b=sv(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,P=JU(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!P)return;const{point:T}=b,{timestamp:L}=zn;this.history.push({...T,timestamp:L});const{onStart:E,onMove:A}=this.handlers;x||(E&&E(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastRawMoveEventInfo=x,this.lastMoveEventInfo=Ph(x,this.transformPagePoint),Ot.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:P,onSessionEnd:T,resumeAnimation:L}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&L&&L(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=sv(b.type==="pointercancel"?this.lastMoveEventInfo:Ph(x,this.transformPagePoint),this.history);this.startEvent&&P&&P(b,E),T&&T(b,E)},!W0(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=l,this.contextWindow=r||window;const u=su(e),h=Ph(u,this.transformPagePoint),{point:p}=h,{timestamp:m}=zn;this.history=[{...p,timestamp:m}];const{onSessionStart:v}=n;v&&v(e,sv(h,this.history));const y={passive:!0,capture:!0};this.removeListeners=au(bd(this.contextWindow,"pointermove",this.handlePointerMove,y),bd(this.contextWindow,"pointerup",this.handlePointerUp,y),bd(this.contextWindow,"pointercancel",this.handlePointerUp,y)),c&&this.startScrollTracking(c)}startScrollTracking(e){let n=e.parentElement;for(;n;){const a=getComputedStyle(n);(B2.has(a.overflowX)||B2.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const a=e===window,r=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-n.x,y:r.y-n.y};s.x===0&&s.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),Ot.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ps(this.updatePoint)}}function Ph(t,e){return e?{point:e(t.point)}:t}function $2(t,e){return{x:t.x-e.x,y:t.y-e.y}}function sv({point:t},e){return{point:t,delta:$2(t,U5(e)),offset:$2(t,QU(e)),velocity:XU(e,.1)}}function QU(t){return t[0]}function U5(t){return t[t.length-1]}function XU(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,a=null;const r=U5(t);for(;n>=0&&(a=t[n],!(r.timestamp-a.timestamp>La(e)));)n--;if(!a)return{x:0,y:0};a===t[0]&&t.length>2&&r.timestamp-a.timestamp>La(e)*2&&(a=t[1]);const s=qa(r.timestamp-a.timestamp);if(s===0)return{x:0,y:0};const l={x:(r.x-a.x)/s,y:(r.y-a.y)/s};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function eB(t,{min:e,max:n},a){return e!==void 0&&t<e?t=a?Nt(e,t,a.min):Math.max(t,e):n!==void 0&&t>n&&(t=a?Nt(n,t,a.max):Math.min(t,n)),t}function V2(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function tB(t,{top:e,left:n,bottom:a,right:r}){return{x:V2(t.x,n,r),y:V2(t.y,e,a)}}function H2(t,e){let n=e.min-t.min,a=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,a]=[a,n]),{min:n,max:a}}function nB(t,e){return{x:H2(t.x,e.x),y:H2(t.y,e.y)}}function aB(t,e){let n=.5;const a=ia(t),r=ia(e);return r>a?n=Nd(e.min,e.max-a,t.min):a>r&&(n=Nd(t.min,t.max-r,e.min)),Zr(0,1,n)}function rB(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const V_=.35;function iB(t=V_){return t===!1?t=0:t===!0&&(t=V_),{x:W2(t,"left","right"),y:W2(t,"top","bottom")}}function W2(t,e,n){return{min:G2(t,e),max:G2(t,n)}}function G2(t,e){return typeof t=="number"?t:t[e]||0}const sB=new WeakMap;class oB{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Cn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=m=>{n&&this.snapToCursor(su(m).point),this.stopAnimation()},l=(m,v)=>{const{drag:y,dragPropagation:b,onDragStart:x}=this.getProps();if(y&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Nz(y),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jr(T=>{let L=this.getAxisMotionValue(T).get()||0;if(Vr.test(L)){const{projection:E}=this.visualElement;if(E&&E.layout){const A=E.layout.layoutBox[T];A&&(L=ia(A)*(parseFloat(L)/100))}}this.originPoint[T]=L}),x&&Ot.update(()=>x(m,v),!1,!0),M_(this.visualElement,"transform");const{animationState:P}=this.visualElement;P&&P.setActive("whileDrag",!0)},c=(m,v)=>{this.latestPointerEvent=m,this.latestPanInfo=v;const{dragPropagation:y,dragDirectionLock:b,onDirectionLock:x,onDrag:P}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:T}=v;if(b&&this.currentDirection===null){this.currentDirection=cB(T),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",v.point,T),this.updateAxis("y",v.point,T),this.visualElement.render(),P&&Ot.update(()=>P(m,v),!1,!0)},u=(m,v)=>{this.latestPointerEvent=m,this.latestPanInfo=v,this.stop(m,v),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new F5(e,{onSessionStart:s,onStart:l,onMove:c,onSessionEnd:u,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:a,contextWindow:z5(this.visualElement),element:this.visualElement.current})}stop(e,n){const a=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!a)return;const{velocity:l}=r;this.startAnimation(l);const{onDragEnd:c}=this.getProps();c&&Ot.postRender(()=>c(a,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,a){const{drag:r}=this.getProps();if(!a||!Sh(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let l=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(l=eB(l,this.constraints[e],this.elastic[e])),s.set(l)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&dl(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=tB(a.layoutBox,e):this.constraints=!1,this.elastic=iB(n),r!==this.constraints&&!dl(e)&&a&&this.constraints&&!this.hasMutatedConstraints&&jr(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=rB(a.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!dl(e))return!1;const a=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const s=cF(a,r.root,this.visualElement.getTransformPagePoint());let l=nB(r.layout.layoutBox,s);if(n){const c=n(sF(l));this.hasMutatedConstraints=!!c,c&&(l=o5(c))}return l}startAnimation(e){const{drag:n,dragMomentum:a,dragElastic:r,dragTransition:s,dragSnapToOrigin:l,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},h=jr(p=>{if(!Sh(p,n,this.currentDirection))return;let m=u&&u[p]||{};(l===!0||l===p)&&(m={min:0,max:0});const v=r?200:1e6,y=r?40:1e7,b={type:"inertia",velocity:a?e[p]:0,bounceStiffness:v,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...s,...m};return this.startAxisValueAnimation(p,b)});return Promise.all(h).then(c)}startAxisValueAnimation(e,n){const a=this.getAxisMotionValue(e);return M_(this.visualElement,e),a.start(U0(e,a,0,n,this.visualElement,!1))}stopAnimation(){jr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[n];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){jr(n=>{const{drag:a}=this.getProps();if(!Sh(n,a,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:l,max:c}=r.layout.layoutBox[n],u=s.get()||0;s.set(e[n]-Nt(l,c,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!dl(n)||!a||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};jr(l=>{const c=this.getAxisMotionValue(l);if(c&&this.constraints!==!1){const u=c.get();r[l]=aB({min:u,max:u},this.constraints[l])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),jr(l=>{if(!Sh(l,e,null))return;const c=this.getAxisMotionValue(l),{min:u,max:h}=this.constraints[l];c.set(Nt(u,h,r[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sB.set(this.visualElement,this);const e=this.visualElement.current,n=bd(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),v=h.target,y=v!==e&&Bz(v);p&&m&&!y&&this.start(h)});let a;const r=()=>{const{dragConstraints:h}=this.getProps();dl(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=lB(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,l=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ot.read(r);const c=zd(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(jr(m=>{const v=this.getAxisMotionValue(m);v&&(this.originPoint[m]+=h[m].translate,v.set(v.get()+h[m].translate))}),this.visualElement.render())}));return()=>{c(),n(),l(),u&&u(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:l=V_,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:a,dragPropagation:r,dragConstraints:s,dragElastic:l,dragMomentum:c}}}function q2(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function lB(t,e,n){const a=e2(t,q2(n)),r=e2(e,q2(n));return()=>{a(),r()}}function Sh(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function cB(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class dB extends vs{constructor(e){super(e),this.removeGroupControls=Za,this.removeListeners=Za,this.controls=new oB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Za}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ov=t=>(e,n)=>{t&&Ot.update(()=>t(e,n),!1,!0)};class uB extends vs{constructor(){super(...arguments),this.removePointerDownListener=Za}onPointerDown(e){this.session=new F5(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:z5(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:a,onPanEnd:r}=this.node.getProps();return{onSessionStart:ov(e),onStart:ov(n),onMove:ov(a),onEnd:(s,l)=>{delete this.session,r&&Ot.postRender(()=>r(s,l))}}}mount(){this.removePointerDownListener=bd(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let lv=!1;class hB extends k.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a,layoutId:r}=this.props,{projection:s}=e;s&&(n.group&&n.group.add(s),a&&a.register&&r&&a.register(s),lv&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),dp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:a,drag:r,isPresent:s}=this.props,{projection:l}=a;return l&&(l.isPresent=s,e.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),lv=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?l.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?l.promote():l.relegate()||Ot.postRender(()=>{const c=l.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:a}=e;a&&(a.options.layoutAnchor=n,a.root.didUpdate(),H0.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:r}=e;lv=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),a&&a.deregister&&a.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function B5(t){const[e,n]=E5(),a=k.useContext(P0);return R.jsx(hB,{...t,layoutGroup:a,switchLayoutGroup:k.useContext(O5),isPresent:e,safeToRemove:n})}const pB={pan:{Feature:uB},drag:{Feature:dB,ProjectionNode:T5,MeasureLayout:B5}};function K2(t,e,n){const{props:a}=t;t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=a[r];s&&Ot.postRender(()=>s(e,su(e)))}class fB extends vs{mount(){const{current:e}=this.node;e&&(this.unmount=jz(e,(n,a)=>(K2(this.node,a,"Start"),r=>K2(this.node,r,"End"))))}unmount(){}}class mB extends vs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=au(zd(this.node.current,"focus",()=>this.onFocus()),zd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Y2(t,e,n){const{props:a}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&a.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=a[r];s&&Ot.postRender(()=>s(e,su(e)))}class gB extends vs{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:a}=this.node.props;this.unmount=Vz(e,(r,s)=>(Y2(this.node,s,"Start"),(l,{success:c})=>Y2(this.node,l,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:a?.tap===!1})}unmount(){}}const H_=new WeakMap,cv=new WeakMap,vB=t=>{const e=H_.get(t.target);e&&e(t)},_B=t=>{t.forEach(vB)};function yB({root:t,...e}){const n=t||document;cv.has(n)||cv.set(n,{});const a=cv.get(n),r=JSON.stringify(e);return a[r]||(a[r]=new IntersectionObserver(_B,{root:t,...e})),a[r]}function bB(t,e,n){const a=yB(e);return H_.set(t,n),a.observe(t),()=>{H_.delete(t),a.unobserve(t)}}const kB={some:0,all:1};class wB extends vs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:a,amount:r="some",once:s}=e,l={root:n?n.current:void 0,rootMargin:a,threshold:typeof r=="number"?r:kB[r]},c=u=>{const{isIntersecting:h}=u;if(this.isInView===h||(this.isInView=h,s&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),v=h?p:m;v&&v(u)};this.stopObserver=bB(this.node.current,l,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(xB(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function xB({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const PB={inView:{Feature:wB},tap:{Feature:gB},focus:{Feature:mB},hover:{Feature:fB}},SB={layout:{ProjectionNode:T5,MeasureLayout:B5}},CB={...YU,...PB,...pB,...SB},TB=HU(CB,WU);function EB(){!Y0.current&&r5();const[t]=k.useState(Wp.current);return t}const kd=TB;function $5(t){var e,n,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=$5(t[e]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}function AB(){for(var t,e,n=0,a="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=$5(t))&&(a&&(a+=" "),a+=e);return a}const RB=(t,e)=>{const n=new Array(t.length+e.length);for(let a=0;a<t.length;a++)n[a]=t[a];for(let a=0;a<e.length;a++)n[t.length+a]=e[a];return n},LB=(t,e)=>({classGroupId:t,validator:e}),V5=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Zp="-",Z2=[],DB="arbitrary..",IB=t=>{const e=NB(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return MB(l);const c=l.split(Zp),u=c[0]===""&&c.length>1?1:0;return H5(c,u,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const u=a[l],h=n[l];return u?h?RB(h,u):u:h||Z2}return n[l]||Z2}}},H5=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const r=t[e],s=n.nextPart.get(r);if(s){const h=H5(t,e+1,s);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(Zp):t.slice(e).join(Zp),u=l.length;for(let h=0;h<u;h++){const p=l[h];if(p.validator(c))return p.classGroupId}},MB=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),a=e.slice(0,n);return a?DB+a:void 0})(),NB=t=>{const{theme:e,classGroups:n}=t;return OB(n,e)},OB=(t,e)=>{const n=V5();for(const a in t){const r=t[a];tb(r,n,a,e)}return n},tb=(t,e,n,a)=>{const r=t.length;for(let s=0;s<r;s++){const l=t[s];jB(l,e,n,a)}},jB=(t,e,n,a)=>{if(typeof t=="string"){zB(t,e,n);return}if(typeof t=="function"){FB(t,e,n,a);return}UB(t,e,n,a)},zB=(t,e,n)=>{const a=t===""?e:W5(e,t);a.classGroupId=n},FB=(t,e,n,a)=>{if(BB(t)){tb(t(a),e,n,a);return}e.validators===null&&(e.validators=[]),e.validators.push(LB(n,t))},UB=(t,e,n,a)=>{const r=Object.entries(t),s=r.length;for(let l=0;l<s;l++){const[c,u]=r[l];tb(u,W5(e,c),n,a)}},W5=(t,e)=>{let n=t;const a=e.split(Zp),r=a.length;for(let s=0;s<r;s++){const l=a[s];let c=n.nextPart.get(l);c||(c=V5(),n.nextPart.set(l,c)),n=c}return n},BB=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,$B=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),a=Object.create(null);const r=(s,l)=>{n[s]=l,e++,e>t&&(e=0,a=n,n=Object.create(null))};return{get(s){let l=n[s];if(l!==void 0)return l;if((l=a[s])!==void 0)return r(s,l),l},set(s,l){s in n?n[s]=l:r(s,l)}}},W_="!",J2=":",VB=[],Q2=(t,e,n,a,r)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:a,isExternal:r}),HB=t=>{const{prefix:e,experimentalParseClassName:n}=t;let a=r=>{const s=[];let l=0,c=0,u=0,h;const p=r.length;for(let x=0;x<p;x++){const P=r[x];if(l===0&&c===0){if(P===J2){s.push(r.slice(u,x)),u=x+1;continue}if(P==="/"){h=x;continue}}P==="["?l++:P==="]"?l--:P==="("?c++:P===")"&&c--}const m=s.length===0?r:r.slice(u);let v=m,y=!1;m.endsWith(W_)?(v=m.slice(0,-1),y=!0):m.startsWith(W_)&&(v=m.slice(1),y=!0);const b=h&&h>u?h-u:void 0;return Q2(s,y,v,b)};if(e){const r=e+J2,s=a;a=l=>l.startsWith(r)?s(l.slice(r.length)):Q2(VB,!1,l,void 0,!0)}if(n){const r=a;a=s=>n({className:s,parseClassName:r})}return a},WB=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,a)=>{e.set(n,1e6+a)}),n=>{const a=[];let r=[];for(let s=0;s<n.length;s++){const l=n[s],c=l[0]==="[",u=e.has(l);c||u?(r.length>0&&(r.sort(),a.push(...r),r=[]),a.push(l)):r.push(l)}return r.length>0&&(r.sort(),a.push(...r)),a}},GB=t=>({cache:$B(t.cacheSize),parseClassName:HB(t),sortModifiers:WB(t),postfixLookupClassGroupIds:qB(t),...IB(t)}),qB=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let a=0;a<n.length;a++)e[n[a]]=!0;return e},KB=/\s+/,YB=(t,e)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:l}=e,c=[],u=t.trim().split(KB);let h="";for(let p=u.length-1;p>=0;p-=1){const m=u[p],{isExternal:v,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:P}=n(m);if(v){h=m+(h.length>0?" "+h:h);continue}let T=!!P,L;if(T){const j=x.substring(0,P);L=a(j);const S=L&&l[L]?a(x):void 0;S&&S!==L&&(L=S,T=!1)}else L=a(x);if(!L){if(!T){h=m+(h.length>0?" "+h:h);continue}if(L=a(x),!L){h=m+(h.length>0?" "+h:h);continue}T=!1}const E=y.length===0?"":y.length===1?y[0]:s(y).join(":"),A=b?E+W_:E,D=A+L;if(c.indexOf(D)>-1)continue;c.push(D);const B=r(L,T);for(let j=0;j<B.length;++j){const S=B[j];c.push(A+S)}h=m+(h.length>0?" "+h:h)}return h},ZB=(...t)=>{let e=0,n,a,r="";for(;e<t.length;)(n=t[e++])&&(a=G5(n))&&(r&&(r+=" "),r+=a);return r},G5=t=>{if(typeof t=="string")return t;let e,n="";for(let a=0;a<t.length;a++)t[a]&&(e=G5(t[a]))&&(n&&(n+=" "),n+=e);return n},JB=(t,...e)=>{let n,a,r,s;const l=u=>{const h=e.reduce((p,m)=>m(p),t());return n=GB(h),a=n.cache.get,r=n.cache.set,s=c,c(u)},c=u=>{const h=a(u);if(h)return h;const p=YB(u,n);return r(u,p),p};return s=l,(...u)=>s(ZB(...u))},QB=[],Sn=t=>{const e=n=>n[t]||QB;return e.isThemeGetter=!0,e},q5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,K5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XB=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,e$=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t$=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n$=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ts=t=>XB.test(t),ct=t=>!!t&&!Number.isNaN(Number(t)),Dr=t=>!!t&&Number.isInteger(Number(t)),dv=t=>t.endsWith("%")&&ct(t.slice(0,-1)),pi=t=>e$.test(t),Y5=()=>!0,i$=t=>t$.test(t)&&!n$.test(t),nb=()=>!1,s$=t=>a$.test(t),o$=t=>r$.test(t),l$=t=>!Te(t)&&!Ae(t),c$=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),d$=t=>_s(t,Q5,nb),Te=t=>q5.test(t),Os=t=>_s(t,X5,i$),X2=t=>_s(t,_$,ct),u$=t=>_s(t,t4,Y5),h$=t=>_s(t,e4,nb),eP=t=>_s(t,Z5,nb),p$=t=>_s(t,J5,o$),Ch=t=>_s(t,n4,s$),Ae=t=>K5.test(t),$c=t=>wo(t,X5),f$=t=>wo(t,e4),tP=t=>wo(t,Z5),m$=t=>wo(t,Q5),g$=t=>wo(t,J5),Th=t=>wo(t,n4,!0),v$=t=>wo(t,t4,!0),_s=(t,e,n)=>{const a=q5.exec(t);return a?a[1]?e(a[1]):n(a[2]):!1},wo=(t,e,n=!1)=>{const a=K5.exec(t);return a?a[1]?e(a[1]):n:!1},Z5=t=>t==="position"||t==="percentage",J5=t=>t==="image"||t==="url",Q5=t=>t==="length"||t==="size"||t==="bg-size",X5=t=>t==="length",_$=t=>t==="number",e4=t=>t==="family-name",t4=t=>t==="number"||t==="weight",n4=t=>t==="shadow",y$=()=>{const t=Sn("color"),e=Sn("font"),n=Sn("text"),a=Sn("font-weight"),r=Sn("tracking"),s=Sn("leading"),l=Sn("breakpoint"),c=Sn("container"),u=Sn("spacing"),h=Sn("radius"),p=Sn("shadow"),m=Sn("inset-shadow"),v=Sn("text-shadow"),y=Sn("drop-shadow"),b=Sn("blur"),x=Sn("perspective"),P=Sn("aspect"),T=Sn("ease"),L=Sn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),Ae,Te],B=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[Ae,Te,u],N=()=>[ts,"full","auto",...S()],U=()=>[Dr,"none","subgrid",Ae,Te],Q=()=>["auto",{span:["full",Dr,Ae,Te]},Dr,Ae,Te],ee=()=>[Dr,"auto",Ae,Te],ce=()=>["auto","min","max","fr",Ae,Te],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...S()],ie=()=>[ts,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],$=()=>[ts,"screen","full","dvw","lvw","svw","min","max","fit",...S()],X=()=>[ts,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],W=()=>[t,Ae,Te],O=()=>[...A(),tP,eP,{position:[Ae,Te]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ae=()=>["auto","cover","contain",m$,d$,{size:[Ae,Te]}],_e=()=>[dv,$c,Os],fe=()=>["","none","full",h,Ae,Te],ve=()=>["",ct,$c,Os],Ne=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>[ct,dv,tP,eP],St=()=>["","none",b,Ae,Te],un=()=>["none",ct,Ae,Te],jt=()=>["none",ct,Ae,Te],_t=()=>[ct,Ae,Te],Jt=()=>[ts,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pi],breakpoint:[pi],color:[Y5],container:[pi],"drop-shadow":[pi],ease:["in","out","in-out"],font:[l$],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pi],shadow:[pi],spacing:["px",ct],text:[pi],"text-shadow":[pi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ts,Te,Ae,P]}],container:["container"],"container-type":[{"@container":["","normal","size",Ae,Te]}],"container-named":[c$],columns:[{columns:[ct,Te,Ae,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Dr,"auto",Ae,Te]}],basis:[{basis:[ts,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,ts,"auto","initial","none",Te]}],grow:[{grow:["",ct,Ae,Te]}],shrink:[{shrink:["",ct,Ae,Te]}],order:[{order:[Dr,"first","last","none",Ae,Te]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mbs:[{mbs:te()}],mbe:[{mbe:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:ie()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[c,"screen",...ie()]}],"min-w":[{"min-w":[c,"screen","none",...ie()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ie()]}],h:[{h:["screen","lh",...ie()]}],"min-h":[{"min-h":["screen","lh","none",...ie()]}],"max-h":[{"max-h":["screen","lh",...ie()]}],"font-size":[{text:["base",n,$c,Os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,v$,u$]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dv,Te]}],"font-family":[{font:[f$,h$,e]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Ae,Te]}],"line-clamp":[{"line-clamp":[ct,"none",Ae,X2]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",Ae,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",Ae,Os]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[ct,"auto",Ae,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[Dr,Ae,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Dr,Ae,Te],radial:["",Ae,Te],conic:[Dr,Ae,Te]},g$,p$]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:_e()}],"gradient-via-pos":[{via:_e()}],"gradient-to-pos":[{to:_e()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ve()}],"border-w-x":[{"border-x":ve()}],"border-w-y":[{"border-y":ve()}],"border-w-s":[{"border-s":ve()}],"border-w-e":[{"border-e":ve()}],"border-w-bs":[{"border-bs":ve()}],"border-w-be":[{"border-be":ve()}],"border-w-t":[{"border-t":ve()}],"border-w-r":[{"border-r":ve()}],"border-w-b":[{"border-b":ve()}],"border-w-l":[{"border-l":ve()}],"divide-x":[{"divide-x":ve()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ve()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,Ae,Te]}],"outline-w":[{outline:["",ct,$c,Os]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",p,Th,Ch]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",m,Th,Ch]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[ct,Os]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ve()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",v,Th,Ch]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[ct,Ae,Te]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ie()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":Ie()}],"mask-image-t-to-pos":[{"mask-t-to":Ie()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":Ie()}],"mask-image-r-to-pos":[{"mask-r-to":Ie()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":Ie()}],"mask-image-b-to-pos":[{"mask-b-to":Ie()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":Ie()}],"mask-image-l-to-pos":[{"mask-l-to":Ie()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":Ie()}],"mask-image-x-to-pos":[{"mask-x-to":Ie()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":Ie()}],"mask-image-y-to-pos":[{"mask-y-to":Ie()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Ae,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ie()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ie()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Te]}],filter:[{filter:["","none",Ae,Te]}],blur:[{blur:St()}],brightness:[{brightness:[ct,Ae,Te]}],contrast:[{contrast:[ct,Ae,Te]}],"drop-shadow":[{"drop-shadow":["","none",y,Th,Ch]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",ct,Ae,Te]}],"hue-rotate":[{"hue-rotate":[ct,Ae,Te]}],invert:[{invert:["",ct,Ae,Te]}],saturate:[{saturate:[ct,Ae,Te]}],sepia:[{sepia:["",ct,Ae,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Te]}],"backdrop-blur":[{"backdrop-blur":St()}],"backdrop-brightness":[{"backdrop-brightness":[ct,Ae,Te]}],"backdrop-contrast":[{"backdrop-contrast":[ct,Ae,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,Ae,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,Ae,Te]}],"backdrop-invert":[{"backdrop-invert":["",ct,Ae,Te]}],"backdrop-opacity":[{"backdrop-opacity":[ct,Ae,Te]}],"backdrop-saturate":[{"backdrop-saturate":[ct,Ae,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,Ae,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",Ae,Te]}],ease:[{ease:["linear","initial",T,Ae,Te]}],delay:[{delay:[ct,Ae,Te]}],animate:[{animate:["none",L,Ae,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Ae,Te]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:un()}],"rotate-x":[{"rotate-x":un()}],"rotate-y":[{"rotate-y":un()}],"rotate-z":[{"rotate-z":un()}],scale:[{scale:jt()}],"scale-x":[{"scale-x":jt()}],"scale-y":[{"scale-y":jt()}],"scale-z":[{"scale-z":jt()}],"scale-3d":["scale-3d"],skew:[{skew:_t()}],"skew-x":[{"skew-x":_t()}],"skew-y":[{"skew-y":_t()}],transform:[{transform:[Ae,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Jt()}],"translate-x":[{"translate-x":Jt()}],"translate-y":[{"translate-y":Jt()}],"translate-z":[{"translate-z":Jt()}],"translate-none":["translate-none"],zoom:[{zoom:[Dr,Ae,Te]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,Te]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[ct,$c,Os,X2]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},b$=JB(y$);function $t(...t){return b$(AB(t))}const k$=R.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),R.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),R.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),R.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),w$=R.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:R.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),x$={google:k$,github:w$},P$={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function S$(t){return P$[t]||String(t||"").replace(/-/g," ")}function C$(t){if(typeof t=="string"&&t.trim())return t.trim();if(t&&typeof t=="object"){if(typeof t.token=="string"&&t.token.trim())return t.token.trim();if(typeof t.otp=="string"&&t.otp.trim())return t.otp.trim()}return""}function T$({title:t,subtitle:e,className:n="",onSuccess:a,hideLogo:r=!1,initialMode:s="signin",tokenFromUrl:l="",initialEmail:c="",initialCode:u=""}){Kl();const{enabled:h,signedIn:p,refreshUser:m,signInWithPassword:v,signUp:y,signInWithOAuth:b,getPublicAuthConfig:x,sendResetPasswordEmail:P,exchangeResetPasswordToken:T,resetPassword:L}=ko(),[E,A]=k.useState(s),[D,B]=k.useState(c),[j,S]=k.useState(""),[N,U]=k.useState(""),[Q,ee]=k.useState(""),[ce,le]=k.useState(u),[re,te]=k.useState(!1),[ie,$]=k.useState(null),[X,W]=k.useState(null),[O,Y]=k.useState(!1),[ae,_e]=k.useState(!!(s!=="signin"||c)),[fe,ve]=k.useState(!0),[Ne,Oe]=k.useState([]),[Ie,St]=k.useState(8);k.useEffect(()=>{s&&A(s)},[s]),k.useEffect(()=>{c&&B(c)},[c]),k.useEffect(()=>{u&&le(u)},[u]),k.useEffect(()=>{if(!h)return;let Xe=!0;return ve(!0),(async()=>{const{data:ot,error:Dt}=await x();if(Xe){if(Dt||!ot)Oe(["google","github"]);else{const Et=Array.isArray(ot.oAuthProviders)?ot.oAuthProviders:[],Nn=Array.isArray(ot.customOAuthProviders)?ot.customOAuthProviders:[];Oe([...Et,...Nn]),typeof ot.passwordMinLength=="number"&&ot.passwordMinLength>0&&St(ot.passwordMinLength)}ve(!1)}})(),()=>{Xe=!1}},[h,x]),k.useEffect(()=>{p&&a&&a()},[p,a]);const un=k.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),jt=k.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),_t=k.useCallback(async Xe=>{$(null),te(!0);try{const{error:ot}=await b(Xe,un);ot&&$(ot.message||String(ot))}finally{te(!1)}},[b,un]);k.useEffect(()=>{if(!h||fe||p||typeof window>"u")return;const Xe=window.location.search;if(!Xe)return;const ot=new URLSearchParams(Xe),Dt=ot.get("native")==="1",Et=ot.get("provider");Dt&&Et&&[...Ne].includes(Et)&&_t(Et)},[h,fe,p,Ne,_t]);const Jt=k.useCallback(async Xe=>{Xe.preventDefault(),$(null),te(!0);try{if(E==="signup"){const{data:Dt,error:Et}=await y({email:D.trim(),password:j,name:Q.trim()||void 0});if(Et){$(Et.message||String(Et));return}if(Dt?.requireEmailVerification){W(we("login.verify_email_pending")),A("signin");return}await m();return}const{error:ot}=await v({email:D.trim(),password:j});if(ot){$(ot.message||String(ot));return}await m()}finally{te(!1)}},[E,D,j,Q,y,v,m]),nr=k.useCallback(async Xe=>{Xe.preventDefault(),$(null),te(!0);try{const ot=D.trim(),{error:Dt}=await P({email:ot,redirectTo:jt});if(Dt){$(Dt.message||String(Dt));return}B(ot),W(we("reset_password.request.sent")),A("reset_confirm")}finally{te(!1)}},[D,jt,P]),Mn=k.useCallback(async Xe=>{if(Xe.preventDefault(),$(null),j!==N){$(we("reset_password.error.password_mismatch"));return}te(!0);try{let ot=l;if(!ot){const{data:Et,error:Nn}=await T({email:D.trim(),code:ce.trim()});if(Nn){$(Nn.message||String(Nn));return}if(ot=C$(Et),!ot){$(we("reset_password.error.missing_token"));return}}const{error:Dt}=await L({newPassword:j,otp:ot});if(Dt){$(Dt.message||String(Dt));return}Y(!0),W(we("reset_password.success"))}finally{te(!1)}},[ce,N,D,T,j,L,l]);if(!h)return null;const Vt=E==="reset_email"||E==="reset_confirm";return R.jsxs("div",{className:$t("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",n),children:[Vt&&R.jsxs("button",{type:"button",onClick:()=>{A("signin"),W(null),$(null),Y(!1),S(""),U("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[R.jsx(VN,{className:"h-3.5 w-3.5"}),we("reset_password.back_to_sign_in")]}),R.jsxs("div",{className:$t("mb-6",Vt?"text-left":"text-center"),children:[!r&&!Vt&&R.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[R.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),R.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:we("shared.app_name")})]}),R.jsx("h2",{className:$t("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(r||Vt)&&"text-base font-bold md:text-lg"),children:Vt?we("reset_password.title"):t||we("login_modal.subtitle")}),!Vt&&e&&R.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:e}),Vt&&R.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:X&&E==="reset_confirm"&&!O?X:we("reset_password.subtitle")})]}),X&&(!Vt||O)&&R.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:X}),ie&&R.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:ie}),E==="reset_email"&&R.jsxs("form",{onSubmit:nr,className:"space-y-3",children:[R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we("reset_password.request.submit")})]}),E==="reset_confirm"&&(O?R.jsx("button",{type:"button",onClick:()=>{A("signin"),Y(!1),W(null),$(null),S(""),U("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:we("reset_password.success_cta")}):R.jsxs("form",{onSubmit:Mn,className:"space-y-3",children:[!l&&R.jsxs(R.Fragment,{children:[R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.code")}),R.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:ce,onChange:Xe=>le(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.new_password")}),R.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:j,onChange:Xe=>S(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.confirm_password")}),R.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:N,onChange:Xe=>U(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we("reset_password.reset.submit")})]})),!Vt&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"space-y-2.5 mb-5",children:fe?R.jsxs("div",{className:"space-y-2.5",children:[R.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),R.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):Ne.map(Xe=>R.jsxs("button",{type:"button",disabled:re,onClick:()=>_t(Xe),className:$t("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[x$[Xe]||null,we("login.oauth.continue",{provider:S$(Xe)})]},Xe))}),ae?R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"relative mb-5",children:[R.jsx("div",{className:"absolute inset-0 flex items-center",children:R.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),R.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:R.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:we("login_modal.divider_email")})})]}),R.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[R.jsx("button",{type:"button",className:$t("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",E==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{A("signin"),$(null)},children:we("login.tab.sign_in")}),R.jsx("button",{type:"button",className:$t("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",E==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{A("signup"),$(null)},children:we("login.tab.sign_up")})]}),R.jsxs("form",{onSubmit:Jt,className:"space-y-3",children:[E==="signup"&&R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.name")}),R.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:Q,onChange:Xe=>ee(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:we("login.field.name_placeholder")})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.password")}),R.jsx("input",{id:"card-password",type:"password",autoComplete:E==="signup"?"new-password":"current-password",required:!0,minLength:E==="signup"?Ie:void 0,value:j,onChange:Xe=>S(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),E==="signup"&&R.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:we("login.password_hint",{min:String(Ie)})}),E==="signin"&&R.jsx("div",{className:"mt-1 text-right",children:R.jsx("button",{type:"button",onClick:()=>{A("reset_email"),$(null),W(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:we("login.forgot_password")})})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we(E==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]}):R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"relative mb-5",children:[R.jsx("div",{className:"absolute inset-0 flex items-center",children:R.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),R.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:R.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:we("login.divider")})})]}),R.jsxs("button",{type:"button",onClick:()=>_e(!0),className:$t("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[R.jsx(aO,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),we("login_modal.continue_email")]})]})]})]})}function E$(){const{isOpen:t,closeLoginModal:e}=aT(),{enabled:n}=ko();return k.useEffect(()=>{if(!t)return;const a=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,e]),n?R.jsx(A5,{children:t&&R.jsxs(kd.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[R.jsx(kd.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),R.jsxs(kd.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 shadow-2xl overflow-hidden",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:a=>a.stopPropagation(),children:[R.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 z-10 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:R.jsx(x0,{className:"h-5 w-5"})}),R.jsx(T$,{onSuccess:e,className:"p-6 bg-transparent"})]})]})}):null}const A$={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"},qY="https://tokentracker.statuspage.io/",R$="https://github.com/mm7894215/TokenTracker",a4=`${R$}/releases/latest`,KY=`${a4}/download/TokenTrackerBar.dmg`,YY=`${a4}/download/TokenTracker-Setup.exe`;function L$(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?A$:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||Yr()).trim()}function D$(){return Yr()}function I$(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const M$=300*1e3,N$=720*60*1e3;function ab(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}function O$(t,e=Date.now()){if(!t?.token||!t?.deviceId||!t?.issuedAt)return!0;const n=Date.parse(t.issuedAt);return Number.isFinite(n)?n+N$<=e:!0}async function r4(t,e){const n=Yr();if(!ab(n)||!t)return;const a=n.replace(/\/$/,""),r=Gl(),s={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};r&&(s.apikey=r);try{await fetch(`${a}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:s,body:JSON.stringify({period:"week",source:e})})}catch{}}async function j$(){try{const t=await fetch("/functions/tokentracker-machine-id",{headers:{Accept:"application/json"},cache:"no-store"});if(t.ok){const e=await t.json().catch(()=>null),n=typeof e?.machineId=="string"?e.machineId.trim():null;if(n&&n.length>=8)return n}}catch{}return null}async function z$(t){const e=Yr();if(!ab(e)||!t)return null;const n=e.replace(/\/$/,""),a=Gl(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};a&&(r.apikey=a);const s=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",l=await j$();if(!l)return null;const c=`Token Tracker (dashboard) #${l.slice(0,8)}`,u=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:r,body:JSON.stringify({device_name:c,platform:s,machine_id:l})});if(!u.ok)return null;const h=await u.json().catch(()=>null),p=typeof h?.token=="string"?h.token:null,m=typeof h?.device_id=="string"?h.device_id:null;return!p||!m?null:{token:p,deviceId:m,issuedAt:typeof h?.created_at=="string"?h.created_at:new Date().toISOString()}}async function nP(t){const{deviceToken:e,insforgeBaseUrl:n,drain:a}=t,r={deviceToken:e};a===!0&&(r.drain=!0);const s=n||Yr();ab(s)&&(r.insforgeBaseUrl=s.trim());const l=await eu(),c=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...l},body:JSON.stringify(r)}),u=await c.json().catch(()=>({}));if(!c.ok){const h=typeof u.error=="string"?u.error:`HTTP ${c.status}`;throw new Error(h)}return u}async function aP(t){const e=await t();if(!e)return null;const n=pC();if(n&&!O$(n))return n;const a=await z$(e);return a?(C7(a),a):null}async function i4(t,e={}){let n=await t();if(!n)return null;let a=await aP(async()=>n);if(!a)return n;try{return await nP({deviceToken:a.token,insforgeBaseUrl:Yr(),drain:e.drain===!0}),n}catch(r){if(!pC()||(fC(),n=await t(),!n)||(a=await aP(async()=>n),!a))throw r;return await nP({deviceToken:a.token,insforgeBaseUrl:Yr(),drain:e.drain===!0}),n}}async function F$(t){const e=T7();if(Date.now()-e<M$)return;const n=await i4(t);n&&(mC(Date.now()),await r4(n,"cloud-sync-auto"))}async function ZY(t){const e=await i4(t,{drain:!0});e&&(mC(Date.now()),await r4(e,"cloud-sync-now"))}function U$(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function B$(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||U$(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function $$(){const t=ya(),e=ko(),n=k.useRef(!1);k.useEffect(()=>{if(!Rp()||!B$(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!Lp())return;let a=!1;const r=window.setTimeout(()=>{(async()=>{if(!(a||n.current)){n.current=!0;try{await F$(()=>e.getAccessToken())}catch(s){console.warn("[tokentracker] cloud usage sync:",s)}finally{n.current=!1}}})()},2500);return()=>{a=!0,window.clearTimeout(r)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}function V$(){const t=k.useContext(tT);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}function H$({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function W$(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},a=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof a=="string"&&a.trim()?a.trim():null}function G$(t){return t?Nf()?`/api/avatar-proxy?url=${encodeURIComponent(t)}`:t:null}function Eh(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function rP({className:t,variant:e="header",collapsed:n=!1,onAfterAction:a}){Kl();const r=e==="sidebar",{enabled:s,loading:l,signedIn:c,user:u,displayName:h}=ko(),{openLoginModal:p}=aT(),m=$l(),v=k.useMemo(()=>W$(u),[u]),y=k.useMemo(()=>G$(v),[v]),[b,x]=Cl.useState(!1);if(Cl.useEffect(()=>{x(!1)},[y]),!s)return null;if(l)return R.jsx("div",{className:$t("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!c)return r?R.jsxs("button",{type:"button",onClick:()=>{p(),a?.()},className:$t("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":we("header.auth.sign_in_aria"),title:n?we("header.auth.sign_in_aria"):void 0,children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:R.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&R.jsx("span",{className:"truncate flex-1 text-left",children:we("header.auth.sign_in_aria")})]}):R.jsx("button",{type:"button",onClick:p,className:$t("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-md px-4 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":we("header.auth.sign_in_aria"),children:we("header.auth.sign_in_aria")});const P=()=>{m("/settings"),a?.()};return R.jsx("div",{className:$t(r?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:R.jsxs("button",{type:"button",onClick:P,className:$t(r?$t("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-md pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":we("header.auth.open_settings"),title:r&&n?h:void 0,children:[r?R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:y&&!b?R.jsx("img",{src:y,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer",onError:()=>x(!0)}):Eh(h)==="?"?R.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600/30 text-white ring-1 ring-oai-brand-500/50",children:R.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3 opacity-80",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}):R.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:Eh(h)})}):y&&!b?R.jsx("img",{src:y,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer",onError:()=>x(!0)}):Eh(h)==="?"?R.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600/30 text-white ring-1 ring-oai-brand-500/50",children:R.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-4 h-4 opacity-80",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}):R.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:Eh(h)}),r?!n&&R.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:h}):R.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:h})]})})}const G_="tt.sidebarCollapsed";function s4(){return[{id:"general",label:we("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:qN,label:we("nav.usage")},{id:"limits",to:"/limits",icon:JN,label:we("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:xO,label:we("nav.leaderboard")},{id:"achievements",to:"/achievements",icon:WN,label:we("nav.achievements")}]},{id:"tools",label:we("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:tO,label:we("nav.widgets")},{id:"pet",to:"/pet-settings",icon:dO,label:we("nav.pet")},{id:"skills",to:"/skills",icon:hO,label:we("nav.skills")},{id:"ip-check",to:"/ip-check",icon:XN,label:we("nav.ip_check")}]},{id:"account",label:we("nav.group.account"),items:[{id:"settings",to:"/settings",icon:_O,label:we("nav.settings")}]}]}function q$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(G_)==="1"}catch{return!1}}function K$(){const[t,e]=k.useState(q$),n=k.useCallback(()=>{e(a=>{const r=!a;try{typeof window<"u"&&window.localStorage.setItem(G_,r?"1":"0")}catch{}return r})},[]);return k.useEffect(()=>{if(typeof window>"u")return;const a=r=>{r.key===G_&&e(r.newValue==="1")};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),{collapsed:t,toggle:n}}function Y$(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function Z$({label:t,collapsed:e,first:n}){return e?n?null:R.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):R.jsx("div",{className:$t("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function J$({item:t,collapsed:e,active:n,onClick:a}){const r=t.icon;return R.jsxs(Ef,{to:t.to,onClick:a,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:$t("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:R.jsx(r,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&R.jsx("span",{className:"truncate",children:t.label})]})}function Q$({as:t="button",title:e,onClick:n,href:a,children:r,className:s,...l}){const c=$t("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",s);return t==="a"?R.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:c,...l,children:r}):R.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:c,...l,children:r})}function X$({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,a]=k.useState(null);return k.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;H$({prefersReducedMotion:r,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&a(s.stargazers_count)}).catch(()=>{})},[t]),R.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:$t("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[R.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:R.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),R.jsx("span",{children:"Star"}),n!==null&&R.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const eV=[{value:"light",label:"Light",Icon:eT},{value:"dark",label:"Dark",Icon:XC},{value:"system",label:"System",Icon:oO}];function tV({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:a=!1}){const[r,s]=k.useState(!1),l=k.useRef(null),c=e==="dark"?XC:eT;return k.useEffect(()=>{if(!r)return;const u=p=>{l.current&&!l.current.contains(p.target)&&s(!1)},h=p=>{p.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[r]),R.jsxs("div",{ref:l,className:"relative",children:[R.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":r,"aria-haspopup":"menu",title:"Theme",onClick:()=>s(u=>!u),className:$t("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:R.jsx(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r&&R.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:eV.map(({value:u,label:h,Icon:p})=>{const m=t===u;return R.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(u),s(!1)},className:$t("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",m?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[R.jsx(p,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),R.jsx("span",{children:h})]},u)})})]})}function o4({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:a=!1,onClose:r,glassChrome:s=!1}){const c=ya()?.pathname||"/",{theme:u,resolvedTheme:h,setTheme:p}=V$(),{resolvedLocale:m}=Kl(),v=k.useMemo(()=>s4(),[m]);return R.jsxs(R.Fragment,{children:[R.jsx("div",{className:$t("px-2 pt-2 pb-2",t&&"flex justify-center"),children:a?R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("div",{className:"flex-1 min-w-0",children:R.jsx(rP,{variant:"sidebar",collapsed:t,onAfterAction:n})}),R.jsx("button",{type:"button",onClick:r,"aria-label":we("nav.close_menu"),title:we("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:R.jsx(x0,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):R.jsx(rP,{variant:"sidebar",collapsed:t,onAfterAction:n})}),R.jsx("nav",{"aria-label":we("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:v.map((y,b)=>R.jsxs("div",{className:"flex flex-col",children:[R.jsx(Z$,{label:y.label,collapsed:t,first:b===0}),R.jsx("div",{className:"flex flex-col gap-0.5",children:y.items.filter(x=>!(x.to==="/widgets"&&Of())).map(x=>R.jsx(J$,{item:x,collapsed:t,active:Y$(c,x.to),onClick:n},x.id))})]},y.id))}),R.jsxs("div",{className:$t("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[R.jsx(tV,{theme:u,resolvedTheme:h,onSetTheme:p,glassChrome:s}),R.jsx("div",{className:"flex items-center gap-1.5",children:!t&&R.jsx(X$,{glassChrome:s})})]})]})}function nV({collapsed:t,onToggleCollapsed:e}){const n=k.useMemo(()=>typeof window>"u"?!1:Ga()||Nf(),[]);return R.jsx("aside",{"data-native-sidebar":!0,"aria-label":we("nav.aside_label"),className:$t("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:R.jsx(o4,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function aV({open:t,onClose:e}){return k.useEffect(()=>{if(!t)return;const n=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),k.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?R.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[R.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),R.jsx("aside",{"aria-label":we("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:R.jsx(o4,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function rV({onOpenDrawer:t}){return R.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[R.jsx(Q$,{title:we("nav.menu"),onClick:t,children:R.jsx(iO,{className:"h-5 w-5","aria-hidden":!0})}),R.jsxs(Ef,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[R.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),R.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),R.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function iV({children:t}){const{collapsed:e,toggle:n}=K$(),[a,r]=k.useState(!1),s=k.useCallback(()=>r(!0),[]),l=k.useCallback(()=>r(!1),[]),c=k.useMemo(()=>typeof window>"u"?!1:Ga()||Nf(),[]);return R.jsxs("div",{className:$t("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",Of()&&"tt-native-glass-shell",c?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[c&&R.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),R.jsxs("div",{className:"flex-1 min-h-0 flex",children:[R.jsx(nV,{collapsed:e,onToggleCollapsed:n}),R.jsx(aV,{open:a,onClose:l}),R.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:R.jsxs("div",{className:$t("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",c?"tt-native-main-card":"rounded-2xl",!c&&"shadow-sm"),children:[R.jsx(rV,{onOpenDrawer:s}),R.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}function sV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function iP({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:R.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function oV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function lV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function cV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function dV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function uV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function hV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:[R.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),R.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function pV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function sP({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 60",fill:"none",className:e,"aria-hidden":"true",children:[R.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),R.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:R.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),R.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:R.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function fV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:[R.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),R.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),R.jsx("path",{d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function mV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",className:e,children:R.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function gV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:e,children:R.jsx("path",{d:"M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263c-.135-.423-.73-.423-.867 0L1.388 9.452.045 13.587a.924.924 0 0 0 .331 1.03L12 23.054l11.625-8.436a.92.92 0 0 0 .33-1.031"})})}function vV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":"true",children:R.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:R.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function _V({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[R.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),R.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),R.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),R.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),R.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),R.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function yV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[R.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),R.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),R.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}function bV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[R.jsx("path",{d:"M9 3v2"}),R.jsx("path",{d:"M15 3v2"}),R.jsx("rect",{x:"4",y:"6",width:"16",height:"13",rx:"3"}),R.jsx("circle",{cx:"9",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),R.jsx("circle",{cx:"15",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),R.jsx("path",{d:"M9 16h6"})]})}function kV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"})})}function wV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M20.113 5.5l-.442 1.557a.157.157 0 01-.196.106l-7.414-2.157a.16.16 0 00-.143.028l-7.342 5.74a.159.159 0 01-.074.032l-4.37.656a.154.154 0 00-.132.162l.02.245c.005.078.071.14.152.141l5.074.128.058.002 3.75-1.953a.16.16 0 01.164.01l2.657 1.847a.152.152 0 01.066.125l-.023 2.45c0 .032.01.063.028.089l3.737 5.227c.03.04.077.065.129.065h1.182a.153.153 0 00.14-.224l-2.664-4.919a.15.15 0 01.005-.152l1.389-2.169a.156.156 0 01.062-.055l4.965-2.456a.16.16 0 01.158.01l1.418.921a.16.16 0 00.087.026h1.289c.125 0 .2-.136.13-.237l-3.578-5.29c-.074-.109-.246-.082-.282.044z"})})}function xV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})})}function PV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M0 0v24h24V0H0zm22.222 22.222H1.778V1.778h20.444v20.444zm-7.555-4.964h2.222v1.778h-2.794L12.89 17.83v-2.794h1.778v2.222zm4 0h-1.778v-2.222h-2.222v-1.778h2.793l1.207 1.207v2.793zm-7.556-2.591H9.333v-1.778h1.778v1.778zm-5.778-1.778h1.778v4h4v1.778H6.54L5.333 17.46V12.89zm13.334-3.556v1.778h-5.778V9.333h1.987V7.111h-1.987V5.333h2.558l1.206 1.207v2.793h2.014zm-11.556-2h2.222l1.778 1.778v2H9.333v-2H7.111v2H5.333V5.333h1.778v2zm4 0H9.333v-2h1.778v2z"})})}function SV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,children:R.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.125 2.75C2.9179 2.75 2.75 2.9179 2.75 3.125V11.375H2V3.125C2 2.50368 2.50368 2 3.125 2H13.1723C13.6735 2 13.9244 2.6059 13.5701 2.96025L7.38189 9.14843H9.125V8.375H9.875V9.33593C9.875 9.6466 9.6232 9.8984 9.3125 9.8984H6.63189L5.34282 11.1875H11.1875V6.5H11.9375V11.1875C11.9375 11.6017 11.6017 11.9375 11.1875 11.9375H4.59282L3.28032 13.25H12.875C13.0821 13.25 13.25 13.0821 13.25 12.875V4.625H14V12.875C14 13.4963 13.4963 14 12.875 14H2.82767C2.32653 14 2.07557 13.3941 2.42992 13.0397L8.59468 6.875H6.875V7.625H6.125V6.6875C6.125 6.37684 6.37684 6.125 6.6875 6.125H9.34468L10.6571 4.8125H4.8125V9.5H4.0625V4.8125C4.0625 4.39829 4.39829 4.0625 4.8125 4.0625H11.4071L12.7197 2.75H3.125Z"})})}function CV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",xmlns:"http://www.w3.org/2000/svg",className:e,children:R.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"})})}const TV={CLAUDE:sV,ZCODE:kV,CODEBUDDY:sP,WORKBUDDY:sP,CODEX:iP,COPILOT:pV,CRAFT:vV,CURSOR:oV,DEEPSEEK:CV,DROID:bV,"EVERY-CODE":iP,GEMINI:lV,GITHUB:mV,GITLAB:gV,GOOSE:xV,GROK:cV,HERMES:fV,KIMI:hV,KIRO:dV,KILOCODE:PV,OPENCODE:uV,OMP:_V,PI:yV,ROOCODE:wV,ZED:SV},EV={ANTIGRAVITY:"/brand-logos/antigravity.svg",ANYTHINGLLM:"/brand-logos/anythingllm.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",DEEPSEEK:"/brand-logos/deepseek.svg",GEMINI:"/brand-logos/gemini.svg","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",MIMO:"/brand-logos/mimo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"},AV={ANYTHINGLLM:"brightness-0 dark:brightness-100"};function RV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:R.jsx("circle",{cx:"12",cy:"12",r:"7.5",strokeDasharray:"3 3"})})}function LV({provider:t,size:e=16,color:n,className:a=""}){const r=t?.toUpperCase?.()||"",s=EV[r];if(s){const c=`${AV[r]||""} ${a}`.trim();return R.jsx("img",{src:s,alt:"",width:e,height:e,className:c,style:{width:e,height:e,objectFit:"contain"},"aria-hidden":!0})}const l=TV[r];return l?R.jsx(l,{size:e,className:a}):R.jsx(RV,{size:e,className:`text-oai-gray-400 dark:text-oai-gray-500 shrink-0 ${a}`})}const l4="tokentracker-skills";async function xo(t){const e=new URL(`/functions/${l4}`,window.location.origin);if(t)for(const[r,s]of Object.entries(t))s!=null&&s!==""&&e.searchParams.set(r,String(s));const n=await fetch(e.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),a=await n.json().catch(()=>null);if(!n.ok)throw new Error(a?.error||`Request failed with HTTP ${n.status}`);return a}async function ys(t){const e=await eu(),n=await fetch(`/functions/${l4}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e},cache:"no-store",body:JSON.stringify(t)}),a=await n.json().catch(()=>null);if(!n.ok||a?.ok===!1)throw new Error(a?.error||`Request failed with HTTP ${n.status}`);return a}function DV(){return xo({mode:"installed"})}function JY(t={}){return xo({mode:"discover",...t.force?{force:1}:{}})}function QY(t,e=0,n=20){return xo({mode:"search",q:t,offset:e,limit:n})}function XY(){return xo({mode:"repos"})}function eZ(t,e){return ys({action:"install",skill:t,targets:e})}function tZ(t){return ys({action:"uninstall",id:t})}function nZ(t){return ys({action:"restore",id:t})}function aZ(t,e){return ys({action:"set_targets",id:t,targets:e})}function rZ(t,e){return ys({action:"import_local",directory:t,targets:e})}function iZ(t,e){return ys({action:"delete_local",directory:t,targets:e||[]})}function sZ(t){return ys({action:"add_repo",repo:t})}function oZ(t,e){return ys({action:"remove_repo",owner:t,name:e})}function lZ(t={}){return xo({mode:"popular",...t.force?{force:1}:{}})}function cZ(t={}){return xo({mode:"updates",...t.force?{force:1}:{}})}function dZ(t={}){return xo({mode:"skill_usage",...t.force?{force:1}:{}})}const IV=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function MV(){const t=$l(),e=EB(),[n,a]=k.useState(!1),[r,s]=k.useState(""),[l,c]=k.useState(0),[u,h]=k.useState([]),p=k.useRef(null),m=k.useRef(null);k.useEffect(()=>{const E=A=>{(A.metaKey||A.ctrlKey)&&(A.key==="k"||A.key==="K")&&(A.preventDefault(),a(B=>!B))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[]),k.useEffect(()=>{if(!n)return;s(""),c(0);const E=requestAnimationFrame(()=>p.current?.focus());return IV&&!u.length&&DV().then(A=>h(A?.skills||[])).catch(()=>h([])),()=>cancelAnimationFrame(E)},[n,u.length]);const v=k.useMemo(()=>{const E=s4().flatMap(D=>D.items.map(B=>({kind:"page",id:`page:${B.id}`,label:B.label,sub:we("cmdk.group.pages"),Icon:B.icon,run:()=>t(B.to)}))),A=(u||[]).map(D=>({kind:"skill",id:`skill:${D.id||D.directory}`,label:D.name||D.directory,sub:D.repoOwner&&D.repoName?`${D.repoOwner}/${D.repoName}`:we("cmdk.group.skills"),provider:(D.targets||[])[0]||"claude",run:()=>t(`/skills?skill=${encodeURIComponent(D.directory||D.id)}`)}));return[...E,...A]},[t,u]),y=k.useMemo(()=>{const E=r.trim().toLowerCase();return E?v.filter(A=>A.label.toLowerCase().includes(E)||String(A.sub||"").toLowerCase().includes(E)):v},[v,r]);k.useEffect(()=>{l>=y.length&&c(y.length?y.length-1:0)},[l,y.length]),k.useEffect(()=>{if(!n)return;m.current?.querySelector(`[data-cmdk-index="${l}"]`)?.scrollIntoView({block:"nearest"})},[l,n]);const b=k.useCallback(()=>a(!1),[]),x=k.useCallback(E=>{E&&(b(),E.run())},[b]),P=E=>{E.key==="ArrowDown"?(E.preventDefault(),c(A=>Math.min(A+1,Math.max(0,y.length-1)))):E.key==="ArrowUp"?(E.preventDefault(),c(A=>Math.max(A-1,0))):E.key==="Enter"?(E.preventDefault(),x(y[l])):E.key==="Escape"&&(E.preventDefault(),b())},T={duration:e?0:.12},L=e?{duration:0}:{type:"spring",stiffness:460,damping:34,mass:.6};return R.jsx(A5,{children:n?R.jsxs(kd.div,{className:"fixed inset-0 z-[120] flex items-start justify-center px-4 pt-[16vh]",initial:e?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:T,children:[R.jsx("button",{type:"button","aria-label":we("cmdk.close"),onClick:b,className:"absolute inset-0 cursor-default bg-oai-black/40"}),R.jsxs(kd.div,{role:"dialog","aria-modal":"true","aria-label":we("cmdk.open_aria"),initial:e?!1:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:e?{opacity:0}:{opacity:0,y:-8,scale:.985},transition:L,className:"relative w-full max-w-xl overflow-hidden rounded-2xl border border-oai-gray-200 bg-oai-white shadow-2xl dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[R.jsxs("div",{className:"flex items-center gap-2.5 border-b border-oai-gray-200 px-4 dark:border-oai-gray-800",children:[R.jsx(gO,{className:"h-4 w-4 shrink-0 text-oai-gray-400","aria-hidden":!0}),R.jsx("input",{ref:p,type:"text",value:r,onChange:E=>{s(E.target.value),c(0)},onKeyDown:P,"aria-label":we("cmdk.placeholder"),"aria-controls":"cmdk-listbox","aria-activedescendant":y[l]?`cmdk-opt-${l}`:void 0,role:"combobox","aria-expanded":"true",placeholder:we("cmdk.placeholder"),className:"h-12 w-full bg-transparent text-sm text-oai-black placeholder:text-oai-gray-400 focus:outline-none dark:text-white"})]}),R.jsx("div",{ref:m,id:"cmdk-listbox",role:"listbox",className:"max-h-[min(56vh,22rem)] overflow-y-auto p-1.5",children:y.length===0?R.jsx("div",{className:"px-3 py-8 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:we("cmdk.empty")}):y.map((E,A)=>{const D=A===l;return R.jsxs("button",{type:"button",role:"option",id:`cmdk-opt-${A}`,"data-cmdk-index":A,"aria-selected":D,onMouseMove:()=>c(A),onClick:()=>x(E),className:$t("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",D?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200"),children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-400",children:E.kind==="skill"?R.jsx(LV,{provider:E.provider,size:16}):R.jsx(E.Icon,{className:"h-4 w-4","aria-hidden":!0})}),R.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:E.label}),R.jsx("span",{className:"shrink-0 truncate text-xs text-oai-gray-400 dark:text-oai-gray-500",children:E.sub}),D?R.jsx(YN,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}):null]},E.id)})})]})]}):null})}const NV=[];function rb(t){k.useEffect(t,NV)}const oP={};function Ql(t,e){const n=k.useRef(oP);return n.current===oP&&(n.current=t(e)),n}const OV=()=>{},Ka=typeof document<"u"?k.useLayoutEffect:OV;function jV(t,e){return function(a,...r){const s=new URL(t);return s.searchParams.set("code",a.toString()),r.forEach(l=>s.searchParams.append("args[]",l)),`${e} error #${a}; visit ${s} for the full message.`}}const Xl=jV("https://base-ui.com/production-error","Base UI"),ib=k.createContext(void 0);function sb(){const t=k.useContext(ib);if(!t)throw new Error(Xl(73));return t}const fr=(t,e,n,a,r,s,...l)=>{if(l.length>0)throw new Error(Xl(1));let c;if(t&&e&&n&&a&&r&&s)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m),x=a(u,h,p,m),P=r(u,h,p,m);return s(v,y,b,x,P,h,p,m)};else if(t&&e&&n&&a&&r)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m),x=a(u,h,p,m);return r(v,y,b,x,h,p,m)};else if(t&&e&&n&&a)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m);return a(v,y,b,h,p,m)};else if(t&&e&&n)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m);return n(v,y,h,p,m)};else if(t&&e)c=(u,h,p,m)=>{const v=t(u,h,p,m);return e(v,h,p,m)};else if(t)c=t;else throw new Error("Missing arguments");return c};var uv={exports:{}},hv={};var lP;function zV(){if(lP)return hv;lP=1;var t=Kd();function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var n=typeof Object.is=="function"?Object.is:e,a=t.useState,r=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(m,v){var y=v(),b=a({inst:{value:y,getSnapshot:v}}),x=b[0].inst,P=b[1];return s(function(){x.value=y,x.getSnapshot=v,u(x)&&P({inst:x})},[m,y,v]),r(function(){return u(x)&&P({inst:x}),m(function(){u(x)&&P({inst:x})})},[m]),l(y),y}function u(m){var v=m.getSnapshot;m=m.value;try{var y=v();return!n(m,y)}catch{return!0}}function h(m,v){return v()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return hv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,hv}var cP;function c4(){return cP||(cP=1,uv.exports=zV()),uv.exports}var FV=c4(),pv={exports:{}},fv={};var dP;function UV(){if(dP)return fv;dP=1;var t=Kd(),e=c4();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var a=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return fv.useSyncExternalStoreWithSelector=function(h,p,m,v,y){var b=s(null);if(b.current===null){var x={hasValue:!1,value:null};b.current=x}else x=b.current;b=c(function(){function T(B){if(!L){if(L=!0,E=B,B=v(B),y!==void 0&&x.hasValue){var j=x.value;if(y(j,B))return A=j}return A=B}if(j=A,a(E,B))return j;var S=v(B);return y!==void 0&&y(j,S)?(E=B,j):(E=B,A=S)}var L=!1,E,A,D=m===void 0?null:m;return[function(){return T(p())},D===null?void 0:function(){return T(D())}]},[p,m,v,y]);var P=r(h,b[0],b[1]);return l(function(){x.hasValue=!0,x.value=P},[P]),u(P),P},fv}var uP;function BV(){return uP||(uP=1,pv.exports=UV()),pv.exports}var $V=BV();const VV=parseInt(k.version,10);function ob(t){return VV>=t}const HV=ob(19),WV=HV?qV:KV;function d4(t,e,n,a,r){return WV(t,e,n,a,r)}function GV(t,e,n,a,r){const s=k.useCallback(()=>e(t.getSnapshot(),n,a,r),[t,e,n,a,r]);return FV.useSyncExternalStore(t.subscribe,s,s)}function qV(t,e,n,a,r){return GV(t,e,n,a,r)}function KV(t,e,n,a,r){return $V.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,s=>e(s,n,a,r))}class YV{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const a of this.listeners){if(n!==this.updateTick)return;a(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){this.setState({...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||this.setState({...this.state,[e]:n})}notifyAll(){const e={...this.state};this.setState(e)}use(e,n,a,r){return d4(this,e,n,a,r)}}const lb={...OS},mv=lb.useInsertionEffect,ZV=mv&&mv!==lb.useLayoutEffect?mv:t=>t();function go(t){const e=Ql(JV).current;return e.next=t,ZV(e.effect),e.trampoline}function JV(){const t={next:void 0,callback:QV,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function QV(){}function XV(){}const uZ=Object.freeze([]),eo=Object.freeze({});class eH extends YV{constructor(e,n={},a){super(e),this.context=n,this.selectors=a}useSyncedValue(e,n){k.useDebugValue(e);const a=this;Ka(()=>{a.state[e]!==n&&a.set(e,n)},[a,e,n])}useSyncedValueWithCleanup(e,n){const a=this;Ka(()=>(a.state[e]!==n&&a.set(e,n),()=>{a.set(e,void 0)}),[a,e,n])}useSyncedValues(e){const n=this,a=Object.values(e);Ka(()=>{n.update(e)},[n,...a])}useControlledProp(e,n){k.useDebugValue(e);const a=this,r=n!==void 0;Ka(()=>{r&&!Object.is(a.state[e],n)&&a.setState({...a.state,[e]:n})},[a,e,n,r])}select(e,n,a,r){const s=this.selectors[e];return s(this.state,n,a,r)}useState(e,n,a,r){return k.useDebugValue(e),d4(this,this.selectors[e],n,a,r)}useContextCallback(e,n){k.useDebugValue(e);const a=go(n??XV);this.context[e]=a}useStateSetter(e){const n=k.useRef(void 0);return n.current===void 0&&(n.current=a=>{this.set(e,a)}),n.current}observe(e,n){let a;typeof e=="function"?a=e:a=this.selectors[e];let r=a(this.state);return n(r,r,this),this.subscribe(s=>{const l=a(s);if(!Object.is(r,l)){const c=r;r=l,n(l,c,this)}})}}function Vf(){return typeof window<"u"}function wr(t){return cb(t)?(t.nodeName||"").toLowerCase():"#document"}function Ei(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tH(t){var e;return(e=(cb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function cb(t){return Vf()?t instanceof Node||t instanceof Ei(t).Node:!1}function db(t){return Vf()?t instanceof Element||t instanceof Ei(t).Element:!1}function fs(t){return Vf()?t instanceof HTMLElement||t instanceof Ei(t).HTMLElement:!1}function Jp(t){return!Vf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ei(t).ShadowRoot}function u4(t){const{overflow:e,overflowX:n,overflowY:a,display:r}=Hf(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+n)&&r!=="inline"&&r!=="contents"}function hZ(t){return/^(table|td|th)$/.test(wr(t))}function nH(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const aH=/transform|translate|scale|rotate|perspective|filter/,rH=/paint|layout|strict|content/,js=t=>!!t&&t!=="none";let gv;function iH(t){const e=db(t)?Hf(t):t;return js(e.transform)||js(e.translate)||js(e.scale)||js(e.rotate)||js(e.perspective)||!sH()&&(js(e.backdropFilter)||js(e.filter))||aH.test(e.willChange||"")||rH.test(e.contain||"")}function pZ(t){let e=q_(t);for(;fs(e)&&!h4(e);){if(iH(e))return e;if(nH(e))return null;e=q_(e)}return null}function sH(){return gv==null&&(gv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gv}function h4(t){return/^(html|body|#document)$/.test(wr(t))}function Hf(t){return Ei(t).getComputedStyle(t)}function fZ(t){return db(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q_(t){if(wr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Jp(t)&&t.host||tH(t);return Jp(e)?e.host:e}function p4(t){const e=q_(t);return h4(e)?t.ownerDocument?t.ownerDocument.body:t.body:fs(e)&&u4(e)?e:p4(e)}function hP(t,e,n){var a;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=p4(t),s=r===((a=t.ownerDocument)==null?void 0:a.body),l=Ei(r);if(s){const c=oH(l);return e.concat(l,l.visualViewport||[],u4(r)?r:[],c&&n?hP(c):[])}else return e.concat(r,hP(r,[],n))}function oH(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function f4(...t){return()=>{for(let e=0;e<t.length;e+=1){const n=t[e];n&&n()}}}function br(t){return t?.ownerDocument||document}function to(t,e,n,a){return t.addEventListener(e,n,a),()=>{t.removeEventListener(e,n,a)}}const Ah=null;class lH{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let r=0;r<n.length;r+=1)n[r]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Rh=new lH;class ub{static create(){return new ub}static request(e){return Rh.request(e)}static cancel(e){return Rh.cancel(e)}currentId=Ah;request(e){this.cancel(),this.currentId=Rh.request(()=>{this.currentId=Ah,e()})}cancel=()=>{this.currentId!==Ah&&(Rh.cancel(this.currentId),this.currentId=Ah)};disposeEffect=()=>this.cancel}function cH(){const t=Ql(ub.create).current;return rb(t.disposeEffect),t}const Vc=0;class Fd{static create(){return new Fd}currentId=Vc;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Vc,n()},e)}isStarted(){return this.currentId!==Vc}clear=()=>{this.currentId!==Vc&&(clearTimeout(this.currentId),this.currentId=Vc)};disposeEffect=()=>this.clear}function dH(){const t=Ql(Fd.create).current;return rb(t.disposeEffect),t}let pP=0;function m4(t){return pP+=1,`${t}-${Math.random().toString(36).slice(2,6)}-${pP}`}function vv(t,e){if(typeof t=="string")return{description:t};if(typeof t=="function"){const n=t(e);return typeof n=="string"?{description:n}:n}return t}function uH(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:hH,platform:pH,maxTouchPoints:fH}=uH(),Wf=hH.toLowerCase(),Ud=pH.toLowerCase(),g4=/^i(os$|p)/.test(Ud)||Ud==="macintel"&&fH>1,fP="android",mZ=Ud===fP||Wf.includes(fP),mH=!g4&&Ud.startsWith("mac");Ud.startsWith("win");const gH=mH||g4,hb=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!hb&&Wf.includes("firefox");!hb&&Wf.includes("chrom");const vH=gH,_H=/jsdom|happydom/.test(Wf),mP="data-base-ui-focusable",v4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",gZ="ArrowLeft",vZ="ArrowRight",_Z="ArrowUp",yZ="ArrowDown";function xl(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Ai(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Jp(n)){let a=e;for(;a;){if(t===a)return!0;a=a.parentNode||a.host}}return!1}function no(t){return"composedPath"in t?t.composedPath()[0]:t.target}function bZ(t,e){if(!db(t))return!1;const n=t;if(e.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,a]of e.entries())if(Ai(a,n))return!a.hasAttribute("data-trigger-disabled");return!1}function kZ(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function wZ(t){return t.matches("html,body")}function yH(t){return fs(t)&&t.matches(v4)}function xZ(t){return t?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${v4}`)!=null}function PZ(t){return t?t.getAttribute("role")==="combobox"&&yH(t):!1}function K_(t){if(!t||_H)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function SZ(t){return t?t.hasAttribute(mP)?t:t.querySelector(`[${mP}]`)||t:null}function CZ(t,e){return e<0||e>=t.length}function TZ(t,e){return _4(t.current,{disabledIndices:e})}function EZ(t,e){return _4(t.current,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function _4(t,{startingIndex:e=-1,decrement:n=!1,disabledIndices:a,amount:r=1}={}){let s=e;do s+=n?-r:r;while(s>=0&&s<=t.length-1&&bH(t,s,a));return s}function bH(t,e,n){if(typeof n=="function"?n(e):n?.includes(e)??!1)return!0;const r=t[e];return r?y4(r)?!n&&(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"):!0:!1}function kH(t){return t.visibility==="hidden"||t.visibility==="collapse"}function y4(t,e=t?Hf(t):null){return!t||!t.isConnected||!e||kH(e)?!1:typeof t.checkVisibility=="function"?t.checkVisibility():e.display!=="none"&&e.display!=="contents"}const wH='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function xH(t){const e=t.assignedSlot;if(e)return e;if(t.parentElement)return t.parentElement;const n=t.getRootNode();return Jp(n)?n.host:null}function Y_(t){for(const e of Array.from(t.children))if(wr(e)==="summary")return e;return null}function PH(t,e){const n=Y_(e);return!!n&&(t===n||Ai(n,t))}function b4(t){const e=t?wr(t):"";return t!=null&&t.matches(wH)&&(e!=="summary"||t.parentElement!=null&&wr(t.parentElement)==="details"&&Y_(t.parentElement)===t)&&(e!=="details"||Y_(t)==null)&&(e!=="input"||t.type!=="hidden")}function k4(t){if(!b4(t)||!t.isConnected||t.matches(":disabled"))return!1;for(let e=t;e;e=xH(e)){const n=e!==t,a=wr(e)==="slot";if(e.hasAttribute("inert")||n&&wr(e)==="details"&&!e.open&&!PH(t,e)||e.hasAttribute("hidden")||!a&&!SH(e,n))return!1}return!0}function SH(t,e){const n=Hf(t);return e?n.display!=="none":y4(t,n)}function w4(t){const e=t.tabIndex;if(e<0){const n=wr(t);if(n==="details"||n==="audio"||n==="video"||fs(t)&&t.isContentEditable)return 0}return e}function _v(t){if(wr(t)!=="input")return null;const e=t;return e.type==="radio"&&e.name!==""?e:null}function CH(t,e){const n=_v(t);if(!n)return!0;const a=e.find(r=>{const s=_v(r);return s?.name===n.name&&s.form===n.form&&s.checked});return a?a===n:e.find(r=>{const s=_v(r);return s?.name===n.name&&s.form===n.form})===n}function x4(t){if(fs(t)&&wr(t)==="slot"){const e=t.assignedElements({flatten:!0});if(e.length>0)return e}return fs(t)&&t.shadowRoot?Array.from(t.shadowRoot.children):Array.from(t.children)}function P4(t,e){x4(t).forEach(n=>{b4(n)&&e.push(n),P4(n,e)})}function S4(t,e,n){x4(t).forEach(a=>{fs(a)&&a.matches(e)&&n.push(a),S4(a,e,n)})}function AZ(t){return k4(t)&&w4(t)>=0}function TH(t){const e=[];return P4(t,e),e.filter(k4)}function pb(t){const e=TH(t);return e.filter(n=>w4(n)>=0&&CH(n,e))}function C4(t,e){const n=pb(t),a=n.length;if(a===0)return;const r=xl(br(t)),s=n.indexOf(r),l=s===-1?e===1?0:a-1:s+e;return n[l]}function EH(t){return C4(br(t).body,1)||t}function AH(t){return C4(br(t).body,-1)||t}function T4(t,e){if(!t)return null;const n=pb(br(t).body),a=n.length;if(a===0)return null;const r=n.indexOf(t);if(r===-1)return null;const s=(r+e+a)%a;return n[s]}function RZ(t){return T4(t,1)}function LZ(t){return T4(t,-1)}function yv(t,e){const n=e||t.currentTarget,a=t.relatedTarget;return!a||!Ai(n,a)}function RH(t){pb(t).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function gP(t){const e=[];S4(t,"[data-tabindex]",e),e.forEach(n=>{const a=n.dataset.tabindex;delete n.dataset.tabindex,a?n.setAttribute("tabindex",a):n.removeAttribute("tabindex")})}function Lh(t){const e=new Map;let n=0,a=0;return t.forEach((r,s)=>{const l=r.transitionStatus==="ending";e.set(r.id,{value:r,domIndex:s,visibleIndex:l?-1:n,offsetY:a}),a+=r.height||0,l||(n+=1)}),e}function bv(t,e){let n=0;return t.map(a=>{if(a.transitionStatus==="ending")return a;const r=n>=e;return n+=1,a.limited===r?a:{...a,limited:r}})}const Dh=t=>t.toastMetadata,Ir={toasts:fr(t=>t.toasts),isEmpty:fr(t=>t.toasts.length===0),toast:fr(Dh,(t,e)=>t.get(e)?.value),toastIndex:fr(Dh,(t,e)=>t.get(e)?.domIndex??-1),toastOffsetY:fr(Dh,(t,e)=>t.get(e)?.offsetY??0),toastVisibleIndex:fr(Dh,(t,e)=>t.get(e)?.visibleIndex??-1),hovering:fr(t=>t.hovering),focused:fr(t=>t.focused),expanded:fr(t=>t.hovering||t.focused),expandedOrOutOfFocus:fr(t=>t.hovering||t.focused||!t.isWindowFocused),prevFocusElement:fr(t=>t.prevFocusElement)};class LH extends eH{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Lh(e.toasts)},{},Ir)}setFocused(e){this.set("focused",e)}setHovering(e){this.set("hovering",e)}setIsWindowFocused(e){this.set("isWindowFocused",e)}setPrevFocusElement(e){this.set("prevFocusElement",e)}setViewport=e=>{this.set("viewport",e)};syncProviderProps(e){const n=this.state.limit!==e.limit;if(this.state.timeout===e.timeout&&!n)return;const a={timeout:e.timeout,limit:e.limit};if(n){const r=bv(this.state.toasts,e.limit);a.toasts=r,a.toastMetadata=Lh(r)}this.update(a)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,n={}){const a=Ir.toastIndex(this.state,e);if(a===-1)return;const r=this.state.toasts[a];n.skipOnRemove||r?.onRemove?.();const s=[...this.state.toasts];s.splice(a,1),this.setToasts(s)}addToast=e=>{const{timeout:n,limit:a}=this.state,r=e.id||m4("toast");if(e.id){const u=Ir.toast(this.state,e.id);if(u)if(u.transitionStatus==="ending")this.removeToast(e.id,{skipOnRemove:!0});else{const{id:h,transitionStatus:p,...m}=e;return this.updateToastInternal(e.id,m,{resetTimer:!0,markUpdated:!0}),e.id}}const s={...e,id:r,updateKey:0,transitionStatus:"starting"},l=[s,...this.state.toasts];this.setToasts(bv(l,a));const c=s.timeout??n;return s.type!=="loading"&&c>0&&this.scheduleTimer(r,c,()=>this.closeToast(r)),Ir.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,n)=>{this.updateToastInternal(e,n,{markUpdated:!0})};updateToastInternal=(e,n,a={})=>{const{timeout:r,toasts:s}=this.state,l=Ir.toast(this.state,e)??null;if(!l||l.transitionStatus==="ending")return;const c={...l,...n,...a.markUpdated&&{updateKey:(l.updateKey??0)+1}};this.setToasts(s.map(x=>x.id===e?c:x));const u=c.timeout??r,h=l?.timeout??r,p=Object.hasOwn(n,"timeout"),m=c.transitionStatus!=="ending"&&c.type!=="loading"&&u>0,v=this.timers.has(e),y=h!==u,b=l?.type==="loading";if(!m&&v){this.clearTimer(e);return}m&&(!v||y||p||b||a.resetTimer)&&(this.clearTimer(e),this.scheduleTimer(e,u,()=>this.closeToast(e)),Ir.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{const n=e===void 0,{limit:a,toasts:r}=this.state;let s;if(n)s=r,this.clearTimers();else{const p=Ir.toast(this.state,e);if(!p)return;s=[p],this.clearTimer(e)}const l=r.map(p=>n||p.id===e?{...p,transitionStatus:"ending",height:0}:p),c=bv(l,a),u={toasts:c,toastMetadata:Lh(c)};c.some(p=>p.transitionStatus!=="ending")||(u.hovering=!1,u.focused=!1),this.update(u),s.forEach(p=>{p.transitionStatus!=="ending"&&p.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,n)=>{const a=vv(n.loading),r=this.addToast({...a,type:"loading"}),s=e.then(l=>{const c=vv(n.success,l);return this.updateToast(r,{...c,type:"success",timeout:c.timeout}),l}).catch(l=>{const c=vv(n.error,l);return this.updateToast(r,{...c,type:"error",timeout:c.timeout}),Promise.reject(l)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();const n=Date.now()-e.start,a=e.delay-n;e.remaining=a>0?a:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,n)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=Fd.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(n),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!=="touch")return;const n=no(e);Ai(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,n,a){const r=Date.now(),s=!Ir.expandedOrOutOfFocus(this.state),l=s?Fd.create():void 0;l?.start(n,()=>{this.handleTimerFired(e),a()}),this.timers.set(e,{timeout:l,start:s?r:0,delay:n,remaining:n,callback:a})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e){const n={toasts:e,toastMetadata:Lh(e)};e.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){const n=xl(br(this.state.viewport));if(!this.state.viewport||!Ai(this.state.viewport,n)||!K_(n))return;if(e===void 0){this.restoreFocusToPrevElement();return}const a=Ir.toasts(this.state),r=Ir.toastIndex(this.state,e);let s=null,l=r+1;for(;l<a.length;){if(a[l].transitionStatus!=="ending"){s=a[l];break}l+=1}if(!s)for(l=r-1;l>=0;){if(a[l].transitionStatus!=="ending"){s=a[l];break}l-=1}s?s.ref?.current?.focus():this.restoreFocusToPrevElement()}}const DH=function(e){const{children:n,timeout:a=5e3,limit:r=3,toastManager:s}=e,l=Ql(()=>new LH({timeout:a,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return rb(l.disposeEffect),k.useEffect(function(){return s?s[" subscribe"](({action:h,options:p})=>{const m=p.id;h==="promise"&&p.promise?l.promiseToast(p.promise,p):h==="update"&&m?l.updateToast(m,p):h==="close"?l.closeToast(m):l.addToast(p)}):void 0},[l,s]),Ka(()=>{l.syncProviderProps({timeout:a,limit:r})},[l,a,r]),R.jsx(ib.Provider,{value:l,children:n})},E4={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},A4={...E4,position:"fixed",top:0,left:0},DZ={...E4,position:"absolute"},wd=k.forwardRef(function(e,n){const[a,r]=k.useState();Ka(()=>{vH&&hb&&r("button")},[]);const s={tabIndex:0,role:a};return R.jsx("span",{...e,ref:n,style:A4,"aria-hidden":a?void 0:!0,...s,"data-base-ui-focus-guard":""})});function vP(t,e,n,a){const r=Ql(R4).current;return MH(r,t,e,n,a)&&L4(r,[t,e,n,a]),r.callback}function IH(t){const e=Ql(R4).current;return NH(e,t)&&L4(e,t),e.callback}function R4(){return{callback:null,cleanup:null,refs:[]}}function MH(t,e,n,a,r){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==a||t.refs[3]!==r}function NH(t,e){return t.refs.length!==e.length||t.refs.some((n,a)=>n!==e[a])}function L4(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const a=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const l=s(n);typeof l=="function"&&(a[r]=l);break}case"object":{s.current=n;break}}}t.cleanup=()=>{for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const l=a[r];typeof l=="function"?l():s(null);break}case"object":{s.current=null;break}}}}}}}function _P(t){if(!k.isValidElement(t))return null;const e=t,n=e.props;return(ob(19)?n?.ref:e.ref)??null}function Z_(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}function OH(t,e){const n={};for(const a in t){const r=t[a];if(e?.hasOwnProperty(a)){const s=e[a](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${a.toLowerCase()}`]="":r&&(n[`data-${a.toLowerCase()}`]=r.toString())}return n}function jH(t,e){return typeof t=="function"?t(e):t}function zH(t,e){return typeof t=="function"?t(e):t}const fb={};function mb(t,e,n,a,r){if(!n&&!a&&!r&&!t)return Qp(e);let s=Qp(t);return e&&(s=sd(s,e)),n&&(s=sd(s,n)),a&&(s=sd(s,a)),r&&(s=sd(s,r)),s}function FH(t){if(t.length===0)return fb;if(t.length===1)return Qp(t[0]);let e=Qp(t[0]);for(let n=1;n<t.length;n+=1)e=sd(e,t[n]);return e}function Qp(t){return gb(t)?{...I4(t,fb)}:UH(t)}function sd(t,e){return gb(e)?I4(e,t):BH(t,e)}function UH(t){const e={...t};for(const n in e){const a=e[n];D4(n,a)&&(e[n]=M4(a))}return e}function BH(t,e){if(!e)return t;for(const n in e){const a=e[n];switch(n){case"style":{t[n]=Z_(t.style,a);break}case"className":{t[n]=N4(t.className,a);break}default:D4(n,a)?t[n]=$H(t[n],a):t[n]=a}}return t}function D4(t,e){const n=t.charCodeAt(0),a=t.charCodeAt(1),r=t.charCodeAt(2);return n===111&&a===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function gb(t){return typeof t=="function"}function I4(t,e){return gb(t)?t(e):t??fb}function $H(t,e){return e?t?(...n)=>{const a=n[0];if(O4(a)){const s=a;Xp(s);const l=e(...n);return s.baseUIHandlerPrevented||t?.(...n),l}const r=e(...n);return t?.(...n),r}:M4(e):t}function M4(t){return t&&((...e)=>{const n=e[0];return O4(n)&&Xp(n),t(...e)})}function Xp(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function N4(t,e){return e?t?e+" "+t:e:t}function O4(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function ou(t,e,n={}){const a=e.render,r=VH(e,n);if(n.enabled===!1)return null;const s=n.state??eo;return GH(t,a,r,s)}function VH(t,e={}){const{className:n,style:a,render:r}=t,{state:s=eo,ref:l,props:c,stateAttributesMapping:u,enabled:h=!0}=e,p=h?jH(n,s):void 0,m=h?zH(a,s):void 0,v=h?OH(s,u):eo,y=h&&c?HH(c):void 0,b=h?Z_(v,y)??{}:eo;return typeof document<"u"&&(h?Array.isArray(l)?b.ref=IH([b.ref,_P(r),...l]):b.ref=vP(b.ref,_P(r),l):vP(null,null)),h?(p!==void 0&&(b.className=N4(b.className,p)),m!==void 0&&(b.style=Z_(b.style,m)),b):eo}function HH(t){return Array.isArray(t)?FH(t):mb(void 0,t)}const WH=Symbol.for("react.lazy");function GH(t,e,n,a){if(e){if(typeof e=="function")return e(n,a);const r=mb(n,e.props);r.ref=n.ref;let s=e;return s?.$$typeof===WH&&(s=k.Children.toArray(e)[0]),k.cloneElement(s,r)}if(t&&typeof t=="string")return qH(t,n);throw new Error(Xl(8))}function qH(t,e){return t==="button"?k.createElement("button",{type:"button",...e,key:e.key}):t==="img"?k.createElement("img",{alt:"",...e,key:e.key}):k.createElement(t,e)}let KH=(function(t){return t.frontmostHeight="--toast-frontmost-height",t})({});const YH=k.forwardRef(function(e,n){const{render:a,className:r,style:s,children:l,...c}=e,u=sb(),h=dH(),p=k.useRef(!1),m=k.useRef(!1),v=k.useRef(!1),y=u.useState("isEmpty"),b=u.useState("toasts"),x=u.useState("focused"),P=u.useState("expanded"),T=u.useState("prevFocusElement"),L=b[0]?.height??0,E=k.useMemo(()=>b.some($=>$.transitionStatus==="ending"),[b]),A=k.useMemo(()=>b.filter($=>$.priority==="high"),[b]);k.useEffect(()=>{const $=u.state.viewport;if(!$)return;function X(O){y||O.key==="F6"&&no(O)!==$&&(O.preventDefault(),u.setPrevFocusElement(xl(br($))),$?.focus({preventScroll:!0}),u.pauseTimers(),u.setFocused(!0))}const W=Ei($);return to(W,"keydown",X)},[u,y]),k.useEffect(()=>{const $=u.state.viewport;if(!$||y)return;const X=Ei($);function W(Y){no(Y)===X&&(u.setIsWindowFocused(!1),u.pauseTimers())}function O(Y){if(Y.relatedTarget)return;const ae=no(Y),_e=xl(br($));(ae===X||!Ai($,ae)||!K_(_e))&&u.resumeTimers(),h.start(0,()=>u.setIsWindowFocused(!0))}return f4(to(X,"blur",W,!0),to(X,"focus",O,!0))},[u,h,y]),k.useEffect(()=>{const $=u.state.viewport;if(!$||y)return;const X=br($);return to(X,"pointerdown",u.handleDocumentPointerDown,!0)},[y,u]);function D($){const X=u.state.viewport;if(X)if(p.current=!0,$.relatedTarget===X){const W=b.find(O=>O.transitionStatus!=="ending"&&!O.limited);W?W.ref?.current?.focus():u.restoreFocusToPrevElement()}else u.restoreFocusToPrevElement()}function B($){$.key==="Tab"&&$.shiftKey&&no($.nativeEvent)===u.state.viewport&&($.preventDefault(),u.restoreFocusToPrevElement(),u.resumeTimers())}function j(){u.state.toasts.some(X=>X.transitionStatus==="ending")||v.current||!m.current||(u.state.isWindowFocused&&u.resumeTimers(),u.setHovering(!1),m.current=!1)}k.useEffect(j,[E,u]);function S(){u.pauseTimers(),u.setHovering(!0),m.current=!1}function N(){u.state.isWindowFocused&&u.resumeTimers()}function U(){u.state.toasts.some(X=>X.transitionStatus==="ending")||v.current?m.current=!0:(N(),u.setHovering(!1))}function Q($){$.pointerType==="touch"&&(v.current=!0)}function ee($){$.pointerType==="touch"&&(v.current=!1,j())}function ce(){if(p.current){p.current=!1;return}x||K_(xl(br(u.state.viewport)))&&(u.setFocused(!0),u.pauseTimers())}function le($){!x||Ai(u.state.viewport,$.relatedTarget)||(u.setFocused(!1),N())}const re={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:S,onMouseMove:S,onMouseLeave:U,onFocus:ce,onBlur:le,onKeyDown:B,onClick:ce,onPointerDown:Q,onPointerUp:ee,onPointerCancel:ee},te={expanded:P},ie=ou("div",e,{ref:[n,u.setViewport],state:te,props:[re,{style:{[KH.frontmostHeight]:L?`${L}px`:void 0}},c,{children:R.jsxs(k.Fragment,{children:[!y&&T&&R.jsx(wd,{onFocus:D}),l,!y&&T&&R.jsx(wd,{onFocus:D})]})}]});return R.jsxs(k.Fragment,{children:[!y&&T&&R.jsx(wd,{onFocus:D}),ie,!x&&A.length>0&&R.jsx("div",{style:A4,children:A.map($=>R.jsxs("div",{role:"alert","aria-atomic":!0,children:[R.jsx("div",{children:$.title}),R.jsx("div",{children:$.description})]},$.id))})]})});function ZH(t){return ob(19)?t:t?"true":void 0}const j4=k.createContext(void 0);function z4(){const t=k.useContext(j4);if(!t)throw new Error(Xl(66));return t}let vb=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const JH={[vb.startingStyle]:""},QH={[vb.endingStyle]:""},XH={transitionStatus(t){return t==="starting"?JH:t==="ending"?QH:null}};function eW(t){return t==null?t:"current"in t?t.current:t}function tW(t,e=!1,n=!0){const a=cH();return go((r,s=null)=>{a.cancel();const l=eW(t);if(l==null)return;const c=l,u=()=>{Vl.flushSync(r)};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function h(){Promise.all(c.getAnimations().map(p=>p.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(n){s?.aborted||u();return}const p=c.getAnimations();!s?.aborted&&p.length>0&&p.some(m=>m.pending||m.playState!=="finished")&&h()})}if(e){const p=vb.startingStyle;if(!c.hasAttribute(p)){a.request(h);return}const m=new MutationObserver(()=>{c.hasAttribute(p)||(m.disconnect(),h())});m.observe(c,{attributes:!0,attributeFilter:[p]}),s?.addEventListener("abort",()=>m.disconnect(),{once:!0});return}a.request(h)})}function nW(t){const{enabled:e=!0,open:n,ref:a,onComplete:r}=t,s=go(r),l=tW(a,n,!1);k.useEffect(()=>{if(!e)return;const c=new AbortController;return l(s,c.signal),()=>{c.abort()}},[e,n,s,l])}let zs=(function(t){return t.index="--toast-index",t.offsetY="--toast-offset-y",t.height="--toast-height",t.swipeMovementX="--toast-swipe-movement-x",t.swipeMovementY="--toast-swipe-movement-y",t})({});const IZ=500,MZ={style:{transition:"none"}},NZ="data-base-ui-click-trigger",aW="data-base-ui-swipe-ignore",rW="data-swipe-ignore",iW=`[${aW}]`,sW=`[${rW}]`,OZ={fallbackAxisSide:"none"},jZ={fallbackAxisSide:"end"},oW={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function yP(t,e,n){switch(t){case"up":return-n;case"down":return n;case"left":return-e;case"right":return e;default:return 0}}function lW(t){const n=Ei(t).getComputedStyle(t).transform;let a=0,r=0,s=1;if(n&&n!=="none"){const l=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const c=l[1].split(", ").map(parseFloat);c.length===6?(a=c[4],r=c[5],s=Math.sqrt(c[0]*c[0]+c[1]*c[1])):c.length===16&&(a=c[12],r=c[13],s=c[0])}}return{x:a,y:r,scale:s}}const cW={...XH,swipeDirection(t){return t?{"data-swipe-direction":t}:null}},Hc=40,dW=10,ns=.5,uW=1,hW=`${iW},${sW}`,pW=k.forwardRef(function(e,n){const{toast:a,render:r,className:s,swipeDirection:l=["down","right"],style:c,...u}=e,h=a.positionerProps?.anchor!==void 0;let p=[];h||(p=Array.isArray(l)?l:[l]);const m=p.length>0,v=sb(),[y,b]=k.useState(void 0),[x,P]=k.useState(!1),[T,L]=k.useState(!1),[E,A]=k.useState(!1),[D,B]=k.useState({x:0,y:0}),[j,S]=k.useState({x:0,y:0,scale:1}),[N,U]=k.useState(),[Q,ee]=k.useState(),[ce,le]=k.useState(null),re=k.useRef(null),te=k.useRef({x:0,y:0}),ie=k.useRef({x:0,y:0,scale:1}),$=k.useRef(void 0),X=k.useRef(0),W=k.useRef(!1),O=k.useRef({x:0,y:0}),Y=k.useRef(!1),ae=k.useRef({x:0,y:0}),_e=k.useRef(null),fe=k.useRef(null),ve=v.useState("toastIndex",a.id),Ne=v.useState("toastVisibleIndex",a.id),Oe=v.useState("toastOffsetY",a.id),Ie=v.useState("focused"),St=v.useState("expanded");nW({open:a.transitionStatus!=="ending",ref:re,onComplete(){a.transitionStatus==="ending"&&v.removeToast(a.id)}});const un=go((tt=!1)=>{const et=re.current;if(!et)return;const kt=et.style.height;et.style.height="auto";const an=et.offsetHeight;et.style.height=kt;function zt(){v.updateToastInternal(a.id,{ref:re,height:an,...a.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}tt?Vl.flushSync(zt):zt()});Ka(un,[un]);function jt(tt){ae.current=tt,B(tt)}Ka(()=>()=>{fe.current?.abort()},[]);function _t(tt,et){let kt=tt,an=et;return!p.includes("left")&&!p.includes("right")?kt=tt>0?tt**ns:-(Math.abs(tt)**ns):(!p.includes("right")&&tt>0&&(kt=tt**ns),!p.includes("left")&&tt<0&&(kt=-(Math.abs(tt)**ns))),!p.includes("up")&&!p.includes("down")?an=et>0?et**ns:-(Math.abs(et)**ns):(!p.includes("down")&&et>0&&(an=et**ns),!p.includes("up")&&et<0&&(an=-(Math.abs(et)**ns))),{x:kt,y:an}}const Jt=go(tt=>{if(tt.pointerId!==_e.current)return;_e.current=null,fe.current?.abort(),fe.current=null,P(!1),L(!1),le(null);const et=ie.current;if(tt.type==="pointercancel"||W.current){jt({x:et.x,y:et.y}),b(void 0);return}let kt=!1;const an=ae.current,zt=an.x-et.x,At=an.y-et.y;let xt;for(const ar of p){switch(ar){case"right":zt>Hc&&(kt=!0,xt="right");break;case"left":zt<-Hc&&(kt=!0,xt="left");break;case"down":At>Hc&&(kt=!0,xt="down");break;case"up":At<-Hc&&(kt=!0,xt="up");break}if(kt)break}kt?(b(xt),A(!0),v.closeToast(a.id)):(jt({x:et.x,y:et.y}),b(void 0))});function nr(tt){if(tt.button!==0)return;tt.pointerType==="touch"&&v.pauseTimers();const et=no(tt.nativeEvent);if(et?et.closest(`button,a,input,textarea,[role="button"],${hW}`):!1)return;if(W.current=!1,$.current=void 0,X.current=0,_e.current=tt.pointerId,te.current={x:tt.clientX,y:tt.clientY},O.current=te.current,re.current){const zt=lW(re.current);ie.current=zt,S(zt),jt({x:zt.x,y:zt.y})}v.setHovering(!0),P(!0),L(!1),le(null),Y.current=!0;const an=re.current;if(an){fe.current?.abort();const zt=new AbortController;fe.current=zt;const At=br(an);At.addEventListener("pointerup",Jt,{signal:zt.signal}),At.addEventListener("pointercancel",Jt,{signal:zt.signal}),an.setPointerCapture?.(tt.pointerId)}}function Mn(tt){if(tt.pointerId!==_e.current)return;tt.preventDefault(),Y.current&&(te.current={x:tt.clientX,y:tt.clientY},Y.current=!1);const{clientY:et,clientX:kt,movementX:an,movementY:zt}=tt;(zt<0&&et>O.current.y||zt>0&&et<O.current.y)&&(O.current={x:O.current.x,y:et}),(an<0&&kt>O.current.x||an>0&&kt<O.current.x)&&(O.current={x:kt,y:O.current.y});const At=kt-te.current.x,xt=et-te.current.y,ar=et-O.current.y,ec=kt-O.current.x;if(!T&&Math.sqrt(At*At+xt*xt)>=uW&&(L(!0),ce===null)){const rr=p.includes("left")||p.includes("right"),bs=p.includes("up")||p.includes("down");if(rr&&bs){const Ri=Math.abs(At),wa=Math.abs(xt);le(Ri>wa?"horizontal":"vertical")}}let En;if(!$.current)ce==="vertical"?xt>0?En="down":xt<0&&(En="up"):ce==="horizontal"?At>0?En="right":At<0&&(En="left"):Math.abs(At)>=Math.abs(xt)?En=At>0?"right":"left":En=xt>0?"down":"up",En&&p.includes(En)&&($.current=En,X.current=yP(En,At,xt),b(En));else{const Sr=$.current,rr=yP(Sr,ec,ar);rr>Hc?(W.current=!1,b(Sr)):!(p.includes("left")&&p.includes("right"))&&!(p.includes("up")&&p.includes("down"))&&X.current-rr>=dW&&(W.current=!0)}const ti=_t(At,xt);let Xn=ie.current.x,Pr=ie.current.y;ce==="horizontal"?(p.includes("left")||p.includes("right"))&&(Xn+=ti.x):(ce==="vertical"||(p.includes("left")||p.includes("right"))&&(Xn+=ti.x),(p.includes("up")||p.includes("down"))&&(Pr+=ti.y)),jt({x:Xn,y:Pr})}function Vt(tt){if(tt.key==="Escape"){if(!re.current||!Ai(re.current,xl(br(re.current))))return;v.closeToast(a.id)}}k.useEffect(()=>{if(!m)return;const tt=re.current;if(!tt)return;function et(kt){_e.current===null||!Ai(tt,no(kt))||kt.preventDefault()}return to(tt,"touchmove",et,{passive:!1})},[m]);function Xe(){if(!x&&D.x===j.x&&D.y===j.y&&!E)return{[zs.swipeMovementX]:"0px",[zs.swipeMovementY]:"0px"};const tt=D.x-j.x,et=D.y-j.y;return{transition:x?"none":void 0,transform:x?`translateX(${D.x}px) translateY(${D.y}px) scale(${j.scale})`:void 0,[zs.swipeMovementX]:`${tt}px`,[zs.swipeMovementY]:`${et}px`}}const ot=a.priority==="high",Dt={role:ot?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":N,"aria-describedby":Q,"aria-hidden":ot&&!Ie?!0:void 0,onPointerDown:m?nr:void 0,onPointerMove:m?Mn:void 0,onPointerUp:m?Jt:void 0,onPointerCancel:m?Jt:void 0,onKeyDown:Vt,inert:ZH(a.limited),style:{...Xe(),[zs.index]:a.transitionStatus==="ending"?ve:Ne,[zs.offsetY]:`${Oe}px`,[zs.height]:a.height?`${a.height}px`:void 0}},Et=k.useMemo(()=>({rootRef:re,toast:a,titleId:N,setTitleId:U,descriptionId:Q,setDescriptionId:ee,swiping:x,swipeDirection:y,recalculateHeight:un,index:ve,visibleIndex:Ne,expanded:St}),[a,N,Q,x,y,un,ve,Ne,St]),Nn={transitionStatus:a.transitionStatus,expanded:St,limited:a.limited||!1,type:a.type,swiping:Et.swiping,swipeDirection:Et.swipeDirection},xr=ou("div",e,{ref:[n,Et.rootRef],state:Nn,stateAttributesMapping:cW,props:[Dt,u]});return R.jsx(j4.Provider,{value:Et,children:xr})});let bP=0;function fW(t,e="mui"){const[n,a]=k.useState(t),r=t||n;return k.useEffect(()=>{n==null&&(bP+=1,a(`${e}-${bP}`))},[n,e]),r}const kP=lb.useId;function F4(t,e){if(kP!==void 0){const n=kP();return t??(e?`${e}-${n}`:n)}return fW(t,e)}const mW=k.forwardRef(function(e,n){const{render:a,className:r,style:s,id:l,children:c,...u}=e,{toast:h,setTitleId:p}=z4(),m=c??h.title,v=!!m,y=F4(l);Ka(()=>{if(v)return p(y),()=>{p(void 0)}},[v,y,p]);const b={type:h.type},x=ou("h2",e,{ref:n,state:b,props:{...u,id:y,children:m}});return v?x:null}),gW=k.createContext(void 0);function vW(t=!1){const e=k.useContext(gW);if(e===void 0&&!t)throw new Error(Xl(16));return e}function _W(t){const{focusableWhenDisabled:e,disabled:n,composite:a=!1,tabIndex:r=0,isNativeButton:s}=t,l=a&&e!==!1,c=a&&e===!1;return{props:k.useMemo(()=>{const h={onKeyDown(p){n&&e&&p.key!=="Tab"&&p.preventDefault()}};return a||(h.tabIndex=r,!s&&n&&(h.tabIndex=e?r:-1)),(s&&(e||l)||!s&&n)&&(h["aria-disabled"]=n),s&&(!e||c)&&(h.disabled=n),h},[a,n,e,l,c,s,r])}}function yW(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:a=0,native:r=!0,composite:s}=t,l=k.useRef(null),c=vW(!0),u=s??c!==void 0,{props:h}=_W({focusableWhenDisabled:n,disabled:e,composite:u,tabIndex:a,isNativeButton:r}),p=k.useCallback(()=>{const y=l.current;kv(y)&&u&&e&&h.disabled===void 0&&y.disabled&&(y.disabled=!1)},[e,h.disabled,u]);Ka(p,[p]);const m=k.useCallback((y={})=>{const{onClick:b,onMouseDown:x,onKeyUp:P,onKeyDown:T,onPointerDown:L,...E}=y;return mb({onClick(A){if(e){A.preventDefault();return}b?.(A)},onMouseDown(A){e||x?.(A)},onKeyDown(A){if(e||(Xp(A),T?.(A),A.baseUIHandlerPrevented))return;const D=A.target===A.currentTarget,B=A.currentTarget,j=kv(B),S=!r&&bW(B),N=D&&(r?j:!S),U=A.key==="Enter",Q=A.key===" ",ee=B.getAttribute("role"),ce=ee?.startsWith("menuitem")||ee==="option"||ee==="gridcell";if(D&&u&&Q){if(A.defaultPrevented&&ce)return;A.preventDefault(),S||r&&j?(B.click(),A.preventBaseUIHandler()):N&&(b?.(A),A.preventBaseUIHandler());return}N&&(!r&&(Q||U)&&A.preventDefault(),!r&&U&&b?.(A))},onKeyUp(A){if(!e){if(Xp(A),P?.(A),A.target===A.currentTarget&&r&&u&&kv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!r&&!u&&A.key===" "&&b?.(A)}},onPointerDown(A){if(e){A.preventDefault();return}L?.(A)}},r?{type:"button"}:{role:"button"},h,E)},[e,h,u,r]),v=go(y=>{l.current=y,p()});return{getButtonProps:m,buttonRef:v}}function kv(t){return fs(t)&&t.tagName==="BUTTON"}function bW(t){return!!(t?.tagName==="A"&&t?.href)}const kW=k.forwardRef(function(e,n){const{render:a,className:r,style:s,disabled:l,nativeButton:c=!0,...u}=e,h=sb(),{toast:p}=z4(),m=h.useState("expanded"),[v,y]=k.useState(!1),{getButtonProps:b,buttonRef:x}=yW({disabled:l,native:c}),P={type:p.type};return ou("button",e,{ref:[n,x],state:P,props:[{"aria-hidden":!m&&!v,onClick(){h.closeToast(p.id)},onFocus(){y(!0)},onBlur(){y(!1)}},u,b]})}),zZ="none",FZ="trigger-press",UZ="trigger-hover",BZ="outside-press",$Z="item-press",VZ="close-press",wW="focus-out",HZ="escape-key",WZ="list-navigation",GZ="cancel-open",qZ="imperative-action",KZ="window-resize";function xW(t,e,n,a){let r=!1,s=!1;const l=eo;return{reason:t,event:e??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...l}}function PW(t){return`data-base-ui-${t}`}const U4=k.createContext(null),SW=()=>k.useContext(U4),CW=PW("portal");function B4(t={}){const{ref:e,container:n,componentProps:a=eo,elementProps:r}=t,s=F4(),c=SW()?.portalNode,[u,h]=k.useState(null),[p,m]=k.useState(null),v=go(P=>{P!==null&&m(P)}),y=k.useRef(null);Ka(()=>{if(n===null){y.current&&(y.current=null,m(null),h(null));return}if(s==null)return;const P=(n&&(cb(n)?n:n.current))??c??document.body;if(P==null){y.current&&(y.current=null,m(null),h(null));return}y.current!==P&&(y.current=P,m(null),h(P))},[n,c,s]);const b=ou("div",a,{ref:[e,v],props:[{id:s,[CW]:""},r]});return{portalNode:p,portalSubtree:u&&b?Vl.createPortal(b,u):null}}const YZ=k.forwardRef(function(e,n){const{render:a,className:r,style:s,children:l,container:c,renderGuards:u,...h}=e,{portalNode:p,portalSubtree:m}=B4({container:c,ref:n,componentProps:e,elementProps:h}),v=k.useRef(null),y=k.useRef(null),b=k.useRef(null),x=k.useRef(null),[P,T]=k.useState(null),L=k.useRef(!1),E=P?.modal,A=P?.open,D=typeof u=="boolean"?u:!!P&&!P.modal&&P.open&&!!p;k.useEffect(()=>{if(!p||E)return;function j(S){p&&S.relatedTarget&&yv(S)&&(S.type==="focusin"?L.current&&(gP(p),L.current=!1):(RH(p),L.current=!0))}return f4(to(p,"focusin",j,!0),to(p,"focusout",j,!0))},[p,E]),Ka(()=>{!p||A!==!0||!L.current||(gP(p),L.current=!1)},[A,p]);const B=k.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:y,beforeInsideRef:b,afterInsideRef:x,portalNode:p,setFocusManagerState:T}),[p]);return R.jsxs(k.Fragment,{children:[m,R.jsxs(U4.Provider,{value:B,children:[D&&p&&R.jsx(wd,{"data-type":"outside",ref:v,onFocus:j=>{if(yv(j,p))b.current?.focus();else{const S=P?P.domReference:null;AH(S)?.focus()}}}),D&&p&&R.jsx("span",{"aria-owns":p.id,style:oW}),p&&Vl.createPortal(l,p),D&&p&&R.jsx(wd,{"data-type":"outside",ref:y,onFocus:j=>{if(yv(j,p))x.current?.focus();else{const S=P?P.domReference:null;EH(S)?.focus(),P?.closeOnFocusOut&&P?.onOpenChange(!1,xW(wW,j.nativeEvent))}}})]})]})}),TW=k.forwardRef(function(e,n){const{children:a,container:r,className:s,render:l,style:c,...u}=e,{portalNode:h,portalSubtree:p}=B4({container:r,ref:n,componentProps:e,elementProps:u});return!p&&!h?null:R.jsxs(k.Fragment,{children:[p,h&&Vl.createPortal(a,h)]})}),EW=TW;function AW(){const t=k.useContext(ib);if(!t)throw new Error(Xl(73));const e=t.useState("toasts");return k.useMemo(()=>({toasts:e,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[e,t])}function RW(){const t=new Set;function e(n){t.forEach(a=>a(n))}return{" subscribe":function(a){return t.add(a),()=>{t.delete(a)}},add(n){const a=n.id||m4("toast"),r={...n,id:a,transitionStatus:"starting"};return e({action:"add",options:r}),a},close(n){e({action:"close",options:{id:n}})},update(n,a){e({action:"update",options:{...a,id:n}})},promise(n,a){let r=n;return e({action:"promise",options:{...a,promise:n,setPromise(s){r=s}}}),r}}}const _b=RW();function ZZ(t){return _b.add(t)}function LW({children:t}){return R.jsxs(DH,{toastManager:_b,children:[t,R.jsx(EW,{children:R.jsx(YH,{className:"fixed inset-x-0 top-6 z-[100] mx-auto flex w-full max-w-sm flex-col items-center gap-2 px-4 outline-none",children:R.jsx(DW,{})})})]})}function DW(){const{toasts:t}=AW();return t.map(e=>{const n=e.data?.onUndo;return R.jsxs(pW,{toast:e,className:$t("pointer-events-auto flex w-full items-center gap-3 rounded-xl border border-oai-gray-200 bg-oai-white px-4 py-3 shadow-xl transition-all duration-200 ease-out","data-[starting-style]:-translate-y-3 data-[starting-style]:opacity-0","data-[ending-style]:-translate-y-3 data-[ending-style]:opacity-0","dark:border-oai-gray-800 dark:bg-oai-gray-900"),children:[R.jsx(mW,{className:"min-w-0 flex-1 text-sm font-medium text-oai-black dark:text-white"}),n?R.jsx("button",{type:"button",onClick:()=>{n(),_b.close(e.id)},className:"shrink-0 rounded-md px-2 py-1 text-xs font-semibold text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:we("shared.action.undo")}):null,R.jsx(kW,{"aria-label":we("shared.action.dismiss"),className:"-mr-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:R.jsx(x0,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},e.id)})}const yb=Object.freeze(["limits","leaderboard"]),IW=Object.freeze({limits:"/limits",leaderboard:"/leaderboard"}),MW=Object.freeze({limits:()=>In(()=>import("./LimitsPage-BpwioIa-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),leaderboard:()=>In(()=>import("./LeaderboardPage-B12HJ9LA.js"),__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18,19,20]))}),$4="total",V4=0,wP=20,NW=Object.freeze([10,20,50,100]),OW="tokentracker:leaderboard:pageSize",jW=20,zW=Object.freeze(["dashboard-existing","silent-preload","page-load","manual-refresh"]);let xP=0,Ja;class FW{constructor(e={}){this.limits=null,this.leaderboard=new Map,this.leaderboardMaxEntries=$W(e.leaderboardMaxEntries)}read(e,n){return lu(e),e==="limits"?!this.limits||this.limits.contextKey!==n?null:up(this.limits):n?up(this.leaderboard.get(n)):null}write(e,n={}){if(e.targetKey==="limits"){this.limits=e;return}this.leaderboard.has(e.contextKey)&&this.leaderboard.delete(e.contextKey),this.leaderboard.set(e.contextKey,e),this.evictLeaderboardEntries(n.activeContextKey||e.contextKey)}evictLeaderboardEntries(e=null){for(;this.leaderboard.size>this.leaderboardMaxEntries;){const n=Array.from(this.leaderboard.keys()).find(a=>a!==e)||this.leaderboard.keys().next().value;this.leaderboard.delete(n)}}snapshot(){return{limits:up(this.limits),leaderboard:{maxEntries:this.leaderboardMaxEntries,size:this.leaderboard.size,keys:Array.from(this.leaderboard.keys())}}}}class UW{constructor(e={}){xP+=1,this.sessionId=`dashboard-preload-${xP}`,this.createdAt=Date.now(),this.completedAt=null,this.startedAfterMainContentVisible=!1,this.cache=new FW(e),this.targets={limits:PP("limits"),leaderboard:PP("leaderboard")}}}function PP(t){return{key:t,route:IW[t],resourceStatus:"idle",stateStatus:"idle",error:null,resourcePromise:null,resourceModule:null,resourceRequestId:0,statePromise:null,stateRequestId:0,pendingStateContextKey:null}}function BW(t={}){return new UW(t)}function $W(t){const e=Number(t);return!Number.isInteger(e)||e<1?jW:e}Ja=BW();function lu(t){if(!yb.includes(t))throw new Error(`Unknown dashboard preload target: ${t}`)}function H4(t){return t?typeof t=="string"?t:t.message||String(t):null}function VW(t,e){return zW.includes(t)?t:e}function HW(t){const e=Number(t);return Number.isFinite(e)?e:Date.now()}function up(t){return t?{...t}:null}function SP(){const t=yb.every(e=>{const n=Ja.targets[e];return n.resourceStatus==="fulfilled"||n.resourceStatus==="rejected"});Ja.completedAt=t?Date.now():null}function WW(){Ja.startedAfterMainContentVisible=!0}function bb(t,e={}){lu(t);const n=Object.entries(e).filter(([,a])=>a!==void 0).sort(([a],[r])=>a.localeCompare(r)).map(([a,r])=>`${a}=${r===null?"null":String(r)}`);return`${t}:${n.join("|")}`}function GW(t,e={}){lu(t);const n=Ja.targets[t];if(n.resourceStatus==="fulfilled")return Promise.resolve(n.resourceModule);if(n.resourceStatus==="pending"&&n.resourcePromise)return n.resourcePromise;const a=e.loader||MW[t],r=n.resourceRequestId+1;n.resourceRequestId=r,n.resourceStatus="pending",n.error=null;const s=Promise.resolve().then(()=>a()).then(l=>n.resourceRequestId!==r||n.resourcePromise!==s?null:(n.resourceStatus="fulfilled",n.resourceModule=l,n.error=null,SP(),l)).catch(l=>(n.resourceRequestId!==r||n.resourcePromise!==s||(n.resourceStatus="rejected",n.error=H4(l),SP()),null));return n.resourcePromise=s,s}function qW(t={}){const e=t.loaders||{};return Promise.all(yb.map(n=>GW(n,{loader:e[n]})))}function W4(t,e){lu(t);const n=Ja.targets[t],a=e?.status||"fulfilled",r={targetKey:t,status:a,data:e?.data??null,error:H4(e?.error),source:VW(e?.source,"silent-preload"),generatedAt:HW(e?.generatedAt),updatedAt:Date.now(),contextKey:e?.contextKey||bb(t,e?.context||{})};return n.stateStatus=a,a==="rejected"||a==="skipped"?n.error=r.error:a==="fulfilled"&&(n.error=null,Ja.cache.write(r,{activeContextKey:e?.activeContextKey})),up(r)}function G4(t,e){return lu(t),Ja.cache.read(t,e)}function JZ(t,e={}){return W4("limits",{data:t,source:e.source||"dashboard-existing",contextKey:e.contextKey||q4(e.context||{}),generatedAt:e.generatedAt,status:e.status||"fulfilled",error:e.error})}function q4(t={}){return bb("limits",{state:"current",...t})}function QZ(t=q4()){return G4("limits",t)}function J_(t,e={}){return W4("leaderboard",{activeContextKey:e.activeContextKey,data:t,source:e.source||"silent-preload",contextKey:e.contextKey||kb(e.context||{}),generatedAt:e.generatedAt,status:e.status||"fulfilled",error:e.error})}function KW(t){return G4("leaderboard",t)}function K4(){if(typeof window>"u")return wP;try{const t=window.localStorage.getItem(OW),e=Number(t);if(NW.includes(e))return e}catch{}return wP}function Y4(t={}){const e=t.userId;return e!==void 0?e||null:t.cloudUser?.id||null}function Z4(t={}){return typeof t.accessMode=="string"&&t.accessMode.trim()?t.accessMode.trim():t.mockEnabled?"mock":t.baseUrl?"cloud":"unavailable"}function kb(t={}){const e=!!t.mockEnabled,n=t.baseUrl??"";return bb("leaderboard",{accessMode:Z4({...t,baseUrl:n,mockEnabled:e}),baseUrl:n,mockEnabled:e,offset:t.offset??V4,pageSize:t.pageSize??K4(),period:t.period||$4,userId:Y4(t)})}function Ih(t,e){const n=Ja.targets.leaderboard;return n.stateRequestId+=1,n.statePromise=null,n.pendingStateContextKey=null,J_(null,{contextKey:e,status:"skipped",error:t})}function YW(t={}){const e=Ja,n=!!t.mockEnabled,a=t.baseUrl??"",r=Z4({...t,baseUrl:a,mockEnabled:n}),s=t.period||$4,l=t.pageSize??K4(),c=t.offset??V4,u=Y4(t),h=kb({accessMode:r,baseUrl:a,mockEnabled:n,offset:c,pageSize:l,period:s,userId:u});if(!n&&t.authLoading)return Promise.resolve(Ih("auth-loading",h));if(!n&&!t.signedIn&&r!=="public")return Promise.resolve(Ih("not-signed-in",h));if(!n&&!a)return Promise.resolve(Ih("missing-base-url",h));if(!n&&r==="unavailable")return Promise.resolve(Ih("access-unavailable",h));const p=e.targets.leaderboard,m=KW(h);if(m)return Promise.resolve(m);if(p.stateStatus==="pending"&&p.statePromise&&p.pendingStateContextKey===h)return p.statePromise;const v=p.stateRequestId+1;p.stateRequestId=v,p.stateStatus="pending",p.pendingStateContextKey=h,p.error=null;const y=Promise.resolve().then(()=>v9({userId:u,period:s,limit:l,offset:c})).then(b=>Ja!==e||p.stateRequestId!==v||p.statePromise!==y?null:(p.pendingStateContextKey=null,J_(b,{contextKey:h}))).catch(b=>(Ja!==e||p.stateRequestId!==v||p.statePromise!==y||(p.pendingStateContextKey=null,J_(null,{contextKey:h,status:"rejected",error:b})),null));return p.statePromise=y,y}const ZW=typeof window<"u"?window.location.search:"",CP=new URLSearchParams(ZW),Mh=CP.get("insforge_code")||CP.get("code")||null,JW=typeof window<"u"&&!!window.webkit?.messageHandlers?.nativeOAuth;function QW(){Kl();const{loading:t,signedIn:e}=ko(),n=$l(),[a,r]=k.useState("processing"),[s,l]=k.useState(null),c=k.useRef(!1);k.useEffect(()=>{if(!(!Mh||c.current)){if(c.current=!0,JW){l(!1);return}(async()=>{try{const p=await(await fetch("/api/auth-bridge/verifier")).json();l(!!p?.native)}catch{l(!1)}})()}},[]),k.useEffect(()=>{if(s!==!0||!Mh)return;r("redirecting");const h=setTimeout(()=>{window.location.href=`tokentracker://auth/callback?insforge_code=${encodeURIComponent(Mh)}`},200);return()=>clearTimeout(h)},[s]),k.useEffect(()=>{if(s!==!1||t)return;if(e){n("/dashboard",{replace:!0});return}const h=setTimeout(()=>{e||r("failed")},12e3);return()=>clearTimeout(h)},[s,t,e,n]),k.useEffect(()=>{if(!Mh&&s===null){const h=setTimeout(()=>r("failed"),3e3);return()=>clearTimeout(h)}},[s]);const u=()=>{n("/dashboard",{replace:!0})};return a==="processing"&&s!==!0&&(s===null||s===!1&&t)?R.jsx("div",{className:"min-h-screen bg-oai-gray-950"}):R.jsx("div",{className:"min-h-screen bg-oai-gray-950 text-white font-oai antialiased dark flex items-center justify-center",children:R.jsxs("div",{className:"text-center space-y-4 max-w-sm px-4",children:[a==="processing"&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"w-8 h-8 border-2 border-oai-gray-600 border-t-white rounded-full animate-spin mx-auto"}),R.jsx("p",{className:"text-oai-gray-400 text-sm",children:we("auth.callback.processing")})]}),a==="redirecting"&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-green-500/15 flex items-center justify-center",children:R.jsx("svg",{className:"w-6 h-6 text-green-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:R.jsx("path",{d:"M20 6 9 17l-5-5"})})}),R.jsx("p",{className:"text-white text-sm font-medium",children:we("auth.callback.success")}),R.jsx("p",{className:"text-oai-gray-500 text-xs",children:we("auth.callback.redirecting")})]}),a==="failed"&&R.jsxs("div",{className:"space-y-3",children:[R.jsx("p",{className:"text-oai-gray-300 text-sm",children:we("auth.callback.failed")}),R.jsx("button",{type:"button",onClick:u,className:"px-4 py-2 rounded-lg bg-oai-gray-800 text-sm text-white hover:bg-oai-gray-700 transition-colors",children:we("auth.callback.close")})]})]})})}const XW=k.lazy(()=>In(()=>import("./DashboardPage-CAlgaBa7.js"),__vite__mapDeps([21,13,1,14,15,22,23,24,11,25,3,9,10,12,26,27,28,4,29,30,31])).then(t=>({default:t.DashboardPage}))),eG=k.lazy(()=>In(()=>import("./IpCheckPage-D8CViF98.js"),[])),tG=k.lazy(()=>In(()=>import("./AchievementsPage-9kHEQicS.js"),__vite__mapDeps([32,33,17,18,19,34]))),nG=k.lazy(()=>In(()=>import("./LandingPage-CqN5KEjV.js"),__vite__mapDeps([35,36,20,12,37,7,31,34])).then(t=>({default:t.LandingPage}))),aG=k.lazy(()=>In(()=>import("./LeaderboardPage-B12HJ9LA.js"),__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18,19,20])).then(t=>({default:t.LeaderboardPage}))),rG=k.lazy(()=>In(()=>import("./LeaderboardProfilePage-Z0ZYpNFd.js"),__vite__mapDeps([38,14,36,39,22,15,23,16,17,18,19,33,34,6,40,12,24,11,7])).then(t=>({default:t.LeaderboardProfilePage}))),iG=k.lazy(()=>In(()=>import("./LimitsPage-BpwioIa-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(t=>({default:t.LimitsPage}))),sG=k.lazy(()=>In(()=>import("./LoginPage-CRqbhwCx.js"),[]).then(t=>({default:t.LoginPage}))),oG=k.lazy(()=>In(()=>import("./ResetPasswordPage-C8IEJbVc.js"),[]).then(t=>({default:t.ResetPasswordPage}))),lG=k.lazy(()=>In(()=>import("./DevicePage-DinOyaeN.js"),[])),cG=k.lazy(()=>In(()=>import("./WrappedPage-DcMiKvzf.js"),[])),dG=k.lazy(()=>In(()=>import("./SettingsPage-DipzOQVg.js"),__vite__mapDeps([41,2,42,3,30,12,37,14,15,9,10,11,23,43,44,24,45,7])).then(t=>({default:t.SettingsPage}))),uG=k.lazy(()=>In(()=>import("./SkillsPage-CziypUTf.js"),__vite__mapDeps([46,5,6,7,3,44,24,11,45,23,14,28,12,47,10,19,26])).then(t=>({default:t.SkillsPage}))),hG=k.lazy(()=>In(()=>import("./WidgetsPage-CJegJhVR.js"),__vite__mapDeps([48,9,10,11,12,43,42,3,4,6,7])).then(t=>({default:t.WidgetsPage}))),pG=k.lazy(()=>In(()=>import("./PetPage-BY_yObVj.js"),__vite__mapDeps([49,42,3,29,4,40,28,18,47])).then(t=>({default:t.PetPage})));function fG(){const{resolvedLocale:t}=Kl(),e=ya(),n=ko();$$();const a=k.useRef(!1),r=k.useRef(!1),s=k.useRef(new Set),l=bn(),c=k.useMemo(()=>typeof window>"u"?!1:I$(window.location.search),[]),u=e?.pathname||"/",h=new URL(window.location.href),p=h.pathname.replace(/\/+$/,"")||"/",v=p.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,y=h.searchParams.get("token")||null,b=v||y,x=p==="/share"||p==="/share.html"||p.startsWith("/share/"),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),T=u.replace(/\/+$/,"")||"/",L=T==="/"||T==="/dashboard",E=T==="/leaderboard",A=T.match(/^\/u\/([^/]+)$/i),D=A?A[1]:null,B=!!(n.enabled&&n.signedIn),j=P||B,S=!1,N=L$(),U=!j&&!l&&!P,Q=l?"mock":n.loading?"unavailable":B?"cloud":j?"local":"unavailable",ee=k.useCallback(()=>{if(!a.current||!l&&n.loading||!l&&!j)return;const Ne={accessMode:Q,baseUrl:D$(),mockEnabled:l,signedIn:j,authLoading:!!n.loading,userId:B&&n.user?.id||null},Oe=kb(Ne);s.current.has(Oe)||(s.current.add(Oe),YW(Ne))},[B,n.loading,n.user?.id,Q,l,j]),ce=k.useCallback(()=>{L&&(a.current||(a.current=!0,WW()),r.current||(r.current=!0,qW()),ee())},[L,ee]);k.useEffect(()=>{ee()},[ee]);const le=k.useMemo(()=>!n.enabled||!B?null:{getAccessToken:()=>n.getAccessToken(),name:n.displayName||"",userId:n.user?.id||null},[B,n]);let re=P||l||c?"dashboard":"landing";T==="/landing"&&(re="landing"),T==="/dashboard"&&(re="dashboard"),E&&(re="dashboard"),D&&(re="dashboard");const te=T==="/limits",ie=T==="/settings",$=T==="/skills",X=T==="/widgets",W=T==="/pet-settings",O=T==="/ip-check",Y=T==="/achievements";(te||ie||$||X||W||O||Y)&&(re="dashboard");let ae=XW;D?ae=rG:T==="/leaderboard"?ae=aG:te?ae=iG:ie?ae=dG:$?ae=uG:X?ae=hG:W?ae=pG:O?ae=eG:Y&&(ae=tG);const _e=!x&&!U&&(T==="/dashboard"||T==="/"||E||te||ie||$||X||W||O||Y);if(!P&&!B&&!x&&!n.loading&&re==="dashboard"&&!E&&!D&&T!=="/login"&&T!=="/reset-password"&&T!=="/landing"&&T!=="/auth/callback"&&T!=="/auth/native-callback")return R.jsx(i8,{to:"/login",replace:!0});let ve=null;if(T==="/auth/callback"||T==="/auth/native-callback")ve=R.jsx(QW,{});else if(T==="/login")ve=R.jsx(sG,{});else if(T==="/reset-password")ve=R.jsx(oG,{});else if(T==="/device")ve=R.jsx(lG,{});else if(T==="/wrapped")ve=R.jsx(cG,{});else if(re==="landing")ve=R.jsx(nG,{signInUrl:"/login",signUpUrl:"/login"});else{const Ne=R.jsx(ae,{baseUrl:N,auth:le,signedIn:j,sessionSoftExpired:S,signOut:()=>n.enabled?n.signOut():Promise.resolve(),publicMode:x,publicToken:b,userId:D,signInUrl:"/login",signUpUrl:"/login",onMainContentVisible:ce},t);_e?ve=R.jsx(iV,{children:Ne}):ve=Ne}return R.jsx(CO,{children:R.jsx(AO,{children:R.jsx(LW,{children:R.jsxs(RO,{children:[R.jsx(k.Suspense,{fallback:null,children:ve}),_e?R.jsx(MV,{}):null,R.jsx(E$,{}),R.jsx(PN,{}),R.jsx(NN,{})]})})})})}var Z=typeof window<"u"?window:void 0,Tn=typeof globalThis<"u"?globalThis:Z;typeof self>"u"&&(Tn.self=Tn),typeof File>"u"&&(Tn.File=function(){});var sa=Tn?.navigator,xe=Tn?.document,fn=Tn?.location,wb=Tn?.fetch,Q_=Tn!=null&&Tn.XMLHttpRequest&&"withCredentials"in new Tn.XMLHttpRequest?Tn.XMLHttpRequest:void 0,TP=Tn?.AbortController,mG=Tn?.CompressionStream,va=sa?.userAgent,Be=Z??{};function J4(){return!(!Z||Z.navigator.onLine===!1)}var EP="1.402.0",en={DEBUG:!1,LIB_VERSION:EP,LIB_NAME:"web",JS_SDK_VERSION:EP};function AP(t,e,n,a,r,s,l){try{var c=t[s](l),u=c.value}catch(h){return void n(h)}c.done?e(u):Promise.resolve(u).then(a,r)}function cn(t){return function(){var e=this,n=arguments;return new Promise((function(a,r){var s=t.apply(e,n);function l(u){AP(s,a,r,l,c,"next",u)}function c(u){AP(s,a,r,l,c,"throw",u)}l(void 0)}))}}function he(){return he=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},he.apply(null,arguments)}function Q4(t,e){if(t==null)return{};var n={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;n[a]=t[a]}return n}var RP=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function LP(t){return typeof t=="string"||t}function DP(t){return typeof t=="string"?t:void 0}var Wc,ki=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),IP=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),gG=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],vG=["token"],X4="NativeGzipValidationError",X_=t=>t.length>=2&&t[0]===31&&t[1]===139,MP=(t,e)=>t===IP.GZipJS||e===IP.GZipJS||e==="gzip",NP=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Nh=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=X4,e},_G=(function(){var t=cn((function*(e,n){18>e.size&&Nh("too-short");var a=new Uint8Array(yield e.slice(0,10).arrayBuffer());X_(a)&&a[2]===8||Nh("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(l=>{for(var c=(()=>{if(Wc)return Wc;Wc=[];for(var p=0;256>p;p++){for(var m=p,v=0;8>v;v++)m=1&m?3988292384^m>>>1:m>>>1;Wc[p]=m>>>0}return Wc})(),u=4294967295,h=0;l.length>h;h++)u=c[255&(u^l[h])]^u>>>8;return(4294967295^u)>>>0})(n)&&Nh("invalid-crc");var s=n.length>>>0;r.getUint32(4,!0)!==s&&Nh("invalid-size")}));return function(e,n){return t.apply(this,arguments)}})();function ey(){return ey=cn((function*(t,e,n){e===void 0&&(e=!0);try{var a=new TextEncoder().encode(t),r=new CompressionStream("gzip"),s=r.writable.getWriter(),l=s.write(a).then((()=>s.close())).catch((function(){var h=cn((function*(p){try{yield s.abort(p)}catch{}throw p}));return function(p){return h.apply(this,arguments)}})()),c=new Response(r.readable).blob(),u=(yield Promise.all([c,l]))[0];return yield _G(u,a),u}catch(h){if(n!=null&&n.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),ey.apply(this,arguments)}var yG=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],OP=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return yG.concat(e).some((a=>{var r=a.toLowerCase();return n.indexOf(r)!==-1}))};function Ke(t,e){return t.indexOf(e)!==-1}var Gf=function(t){return t.trim()},ty=function(t){return t.replace(/^\$/,"")};function eE(t){var e,n=[];return(e=JSON.stringify(t,(function(a,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(r))return"[Circular]";n.push(r)}return r}})))!==null&&e!==void 0?e:"null"}var tE=Object.prototype,nE=tE.hasOwnProperty,qf=tE.toString,it=Array.isArray||function(t){return qf.call(t)==="[object Array]"},yr=t=>typeof t=="function",qt=t=>t===Object(t)&&!it(t),cs=t=>{if(qt(t)){for(var e in t)if(nE.call(t,e))return!1;return!0}return!1},ke=t=>t===void 0,Lt=t=>qf.call(t)=="[object String]",ny=t=>Lt(t)&&t.trim().length===0,la=t=>t===null,nt=t=>ke(t)||la(t),Bn=t=>qf.call(t)=="[object Number]"&&t==t,yi=t=>Bn(t)&&t>0,Hr=t=>qf.call(t)==="[object Boolean]",bG=t=>t instanceof FormData,kG=t=>Ke(gG,t),wG=t=>Ke(vG,t);function aE(t){return t===null||typeof t!="object"}function ef(t,e){return{}.toString.call(t)==="[object "+e+"]"}function xb(t){return typeof Event<"u"&&(function(e,n){try{return e instanceof n}catch{return!1}})(t,Event)}var xG=[!0,"true",1,"1","yes"],wv=t=>Ke(xG,t),PG=[!1,"false",0,"0","no"];function Br(t,e,n,a,r){return e>n&&(a.warn("min cannot be greater than max."),e=n),Bn(t)?t>n?(a.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(a.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(a.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),Br(r||n,e,n,a))}class SG{constructor(e){this.Pe={},this.Oe=e.Oe,this.Fe=Br(e.bucketSize,0,100,e.Ae),this.$e=Br(e.refillRate,0,this.Fe,e.Ae),this.Ne=Br(e.refillInterval,0,864e5,e.Ae)}De(e,n){var a=Math.floor((n-e.lastAccess)/this.Ne);a>0&&(e.tokens=Math.min(e.tokens+a*this.$e,this.Fe),e.lastAccess=e.lastAccess+a*this.Ne)}consumeRateLimit(e){var n,a=Date.now(),r=String(e),s=this.Pe[r];return s?this.De(s,a):this.Pe[r]=s={tokens:this.Fe,lastAccess:a},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.Oe)==null||n.call(this,e)),s.tokens===0)}stop(){this.Pe={}}}var Da="Mobile",tf="iOS",Si="Android",Nl="Tablet",rE=Si+" "+Nl,iE="iPad",sE="Apple",oE=sE+" Watch",xd="Safari",Ol="BlackBerry",lE="Samsung",cE=lE+"Browser",dE=lE+" Internet",oo="Chrome",CG=oo+" OS",uE=oo+" "+tf,Pb="Internet Explorer",hE=Pb+" "+Da,Sb="Opera",TG=Sb+" Mini",Cb="Edge",pE="Microsoft "+Cb,Pl="Firefox",fE=Pl+" "+tf,Bd="Nintendo",$d="PlayStation",Sl="Xbox",mE=Si+" "+Da,gE=Da+" "+xd,od="Windows",ay=od+" Phone",jP="Nokia",ry="Ouya",vE="Generic",EG=vE+" "+Da.toLowerCase(),_E=vE+" "+Nl.toLowerCase(),iy="Konqueror",yE="Oculus Browser",nf="Vivaldi",bE="Yandex",af="Whale",sy="DuckDuckGo",kE="Pale Moon",rf="Waterfox",Pd="Brave",wE="Google Search App",Xt="(\\d+(\\.\\d+)?)",xv=new RegExp("Version/"+Xt),AG=new RegExp(Sl,"i"),RG=new RegExp($d+" \\w+","i"),LG=new RegExp(Bd+" \\w+","i"),Tb=new RegExp(Ol+"|PlayBook|BB10","i"),DG={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},xE=function(t,e,n,a){e=e||"";var r=(function(s){return s!=null&&s.brave?Pd:null})(n);return r||(a!=null&&a.detectGoogleSearchApp&&Ke(t,"GSA/")?wE:Ke(t," OPR/")&&Ke(t,"Mini")?TG:Ke(t," OPR/")?Sb:Tb.test(t)?Ol:Ke(t,"IE"+Da)||Ke(t,"WPDesktop")?hE:Ke(t,"OculusBrowser")?yE:Ke(t,cE)?dE:Ke(t,Cb)||Ke(t,"Edg/")?pE:Ke(t,nf+"/")?nf:Ke(t,"YaBrowser/")?bE:Ke(t,af+"/")?af:Ke(t,sy+"/")||Ke(t,"Ddg/")?sy:Ke(t,"FBIOS")?"Facebook "+Da:Ke(t,"UCWEB")||Ke(t,"UCBrowser")?"UC Browser":Ke(t,"CriOS")?uE:Ke(t,"CrMo")||Ke(t,oo)?oo:Ke(t,Si)&&Ke(t,xd)?mE:Ke(t,"FxiOS")?fE:Ke(t.toLowerCase(),iy.toLowerCase())?iy:Ke(t,Pd+"/")?Pd:((s,l)=>l&&Ke(l,sE)||(function(c){return Ke(c,xd)&&!Ke(c,oo)&&!Ke(c,Si)})(s))(t,e)?Ke(t,Da)?gE:xd:Ke(t,"PaleMoon/")?kE:Ke(t,rf+"/")?rf:Ke(t,Pl)?Pl:Ke(t,"MSIE")||Ke(t,"Trident/")?Pb:Ke(t,"Gecko")?Pl:"")},IG={[hE]:[new RegExp("rv:"+Xt)],[pE]:[new RegExp(Cb+"?\\/"+Xt)],[oo]:[new RegExp("("+oo+"|CrMo)\\/"+Xt)],[uE]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[xd]:[xv],[gE]:[xv],[Sb]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Pl]:[new RegExp(Pl+"\\/"+Xt)],[fE]:[new RegExp("FxiOS\\/"+Xt)],[iy]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[Ol]:[new RegExp(Ol+" "+Xt),xv],[mE]:[new RegExp("android\\s"+Xt,"i")],[dE]:[new RegExp(cE+"\\/"+Xt)],[yE]:[new RegExp("OculusBrowser\\/"+Xt)],[nf]:[new RegExp(nf+"\\/"+Xt)],[bE]:[new RegExp("YaBrowser\\/"+Xt)],[af]:[new RegExp(af+"\\/"+Xt)],[Pd]:[new RegExp(Pd+"\\/"+Xt)],[sy]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[kE]:[new RegExp("PaleMoon\\/"+Xt)],[rf]:[new RegExp(rf+"\\/"+Xt)],[wE]:[new RegExp("GSA\\/"+Xt)],[Pb]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},MG=function(t,e,n,a){var r=xE(t,e,n,a),s=IG[r];if(ke(s))return null;for(var l=0;s.length>l;l++){var c=t.match(s[l]);if(c)return parseFloat(c[c.length-2])}return null},zP=[[new RegExp(Sl+"; "+Sl+" (.*?)[);]","i"),t=>[Sl,t&&t[1]||""]],[new RegExp(Bd,"i"),[Bd,""]],[new RegExp($d,"i"),[$d,""]],[Tb,[Ol,""]],[new RegExp(od,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ay,""];if(new RegExp(Da).test(e)&&!/IEMobile\b/.test(e))return[od+" "+Da,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var a=DG[n[1]]||"";return/arm/i.test(e)&&(a="RT"),[od,a]}return[od,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tf,[t[3],t[4],t[5]||"0"].join(".")]:[tf,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ke(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Si+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Si+")","i"),t=>t&&t[2]?[Si,[t[2],t[3],t[4]||"0"].join(".")]:[Si,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[CG,""]],[/Linux|debian/i,["Linux",""]]],FP=function(t){return LG.test(t)?Bd:RG.test(t)?$d:AG.test(t)?Sl:new RegExp(ry,"i").test(t)?ry:new RegExp("("+ay+"|WPDesktop)","i").test(t)?ay:/iPad/.test(t)?iE:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?oE:Tb.test(t)?Ol:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jP,"i").test(t)?jP:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Da).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Si:rE:new RegExp("(pda|"+Da+")","i").test(t)?EG:new RegExp(Nl,"i").test(t)&&!new RegExp(Nl+" pc","i").test(t)?_E:""},NG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function UP(t,e){return typeof(n=t)=="string"&&NG.test(n)?t:e();var n}function ms(t){return t&&t.split("#")[0]}function hp(t,e){var n=setTimeout(t,e);return n?.unref&&n?.unref(),n}var OG=t=>t instanceof Error,PE={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},jG=PE.info;function SE(t){if(Hr(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(it(t))return{arrayValue:{values:t.map((e=>SE(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function sf(t){var e=[];for(var n in t){var a=t[n];la(a)||ke(a)||e.push({key:n,value:SE(a)})}return e}function zG(t,e){var n=PE[t.level||"info"]||jG,a=n.text,r=n.number,s=String(Date.now())+"000000",l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),nt(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),nt(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);var c=he({},l,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:r,severityText:a,body:{stringValue:t.body},attributes:sf(c)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ke(t.trace_flags)||(u.flags=t.trace_flags),u}function CE(t,e,n){return he({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}function TE(t,e,n,a){return{resourceLogs:[{resource:{attributes:sf(e)},scopeLogs:[{scope:{name:n,version:a},logRecords:t}]}]}}let FG=class{constructor(t,e,n,a,r,s,l){var c;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=n,this.qe=a,this.je=r,this.Be=s,this.He=l,this.Ue=null,this.ze=0,this.We=0,this.Ve=0,this.Ze=0,this.Ge=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((c=e.maxQueueSize)!==null&&c!==void 0?c:e.maxBufferSize,e.maxBufferSize),this.Ke=e.flushIntervalMs,this.Ye=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.Ve=0,this.Ze=0,this.Ge=!1,this.ze=0,this.We=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.We=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.it(t);if(e!==null)if(e.body){if(this.nt()){var n={record:zG(e,this.qe())};this.je((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=it(e)?e:[e],a=t;for(var r of n)try{var s=r(a);if(!s)return this.Ae.info("Log was rejected in beforeSend function"),null;a=s}catch(l){return this.Ae.error("Error in beforeSend function for log:",l),null}return a}nt(){if(this.et===void 0)return!0;var t=Date.now(),e=t-this.Ve;return this.Xe>e&&e>=0||(this.Ve=t,this.Ze=0,this.Ge=!1),this.et>this.Ze?(this.Ze++,!0):(this.Ge||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ge=!0),!1)}flush(){var t=this;return cn((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return cn((function*(){var e;t.tt();var n=(e=t._instance.getPersistedProperty(ki.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var a=n.length,r=0;n.length>0&&a>r;){var s,l;t.ze=0;var c=Math.min(n.length,t.Ye),u=n.slice(0,c),h=TE(u.map((m=>m.record)),t.ut(),(s=t.He)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),p=yield t._instance.ht(h);if(p.kind==="too-large"&&u.length>1)t.Ye=Math.max(1,Math.floor(u.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.Ye);else if(p.kind==="retry-later"||(p.kind==="too-large"?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&t.Se.maxBatchRecordsPerPost>t.Ye&&(t.Ye=Math.min(t.Se.maxBatchRecordsPerPost,t.Ye+1)),yield t.dt(u.length),n=(l=t._instance.getPersistedProperty(ki.LogsQueue))!==null&&l!==void 0?l:[],r+=u.length,p.kind==="fatal"))throw p.error}}))()}dt(t){var e=this;return cn((function*(){var n,a=Math.max(0,t-e.ze),r=(n=e._instance.getPersistedProperty(ki.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(ki.LogsQueue,r.slice(a)),yield e.Be()}))()}ut(){return CE(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(ki.LogsQueue))!==null&&e!==void 0?e:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(ki.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(t){t===void 0&&(t=this.Ke),this.vt||(this.vt=hp((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.We-1),6);return this.Ke*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(ki.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return cn((function*(){e.tt();var n=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([n,new Promise((a=>hp(a,t)))]):yield n}))()}flushWithTimeout(t){var e=this;return cn((function*(){var n=!1,a=e.flush(),r=new Promise((s=>hp((()=>{n=!0,s()}),t)));try{yield Promise.race([a,r])}finally{n&&a.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.We=0}),(t=>{this.We++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var Pv=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function BP(t){return String(t)+"000000"}function $P(t,e,n,a){var r="";return a&&(r=Object.keys(a).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(a[s]))).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+r}let UG=class{constructor(t,e,n){this._instance=t,this.Se=e,this.Ae=n,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(t,e,n){e===void 0&&(e=1),this.kt({name:t,type:"count",value:e,unit:n?.unit,attributes:n?.attributes})}gauge(t,e,n){this.kt({name:t,type:"gauge",value:e,unit:n?.unit,attributes:n?.attributes})}histogram(t,e,n){this.kt({name:t,type:"histogram",value:e,unit:n?.unit,attributes:n?.attributes})}flush(){var t=this,e=this.Ue,n=(function(){var r=cn((function*(){e&&(yield e.catch((()=>{}))),yield t.St()}));return function(){return r.apply(this,arguments)}})(),a=n().finally((()=>{this.Ue===a&&(this.Ue=null)}));return this.Ue=a,a}drainWindow(){if(this.bt.size===0)return null;var t=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(t)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.it(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ae.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n=this.wt.get(e.name);n===void 0?this.wt.set(e.name,e.type):n===e.type||this.xt.has(e.name)||(this.xt.add(e.name),this.Ae.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name."));var a=$P(e.type,e.name,e.unit,e.attributes),r=this.bt.get(a);if(!r){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));r={name:e.name,type:e.type,unit:e.unit,attributes:e.attributes?he({},e.attributes):void 0,windowStartMs:Date.now()},this.bt.set(a,r)}this.Tt(r,e.value),this.ct()}else this.Ae.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}Tt(t,e){var n;switch(t.type){case"count":t.total=((n=t.total)!==null&&n!==void 0?n:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Pv.length+1).fill(0)});var a=t.hist;a.count+=1,a.sum+=e,a.min=Math.min(a.min,e),a.max=Math.max(a.max,e),a.bucketCounts[(function(r,s){for(var l=0;s.length>l;l++)if(s[l]>=r)return l;return s.length})(e,Pv)]+=1}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=it(e)?e:[e],a=t;for(var r of n)try{var s=r(a);if(!s)return this.Ae.info("Metric was rejected in beforeSend function"),null;a=s}catch(l){return this.Ae.error("Error in beforeSend function for metric:",l),null}return a}ct(){this.vt||(this.vt=hp((()=>{this.vt=void 0,this.flush().catch((()=>{}))}),this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var t=this;return cn((function*(){if(t.bt.size!==0){var e=t.bt;t.bt=new Map,t._t=!1,t.wt=new Map,t.xt=new Set;var n=yield t._instance.It(t.Ct(e));switch(n.kind){case"ok":return;case"retry-later":return t.Mt(e),void t.ct();case"too-large":return void t.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ae.error("Failed to send metrics batch:",n.error)}}}))()}Ct(t){return(function(r,s,l,c){return{resourceMetrics:[{resource:{attributes:sf(s)},scopeMetrics:[{scope:{name:l,version:c},metrics:r}]}]}})(this.Et(t),(e=this.Se,n=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),he({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":n,"telemetry.sdk.version":a})),this._instance.getLibraryId(),this._instance.getLibraryVersion());var e,n,a}Et(t){var e=BP(Date.now()),n=new Map;for(var a of t.values()){var r,s=$P(a.type,a.name,a.unit,void 0),l=n.get(s);l||(l=he({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},n.set(s,l));var c=sf((r=a.attributes)!==null&&r!==void 0?r:{}),u=BP(a.windowStartMs);if(a.type==="count"){var h,p={attributes:c,startTimeUnixNano:u,timeUnixNano:e,asDouble:(h=a.total)!==null&&h!==void 0?h:0};l.sum.dataPoints.push(p)}else if(a.type==="gauge"){var m,v={attributes:c,timeUnixNano:e,asDouble:(m=a.last)!==null&&m!==void 0?m:0};l.gauge.dataPoints.push(v)}else a.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:e,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:Pv})}return Array.from(n.values())}Mt(t){var e,n;for(var a of t){var r=a[0],s=a[1],l=this.bt.get(r);if(l)switch(l.windowStartMs=Math.min(l.windowStartMs,s.windowStartMs),l.type){case"count":l.total=((e=l.total)!==null&&e!==void 0?e:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(l.hist){l.hist.count+=s.hist.count,l.hist.sum+=s.hist.sum,l.hist.min=Math.min(l.hist.min,s.hist.min),l.hist.max=Math.max(l.hist.max,s.hist.max);for(var c=0;l.hist.bucketCounts.length>c;c++)l.hist.bucketCounts[c]+=s.hist.bucketCounts[c]}else l.hist=s.hist}else this.bt.set(r,s)}}};var Oh,VP,Sv;function BG(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Sv&&n.length===VP||(VP=n.length,Sv=n.reduce(((a,r)=>{Oh||(Oh={});var s=Oh[r];if(s)a[s[0]]=s[1];else for(var l=t(r),c=l.length-1;c>=0;c--){var u=l[c],h=u?.filename,p=e[r];if(h&&p){a[h]=p,Oh[r]=[h,p];break}}return a}),{})),Sv}}class $G{constructor(e,n,a){a===void 0&&(a=[]),this.coercers=e,this.stackParser=n,this.modifiers=a}buildFromUnknown(e,n){n===void 0&&(n={});var a=n&&n.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(a,n,0).apply(e),s=this.buildParsingContext(n),l=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(l,a),$exception_level:"error"}}modifyFrames(e){var n=this;return cn((function*(){for(var a of e)a.stacktrace&&a.stacktrace.frames&&it(a.stacktrace.frames)&&(a.stacktrace.frames=yield n.applyModifiers(a.stacktrace.frames));return e}))()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var a,r;return e.cause!=null&&(a=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),he({},e,{cause:a,stack:r})}applyChunkIds(e,n){return e.map((a=>(a.filename&&n&&(a.chunk_id=n[a.filename]),a)))}applyCoercers(e,n){for(var a of this.coercers)if(a.match(e))return a.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return cn((function*(){var a=e;for(var r of n.modifiers)a=yield r(a);return a}))()}convertToExceptionList(e,n){var a,r,s,l={type:e.type,value:e.value,mechanism:{type:(a=n.type)!==null&&a!==void 0?a:"generic",handled:(r=n.handled)===null||r===void 0||r,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(l.stacktrace={type:"raw",frames:e.stack});var c=[l];return e.cause!=null&&c.push(...this.convertToExceptionList(e.cause,he({},n,{handled:!0}))),c}buildParsingContext(e){var n;return{chunkIdMap:BG(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,a){a===void 0&&(a=0);var r=(s,l)=>{if(4>=l){var c=this.buildCoercingContext(e,n,l);return this.applyCoercers(s,c)}};return he({},n,{syntheticException:a==0?n.syntheticException:void 0,mechanism:e,apply:s=>r(s,a),next:s=>r(s,a+1)})}}var jl="?";function oy(t,e,n,a,r){var s={platform:t,filename:e,function:n==="<anonymous>"?jl:n,in_app:!0};return ke(a)||(s.lineno=a),ke(r)||(s.colno=r),s}var EE=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,a=t.indexOf("safari-web-extension")!==-1;return n||a?[t.indexOf("@")!==-1?t.split("@")[0]:jl,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},VG=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,HG=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,WG=/\((\S*)(?::(\d+))(?::(\d+))\)/,GG=(t,e)=>{var n=VG.exec(t);if(n)return oy(e,n[1],jl,+n[2],+n[3]);var a=HG.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var r=WG.exec(a[2]);r&&(a[2]=r[1],a[3]=r[2],a[4]=r[3])}var s=EE(a[1]||jl,a[2]);return oy(e,s[1],s[0],a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},qG=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KG=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YG=(t,e)=>{var n=qG.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var a=KG.exec(n[3]);a&&(n[1]=n[1]||"eval",n[3]=a[1],n[4]=a[2],n[5]="")}var r=n[3],s=n[1]||jl,l=EE(s,r);return oy(e,r=l[1],s=l[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},HP=/\(error: (.*)\)/;class ZG{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var a=Lt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:a?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return ef(e,"DOMException")}isDOMError(e){return ef(e,"DOMError")}}class JG{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var a=e.message;return String(a.error&&typeof a.error.message=="string"?a.error.message:a)}getStack(e){return e.stacktrace||e.stack||void 0}}class QG{constructor(){}match(e){return ef(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var a;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}var XG=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class eq{match(e){return typeof e=="string"}coerce(e,n){var a,r=this.getInfos(e),s=r[0],l=r[1];return{type:s??"Error",value:l??e,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}getInfos(e){var n="Error",a=e,r=e.match(XG);return r&&(n=r[1],a=r[2]),[n,a]}}var tq=["fatal","error","warning","log","info","debug"];function AE(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var a=n.length;a>0;a--){var r=n.slice(0,a).join(", ");if(e>=r.length)return a===n.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class nq{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var a,r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return xb(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var a=this.getObjectClassName(e);return(a&&a!=="Object"?"'"+a+"'":"Object")+" captured as exception with keys: "+AE(e)}isSeverityLevel(e){return Lt(e)&&!ny(e)&&tq.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var a=e[n];if(OG(a))return a}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class aq{match(e){return xb(e)}coerce(e,n){var a,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+AE(e),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class rq{match(e){return aE(e)}coerce(e,n){var a;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class iq{match(e){return ef(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!xb(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var a,r=this.getUnhandledRejectionReason(e);return aE(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}:n.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var of="$message",lf="$timestamp",sq=new Set([of,lf]),Cv={enabled:!0,max_bytes:32768};function cf(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Cv.enabled,max_bytes:lq(t.max_bytes,Cv.max_bytes)}:he({},Cv)}class oq{constructor(e){this.Rt=[],this.Pt=0,this.Se=cf(e)}setConfig(e){this.Se=cf(e),this.Ot()}add(e){var n=(function(r){var s;try{s=eE(r)}catch{return}try{var l=JSON.parse(s);if(!qt(l))return;var c=l,u=c[of],h=c[lf];return!Lt(u)||u.trim().length===0||!Lt(h)&&!Bn(h)?void 0:{step:c,json:s}}catch{return}})(e);if(n){var a=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var s=encodeURIComponent(r),l=0,c=0;s.length>c;c++)s[c]==="%"?(l+=1,c+=2):l+=1;return l})(n.json);a>this.Se.max_bytes||(this.Rt.push({step:n.step,bytes:a}),this.Pt+=a,this.Ot())}}getAttachable(){return this.Rt.map((e=>e.step))}clear(){this.Rt=[],this.Pt=0}size(){return this.Rt.length}Ot(){for(;this.Pt>this.Se.max_bytes&&this.Rt.length>0;){var e=this.Rt.shift();e&&(this.Pt-=e.bytes)}}}function lq(t,e){if(!Bn(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var RE=function(t,e){var n=(e===void 0?{}:e).debugEnabled,a={k(r){if(Z&&(en.DEBUG||Be.POSTHOG_DEBUG||n)&&!ke(Z.console)&&Z.console){for(var s=("__rrweb_original__"in Z.console[r])?Z.console[r].__rrweb_original__:Z.console[r],l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];s(t,...c)}},debug(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("debug",...s)},info(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("log",...s)},warn(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("warn",...s)},error(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("error",...s)},critical(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];console.error(t,...s)},uninitializedWarning(r){a.error("You must initialize PostHog before calling "+r)},createLogger:(r,s)=>RE(t+" "+r,s)};return a},be=RE("[PostHog.js]"),Zt=be.createLogger,cq=Zt("[ExternalScriptsLoader]"),Tv=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return cq.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var a=xe?.querySelectorAll("script");if(a){for(var r,s=function(){if(a[l].src===e){var u=a[l];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",(h=>{u.__posthog_loading_callback_fired=!0,n(void 0,h)})),u.onerror=h=>n(h),{v:void 0})}},l=0;a.length>l;l++)if(r=s())return r.v}var c=()=>{if(!xe)return n("document not found");var u=xe.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=m=>{u.__posthog_loading_callback_fired=!0,n(void 0,m)},u.onerror=m=>n(m),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")xe.head.appendChild(u);else{var h,p=xe.querySelectorAll("body > script");p.length>0?(h=p[0].parentNode)==null||h.insertBefore(u,p[0]):xe.body.appendChild(u)}};xe!=null&&xe.body?c():xe?.addEventListener("DOMContentLoaded",c)};Be.__PosthogExtensions__=Be.__PosthogExtensions__||{},Be.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var a;if(t.config.strict_script_versioning)a=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}a=t.requestRouter.endpointFor("assets",r)}Tv(t,a,n)}else{var l=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Tv(t,l,n)}},Be.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var a=t.requestRouter.endpointFor("api",e);Tv(t,a,n)};var LE="$people_distinct_id",df="$device_id",Ev="$device_model",ld="__alias",cd="__timers",ly="$autocapture_disabled_server_side",cy="$heatmaps_enabled_server_side",dy="$exception_capture_enabled_server_side",uy="$error_tracking_suppression_rules",hy="$error_tracking_capture_extension_exceptions",py="$web_vitals_enabled_server_side",Eb="$dead_clicks_enabled_server_side",Ab="$product_tours_enabled_server_side",fy="$web_vitals_allowed_metrics",ao="$session_recording_remote_config",DE="$replay_sample_rate",IE="$replay_override_sampling",ME="$replay_override_linked_flag",NE="$replay_override_url_trigger",OE="$replay_override_event_trigger",yl="$sesid",Rb="$session_is_sampled",Ys="$enabled_feature_flags",pp="$active_feature_flags",dd="$early_access_features",my="$feature_flag_details",fp="$feature_flag_payloads",gy="$feature_flag_request_id",bi="$override_feature_flags",ul="$override_feature_flag_payloads",Gs="$stored_person_properties",qs="$stored_group_properties",vy="$surveys",uf="$surveys_loaded_at",_y="$surveys_activated",ud="ph_product_tours",Sd="$flag_call_reported",yy="$flag_call_reported_session_id",by="$feature_flag_errors",Vd="$feature_flag_evaluated_at",vr="$user_state",ky="$client_session_props",wy="$capture_rate_limit",xy="$initial_campaign_params",Py="$initial_referrer_info",hf="$initial_person_info",pf="$epp",jE="__POSTHOG_TOOLBAR__",jh="$posthog_cookieless",zE="$sdk_debug_extensions_init_method",FE="$sdk_debug_extensions_init_time_ms",UE="$sdk_debug_recording_script_not_loaded",Lb="PostHog loadExternalDependency extension not found.",Ks="on_reject",xi="always",tl="anonymous",nl="identified",Sy="identified_only",ff="visibilitychange",mf="beforeunload",hl="$pageview",Av="$pageleave",Rv="$identify",WP="$groupidentify";function zh(t,e){it(t)&&t.forEach(e)}function Mt(t,e){if(!nt(t))if(it(t))t.forEach(e);else if(bG(t))t.forEach(((a,r)=>e(a,r)));else for(var n in t)nE.call(t,n)&&e(t[n],n)}var Bt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),a=1;e>a;a++)n[a-1]=arguments[a];for(var r of n)for(var s in r)r[s]!==void 0&&(t[s]=r[s]);return t};function mp(t){for(var e=Object.keys(t),n=e.length,a=new Array(n);n--;)a[n]=[e[n],t[e[n]]];return a}var GP=function(t){try{return t()}catch{return}},dq=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),a=0;e>a;a++)n[a]=arguments[a];return t.apply(this,n)}catch(r){be.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),be.critical(r)}}},Db=function(t){var e={};return Mt(t,(function(n,a){(Lt(n)&&n.length>0||Bn(n))&&(e[a]=n)})),e},uq=["herokuapp.com","vercel.app","netlify.app"];function hq(t){var e=t?.hostname;if(!Lt(e))return!1;var n=e.split(".").slice(-2).join(".");for(var a of uq)if(n===a)return!1;return!0}function tn(t,e,n,a){var r=a??{},s=r.capture,l=r.passive;t?.addEventListener(e,n,{capture:s!==void 0&&s,passive:l===void 0||l})}function BE(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Bn(t)&&isFinite(t)&&Math.floor(t)===t});class gf{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,a,r){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(a)||!Number.isInteger(r)||0>e||0>n||0>a||0>r||e>0xffffffffffff||n>4095||a>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|a>>>24,s[9]=a>>>16,s[10]=a>>>8,s[11]=a,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new gf(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gf(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var a=this.bytes[n]-e.bytes[n];if(a!==0)return Math.sign(a)}return 0}}class pq{constructor(){this.S=0,this.C=0,this.I=new fq}generate(){var e=this.generateOrAbort();if(ke(e)){this.S=0;var n=this.generateOrAbort();if(ke(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return gf.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var qP,$E=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Z&&!ke(Z.crypto)&&crypto.getRandomValues&&($E=t=>crypto.getRandomValues(t));class fq{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||($E(this.R),this.O=0),this.R[this.O++]}}var wi=()=>mq().toString(),mq=()=>(qP||(qP=new pq)).generate(),Gc="",gq=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fr={N:()=>!!xe,D(t){be.error("cookieStore error: "+t)},A(t){if(xe){try{for(var e=t+"=",n=xe.cookie.split(";").filter((s=>s.length)),a=0;n.length>a;a++){for(var r=n[a];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(t){var e;try{e=JSON.parse(Fr.A(t))||{}}catch{}return e},q(t,e,n,a,r){if(!xe)return!1;try{var s="",l="",c=(function(p,m){if(m){var v=(function(b,x){if(x===void 0&&(x=xe),Gc)return Gc;if(!x||["localhost","127.0.0.1"].includes(b))return"";for(var P=b.split("."),T=Math.min(P.length,8),L="dmn_chk_"+wi();!Gc&&T--;){var E=P.slice(T).join("."),A=L+"=1;domain=."+E+";path=/";x.cookie=A+";max-age=3",x.cookie.includes(L)&&(x.cookie=A+";max-age=0",Gc=E)}return Gc})(p);if(!v){var y=(b=>{var x=b.match(gq);return x?x[0]:""})(p);y!==v&&be.info("Warning: cookie subdomain discovery mismatch",y,v),v=y}return v?"; domain=."+v:""}return""})(xe.location.hostname,a);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(l="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+c+l;return h.length>3686.4&&be.warn("cookieStore warning: large cookie, len="+h.length),xe.cookie=h,!0}catch{return!1}},P(t,e){if(xe!=null&&xe.cookie)try{Fr.q(t,"",-1,e)}catch{return}}},Lv=null,It={N(){if(!la(Lv))return Lv;var t=!0;if(ke(Z))t=!1;else try{var e="__mplssupport__";It.q(e,"xyz"),It.A(e)!=='"xyz"'&&(t=!1),It.P(e)}catch{t=!1}return t||be.error("localStorage unsupported; falling back to cookie store"),Lv=t,t},D(t){be.error("localStorage error: "+t)},A(t){try{return Z?.localStorage.getItem(t)}catch(e){It.D(e)}return null},F(t){try{return JSON.parse(It.A(t))||{}}catch{}return null},q(t,e){try{return Z?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){It.D(n)}return!1},P(t){try{Z?.localStorage.removeItem(t)}catch(e){It.D(e)}}},vq=[df,"distinct_id",yl,Rb,pf,hf,vr],Fh={},_q={N:()=>!0,D(t){be.error("memoryStorage error: "+t)},A:t=>Fh[t]||null,F:t=>Fh[t]||null,q:(t,e)=>(Fh[t]=e,!0),P(t){delete Fh[t]}},Fs=null,Fn={N(){if(!la(Fs))return Fs;if(Fs=!0,ke(Z))Fs=!1;else try{var t="__support__";Fn.q(t,"xyz"),Fn.A(t)!=='"xyz"'&&(Fs=!1),Fn.P(t)}catch{Fs=!1}return Fs},D(t){be.error("sessionStorage error: ",t)},A(t){try{return Z?.sessionStorage.getItem(t)}catch(e){Fn.D(e)}return null},F(t){try{return JSON.parse(Fn.A(t))||null}catch{}return null},q(t,e){try{return Z?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Fn.D(n)}return!1},P(t){try{Z?.sessionStorage.removeItem(t)}catch(e){Fn.D(e)}}};class yq{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.At()?0:this.$t}isOptedOut(){return this.Se.cookieless_mode===xi||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===Ks}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Nt.q(this.Dt,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Nt.P(this.Dt,this.Se.cross_subdomain_cookie)}get Dt(){var e=this._instance.config,n=e.token,a=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(a?a+n:"__ph_opt_in_out_"+n)}get $t(){var e=this.Nt.A(this.Dt);return wv(e)?1:Ke(PG,e)?0:-1}get Nt(){var e=this.Se.opt_out_capturing_persistence_type,n=e==="localStorage"?It:Fr;if(!this.qt||this.qt!==n){this.qt=n;var a=e==="localStorage"?Fr:It;a.A(this.Dt)&&(this.qt.A(this.Dt)||this.optInOut(wv(a.A(this.Dt))),a.P(this.Dt,this.Se.cross_subdomain_cookie))}return this.qt}At(){return!!this.Se.respect_dnt&&[sa?.doNotTrack,sa?.msDoNotTrack,Be.doNotTrack].some((e=>wv(e)))}}function VE(t,e){var n,a=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!yr(a))return e;try{var r=a(e);return Lt(r)&&r?r:e}catch(s){return be.error("Error in get_current_url, falling back to window.location.href",s),e}}var bq=1,kq=3,wq=11;function KP(t){return t instanceof Element&&(t.id===jE||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function gs(t){return!!t&&t.nodeType===bq}function Ra(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function HE(t){return!!t&&t.nodeType===kq}function WE(t){return!!t&&t.nodeType===wq&&gs(t.host)}var GE=1e3;function Ib(t){return t?Gf(t).split(/\s+/):[]}function YP(t,e){var n=(function(a){var r,s=Z==null||(r=Z.location)==null?void 0:r.href;return ke(s)?void 0:VE(a,s)})(e);return!!(n&&t&&t.some((a=>n.match(a))))}function vf(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Ib(e)}function qE(t){return nt(t)?null:Gf(t).split(/(\s+)/).filter((e=>Cd(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Hd(t){var e="";return Ty(t)&&!JE(t)&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(n){var a;HE(n)&&n.textContent&&(e+=(a=qE(n.textContent))!==null&&a!==void 0?a:"")})),Gf(e)}function Dv(t){return ke(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Mb=["a","button","form","input","select","textarea","label"];function Cy(t,e){if(ke(e))return!0;var n,a=function(s){if(e.some((l=>(function(c,u){var h=c.matches||c.matchesSelector||c.msMatchesSelector||c.mozMatchesSelector||c.webkitMatchesSelector||c.oMatchesSelector;try{return!!h&&h.call(c,u)}catch{return!1}})(s,l))))return{v:!0}};for(var r of t)if(n=a(r))return n.v;return!1}function KE(t){var e=t.parentNode;return!(!e||!gs(e))&&e}var xq=[".ph-no-autocapture","[data-ph-no-autocapture]"],YE=["next","previous","prev",">","<"],Pq=[...YE,"+","-","−","–"],ZP=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,JP=[".ph-no-rageclick",".ph-no-capture"],Sq=["","text","search","email","password","url","tel","number"];function QP(t,e){if(!Z||Nb(t))return!1;var n,a,r,s,l;if(Hr(e)?(n=!!e&&JP,a=void 0,r=!1):(n=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:JP,a=e?.content_ignorelist,r=(l=e?.ignore_text_selection)!==null&&l!==void 0&&l),n===!1||r&&(function(u){return!(!u||!gs(u))&&(!!Ra(u,"textarea")||(Ra(u,"input")?Ke(Sq,(u.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var p=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return p==="true"||p===""})(u)))})(t))return!1;var c=ZE(t,!1).targetElementList;return!(function(u,h){if(u===!1||ke(u))return!1;var p;if(u===!0)p=YE;else{if(!it(u))return!1;if(u.length>10)return be.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;p=u.map((m=>m.toLowerCase()))}return h.some((m=>{var v=m.safeText,y=m.ariaLabel;return p.some((b=>ZP(v,b)||ZP(y,b)))}))})(a,c.map((u=>{var h;return{safeText:Hd(u).toLowerCase(),ariaLabel:((h=u.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!Cy(c,n)}var Nb=t=>!t||Ra(t,"html")||!gs(t),ZE=(t,e)=>{if(!Z||Nb(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,a=[t],r=t;r.parentNode&&!Ra(r,"body");)if(WE(r.parentNode))a.push(r.parentNode.host),r=r.parentNode.host;else{var s=KE(r);if(!s)break;if(e||Mb.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var l=Z.getComputedStyle(s);l&&l.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}a.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:a}};function Ty(t){for(var e=new Set,n=0,a=t;a.parentNode&&!Ra(a,"body");a=a.parentNode){if(n++>=GE||e.has(a))return!1;e.add(a);var r=vf(a);if(Ke(r,"ph-sensitive")||Ke(r,"ph-no-capture"))return!1}if(Ke(vf(t),"ph-include"))return!0;var s=t.type||"";if(Lt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var l=t.name||t.id||"";return!Lt(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function JE(t){return!!(Ra(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ra(t,"select")||Ra(t,"textarea")||t.getAttribute("contenteditable")==="true")}var QE="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Cq=new RegExp("^(?:"+QE+")$"),Tq=new RegExp(QE),XE="\\d{3}-?\\d{2}-?\\d{4}",Eq=new RegExp("^("+XE+")$"),Aq=new RegExp("("+XE+")");function Cd(t,e){return e===void 0&&(e=!0),!(nt(t)||Lt(t)&&(t=Gf(t),(e?Cq:Tq).test((t||"").replace(/[- ]/g,""))||(e?Eq:Aq).test(t)))}function XP(t){var e=Hd(t);return Cd(e=(e+" "+e6(t)).trim())?e:""}function e6(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(n){var a;if(n&&((a=n.tagName)==null?void 0:a.toLowerCase())==="span")try{var r=Hd(n);e=(e+" "+r).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+e6(n)).trim())}catch(s){be.error("[AutoCapture]",s)}})),e}function eS(t){return t.replace(/"|\\"/g,'\\"')}function Rq(t){var e=t.attr__class;return e?it(e)?e:Ib(e):void 0}var Uh=Zt("[Dead Clicks]"),Lq=()=>!0,Dq=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(Eb)),a=t.instance.config.capture_dead_clicks;return Hr(a)?a:!!qt(a)||n};class tS{get lazyLoadedDeadClicksAutocapture(){return this.jt}constructor(e,n,a){this.instance=e,this.isEnabled=n,this.onCapture=a,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Eb]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt((()=>{this.Ht()})):this.stop()}Bt(e){var n,a;(n=Be.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Uh.error("failed to load script",r):e()}))}Ht(){var e;if(xe){if(!this.jt&&(e=Be.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=qt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.jt=Be.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.jt.start(xe),Uh.info("starting...")}}else Uh.error("`document` not found. Cannot start.")}stop(){this.jt&&(this.jt.stop(),this.jt=void 0,Uh.info("stopping..."))}}var Iv=Zt("[SegmentIntegration]"),t6="posthog-js";function n6(t,e){var n=e===void 0?{}:e,a=n.organization,r=n.projectId,s=n.prefix,l=n.severityAllowList,c=l===void 0?["error"]:l,u=n.sendExceptionsToPostHog,h=u===void 0||u;return p=>{var m,v,y,b,x;if(c!=="*"&&!c.includes(p.level)||!t.__loaded)return p;p.tags||(p.tags={});var P=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());p.tags["PostHog Person URL"]=P,t.sessionRecordingStarted()&&(p.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var T,L=((m=p.exception)==null?void 0:m.values)||[],E=L.map((D=>he({},D,{stacktrace:D.stacktrace?he({},D.stacktrace,{type:"raw",frames:(D.stacktrace.frames||[]).map((B=>he({},B,{platform:"web:javascript"})))}):void 0}))),A={$exception_message:((v=L[0])==null?void 0:v.value)||p.message,$exception_type:(y=L[0])==null?void 0:y.type,$exception_level:p.level,$exception_list:E,$sentry_event_id:p.event_id,$sentry_exception:p.exception,$sentry_exception_message:((b=L[0])==null?void 0:b.value)||p.message,$sentry_exception_type:(x=L[0])==null?void 0:x.type,$sentry_tags:p.tags};return a&&r&&(A.$sentry_url=(s||"https://sentry.io/organizations/")+a+"/issues/?project="+r+"&query="+p.event_id),h&&((T=t.exceptions)==null||T.sendExceptionEvent(A)),p}}class Iq{constructor(e,n,a,r,s,l){this.name=t6,this.setupOnce=function(c){c(n6(e,{organization:n,projectId:a,prefix:r,severityAllowList:s,sendExceptionsToPostHog:l==null||l}))}}}class nS{constructor(e){this.Ut=(n,a,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(be.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:r}),this.zt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Wt()}Wt(){var e;this.Vt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ut)}destroy(){var e;(e=this.Vt)==null||e.call(this),this.Vt=void 0}doPageView(e,n){var a,r=this.Zt(e,n);return this.zt={pathname:(a=Z?.location.pathname)!==null&&a!==void 0?a:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var n;return this.Zt(e,(n=this.zt)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.zt)==null?void 0:e.pageViewId}}Zt(e,n){var a=this.zt;if(!a)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:a.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var l=s.maxScrollHeight,c=s.lastScrollY,u=s.maxScrollY,h=s.maxContentHeight,p=s.lastContentY,m=s.maxContentY;if(!(ke(l)||ke(c)||ke(u)||ke(h)||ke(p)||ke(m))){l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h),p=Math.ceil(p),m=Math.ceil(m);var v=l>1?Br(c/l,0,1,be):1,y=l>1?Br(u/l,0,1,be):1,b=h>1?Br(p/h,0,1,be):1,x=h>1?Br(m/h,0,1,be):1;r=Bt(r,{$prev_pageview_last_scroll:c,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:b,$prev_pageview_max_content:m,$prev_pageview_max_content_percentage:x})}}return a.pathname&&(r.$prev_pageview_pathname=a.pathname),a.timestamp&&(r.$prev_pageview_duration=(e.getTime()-a.timestamp.getTime())/1e3),r}}var Bh=["flags","surveys"],Mq={[LE]:{exposure:"hidden"},[ld]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[cd]:{exposure:"hidden"},[ly]:{exposure:"event"},[cy]:{exposure:"hidden"},[dy]:{exposure:"event"},[uy]:{exposure:"hidden"},[hy]:{exposure:"event"},[py]:{exposure:"event"},[Eb]:{exposure:"event"},[Ab]:{exposure:"hidden"},[fy]:{exposure:"event"},[ao]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[yl]:{exposure:"hidden"},[Rb]:{exposure:"event"},[DE]:{exposure:"event",shouldSkipFromEventProperties:t=>la(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ys]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!qt(t))return{};for(var e={},n=Object.keys(t),a=0;n.length>a;a++)e["$feature/"+n[a]]=t[n[a]];return e}},[pp]:{exposure:"event",storageGroup:"flags"},[dd]:{exposure:"hidden"},[my]:{exposure:"hidden",storageGroup:"flags"},[fp]:{exposure:"event",storageGroup:"flags"},[gy]:{exposure:"event",storageGroup:"flags",volatile:!0},[bi]:{exposure:"event"},[ul]:{exposure:"hidden"},[Gs]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[vy]:{exposure:"hidden",storageGroup:"surveys"},[uf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[_y]:{exposure:"event"},[ud]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Sd]:{exposure:"hidden"},[yy]:{exposure:"hidden"},[by]:{exposure:"hidden"},[Vd]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[vr]:{exposure:"hidden"},[ky]:{exposure:"hidden"},[wy]:{exposure:"hidden"},[xy]:{exposure:"hidden"},[Py]:{exposure:"hidden"},[hf]:{exposure:"hidden"},[pf]:{exposure:"hidden"},[IE]:{exposure:"event"},[ME]:{exposure:"event"},[NE]:{exposure:"event"},[OE]:{exposure:"event"},[zE]:{exposure:"event"},[FE]:{exposure:"event"},[UE]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Nq=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Us=t=>{var e=Mq[t];if(e)return e;for(var n of Nq){var a=n[1];if(t.indexOf(n[0])===0)return a}},Wd=t=>{var e=xe?.createElement("a");return ke(e)?null:(e.href=t,e)},zl=function(t,e){for(var n,a=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;a.length>r;r++){var s=a[r].split("=");if(s[0]===e){n=s;break}}if(!it(n)||2>n.length)return"";var l=n[1];try{l=decodeURIComponent(l)}catch{be.error("Skipping decoding for malformed query param: "+l)}return l.replace(/\+/g," ")},Gd=function(t,e,n){if(!t||!e||!e.length)return t;for(var a=t.split("#"),r=a[1],s=(a[0]||"").split("?"),l=s[1],c=s[0],u=(l||"").split("&"),h=[],p=0;u.length>p;p++){var m=u[p].split("=");it(m)&&(e.includes(m[0])?h.push(m[0]+"="+n):h.push(u[p]))}var v=c;return l!=null&&(v+="?"+h.join("&")),r!=null&&(v+="#"+r),v},_f=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},a6=(t,e)=>t>=e&&J4(),r6=(t,e,n,a)=>{if(t===0){if(J4()){var r=e+1;return r===n&&a(),r}return e}return 0},$h="https?://(.*)",Fl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oq=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Fl],qd="<masked>",jq=["li_fat_id"];function i6(t,e,n){if(!xe)return{};var a,r=e?[...Fl,...n||[]]:[],s=s6(Gd(xe.URL,r,qd),t),l=(a={},Mt(jq,(function(c){var u=Fr.A(c);a[c]=u||null})),a);return Bt(l,s)}function s6(t,e){var n=Oq.concat(e||[]),a={};return Mt(n,(function(r){var s=zl(t,r);a[r]=s||null})),a}function o6(t){var e=(function(s){return s?s.search($h+"google.([^/?]*)")===0?"google":s.search($h+"bing.com")===0?"bing":s.search($h+"yahoo.com")===0?"yahoo":s.search($h+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",a={};if(!la(e)){a.$search_engine=e;var r=xe?zl(xe.referrer,n):"";r.length&&(a.ph_keyword=r)}return a}function aS(){return navigator.language||navigator.userLanguage}var yf="$direct";function l6(){return xe?.referrer||yf}function c6(t,e,n){n===void 0&&(n=!1);var a=t?[...Fl,...e||[]]:[],r=n?ms(fn?.href):fn?.href,s=r?.substring(0,1e3);return{r:l6().substring(0,1e3),u:s?Gd(s,a,qd):void 0}}function d6(t,e){var n;e===void 0&&(e=!1);var a=t.r,r=t.u,s=e?ms(r):r,l={$referrer:a,$referring_domain:a==null?void 0:a==yf?yf:(n=Wd(a))==null?void 0:n.host};if(s){l.$current_url=s;var c=Wd(s);l.$host=c?.host,l.$pathname=c?.pathname;var u=s6(s);Bt(l,u)}if(a){var h=o6(a);Bt(l,h)}return l}function u6(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zq(){try{return new Date().getTimezoneOffset()}catch{return}}var Fq={flags:Vd,surveys:uf},Uq=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],al="main";class Mv{constructor(e,n,a){if(a===void 0&&(a=!0),this.Gt={},this.Qt=!1,this.Jt=!1,this.Se=e,this.Kt=a,this.props={},this.Yt=!1,this.Xt=(s=>{var l="";return s.token&&(l=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+l+"_posthog"})(e),this.Nt=this.er(e),this.Jt=this.tr(e),this.load(),e.debug&&be.info("Persistence loaded",e.persistence,he({},this.props)),this.update_config(e,e,n),this.save(),Z){var r=()=>this.flush();tn(Z,"beforeunload",r,{capture:!1}),tn(Z,"pagehide",r,{capture:!1})}}rr(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Bn(n)&&n>0?n:0}isDisabled(){return!!this.ir}er(e){Uq.indexOf(e.persistence.toLowerCase())===-1&&(be.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,a=(function(l,c){l===void 0&&(l=[]),c===void 0&&(c=!1);var u=[...vq,...l];return he({},It,{F(h){try{var p={};try{p=Fr.F(h)||{}}catch{}var m,v=JSON.parse(It.A(h)||"{}");if(c){var y={};for(var b in p){var x=p[b];la(x)||x===""||(y[b]=x)}m=Bt(v,y)}else m=Bt(p,v);return It.q(h,m),m}catch{}return null},q(h,p,m,v,y,b){var x=It.q(h,p,void 0,void 0,b);try{var P={};u.forEach((T=>{p[T]&&(P[T]=p[T])})),Object.keys(P).length&&Fr.q(h,P,m,v,y,b)}catch(T){It.D(T)}return x},P(h,p){try{Z?.localStorage.removeItem(h),Fr.P(h,p)}catch(m){It.D(m)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&It.N()?(n=It,r=!0):s==="localstorage+cookie"&&a.N()?(n=a,r=!0):s==="sessionstorage"&&Fn.N()?n=Fn:s==="memory"?n=_q:s==="cookie"?n=Fr:a.N()?(n=a,r=!0):n=Fr,this.Qt=r,n}nr(e){return this.Xt+"__"+e}tr(e){return this.Qt&&!!e.split_storage}sr(e){var n=e??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var a=this.props[Vd];return!a||typeof a!="number"||Date.now()-a>n}properties(){var e={};return Mt(this.props,((n,a)=>{var r=Us(a);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(n,a===Ys?()=>this.sr():()=>!1))return;r.transformToEventProperties&&Bt(e,r.transformToEventProperties(n))}else if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(n,(()=>!1)))return;e[a]=n}})),e}load(){if(!this.ir){var e=this.Nt.F(this.Xt);e&&(this.props=Bt({},e)),this.Jt&&this.ar()}}ar(){for(var e of Bh){var n=It.F(this.nr(e));if(n&&!cs(n)){var a=this.lr(e);a.persisted=!0,this.ur(e)||(a.fingerprint=this.hr(n,e)),this.dr(e,n)||Bt(this.props,n)}}}ur(e){return Object.keys(this.props).some((n=>{var a;return((a=Us(n))==null?void 0:a.storageGroup)===e}))}dr(e,n){var a=Fq[e];if(!a)return!1;var r=n[a],s=this.props[a];return Bn(r)&&Bn(s)&&s>r}refreshKey(e){var n;if(!this.ir){var a=this.Jt?(n=Us(e))==null?void 0:n.storageGroup:void 0,r=a?It.F(this.nr(a)):this.Nt.F(this.Xt);if(r&&e in r)this.cr(e,r[e]);else{if(a){var s=this.Nt.F(this.Xt);if(s&&e in s)return void this.cr(e,s[e])}this.vr(e)}}}save(){if(!this.ir){var e=this.rr();e>0?ke(this.pr)&&(this.pr=setTimeout((()=>{this.pr=void 0,this.gr()}),e)):this.gr()}}flush(){ke(this.pr)||(clearTimeout(this.pr),this.pr=void 0,this.gr())}gr(){this.ir||(this.Jt?this.mr():this.yr(this.Nt,this.Xt,this.props,al))}mr(){var e=this.br(),n=e.main,a=e.groups;for(var r of(this.yr(this.Nt,this.Xt,n,al),Bh)){var s,l=a[r];(!cs(l)||(s=this.Gt[r])!=null&&s.persisted)&&this.yr(It,this.nr(r),l,r)}}br(){var e={},n={};for(var a of Bh)n[a]={};return Mt(this.props,((r,s)=>{var l,c=(l=Us(s))==null?void 0:l.storageGroup;c?n[c][s]=r:e[s]=r})),{main:e,groups:n}}hr(e,n){if(n===al)return JSON.stringify(e)+"|"+this._r+"|"+this.wr+"|"+this.kr;var a={};return Mt(e,((r,s)=>{var l;a[s]=(l=Us(s))!=null&&l.volatile?"__volatile__":r})),JSON.stringify(a)}yr(e,n,a,r){var s=this.lr(r);if(r===al||s.dirty||ke(s.fingerprint)){var l;try{if((l=this.hr(a,r))===s.fingerprint)return void(s.dirty=!1)}catch{l=void 0}e.q(n,a,this._r,this.wr,this.kr,this.Se.debug)?(s.dirty=!1,r!==al&&(s.persisted=!0),ke(l)||(s.fingerprint=l)):this.Se.debug&&be.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(e){var n=(e===void 0?{}:e).keepGroupEntries,a=n!==void 0&&n;if(ke(this.pr)||(clearTimeout(this.pr),this.pr=void 0),this.Nt.P(this.Xt,!1),this.Nt.P(this.Xt,!0),!a&&this.Kt)for(var r of Bh)It.P(this.nr(r));a?delete this.Gt[al]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,n,a){if(qt(e)){ke(n)&&(n="None"),this._r=ke(a)?this.Sr:a;var r=!1;if(Mt(e,((s,l)=>{this.props.hasOwnProperty(l)&&this.props[l]!==n||(this.cr(l,s),r=!0)})),r)return this.save(),!0}return!1}register(e,n){if(qt(e)){this._r=ke(n)?this.Sr:n;var a=!1;if(Mt(e,((r,s)=>{e.hasOwnProperty(s)&&this.props[s]!==r&&(this.cr(s,r),a=!0)})),a)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.vr(e),this.save())}update_campaign_params(){if(!this.Yt){var e=i6(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);cs(Db(e))||this.register(e),this.Yt=!0}}update_search_keyword(){var e;this.register((e=xe?.referrer)?o6(e):{})}update_referrer_info(){var e;this.register_once({$referrer:l6(),$referring_domain:xe!=null&&xe.referrer&&((e=Wd(xe.referrer))==null?void 0:e.host)||yf},void 0)}set_initial_person_info(){this.props[xy]||this.props[Py]||this.register_once({[hf]:c6(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Mt([Py,xy],(r=>{var s=this.props[r];s&&Mt(s,(function(l,c){e["$initial_"+ty(c)]=l}))}));var n=this.props[hf];if(n){var a=(function(r,s){s===void 0&&(s=!1);var l=d6(r,s),c={};return Mt(l,(function(u,h){c["$initial_"+ty(h)]=u})),c})(n,this.Se.disable_capture_url_hashes);Bt(e,a)}return e}safe_merge(e){return Mt(this.props,(function(n,a){a in e||(e[a]=n)})),e}update_config(e,n,a){this.Sr=this._r=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==n.persistence||!((u,h)=>{if(u.length!==h.length)return!1;var p=[...u].sort(),m=[...h].sort();return p.every(((v,y)=>v===m[y]))})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=r?this.er(e):this.Nt,l=this.tr(e);if(r||l!==this.Jt){var c=this.props;this.clear(),this.Nt=s,this.Jt=l,this.props=c,this.save()}}set_disabled(e){this.ir=e,this.ir?this.remove():this.save()}set_cross_subdomain(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.kr&&(this.kr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var a=this.props[cd]||{};a[e]=n,this.cr(cd,a),this.save()}remove_event_timer(e){var n=this.props[cd]||{},a=n[e];return ke(a)||(delete n[e],this.cr(cd,n),this.save()),a}get_property(e){return this.props[e]}set_property(e,n){this.cr(e,n),this.save()}cr(e,n){var a;this.props[e]=n,(a=Us(e))!=null&&a.volatile||this.Cr(e)}vr(e){delete this.props[e],this.Cr(e)}Cr(e){var n,a=(n=Us(e))==null?void 0:n.storageGroup;a&&(this.lr(a).dirty=!0)}lr(e){return this.Gt[e]||(this.Gt[e]={})}}var qc={Activation:"events",Cancellation:"cancelEvents"},Nv={Popover:"popover",API:"api",Widget:"widget"},Pi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Ov={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ey={Popover:"popover",Inline:"inline"},Bq={SHOWN:"product tour shown"},rS={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},iS=Zt("[RateLimiter]");class $q{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var a=n.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((r=>{iS.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void iS.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:a})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,a,r;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,l=this.captureEventsPerSecond,c=new Date().getTime(),u=(n=(a=this.instance.persistence)==null?void 0:a.get_property(wy))!==null&&n!==void 0?n:{tokens:s,last:c};u.tokens+=(c-u.last)/1e3*l,u.last=c,u.tokens>s&&(u.tokens=s);var h=1>u.tokens;return h||e||(u.tokens=Math.max(0,u.tokens-1)),!h||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+l+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=h,(r=this.instance.persistence)==null||r.set_property(wy,u),{isRateLimited:h,remainingTokens:u.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Kc=Zt("[RemoteConfig]");class h6{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Be._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Tr(e){var n,a;(n=Be.__PosthogExtensions__)!=null&&n.loadExternalDependency?(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ir(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return Kc.info("Using preloaded remote config",this.remoteConfig),this.Mr(this.remoteConfig),void this.Er();if(this._instance.Rr())return void Kc.warn("Remote config is disabled. Falling back to local config.");this.Tr((e=>{if(!e)return Kc.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ir((n=>{this.Mr(n),this.Er()}));this.Mr(e),this.Er()}))}catch(e){Kc.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}refresh(){!this._instance.Rr()&&xe&&xe.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Er(){var e;if(!this.Pr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Pr=setInterval((()=>{this.refresh()}),n))}}Mr(e){var n;e||Kc.error("Failed to fetch remote config from PostHog."),this._instance.Mr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var aa={GZipJS:"gzip-js",Base64:"base64"},Qa=Uint8Array,_a=Uint16Array,Ul=Uint32Array,Ob=new Qa([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),jb=new Qa([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),sS=new Qa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p6=function(t,e){for(var n=new _a(31),a=0;31>a;++a)n[a]=e+=1<<t[a-1];var r=new Ul(n[30]);for(a=1;30>a;++a)for(var s=n[a];n[a+1]>s;++s)r[s]=s-n[a]<<5|a;return[n,r]},f6=p6(Ob,2),Ay=f6[1];f6[0][28]=258,Ay[258]=28;for(var oS=p6(jb,0)[1],m6=new _a(32768),Yt=0;32768>Yt;++Yt){var rl=(43690&Yt)>>>1|(21845&Yt)<<1;m6[Yt]=((65280&(rl=(61680&(rl=(52428&rl)>>>2|(13107&rl)<<2))>>>4|(3855&rl)<<4))>>>8|(255&rl)<<8)>>>1}var Td=function(t,e,n){for(var a=t.length,r=0,s=new _a(e);a>r;++r)++s[t[r]-1];var l,c=new _a(e);for(r=0;e>r;++r)c[r]=c[r-1]+s[r-1]<<1;for(l=new _a(a),r=0;a>r;++r)l[r]=m6[c[t[r]-1]++]>>>15-t[r];return l},vo=new Qa(288);for(Yt=0;144>Yt;++Yt)vo[Yt]=8;for(Yt=144;256>Yt;++Yt)vo[Yt]=9;for(Yt=256;280>Yt;++Yt)vo[Yt]=7;for(Yt=280;288>Yt;++Yt)vo[Yt]=8;var bf=new Qa(32);for(Yt=0;32>Yt;++Yt)bf[Yt]=5;var Vq=Td(vo,9),Hq=Td(bf,5),g6=function(t){return(t/8>>0)+(7&t&&1)},v6=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var a=new(t instanceof _a?_a:t instanceof Ul?Ul:Qa)(n-e);return a.set(t.subarray(e,n)),a},fi=function(t,e,n){var a=e/8>>0;t[a]|=n<<=7&e,t[a+1]|=n>>>8},Yc=function(t,e,n){var a=e/8>>0;t[a]|=n<<=7&e,t[a+1]|=n>>>8,t[a+2]|=n>>>16},jv=function(t,e){for(var n=[],a=0;t.length>a;++a)t[a]&&n.push({s:a,f:t[a]});var r=n.length,s=n.slice();if(!r)return[new Qa(0),0];if(r==1){var l=new Qa(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort((function(D,B){return D.f-B.f})),n.push({s:-1,f:25001});var c=n[0],u=n[1],h=0,p=1,m=2;for(n[0]={s:-1,f:c.f+u.f,l:c,r:u};p!=r-1;)c=n[n[m].f>n[h].f?h++:m++],u=n[h!=p&&n[m].f>n[h].f?h++:m++],n[p++]={s:-1,f:c.f+u.f,l:c,r:u};var v=s[0].s;for(a=1;r>a;++a)s[a].s>v&&(v=s[a].s);var y=new _a(v+1),b=Ry(n[p-1],y,0);if(b>e){a=0;var x=0,P=b-e,T=1<<P;for(s.sort((function(D,B){return y[B.s]-y[D.s]||D.f-B.f}));r>a;++a){var L=s[a].s;if(e>=y[L])break;x+=T-(1<<b-y[L]),y[L]=e}for(x>>>=P;x>0;){var E=s[a].s;e>y[E]?x-=1<<e-y[E]++-1:++a}for(;a>=0&&x;--a){var A=s[a].s;y[A]==e&&(--y[A],++x)}b=e}return[new Qa(y),b]},Ry=function(t,e,n){return t.s==-1?Math.max(Ry(t.l,e,n+1),Ry(t.r,e,n+1)):e[t.s]=n},lS=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _a(++e),a=0,r=t[0],s=1,l=function(u){n[a++]=u},c=1;e>=c;++c)if(t[c]==r&&c!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)l(32754);s>2&&(l(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(l(r),--s;s>6;s-=6)l(8304);s>2&&(l(s-3<<5|8208),s=0)}for(;s--;)l(r);s=1,r=t[c]}return[n.subarray(0,a),e]},Zc=function(t,e){for(var n=0,a=0;e.length>a;++a)n+=t[a]*e[a];return n},Ly=function(t,e,n){var a=n.length,r=g6(e+2);t[r]=255&a,t[r+1]=a>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;a>s;++s)t[r+s+4]=n[s];return 8*(r+4+a)},cS=function(t,e,n,a,r,s,l,c,u,h,p){fi(e,p++,n),++r[256];for(var m=jv(r,15),v=m[0],y=m[1],b=jv(s,15),x=b[0],P=b[1],T=lS(v),L=T[0],E=T[1],A=lS(x),D=A[0],B=A[1],j=new _a(19),S=0;L.length>S;++S)j[31&L[S]]++;for(S=0;D.length>S;++S)j[31&D[S]]++;for(var N=jv(j,7),U=N[0],Q=N[1],ee=19;ee>4&&!U[sS[ee-1]];--ee);var ce,le,re,te,ie=h+5<<3,$=Zc(r,vo)+Zc(s,bf)+l,X=Zc(r,v)+Zc(s,x)+l+14+3*ee+Zc(j,U)+(2*j[16]+3*j[17]+7*j[18]);if($>=ie&&X>=ie)return Ly(e,p,t.subarray(u,u+h));if(fi(e,p,1+($>X)),p+=2,$>X){ce=Td(v,y),le=v,re=Td(x,P),te=x;var W=Td(U,Q);for(fi(e,p,E-257),fi(e,p+5,B-1),fi(e,p+10,ee-4),p+=14,S=0;ee>S;++S)fi(e,p+3*S,U[sS[S]]);p+=3*ee;for(var O=[L,D],Y=0;2>Y;++Y){var ae=O[Y];for(S=0;ae.length>S;++S)fi(e,p,W[_e=31&ae[S]]),p+=U[_e],_e>15&&(fi(e,p,ae[S]>>>5&127),p+=ae[S]>>>12)}}else ce=Vq,le=vo,re=Hq,te=bf;for(S=0;c>S;++S)if(a[S]>255){var _e;Yc(e,p,ce[257+(_e=a[S]>>>18&31)]),p+=le[_e+257],_e>7&&(fi(e,p,a[S]>>>23&31),p+=Ob[_e]);var fe=31&a[S];Yc(e,p,re[fe]),p+=te[fe],fe>3&&(Yc(e,p,a[S]>>>5&8191),p+=jb[fe])}else Yc(e,p,ce[a[S]]),p+=le[a[S]];return Yc(e,p,ce[256]),p+le[256]},Wq=new Ul([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gq=(function(){for(var t=new Ul(256),e=0;256>e;++e){for(var n=e,a=9;--a;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),zv=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function qq(t,e){e===void 0&&(e={});var n=(function(){var m=4294967295;return{p(v){for(var y=m,b=0;v.length>b;++b)y=Gq[255&y^v[b]]^y>>>8;m=y},d(){return 4294967295^m}}})(),a=t.length;n.p(t);var r,s,l,c,u,h=(c=10+((r=e).filename&&r.filename.length+1||0),u=8,(function(m,v,y,b,x,P){var T=m.length,L=new Qa(b+T+5*(1+Math.floor(T/7e3))+x),E=L.subarray(b,L.length-x),A=0;if(!v||8>T)for(var D=0;T>=D;D+=65535){var B=D+65535;T>B?A=Ly(E,A,m.subarray(D,B)):(E[D]=!0,A=Ly(E,A,m.subarray(D,T)))}else{for(var j=Wq[v-1],S=j>>>13,N=8191&j,U=(1<<y)-1,Q=new _a(32768),ee=new _a(U+1),ce=Math.ceil(y/3),le=2*ce,re=function(xr){return(m[xr]^m[xr+1]<<ce^m[xr+2]<<le)&U},te=new Ul(25e3),ie=new _a(288),$=new _a(32),X=0,W=0,O=(D=0,0),Y=0,ae=0;T>D;++D){var _e=re(D),fe=32767&D,ve=ee[_e];if(Q[fe]=ve,ee[_e]=fe,D>=Y){var Ne=T-D;if((X>7e3||O>24576)&&Ne>423){A=cS(m,E,0,te,ie,$,W,O,ae,D-ae,A),O=X=W=0,ae=D;for(var Oe=0;286>Oe;++Oe)ie[Oe]=0;for(Oe=0;30>Oe;++Oe)$[Oe]=0}var Ie=2,St=0,un=N,jt=fe-ve&32767;if(Ne>2&&_e==re(D-jt))for(var _t=Math.min(S,Ne)-1,Jt=Math.min(32767,D),nr=Math.min(258,Ne);Jt>=jt&&--un&&fe!=ve;){if(m[D+Ie]==m[D+Ie-jt]){for(var Mn=0;nr>Mn&&m[D+Mn]==m[D+Mn-jt];++Mn);if(Mn>Ie){if(Ie=Mn,St=jt,Mn>_t)break;var Vt=Math.min(jt,Mn-2),Xe=0;for(Oe=0;Vt>Oe;++Oe){var ot=D-jt+Oe+32768&32767,Dt=ot-Q[ot]+32768&32767;Dt>Xe&&(Xe=Dt,ve=ot)}}}jt+=(fe=ve)-(ve=Q[fe])+32768&32767}if(St){te[O++]=268435456|Ay[Ie]<<18|oS[St];var Et=31&Ay[Ie],Nn=31&oS[St];W+=Ob[Et]+jb[Nn],++ie[257+Et],++$[Nn],Y=D+Ie,++X}else te[O++]=m[D],++ie[m[D]]}}A=cS(m,E,!0,te,ie,$,W,O,ae,D-ae,A)}return v6(L,0,b+g6(A)+x)})(s=t,(l=e).level==null?6:l.level,l.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+l.mem,c,u)),p=h.length;return(function(m,v){var y=v.filename;if(m[0]=31,m[1]=139,m[2]=8,m[8]=2>v.level?4:v.level==9?2:0,m[9]=3,v.mtime!=0&&zv(m,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),y){m[3]=8;for(var b=0;y.length>=b;++b)m[b+10]=y.charCodeAt(b)}})(h,e),zv(h,p-8,n.d()),zv(h,p-4,a),h}var Kq=!!Q_||!!wb,_6="text/plain",gp=!1,Dy=(t,e)=>{var n=t.split("#"),a=n[1],r=n[0].split("?"),s=r[0],l=r[1];if(!l)return t;var c=l.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(c?"?"+c:"")+(a?"#"+a:"")},zb=function(t,e,n){var a;n===void 0&&(n=!0);var r=t.split("?"),s=r[0],l=r[1],c=he({},e),u=(a=l?.split("&").map((p=>{var m,v=p.split("="),y=v[0],b=n&&(m=c[y])!==null&&m!==void 0?m:v[1];return delete c[y],y+"="+b})))!==null&&a!==void 0?a:[],h=(function(p,m){var v,y;m===void 0&&(m="&");var b=[];return Mt(p,(function(x,P){ke(x)||ke(P)||P==="undefined"||(v=encodeURIComponent((T=>T instanceof File)(x)?x.name:x.toString()),y=encodeURIComponent(P),b[b.length]=y+"="+v)})),b.join(m)})(c);return h&&u.push(h),s+"?"+u.join("&")},bl=(t,e)=>{try{return JSON.stringify(t,((n,a)=>typeof a=="bigint"?a.toString():a),e)}catch{return eE(t)}},Fv=t=>{if(t.Lt)return t.Lt;var e=t.data,n=t.compression;if(e){if(n===aa.GZipJS){var a=qq((function(c,u){var h=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var p=new Qa(c.length+(c.length>>>1)),m=0,v=function(P){p[m++]=P},y=0;h>y;++y){if(m+5>p.length){var b=new Qa(m+8+(h-y<<1));b.set(p),p=b}var x=c.charCodeAt(y);128>x?v(x):2048>x?(v(192|x>>>6),v(128|63&x)):x>55295&&57344>x?(v(240|(x=65536+(1047552&x)|1023&c.charCodeAt(++y))>>>18),v(128|x>>>12&63),v(128|x>>>6&63),v(128|63&x)):(v(224|x>>>12),v(128|x>>>6&63),v(128|63&x))}return v6(p,0,m)})(bl(e)),{mtime:0});return{contentType:_6,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===aa.Base64){var r=(function(c){return c&&btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,((u,h)=>String.fromCharCode(parseInt(h,16)))))})(bl(e)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:bl(c)))(r);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var l=bl(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},y6=t=>{var e,n,a=()=>t.transport==="sendBeacon"?{url:zb(t.url,{compression:aa.Base64}),encodedBody:Fv(he({},t,{compression:aa.Base64,Lt:void 0}))}:{url:Dy(t.url,"compression"),encodedBody:Fv(he({},t,{compression:void 0,Lt:void 0}))};try{e=Fv(t)}catch(r){if(MP(t.compression,zl(t.url,"compression")))return be.error("Failed to gzip request body, sending uncompressed payload",r),a();throw r}return e&&MP(t.compression,zl(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?X_(new Uint8Array(n)):ArrayBuffer.isView(n)&&X_(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(gp=!0,a()):{url:t.url,encodedBody:e}},b6=t=>{try{return y6(t)}catch(e){return be.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},Yq=(function(){var t=cn((function*(e){var n=bl(e.data),a=yield(function(s,l,c){return ey.apply(this,arguments)})(n,en.DEBUG,{rethrow:!0});if(!a)return e;var r=yield a.arrayBuffer();return he({},e,{Lt:{contentType:_6,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),Zq=/Failed to fetch|NetworkError|Load failed/i,k6=t=>{var e,n=b6(t);if(n){var a=n.url,r=n.encodedBody,s=r??{},l=s.contentType,c=s.body,u=s.estimatedSize,h=new Headers;Mt(t.headers,(function(y,b){h.append(b,y)})),l&&h.append("Content-Type",l);var p=null,m=!1;if(TP){var v=new TP;p={signal:v.signal,timeout:setTimeout((()=>{var y,b;m=!0,v.abort((y=t.timeout,(b=new Error("PostHog request timed out"+(y?" after "+y+"ms":""))).name="AbortError",b))}),t.timeout)}}wb(a,he({method:t?.method||"GET",headers:h,keepalive:t.method==="POST"&&!t.Ft&&52428.8>(u||0),body:c,signal:(e=p)==null?void 0:e.signal},t.fetchOptions)).then((y=>y.text().then((b=>{var x={statusCode:y.status,text:b};if(y.status===200)try{x.json=JSON.parse(b)}catch(P){be.error(P)}t.callback==null||t.callback(x)})))).catch((y=>{m&&y?.name==="AbortError"||(b=>b?.name==="TypeError"&&Zq.test(b?.message||""))(y)?be.warn(y):be.error(y),t.callback==null||t.callback({statusCode:0,error:y})})).finally((()=>p?clearTimeout(p.timeout):null))}},Iy=t=>{try{var e=y6(t),n=e.url,a=e.encodedBody,r=a??{},s=r.body,l=r.estimatedSize;if(!s)return;var c=s instanceof Blob?s:new Blob([s],{type:r.contentType});if(sa.sendBeacon(n,c))return;if(it(t.data)&&t.data.length>1&&(l??0)>16384){var u=Math.ceil(t.data.length/2);return Iy(he({},t,{data:t.data.slice(0,u)})),void Iy(he({},t,{data:t.data.slice(u)}))}be.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),k6(he({},t,{Ft:!0}))}catch(h){be.warn("Beacon send failed",h)}},Jq=["/e/","/s/"],dS=(t,e)=>{var n=(r=>{var s=(l=>{var c=Wd(l),u=c?.pathname||l.split(/[?#]/)[0];return u?u[0]==="/"?u:"/"+u:"/"})(r);return Jq.some((l=>((c,u)=>c.slice(c.length-u.length)===u)(s,l)))})(t),a=n?Dy(t,"ver"):t;return zb(e===aa.GZipJS?Dy(a,"compression"):a,he({_:new Date().getTime().toString()},n?{}:{ver:en.JS_SDK_VERSION},e===aa.GZipJS?{}:{compression:e}))},vp=[];wb&&vp.push({transport:"fetch",method:k6}),Q_&&vp.push({transport:"XHR",method(t){var e=b6(t);if(e){var n=new Q_,a=e.encodedBody;n.open(t.method||"GET",e.url,!0);var r=a??{},s=r.contentType,l=r.body;Mt(t.headers,(function(c,u){n.setRequestHeader(u,c)})),s&&n.setRequestHeader("Content-Type",s),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(c)}},n.send(l)}}}),sa!=null&&sa.sendBeacon&&vp.push({transport:"sendBeacon",method:Iy});var My=3e3;class Qq{constructor(e,n){this.Or=!0,this.Lr=[],this.Fr=Br(n?.flush_interval_ms||My,250,5e3,be.createLogger("flush interval"),My),this.Ar=e}enqueue(e){this.Lr.push(e),this.$r||this.Nr()}unload(){this.Dr();var e=this.Lr.length>0?this.qr():{},n=Object.values(e);[...n.filter((a=>a.url.indexOf("/e")===0)),...n.filter((a=>a.url.indexOf("/e")!==0))].map((a=>{this.jr(he({},a,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.Nr()}Nr(){var e=this;this.Or||(this.$r=setTimeout((()=>{if(this.Dr(),this.Lr.length>0){var n=this.qr(),a=function(){var s=n[r],l=new Date().getTime();s.data&&it(s.data)&&Mt(s.data,(c=>{c.offset=Math.abs(c.timestamp-l),delete c.timestamp})),e.jr(s)};for(var r in n)a()}}),this.Fr))}jr(e){try{this.Ar(e)}catch(n){be.error(n)}}Dr(){clearTimeout(this.$r),this.$r=void 0}qr(){var e={};return Mt(this.Lr,(n=>{var a,r=n,s=(r?r.batchKey:null)||r.url;ke(e[s])&&(e[s]=he({},r,{data:[]})),(a=e[s].data)==null||a.push(r.data)})),this.Lr=[],e}}var Xq=["retriesPerformedSoFar"];class eK{constructor(e){this.Br=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.Ur=!0,!ke(Z)&&"onLine"in Z.navigator&&(this.Ur=Z.navigator.onLine,this.zr=()=>{this.Ur=!0,this.Wr()},this.Vr=()=>{this.Ur=!1},tn(Z,"online",this.zr),tn(Z,"offline",this.Vr))}get length(){return this.Lr.length}retriableRequest(e){var n=e.retriesPerformedSoFar,a=Q4(e,Xq);yi(n)&&(a.url=zb(a.url,{retry_count:n})),this._instance._send_request(he({},a,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(n??0))return void this.st(he({retriesPerformedSoFar:n},a));r.statusCode===0&&be.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}a.callback==null||a.callback(r)}}))}st(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var a=(function(l){var c=3e3*Math.pow(2,l),u=c/2,h=Math.min(18e5,c),p=Math.random()-.5;return Math.ceil(h+p*(h-u))})(n),r=Date.now()+a;this.Lr.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+a;navigator.onLine||(s+=" (Browser is offline)"),be.warn(s),this.Br||(this.Br=!0,this.Zr())}Zr(){if(this.Gr&&clearTimeout(this.Gr),this.Lr.length===0)return this.Br=!1,void(this.Gr=void 0);this.Gr=setTimeout((()=>{this.Ur&&this.Lr.length>0&&this.Wr(),this.Zr()}),this.Hr)}Wr(){var e=Date.now(),n=[],a=this.Lr.filter((s=>e>s.retryAt||(n.push(s),!1)));if(this.Lr=n,a.length>0)for(var r of a)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,ke(Z)||(this.zr&&(Z.removeEventListener("online",this.zr),this.zr=void 0),this.Vr&&(Z.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Lr)){var n=e.requestOptions;try{this._instance._send_request(he({},n,{transport:"sendBeacon"}))}catch(a){be.error(a)}}this.Lr=[]}}class tK{constructor(e){this.Qr=()=>{var n,a,r,s;this.Jr||(this.Jr={});var l=this.scrollElement(),c=this.scrollY(),u=l?Math.max(0,l.scrollHeight-l.clientHeight):0,h=c+(l?.clientHeight||0),p=l?.scrollHeight||0;this.Jr.lastScrollY=Math.ceil(c),this.Jr.maxScrollY=Math.max(c,(n=this.Jr.maxScrollY)!==null&&n!==void 0?n:0),this.Jr.maxScrollHeight=Math.max(u,(a=this.Jr.maxScrollHeight)!==null&&a!==void 0?a:0),this.Jr.lastContentY=h,this.Jr.maxContentY=Math.max(h,(r=this.Jr.maxContentY)!==null&&r!==void 0?r:0),this.Jr.maxContentHeight=Math.max(p,(s=this.Jr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get Kr(){return this._instance.config.scroll_root_selector}getContext(){return this.Jr}resetContext(){var e=this.Jr;return setTimeout(this.Qr,0),e}startMeasuringScrollPosition(){tn(Z,"scroll",this.Qr,{capture:!0}),tn(Z,"scrollend",this.Qr,{capture:!0}),tn(Z,"resize",this.Qr)}scrollElement(){if(!this.Kr)return Z?.document.documentElement;var e=it(this.Kr)?this.Kr:[this.Kr];for(var n of e){var a=Z?.document.querySelector(n);if(a)return a}}Yr(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.Kr){var a=this.scrollElement();return a&&a[n]||0}return Z?e==="y"?Z.scrollY||Z.pageYOffset||Z.document.documentElement.scrollTop||0:Z.scrollX||Z.pageXOffset||Z.document.documentElement.scrollLeft||0:0}scrollY(){return this.Yr("y")}scrollX(){return this.Yr("x")}}var nK=t=>c6(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);class uS{constructor(e,n,a,r){this.Xr=s=>{var l=this.ei();if(!l||l.sessionId!==s){var c={sessionId:s,props:this.ti(this._instance)};this.ri.register({[ky]:c})}},this._instance=e,this.ii=n,this.ri=a,this.ti=r||nK,this.ii.onSessionId(this.Xr)}ei(){return this.ri.props[ky]}getSetOnceProps(){var e,n=(e=this.ei())==null?void 0:e.props;return n?"r"in n?d6(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Mt(Db(this.getSetOnceProps()),((n,a)=>{a==="$current_url"&&(a="url"),e["$session_entry_"+ty(a)]=n})),e}}class Fb{constructor(){this.ni={}}on(e,n){return this.ni[e]||(this.ni[e]=[]),this.ni[e].push(n),()=>{this.ni[e]=this.ni[e].filter((a=>a!==n))}}emit(e,n){for(var a of this.ni[e]||[])a(n);for(var r of this.ni["*"]||[])r(e,n)}}var Jc=Zt("[SessionId]");class hS{on(e,n){return this.si.on(e,n)}constructor(e,n,a){var r;if(this.oi=null,this.ai=[],this.li=void 0,this.ui=!1,this.si=new Fb,this.hi=(h,p)=>!(!yi(h)||!yi(p))&&Math.abs(h-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===xi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ri=e.persistence,this.di=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=n||wi,this.fi=a||wi;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*Br(this.Se.session_idle_timeout_seconds||1800,60,36e3,Jc.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var l=Fn.F(this.gi),c=Fn.F(this.mi);l&&!c?this.di=l:Fn.P(this.gi),Fn.q(this.mi,!0)}if((r=this.Se.bootstrap)!=null&&r.sessionID)try{var u=(h=>{var p=this.Se.bootstrap.sessionID.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})();this.bi(this.Se.bootstrap.sessionID,new Date().getTime(),u)}catch(h){Jc.error("Invalid sessionID in bootstrap",h)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ke(this.ai)&&(this.ai=[]),this.ai.push(e),this.ci&&e(this.ci,this.di),()=>{this.ai=this.ai.filter((n=>n!==e))}}yi(){return this.Se.persistence!=="memory"&&!this.ri.ir&&Fn.N()}xi(e){e!==this.di&&(this.di=e,this.yi()&&Fn.q(this.gi,e))}ki(){return this.di?this.di:this.yi()?Fn.F(this.gi):null}Si(e){var n=this.oi;return!la(n)&&!la(e)&&5e3>Math.abs(e-n)}bi(e,n,a){var r=n!==this._sessionActivityTimestamp,s=!(e!==this.ci||a!==this._sessionStartTimestamp);this._sessionStartTimestamp=a,this._sessionActivityTimestamp=n,this.ci=e,s&&!r||s&&this.Si(n)||(this.oi=n,this.ri.register({[yl]:[n,e,a]}))}Ci(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return yi(n)&&n>0}Ti(){this.Ci()?this.ri.refreshKey(yl):(this.ri.flush(),this.ri.load())}Ii(){var e;if(!la(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.oi){this.Ti();var n=this.Mi();n[1]===this.ci&&n[2]===this._sessionStartTimestamp&&(this.oi=this._sessionActivityTimestamp,this.ri.register({[yl]:[this._sessionActivityTimestamp,(e=this.ci)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ri.flush())}}Ei(){var e=this.Mi()[0],n=yi(e)?e:0,a=yi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,a)}Ri(e){return this.Ti(),this.hi(e,this.Ei())}Mi(){var e=this.ri.props[yl];return it(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.oi=null,clearTimeout(this.Pi),this.Pi=void 0,this.bi(null,null,null)}destroy(){this.ui=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.li&&Z&&(Z.removeEventListener(mf,this.li,{capture:!1}),this.li=void 0),this.ai=[]}wi(){this.li=()=>{this.Ii(),this.yi()&&Fn.P(this.mi)},tn(Z,mf,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Se.cookieless_mode===xi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),r=this.Mi(),s=r[1],l=r[2],c=this.Ei(),u=this.ki(),h=yi(l)&&Math.abs(a-l)>864e5,p=!1,m=!1,v=!s,y=s,b=!v&&!e&&this.hi(a,c);if(b){(b=this.Ri(a))||Jc.info("cross-tab refresh kept the session alive",{sessionId:s});var x=this.Mi();s=x[1],l=x[2]}v||b||h?(s=this.vi(),u=this.fi(),Jc.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),l=a,p=!0):(u||(u=this.fi(),p=!0),(m=s!==y)&&(Jc.info("adopted cross-tab session id",{sessionId:s,windowId:u}),p=!0));var P=yi(c)&&e&&!h?c:a,T=yi(l)?l:new Date().getTime();this.xi(u),this.bi(s,P,T),e||this.pi();var L={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:m};return p&&this.ai.forEach((E=>E(s,u,L))),{sessionId:s,windowId:u,sessionStartTimestamp:T,changeReason:p?L:void 0,lastActivityTimestamp:c}}pi(){this.ui||(clearTimeout(this.Pi),this.Pi=setTimeout((()=>{if(!this.ui)if(this.Ri(new Date().getTime())){var e=this.ci;this.resetSessionId(),this.si.emit("forcedIdleReset",{idleSessionId:e})}else this.pi()}),1.1*this.sessionTimeoutMs))}}var w6=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&OP(n,e))return!0;try{var a=t?.userAgentData;if(a!=null&&a.brands&&a.brands.some((r=>OP(r?.brand,e))))return!0}catch{}return!!t.webdriver};function x6(){return(x6=cn((function*(){var t=sa?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e?.model;return Lt(n)&&n.length>0?n:void 0}catch(a){return void be.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",a)}}))).apply(this,arguments)}var kf=function(t,e){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function pS(t,e,n){return bl({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var P6={exact:(t,e)=>e.some((n=>t.some((a=>n===a)))),is_not:(t,e)=>e.every((n=>t.every((a=>n!==a)))),regex:(t,e)=>e.some((n=>t.some((a=>kf(n,a))))),not_regex:(t,e)=>e.every((n=>t.every((a=>!kf(n,a))))),icontains:(t,e)=>e.map(Vh).some((n=>t.map(Vh).some((a=>n.includes(a))))),not_icontains:(t,e)=>e.map(Vh).every((n=>t.map(Vh).every((a=>!n.includes(a))))),gt:(t,e)=>e.some((n=>{var a=parseFloat(n);return!isNaN(a)&&t.some((r=>a>parseFloat(r)))})),lt:(t,e)=>e.some((n=>{var a=parseFloat(n);return!isNaN(a)&&t.some((r=>a<parseFloat(r)))}))},Vh=t=>t.toLowerCase();function S6(t,e){return!t||Object.entries(t).every((n=>{var a=n[1],r=e?.[n[0]];if(ke(r)||la(r))return!1;var s=[String(r)],l=P6[a.operator];return!!l&&l(a.values,s)}))}var Ny="custom",fS="i.posthog.com",aK=/^\/static\//;class rK{constructor(e){this.Oi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+fS,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Oi[this.apiHost]||(this.Oi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ny),this.Oi[this.apiHost]}Li(e){if(aK.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var a=this.Li(n);if(a)return""+a+n}if(this.region===Ny)return this.apiHost+n;var r=fS+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function C6(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var Rt=Zt("[Surveys]"),T6="seenSurvey_",E6=t=>{try{var e=(n=>((a,r)=>""+T6+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(r))(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){Rt.error("Failed to persist survey seen state",n)}},iK=[Nv.Popover,Nv.Widget,Nv.API],sK={ignoreConditions:!1,ignoreDelay:!1,displayType:Ey.Popover},oK=Zt("[PostHog ExternalIntegrations]"),lK={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class cK{constructor(e){this._instance=e}Bt(e,n){var a;(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,e,(r=>{if(r)return oK.error("failed to load script",r);n()}))}startIfEnabledOrStop(){var e=this,n=function(){var s,l,c,u=a[0],h=a[1];!h||(s=Be.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.Bt(lK[u],(()=>{var p;(p=Be.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.start(e._instance)})),!h&&(l=Be.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[u]&&((c=Be.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[u])==null||c.stop())};for(var a of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;n()}}}var Ed={},Uv=0,wf=()=>{},mS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qc="Surveys module not available",gS="sanitize_properties is deprecated. Use before_send instead",A6="Invalid value for property_denylist config: ",pl="posthog",R6=!Kq&&va?.indexOf("MSIE")===-1&&va?.indexOf("Mozilla")===-1,vS=t=>{var e;return he({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:hq(xe?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:wf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:fn&&Lt(fn?.search)&&fn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(Z==null||(e=Z.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){be.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sy,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:My},error_tracking:{},_onCapture:wf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Pq,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(t))},dK=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],_S=t=>{var e={};for(var n of dK){var a=n[0],r=n[1];ke(t[a])||(e[r]=t[a])}var s=Bt({},e,t),l=t.__preview_external_dependency_versioned_paths;return ke(l)||(ke(t.strict_script_versioning)&&(s.strict_script_versioning=!!l),Lt(l)&&ke(t.asset_host)&&(s.asset_host=l)),it(t.property_blacklist)&&(ke(t.property_denylist)?s.property_denylist=t.property_blacklist:it(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:be.error(A6+t.property_denylist)),s};class uK{constructor(){this.__forceAllowLocalhost=!1}get Fi(){return this.__forceAllowLocalhost}set Fi(e){be.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Wa{Ai(e,n){if(e){var a=this.$i.indexOf(e);a!==-1&&this.$i.splice(a,1)}return this.$i.push(n),n.initialize==null||n.initialize(),n}Ni(){return this.config.cookieless_mode===xi||this.config.cookieless_mode===Ks&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new uK,this.Di=!1,this.version=en.LIB_VERSION,this.qi=new Fb,this.$i=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=vS(),this.SentryIntegration=Iq,this.sentryIntegration=a=>(function(r,s){var l=n6(r,s);return{name:t6,processEvent:c=>l(c)}})(this,a),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ji=!1,this.Bi=null,this.Hi=null,this.Ui=null,this.scrollManager=new tK(this),this.pageViewManager=new nS(this),this.rateLimiter=new $q(this),this.requestRouter=new rK(this),this.consent=new yq(this),this.externalIntegrations=new cK(this);var n=(e=Wa.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(a,r,s)=>{var l=Lt(a)?{[a]:r}:a;this.setPersonProperties(l),s?.({})},set_once:(a,r,s)=>{var l=Lt(a)?{[a]:r}:a;this.setPersonProperties(void 0,l),s?.({})}},this.on("eventCaptured",(a=>be.info('send "'+a?.event+'"',a)))}init(e,n,a){if(a&&a!==pl){var r,s=(r=Ed[a])!==null&&r!==void 0?r:new Wa;return s._init(e,n,a),Ed[a]=s,Ed[pl][a]=s,s}return this._init(e,n,a)}_init(e,n,a){var r,s;n===void 0&&(n={});var l=Lt(e)?e.trim():"";if(!l)return be.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.zi(n.debug),this.Wi=n,this.Vi=[],n.person_profiles?this.Hi=n.person_profiles:n.process_person&&(this.Hi=n.process_person);var c=vS(n.defaults),u=_S(n),h=Bt({},c,u,{name:a,token:l});qt(c.rageclick)&&qt(u.rageclick)&&(h.rageclick=Bt({},c.rageclick,u.rageclick)),qt(c.session_recording)&&qt(u.session_recording)&&(h.session_recording=Bt({},c.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&be.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:aa.GZipJS;var p=this.Zi();this.persistence=new Mv(this.config,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Mv(he({},this.config,{persistence:"sessionStorage"}),p,!1);var m=he({},this.persistence.props),v=he({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gi=new Qq((A=>this.Qi(A)),this.config.request_queue_config),this.Ji=new eK(this),this.__request_queue=[];var y=this.Ni();if(y||(this.sessionManager=new hS(this),this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(be.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ki(y)}),0)):(be.info("Initializing extensions synchronously"),this.Ki(y)),en.DEBUG=en.DEBUG||this.config.debug,en.DEBUG&&be.info("Starting in debug mode",{this:this,config:n,thisC:he({},this.config),p:m,s:v}),!this.config.identity_distinct_id||(r=n.bootstrap)!=null&&r.distinctID||(n.bootstrap=he({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var b=n.bootstrap.distinctID,x=this.get_distinct_id(),P=this.persistence.get_property(vr);if(n.bootstrap.isIdentifiedID&&x!=null&&x!==b&&P===tl)this.identify(b);else if(n.bootstrap.isIdentifiedID&&x!=null&&x!==b&&P===nl)be.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var T=this.config.get_device_id(wi()),L=n.bootstrap.isIdentifiedID?T:b;this.persistence.set_property(vr,n.bootstrap.isIdentifiedID?nl:tl),this.register({distinct_id:b,$device_id:L})}}if(y)this.register_once({distinct_id:jh,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(wi());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(vr,tl)}return tn(Z,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(A,D){var B=A.config.segment;if(!B)return D();(function(j,S){var N=j.config.segment;if(!N)return S();var U=ee=>{var ce=()=>ee.anonymousId()||wi();j.config.get_device_id=ce,ee.id()&&(j.register({distinct_id:ee.id(),$device_id:ce()}),j.persistence.set_property(vr,nl)),S()},Q=N.user();"then"in Q&&yr(Q.then)?Q.then(U):U(Q)})(A,(()=>{B.register((j=>{typeof Promise<"u"&&Promise.resolve||Iv.warn("This browser does not have Promise support, and can not use the segment integration");var S=(N,U)=>{if(!U)return N;N.event.userId||N.event.anonymousId===j.get_distinct_id()||(Iv.info("No userId set, resetting PostHog"),j.reset()),N.event.userId&&N.event.userId!==j.get_distinct_id()&&(Iv.info("UserId set, identifying with PostHog"),j.identify(N.event.userId));var Q=j.calculateEventProperties(U,N.event.properties);return N.event.properties=Object.assign({},Q,N.event.properties),N};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:N=>S(N,N.event.event),page:N=>S(N,hl),identify:N=>S(N,Rv),screen:N=>S(N,"$screen")}})(A)).then((()=>{D()}))}))})(this,(()=>this.Yi())):this.Yi(),yr(this.config._onCapture)&&this.config._onCapture!==wf&&(be.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(A=>this.config._onCapture(A.event,A)))),this.config.ip&&be.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return x6.apply(this,arguments)})().then((A=>{A&&this.register({[Ev]:A})})).catch(wf),this}Ki(e){var n,a,r,s,l,c,u,h,p=performance.now(),m=he({},Wa.__defaultExtensionClasses,this.config.__extensionClasses),v=[];m.featureFlags&&this.$i.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new m.featureFlags(this)),m.exceptions&&this.$i.push(this.exceptions=(a=this.exceptions)!==null&&a!==void 0?a:new m.exceptions(this)),m.historyAutocapture&&this.$i.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.$i.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.$i.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!e&&this.$i.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.$i.push(this.autocapture=new m.autocapture(this)),m.surveys&&this.$i.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this)),m.logs&&this.$i.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new m.logs(this)),m.metrics&&this.$i.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new m.metrics(this)),m.conversations&&this.$i.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new m.conversations(this)),m.productTours&&this.$i.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.$i.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.$i.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.$i.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.$i.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,Dq)),m.toolbar&&this.$i.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new m.toolbar(this)),m.experiments&&this.$i.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new m.experiments(this)),this.$i.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Xi){var y=this.Xi;this.Xi=void 0,this.Mr(y)}})),this.en(v,p)}en(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout((()=>{this.en(e,n)}),0);var a=e.shift();if(a)try{a()}catch(s){be.error("Error initializing extension:",s)}}var r=Math.round(performance.now()-n);this.register_for_session({[zE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[FE]:r}),this.config.__preview_deferred_init_extensions&&be.info("PostHog extensions initialized ("+r+"ms)")}Mr(e){var n;if(!xe||!xe.body)return be.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Mr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Xi=e),this.tn=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Ke(e.supportedCompression,aa.GZipJS)?aa.GZipJS:Ke(e.supportedCompression,aa.Base64)?aa.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Hi?this.Hi:Sy}),this.$i.forEach((a=>a.onRemoteConfig==null?void 0:a.onRemoteConfig(e)))}Yi(){try{this.config.loaded(this)}catch(a){be.critical("`loaded` function failed",a)}if(this.rn(),this.config.internal_or_test_user_hostname&&fn!=null&&fn.hostname){var e=fn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.nn()}),1),this.sn=new h6(this),this.sn.load()}rn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Gi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&zh(this.__request_queue,(e=>this.Qi(e))),this.__request_queue=[],this.rn()}_handle_unload(){var e,n,a,r,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.an()&&this.capture(Av),(a=this.logs)==null||a.flushLogs("sendBeacon"),(r=this.Gi)==null||r.unload(),(s=this.Ji)==null||s.unload()):this.an()&&this.capture(Av,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?R6?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=he({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(ke(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var a,r,s,l=he({},n);l.timeout=l.timeout||6e4;var c=(a=l.transport)!==null&&a!==void 0?a:"fetch";c==="sendBeacon"&&ke(l.compression)&&l.data&&(l.compression=aa.Base64),l.url=dS(l.url,l.compression);var u=vp.filter((p=>!l.disableTransport||!p.transport||!l.disableTransport.includes(p.transport))),h=(r=(s=(function(p,m){for(var v=0;p.length>v;v++)if(p[v].transport===c)return p[v]})(u))==null?void 0:s.method)!==null&&r!==void 0?r:u[0].method;if(!h)throw new Error("No available transport method");c!=="sendBeacon"&&l.data&&l.compression===aa.GZipJS&&mG&&typeof Promise<"u"&&!gp?Yq(l).then((p=>{h(p)})).catch((p=>{if(NP(p))return gp=!0,void h(he({},l,{compression:void 0,url:dS(n.url,void 0)}));(m=>{if(!m||typeof m!="object")return!1;var v="name"in m?String(m.name):"";return NP(m)||v===X4})(p)&&(gp=!0),h(l)})):h(l)})(he({},e,{callback:n=>{var a,r;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(r=this.config).on_request_error)==null||a.call(r,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Qi(e){this.Ji?this.Ji.retriableRequest(e):this._send_request(e)}_execute_array(e){Uv++;try{var n,a=[],r=[],s=[];zh(e,(c=>{if(c)if(it(n=c[0]))s.push(c);else if(yr(c))try{c.call(this)}catch(u){be.error("Error executing queued PostHog call",c,u)}else it(c)&&n==="alias"?a.push(c):it(c)&&n.indexOf("capture")!==-1&&yr(this[n])?s.push(c):r.push(c)}));var l=function(c,u){zh(c,(function(h){try{if(it(h[0])){var p=u;Mt(h,(function(m){p=p[m[0]].apply(p,m.slice(1))}))}else u[h[0]].apply(u,h.slice(1))}catch(m){be.error("Error executing queued PostHog call",h,m)}}))};l(a,this),l(r,this),l(s,this)}finally{Uv--}}push(e){if(Uv>0&&it(e)&&Lt(e[0])){var n=Wa.prototype[e[0]];yr(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,a){var r,s,l,c,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!ke(e)&&Lt(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var p=a!=null&&a.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(p==null||!p.isRateLimited){n!=null&&n.$current_url&&!Lt(n?.$current_url)&&(be.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||a!=null&&a.ln||be.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var m=new Date,v=a?.timestamp||m,y=UP(a?.uuid,wi),b={uuid:y,event:e,properties:this.calculateEventProperties(e,n||{},v,y)};e===hl&&this.config.__preview_capture_bot_pageviews&&h&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),p&&(b.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens),a?.$set&&(b.$set=a?.$set);var x=a?.$unset;x&&(b.$unset=x);var P,T,L,E=this.un(a?.$set_once,e!==WP,e===Rv);if(E&&(b.$set_once=E),a!=null&&a._noTruncate||(s=this.config.properties_string_max_length,l=b,c=U=>Lt(U)?U.slice(0,s):U,u=new Set,b=(function U(Q,ee){return Q!==Object(Q)?c?c(Q):Q:u.has(Q)?void 0:(u.add(Q),it(Q)?(ce=[],zh(Q,(le=>{ce.push(U(le))}))):(ce={},Mt(Q,((le,re)=>{u.has(le)||(ce[re]=U(le))}))),ce);var ce})(l)),b.timestamp=v,ke(a?.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=m),e===Pi.DISMISSED||e===Pi.SENT){var A=n?.[Ov.SURVEY_ID],D=n?.[Ov.SURVEY_ITERATION];E6({id:A,current_iteration:D}),b.$set=he({},b.$set,{[(P={id:A,current_iteration:D},T=e===Pi.SENT?"responded":"dismissed",L="$survey_"+T+"/"+P.id,P.current_iteration&&P.current_iteration>0&&(L="$survey_"+T+"/"+P.id+"/"+P.current_iteration),L)]:!0})}else e===Pi.SHOWN&&(b.$set=he({},b.$set,{[Ov.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Bq.SHOWN){var B=n?.[rS.TOUR_TYPE];B&&(b.$set=he({},b.$set,{[rS.TOUR_LAST_SEEN_DATE+"/"+B]:new Date().toISOString()}))}var j=he({},b.properties.$set,b.$set);if(cs(j)||this.setPersonPropertiesForFlags(j),!nt(this.config.before_send)){var S=this.it(b);if(!S)return;(b=S).uuid=UP(b.uuid,wi)}this.qi.emit("eventCaptured",b);var N={method:"POST",url:(r=a?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:b,compression:"best-available",batchKey:a?._batchKey,transport:a?.transport};return!this.config.request_batching||a&&(a==null||!a._batchKey)||a!=null&&a.send_instantly?this.Qi(N):this.Gi.enqueue(N),b}be.critical("This capture call is ignored due to client rate limiting.")}}else be.error("No event name provided to posthog.capture")}else be.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(n=>e(n.event,n)))}calculateEventProperties(e,n,a,r,s){if(a=a||new Date,!this.persistence||!this.sessionPersistence)return n;var l=s?void 0:this.persistence.remove_event_timer(e),c=he({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.Ni()&&(c.$cookieless_mode=!0),e==="$snapshot"){var u=he({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=u.distinct_id,(!Lt(c.distinct_id)&&!Bn(c.distinct_id)||ny(c.distinct_id))&&be.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=(function(T,L,E,A){var D,B,j,S;if(A===void 0&&(A=!1),!va)return{};var N,U,Q,ee,ce,le,re,te,ie,$=T?[...Fl,...L||[]]:[],X=(function(ae){for(var _e=0;zP.length>_e;_e++){var fe=zP[_e],ve=fe[1],Ne=fe[0].exec(ae),Oe=Ne&&(yr(ve)?ve(Ne,ae):ve);if(Oe)return Oe}return["",""]})(va),W=(N=typeof navigator<"u"?navigator:void 0)!=null&&N.brave?{brave:!0}:{},O={detectGoogleSearchApp:E},Y=Bt(Db({$os:X[0],$os_version:X[1],$browser:xE(va,navigator.vendor,W,O),$device:FP(va),$device_type:(Q=va,ee={userAgentDataPlatform:(D=navigator)==null||(D=D.userAgentData)==null?void 0:D.platform,maxTouchPoints:(B=navigator)==null?void 0:B.maxTouchPoints,screenWidth:Z==null||(j=Z.screen)==null?void 0:j.width,screenHeight:Z==null||(S=Z.screen)==null?void 0:S.height,devicePixelRatio:Z?.devicePixelRatio},ie=FP(Q),ie===iE||ie===rE||ie==="Kobo"||ie==="Kindle Fire"||ie===_E?Nl:ie===Bd||ie===Sl||ie===$d||ie===ry?"Console":ie===oE?"Wearable":ie?Da:ee?.userAgentDataPlatform==="Android"&&((ce=ee?.maxTouchPoints)!==null&&ce!==void 0?ce:0)>0?600>Math.min((le=ee?.screenWidth)!==null&&le!==void 0?le:0,(re=ee?.screenHeight)!==null&&re!==void 0?re:0)/((te=ee?.devicePixelRatio)!==null&&te!==void 0?te:1)?Da:Nl:"Desktop"),$timezone:u6(),$timezone_offset:zq()}),{$current_url:Gd(A?ms(fn?.href):fn?.href,$,qd),$host:fn?.host,$pathname:fn?.pathname,$raw_user_agent:va.length>1e3?va.substring(0,997)+"...":va,$browser_version:MG(va,navigator.vendor,W,O),$browser_language:aS(),$browser_language_prefix:(U=aS(),typeof U=="string"?U.split("-")[0]:void 0),$screen_height:Z?.screen.height,$screen_width:Z?.screen.width,$viewport_height:Z?.innerHeight,$viewport_width:Z?.innerWidth,$lib:en.LIB_NAME,$lib_version:en.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return en.SDK_DIST_CHANNEL&&(Y.$sdk_dist_channel=en.SDK_DIST_CHANNEL),Y})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var m=this.sessionManager.checkAndGetSessionAndWindowId(s,a.getTime()),v=m.windowId;c.$session_id=m.sessionId,c.$window_id=v}this.sessionPropsManager&&Bt(c,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Bt(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(y=this.Ji)==null?void 0:y.length}catch(T){c.$sdk_debug_error_capturing_properties=String(T)}if(this.requestRouter.region===Ny&&(c.$lib_custom_api_host=this.config.api_host),h=e!==hl||s?e!==Av||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(a):this.pageViewManager.doPageView(a,r),c=Bt(c,h),e===hl&&xe&&(c.title=xe.title),!ke(l)){var b=a.getTime()-l;c.$duration=parseFloat((b/1e3).toFixed(3))}va&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=Bt({},p,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),it(this.config.property_denylist)?Mt(this.config.property_denylist,(function(T){delete c[T]})):be.error(A6+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(be.error(gS),c=x(c,e));var P=this.hn();return c.$process_person_profile=P,P&&!s&&this.dn("_calculate_event_properties"),c}un(e,n,a){var r;if(n===void 0&&(n=!0),a===void 0&&(a=!1),!this.persistence||!this.hn()||this.Di&&!a)return e;var s=this.persistence.get_initial_props(),l=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),c=Bt({},s,l||{},e||{}),u=this.config.sanitize_properties;return u&&(be.error(gS),c=u(c,"$set_once")),n&&(this.Di=!0),cs(c)?void 0:c}register(e,n){var a;(a=this.persistence)==null||a.register(e,n)}register_once(e,n,a){var r;(r=this.persistence)==null||r.register_once(e,n,a)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}cn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var a;return(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,a){var r;(r=this.featureFlags)==null||r.updateFlags(e,n,a)}updateEarlyAccessFeatureEnrollment(e,n,a){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,n,a)}getEarlyAccessFeatures(e,n,a){var r;return n===void 0&&(n=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,n,a)}on(e,n){return this.qi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Qc}),()=>{})}onSessionId(e){var n,a;return(n=(a=this.sessionManager)==null?void 0:a.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Qc})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Qc})}renderSurvey(e,n){var a;(a=this.surveys)==null||a.renderSurvey(e,n)}displaySurvey(e,n){var a;n===void 0&&(n=sK),(a=this.surveys)==null||a.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,a;return(n=(a=this.surveys)==null?void 0:a.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Qc}}canRenderSurveyAsync(e,n){var a,r;return n===void 0&&(n=!1),(a=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,n))!==null&&a!==void 0?a:Promise.resolve({visible:!1,disabledReason:Qc})}vn(e){return!e||ny(e)?(be.critical("Unique user id has not been set in posthog.identify"),!1):e===jh?(be.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(be.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,a){if(!this.__loaded||!this.persistence)return be.uninitializedWarning("posthog.identify");if(Bn(e)&&(e=e.toString(),be.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.vn(e)&&this.dn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(df)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(ld)&&(this.unregister(ld),this.register({distinct_id:e}));var s,l=(this.persistence.get_property(vr)||tl)===tl;e!==r&&l?(this.persistence.set_property(vr,nl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:a||{}},!1),this.capture(Rv,{distinct_id:e,$anon_distinct_id:r},{$set:n||{},$set_once:a||{}}),this.Ui=pS(e,n,a),(s=this.featureFlags)==null||s.setAnonymousDistinctId(r)):(n||a)&&this.setPersonProperties(n,a),e!==r&&(this.reloadFeatureFlags(),this.unregister(Sd))}}setPersonProperties(e,n){if((e||n)&&this.dn("posthog.setPersonProperties")){var a=pS(this.get_distinct_id(),e,n);this.Ui!==a?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ui=a):be.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,a=(it(e)?e:[e]).filter((r=>Lt(r)&&r.length>0));a.length!==0&&this.dn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(a,!0),this.capture("$set",{$unset:a}),this.Ui=null)}group(e,n,a){if(e&&n){var r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:he({},r,{[e]:n})}),s||a){var l={$group_type:e,$group_key:n};a&&(l.$group_set=a),this.capture(WP,l)}a&&this.setGroupPropertiesForFlags({[e]:a}),s&&!a&&this.reloadFeatureFlags()}else be.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var a;n===void 0&&(n=!0),(a=this.featureFlags)==null||a.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var a;n===void 0&&(n=!0),this.dn("posthog.setGroupPropertiesForFlags")&&((a=this.featureFlags)==null||a.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,a,r,s,l,c,u,h,p,m;if(be.info("reset"),!this.__loaded)return be.uninitializedWarning("posthog.reset");var v,y=this.get_property(df),b=this.get_property(Ev),x=this.get_property(ao);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(a=this.sessionPersistence)==null||a.clear(),ke(x)||(v=this.persistence)==null||v.register({[ao]:x}),(r=this.surveys)==null||r.reset(),(s=this.sn)==null||s.stop(),(l=this.featureFlags)==null||l.reset(),(c=this.conversations)==null||c.reset(),(u=this.logs)==null||u.reset(),(h=this.metrics)==null||h.reset(),(p=this.persistence)==null||p.set_property(vr,tl),(m=this.sessionManager)==null||m.resetSessionId(),this.Ui=null,this.config.cookieless_mode===xi)this.register_once({distinct_id:jh,$device_id:null},"");else{var P=this.config.get_device_id(wi());this.register_once({distinct_id:P,$device_id:e?P:y},""),e||ke(b)||this.register({[Ev]:b})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var n=this;return cn((function*(){var a,r,s,l,c;n.__loaded?((a=n.logs)==null||a.flushLogs("sendBeacon"),(r=n.metrics)==null||r.flush("sendBeacon"),(s=n.Gi)==null||s.unload(),(l=n.Ji)==null||l.unload(),(c=n.featureFlags)==null||c.destroy()):be.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,n){var a;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(a=this.conversations)==null||a.fn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.pn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=n.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(e!=null&&e.withTimestamp&&a){var s,l=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!a)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-a)/1e3)-l,0)}return r}alias(e,n){return e===this.get_property(LE)?(be.critical("Attempting to create alias for existing People user - aborting."),-2):this.dn("posthog.alias")?(ke(n)&&(n=this.get_distinct_id()),e!==n?(this.cn(ld,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(be.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=he({},this.config);if(qt(e)){var a,r,s,l,c,u,h,p,m,v,y;Bt(this.config,_S(e));var b=this.Zi();(a=this.persistence)==null||a.update_config(this.config,n,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Mv(he({},this.config,{persistence:"sessionStorage"}),b,!1);var x=this.zi(this.config.debug);Hr(x)&&(this.config.debug=x),Hr(this.config.debug)&&(this.config.debug?(en.DEBUG=!0,It.N()&&It.q("ph_debug",!0),be.info("set_config",{config:e,oldConfig:n,newConfig:he({},this.config)})):(en.DEBUG=!1,It.N()&&It.P("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(l=this.sessionRecording)==null||l.startIfEnabledOrStop(),(c=this.tracingHeaders)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(h=this.heatmaps)==null||h.startIfEnabled(),(p=this.exceptionObserver)==null||p.startIfEnabledOrStop(),(m=this.deadClicksAutocapture)==null||m.startIfEnabledOrStop(),(v=this.surveys)==null||v.loadIfEnabled(),this.gn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){en.LIB_NAME=e,en.LIB_VERSION=n}startSessionRecording(e){var n,a,r,s,l,c=e===!0,u={sampling:c||!(e==null||!e.sampling),linked_flag:c||!(e==null||!e.linked_flag),url_trigger:c||!(e==null||!e.url_trigger),event_trigger:c||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),u.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var a=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:a});return this.exceptions.sendExceptionEvent(he({},r,n))}}addExceptionStep(e,n){var a;(a=this.exceptions)==null||a.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Wa.mn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,a;return(n=(a=this.toolbar)==null?void 0:a.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:pl;return n!==pl&&(n=pl+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(vr))===nl||((n=this.sessionPersistence)==null?void 0:n.get_property(vr))===nl}hn(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Sy&&!this._isIdentified()&&cs(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ld])&&((n=this.persistence)==null||(n=n.props)==null||!n[pf]))}an(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.hn()||this.dn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.dn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}dn(e){return this.config.person_profiles==="never"?(be.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.cn(pf,!0),!0)}Zi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ks)}gn(){var e,n,a,r,s=this.Zi();return((e=this.persistence)==null?void 0:e.ir)!==s&&((a=this.persistence)==null||a.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.ir)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s)),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==xi){if(this.Ni()){var a,r,s,l,c;this.reset(!0),(a=this.sessionManager)==null||a.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new hS(this),this.pageViewManager=new nS(this),this.persistence&&(this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence));var u,h=(s=(l=this.config.__extensionClasses)==null?void 0:l.sessionRecording)!==null&&s!==void 0?s:(c=Wa.__defaultExtensionClasses)==null?void 0:c.sessionRecording;h&&(this.sessionRecording=this.Ai(this.sessionRecording,new h(this)),this.tn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.tn)))}var p,m;this.consent.optInOut(!0),this.gn(),this.rn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Ks&&((p=this.surveys)==null||p.loadIfEnabled()),(ke(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((m=e?.captureEventName)!==null&&m!==void 0?m:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nn()}else be.warn(mS)}opt_out_capturing(){var e,n,a;this.config.cookieless_mode!==xi?(this.config.cookieless_mode===Ks&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.gn(),this.config.cookieless_mode===Ks&&(this.register({distinct_id:jh,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nn(),this.rn())):be.warn(mS)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===xi||(this.config.cookieless_mode===Ks?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.gn()}_is_bot(){return sa?w6(sa,this.config.custom_blocked_useragents):void 0}nn(){xe&&(xe.visibilityState==="visible"?this.ji||(this.ji=!0,this.capture(hl,{title:xe.title},{send_instantly:!0}),this.Bi&&(xe.removeEventListener(ff,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.nn.bind(this),tn(xe,ff,this.Bi)))}debug(e){e===!1?(Z?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Z?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Rr(){var e,n,a,r,s,l,c=this.Wi||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(be.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(a="advanced_disable_decide",r=be,s=(n="advanced_disable_flags")in(e=c)&&!nt(e[n]),l=a in e&&!nt(e[a]),s?e[n]:!!l&&(r&&r.warn("Config field '"+a+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[a]))}it(e){var n;if(nt(this.config.before_send))return e;var a=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(wG),r=it(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var l of r){if(s=l(s),nt(s)){var c="Event '"+e.event+"' was rejected in beforeSend function";return kG(e.event)?be.warn(c+". This can cause unexpected behavior."):be.info(c),null}s.properties&&!cs(s.properties)||be.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of a)if(s.properties&&nt(s.properties[u]))return be.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.zt)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,a){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(a)})}zi(e){var n=Hr(e)&&!e,a=It.N()&&It.A("ph_debug")==="true";return!n&&(!!a||e)}}Wa.__defaultExtensionClasses={},Wa.mn=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=dq(t.prototype[e[n]])})(Wa,["identify"]);class yS{constructor(e){this.disabled=e===!1;var n=qt(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,a){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(n-r.y)<this.thresholdPx&&this.timeoutMs>a-r.timestamp){if(this.clicks.push({x:e,y:n,timestamp:a}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:a}];return!1}}var Bv="$copy_autocapture",$v=Zt("[AutoCapture]");function Vv(t,e){return e.length>t?e.slice(0,t)+"...":e}function hK(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!gs(e));return e}function pK(t,e){var n,a,r=e.e,s=e.maskAllElementAttributes,l=e.maskAllText,c=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!gs(t))return{props:{}};for(var p=[t],m=new Set([t]),v=t;v.parentNode&&!Ra(v,"body")&&GE>p.length;)if(WE(v.parentNode)){var y=v.parentNode.host;if(m.has(y))break;m.add(y),p.push(y),v=y}else{if(!gs(v.parentNode)||m.has(v.parentNode))break;m.add(v.parentNode),p.push(v.parentNode),v=v.parentNode}var b,x,P=[],T={},L=!1,E=!1;if(Mt(p,(S=>{var N=Ty(S);if(Ra(S,"a")){var U=S.getAttribute("href");L=!!(N&&U&&Cd(U))&&(h?ms(U):U)}Ke(vf(S),"ph-no-capture")&&(E=!0),P.push((function(ee,ce,le,re,te){te===void 0&&(te=!1);var ie=ee.tagName.toLowerCase(),$={tag_name:ie};Mb.indexOf(ie)>-1&&!le&&($.$el_text=ie.toLowerCase()==="a"||ie.toLowerCase()==="button"?Vv(1024,XP(ee)):Vv(1024,Hd(ee)));var X=vf(ee);X.length>0&&($.classes=X.filter((function(ae){return ae!==""}))),Mt(ee.attributes,(function(ae){var _e;if((!JE(ee)||["name","id","class","aria-label"].indexOf(ae.name)!==-1)&&(re==null||!re.includes(ae.name))&&!ce&&Cd(ae.value)&&(!Lt(_e=ae.name)||_e.substring(0,10)!=="_ngcontent"&&_e.substring(0,7)!=="_nghost")){var fe=ae.value;ae.name==="class"&&(fe=Ib(fe).join(" ")),$["attr__"+ae.name]=Vv(1024,ae.name==="href"&&te?ms(fe):fe)}}));for(var W=1,O=1,Y=ee;Y=hK(Y);)W++,Y.tagName===ee.tagName&&O++;return $.nth_child=W,$.nth_of_type=O,$})(S,s,l,c,h));var Q=(function(ee){if(!Ty(ee))return{};var ce={};return Mt(ee.attributes,(function(le){if(le.name&&le.name.indexOf("data-ph-capture-attribute")===0){var re=le.name.replace("data-ph-capture-attribute-",""),te=le.value;re&&te&&Cd(te)&&(ce[re]=te)}})),ce})(S);Bt(T,Q)})),E)return{props:{},explicitNoCapture:E};if(l||(P[0].$el_text=Ra(t,"a")||Ra(t,"button")?XP(t):Hd(t)),L){var A,D;P[0].attr__href=L;var B=(A=Wd(L))==null?void 0:A.host,j=Z==null||(D=Z.location)==null?void 0:D.host;B&&j&&B!==j&&(b=L)}return{props:Bt({$event_type:r.type,$ce_version:1},u?{}:{$elements:P},{$elements_chain:(x=P,(function(S){return S.map((N=>{var U,Q,ee="";if(N.tag_name&&(ee+=N.tag_name),N.attr_class)for(var ce of(N.attr_class.sort(),N.attr_class))ee+="."+ce.replace(/"/g,"");var le=he({},N.text?{text:N.text}:{},{"nth-child":(U=N.nth_child)!==null&&U!==void 0?U:0,"nth-of-type":(Q=N.nth_of_type)!==null&&Q!==void 0?Q:0},N.href?{href:N.href}:{},N.attr_id?{attr_id:N.attr_id}:{},N.attributes),re={};return mp(le).sort(((te,ie)=>te[0].localeCompare(ie[0]))).forEach((te=>{var ie=te[1];return re[eS(te[0].toString())]=eS(ie.toString())})),(ee+=":")+mp(re).map((te=>te[0]+'="'+te[1]+'"')).join("")})).join(";")})((function(S){return S.map((N=>{var U,Q,ee={text:(U=N.$el_text)==null?void 0:U.slice(0,400),tag_name:N.tag_name,href:(Q=N.attr__href)==null?void 0:Q.slice(0,2048),attr_class:Rq(N),attr_id:N.attr__id,nth_child:N.nth_child,nth_of_type:N.nth_of_type,attributes:{}};return mp(N).filter((ce=>ce[0].indexOf("attr__")===0)).forEach((ce=>ee.attributes[ce[0]]=ce[1])),ee}))})(x)))},(n=P[0])!=null&&n.$el_text?{$el_text:(a=P[0])==null?void 0:a.$el_text}:{},b&&r.type==="click"?{$external_click_url:b}:{},T)}}var Xc=Zt("[ExceptionAutocapture]"),bS=()=>{},fK=Zt("[TracingHeaders]"),Bs=Zt("[Web Vitals]"),kS=9e5,wS="disabled",xS="lazy_loading",ed="awaiting_config",Hh="missing_config";Zt("[SessionRecording]"),Zt("[SessionRecording]");var Oy="[SessionRecording]",mi=Zt(Oy),mK=Zt("[Heatmaps]");function PS(t){return qt(t)&&"clientX"in t&&"clientY"in t&&Bn(t.clientX)&&Bn(t.clientY)}var Hv=Zt("[Product Tours]"),Wv=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Ab))},gK=["$set_once","$set"],Mr=Zt("[SiteApps]"),SS="Error while initializing PostHog app with config id ";function il(t,e,n){if(nt(t))return!1;switch(n){case"exact":return t===e;case"contains":var a=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(a,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class vK{constructor(e){this.yn=new Fb,this.bn=(n,a)=>this._n(n,a)&&this.wn(n,a)&&this.xn(n,a)&&this.kn(n,a),this._n=(n,a)=>a==null||!a.event||n?.event===a?.event,this._instance=e,this.Sn=new Set,this.Cn=new Set}init(){var e,n;ke((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((a,r)=>{this.on(a,r)}))}register(e){var n,a;if(!ke((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach((l=>{var c,u;(c=this.Cn)==null||c.add(l),(u=l.steps)==null||u.forEach((h=>{var p;(p=this.Sn)==null||p.add(h?.event||"")}))})),(a=this._instance)!=null&&a.autocapture)){var r,s=new Set;e.forEach((l=>{var c;(c=l.steps)==null||c.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(s)}}on(e,n){var a;n!=null&&e.length!=0&&(this.Sn.has(e)||this.Sn.has(n?.event))&&this.Cn&&((a=this.Cn)==null?void 0:a.size)>0&&this.Cn.forEach((r=>{this.Tn(n,r)&&this.yn.emit("actionCaptured",r.name)}))}In(e){this.onAction("actionCaptured",(n=>e(n)))}Tn(e,n){if(n?.steps==null)return!1;for(var a of n.steps)if(this.bn(e,a))return!0;return!1}onAction(e,n){return this.yn.on(e,n)}wn(e,n){if(n!=null&&n.url){var a,r=e==null||(a=e.properties)==null?void 0:a.$current_url;if(!r||typeof r!="string"||!il(r,n.url,n.url_matching||"contains"))return!1}return!0}xn(e,n){return!!this.Mn(e,n)&&!!this.En(e,n)&&!!this.Rn(e,n)}Mn(e,n){var a;if(n==null||!n.href)return!0;var r=this.Pn(e);if(r.length>0)return r.some((c=>il(c.href,n.href,n.href_matching||"exact")));var s,l=(e==null||(a=e.properties)==null?void 0:a.$elements_chain)||"";return!!l&&il((s=l.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}En(e,n){var a;if(n==null||!n.text)return!0;var r=this.Pn(e);if(r.length>0)return r.some((h=>il(h.text,n.text,n.text_matching||"exact")||il(h.$el_text,n.text,n.text_matching||"exact")));var s,l,c,u=(e==null||(a=e.properties)==null?void 0:a.$elements_chain)||"";return!!u&&(s=(function(h){for(var p,m=[],v=/(?::|")text="(.*?)"/g;!nt(p=v.exec(h));)m.includes(p[1])||m.push(p[1]);return m})(u),l=n.text,c=n.text_matching||"exact",s.some((h=>il(h,l,c))))}Rn(e,n){var a,r;if(n==null||!n.selector)return!0;var s=e==null||(a=e.properties)==null?void 0:a.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(n.selector_regex&&l)try{return new RegExp(n.selector_regex).test(l)}catch{return!1}return!1}Pn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}kn(e,n){return n==null||!n.properties||n.properties.length===0||S6(n.properties.reduce(((a,r)=>{var s=it(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return a[r.key]={values:s,operator:r.operator||"exact"},a}),{}),e?.properties)}}class _K{constructor(e){this.On=[],this._instance=e,this.Ln=new Map,this.Fn=new Map,this.An=new Map}$n(e,n){return!!e&&S6(e.propertyFilters,n?.properties)}Nn(e,n){var a=new Map;return e.forEach((r=>{var s;(s=r.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach((l=>{if(l!=null&&l.name){var c=a.get(l.name)||[];c.push(r.id),a.set(l.name,c)}}))})),a}Dn(e,n,a){var r=(a===qc.Activation?this.Ln:this.Fn).get(e),s=[];return this.qn((l=>{s=l.filter((c=>r?.includes(c.id)))})),s.filter((l=>{var c,u=(c=l.conditions)==null||(c=c[a])==null||(c=c.values)==null?void 0:c.find((h=>h.name===e));return this.$n(u,n)}))}register(e){var n;ke((n=this._instance)==null?void 0:n._addCaptureHook)||(this.jn(e),this.Bn(e))}Bn(e){var n=e.filter((a=>{var r,s;return((r=a.conditions)==null?void 0:r.actions)&&((s=a.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));n.length!==0&&(this.Hn==null&&(this.Hn=new vK(this._instance),this.Hn.init(),this.Hn.In((a=>{this.onAction(a)}))),n.forEach((a=>{var r,s,l,c,u;a.conditions&&(r=a.conditions)!=null&&r.actions&&(s=a.conditions)!=null&&(s=s.actions)!=null&&s.values&&((l=a.conditions)==null||(l=l.actions)==null||(l=l.values)==null?void 0:l.length)>0&&((c=this.Hn)==null||c.register(a.conditions.actions.values),(u=a.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((h=>{if(h&&h.name){var p=this.An.get(h.name);p&&p.push(a.id),this.An.set(h.name,p||[a.id])}})))})))}jn(e){var n,a=e.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.events)&&((c=s.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),r=e.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.cancelEvents)&&((c=s.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}));a.length===0&&r.length===0||((n=this._instance)==null||n._addCaptureHook(((s,l)=>{this.onEvent(s,l)})),this.Ln=this.Nn(e,qc.Activation),this.Fn=this.Nn(e,qc.Cancellation))}onEvent(e,n){var a,r,s=this.Un(),l=(n==null||(a=n.properties)==null?void 0:a.$survey_id)||(n==null||(r=n.properties)==null?void 0:r.$product_tour_id);if(l&&this.getActivatedIds().includes(l)){var c=this.zn(e,l);if(c==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:l}),void this.Wn([l]);if(c==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:l}),void this.Vn(l)}if(this.Fn.has(e)){var u=this.Dn(e,n,qc.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((p=>p.id))}),this.Wn(u.map((p=>p.id))),u.forEach((p=>this.Zn(p.id))))}if(this.Ln.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.Ln.get(e)});var h=this.Dn(e,n,qc.Activation);this.Gn(h.map((p=>p.id)))}}onAction(e){this.An.has(e)&&this.Gn(this.An.get(e)||[])}Gn(e){e.length!==0&&(this.On=[...new Set([...this.On,...e])],this.Un().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.On=this.On.filter((a=>a!==e));var n=this.Qn();n.includes(e)||this.Jn([...n,e])}Wn(e){var n=new Set(e);this.On=this.On.filter((s=>!n.has(s)));var a=this.Qn(),r=a.filter((s=>!n.has(s)));r.length!==a.length&&this.Jn(r)}Qn(){var e,n=this.Kn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getActivatedIds(){return[...new Set([...this.Qn(),...this.On])].filter((e=>!this.Yn(e)))}reset(){this.On=[],this.Qn().length>0&&this.Jn([])}getEventToItemsMap(){return this.Ln}Xn(){return this.Hn}}class yK extends _K{constructor(e){super(e)}Kn(){return _y}es(){return Pi.SHOWN}qn(e){var n;(n=this._instance)==null||n.getSurveys(e)}Zn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}Un(){return Rt}Jn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[_y]:e})}Yn(){return!1}zn(e,n){var a;this.qn((s=>{a=s.find((l=>l.id===n))}));var r=!a||(function(s){var l;return C6(s)&&!((l=s.conditions)==null||(l=l.events)==null||!l.repeatedActivation)||s.schedule==="always"})(a);return r?e===Pi.SHOWN?"consume":"ignore":e===Pi.SHOWN?"persist":e===Pi.DISMISSED||e===Pi.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Gv="SDK is not enabled or survey functionality is not yet loaded",CS="Disabled. Not loading surveys.",bK=Z!=null&&Z.location?_f(Z.location.hash,"__posthog")||_f(location.hash,"state"):null,TS="_postHogToolbarParams",ES=Zt("[Toolbar]"),gn=Zt("[FeatureFlags]"),$s=Zt("[FeatureFlags]",{debugEnabled:!0}),qv=`" failed. Feature flags didn't load in time.`,AS=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},RS=t=>{var e={};for(var n of mp(t||{})){var a=n[1];a&&(e[n[0]]=a)}return e},gi=Zt("[Error tracking]"),LS="Refusing to render web experiment since the viewer is a likely bot",kK={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>kf(e,t),not_regex:(t,e)=>!kf(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Zn{get Se(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(a){a===void 0&&(a=!1),n.getWebExperiments((r=>{Zn.ts("retrieved web experiments from the server"),n.rs=new Map,r.forEach((s=>{if(s.feature_flag_key){var l;n.rs&&(Zn.ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(l=n.rs)==null||l.set(s.feature_flag_key,s));var c=n._instance.getFeatureFlag(s.feature_flag_key);Lt(c)&&s.variants[c]&&n.ns(s.name,c,s.variants[c].transforms)}else if(s.variants)for(var u in s.variants){var h=s.variants[u];Zn.ss(h,n._instance)&&n.ns(s.name,u,h.transforms)}}))}),a)},this._instance=e,this._instance.onFeatureFlags((a=>{this.onFeatureFlags(a)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Zn.ts(LS);else if(!this.Se.disable_web_experiments){if(nt(this.rs))return this.rs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zn.ts("applying feature flags",e),e.forEach((n=>{var a;if(this.rs&&(a=this.rs)!=null&&a.has(n)){var r,s=this._instance.getFeatureFlag(n),l=(r=this.rs)==null?void 0:r.get(n);s&&l!=null&&l.variants[s]&&this.ns(l.name,s,l.variants[s].transforms)}}))}}previewWebExperiment(){var e=Zn.getWindowLocation();if(e!=null&&e.search){var n=zl(e?.search,"__experiment_id"),a=zl(e?.search,"__experiment_variant");n&&a&&(Zn.ts("previewing web experiments "+n+" && "+a),this.getWebExperiments((r=>{this.os(parseInt(n),a,r)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,a){if(this.Se.disable_web_experiments&&!a)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!n)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}os(e,n,a){var r=a.filter((s=>s.id===e));r&&r.length>0&&(Zn.ts("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.ns(r[0].name,n,r[0].variants[n].transforms))}static ss(e,n){return!nt(e.conditions)&&Zn.ls(e,n)&&Zn.us(e)}static ls(e,n){var a;if(nt(e.conditions)||nt((a=e.conditions)==null?void 0:a.url))return!0;var r=Zn.getWindowLocation();if(r){var s,l,c,u=VE(n,r.href);return(s=e.conditions)==null||!s.url||kK[(l=(c=e.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return Z?.location}static us(e){var n;if(nt(e.conditions)||nt((n=e.conditions)==null?void 0:n.utm))return!0;var a=i6();if(a.utm_source){var r,s,l,c,u,h,p,m,v=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==a.utm_campaign,y=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_source||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_source)==a.utm_source,b=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==a.utm_medium,x=(p=e.conditions)==null||(p=p.utm)==null||!p.utm_term||((m=e.conditions)==null||(m=m.utm)==null?void 0:m.utm_term)==a.utm_term;return v&&b&&x&&y}return!1}static ts(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;n>r;r++)a[r-1]=arguments[r];be.info("[WebExperiments] "+e,a)}ns(e,n,a){this._is_bot()?Zn.ts(LS):n!=="control"?a.forEach((r=>{if(r.selector){var s;Zn.ts("applying transform of variant "+n+" for experiment "+e+" ",r);var l=(s=document)==null?void 0:s.querySelectorAll(r.selector);l?.forEach((c=>{var u=c;r.html&&(u.innerHTML=r.html),r.css&&u.setAttribute("style",r.css)}))}})):Zn.ts("Control variants leave the page unmodified.")}_is_bot(){return sa&&this._instance?w6(sa,this.Se.custom_blocked_useragents):void 0}}var Ba=Zt("[Conversations]"),Vs="Conversations not available yet.",DS="console",Kf={featureFlags:class{constructor(t){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=!1,this.bs=0,this._s=()=>{var e=this.ws();this.bs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],Z&&tn(Z,"online",this._s)}destroy(){Z?.removeEventListener("online",this._s)}get Se(){return this._instance.config}get ri(){return this._instance.persistence}xs(t){return this._instance.get_property(t)}ks(){var t,e;return(t=(e=this.ri)==null?void 0:e.sr(this.Se.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ss(){return!!this.ks()&&(this.ys||this.cs||(this.ys=!0,gn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Cs(){var t,e=(t=this.Se.evaluation_contexts)!==null&&t!==void 0?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.gs||(gn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.gs=!0),e!=null&&e.length?e.filter((n=>{var a=n&&typeof n=="string"&&n.trim().length>0;return a||gn.error("Invalid evaluation context found:",n,"Expected non-empty string"),a})):[]}Ts(){return this.Cs().length>0}Is(){var t=this.Se.flag_keys;if(!ke(t)){if(it(t))return t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||gn.error("Invalid flag key found:",e,"Expected non-empty string"),n}));gn.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,n=this._instance.config,a=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(a).length){var r,s,l=(r=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&r!==void 0?r:{},c=Object.keys(a).filter((h=>!!a[h])).reduce(((h,p)=>(h[p]=a[p]||!1,h)),{}),u=Object.keys(l).filter((h=>c[h])).reduce(((h,p)=>(l[p]&&(h[p]=l[p]),h)),{});this.receivedFeatureFlags({featureFlags:c,featureFlagPayloads:u})}}updateFlags(t,e,n){var a,r,s=n!=null&&n.merge&&(a=this.xs(Ys))!==null&&a!==void 0?a:{},l=n!=null&&n.merge&&(r=this.xs(fp))!==null&&r!==void 0?r:{},c=he({},s,t),u=he({},l,e),h={};for(var p of Object.entries(c)){var m=p[0],v=p[1];h[m]={key:m,enabled:LP(v),variant:DP(v),reason:void 0,metadata:ke(u?.[m])?void 0:{id:0,version:void 0,description:void 0,payload:u[m]}}}this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.ds}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.xs(my),e=this.xs(bi),n=this.xs(ul);if(!n&&!e)return t||{};var a=Bt({},t||{}),r=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of r){var l,c,u=a[s],h=e?.[s],p=ke(h)?(l=u?.enabled)!==null&&l!==void 0&&l:!!h,m=ke(h)?u.variant:typeof h=="string"?h:void 0,v=n?.[s],y=he({},u,{enabled:p,variant:p?m??u?.variant:void 0});p!==u?.enabled&&(y.original_enabled=u?.enabled),m!==u?.variant&&(y.original_variant=u?.variant),v&&(y.metadata=he({},u?.metadata,{payload:v,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),a[s]=y}return this.hs||(gn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:a}),this.hs=!0),a}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((n=>{var a=t[n];return{key:n,enabled:LP(a),variant:DP(a),payload:RP(e[n])}}))}getFlagVariants(){var t=this.xs(Ys),e=this.xs(bi);if(!e)return t||{};for(var n=Bt({},t),a=Object.keys(e),r=0;a.length>r;r++)n[a[r]]=e[a[r]];return this.hs||(gn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.hs=!0),n}getFlagPayloads(){var t=this.xs(fp),e=this.xs(ul);if(!e)return t||{};for(var n=Bt({},t||{}),a=Object.keys(e),r=0;a.length>r;r++)n[a[r]]=e[a[r]];return this.hs||(gn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.hs=!0),n}reloadFeatureFlags(){this.vs||this.Se.advanced_disable_feature_flags||this.ws()||this.Ms||(this._instance.qi.emit("featureFlagsReloading",!0),this.Ms=setTimeout((()=>{this.Es()}),5))}Rs(){clearTimeout(this.Ms),this.Ms=void 0}ensureFlagsLoaded(){this.ds||this.cs||this.Ms||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.vs=t}Es(t){var e;if(this.Rs(),!this._instance.Rr()&&!this.ws())if(this.cs)this.fs=!0;else{var n=this.Se.token,a=this.xs(df),r={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:he({},((e=this.ri)==null?void 0:e.get_initial_props())||{},this.xs(Gs)||{}),group_properties:this.xs(qs),timezone:u6()};la(a)||ke(a)||(r.$device_id=a),(t!=null&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Ts()&&(r.evaluation_contexts=this.Cs());var s=this.Is();ke(s)||(r.flag_keys=s);var l=!!this.Se.advanced_only_evaluate_survey_feature_flags,c=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.cs=!0,this._instance._send_request({method:"POST",url:c,data:r,compression:this.Se.disable_compression?void 0:aa.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:u=>{var h,p,m,v=!0;if(this.Ps(u.statusCode),u.statusCode===200&&(this.fs||(this.$anon_distinct_id=void 0),v=!1),this.cs=!1,!r.disable_flags||this.fs){this.ps=!v;var y=[];u.error?u.error instanceof Error?y.push(u.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):u.statusCode!==200&&y.push("api_error_"+u.statusCode),(h=u.json)!=null&&h.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var b,x=!((p=u.json)==null||(p=p.quotaLimited)==null||!p.includes("feature_flags"));x&&y.push("quota_limited"),(m=this.ri)==null||m.register({[by]:y}),x?gn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags((b=u.json)!==null&&b!==void 0?b:{},v,{partialResponse:l}),this.fs&&(this.fs=!1,this.Es()))}}})}}ws(){return a6(this.bs,3)}Ps(t){this.bs=r6(t,this.bs,3,(()=>gn.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.ps)if(this.ds||this.getFlags()&&this.getFlags().length>0){if(!this.Ss()){var a=this.getFeatureFlagResult(t,e);return(n=a?.variant)!==null&&n!==void 0?n:a?.enabled}}else gn.warn('getFeatureFlag for key "'+t+qv)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.ps)if(this.ds||this.getFlags()&&this.getFlags().length>0){if(!this.Ss()){var n=this.getFlagVariants(),a=t in n,r=n[t],s=this.getFlagPayloads()[t],l=String(r),c=this.xs(gy)||void 0,u=this.xs(Vd)||void 0,h=this.xs(Sd)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var p,m=this._instance.get_session_id(),v=this.xs(yy);m&&m!==v&&(h={},(p=this.ri)==null||p.register({[Sd]:h,[yy]:m}))}if((e.send_event||!("send_event"in e))&&(!(t in h)||!h[t].includes(l))){var y,b,x,P,T,L,E,A,D,B;it(h[t])?h[t].push(l):h[t]=[l],(y=this.ri)==null||y.register({[Sd]:h});var j=this.getFeatureFlagDetails(t),S=[...(b=this.xs(by))!==null&&b!==void 0?b:[]];ke(r)&&S.push("flag_missing");var N={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:s||null,$feature_flag_request_id:c,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((x=this.Se.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[t])||null,$feature_flag_bootstrapped_payload:((P=this.Se.bootstrap)==null||(P=P.featureFlagPayloads)==null?void 0:P[t])||null,$used_bootstrap_value:!this.ps};ke(j==null||(T=j.metadata)==null?void 0:T.version)||(N.$feature_flag_version=j.metadata.version);var U,Q=(L=j==null||(E=j.reason)==null?void 0:E.description)!==null&&L!==void 0?L:j==null||(A=j.reason)==null?void 0:A.code;Q&&(N.$feature_flag_reason=Q),j!=null&&(D=j.metadata)!=null&&D.id&&(N.$feature_flag_id=j.metadata.id),ke(j?.original_variant)&&ke(j?.original_enabled)||(N.$feature_flag_original_response=ke(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(B=j.metadata)!=null&&B.original_payload&&(N.$feature_flag_original_payload=j==null||(U=j.metadata)==null?void 0:U.original_payload),S.length&&(N.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",N)}if(a)return{key:t,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:RP(s)}}}else gn.warn('getFeatureFlagResult for key "'+t+qv)}getRemoteConfigPayload(t,e){var n=this.Se.token,a={distinct_id:this._instance.get_distinct_id(),token:n};this.Ts()&&(a.evaluation_contexts=this.Cs());var r=this.Is();ke(r)||(a.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:a,compression:this.Se.disable_compression?void 0:aa.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(s){var l,c=(l=s.json)==null?void 0:l.featureFlagPayloads;e(c?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.ps){if(this.ds||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return ke(n)?void 0:!!n}gn.warn('isFeatureEnabled for key "'+t+qv)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,n){if(this.ri){this.ds=!0;var a=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(l,c,u,h,p,m){u===void 0&&(u={}),h===void 0&&(h={}),p===void 0&&(p={});var v=(S=>{var N=S.flags;return N?(S.featureFlags=Object.fromEntries(Object.keys(N).map((U=>{var Q;return[U,(Q=N[U].variant)!==null&&Q!==void 0?Q:N[U].enabled]}))),S.featureFlagPayloads=Object.fromEntries(Object.keys(N).filter((U=>N[U].enabled)).filter((U=>{var Q;return(Q=N[U].metadata)==null?void 0:Q.payload})).map((U=>{var Q;return[U,(Q=N[U].metadata)==null?void 0:Q.payload]})))):S.featureFlags&&gn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),S})(l),y=v.flags,b=v.featureFlags,x=v.featureFlagPayloads;if(b){var P=l.requestId,T=l.evaluatedAt;if(it(b)){gn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var L={};if(b)for(var E=0;b.length>E;E++)L[b[E]]=!0;c&&c.register({[pp]:b,[Ys]:L})}else{var A=b,D=x,B=y;if(m!=null&&m.partialResponse)A=he({},u,A),D=he({},h,D),B=he({},p,B);else if(l.errorsWhileComputingFlags)if(y){var j=new Set(Object.keys(y).filter((S=>{var N;return!((N=y[S])!=null&&N.failed)})));A=he({},u,Object.fromEntries(Object.entries(A).filter((S=>j.has(S[0]))))),D=he({},h,Object.fromEntries(Object.entries(D||{}).filter((S=>j.has(S[0]))))),B=he({},p,Object.fromEntries(Object.entries(B||{}).filter((S=>j.has(S[0])))))}else A=he({},u,A),D=he({},h,D),B=he({},p,B);c&&c.register(he({[pp]:Object.keys(RS(A)),[Ys]:A||{},[fp]:D||{},[my]:B||{}},P?{[gy]:P}:{},T?{[Vd]:T}:{}))}}})(t,this.ri,a,r,s,n),e||(this.ys=!1),this.Os(e)}}override(t,e){e===void 0&&(e=!1),gn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ri)return gn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ri.unregister(bi),this.ri.unregister(ul),this.Os(),$s.info("All overrides cleared");if(it(t)){var e=AS(t);return this.ri.register({[bi]:e}),this.Os(),$s.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,a=t;if(this.hs=!!((n=a.suppressWarning)!==null&&n!==void 0&&n),"flags"in a){if(a.flags===!1)this.ri.unregister(bi),$s.info("Flag overrides cleared");else if(a.flags){if(it(a.flags)){var r=AS(a.flags);this.ri.register({[bi]:r})}else this.ri.register({[bi]:a.flags});$s.info("Flag overrides set",{flags:a.flags})}}return"payloads"in a&&(a.payloads===!1?(this.ri.unregister(ul),$s.info("Payload overrides cleared")):a.payloads&&(this.ri.register({[ul]:a.payloads}),$s.info("Payload overrides set",{payloads:a.payloads}))),void this.Os()}if(t&&typeof t=="object")return this.ri.register({[bi]:t}),this.Os(),$s.info("Flag overrides set",{flags:t});gn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ds){var e=this.Ls(),n=e.flags,a=e.flagVariants;try{t(n,a)}catch(r){gn.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var a,r=(this.xs(dd)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},l={$feature_flag:t,$feature_enrollment:e,$set:s};r&&(l.$early_access_feature_name=r.name),n&&(l.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(s,!1);var c=he({},this.getFlagVariants(),{[t]:e});(a=this.ri)==null||a.register({[pp]:Object.keys(RS(c)),[Ys]:c}),this.Os()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var a=this.xs(dd),r=n?"&"+n.map((s=>"stage="+s)).join("&"):"";if(a&&!e)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+r),method:"GET",callback:s=>{var l,c;if(s.json){var u=s.json.earlyAccessFeatures;return(l=this.ri)==null||l.unregister(dd),(c=this.ri)==null||c.register({[dd]:u}),t(u)}}})}Ls(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((n=>e[n])),flagVariants:Object.keys(e).filter((n=>e[n])).reduce(((n,a)=>(n[a]=e[a],n)),{})}}Os(t){var e=this.Ls(),n=e.flags,a=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(n,a,{errorsLoading:t})}catch(s){gn.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.xs(Gs)||{},a=t?.$set||(t!=null&&t.$set_once?{}:t),r=t?.$set_once,s={};if(r)for(var l in r)({}).hasOwnProperty.call(r,l)&&(l in n||(s[l]=r[l]));this._instance.register({[Gs]:he({},n,s,a)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=he({},this.xs(Gs)||{});t.forEach((a=>{delete n[a]})),this._instance.register({[Gs]:n}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Gs),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.xs(qs)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((a=>{n[a]=he({},n[a],t[a]),delete t[a]})),this._instance.register({[qs]:he({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.xs(qs)||{};this._instance.register({[qs]:he({},e,{[t]:{}})})}else this._instance.unregister(qs)}reset(){this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.$anon_distinct_id=void 0,this.Rs(),this.hs=!1,this.bs=0}}},wK={sessionRecording:class{get Se(){return this._instance.config}get ri(){return this._instance.persistence}get started(){var t;return!((t=this.Fs)==null||!t.isStarted)}get status(){var t,e;return this.As===ed||this.As===Hh?this.As:(t=(e=this.Fs)==null?void 0:e.status)!==null&&t!==void 0?t:this.As}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.As=wS,this.$s=void 0,this._instance=t,!this._instance.sessionManager)throw mi.error("started without valid sessionManager"),new Error(Oy+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===xi)throw new Error(Oy+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ns(){var t,e=!((t=this._instance.get_property(ao))==null||!t.enabled),n=!this.Se.disable_session_recording,a=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return Z&&e&&n&&!a}startIfEnabledOrStop(t){var e;if(!this.Ns||(e=this.Fs)==null||!e.isStarted){var n=!ke(Object.assign)&&!ke(Array.from);this.Ns&&n?(this.Ds(t),mi.info("starting")):(this.As=wS,this.stopRecording())}}Ds(t){var e,n,a;this.Ns&&(this.As!==ed&&this.As!==Hh&&(this.As=xS),Be!=null&&(e=Be.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=Be.__PosthogExtensions__)!=null&&n.initSessionRecording?this.qs(t):(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,this.js,(r=>{if(r)return mi.error("could not load recorder",r);this.qs(t)})))}stopRecording(){var t,e;(t=this.$s)==null||t.call(this),this.$s=void 0,(e=this.Fs)==null||e.stop()}Bs(){var t,e;(t=this.$s)==null||t.call(this),this.$s=void 0,(e=this.Fs)==null||e.discard()}Hs(){var t,e;(t=this.ri)==null||t.unregister(Rb),(e=this.ri)==null||e.unregister(DE)}Us(t,e){if(nt(t))return null;var n,a=Bn(t)?t:parseFloat(t);return typeof(n=a)!="number"||!Number.isFinite(n)||0>n||n>1?(mi.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):a}zs(t){if(this.ri){var e,n,a=this.ri,r=()=>{var s,l=t.sessionRecording===!1?void 0:t.sessionRecording,c=this.Us((s=this.Se.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.Us(l?.sampleRate,"remote config sampleRate"),h=c??u;nt(h)&&this.Hs();var p=l?.minimumDurationMilliseconds;a.register({[ao]:he({cache_timestamp:Date.now(),enabled:!!l},l,{networkPayloadCapture:he({capturePerformance:t.capturePerformance},l?.networkPayloadCapture),canvasRecording:{enabled:l?.recordCanvas,fps:l?.canvasFps,quality:l?.canvasQuality},sampleRate:h,minimumDurationMilliseconds:ke(p)?null:p,endpoint:l?.endpoint,triggerMatchType:l?.triggerMatchType,masking:l?.masking,urlTriggers:l?.urlTriggers,version:l?.version,triggerGroups:l?.triggerGroups})})};r(),(e=this.$s)==null||e.call(this),this.$s=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(r)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.zs(t),void this.Bs()):(this.zs(t),void this.startIfEnabledOrStop()):(this.As===ed&&(this.As=Hh,mi.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Fs)!=null&&n.log?this.Fs.log(t,e):mi.warn("log called before recorder was ready")}get js(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(ao);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Ws(){var t,e,n=this._instance.get_property(ao);if(!n)return!1;try{e=typeof n=="object"?n:JSON.parse(n)}catch(r){return mi.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var a=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-a}qs(t){var e,n;if((e=Be.__PosthogExtensions__)==null||!e.initSessionRecording)return mi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[UE]:!0});if(this.Fs||(this.Fs=(n=Be.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Fs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ws())return this.As===Hh||this.As===ed?void 0:(this.As=ed,mi.info("persisted remote config is stale, requesting fresh config before starting"),void new h6(this._instance).load());this.As=xS,this.Fs.start(t)}onRRwebEmit(t){var e;(e=this.Fs)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Fs||(e=this.ri)==null||e.register({[ME]:!0}),(t=this.Fs)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Fs||(e=this.ri)==null||e.register({[IE]:!0}),(t=this.Fs)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Fs||(n=this.ri)==null||n.register({[t==="url"?NE:OE]:!0}),(e=this.Fs)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Fs)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Fs)==null||!n.tryAddCustomEvent(t,e))}}},xK={autocapture:class{constructor(t){this.Vs=!1,this.Zs=null,this.Gs=!1,this.instance=t,this.rageclicks=new yS(t.config.rageclick),this.Qs=null}initialize(){this.startIfEnabled()}get Se(){var t,e,n=qt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map((a=>new RegExp(a))),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map((a=>new RegExp(a))),n}Js(){if(this.isBrowserSupported()){if(Z&&xe){var t=n=>{n=n||Z?.event;try{this.Ks(n)}catch(a){$v.error("Failed to capture event",a)}};if(tn(xe,"submit",t,{capture:!0}),tn(xe,"change",t,{capture:!0}),tn(xe,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=n=>{n=n||Z?.event;try{this.Ks(n,Bv)}catch(a){$v.error("Failed to capture copy/cut event",a)}};tn(xe,"copy",e,{capture:!0}),tn(xe,"cut",e,{capture:!0})}}}else $v.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Js(),this.Vs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Gs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ly]:!!t.autocapture_opt_out}),this.Zs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Qs=t}getElementSelectors(t){var e,n=[];return(e=this.Qs)==null||e.forEach((a=>{var r=xe?.querySelectorAll(a);r?.forEach((s=>{t===s&&n.push(a)}))})),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[ly];if(la(this.Zs)&&!Hr(n)&&!this.instance.Rr())return!1;var a=(e=this.Zs)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!a}Ks(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,a=Dv(t);HE(a)&&(a=a.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&QP(a,this.instance.config.rageclick)&&this.Ks(t,"$rageclick");var r=e===Bv;if(a&&(function(m,v,y,b,x,P){var T,L,E,A,D,B;if(y===void 0&&(y=void 0),!Z||Nb(m)||(T=y)!=null&&T.url_allowlist&&!YP(y.url_allowlist,P)||(L=y)!=null&&L.url_ignorelist&&YP(y.url_ignorelist,P))return!1;if((E=y)!=null&&E.dom_event_allowlist){var j=y.dom_event_allowlist;if(j&&!j.some((ce=>v.type===ce)))return!1}var S=ZE(m,b),N=S.parentIsUsefulElement,U=S.targetElementList;if(!(function(ce,le){var re=le?.element_allowlist;if(ke(re))return!0;var te,ie=function(X){if(re.some((W=>X.tagName.toLowerCase()===W)))return{v:!0}};for(var $ of ce)if(te=ie($))return te.v;return!1})(U,y)||!Cy(U,(A=y)==null?void 0:A.css_selector_allowlist)||Cy(U,(D=(B=y)==null?void 0:B.css_selector_ignorelist)!==null&&D!==void 0?D:xq))return!1;try{var Q=Z.getComputedStyle(m);if(Q&&Q.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}var ee=m.tagName.toLowerCase();switch(ee){case"html":return!1;case"form":return(x||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(v.type)>=0;default:return N?(x||["click"]).indexOf(v.type)>=0:(x||["click"]).indexOf(v.type)>=0&&(Mb.indexOf(ee)>-1||m.getAttribute("contenteditable")==="true")}})(a,t,this.Se,r,r?["copy","cut"]:void 0,this.instance)){var s=pK(a,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),l=s.props;if(s.explicitNoCapture)return!1;var c=this.getElementSelectors(a);if(c&&c.length>0&&(l.$element_selectors=c),e===Bv){var u,h=qE(Z==null||(u=Z.getSelection())==null?void 0:u.toString()),p=t.type||"clipboard";if(!h)return!1;l.$selected_content=h,l.$copy_type=p}return this.instance.capture(e,l),!0}}}isBrowserSupported(){return yr(xe?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ys=(Z==null||(e=Z.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(be.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Xs&&this.Xs(),this.Xs=void 0,be.info("History API monitoring stopped")}monitorHistoryChanges(){Z&&Z.history&&(this.eo("pushState"),this.eo("replaceState"),this.ro())}eo(t){var e;if(Z&&((e=Z.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(a,r,s){try{if(!(r in a))return bS;var l={next:a[r]},c=s((function(){for(var u=arguments.length,h=new Array(u),p=0;u>p;p++)h[p]=arguments[p];return l.next.apply(this,h)}));return yr(c)&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:l}})),a[r]=c,()=>{if(a[r]!==c)for(var u=a[r];yr(u)&&u.__posthog_layer__;){var h=u.__posthog_layer__;if(h.next===c)return void(h.next=l.next);u=h.next}else a[r]=l.next}}catch{return bS}})(Z.history,t,(a=>function(r,s,l){a.call(this,r,s,l),n.io(t)}))}}io(t){try{var e,n=Z==null||(e=Z.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ys&&this.isEnabled&&this._instance.capture(hl,{navigation_type:t}),this.Ys=n}catch(a){be.error("Error capturing "+t+" pageview",a)}}ro(){if(!this.Xs){var t=()=>{this.io("popstate")};tn(Z,"popstate",t),this.Xs=()=>{Z&&Z.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.no=!1,this.Vs=!1,this.so=null,this.instance=t,this.no=!((e=this.instance.persistence)==null||!e.props[cy]),this.rageclicks=new yS(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return qt(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return nt(this.Se.capture_heatmaps)?nt(this.Se.enable_heatmaps)?this.no:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Vs)return;mK.info("starting..."),this.oo(),this.ke()}else{var t;clearInterval((t=this.so)!==null&&t!==void 0?t:void 0),this.ao(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cy]:e}),this.no=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}lo(t){this.fe(t.originalEvent,"deadclick")}ke(){this.so&&clearInterval(this.so),this.so=xe?.visibilityState==="visible"?setInterval(this.Wr.bind(this),this.flushIntervalMilliseconds):null}oo(){Z&&xe&&(this.uo=this.Wr.bind(this),tn(Z,mf,this.uo),this.ho=t=>this.fe(t||Z?.event),tn(xe,"click",this.ho,{capture:!0}),this.do=t=>this.co(t||Z?.event),tn(xe,"mousemove",this.do,{capture:!0}),this.vo=new tS(this.instance,Lq,this.lo.bind(this)),this.vo.startIfEnabledOrStop(),this.fo=this.ke.bind(this),tn(xe,ff,this.fo),this.Vs=!0)}ao(){var t;Z&&xe&&(this.uo&&Z.removeEventListener(mf,this.uo),this.ho&&xe.removeEventListener("click",this.ho,{capture:!0}),this.do&&xe.removeEventListener("mousemove",this.do,{capture:!0}),this.fo&&xe.removeEventListener(ff,this.fo),clearTimeout(this.po),(t=this.vo)==null||t.stop(),this.Vs=!1)}mo(t,e){var n=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=(function(l,c,u){for(var h=l;h&&gs(h)&&!Ra(h,"body");){if(h===u)return!1;var p=void 0;try{var m,v,y;p=(m=(v=(y=h.ownerDocument)==null?void 0:y.defaultView)!==null&&v!==void 0?v:Z)==null?void 0:m.getComputedStyle(h).position}catch{return!1}if(Ke(c,p))return!0;h=KE(h)}return!1})(Dv(t),["fixed","sticky"],r);return{x:t.clientX+(s?0:a),y:t.clientY+(s?0:n),target_fixed:s,type:e}}fe(t,e){var n;if(e===void 0&&(e="click"),!KP(t.target)&&PS(t)){var a=this.mo(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&QP(Dv(t),this.instance.config.rageclick)&&this.kt(he({},a,{type:"rageclick"})),this.kt(a)}}co(t){!KP(t.target)&&PS(t)&&(clearTimeout(this.po),this.po=setTimeout((()=>{this.kt(this.mo(t,"mousemove"))}),500))}kt(t){if(Z){var e=this.Se.disable_capture_url_hashes?ms(Z.location.href):Z.location.href,n=this.Se.custom_personal_data_properties,a=this.Se.mask_personal_data_properties?[...Fl,...n||[]]:[],r=Gd(e,a,qd);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(t)}}Wr(){this.R&&!cs(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:tS,webVitalsAutocapture:class{constructor(t){var e;this.no=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.yo=()=>{clearTimeout(this.bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,a)=>he({},n,{["$web_vitals_"+a.name+"_event"]:he({},a),["$web_vitals_"+a.name+"_value"]:a.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._o=n=>{var a;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.wo();if(!ke(r))if(nt(n?.name)||nt(n?.value))Bs.error("Invalid metric received",n);else if(!this.xo||this.xo>n.value){this.R.url!==r&&(this.yo(),this.bo=setTimeout(this.yo,this.flushToCaptureTimeoutMs)),ke(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=ke(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var s=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0),l=he({},n,{$current_url:r,timestamp:Date.now()});ke(s)||(l.$session_id=s.sessionId,l.$window_id=s.windowId),this.R.metrics.push(l),this.R.metrics.length===this.allowedMetrics.length&&this.yo()}else Bs.error("Ignoring metric with value >= "+this.xo,n)},this.ko=()=>{if(!this.Vs){var n,a,r,s,l=Be.__PosthogExtensions__;if(!ke(l)&&!ke(l.postHogWebVitalsCallbacks)){var c=l.postHogWebVitalsCallbacks;n=c.onLCP,a=c.onCLS,r=c.onFCP,s=c.onINP}n&&a&&r&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this._o.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(this._o.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this._o.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._o.bind(this)),this.Vs=!0):Bs.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.no=!((e=this._instance.persistence)==null||!e.props[py]),this.startIfEnabled()}get So(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=qt(this.So)?(t=this.So)==null?void 0:t.web_vitals_allowed_metrics:void 0;return nt(n)?((e=this._instance.persistence)==null?void 0:e.props[fy])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(qt(this.So)?this.So.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=qt(this.So)?this.So.web_vitals_attribution:void 0;return t!=null&&t}get xo(){var t=qt(this.So)&&Bn(this.So.__web_vitals_max_value)?this.So.__web_vitals_max_value:kS;return t>0&&6e4>=t?kS:t}get isEnabled(){var t=fn?.protocol;if(t!=="http:"&&t!=="https:")return Bs.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=qt(this.So)?this.So.web_vitals:Hr(this.So)?this.So:void 0;return Hr(e)?e:this.no}startIfEnabled(){this.isEnabled&&!this.Vs&&(Bs.info("enabled, starting..."),this.Bt(this.ko))}onRemoteConfig(t){if("capturePerformance"in t){var e=qt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=qt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[py]:e}),this._instance.persistence.register({[fy]:n})),this.no=e,this.startIfEnabled()}}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(a=>{a?Bs.error("failed to load script",a):t()}))}wo(){var t=Z?this._instance.config.disable_capture_url_hashes?ms(Z.location.href):Z.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Fl,...e||[]]:[];return Gd(t,n,qd)}Bs.error("Could not determine current URL")}}},PK={exceptionObserver:class{constructor(t){var e,n,a,r,s,l;this.ko=()=>{var c;if(Z&&this.isEnabled&&(c=Be.__PosthogExtensions__)!=null&&c.errorWrappingFunctions){var u=Be.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,h=Be.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,p=Be.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Co&&this.Se.capture_unhandled_errors&&(this.Co=u(this.captureException.bind(this))),!this.To&&this.Se.capture_unhandled_rejections&&(this.To=h(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=p(this.captureException.bind(this)))}catch(m){Xc.error("failed to start",m),this.Mo()}}},this._instance=t,this.Eo=!((e=this._instance.persistence)==null||!e.props[dy]),this.Ro=new SG(he({},((n=this._instance.config.error_tracking)===void 0&&(n={}),{refillRate:(a=(r=n.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:n.__exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:1,bucketSize:(s=(l=n.exceptionRateLimiterBucketSize)!==null&&l!==void 0?l:n.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}),{refillInterval:1e4,Ae:Xc})),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return qt(t)?e=he({},e,t):(ke(t)?this.Eo:t)&&(e=he({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Xc.info("enabled"),this.Mo(),this.Bt(this.ko)):this.Mo()}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(a=>{if(a)return Xc.error("failed to load script",a);t()}))}Mo(){var t,e,n;(t=this.Co)==null||t.call(this),this.Co=void 0,(e=this.To)==null||e.call(this),this.To=void 0,(n=this.Io)==null||n.call(this),this.Io=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Eo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[dy]:this.Eo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}captureException(t){var e,n,a,r=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Ro.consumeRateLimit(r)?Xc.info("Skipping exception capture because of client rate limiting.",{exception:r}):(a=this._instance.exceptions)==null||a.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Oo=[],this.Lo=new $G([new ZG,new iq,new QG,new JG,new aq,new nq,new eq,new rq],(function(a){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;r>l;l++)s[l-1]=arguments[l];return function(c,u){u===void 0&&(u=0);for(var h=[],p=c.split(`
|
|
1248
|
+
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),j.contains(B)&&j.removeChild(B)}},[e]),R.jsx(gU,{isPresent:e,childRef:c,sizeRef:u,pop:s,children:s===!1?t:k.cloneElement(t,{ref:m})})}const _U=({children:t,initial:e,isPresent:n,onExitComplete:a,custom:r,presenceAffectsLayout:s,mode:l,anchorX:c,anchorY:u,root:h})=>{const p=S0(yU),m=k.useId(),v=k.useRef(n),y=k.useRef(a);C0(()=>{v.current=n,y.current=a});let b=!0,x=k.useMemo(()=>(b=!1,{id:m,initial:e,isPresent:n,custom:r,onExitComplete:P=>{p.set(P,!0);for(const T of p.values())if(!T)return;a&&a()},register:P=>(p.set(P,!1),()=>{p.delete(P),!v.current&&!p.size&&y.current?.()})}),[n,p,a]);return s&&b&&(x={...x}),k.useMemo(()=>{p.forEach((P,T)=>p.set(T,!1))},[n]),k.useEffect(()=>{!n&&!p.size&&a&&a()},[n]),t=R.jsx(vU,{pop:l==="popLayout",isPresent:n,anchorX:c,anchorY:u,root:h,children:t}),R.jsx(zf.Provider,{value:x,children:t})};function yU(){return new Map}function E5(t=!0){const e=k.useContext(zf);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=e,s=k.useId();k.useEffect(()=>{if(t)return r(s)},[t]);const l=k.useCallback(()=>t&&a&&a(s),[s,a,t]);return!n&&a?[!1,l]:[!0]}const xh=t=>t.key||"";function O2(t){const e=[];return k.Children.forEach(t,n=>{k.isValidElement(n)&&e.push(n)}),e}const A5=({children:t,custom:e,initial:n=!0,onExitComplete:a,presenceAffectsLayout:r=!0,mode:s="sync",propagate:l=!1,anchorX:c="left",anchorY:u="top",root:h})=>{const[p,m]=E5(l),v=k.useMemo(()=>O2(t),[t]),y=l&&!p?[]:v.map(xh),b=k.useRef(!0),x=k.useRef(v),P=S0(()=>new Map),T=k.useRef(new Set),[L,E]=k.useState(v),[A,D]=k.useState(v);C0(()=>{b.current=!1,x.current=v;for(let S=0;S<A.length;S++){const N=xh(A[S]);y.includes(N)?(P.delete(N),T.current.delete(N)):P.get(N)!==!0&&P.set(N,!1)}},[A,y.length,y.join("-")]);const B=[];if(v!==L){let S=[...v];for(let N=0;N<A.length;N++){const U=A[N],Q=xh(U);y.includes(Q)||(S.splice(N,0,U),B.push(U))}return s==="wait"&&B.length&&(S=B),D(O2(S)),E(v),null}const{forceRender:j}=k.useContext(P0);return R.jsx(R.Fragment,{children:A.map(S=>{const N=xh(S),U=l&&!p?!1:v===A||y.includes(N),Q=()=>{if(T.current.has(N))return;if(P.has(N))T.current.add(N),P.set(N,!0);else return;let ee=!0;P.forEach(ce=>{ce||(ee=!1)}),ee&&(j?.(),D(x.current),l&&m?.(),a&&a())};return R.jsx(_U,{isPresent:U,initial:!b.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:h,onExitComplete:U?void 0:Q,anchorX:c,anchorY:u,children:S},N)})})},R5=k.createContext({strict:!1}),j2={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let z2=!1;function bU(){if(z2)return;const t={};for(const e in j2)t[e]={isEnabled:n=>j2[e].some(a=>!!n[a])};i5(t),z2=!0}function L5(){return bU(),rF()}function kU(t){const e=L5();for(const n in t)e[n]={...e[n],...t[n]};i5(e)}const wU=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Yp(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||wU.has(t)}let D5=t=>!Yp(t);function xU(t){typeof t=="function"&&(D5=e=>e.startsWith("on")?!Yp(e):t(e))}try{xU(require("@emotion/is-prop-valid").default)}catch{}function PU(t,e,n){const a={};for(const r in t)r==="values"&&typeof t.values=="object"||Un(t[r])||(D5(r)||n===!0&&Yp(r)||!e&&!Yp(r)||t.draggable&&r.startsWith("onDrag"))&&(a[r]=t[r]);return a}const $f=k.createContext({});function SU(t,e){if(Bf(t)){const{initial:n,animate:a}=t;return{initial:n===!1||jd(n)?n:void 0,animate:jd(a)?a:void 0}}return t.inherit!==!1?e:{}}function CU(t){const{initial:e,animate:n}=SU(t,k.useContext($f));return k.useMemo(()=>({initial:e,animate:n}),[F2(e),F2(n)])}function F2(t){return Array.isArray(t)?t.join(" "):t}const X0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function I5(t,e,n){for(const a in e)!Un(e[a])&&!h5(a,n)&&(t[a]=e[a])}function TU({transformTemplate:t},e){return k.useMemo(()=>{const n=X0();return Z0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function EU(t,e){const n=t.style||{},a={};return I5(a,n,t),Object.assign(a,TU(t,e)),a}function AU(t,e){const n={},a=EU(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=a,n}const M5=()=>({...X0(),attrs:{}});function RU(t,e,n,a){const r=k.useMemo(()=>{const s=M5();return p5(s,e,m5(a),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};I5(s,t.style,t),r.style={...s,...r.style}}return r}const LU=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function eb(t){return typeof t!="string"||t.includes("-")?!1:!!(LU.indexOf(t)>-1||/[A-Z]/u.test(t))}function DU(t,e,n,{latestValues:a},r,s=!1,l){const u=(l??eb(t)?RU:AU)(e,a,r,t),h=PU(e,typeof t=="string",s),p=t!==k.Fragment?{...h,...u,ref:n}:{},{children:m}=e,v=k.useMemo(()=>Un(m)?m.get():m,[m]);return k.createElement(t,{...p,children:v})}function IU({scrapeMotionValuesFromProps:t,createRenderState:e},n,a,r){return{latestValues:MU(n,a,r,t),renderState:e()}}function MU(t,e,n,a){const r={},s=a(t,{});for(const v in s)r[v]=cp(s[v]);let{initial:l,animate:c}=t;const u=Bf(t),h=a5(t);e&&h&&!u&&t.inherit!==!1&&(l===void 0&&(l=e.initial),c===void 0&&(c=e.animate));let p=n?n.initial===!1:!1;p=p||l===!1;const m=p?c:l;if(m&&typeof m!="boolean"&&!Uf(m)){const v=Array.isArray(m)?m:[m];for(let y=0;y<v.length;y++){const b=B0(t,v[y]);if(b){const{transitionEnd:x,transition:P,...T}=b;for(const L in T){let E=T[L];if(Array.isArray(E)){const A=p?E.length-1:0;E=E[A]}E!==null&&(r[L]=E)}for(const L in x)r[L]=x[L]}}}return r}const N5=t=>(e,n)=>{const a=k.useContext($f),r=k.useContext(zf),s=()=>IU(t,e,a,r);return n?s():S0(s)},NU=N5({scrapeMotionValuesFromProps:J0,createRenderState:X0}),OU=N5({scrapeMotionValuesFromProps:g5,createRenderState:M5}),jU=Symbol.for("motionComponentSymbol");function zU(t,e,n){const a=k.useRef(n);k.useInsertionEffect(()=>{a.current=n});const r=k.useRef(null);return k.useCallback(s=>{s&&t.onMount?.(s),e&&(s?e.mount(s):e.unmount());const l=a.current;if(typeof l=="function")if(s){const c=l(s);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):l(s);else l&&(l.current=s)},[e])}const O5=k.createContext({});function dl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function FU(t,e,n,a,r,s){const{visualElement:l}=k.useContext($f),c=k.useContext(R5),u=k.useContext(zf),h=k.useContext(Q0),p=h.reducedMotion,m=h.skipAnimations,v=k.useRef(null),y=k.useRef(!1);a=a||c.renderer,!v.current&&a&&(v.current=a(t,{visualState:e,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:p,skipAnimations:m,isSVG:s}),y.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const b=v.current,x=k.useContext(O5);b&&!b.projection&&r&&(b.type==="html"||b.type==="svg")&&UU(v.current,n,r,x);const P=k.useRef(!1);k.useInsertionEffect(()=>{b&&P.current&&b.update(n,u)});const T=n[WT],L=k.useRef(!!T&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(T)&&window.MotionHasOptimisedAnimation?.(T));return C0(()=>{y.current=!0,b&&(P.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),L.current&&b.animationState&&b.animationState.animateChanges())}),k.useEffect(()=>{b&&(!L.current&&b.animationState&&b.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(T)}),L.current=!1),b.enteringChildren=void 0)}),b}function UU(t,e,n,a){const{layoutId:r,layout:s,drag:l,dragConstraints:c,layoutScroll:u,layoutRoot:h,layoutAnchor:p,layoutCrossfade:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:j5(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!l||c&&dl(c),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:a,crossfade:m,layoutScroll:u,layoutRoot:h,layoutAnchor:p})}function j5(t){if(t)return t.options.allowProjection!==!1?t.projection:j5(t.parent)}function iv(t,{forwardMotionProps:e=!1,type:n}={},a,r){a&&kU(a);const s=n?n==="svg":eb(t),l=s?OU:NU;function c(h,p){let m;const v={...k.useContext(Q0),...h,layoutId:BU(h)},{isStatic:y}=v,b=CU(h),x=l(h,y);if(!y&&typeof window<"u"){$U();const P=VU(v);m=P.MeasureLayout,b.visualElement=FU(t,x,v,r,P.ProjectionNode,s)}return R.jsxs($f.Provider,{value:b,children:[m&&b.visualElement?R.jsx(m,{visualElement:b.visualElement,...v}):null,DU(t,h,zU(x,b.visualElement,p),x,y,e,s)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=k.forwardRef(c);return u[jU]=t,u}function BU({layoutId:t}){const e=k.useContext(P0).id;return e&&t!==void 0?e+"-"+t:t}function $U(t,e){k.useContext(R5).strict}function VU(t){const e=L5(),{drag:n,layout:a}=e;if(!n&&!a)return{};const r={...n,...a};return{MeasureLayout:n?.isEnabled(t)||a?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function HU(t,e){if(typeof Proxy>"u")return iv;const n=new Map,a=(s,l)=>iv(s,l,t,e),r=(s,l)=>a(s,l);return new Proxy(r,{get:(s,l)=>l==="create"?a:(n.has(l)||n.set(l,iv(l,void 0,t,e)),n.get(l))})}const WU=(t,e)=>e.isSVG??eb(t)?new kF(e):new mF(e,{allowProjection:t!==k.Fragment});class GU extends vs{constructor(e){super(e),e.animationState||(e.animationState=CF(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Uf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let qU=0;class KU extends vs{constructor(){super(...arguments),this.id=qU++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;if(e&&a===!1){if(this.isExitComplete){const{initial:s,custom:l}=this.node.getProps();if(typeof s=="string"||typeof s=="object"&&s!==null&&!Array.isArray(s)){const c=so(this.node,s,l);if(c){const{transition:u,transitionEnd:h,...p}=c;for(const m in p)this.node.getValue(m)?.jump(p[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const YU={animation:{Feature:GU},exit:{Feature:KU}};function su(t){return{point:{x:t.pageX,y:t.pageY}}}const ZU=t=>e=>W0(e)&&t(e,su(e));function bd(t,e,n,a){return zd(t,e,ZU(n),a)}const z5=({current:t})=>t?t.ownerDocument.defaultView:null,U2=(t,e)=>Math.abs(t-e);function JU(t,e){const n=U2(t.x,e.x),a=U2(t.y,e.y);return Math.sqrt(n**2+a**2)}const B2=new Set(["auto","scroll"]);class F5{constructor(e,n,{transformPagePoint:a,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:l=3,element:c}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ph(this.lastRawMoveEventInfo,this.transformPagePoint));const b=sv(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,P=JU(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!P)return;const{point:T}=b,{timestamp:L}=zn;this.history.push({...T,timestamp:L});const{onStart:E,onMove:A}=this.handlers;x||(E&&E(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastRawMoveEventInfo=x,this.lastMoveEventInfo=Ph(x,this.transformPagePoint),Ot.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:P,onSessionEnd:T,resumeAnimation:L}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&L&&L(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=sv(b.type==="pointercancel"?this.lastMoveEventInfo:Ph(x,this.transformPagePoint),this.history);this.startEvent&&P&&P(b,E),T&&T(b,E)},!W0(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=l,this.contextWindow=r||window;const u=su(e),h=Ph(u,this.transformPagePoint),{point:p}=h,{timestamp:m}=zn;this.history=[{...p,timestamp:m}];const{onSessionStart:v}=n;v&&v(e,sv(h,this.history));const y={passive:!0,capture:!0};this.removeListeners=au(bd(this.contextWindow,"pointermove",this.handlePointerMove,y),bd(this.contextWindow,"pointerup",this.handlePointerUp,y),bd(this.contextWindow,"pointercancel",this.handlePointerUp,y)),c&&this.startScrollTracking(c)}startScrollTracking(e){let n=e.parentElement;for(;n;){const a=getComputedStyle(n);(B2.has(a.overflowX)||B2.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const a=e===window,r=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-n.x,y:r.y-n.y};s.x===0&&s.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),Ot.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ps(this.updatePoint)}}function Ph(t,e){return e?{point:e(t.point)}:t}function $2(t,e){return{x:t.x-e.x,y:t.y-e.y}}function sv({point:t},e){return{point:t,delta:$2(t,U5(e)),offset:$2(t,QU(e)),velocity:XU(e,.1)}}function QU(t){return t[0]}function U5(t){return t[t.length-1]}function XU(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,a=null;const r=U5(t);for(;n>=0&&(a=t[n],!(r.timestamp-a.timestamp>La(e)));)n--;if(!a)return{x:0,y:0};a===t[0]&&t.length>2&&r.timestamp-a.timestamp>La(e)*2&&(a=t[1]);const s=qa(r.timestamp-a.timestamp);if(s===0)return{x:0,y:0};const l={x:(r.x-a.x)/s,y:(r.y-a.y)/s};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function eB(t,{min:e,max:n},a){return e!==void 0&&t<e?t=a?Nt(e,t,a.min):Math.max(t,e):n!==void 0&&t>n&&(t=a?Nt(n,t,a.max):Math.min(t,n)),t}function V2(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function tB(t,{top:e,left:n,bottom:a,right:r}){return{x:V2(t.x,n,r),y:V2(t.y,e,a)}}function H2(t,e){let n=e.min-t.min,a=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,a]=[a,n]),{min:n,max:a}}function nB(t,e){return{x:H2(t.x,e.x),y:H2(t.y,e.y)}}function aB(t,e){let n=.5;const a=ia(t),r=ia(e);return r>a?n=Nd(e.min,e.max-a,t.min):a>r&&(n=Nd(t.min,t.max-r,e.min)),Zr(0,1,n)}function rB(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const V_=.35;function iB(t=V_){return t===!1?t=0:t===!0&&(t=V_),{x:W2(t,"left","right"),y:W2(t,"top","bottom")}}function W2(t,e,n){return{min:G2(t,e),max:G2(t,n)}}function G2(t,e){return typeof t=="number"?t:t[e]||0}const sB=new WeakMap;class oB{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Cn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=m=>{n&&this.snapToCursor(su(m).point),this.stopAnimation()},l=(m,v)=>{const{drag:y,dragPropagation:b,onDragStart:x}=this.getProps();if(y&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Nz(y),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jr(T=>{let L=this.getAxisMotionValue(T).get()||0;if(Vr.test(L)){const{projection:E}=this.visualElement;if(E&&E.layout){const A=E.layout.layoutBox[T];A&&(L=ia(A)*(parseFloat(L)/100))}}this.originPoint[T]=L}),x&&Ot.update(()=>x(m,v),!1,!0),M_(this.visualElement,"transform");const{animationState:P}=this.visualElement;P&&P.setActive("whileDrag",!0)},c=(m,v)=>{this.latestPointerEvent=m,this.latestPanInfo=v;const{dragPropagation:y,dragDirectionLock:b,onDirectionLock:x,onDrag:P}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:T}=v;if(b&&this.currentDirection===null){this.currentDirection=cB(T),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",v.point,T),this.updateAxis("y",v.point,T),this.visualElement.render(),P&&Ot.update(()=>P(m,v),!1,!0)},u=(m,v)=>{this.latestPointerEvent=m,this.latestPanInfo=v,this.stop(m,v),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new F5(e,{onSessionStart:s,onStart:l,onMove:c,onSessionEnd:u,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:a,contextWindow:z5(this.visualElement),element:this.visualElement.current})}stop(e,n){const a=e||this.latestPointerEvent,r=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!a)return;const{velocity:l}=r;this.startAnimation(l);const{onDragEnd:c}=this.getProps();c&&Ot.postRender(()=>c(a,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,a){const{drag:r}=this.getProps();if(!a||!Sh(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let l=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(l=eB(l,this.constraints[e],this.elastic[e])),s.set(l)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&dl(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=tB(a.layoutBox,e):this.constraints=!1,this.elastic=iB(n),r!==this.constraints&&!dl(e)&&a&&this.constraints&&!this.hasMutatedConstraints&&jr(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=rB(a.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!dl(e))return!1;const a=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const s=cF(a,r.root,this.visualElement.getTransformPagePoint());let l=nB(r.layout.layoutBox,s);if(n){const c=n(sF(l));this.hasMutatedConstraints=!!c,c&&(l=o5(c))}return l}startAnimation(e){const{drag:n,dragMomentum:a,dragElastic:r,dragTransition:s,dragSnapToOrigin:l,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},h=jr(p=>{if(!Sh(p,n,this.currentDirection))return;let m=u&&u[p]||{};(l===!0||l===p)&&(m={min:0,max:0});const v=r?200:1e6,y=r?40:1e7,b={type:"inertia",velocity:a?e[p]:0,bounceStiffness:v,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...s,...m};return this.startAxisValueAnimation(p,b)});return Promise.all(h).then(c)}startAxisValueAnimation(e,n){const a=this.getAxisMotionValue(e);return M_(this.visualElement,e),a.start(U0(e,a,0,n,this.visualElement,!1))}stopAnimation(){jr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[n];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){jr(n=>{const{drag:a}=this.getProps();if(!Sh(n,a,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:l,max:c}=r.layout.layoutBox[n],u=s.get()||0;s.set(e[n]-Nt(l,c,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!dl(n)||!a||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};jr(l=>{const c=this.getAxisMotionValue(l);if(c&&this.constraints!==!1){const u=c.get();r[l]=aB({min:u,max:u},this.constraints[l])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),jr(l=>{if(!Sh(l,e,null))return;const c=this.getAxisMotionValue(l),{min:u,max:h}=this.constraints[l];c.set(Nt(u,h,r[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sB.set(this.visualElement,this);const e=this.visualElement.current,n=bd(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),v=h.target,y=v!==e&&Bz(v);p&&m&&!y&&this.start(h)});let a;const r=()=>{const{dragConstraints:h}=this.getProps();dl(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=lB(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,l=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ot.read(r);const c=zd(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(jr(m=>{const v=this.getAxisMotionValue(m);v&&(this.originPoint[m]+=h[m].translate,v.set(v.get()+h[m].translate))}),this.visualElement.render())}));return()=>{c(),n(),l(),u&&u(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:l=V_,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:a,dragPropagation:r,dragConstraints:s,dragElastic:l,dragMomentum:c}}}function q2(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function lB(t,e,n){const a=e2(t,q2(n)),r=e2(e,q2(n));return()=>{a(),r()}}function Sh(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function cB(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class dB extends vs{constructor(e){super(e),this.removeGroupControls=Za,this.removeListeners=Za,this.controls=new oB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Za}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ov=t=>(e,n)=>{t&&Ot.update(()=>t(e,n),!1,!0)};class uB extends vs{constructor(){super(...arguments),this.removePointerDownListener=Za}onPointerDown(e){this.session=new F5(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:z5(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:a,onPanEnd:r}=this.node.getProps();return{onSessionStart:ov(e),onStart:ov(n),onMove:ov(a),onEnd:(s,l)=>{delete this.session,r&&Ot.postRender(()=>r(s,l))}}}mount(){this.removePointerDownListener=bd(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let lv=!1;class hB extends k.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a,layoutId:r}=this.props,{projection:s}=e;s&&(n.group&&n.group.add(s),a&&a.register&&r&&a.register(s),lv&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),dp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:a,drag:r,isPresent:s}=this.props,{projection:l}=a;return l&&(l.isPresent=s,e.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),lv=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==s?l.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?l.promote():l.relegate()||Ot.postRender(()=>{const c=l.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:a}=e;a&&(a.options.layoutAnchor=n,a.root.didUpdate(),H0.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:r}=e;lv=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),a&&a.deregister&&a.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function B5(t){const[e,n]=E5(),a=k.useContext(P0);return R.jsx(hB,{...t,layoutGroup:a,switchLayoutGroup:k.useContext(O5),isPresent:e,safeToRemove:n})}const pB={pan:{Feature:uB},drag:{Feature:dB,ProjectionNode:T5,MeasureLayout:B5}};function K2(t,e,n){const{props:a}=t;t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=a[r];s&&Ot.postRender(()=>s(e,su(e)))}class fB extends vs{mount(){const{current:e}=this.node;e&&(this.unmount=jz(e,(n,a)=>(K2(this.node,a,"Start"),r=>K2(this.node,r,"End"))))}unmount(){}}class mB extends vs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=au(zd(this.node.current,"focus",()=>this.onFocus()),zd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Y2(t,e,n){const{props:a}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&a.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=a[r];s&&Ot.postRender(()=>s(e,su(e)))}class gB extends vs{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:a}=this.node.props;this.unmount=Vz(e,(r,s)=>(Y2(this.node,s,"Start"),(l,{success:c})=>Y2(this.node,l,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:a?.tap===!1})}unmount(){}}const H_=new WeakMap,cv=new WeakMap,vB=t=>{const e=H_.get(t.target);e&&e(t)},_B=t=>{t.forEach(vB)};function yB({root:t,...e}){const n=t||document;cv.has(n)||cv.set(n,{});const a=cv.get(n),r=JSON.stringify(e);return a[r]||(a[r]=new IntersectionObserver(_B,{root:t,...e})),a[r]}function bB(t,e,n){const a=yB(e);return H_.set(t,n),a.observe(t),()=>{H_.delete(t),a.unobserve(t)}}const kB={some:0,all:1};class wB extends vs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:a,amount:r="some",once:s}=e,l={root:n?n.current:void 0,rootMargin:a,threshold:typeof r=="number"?r:kB[r]},c=u=>{const{isIntersecting:h}=u;if(this.isInView===h||(this.isInView=h,s&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),v=h?p:m;v&&v(u)};this.stopObserver=bB(this.node.current,l,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(xB(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function xB({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const PB={inView:{Feature:wB},tap:{Feature:gB},focus:{Feature:mB},hover:{Feature:fB}},SB={layout:{ProjectionNode:T5,MeasureLayout:B5}},CB={...YU,...PB,...pB,...SB},TB=HU(CB,WU);function EB(){!Y0.current&&r5();const[t]=k.useState(Wp.current);return t}const kd=TB;function $5(t){var e,n,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=$5(t[e]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}function AB(){for(var t,e,n=0,a="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=$5(t))&&(a&&(a+=" "),a+=e);return a}const RB=(t,e)=>{const n=new Array(t.length+e.length);for(let a=0;a<t.length;a++)n[a]=t[a];for(let a=0;a<e.length;a++)n[t.length+a]=e[a];return n},LB=(t,e)=>({classGroupId:t,validator:e}),V5=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Zp="-",Z2=[],DB="arbitrary..",IB=t=>{const e=NB(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return MB(l);const c=l.split(Zp),u=c[0]===""&&c.length>1?1:0;return H5(c,u,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const u=a[l],h=n[l];return u?h?RB(h,u):u:h||Z2}return n[l]||Z2}}},H5=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const r=t[e],s=n.nextPart.get(r);if(s){const h=H5(t,e+1,s);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(Zp):t.slice(e).join(Zp),u=l.length;for(let h=0;h<u;h++){const p=l[h];if(p.validator(c))return p.classGroupId}},MB=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),a=e.slice(0,n);return a?DB+a:void 0})(),NB=t=>{const{theme:e,classGroups:n}=t;return OB(n,e)},OB=(t,e)=>{const n=V5();for(const a in t){const r=t[a];tb(r,n,a,e)}return n},tb=(t,e,n,a)=>{const r=t.length;for(let s=0;s<r;s++){const l=t[s];jB(l,e,n,a)}},jB=(t,e,n,a)=>{if(typeof t=="string"){zB(t,e,n);return}if(typeof t=="function"){FB(t,e,n,a);return}UB(t,e,n,a)},zB=(t,e,n)=>{const a=t===""?e:W5(e,t);a.classGroupId=n},FB=(t,e,n,a)=>{if(BB(t)){tb(t(a),e,n,a);return}e.validators===null&&(e.validators=[]),e.validators.push(LB(n,t))},UB=(t,e,n,a)=>{const r=Object.entries(t),s=r.length;for(let l=0;l<s;l++){const[c,u]=r[l];tb(u,W5(e,c),n,a)}},W5=(t,e)=>{let n=t;const a=e.split(Zp),r=a.length;for(let s=0;s<r;s++){const l=a[s];let c=n.nextPart.get(l);c||(c=V5(),n.nextPart.set(l,c)),n=c}return n},BB=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,$B=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),a=Object.create(null);const r=(s,l)=>{n[s]=l,e++,e>t&&(e=0,a=n,n=Object.create(null))};return{get(s){let l=n[s];if(l!==void 0)return l;if((l=a[s])!==void 0)return r(s,l),l},set(s,l){s in n?n[s]=l:r(s,l)}}},W_="!",J2=":",VB=[],Q2=(t,e,n,a,r)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:a,isExternal:r}),HB=t=>{const{prefix:e,experimentalParseClassName:n}=t;let a=r=>{const s=[];let l=0,c=0,u=0,h;const p=r.length;for(let x=0;x<p;x++){const P=r[x];if(l===0&&c===0){if(P===J2){s.push(r.slice(u,x)),u=x+1;continue}if(P==="/"){h=x;continue}}P==="["?l++:P==="]"?l--:P==="("?c++:P===")"&&c--}const m=s.length===0?r:r.slice(u);let v=m,y=!1;m.endsWith(W_)?(v=m.slice(0,-1),y=!0):m.startsWith(W_)&&(v=m.slice(1),y=!0);const b=h&&h>u?h-u:void 0;return Q2(s,y,v,b)};if(e){const r=e+J2,s=a;a=l=>l.startsWith(r)?s(l.slice(r.length)):Q2(VB,!1,l,void 0,!0)}if(n){const r=a;a=s=>n({className:s,parseClassName:r})}return a},WB=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,a)=>{e.set(n,1e6+a)}),n=>{const a=[];let r=[];for(let s=0;s<n.length;s++){const l=n[s],c=l[0]==="[",u=e.has(l);c||u?(r.length>0&&(r.sort(),a.push(...r),r=[]),a.push(l)):r.push(l)}return r.length>0&&(r.sort(),a.push(...r)),a}},GB=t=>({cache:$B(t.cacheSize),parseClassName:HB(t),sortModifiers:WB(t),postfixLookupClassGroupIds:qB(t),...IB(t)}),qB=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let a=0;a<n.length;a++)e[n[a]]=!0;return e},KB=/\s+/,YB=(t,e)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:l}=e,c=[],u=t.trim().split(KB);let h="";for(let p=u.length-1;p>=0;p-=1){const m=u[p],{isExternal:v,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:P}=n(m);if(v){h=m+(h.length>0?" "+h:h);continue}let T=!!P,L;if(T){const j=x.substring(0,P);L=a(j);const S=L&&l[L]?a(x):void 0;S&&S!==L&&(L=S,T=!1)}else L=a(x);if(!L){if(!T){h=m+(h.length>0?" "+h:h);continue}if(L=a(x),!L){h=m+(h.length>0?" "+h:h);continue}T=!1}const E=y.length===0?"":y.length===1?y[0]:s(y).join(":"),A=b?E+W_:E,D=A+L;if(c.indexOf(D)>-1)continue;c.push(D);const B=r(L,T);for(let j=0;j<B.length;++j){const S=B[j];c.push(A+S)}h=m+(h.length>0?" "+h:h)}return h},ZB=(...t)=>{let e=0,n,a,r="";for(;e<t.length;)(n=t[e++])&&(a=G5(n))&&(r&&(r+=" "),r+=a);return r},G5=t=>{if(typeof t=="string")return t;let e,n="";for(let a=0;a<t.length;a++)t[a]&&(e=G5(t[a]))&&(n&&(n+=" "),n+=e);return n},JB=(t,...e)=>{let n,a,r,s;const l=u=>{const h=e.reduce((p,m)=>m(p),t());return n=GB(h),a=n.cache.get,r=n.cache.set,s=c,c(u)},c=u=>{const h=a(u);if(h)return h;const p=YB(u,n);return r(u,p),p};return s=l,(...u)=>s(ZB(...u))},QB=[],Sn=t=>{const e=n=>n[t]||QB;return e.isThemeGetter=!0,e},q5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,K5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XB=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,e$=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t$=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n$=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ts=t=>XB.test(t),ct=t=>!!t&&!Number.isNaN(Number(t)),Dr=t=>!!t&&Number.isInteger(Number(t)),dv=t=>t.endsWith("%")&&ct(t.slice(0,-1)),pi=t=>e$.test(t),Y5=()=>!0,i$=t=>t$.test(t)&&!n$.test(t),nb=()=>!1,s$=t=>a$.test(t),o$=t=>r$.test(t),l$=t=>!Te(t)&&!Ae(t),c$=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),d$=t=>_s(t,Q5,nb),Te=t=>q5.test(t),Os=t=>_s(t,X5,i$),X2=t=>_s(t,_$,ct),u$=t=>_s(t,t4,Y5),h$=t=>_s(t,e4,nb),eP=t=>_s(t,Z5,nb),p$=t=>_s(t,J5,o$),Ch=t=>_s(t,n4,s$),Ae=t=>K5.test(t),$c=t=>wo(t,X5),f$=t=>wo(t,e4),tP=t=>wo(t,Z5),m$=t=>wo(t,Q5),g$=t=>wo(t,J5),Th=t=>wo(t,n4,!0),v$=t=>wo(t,t4,!0),_s=(t,e,n)=>{const a=q5.exec(t);return a?a[1]?e(a[1]):n(a[2]):!1},wo=(t,e,n=!1)=>{const a=K5.exec(t);return a?a[1]?e(a[1]):n:!1},Z5=t=>t==="position"||t==="percentage",J5=t=>t==="image"||t==="url",Q5=t=>t==="length"||t==="size"||t==="bg-size",X5=t=>t==="length",_$=t=>t==="number",e4=t=>t==="family-name",t4=t=>t==="number"||t==="weight",n4=t=>t==="shadow",y$=()=>{const t=Sn("color"),e=Sn("font"),n=Sn("text"),a=Sn("font-weight"),r=Sn("tracking"),s=Sn("leading"),l=Sn("breakpoint"),c=Sn("container"),u=Sn("spacing"),h=Sn("radius"),p=Sn("shadow"),m=Sn("inset-shadow"),v=Sn("text-shadow"),y=Sn("drop-shadow"),b=Sn("blur"),x=Sn("perspective"),P=Sn("aspect"),T=Sn("ease"),L=Sn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),Ae,Te],B=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[Ae,Te,u],N=()=>[ts,"full","auto",...S()],U=()=>[Dr,"none","subgrid",Ae,Te],Q=()=>["auto",{span:["full",Dr,Ae,Te]},Dr,Ae,Te],ee=()=>[Dr,"auto",Ae,Te],ce=()=>["auto","min","max","fr",Ae,Te],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...S()],ie=()=>[ts,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],$=()=>[ts,"screen","full","dvw","lvw","svw","min","max","fit",...S()],X=()=>[ts,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],W=()=>[t,Ae,Te],O=()=>[...A(),tP,eP,{position:[Ae,Te]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ae=()=>["auto","cover","contain",m$,d$,{size:[Ae,Te]}],_e=()=>[dv,$c,Os],fe=()=>["","none","full",h,Ae,Te],ve=()=>["",ct,$c,Os],Ne=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>[ct,dv,tP,eP],St=()=>["","none",b,Ae,Te],un=()=>["none",ct,Ae,Te],jt=()=>["none",ct,Ae,Te],_t=()=>[ct,Ae,Te],Jt=()=>[ts,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pi],breakpoint:[pi],color:[Y5],container:[pi],"drop-shadow":[pi],ease:["in","out","in-out"],font:[l$],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pi],shadow:[pi],spacing:["px",ct],text:[pi],"text-shadow":[pi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ts,Te,Ae,P]}],container:["container"],"container-type":[{"@container":["","normal","size",Ae,Te]}],"container-named":[c$],columns:[{columns:[ct,Te,Ae,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Dr,"auto",Ae,Te]}],basis:[{basis:[ts,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,ts,"auto","initial","none",Te]}],grow:[{grow:["",ct,Ae,Te]}],shrink:[{shrink:["",ct,Ae,Te]}],order:[{order:[Dr,"first","last","none",Ae,Te]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mbs:[{mbs:te()}],mbe:[{mbe:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:ie()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[c,"screen",...ie()]}],"min-w":[{"min-w":[c,"screen","none",...ie()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ie()]}],h:[{h:["screen","lh",...ie()]}],"min-h":[{"min-h":["screen","lh","none",...ie()]}],"max-h":[{"max-h":["screen","lh",...ie()]}],"font-size":[{text:["base",n,$c,Os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,v$,u$]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dv,Te]}],"font-family":[{font:[f$,h$,e]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Ae,Te]}],"line-clamp":[{"line-clamp":[ct,"none",Ae,X2]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",Ae,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",Ae,Os]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[ct,"auto",Ae,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[Dr,Ae,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Dr,Ae,Te],radial:["",Ae,Te],conic:[Dr,Ae,Te]},g$,p$]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:_e()}],"gradient-via-pos":[{via:_e()}],"gradient-to-pos":[{to:_e()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ve()}],"border-w-x":[{"border-x":ve()}],"border-w-y":[{"border-y":ve()}],"border-w-s":[{"border-s":ve()}],"border-w-e":[{"border-e":ve()}],"border-w-bs":[{"border-bs":ve()}],"border-w-be":[{"border-be":ve()}],"border-w-t":[{"border-t":ve()}],"border-w-r":[{"border-r":ve()}],"border-w-b":[{"border-b":ve()}],"border-w-l":[{"border-l":ve()}],"divide-x":[{"divide-x":ve()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ve()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,Ae,Te]}],"outline-w":[{outline:["",ct,$c,Os]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",p,Th,Ch]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",m,Th,Ch]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[ct,Os]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ve()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",v,Th,Ch]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[ct,Ae,Te]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ie()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":Ie()}],"mask-image-t-to-pos":[{"mask-t-to":Ie()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":Ie()}],"mask-image-r-to-pos":[{"mask-r-to":Ie()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":Ie()}],"mask-image-b-to-pos":[{"mask-b-to":Ie()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":Ie()}],"mask-image-l-to-pos":[{"mask-l-to":Ie()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":Ie()}],"mask-image-x-to-pos":[{"mask-x-to":Ie()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":Ie()}],"mask-image-y-to-pos":[{"mask-y-to":Ie()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Ae,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ie()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ie()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Te]}],filter:[{filter:["","none",Ae,Te]}],blur:[{blur:St()}],brightness:[{brightness:[ct,Ae,Te]}],contrast:[{contrast:[ct,Ae,Te]}],"drop-shadow":[{"drop-shadow":["","none",y,Th,Ch]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",ct,Ae,Te]}],"hue-rotate":[{"hue-rotate":[ct,Ae,Te]}],invert:[{invert:["",ct,Ae,Te]}],saturate:[{saturate:[ct,Ae,Te]}],sepia:[{sepia:["",ct,Ae,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Te]}],"backdrop-blur":[{"backdrop-blur":St()}],"backdrop-brightness":[{"backdrop-brightness":[ct,Ae,Te]}],"backdrop-contrast":[{"backdrop-contrast":[ct,Ae,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,Ae,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,Ae,Te]}],"backdrop-invert":[{"backdrop-invert":["",ct,Ae,Te]}],"backdrop-opacity":[{"backdrop-opacity":[ct,Ae,Te]}],"backdrop-saturate":[{"backdrop-saturate":[ct,Ae,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,Ae,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",Ae,Te]}],ease:[{ease:["linear","initial",T,Ae,Te]}],delay:[{delay:[ct,Ae,Te]}],animate:[{animate:["none",L,Ae,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Ae,Te]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:un()}],"rotate-x":[{"rotate-x":un()}],"rotate-y":[{"rotate-y":un()}],"rotate-z":[{"rotate-z":un()}],scale:[{scale:jt()}],"scale-x":[{"scale-x":jt()}],"scale-y":[{"scale-y":jt()}],"scale-z":[{"scale-z":jt()}],"scale-3d":["scale-3d"],skew:[{skew:_t()}],"skew-x":[{"skew-x":_t()}],"skew-y":[{"skew-y":_t()}],transform:[{transform:[Ae,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Jt()}],"translate-x":[{"translate-x":Jt()}],"translate-y":[{"translate-y":Jt()}],"translate-z":[{"translate-z":Jt()}],"translate-none":["translate-none"],zoom:[{zoom:[Dr,Ae,Te]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,Te]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[ct,$c,Os,X2]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},b$=JB(y$);function $t(...t){return b$(AB(t))}const k$=R.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),R.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),R.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),R.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),w$=R.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:R.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),x$={google:k$,github:w$},P$={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function S$(t){return P$[t]||String(t||"").replace(/-/g," ")}function C$(t){if(typeof t=="string"&&t.trim())return t.trim();if(t&&typeof t=="object"){if(typeof t.token=="string"&&t.token.trim())return t.token.trim();if(typeof t.otp=="string"&&t.otp.trim())return t.otp.trim()}return""}function T$({title:t,subtitle:e,className:n="",onSuccess:a,hideLogo:r=!1,initialMode:s="signin",tokenFromUrl:l="",initialEmail:c="",initialCode:u=""}){Kl();const{enabled:h,signedIn:p,refreshUser:m,signInWithPassword:v,signUp:y,signInWithOAuth:b,getPublicAuthConfig:x,sendResetPasswordEmail:P,exchangeResetPasswordToken:T,resetPassword:L}=ko(),[E,A]=k.useState(s),[D,B]=k.useState(c),[j,S]=k.useState(""),[N,U]=k.useState(""),[Q,ee]=k.useState(""),[ce,le]=k.useState(u),[re,te]=k.useState(!1),[ie,$]=k.useState(null),[X,W]=k.useState(null),[O,Y]=k.useState(!1),[ae,_e]=k.useState(!!(s!=="signin"||c)),[fe,ve]=k.useState(!0),[Ne,Oe]=k.useState([]),[Ie,St]=k.useState(8);k.useEffect(()=>{s&&A(s)},[s]),k.useEffect(()=>{c&&B(c)},[c]),k.useEffect(()=>{u&&le(u)},[u]),k.useEffect(()=>{if(!h)return;let Xe=!0;return ve(!0),(async()=>{const{data:ot,error:Dt}=await x();if(Xe){if(Dt||!ot)Oe(["google","github"]);else{const Et=Array.isArray(ot.oAuthProviders)?ot.oAuthProviders:[],Nn=Array.isArray(ot.customOAuthProviders)?ot.customOAuthProviders:[];Oe([...Et,...Nn]),typeof ot.passwordMinLength=="number"&&ot.passwordMinLength>0&&St(ot.passwordMinLength)}ve(!1)}})(),()=>{Xe=!1}},[h,x]),k.useEffect(()=>{p&&a&&a()},[p,a]);const un=k.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),jt=k.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),_t=k.useCallback(async Xe=>{$(null),te(!0);try{const{error:ot}=await b(Xe,un);ot&&$(ot.message||String(ot))}finally{te(!1)}},[b,un]);k.useEffect(()=>{if(!h||fe||p||typeof window>"u")return;const Xe=window.location.search;if(!Xe)return;const ot=new URLSearchParams(Xe),Dt=ot.get("native")==="1",Et=ot.get("provider");Dt&&Et&&[...Ne].includes(Et)&&_t(Et)},[h,fe,p,Ne,_t]);const Jt=k.useCallback(async Xe=>{Xe.preventDefault(),$(null),te(!0);try{if(E==="signup"){const{data:Dt,error:Et}=await y({email:D.trim(),password:j,name:Q.trim()||void 0});if(Et){$(Et.message||String(Et));return}if(Dt?.requireEmailVerification){W(we("login.verify_email_pending")),A("signin");return}await m();return}const{error:ot}=await v({email:D.trim(),password:j});if(ot){$(ot.message||String(ot));return}await m()}finally{te(!1)}},[E,D,j,Q,y,v,m]),nr=k.useCallback(async Xe=>{Xe.preventDefault(),$(null),te(!0);try{const ot=D.trim(),{error:Dt}=await P({email:ot,redirectTo:jt});if(Dt){$(Dt.message||String(Dt));return}B(ot),W(we("reset_password.request.sent")),A("reset_confirm")}finally{te(!1)}},[D,jt,P]),Mn=k.useCallback(async Xe=>{if(Xe.preventDefault(),$(null),j!==N){$(we("reset_password.error.password_mismatch"));return}te(!0);try{let ot=l;if(!ot){const{data:Et,error:Nn}=await T({email:D.trim(),code:ce.trim()});if(Nn){$(Nn.message||String(Nn));return}if(ot=C$(Et),!ot){$(we("reset_password.error.missing_token"));return}}const{error:Dt}=await L({newPassword:j,otp:ot});if(Dt){$(Dt.message||String(Dt));return}Y(!0),W(we("reset_password.success"))}finally{te(!1)}},[ce,N,D,T,j,L,l]);if(!h)return null;const Vt=E==="reset_email"||E==="reset_confirm";return R.jsxs("div",{className:$t("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",n),children:[Vt&&R.jsxs("button",{type:"button",onClick:()=>{A("signin"),W(null),$(null),Y(!1),S(""),U("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[R.jsx(VN,{className:"h-3.5 w-3.5"}),we("reset_password.back_to_sign_in")]}),R.jsxs("div",{className:$t("mb-6",Vt?"text-left":"text-center"),children:[!r&&!Vt&&R.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[R.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),R.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:we("shared.app_name")})]}),R.jsx("h2",{className:$t("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(r||Vt)&&"text-base font-bold md:text-lg"),children:Vt?we("reset_password.title"):t||we("login_modal.subtitle")}),!Vt&&e&&R.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:e}),Vt&&R.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:X&&E==="reset_confirm"&&!O?X:we("reset_password.subtitle")})]}),X&&(!Vt||O)&&R.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:X}),ie&&R.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:ie}),E==="reset_email"&&R.jsxs("form",{onSubmit:nr,className:"space-y-3",children:[R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we("reset_password.request.submit")})]}),E==="reset_confirm"&&(O?R.jsx("button",{type:"button",onClick:()=>{A("signin"),Y(!1),W(null),$(null),S(""),U("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:we("reset_password.success_cta")}):R.jsxs("form",{onSubmit:Mn,className:"space-y-3",children:[!l&&R.jsxs(R.Fragment,{children:[R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.code")}),R.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:ce,onChange:Xe=>le(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.new_password")}),R.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:j,onChange:Xe=>S(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("reset_password.field.confirm_password")}),R.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:N,onChange:Xe=>U(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we("reset_password.reset.submit")})]})),!Vt&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"space-y-2.5 mb-5",children:fe?R.jsxs("div",{className:"space-y-2.5",children:[R.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),R.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):Ne.map(Xe=>R.jsxs("button",{type:"button",disabled:re,onClick:()=>_t(Xe),className:$t("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[x$[Xe]||null,we("login.oauth.continue",{provider:S$(Xe)})]},Xe))}),ae?R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"relative mb-5",children:[R.jsx("div",{className:"absolute inset-0 flex items-center",children:R.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),R.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:R.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:we("login_modal.divider_email")})})]}),R.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[R.jsx("button",{type:"button",className:$t("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",E==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{A("signin"),$(null)},children:we("login.tab.sign_in")}),R.jsx("button",{type:"button",className:$t("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",E==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{A("signup"),$(null)},children:we("login.tab.sign_up")})]}),R.jsxs("form",{onSubmit:Jt,className:"space-y-3",children:[E==="signup"&&R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.name")}),R.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:Q,onChange:Xe=>ee(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:we("login.field.name_placeholder")})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.email")}),R.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:D,onChange:Xe=>B(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),R.jsxs("div",{children:[R.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:we("login.field.password")}),R.jsx("input",{id:"card-password",type:"password",autoComplete:E==="signup"?"new-password":"current-password",required:!0,minLength:E==="signup"?Ie:void 0,value:j,onChange:Xe=>S(Xe.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),E==="signup"&&R.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:we("login.password_hint",{min:String(Ie)})}),E==="signin"&&R.jsx("div",{className:"mt-1 text-right",children:R.jsx("button",{type:"button",onClick:()=>{A("reset_email"),$(null),W(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:we("login.forgot_password")})})]}),R.jsx("button",{type:"submit",disabled:re,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:we(E==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]}):R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"relative mb-5",children:[R.jsx("div",{className:"absolute inset-0 flex items-center",children:R.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),R.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:R.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:we("login.divider")})})]}),R.jsxs("button",{type:"button",onClick:()=>_e(!0),className:$t("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[R.jsx(aO,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),we("login_modal.continue_email")]})]})]})]})}function E$(){const{isOpen:t,closeLoginModal:e}=aT(),{enabled:n}=ko();return k.useEffect(()=>{if(!t)return;const a=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,e]),n?R.jsx(A5,{children:t&&R.jsxs(kd.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[R.jsx(kd.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),R.jsxs(kd.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 shadow-2xl overflow-hidden",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:a=>a.stopPropagation(),children:[R.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 z-10 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:R.jsx(x0,{className:"h-5 w-5"})}),R.jsx(T$,{onSuccess:e,className:"p-6 bg-transparent"})]})]})}):null}const A$={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"},qY="https://tokentracker.statuspage.io/",R$="https://github.com/mm7894215/TokenTracker",a4=`${R$}/releases/latest`,KY=`${a4}/download/TokenTrackerBar.dmg`,YY=`${a4}/download/TokenTracker-Setup.exe`;function L$(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?A$:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||Yr()).trim()}function D$(){return Yr()}function I$(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const M$=300*1e3,N$=720*60*1e3;function ab(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}function O$(t,e=Date.now()){if(!t?.token||!t?.deviceId||!t?.issuedAt)return!0;const n=Date.parse(t.issuedAt);return Number.isFinite(n)?n+N$<=e:!0}async function r4(t,e){const n=Yr();if(!ab(n)||!t)return;const a=n.replace(/\/$/,""),r=Gl(),s={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};r&&(s.apikey=r);try{await fetch(`${a}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:s,body:JSON.stringify({period:"week",source:e})})}catch{}}async function j$(){try{const t=await fetch("/functions/tokentracker-machine-id",{headers:{Accept:"application/json"},cache:"no-store"});if(t.ok){const e=await t.json().catch(()=>null),n=typeof e?.machineId=="string"?e.machineId.trim():null;if(n&&n.length>=8)return n}}catch{}return null}async function z$(t){const e=Yr();if(!ab(e)||!t)return null;const n=e.replace(/\/$/,""),a=Gl(),r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};a&&(r.apikey=a);const s=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",l=await j$();if(!l)return null;const c=`Token Tracker (dashboard) #${l.slice(0,8)}`,u=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:r,body:JSON.stringify({device_name:c,platform:s,machine_id:l})});if(!u.ok)return null;const h=await u.json().catch(()=>null),p=typeof h?.token=="string"?h.token:null,m=typeof h?.device_id=="string"?h.device_id:null;return!p||!m?null:{token:p,deviceId:m,issuedAt:typeof h?.created_at=="string"?h.created_at:new Date().toISOString()}}async function nP(t){const{deviceToken:e,insforgeBaseUrl:n,drain:a}=t,r={deviceToken:e};a===!0&&(r.drain=!0);const s=n||Yr();ab(s)&&(r.insforgeBaseUrl=s.trim());const l=await eu(),c=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...l},body:JSON.stringify(r)}),u=await c.json().catch(()=>({}));if(!c.ok){const h=typeof u.error=="string"?u.error:`HTTP ${c.status}`;throw new Error(h)}return u}async function aP(t){const e=await t();if(!e)return null;const n=pC();if(n&&!O$(n))return n;const a=await z$(e);return a?(C7(a),a):null}async function i4(t,e={}){let n=await t();if(!n)return null;let a=await aP(async()=>n);if(!a)return n;try{return await nP({deviceToken:a.token,insforgeBaseUrl:Yr(),drain:e.drain===!0}),n}catch(r){if(!pC()||(fC(),n=await t(),!n)||(a=await aP(async()=>n),!a))throw r;return await nP({deviceToken:a.token,insforgeBaseUrl:Yr(),drain:e.drain===!0}),n}}async function F$(t){const e=T7();if(Date.now()-e<M$)return;const n=await i4(t);n&&(mC(Date.now()),await r4(n,"cloud-sync-auto"))}async function ZY(t){const e=await i4(t,{drain:!0});e&&(mC(Date.now()),await r4(e,"cloud-sync-now"))}function U$(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function B$(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||U$(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function $$(){const t=ya(),e=ko(),n=k.useRef(!1);k.useEffect(()=>{if(!Rp()||!B$(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!Lp())return;let a=!1;const r=window.setTimeout(()=>{(async()=>{if(!(a||n.current)){n.current=!0;try{await F$(()=>e.getAccessToken())}catch(s){console.warn("[tokentracker] cloud usage sync:",s)}finally{n.current=!1}}})()},2500);return()=>{a=!0,window.clearTimeout(r)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}function V$(){const t=k.useContext(tT);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}function H$({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function W$(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},a=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof a=="string"&&a.trim()?a.trim():null}function G$(t){return t?Nf()?`/api/avatar-proxy?url=${encodeURIComponent(t)}`:t:null}function Eh(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function rP({className:t,variant:e="header",collapsed:n=!1,onAfterAction:a}){Kl();const r=e==="sidebar",{enabled:s,loading:l,signedIn:c,user:u,displayName:h}=ko(),{openLoginModal:p}=aT(),m=$l(),v=k.useMemo(()=>W$(u),[u]),y=k.useMemo(()=>G$(v),[v]),[b,x]=Cl.useState(!1);if(Cl.useEffect(()=>{x(!1)},[y]),!s)return null;if(l)return R.jsx("div",{className:$t("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!c)return r?R.jsxs("button",{type:"button",onClick:()=>{p(),a?.()},className:$t("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":we("header.auth.sign_in_aria"),title:n?we("header.auth.sign_in_aria"):void 0,children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:R.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&R.jsx("span",{className:"truncate flex-1 text-left",children:we("header.auth.sign_in_aria")})]}):R.jsx("button",{type:"button",onClick:p,className:$t("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-md px-4 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":we("header.auth.sign_in_aria"),children:we("header.auth.sign_in_aria")});const P=()=>{m("/settings"),a?.()};return R.jsx("div",{className:$t(r?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:R.jsxs("button",{type:"button",onClick:P,className:$t(r?$t("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-md pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":we("header.auth.open_settings"),title:r&&n?h:void 0,children:[r?R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:y&&!b?R.jsx("img",{src:y,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer",onError:()=>x(!0)}):Eh(h)==="?"?R.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600/30 text-white ring-1 ring-oai-brand-500/50",children:R.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3 opacity-80",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}):R.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:Eh(h)})}):y&&!b?R.jsx("img",{src:y,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer",onError:()=>x(!0)}):Eh(h)==="?"?R.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600/30 text-white ring-1 ring-oai-brand-500/50",children:R.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-4 h-4 opacity-80",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}):R.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:Eh(h)}),r?!n&&R.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:h}):R.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:h})]})})}const G_="tt.sidebarCollapsed";function s4(){return[{id:"general",label:we("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:qN,label:we("nav.usage")},{id:"limits",to:"/limits",icon:JN,label:we("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:xO,label:we("nav.leaderboard")},{id:"achievements",to:"/achievements",icon:WN,label:we("nav.achievements")}]},{id:"tools",label:we("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:tO,label:we("nav.widgets")},{id:"pet",to:"/pet-settings",icon:dO,label:we("nav.pet")},{id:"skills",to:"/skills",icon:hO,label:we("nav.skills")},{id:"ip-check",to:"/ip-check",icon:XN,label:we("nav.ip_check")}]},{id:"account",label:we("nav.group.account"),items:[{id:"settings",to:"/settings",icon:_O,label:we("nav.settings")}]}]}function q$(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(G_)==="1"}catch{return!1}}function K$(){const[t,e]=k.useState(q$),n=k.useCallback(()=>{e(a=>{const r=!a;try{typeof window<"u"&&window.localStorage.setItem(G_,r?"1":"0")}catch{}return r})},[]);return k.useEffect(()=>{if(typeof window>"u")return;const a=r=>{r.key===G_&&e(r.newValue==="1")};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),{collapsed:t,toggle:n}}function Y$(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function Z$({label:t,collapsed:e,first:n}){return e?n?null:R.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):R.jsx("div",{className:$t("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function J$({item:t,collapsed:e,active:n,onClick:a}){const r=t.icon;return R.jsxs(Ef,{to:t.to,onClick:a,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:$t("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:R.jsx(r,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&R.jsx("span",{className:"truncate",children:t.label})]})}function Q$({as:t="button",title:e,onClick:n,href:a,children:r,className:s,...l}){const c=$t("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",s);return t==="a"?R.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:c,...l,children:r}):R.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:c,...l,children:r})}function X$({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,a]=k.useState(null);return k.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;H$({prefersReducedMotion:r,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(s=>s.json()).then(s=>{s&&typeof s.stargazers_count=="number"&&a(s.stargazers_count)}).catch(()=>{})},[t]),R.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:$t("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[R.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:R.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),R.jsx("span",{children:"Star"}),n!==null&&R.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const eV=[{value:"light",label:"Light",Icon:eT},{value:"dark",label:"Dark",Icon:XC},{value:"system",label:"System",Icon:oO}];function tV({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:a=!1}){const[r,s]=k.useState(!1),l=k.useRef(null),c=e==="dark"?XC:eT;return k.useEffect(()=>{if(!r)return;const u=p=>{l.current&&!l.current.contains(p.target)&&s(!1)},h=p=>{p.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[r]),R.jsxs("div",{ref:l,className:"relative",children:[R.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":r,"aria-haspopup":"menu",title:"Theme",onClick:()=>s(u=>!u),className:$t("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:R.jsx(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r&&R.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:eV.map(({value:u,label:h,Icon:p})=>{const m=t===u;return R.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(u),s(!1)},className:$t("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",m?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[R.jsx(p,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),R.jsx("span",{children:h})]},u)})})]})}function o4({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:a=!1,onClose:r,glassChrome:s=!1}){const c=ya()?.pathname||"/",{theme:u,resolvedTheme:h,setTheme:p}=V$(),{resolvedLocale:m}=Kl(),v=k.useMemo(()=>s4(),[m]);return R.jsxs(R.Fragment,{children:[R.jsx("div",{className:$t("px-2 pt-2 pb-2",t&&"flex justify-center"),children:a?R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx("div",{className:"flex-1 min-w-0",children:R.jsx(rP,{variant:"sidebar",collapsed:t,onAfterAction:n})}),R.jsx("button",{type:"button",onClick:r,"aria-label":we("nav.close_menu"),title:we("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:R.jsx(x0,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):R.jsx(rP,{variant:"sidebar",collapsed:t,onAfterAction:n})}),R.jsx("nav",{"aria-label":we("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:v.map((y,b)=>R.jsxs("div",{className:"flex flex-col",children:[R.jsx(Z$,{label:y.label,collapsed:t,first:b===0}),R.jsx("div",{className:"flex flex-col gap-0.5",children:y.items.filter(x=>!(x.to==="/widgets"&&Of())).map(x=>R.jsx(J$,{item:x,collapsed:t,active:Y$(c,x.to),onClick:n},x.id))})]},y.id))}),R.jsxs("div",{className:$t("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[R.jsx(tV,{theme:u,resolvedTheme:h,onSetTheme:p,glassChrome:s}),R.jsx("div",{className:"flex items-center gap-1.5",children:!t&&R.jsx(X$,{glassChrome:s})})]})]})}function nV({collapsed:t,onToggleCollapsed:e}){const n=k.useMemo(()=>typeof window>"u"?!1:Ga()||Nf(),[]);return R.jsx("aside",{"data-native-sidebar":!0,"aria-label":we("nav.aside_label"),className:$t("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:R.jsx(o4,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function aV({open:t,onClose:e}){return k.useEffect(()=>{if(!t)return;const n=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),k.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?R.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[R.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),R.jsx("aside",{"aria-label":we("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:R.jsx(o4,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function rV({onOpenDrawer:t}){return R.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[R.jsx(Q$,{title:we("nav.menu"),onClick:t,children:R.jsx(iO,{className:"h-5 w-5","aria-hidden":!0})}),R.jsxs(Ef,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[R.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),R.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),R.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function iV({children:t}){const{collapsed:e,toggle:n}=K$(),[a,r]=k.useState(!1),s=k.useCallback(()=>r(!0),[]),l=k.useCallback(()=>r(!1),[]),c=k.useMemo(()=>typeof window>"u"?!1:Ga()||Nf(),[]);return R.jsxs("div",{className:$t("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",Of()&&"tt-native-glass-shell",c?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[c&&R.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),R.jsxs("div",{className:"flex-1 min-h-0 flex",children:[R.jsx(nV,{collapsed:e,onToggleCollapsed:n}),R.jsx(aV,{open:a,onClose:l}),R.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:R.jsxs("div",{className:$t("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",c?"tt-native-main-card":"rounded-2xl",!c&&"shadow-sm"),children:[R.jsx(rV,{onOpenDrawer:s}),R.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}function sV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function iP({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:R.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function oV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function lV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function cV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function dV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function uV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function hV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:[R.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),R.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function pV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function sP({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 60",fill:"none",className:e,"aria-hidden":"true",children:[R.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),R.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:R.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),R.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:R.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function fV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:[R.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),R.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),R.jsx("path",{d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function mV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",className:e,children:R.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function gV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:e,children:R.jsx("path",{d:"M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263c-.135-.423-.73-.423-.867 0L1.388 9.452.045 13.587a.924.924 0 0 0 .331 1.03L12 23.054l11.625-8.436a.92.92 0 0 0 .33-1.031"})})}function vV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":"true",children:R.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:R.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function _V({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[R.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),R.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),R.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),R.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),R.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),R.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function yV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[R.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),R.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),R.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}function bV({size:t=16,className:e=""}){return R.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[R.jsx("path",{d:"M9 3v2"}),R.jsx("path",{d:"M15 3v2"}),R.jsx("rect",{x:"4",y:"6",width:"16",height:"13",rx:"3"}),R.jsx("circle",{cx:"9",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),R.jsx("circle",{cx:"15",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),R.jsx("path",{d:"M9 16h6"})]})}function kV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"})})}function wV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M20.113 5.5l-.442 1.557a.157.157 0 01-.196.106l-7.414-2.157a.16.16 0 00-.143.028l-7.342 5.74a.159.159 0 01-.074.032l-4.37.656a.154.154 0 00-.132.162l.02.245c.005.078.071.14.152.141l5.074.128.058.002 3.75-1.953a.16.16 0 01.164.01l2.657 1.847a.152.152 0 01.066.125l-.023 2.45c0 .032.01.063.028.089l3.737 5.227c.03.04.077.065.129.065h1.182a.153.153 0 00.14-.224l-2.664-4.919a.15.15 0 01.005-.152l1.389-2.169a.156.156 0 01.062-.055l4.965-2.456a.16.16 0 01.158.01l1.418.921a.16.16 0 00.087.026h1.289c.125 0 .2-.136.13-.237l-3.578-5.29c-.074-.109-.246-.082-.282.044z"})})}function xV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})})}function PV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:R.jsx("path",{d:"M0 0v24h24V0H0zm22.222 22.222H1.778V1.778h20.444v20.444zm-7.555-4.964h2.222v1.778h-2.794L12.89 17.83v-2.794h1.778v2.222zm4 0h-1.778v-2.222h-2.222v-1.778h2.793l1.207 1.207v2.793zm-7.556-2.591H9.333v-1.778h1.778v1.778zm-5.778-1.778h1.778v4h4v1.778H6.54L5.333 17.46V12.89zm13.334-3.556v1.778h-5.778V9.333h1.987V7.111h-1.987V5.333h2.558l1.206 1.207v2.793h2.014zm-11.556-2h2.222l1.778 1.778v2H9.333v-2H7.111v2H5.333V5.333h1.778v2zm4 0H9.333v-2h1.778v2z"})})}function SV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,children:R.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.125 2.75C2.9179 2.75 2.75 2.9179 2.75 3.125V11.375H2V3.125C2 2.50368 2.50368 2 3.125 2H13.1723C13.6735 2 13.9244 2.6059 13.5701 2.96025L7.38189 9.14843H9.125V8.375H9.875V9.33593C9.875 9.6466 9.6232 9.8984 9.3125 9.8984H6.63189L5.34282 11.1875H11.1875V6.5H11.9375V11.1875C11.9375 11.6017 11.6017 11.9375 11.1875 11.9375H4.59282L3.28032 13.25H12.875C13.0821 13.25 13.25 13.0821 13.25 12.875V4.625H14V12.875C14 13.4963 13.4963 14 12.875 14H2.82767C2.32653 14 2.07557 13.3941 2.42992 13.0397L8.59468 6.875H6.875V7.625H6.125V6.6875C6.125 6.37684 6.37684 6.125 6.6875 6.125H9.34468L10.6571 4.8125H4.8125V9.5H4.0625V4.8125C4.0625 4.39829 4.39829 4.0625 4.8125 4.0625H11.4071L12.7197 2.75H3.125Z"})})}function CV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",xmlns:"http://www.w3.org/2000/svg",className:e,children:R.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"})})}const TV={CLAUDE:sV,ZCODE:kV,CODEBUDDY:sP,WORKBUDDY:sP,CODEX:iP,COPILOT:pV,CRAFT:vV,CURSOR:oV,DEEPSEEK:CV,DROID:bV,"EVERY-CODE":iP,GEMINI:lV,GITHUB:mV,GITLAB:gV,GOOSE:xV,GROK:cV,HERMES:fV,KIMI:hV,KIRO:dV,KILOCODE:PV,OPENCODE:uV,OMP:_V,PI:yV,ROOCODE:wV,ZED:SV},EV={ANTIGRAVITY:"/brand-logos/antigravity.svg",ANYTHINGLLM:"/brand-logos/anythingllm.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",DEEPSEEK:"/brand-logos/deepseek.svg",GEMINI:"/brand-logos/gemini.svg","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",MIMO:"/brand-logos/mimo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"},AV={ANYTHINGLLM:"brightness-0 dark:brightness-100"};function RV({size:t=16,className:e=""}){return R.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:R.jsx("circle",{cx:"12",cy:"12",r:"7.5",strokeDasharray:"3 3"})})}function LV({provider:t,size:e=16,color:n,className:a=""}){const r=t?.toUpperCase?.()||"",s=EV[r];if(s){const c=`${AV[r]||""} ${a}`.trim();return R.jsx("img",{src:s,alt:"",width:e,height:e,className:c,style:{width:e,height:e,objectFit:"contain"},"aria-hidden":!0})}const l=TV[r];return l?R.jsx(l,{size:e,className:a}):R.jsx(RV,{size:e,className:`text-oai-gray-400 dark:text-oai-gray-500 shrink-0 ${a}`})}const l4="tokentracker-skills";async function xo(t){const e=new URL(`/functions/${l4}`,window.location.origin);if(t)for(const[r,s]of Object.entries(t))s!=null&&s!==""&&e.searchParams.set(r,String(s));const n=await fetch(e.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),a=await n.json().catch(()=>null);if(!n.ok)throw new Error(a?.error||`Request failed with HTTP ${n.status}`);return a}async function ys(t){const e=await eu(),n=await fetch(`/functions/${l4}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e},cache:"no-store",body:JSON.stringify(t)}),a=await n.json().catch(()=>null);if(!n.ok||a?.ok===!1)throw new Error(a?.error||`Request failed with HTTP ${n.status}`);return a}function DV(){return xo({mode:"installed"})}function JY(t={}){return xo({mode:"discover",...t.force?{force:1}:{}})}function QY(t,e=0,n=20){return xo({mode:"search",q:t,offset:e,limit:n})}function XY(){return xo({mode:"repos"})}function eZ(t,e){return ys({action:"install",skill:t,targets:e})}function tZ(t){return ys({action:"uninstall",id:t})}function nZ(t){return ys({action:"restore",id:t})}function aZ(t,e){return ys({action:"set_targets",id:t,targets:e})}function rZ(t,e){return ys({action:"import_local",directory:t,targets:e})}function iZ(t,e){return ys({action:"delete_local",directory:t,targets:e||[]})}function sZ(t){return ys({action:"add_repo",repo:t})}function oZ(t,e){return ys({action:"remove_repo",owner:t,name:e})}function lZ(t={}){return xo({mode:"popular",...t.force?{force:1}:{}})}function cZ(t={}){return xo({mode:"updates",...t.force?{force:1}:{}})}function dZ(t={}){return xo({mode:"skill_usage",...t.force?{force:1}:{}})}const IV=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function MV(){const t=$l(),e=EB(),[n,a]=k.useState(!1),[r,s]=k.useState(""),[l,c]=k.useState(0),[u,h]=k.useState([]),p=k.useRef(null),m=k.useRef(null);k.useEffect(()=>{const E=A=>{(A.metaKey||A.ctrlKey)&&(A.key==="k"||A.key==="K")&&(A.preventDefault(),a(B=>!B))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[]),k.useEffect(()=>{if(!n)return;s(""),c(0);const E=requestAnimationFrame(()=>p.current?.focus());return IV&&!u.length&&DV().then(A=>h(A?.skills||[])).catch(()=>h([])),()=>cancelAnimationFrame(E)},[n,u.length]);const v=k.useMemo(()=>{const E=s4().flatMap(D=>D.items.map(B=>({kind:"page",id:`page:${B.id}`,label:B.label,sub:we("cmdk.group.pages"),Icon:B.icon,run:()=>t(B.to)}))),A=(u||[]).map(D=>({kind:"skill",id:`skill:${D.id||D.directory}`,label:D.name||D.directory,sub:D.repoOwner&&D.repoName?`${D.repoOwner}/${D.repoName}`:we("cmdk.group.skills"),provider:(D.targets||[])[0]||"claude",run:()=>t(`/skills?skill=${encodeURIComponent(D.directory||D.id)}`)}));return[...E,...A]},[t,u]),y=k.useMemo(()=>{const E=r.trim().toLowerCase();return E?v.filter(A=>A.label.toLowerCase().includes(E)||String(A.sub||"").toLowerCase().includes(E)):v},[v,r]);k.useEffect(()=>{l>=y.length&&c(y.length?y.length-1:0)},[l,y.length]),k.useEffect(()=>{if(!n)return;m.current?.querySelector(`[data-cmdk-index="${l}"]`)?.scrollIntoView({block:"nearest"})},[l,n]);const b=k.useCallback(()=>a(!1),[]),x=k.useCallback(E=>{E&&(b(),E.run())},[b]),P=E=>{E.key==="ArrowDown"?(E.preventDefault(),c(A=>Math.min(A+1,Math.max(0,y.length-1)))):E.key==="ArrowUp"?(E.preventDefault(),c(A=>Math.max(A-1,0))):E.key==="Enter"?(E.preventDefault(),x(y[l])):E.key==="Escape"&&(E.preventDefault(),b())},T={duration:e?0:.12},L=e?{duration:0}:{type:"spring",stiffness:460,damping:34,mass:.6};return R.jsx(A5,{children:n?R.jsxs(kd.div,{className:"fixed inset-0 z-[120] flex items-start justify-center px-4 pt-[16vh]",initial:e?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:T,children:[R.jsx("button",{type:"button","aria-label":we("cmdk.close"),onClick:b,className:"absolute inset-0 cursor-default bg-oai-black/40"}),R.jsxs(kd.div,{role:"dialog","aria-modal":"true","aria-label":we("cmdk.open_aria"),initial:e?!1:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:e?{opacity:0}:{opacity:0,y:-8,scale:.985},transition:L,className:"relative w-full max-w-xl overflow-hidden rounded-2xl border border-oai-gray-200 bg-oai-white shadow-2xl dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[R.jsxs("div",{className:"flex items-center gap-2.5 border-b border-oai-gray-200 px-4 dark:border-oai-gray-800",children:[R.jsx(gO,{className:"h-4 w-4 shrink-0 text-oai-gray-400","aria-hidden":!0}),R.jsx("input",{ref:p,type:"text",value:r,onChange:E=>{s(E.target.value),c(0)},onKeyDown:P,"aria-label":we("cmdk.placeholder"),"aria-controls":"cmdk-listbox","aria-activedescendant":y[l]?`cmdk-opt-${l}`:void 0,role:"combobox","aria-expanded":"true",placeholder:we("cmdk.placeholder"),className:"h-12 w-full bg-transparent text-sm text-oai-black placeholder:text-oai-gray-400 focus:outline-none dark:text-white"})]}),R.jsx("div",{ref:m,id:"cmdk-listbox",role:"listbox",className:"max-h-[min(56vh,22rem)] overflow-y-auto p-1.5",children:y.length===0?R.jsx("div",{className:"px-3 py-8 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:we("cmdk.empty")}):y.map((E,A)=>{const D=A===l;return R.jsxs("button",{type:"button",role:"option",id:`cmdk-opt-${A}`,"data-cmdk-index":A,"aria-selected":D,onMouseMove:()=>c(A),onClick:()=>x(E),className:$t("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",D?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200"),children:[R.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-400",children:E.kind==="skill"?R.jsx(LV,{provider:E.provider,size:16}):R.jsx(E.Icon,{className:"h-4 w-4","aria-hidden":!0})}),R.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:E.label}),R.jsx("span",{className:"shrink-0 truncate text-xs text-oai-gray-400 dark:text-oai-gray-500",children:E.sub}),D?R.jsx(YN,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}):null]},E.id)})})]})]}):null})}const NV=[];function rb(t){k.useEffect(t,NV)}const oP={};function Ql(t,e){const n=k.useRef(oP);return n.current===oP&&(n.current=t(e)),n}const OV=()=>{},Ka=typeof document<"u"?k.useLayoutEffect:OV;function jV(t,e){return function(a,...r){const s=new URL(t);return s.searchParams.set("code",a.toString()),r.forEach(l=>s.searchParams.append("args[]",l)),`${e} error #${a}; visit ${s} for the full message.`}}const Xl=jV("https://base-ui.com/production-error","Base UI"),ib=k.createContext(void 0);function sb(){const t=k.useContext(ib);if(!t)throw new Error(Xl(73));return t}const fr=(t,e,n,a,r,s,...l)=>{if(l.length>0)throw new Error(Xl(1));let c;if(t&&e&&n&&a&&r&&s)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m),x=a(u,h,p,m),P=r(u,h,p,m);return s(v,y,b,x,P,h,p,m)};else if(t&&e&&n&&a&&r)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m),x=a(u,h,p,m);return r(v,y,b,x,h,p,m)};else if(t&&e&&n&&a)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m),b=n(u,h,p,m);return a(v,y,b,h,p,m)};else if(t&&e&&n)c=(u,h,p,m)=>{const v=t(u,h,p,m),y=e(u,h,p,m);return n(v,y,h,p,m)};else if(t&&e)c=(u,h,p,m)=>{const v=t(u,h,p,m);return e(v,h,p,m)};else if(t)c=t;else throw new Error("Missing arguments");return c};var uv={exports:{}},hv={};var lP;function zV(){if(lP)return hv;lP=1;var t=Kd();function e(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var n=typeof Object.is=="function"?Object.is:e,a=t.useState,r=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(m,v){var y=v(),b=a({inst:{value:y,getSnapshot:v}}),x=b[0].inst,P=b[1];return s(function(){x.value=y,x.getSnapshot=v,u(x)&&P({inst:x})},[m,y,v]),r(function(){return u(x)&&P({inst:x}),m(function(){u(x)&&P({inst:x})})},[m]),l(y),y}function u(m){var v=m.getSnapshot;m=m.value;try{var y=v();return!n(m,y)}catch{return!0}}function h(m,v){return v()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return hv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,hv}var cP;function c4(){return cP||(cP=1,uv.exports=zV()),uv.exports}var FV=c4(),pv={exports:{}},fv={};var dP;function UV(){if(dP)return fv;dP=1;var t=Kd(),e=c4();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var a=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return fv.useSyncExternalStoreWithSelector=function(h,p,m,v,y){var b=s(null);if(b.current===null){var x={hasValue:!1,value:null};b.current=x}else x=b.current;b=c(function(){function T(B){if(!L){if(L=!0,E=B,B=v(B),y!==void 0&&x.hasValue){var j=x.value;if(y(j,B))return A=j}return A=B}if(j=A,a(E,B))return j;var S=v(B);return y!==void 0&&y(j,S)?(E=B,j):(E=B,A=S)}var L=!1,E,A,D=m===void 0?null:m;return[function(){return T(p())},D===null?void 0:function(){return T(D())}]},[p,m,v,y]);var P=r(h,b[0],b[1]);return l(function(){x.hasValue=!0,x.value=P},[P]),u(P),P},fv}var uP;function BV(){return uP||(uP=1,pv.exports=UV()),pv.exports}var $V=BV();const VV=parseInt(k.version,10);function ob(t){return VV>=t}const HV=ob(19),WV=HV?qV:KV;function d4(t,e,n,a,r){return WV(t,e,n,a,r)}function GV(t,e,n,a,r){const s=k.useCallback(()=>e(t.getSnapshot(),n,a,r),[t,e,n,a,r]);return FV.useSyncExternalStore(t.subscribe,s,s)}function qV(t,e,n,a,r){return GV(t,e,n,a,r)}function KV(t,e,n,a,r){return $V.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,s=>e(s,n,a,r))}class YV{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const a of this.listeners){if(n!==this.updateTick)return;a(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){this.setState({...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||this.setState({...this.state,[e]:n})}notifyAll(){const e={...this.state};this.setState(e)}use(e,n,a,r){return d4(this,e,n,a,r)}}const lb={...OS},mv=lb.useInsertionEffect,ZV=mv&&mv!==lb.useLayoutEffect?mv:t=>t();function go(t){const e=Ql(JV).current;return e.next=t,ZV(e.effect),e.trampoline}function JV(){const t={next:void 0,callback:QV,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function QV(){}function XV(){}const uZ=Object.freeze([]),eo=Object.freeze({});class eH extends YV{constructor(e,n={},a){super(e),this.context=n,this.selectors=a}useSyncedValue(e,n){k.useDebugValue(e);const a=this;Ka(()=>{a.state[e]!==n&&a.set(e,n)},[a,e,n])}useSyncedValueWithCleanup(e,n){const a=this;Ka(()=>(a.state[e]!==n&&a.set(e,n),()=>{a.set(e,void 0)}),[a,e,n])}useSyncedValues(e){const n=this,a=Object.values(e);Ka(()=>{n.update(e)},[n,...a])}useControlledProp(e,n){k.useDebugValue(e);const a=this,r=n!==void 0;Ka(()=>{r&&!Object.is(a.state[e],n)&&a.setState({...a.state,[e]:n})},[a,e,n,r])}select(e,n,a,r){const s=this.selectors[e];return s(this.state,n,a,r)}useState(e,n,a,r){return k.useDebugValue(e),d4(this,this.selectors[e],n,a,r)}useContextCallback(e,n){k.useDebugValue(e);const a=go(n??XV);this.context[e]=a}useStateSetter(e){const n=k.useRef(void 0);return n.current===void 0&&(n.current=a=>{this.set(e,a)}),n.current}observe(e,n){let a;typeof e=="function"?a=e:a=this.selectors[e];let r=a(this.state);return n(r,r,this),this.subscribe(s=>{const l=a(s);if(!Object.is(r,l)){const c=r;r=l,n(l,c,this)}})}}function Vf(){return typeof window<"u"}function wr(t){return cb(t)?(t.nodeName||"").toLowerCase():"#document"}function Ei(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tH(t){var e;return(e=(cb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function cb(t){return Vf()?t instanceof Node||t instanceof Ei(t).Node:!1}function db(t){return Vf()?t instanceof Element||t instanceof Ei(t).Element:!1}function fs(t){return Vf()?t instanceof HTMLElement||t instanceof Ei(t).HTMLElement:!1}function Jp(t){return!Vf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ei(t).ShadowRoot}function u4(t){const{overflow:e,overflowX:n,overflowY:a,display:r}=Hf(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+n)&&r!=="inline"&&r!=="contents"}function hZ(t){return/^(table|td|th)$/.test(wr(t))}function nH(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const aH=/transform|translate|scale|rotate|perspective|filter/,rH=/paint|layout|strict|content/,js=t=>!!t&&t!=="none";let gv;function iH(t){const e=db(t)?Hf(t):t;return js(e.transform)||js(e.translate)||js(e.scale)||js(e.rotate)||js(e.perspective)||!sH()&&(js(e.backdropFilter)||js(e.filter))||aH.test(e.willChange||"")||rH.test(e.contain||"")}function pZ(t){let e=q_(t);for(;fs(e)&&!h4(e);){if(iH(e))return e;if(nH(e))return null;e=q_(e)}return null}function sH(){return gv==null&&(gv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gv}function h4(t){return/^(html|body|#document)$/.test(wr(t))}function Hf(t){return Ei(t).getComputedStyle(t)}function fZ(t){return db(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q_(t){if(wr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Jp(t)&&t.host||tH(t);return Jp(e)?e.host:e}function p4(t){const e=q_(t);return h4(e)?t.ownerDocument?t.ownerDocument.body:t.body:fs(e)&&u4(e)?e:p4(e)}function hP(t,e,n){var a;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=p4(t),s=r===((a=t.ownerDocument)==null?void 0:a.body),l=Ei(r);if(s){const c=oH(l);return e.concat(l,l.visualViewport||[],u4(r)?r:[],c&&n?hP(c):[])}else return e.concat(r,hP(r,[],n))}function oH(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function f4(...t){return()=>{for(let e=0;e<t.length;e+=1){const n=t[e];n&&n()}}}function br(t){return t?.ownerDocument||document}function to(t,e,n,a){return t.addEventListener(e,n,a),()=>{t.removeEventListener(e,n,a)}}const Ah=null;class lH{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let r=0;r<n.length;r+=1)n[r]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Rh=new lH;class ub{static create(){return new ub}static request(e){return Rh.request(e)}static cancel(e){return Rh.cancel(e)}currentId=Ah;request(e){this.cancel(),this.currentId=Rh.request(()=>{this.currentId=Ah,e()})}cancel=()=>{this.currentId!==Ah&&(Rh.cancel(this.currentId),this.currentId=Ah)};disposeEffect=()=>this.cancel}function cH(){const t=Ql(ub.create).current;return rb(t.disposeEffect),t}const Vc=0;class Fd{static create(){return new Fd}currentId=Vc;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Vc,n()},e)}isStarted(){return this.currentId!==Vc}clear=()=>{this.currentId!==Vc&&(clearTimeout(this.currentId),this.currentId=Vc)};disposeEffect=()=>this.clear}function dH(){const t=Ql(Fd.create).current;return rb(t.disposeEffect),t}let pP=0;function m4(t){return pP+=1,`${t}-${Math.random().toString(36).slice(2,6)}-${pP}`}function vv(t,e){if(typeof t=="string")return{description:t};if(typeof t=="function"){const n=t(e);return typeof n=="string"?{description:n}:n}return t}function uH(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:hH,platform:pH,maxTouchPoints:fH}=uH(),Wf=hH.toLowerCase(),Ud=pH.toLowerCase(),g4=/^i(os$|p)/.test(Ud)||Ud==="macintel"&&fH>1,fP="android",mZ=Ud===fP||Wf.includes(fP),mH=!g4&&Ud.startsWith("mac");Ud.startsWith("win");const gH=mH||g4,hb=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!hb&&Wf.includes("firefox");!hb&&Wf.includes("chrom");const vH=gH,_H=/jsdom|happydom/.test(Wf),mP="data-base-ui-focusable",v4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",gZ="ArrowLeft",vZ="ArrowRight",_Z="ArrowUp",yZ="ArrowDown";function xl(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Ai(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Jp(n)){let a=e;for(;a;){if(t===a)return!0;a=a.parentNode||a.host}}return!1}function no(t){return"composedPath"in t?t.composedPath()[0]:t.target}function bZ(t,e){if(!db(t))return!1;const n=t;if(e.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,a]of e.entries())if(Ai(a,n))return!a.hasAttribute("data-trigger-disabled");return!1}function kZ(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function wZ(t){return t.matches("html,body")}function yH(t){return fs(t)&&t.matches(v4)}function xZ(t){return t?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${v4}`)!=null}function PZ(t){return t?t.getAttribute("role")==="combobox"&&yH(t):!1}function K_(t){if(!t||_H)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function SZ(t){return t?t.hasAttribute(mP)?t:t.querySelector(`[${mP}]`)||t:null}function CZ(t,e){return e<0||e>=t.length}function TZ(t,e){return _4(t.current,{disabledIndices:e})}function EZ(t,e){return _4(t.current,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function _4(t,{startingIndex:e=-1,decrement:n=!1,disabledIndices:a,amount:r=1}={}){let s=e;do s+=n?-r:r;while(s>=0&&s<=t.length-1&&bH(t,s,a));return s}function bH(t,e,n){if(typeof n=="function"?n(e):n?.includes(e)??!1)return!0;const r=t[e];return r?y4(r)?!n&&(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"):!0:!1}function kH(t){return t.visibility==="hidden"||t.visibility==="collapse"}function y4(t,e=t?Hf(t):null){return!t||!t.isConnected||!e||kH(e)?!1:typeof t.checkVisibility=="function"?t.checkVisibility():e.display!=="none"&&e.display!=="contents"}const wH='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function xH(t){const e=t.assignedSlot;if(e)return e;if(t.parentElement)return t.parentElement;const n=t.getRootNode();return Jp(n)?n.host:null}function Y_(t){for(const e of Array.from(t.children))if(wr(e)==="summary")return e;return null}function PH(t,e){const n=Y_(e);return!!n&&(t===n||Ai(n,t))}function b4(t){const e=t?wr(t):"";return t!=null&&t.matches(wH)&&(e!=="summary"||t.parentElement!=null&&wr(t.parentElement)==="details"&&Y_(t.parentElement)===t)&&(e!=="details"||Y_(t)==null)&&(e!=="input"||t.type!=="hidden")}function k4(t){if(!b4(t)||!t.isConnected||t.matches(":disabled"))return!1;for(let e=t;e;e=xH(e)){const n=e!==t,a=wr(e)==="slot";if(e.hasAttribute("inert")||n&&wr(e)==="details"&&!e.open&&!PH(t,e)||e.hasAttribute("hidden")||!a&&!SH(e,n))return!1}return!0}function SH(t,e){const n=Hf(t);return e?n.display!=="none":y4(t,n)}function w4(t){const e=t.tabIndex;if(e<0){const n=wr(t);if(n==="details"||n==="audio"||n==="video"||fs(t)&&t.isContentEditable)return 0}return e}function _v(t){if(wr(t)!=="input")return null;const e=t;return e.type==="radio"&&e.name!==""?e:null}function CH(t,e){const n=_v(t);if(!n)return!0;const a=e.find(r=>{const s=_v(r);return s?.name===n.name&&s.form===n.form&&s.checked});return a?a===n:e.find(r=>{const s=_v(r);return s?.name===n.name&&s.form===n.form})===n}function x4(t){if(fs(t)&&wr(t)==="slot"){const e=t.assignedElements({flatten:!0});if(e.length>0)return e}return fs(t)&&t.shadowRoot?Array.from(t.shadowRoot.children):Array.from(t.children)}function P4(t,e){x4(t).forEach(n=>{b4(n)&&e.push(n),P4(n,e)})}function S4(t,e,n){x4(t).forEach(a=>{fs(a)&&a.matches(e)&&n.push(a),S4(a,e,n)})}function AZ(t){return k4(t)&&w4(t)>=0}function TH(t){const e=[];return P4(t,e),e.filter(k4)}function pb(t){const e=TH(t);return e.filter(n=>w4(n)>=0&&CH(n,e))}function C4(t,e){const n=pb(t),a=n.length;if(a===0)return;const r=xl(br(t)),s=n.indexOf(r),l=s===-1?e===1?0:a-1:s+e;return n[l]}function EH(t){return C4(br(t).body,1)||t}function AH(t){return C4(br(t).body,-1)||t}function T4(t,e){if(!t)return null;const n=pb(br(t).body),a=n.length;if(a===0)return null;const r=n.indexOf(t);if(r===-1)return null;const s=(r+e+a)%a;return n[s]}function RZ(t){return T4(t,1)}function LZ(t){return T4(t,-1)}function yv(t,e){const n=e||t.currentTarget,a=t.relatedTarget;return!a||!Ai(n,a)}function RH(t){pb(t).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function gP(t){const e=[];S4(t,"[data-tabindex]",e),e.forEach(n=>{const a=n.dataset.tabindex;delete n.dataset.tabindex,a?n.setAttribute("tabindex",a):n.removeAttribute("tabindex")})}function Lh(t){const e=new Map;let n=0,a=0;return t.forEach((r,s)=>{const l=r.transitionStatus==="ending";e.set(r.id,{value:r,domIndex:s,visibleIndex:l?-1:n,offsetY:a}),a+=r.height||0,l||(n+=1)}),e}function bv(t,e){let n=0;return t.map(a=>{if(a.transitionStatus==="ending")return a;const r=n>=e;return n+=1,a.limited===r?a:{...a,limited:r}})}const Dh=t=>t.toastMetadata,Ir={toasts:fr(t=>t.toasts),isEmpty:fr(t=>t.toasts.length===0),toast:fr(Dh,(t,e)=>t.get(e)?.value),toastIndex:fr(Dh,(t,e)=>t.get(e)?.domIndex??-1),toastOffsetY:fr(Dh,(t,e)=>t.get(e)?.offsetY??0),toastVisibleIndex:fr(Dh,(t,e)=>t.get(e)?.visibleIndex??-1),hovering:fr(t=>t.hovering),focused:fr(t=>t.focused),expanded:fr(t=>t.hovering||t.focused),expandedOrOutOfFocus:fr(t=>t.hovering||t.focused||!t.isWindowFocused),prevFocusElement:fr(t=>t.prevFocusElement)};class LH extends eH{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Lh(e.toasts)},{},Ir)}setFocused(e){this.set("focused",e)}setHovering(e){this.set("hovering",e)}setIsWindowFocused(e){this.set("isWindowFocused",e)}setPrevFocusElement(e){this.set("prevFocusElement",e)}setViewport=e=>{this.set("viewport",e)};syncProviderProps(e){const n=this.state.limit!==e.limit;if(this.state.timeout===e.timeout&&!n)return;const a={timeout:e.timeout,limit:e.limit};if(n){const r=bv(this.state.toasts,e.limit);a.toasts=r,a.toastMetadata=Lh(r)}this.update(a)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,n={}){const a=Ir.toastIndex(this.state,e);if(a===-1)return;const r=this.state.toasts[a];n.skipOnRemove||r?.onRemove?.();const s=[...this.state.toasts];s.splice(a,1),this.setToasts(s)}addToast=e=>{const{timeout:n,limit:a}=this.state,r=e.id||m4("toast");if(e.id){const u=Ir.toast(this.state,e.id);if(u)if(u.transitionStatus==="ending")this.removeToast(e.id,{skipOnRemove:!0});else{const{id:h,transitionStatus:p,...m}=e;return this.updateToastInternal(e.id,m,{resetTimer:!0,markUpdated:!0}),e.id}}const s={...e,id:r,updateKey:0,transitionStatus:"starting"},l=[s,...this.state.toasts];this.setToasts(bv(l,a));const c=s.timeout??n;return s.type!=="loading"&&c>0&&this.scheduleTimer(r,c,()=>this.closeToast(r)),Ir.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,n)=>{this.updateToastInternal(e,n,{markUpdated:!0})};updateToastInternal=(e,n,a={})=>{const{timeout:r,toasts:s}=this.state,l=Ir.toast(this.state,e)??null;if(!l||l.transitionStatus==="ending")return;const c={...l,...n,...a.markUpdated&&{updateKey:(l.updateKey??0)+1}};this.setToasts(s.map(x=>x.id===e?c:x));const u=c.timeout??r,h=l?.timeout??r,p=Object.hasOwn(n,"timeout"),m=c.transitionStatus!=="ending"&&c.type!=="loading"&&u>0,v=this.timers.has(e),y=h!==u,b=l?.type==="loading";if(!m&&v){this.clearTimer(e);return}m&&(!v||y||p||b||a.resetTimer)&&(this.clearTimer(e),this.scheduleTimer(e,u,()=>this.closeToast(e)),Ir.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{const n=e===void 0,{limit:a,toasts:r}=this.state;let s;if(n)s=r,this.clearTimers();else{const p=Ir.toast(this.state,e);if(!p)return;s=[p],this.clearTimer(e)}const l=r.map(p=>n||p.id===e?{...p,transitionStatus:"ending",height:0}:p),c=bv(l,a),u={toasts:c,toastMetadata:Lh(c)};c.some(p=>p.transitionStatus!=="ending")||(u.hovering=!1,u.focused=!1),this.update(u),s.forEach(p=>{p.transitionStatus!=="ending"&&p.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,n)=>{const a=vv(n.loading),r=this.addToast({...a,type:"loading"}),s=e.then(l=>{const c=vv(n.success,l);return this.updateToast(r,{...c,type:"success",timeout:c.timeout}),l}).catch(l=>{const c=vv(n.error,l);return this.updateToast(r,{...c,type:"error",timeout:c.timeout}),Promise.reject(l)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();const n=Date.now()-e.start,a=e.delay-n;e.remaining=a>0?a:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,n)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=Fd.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(n),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!=="touch")return;const n=no(e);Ai(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,n,a){const r=Date.now(),s=!Ir.expandedOrOutOfFocus(this.state),l=s?Fd.create():void 0;l?.start(n,()=>{this.handleTimerFired(e),a()}),this.timers.set(e,{timeout:l,start:s?r:0,delay:n,remaining:n,callback:a})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e){const n={toasts:e,toastMetadata:Lh(e)};e.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){const n=xl(br(this.state.viewport));if(!this.state.viewport||!Ai(this.state.viewport,n)||!K_(n))return;if(e===void 0){this.restoreFocusToPrevElement();return}const a=Ir.toasts(this.state),r=Ir.toastIndex(this.state,e);let s=null,l=r+1;for(;l<a.length;){if(a[l].transitionStatus!=="ending"){s=a[l];break}l+=1}if(!s)for(l=r-1;l>=0;){if(a[l].transitionStatus!=="ending"){s=a[l];break}l-=1}s?s.ref?.current?.focus():this.restoreFocusToPrevElement()}}const DH=function(e){const{children:n,timeout:a=5e3,limit:r=3,toastManager:s}=e,l=Ql(()=>new LH({timeout:a,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return rb(l.disposeEffect),k.useEffect(function(){return s?s[" subscribe"](({action:h,options:p})=>{const m=p.id;h==="promise"&&p.promise?l.promiseToast(p.promise,p):h==="update"&&m?l.updateToast(m,p):h==="close"?l.closeToast(m):l.addToast(p)}):void 0},[l,s]),Ka(()=>{l.syncProviderProps({timeout:a,limit:r})},[l,a,r]),R.jsx(ib.Provider,{value:l,children:n})},E4={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},A4={...E4,position:"fixed",top:0,left:0},DZ={...E4,position:"absolute"},wd=k.forwardRef(function(e,n){const[a,r]=k.useState();Ka(()=>{vH&&hb&&r("button")},[]);const s={tabIndex:0,role:a};return R.jsx("span",{...e,ref:n,style:A4,"aria-hidden":a?void 0:!0,...s,"data-base-ui-focus-guard":""})});function vP(t,e,n,a){const r=Ql(R4).current;return MH(r,t,e,n,a)&&L4(r,[t,e,n,a]),r.callback}function IH(t){const e=Ql(R4).current;return NH(e,t)&&L4(e,t),e.callback}function R4(){return{callback:null,cleanup:null,refs:[]}}function MH(t,e,n,a,r){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==a||t.refs[3]!==r}function NH(t,e){return t.refs.length!==e.length||t.refs.some((n,a)=>n!==e[a])}function L4(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const a=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const l=s(n);typeof l=="function"&&(a[r]=l);break}case"object":{s.current=n;break}}}t.cleanup=()=>{for(let r=0;r<e.length;r+=1){const s=e[r];if(s!=null)switch(typeof s){case"function":{const l=a[r];typeof l=="function"?l():s(null);break}case"object":{s.current=null;break}}}}}}}function _P(t){if(!k.isValidElement(t))return null;const e=t,n=e.props;return(ob(19)?n?.ref:e.ref)??null}function Z_(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}function OH(t,e){const n={};for(const a in t){const r=t[a];if(e?.hasOwnProperty(a)){const s=e[a](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${a.toLowerCase()}`]="":r&&(n[`data-${a.toLowerCase()}`]=r.toString())}return n}function jH(t,e){return typeof t=="function"?t(e):t}function zH(t,e){return typeof t=="function"?t(e):t}const fb={};function mb(t,e,n,a,r){if(!n&&!a&&!r&&!t)return Qp(e);let s=Qp(t);return e&&(s=sd(s,e)),n&&(s=sd(s,n)),a&&(s=sd(s,a)),r&&(s=sd(s,r)),s}function FH(t){if(t.length===0)return fb;if(t.length===1)return Qp(t[0]);let e=Qp(t[0]);for(let n=1;n<t.length;n+=1)e=sd(e,t[n]);return e}function Qp(t){return gb(t)?{...I4(t,fb)}:UH(t)}function sd(t,e){return gb(e)?I4(e,t):BH(t,e)}function UH(t){const e={...t};for(const n in e){const a=e[n];D4(n,a)&&(e[n]=M4(a))}return e}function BH(t,e){if(!e)return t;for(const n in e){const a=e[n];switch(n){case"style":{t[n]=Z_(t.style,a);break}case"className":{t[n]=N4(t.className,a);break}default:D4(n,a)?t[n]=$H(t[n],a):t[n]=a}}return t}function D4(t,e){const n=t.charCodeAt(0),a=t.charCodeAt(1),r=t.charCodeAt(2);return n===111&&a===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function gb(t){return typeof t=="function"}function I4(t,e){return gb(t)?t(e):t??fb}function $H(t,e){return e?t?(...n)=>{const a=n[0];if(O4(a)){const s=a;Xp(s);const l=e(...n);return s.baseUIHandlerPrevented||t?.(...n),l}const r=e(...n);return t?.(...n),r}:M4(e):t}function M4(t){return t&&((...e)=>{const n=e[0];return O4(n)&&Xp(n),t(...e)})}function Xp(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function N4(t,e){return e?t?e+" "+t:e:t}function O4(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function ou(t,e,n={}){const a=e.render,r=VH(e,n);if(n.enabled===!1)return null;const s=n.state??eo;return GH(t,a,r,s)}function VH(t,e={}){const{className:n,style:a,render:r}=t,{state:s=eo,ref:l,props:c,stateAttributesMapping:u,enabled:h=!0}=e,p=h?jH(n,s):void 0,m=h?zH(a,s):void 0,v=h?OH(s,u):eo,y=h&&c?HH(c):void 0,b=h?Z_(v,y)??{}:eo;return typeof document<"u"&&(h?Array.isArray(l)?b.ref=IH([b.ref,_P(r),...l]):b.ref=vP(b.ref,_P(r),l):vP(null,null)),h?(p!==void 0&&(b.className=N4(b.className,p)),m!==void 0&&(b.style=Z_(b.style,m)),b):eo}function HH(t){return Array.isArray(t)?FH(t):mb(void 0,t)}const WH=Symbol.for("react.lazy");function GH(t,e,n,a){if(e){if(typeof e=="function")return e(n,a);const r=mb(n,e.props);r.ref=n.ref;let s=e;return s?.$$typeof===WH&&(s=k.Children.toArray(e)[0]),k.cloneElement(s,r)}if(t&&typeof t=="string")return qH(t,n);throw new Error(Xl(8))}function qH(t,e){return t==="button"?k.createElement("button",{type:"button",...e,key:e.key}):t==="img"?k.createElement("img",{alt:"",...e,key:e.key}):k.createElement(t,e)}let KH=(function(t){return t.frontmostHeight="--toast-frontmost-height",t})({});const YH=k.forwardRef(function(e,n){const{render:a,className:r,style:s,children:l,...c}=e,u=sb(),h=dH(),p=k.useRef(!1),m=k.useRef(!1),v=k.useRef(!1),y=u.useState("isEmpty"),b=u.useState("toasts"),x=u.useState("focused"),P=u.useState("expanded"),T=u.useState("prevFocusElement"),L=b[0]?.height??0,E=k.useMemo(()=>b.some($=>$.transitionStatus==="ending"),[b]),A=k.useMemo(()=>b.filter($=>$.priority==="high"),[b]);k.useEffect(()=>{const $=u.state.viewport;if(!$)return;function X(O){y||O.key==="F6"&&no(O)!==$&&(O.preventDefault(),u.setPrevFocusElement(xl(br($))),$?.focus({preventScroll:!0}),u.pauseTimers(),u.setFocused(!0))}const W=Ei($);return to(W,"keydown",X)},[u,y]),k.useEffect(()=>{const $=u.state.viewport;if(!$||y)return;const X=Ei($);function W(Y){no(Y)===X&&(u.setIsWindowFocused(!1),u.pauseTimers())}function O(Y){if(Y.relatedTarget)return;const ae=no(Y),_e=xl(br($));(ae===X||!Ai($,ae)||!K_(_e))&&u.resumeTimers(),h.start(0,()=>u.setIsWindowFocused(!0))}return f4(to(X,"blur",W,!0),to(X,"focus",O,!0))},[u,h,y]),k.useEffect(()=>{const $=u.state.viewport;if(!$||y)return;const X=br($);return to(X,"pointerdown",u.handleDocumentPointerDown,!0)},[y,u]);function D($){const X=u.state.viewport;if(X)if(p.current=!0,$.relatedTarget===X){const W=b.find(O=>O.transitionStatus!=="ending"&&!O.limited);W?W.ref?.current?.focus():u.restoreFocusToPrevElement()}else u.restoreFocusToPrevElement()}function B($){$.key==="Tab"&&$.shiftKey&&no($.nativeEvent)===u.state.viewport&&($.preventDefault(),u.restoreFocusToPrevElement(),u.resumeTimers())}function j(){u.state.toasts.some(X=>X.transitionStatus==="ending")||v.current||!m.current||(u.state.isWindowFocused&&u.resumeTimers(),u.setHovering(!1),m.current=!1)}k.useEffect(j,[E,u]);function S(){u.pauseTimers(),u.setHovering(!0),m.current=!1}function N(){u.state.isWindowFocused&&u.resumeTimers()}function U(){u.state.toasts.some(X=>X.transitionStatus==="ending")||v.current?m.current=!0:(N(),u.setHovering(!1))}function Q($){$.pointerType==="touch"&&(v.current=!0)}function ee($){$.pointerType==="touch"&&(v.current=!1,j())}function ce(){if(p.current){p.current=!1;return}x||K_(xl(br(u.state.viewport)))&&(u.setFocused(!0),u.pauseTimers())}function le($){!x||Ai(u.state.viewport,$.relatedTarget)||(u.setFocused(!1),N())}const re={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:S,onMouseMove:S,onMouseLeave:U,onFocus:ce,onBlur:le,onKeyDown:B,onClick:ce,onPointerDown:Q,onPointerUp:ee,onPointerCancel:ee},te={expanded:P},ie=ou("div",e,{ref:[n,u.setViewport],state:te,props:[re,{style:{[KH.frontmostHeight]:L?`${L}px`:void 0}},c,{children:R.jsxs(k.Fragment,{children:[!y&&T&&R.jsx(wd,{onFocus:D}),l,!y&&T&&R.jsx(wd,{onFocus:D})]})}]});return R.jsxs(k.Fragment,{children:[!y&&T&&R.jsx(wd,{onFocus:D}),ie,!x&&A.length>0&&R.jsx("div",{style:A4,children:A.map($=>R.jsxs("div",{role:"alert","aria-atomic":!0,children:[R.jsx("div",{children:$.title}),R.jsx("div",{children:$.description})]},$.id))})]})});function ZH(t){return ob(19)?t:t?"true":void 0}const j4=k.createContext(void 0);function z4(){const t=k.useContext(j4);if(!t)throw new Error(Xl(66));return t}let vb=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const JH={[vb.startingStyle]:""},QH={[vb.endingStyle]:""},XH={transitionStatus(t){return t==="starting"?JH:t==="ending"?QH:null}};function eW(t){return t==null?t:"current"in t?t.current:t}function tW(t,e=!1,n=!0){const a=cH();return go((r,s=null)=>{a.cancel();const l=eW(t);if(l==null)return;const c=l,u=()=>{Vl.flushSync(r)};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function h(){Promise.all(c.getAnimations().map(p=>p.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(n){s?.aborted||u();return}const p=c.getAnimations();!s?.aborted&&p.length>0&&p.some(m=>m.pending||m.playState!=="finished")&&h()})}if(e){const p=vb.startingStyle;if(!c.hasAttribute(p)){a.request(h);return}const m=new MutationObserver(()=>{c.hasAttribute(p)||(m.disconnect(),h())});m.observe(c,{attributes:!0,attributeFilter:[p]}),s?.addEventListener("abort",()=>m.disconnect(),{once:!0});return}a.request(h)})}function nW(t){const{enabled:e=!0,open:n,ref:a,onComplete:r}=t,s=go(r),l=tW(a,n,!1);k.useEffect(()=>{if(!e)return;const c=new AbortController;return l(s,c.signal),()=>{c.abort()}},[e,n,s,l])}let zs=(function(t){return t.index="--toast-index",t.offsetY="--toast-offset-y",t.height="--toast-height",t.swipeMovementX="--toast-swipe-movement-x",t.swipeMovementY="--toast-swipe-movement-y",t})({});const IZ=500,MZ={style:{transition:"none"}},NZ="data-base-ui-click-trigger",aW="data-base-ui-swipe-ignore",rW="data-swipe-ignore",iW=`[${aW}]`,sW=`[${rW}]`,OZ={fallbackAxisSide:"none"},jZ={fallbackAxisSide:"end"},oW={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function yP(t,e,n){switch(t){case"up":return-n;case"down":return n;case"left":return-e;case"right":return e;default:return 0}}function lW(t){const n=Ei(t).getComputedStyle(t).transform;let a=0,r=0,s=1;if(n&&n!=="none"){const l=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const c=l[1].split(", ").map(parseFloat);c.length===6?(a=c[4],r=c[5],s=Math.sqrt(c[0]*c[0]+c[1]*c[1])):c.length===16&&(a=c[12],r=c[13],s=c[0])}}return{x:a,y:r,scale:s}}const cW={...XH,swipeDirection(t){return t?{"data-swipe-direction":t}:null}},Hc=40,dW=10,ns=.5,uW=1,hW=`${iW},${sW}`,pW=k.forwardRef(function(e,n){const{toast:a,render:r,className:s,swipeDirection:l=["down","right"],style:c,...u}=e,h=a.positionerProps?.anchor!==void 0;let p=[];h||(p=Array.isArray(l)?l:[l]);const m=p.length>0,v=sb(),[y,b]=k.useState(void 0),[x,P]=k.useState(!1),[T,L]=k.useState(!1),[E,A]=k.useState(!1),[D,B]=k.useState({x:0,y:0}),[j,S]=k.useState({x:0,y:0,scale:1}),[N,U]=k.useState(),[Q,ee]=k.useState(),[ce,le]=k.useState(null),re=k.useRef(null),te=k.useRef({x:0,y:0}),ie=k.useRef({x:0,y:0,scale:1}),$=k.useRef(void 0),X=k.useRef(0),W=k.useRef(!1),O=k.useRef({x:0,y:0}),Y=k.useRef(!1),ae=k.useRef({x:0,y:0}),_e=k.useRef(null),fe=k.useRef(null),ve=v.useState("toastIndex",a.id),Ne=v.useState("toastVisibleIndex",a.id),Oe=v.useState("toastOffsetY",a.id),Ie=v.useState("focused"),St=v.useState("expanded");nW({open:a.transitionStatus!=="ending",ref:re,onComplete(){a.transitionStatus==="ending"&&v.removeToast(a.id)}});const un=go((tt=!1)=>{const et=re.current;if(!et)return;const kt=et.style.height;et.style.height="auto";const an=et.offsetHeight;et.style.height=kt;function zt(){v.updateToastInternal(a.id,{ref:re,height:an,...a.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}tt?Vl.flushSync(zt):zt()});Ka(un,[un]);function jt(tt){ae.current=tt,B(tt)}Ka(()=>()=>{fe.current?.abort()},[]);function _t(tt,et){let kt=tt,an=et;return!p.includes("left")&&!p.includes("right")?kt=tt>0?tt**ns:-(Math.abs(tt)**ns):(!p.includes("right")&&tt>0&&(kt=tt**ns),!p.includes("left")&&tt<0&&(kt=-(Math.abs(tt)**ns))),!p.includes("up")&&!p.includes("down")?an=et>0?et**ns:-(Math.abs(et)**ns):(!p.includes("down")&&et>0&&(an=et**ns),!p.includes("up")&&et<0&&(an=-(Math.abs(et)**ns))),{x:kt,y:an}}const Jt=go(tt=>{if(tt.pointerId!==_e.current)return;_e.current=null,fe.current?.abort(),fe.current=null,P(!1),L(!1),le(null);const et=ie.current;if(tt.type==="pointercancel"||W.current){jt({x:et.x,y:et.y}),b(void 0);return}let kt=!1;const an=ae.current,zt=an.x-et.x,At=an.y-et.y;let xt;for(const ar of p){switch(ar){case"right":zt>Hc&&(kt=!0,xt="right");break;case"left":zt<-Hc&&(kt=!0,xt="left");break;case"down":At>Hc&&(kt=!0,xt="down");break;case"up":At<-Hc&&(kt=!0,xt="up");break}if(kt)break}kt?(b(xt),A(!0),v.closeToast(a.id)):(jt({x:et.x,y:et.y}),b(void 0))});function nr(tt){if(tt.button!==0)return;tt.pointerType==="touch"&&v.pauseTimers();const et=no(tt.nativeEvent);if(et?et.closest(`button,a,input,textarea,[role="button"],${hW}`):!1)return;if(W.current=!1,$.current=void 0,X.current=0,_e.current=tt.pointerId,te.current={x:tt.clientX,y:tt.clientY},O.current=te.current,re.current){const zt=lW(re.current);ie.current=zt,S(zt),jt({x:zt.x,y:zt.y})}v.setHovering(!0),P(!0),L(!1),le(null),Y.current=!0;const an=re.current;if(an){fe.current?.abort();const zt=new AbortController;fe.current=zt;const At=br(an);At.addEventListener("pointerup",Jt,{signal:zt.signal}),At.addEventListener("pointercancel",Jt,{signal:zt.signal}),an.setPointerCapture?.(tt.pointerId)}}function Mn(tt){if(tt.pointerId!==_e.current)return;tt.preventDefault(),Y.current&&(te.current={x:tt.clientX,y:tt.clientY},Y.current=!1);const{clientY:et,clientX:kt,movementX:an,movementY:zt}=tt;(zt<0&&et>O.current.y||zt>0&&et<O.current.y)&&(O.current={x:O.current.x,y:et}),(an<0&&kt>O.current.x||an>0&&kt<O.current.x)&&(O.current={x:kt,y:O.current.y});const At=kt-te.current.x,xt=et-te.current.y,ar=et-O.current.y,ec=kt-O.current.x;if(!T&&Math.sqrt(At*At+xt*xt)>=uW&&(L(!0),ce===null)){const rr=p.includes("left")||p.includes("right"),bs=p.includes("up")||p.includes("down");if(rr&&bs){const Ri=Math.abs(At),wa=Math.abs(xt);le(Ri>wa?"horizontal":"vertical")}}let En;if(!$.current)ce==="vertical"?xt>0?En="down":xt<0&&(En="up"):ce==="horizontal"?At>0?En="right":At<0&&(En="left"):Math.abs(At)>=Math.abs(xt)?En=At>0?"right":"left":En=xt>0?"down":"up",En&&p.includes(En)&&($.current=En,X.current=yP(En,At,xt),b(En));else{const Sr=$.current,rr=yP(Sr,ec,ar);rr>Hc?(W.current=!1,b(Sr)):!(p.includes("left")&&p.includes("right"))&&!(p.includes("up")&&p.includes("down"))&&X.current-rr>=dW&&(W.current=!0)}const ti=_t(At,xt);let Xn=ie.current.x,Pr=ie.current.y;ce==="horizontal"?(p.includes("left")||p.includes("right"))&&(Xn+=ti.x):(ce==="vertical"||(p.includes("left")||p.includes("right"))&&(Xn+=ti.x),(p.includes("up")||p.includes("down"))&&(Pr+=ti.y)),jt({x:Xn,y:Pr})}function Vt(tt){if(tt.key==="Escape"){if(!re.current||!Ai(re.current,xl(br(re.current))))return;v.closeToast(a.id)}}k.useEffect(()=>{if(!m)return;const tt=re.current;if(!tt)return;function et(kt){_e.current===null||!Ai(tt,no(kt))||kt.preventDefault()}return to(tt,"touchmove",et,{passive:!1})},[m]);function Xe(){if(!x&&D.x===j.x&&D.y===j.y&&!E)return{[zs.swipeMovementX]:"0px",[zs.swipeMovementY]:"0px"};const tt=D.x-j.x,et=D.y-j.y;return{transition:x?"none":void 0,transform:x?`translateX(${D.x}px) translateY(${D.y}px) scale(${j.scale})`:void 0,[zs.swipeMovementX]:`${tt}px`,[zs.swipeMovementY]:`${et}px`}}const ot=a.priority==="high",Dt={role:ot?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":N,"aria-describedby":Q,"aria-hidden":ot&&!Ie?!0:void 0,onPointerDown:m?nr:void 0,onPointerMove:m?Mn:void 0,onPointerUp:m?Jt:void 0,onPointerCancel:m?Jt:void 0,onKeyDown:Vt,inert:ZH(a.limited),style:{...Xe(),[zs.index]:a.transitionStatus==="ending"?ve:Ne,[zs.offsetY]:`${Oe}px`,[zs.height]:a.height?`${a.height}px`:void 0}},Et=k.useMemo(()=>({rootRef:re,toast:a,titleId:N,setTitleId:U,descriptionId:Q,setDescriptionId:ee,swiping:x,swipeDirection:y,recalculateHeight:un,index:ve,visibleIndex:Ne,expanded:St}),[a,N,Q,x,y,un,ve,Ne,St]),Nn={transitionStatus:a.transitionStatus,expanded:St,limited:a.limited||!1,type:a.type,swiping:Et.swiping,swipeDirection:Et.swipeDirection},xr=ou("div",e,{ref:[n,Et.rootRef],state:Nn,stateAttributesMapping:cW,props:[Dt,u]});return R.jsx(j4.Provider,{value:Et,children:xr})});let bP=0;function fW(t,e="mui"){const[n,a]=k.useState(t),r=t||n;return k.useEffect(()=>{n==null&&(bP+=1,a(`${e}-${bP}`))},[n,e]),r}const kP=lb.useId;function F4(t,e){if(kP!==void 0){const n=kP();return t??(e?`${e}-${n}`:n)}return fW(t,e)}const mW=k.forwardRef(function(e,n){const{render:a,className:r,style:s,id:l,children:c,...u}=e,{toast:h,setTitleId:p}=z4(),m=c??h.title,v=!!m,y=F4(l);Ka(()=>{if(v)return p(y),()=>{p(void 0)}},[v,y,p]);const b={type:h.type},x=ou("h2",e,{ref:n,state:b,props:{...u,id:y,children:m}});return v?x:null}),gW=k.createContext(void 0);function vW(t=!1){const e=k.useContext(gW);if(e===void 0&&!t)throw new Error(Xl(16));return e}function _W(t){const{focusableWhenDisabled:e,disabled:n,composite:a=!1,tabIndex:r=0,isNativeButton:s}=t,l=a&&e!==!1,c=a&&e===!1;return{props:k.useMemo(()=>{const h={onKeyDown(p){n&&e&&p.key!=="Tab"&&p.preventDefault()}};return a||(h.tabIndex=r,!s&&n&&(h.tabIndex=e?r:-1)),(s&&(e||l)||!s&&n)&&(h["aria-disabled"]=n),s&&(!e||c)&&(h.disabled=n),h},[a,n,e,l,c,s,r])}}function yW(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:a=0,native:r=!0,composite:s}=t,l=k.useRef(null),c=vW(!0),u=s??c!==void 0,{props:h}=_W({focusableWhenDisabled:n,disabled:e,composite:u,tabIndex:a,isNativeButton:r}),p=k.useCallback(()=>{const y=l.current;kv(y)&&u&&e&&h.disabled===void 0&&y.disabled&&(y.disabled=!1)},[e,h.disabled,u]);Ka(p,[p]);const m=k.useCallback((y={})=>{const{onClick:b,onMouseDown:x,onKeyUp:P,onKeyDown:T,onPointerDown:L,...E}=y;return mb({onClick(A){if(e){A.preventDefault();return}b?.(A)},onMouseDown(A){e||x?.(A)},onKeyDown(A){if(e||(Xp(A),T?.(A),A.baseUIHandlerPrevented))return;const D=A.target===A.currentTarget,B=A.currentTarget,j=kv(B),S=!r&&bW(B),N=D&&(r?j:!S),U=A.key==="Enter",Q=A.key===" ",ee=B.getAttribute("role"),ce=ee?.startsWith("menuitem")||ee==="option"||ee==="gridcell";if(D&&u&&Q){if(A.defaultPrevented&&ce)return;A.preventDefault(),S||r&&j?(B.click(),A.preventBaseUIHandler()):N&&(b?.(A),A.preventBaseUIHandler());return}N&&(!r&&(Q||U)&&A.preventDefault(),!r&&U&&b?.(A))},onKeyUp(A){if(!e){if(Xp(A),P?.(A),A.target===A.currentTarget&&r&&u&&kv(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!r&&!u&&A.key===" "&&b?.(A)}},onPointerDown(A){if(e){A.preventDefault();return}L?.(A)}},r?{type:"button"}:{role:"button"},h,E)},[e,h,u,r]),v=go(y=>{l.current=y,p()});return{getButtonProps:m,buttonRef:v}}function kv(t){return fs(t)&&t.tagName==="BUTTON"}function bW(t){return!!(t?.tagName==="A"&&t?.href)}const kW=k.forwardRef(function(e,n){const{render:a,className:r,style:s,disabled:l,nativeButton:c=!0,...u}=e,h=sb(),{toast:p}=z4(),m=h.useState("expanded"),[v,y]=k.useState(!1),{getButtonProps:b,buttonRef:x}=yW({disabled:l,native:c}),P={type:p.type};return ou("button",e,{ref:[n,x],state:P,props:[{"aria-hidden":!m&&!v,onClick(){h.closeToast(p.id)},onFocus(){y(!0)},onBlur(){y(!1)}},u,b]})}),zZ="none",FZ="trigger-press",UZ="trigger-hover",BZ="outside-press",$Z="item-press",VZ="close-press",wW="focus-out",HZ="escape-key",WZ="list-navigation",GZ="cancel-open",qZ="imperative-action",KZ="window-resize";function xW(t,e,n,a){let r=!1,s=!1;const l=eo;return{reason:t,event:e??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...l}}function PW(t){return`data-base-ui-${t}`}const U4=k.createContext(null),SW=()=>k.useContext(U4),CW=PW("portal");function B4(t={}){const{ref:e,container:n,componentProps:a=eo,elementProps:r}=t,s=F4(),c=SW()?.portalNode,[u,h]=k.useState(null),[p,m]=k.useState(null),v=go(P=>{P!==null&&m(P)}),y=k.useRef(null);Ka(()=>{if(n===null){y.current&&(y.current=null,m(null),h(null));return}if(s==null)return;const P=(n&&(cb(n)?n:n.current))??c??document.body;if(P==null){y.current&&(y.current=null,m(null),h(null));return}y.current!==P&&(y.current=P,m(null),h(P))},[n,c,s]);const b=ou("div",a,{ref:[e,v],props:[{id:s,[CW]:""},r]});return{portalNode:p,portalSubtree:u&&b?Vl.createPortal(b,u):null}}const YZ=k.forwardRef(function(e,n){const{render:a,className:r,style:s,children:l,container:c,renderGuards:u,...h}=e,{portalNode:p,portalSubtree:m}=B4({container:c,ref:n,componentProps:e,elementProps:h}),v=k.useRef(null),y=k.useRef(null),b=k.useRef(null),x=k.useRef(null),[P,T]=k.useState(null),L=k.useRef(!1),E=P?.modal,A=P?.open,D=typeof u=="boolean"?u:!!P&&!P.modal&&P.open&&!!p;k.useEffect(()=>{if(!p||E)return;function j(S){p&&S.relatedTarget&&yv(S)&&(S.type==="focusin"?L.current&&(gP(p),L.current=!1):(RH(p),L.current=!0))}return f4(to(p,"focusin",j,!0),to(p,"focusout",j,!0))},[p,E]),Ka(()=>{!p||A!==!0||!L.current||(gP(p),L.current=!1)},[A,p]);const B=k.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:y,beforeInsideRef:b,afterInsideRef:x,portalNode:p,setFocusManagerState:T}),[p]);return R.jsxs(k.Fragment,{children:[m,R.jsxs(U4.Provider,{value:B,children:[D&&p&&R.jsx(wd,{"data-type":"outside",ref:v,onFocus:j=>{if(yv(j,p))b.current?.focus();else{const S=P?P.domReference:null;AH(S)?.focus()}}}),D&&p&&R.jsx("span",{"aria-owns":p.id,style:oW}),p&&Vl.createPortal(l,p),D&&p&&R.jsx(wd,{"data-type":"outside",ref:y,onFocus:j=>{if(yv(j,p))x.current?.focus();else{const S=P?P.domReference:null;EH(S)?.focus(),P?.closeOnFocusOut&&P?.onOpenChange(!1,xW(wW,j.nativeEvent))}}})]})]})}),TW=k.forwardRef(function(e,n){const{children:a,container:r,className:s,render:l,style:c,...u}=e,{portalNode:h,portalSubtree:p}=B4({container:r,ref:n,componentProps:e,elementProps:u});return!p&&!h?null:R.jsxs(k.Fragment,{children:[p,h&&Vl.createPortal(a,h)]})}),EW=TW;function AW(){const t=k.useContext(ib);if(!t)throw new Error(Xl(73));const e=t.useState("toasts");return k.useMemo(()=>({toasts:e,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[e,t])}function RW(){const t=new Set;function e(n){t.forEach(a=>a(n))}return{" subscribe":function(a){return t.add(a),()=>{t.delete(a)}},add(n){const a=n.id||m4("toast"),r={...n,id:a,transitionStatus:"starting"};return e({action:"add",options:r}),a},close(n){e({action:"close",options:{id:n}})},update(n,a){e({action:"update",options:{...a,id:n}})},promise(n,a){let r=n;return e({action:"promise",options:{...a,promise:n,setPromise(s){r=s}}}),r}}}const _b=RW();function ZZ(t){return _b.add(t)}function LW({children:t}){return R.jsxs(DH,{toastManager:_b,children:[t,R.jsx(EW,{children:R.jsx(YH,{className:"fixed inset-x-0 top-6 z-[100] mx-auto flex w-full max-w-sm flex-col items-center gap-2 px-4 outline-none",children:R.jsx(DW,{})})})]})}function DW(){const{toasts:t}=AW();return t.map(e=>{const n=e.data?.onUndo;return R.jsxs(pW,{toast:e,className:$t("pointer-events-auto flex w-full items-center gap-3 rounded-xl border border-oai-gray-200 bg-oai-white px-4 py-3 shadow-xl transition-all duration-200 ease-out","data-[starting-style]:-translate-y-3 data-[starting-style]:opacity-0","data-[ending-style]:-translate-y-3 data-[ending-style]:opacity-0","dark:border-oai-gray-800 dark:bg-oai-gray-900"),children:[R.jsx(mW,{className:"min-w-0 flex-1 text-sm font-medium text-oai-black dark:text-white"}),n?R.jsx("button",{type:"button",onClick:()=>{n(),_b.close(e.id)},className:"shrink-0 rounded-md px-2 py-1 text-xs font-semibold text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:we("shared.action.undo")}):null,R.jsx(kW,{"aria-label":we("shared.action.dismiss"),className:"-mr-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:R.jsx(x0,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},e.id)})}const yb=Object.freeze(["limits","leaderboard"]),IW=Object.freeze({limits:"/limits",leaderboard:"/leaderboard"}),MW=Object.freeze({limits:()=>In(()=>import("./LimitsPage-BovkRgac.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),leaderboard:()=>In(()=>import("./LeaderboardPage-BvOPIj-b.js"),__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18,19,20]))}),$4="total",V4=0,wP=20,NW=Object.freeze([10,20,50,100]),OW="tokentracker:leaderboard:pageSize",jW=20,zW=Object.freeze(["dashboard-existing","silent-preload","page-load","manual-refresh"]);let xP=0,Ja;class FW{constructor(e={}){this.limits=null,this.leaderboard=new Map,this.leaderboardMaxEntries=$W(e.leaderboardMaxEntries)}read(e,n){return lu(e),e==="limits"?!this.limits||this.limits.contextKey!==n?null:up(this.limits):n?up(this.leaderboard.get(n)):null}write(e,n={}){if(e.targetKey==="limits"){this.limits=e;return}this.leaderboard.has(e.contextKey)&&this.leaderboard.delete(e.contextKey),this.leaderboard.set(e.contextKey,e),this.evictLeaderboardEntries(n.activeContextKey||e.contextKey)}evictLeaderboardEntries(e=null){for(;this.leaderboard.size>this.leaderboardMaxEntries;){const n=Array.from(this.leaderboard.keys()).find(a=>a!==e)||this.leaderboard.keys().next().value;this.leaderboard.delete(n)}}snapshot(){return{limits:up(this.limits),leaderboard:{maxEntries:this.leaderboardMaxEntries,size:this.leaderboard.size,keys:Array.from(this.leaderboard.keys())}}}}class UW{constructor(e={}){xP+=1,this.sessionId=`dashboard-preload-${xP}`,this.createdAt=Date.now(),this.completedAt=null,this.startedAfterMainContentVisible=!1,this.cache=new FW(e),this.targets={limits:PP("limits"),leaderboard:PP("leaderboard")}}}function PP(t){return{key:t,route:IW[t],resourceStatus:"idle",stateStatus:"idle",error:null,resourcePromise:null,resourceModule:null,resourceRequestId:0,statePromise:null,stateRequestId:0,pendingStateContextKey:null}}function BW(t={}){return new UW(t)}function $W(t){const e=Number(t);return!Number.isInteger(e)||e<1?jW:e}Ja=BW();function lu(t){if(!yb.includes(t))throw new Error(`Unknown dashboard preload target: ${t}`)}function H4(t){return t?typeof t=="string"?t:t.message||String(t):null}function VW(t,e){return zW.includes(t)?t:e}function HW(t){const e=Number(t);return Number.isFinite(e)?e:Date.now()}function up(t){return t?{...t}:null}function SP(){const t=yb.every(e=>{const n=Ja.targets[e];return n.resourceStatus==="fulfilled"||n.resourceStatus==="rejected"});Ja.completedAt=t?Date.now():null}function WW(){Ja.startedAfterMainContentVisible=!0}function bb(t,e={}){lu(t);const n=Object.entries(e).filter(([,a])=>a!==void 0).sort(([a],[r])=>a.localeCompare(r)).map(([a,r])=>`${a}=${r===null?"null":String(r)}`);return`${t}:${n.join("|")}`}function GW(t,e={}){lu(t);const n=Ja.targets[t];if(n.resourceStatus==="fulfilled")return Promise.resolve(n.resourceModule);if(n.resourceStatus==="pending"&&n.resourcePromise)return n.resourcePromise;const a=e.loader||MW[t],r=n.resourceRequestId+1;n.resourceRequestId=r,n.resourceStatus="pending",n.error=null;const s=Promise.resolve().then(()=>a()).then(l=>n.resourceRequestId!==r||n.resourcePromise!==s?null:(n.resourceStatus="fulfilled",n.resourceModule=l,n.error=null,SP(),l)).catch(l=>(n.resourceRequestId!==r||n.resourcePromise!==s||(n.resourceStatus="rejected",n.error=H4(l),SP()),null));return n.resourcePromise=s,s}function qW(t={}){const e=t.loaders||{};return Promise.all(yb.map(n=>GW(n,{loader:e[n]})))}function W4(t,e){lu(t);const n=Ja.targets[t],a=e?.status||"fulfilled",r={targetKey:t,status:a,data:e?.data??null,error:H4(e?.error),source:VW(e?.source,"silent-preload"),generatedAt:HW(e?.generatedAt),updatedAt:Date.now(),contextKey:e?.contextKey||bb(t,e?.context||{})};return n.stateStatus=a,a==="rejected"||a==="skipped"?n.error=r.error:a==="fulfilled"&&(n.error=null,Ja.cache.write(r,{activeContextKey:e?.activeContextKey})),up(r)}function G4(t,e){return lu(t),Ja.cache.read(t,e)}function JZ(t,e={}){return W4("limits",{data:t,source:e.source||"dashboard-existing",contextKey:e.contextKey||q4(e.context||{}),generatedAt:e.generatedAt,status:e.status||"fulfilled",error:e.error})}function q4(t={}){return bb("limits",{state:"current",...t})}function QZ(t=q4()){return G4("limits",t)}function J_(t,e={}){return W4("leaderboard",{activeContextKey:e.activeContextKey,data:t,source:e.source||"silent-preload",contextKey:e.contextKey||kb(e.context||{}),generatedAt:e.generatedAt,status:e.status||"fulfilled",error:e.error})}function KW(t){return G4("leaderboard",t)}function K4(){if(typeof window>"u")return wP;try{const t=window.localStorage.getItem(OW),e=Number(t);if(NW.includes(e))return e}catch{}return wP}function Y4(t={}){const e=t.userId;return e!==void 0?e||null:t.cloudUser?.id||null}function Z4(t={}){return typeof t.accessMode=="string"&&t.accessMode.trim()?t.accessMode.trim():t.mockEnabled?"mock":t.baseUrl?"cloud":"unavailable"}function kb(t={}){const e=!!t.mockEnabled,n=t.baseUrl??"";return bb("leaderboard",{accessMode:Z4({...t,baseUrl:n,mockEnabled:e}),baseUrl:n,mockEnabled:e,offset:t.offset??V4,pageSize:t.pageSize??K4(),period:t.period||$4,userId:Y4(t)})}function Ih(t,e){const n=Ja.targets.leaderboard;return n.stateRequestId+=1,n.statePromise=null,n.pendingStateContextKey=null,J_(null,{contextKey:e,status:"skipped",error:t})}function YW(t={}){const e=Ja,n=!!t.mockEnabled,a=t.baseUrl??"",r=Z4({...t,baseUrl:a,mockEnabled:n}),s=t.period||$4,l=t.pageSize??K4(),c=t.offset??V4,u=Y4(t),h=kb({accessMode:r,baseUrl:a,mockEnabled:n,offset:c,pageSize:l,period:s,userId:u});if(!n&&t.authLoading)return Promise.resolve(Ih("auth-loading",h));if(!n&&!t.signedIn&&r!=="public")return Promise.resolve(Ih("not-signed-in",h));if(!n&&!a)return Promise.resolve(Ih("missing-base-url",h));if(!n&&r==="unavailable")return Promise.resolve(Ih("access-unavailable",h));const p=e.targets.leaderboard,m=KW(h);if(m)return Promise.resolve(m);if(p.stateStatus==="pending"&&p.statePromise&&p.pendingStateContextKey===h)return p.statePromise;const v=p.stateRequestId+1;p.stateRequestId=v,p.stateStatus="pending",p.pendingStateContextKey=h,p.error=null;const y=Promise.resolve().then(()=>v9({userId:u,period:s,limit:l,offset:c})).then(b=>Ja!==e||p.stateRequestId!==v||p.statePromise!==y?null:(p.pendingStateContextKey=null,J_(b,{contextKey:h}))).catch(b=>(Ja!==e||p.stateRequestId!==v||p.statePromise!==y||(p.pendingStateContextKey=null,J_(null,{contextKey:h,status:"rejected",error:b})),null));return p.statePromise=y,y}const ZW=typeof window<"u"?window.location.search:"",CP=new URLSearchParams(ZW),Mh=CP.get("insforge_code")||CP.get("code")||null,JW=typeof window<"u"&&!!window.webkit?.messageHandlers?.nativeOAuth;function QW(){Kl();const{loading:t,signedIn:e}=ko(),n=$l(),[a,r]=k.useState("processing"),[s,l]=k.useState(null),c=k.useRef(!1);k.useEffect(()=>{if(!(!Mh||c.current)){if(c.current=!0,JW){l(!1);return}(async()=>{try{const p=await(await fetch("/api/auth-bridge/verifier")).json();l(!!p?.native)}catch{l(!1)}})()}},[]),k.useEffect(()=>{if(s!==!0||!Mh)return;r("redirecting");const h=setTimeout(()=>{window.location.href=`tokentracker://auth/callback?insforge_code=${encodeURIComponent(Mh)}`},200);return()=>clearTimeout(h)},[s]),k.useEffect(()=>{if(s!==!1||t)return;if(e){n("/dashboard",{replace:!0});return}const h=setTimeout(()=>{e||r("failed")},12e3);return()=>clearTimeout(h)},[s,t,e,n]),k.useEffect(()=>{if(!Mh&&s===null){const h=setTimeout(()=>r("failed"),3e3);return()=>clearTimeout(h)}},[s]);const u=()=>{n("/dashboard",{replace:!0})};return a==="processing"&&s!==!0&&(s===null||s===!1&&t)?R.jsx("div",{className:"min-h-screen bg-oai-gray-950"}):R.jsx("div",{className:"min-h-screen bg-oai-gray-950 text-white font-oai antialiased dark flex items-center justify-center",children:R.jsxs("div",{className:"text-center space-y-4 max-w-sm px-4",children:[a==="processing"&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"w-8 h-8 border-2 border-oai-gray-600 border-t-white rounded-full animate-spin mx-auto"}),R.jsx("p",{className:"text-oai-gray-400 text-sm",children:we("auth.callback.processing")})]}),a==="redirecting"&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-green-500/15 flex items-center justify-center",children:R.jsx("svg",{className:"w-6 h-6 text-green-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:R.jsx("path",{d:"M20 6 9 17l-5-5"})})}),R.jsx("p",{className:"text-white text-sm font-medium",children:we("auth.callback.success")}),R.jsx("p",{className:"text-oai-gray-500 text-xs",children:we("auth.callback.redirecting")})]}),a==="failed"&&R.jsxs("div",{className:"space-y-3",children:[R.jsx("p",{className:"text-oai-gray-300 text-sm",children:we("auth.callback.failed")}),R.jsx("button",{type:"button",onClick:u,className:"px-4 py-2 rounded-lg bg-oai-gray-800 text-sm text-white hover:bg-oai-gray-700 transition-colors",children:we("auth.callback.close")})]})]})})}const XW=k.lazy(()=>In(()=>import("./DashboardPage-Cw6lmVSg.js"),__vite__mapDeps([21,13,1,14,15,22,23,24,11,25,3,9,10,12,26,27,28,4,29,30,31])).then(t=>({default:t.DashboardPage}))),eG=k.lazy(()=>In(()=>import("./IpCheckPage-CTwL-Zmz.js"),[])),tG=k.lazy(()=>In(()=>import("./AchievementsPage-mzE76Ah9.js"),__vite__mapDeps([32,33,17,18,19,34]))),nG=k.lazy(()=>In(()=>import("./LandingPage-CqYJ3sZh.js"),__vite__mapDeps([35,36,20,12,37,7,31,34])).then(t=>({default:t.LandingPage}))),aG=k.lazy(()=>In(()=>import("./LeaderboardPage-BvOPIj-b.js"),__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18,19,20])).then(t=>({default:t.LeaderboardPage}))),rG=k.lazy(()=>In(()=>import("./LeaderboardProfilePage-RE1CPqzM.js"),__vite__mapDeps([38,14,36,39,22,15,23,16,17,18,19,33,34,6,40,12,24,11,7])).then(t=>({default:t.LeaderboardProfilePage}))),iG=k.lazy(()=>In(()=>import("./LimitsPage-BovkRgac.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(t=>({default:t.LimitsPage}))),sG=k.lazy(()=>In(()=>import("./LoginPage-mguBCTBZ.js"),[]).then(t=>({default:t.LoginPage}))),oG=k.lazy(()=>In(()=>import("./ResetPasswordPage-DnhgHQrV.js"),[]).then(t=>({default:t.ResetPasswordPage}))),lG=k.lazy(()=>In(()=>import("./DevicePage-CsPSjSLH.js"),[])),cG=k.lazy(()=>In(()=>import("./WrappedPage-T720sQ9S.js"),[])),dG=k.lazy(()=>In(()=>import("./SettingsPage-BK0IqSjg.js"),__vite__mapDeps([41,2,42,3,30,12,37,14,15,9,10,11,23,43,44,24,45,7])).then(t=>({default:t.SettingsPage}))),uG=k.lazy(()=>In(()=>import("./SkillsPage-BQNoMpL2.js"),__vite__mapDeps([46,5,6,7,3,44,24,11,45,23,14,28,12,47,10,19,26])).then(t=>({default:t.SkillsPage}))),hG=k.lazy(()=>In(()=>import("./WidgetsPage-308d8icu.js"),__vite__mapDeps([48,9,10,11,12,43,42,3,4,6,7])).then(t=>({default:t.WidgetsPage}))),pG=k.lazy(()=>In(()=>import("./PetPage-C5KLH6Fm.js"),__vite__mapDeps([49,42,3,29,4,40,28,18,47])).then(t=>({default:t.PetPage})));function fG(){const{resolvedLocale:t}=Kl(),e=ya(),n=ko();$$();const a=k.useRef(!1),r=k.useRef(!1),s=k.useRef(new Set),l=bn(),c=k.useMemo(()=>typeof window>"u"?!1:I$(window.location.search),[]),u=e?.pathname||"/",h=new URL(window.location.href),p=h.pathname.replace(/\/+$/,"")||"/",v=p.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,y=h.searchParams.get("token")||null,b=v||y,x=p==="/share"||p==="/share.html"||p.startsWith("/share/"),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),T=u.replace(/\/+$/,"")||"/",L=T==="/"||T==="/dashboard",E=T==="/leaderboard",A=T.match(/^\/u\/([^/]+)$/i),D=A?A[1]:null,B=!!(n.enabled&&n.signedIn),j=P||B,S=!1,N=L$(),U=!j&&!l&&!P,Q=l?"mock":n.loading?"unavailable":B?"cloud":j?"local":"unavailable",ee=k.useCallback(()=>{if(!a.current||!l&&n.loading||!l&&!j)return;const Ne={accessMode:Q,baseUrl:D$(),mockEnabled:l,signedIn:j,authLoading:!!n.loading,userId:B&&n.user?.id||null},Oe=kb(Ne);s.current.has(Oe)||(s.current.add(Oe),YW(Ne))},[B,n.loading,n.user?.id,Q,l,j]),ce=k.useCallback(()=>{L&&(a.current||(a.current=!0,WW()),r.current||(r.current=!0,qW()),ee())},[L,ee]);k.useEffect(()=>{ee()},[ee]);const le=k.useMemo(()=>!n.enabled||!B?null:{getAccessToken:()=>n.getAccessToken(),name:n.displayName||"",userId:n.user?.id||null},[B,n]);let re=P||l||c?"dashboard":"landing";T==="/landing"&&(re="landing"),T==="/dashboard"&&(re="dashboard"),E&&(re="dashboard"),D&&(re="dashboard");const te=T==="/limits",ie=T==="/settings",$=T==="/skills",X=T==="/widgets",W=T==="/pet-settings",O=T==="/ip-check",Y=T==="/achievements";(te||ie||$||X||W||O||Y)&&(re="dashboard");let ae=XW;D?ae=rG:T==="/leaderboard"?ae=aG:te?ae=iG:ie?ae=dG:$?ae=uG:X?ae=hG:W?ae=pG:O?ae=eG:Y&&(ae=tG);const _e=!x&&!U&&(T==="/dashboard"||T==="/"||E||te||ie||$||X||W||O||Y);if(!P&&!B&&!x&&!n.loading&&re==="dashboard"&&!E&&!D&&T!=="/login"&&T!=="/reset-password"&&T!=="/landing"&&T!=="/auth/callback"&&T!=="/auth/native-callback")return R.jsx(i8,{to:"/login",replace:!0});let ve=null;if(T==="/auth/callback"||T==="/auth/native-callback")ve=R.jsx(QW,{});else if(T==="/login")ve=R.jsx(sG,{});else if(T==="/reset-password")ve=R.jsx(oG,{});else if(T==="/device")ve=R.jsx(lG,{});else if(T==="/wrapped")ve=R.jsx(cG,{});else if(re==="landing")ve=R.jsx(nG,{signInUrl:"/login",signUpUrl:"/login"});else{const Ne=R.jsx(ae,{baseUrl:N,auth:le,signedIn:j,sessionSoftExpired:S,signOut:()=>n.enabled?n.signOut():Promise.resolve(),publicMode:x,publicToken:b,userId:D,signInUrl:"/login",signUpUrl:"/login",onMainContentVisible:ce},t);_e?ve=R.jsx(iV,{children:Ne}):ve=Ne}return R.jsx(CO,{children:R.jsx(AO,{children:R.jsx(LW,{children:R.jsxs(RO,{children:[R.jsx(k.Suspense,{fallback:null,children:ve}),_e?R.jsx(MV,{}):null,R.jsx(E$,{}),R.jsx(PN,{}),R.jsx(NN,{})]})})})})}var Z=typeof window<"u"?window:void 0,Tn=typeof globalThis<"u"?globalThis:Z;typeof self>"u"&&(Tn.self=Tn),typeof File>"u"&&(Tn.File=function(){});var sa=Tn?.navigator,xe=Tn?.document,fn=Tn?.location,wb=Tn?.fetch,Q_=Tn!=null&&Tn.XMLHttpRequest&&"withCredentials"in new Tn.XMLHttpRequest?Tn.XMLHttpRequest:void 0,TP=Tn?.AbortController,mG=Tn?.CompressionStream,va=sa?.userAgent,Be=Z??{};function J4(){return!(!Z||Z.navigator.onLine===!1)}var EP="1.402.0",en={DEBUG:!1,LIB_VERSION:EP,LIB_NAME:"web",JS_SDK_VERSION:EP};function AP(t,e,n,a,r,s,l){try{var c=t[s](l),u=c.value}catch(h){return void n(h)}c.done?e(u):Promise.resolve(u).then(a,r)}function cn(t){return function(){var e=this,n=arguments;return new Promise((function(a,r){var s=t.apply(e,n);function l(u){AP(s,a,r,l,c,"next",u)}function c(u){AP(s,a,r,l,c,"throw",u)}l(void 0)}))}}function he(){return he=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var a in n)({}).hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},he.apply(null,arguments)}function Q4(t,e){if(t==null)return{};var n={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;n[a]=t[a]}return n}var RP=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function LP(t){return typeof t=="string"||t}function DP(t){return typeof t=="string"?t:void 0}var Wc,ki=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),IP=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),gG=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],vG=["token"],X4="NativeGzipValidationError",X_=t=>t.length>=2&&t[0]===31&&t[1]===139,MP=(t,e)=>t===IP.GZipJS||e===IP.GZipJS||e==="gzip",NP=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Nh=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=X4,e},_G=(function(){var t=cn((function*(e,n){18>e.size&&Nh("too-short");var a=new Uint8Array(yield e.slice(0,10).arrayBuffer());X_(a)&&a[2]===8||Nh("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(l=>{for(var c=(()=>{if(Wc)return Wc;Wc=[];for(var p=0;256>p;p++){for(var m=p,v=0;8>v;v++)m=1&m?3988292384^m>>>1:m>>>1;Wc[p]=m>>>0}return Wc})(),u=4294967295,h=0;l.length>h;h++)u=c[255&(u^l[h])]^u>>>8;return(4294967295^u)>>>0})(n)&&Nh("invalid-crc");var s=n.length>>>0;r.getUint32(4,!0)!==s&&Nh("invalid-size")}));return function(e,n){return t.apply(this,arguments)}})();function ey(){return ey=cn((function*(t,e,n){e===void 0&&(e=!0);try{var a=new TextEncoder().encode(t),r=new CompressionStream("gzip"),s=r.writable.getWriter(),l=s.write(a).then((()=>s.close())).catch((function(){var h=cn((function*(p){try{yield s.abort(p)}catch{}throw p}));return function(p){return h.apply(this,arguments)}})()),c=new Response(r.readable).blob(),u=(yield Promise.all([c,l]))[0];return yield _G(u,a),u}catch(h){if(n!=null&&n.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),ey.apply(this,arguments)}var yG=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],OP=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return yG.concat(e).some((a=>{var r=a.toLowerCase();return n.indexOf(r)!==-1}))};function Ke(t,e){return t.indexOf(e)!==-1}var Gf=function(t){return t.trim()},ty=function(t){return t.replace(/^\$/,"")};function eE(t){var e,n=[];return(e=JSON.stringify(t,(function(a,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(r))return"[Circular]";n.push(r)}return r}})))!==null&&e!==void 0?e:"null"}var tE=Object.prototype,nE=tE.hasOwnProperty,qf=tE.toString,it=Array.isArray||function(t){return qf.call(t)==="[object Array]"},yr=t=>typeof t=="function",qt=t=>t===Object(t)&&!it(t),cs=t=>{if(qt(t)){for(var e in t)if(nE.call(t,e))return!1;return!0}return!1},ke=t=>t===void 0,Lt=t=>qf.call(t)=="[object String]",ny=t=>Lt(t)&&t.trim().length===0,la=t=>t===null,nt=t=>ke(t)||la(t),Bn=t=>qf.call(t)=="[object Number]"&&t==t,yi=t=>Bn(t)&&t>0,Hr=t=>qf.call(t)==="[object Boolean]",bG=t=>t instanceof FormData,kG=t=>Ke(gG,t),wG=t=>Ke(vG,t);function aE(t){return t===null||typeof t!="object"}function ef(t,e){return{}.toString.call(t)==="[object "+e+"]"}function xb(t){return typeof Event<"u"&&(function(e,n){try{return e instanceof n}catch{return!1}})(t,Event)}var xG=[!0,"true",1,"1","yes"],wv=t=>Ke(xG,t),PG=[!1,"false",0,"0","no"];function Br(t,e,n,a,r){return e>n&&(a.warn("min cannot be greater than max."),e=n),Bn(t)?t>n?(a.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(a.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(a.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),Br(r||n,e,n,a))}class SG{constructor(e){this.Pe={},this.Oe=e.Oe,this.Fe=Br(e.bucketSize,0,100,e.Ae),this.$e=Br(e.refillRate,0,this.Fe,e.Ae),this.Ne=Br(e.refillInterval,0,864e5,e.Ae)}De(e,n){var a=Math.floor((n-e.lastAccess)/this.Ne);a>0&&(e.tokens=Math.min(e.tokens+a*this.$e,this.Fe),e.lastAccess=e.lastAccess+a*this.Ne)}consumeRateLimit(e){var n,a=Date.now(),r=String(e),s=this.Pe[r];return s?this.De(s,a):this.Pe[r]=s={tokens:this.Fe,lastAccess:a},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.Oe)==null||n.call(this,e)),s.tokens===0)}stop(){this.Pe={}}}var Da="Mobile",tf="iOS",Si="Android",Nl="Tablet",rE=Si+" "+Nl,iE="iPad",sE="Apple",oE=sE+" Watch",xd="Safari",Ol="BlackBerry",lE="Samsung",cE=lE+"Browser",dE=lE+" Internet",oo="Chrome",CG=oo+" OS",uE=oo+" "+tf,Pb="Internet Explorer",hE=Pb+" "+Da,Sb="Opera",TG=Sb+" Mini",Cb="Edge",pE="Microsoft "+Cb,Pl="Firefox",fE=Pl+" "+tf,Bd="Nintendo",$d="PlayStation",Sl="Xbox",mE=Si+" "+Da,gE=Da+" "+xd,od="Windows",ay=od+" Phone",jP="Nokia",ry="Ouya",vE="Generic",EG=vE+" "+Da.toLowerCase(),_E=vE+" "+Nl.toLowerCase(),iy="Konqueror",yE="Oculus Browser",nf="Vivaldi",bE="Yandex",af="Whale",sy="DuckDuckGo",kE="Pale Moon",rf="Waterfox",Pd="Brave",wE="Google Search App",Xt="(\\d+(\\.\\d+)?)",xv=new RegExp("Version/"+Xt),AG=new RegExp(Sl,"i"),RG=new RegExp($d+" \\w+","i"),LG=new RegExp(Bd+" \\w+","i"),Tb=new RegExp(Ol+"|PlayBook|BB10","i"),DG={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},xE=function(t,e,n,a){e=e||"";var r=(function(s){return s!=null&&s.brave?Pd:null})(n);return r||(a!=null&&a.detectGoogleSearchApp&&Ke(t,"GSA/")?wE:Ke(t," OPR/")&&Ke(t,"Mini")?TG:Ke(t," OPR/")?Sb:Tb.test(t)?Ol:Ke(t,"IE"+Da)||Ke(t,"WPDesktop")?hE:Ke(t,"OculusBrowser")?yE:Ke(t,cE)?dE:Ke(t,Cb)||Ke(t,"Edg/")?pE:Ke(t,nf+"/")?nf:Ke(t,"YaBrowser/")?bE:Ke(t,af+"/")?af:Ke(t,sy+"/")||Ke(t,"Ddg/")?sy:Ke(t,"FBIOS")?"Facebook "+Da:Ke(t,"UCWEB")||Ke(t,"UCBrowser")?"UC Browser":Ke(t,"CriOS")?uE:Ke(t,"CrMo")||Ke(t,oo)?oo:Ke(t,Si)&&Ke(t,xd)?mE:Ke(t,"FxiOS")?fE:Ke(t.toLowerCase(),iy.toLowerCase())?iy:Ke(t,Pd+"/")?Pd:((s,l)=>l&&Ke(l,sE)||(function(c){return Ke(c,xd)&&!Ke(c,oo)&&!Ke(c,Si)})(s))(t,e)?Ke(t,Da)?gE:xd:Ke(t,"PaleMoon/")?kE:Ke(t,rf+"/")?rf:Ke(t,Pl)?Pl:Ke(t,"MSIE")||Ke(t,"Trident/")?Pb:Ke(t,"Gecko")?Pl:"")},IG={[hE]:[new RegExp("rv:"+Xt)],[pE]:[new RegExp(Cb+"?\\/"+Xt)],[oo]:[new RegExp("("+oo+"|CrMo)\\/"+Xt)],[uE]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[xd]:[xv],[gE]:[xv],[Sb]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Pl]:[new RegExp(Pl+"\\/"+Xt)],[fE]:[new RegExp("FxiOS\\/"+Xt)],[iy]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[Ol]:[new RegExp(Ol+" "+Xt),xv],[mE]:[new RegExp("android\\s"+Xt,"i")],[dE]:[new RegExp(cE+"\\/"+Xt)],[yE]:[new RegExp("OculusBrowser\\/"+Xt)],[nf]:[new RegExp(nf+"\\/"+Xt)],[bE]:[new RegExp("YaBrowser\\/"+Xt)],[af]:[new RegExp(af+"\\/"+Xt)],[Pd]:[new RegExp(Pd+"\\/"+Xt)],[sy]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[kE]:[new RegExp("PaleMoon\\/"+Xt)],[rf]:[new RegExp(rf+"\\/"+Xt)],[wE]:[new RegExp("GSA\\/"+Xt)],[Pb]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},MG=function(t,e,n,a){var r=xE(t,e,n,a),s=IG[r];if(ke(s))return null;for(var l=0;s.length>l;l++){var c=t.match(s[l]);if(c)return parseFloat(c[c.length-2])}return null},zP=[[new RegExp(Sl+"; "+Sl+" (.*?)[);]","i"),t=>[Sl,t&&t[1]||""]],[new RegExp(Bd,"i"),[Bd,""]],[new RegExp($d,"i"),[$d,""]],[Tb,[Ol,""]],[new RegExp(od,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ay,""];if(new RegExp(Da).test(e)&&!/IEMobile\b/.test(e))return[od+" "+Da,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var a=DG[n[1]]||"";return/arm/i.test(e)&&(a="RT"),[od,a]}return[od,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tf,[t[3],t[4],t[5]||"0"].join(".")]:[tf,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ke(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Si+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Si+")","i"),t=>t&&t[2]?[Si,[t[2],t[3],t[4]||"0"].join(".")]:[Si,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[CG,""]],[/Linux|debian/i,["Linux",""]]],FP=function(t){return LG.test(t)?Bd:RG.test(t)?$d:AG.test(t)?Sl:new RegExp(ry,"i").test(t)?ry:new RegExp("("+ay+"|WPDesktop)","i").test(t)?ay:/iPad/.test(t)?iE:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?oE:Tb.test(t)?Ol:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jP,"i").test(t)?jP:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Da).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Si:rE:new RegExp("(pda|"+Da+")","i").test(t)?EG:new RegExp(Nl,"i").test(t)&&!new RegExp(Nl+" pc","i").test(t)?_E:""},NG=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function UP(t,e){return typeof(n=t)=="string"&&NG.test(n)?t:e();var n}function ms(t){return t&&t.split("#")[0]}function hp(t,e){var n=setTimeout(t,e);return n?.unref&&n?.unref(),n}var OG=t=>t instanceof Error,PE={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},jG=PE.info;function SE(t){if(Hr(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(it(t))return{arrayValue:{values:t.map((e=>SE(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function sf(t){var e=[];for(var n in t){var a=t[n];la(a)||ke(a)||e.push({key:n,value:SE(a)})}return e}function zG(t,e){var n=PE[t.level||"info"]||jG,a=n.text,r=n.number,s=String(Date.now())+"000000",l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),nt(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),nt(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);var c=he({},l,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:r,severityText:a,body:{stringValue:t.body},attributes:sf(c)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ke(t.trace_flags)||(u.flags=t.trace_flags),u}function CE(t,e,n){return he({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}function TE(t,e,n,a){return{resourceLogs:[{resource:{attributes:sf(e)},scopeLogs:[{scope:{name:n,version:a},logRecords:t}]}]}}let FG=class{constructor(t,e,n,a,r,s,l){var c;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=n,this.qe=a,this.je=r,this.Be=s,this.He=l,this.Ue=null,this.ze=0,this.We=0,this.Ve=0,this.Ze=0,this.Ge=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((c=e.maxQueueSize)!==null&&c!==void 0?c:e.maxBufferSize,e.maxBufferSize),this.Ke=e.flushIntervalMs,this.Ye=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.Ve=0,this.Ze=0,this.Ge=!1,this.ze=0,this.We=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.We=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.it(t);if(e!==null)if(e.body){if(this.nt()){var n={record:zG(e,this.qe())};this.je((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=it(e)?e:[e],a=t;for(var r of n)try{var s=r(a);if(!s)return this.Ae.info("Log was rejected in beforeSend function"),null;a=s}catch(l){return this.Ae.error("Error in beforeSend function for log:",l),null}return a}nt(){if(this.et===void 0)return!0;var t=Date.now(),e=t-this.Ve;return this.Xe>e&&e>=0||(this.Ve=t,this.Ze=0,this.Ge=!1),this.et>this.Ze?(this.Ze++,!0):(this.Ge||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ge=!0),!1)}flush(){var t=this;return cn((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return cn((function*(){var e;t.tt();var n=(e=t._instance.getPersistedProperty(ki.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var a=n.length,r=0;n.length>0&&a>r;){var s,l;t.ze=0;var c=Math.min(n.length,t.Ye),u=n.slice(0,c),h=TE(u.map((m=>m.record)),t.ut(),(s=t.He)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),p=yield t._instance.ht(h);if(p.kind==="too-large"&&u.length>1)t.Ye=Math.max(1,Math.floor(u.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.Ye);else if(p.kind==="retry-later"||(p.kind==="too-large"?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&t.Se.maxBatchRecordsPerPost>t.Ye&&(t.Ye=Math.min(t.Se.maxBatchRecordsPerPost,t.Ye+1)),yield t.dt(u.length),n=(l=t._instance.getPersistedProperty(ki.LogsQueue))!==null&&l!==void 0?l:[],r+=u.length,p.kind==="fatal"))throw p.error}}))()}dt(t){var e=this;return cn((function*(){var n,a=Math.max(0,t-e.ze),r=(n=e._instance.getPersistedProperty(ki.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(ki.LogsQueue,r.slice(a)),yield e.Be()}))()}ut(){return CE(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(ki.LogsQueue))!==null&&e!==void 0?e:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(ki.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(t){t===void 0&&(t=this.Ke),this.vt||(this.vt=hp((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.We-1),6);return this.Ke*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(ki.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return cn((function*(){e.tt();var n=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([n,new Promise((a=>hp(a,t)))]):yield n}))()}flushWithTimeout(t){var e=this;return cn((function*(){var n=!1,a=e.flush(),r=new Promise((s=>hp((()=>{n=!0,s()}),t)));try{yield Promise.race([a,r])}finally{n&&a.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.We=0}),(t=>{this.We++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var Pv=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function BP(t){return String(t)+"000000"}function $P(t,e,n,a){var r="";return a&&(r=Object.keys(a).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(a[s]))).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+r}let UG=class{constructor(t,e,n){this._instance=t,this.Se=e,this.Ae=n,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(t,e,n){e===void 0&&(e=1),this.kt({name:t,type:"count",value:e,unit:n?.unit,attributes:n?.attributes})}gauge(t,e,n){this.kt({name:t,type:"gauge",value:e,unit:n?.unit,attributes:n?.attributes})}histogram(t,e,n){this.kt({name:t,type:"histogram",value:e,unit:n?.unit,attributes:n?.attributes})}flush(){var t=this,e=this.Ue,n=(function(){var r=cn((function*(){e&&(yield e.catch((()=>{}))),yield t.St()}));return function(){return r.apply(this,arguments)}})(),a=n().finally((()=>{this.Ue===a&&(this.Ue=null)}));return this.Ue=a,a}drainWindow(){if(this.bt.size===0)return null;var t=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(t)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.it(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ae.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n=this.wt.get(e.name);n===void 0?this.wt.set(e.name,e.type):n===e.type||this.xt.has(e.name)||(this.xt.add(e.name),this.Ae.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name."));var a=$P(e.type,e.name,e.unit,e.attributes),r=this.bt.get(a);if(!r){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));r={name:e.name,type:e.type,unit:e.unit,attributes:e.attributes?he({},e.attributes):void 0,windowStartMs:Date.now()},this.bt.set(a,r)}this.Tt(r,e.value),this.ct()}else this.Ae.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}Tt(t,e){var n;switch(t.type){case"count":t.total=((n=t.total)!==null&&n!==void 0?n:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Pv.length+1).fill(0)});var a=t.hist;a.count+=1,a.sum+=e,a.min=Math.min(a.min,e),a.max=Math.max(a.max,e),a.bucketCounts[(function(r,s){for(var l=0;s.length>l;l++)if(s[l]>=r)return l;return s.length})(e,Pv)]+=1}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=it(e)?e:[e],a=t;for(var r of n)try{var s=r(a);if(!s)return this.Ae.info("Metric was rejected in beforeSend function"),null;a=s}catch(l){return this.Ae.error("Error in beforeSend function for metric:",l),null}return a}ct(){this.vt||(this.vt=hp((()=>{this.vt=void 0,this.flush().catch((()=>{}))}),this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var t=this;return cn((function*(){if(t.bt.size!==0){var e=t.bt;t.bt=new Map,t._t=!1,t.wt=new Map,t.xt=new Set;var n=yield t._instance.It(t.Ct(e));switch(n.kind){case"ok":return;case"retry-later":return t.Mt(e),void t.ct();case"too-large":return void t.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ae.error("Failed to send metrics batch:",n.error)}}}))()}Ct(t){return(function(r,s,l,c){return{resourceMetrics:[{resource:{attributes:sf(s)},scopeMetrics:[{scope:{name:l,version:c},metrics:r}]}]}})(this.Et(t),(e=this.Se,n=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),he({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":n,"telemetry.sdk.version":a})),this._instance.getLibraryId(),this._instance.getLibraryVersion());var e,n,a}Et(t){var e=BP(Date.now()),n=new Map;for(var a of t.values()){var r,s=$P(a.type,a.name,a.unit,void 0),l=n.get(s);l||(l=he({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},n.set(s,l));var c=sf((r=a.attributes)!==null&&r!==void 0?r:{}),u=BP(a.windowStartMs);if(a.type==="count"){var h,p={attributes:c,startTimeUnixNano:u,timeUnixNano:e,asDouble:(h=a.total)!==null&&h!==void 0?h:0};l.sum.dataPoints.push(p)}else if(a.type==="gauge"){var m,v={attributes:c,timeUnixNano:e,asDouble:(m=a.last)!==null&&m!==void 0?m:0};l.gauge.dataPoints.push(v)}else a.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:e,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:Pv})}return Array.from(n.values())}Mt(t){var e,n;for(var a of t){var r=a[0],s=a[1],l=this.bt.get(r);if(l)switch(l.windowStartMs=Math.min(l.windowStartMs,s.windowStartMs),l.type){case"count":l.total=((e=l.total)!==null&&e!==void 0?e:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(l.hist){l.hist.count+=s.hist.count,l.hist.sum+=s.hist.sum,l.hist.min=Math.min(l.hist.min,s.hist.min),l.hist.max=Math.max(l.hist.max,s.hist.max);for(var c=0;l.hist.bucketCounts.length>c;c++)l.hist.bucketCounts[c]+=s.hist.bucketCounts[c]}else l.hist=s.hist}else this.bt.set(r,s)}}};var Oh,VP,Sv;function BG(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Sv&&n.length===VP||(VP=n.length,Sv=n.reduce(((a,r)=>{Oh||(Oh={});var s=Oh[r];if(s)a[s[0]]=s[1];else for(var l=t(r),c=l.length-1;c>=0;c--){var u=l[c],h=u?.filename,p=e[r];if(h&&p){a[h]=p,Oh[r]=[h,p];break}}return a}),{})),Sv}}class $G{constructor(e,n,a){a===void 0&&(a=[]),this.coercers=e,this.stackParser=n,this.modifiers=a}buildFromUnknown(e,n){n===void 0&&(n={});var a=n&&n.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(a,n,0).apply(e),s=this.buildParsingContext(n),l=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(l,a),$exception_level:"error"}}modifyFrames(e){var n=this;return cn((function*(){for(var a of e)a.stacktrace&&a.stacktrace.frames&&it(a.stacktrace.frames)&&(a.stacktrace.frames=yield n.applyModifiers(a.stacktrace.frames));return e}))()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var a,r;return e.cause!=null&&(a=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),he({},e,{cause:a,stack:r})}applyChunkIds(e,n){return e.map((a=>(a.filename&&n&&(a.chunk_id=n[a.filename]),a)))}applyCoercers(e,n){for(var a of this.coercers)if(a.match(e))return a.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return cn((function*(){var a=e;for(var r of n.modifiers)a=yield r(a);return a}))()}convertToExceptionList(e,n){var a,r,s,l={type:e.type,value:e.value,mechanism:{type:(a=n.type)!==null&&a!==void 0?a:"generic",handled:(r=n.handled)===null||r===void 0||r,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(l.stacktrace={type:"raw",frames:e.stack});var c=[l];return e.cause!=null&&c.push(...this.convertToExceptionList(e.cause,he({},n,{handled:!0}))),c}buildParsingContext(e){var n;return{chunkIdMap:BG(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,a){a===void 0&&(a=0);var r=(s,l)=>{if(4>=l){var c=this.buildCoercingContext(e,n,l);return this.applyCoercers(s,c)}};return he({},n,{syntheticException:a==0?n.syntheticException:void 0,mechanism:e,apply:s=>r(s,a),next:s=>r(s,a+1)})}}var jl="?";function oy(t,e,n,a,r){var s={platform:t,filename:e,function:n==="<anonymous>"?jl:n,in_app:!0};return ke(a)||(s.lineno=a),ke(r)||(s.colno=r),s}var EE=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,a=t.indexOf("safari-web-extension")!==-1;return n||a?[t.indexOf("@")!==-1?t.split("@")[0]:jl,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},VG=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,HG=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,WG=/\((\S*)(?::(\d+))(?::(\d+))\)/,GG=(t,e)=>{var n=VG.exec(t);if(n)return oy(e,n[1],jl,+n[2],+n[3]);var a=HG.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var r=WG.exec(a[2]);r&&(a[2]=r[1],a[3]=r[2],a[4]=r[3])}var s=EE(a[1]||jl,a[2]);return oy(e,s[1],s[0],a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},qG=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KG=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YG=(t,e)=>{var n=qG.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var a=KG.exec(n[3]);a&&(n[1]=n[1]||"eval",n[3]=a[1],n[4]=a[2],n[5]="")}var r=n[3],s=n[1]||jl,l=EE(s,r);return oy(e,r=l[1],s=l[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},HP=/\(error: (.*)\)/;class ZG{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var a=Lt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:a?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return ef(e,"DOMException")}isDOMError(e){return ef(e,"DOMError")}}class JG{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var a=e.message;return String(a.error&&typeof a.error.message=="string"?a.error.message:a)}getStack(e){return e.stacktrace||e.stack||void 0}}class QG{constructor(){}match(e){return ef(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var a;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}var XG=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class eq{match(e){return typeof e=="string"}coerce(e,n){var a,r=this.getInfos(e),s=r[0],l=r[1];return{type:s??"Error",value:l??e,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}getInfos(e){var n="Error",a=e,r=e.match(XG);return r&&(n=r[1],a=r[2]),[n,a]}}var tq=["fatal","error","warning","log","info","debug"];function AE(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var a=n.length;a>0;a--){var r=n.slice(0,a).join(", ");if(e>=r.length)return a===n.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class nq{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var a,r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return xb(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var a=this.getObjectClassName(e);return(a&&a!=="Object"?"'"+a+"'":"Object")+" captured as exception with keys: "+AE(e)}isSeverityLevel(e){return Lt(e)&&!ny(e)&&tq.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var a=e[n];if(OG(a))return a}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class aq{match(e){return xb(e)}coerce(e,n){var a,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+AE(e),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class rq{match(e){return aE(e)}coerce(e,n){var a;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class iq{match(e){return ef(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!xb(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var a,r=this.getUnhandledRejectionReason(e);return aE(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}:n.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var of="$message",lf="$timestamp",sq=new Set([of,lf]),Cv={enabled:!0,max_bytes:32768};function cf(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Cv.enabled,max_bytes:lq(t.max_bytes,Cv.max_bytes)}:he({},Cv)}class oq{constructor(e){this.Rt=[],this.Pt=0,this.Se=cf(e)}setConfig(e){this.Se=cf(e),this.Ot()}add(e){var n=(function(r){var s;try{s=eE(r)}catch{return}try{var l=JSON.parse(s);if(!qt(l))return;var c=l,u=c[of],h=c[lf];return!Lt(u)||u.trim().length===0||!Lt(h)&&!Bn(h)?void 0:{step:c,json:s}}catch{return}})(e);if(n){var a=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var s=encodeURIComponent(r),l=0,c=0;s.length>c;c++)s[c]==="%"?(l+=1,c+=2):l+=1;return l})(n.json);a>this.Se.max_bytes||(this.Rt.push({step:n.step,bytes:a}),this.Pt+=a,this.Ot())}}getAttachable(){return this.Rt.map((e=>e.step))}clear(){this.Rt=[],this.Pt=0}size(){return this.Rt.length}Ot(){for(;this.Pt>this.Se.max_bytes&&this.Rt.length>0;){var e=this.Rt.shift();e&&(this.Pt-=e.bytes)}}}function lq(t,e){if(!Bn(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var RE=function(t,e){var n=(e===void 0?{}:e).debugEnabled,a={k(r){if(Z&&(en.DEBUG||Be.POSTHOG_DEBUG||n)&&!ke(Z.console)&&Z.console){for(var s=("__rrweb_original__"in Z.console[r])?Z.console[r].__rrweb_original__:Z.console[r],l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];s(t,...c)}},debug(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("debug",...s)},info(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("log",...s)},warn(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("warn",...s)},error(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];a.k("error",...s)},critical(){for(var r=arguments.length,s=new Array(r),l=0;r>l;l++)s[l]=arguments[l];console.error(t,...s)},uninitializedWarning(r){a.error("You must initialize PostHog before calling "+r)},createLogger:(r,s)=>RE(t+" "+r,s)};return a},be=RE("[PostHog.js]"),Zt=be.createLogger,cq=Zt("[ExternalScriptsLoader]"),Tv=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return cq.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var a=xe?.querySelectorAll("script");if(a){for(var r,s=function(){if(a[l].src===e){var u=a[l];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",(h=>{u.__posthog_loading_callback_fired=!0,n(void 0,h)})),u.onerror=h=>n(h),{v:void 0})}},l=0;a.length>l;l++)if(r=s())return r.v}var c=()=>{if(!xe)return n("document not found");var u=xe.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=m=>{u.__posthog_loading_callback_fired=!0,n(void 0,m)},u.onerror=m=>n(m),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")xe.head.appendChild(u);else{var h,p=xe.querySelectorAll("body > script");p.length>0?(h=p[0].parentNode)==null||h.insertBefore(u,p[0]):xe.body.appendChild(u)}};xe!=null&&xe.body?c():xe?.addEventListener("DOMContentLoaded",c)};Be.__PosthogExtensions__=Be.__PosthogExtensions__||{},Be.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var a;if(t.config.strict_script_versioning)a=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}a=t.requestRouter.endpointFor("assets",r)}Tv(t,a,n)}else{var l=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Tv(t,l,n)}},Be.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var a=t.requestRouter.endpointFor("api",e);Tv(t,a,n)};var LE="$people_distinct_id",df="$device_id",Ev="$device_model",ld="__alias",cd="__timers",ly="$autocapture_disabled_server_side",cy="$heatmaps_enabled_server_side",dy="$exception_capture_enabled_server_side",uy="$error_tracking_suppression_rules",hy="$error_tracking_capture_extension_exceptions",py="$web_vitals_enabled_server_side",Eb="$dead_clicks_enabled_server_side",Ab="$product_tours_enabled_server_side",fy="$web_vitals_allowed_metrics",ao="$session_recording_remote_config",DE="$replay_sample_rate",IE="$replay_override_sampling",ME="$replay_override_linked_flag",NE="$replay_override_url_trigger",OE="$replay_override_event_trigger",yl="$sesid",Rb="$session_is_sampled",Ys="$enabled_feature_flags",pp="$active_feature_flags",dd="$early_access_features",my="$feature_flag_details",fp="$feature_flag_payloads",gy="$feature_flag_request_id",bi="$override_feature_flags",ul="$override_feature_flag_payloads",Gs="$stored_person_properties",qs="$stored_group_properties",vy="$surveys",uf="$surveys_loaded_at",_y="$surveys_activated",ud="ph_product_tours",Sd="$flag_call_reported",yy="$flag_call_reported_session_id",by="$feature_flag_errors",Vd="$feature_flag_evaluated_at",vr="$user_state",ky="$client_session_props",wy="$capture_rate_limit",xy="$initial_campaign_params",Py="$initial_referrer_info",hf="$initial_person_info",pf="$epp",jE="__POSTHOG_TOOLBAR__",jh="$posthog_cookieless",zE="$sdk_debug_extensions_init_method",FE="$sdk_debug_extensions_init_time_ms",UE="$sdk_debug_recording_script_not_loaded",Lb="PostHog loadExternalDependency extension not found.",Ks="on_reject",xi="always",tl="anonymous",nl="identified",Sy="identified_only",ff="visibilitychange",mf="beforeunload",hl="$pageview",Av="$pageleave",Rv="$identify",WP="$groupidentify";function zh(t,e){it(t)&&t.forEach(e)}function Mt(t,e){if(!nt(t))if(it(t))t.forEach(e);else if(bG(t))t.forEach(((a,r)=>e(a,r)));else for(var n in t)nE.call(t,n)&&e(t[n],n)}var Bt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),a=1;e>a;a++)n[a-1]=arguments[a];for(var r of n)for(var s in r)r[s]!==void 0&&(t[s]=r[s]);return t};function mp(t){for(var e=Object.keys(t),n=e.length,a=new Array(n);n--;)a[n]=[e[n],t[e[n]]];return a}var GP=function(t){try{return t()}catch{return}},dq=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),a=0;e>a;a++)n[a]=arguments[a];return t.apply(this,n)}catch(r){be.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),be.critical(r)}}},Db=function(t){var e={};return Mt(t,(function(n,a){(Lt(n)&&n.length>0||Bn(n))&&(e[a]=n)})),e},uq=["herokuapp.com","vercel.app","netlify.app"];function hq(t){var e=t?.hostname;if(!Lt(e))return!1;var n=e.split(".").slice(-2).join(".");for(var a of uq)if(n===a)return!1;return!0}function tn(t,e,n,a){var r=a??{},s=r.capture,l=r.passive;t?.addEventListener(e,n,{capture:s!==void 0&&s,passive:l===void 0||l})}function BE(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Bn(t)&&isFinite(t)&&Math.floor(t)===t});class gf{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,a,r){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(a)||!Number.isInteger(r)||0>e||0>n||0>a||0>r||e>0xffffffffffff||n>4095||a>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|a>>>24,s[9]=a>>>16,s[10]=a>>>8,s[11]=a,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new gf(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gf(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var a=this.bytes[n]-e.bytes[n];if(a!==0)return Math.sign(a)}return 0}}class pq{constructor(){this.S=0,this.C=0,this.I=new fq}generate(){var e=this.generateOrAbort();if(ke(e)){this.S=0;var n=this.generateOrAbort();if(ke(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return gf.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var qP,$E=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Z&&!ke(Z.crypto)&&crypto.getRandomValues&&($E=t=>crypto.getRandomValues(t));class fq{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||($E(this.R),this.O=0),this.R[this.O++]}}var wi=()=>mq().toString(),mq=()=>(qP||(qP=new pq)).generate(),Gc="",gq=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fr={N:()=>!!xe,D(t){be.error("cookieStore error: "+t)},A(t){if(xe){try{for(var e=t+"=",n=xe.cookie.split(";").filter((s=>s.length)),a=0;n.length>a;a++){for(var r=n[a];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(t){var e;try{e=JSON.parse(Fr.A(t))||{}}catch{}return e},q(t,e,n,a,r){if(!xe)return!1;try{var s="",l="",c=(function(p,m){if(m){var v=(function(b,x){if(x===void 0&&(x=xe),Gc)return Gc;if(!x||["localhost","127.0.0.1"].includes(b))return"";for(var P=b.split("."),T=Math.min(P.length,8),L="dmn_chk_"+wi();!Gc&&T--;){var E=P.slice(T).join("."),A=L+"=1;domain=."+E+";path=/";x.cookie=A+";max-age=3",x.cookie.includes(L)&&(x.cookie=A+";max-age=0",Gc=E)}return Gc})(p);if(!v){var y=(b=>{var x=b.match(gq);return x?x[0]:""})(p);y!==v&&be.info("Warning: cookie subdomain discovery mismatch",y,v),v=y}return v?"; domain=."+v:""}return""})(xe.location.hostname,a);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(l="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+c+l;return h.length>3686.4&&be.warn("cookieStore warning: large cookie, len="+h.length),xe.cookie=h,!0}catch{return!1}},P(t,e){if(xe!=null&&xe.cookie)try{Fr.q(t,"",-1,e)}catch{return}}},Lv=null,It={N(){if(!la(Lv))return Lv;var t=!0;if(ke(Z))t=!1;else try{var e="__mplssupport__";It.q(e,"xyz"),It.A(e)!=='"xyz"'&&(t=!1),It.P(e)}catch{t=!1}return t||be.error("localStorage unsupported; falling back to cookie store"),Lv=t,t},D(t){be.error("localStorage error: "+t)},A(t){try{return Z?.localStorage.getItem(t)}catch(e){It.D(e)}return null},F(t){try{return JSON.parse(It.A(t))||{}}catch{}return null},q(t,e){try{return Z?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){It.D(n)}return!1},P(t){try{Z?.localStorage.removeItem(t)}catch(e){It.D(e)}}},vq=[df,"distinct_id",yl,Rb,pf,hf,vr],Fh={},_q={N:()=>!0,D(t){be.error("memoryStorage error: "+t)},A:t=>Fh[t]||null,F:t=>Fh[t]||null,q:(t,e)=>(Fh[t]=e,!0),P(t){delete Fh[t]}},Fs=null,Fn={N(){if(!la(Fs))return Fs;if(Fs=!0,ke(Z))Fs=!1;else try{var t="__support__";Fn.q(t,"xyz"),Fn.A(t)!=='"xyz"'&&(Fs=!1),Fn.P(t)}catch{Fs=!1}return Fs},D(t){be.error("sessionStorage error: ",t)},A(t){try{return Z?.sessionStorage.getItem(t)}catch(e){Fn.D(e)}return null},F(t){try{return JSON.parse(Fn.A(t))||null}catch{}return null},q(t,e){try{return Z?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Fn.D(n)}return!1},P(t){try{Z?.sessionStorage.removeItem(t)}catch(e){Fn.D(e)}}};class yq{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.At()?0:this.$t}isOptedOut(){return this.Se.cookieless_mode===xi||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===Ks}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Nt.q(this.Dt,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Nt.P(this.Dt,this.Se.cross_subdomain_cookie)}get Dt(){var e=this._instance.config,n=e.token,a=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(a?a+n:"__ph_opt_in_out_"+n)}get $t(){var e=this.Nt.A(this.Dt);return wv(e)?1:Ke(PG,e)?0:-1}get Nt(){var e=this.Se.opt_out_capturing_persistence_type,n=e==="localStorage"?It:Fr;if(!this.qt||this.qt!==n){this.qt=n;var a=e==="localStorage"?Fr:It;a.A(this.Dt)&&(this.qt.A(this.Dt)||this.optInOut(wv(a.A(this.Dt))),a.P(this.Dt,this.Se.cross_subdomain_cookie))}return this.qt}At(){return!!this.Se.respect_dnt&&[sa?.doNotTrack,sa?.msDoNotTrack,Be.doNotTrack].some((e=>wv(e)))}}function VE(t,e){var n,a=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!yr(a))return e;try{var r=a(e);return Lt(r)&&r?r:e}catch(s){return be.error("Error in get_current_url, falling back to window.location.href",s),e}}var bq=1,kq=3,wq=11;function KP(t){return t instanceof Element&&(t.id===jE||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function gs(t){return!!t&&t.nodeType===bq}function Ra(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function HE(t){return!!t&&t.nodeType===kq}function WE(t){return!!t&&t.nodeType===wq&&gs(t.host)}var GE=1e3;function Ib(t){return t?Gf(t).split(/\s+/):[]}function YP(t,e){var n=(function(a){var r,s=Z==null||(r=Z.location)==null?void 0:r.href;return ke(s)?void 0:VE(a,s)})(e);return!!(n&&t&&t.some((a=>n.match(a))))}function vf(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Ib(e)}function qE(t){return nt(t)?null:Gf(t).split(/(\s+)/).filter((e=>Cd(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Hd(t){var e="";return Ty(t)&&!JE(t)&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(n){var a;HE(n)&&n.textContent&&(e+=(a=qE(n.textContent))!==null&&a!==void 0?a:"")})),Gf(e)}function Dv(t){return ke(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Mb=["a","button","form","input","select","textarea","label"];function Cy(t,e){if(ke(e))return!0;var n,a=function(s){if(e.some((l=>(function(c,u){var h=c.matches||c.matchesSelector||c.msMatchesSelector||c.mozMatchesSelector||c.webkitMatchesSelector||c.oMatchesSelector;try{return!!h&&h.call(c,u)}catch{return!1}})(s,l))))return{v:!0}};for(var r of t)if(n=a(r))return n.v;return!1}function KE(t){var e=t.parentNode;return!(!e||!gs(e))&&e}var xq=[".ph-no-autocapture","[data-ph-no-autocapture]"],YE=["next","previous","prev",">","<"],Pq=[...YE,"+","-","−","–"],ZP=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,JP=[".ph-no-rageclick",".ph-no-capture"],Sq=["","text","search","email","password","url","tel","number"];function QP(t,e){if(!Z||Nb(t))return!1;var n,a,r,s,l;if(Hr(e)?(n=!!e&&JP,a=void 0,r=!1):(n=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:JP,a=e?.content_ignorelist,r=(l=e?.ignore_text_selection)!==null&&l!==void 0&&l),n===!1||r&&(function(u){return!(!u||!gs(u))&&(!!Ra(u,"textarea")||(Ra(u,"input")?Ke(Sq,(u.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var p=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return p==="true"||p===""})(u)))})(t))return!1;var c=ZE(t,!1).targetElementList;return!(function(u,h){if(u===!1||ke(u))return!1;var p;if(u===!0)p=YE;else{if(!it(u))return!1;if(u.length>10)return be.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;p=u.map((m=>m.toLowerCase()))}return h.some((m=>{var v=m.safeText,y=m.ariaLabel;return p.some((b=>ZP(v,b)||ZP(y,b)))}))})(a,c.map((u=>{var h;return{safeText:Hd(u).toLowerCase(),ariaLabel:((h=u.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!Cy(c,n)}var Nb=t=>!t||Ra(t,"html")||!gs(t),ZE=(t,e)=>{if(!Z||Nb(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,a=[t],r=t;r.parentNode&&!Ra(r,"body");)if(WE(r.parentNode))a.push(r.parentNode.host),r=r.parentNode.host;else{var s=KE(r);if(!s)break;if(e||Mb.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var l=Z.getComputedStyle(s);l&&l.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}a.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:a}};function Ty(t){for(var e=new Set,n=0,a=t;a.parentNode&&!Ra(a,"body");a=a.parentNode){if(n++>=GE||e.has(a))return!1;e.add(a);var r=vf(a);if(Ke(r,"ph-sensitive")||Ke(r,"ph-no-capture"))return!1}if(Ke(vf(t),"ph-include"))return!0;var s=t.type||"";if(Lt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var l=t.name||t.id||"";return!Lt(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function JE(t){return!!(Ra(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ra(t,"select")||Ra(t,"textarea")||t.getAttribute("contenteditable")==="true")}var QE="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Cq=new RegExp("^(?:"+QE+")$"),Tq=new RegExp(QE),XE="\\d{3}-?\\d{2}-?\\d{4}",Eq=new RegExp("^("+XE+")$"),Aq=new RegExp("("+XE+")");function Cd(t,e){return e===void 0&&(e=!0),!(nt(t)||Lt(t)&&(t=Gf(t),(e?Cq:Tq).test((t||"").replace(/[- ]/g,""))||(e?Eq:Aq).test(t)))}function XP(t){var e=Hd(t);return Cd(e=(e+" "+e6(t)).trim())?e:""}function e6(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(n){var a;if(n&&((a=n.tagName)==null?void 0:a.toLowerCase())==="span")try{var r=Hd(n);e=(e+" "+r).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+e6(n)).trim())}catch(s){be.error("[AutoCapture]",s)}})),e}function eS(t){return t.replace(/"|\\"/g,'\\"')}function Rq(t){var e=t.attr__class;return e?it(e)?e:Ib(e):void 0}var Uh=Zt("[Dead Clicks]"),Lq=()=>!0,Dq=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(Eb)),a=t.instance.config.capture_dead_clicks;return Hr(a)?a:!!qt(a)||n};class tS{get lazyLoadedDeadClicksAutocapture(){return this.jt}constructor(e,n,a){this.instance=e,this.isEnabled=n,this.onCapture=a,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Eb]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt((()=>{this.Ht()})):this.stop()}Bt(e){var n,a;(n=Be.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Uh.error("failed to load script",r):e()}))}Ht(){var e;if(xe){if(!this.jt&&(e=Be.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=qt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.jt=Be.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.jt.start(xe),Uh.info("starting...")}}else Uh.error("`document` not found. Cannot start.")}stop(){this.jt&&(this.jt.stop(),this.jt=void 0,Uh.info("stopping..."))}}var Iv=Zt("[SegmentIntegration]"),t6="posthog-js";function n6(t,e){var n=e===void 0?{}:e,a=n.organization,r=n.projectId,s=n.prefix,l=n.severityAllowList,c=l===void 0?["error"]:l,u=n.sendExceptionsToPostHog,h=u===void 0||u;return p=>{var m,v,y,b,x;if(c!=="*"&&!c.includes(p.level)||!t.__loaded)return p;p.tags||(p.tags={});var P=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());p.tags["PostHog Person URL"]=P,t.sessionRecordingStarted()&&(p.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var T,L=((m=p.exception)==null?void 0:m.values)||[],E=L.map((D=>he({},D,{stacktrace:D.stacktrace?he({},D.stacktrace,{type:"raw",frames:(D.stacktrace.frames||[]).map((B=>he({},B,{platform:"web:javascript"})))}):void 0}))),A={$exception_message:((v=L[0])==null?void 0:v.value)||p.message,$exception_type:(y=L[0])==null?void 0:y.type,$exception_level:p.level,$exception_list:E,$sentry_event_id:p.event_id,$sentry_exception:p.exception,$sentry_exception_message:((b=L[0])==null?void 0:b.value)||p.message,$sentry_exception_type:(x=L[0])==null?void 0:x.type,$sentry_tags:p.tags};return a&&r&&(A.$sentry_url=(s||"https://sentry.io/organizations/")+a+"/issues/?project="+r+"&query="+p.event_id),h&&((T=t.exceptions)==null||T.sendExceptionEvent(A)),p}}class Iq{constructor(e,n,a,r,s,l){this.name=t6,this.setupOnce=function(c){c(n6(e,{organization:n,projectId:a,prefix:r,severityAllowList:s,sendExceptionsToPostHog:l==null||l}))}}}class nS{constructor(e){this.Ut=(n,a,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(be.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:r}),this.zt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Wt()}Wt(){var e;this.Vt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ut)}destroy(){var e;(e=this.Vt)==null||e.call(this),this.Vt=void 0}doPageView(e,n){var a,r=this.Zt(e,n);return this.zt={pathname:(a=Z?.location.pathname)!==null&&a!==void 0?a:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var n;return this.Zt(e,(n=this.zt)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.zt)==null?void 0:e.pageViewId}}Zt(e,n){var a=this.zt;if(!a)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:a.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var l=s.maxScrollHeight,c=s.lastScrollY,u=s.maxScrollY,h=s.maxContentHeight,p=s.lastContentY,m=s.maxContentY;if(!(ke(l)||ke(c)||ke(u)||ke(h)||ke(p)||ke(m))){l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h),p=Math.ceil(p),m=Math.ceil(m);var v=l>1?Br(c/l,0,1,be):1,y=l>1?Br(u/l,0,1,be):1,b=h>1?Br(p/h,0,1,be):1,x=h>1?Br(m/h,0,1,be):1;r=Bt(r,{$prev_pageview_last_scroll:c,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:b,$prev_pageview_max_content:m,$prev_pageview_max_content_percentage:x})}}return a.pathname&&(r.$prev_pageview_pathname=a.pathname),a.timestamp&&(r.$prev_pageview_duration=(e.getTime()-a.timestamp.getTime())/1e3),r}}var Bh=["flags","surveys"],Mq={[LE]:{exposure:"hidden"},[ld]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[cd]:{exposure:"hidden"},[ly]:{exposure:"event"},[cy]:{exposure:"hidden"},[dy]:{exposure:"event"},[uy]:{exposure:"hidden"},[hy]:{exposure:"event"},[py]:{exposure:"event"},[Eb]:{exposure:"event"},[Ab]:{exposure:"hidden"},[fy]:{exposure:"event"},[ao]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[yl]:{exposure:"hidden"},[Rb]:{exposure:"event"},[DE]:{exposure:"event",shouldSkipFromEventProperties:t=>la(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ys]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!qt(t))return{};for(var e={},n=Object.keys(t),a=0;n.length>a;a++)e["$feature/"+n[a]]=t[n[a]];return e}},[pp]:{exposure:"event",storageGroup:"flags"},[dd]:{exposure:"hidden"},[my]:{exposure:"hidden",storageGroup:"flags"},[fp]:{exposure:"event",storageGroup:"flags"},[gy]:{exposure:"event",storageGroup:"flags",volatile:!0},[bi]:{exposure:"event"},[ul]:{exposure:"hidden"},[Gs]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[vy]:{exposure:"hidden",storageGroup:"surveys"},[uf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[_y]:{exposure:"event"},[ud]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Sd]:{exposure:"hidden"},[yy]:{exposure:"hidden"},[by]:{exposure:"hidden"},[Vd]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[vr]:{exposure:"hidden"},[ky]:{exposure:"hidden"},[wy]:{exposure:"hidden"},[xy]:{exposure:"hidden"},[Py]:{exposure:"hidden"},[hf]:{exposure:"hidden"},[pf]:{exposure:"hidden"},[IE]:{exposure:"event"},[ME]:{exposure:"event"},[NE]:{exposure:"event"},[OE]:{exposure:"event"},[zE]:{exposure:"event"},[FE]:{exposure:"event"},[UE]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Nq=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Us=t=>{var e=Mq[t];if(e)return e;for(var n of Nq){var a=n[1];if(t.indexOf(n[0])===0)return a}},Wd=t=>{var e=xe?.createElement("a");return ke(e)?null:(e.href=t,e)},zl=function(t,e){for(var n,a=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;a.length>r;r++){var s=a[r].split("=");if(s[0]===e){n=s;break}}if(!it(n)||2>n.length)return"";var l=n[1];try{l=decodeURIComponent(l)}catch{be.error("Skipping decoding for malformed query param: "+l)}return l.replace(/\+/g," ")},Gd=function(t,e,n){if(!t||!e||!e.length)return t;for(var a=t.split("#"),r=a[1],s=(a[0]||"").split("?"),l=s[1],c=s[0],u=(l||"").split("&"),h=[],p=0;u.length>p;p++){var m=u[p].split("=");it(m)&&(e.includes(m[0])?h.push(m[0]+"="+n):h.push(u[p]))}var v=c;return l!=null&&(v+="?"+h.join("&")),r!=null&&(v+="#"+r),v},_f=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},a6=(t,e)=>t>=e&&J4(),r6=(t,e,n,a)=>{if(t===0){if(J4()){var r=e+1;return r===n&&a(),r}return e}return 0},$h="https?://(.*)",Fl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oq=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Fl],qd="<masked>",jq=["li_fat_id"];function i6(t,e,n){if(!xe)return{};var a,r=e?[...Fl,...n||[]]:[],s=s6(Gd(xe.URL,r,qd),t),l=(a={},Mt(jq,(function(c){var u=Fr.A(c);a[c]=u||null})),a);return Bt(l,s)}function s6(t,e){var n=Oq.concat(e||[]),a={};return Mt(n,(function(r){var s=zl(t,r);a[r]=s||null})),a}function o6(t){var e=(function(s){return s?s.search($h+"google.([^/?]*)")===0?"google":s.search($h+"bing.com")===0?"bing":s.search($h+"yahoo.com")===0?"yahoo":s.search($h+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",a={};if(!la(e)){a.$search_engine=e;var r=xe?zl(xe.referrer,n):"";r.length&&(a.ph_keyword=r)}return a}function aS(){return navigator.language||navigator.userLanguage}var yf="$direct";function l6(){return xe?.referrer||yf}function c6(t,e,n){n===void 0&&(n=!1);var a=t?[...Fl,...e||[]]:[],r=n?ms(fn?.href):fn?.href,s=r?.substring(0,1e3);return{r:l6().substring(0,1e3),u:s?Gd(s,a,qd):void 0}}function d6(t,e){var n;e===void 0&&(e=!1);var a=t.r,r=t.u,s=e?ms(r):r,l={$referrer:a,$referring_domain:a==null?void 0:a==yf?yf:(n=Wd(a))==null?void 0:n.host};if(s){l.$current_url=s;var c=Wd(s);l.$host=c?.host,l.$pathname=c?.pathname;var u=s6(s);Bt(l,u)}if(a){var h=o6(a);Bt(l,h)}return l}function u6(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zq(){try{return new Date().getTimezoneOffset()}catch{return}}var Fq={flags:Vd,surveys:uf},Uq=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],al="main";class Mv{constructor(e,n,a){if(a===void 0&&(a=!0),this.Gt={},this.Qt=!1,this.Jt=!1,this.Se=e,this.Kt=a,this.props={},this.Yt=!1,this.Xt=(s=>{var l="";return s.token&&(l=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+l+"_posthog"})(e),this.Nt=this.er(e),this.Jt=this.tr(e),this.load(),e.debug&&be.info("Persistence loaded",e.persistence,he({},this.props)),this.update_config(e,e,n),this.save(),Z){var r=()=>this.flush();tn(Z,"beforeunload",r,{capture:!1}),tn(Z,"pagehide",r,{capture:!1})}}rr(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Bn(n)&&n>0?n:0}isDisabled(){return!!this.ir}er(e){Uq.indexOf(e.persistence.toLowerCase())===-1&&(be.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,a=(function(l,c){l===void 0&&(l=[]),c===void 0&&(c=!1);var u=[...vq,...l];return he({},It,{F(h){try{var p={};try{p=Fr.F(h)||{}}catch{}var m,v=JSON.parse(It.A(h)||"{}");if(c){var y={};for(var b in p){var x=p[b];la(x)||x===""||(y[b]=x)}m=Bt(v,y)}else m=Bt(p,v);return It.q(h,m),m}catch{}return null},q(h,p,m,v,y,b){var x=It.q(h,p,void 0,void 0,b);try{var P={};u.forEach((T=>{p[T]&&(P[T]=p[T])})),Object.keys(P).length&&Fr.q(h,P,m,v,y,b)}catch(T){It.D(T)}return x},P(h,p){try{Z?.localStorage.removeItem(h),Fr.P(h,p)}catch(m){It.D(m)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&It.N()?(n=It,r=!0):s==="localstorage+cookie"&&a.N()?(n=a,r=!0):s==="sessionstorage"&&Fn.N()?n=Fn:s==="memory"?n=_q:s==="cookie"?n=Fr:a.N()?(n=a,r=!0):n=Fr,this.Qt=r,n}nr(e){return this.Xt+"__"+e}tr(e){return this.Qt&&!!e.split_storage}sr(e){var n=e??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var a=this.props[Vd];return!a||typeof a!="number"||Date.now()-a>n}properties(){var e={};return Mt(this.props,((n,a)=>{var r=Us(a);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(n,a===Ys?()=>this.sr():()=>!1))return;r.transformToEventProperties&&Bt(e,r.transformToEventProperties(n))}else if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(n,(()=>!1)))return;e[a]=n}})),e}load(){if(!this.ir){var e=this.Nt.F(this.Xt);e&&(this.props=Bt({},e)),this.Jt&&this.ar()}}ar(){for(var e of Bh){var n=It.F(this.nr(e));if(n&&!cs(n)){var a=this.lr(e);a.persisted=!0,this.ur(e)||(a.fingerprint=this.hr(n,e)),this.dr(e,n)||Bt(this.props,n)}}}ur(e){return Object.keys(this.props).some((n=>{var a;return((a=Us(n))==null?void 0:a.storageGroup)===e}))}dr(e,n){var a=Fq[e];if(!a)return!1;var r=n[a],s=this.props[a];return Bn(r)&&Bn(s)&&s>r}refreshKey(e){var n;if(!this.ir){var a=this.Jt?(n=Us(e))==null?void 0:n.storageGroup:void 0,r=a?It.F(this.nr(a)):this.Nt.F(this.Xt);if(r&&e in r)this.cr(e,r[e]);else{if(a){var s=this.Nt.F(this.Xt);if(s&&e in s)return void this.cr(e,s[e])}this.vr(e)}}}save(){if(!this.ir){var e=this.rr();e>0?ke(this.pr)&&(this.pr=setTimeout((()=>{this.pr=void 0,this.gr()}),e)):this.gr()}}flush(){ke(this.pr)||(clearTimeout(this.pr),this.pr=void 0,this.gr())}gr(){this.ir||(this.Jt?this.mr():this.yr(this.Nt,this.Xt,this.props,al))}mr(){var e=this.br(),n=e.main,a=e.groups;for(var r of(this.yr(this.Nt,this.Xt,n,al),Bh)){var s,l=a[r];(!cs(l)||(s=this.Gt[r])!=null&&s.persisted)&&this.yr(It,this.nr(r),l,r)}}br(){var e={},n={};for(var a of Bh)n[a]={};return Mt(this.props,((r,s)=>{var l,c=(l=Us(s))==null?void 0:l.storageGroup;c?n[c][s]=r:e[s]=r})),{main:e,groups:n}}hr(e,n){if(n===al)return JSON.stringify(e)+"|"+this._r+"|"+this.wr+"|"+this.kr;var a={};return Mt(e,((r,s)=>{var l;a[s]=(l=Us(s))!=null&&l.volatile?"__volatile__":r})),JSON.stringify(a)}yr(e,n,a,r){var s=this.lr(r);if(r===al||s.dirty||ke(s.fingerprint)){var l;try{if((l=this.hr(a,r))===s.fingerprint)return void(s.dirty=!1)}catch{l=void 0}e.q(n,a,this._r,this.wr,this.kr,this.Se.debug)?(s.dirty=!1,r!==al&&(s.persisted=!0),ke(l)||(s.fingerprint=l)):this.Se.debug&&be.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(e){var n=(e===void 0?{}:e).keepGroupEntries,a=n!==void 0&&n;if(ke(this.pr)||(clearTimeout(this.pr),this.pr=void 0),this.Nt.P(this.Xt,!1),this.Nt.P(this.Xt,!0),!a&&this.Kt)for(var r of Bh)It.P(this.nr(r));a?delete this.Gt[al]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,n,a){if(qt(e)){ke(n)&&(n="None"),this._r=ke(a)?this.Sr:a;var r=!1;if(Mt(e,((s,l)=>{this.props.hasOwnProperty(l)&&this.props[l]!==n||(this.cr(l,s),r=!0)})),r)return this.save(),!0}return!1}register(e,n){if(qt(e)){this._r=ke(n)?this.Sr:n;var a=!1;if(Mt(e,((r,s)=>{e.hasOwnProperty(s)&&this.props[s]!==r&&(this.cr(s,r),a=!0)})),a)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.vr(e),this.save())}update_campaign_params(){if(!this.Yt){var e=i6(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);cs(Db(e))||this.register(e),this.Yt=!0}}update_search_keyword(){var e;this.register((e=xe?.referrer)?o6(e):{})}update_referrer_info(){var e;this.register_once({$referrer:l6(),$referring_domain:xe!=null&&xe.referrer&&((e=Wd(xe.referrer))==null?void 0:e.host)||yf},void 0)}set_initial_person_info(){this.props[xy]||this.props[Py]||this.register_once({[hf]:c6(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Mt([Py,xy],(r=>{var s=this.props[r];s&&Mt(s,(function(l,c){e["$initial_"+ty(c)]=l}))}));var n=this.props[hf];if(n){var a=(function(r,s){s===void 0&&(s=!1);var l=d6(r,s),c={};return Mt(l,(function(u,h){c["$initial_"+ty(h)]=u})),c})(n,this.Se.disable_capture_url_hashes);Bt(e,a)}return e}safe_merge(e){return Mt(this.props,(function(n,a){a in e||(e[a]=n)})),e}update_config(e,n,a){this.Sr=this._r=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==n.persistence||!((u,h)=>{if(u.length!==h.length)return!1;var p=[...u].sort(),m=[...h].sort();return p.every(((v,y)=>v===m[y]))})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=r?this.er(e):this.Nt,l=this.tr(e);if(r||l!==this.Jt){var c=this.props;this.clear(),this.Nt=s,this.Jt=l,this.props=c,this.save()}}set_disabled(e){this.ir=e,this.ir?this.remove():this.save()}set_cross_subdomain(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.kr&&(this.kr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var a=this.props[cd]||{};a[e]=n,this.cr(cd,a),this.save()}remove_event_timer(e){var n=this.props[cd]||{},a=n[e];return ke(a)||(delete n[e],this.cr(cd,n),this.save()),a}get_property(e){return this.props[e]}set_property(e,n){this.cr(e,n),this.save()}cr(e,n){var a;this.props[e]=n,(a=Us(e))!=null&&a.volatile||this.Cr(e)}vr(e){delete this.props[e],this.Cr(e)}Cr(e){var n,a=(n=Us(e))==null?void 0:n.storageGroup;a&&(this.lr(a).dirty=!0)}lr(e){return this.Gt[e]||(this.Gt[e]={})}}var qc={Activation:"events",Cancellation:"cancelEvents"},Nv={Popover:"popover",API:"api",Widget:"widget"},Pi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Ov={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ey={Popover:"popover",Inline:"inline"},Bq={SHOWN:"product tour shown"},rS={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},iS=Zt("[RateLimiter]");class $q{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var a=n.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((r=>{iS.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void iS.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:a})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,a,r;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,l=this.captureEventsPerSecond,c=new Date().getTime(),u=(n=(a=this.instance.persistence)==null?void 0:a.get_property(wy))!==null&&n!==void 0?n:{tokens:s,last:c};u.tokens+=(c-u.last)/1e3*l,u.last=c,u.tokens>s&&(u.tokens=s);var h=1>u.tokens;return h||e||(u.tokens=Math.max(0,u.tokens-1)),!h||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+l+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=h,(r=this.instance.persistence)==null||r.set_property(wy,u),{isRateLimited:h,remainingTokens:u.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Kc=Zt("[RemoteConfig]");class h6{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Be._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Tr(e){var n,a;(n=Be.__PosthogExtensions__)!=null&&n.loadExternalDependency?(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ir(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return Kc.info("Using preloaded remote config",this.remoteConfig),this.Mr(this.remoteConfig),void this.Er();if(this._instance.Rr())return void Kc.warn("Remote config is disabled. Falling back to local config.");this.Tr((e=>{if(!e)return Kc.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ir((n=>{this.Mr(n),this.Er()}));this.Mr(e),this.Er()}))}catch(e){Kc.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}refresh(){!this._instance.Rr()&&xe&&xe.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Er(){var e;if(!this.Pr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Pr=setInterval((()=>{this.refresh()}),n))}}Mr(e){var n;e||Kc.error("Failed to fetch remote config from PostHog."),this._instance.Mr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var aa={GZipJS:"gzip-js",Base64:"base64"},Qa=Uint8Array,_a=Uint16Array,Ul=Uint32Array,Ob=new Qa([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),jb=new Qa([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),sS=new Qa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p6=function(t,e){for(var n=new _a(31),a=0;31>a;++a)n[a]=e+=1<<t[a-1];var r=new Ul(n[30]);for(a=1;30>a;++a)for(var s=n[a];n[a+1]>s;++s)r[s]=s-n[a]<<5|a;return[n,r]},f6=p6(Ob,2),Ay=f6[1];f6[0][28]=258,Ay[258]=28;for(var oS=p6(jb,0)[1],m6=new _a(32768),Yt=0;32768>Yt;++Yt){var rl=(43690&Yt)>>>1|(21845&Yt)<<1;m6[Yt]=((65280&(rl=(61680&(rl=(52428&rl)>>>2|(13107&rl)<<2))>>>4|(3855&rl)<<4))>>>8|(255&rl)<<8)>>>1}var Td=function(t,e,n){for(var a=t.length,r=0,s=new _a(e);a>r;++r)++s[t[r]-1];var l,c=new _a(e);for(r=0;e>r;++r)c[r]=c[r-1]+s[r-1]<<1;for(l=new _a(a),r=0;a>r;++r)l[r]=m6[c[t[r]-1]++]>>>15-t[r];return l},vo=new Qa(288);for(Yt=0;144>Yt;++Yt)vo[Yt]=8;for(Yt=144;256>Yt;++Yt)vo[Yt]=9;for(Yt=256;280>Yt;++Yt)vo[Yt]=7;for(Yt=280;288>Yt;++Yt)vo[Yt]=8;var bf=new Qa(32);for(Yt=0;32>Yt;++Yt)bf[Yt]=5;var Vq=Td(vo,9),Hq=Td(bf,5),g6=function(t){return(t/8>>0)+(7&t&&1)},v6=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var a=new(t instanceof _a?_a:t instanceof Ul?Ul:Qa)(n-e);return a.set(t.subarray(e,n)),a},fi=function(t,e,n){var a=e/8>>0;t[a]|=n<<=7&e,t[a+1]|=n>>>8},Yc=function(t,e,n){var a=e/8>>0;t[a]|=n<<=7&e,t[a+1]|=n>>>8,t[a+2]|=n>>>16},jv=function(t,e){for(var n=[],a=0;t.length>a;++a)t[a]&&n.push({s:a,f:t[a]});var r=n.length,s=n.slice();if(!r)return[new Qa(0),0];if(r==1){var l=new Qa(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort((function(D,B){return D.f-B.f})),n.push({s:-1,f:25001});var c=n[0],u=n[1],h=0,p=1,m=2;for(n[0]={s:-1,f:c.f+u.f,l:c,r:u};p!=r-1;)c=n[n[m].f>n[h].f?h++:m++],u=n[h!=p&&n[m].f>n[h].f?h++:m++],n[p++]={s:-1,f:c.f+u.f,l:c,r:u};var v=s[0].s;for(a=1;r>a;++a)s[a].s>v&&(v=s[a].s);var y=new _a(v+1),b=Ry(n[p-1],y,0);if(b>e){a=0;var x=0,P=b-e,T=1<<P;for(s.sort((function(D,B){return y[B.s]-y[D.s]||D.f-B.f}));r>a;++a){var L=s[a].s;if(e>=y[L])break;x+=T-(1<<b-y[L]),y[L]=e}for(x>>>=P;x>0;){var E=s[a].s;e>y[E]?x-=1<<e-y[E]++-1:++a}for(;a>=0&&x;--a){var A=s[a].s;y[A]==e&&(--y[A],++x)}b=e}return[new Qa(y),b]},Ry=function(t,e,n){return t.s==-1?Math.max(Ry(t.l,e,n+1),Ry(t.r,e,n+1)):e[t.s]=n},lS=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _a(++e),a=0,r=t[0],s=1,l=function(u){n[a++]=u},c=1;e>=c;++c)if(t[c]==r&&c!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)l(32754);s>2&&(l(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(l(r),--s;s>6;s-=6)l(8304);s>2&&(l(s-3<<5|8208),s=0)}for(;s--;)l(r);s=1,r=t[c]}return[n.subarray(0,a),e]},Zc=function(t,e){for(var n=0,a=0;e.length>a;++a)n+=t[a]*e[a];return n},Ly=function(t,e,n){var a=n.length,r=g6(e+2);t[r]=255&a,t[r+1]=a>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;a>s;++s)t[r+s+4]=n[s];return 8*(r+4+a)},cS=function(t,e,n,a,r,s,l,c,u,h,p){fi(e,p++,n),++r[256];for(var m=jv(r,15),v=m[0],y=m[1],b=jv(s,15),x=b[0],P=b[1],T=lS(v),L=T[0],E=T[1],A=lS(x),D=A[0],B=A[1],j=new _a(19),S=0;L.length>S;++S)j[31&L[S]]++;for(S=0;D.length>S;++S)j[31&D[S]]++;for(var N=jv(j,7),U=N[0],Q=N[1],ee=19;ee>4&&!U[sS[ee-1]];--ee);var ce,le,re,te,ie=h+5<<3,$=Zc(r,vo)+Zc(s,bf)+l,X=Zc(r,v)+Zc(s,x)+l+14+3*ee+Zc(j,U)+(2*j[16]+3*j[17]+7*j[18]);if($>=ie&&X>=ie)return Ly(e,p,t.subarray(u,u+h));if(fi(e,p,1+($>X)),p+=2,$>X){ce=Td(v,y),le=v,re=Td(x,P),te=x;var W=Td(U,Q);for(fi(e,p,E-257),fi(e,p+5,B-1),fi(e,p+10,ee-4),p+=14,S=0;ee>S;++S)fi(e,p+3*S,U[sS[S]]);p+=3*ee;for(var O=[L,D],Y=0;2>Y;++Y){var ae=O[Y];for(S=0;ae.length>S;++S)fi(e,p,W[_e=31&ae[S]]),p+=U[_e],_e>15&&(fi(e,p,ae[S]>>>5&127),p+=ae[S]>>>12)}}else ce=Vq,le=vo,re=Hq,te=bf;for(S=0;c>S;++S)if(a[S]>255){var _e;Yc(e,p,ce[257+(_e=a[S]>>>18&31)]),p+=le[_e+257],_e>7&&(fi(e,p,a[S]>>>23&31),p+=Ob[_e]);var fe=31&a[S];Yc(e,p,re[fe]),p+=te[fe],fe>3&&(Yc(e,p,a[S]>>>5&8191),p+=jb[fe])}else Yc(e,p,ce[a[S]]),p+=le[a[S]];return Yc(e,p,ce[256]),p+le[256]},Wq=new Ul([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gq=(function(){for(var t=new Ul(256),e=0;256>e;++e){for(var n=e,a=9;--a;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),zv=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function qq(t,e){e===void 0&&(e={});var n=(function(){var m=4294967295;return{p(v){for(var y=m,b=0;v.length>b;++b)y=Gq[255&y^v[b]]^y>>>8;m=y},d(){return 4294967295^m}}})(),a=t.length;n.p(t);var r,s,l,c,u,h=(c=10+((r=e).filename&&r.filename.length+1||0),u=8,(function(m,v,y,b,x,P){var T=m.length,L=new Qa(b+T+5*(1+Math.floor(T/7e3))+x),E=L.subarray(b,L.length-x),A=0;if(!v||8>T)for(var D=0;T>=D;D+=65535){var B=D+65535;T>B?A=Ly(E,A,m.subarray(D,B)):(E[D]=!0,A=Ly(E,A,m.subarray(D,T)))}else{for(var j=Wq[v-1],S=j>>>13,N=8191&j,U=(1<<y)-1,Q=new _a(32768),ee=new _a(U+1),ce=Math.ceil(y/3),le=2*ce,re=function(xr){return(m[xr]^m[xr+1]<<ce^m[xr+2]<<le)&U},te=new Ul(25e3),ie=new _a(288),$=new _a(32),X=0,W=0,O=(D=0,0),Y=0,ae=0;T>D;++D){var _e=re(D),fe=32767&D,ve=ee[_e];if(Q[fe]=ve,ee[_e]=fe,D>=Y){var Ne=T-D;if((X>7e3||O>24576)&&Ne>423){A=cS(m,E,0,te,ie,$,W,O,ae,D-ae,A),O=X=W=0,ae=D;for(var Oe=0;286>Oe;++Oe)ie[Oe]=0;for(Oe=0;30>Oe;++Oe)$[Oe]=0}var Ie=2,St=0,un=N,jt=fe-ve&32767;if(Ne>2&&_e==re(D-jt))for(var _t=Math.min(S,Ne)-1,Jt=Math.min(32767,D),nr=Math.min(258,Ne);Jt>=jt&&--un&&fe!=ve;){if(m[D+Ie]==m[D+Ie-jt]){for(var Mn=0;nr>Mn&&m[D+Mn]==m[D+Mn-jt];++Mn);if(Mn>Ie){if(Ie=Mn,St=jt,Mn>_t)break;var Vt=Math.min(jt,Mn-2),Xe=0;for(Oe=0;Vt>Oe;++Oe){var ot=D-jt+Oe+32768&32767,Dt=ot-Q[ot]+32768&32767;Dt>Xe&&(Xe=Dt,ve=ot)}}}jt+=(fe=ve)-(ve=Q[fe])+32768&32767}if(St){te[O++]=268435456|Ay[Ie]<<18|oS[St];var Et=31&Ay[Ie],Nn=31&oS[St];W+=Ob[Et]+jb[Nn],++ie[257+Et],++$[Nn],Y=D+Ie,++X}else te[O++]=m[D],++ie[m[D]]}}A=cS(m,E,!0,te,ie,$,W,O,ae,D-ae,A)}return v6(L,0,b+g6(A)+x)})(s=t,(l=e).level==null?6:l.level,l.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+l.mem,c,u)),p=h.length;return(function(m,v){var y=v.filename;if(m[0]=31,m[1]=139,m[2]=8,m[8]=2>v.level?4:v.level==9?2:0,m[9]=3,v.mtime!=0&&zv(m,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),y){m[3]=8;for(var b=0;y.length>=b;++b)m[b+10]=y.charCodeAt(b)}})(h,e),zv(h,p-8,n.d()),zv(h,p-4,a),h}var Kq=!!Q_||!!wb,_6="text/plain",gp=!1,Dy=(t,e)=>{var n=t.split("#"),a=n[1],r=n[0].split("?"),s=r[0],l=r[1];if(!l)return t;var c=l.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(c?"?"+c:"")+(a?"#"+a:"")},zb=function(t,e,n){var a;n===void 0&&(n=!0);var r=t.split("?"),s=r[0],l=r[1],c=he({},e),u=(a=l?.split("&").map((p=>{var m,v=p.split("="),y=v[0],b=n&&(m=c[y])!==null&&m!==void 0?m:v[1];return delete c[y],y+"="+b})))!==null&&a!==void 0?a:[],h=(function(p,m){var v,y;m===void 0&&(m="&");var b=[];return Mt(p,(function(x,P){ke(x)||ke(P)||P==="undefined"||(v=encodeURIComponent((T=>T instanceof File)(x)?x.name:x.toString()),y=encodeURIComponent(P),b[b.length]=y+"="+v)})),b.join(m)})(c);return h&&u.push(h),s+"?"+u.join("&")},bl=(t,e)=>{try{return JSON.stringify(t,((n,a)=>typeof a=="bigint"?a.toString():a),e)}catch{return eE(t)}},Fv=t=>{if(t.Lt)return t.Lt;var e=t.data,n=t.compression;if(e){if(n===aa.GZipJS){var a=qq((function(c,u){var h=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var p=new Qa(c.length+(c.length>>>1)),m=0,v=function(P){p[m++]=P},y=0;h>y;++y){if(m+5>p.length){var b=new Qa(m+8+(h-y<<1));b.set(p),p=b}var x=c.charCodeAt(y);128>x?v(x):2048>x?(v(192|x>>>6),v(128|63&x)):x>55295&&57344>x?(v(240|(x=65536+(1047552&x)|1023&c.charCodeAt(++y))>>>18),v(128|x>>>12&63),v(128|x>>>6&63),v(128|63&x)):(v(224|x>>>12),v(128|x>>>6&63),v(128|63&x))}return v6(p,0,m)})(bl(e)),{mtime:0});return{contentType:_6,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===aa.Base64){var r=(function(c){return c&&btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,((u,h)=>String.fromCharCode(parseInt(h,16)))))})(bl(e)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:bl(c)))(r);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var l=bl(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},y6=t=>{var e,n,a=()=>t.transport==="sendBeacon"?{url:zb(t.url,{compression:aa.Base64}),encodedBody:Fv(he({},t,{compression:aa.Base64,Lt:void 0}))}:{url:Dy(t.url,"compression"),encodedBody:Fv(he({},t,{compression:void 0,Lt:void 0}))};try{e=Fv(t)}catch(r){if(MP(t.compression,zl(t.url,"compression")))return be.error("Failed to gzip request body, sending uncompressed payload",r),a();throw r}return e&&MP(t.compression,zl(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?X_(new Uint8Array(n)):ArrayBuffer.isView(n)&&X_(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(gp=!0,a()):{url:t.url,encodedBody:e}},b6=t=>{try{return y6(t)}catch(e){return be.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},Yq=(function(){var t=cn((function*(e){var n=bl(e.data),a=yield(function(s,l,c){return ey.apply(this,arguments)})(n,en.DEBUG,{rethrow:!0});if(!a)return e;var r=yield a.arrayBuffer();return he({},e,{Lt:{contentType:_6,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),Zq=/Failed to fetch|NetworkError|Load failed/i,k6=t=>{var e,n=b6(t);if(n){var a=n.url,r=n.encodedBody,s=r??{},l=s.contentType,c=s.body,u=s.estimatedSize,h=new Headers;Mt(t.headers,(function(y,b){h.append(b,y)})),l&&h.append("Content-Type",l);var p=null,m=!1;if(TP){var v=new TP;p={signal:v.signal,timeout:setTimeout((()=>{var y,b;m=!0,v.abort((y=t.timeout,(b=new Error("PostHog request timed out"+(y?" after "+y+"ms":""))).name="AbortError",b))}),t.timeout)}}wb(a,he({method:t?.method||"GET",headers:h,keepalive:t.method==="POST"&&!t.Ft&&52428.8>(u||0),body:c,signal:(e=p)==null?void 0:e.signal},t.fetchOptions)).then((y=>y.text().then((b=>{var x={statusCode:y.status,text:b};if(y.status===200)try{x.json=JSON.parse(b)}catch(P){be.error(P)}t.callback==null||t.callback(x)})))).catch((y=>{m&&y?.name==="AbortError"||(b=>b?.name==="TypeError"&&Zq.test(b?.message||""))(y)?be.warn(y):be.error(y),t.callback==null||t.callback({statusCode:0,error:y})})).finally((()=>p?clearTimeout(p.timeout):null))}},Iy=t=>{try{var e=y6(t),n=e.url,a=e.encodedBody,r=a??{},s=r.body,l=r.estimatedSize;if(!s)return;var c=s instanceof Blob?s:new Blob([s],{type:r.contentType});if(sa.sendBeacon(n,c))return;if(it(t.data)&&t.data.length>1&&(l??0)>16384){var u=Math.ceil(t.data.length/2);return Iy(he({},t,{data:t.data.slice(0,u)})),void Iy(he({},t,{data:t.data.slice(u)}))}be.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),k6(he({},t,{Ft:!0}))}catch(h){be.warn("Beacon send failed",h)}},Jq=["/e/","/s/"],dS=(t,e)=>{var n=(r=>{var s=(l=>{var c=Wd(l),u=c?.pathname||l.split(/[?#]/)[0];return u?u[0]==="/"?u:"/"+u:"/"})(r);return Jq.some((l=>((c,u)=>c.slice(c.length-u.length)===u)(s,l)))})(t),a=n?Dy(t,"ver"):t;return zb(e===aa.GZipJS?Dy(a,"compression"):a,he({_:new Date().getTime().toString()},n?{}:{ver:en.JS_SDK_VERSION},e===aa.GZipJS?{}:{compression:e}))},vp=[];wb&&vp.push({transport:"fetch",method:k6}),Q_&&vp.push({transport:"XHR",method(t){var e=b6(t);if(e){var n=new Q_,a=e.encodedBody;n.open(t.method||"GET",e.url,!0);var r=a??{},s=r.contentType,l=r.body;Mt(t.headers,(function(c,u){n.setRequestHeader(u,c)})),s&&n.setRequestHeader("Content-Type",s),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(c)}},n.send(l)}}}),sa!=null&&sa.sendBeacon&&vp.push({transport:"sendBeacon",method:Iy});var My=3e3;class Qq{constructor(e,n){this.Or=!0,this.Lr=[],this.Fr=Br(n?.flush_interval_ms||My,250,5e3,be.createLogger("flush interval"),My),this.Ar=e}enqueue(e){this.Lr.push(e),this.$r||this.Nr()}unload(){this.Dr();var e=this.Lr.length>0?this.qr():{},n=Object.values(e);[...n.filter((a=>a.url.indexOf("/e")===0)),...n.filter((a=>a.url.indexOf("/e")!==0))].map((a=>{this.jr(he({},a,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.Nr()}Nr(){var e=this;this.Or||(this.$r=setTimeout((()=>{if(this.Dr(),this.Lr.length>0){var n=this.qr(),a=function(){var s=n[r],l=new Date().getTime();s.data&&it(s.data)&&Mt(s.data,(c=>{c.offset=Math.abs(c.timestamp-l),delete c.timestamp})),e.jr(s)};for(var r in n)a()}}),this.Fr))}jr(e){try{this.Ar(e)}catch(n){be.error(n)}}Dr(){clearTimeout(this.$r),this.$r=void 0}qr(){var e={};return Mt(this.Lr,(n=>{var a,r=n,s=(r?r.batchKey:null)||r.url;ke(e[s])&&(e[s]=he({},r,{data:[]})),(a=e[s].data)==null||a.push(r.data)})),this.Lr=[],e}}var Xq=["retriesPerformedSoFar"];class eK{constructor(e){this.Br=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.Ur=!0,!ke(Z)&&"onLine"in Z.navigator&&(this.Ur=Z.navigator.onLine,this.zr=()=>{this.Ur=!0,this.Wr()},this.Vr=()=>{this.Ur=!1},tn(Z,"online",this.zr),tn(Z,"offline",this.Vr))}get length(){return this.Lr.length}retriableRequest(e){var n=e.retriesPerformedSoFar,a=Q4(e,Xq);yi(n)&&(a.url=zb(a.url,{retry_count:n})),this._instance._send_request(he({},a,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(n??0))return void this.st(he({retriesPerformedSoFar:n},a));r.statusCode===0&&be.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}a.callback==null||a.callback(r)}}))}st(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var a=(function(l){var c=3e3*Math.pow(2,l),u=c/2,h=Math.min(18e5,c),p=Math.random()-.5;return Math.ceil(h+p*(h-u))})(n),r=Date.now()+a;this.Lr.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+a;navigator.onLine||(s+=" (Browser is offline)"),be.warn(s),this.Br||(this.Br=!0,this.Zr())}Zr(){if(this.Gr&&clearTimeout(this.Gr),this.Lr.length===0)return this.Br=!1,void(this.Gr=void 0);this.Gr=setTimeout((()=>{this.Ur&&this.Lr.length>0&&this.Wr(),this.Zr()}),this.Hr)}Wr(){var e=Date.now(),n=[],a=this.Lr.filter((s=>e>s.retryAt||(n.push(s),!1)));if(this.Lr=n,a.length>0)for(var r of a)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,ke(Z)||(this.zr&&(Z.removeEventListener("online",this.zr),this.zr=void 0),this.Vr&&(Z.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Lr)){var n=e.requestOptions;try{this._instance._send_request(he({},n,{transport:"sendBeacon"}))}catch(a){be.error(a)}}this.Lr=[]}}class tK{constructor(e){this.Qr=()=>{var n,a,r,s;this.Jr||(this.Jr={});var l=this.scrollElement(),c=this.scrollY(),u=l?Math.max(0,l.scrollHeight-l.clientHeight):0,h=c+(l?.clientHeight||0),p=l?.scrollHeight||0;this.Jr.lastScrollY=Math.ceil(c),this.Jr.maxScrollY=Math.max(c,(n=this.Jr.maxScrollY)!==null&&n!==void 0?n:0),this.Jr.maxScrollHeight=Math.max(u,(a=this.Jr.maxScrollHeight)!==null&&a!==void 0?a:0),this.Jr.lastContentY=h,this.Jr.maxContentY=Math.max(h,(r=this.Jr.maxContentY)!==null&&r!==void 0?r:0),this.Jr.maxContentHeight=Math.max(p,(s=this.Jr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get Kr(){return this._instance.config.scroll_root_selector}getContext(){return this.Jr}resetContext(){var e=this.Jr;return setTimeout(this.Qr,0),e}startMeasuringScrollPosition(){tn(Z,"scroll",this.Qr,{capture:!0}),tn(Z,"scrollend",this.Qr,{capture:!0}),tn(Z,"resize",this.Qr)}scrollElement(){if(!this.Kr)return Z?.document.documentElement;var e=it(this.Kr)?this.Kr:[this.Kr];for(var n of e){var a=Z?.document.querySelector(n);if(a)return a}}Yr(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.Kr){var a=this.scrollElement();return a&&a[n]||0}return Z?e==="y"?Z.scrollY||Z.pageYOffset||Z.document.documentElement.scrollTop||0:Z.scrollX||Z.pageXOffset||Z.document.documentElement.scrollLeft||0:0}scrollY(){return this.Yr("y")}scrollX(){return this.Yr("x")}}var nK=t=>c6(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);class uS{constructor(e,n,a,r){this.Xr=s=>{var l=this.ei();if(!l||l.sessionId!==s){var c={sessionId:s,props:this.ti(this._instance)};this.ri.register({[ky]:c})}},this._instance=e,this.ii=n,this.ri=a,this.ti=r||nK,this.ii.onSessionId(this.Xr)}ei(){return this.ri.props[ky]}getSetOnceProps(){var e,n=(e=this.ei())==null?void 0:e.props;return n?"r"in n?d6(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Mt(Db(this.getSetOnceProps()),((n,a)=>{a==="$current_url"&&(a="url"),e["$session_entry_"+ty(a)]=n})),e}}class Fb{constructor(){this.ni={}}on(e,n){return this.ni[e]||(this.ni[e]=[]),this.ni[e].push(n),()=>{this.ni[e]=this.ni[e].filter((a=>a!==n))}}emit(e,n){for(var a of this.ni[e]||[])a(n);for(var r of this.ni["*"]||[])r(e,n)}}var Jc=Zt("[SessionId]");class hS{on(e,n){return this.si.on(e,n)}constructor(e,n,a){var r;if(this.oi=null,this.ai=[],this.li=void 0,this.ui=!1,this.si=new Fb,this.hi=(h,p)=>!(!yi(h)||!yi(p))&&Math.abs(h-p)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===xi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ri=e.persistence,this.di=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=n||wi,this.fi=a||wi;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*Br(this.Se.session_idle_timeout_seconds||1800,60,36e3,Jc.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var l=Fn.F(this.gi),c=Fn.F(this.mi);l&&!c?this.di=l:Fn.P(this.gi),Fn.q(this.mi,!0)}if((r=this.Se.bootstrap)!=null&&r.sessionID)try{var u=(h=>{var p=this.Se.bootstrap.sessionID.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})();this.bi(this.Se.bootstrap.sessionID,new Date().getTime(),u)}catch(h){Jc.error("Invalid sessionID in bootstrap",h)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ke(this.ai)&&(this.ai=[]),this.ai.push(e),this.ci&&e(this.ci,this.di),()=>{this.ai=this.ai.filter((n=>n!==e))}}yi(){return this.Se.persistence!=="memory"&&!this.ri.ir&&Fn.N()}xi(e){e!==this.di&&(this.di=e,this.yi()&&Fn.q(this.gi,e))}ki(){return this.di?this.di:this.yi()?Fn.F(this.gi):null}Si(e){var n=this.oi;return!la(n)&&!la(e)&&5e3>Math.abs(e-n)}bi(e,n,a){var r=n!==this._sessionActivityTimestamp,s=!(e!==this.ci||a!==this._sessionStartTimestamp);this._sessionStartTimestamp=a,this._sessionActivityTimestamp=n,this.ci=e,s&&!r||s&&this.Si(n)||(this.oi=n,this.ri.register({[yl]:[n,e,a]}))}Ci(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return yi(n)&&n>0}Ti(){this.Ci()?this.ri.refreshKey(yl):(this.ri.flush(),this.ri.load())}Ii(){var e;if(!la(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.oi){this.Ti();var n=this.Mi();n[1]===this.ci&&n[2]===this._sessionStartTimestamp&&(this.oi=this._sessionActivityTimestamp,this.ri.register({[yl]:[this._sessionActivityTimestamp,(e=this.ci)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ri.flush())}}Ei(){var e=this.Mi()[0],n=yi(e)?e:0,a=yi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,a)}Ri(e){return this.Ti(),this.hi(e,this.Ei())}Mi(){var e=this.ri.props[yl];return it(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.oi=null,clearTimeout(this.Pi),this.Pi=void 0,this.bi(null,null,null)}destroy(){this.ui=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.li&&Z&&(Z.removeEventListener(mf,this.li,{capture:!1}),this.li=void 0),this.ai=[]}wi(){this.li=()=>{this.Ii(),this.yi()&&Fn.P(this.mi)},tn(Z,mf,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Se.cookieless_mode===xi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),r=this.Mi(),s=r[1],l=r[2],c=this.Ei(),u=this.ki(),h=yi(l)&&Math.abs(a-l)>864e5,p=!1,m=!1,v=!s,y=s,b=!v&&!e&&this.hi(a,c);if(b){(b=this.Ri(a))||Jc.info("cross-tab refresh kept the session alive",{sessionId:s});var x=this.Mi();s=x[1],l=x[2]}v||b||h?(s=this.vi(),u=this.fi(),Jc.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),l=a,p=!0):(u||(u=this.fi(),p=!0),(m=s!==y)&&(Jc.info("adopted cross-tab session id",{sessionId:s,windowId:u}),p=!0));var P=yi(c)&&e&&!h?c:a,T=yi(l)?l:new Date().getTime();this.xi(u),this.bi(s,P,T),e||this.pi();var L={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:m};return p&&this.ai.forEach((E=>E(s,u,L))),{sessionId:s,windowId:u,sessionStartTimestamp:T,changeReason:p?L:void 0,lastActivityTimestamp:c}}pi(){this.ui||(clearTimeout(this.Pi),this.Pi=setTimeout((()=>{if(!this.ui)if(this.Ri(new Date().getTime())){var e=this.ci;this.resetSessionId(),this.si.emit("forcedIdleReset",{idleSessionId:e})}else this.pi()}),1.1*this.sessionTimeoutMs))}}var w6=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&OP(n,e))return!0;try{var a=t?.userAgentData;if(a!=null&&a.brands&&a.brands.some((r=>OP(r?.brand,e))))return!0}catch{}return!!t.webdriver};function x6(){return(x6=cn((function*(){var t=sa?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e?.model;return Lt(n)&&n.length>0?n:void 0}catch(a){return void be.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",a)}}))).apply(this,arguments)}var kf=function(t,e){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function pS(t,e,n){return bl({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var P6={exact:(t,e)=>e.some((n=>t.some((a=>n===a)))),is_not:(t,e)=>e.every((n=>t.every((a=>n!==a)))),regex:(t,e)=>e.some((n=>t.some((a=>kf(n,a))))),not_regex:(t,e)=>e.every((n=>t.every((a=>!kf(n,a))))),icontains:(t,e)=>e.map(Vh).some((n=>t.map(Vh).some((a=>n.includes(a))))),not_icontains:(t,e)=>e.map(Vh).every((n=>t.map(Vh).every((a=>!n.includes(a))))),gt:(t,e)=>e.some((n=>{var a=parseFloat(n);return!isNaN(a)&&t.some((r=>a>parseFloat(r)))})),lt:(t,e)=>e.some((n=>{var a=parseFloat(n);return!isNaN(a)&&t.some((r=>a<parseFloat(r)))}))},Vh=t=>t.toLowerCase();function S6(t,e){return!t||Object.entries(t).every((n=>{var a=n[1],r=e?.[n[0]];if(ke(r)||la(r))return!1;var s=[String(r)],l=P6[a.operator];return!!l&&l(a.values,s)}))}var Ny="custom",fS="i.posthog.com",aK=/^\/static\//;class rK{constructor(e){this.Oi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+fS,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Oi[this.apiHost]||(this.Oi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ny),this.Oi[this.apiHost]}Li(e){if(aK.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var a=this.Li(n);if(a)return""+a+n}if(this.region===Ny)return this.apiHost+n;var r=fS+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function C6(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var Rt=Zt("[Surveys]"),T6="seenSurvey_",E6=t=>{try{var e=(n=>((a,r)=>""+T6+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(r))(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){Rt.error("Failed to persist survey seen state",n)}},iK=[Nv.Popover,Nv.Widget,Nv.API],sK={ignoreConditions:!1,ignoreDelay:!1,displayType:Ey.Popover},oK=Zt("[PostHog ExternalIntegrations]"),lK={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class cK{constructor(e){this._instance=e}Bt(e,n){var a;(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,e,(r=>{if(r)return oK.error("failed to load script",r);n()}))}startIfEnabledOrStop(){var e=this,n=function(){var s,l,c,u=a[0],h=a[1];!h||(s=Be.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.Bt(lK[u],(()=>{var p;(p=Be.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.start(e._instance)})),!h&&(l=Be.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[u]&&((c=Be.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[u])==null||c.stop())};for(var a of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;n()}}}var Ed={},Uv=0,wf=()=>{},mS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qc="Surveys module not available",gS="sanitize_properties is deprecated. Use before_send instead",A6="Invalid value for property_denylist config: ",pl="posthog",R6=!Kq&&va?.indexOf("MSIE")===-1&&va?.indexOf("Mozilla")===-1,vS=t=>{var e;return he({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:hq(xe?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:wf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:fn&&Lt(fn?.search)&&fn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(Z==null||(e=Z.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){be.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sy,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:My},error_tracking:{},_onCapture:wf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Pq,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(t))},dK=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],_S=t=>{var e={};for(var n of dK){var a=n[0],r=n[1];ke(t[a])||(e[r]=t[a])}var s=Bt({},e,t),l=t.__preview_external_dependency_versioned_paths;return ke(l)||(ke(t.strict_script_versioning)&&(s.strict_script_versioning=!!l),Lt(l)&&ke(t.asset_host)&&(s.asset_host=l)),it(t.property_blacklist)&&(ke(t.property_denylist)?s.property_denylist=t.property_blacklist:it(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:be.error(A6+t.property_denylist)),s};class uK{constructor(){this.__forceAllowLocalhost=!1}get Fi(){return this.__forceAllowLocalhost}set Fi(e){be.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Wa{Ai(e,n){if(e){var a=this.$i.indexOf(e);a!==-1&&this.$i.splice(a,1)}return this.$i.push(n),n.initialize==null||n.initialize(),n}Ni(){return this.config.cookieless_mode===xi||this.config.cookieless_mode===Ks&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new uK,this.Di=!1,this.version=en.LIB_VERSION,this.qi=new Fb,this.$i=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=vS(),this.SentryIntegration=Iq,this.sentryIntegration=a=>(function(r,s){var l=n6(r,s);return{name:t6,processEvent:c=>l(c)}})(this,a),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ji=!1,this.Bi=null,this.Hi=null,this.Ui=null,this.scrollManager=new tK(this),this.pageViewManager=new nS(this),this.rateLimiter=new $q(this),this.requestRouter=new rK(this),this.consent=new yq(this),this.externalIntegrations=new cK(this);var n=(e=Wa.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(a,r,s)=>{var l=Lt(a)?{[a]:r}:a;this.setPersonProperties(l),s?.({})},set_once:(a,r,s)=>{var l=Lt(a)?{[a]:r}:a;this.setPersonProperties(void 0,l),s?.({})}},this.on("eventCaptured",(a=>be.info('send "'+a?.event+'"',a)))}init(e,n,a){if(a&&a!==pl){var r,s=(r=Ed[a])!==null&&r!==void 0?r:new Wa;return s._init(e,n,a),Ed[a]=s,Ed[pl][a]=s,s}return this._init(e,n,a)}_init(e,n,a){var r,s;n===void 0&&(n={});var l=Lt(e)?e.trim():"";if(!l)return be.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.zi(n.debug),this.Wi=n,this.Vi=[],n.person_profiles?this.Hi=n.person_profiles:n.process_person&&(this.Hi=n.process_person);var c=vS(n.defaults),u=_S(n),h=Bt({},c,u,{name:a,token:l});qt(c.rageclick)&&qt(u.rageclick)&&(h.rageclick=Bt({},c.rageclick,u.rageclick)),qt(c.session_recording)&&qt(u.session_recording)&&(h.session_recording=Bt({},c.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&be.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:aa.GZipJS;var p=this.Zi();this.persistence=new Mv(this.config,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Mv(he({},this.config,{persistence:"sessionStorage"}),p,!1);var m=he({},this.persistence.props),v=he({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gi=new Qq((A=>this.Qi(A)),this.config.request_queue_config),this.Ji=new eK(this),this.__request_queue=[];var y=this.Ni();if(y||(this.sessionManager=new hS(this),this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(be.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ki(y)}),0)):(be.info("Initializing extensions synchronously"),this.Ki(y)),en.DEBUG=en.DEBUG||this.config.debug,en.DEBUG&&be.info("Starting in debug mode",{this:this,config:n,thisC:he({},this.config),p:m,s:v}),!this.config.identity_distinct_id||(r=n.bootstrap)!=null&&r.distinctID||(n.bootstrap=he({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var b=n.bootstrap.distinctID,x=this.get_distinct_id(),P=this.persistence.get_property(vr);if(n.bootstrap.isIdentifiedID&&x!=null&&x!==b&&P===tl)this.identify(b);else if(n.bootstrap.isIdentifiedID&&x!=null&&x!==b&&P===nl)be.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var T=this.config.get_device_id(wi()),L=n.bootstrap.isIdentifiedID?T:b;this.persistence.set_property(vr,n.bootstrap.isIdentifiedID?nl:tl),this.register({distinct_id:b,$device_id:L})}}if(y)this.register_once({distinct_id:jh,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(wi());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(vr,tl)}return tn(Z,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(A,D){var B=A.config.segment;if(!B)return D();(function(j,S){var N=j.config.segment;if(!N)return S();var U=ee=>{var ce=()=>ee.anonymousId()||wi();j.config.get_device_id=ce,ee.id()&&(j.register({distinct_id:ee.id(),$device_id:ce()}),j.persistence.set_property(vr,nl)),S()},Q=N.user();"then"in Q&&yr(Q.then)?Q.then(U):U(Q)})(A,(()=>{B.register((j=>{typeof Promise<"u"&&Promise.resolve||Iv.warn("This browser does not have Promise support, and can not use the segment integration");var S=(N,U)=>{if(!U)return N;N.event.userId||N.event.anonymousId===j.get_distinct_id()||(Iv.info("No userId set, resetting PostHog"),j.reset()),N.event.userId&&N.event.userId!==j.get_distinct_id()&&(Iv.info("UserId set, identifying with PostHog"),j.identify(N.event.userId));var Q=j.calculateEventProperties(U,N.event.properties);return N.event.properties=Object.assign({},Q,N.event.properties),N};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:N=>S(N,N.event.event),page:N=>S(N,hl),identify:N=>S(N,Rv),screen:N=>S(N,"$screen")}})(A)).then((()=>{D()}))}))})(this,(()=>this.Yi())):this.Yi(),yr(this.config._onCapture)&&this.config._onCapture!==wf&&(be.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(A=>this.config._onCapture(A.event,A)))),this.config.ip&&be.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return x6.apply(this,arguments)})().then((A=>{A&&this.register({[Ev]:A})})).catch(wf),this}Ki(e){var n,a,r,s,l,c,u,h,p=performance.now(),m=he({},Wa.__defaultExtensionClasses,this.config.__extensionClasses),v=[];m.featureFlags&&this.$i.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new m.featureFlags(this)),m.exceptions&&this.$i.push(this.exceptions=(a=this.exceptions)!==null&&a!==void 0?a:new m.exceptions(this)),m.historyAutocapture&&this.$i.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.$i.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.$i.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!e&&this.$i.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.$i.push(this.autocapture=new m.autocapture(this)),m.surveys&&this.$i.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this)),m.logs&&this.$i.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new m.logs(this)),m.metrics&&this.$i.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new m.metrics(this)),m.conversations&&this.$i.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new m.conversations(this)),m.productTours&&this.$i.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.$i.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.$i.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.$i.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.$i.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,Dq)),m.toolbar&&this.$i.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new m.toolbar(this)),m.experiments&&this.$i.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new m.experiments(this)),this.$i.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Xi){var y=this.Xi;this.Xi=void 0,this.Mr(y)}})),this.en(v,p)}en(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout((()=>{this.en(e,n)}),0);var a=e.shift();if(a)try{a()}catch(s){be.error("Error initializing extension:",s)}}var r=Math.round(performance.now()-n);this.register_for_session({[zE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[FE]:r}),this.config.__preview_deferred_init_extensions&&be.info("PostHog extensions initialized ("+r+"ms)")}Mr(e){var n;if(!xe||!xe.body)return be.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Mr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Xi=e),this.tn=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Ke(e.supportedCompression,aa.GZipJS)?aa.GZipJS:Ke(e.supportedCompression,aa.Base64)?aa.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Hi?this.Hi:Sy}),this.$i.forEach((a=>a.onRemoteConfig==null?void 0:a.onRemoteConfig(e)))}Yi(){try{this.config.loaded(this)}catch(a){be.critical("`loaded` function failed",a)}if(this.rn(),this.config.internal_or_test_user_hostname&&fn!=null&&fn.hostname){var e=fn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.nn()}),1),this.sn=new h6(this),this.sn.load()}rn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Gi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&zh(this.__request_queue,(e=>this.Qi(e))),this.__request_queue=[],this.rn()}_handle_unload(){var e,n,a,r,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.an()&&this.capture(Av),(a=this.logs)==null||a.flushLogs("sendBeacon"),(r=this.Gi)==null||r.unload(),(s=this.Ji)==null||s.unload()):this.an()&&this.capture(Av,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?R6?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=he({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(ke(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var a,r,s,l=he({},n);l.timeout=l.timeout||6e4;var c=(a=l.transport)!==null&&a!==void 0?a:"fetch";c==="sendBeacon"&&ke(l.compression)&&l.data&&(l.compression=aa.Base64),l.url=dS(l.url,l.compression);var u=vp.filter((p=>!l.disableTransport||!p.transport||!l.disableTransport.includes(p.transport))),h=(r=(s=(function(p,m){for(var v=0;p.length>v;v++)if(p[v].transport===c)return p[v]})(u))==null?void 0:s.method)!==null&&r!==void 0?r:u[0].method;if(!h)throw new Error("No available transport method");c!=="sendBeacon"&&l.data&&l.compression===aa.GZipJS&&mG&&typeof Promise<"u"&&!gp?Yq(l).then((p=>{h(p)})).catch((p=>{if(NP(p))return gp=!0,void h(he({},l,{compression:void 0,url:dS(n.url,void 0)}));(m=>{if(!m||typeof m!="object")return!1;var v="name"in m?String(m.name):"";return NP(m)||v===X4})(p)&&(gp=!0),h(l)})):h(l)})(he({},e,{callback:n=>{var a,r;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(r=this.config).on_request_error)==null||a.call(r,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Qi(e){this.Ji?this.Ji.retriableRequest(e):this._send_request(e)}_execute_array(e){Uv++;try{var n,a=[],r=[],s=[];zh(e,(c=>{if(c)if(it(n=c[0]))s.push(c);else if(yr(c))try{c.call(this)}catch(u){be.error("Error executing queued PostHog call",c,u)}else it(c)&&n==="alias"?a.push(c):it(c)&&n.indexOf("capture")!==-1&&yr(this[n])?s.push(c):r.push(c)}));var l=function(c,u){zh(c,(function(h){try{if(it(h[0])){var p=u;Mt(h,(function(m){p=p[m[0]].apply(p,m.slice(1))}))}else u[h[0]].apply(u,h.slice(1))}catch(m){be.error("Error executing queued PostHog call",h,m)}}))};l(a,this),l(r,this),l(s,this)}finally{Uv--}}push(e){if(Uv>0&&it(e)&&Lt(e[0])){var n=Wa.prototype[e[0]];yr(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,a){var r,s,l,c,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!ke(e)&&Lt(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var p=a!=null&&a.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(p==null||!p.isRateLimited){n!=null&&n.$current_url&&!Lt(n?.$current_url)&&(be.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||a!=null&&a.ln||be.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var m=new Date,v=a?.timestamp||m,y=UP(a?.uuid,wi),b={uuid:y,event:e,properties:this.calculateEventProperties(e,n||{},v,y)};e===hl&&this.config.__preview_capture_bot_pageviews&&h&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),p&&(b.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens),a?.$set&&(b.$set=a?.$set);var x=a?.$unset;x&&(b.$unset=x);var P,T,L,E=this.un(a?.$set_once,e!==WP,e===Rv);if(E&&(b.$set_once=E),a!=null&&a._noTruncate||(s=this.config.properties_string_max_length,l=b,c=U=>Lt(U)?U.slice(0,s):U,u=new Set,b=(function U(Q,ee){return Q!==Object(Q)?c?c(Q):Q:u.has(Q)?void 0:(u.add(Q),it(Q)?(ce=[],zh(Q,(le=>{ce.push(U(le))}))):(ce={},Mt(Q,((le,re)=>{u.has(le)||(ce[re]=U(le))}))),ce);var ce})(l)),b.timestamp=v,ke(a?.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=m),e===Pi.DISMISSED||e===Pi.SENT){var A=n?.[Ov.SURVEY_ID],D=n?.[Ov.SURVEY_ITERATION];E6({id:A,current_iteration:D}),b.$set=he({},b.$set,{[(P={id:A,current_iteration:D},T=e===Pi.SENT?"responded":"dismissed",L="$survey_"+T+"/"+P.id,P.current_iteration&&P.current_iteration>0&&(L="$survey_"+T+"/"+P.id+"/"+P.current_iteration),L)]:!0})}else e===Pi.SHOWN&&(b.$set=he({},b.$set,{[Ov.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Bq.SHOWN){var B=n?.[rS.TOUR_TYPE];B&&(b.$set=he({},b.$set,{[rS.TOUR_LAST_SEEN_DATE+"/"+B]:new Date().toISOString()}))}var j=he({},b.properties.$set,b.$set);if(cs(j)||this.setPersonPropertiesForFlags(j),!nt(this.config.before_send)){var S=this.it(b);if(!S)return;(b=S).uuid=UP(b.uuid,wi)}this.qi.emit("eventCaptured",b);var N={method:"POST",url:(r=a?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:b,compression:"best-available",batchKey:a?._batchKey,transport:a?.transport};return!this.config.request_batching||a&&(a==null||!a._batchKey)||a!=null&&a.send_instantly?this.Qi(N):this.Gi.enqueue(N),b}be.critical("This capture call is ignored due to client rate limiting.")}}else be.error("No event name provided to posthog.capture")}else be.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(n=>e(n.event,n)))}calculateEventProperties(e,n,a,r,s){if(a=a||new Date,!this.persistence||!this.sessionPersistence)return n;var l=s?void 0:this.persistence.remove_event_timer(e),c=he({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.Ni()&&(c.$cookieless_mode=!0),e==="$snapshot"){var u=he({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=u.distinct_id,(!Lt(c.distinct_id)&&!Bn(c.distinct_id)||ny(c.distinct_id))&&be.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=(function(T,L,E,A){var D,B,j,S;if(A===void 0&&(A=!1),!va)return{};var N,U,Q,ee,ce,le,re,te,ie,$=T?[...Fl,...L||[]]:[],X=(function(ae){for(var _e=0;zP.length>_e;_e++){var fe=zP[_e],ve=fe[1],Ne=fe[0].exec(ae),Oe=Ne&&(yr(ve)?ve(Ne,ae):ve);if(Oe)return Oe}return["",""]})(va),W=(N=typeof navigator<"u"?navigator:void 0)!=null&&N.brave?{brave:!0}:{},O={detectGoogleSearchApp:E},Y=Bt(Db({$os:X[0],$os_version:X[1],$browser:xE(va,navigator.vendor,W,O),$device:FP(va),$device_type:(Q=va,ee={userAgentDataPlatform:(D=navigator)==null||(D=D.userAgentData)==null?void 0:D.platform,maxTouchPoints:(B=navigator)==null?void 0:B.maxTouchPoints,screenWidth:Z==null||(j=Z.screen)==null?void 0:j.width,screenHeight:Z==null||(S=Z.screen)==null?void 0:S.height,devicePixelRatio:Z?.devicePixelRatio},ie=FP(Q),ie===iE||ie===rE||ie==="Kobo"||ie==="Kindle Fire"||ie===_E?Nl:ie===Bd||ie===Sl||ie===$d||ie===ry?"Console":ie===oE?"Wearable":ie?Da:ee?.userAgentDataPlatform==="Android"&&((ce=ee?.maxTouchPoints)!==null&&ce!==void 0?ce:0)>0?600>Math.min((le=ee?.screenWidth)!==null&&le!==void 0?le:0,(re=ee?.screenHeight)!==null&&re!==void 0?re:0)/((te=ee?.devicePixelRatio)!==null&&te!==void 0?te:1)?Da:Nl:"Desktop"),$timezone:u6(),$timezone_offset:zq()}),{$current_url:Gd(A?ms(fn?.href):fn?.href,$,qd),$host:fn?.host,$pathname:fn?.pathname,$raw_user_agent:va.length>1e3?va.substring(0,997)+"...":va,$browser_version:MG(va,navigator.vendor,W,O),$browser_language:aS(),$browser_language_prefix:(U=aS(),typeof U=="string"?U.split("-")[0]:void 0),$screen_height:Z?.screen.height,$screen_width:Z?.screen.width,$viewport_height:Z?.innerHeight,$viewport_width:Z?.innerWidth,$lib:en.LIB_NAME,$lib_version:en.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return en.SDK_DIST_CHANNEL&&(Y.$sdk_dist_channel=en.SDK_DIST_CHANNEL),Y})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var m=this.sessionManager.checkAndGetSessionAndWindowId(s,a.getTime()),v=m.windowId;c.$session_id=m.sessionId,c.$window_id=v}this.sessionPropsManager&&Bt(c,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Bt(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(y=this.Ji)==null?void 0:y.length}catch(T){c.$sdk_debug_error_capturing_properties=String(T)}if(this.requestRouter.region===Ny&&(c.$lib_custom_api_host=this.config.api_host),h=e!==hl||s?e!==Av||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(a):this.pageViewManager.doPageView(a,r),c=Bt(c,h),e===hl&&xe&&(c.title=xe.title),!ke(l)){var b=a.getTime()-l;c.$duration=parseFloat((b/1e3).toFixed(3))}va&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=Bt({},p,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),it(this.config.property_denylist)?Mt(this.config.property_denylist,(function(T){delete c[T]})):be.error(A6+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(be.error(gS),c=x(c,e));var P=this.hn();return c.$process_person_profile=P,P&&!s&&this.dn("_calculate_event_properties"),c}un(e,n,a){var r;if(n===void 0&&(n=!0),a===void 0&&(a=!1),!this.persistence||!this.hn()||this.Di&&!a)return e;var s=this.persistence.get_initial_props(),l=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),c=Bt({},s,l||{},e||{}),u=this.config.sanitize_properties;return u&&(be.error(gS),c=u(c,"$set_once")),n&&(this.Di=!0),cs(c)?void 0:c}register(e,n){var a;(a=this.persistence)==null||a.register(e,n)}register_once(e,n,a){var r;(r=this.persistence)==null||r.register_once(e,n,a)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}cn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var a;return(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,a){var r;(r=this.featureFlags)==null||r.updateFlags(e,n,a)}updateEarlyAccessFeatureEnrollment(e,n,a){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,n,a)}getEarlyAccessFeatures(e,n,a){var r;return n===void 0&&(n=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,n,a)}on(e,n){return this.qi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Qc}),()=>{})}onSessionId(e){var n,a;return(n=(a=this.sessionManager)==null?void 0:a.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Qc})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Qc})}renderSurvey(e,n){var a;(a=this.surveys)==null||a.renderSurvey(e,n)}displaySurvey(e,n){var a;n===void 0&&(n=sK),(a=this.surveys)==null||a.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,a;return(n=(a=this.surveys)==null?void 0:a.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Qc}}canRenderSurveyAsync(e,n){var a,r;return n===void 0&&(n=!1),(a=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,n))!==null&&a!==void 0?a:Promise.resolve({visible:!1,disabledReason:Qc})}vn(e){return!e||ny(e)?(be.critical("Unique user id has not been set in posthog.identify"),!1):e===jh?(be.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(be.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,a){if(!this.__loaded||!this.persistence)return be.uninitializedWarning("posthog.identify");if(Bn(e)&&(e=e.toString(),be.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.vn(e)&&this.dn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(df)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(ld)&&(this.unregister(ld),this.register({distinct_id:e}));var s,l=(this.persistence.get_property(vr)||tl)===tl;e!==r&&l?(this.persistence.set_property(vr,nl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:a||{}},!1),this.capture(Rv,{distinct_id:e,$anon_distinct_id:r},{$set:n||{},$set_once:a||{}}),this.Ui=pS(e,n,a),(s=this.featureFlags)==null||s.setAnonymousDistinctId(r)):(n||a)&&this.setPersonProperties(n,a),e!==r&&(this.reloadFeatureFlags(),this.unregister(Sd))}}setPersonProperties(e,n){if((e||n)&&this.dn("posthog.setPersonProperties")){var a=pS(this.get_distinct_id(),e,n);this.Ui!==a?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ui=a):be.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,a=(it(e)?e:[e]).filter((r=>Lt(r)&&r.length>0));a.length!==0&&this.dn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(a,!0),this.capture("$set",{$unset:a}),this.Ui=null)}group(e,n,a){if(e&&n){var r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:he({},r,{[e]:n})}),s||a){var l={$group_type:e,$group_key:n};a&&(l.$group_set=a),this.capture(WP,l)}a&&this.setGroupPropertiesForFlags({[e]:a}),s&&!a&&this.reloadFeatureFlags()}else be.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var a;n===void 0&&(n=!0),(a=this.featureFlags)==null||a.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var a;n===void 0&&(n=!0),this.dn("posthog.setGroupPropertiesForFlags")&&((a=this.featureFlags)==null||a.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,a,r,s,l,c,u,h,p,m;if(be.info("reset"),!this.__loaded)return be.uninitializedWarning("posthog.reset");var v,y=this.get_property(df),b=this.get_property(Ev),x=this.get_property(ao);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(a=this.sessionPersistence)==null||a.clear(),ke(x)||(v=this.persistence)==null||v.register({[ao]:x}),(r=this.surveys)==null||r.reset(),(s=this.sn)==null||s.stop(),(l=this.featureFlags)==null||l.reset(),(c=this.conversations)==null||c.reset(),(u=this.logs)==null||u.reset(),(h=this.metrics)==null||h.reset(),(p=this.persistence)==null||p.set_property(vr,tl),(m=this.sessionManager)==null||m.resetSessionId(),this.Ui=null,this.config.cookieless_mode===xi)this.register_once({distinct_id:jh,$device_id:null},"");else{var P=this.config.get_device_id(wi());this.register_once({distinct_id:P,$device_id:e?P:y},""),e||ke(b)||this.register({[Ev]:b})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var n=this;return cn((function*(){var a,r,s,l,c;n.__loaded?((a=n.logs)==null||a.flushLogs("sendBeacon"),(r=n.metrics)==null||r.flush("sendBeacon"),(s=n.Gi)==null||s.unload(),(l=n.Ji)==null||l.unload(),(c=n.featureFlags)==null||c.destroy()):be.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,n){var a;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(a=this.conversations)==null||a.fn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.pn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=n.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(e!=null&&e.withTimestamp&&a){var s,l=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!a)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-a)/1e3)-l,0)}return r}alias(e,n){return e===this.get_property(LE)?(be.critical("Attempting to create alias for existing People user - aborting."),-2):this.dn("posthog.alias")?(ke(n)&&(n=this.get_distinct_id()),e!==n?(this.cn(ld,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(be.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=he({},this.config);if(qt(e)){var a,r,s,l,c,u,h,p,m,v,y;Bt(this.config,_S(e));var b=this.Zi();(a=this.persistence)==null||a.update_config(this.config,n,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Mv(he({},this.config,{persistence:"sessionStorage"}),b,!1);var x=this.zi(this.config.debug);Hr(x)&&(this.config.debug=x),Hr(this.config.debug)&&(this.config.debug?(en.DEBUG=!0,It.N()&&It.q("ph_debug",!0),be.info("set_config",{config:e,oldConfig:n,newConfig:he({},this.config)})):(en.DEBUG=!1,It.N()&&It.P("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(l=this.sessionRecording)==null||l.startIfEnabledOrStop(),(c=this.tracingHeaders)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(h=this.heatmaps)==null||h.startIfEnabled(),(p=this.exceptionObserver)==null||p.startIfEnabledOrStop(),(m=this.deadClicksAutocapture)==null||m.startIfEnabledOrStop(),(v=this.surveys)==null||v.loadIfEnabled(),this.gn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){en.LIB_NAME=e,en.LIB_VERSION=n}startSessionRecording(e){var n,a,r,s,l,c=e===!0,u={sampling:c||!(e==null||!e.sampling),linked_flag:c||!(e==null||!e.linked_flag),url_trigger:c||!(e==null||!e.url_trigger),event_trigger:c||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),u.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var a=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:a});return this.exceptions.sendExceptionEvent(he({},r,n))}}addExceptionStep(e,n){var a;(a=this.exceptions)==null||a.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Wa.mn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,a;return(n=(a=this.toolbar)==null?void 0:a.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:pl;return n!==pl&&(n=pl+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(vr))===nl||((n=this.sessionPersistence)==null?void 0:n.get_property(vr))===nl}hn(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Sy&&!this._isIdentified()&&cs(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ld])&&((n=this.persistence)==null||(n=n.props)==null||!n[pf]))}an(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.hn()||this.dn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.dn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}dn(e){return this.config.person_profiles==="never"?(be.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.cn(pf,!0),!0)}Zi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ks)}gn(){var e,n,a,r,s=this.Zi();return((e=this.persistence)==null?void 0:e.ir)!==s&&((a=this.persistence)==null||a.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.ir)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s)),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==xi){if(this.Ni()){var a,r,s,l,c;this.reset(!0),(a=this.sessionManager)==null||a.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new hS(this),this.pageViewManager=new nS(this),this.persistence&&(this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence));var u,h=(s=(l=this.config.__extensionClasses)==null?void 0:l.sessionRecording)!==null&&s!==void 0?s:(c=Wa.__defaultExtensionClasses)==null?void 0:c.sessionRecording;h&&(this.sessionRecording=this.Ai(this.sessionRecording,new h(this)),this.tn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.tn)))}var p,m;this.consent.optInOut(!0),this.gn(),this.rn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Ks&&((p=this.surveys)==null||p.loadIfEnabled()),(ke(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((m=e?.captureEventName)!==null&&m!==void 0?m:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nn()}else be.warn(mS)}opt_out_capturing(){var e,n,a;this.config.cookieless_mode!==xi?(this.config.cookieless_mode===Ks&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.gn(),this.config.cookieless_mode===Ks&&(this.register({distinct_id:jh,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nn(),this.rn())):be.warn(mS)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===xi||(this.config.cookieless_mode===Ks?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.gn()}_is_bot(){return sa?w6(sa,this.config.custom_blocked_useragents):void 0}nn(){xe&&(xe.visibilityState==="visible"?this.ji||(this.ji=!0,this.capture(hl,{title:xe.title},{send_instantly:!0}),this.Bi&&(xe.removeEventListener(ff,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.nn.bind(this),tn(xe,ff,this.Bi)))}debug(e){e===!1?(Z?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Z?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Rr(){var e,n,a,r,s,l,c=this.Wi||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(be.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(a="advanced_disable_decide",r=be,s=(n="advanced_disable_flags")in(e=c)&&!nt(e[n]),l=a in e&&!nt(e[a]),s?e[n]:!!l&&(r&&r.warn("Config field '"+a+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[a]))}it(e){var n;if(nt(this.config.before_send))return e;var a=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(wG),r=it(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var l of r){if(s=l(s),nt(s)){var c="Event '"+e.event+"' was rejected in beforeSend function";return kG(e.event)?be.warn(c+". This can cause unexpected behavior."):be.info(c),null}s.properties&&!cs(s.properties)||be.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of a)if(s.properties&&nt(s.properties[u]))return be.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.zt)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,a){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(a)})}zi(e){var n=Hr(e)&&!e,a=It.N()&&It.A("ph_debug")==="true";return!n&&(!!a||e)}}Wa.__defaultExtensionClasses={},Wa.mn=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=dq(t.prototype[e[n]])})(Wa,["identify"]);class yS{constructor(e){this.disabled=e===!1;var n=qt(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,a){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(n-r.y)<this.thresholdPx&&this.timeoutMs>a-r.timestamp){if(this.clicks.push({x:e,y:n,timestamp:a}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:a}];return!1}}var Bv="$copy_autocapture",$v=Zt("[AutoCapture]");function Vv(t,e){return e.length>t?e.slice(0,t)+"...":e}function hK(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!gs(e));return e}function pK(t,e){var n,a,r=e.e,s=e.maskAllElementAttributes,l=e.maskAllText,c=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!gs(t))return{props:{}};for(var p=[t],m=new Set([t]),v=t;v.parentNode&&!Ra(v,"body")&&GE>p.length;)if(WE(v.parentNode)){var y=v.parentNode.host;if(m.has(y))break;m.add(y),p.push(y),v=y}else{if(!gs(v.parentNode)||m.has(v.parentNode))break;m.add(v.parentNode),p.push(v.parentNode),v=v.parentNode}var b,x,P=[],T={},L=!1,E=!1;if(Mt(p,(S=>{var N=Ty(S);if(Ra(S,"a")){var U=S.getAttribute("href");L=!!(N&&U&&Cd(U))&&(h?ms(U):U)}Ke(vf(S),"ph-no-capture")&&(E=!0),P.push((function(ee,ce,le,re,te){te===void 0&&(te=!1);var ie=ee.tagName.toLowerCase(),$={tag_name:ie};Mb.indexOf(ie)>-1&&!le&&($.$el_text=ie.toLowerCase()==="a"||ie.toLowerCase()==="button"?Vv(1024,XP(ee)):Vv(1024,Hd(ee)));var X=vf(ee);X.length>0&&($.classes=X.filter((function(ae){return ae!==""}))),Mt(ee.attributes,(function(ae){var _e;if((!JE(ee)||["name","id","class","aria-label"].indexOf(ae.name)!==-1)&&(re==null||!re.includes(ae.name))&&!ce&&Cd(ae.value)&&(!Lt(_e=ae.name)||_e.substring(0,10)!=="_ngcontent"&&_e.substring(0,7)!=="_nghost")){var fe=ae.value;ae.name==="class"&&(fe=Ib(fe).join(" ")),$["attr__"+ae.name]=Vv(1024,ae.name==="href"&&te?ms(fe):fe)}}));for(var W=1,O=1,Y=ee;Y=hK(Y);)W++,Y.tagName===ee.tagName&&O++;return $.nth_child=W,$.nth_of_type=O,$})(S,s,l,c,h));var Q=(function(ee){if(!Ty(ee))return{};var ce={};return Mt(ee.attributes,(function(le){if(le.name&&le.name.indexOf("data-ph-capture-attribute")===0){var re=le.name.replace("data-ph-capture-attribute-",""),te=le.value;re&&te&&Cd(te)&&(ce[re]=te)}})),ce})(S);Bt(T,Q)})),E)return{props:{},explicitNoCapture:E};if(l||(P[0].$el_text=Ra(t,"a")||Ra(t,"button")?XP(t):Hd(t)),L){var A,D;P[0].attr__href=L;var B=(A=Wd(L))==null?void 0:A.host,j=Z==null||(D=Z.location)==null?void 0:D.host;B&&j&&B!==j&&(b=L)}return{props:Bt({$event_type:r.type,$ce_version:1},u?{}:{$elements:P},{$elements_chain:(x=P,(function(S){return S.map((N=>{var U,Q,ee="";if(N.tag_name&&(ee+=N.tag_name),N.attr_class)for(var ce of(N.attr_class.sort(),N.attr_class))ee+="."+ce.replace(/"/g,"");var le=he({},N.text?{text:N.text}:{},{"nth-child":(U=N.nth_child)!==null&&U!==void 0?U:0,"nth-of-type":(Q=N.nth_of_type)!==null&&Q!==void 0?Q:0},N.href?{href:N.href}:{},N.attr_id?{attr_id:N.attr_id}:{},N.attributes),re={};return mp(le).sort(((te,ie)=>te[0].localeCompare(ie[0]))).forEach((te=>{var ie=te[1];return re[eS(te[0].toString())]=eS(ie.toString())})),(ee+=":")+mp(re).map((te=>te[0]+'="'+te[1]+'"')).join("")})).join(";")})((function(S){return S.map((N=>{var U,Q,ee={text:(U=N.$el_text)==null?void 0:U.slice(0,400),tag_name:N.tag_name,href:(Q=N.attr__href)==null?void 0:Q.slice(0,2048),attr_class:Rq(N),attr_id:N.attr__id,nth_child:N.nth_child,nth_of_type:N.nth_of_type,attributes:{}};return mp(N).filter((ce=>ce[0].indexOf("attr__")===0)).forEach((ce=>ee.attributes[ce[0]]=ce[1])),ee}))})(x)))},(n=P[0])!=null&&n.$el_text?{$el_text:(a=P[0])==null?void 0:a.$el_text}:{},b&&r.type==="click"?{$external_click_url:b}:{},T)}}var Xc=Zt("[ExceptionAutocapture]"),bS=()=>{},fK=Zt("[TracingHeaders]"),Bs=Zt("[Web Vitals]"),kS=9e5,wS="disabled",xS="lazy_loading",ed="awaiting_config",Hh="missing_config";Zt("[SessionRecording]"),Zt("[SessionRecording]");var Oy="[SessionRecording]",mi=Zt(Oy),mK=Zt("[Heatmaps]");function PS(t){return qt(t)&&"clientX"in t&&"clientY"in t&&Bn(t.clientX)&&Bn(t.clientY)}var Hv=Zt("[Product Tours]"),Wv=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Ab))},gK=["$set_once","$set"],Mr=Zt("[SiteApps]"),SS="Error while initializing PostHog app with config id ";function il(t,e,n){if(nt(t))return!1;switch(n){case"exact":return t===e;case"contains":var a=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(a,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class vK{constructor(e){this.yn=new Fb,this.bn=(n,a)=>this._n(n,a)&&this.wn(n,a)&&this.xn(n,a)&&this.kn(n,a),this._n=(n,a)=>a==null||!a.event||n?.event===a?.event,this._instance=e,this.Sn=new Set,this.Cn=new Set}init(){var e,n;ke((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((a,r)=>{this.on(a,r)}))}register(e){var n,a;if(!ke((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach((l=>{var c,u;(c=this.Cn)==null||c.add(l),(u=l.steps)==null||u.forEach((h=>{var p;(p=this.Sn)==null||p.add(h?.event||"")}))})),(a=this._instance)!=null&&a.autocapture)){var r,s=new Set;e.forEach((l=>{var c;(c=l.steps)==null||c.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(s)}}on(e,n){var a;n!=null&&e.length!=0&&(this.Sn.has(e)||this.Sn.has(n?.event))&&this.Cn&&((a=this.Cn)==null?void 0:a.size)>0&&this.Cn.forEach((r=>{this.Tn(n,r)&&this.yn.emit("actionCaptured",r.name)}))}In(e){this.onAction("actionCaptured",(n=>e(n)))}Tn(e,n){if(n?.steps==null)return!1;for(var a of n.steps)if(this.bn(e,a))return!0;return!1}onAction(e,n){return this.yn.on(e,n)}wn(e,n){if(n!=null&&n.url){var a,r=e==null||(a=e.properties)==null?void 0:a.$current_url;if(!r||typeof r!="string"||!il(r,n.url,n.url_matching||"contains"))return!1}return!0}xn(e,n){return!!this.Mn(e,n)&&!!this.En(e,n)&&!!this.Rn(e,n)}Mn(e,n){var a;if(n==null||!n.href)return!0;var r=this.Pn(e);if(r.length>0)return r.some((c=>il(c.href,n.href,n.href_matching||"exact")));var s,l=(e==null||(a=e.properties)==null?void 0:a.$elements_chain)||"";return!!l&&il((s=l.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}En(e,n){var a;if(n==null||!n.text)return!0;var r=this.Pn(e);if(r.length>0)return r.some((h=>il(h.text,n.text,n.text_matching||"exact")||il(h.$el_text,n.text,n.text_matching||"exact")));var s,l,c,u=(e==null||(a=e.properties)==null?void 0:a.$elements_chain)||"";return!!u&&(s=(function(h){for(var p,m=[],v=/(?::|")text="(.*?)"/g;!nt(p=v.exec(h));)m.includes(p[1])||m.push(p[1]);return m})(u),l=n.text,c=n.text_matching||"exact",s.some((h=>il(h,l,c))))}Rn(e,n){var a,r;if(n==null||!n.selector)return!0;var s=e==null||(a=e.properties)==null?void 0:a.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(n.selector_regex&&l)try{return new RegExp(n.selector_regex).test(l)}catch{return!1}return!1}Pn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}kn(e,n){return n==null||!n.properties||n.properties.length===0||S6(n.properties.reduce(((a,r)=>{var s=it(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return a[r.key]={values:s,operator:r.operator||"exact"},a}),{}),e?.properties)}}class _K{constructor(e){this.On=[],this._instance=e,this.Ln=new Map,this.Fn=new Map,this.An=new Map}$n(e,n){return!!e&&S6(e.propertyFilters,n?.properties)}Nn(e,n){var a=new Map;return e.forEach((r=>{var s;(s=r.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach((l=>{if(l!=null&&l.name){var c=a.get(l.name)||[];c.push(r.id),a.set(l.name,c)}}))})),a}Dn(e,n,a){var r=(a===qc.Activation?this.Ln:this.Fn).get(e),s=[];return this.qn((l=>{s=l.filter((c=>r?.includes(c.id)))})),s.filter((l=>{var c,u=(c=l.conditions)==null||(c=c[a])==null||(c=c.values)==null?void 0:c.find((h=>h.name===e));return this.$n(u,n)}))}register(e){var n;ke((n=this._instance)==null?void 0:n._addCaptureHook)||(this.jn(e),this.Bn(e))}Bn(e){var n=e.filter((a=>{var r,s;return((r=a.conditions)==null?void 0:r.actions)&&((s=a.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));n.length!==0&&(this.Hn==null&&(this.Hn=new vK(this._instance),this.Hn.init(),this.Hn.In((a=>{this.onAction(a)}))),n.forEach((a=>{var r,s,l,c,u;a.conditions&&(r=a.conditions)!=null&&r.actions&&(s=a.conditions)!=null&&(s=s.actions)!=null&&s.values&&((l=a.conditions)==null||(l=l.actions)==null||(l=l.values)==null?void 0:l.length)>0&&((c=this.Hn)==null||c.register(a.conditions.actions.values),(u=a.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((h=>{if(h&&h.name){var p=this.An.get(h.name);p&&p.push(a.id),this.An.set(h.name,p||[a.id])}})))})))}jn(e){var n,a=e.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.events)&&((c=s.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),r=e.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.cancelEvents)&&((c=s.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}));a.length===0&&r.length===0||((n=this._instance)==null||n._addCaptureHook(((s,l)=>{this.onEvent(s,l)})),this.Ln=this.Nn(e,qc.Activation),this.Fn=this.Nn(e,qc.Cancellation))}onEvent(e,n){var a,r,s=this.Un(),l=(n==null||(a=n.properties)==null?void 0:a.$survey_id)||(n==null||(r=n.properties)==null?void 0:r.$product_tour_id);if(l&&this.getActivatedIds().includes(l)){var c=this.zn(e,l);if(c==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:l}),void this.Wn([l]);if(c==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:l}),void this.Vn(l)}if(this.Fn.has(e)){var u=this.Dn(e,n,qc.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((p=>p.id))}),this.Wn(u.map((p=>p.id))),u.forEach((p=>this.Zn(p.id))))}if(this.Ln.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.Ln.get(e)});var h=this.Dn(e,n,qc.Activation);this.Gn(h.map((p=>p.id)))}}onAction(e){this.An.has(e)&&this.Gn(this.An.get(e)||[])}Gn(e){e.length!==0&&(this.On=[...new Set([...this.On,...e])],this.Un().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.On=this.On.filter((a=>a!==e));var n=this.Qn();n.includes(e)||this.Jn([...n,e])}Wn(e){var n=new Set(e);this.On=this.On.filter((s=>!n.has(s)));var a=this.Qn(),r=a.filter((s=>!n.has(s)));r.length!==a.length&&this.Jn(r)}Qn(){var e,n=this.Kn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getActivatedIds(){return[...new Set([...this.Qn(),...this.On])].filter((e=>!this.Yn(e)))}reset(){this.On=[],this.Qn().length>0&&this.Jn([])}getEventToItemsMap(){return this.Ln}Xn(){return this.Hn}}class yK extends _K{constructor(e){super(e)}Kn(){return _y}es(){return Pi.SHOWN}qn(e){var n;(n=this._instance)==null||n.getSurveys(e)}Zn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}Un(){return Rt}Jn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[_y]:e})}Yn(){return!1}zn(e,n){var a;this.qn((s=>{a=s.find((l=>l.id===n))}));var r=!a||(function(s){var l;return C6(s)&&!((l=s.conditions)==null||(l=l.events)==null||!l.repeatedActivation)||s.schedule==="always"})(a);return r?e===Pi.SHOWN?"consume":"ignore":e===Pi.SHOWN?"persist":e===Pi.DISMISSED||e===Pi.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Gv="SDK is not enabled or survey functionality is not yet loaded",CS="Disabled. Not loading surveys.",bK=Z!=null&&Z.location?_f(Z.location.hash,"__posthog")||_f(location.hash,"state"):null,TS="_postHogToolbarParams",ES=Zt("[Toolbar]"),gn=Zt("[FeatureFlags]"),$s=Zt("[FeatureFlags]",{debugEnabled:!0}),qv=`" failed. Feature flags didn't load in time.`,AS=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},RS=t=>{var e={};for(var n of mp(t||{})){var a=n[1];a&&(e[n[0]]=a)}return e},gi=Zt("[Error tracking]"),LS="Refusing to render web experiment since the viewer is a likely bot",kK={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>kf(e,t),not_regex:(t,e)=>!kf(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Zn{get Se(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(a){a===void 0&&(a=!1),n.getWebExperiments((r=>{Zn.ts("retrieved web experiments from the server"),n.rs=new Map,r.forEach((s=>{if(s.feature_flag_key){var l;n.rs&&(Zn.ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(l=n.rs)==null||l.set(s.feature_flag_key,s));var c=n._instance.getFeatureFlag(s.feature_flag_key);Lt(c)&&s.variants[c]&&n.ns(s.name,c,s.variants[c].transforms)}else if(s.variants)for(var u in s.variants){var h=s.variants[u];Zn.ss(h,n._instance)&&n.ns(s.name,u,h.transforms)}}))}),a)},this._instance=e,this._instance.onFeatureFlags((a=>{this.onFeatureFlags(a)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Zn.ts(LS);else if(!this.Se.disable_web_experiments){if(nt(this.rs))return this.rs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zn.ts("applying feature flags",e),e.forEach((n=>{var a;if(this.rs&&(a=this.rs)!=null&&a.has(n)){var r,s=this._instance.getFeatureFlag(n),l=(r=this.rs)==null?void 0:r.get(n);s&&l!=null&&l.variants[s]&&this.ns(l.name,s,l.variants[s].transforms)}}))}}previewWebExperiment(){var e=Zn.getWindowLocation();if(e!=null&&e.search){var n=zl(e?.search,"__experiment_id"),a=zl(e?.search,"__experiment_variant");n&&a&&(Zn.ts("previewing web experiments "+n+" && "+a),this.getWebExperiments((r=>{this.os(parseInt(n),a,r)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,a){if(this.Se.disable_web_experiments&&!a)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!n)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}os(e,n,a){var r=a.filter((s=>s.id===e));r&&r.length>0&&(Zn.ts("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.ns(r[0].name,n,r[0].variants[n].transforms))}static ss(e,n){return!nt(e.conditions)&&Zn.ls(e,n)&&Zn.us(e)}static ls(e,n){var a;if(nt(e.conditions)||nt((a=e.conditions)==null?void 0:a.url))return!0;var r=Zn.getWindowLocation();if(r){var s,l,c,u=VE(n,r.href);return(s=e.conditions)==null||!s.url||kK[(l=(c=e.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return Z?.location}static us(e){var n;if(nt(e.conditions)||nt((n=e.conditions)==null?void 0:n.utm))return!0;var a=i6();if(a.utm_source){var r,s,l,c,u,h,p,m,v=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==a.utm_campaign,y=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_source||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_source)==a.utm_source,b=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==a.utm_medium,x=(p=e.conditions)==null||(p=p.utm)==null||!p.utm_term||((m=e.conditions)==null||(m=m.utm)==null?void 0:m.utm_term)==a.utm_term;return v&&b&&x&&y}return!1}static ts(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;n>r;r++)a[r-1]=arguments[r];be.info("[WebExperiments] "+e,a)}ns(e,n,a){this._is_bot()?Zn.ts(LS):n!=="control"?a.forEach((r=>{if(r.selector){var s;Zn.ts("applying transform of variant "+n+" for experiment "+e+" ",r);var l=(s=document)==null?void 0:s.querySelectorAll(r.selector);l?.forEach((c=>{var u=c;r.html&&(u.innerHTML=r.html),r.css&&u.setAttribute("style",r.css)}))}})):Zn.ts("Control variants leave the page unmodified.")}_is_bot(){return sa&&this._instance?w6(sa,this.Se.custom_blocked_useragents):void 0}}var Ba=Zt("[Conversations]"),Vs="Conversations not available yet.",DS="console",Kf={featureFlags:class{constructor(t){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=!1,this.bs=0,this._s=()=>{var e=this.ws();this.bs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],Z&&tn(Z,"online",this._s)}destroy(){Z?.removeEventListener("online",this._s)}get Se(){return this._instance.config}get ri(){return this._instance.persistence}xs(t){return this._instance.get_property(t)}ks(){var t,e;return(t=(e=this.ri)==null?void 0:e.sr(this.Se.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ss(){return!!this.ks()&&(this.ys||this.cs||(this.ys=!0,gn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Cs(){var t,e=(t=this.Se.evaluation_contexts)!==null&&t!==void 0?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.gs||(gn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.gs=!0),e!=null&&e.length?e.filter((n=>{var a=n&&typeof n=="string"&&n.trim().length>0;return a||gn.error("Invalid evaluation context found:",n,"Expected non-empty string"),a})):[]}Ts(){return this.Cs().length>0}Is(){var t=this.Se.flag_keys;if(!ke(t)){if(it(t))return t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||gn.error("Invalid flag key found:",e,"Expected non-empty string"),n}));gn.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,n=this._instance.config,a=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(a).length){var r,s,l=(r=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&r!==void 0?r:{},c=Object.keys(a).filter((h=>!!a[h])).reduce(((h,p)=>(h[p]=a[p]||!1,h)),{}),u=Object.keys(l).filter((h=>c[h])).reduce(((h,p)=>(l[p]&&(h[p]=l[p]),h)),{});this.receivedFeatureFlags({featureFlags:c,featureFlagPayloads:u})}}updateFlags(t,e,n){var a,r,s=n!=null&&n.merge&&(a=this.xs(Ys))!==null&&a!==void 0?a:{},l=n!=null&&n.merge&&(r=this.xs(fp))!==null&&r!==void 0?r:{},c=he({},s,t),u=he({},l,e),h={};for(var p of Object.entries(c)){var m=p[0],v=p[1];h[m]={key:m,enabled:LP(v),variant:DP(v),reason:void 0,metadata:ke(u?.[m])?void 0:{id:0,version:void 0,description:void 0,payload:u[m]}}}this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.ds}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.xs(my),e=this.xs(bi),n=this.xs(ul);if(!n&&!e)return t||{};var a=Bt({},t||{}),r=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of r){var l,c,u=a[s],h=e?.[s],p=ke(h)?(l=u?.enabled)!==null&&l!==void 0&&l:!!h,m=ke(h)?u.variant:typeof h=="string"?h:void 0,v=n?.[s],y=he({},u,{enabled:p,variant:p?m??u?.variant:void 0});p!==u?.enabled&&(y.original_enabled=u?.enabled),m!==u?.variant&&(y.original_variant=u?.variant),v&&(y.metadata=he({},u?.metadata,{payload:v,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),a[s]=y}return this.hs||(gn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:a}),this.hs=!0),a}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((n=>{var a=t[n];return{key:n,enabled:LP(a),variant:DP(a),payload:RP(e[n])}}))}getFlagVariants(){var t=this.xs(Ys),e=this.xs(bi);if(!e)return t||{};for(var n=Bt({},t),a=Object.keys(e),r=0;a.length>r;r++)n[a[r]]=e[a[r]];return this.hs||(gn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.hs=!0),n}getFlagPayloads(){var t=this.xs(fp),e=this.xs(ul);if(!e)return t||{};for(var n=Bt({},t||{}),a=Object.keys(e),r=0;a.length>r;r++)n[a[r]]=e[a[r]];return this.hs||(gn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.hs=!0),n}reloadFeatureFlags(){this.vs||this.Se.advanced_disable_feature_flags||this.ws()||this.Ms||(this._instance.qi.emit("featureFlagsReloading",!0),this.Ms=setTimeout((()=>{this.Es()}),5))}Rs(){clearTimeout(this.Ms),this.Ms=void 0}ensureFlagsLoaded(){this.ds||this.cs||this.Ms||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.vs=t}Es(t){var e;if(this.Rs(),!this._instance.Rr()&&!this.ws())if(this.cs)this.fs=!0;else{var n=this.Se.token,a=this.xs(df),r={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:he({},((e=this.ri)==null?void 0:e.get_initial_props())||{},this.xs(Gs)||{}),group_properties:this.xs(qs),timezone:u6()};la(a)||ke(a)||(r.$device_id=a),(t!=null&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Ts()&&(r.evaluation_contexts=this.Cs());var s=this.Is();ke(s)||(r.flag_keys=s);var l=!!this.Se.advanced_only_evaluate_survey_feature_flags,c=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.cs=!0,this._instance._send_request({method:"POST",url:c,data:r,compression:this.Se.disable_compression?void 0:aa.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:u=>{var h,p,m,v=!0;if(this.Ps(u.statusCode),u.statusCode===200&&(this.fs||(this.$anon_distinct_id=void 0),v=!1),this.cs=!1,!r.disable_flags||this.fs){this.ps=!v;var y=[];u.error?u.error instanceof Error?y.push(u.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):u.statusCode!==200&&y.push("api_error_"+u.statusCode),(h=u.json)!=null&&h.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var b,x=!((p=u.json)==null||(p=p.quotaLimited)==null||!p.includes("feature_flags"));x&&y.push("quota_limited"),(m=this.ri)==null||m.register({[by]:y}),x?gn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags((b=u.json)!==null&&b!==void 0?b:{},v,{partialResponse:l}),this.fs&&(this.fs=!1,this.Es()))}}})}}ws(){return a6(this.bs,3)}Ps(t){this.bs=r6(t,this.bs,3,(()=>gn.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.ps)if(this.ds||this.getFlags()&&this.getFlags().length>0){if(!this.Ss()){var a=this.getFeatureFlagResult(t,e);return(n=a?.variant)!==null&&n!==void 0?n:a?.enabled}}else gn.warn('getFeatureFlag for key "'+t+qv)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.ps)if(this.ds||this.getFlags()&&this.getFlags().length>0){if(!this.Ss()){var n=this.getFlagVariants(),a=t in n,r=n[t],s=this.getFlagPayloads()[t],l=String(r),c=this.xs(gy)||void 0,u=this.xs(Vd)||void 0,h=this.xs(Sd)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var p,m=this._instance.get_session_id(),v=this.xs(yy);m&&m!==v&&(h={},(p=this.ri)==null||p.register({[Sd]:h,[yy]:m}))}if((e.send_event||!("send_event"in e))&&(!(t in h)||!h[t].includes(l))){var y,b,x,P,T,L,E,A,D,B;it(h[t])?h[t].push(l):h[t]=[l],(y=this.ri)==null||y.register({[Sd]:h});var j=this.getFeatureFlagDetails(t),S=[...(b=this.xs(by))!==null&&b!==void 0?b:[]];ke(r)&&S.push("flag_missing");var N={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:s||null,$feature_flag_request_id:c,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((x=this.Se.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[t])||null,$feature_flag_bootstrapped_payload:((P=this.Se.bootstrap)==null||(P=P.featureFlagPayloads)==null?void 0:P[t])||null,$used_bootstrap_value:!this.ps};ke(j==null||(T=j.metadata)==null?void 0:T.version)||(N.$feature_flag_version=j.metadata.version);var U,Q=(L=j==null||(E=j.reason)==null?void 0:E.description)!==null&&L!==void 0?L:j==null||(A=j.reason)==null?void 0:A.code;Q&&(N.$feature_flag_reason=Q),j!=null&&(D=j.metadata)!=null&&D.id&&(N.$feature_flag_id=j.metadata.id),ke(j?.original_variant)&&ke(j?.original_enabled)||(N.$feature_flag_original_response=ke(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(B=j.metadata)!=null&&B.original_payload&&(N.$feature_flag_original_payload=j==null||(U=j.metadata)==null?void 0:U.original_payload),S.length&&(N.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",N)}if(a)return{key:t,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:RP(s)}}}else gn.warn('getFeatureFlagResult for key "'+t+qv)}getRemoteConfigPayload(t,e){var n=this.Se.token,a={distinct_id:this._instance.get_distinct_id(),token:n};this.Ts()&&(a.evaluation_contexts=this.Cs());var r=this.Is();ke(r)||(a.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:a,compression:this.Se.disable_compression?void 0:aa.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(s){var l,c=(l=s.json)==null?void 0:l.featureFlagPayloads;e(c?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.ps){if(this.ds||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return ke(n)?void 0:!!n}gn.warn('isFeatureEnabled for key "'+t+qv)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,n){if(this.ri){this.ds=!0;var a=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(l,c,u,h,p,m){u===void 0&&(u={}),h===void 0&&(h={}),p===void 0&&(p={});var v=(S=>{var N=S.flags;return N?(S.featureFlags=Object.fromEntries(Object.keys(N).map((U=>{var Q;return[U,(Q=N[U].variant)!==null&&Q!==void 0?Q:N[U].enabled]}))),S.featureFlagPayloads=Object.fromEntries(Object.keys(N).filter((U=>N[U].enabled)).filter((U=>{var Q;return(Q=N[U].metadata)==null?void 0:Q.payload})).map((U=>{var Q;return[U,(Q=N[U].metadata)==null?void 0:Q.payload]})))):S.featureFlags&&gn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),S})(l),y=v.flags,b=v.featureFlags,x=v.featureFlagPayloads;if(b){var P=l.requestId,T=l.evaluatedAt;if(it(b)){gn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var L={};if(b)for(var E=0;b.length>E;E++)L[b[E]]=!0;c&&c.register({[pp]:b,[Ys]:L})}else{var A=b,D=x,B=y;if(m!=null&&m.partialResponse)A=he({},u,A),D=he({},h,D),B=he({},p,B);else if(l.errorsWhileComputingFlags)if(y){var j=new Set(Object.keys(y).filter((S=>{var N;return!((N=y[S])!=null&&N.failed)})));A=he({},u,Object.fromEntries(Object.entries(A).filter((S=>j.has(S[0]))))),D=he({},h,Object.fromEntries(Object.entries(D||{}).filter((S=>j.has(S[0]))))),B=he({},p,Object.fromEntries(Object.entries(B||{}).filter((S=>j.has(S[0])))))}else A=he({},u,A),D=he({},h,D),B=he({},p,B);c&&c.register(he({[pp]:Object.keys(RS(A)),[Ys]:A||{},[fp]:D||{},[my]:B||{}},P?{[gy]:P}:{},T?{[Vd]:T}:{}))}}})(t,this.ri,a,r,s,n),e||(this.ys=!1),this.Os(e)}}override(t,e){e===void 0&&(e=!1),gn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ri)return gn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ri.unregister(bi),this.ri.unregister(ul),this.Os(),$s.info("All overrides cleared");if(it(t)){var e=AS(t);return this.ri.register({[bi]:e}),this.Os(),$s.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,a=t;if(this.hs=!!((n=a.suppressWarning)!==null&&n!==void 0&&n),"flags"in a){if(a.flags===!1)this.ri.unregister(bi),$s.info("Flag overrides cleared");else if(a.flags){if(it(a.flags)){var r=AS(a.flags);this.ri.register({[bi]:r})}else this.ri.register({[bi]:a.flags});$s.info("Flag overrides set",{flags:a.flags})}}return"payloads"in a&&(a.payloads===!1?(this.ri.unregister(ul),$s.info("Payload overrides cleared")):a.payloads&&(this.ri.register({[ul]:a.payloads}),$s.info("Payload overrides set",{payloads:a.payloads}))),void this.Os()}if(t&&typeof t=="object")return this.ri.register({[bi]:t}),this.Os(),$s.info("Flag overrides set",{flags:t});gn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ds){var e=this.Ls(),n=e.flags,a=e.flagVariants;try{t(n,a)}catch(r){gn.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var a,r=(this.xs(dd)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},l={$feature_flag:t,$feature_enrollment:e,$set:s};r&&(l.$early_access_feature_name=r.name),n&&(l.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(s,!1);var c=he({},this.getFlagVariants(),{[t]:e});(a=this.ri)==null||a.register({[pp]:Object.keys(RS(c)),[Ys]:c}),this.Os()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var a=this.xs(dd),r=n?"&"+n.map((s=>"stage="+s)).join("&"):"";if(a&&!e)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+r),method:"GET",callback:s=>{var l,c;if(s.json){var u=s.json.earlyAccessFeatures;return(l=this.ri)==null||l.unregister(dd),(c=this.ri)==null||c.register({[dd]:u}),t(u)}}})}Ls(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((n=>e[n])),flagVariants:Object.keys(e).filter((n=>e[n])).reduce(((n,a)=>(n[a]=e[a],n)),{})}}Os(t){var e=this.Ls(),n=e.flags,a=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(n,a,{errorsLoading:t})}catch(s){gn.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.xs(Gs)||{},a=t?.$set||(t!=null&&t.$set_once?{}:t),r=t?.$set_once,s={};if(r)for(var l in r)({}).hasOwnProperty.call(r,l)&&(l in n||(s[l]=r[l]));this._instance.register({[Gs]:he({},n,s,a)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=he({},this.xs(Gs)||{});t.forEach((a=>{delete n[a]})),this._instance.register({[Gs]:n}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Gs),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.xs(qs)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((a=>{n[a]=he({},n[a],t[a]),delete t[a]})),this._instance.register({[qs]:he({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.xs(qs)||{};this._instance.register({[qs]:he({},e,{[t]:{}})})}else this._instance.unregister(qs)}reset(){this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.$anon_distinct_id=void 0,this.Rs(),this.hs=!1,this.bs=0}}},wK={sessionRecording:class{get Se(){return this._instance.config}get ri(){return this._instance.persistence}get started(){var t;return!((t=this.Fs)==null||!t.isStarted)}get status(){var t,e;return this.As===ed||this.As===Hh?this.As:(t=(e=this.Fs)==null?void 0:e.status)!==null&&t!==void 0?t:this.As}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.As=wS,this.$s=void 0,this._instance=t,!this._instance.sessionManager)throw mi.error("started without valid sessionManager"),new Error(Oy+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===xi)throw new Error(Oy+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ns(){var t,e=!((t=this._instance.get_property(ao))==null||!t.enabled),n=!this.Se.disable_session_recording,a=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return Z&&e&&n&&!a}startIfEnabledOrStop(t){var e;if(!this.Ns||(e=this.Fs)==null||!e.isStarted){var n=!ke(Object.assign)&&!ke(Array.from);this.Ns&&n?(this.Ds(t),mi.info("starting")):(this.As=wS,this.stopRecording())}}Ds(t){var e,n,a;this.Ns&&(this.As!==ed&&this.As!==Hh&&(this.As=xS),Be!=null&&(e=Be.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=Be.__PosthogExtensions__)!=null&&n.initSessionRecording?this.qs(t):(a=Be.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,this.js,(r=>{if(r)return mi.error("could not load recorder",r);this.qs(t)})))}stopRecording(){var t,e;(t=this.$s)==null||t.call(this),this.$s=void 0,(e=this.Fs)==null||e.stop()}Bs(){var t,e;(t=this.$s)==null||t.call(this),this.$s=void 0,(e=this.Fs)==null||e.discard()}Hs(){var t,e;(t=this.ri)==null||t.unregister(Rb),(e=this.ri)==null||e.unregister(DE)}Us(t,e){if(nt(t))return null;var n,a=Bn(t)?t:parseFloat(t);return typeof(n=a)!="number"||!Number.isFinite(n)||0>n||n>1?(mi.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):a}zs(t){if(this.ri){var e,n,a=this.ri,r=()=>{var s,l=t.sessionRecording===!1?void 0:t.sessionRecording,c=this.Us((s=this.Se.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.Us(l?.sampleRate,"remote config sampleRate"),h=c??u;nt(h)&&this.Hs();var p=l?.minimumDurationMilliseconds;a.register({[ao]:he({cache_timestamp:Date.now(),enabled:!!l},l,{networkPayloadCapture:he({capturePerformance:t.capturePerformance},l?.networkPayloadCapture),canvasRecording:{enabled:l?.recordCanvas,fps:l?.canvasFps,quality:l?.canvasQuality},sampleRate:h,minimumDurationMilliseconds:ke(p)?null:p,endpoint:l?.endpoint,triggerMatchType:l?.triggerMatchType,masking:l?.masking,urlTriggers:l?.urlTriggers,version:l?.version,triggerGroups:l?.triggerGroups})})};r(),(e=this.$s)==null||e.call(this),this.$s=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(r)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.zs(t),void this.Bs()):(this.zs(t),void this.startIfEnabledOrStop()):(this.As===ed&&(this.As=Hh,mi.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Fs)!=null&&n.log?this.Fs.log(t,e):mi.warn("log called before recorder was ready")}get js(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(ao);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Ws(){var t,e,n=this._instance.get_property(ao);if(!n)return!1;try{e=typeof n=="object"?n:JSON.parse(n)}catch(r){return mi.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var a=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-a}qs(t){var e,n;if((e=Be.__PosthogExtensions__)==null||!e.initSessionRecording)return mi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[UE]:!0});if(this.Fs||(this.Fs=(n=Be.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Fs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ws())return this.As===Hh||this.As===ed?void 0:(this.As=ed,mi.info("persisted remote config is stale, requesting fresh config before starting"),void new h6(this._instance).load());this.As=xS,this.Fs.start(t)}onRRwebEmit(t){var e;(e=this.Fs)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Fs||(e=this.ri)==null||e.register({[ME]:!0}),(t=this.Fs)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Fs||(e=this.ri)==null||e.register({[IE]:!0}),(t=this.Fs)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Fs||(n=this.ri)==null||n.register({[t==="url"?NE:OE]:!0}),(e=this.Fs)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Fs)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Fs)==null||!n.tryAddCustomEvent(t,e))}}},xK={autocapture:class{constructor(t){this.Vs=!1,this.Zs=null,this.Gs=!1,this.instance=t,this.rageclicks=new yS(t.config.rageclick),this.Qs=null}initialize(){this.startIfEnabled()}get Se(){var t,e,n=qt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map((a=>new RegExp(a))),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map((a=>new RegExp(a))),n}Js(){if(this.isBrowserSupported()){if(Z&&xe){var t=n=>{n=n||Z?.event;try{this.Ks(n)}catch(a){$v.error("Failed to capture event",a)}};if(tn(xe,"submit",t,{capture:!0}),tn(xe,"change",t,{capture:!0}),tn(xe,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=n=>{n=n||Z?.event;try{this.Ks(n,Bv)}catch(a){$v.error("Failed to capture copy/cut event",a)}};tn(xe,"copy",e,{capture:!0}),tn(xe,"cut",e,{capture:!0})}}}else $v.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Js(),this.Vs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Gs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ly]:!!t.autocapture_opt_out}),this.Zs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Qs=t}getElementSelectors(t){var e,n=[];return(e=this.Qs)==null||e.forEach((a=>{var r=xe?.querySelectorAll(a);r?.forEach((s=>{t===s&&n.push(a)}))})),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[ly];if(la(this.Zs)&&!Hr(n)&&!this.instance.Rr())return!1;var a=(e=this.Zs)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!a}Ks(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,a=Dv(t);HE(a)&&(a=a.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&QP(a,this.instance.config.rageclick)&&this.Ks(t,"$rageclick");var r=e===Bv;if(a&&(function(m,v,y,b,x,P){var T,L,E,A,D,B;if(y===void 0&&(y=void 0),!Z||Nb(m)||(T=y)!=null&&T.url_allowlist&&!YP(y.url_allowlist,P)||(L=y)!=null&&L.url_ignorelist&&YP(y.url_ignorelist,P))return!1;if((E=y)!=null&&E.dom_event_allowlist){var j=y.dom_event_allowlist;if(j&&!j.some((ce=>v.type===ce)))return!1}var S=ZE(m,b),N=S.parentIsUsefulElement,U=S.targetElementList;if(!(function(ce,le){var re=le?.element_allowlist;if(ke(re))return!0;var te,ie=function(X){if(re.some((W=>X.tagName.toLowerCase()===W)))return{v:!0}};for(var $ of ce)if(te=ie($))return te.v;return!1})(U,y)||!Cy(U,(A=y)==null?void 0:A.css_selector_allowlist)||Cy(U,(D=(B=y)==null?void 0:B.css_selector_ignorelist)!==null&&D!==void 0?D:xq))return!1;try{var Q=Z.getComputedStyle(m);if(Q&&Q.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}var ee=m.tagName.toLowerCase();switch(ee){case"html":return!1;case"form":return(x||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(v.type)>=0;default:return N?(x||["click"]).indexOf(v.type)>=0:(x||["click"]).indexOf(v.type)>=0&&(Mb.indexOf(ee)>-1||m.getAttribute("contenteditable")==="true")}})(a,t,this.Se,r,r?["copy","cut"]:void 0,this.instance)){var s=pK(a,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),l=s.props;if(s.explicitNoCapture)return!1;var c=this.getElementSelectors(a);if(c&&c.length>0&&(l.$element_selectors=c),e===Bv){var u,h=qE(Z==null||(u=Z.getSelection())==null?void 0:u.toString()),p=t.type||"clipboard";if(!h)return!1;l.$selected_content=h,l.$copy_type=p}return this.instance.capture(e,l),!0}}}isBrowserSupported(){return yr(xe?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ys=(Z==null||(e=Z.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(be.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Xs&&this.Xs(),this.Xs=void 0,be.info("History API monitoring stopped")}monitorHistoryChanges(){Z&&Z.history&&(this.eo("pushState"),this.eo("replaceState"),this.ro())}eo(t){var e;if(Z&&((e=Z.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(a,r,s){try{if(!(r in a))return bS;var l={next:a[r]},c=s((function(){for(var u=arguments.length,h=new Array(u),p=0;u>p;p++)h[p]=arguments[p];return l.next.apply(this,h)}));return yr(c)&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:l}})),a[r]=c,()=>{if(a[r]!==c)for(var u=a[r];yr(u)&&u.__posthog_layer__;){var h=u.__posthog_layer__;if(h.next===c)return void(h.next=l.next);u=h.next}else a[r]=l.next}}catch{return bS}})(Z.history,t,(a=>function(r,s,l){a.call(this,r,s,l),n.io(t)}))}}io(t){try{var e,n=Z==null||(e=Z.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ys&&this.isEnabled&&this._instance.capture(hl,{navigation_type:t}),this.Ys=n}catch(a){be.error("Error capturing "+t+" pageview",a)}}ro(){if(!this.Xs){var t=()=>{this.io("popstate")};tn(Z,"popstate",t),this.Xs=()=>{Z&&Z.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.no=!1,this.Vs=!1,this.so=null,this.instance=t,this.no=!((e=this.instance.persistence)==null||!e.props[cy]),this.rageclicks=new yS(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return qt(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return nt(this.Se.capture_heatmaps)?nt(this.Se.enable_heatmaps)?this.no:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Vs)return;mK.info("starting..."),this.oo(),this.ke()}else{var t;clearInterval((t=this.so)!==null&&t!==void 0?t:void 0),this.ao(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cy]:e}),this.no=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}lo(t){this.fe(t.originalEvent,"deadclick")}ke(){this.so&&clearInterval(this.so),this.so=xe?.visibilityState==="visible"?setInterval(this.Wr.bind(this),this.flushIntervalMilliseconds):null}oo(){Z&&xe&&(this.uo=this.Wr.bind(this),tn(Z,mf,this.uo),this.ho=t=>this.fe(t||Z?.event),tn(xe,"click",this.ho,{capture:!0}),this.do=t=>this.co(t||Z?.event),tn(xe,"mousemove",this.do,{capture:!0}),this.vo=new tS(this.instance,Lq,this.lo.bind(this)),this.vo.startIfEnabledOrStop(),this.fo=this.ke.bind(this),tn(xe,ff,this.fo),this.Vs=!0)}ao(){var t;Z&&xe&&(this.uo&&Z.removeEventListener(mf,this.uo),this.ho&&xe.removeEventListener("click",this.ho,{capture:!0}),this.do&&xe.removeEventListener("mousemove",this.do,{capture:!0}),this.fo&&xe.removeEventListener(ff,this.fo),clearTimeout(this.po),(t=this.vo)==null||t.stop(),this.Vs=!1)}mo(t,e){var n=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=(function(l,c,u){for(var h=l;h&&gs(h)&&!Ra(h,"body");){if(h===u)return!1;var p=void 0;try{var m,v,y;p=(m=(v=(y=h.ownerDocument)==null?void 0:y.defaultView)!==null&&v!==void 0?v:Z)==null?void 0:m.getComputedStyle(h).position}catch{return!1}if(Ke(c,p))return!0;h=KE(h)}return!1})(Dv(t),["fixed","sticky"],r);return{x:t.clientX+(s?0:a),y:t.clientY+(s?0:n),target_fixed:s,type:e}}fe(t,e){var n;if(e===void 0&&(e="click"),!KP(t.target)&&PS(t)){var a=this.mo(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&QP(Dv(t),this.instance.config.rageclick)&&this.kt(he({},a,{type:"rageclick"})),this.kt(a)}}co(t){!KP(t.target)&&PS(t)&&(clearTimeout(this.po),this.po=setTimeout((()=>{this.kt(this.mo(t,"mousemove"))}),500))}kt(t){if(Z){var e=this.Se.disable_capture_url_hashes?ms(Z.location.href):Z.location.href,n=this.Se.custom_personal_data_properties,a=this.Se.mask_personal_data_properties?[...Fl,...n||[]]:[],r=Gd(e,a,qd);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(t)}}Wr(){this.R&&!cs(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:tS,webVitalsAutocapture:class{constructor(t){var e;this.no=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.yo=()=>{clearTimeout(this.bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,a)=>he({},n,{["$web_vitals_"+a.name+"_event"]:he({},a),["$web_vitals_"+a.name+"_value"]:a.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._o=n=>{var a;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.wo();if(!ke(r))if(nt(n?.name)||nt(n?.value))Bs.error("Invalid metric received",n);else if(!this.xo||this.xo>n.value){this.R.url!==r&&(this.yo(),this.bo=setTimeout(this.yo,this.flushToCaptureTimeoutMs)),ke(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=ke(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var s=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0),l=he({},n,{$current_url:r,timestamp:Date.now()});ke(s)||(l.$session_id=s.sessionId,l.$window_id=s.windowId),this.R.metrics.push(l),this.R.metrics.length===this.allowedMetrics.length&&this.yo()}else Bs.error("Ignoring metric with value >= "+this.xo,n)},this.ko=()=>{if(!this.Vs){var n,a,r,s,l=Be.__PosthogExtensions__;if(!ke(l)&&!ke(l.postHogWebVitalsCallbacks)){var c=l.postHogWebVitalsCallbacks;n=c.onLCP,a=c.onCLS,r=c.onFCP,s=c.onINP}n&&a&&r&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this._o.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(this._o.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this._o.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._o.bind(this)),this.Vs=!0):Bs.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.no=!((e=this._instance.persistence)==null||!e.props[py]),this.startIfEnabled()}get So(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=qt(this.So)?(t=this.So)==null?void 0:t.web_vitals_allowed_metrics:void 0;return nt(n)?((e=this._instance.persistence)==null?void 0:e.props[fy])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(qt(this.So)?this.So.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=qt(this.So)?this.So.web_vitals_attribution:void 0;return t!=null&&t}get xo(){var t=qt(this.So)&&Bn(this.So.__web_vitals_max_value)?this.So.__web_vitals_max_value:kS;return t>0&&6e4>=t?kS:t}get isEnabled(){var t=fn?.protocol;if(t!=="http:"&&t!=="https:")return Bs.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=qt(this.So)?this.So.web_vitals:Hr(this.So)?this.So:void 0;return Hr(e)?e:this.no}startIfEnabled(){this.isEnabled&&!this.Vs&&(Bs.info("enabled, starting..."),this.Bt(this.ko))}onRemoteConfig(t){if("capturePerformance"in t){var e=qt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=qt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[py]:e}),this._instance.persistence.register({[fy]:n})),this.no=e,this.startIfEnabled()}}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(a=>{a?Bs.error("failed to load script",a):t()}))}wo(){var t=Z?this._instance.config.disable_capture_url_hashes?ms(Z.location.href):Z.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Fl,...e||[]]:[];return Gd(t,n,qd)}Bs.error("Could not determine current URL")}}},PK={exceptionObserver:class{constructor(t){var e,n,a,r,s,l;this.ko=()=>{var c;if(Z&&this.isEnabled&&(c=Be.__PosthogExtensions__)!=null&&c.errorWrappingFunctions){var u=Be.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,h=Be.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,p=Be.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Co&&this.Se.capture_unhandled_errors&&(this.Co=u(this.captureException.bind(this))),!this.To&&this.Se.capture_unhandled_rejections&&(this.To=h(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=p(this.captureException.bind(this)))}catch(m){Xc.error("failed to start",m),this.Mo()}}},this._instance=t,this.Eo=!((e=this._instance.persistence)==null||!e.props[dy]),this.Ro=new SG(he({},((n=this._instance.config.error_tracking)===void 0&&(n={}),{refillRate:(a=(r=n.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:n.__exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:1,bucketSize:(s=(l=n.exceptionRateLimiterBucketSize)!==null&&l!==void 0?l:n.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}),{refillInterval:1e4,Ae:Xc})),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return qt(t)?e=he({},e,t):(ke(t)?this.Eo:t)&&(e=he({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Xc.info("enabled"),this.Mo(),this.Bt(this.ko)):this.Mo()}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(a=>{if(a)return Xc.error("failed to load script",a);t()}))}Mo(){var t,e,n;(t=this.Co)==null||t.call(this),this.Co=void 0,(e=this.To)==null||e.call(this),this.To=void 0,(n=this.Io)==null||n.call(this),this.Io=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Eo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[dy]:this.Eo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}captureException(t){var e,n,a,r=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Ro.consumeRateLimit(r)?Xc.info("Skipping exception capture because of client rate limiting.",{exception:r}):(a=this._instance.exceptions)==null||a.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Oo=[],this.Lo=new $G([new ZG,new iq,new QG,new JG,new aq,new nq,new eq,new rq],(function(a){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;r>l;l++)s[l-1]=arguments[l];return function(c,u){u===void 0&&(u=0);for(var h=[],p=c.split(`
|
|
1249
1249
|
`),m=u;p.length>m;m++){var v=p[m];if(1024>=v.length){var y=HP.test(v)?v.replace(HP,"$1"):v;if(!y.match(/\S*Error: /)){for(var b of s){var x=b(y,a);if(x){h.push(x);break}}if(h.length>=50)break}}}return(function(P){if(!P.length)return[];var T=Array.from(P);return T.reverse(),T.slice(0,50).map((L=>{return he({},L,{filename:L.filename||(E=T,E[E.length-1]||{}).filename,function:L.function||jl});var E}))})(h)}})("web:javascript",GG,YG)),this._instance=t,this.Oo=(e=(n=this._instance.persistence)==null?void 0:n.get_property(uy))!==null&&e!==void 0?e:[],this.Fo=cf(this.Ao()),this.$o=new oq(this.Fo)}onConfigChange(){this.Fo=cf(this.Ao()),this.$o.setConfig(this.Fo)}onRemoteConfig(t){var e,n,a;if("errorTracking"in t){var r=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(a=t.errorTracking)==null?void 0:a.captureExtensionExceptions;this.Oo=r,this._instance.persistence&&this._instance.persistence.register({[uy]:this.Oo,[hy]:s})}}get No(){var t,e=!!this._instance.get_property(hy),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Lo.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.Fo.enabled)try{if(!Lt(t)||t.trim().length===0)return void gi.warn("Ignoring exception step because message must be a non-empty string");var n=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var l=[];return{sanitizedProperties:Object.keys(s).reduce(((c,u)=>sq.has(u)?(l.push(u),c):(c[u]=s[u],c)),{}),droppedKeys:l}})(this.Do(e)),a=n.sanitizedProperties,r=n.droppedKeys;r.length>0&&gi.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.$o.add(he({[of]:t,[lf]:new Date().toISOString()},a))}catch(s){gi.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.qo(e)){if(this.jo(e))return this.Bo("Exception dropped: matched a suppression rule"),void gi.info("Skipping exception capture because a suppression rule matched");if(!this.No&&this.Ho(e))return this.Bo("Exception dropped: thrown by a browser extension"),void gi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Uo(e))return this.Bo("Exception dropped: thrown by the PostHog SDK"),void gi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.Fo.enabled&&nt(t.$exception_steps)?this.zo(t):t;try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",ln:!0});return a&&this.$o.clear(),a}catch(r){return gi.error("Failed to capture exception event. Dropping this exception.",r),void this.$o.clear()}}catch(r){return void gi.error("Failed to process exception event. Ignoring this exception.",r)}}zo(t){try{var e=this.$o.getAttachable();return e.length===0?t:he({},t,{$exception_steps:e})}catch(n){return gi.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}Bo(t){this.Fo.enabled&&this.$o.add({[of]:t,[lf]:new Date().toISOString()})}Do(t){return qt(t)?he({},t):{}}Ao(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}jo(t){if(t.length===0)return!1;var e=t.reduce(((n,a)=>{var r=a.type,s=a.value;return Lt(r)&&r.length>0&&n.$exception_types.push(r),Lt(s)&&s.length>0&&n.$exception_values.push(s),n}),{$exception_types:[],$exception_values:[]});return this.Oo.some((n=>{var a=n.values.map((r=>{var s,l=P6[r.operator],c=it(r.value)?r.value:[r.value],u=(s=e[r.key])!==null&&s!==void 0?s:[];return c.length>0&&l(c,u)}));return n.type==="OR"?a.some(Boolean):a.every(Boolean)}))}Ho(t){return t.flatMap((e=>{var n,a;return(n=(a=e.stacktrace)==null?void 0:a.frames)!==null&&n!==void 0?n:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Uo(t){if(t.length>0){var e,n,a,r,s=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],l=s[s.length-1];return(a=l==null||(r=l.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&a!==void 0&&a}return!1}qo(t){return!nt(t)&&it(t)}}},SK=he({productTours:class{get ri(){return this._instance.persistence}constructor(t){this.Wo=null,this.Vo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,n;if(this.ri&&this.ri.register({[Ab]:!!t.productTours}),!Wv(this._instance))return!this.Wo&&nt((e=this.ri)==null?void 0:e.props[ud])||Hv.info("product tours disabled; stopping and clearing cached tours"),(n=this.Wo)==null||n.stop(),this.Wo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Wo&&Wv(this._instance)&&this.Bt((()=>this.Zo()))}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(a=>{a?Hv.error("Could not load product tours script",a):t()}))}Zo(){var t;!this.Wo&&(t=Be.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.Wo=Be.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!it(this.Vo)||e){var n=this.ri;if(n){var a=n.props[ud];if(it(a)&&!e)return this.Vo=a,void t(a,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{if(Wv(this._instance)){var s=r.statusCode;if(s!==200||!r.json){var l="Product Tours API could not be loaded, status: "+s;return Hv.error(l),void t([],{isLoaded:!1,error:l})}var c=it(r.json.product_tours)?r.json.product_tours:[];this.Vo=c,n&&n.register({[ud]:c}),t(c,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Vo,{isLoaded:!0})}getActiveProductTours(t){nt(this.Wo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Wo.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Wo)==null||e.showTourById(t)}previewTour(t){this.Wo?this.Wo.previewTour(t):this.Bt((()=>{var e;this.Zo(),(e=this.Wo)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.Wo)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Wo)==null||t.nextStep()}previousStep(){var t;(t=this.Wo)==null||t.previousStep()}clearCache(){var t;this.Vo=null,(t=this.ri)==null||t.unregister(ud)}resetTour(t){var e;(e=this.Wo)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.Wo)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Wo)==null||e.cancelPendingTour(t)}}},Kf),CK={siteApps:class{constructor(t){this.Go=0,this._instance=t,this.Qo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Jo(t,e){if(e){var n=this.globalsForEvent(e);this.Qo.push(n),this.Qo.length>1e3&&(this.Qo=this.Qo.slice(10))}}get siteAppLoaders(){var t;return(t=Be._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Jo.bind(this));this.Ko=()=>{t(),this.Qo=[],this.Ko=void 0}}}globalsForEvent(t){var e,n,a,r,s,l,c;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var m of Object.entries(p)){var v=m[0];u[v]={id:h[v],type:v,properties:m[1]}}var y=t.$set_once,b=t.$set;return{event:he({},Q4(t,gK),{properties:he({},t.properties,b?{$set:he({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},b)}:{},y?{$set_once:he({},(a=(r=t.properties)==null?void 0:r.$set_once)!==null&&a!==void 0?a:{},y)}:{}),elements_chain:(s=(l=t.properties)==null?void 0:l.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(c=t.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Yo(t){var e,n=(e=t.tagName)==null?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Mr.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Mr.error("prepare_external_dependency_script returned null"),null):t}Xo(){var t,e,n,a,r,s,l,c;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=xe?.defaultView,h=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Go++,this.ea)return this.ta();var p=[],m=this,v=new WeakSet,y=(P,T,L)=>{if(P!=null&&P[T]){var E=P[T];P[T]=L(E),p.push((()=>{P[T]=E}))}},b=P=>{if(v.has(P))return P;var T=m.Yo(P);return T&&v.add(T),T},x=P=>P.map((T=>typeof T=="string"?T:b(T))).filter((T=>!la(T)));return y(h,"appendChild",(P=>function(T){var L=b(T);return L?P.call(this,L):T})),y(h,"insertBefore",(P=>function(T,L){var E=b(T);return E?P.call(this,E,L):T})),y(h,"replaceChild",(P=>function(T,L){var E=b(T);return E?P.call(this,E,L):L})),[(e=u.Element)==null?void 0:e.prototype,(n=u.Document)==null?void 0:n.prototype,(a=u.DocumentFragment)==null?void 0:a.prototype].forEach((P=>{y(P,"append",(T=>function(){for(var L=arguments.length,E=new Array(L),A=0;L>A;A++)E[A]=arguments[A];return T.apply(this,x(E))})),y(P,"prepend",(T=>function(){for(var L=arguments.length,E=new Array(L),A=0;L>A;A++)E[A]=arguments[A];return T.apply(this,x(E))}))})),[(r=u.Element)==null?void 0:r.prototype,(s=u.CharacterData)==null?void 0:s.prototype,(l=u.DocumentType)==null?void 0:l.prototype].forEach((P=>{y(P,"before",(T=>function(){for(var L=arguments.length,E=new Array(L),A=0;L>A;A++)E[A]=arguments[A];return T.apply(this,x(E))})),y(P,"after",(T=>function(){for(var L=arguments.length,E=new Array(L),A=0;L>A;A++)E[A]=arguments[A];return T.apply(this,x(E))})),y(P,"replaceWith",(T=>function(){for(var L=arguments.length,E=new Array(L),A=0;L>A;A++)E[A]=arguments[A];var D=x(E);return E.length&&!D.length?void 0:T.apply(this,D)}))})),y((c=u.Element)==null?void 0:c.prototype,"insertAdjacentElement",(P=>function(T,L){var E=b(L);return E?P.call(this,T,E):null})),this.ea=()=>{p.forEach((P=>P())),this.ea=void 0},this.ta()}ta(){var t=!1;return()=>{var e;t||(t=!0,this.Go--,this.Go===0&&((e=this.ea)==null||e.call(this)))}}ra(t,e){e===void 0&&(e=!0);var n=this.Xo();try{var a=t(n);return e&&n(),a}catch(r){throw n(),r}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var l;!e.errored&&this.Qo.length&&(Mr.info("Processing "+this.Qo.length+" events for site app with id "+t.id),this.Qo.forEach((c=>this.ra((()=>e.processEvent==null?void 0:e.processEvent(c))))),e.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((l=this.Ko)==null||l.call(this))},a=!1,r=l=>{e.errored=!l,e.loaded=!0,Mr.info("Site app with id "+t.id+" "+(l?"loaded":"errored")),a&&n()};try{var s=this.ra((l=>t.init({posthog:this._instance,callback(c){l(),r(c)}})),!1).processEvent;s&&(e.processEvent=s),a=!0}catch(l){Mr.error(SS+t.id,l),r(!1)}if(a&&e.loaded)try{n()}catch(l){Mr.error("Error while processing buffered events PostHog app with config id "+t.id,l),e.errored=!0}}ia(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}na(t){var e=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t),a=function(s){try{e.ra((()=>s.processEvent==null?void 0:s.processEvent(n)))}catch(l){Mr.error("Error while processing event "+t.event+" for site app "+s.id,l)}};for(var r of Object.values(this.apps))a(r)}}onRemoteConfig(t){var e,n,a,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.ia(),void this._instance.on("eventCaptured",(c=>this.na(c)))):void Mr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ko)==null||n.call(this),(a=t.siteApps)!=null&&a.length)if(this.isEnabled){var s=function(){var c,u=l.id,h=l.url;Be["__$$ph_site_app_"+u]=r._instance,(c=Be.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(r._instance,h,(p=>{if(p)return Mr.error(SS+u,p)}))};for(var l of t.siteApps)s()}else Mr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},TK={tracingHeaders:class{constructor(t){this.sa=void 0,this.oa=void 0,this.aa=void 0,this.ko=()=>{var e,n,a=this.la();a?(ke(this.sa)&&(this.sa=(e=Be.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(a,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ke(this.oa)&&(this.oa=(n=Be.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(a,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Mo()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Bt(t){var e,n;(e=Be.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(n=Be.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(a=>{if(a)return fK.error("failed to load script",a);t()}))}ua(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}la(){var t=this.ua();return it(t)?(it(this.aa)?this.aa.splice(0,this.aa.length,...t):this.aa=[...t],t.length>0?this.aa:void 0):(it(this.aa)&&this.aa.splice(0),this.aa=t||void 0,this.aa)}Mo(){var t,e;(t=this.sa)==null||t.call(this),(e=this.oa)==null||e.call(this),this.sa=void 0,this.oa=void 0}startIfEnabledOrStop(){this.la()?this.Bt(this.ko):this.Mo()}}},EK=he({surveys:class{get Se(){return this._instance.config}constructor(t){this.ha=void 0,this._surveyManager=null,this.da=!1,this.ca=[],this.va=null,this.fa=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(nt(e))return Rt.warn("Flags not loaded yet. Not loading surveys.");var n=it(e);this.ha=n?e.length>0:e,Rt.info("flags response received, isSurveysEnabled: "+this.ha),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var a=localStorage.key(n);(a!=null&&a.startsWith(T6)||a!=null&&a.startsWith("inProgressSurvey_"))&&e.push(a)}e.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.da)Rt.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)Rt.info(CS);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())Rt.info("Not loading surveys in cookieless mode without consent.");else{var t=Be?.__PosthogExtensions__;if(t){if(!ke(this.ha)||this.Se.advanced_enable_surveys){var e=this.ha||this.Se.advanced_enable_surveys;this.da=!0;try{var n=t.generateSurveys;if(n)return void this.pa(n,e);var a=t.loadExternalDependency;if(!a)return void this.ga(Lb);a(this._instance,"surveys",(r=>{r||!t.generateSurveys?this.ga("Could not load surveys script",r):this.pa(t.generateSurveys,e)}))}catch(r){throw this.ga("Error initializing surveys",r),r}finally{this.da=!1}}}else Rt.error("PostHog Extensions not found.")}}pa(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new yK(this._instance),Rt.info("Surveys loaded successfully"),this.ma({isLoaded:!0})}ga(t,e){Rt.error(t,e),this.ma({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ca.push(t),this._surveyManager&&this.ma({isLoaded:!0}),()=>{this.ca=this.ca.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Se.disable_surveys)return Rt.info(CS),t([]);var n,a=this._instance.get_property(vy);if(a&&!e)return t(a,{isLoaded:!0}),void(this.ya()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.va?this.va.then((r=>t(r.surveys,r.context))):(typeof Promise<"u"&&(this.va=new Promise((r=>{n=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:r=>{var s;this.va=null;var l=r.statusCode;if(l!==200||!r.json){var c="Surveys API could not be loaded, status: "+l;Rt.error(c),this.fa=Date.now();var u={isLoaded:!1,error:c};return t([],u),void(n==null||n({surveys:[],context:u}))}this.fa=null;var h,p=r.json.surveys||[],m=p.filter((y=>(function(b){return!(!b.start_date||b.end_date)})(y)&&(C6(y)||(function(b){var x;return!((x=b.conditions)==null||(x=x.actions)==null||(x=x.values)==null||!x.length)})(y))));m.length>0&&((h=this._surveyEventReceiver)==null||h.register(m)),(s=this._instance.persistence)==null||s.register({[vy]:p,[uf]:Date.now()});var v={isLoaded:!0};t(p,v),n?.({surveys:p,context:v})}}))}ya(){return this.ba()&&!this.va&&!this._a()}ba(){var t=this._instance.get_property(uf);return Bn(t)&&Date.now()-t>3e5}_a(){return Bn(this.fa)&&3e5>Date.now()-this.fa}markSurveyAsSeen(t,e){var n,a={id:t,current_iteration:(n=e?.iteration)!==null&&n!==void 0?n:null};E6(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ma(t){for(var e of this.ca)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){Rt.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!nt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Rt.warn("init was not called")}wa(t){var e=null;return this.getSurveys((n=>{var a;e=(a=n.find((r=>r.id===t)))!==null&&a!==void 0?a:null})),e}xa(t){if(nt(this._surveyManager))return{eligible:!1,reason:Gv};var e=typeof t=="string"?this.wa(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(nt(this._surveyManager))return Rt.warn("init was not called"),{visible:!1,disabledReason:Gv};var e=this.xa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return nt(this._surveyManager)?(Rt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Gv})):new Promise((n=>{this.getSurveys((a=>{var r,s=(r=a.find((c=>c.id===t)))!==null&&r!==void 0?r:null;if(s){var l=this.xa(s);n({visible:l.eligible,disabledReason:l.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,n){var a;if(nt(this._surveyManager))Rt.warn("init was not called");else{var r=typeof t=="string"?this.wa(t):t;if(r!=null&&r.id)if(iK.includes(r.type)){var s=xe?.querySelector(e);if(s)return(a=r.appearance)!=null&&a.surveyPopupDelaySeconds?(Rt.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var l,c;Rt.info("Rendering survey "+r.id+" with delay of "+((l=r.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(c=this._surveyManager)==null||c.renderSurvey(r,s,n),Rt.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s,n);Rt.warn("Survey element not found")}else Rt.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Rt.warn("Survey not found")}}displaySurvey(t,e){var n;if(nt(this._surveyManager))Rt.warn("init was not called");else{var a=this.wa(t);if(a){var r=a;if((n=a.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=he({},a,{appearance:he({},a.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ey.Popover&&e.initialResponses&&Rt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.canRenderSurvey(a);if(!s.visible)return void Rt.warn("Survey is not eligible to be displayed: ",s.disabledReason)}e.displayType!==Ey.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else Rt.warn("Survey not found")}}cancelPendingSurvey(t){nt(this._surveyManager)?Rt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Kf),AK={toolbar:class{constructor(t){this.instance=t}ka(t){Be.ph_toolbar_state=t}Sa(){var t;return(t=Be.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),BE(this.instance.config)||!Z||!xe)return!1;t=t??Z.location,n=n??Z.history;try{if(!e){try{Z.localStorage.setItem("test","test"),Z.localStorage.removeItem("test")}catch{return!1}e=Z?.localStorage}var a,r=bK||_f(t.hash,"__posthog")||_f(t.hash,"state"),s=r?GP((()=>JSON.parse(atob(decodeURIComponent(r)))))||GP((()=>JSON.parse(decodeURIComponent(r)))):null;return s&&s.action==="ph_authorize"?((a=s).source="url",a&&Object.keys(a).length>0&&(s.desiredHash?t.hash=s.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((a=JSON.parse(e.getItem(TS)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}Ca(t){var e=Be.ph_load_toolbar||Be.ph_load_editor;!nt(e)&&yr(e)?e(t,this.instance):ES.warn("No toolbar load function found")}loadToolbar(t){var e=!(xe==null||!xe.getElementById(jE));if(!Z||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,a=he({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Z.localStorage.setItem(TS,JSON.stringify(he({},a,{source:void 0}))),this.Sa()===2)this.Ca(a);else if(this.Sa()===0){var r;this.ka(1),(r=Be.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return ES.error("[Toolbar] Failed to load",s),void this.ka(0);this.ka(2),this.Ca(a)})),tn(Z,"turbolinks:load",(()=>{this.ka(0),this.loadToolbar(a)}))}return!0}Ta(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},RK=he({experiments:Zn},Kf),LK={conversations:class{constructor(t){this.Ia=void 0,this._conversationsManager=null,this.Ma=!1,this.Ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;nt(e)||(Hr(e)?this.Ia=e:(this.Ia=e.enabled,this.Ea=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ia=void 0,this.Ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ma||this._instance.config.disable_conversations||BE(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=Be?.__PosthogExtensions__;if(t&&!ke(this.Ia)&&this.Ia)if(this.Ea&&this.Ea.token){this.Ma=!0;try{var e=t.initConversations;if(e)return this.Ra(e),void(this.Ma=!1);var n=t.loadExternalDependency;if(!n)return void this.Pa(Lb);n(this._instance,"conversations",(a=>{a||!t.initConversations?this.Pa("Could not load conversations script",a):this.Ra(t.initConversations),this.Ma=!1}))}catch(a){this.Pa("Error initializing conversations",a),this.Ma=!1}}else Ba.error("Conversations enabled but missing token in remote config.")}}Ra(t){if(this.Ea)try{this._conversationsManager=t(this.Ea,this._instance),Ba.info("Conversations loaded successfully")}catch(e){this.Pa("Error completing conversations initialization",e)}else Ba.error("Cannot complete initialization: remote config is null")}Pa(t,e){Ba.error(t,e),this._conversationsManager=null,this.Ma=!1}show(){this._conversationsManager?this._conversationsManager.show():Ba.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ia===!0&&!la(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var a=this;return cn((function*(){return a._conversationsManager?a._conversationsManager.sendMessage(t,e,n):(Ba.warn(Vs),null)}))()}getMessages(t,e){var n=this;return cn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(Ba.warn(Vs),null)}))()}markAsRead(t){var e=this;return cn((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ba.warn(Vs),null)}))()}getTickets(t){var e=this;return cn((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ba.warn(Vs),null)}))()}requestRestoreLink(t){var e=this;return cn((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ba.warn(Vs),null)}))()}restoreFromToken(t){var e=this;return cn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ba.warn(Vs),null)}))()}restoreFromUrlToken(){var t=this;return cn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ba.warn(Vs),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}fn(){var t;(t=this._conversationsManager)==null||t.setIdentity()}pn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},DK={logs:class{constructor(t){var e;this.Oa=!1,this.La=!1,this.Ae=Zt("[logs]"),this.Lr=[],this.Fa=[],this.bs=0,this.Aa=()=>{var n,a;this.bs=0,(n=this.$a)==null||n.onReconnect(),(a=this.Na)==null||a.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Oa=!0),Z&&tn(Z,"online",this.Aa)}Da(t,e,n,a){var r,s=(function(l,c){var u,h,p,m,v,y,b,x=(u=l?.flushIntervalMs)!==null&&u!==void 0?u:3e3,P=(h=l?.maxBufferSize)!==null&&h!==void 0?h:100,T=c!=null&&c.consoleCapture?void 0:(p=l?.maxLogsPerInterval)!==null&&p!==void 0?p:1e3,L=ke(T)?Math.max(P,2048):Math.max(P,T),E=l?.resourceAttributes;return{serviceName:(m=(v=E?.["service.name"])!==null&&v!==void 0?v:l?.serviceName)!==null&&m!==void 0?m:c?.serviceNameDefault,serviceVersion:(y=E?.["service.version"])!==null&&y!==void 0?y:l?.serviceVersion,environment:(b=E?.["deployment.environment"])!==null&&b!==void 0?b:l?.environment,resourceAttributes:E,beforeSend:l?.beforeSend,flushIntervalMs:x,maxBufferSize:P,maxQueueSize:L,maxBatchRecordsPerPost:100,rateCapWindowMs:x,maxLogsPerInterval:T,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,n);return[new FG(this.qa(t,e),s,this.Ae,(()=>this.ja()),(l=>l()),void 0,a),s]}Ba(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.$a||this.Ha!==e){var n;(n=this.$a)==null||n.reset(),this.Ha=e;var a=this.Da((()=>this.Lr),(r=>{this.Lr=r}));this.$a=a[0],this.Ua=a[1]}return this.$a}za(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Na||this.Wa!==e){var n;(n=this.Na)==null||n.reset(),this.Wa=e;var a=this.Da((()=>this.Fa),(r=>{this.Fa=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},DS);this.Na=a[0],this.Va=a[1]}return this.Na}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!nt(n)&&n&&(this.Oa=!0,this.loadIfEnabled())}reset(){var t,e;this.Lr=[],(t=this.$a)==null||t.reset(),this.Fa=[],(e=this.Na)==null||e.reset(),this.bs=0}captureLog(t){this.Ba().captureLog(t)}le(t){this.za().captureLog(t)}get logger(){return this.Za||(this.Za={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Za}flushLogs(t){t?this.Ga(t):(this.$a&&this.$a.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))),this.Na&&this.Na.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.Oa&&!this.La){var t=Be?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(n=>{var a;n||(a=t.logs)==null||!a.initializeLogs?this.Ae.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.La=!0)})):this.Ae.error(Lb)}else this.Ae.error("PostHog Extensions not found.")}}qa(t,e){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:a=>a===ki.LogsQueue?t():void 0,setPersistedProperty(a,r){var s;a===ki.LogsQueue&&e((s=r)!==null&&s!==void 0?s:[])},ht:a=>this.ht(a),getLibraryId:()=>en.LIB_NAME,getLibraryVersion:()=>en.LIB_VERSION}}ht(t){return new Promise((e=>{if(a6(this.bs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,a=s=>{n||(n=!0,clearTimeout(r),e(s))},r=setTimeout((()=>a({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Qa(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var l=s.statusCode;if(this.Ja(l),l>=200&&300>l)a({kind:"ok"});else if(l===413)a({kind:"too-large"});else if(l!==0&&l!==429&&500>l)a({kind:"fatal",error:new Error("logs request failed with status "+l)});else{var c;a({kind:"retry-later",error:(c=s.error)!==null&&c!==void 0?c:new Error("logs request failed with status "+l)})}}})}}))}Ja(t){(t!==0||this._instance.__loaded)&&(this.bs=r6(t,this.bs,3,(()=>this.Ae.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Ga(t){this.Lr.length>0&&this.Ka(t,this.Lr,this.Ua,en.LIB_NAME,(e=>{this.Lr=e})),this.Fa.length>0&&this.Ka(t,this.Fa,this.Va,DS,(e=>{this.Fa=e}))}Ka(t,e,n,a,r){if(e.length!==0){var s=e.map((c=>c.record));r([]);var l=TE(s,CE(n,en.LIB_NAME,en.LIB_VERSION),a,en.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Qa(),data:l,compression:"best-available",batchKey:"logs",transport:t})}}Qa(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}ja(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),a=n.windowId,r=n.sessionStartTimestamp,s=n.lastActivityTimestamp;e.sessionId=n.sessionId,e.windowId=a,nt(r)||(e.sessionStartTimestamp=r),nt(s)||(e.lastActivityTimestamp=s)}if(Be!=null&&(t=Be.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?ms(Be.location.href):Be.location.href),this._instance.featureFlags){var l=this._instance.featureFlags.getFlags();l&&l.length>0&&(e.activeFeatureFlags=l)}return e}}},IK={metrics:class{constructor(t){this.Ae=Zt("[metrics]"),this._instance=t}initialize(){}Ba(){var t,e,n,a,r,s,l,c,u,h=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.$a&&this.Ha===h||((e=this.$a)==null||e.reset(),this.Ha=h,this.$a=new UG(this.qa(),{serviceName:(a=(u=(n=h)==null?void 0:n.resourceAttributes)==null?void 0:u["service.name"])!==null&&a!==void 0?a:n?.serviceName,serviceVersion:(r=u?.["service.version"])!==null&&r!==void 0?r:n?.serviceVersion,environment:(s=u?.["deployment.environment"])!==null&&s!==void 0?s:n?.environment,resourceAttributes:u,beforeSend:n?.beforeSend,flushIntervalMs:(l=n?.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(c=n?.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3},this.Ae)),this.$a}count(t,e,n){e===void 0&&(e=1),this.Ba().count(t,e,n)}gauge(t,e,n){this.Ba().gauge(t,e,n)}histogram(t,e,n){this.Ba().histogram(t,e,n)}flush(t){if(!this.$a)return Promise.resolve();if(t){var e=this.$a.drainWindow();return e&&this.It(e,t),Promise.resolve()}return this.$a.flush().catch((n=>this.Ae.error("PostHog metrics flush failed:",n)))}reset(){var t;(t=this.$a)==null||t.reset()}qa(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},It:n=>e.It(n),getLibraryId:()=>en.LIB_NAME,getLibraryVersion:()=>en.LIB_VERSION}}It(t,e){return new Promise((n=>{var a=!1,r=l=>{a||(a=!0,clearTimeout(s),n(l))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(he({method:"POST",url:this.Ya(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(l){var c=l.statusCode;if(c>=200&&300>c)r({kind:"ok"});else if(c===413)r({kind:"too-large"});else if(c!==0&&c!==429&&500>c)r({kind:"fatal",error:new Error("metrics request failed with status "+c)});else{var u;r({kind:"retry-later",error:(u=l.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+c)})}}}))}))}Ya(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},MK=he({},Kf,wK,xK,PK,SK,CK,EK,TK,AK,RK,LK,DK,IK);Wa.__defaultExtensionClasses=he({},MK);var IS=(function(){en.SDK_DIST_CHANNEL="npm";var t=Ed[pl]=new Wa;return(function(){function e(){e.done||(e.done=!0,R6=!1,Mt(Ed,(function(n){n._dom_loaded()})))}xe!=null&&xe.addEventListener?xe.readyState==="complete"?e():tn(xe,"DOMContentLoaded",e,{capture:!1}):Z&&be.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();const NK="phc_nXhUfFbyrW9gNvp8iBL83eWPUhAuAYJgcgqUJxwUbBgj",OK="https://us.i.posthog.com";function jK(){if(typeof window>"u")return"web";if(Ga())return"mac-app";if(Of())return"win-app";const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"?"cli-localhost":"web"}function MS(t){IS.init(NK,{api_host:OK,capture_pageview:"history_change",autocapture:!1,disable_session_recording:!0,respect_dnt:!0,persistence:"localStorage"}),IS.register({shell:t})}function zK(){if(!(typeof window>"u"))try{const t=jK();if(t==="web"){MS(t);return}fetch("/functions/tokentracker-telemetry-pref").then(e=>e.ok?e.json():null).then(e=>{e&&e.disabled===!1&&MS(t)}).catch(()=>{})}catch{}}zK();const FK=L8([{path:"*",element:R.jsx(fG,{})}]);yR.createRoot(document.getElementById("root")).render(R.jsx(Cl.StrictMode,{children:R.jsx(nN,{children:R.jsx(hN,{children:R.jsx(cN,{children:R.jsx(w9,{children:R.jsx(x9,{children:R.jsx(V8,{router:FK})})})})})})}));export{Of as $,sY as A,DY as B,yY as C,CC as D,we as E,ep as F,rY as G,V7 as H,Id as I,Vp as J,lY as K,Ef as L,Q0 as M,SO as N,HY as O,$t as P,SC as Q,Cl as R,LV as S,kY as T,ZK as U,YK as V,A5 as W,x0 as X,V$ as Y,aT as Z,ko as _,bn as a,VC as a$,bY as a0,T$ as a1,IY as a2,oO as a3,In as a4,nY as a5,v9 as a6,Kl as a7,I$ as a8,ss as a9,P7 as aA,ZY as aB,qK as aC,hY as aD,Vl as aE,dY as aF,Nf as aG,xO as aH,H$ as aI,QZ as aJ,_O as aK,SY as aL,UK as aM,b7 as aN,C0 as aO,P0 as aP,Rp as aQ,Sx as aR,uY as aS,eT as aT,XC as aU,aY as aV,Dl as aW,Mp as aX,UC as aY,BC as aZ,$C as a_,VY as aa,vY as ab,iY as ac,O7 as ad,JK as ae,QK as af,JZ as ag,_Y as ah,ro as ai,tY as aj,MY as ak,cY as al,fY as am,R$ as an,KY as ao,YY as ap,a4 as aq,rP as ar,qY as as,ya as at,$l as au,D$ as av,Lp as aw,kb as ax,KW as ay,J_ as az,KK as b,qZ as b$,HC as b0,fO as b1,ZZ as b2,y_ as b3,KC as b4,k0 as b5,Ga as b6,gd as b7,zY as b8,OY as b9,tZ as bA,iZ as bB,nZ as bC,aZ as bD,rZ as bE,oZ as bF,sZ as bG,rb as bH,Fd as bI,dH as bJ,go as bK,db as bL,br as bM,f4 as bN,to as bO,no as bP,xZ as bQ,bZ as bR,Ai as bS,UZ as bT,eH as bU,FZ as bV,HZ as bW,VZ as bX,IZ as bY,wW as bZ,fr as b_,d4 as ba,ou as bb,Ka as bc,Xl as bd,Ql as be,yW as bf,XV as bg,vP as bh,mb as bi,eo as bj,Ei as bk,DZ as bl,A4 as bm,xW as bn,zZ as bo,nW as bp,XH as bq,DV as br,XY as bs,JY as bt,lZ as bu,cZ as bv,dZ as bw,gO as bx,QY as by,eZ as bz,kn as c,iF as c$,yv as c0,RZ as c1,EH as c2,LZ as c3,NZ as c4,wd as c5,YZ as c6,jZ as c7,tW as c8,ZH as c9,EZ as cA,xl as cB,WZ as cC,_4 as cD,gZ as cE,vZ as cF,_Z as cG,yZ as cH,bH as cI,y4 as cJ,uZ as cK,MZ as cL,g4 as cM,YV as cN,BZ as cO,_H as cP,GZ as cQ,OZ as cR,hb as cS,KZ as cT,$Z as cU,FY as cV,$Y as cW,UY as cX,BY as cY,eu as cZ,jO as c_,fs as ca,lN as cb,f0 as cc,jY as cd,NY as ce,cH as cf,yH as cg,tH as ch,hP as ci,Hf as cj,nH as ck,q_ as cl,h4 as cm,hZ as cn,iH as co,pZ as cp,wr as cq,u4 as cr,fZ as cs,oH as ct,sH as cu,F4 as cv,SZ as cw,PZ as cx,CZ as cy,TZ as cz,R7 as d,Cn as d0,QT as d1,Nt as d2,Fp as d3,Tj as d4,gj as d5,Cj as d6,uT as d7,jT as d8,La as d9,ub as dA,mP as dB,vb as dC,mY as dD,gY as dE,pY as dF,Yr as dG,WY as dH,Nd as da,G0 as db,Qz as dc,kF as dd,mF as de,tF as df,VF as dg,qT as dh,Ml as di,$p as dj,Sj as dk,S0 as dl,ps as dm,qx as dn,mZ as dp,Jp as dq,SW as dr,pb as ds,PW as dt,eW as du,AH as dv,AZ as dw,TH as dx,kZ as dy,wZ as dz,LY as e,Ot as f,TC as g,CY as h,Un as i,R as j,G7 as k,q7 as l,kd as m,EY as n,wY as o,eY as p,oY as q,k as r,AY as s,xY as t,EB as u,RY as v,PY as w,XK as x,Kt as y,TY as z};
|