PageSourceSearch

https://app.steel.dev/assets/index-CM2WFSq-.js

js steel.dev collected 2026-10-03 21:25:53 UTC 3,233,318 bytes, 560 lines download raw bytes

vendor: 4,700 bytes, lines 1-18
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/page-CeBr9QvP.js","assets/row-menu-H4itxXVO.js","assets/use-computers-I7OVH2Ba.js","assets/section-table-B7Scec6s.js","assets/computer-form-BQQ_IPNu.js","assets/configuration-resources-C8CAP1IR.js","assets/checkpoints-CVOnnQp7.js","assets/configuration-components-Ckhesk0g.js","assets/environments-fGX-VtYD.js","assets/secret-dialog-Czus680i.js","assets/secrets-9ELAAVGn.js","assets/page-ChH3AEj9.js","assets/page-9CEnUXvW.css"])))=>i.map(i=>d[i]);
2var QSe=Object.defineProperty;var vH=t=>{throw TypeError(t)};var JSe=(t,e,n)=>e in t?QSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var js=(t,e,n)=>JSe(t,typeof e!="symbol"?e+"":e,n),ZA=(t,e,n)=>e.has(t)||vH("Cannot "+n);var se=(t,e,n)=>(ZA(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>e.has(t)?vH("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),nt=(t,e,n,s)=>(ZA(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),Ft=(t,e,n)=>(ZA(t,e,"access private method"),n);var a_=(t,e,n,s)=>({set _(r){nt(t,e,r,n)},get _(){return se(t,e,s)}});(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"52ac1b9ca29a8318b79c0d63443825526ed22659"};var e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="31fdca1e-4dfb-45fc-a5d4-b3c605737e94",t._sentryDebugIdIdentifier="sentry-dbid-31fdca1e-4dfb-45fc-a5d4-b3c605737e94")}catch{}})();function ewe(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>s[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"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var o_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function wre(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function s(){return this instanceof s?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(s){var r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:function(){return t[s]}})}),n}var XA={exports:{}},Hx={};/**
3 * @license React
4 * react-jsx-runtime.production.js
5 *
6 * Copyright (c) Meta Platforms, Inc. and affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var xH;function twe(){if(xH)return Hx;xH=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,r,i){var a=null;if(i!==void 0&&(a=""+i),r.key!==void 0&&(a=""+r.key),"key"in r){i={};for(var o in r)o!=="key"&&(i[o]=r[o])}else i=r;return r=i.ref,{$$typeof:t,type:s,key:a,ref:r!==void 0?r:null,props:i}}return Hx.Fragment=e,Hx.jsx=n,Hx.jsxs=n,Hx}var yH;function nwe(){return yH||(yH=1,XA.exports=twe()),XA.exports}var c=nwe(),QA={exports:{}},Gx={},JA={exports:{}},eN={};/**
11 * @license React
12 * scheduler.production.js
13 *
14 * Copyright (c) Meta Platforms, Inc. and affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var bH;function swe(){return bH||(bH=1,(function(t){function e($,V){var B=$.length;$.push(V);e:for(;0<B;){var q=B-1>>>1,z=$[q];if(0<r(z,V))$[q]=V,$[B]=z,B=q;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var V=$[0],B=$.pop();if(B!==V){$[0]=B;e:for(var q=0,z=$.length,D=z>>>1;q<D;){var K=2*(q+1)-1,Y=$[K],J=K+1,ne=$[J];
vendor: 20,245 bytes, lines 18-44
18if(0>r(Y,B))J<z&&0>r(ne,Y)?($[q]=ne,$[J]=B,q=J):($[q]=Y,$[K]=B,q=K);else if(J<z&&0>r(ne,B))$[q]=ne,$[J]=B,q=J;else break e}}return V}function r($,V){var B=$.sortIndex-V.sortIndex;return B!==0?B:$.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],u=[],d=1,f=null,p=3,m=!1,v=!1,x=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function T($){for(var V=n(u);V!==null;){if(V.callback===null)s(u);else if(V.startTime<=$)s(u),V.sortIndex=V.expirationTime,e(l,V);else break;V=n(u)}}function k($){if(x=!1,T($),!v)if(n(l)!==null)v=!0,R||(R=!0,O());else{var V=n(u);V!==null&&G(k,V.startTime-$)}}var R=!1,I=-1,A=5,L=-1;function j(){return y?!0:!(t.unstable_now()-L<A)}function F(){if(y=!1,R){var $=t.unstable_now();L=$;var V=!0;try{e:{v=!1,x&&(x=!1,_(I),I=-1),m=!0;var B=p;try{t:{for(T($),f=n(l);f!==null&&!(f.expirationTime>$&&j());){var q=f.callback;if(typeof q=="function"){f.callback=null,p=f.priorityLevel;var z=q(f.expirationTime<=$);if($=t.unstable_now(),typeof z=="function"){f.callback=z,T($),V=!0;break t}f===n(l)&&s(l),T($)}else s(l);f=n(l)}if(f!==null)V=!0;else{var D=n(u);D!==null&&G(k,D.startTime-$),V=!1}}break e}finally{f=null,p=B,m=!1}V=void 0}}finally{V?O():R=!1}}}var O;if(typeof E=="function")O=function(){E(F)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,U=M.port2;M.port1.onmessage=F,O=function(){U.postMessage(null)}}else O=function(){S(F,0)};function G($,V){I=S(function(){$(t.unstable_now())},V)}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_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"):A=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_next=function($){switch(p){case 1:case 2:case 3:var V=3;break;default:V=p}var B=p;p=V;try{return $()}finally{p=B}},t.unstable_requestPaint=function(){y=!0},t.unstable_runWithPriority=function($,V){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var B=p;p=$;try{return V()}finally{p=B}},t.unstable_scheduleCallback=function($,V,B){var q=t.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?q+B:q):B=q,$){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=B+z,$={id:d++,callback:V,priorityLevel:$,startTime:B,expirationTime:z,sortIndex:-1},B>q?($.sortIndex=B,e(u,$),n(l)===null&&$===n(u)&&(x?(_(I),I=-1):x=!0,G(k,B-q))):($.sortIndex=z,e(l,$),v||m||(v=!0,R||(R=!0,O()))),$},t.unstable_shouldYield=j,t.unstable_wrapCallback=function($){var V=p;return function(){var B=p;p=V;try{return $.apply(this,arguments)}finally{p=B}}}})(eN)),eN}var SH;function rwe(){return SH||(SH=1,JA.exports=swe()),JA.exports}var tN={exports:{}},un={};/**
19 * @license React
20 * react.production.js
21 *
22 * Copyright (c) Meta Platforms, Inc. and affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */var wH;function iwe(){if(wH)return un;wH=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),p=Symbol.iterator;function m(D){return D===null||typeof D!="object"?null:(D=p&&D[p]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function S(D,K,Y){this.props=D,this.context=K,this.refs=y,this.updater=Y||v}S.prototype.isReactComponent={},S.prototype.setState=function(D,K){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,K,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function _(){}_.prototype=S.prototype;function E(D,K,Y){this.props=D,this.context=K,this.refs=y,this.updater=Y||v}var T=E.prototype=new _;T.constructor=E,x(T,S.prototype),T.isPureReactComponent=!0;var k=Array.isArray;function R(){}var I={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function L(D,K,Y){var J=Y.ref;return{$$typeof:t,type:D,key:K,ref:J!==void 0?J:null,props:Y}}function j(D,K){return L(D.type,K,D.props)}function F(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function O(D){var K={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(Y){return K[Y]})}var M=/\/+/g;function U(D,K){return typeof D=="object"&&D!==null&&D.key!=null?O(""+D.key):K.toString(36)}function G(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(R,R):(D.status="pending",D.then(function(K){D.status==="pending"&&(D.status="fulfilled",D.value=K)},function(K){D.status==="pending"&&(D.status="rejected",D.reason=K)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function $(D,K,Y,J,ne){var Q=typeof D;(Q==="undefined"||Q==="boolean")&&(D=null);var ee=!1;if(D===null)ee=!0;else switch(Q){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(D.$$typeof){case t:case e:ee=!0;break;case d:return ee=D._init,$(ee(D._payload),K,Y,J,ne)}}if(ee)return ne=ne(D),ee=J===""?"."+U(D,0):J,k(ne)?(Y="",ee!=null&&(Y=ee.replace(M,"$&/")+"/"),$(ne,K,Y,"",function(ye){return ye})):ne!=null&&(F(ne)&&(ne=j(ne,Y+(ne.key==null||D&&D.key===ne.key?"":(""+ne.key).replace(M,"$&/")+"/")+ee)),K.push(ne)),1;ee=0;var te=J===""?".":J+":";if(k(D))for(var ue=0;ue<D.length;ue++)J=D[ue],Q=te+U(J,ue),ee+=$(J,K,Y,Q,ne);else if(ue=m(D),typeof ue=="function")for(D=ue.call(D),ue=0;!(J=D.next()).done;)J=J.value,Q=te+U(J,ue++),ee+=$(J,K,Y,Q,ne);else if(Q==="object"){if(typeof D.then=="function")return $(G(D),K,Y,J,ne);throw K=String(D),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return ee}function V(D,K,Y){if(D==null)return D;var J=[],ne=0;return $(D,J,"","",function(Q){return K.call(Y,Q,ne++)}),J}function B(D){if(D._status===-1){var K=D._result;K=K(),K.then(function(Y){(D._status===0||D._status===-1)&&(D._status=1,D._result=Y)},function(Y){(D._status===0||D._status===-1)&&(D._status=2,D._result=Y)}),D._status===-1&&(D._status=0,D._result=K)}if(D._status===1)return D._result.default;throw D._result}var q=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},z={map:V,forEach:function(D,K,Y){V(D,function(){K.apply(this,arguments)},Y)},count:function(D){var K=0;return V(D,function(){K++}),K},toArray:function(D){return V(D,function(K){return K})||[]},only:function(D){if(!F(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return un.Activity=f,un.Children=z,un.Component=S,un.Fragment=n,un.Profiler=r,un.PureComponent=E,un.StrictMode=s,un.Suspense=l,un.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,un.__COMPILER_RUNTIME={__proto__:null,c:function(D){return I.H.useMemoCache(D)}},un.cache=function(D){return function(){return D.apply(null,arguments)}},un.cacheSignal=function(){return null},un.cloneElement=function(D,K,Y){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var J=x({},D.props),ne=D.key;if(K!=null)for(Q in K.key!==void 0&&(ne=""+K.key),K)!A.call(K,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&K.ref===void 0||(J[Q]=K[Q]);var Q=arguments.length-2;if(Q===1)J.children=Y;else if(1<Q){for(var ee=Array(Q),te=0;te<Q;te++)ee[te]=arguments[te+2];J.children=ee}return L(D.type,ne,J)},un.createContext=function(D){return D={$$typeof:a,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:i,_context:D},D},un.createElement=function(D,K,Y){var J,ne={},Q=null;if(K!=null)for(J in K.key!==void 0&&(Q=""+K.key),K)A.call(K,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ne[J]=K[J]);var ee=arguments.length-2;if(ee===1)ne.children=Y;else if(1<ee){for(var te=Array(ee),ue=0;ue<ee;ue++)te[ue]=arguments[ue+2];ne.children=te}if(D&&D.defaultProps)for(J in ee=D.defaultProps,ee)ne[J]===void 0&&(ne[J]=ee[J]);return L(D,Q,ne)},un.createRef=function(){return{current:null}},un.forwardRef=function(D){return{$$typeof:o,render:D}},un.isValidElement=F,un.lazy=function(D){return{$$typeof:d,_payload:{_status:-1,_result:D},_init:B}},un.memo=function(D,K){return{$$typeof:u,type:D,compare:K===void 0?null:K}},un.startTransition=function(D){var K=I.T,Y={};I.T=Y;try{var J=D(),ne=I.S;ne!==null&&ne(Y,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(R,q)}catch(Q){q(Q)}finally{K!==null&&Y.types!==null&&(K.types=Y.types),I.T=K}},un.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},un.use=function(D){return I.H.use(D)},un.useActionState=function(D,K,Y){return I.H.useActionState(D,K,Y)},un.useCallback=function(D,K){return I.H.useCallback(D,K)},un.useContext=function(D){return I.H.useContext(D)},un.useDebugValue=function(){},un.useDeferredValue=function(D,K){return I.H.useDeferredValue(D,K)},un.useEffect=function(D,K){return I.H.useEffect(D,K)},un.useEffectEvent=function(D){return I.H.useEffectEvent(D)},un.useId=function(){return I.H.useId()},un.useImperativeHandle=function(D,K,Y){return I.H.useImperativeHandle(D,K,Y)},un.useInsertionEffect=function(D,K){return I.H.useInsertionEffect(D,K)},un.useLayoutEffect=function(D,K){return I.H.useLayoutEffect(D,K)},un.useMemo=function(D,K){return I.H.useMemo(D,K)},un.useOptimistic=function(D,K){return I.H.useOptimistic(D,K)},un.useReducer=function(D,K,Y){return I.H.useReducer(D,K,Y)},un.useRef=function(D){return I.H.useRef(D)},un.useState=function(D){return I.H.useState(D)},un.useSyncExternalStore=function(D,K,Y){return I.H.useSyncExternalStore(D,K,Y)},un.useTransition=function(){return I.H.useTransition()},un.version="19.2.8",un}var _H;function I5(){return _H||(_H=1,tN.exports=iwe()),tN.exports}var nN={exports:{}},Gi={};/**
27 * @license React
28 * react-dom.production.js
29 *
30 * Copyright (c) Meta Platforms, Inc. and affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var EH;function awe(){if(EH)return Gi;EH=1;var t=I5();function e(l){var u="https://react.dev/errors/"+l;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function i(l,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:f==null?null:""+f,children:l,containerInfo:u,implementation:d}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,u){if(l==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Gi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Gi.createPortal=function(l,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(e(299));return i(l,u,null,d)},Gi.flushSync=function(l){var u=a.T,d=s.p;try{if(a.T=null,s.p=2,l)return l()}finally{a.T=u,s.p=d,s.d.f()}},Gi.preconnect=function(l,u){typeof l=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,s.d.C(l,u))},Gi.prefetchDNS=function(l){typeof l=="string"&&s.d.D(l)},Gi.preinit=function(l,u){if(typeof l=="string"&&u&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,m=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?s.d.S(l,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:p,fetchPriority:m}):d==="script"&&s.d.X(l,{crossOrigin:f,integrity:p,fetchPriority:m,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Gi.preinitModule=function(l,u){if(typeof l=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(u.as,u.crossOrigin);s.d.M(l,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&s.d.M(l)},Gi.preload=function(l,u){if(typeof l=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin);s.d.L(l,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},Gi.preloadModule=function(l,u){if(typeof l=="string")if(u){var d=o(u.as,u.crossOrigin);s.d.m(l,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else s.d.m(l)},Gi.requestFormReset=function(l){s.d.r(l)},Gi.unstable_batchedUpdates=function(l,u){return l(u)},Gi.useFormState=function(l,u,d){return a.H.useFormState(l,u,d)},Gi.useFormStatus=function(){return a.H.useHostTransitionStatus()},Gi.version="19.2.8",Gi}var CH;function _re(){if(CH)return nN.exports;CH=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),nN.exports=awe(),nN.exports}/**
35 * @license React
36 * react-dom-client.production.js
37 *
38 * Copyright (c) Meta Platforms, Inc. and affiliates.
39 *
40 * This source code is licensed under the MIT license found in the
41 * LICENSE file in the root directory of this source tree.
42 */var TH;function owe(){if(TH)return Gx;TH=1;var t=rwe(),e=I5(),n=_re();function s(h){var g="https://react.dev/errors/"+h;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)g+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+h+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function i(h){var g=h,b=h;if(h.alternate)for(;g.return;)g=g.return;else{h=g;do g=h,(g.flags&4098)!==0&&(b=g.return),h=g.return;while(h)}return g.tag===3?b:null}function a(h){if(h.tag===13){var g=h.memoizedState;if(g===null&&(h=h.alternate,h!==null&&(g=h.memoizedState)),g!==null)return g.dehydrated}return null}function o(h){if(h.tag===31){var g=h.memoizedState;if(g===null&&(h=h.alternate,h!==null&&(g=h.memoizedState)),g!==null)return g.dehydrated}return null}function l(h){if(i(h)!==h)throw Error(s(188))}function u(h){var g=h.alternate;if(!g){if(g=i(h),g===null)throw Error(s(188));return g!==h?null:h}for(var b=h,C=g;;){var N=b.return;if(N===null)break;var P=N.alternate;if(P===null){if(C=N.return,C!==null){b=C;continue}break}if(N.child===P.child){for(P=N.child;P;){if(P===b)return l(N),h;if(P===C)return l(N),g;P=P.sibling}throw Error(s(188))}if(b.return!==C.return)b=N,C=P;else{for(var W=!1,X=N.child;X;){if(X===b){W=!0,b=N,C=P;break}if(X===C){W=!0,C=N,b=P;break}X=X.sibling}if(!W){for(X=P.child;X;){if(X===b){W=!0,b=P,C=N;break}if(X===C){W=!0,C=P,b=N;break}X=X.sibling}if(!W)throw Error(s(189))}}if(b.alternate!==C)throw Error(s(190))}if(b.tag!==3)throw Error(s(188));return b.stateNode.current===b?h:g}function d(h){var g=h.tag;if(g===5||g===26||g===27||g===6)return h;for(h=h.child;h!==null;){if(g=d(h),g!==null)return g;h=h.sibling}return null}var f=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function O(h){return h===null||typeof h!="object"?null:(h=F&&h[F]||h["@@iterator"],typeof h=="function"?h:null)}var M=Symbol.for("react.client.reference");function U(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===M?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case x:return"Fragment";case S:return"Profiler";case y:return"StrictMode";case k:return"Suspense";case R:return"SuspenseList";case L:return"Activity"}if(typeof h=="object")switch(h.$$typeof){case v:return"Portal";case E:return h.displayName||"Context";case _:return(h._context.displayName||"Context")+".Consumer";case T:var g=h.render;return h=h.displayName,h||(h=g.displayName||g.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case I:return g=h.displayName||null,g!==null?g:U(h.type)||"Memo";case A:g=h._payload,h=h._init;try{return U(h(g))}catch{}}return null}var G=Array.isArray,$=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},q=[],z=-1;function D(h){return{current:h}}function K(h){0>z||(h.current=q[z],q[z]=null,z--)}function Y(h,g){z++,q[z]=h.current,h.current=g}var J=D(null),ne=D(null),Q=D(null),ee=D(null);function te(h,g){switch(Y(Q,g),Y(ne,h),Y(J,null),g.nodeType){case 9:case 11:h=(h=g.documentElement)&&(h=h.namespaceURI)?UV(h):0;break;default:if(h=g.tagName,g=g.namespaceURI)g=UV(g),h=BV(g,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}K(J),Y(J,h)}function ue(){K(J),K(ne),K(Q)}function ye(h){h.memoizedState!==null&&Y(ee,h);var g=J.current,b=BV(g,h.type);g!==b&&(Y(ne,h),Y(J,b))}function je(h){ne.current===h&&(K(J),K(ne)),ee.current===h&&(K(ee),Ux._currentValue=B)}var Re,me;function Ce(h){if(Re===void 0)try{throw Error()}catch(b){var g=b.stack.trim().match(/\n( *(at )?)/);Re=g&&g[1]||"",me=-1<b.stack.indexOf(`
43    at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
44`+Re+h+me}var Xe=!1;function he(h,g){if(!h||Xe)return"";Xe=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var C={DetermineComponentFrameRoot:function(){try{if(g){var Be=function(){throw Error()};if(Object.defineProperty(Be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Be,[])}catch(Te){var _e=Te}Reflect.construct(h,[],Be)}else{try{Be.call()}catch(Te){_e=Te}h.call(Be.prototype)}}else{try{throw Error()}catch(Te){_e=Te}(Be=h())&&typeof Be.catch=="function"&&Be.catch(function(){})}}
vendor: 8,610 bytes, lines 44-49
44catch(Te){if(Te&&_e&&typeof Te.stack=="string")return[Te.stack,_e.stack]}return[null,null]}};C.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(C.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(C.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var P=C.DetermineComponentFrameRoot(),W=P[0],X=P[1];if(W&&X){var oe=W.split(`
45`),Se=X.split(`
46`);for(N=C=0;C<oe.length&&!oe[C].includes("DetermineComponentFrameRoot");)C++;for(;N<Se.length&&!Se[N].includes("DetermineComponentFrameRoot");)N++;if(C===oe.length||N===Se.length)for(C=oe.length-1,N=Se.length-1;1<=C&&0<=N&&oe[C]!==Se[N];)N--;for(;1<=C&&0<=N;C--,N--)if(oe[C]!==Se[N]){if(C!==1||N!==1)do if(C--,N--,0>N||oe[C]!==Se[N]){var Pe=`
47`+oe[C].replace(" at new "," at ");return h.displayName&&Pe.includes("<anonymous>")&&(Pe=Pe.replace("<anonymous>",h.displayName)),Pe}while(1<=C&&0<=N);break}}}finally{Xe=!1,Error.prepareStackTrace=b}return(b=h?h.displayName||h.name:"")?Ce(b):""}function De(h,g){switch(h.tag){case 26:case 27:case 5:return Ce(h.type);case 16:return Ce("Lazy");case 13:return h.child!==g&&g!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return he(h.type,!1);case 11:return he(h.type.render,!1);case 1:return he(h.type,!0);case 31:return Ce("Activity");default:return""}}function Ge(h){try{var g="",b=null;do g+=De(h,b),b=h,h=h.return;while(h);return g}catch(C){return`
48Error generating stack: `+C.message+`
49`+C.stack}}var Je=Object.prototype.hasOwnProperty,Le=t.unstable_scheduleCallback,qe=t.unstable_cancelCallback,et=t.unstable_shouldYield,Ct=t.unstable_requestPaint,Ke=t.unstable_now,dt=t.unstable_getCurrentPriorityLevel,Xt=t.unstable_ImmediatePriority,_n=t.unstable_UserBlockingPriority,Dt=t.unstable_NormalPriority,nn=t.unstable_LowPriority,fn=t.unstable_IdlePriority,Tt=t.log,Ie=t.unstable_setDisableYieldValue,Z=null,ie=null;function le(h){if(typeof Tt=="function"&&Ie(h),ie&&typeof ie.setStrictMode=="function")try{ie.setStrictMode(Z,h)}catch{}}var Ee=Math.clz32?Math.clz32:Ye,ke=Math.log,Ae=Math.LN2;function Ye(h){return h>>>=0,h===0?32:31-(ke(h)/Ae|0)|0}var Qe=256,ft=262144,Me=4194304;function Ut(h){var g=h&42;if(g!==0)return g;switch(h&-h){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return h&261888;case 262144:case 524288:case 1048576:case 2097152:return h&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return h&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return h}}function Nn(h,g,b){var C=h.pendingLanes;if(C===0)return 0;var N=0,P=h.suspendedLanes,W=h.pingedLanes;h=h.warmLanes;var X=C&134217727;return X!==0?(C=X&~P,C!==0?N=Ut(C):(W&=X,W!==0?N=Ut(W):b||(b=X&~h,b!==0&&(N=Ut(b))))):(X=C&~P,X!==0?N=Ut(X):W!==0?N=Ut(W):b||(b=C&~h,b!==0&&(N=Ut(b)))),N===0?0:g!==0&&g!==N&&(g&P)===0&&(P=N&-N,b=g&-g,P>=b||P===32&&(b&4194048)!==0)?g:N}function Cs(h,g){return(h.pendingLanes&~(h.suspendedLanes&~h.pingedLanes)&g)===0}function $o(h,g){switch(h){case 1:case 2:case 4:case 8:case 64:return g+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gu(){var h=Me;return Me<<=1,(Me&62914560)===0&&(Me=4194304),h}function Ti(h){for(var g=[],b=0;31>b;b++)g.push(h);return g}function Pa(h,g){h.pendingLanes|=g,g!==268435456&&(h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0)}function bl(h,g,b,C,N,P){var W=h.pendingLanes;h.pendingLanes=b,h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0,h.expiredLanes&=b,h.entangledLanes&=b,h.errorRecoveryDisabledLanes&=b,h.shellSuspendCounter=0;var X=h.entanglements,oe=h.expirationTimes,Se=h.hiddenUpdates;for(b=W&~b;0<b;){var Pe=31-Ee(b),Be=1<<Pe;X[Pe]=0,oe[Pe]=-1;var _e=Se[Pe];if(_e!==null)for(Se[Pe]=null,Pe=0;Pe<_e.length;Pe++){var Te=_e[Pe];Te!==null&&(Te.lane&=-536870913)}b&=~Be}C!==0&&Dr(h,C,0),P!==0&&N===0&&h.tag!==0&&(h.suspendedLanes|=P&~(W&~g))}function Dr(h,g,b){h.pendingLanes|=g,h.suspendedLanes&=~g;var C=31-Ee(g);h.entangledLanes|=g,h.entanglements[C]=h.entanglements[C]|1073741824|b&261930}function Zh(h,g){var b=h.entangledLanes|=g;for(h=h.entanglements;b;){var C=31-Ee(b),N=1<<C;N&g|h[C]&g&&(h[C]|=g),b&=~N}}function ae(h,g){var b=g&-g;return b=(b&42)!==0?1:de(b),(b&(h.suspendedLanes|g))!==0?0:b}function de(h){switch(h){case 2:h=1;break;case 8:h=4;break;case 32:h=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:h=128;break;case 268435456:h=134217728;break;default:h=0}return h}function ve(h){return h&=-h,2<h?8<h?(h&134217727)!==0?32:268435456:8:2}function ze(){var h=V.p;return h!==0?h:(h=window.event,h===void 0?32:uH(h.type))}function We(h,g){var b=V.p;try{return V.p=h,g()}finally{V.p=b}}var xt=Math.random().toString(36).slice(2),ut="__reactFiber$"+xt,It="__reactProps$"+xt,ct="__reactContainer$"+xt,Lt="__reactEvents$"+xt,Vt="__reactListeners$"+xt,ce="__reactHandles$"+xt,be="__reactResources$"+xt,Fe="__reactMarker$"+xt;function tt(h){delete h[ut],delete h[It],delete h[Lt],delete h[Vt],delete h[ce]}function st(h){var g=h[ut];if(g)return g;for(var b=h.parentNode;b;){if(g=b[ct]||b[ut]){if(b=g.alternate,g.child!==null||b!==null&&b.child!==null)for(h=KV(h);h!==null;){if(b=h[ut])return b;h=KV(h)}return g}h=b,b=h.parentNode}return null}function bt(h){if(h=h[ut]||h[ct]){var g=h.tag;if(g===5||g===6||g===13||g===31||g===26||g===27||g===3)return h}return null}function yt(h){var g=h.tag;if(g===5||g===26||g===27||g===6)return h.stateNode;throw Error(s(33))}function Ht(h){var g=h[be];return g||(g=h[be]={hoistableStyles:new Map,hoistableScripts:new Map}),g}function Pt(h){h[Fe]=!0}var as=new Set,gs={};function pn(h,g){vs(h,g),vs(h+"Capture",g)}function vs(h,g){for(gs[h]=g,h=0;h<g.length;h++)as.add(g[h])}var fi=RegExp("^[: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]*$"),Ma={},pr={};function rr(h){return Je.call(pr,h)?!0:Je.call(Ma,h)?!1:fi.test(h)?pr[h]=!0:(Ma[h]=!0,!1)}function ki(h,g,b){if(rr(g))if(b===null)h.removeAttribute(g);else{switch(typeof b){case"undefined":case"function":case"symbol":h.removeAttribute(g);return;case"boolean":var C=g.toLowerCase().slice(0,5);if(C!=="data-"&&C!=="aria-"){h.removeAttribute(g);return}}h.setAttribute(g,""+b)}}function ca(h,g,b){if(b===null)h.removeAttribute(g);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(g);return}h.setAttribute(g,""+b)}}function qt(h,g,b,C){if(C===null)h.removeAttribute(b);else{switch(typeof C){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(b);return}h.setAttributeNS(g,b,""+C)}}function qn(h){switch(typeof h){case"bigint":case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function ni(h){var g=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(g==="checkbox"||g==="radio")}function ua(h,g,b){var C=Object.getOwnPropertyDescriptor(h.constructor.prototype,g);if(!h.hasOwnProperty(g)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var N=C.get,P=C.set;return Object.defineProperty(h,g,{configurable:!0,get:function(){return N.call(this)},set:function(W){b=""+W,P.call(this,W)}}),Object.defineProperty(h,g,{enumerable:C.enumerable}),{getValue:function(){return b},setValue:function(W){b=""+W},stopTracking:function(){h._valueTracker=null,delete h[g]}}}}function rg(h){if(!h._valueTracker){var g=ni(h)?"checked":"value";h._valueTracker=ua(h,g,""+h[g])}}function ig(h){if(!h)return!1;var g=h._valueTracker;if(!g)return!0;var b=g.getValue(),C="";return h&&(C=ni(h)?h.checked?"true":"false":h.value),h=C,h!==b?(g.
vendor: 4,665 bytes, line 49
49setValue(h),!0):!1}function xs(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}var vu=/[\n"\\]/g;function da(h){return h.replace(vu,function(g){return"\\"+g.charCodeAt(0).toString(16)+" "})}function nx(h,g,b,C,N,P,W,X){h.name="",W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?h.type=W:h.removeAttribute("type"),g!=null?W==="number"?(g===0&&h.value===""||h.value!=g)&&(h.value=""+qn(g)):h.value!==""+qn(g)&&(h.value=""+qn(g)):W!=="submit"&&W!=="reset"||h.removeAttribute("value"),g!=null?GR(h,W,qn(g)):b!=null?GR(h,W,qn(b)):C!=null&&h.removeAttribute("value"),N==null&&P!=null&&(h.defaultChecked=!!P),N!=null&&(h.checked=N&&typeof N!="function"&&typeof N!="symbol"),X!=null&&typeof X!="function"&&typeof X!="symbol"&&typeof X!="boolean"?h.name=""+qn(X):h.removeAttribute("name")}function PU(h,g,b,C,N,P,W,X){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(h.type=P),g!=null||b!=null){if(!(P!=="submit"&&P!=="reset"||g!=null)){rg(h);return}b=b!=null?""+qn(b):"",g=g!=null?""+qn(g):b,X||g===h.value||(h.value=g),h.defaultValue=g}C=C??N,C=typeof C!="function"&&typeof C!="symbol"&&!!C,h.checked=X?h.checked:!!C,h.defaultChecked=!!C,W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"&&(h.name=W),rg(h)}function GR(h,g,b){g==="number"&&xs(h.ownerDocument)===h||h.defaultValue===""+b||(h.defaultValue=""+b)}function ag(h,g,b,C){if(h=h.options,g){g={};for(var N=0;N<b.length;N++)g["$"+b[N]]=!0;for(b=0;b<h.length;b++)N=g.hasOwnProperty("$"+h[b].value),h[b].selected!==N&&(h[b].selected=N),N&&C&&(h[b].defaultSelected=!0)}else{for(b=""+qn(b),g=null,N=0;N<h.length;N++){if(h[N].value===b){h[N].selected=!0,C&&(h[N].defaultSelected=!0);return}g!==null||h[N].disabled||(g=h[N])}g!==null&&(g.selected=!0)}}function MU(h,g,b){if(g!=null&&(g=""+qn(g),g!==h.value&&(h.value=g),b==null)){h.defaultValue!==g&&(h.defaultValue=g);return}h.defaultValue=b!=null?""+qn(b):""}function DU(h,g,b,C){if(g==null){if(C!=null){if(b!=null)throw Error(s(92));if(G(C)){if(1<C.length)throw Error(s(93));C=C[0]}b=C}b==null&&(b=""),g=b}b=qn(g),h.defaultValue=b,C=h.textContent,C===b&&C!==""&&C!==null&&(h.value=C),rg(h)}function og(h,g){if(g){var b=h.firstChild;if(b&&b===h.lastChild&&b.nodeType===3){b.nodeValue=g;return}}h.textContent=g}var qbe=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function OU(h,g,b){var C=g.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?C?h.setProperty(g,""):g==="float"?h.cssFloat="":h[g]="":C?h.setProperty(g,b):typeof b!="number"||b===0||qbe.has(g)?g==="float"?h.cssFloat=b:h[g]=(""+b).trim():h[g]=b+"px"}function $U(h,g,b){if(g!=null&&typeof g!="object")throw Error(s(62));if(h=h.style,b!=null){for(var C in b)!b.hasOwnProperty(C)||g!=null&&g.hasOwnProperty(C)||(C.indexOf("--")===0?h.setProperty(C,""):C==="float"?h.cssFloat="":h[C]="");for(var N in g)C=g[N],g.hasOwnProperty(N)&&b[N]!==C&&OU(h,N,C)}else for(var P in g)g.hasOwnProperty(P)&&OU(h,P,g[P])}function WR(h){if(h.indexOf("-")===-1)return!1;switch(h){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Kbe=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
49dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ybe=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function XS(h){return Ybe.test(""+h)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":h}function xu(){}var qR=null;function KR(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var lg=null,cg=null;function FU(h){var g=bt(h);if(g&&(h=g.stateNode)){var b=h[It]||null;e:switch(h=g.stateNode,g.type){case"input":if(nx(h,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),g=b.name,b.type==="radio"&&g!=null){for(b=h;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+da(""+g)+'"][type="radio"]'),g=0;g<b.length;g++){var C=b[g];if(C!==h&&C.form===h.form){var N=C[It]||null;if(!N)throw Error(s(90));nx(C,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(g=0;g<b.length;g++)C=b[g],C.form===h.form&&ig(C)}break e;case"textarea":MU(h,b.value,b.defaultValue);break e;case"select":g=b.value,g!=null&&ag(h,!!b.multiple,g,!1)}}}var YR=!1;function UU(h,g,b){if(YR)return h(g,b);YR=!0;try{var C=h(g);return C}finally{if(YR=!1,(lg!==null||cg!==null)&&($w(),lg&&(g=lg,h=cg,cg=lg=null,FU(g),h)))for(g=0;g<h.length;g++)FU(h[g])}}function sx(h,g){var b=h.stateNode;if(b===null)return null;var C=b[It]||null;if(C===null)return null;b=C[g];e:switch(g){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(C=!C.disabled)||(h=h.type,C=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!C;break e;default:h=!1}if(h)return null;if(b&&typeof b!="function")throw Error(s(231,g,typeof b));return b}var yu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ZR=!1;if(yu)try{var rx={};Object.defineProperty(rx,"passive",{get:function(){ZR=!0}}),window.addEventListener("test",rx,rx),window.removeEventListener("test",rx,rx)}catch{ZR=!1}var Ud=null,XR=null,QS=null;function BU(){if(QS)return QS;var h,g=XR,b=g.length,C,N="value"in Ud?Ud.value:Ud.textContent,P=N.length;for(h=0;h<b&&g[h]===N[h];h++);var W=b-h;for(C=1;C<=W&&g[b-C]===N[P-C];C++);return QS=N.slice(h,1<C?1-C:void 0)}function JS(h){var g=h.keyCode;
vendor: 6,077 bytes, line 49
49return"charCode"in h?(h=h.charCode,h===0&&g===13&&(h=13)):h=g,h===10&&(h=13),32<=h||h===13?h:0}function ew(){return!0}function zU(){return!1}function Da(h){function g(b,C,N,P,W){this._reactName=b,this._targetInst=N,this.type=C,this.nativeEvent=P,this.target=W,this.currentTarget=null;for(var X in h)h.hasOwnProperty(X)&&(b=h[X],this[X]=b?b(P):P[X]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?ew:zU,this.isPropagationStopped=zU,this}return f(g.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=ew)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=ew)},persist:function(){},isPersistent:ew}),g}var Xh={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tw=Da(Xh),ix=f({},Xh,{view:0,detail:0}),Zbe=Da(ix),QR,JR,ax,nw=f({},ix,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:t3,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==ax&&(ax&&h.type==="mousemove"?(QR=h.screenX-ax.screenX,JR=h.screenY-ax.screenY):JR=QR=0,ax=h),QR)},movementY:function(h){return"movementY"in h?h.movementY:JR}}),VU=Da(nw),Xbe=f({},nw,{dataTransfer:0}),Qbe=Da(Xbe),Jbe=f({},ix,{relatedTarget:0}),e3=Da(Jbe),e2e=f({},Xh,{animationName:0,elapsedTime:0,pseudoElement:0}),t2e=Da(e2e),n2e=f({},Xh,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),s2e=Da(n2e),r2e=f({},Xh,{data:0}),HU=Da(r2e),i2e={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a2e={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},o2e={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function l2e(h){var g=this.nativeEvent;return g.getModifierState?g.getModifierState(h):(h=o2e[h])?!!g[h]:!1}function t3(){return l2e}var c2e=f({},ix,{key:function(h){if(h.key){var g=i2e[h.key]||h.key;if(g!=="Unidentified")return g}return h.type==="keypress"?(h=JS(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?a2e[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:t3,charCode:function(h){return h.type==="keypress"?JS(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?JS(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),u2e=Da(c2e),d2e=f({},nw,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),GU=Da(d2e),f2e=f({},ix,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:t3}),h2e=Da(f2e),p2e=f({},Xh,{propertyName:0,elapsedTime:0,pseudoElement:0}),m2e=Da(p2e),g2e=f({},nw,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),v2e=Da(g2e),x2e=f({},Xh,{newState:0,oldState:0}),y2e=Da(x2e),b2e=[9,13,27,32],n3=yu&&"CompositionEvent"in window,ox=null;yu&&"documentMode"in document&&(ox=document.documentMode);var S2e=yu&&"TextEvent"in window&&!ox,WU=yu&&(!n3||ox&&8<ox&&11>=ox),qU=" ",KU=!1;function YU(h,g){switch(h){case"keyup":return b2e.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ZU(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var ug=!1;function w2e(h,g){switch(h){case"compositionend":return ZU(g);case"keypress":return g.which!==32?null:(KU=!0,qU);case"textInput":return h=g.data,h===qU&&KU?null:h;default:return null}}function _2e(h,g){if(ug)return h==="compositionend"||!n3&&YU(h,g)?(h=BU(),QS=XR=Ud=null,ug=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1<g.char.length)return g.char;if(g.which)return String.fromCharCode(g.which)}return null;case"compositionend":return WU&&g.locale!=="ko"?null:g.data;default:return null}}var E2e={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function XU(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g==="input"?!!E2e[h.type]:g==="textarea"}function QU(h,g,b,C){lg?cg?cg.push(C):cg=[C]:lg=C,g=Gw(g,"onChange"),0<g.length&&(b=new tw("onChange","change",null,b,C),h.push({event:b,listeners:g}))}var lx=null,cx=null;function C2e(h){PV(h,0)}function sw(h){var g=yt(h);if(ig(g))return h}function JU(h,g){if(h==="change")return g}var eB=!1;if(yu){var s3;if(yu){var r3="oninput"in document;if(!r3){var tB=document.createElement("div");tB.setAttribute("oninput","return;"),r3=typeof tB.oninput=="function"}s3=r3}else s3=!1;eB=s3&&(!document.documentMode||9<document.documentMode)}function nB(){lx&&(lx.detachEvent("onpropertychange",sB),cx=lx=null)}function sB(h){if(h.propertyName==="value"&&sw(cx)){var g=[];QU(g,cx,h,KR(h)),UU(C2e,g)}}function T2e(h,g,b){h==="focusin"?(nB(),lx=g,cx=b,lx.attachEvent("onpropertychange",sB)):h==="focusout"&&nB()}
vendor: 24,843 bytes, line 49
49function k2e(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return sw(cx)}function R2e(h,g){if(h==="click")return sw(g)}function A2e(h,g){if(h==="input"||h==="change")return sw(g)}function N2e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var no=typeof Object.is=="function"?Object.is:N2e;function ux(h,g){if(no(h,g))return!0;if(typeof h!="object"||h===null||typeof g!="object"||g===null)return!1;var b=Object.keys(h),C=Object.keys(g);if(b.length!==C.length)return!1;for(C=0;C<b.length;C++){var N=b[C];if(!Je.call(g,N)||!no(h[N],g[N]))return!1}return!0}function rB(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function iB(h,g){var b=rB(h);h=0;for(var C;b;){if(b.nodeType===3){if(C=h+b.textContent.length,h<=g&&C>=g)return{node:b,offset:g-h};h=C}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=rB(b)}}function aB(h,g){return h&&g?h===g?!0:h&&h.nodeType===3?!1:g&&g.nodeType===3?aB(h,g.parentNode):"contains"in h?h.contains(g):h.compareDocumentPosition?!!(h.compareDocumentPosition(g)&16):!1:!1}function oB(h){h=h!=null&&h.ownerDocument!=null&&h.ownerDocument.defaultView!=null?h.ownerDocument.defaultView:window;for(var g=xs(h.document);g instanceof h.HTMLIFrameElement;){try{var b=typeof g.contentWindow.location.href=="string"}catch{b=!1}if(b)h=g.contentWindow;else break;g=xs(h.document)}return g}function i3(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g&&(g==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||g==="textarea"||h.contentEditable==="true")}var I2e=yu&&"documentMode"in document&&11>=document.documentMode,dg=null,a3=null,dx=null,o3=!1;function lB(h,g,b){var C=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;o3||dg==null||dg!==xs(C)||(C=dg,"selectionStart"in C&&i3(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),dx&&ux(dx,C)||(dx=C,C=Gw(a3,"onSelect"),0<C.length&&(g=new tw("onSelect","select",null,g,b),h.push({event:g,listeners:C}),g.target=dg)))}function Qh(h,g){var b={};return b[h.toLowerCase()]=g.toLowerCase(),b["Webkit"+h]="webkit"+g,b["Moz"+h]="moz"+g,b}var fg={animationend:Qh("Animation","AnimationEnd"),animationiteration:Qh("Animation","AnimationIteration"),animationstart:Qh("Animation","AnimationStart"),transitionrun:Qh("Transition","TransitionRun"),transitionstart:Qh("Transition","TransitionStart"),transitioncancel:Qh("Transition","TransitionCancel"),transitionend:Qh("Transition","TransitionEnd")},l3={},cB={};yu&&(cB=document.createElement("div").style,"AnimationEvent"in window||(delete fg.animationend.animation,delete fg.animationiteration.animation,delete fg.animationstart.animation),"TransitionEvent"in window||delete fg.transitionend.transition);function Jh(h){if(l3[h])return l3[h];if(!fg[h])return h;var g=fg[h],b;for(b in g)if(g.hasOwnProperty(b)&&b in cB)return l3[h]=g[b];return h}var uB=Jh("animationend"),dB=Jh("animationiteration"),fB=Jh("animationstart"),L2e=Jh("transitionrun"),j2e=Jh("transitionstart"),P2e=Jh("transitioncancel"),hB=Jh("transitionend"),pB=new Map,c3="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");c3.push("scrollEnd");function Sl(h,g){pB.set(h,g),pn(g,[h])}var rw=typeof reportError=="function"?reportError:function(h){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof h=="object"&&h!==null&&typeof h.message=="string"?String(h.message):String(h),error:h});if(!window.dispatchEvent(g))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",h);return}console.error(h)},Fo=[],hg=0,u3=0;function iw(){for(var h=hg,g=u3=hg=0;g<h;){var b=Fo[g];Fo[g++]=null;var C=Fo[g];Fo[g++]=null;var N=Fo[g];Fo[g++]=null;var P=Fo[g];if(Fo[g++]=null,C!==null&&N!==null){var W=C.pending;W===null?N.next=N:(N.next=W.next,W.next=N),C.pending=N}P!==0&&mB(b,N,P)}}function aw(h,g,b,C){Fo[hg++]=h,Fo[hg++]=g,Fo[hg++]=b,Fo[hg++]=C,u3|=C,h.lanes|=C,h=h.alternate,h!==null&&(h.lanes|=C)}function d3(h,g,b,C){return aw(h,g,b,C),ow(h)}function ep(h,g){return aw(h,null,null,g),ow(h)}function mB(h,g,b){h.lanes|=b;var C=h.alternate;C!==null&&(C.lanes|=b);for(var N=!1,P=h.return;P!==null;)P.childLanes|=b,C=P.alternate,C!==null&&(C.childLanes|=b),P.tag===22&&(h=P.stateNode,h===null||h._visibility&1||(N=!0)),h=P,P=P.return;return h.tag===3?(P=h.stateNode,N&&g!==null&&(N=31-Ee(b),h=P.hiddenUpdates,C=h[N],C===null?h[N]=[g]:C.push(g),g.lane=b|536870912),P):null}function ow(h){if(50<jx)throw jx=0,bA=null,Error(s(185));for(var g=h.return;g!==null;)h=g,g=h.return;return h.tag===3?h.stateNode:null}var pg={};function M2e(h,g,b,C){this.tag=h,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function so(h,g,b,C){return new M2e(h,g,b,C)}function f3(h){return h=h.prototype,!(!h||!h.isReactComponent)}function bu(h,g){var b=h.alternate;return b===null?(b=so(h.tag,g,h.key,h.mode),b.elementType=h.elementType,b.type=h.type,b.stateNode=h.stateNode,b.alternate=h,h.alternate=b):(b.pendingProps=g,b.type=h.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=h.flags&65011712,b.childLanes=h.childLanes,b.lanes=h.lanes,b.child=h.child,b.memoizedProps=h.memoizedProps,b.memoizedState=h.memoizedState,b.updateQueue=h.updateQueue,g=h.dependencies,b.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},b.sibling=h.sibling,b.index=h.index,b.ref=h.ref,b.refCleanup=h.refCleanup,b}function gB(h,g){h.flags&=65011714;var b=h.alternate;return b===null?(h.childLanes=0,h.lanes=g,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=b.childLanes,h.lanes=b.lanes,h.child=b.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=b.memoizedProps,h.memoizedState=b.memoizedState,h.updateQueue=b.updateQueue,h.type=b.type,g=b.dependencies,h.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext}),h}function lw(h,g,b,C,N,P){var W=0;if(C=h,typeof h=="function")f3(h)&&(W=1);else if(typeof h=="string")W=USe(h,b,J.current)?26:h==="html"||h==="head"||h==="body"?27:5;else e:switch(h){case L:return h=so(31,b,g,N),h.elementType=L,h.lanes=P,h;case x:return tp(b.children,N,P,g);case y:W=8,N|=24;break;case S:return h=so(12,b,g,N|2),h.elementType=S,h.lanes=P,h;case k:return h=so(13,b,g,N),h.elementType=k,h.lanes=P,h;case R:return h=so(19,b,g,N),h.elementType=R,h.lanes=P,h;default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case E:W=10;break e;case _:W=9;break e;case T:W=11;break e;case I:W=14;break e;case A:W=16,C=null;break e}W=29,b=Error(s(130,h===null?"null":typeof h,"")),C=null}return g=so(W,b,g,N),g.elementType=h,g.type=C,g.lanes=P,g}function tp(h,g,b,C){return h=so(7,h,C,g),h.lanes=b,h}function h3(h,g,b){return h=so(6,h,null,g),h.lanes=b,h}function vB(h){var g=so(18,null,null,0);return g.stateNode=h,g}function p3(h,g,b){return g=so(4,h.children!==null?h.children:[],h.key,g),g.lanes=b,g.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},g}var xB=new WeakMap;function Uo(h,g){if(typeof h=="object"&&h!==null){var b=xB.get(h);return b!==void 0?b:(g={value:h,source:g,stack:Ge(g)},xB.set(h,g),g)}return{value:h,source:g,stack:Ge(g)}}var mg=[],gg=0,cw=null,fx=0,Bo=[],zo=0,Bd=null,uc=1,dc="";function Su(h,g){mg[gg++]=fx,mg[gg++]=cw,cw=h,fx=g}function yB(h,g,b){Bo[zo++]=uc,Bo[zo++]=dc,Bo[zo++]=Bd,Bd=h;var C=uc;h=dc;var N=32-Ee(C)-1;C&=~(1<<N),b+=1;var P=32-Ee(g)+N;if(30<P){var W=N-N%5;P=(C&(1<<W)-1).toString(32),C>>=W,N-=W,uc=1<<32-Ee(g)+N|b<<N|C,dc=P+h}else uc=1<<P|b<<N|C,dc=h}function m3(h){h.return!==null&&(Su(h,1),yB(h,1,0))}function g3(h){for(;h===cw;)cw=mg[--gg],mg[gg]=null,fx=mg[--gg],mg[gg]=null;for(;h===Bd;)Bd=Bo[--zo],Bo[zo]=null,dc=Bo[--zo],Bo[zo]=null,uc=Bo[--zo],Bo[zo]=null}function bB(h,g){Bo[zo++]=uc,Bo[zo++]=dc,Bo[zo++]=Bd,uc=g.id,dc=g.overflow,Bd=h}var Ri=null,Ws=null,Mn=!1,zd=null,Vo=!1,v3=Error(s(519));function Vd(h){var g=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw hx(Uo(g,h)),v3}function SB(h){var g=h.stateNode,b=h.type,C=h.memoizedProps;switch(g[ut]=h,g[It]=C,b){case"dialog":kn("cancel",g),kn("close",g);break;case"iframe":case"object":case"embed":kn("load",g);break;case"video":case"audio":for(b=0;b<Mx.length;b++)kn(Mx[b],g);break;case"source":kn("error",g);break;case"img":case"image":case"link":kn("error",g),kn("load",g);break;case"details":kn("toggle",g);break;case"input":kn("invalid",g),PU(g,C.value,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name,!0);break;case"select":kn("invalid",g);break;case"textarea":kn("invalid",g),DU(g,C.value,C.defaultValue,C.children)}b=C.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||g.textContent===""+b||C.suppressHydrationWarning===!0||$V(g.textContent,b)?(C.popover!=null&&(kn("beforetoggle",g),kn("toggle",g)),C.onScroll!=null&&kn("scroll",g),C.onScrollEnd!=null&&kn("scrollend",g),C.onClick!=null&&(g.onclick=xu),g=!0):g=!1,g||Vd(h,!0)}function wB(h){for(Ri=h.return;Ri;)switch(Ri.tag){case 5:case 31:case 13:Vo=!1;return;case 27:case 3:Vo=!0;return;default:Ri=Ri.return}}function vg(h){if(h!==Ri)return!1;if(!Mn)return wB(h),Mn=!0,!1;var g=h.tag,b;if((b=g!==3&&g!==27)&&((b=g===5)&&(b=h.type,b=!(b!=="form"&&b!=="button")||MA(h.type,h.memoizedProps)),b=!b),b&&Ws&&Vd(h),wB(h),g===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));Ws=qV(h)}else if(g===31){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));Ws=qV(h)}else g===27?(g=Ws,sf(h.type)?(h=UA,UA=null,Ws=h):Ws=g):Ws=Ri?Go(h.stateNode.nextSibling):null;return!0}function np(){Ws=Ri=null,Mn=!1}function x3(){var h=zd;return h!==null&&(Ua===null?Ua=h:Ua.push.apply(Ua,h),zd=null),h}function hx(h){zd===null?zd=[h]:zd.push(h)}var y3=D(null),sp=null,wu=null;function Hd(h,g,b){Y(y3,g._currentValue),g._currentValue=b}function _u(h){h._currentValue=y3.current,K(y3)}function b3(h,g,b){for(;h!==null;){var C=h.alternate;if((h.childLanes&g)!==g?(h.childLanes|=g,C!==null&&(C.childLanes|=g)):C!==null&&(C.childLanes&g)!==g&&(C.childLanes|=g),h===b)break;h=h.return}}function S3(h,g,b,C){var N=h.child;for(N!==null&&(N.return=h);N!==null;){var P=N.dependencies;if(P!==null){var W=N.child;P=P.firstContext;e:for(;P!==null;){var X=P;P=N;for(var oe=0;oe<g.length;oe++)if(X.context===g[oe]){P.lanes|=b,X=P.alternate,X!==null&&(X.lanes|=b),b3(P.return,b,h),C||(W=null);break e}P=X.next}}else if(N.tag===18){if(W=N.return,W===null)throw Error(s(341));W.lanes|=b,P=W.alternate,P!==null&&(P.lanes|=b),b3(W,b,h),W=null}else W=N.child;if(W!==null)W.return=N;else for(W=N;W!==null;){if(W===h){W=null;break}if(N=W.sibling,N!==null){N.return=W.return,W=N;break}W=W.return}N=W}}function xg(h,g,b,C){h=null;for(var N=g,P=!1;N!==null;){if(!P){if((N.flags&524288)!==0)P=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var W=N.alternate;if(W===null)throw Error(s(387));if(W=W.memoizedProps,W!==null){var X=N.type;no(N.pendingProps.value,W.value)||(h!==null?h.push(X):h=[X])}}else if(N===ee.current){if(W=N.alternate,W===null)throw Error(s(387));W.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(h!==null?h.push(Ux):h=[Ux])}N=N.return}h!==null&&S3(g,h,b,C),g.flags|=262144}function uw(h){for(h=h.firstContext;h!==null;){if(!no(h.context._currentValue,h.memoizedValue))return!0;h=h.next}return!1}function rp(h){sp=h,wu=null,h=h.dependencies,h!==null&&(h.firstContext=null)}function Ai(h){return _B(sp,h)}function dw(h,g){return sp===null&&rp(h),_B(h,g)}function _B(h,g){var b=g._currentValue;if(g={context:g,memoizedValue:b,next:null},wu===null){if(h===null)throw Error(s(308));wu=g,h.dependencies={lanes:0,firstContext:g},h.flags|=524288}else wu=wu.next=g;return b}var D2e=typeof AbortController<"u"?AbortController:function(){var h=[],g=this.signal={aborted:!1,addEventListener:function(b,C){h.push(C)}};this.abort=function(){g.aborted=!0,h.forEach(function(b){return b()})}},O2e=t.unstable_scheduleCallback,$2e=t.unstable_NormalPriority,Hr={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function w3(){return{controller:new D2e,data:new Map,refCount:0}}function px(h){h.refCount--,h.refCount===0&&O2e($2e,function(){h.controller.abort()})}var mx=null,_3=0,yg=0,bg=null;function F2e(h,g){if(mx===null){var b=mx=[];_3=0,yg=TA(),bg={status:"pending",value:void 0,then:function(C){b.push(C)}}}return _3++,g.then(EB,EB),g}function EB(){if(--_3===0&&mx!==null){bg!==null&&(bg.status="fulfilled");var h=mx;mx=null,yg=0,bg=null;for(var g=0;g<h.length;g++)(0,h[g])()}}function U2e(h,g){var b=[],C={status:"pending",value:null,reason:null,then:function(N){b.push(N)}};return h.then(function(){C.status="fulfilled",C.value=g;for(var N=0;N<b.length;N++)(0,b[N])(g)},function(N){for(C.status="rejected",C.reason=N,N=0;N<b.length;N++)(0,b[N])(void 0)}),C}var CB=$.S;$.S=function(h,g){lV=Ke(),typeof g=="object"&&g!==null&&typeof g.then=="function"&&F2e(h,g),CB!==null&&CB(h,g)};var ip=D(null);function E3(){var h=ip.current;return h!==null?h:Ls.pooledCache}function fw(h,g){g===null?Y(ip,ip.current):Y(ip,g.pool)}function TB(){var h=E3();return h===null?null:{parent:Hr._currentValue,pool:h}}var Sg=Error(s(460)),C3=Error(s(474)),hw=Error(s(542)),pw={then:function(){}};function kB(h){return h=h.status,h==="fulfilled"||h==="rejected"}function RB(h,g,b){switch(b=h[b],b===void 0?h.push(g):b!==g&&(g.then(xu,xu),g=b),g.status){case"fulfilled":return g.value;case"rejected":throw h=g.reason,NB(h),h;default:if(typeof g.status=="string")g.then(xu,xu);else{if(h=Ls,h!==null&&100<h.shellSuspendCounter)throw Error(s(482));h=g,h.status="pending",h.then(function(C){if(g.status==="pending"){var N=g;N.status="fulfilled",N.value=C}},function(C){if(g.status==="pending"){var N=g;N.status="rejected",N.reason=C}})}switch(g.status){case"fulfilled":return g.value;case"rejected":throw h=g.reason,NB(h),h}throw op=g,Sg}}function ap(h){try{var g=h._init;return g(h._payload)}catch(b){throw b!==null&&typeof b=="object"&&typeof b.then=="function"?(op=b,Sg):b}}var op=null;function AB(){if(op===null)throw Error(s(459));var h=op;return op=null,h}function NB(h){if(h===Sg||h===hw)throw Error(s(483))}var wg=null,gx=0;function mw(h){var g=gx;return gx+=1,wg===null&&(wg=[]),RB(wg,h,g)}function vx(h,g){g=g.props.ref,h.ref=g!==void 0?g:null}function gw(h,g){throw g.$$typeof===p?Error(s(525)):(h=Object.prototype.toString.call(g),Error(s(31,h==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":h)))}function IB(h){function g(ge,fe){if(h){var xe=ge.deletions;xe===null?(ge.deletions=[fe],ge.flags|=16):xe.push(fe)}}function b(ge,fe){if(!h)return null;for(;fe!==null;)g(ge,fe),fe=fe.sibling;return null}function C(ge){for(var fe=new Map;ge!==null;)ge.key!==null?fe.set(ge.key,ge):fe.set(ge.index,ge),ge=ge.sibling;return fe}function N(ge,fe){return ge=bu(ge,fe),ge.index=0,ge.sibling=null,ge}function P(ge,fe,xe){return ge.index=xe,h?(xe=ge.alternate,xe!==null?(xe=xe.index,xe<fe?(ge.flags|=67108866,fe):xe):(ge.flags|=67108866,fe)):(ge.flags|=1048576,fe)}function W(ge){return h&&ge.alternate===null&&(ge.flags|=67108866),ge}function X(ge,fe,xe,Oe){return fe===null||fe.tag!==6?(fe=h3(xe,ge.mode,Oe),fe.return=ge,fe):(fe=N(fe,xe),fe.return=ge,fe)}function oe(ge,fe,xe,Oe){var $t=xe.type;return $t===x?Pe(ge,fe,xe.props.children,Oe,xe.key):fe!==null&&(fe.elementType===$t||typeof $t=="object"&&$t!==null&&$t.$$typeof===A&&ap($t)===fe.type)?(fe=N(fe,xe.props),vx(fe,xe),fe.return=ge,fe):(fe=lw(xe.type,xe.key,xe.props,null,ge.mode,Oe),vx(fe,xe),fe.return=ge,fe)}function Se(ge,fe,xe,Oe){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==xe.containerInfo||fe.stateNode.implementation!==xe.implementation?(fe=p3(xe,ge.mode,Oe),fe.return=ge,fe):(fe=N(fe,xe.children||[]),fe.return=ge,fe)}function Pe(ge,fe,xe,Oe,$t){return fe===null||fe.tag!==7?(fe=tp(xe,ge.mode,Oe,$t),fe.return=ge,fe):(fe=N(fe,xe),fe.return=ge,fe)}function Be(ge,fe,xe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return fe=h3(""+fe,ge.mode,xe),fe.return=ge,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case m:return xe=lw(fe.type,fe.key,fe.props,null,ge.mode,xe),vx(xe,fe),xe.return=ge,xe;case v:return fe=p3(fe,ge.mode,xe),fe.return=ge,fe;case A:return fe=ap(fe),Be(ge,fe,xe)}if(G(fe)||O(fe))return fe=tp(fe,ge.mode,xe,null),fe.return=ge,fe;if(typeof fe.then=="function")return Be(ge,mw(fe),xe);if(fe.$$typeof===E)return Be(ge,dw(ge,fe),xe);gw(ge,fe)}return null}function _e(ge,fe,xe,Oe){var $t=fe!==null?fe.key:null;if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return $t!==null?null:X(ge,fe,""+xe,Oe);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case m:return xe.key===$t?oe(ge,fe,xe,Oe):null;case v:return xe.key===$t?Se(ge,fe,xe,Oe):null;case A:return xe=ap(xe),_e(ge,fe,xe,Oe)}if(G(xe)||O(xe))return $t!==null?null:Pe(ge,fe,xe,Oe,null);if(typeof xe.then=="function")return _e(ge,fe,mw(xe),Oe);if(xe.$$typeof===E)return _e(ge,fe,dw(ge,xe),Oe);gw(ge,xe)}return null}function Te(ge,fe,xe,Oe,$t){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return ge=ge.get(xe)||null,X(fe,ge,""+Oe,$t);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case m:return ge=ge.get(Oe.key===null?xe:Oe.key)||null,oe(fe,ge,Oe,$t);case v:return ge=ge.get(Oe.key===null?xe:Oe.key)||null,Se(fe,ge,Oe,$t);case A:return Oe=ap(Oe),Te(ge,fe,xe,Oe,$t)}if(G(Oe)||O(Oe))return ge=ge.get(xe)||null,Pe(fe,ge,Oe,$t,null);if(typeof Oe.then=="function")return Te(ge,fe,xe,mw(Oe),$t);if(Oe.$$typeof===E)return Te(ge,fe,xe,dw(fe,Oe),$t);gw(fe,Oe)}return null}function kt(ge,fe,xe,Oe){for(var $t=null,Kn=null,jt=fe,gn=fe=0,Ln=null;jt!==null&&gn<xe.length;gn++){jt.index>gn?(Ln=jt,jt=null):Ln=jt.sibling;var Yn=_e(ge,jt,xe[gn],Oe);if(Yn===null){jt===null&&(jt=Ln);break}h&&jt&&Yn.alternate===null&&g(ge,jt),fe=P(Yn,fe,gn),Kn===null?$t=Yn:Kn.sibling=Yn,Kn=Yn,jt=Ln}if(gn===xe.length)return b(ge,jt),Mn&&Su(ge,gn),$t;if(jt===null){for(;gn<xe.length;gn++)jt=Be(ge,xe[gn],Oe),jt!==null&&(fe=P(jt,fe,gn),Kn===null?$t=jt:Kn.sibling=jt,Kn=jt);return Mn&&Su(ge,gn),$t}for(jt=C(jt);gn<xe.length;gn++)Ln=Te(jt,ge,gn,xe[gn],Oe),Ln!==null&&(h&&Ln.alternate!==null&&jt.delete(Ln.key===null?gn:Ln.key),fe=P(Ln,fe,gn),Kn===null?$t=Ln:Kn.sibling=Ln,Kn=Ln);return h&&jt.forEach(function(cf){return g(ge,cf)}),Mn&&Su(ge,gn),$t}function Kt(ge,fe,xe,Oe){if(xe==null)throw Error(s(151));for(var $t=null,Kn=null,jt=fe,gn=fe=0,Ln=null,Yn=xe.next();jt!==null&&!Yn.done;gn++,Yn=xe.next()){jt.index>gn?(Ln=jt,jt=null):Ln=jt.sibling;var cf=_e(ge,jt,Yn.value,Oe);if(cf===null){jt===null&&(jt=Ln);break}h&&jt&&cf.alternate===null&&g(ge,jt),fe=P(cf,fe,gn),Kn===null?$t=cf:Kn.sibling=cf,Kn=cf,jt=Ln}if(Yn.done)return b(ge,jt),Mn&&Su(ge,gn),$t;if(jt===null){for(;!Yn.done;gn++,Yn=xe.next())Yn=Be(ge,Yn.value,Oe),Yn!==null&&(fe=P(Yn,fe,gn),Kn===null?$t=Yn:Kn.sibling=Yn,Kn=Yn);return Mn&&Su(ge,gn),$t}for(jt=C(jt);!Yn.done;gn++,Yn=xe.next())Yn=Te(jt,ge,gn,Yn.value,Oe),Yn!==null&&(h&&Yn.alternate!==null&&jt.delete(Yn.key===null?gn:Yn.key),fe=P(Yn,fe,gn),Kn===null?$t=Yn:Kn.sibling=Yn,Kn=Yn);return h&&jt.forEach(function(XSe){return g(ge,XSe)}),Mn&&Su(ge,gn),$t}function Rs(ge,fe,xe,Oe){if(typeof xe=="object"&&xe!==null&&xe.type===x&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case m:e:{for(var $t=xe.key;fe!==null;){if(fe.key===$t){if($t=xe.type,$t===x){if(fe.tag===7){b(ge,fe.sibling),Oe=N(fe,xe.props.children),Oe.return=ge,ge=Oe;break e}}else if(fe.elementType===$t||typeof $t=="object"&&$t!==null&&$t.$$typeof===A&&ap($t)===fe.type){b(ge,fe.sibling),Oe=N(fe,xe.props),vx(Oe,xe),Oe.return=ge,ge=Oe;break e}b(ge,fe);break}else g(ge,fe);fe=fe.sibling}xe.type===x?(Oe=tp(xe.props.children,ge.mode,Oe,xe.key),Oe.return=ge,ge=Oe):(Oe=lw(xe.type,xe.key,xe.props,null,ge.mode,Oe),vx(Oe,xe),Oe.return=ge,ge=Oe)}return W(ge);case v:e:{for($t=xe.key;fe!==null;){if(fe.key===$t)if(fe.tag===4&&fe.stateNode.containerInfo===xe.containerInfo&&fe.stateNode.implementation===xe.implementation){b(ge,fe.sibling),Oe=N(fe,xe.children||[]),Oe.return=ge,ge=Oe;break e}else{b(ge,fe);break}else g(ge,fe);fe=fe.sibling}Oe=p3(xe,ge.mode,Oe),Oe.return=ge,ge=Oe}return W(ge);case A:return xe=ap(xe),Rs(ge,fe,xe,Oe)}if(G(xe))return kt(ge,fe,xe,Oe);if(O(xe)){if($t=O(xe),typeof $t!="function")throw Error(s(150));return xe=$t.call(xe),Kt(ge,fe,xe,Oe)}if(typeof xe.then=="function")return Rs(ge,fe,mw(xe),Oe);if(xe.$$typeof===E)return Rs(ge,fe,dw(ge,xe),Oe);gw(ge,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint"?(xe=""+xe,fe!==null&&fe.tag===6?(b(ge,fe.sibling),Oe=N(fe,xe),Oe.return=ge,ge=Oe):(b(ge,fe),Oe=h3(xe,ge.mode,Oe),Oe.return=ge,ge=Oe),W(ge)):b(ge,fe)}return function(ge,fe,xe,Oe){try{gx=0;var $t=Rs(ge,fe,xe,Oe);return wg=null,$t}catch(jt){if(jt===Sg||jt===hw)throw jt;var Kn=so(29,jt,null,ge.mode);return Kn.lanes=Oe,Kn.return=ge,Kn}finally{}}}var lp=IB(!0),LB=IB(!1),Gd=!1;function T3(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function k3(h,g){h=h.updateQueue,g.updateQueue===h&&(g.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,callbacks:null})}function Wd(h){return{lane:h,tag:0,payload:null,callback:null,next:null}}function qd(h,g,b){var C=h.updateQueue;if(C===null)return null;if(C=C.shared,(Jn&2)!==0){var N=C.pending;return N===null?g.next=g:(g.next=N.next,N.next=g),C.pending=g,g=ow(h),mB(h,null,b),g}return aw(h,C,g,b),ow(h)}function xx(h,g,b){if(g=g.updateQueue,g!==null&&(g=g.shared,(b&4194048)!==0)){var C=g.lanes;C&=h.pendingLanes,b|=C,g.lanes=b,Zh(h,b)}}function R3(h,g){var b=h.updateQueue,C=h.alternate;if(C!==null&&(C=C.updateQueue,b===C)){var N=null,P=null;if(b=b.firstBaseUpdate,b!==null){do{var W={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};P===null?N=P=W:P=P.next=W,b=b.next}while(b!==null);P===null?N=P=g:P=P.next=g}else N=P=g;b={baseState:C.baseState,firstBaseUpdate:N,lastBaseUpdate:P,shared:C.shared,callbacks:C.callbacks},h.updateQueue=b;return}h=b.lastBaseUpdate,h===null?b.firstBaseUpdate=g:h.next=g,b.lastBaseUpdate=g}var A3=!1;function yx(){if(A3){var h=bg;if(h!==null)throw h}}function bx(h,g,b,C){A3=!1;var N=h.updateQueue;Gd=!1;var P=N.firstBaseUpdate,W=N.lastBaseUpdate,X=N.shared.pending;if(X!==null){N.shared.pending=null;var oe=X,Se=oe.next;oe.next=null,W===null?P=Se:W.next=Se,W=oe;var Pe=h.alternate;Pe!==null&&(Pe=Pe.updateQueue,X=Pe.lastBaseUpdate,X!==W&&(X===null?Pe.firstBaseUpdate=Se:X.next=Se,Pe.lastBaseUpdate=oe))}if(P!==null){var Be=N.baseState;W=0,Pe=Se=oe=null,X=P;do{var _e=X.lane&-536870913,Te=_e!==X.lane;if(Te?(In&_e)===_e:(C&_e)===_e){_e!==0&&_e===yg&&(A3=!0),Pe!==null&&(Pe=Pe.next={lane:0,tag:X.tag,payload:X.payload,callback:null,next:null});e:{var kt=h,Kt=X;_e=g;var Rs=b;switch(Kt.tag){case 1:if(kt=Kt.payload,typeof kt=="function"){Be=kt.call(Rs,Be,_e);break e}Be=kt;break e;case 3:kt.flags=kt.flags&-65537|128;case 0:if(kt=Kt.payload,_e=typeof kt=="function"?kt.call(Rs,Be,_e):kt,_e==null)break e;Be=f({},Be,_e);break e;case 2:Gd=!0}}_e=X.callback,_e!==null&&(h.flags|=64,Te&&(h.flags|=8192),Te=N.callbacks,Te===null?N.callbacks=[_e]:Te.push(_e))}else Te={lane:_e,tag:X.tag,payload:X.payload,callback:X.callback,next:null},Pe===null?(Se=Pe=Te,oe=Be):Pe=Pe.next=Te,W|=_e;if(X=X.next,X===null){if(X=N.shared.pending,X===null)break;Te=X,X=Te.next,Te.next=null,N.lastBaseUpdate=Te,N.shared.pending=null}}while(!0);Pe===null&&(oe=Be),N.baseState=oe,N.firstBaseUpdate=Se,N.lastBaseUpdate=Pe,P===null&&(N.shared.lanes=0),Qd|=W,h.lanes=W,h.memoizedState=Be}}function jB(h,g){if(typeof h!="function")throw Error(s(191,h));h.call(g)}function PB(h,g){var b=h.callbacks;
vendor: 5,609 bytes, line 49
49if(b!==null)for(h.callbacks=null,h=0;h<b.length;h++)jB(b[h],g)}var _g=D(null),vw=D(0);function MB(h,g){h=Lu,Y(vw,h),Y(_g,g),Lu=h|g.baseLanes}function N3(){Y(vw,Lu),Y(_g,_g.current)}function I3(){Lu=vw.current,K(_g),K(vw)}var ro=D(null),Ho=null;function Kd(h){var g=h.alternate;Y(Or,Or.current&1),Y(ro,h),Ho===null&&(g===null||_g.current!==null||g.memoizedState!==null)&&(Ho=h)}function L3(h){Y(Or,Or.current),Y(ro,h),Ho===null&&(Ho=h)}function DB(h){h.tag===22?(Y(Or,Or.current),Y(ro,h),Ho===null&&(Ho=h)):Yd()}function Yd(){Y(Or,Or.current),Y(ro,ro.current)}function io(h){K(ro),Ho===h&&(Ho=null),K(Or)}var Or=D(0);function xw(h){for(var g=h;g!==null;){if(g.tag===13){var b=g.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||$A(b)||FA(b)))return g}else if(g.tag===19&&(g.memoizedProps.revealOrder==="forwards"||g.memoizedProps.revealOrder==="backwards"||g.memoizedProps.revealOrder==="unstable_legacy-backwards"||g.memoizedProps.revealOrder==="together")){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var Eu=0,mn=null,Ts=null,Gr=null,yw=!1,Eg=!1,cp=!1,bw=0,Sx=0,Cg=null,B2e=0;function yr(){throw Error(s(321))}function j3(h,g){if(g===null)return!1;for(var b=0;b<g.length&&b<h.length;b++)if(!no(h[b],g[b]))return!1;return!0}function P3(h,g,b,C,N,P){return Eu=P,mn=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,$.H=h===null||h.memoizedState===null?yz:Y3,cp=!1,P=b(C,N),cp=!1,Eg&&(P=$B(g,b,C,N)),OB(h),P}function OB(h){$.H=Ex;var g=Ts!==null&&Ts.next!==null;if(Eu=0,Gr=Ts=mn=null,yw=!1,Sx=0,Cg=null,g)throw Error(s(300));h===null||Wr||(h=h.dependencies,h!==null&&uw(h)&&(Wr=!0))}function $B(h,g,b,C){mn=h;var N=0;do{if(Eg&&(Cg=null),Sx=0,Eg=!1,25<=N)throw Error(s(301));if(N+=1,Gr=Ts=null,h.updateQueue!=null){var P=h.updateQueue;P.lastEffect=null,P.events=null,P.stores=null,P.memoCache!=null&&(P.memoCache.index=0)}$.H=bz,P=g(b,C)}while(Eg);return P}function z2e(){var h=$.H,g=h.useState()[0];return g=typeof g.then=="function"?wx(g):g,h=h.useState()[0],(Ts!==null?Ts.memoizedState:null)!==h&&(mn.flags|=1024),g}function M3(){var h=bw!==0;return bw=0,h}function D3(h,g,b){g.updateQueue=h.updateQueue,g.flags&=-2053,h.lanes&=~b}function O3(h){if(yw){for(h=h.memoizedState;h!==null;){var g=h.queue;g!==null&&(g.pending=null),h=h.next}yw=!1}Eu=0,Gr=Ts=mn=null,Eg=!1,Sx=bw=0,Cg=null}function fa(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gr===null?mn.memoizedState=Gr=h:Gr=Gr.next=h,Gr}function $r(){if(Ts===null){var h=mn.alternate;h=h!==null?h.memoizedState:null}else h=Ts.next;var g=Gr===null?mn.memoizedState:Gr.next;if(g!==null)Gr=g,Ts=h;else{if(h===null)throw mn.alternate===null?Error(s(467)):Error(s(310));Ts=h,h={memoizedState:Ts.memoizedState,baseState:Ts.baseState,baseQueue:Ts.baseQueue,queue:Ts.queue,next:null},Gr===null?mn.memoizedState=Gr=h:Gr=Gr.next=h}return Gr}function Sw(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wx(h){var g=Sx;return Sx+=1,Cg===null&&(Cg=[]),h=RB(Cg,h,g),g=mn,(Gr===null?g.memoizedState:Gr.next)===null&&(g=g.alternate,$.H=g===null||g.memoizedState===null?yz:Y3),h}function ww(h){if(h!==null&&typeof h=="object"){if(typeof h.then=="function")return wx(h);if(h.$$typeof===E)return Ai(h)}throw Error(s(438,String(h)))}function $3(h){var g=null,b=mn.updateQueue;if(b!==null&&(g=b.memoCache),g==null){var C=mn.alternate;C!==null&&(C=C.updateQueue,C!==null&&(C=C.memoCache,C!=null&&(g={data:C.data.map(function(N){return N.slice()}),index:0})))}if(g==null&&(g={data:[],index:0}),b===null&&(b=Sw(),mn.updateQueue=b),b.memoCache=g,b=g.data[g.index],b===void 0)for(b=g.data[g.index]=Array(h),C=0;C<h;C++)b[C]=j;return g.index++,b}function Cu(h,g){return typeof g=="function"?g(h):g}function _w(h){var g=$r();return F3(g,Ts,h)}function F3(h,g,b){var C=h.queue;if(C===null)throw Error(s(311));C.lastRenderedReducer=b;var N=h.baseQueue,P=C.pending;if(P!==null){if(N!==null){var W=N.next;N.next=P.next,P.next=W}g.baseQueue=N=P,C.pending=null}if(P=h.baseState,N===null)h.memoizedState=P;else{g=N.next;var X=W=null,oe=null,Se=g,Pe=!1;do{var Be=Se.lane&-536870913;if(Be!==Se.lane?(In&Be)===Be:(Eu&Be)===Be){var _e=Se.revertLane;if(_e===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null}),Be===yg&&(Pe=!0);else if((Eu&_e)===_e){Se=Se.next,_e===yg&&(Pe=!0);continue}else Be={lane:0,revertLane:Se.revertLane,gesture:null,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null},oe===null?(X=oe=Be,W=P):oe=oe.next=Be,mn.lanes|=_e,Qd|=_e;Be=Se.action,cp&&b(P,Be),P=Se.hasEagerState?Se.eagerState:b(P,Be)}else _e={lane:Be,revertLane:Se.revertLane,gesture:Se.gesture,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null},oe===null?(X=oe=_e,W=P):oe=oe.next=_e,mn.lanes|=Be,Qd|=Be;Se=Se.next}while(Se!==null&&Se!==g);if(oe===null?W=P:oe.next=X,!no(P,h.memoizedState)&&(Wr=!0,Pe&&(b=bg,b!==null)))throw b;h.memoizedState=P,h.baseState=W,h.baseQueue=oe,C.lastRenderedState=P}return N===null&&(C.lanes=0),[h.memoizedState,C.dispatch]}function U3(h){var g=$r(),b=g.queue;if(b===null)throw Error(s(311));b.lastRenderedReducer=h;var C=b.dispatch,N=b.pending,P=g.memoizedState;if(N!==null){b.pending=null;var W=N=N.next;do P=h(P,W.action),W=W.next;while(W!==N);no(P,g.memoizedState)||(Wr=!0),g.memoizedState=P,g.baseQueue===null&&(g.baseState=P),b.lastRenderedState=P}return[P,C]}
vendor: 15,933 bytes, line 49
49function FB(h,g,b){var C=mn,N=$r(),P=Mn;if(P){if(b===void 0)throw Error(s(407));b=b()}else b=g();var W=!no((Ts||N).memoizedState,b);if(W&&(N.memoizedState=b,Wr=!0),N=N.queue,V3(zB.bind(null,C,N,h),[h]),N.getSnapshot!==g||W||Gr!==null&&Gr.memoizedState.tag&1){if(C.flags|=2048,Tg(9,{destroy:void 0},BB.bind(null,C,N,b,g),null),Ls===null)throw Error(s(349));P||(Eu&127)!==0||UB(C,g,b)}return b}function UB(h,g,b){h.flags|=16384,h={getSnapshot:g,value:b},g=mn.updateQueue,g===null?(g=Sw(),mn.updateQueue=g,g.stores=[h]):(b=g.stores,b===null?g.stores=[h]:b.push(h))}function BB(h,g,b,C){g.value=b,g.getSnapshot=C,VB(g)&&HB(h)}function zB(h,g,b){return b(function(){VB(g)&&HB(h)})}function VB(h){var g=h.getSnapshot;h=h.value;try{var b=g();return!no(h,b)}catch{return!0}}function HB(h){var g=ep(h,2);g!==null&&Ba(g,h,2)}function B3(h){var g=fa();if(typeof h=="function"){var b=h;if(h=b(),cp){le(!0);try{b()}finally{le(!1)}}}return g.memoizedState=g.baseState=h,g.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cu,lastRenderedState:h},g}function GB(h,g,b,C){return h.baseState=b,F3(h,Ts,typeof C=="function"?C:Cu)}function V2e(h,g,b,C,N){if(Tw(h))throw Error(s(485));if(h=g.action,h!==null){var P={payload:N,action:h,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(W){P.listeners.push(W)}};$.T!==null?b(!0):P.isTransition=!1,C(P),b=g.pending,b===null?(P.next=g.pending=P,WB(g,P)):(P.next=b.next,g.pending=b.next=P)}}function WB(h,g){var b=g.action,C=g.payload,N=h.state;if(g.isTransition){var P=$.T,W={};$.T=W;try{var X=b(N,C),oe=$.S;oe!==null&&oe(W,X),qB(h,g,X)}catch(Se){z3(h,g,Se)}finally{P!==null&&W.types!==null&&(P.types=W.types),$.T=P}}else try{P=b(N,C),qB(h,g,P)}catch(Se){z3(h,g,Se)}}function qB(h,g,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(C){KB(h,g,C)},function(C){return z3(h,g,C)}):KB(h,g,b)}function KB(h,g,b){g.status="fulfilled",g.value=b,YB(g),h.state=b,g=h.pending,g!==null&&(b=g.next,b===g?h.pending=null:(b=b.next,g.next=b,WB(h,b)))}function z3(h,g,b){var C=h.pending;if(h.pending=null,C!==null){C=C.next;do g.status="rejected",g.reason=b,YB(g),g=g.next;while(g!==C)}h.action=null}function YB(h){h=h.listeners;for(var g=0;g<h.length;g++)(0,h[g])()}function ZB(h,g){return g}function XB(h,g){if(Mn){var b=Ls.formState;if(b!==null){e:{var C=mn;if(Mn){if(Ws){t:{for(var N=Ws,P=Vo;N.nodeType!==8;){if(!P){N=null;break t}if(N=Go(N.nextSibling),N===null){N=null;break t}}P=N.data,N=P==="F!"||P==="F"?N:null}if(N){Ws=Go(N.nextSibling),C=N.data==="F!";break e}}Vd(C)}C=!1}C&&(g=b[0])}}return b=fa(),b.memoizedState=b.baseState=g,C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ZB,lastRenderedState:g},b.queue=C,b=gz.bind(null,mn,C),C.dispatch=b,C=B3(!1),P=K3.bind(null,mn,!1,C.queue),C=fa(),N={state:g,dispatch:null,action:h,pending:null},C.queue=N,b=V2e.bind(null,mn,N,P,b),N.dispatch=b,C.memoizedState=h,[g,b,!1]}function QB(h){var g=$r();return JB(g,Ts,h)}function JB(h,g,b){if(g=F3(h,g,ZB)[0],h=_w(Cu)[0],typeof g=="object"&&g!==null&&typeof g.then=="function")try{var C=wx(g)}catch(W){throw W===Sg?hw:W}else C=g;g=$r();var N=g.queue,P=N.dispatch;return b!==g.memoizedState&&(mn.flags|=2048,Tg(9,{destroy:void 0},H2e.bind(null,N,b),null)),[C,P,h]}function H2e(h,g){h.action=g}function ez(h){var g=$r(),b=Ts;if(b!==null)return JB(g,b,h);$r(),g=g.memoizedState,b=$r();var C=b.queue.dispatch;return b.memoizedState=h,[g,C,!1]}function Tg(h,g,b,C){return h={tag:h,create:b,deps:C,inst:g,next:null},g=mn.updateQueue,g===null&&(g=Sw(),mn.updateQueue=g),b=g.lastEffect,b===null?g.lastEffect=h.next=h:(C=b.next,b.next=h,h.next=C,g.lastEffect=h),h}function tz(){return $r().memoizedState}function Ew(h,g,b,C){var N=fa();mn.flags|=h,N.memoizedState=Tg(1|g,{destroy:void 0},b,C===void 0?null:C)}function Cw(h,g,b,C){var N=$r();C=C===void 0?null:C;var P=N.memoizedState.inst;Ts!==null&&C!==null&&j3(C,Ts.memoizedState.deps)?N.memoizedState=Tg(g,P,b,C):(mn.flags|=h,N.memoizedState=Tg(1|g,P,b,C))}function nz(h,g){Ew(8390656,8,h,g)}function V3(h,g){Cw(2048,8,h,g)}function G2e(h){mn.flags|=4;var g=mn.updateQueue;if(g===null)g=Sw(),mn.updateQueue=g,g.events=[h];else{var b=g.events;b===null?g.events=[h]:b.push(h)}}function sz(h){var g=$r().memoizedState;return G2e({ref:g,nextImpl:h}),function(){if((Jn&2)!==0)throw Error(s(440));return g.impl.apply(void 0,arguments)}}function rz(h,g){return Cw(4,2,h,g)}function iz(h,g){return Cw(4,4,h,g)}function az(h,g){if(typeof g=="function"){h=h();var b=g(h);return function(){typeof b=="function"?b():g(null)}}if(g!=null)return h=h(),g.current=h,function(){g.current=null}}function oz(h,g,b){b=b!=null?b.concat([h]):null,Cw(4,4,az.bind(null,g,h),b)}function H3(){}function lz(h,g){var b=$r();g=g===void 0?null:g;var C=b.memoizedState;return g!==null&&j3(g,C[1])?C[0]:(b.memoizedState=[h,g],h)}function cz(h,g){var b=$r();g=g===void 0?null:g;var C=b.memoizedState;if(g!==null&&j3(g,C[1]))return C[0];if(C=h(),cp){le(!0);try{h()}finally{le(!1)}}return b.memoizedState=[C,g],C}function G3(h,g,b){return b===void 0||(Eu&1073741824)!==0&&(In&261930)===0?h.memoizedState=g:(h.memoizedState=b,h=uV(),mn.lanes|=h,Qd|=h,b)}function uz(h,g,b,C){return no(b,g)?b:_g.current!==null?(h=G3(h,b,C),no(h,g)||(Wr=!0),h):(Eu&42)===0||(Eu&1073741824)!==0&&(In&261930)===0?(Wr=!0,h.memoizedState=b):(h=uV(),mn.lanes|=h,Qd|=h,g)}function dz(h,g,b,C,N){var P=V.p;V.p=P!==0&&8>P?P:8;var W=$.T,X={};$.T=X,K3(h,!1,g,b);try{var oe=N(),Se=$.S;if(Se!==null&&Se(X,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var Pe=U2e(oe,C);_x(h,g,Pe,lo(h))}else _x(h,g,C,lo(h))}catch(Be){_x(h,g,{then:function(){},status:"rejected",reason:Be},lo())}finally{V.p=P,W!==null&&X.types!==null&&(W.types=X.types),$.T=W}}function W2e(){}function W3(h,g,b,C){if(h.tag!==5)throw Error(s(476));var N=fz(h).queue;dz(h,N,g,B,b===null?W2e:function(){return hz(h),b(C)})}function fz(h){var g=h.memoizedState;if(g!==null)return g;g={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cu,lastRenderedState:B},next:null};var b={};return g.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cu,lastRenderedState:b},next:null},h.memoizedState=g,h=h.alternate,h!==null&&(h.memoizedState=g),g}function hz(h){var g=fz(h);g.next===null&&(g=h.alternate.memoizedState),_x(h,g.next.queue,{},lo())}function q3(){return Ai(Ux)}function pz(){return $r().memoizedState}function mz(){return $r().memoizedState}function q2e(h){for(var g=h.return;g!==null;){switch(g.tag){case 24:case 3:var b=lo();h=Wd(b);var C=qd(g,h,b);C!==null&&(Ba(C,g,b),xx(C,g,b)),g={cache:w3()},h.payload=g;return}g=g.return}}function K2e(h,g,b){var C=lo();b={lane:C,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},Tw(h)?vz(g,b):(b=d3(h,g,b,C),b!==null&&(Ba(b,h,C),xz(b,g,C)))}function gz(h,g,b){var C=lo();_x(h,g,b,C)}function _x(h,g,b,C){var N={lane:C,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(Tw(h))vz(g,N);else{var P=h.alternate;if(h.lanes===0&&(P===null||P.lanes===0)&&(P=g.lastRenderedReducer,P!==null))try{var W=g.lastRenderedState,X=P(W,b);if(N.hasEagerState=!0,N.eagerState=X,no(X,W))return aw(h,g,N,0),Ls===null&&iw(),!1}catch{}finally{}if(b=d3(h,g,N,C),b!==null)return Ba(b,h,C),xz(b,g,C),!0}return!1}function K3(h,g,b,C){if(C={lane:2,revertLane:TA(),gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},Tw(h)){if(g)throw Error(s(479))}else g=d3(h,b,C,2),g!==null&&Ba(g,h,2)}function Tw(h){var g=h.alternate;return h===mn||g!==null&&g===mn}function vz(h,g){Eg=yw=!0;var b=h.pending;b===null?g.next=g:(g.next=b.next,b.next=g),h.pending=g}function xz(h,g,b){if((b&4194048)!==0){var C=g.lanes;C&=h.pendingLanes,b|=C,g.lanes=b,Zh(h,b)}}var Ex={readContext:Ai,use:ww,useCallback:yr,useContext:yr,useEffect:yr,useImperativeHandle:yr,useLayoutEffect:yr,useInsertionEffect:yr,useMemo:yr,useReducer:yr,useRef:yr,useState:yr,useDebugValue:yr,useDeferredValue:yr,useTransition:yr,useSyncExternalStore:yr,useId:yr,useHostTransitionStatus:yr,useFormState:yr,useActionState:yr,useOptimistic:yr,useMemoCache:yr,useCacheRefresh:yr};Ex.useEffectEvent=yr;var yz={readContext:Ai,use:ww,useCallback:function(h,g){return fa().memoizedState=[h,g===void 0?null:g],h},useContext:Ai,useEffect:nz,useImperativeHandle:function(h,g,b){b=b!=null?b.concat([h]):null,Ew(4194308,4,az.bind(null,g,h),b)},useLayoutEffect:function(h,g){return Ew(4194308,4,h,g)},useInsertionEffect:function(h,g){Ew(4,2,h,g)},useMemo:function(h,g){var b=fa();g=g===void 0?null:g;var C=h();if(cp){le(!0);try{h()}finally{le(!1)}}return b.memoizedState=[C,g],C},useReducer:function(h,g,b){var C=fa();if(b!==void 0){var N=b(g);if(cp){le(!0);try{b(g)}finally{le(!1)}}}else N=g;return C.memoizedState=C.baseState=N,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:N},C.queue=h,h=h.dispatch=K2e.bind(null,mn,h),[C.memoizedState,h]},useRef:function(h){var g=fa();return h={current:h},g.memoizedState=h},useState:function(h){h=B3(h);var g=h.queue,b=gz.bind(null,mn,g);return g.dispatch=b,[h.memoizedState,b]},useDebugValue:H3,useDeferredValue:function(h,g){var b=fa();return G3(b,h,g)},useTransition:function(){var h=B3(!1);return h=dz.bind(null,mn,h.queue,!0,!1),fa().memoizedState=h,[!1,h]},useSyncExternalStore:function(h,g,b){var C=mn,N=fa();if(Mn){if(b===void 0)throw Error(s(407));b=b()}else{if(b=g(),Ls===null)throw Error(s(349));(In&127)!==0||UB(C,g,b)}N.memoizedState=b;var P={value:b,getSnapshot:g};return N.queue=P,nz(zB.bind(null,C,P,h),[h]),C.flags|=2048,Tg(9,{destroy:void 0},BB.bind(null,C,P,b,g),null),b},useId:function(){var h=fa(),g=Ls.identifierPrefix;if(Mn){var b=dc,C=uc;b=(C&~(1<<32-Ee(C)-1)).toString(32)+b,g="_"+g+"R_"+b,b=bw++,0<b&&(g+="H"+b.toString(32)),g+="_"}else b=B2e++,g="_"+g+"r_"+b.toString(32)+"_";return h.memoizedState=g},useHostTransitionStatus:q3,useFormState:XB,useActionState:XB,useOptimistic:function(h){var g=fa();g.memoizedState=g.baseState=h;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return g.queue=b,g=K3.bind(null,mn,!0,b),b.dispatch=g,[h,g]},useMemoCache:$3,useCacheRefresh:function(){return fa().memoizedState=q2e.bind(null,mn)},useEffectEvent:function(h){var g=fa(),b={impl:h};return g.memoizedState=b,function(){if((Jn&2)!==0)throw Error(s(440));return b.impl.apply(void 0,arguments)}}},Y3={readContext:Ai,use:ww,useCallback:lz,useContext:Ai,useEffect:V3,useImperativeHandle:oz,useInsertionEffect:rz,useLayoutEffect:iz,useMemo:cz,useReducer:_w,useRef:tz,useState:function(){return _w(Cu)},useDebugValue:H3,useDeferredValue:function(h,g){var b=$r();return uz(b,Ts.memoizedState,h,g)},useTransition:function(){var h=_w(Cu)[0],g=$r().memoizedState;return[typeof h=="boolean"?h:wx(h),g]},useSyncExternalStore:FB,useId:pz,useHostTransitionStatus:q3,useFormState:QB,useActionState:QB,useOptimistic:function(h,g){var b=$r();return GB(b,Ts,h,g)},useMemoCache:$3,useCacheRefresh:mz};Y3.useEffectEvent=sz;var bz={readContext:Ai,use:ww,useCallback:lz,useContext:Ai,useEffect:V3,useImperativeHandle:oz,useInsertionEffect:rz,useLayoutEffect:iz,useMemo:cz,useReducer:U3,useRef:tz,useState:function(){return U3(Cu)},useDebugValue:H3,useDeferredValue:function(h,g){var b=$r();return Ts===null?G3(b,h,g):uz(b,Ts.memoizedState,h,g)},useTransition:function(){var h=U3(Cu)[0],g=$r().memoizedState;return[typeof h=="boolean"?h:wx(h),g]},useSyncExternalStore:FB,useId:pz,useHostTransitionStatus:q3,useFormState:ez,useActionState:ez,useOptimistic:function(h,g){var b=$r();return Ts!==null?GB(b,Ts,h,g):(b.baseState=h,[h,b.queue.dispatch])},useMemoCache:$3,useCacheRefresh:mz};bz.useEffectEvent=sz;function Z3(h,g,b,C){g=h.memoizedState,b=b(C,g),b=b==null?g:f({},g,b),h.memoizedState=b,h.lanes===0&&(h.updateQueue.baseState=b)}var X3={enqueueSetState:function(h,g,b){h=h._reactInternals;var C=lo(),N=Wd(C);N.payload=g,b!=null&&(N.callback=b),g=qd(h,N,C),g!==null&&(Ba(g,h,C),xx(g,h,C))},enqueueReplaceState:function(h,g,b){h=h._reactInternals;var C=lo(),N=Wd(C);N.tag=1,N.payload=g,b!=null&&(N.callback=b),g=qd(h,N,C),g!==null&&(Ba(g,h,C),xx(g,h,C))},enqueueForceUpdate:function(h,g){h=h._reactInternals;var b=lo(),C=Wd(b);C.tag=2,g!=null&&(C.callback=g),g=qd(h,C,b),g!==null&&(Ba(g,h,b),xx(g,h,b))}};function Sz(h,g,b,C,N,P,W){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(C,P,W):g.prototype&&g.prototype.isPureReactComponent?!ux(b,C)||!ux(N,P):!0}function wz(h,g,b,C){h=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(b,C),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(b,C),g.state!==h&&X3.enqueueReplaceState(g,g.state,null)}function up(h,g){var b=g;if("ref"in g){b={};for(var C in g)C!=="ref"&&(b[C]=g[C])}if(h=h.defaultProps){b===g&&(b=f({},b));for(var N in h)b[N]===void 0&&(b[N]=h[N])}return b}function _z(h){rw(h)}function Ez(h){console.error(h)}function Cz(h){rw(h)}function kw(h,g){try{var b=h.onUncaughtError;b(g.value,{componentStack:g.stack})}catch(C){setTimeout(function(){throw C})}}function Tz(h,g,b){try{var C=h.onCaughtError;C(b.value,{componentStack:b.stack,errorBoundary:g.tag===1?g.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function Q3(h,g,b){return b=Wd(b),b.tag=3,b.payload={element:null},b.callback=function(){kw(h,g)},b}function kz(h){return h=Wd(h),h.tag=3,h}function Rz(h,g,b,C){var N=b.type.getDerivedStateFromError;if(typeof N=="function"){var P=C.value;h.payload=function(){return N(P)},h.callback=function(){Tz(g,b,C)}}var W=b.stateNode;W!==null&&typeof W.componentDidCatch=="function"&&(h.callback=function(){Tz(g,b,C),typeof N!="function"&&(Jd===null?Jd=new Set([this]):Jd.add(this));var X=C.stack;this.componentDidCatch(C.value,{componentStack:X!==null?X:""})})}function Y2e(h,g,b,C,N){if(b.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){if(g=b.alternate,g!==null&&xg(g,b,N,!0),b=ro.current,b!==null){switch(b.tag){case 31:case 13:return Ho===null?Fw():b.alternate===null&&br===0&&(br=3),b.flags&=-257,b.flags|=65536,b.lanes=N,C===pw?b.flags|=16384:(g=b.updateQueue,g===null?b.updateQueue=new Set([C]):g.add(C),_A(h,C,N)),!1;case 22:return b.flags|=65536,C===pw?b.flags|=16384:(g=b.updateQueue,g===null?(g={transitions:null,markerInstances:null,retryQueue:new Set([C])},b.updateQueue=g):(b=g.retryQueue,b===null?g.retryQueue=new Set([C]):b.add(C)),_A(h,C,N)),!1}throw Error(s(435,b.tag))}return _A(h,C,N),Fw(),!1}if(Mn)return g=ro.current,g!==null?((g.flags&65536)===0&&(g.flags|=256),g.flags|=65536,g.lanes=N,C!==v3&&(h=Error(s(422),{cause:C}),hx(Uo(h,b)))):(C!==v3&&(g=Error(s(423),{cause:C}),hx(Uo(g,b))),h=h.current.alternate,h.flags|=65536,N&=-N,h.lanes|=N,C=Uo(C,b),N=Q3(h.stateNode,C,N),R3(h,N),br!==4&&(br=2)),!1;var P=Error(s(520),{cause:C});if(P=Uo(P,b),Lx===null?Lx=[P]:Lx.push(P),br!==4&&(br=2),g===null)return!0;C=Uo(C,b),b=g;do{switch(b.tag){case 3:return b.flags|=65536,h=N&-N,b.lanes|=h,h=Q3(b.stateNode,C,h),R3(b,h),!1;case 1:if(g=b.type,P=b.stateNode,(b.flags&128)===0&&(typeof g.getDerivedStateFromError=="function"||P!==null&&typeof P.componentDidCatch=="function"&&(Jd===null||!Jd.has(P))))return b.flags|=65536,N&=-N,b.lanes|=N,N=kz(N),Rz(N,h,b,C),R3(b,N),!1}b=b.return}while(b!==null);return!1}var J3=Error(s(461)),Wr=!1;function Ni(h,g,b,C){g.child=h===null?LB(g,null,b,C):lp(g,h.child,b,C)}function Az(h,g,b,C,N){b=b.render;var P=g.ref;if("ref"in C){var W={};for(var X in C)X!=="ref"&&(W[X]=C[X])}else W=C;return rp(g),C=P3(h,g,b,W,P,N),X=M3(),h!==null&&!Wr?(D3(h,g,N),Tu(h,g,N)):(Mn&&X&&m3(g),g.flags|=1,Ni(h,g,C,N),g.child)}function Nz(h,g,b,C,N){if(h===null){var P=b.type;return typeof P=="function"&&!f3(P)&&P.defaultProps===void 0&&b.compare===null?(g.tag=15,g.type=P,Iz(h,g,P,C,N)):(h=lw(b.type,null,C,g,g.mode,N),h.ref=g.ref,h.return=g,g.child=h)}if(P=h.child,!oA(h,N)){var W=P.memoizedProps;
vendor: 11,824 bytes, line 49
49if(b=b.compare,b=b!==null?b:ux,b(W,C)&&h.ref===g.ref)return Tu(h,g,N)}return g.flags|=1,h=bu(P,C),h.ref=g.ref,h.return=g,g.child=h}function Iz(h,g,b,C,N){if(h!==null){var P=h.memoizedProps;if(ux(P,C)&&h.ref===g.ref)if(Wr=!1,g.pendingProps=C=P,oA(h,N))(h.flags&131072)!==0&&(Wr=!0);else return g.lanes=h.lanes,Tu(h,g,N)}return eA(h,g,b,C,N)}function Lz(h,g,b,C){var N=C.children,P=h!==null?h.memoizedState:null;if(h===null&&g.stateNode===null&&(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),C.mode==="hidden"){if((g.flags&128)!==0){if(P=P!==null?P.baseLanes|b:b,h!==null){for(C=g.child=h.child,N=0;C!==null;)N=N|C.lanes|C.childLanes,C=C.sibling;C=N&~P}else C=0,g.child=null;return jz(h,g,P,b,C)}if((b&536870912)!==0)g.memoizedState={baseLanes:0,cachePool:null},h!==null&&fw(g,P!==null?P.cachePool:null),P!==null?MB(g,P):N3(),DB(g);else return C=g.lanes=536870912,jz(h,g,P!==null?P.baseLanes|b:b,b,C)}else P!==null?(fw(g,P.cachePool),MB(g,P),Yd(),g.memoizedState=null):(h!==null&&fw(g,null),N3(),Yd());return Ni(h,g,N,b),g.child}function Cx(h,g){return h!==null&&h.tag===22||g.stateNode!==null||(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.sibling}function jz(h,g,b,C,N){var P=E3();return P=P===null?null:{parent:Hr._currentValue,pool:P},g.memoizedState={baseLanes:b,cachePool:P},h!==null&&fw(g,null),N3(),DB(g),h!==null&&xg(h,g,C,!0),g.childLanes=N,null}function Rw(h,g){return g=Nw({mode:g.mode,children:g.children},h.mode),g.ref=h.ref,h.child=g,g.return=h,g}function Pz(h,g,b){return lp(g,h.child,null,b),h=Rw(g,g.pendingProps),h.flags|=2,io(g),g.memoizedState=null,h}function Z2e(h,g,b){var C=g.pendingProps,N=(g.flags&128)!==0;if(g.flags&=-129,h===null){if(Mn){if(C.mode==="hidden")return h=Rw(g,C),g.lanes=536870912,Cx(null,h);if(L3(g),(h=Ws)?(h=WV(h,Vo),h=h!==null&&h.data==="&"?h:null,h!==null&&(g.memoizedState={dehydrated:h,treeContext:Bd!==null?{id:uc,overflow:dc}:null,retryLane:536870912,hydrationErrors:null},b=vB(h),b.return=g,g.child=b,Ri=g,Ws=null)):h=null,h===null)throw Vd(g);return g.lanes=536870912,null}return Rw(g,C)}var P=h.memoizedState;if(P!==null){var W=P.dehydrated;if(L3(g),N)if(g.flags&256)g.flags&=-257,g=Pz(h,g,b);else if(g.memoizedState!==null)g.child=h.child,g.flags|=128,g=null;else throw Error(s(558));else if(Wr||xg(h,g,b,!1),N=(b&h.childLanes)!==0,Wr||N){if(C=Ls,C!==null&&(W=ae(C,b),W!==0&&W!==P.retryLane))throw P.retryLane=W,ep(h,W),Ba(C,h,W),J3;Fw(),g=Pz(h,g,b)}else h=P.treeContext,Ws=Go(W.nextSibling),Ri=g,Mn=!0,zd=null,Vo=!1,h!==null&&bB(g,h),g=Rw(g,C),g.flags|=4096;return g}return h=bu(h.child,{mode:C.mode,children:C.children}),h.ref=g.ref,g.child=h,h.return=g,h}function Aw(h,g){var b=g.ref;if(b===null)h!==null&&h.ref!==null&&(g.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(s(284));(h===null||h.ref!==b)&&(g.flags|=4194816)}}function eA(h,g,b,C,N){return rp(g),b=P3(h,g,b,C,void 0,N),C=M3(),h!==null&&!Wr?(D3(h,g,N),Tu(h,g,N)):(Mn&&C&&m3(g),g.flags|=1,Ni(h,g,b,N),g.child)}function Mz(h,g,b,C,N,P){return rp(g),g.updateQueue=null,b=$B(g,C,b,N),OB(h),C=M3(),h!==null&&!Wr?(D3(h,g,P),Tu(h,g,P)):(Mn&&C&&m3(g),g.flags|=1,Ni(h,g,b,P),g.child)}function Dz(h,g,b,C,N){if(rp(g),g.stateNode===null){var P=pg,W=b.contextType;typeof W=="object"&&W!==null&&(P=Ai(W)),P=new b(C,P),g.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,P.updater=X3,g.stateNode=P,P._reactInternals=g,P=g.stateNode,P.props=C,P.state=g.memoizedState,P.refs={},T3(g),W=b.contextType,P.context=typeof W=="object"&&W!==null?Ai(W):pg,P.state=g.memoizedState,W=b.getDerivedStateFromProps,typeof W=="function"&&(Z3(g,b,W,C),P.state=g.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof P.getSnapshotBeforeUpdate=="function"||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(W=P.state,typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount(),W!==P.state&&X3.enqueueReplaceState(P,P.state,null),bx(g,C,P,N),yx(),P.state=g.memoizedState),typeof P.componentDidMount=="function"&&(g.flags|=4194308),C=!0}else if(h===null){P=g.stateNode;var X=g.memoizedProps,oe=up(b,X);P.props=oe;var Se=P.context,Pe=b.contextType;W=pg,typeof Pe=="object"&&Pe!==null&&(W=Ai(Pe));var Be=b.getDerivedStateFromProps;Pe=typeof Be=="function"||typeof P.getSnapshotBeforeUpdate=="function",X=g.pendingProps!==X,Pe||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(X||Se!==W)&&wz(g,P,C,W),Gd=!1;var _e=g.memoizedState;P.state=_e,bx(g,C,P,N),yx(),Se=g.memoizedState,X||_e!==Se||Gd?(typeof Be=="function"&&(Z3(g,b,Be,C),Se=g.memoizedState),(oe=Gd||Sz(g,b,oe,C,_e,Se,W))?(Pe||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(g.flags|=4194308)):(typeof P.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=Se),P.props=C,P.state=Se,P.context=W,C=oe):(typeof P.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{P=g.stateNode,k3(h,g),W=g.memoizedProps,Pe=up(b,W),P.props=Pe,Be=g.pendingProps,_e=P.context,Se=b.contextType,oe=pg,typeof Se=="object"&&Se!==null&&(oe=Ai(Se)),X=b.getDerivedStateFromProps,(Se=typeof X=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(W!==Be||_e!==oe)&&wz(g,P,C,oe),Gd=!1,_e=g.memoizedState,P.state=_e,bx(g,C,P,N),yx();var Te=g.memoizedState;W!==Be||_e!==Te||Gd||h!==null&&h.dependencies!==null&&uw(h.dependencies)?(typeof X=="function"&&(Z3(g,b,X,C),Te=g.memoizedState),(Pe=Gd||Sz(g,b,Pe,C,_e,Te,oe)||h!==null&&h.dependencies!==null&&uw(h.dependencies))?(Se||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(C,Te,oe),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(C,Te,oe)),typeof P.componentDidUpdate=="function"&&(g.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof P.componentDidUpdate!="function"||W===h.memoizedProps&&_e===h.memoizedState||(g.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||W===h.memoizedProps&&_e===h.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=Te),P.props=C,P.state=Te,P.context=oe,C=Pe):(typeof P.componentDidUpdate!="function"||W===h.memoizedProps&&_e===h.memoizedState||(g.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||W===h.memoizedProps&&_e===h.memoizedState||(g.flags|=1024),C=!1)}return P=C,Aw(h,g),C=(g.flags&128)!==0,P||C?(P=g.stateNode,b=C&&typeof b.getDerivedStateFromError!="function"?null:P.render(),g.flags|=1,h!==null&&C?(g.child=lp(g,h.child,null,N),g.child=lp(g,null,b,N)):Ni(h,g,b,N),g.memoizedState=P.state,h=g.child):h=Tu(h,g,N),h}function Oz(h,g,b,C){return np(),g.flags|=256,Ni(h,g,b,C),g.child}var tA={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nA(h){return{baseLanes:h,cachePool:TB()}}function sA(h,g,b){return h=h!==null?h.childLanes&~b:0,g&&(h|=oo),h}function $z(h,g,b){var C=g.pendingProps,N=!1,P=(g.flags&128)!==0,W;if((W=P)||(W=h!==null&&h.memoizedState===null?!1:(Or.current&2)!==0),W&&(N=!0,g.flags&=-129),W=(g.flags&32)!==0,g.flags&=-33,h===null){if(Mn){if(N?Kd(g):Yd(),(h=Ws)?(h=WV(h,Vo),h=h!==null&&h.data!=="&"?h:null,h!==null&&(g.memoizedState={dehydrated:h,treeContext:Bd!==null?{id:uc,overflow:dc}:null,retryLane:536870912,hydrationErrors:null},b=vB(h),b.return=g,g.child=b,Ri=g,Ws=null)):h=null,h===null)throw Vd(g);return FA(h)?g.lanes=32:g.lanes=536870912,null}var X=C.children;return C=C.fallback,N?(Yd(),N=g.mode,X=Nw({mode:"hidden",children:X},N),C=tp(C,N,b,null),X.return=g,C.return=g,X.sibling=C,g.child=X,C=g.child,C.memoizedState=nA(b),C.childLanes=sA(h,W,b),g.memoizedState=tA,Cx(null,C)):(Kd(g),rA(g,X))}var oe=h.memoizedState;if(oe!==null&&(X=oe.dehydrated,X!==null)){if(P)g.flags&256?(Kd(g),g.flags&=-257,g=iA(h,g,b)):g.memoizedState!==null?(Yd(),g.child=h.child,g.flags|=128,g=null):(Yd(),X=C.fallback,N=g.mode,C=Nw({mode:"visible",children:C.children},N),X=tp(X,N,b,null),X.flags|=2,C.return=g,X.return=g,C.sibling=X,g.child=C,lp(g,h.child,null,b),C=g.child,C.memoizedState=nA(b),C.childLanes=sA(h,W,b),g.memoizedState=tA,g=Cx(null,C));else if(Kd(g),FA(X)){if(W=X.nextSibling&&X.nextSibling.dataset,W)var Se=W.dgst;W=Se,C=Error(s(419)),C.stack="",C.digest=W,hx({value:C,source:null,stack:null}),g=iA(h,g,b)}else if(Wr||xg(h,g,b,!1),W=(b&h.childLanes)!==0,Wr||W){if(W=Ls,W!==null&&(C=ae(W,b),C!==0&&C!==oe.retryLane))throw oe.retryLane=C,ep(h,C),Ba(W,h,C),J3;$A(X)||Fw(),g=iA(h,g,b)}else $A(X)?(g.flags|=192,g.child=h.child,g=null):(h=oe.treeContext,Ws=Go(X.nextSibling),Ri=g,Mn=!0,zd=null,Vo=!1,h!==null&&bB(g,h),g=rA(g,C.children),g.flags|=4096);return g}return N?(Yd(),X=C.fallback,N=g.mode,oe=h.child,Se=oe.sibling,C=bu(oe,{mode:"hidden",children:C.children}),C.subtreeFlags=oe.subtreeFlags&65011712,Se!==null?X=bu(Se,X):(X=tp(X,N,b,null),X.flags|=2),X.return=g,C.return=g,C.sibling=X,g.child=C,Cx(null,C),C=g.child,X=h.child.memoizedState,X===null?X=nA(b):(N=X.cachePool,N!==null?(oe=Hr._currentValue,N=N.parent!==oe?{parent:oe,pool:oe}:N):N=TB(),X={baseLanes:X.baseLanes|b,cachePool:N}),C.memoizedState=X,C.childLanes=sA(h,W,b),g.memoizedState=tA,Cx(h.child,C)):(Kd(g),b=h.child,h=b.sibling,b=bu(b,{mode:"visible",children:C.children}),b.return=g,b.sibling=null,h!==null&&(W=g.deletions,W===null?(g.deletions=[h],g.flags|=16):W.push(h)),g.child=b,g.memoizedState=null,b)}function rA(h,g){return g=Nw({mode:"visible",children:g},h.mode),g.return=h,h.child=g}function Nw(h,g){return h=so(22,h,null,g),h.lanes=0,h}function iA(h,g,b){return lp(g,h.child,null,b),h=rA(g,g.pendingProps.children),h.flags|=2,g.memoizedState=null,h}function Fz(h,g,b){h.lanes|=g;var C=h.alternate;C!==null&&(C.lanes|=g),b3(h.return,g,b)}function aA(h,g,b,C,N,P){var W=h.memoizedState;W===null?h.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:b,tailMode:N,treeForkCount:P}:(W.isBackwards=g,W.rendering=null,W.renderingStartTime=0,W.last=C,W.tail=b,W.tailMode=N,W.treeForkCount=P)}function Uz(h,g,b){var C=g.pendingProps,N=C.revealOrder,P=C.tail;C=C.children;var W=Or.current,X=(W&2)!==0;if(X?(W=W&1|2,g.flags|=128):W&=1,Y(Or,W),Ni(h,g,C,b),C=Mn?fx:0,!X&&h!==null&&(h.flags&128)!==0)e:for(h=g.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&Fz(h,b,g);else if(h.tag===19)Fz(h,b,g);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===g)break e;for(;h.sibling===null;){if(h.return===null||h.return===g)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}switch(N){case"forwards":for(b=g.child,N=null;b!==null;)h=b.alternate,h!==null&&xw(h)===null&&(N=b),b=b.sibling;b=N,b===null?(N=g.child,g.child=null):(N=b.sibling,b.sibling=null),aA(g,!1,N,b,P,C);break;case"backwards":case"unstable_legacy-backwards":for(b=null,N=g.child,g.child=null;N!==null;){if(h=N.alternate,h!==null&&xw(h)===null){g.child=N;break}h=N.sibling,N.sibling=b,b=N,N=h}aA(g,!0,b,null,P,C);break;case"together":aA(g,!1,null,null,void 0,C);break;default:g.memoizedState=null}return g.child}function Tu(h,g,b){if(h!==null&&(g.dependencies=h.dependencies),Qd|=g.lanes,(b&g.childLanes)===0)if(h!==null){if(xg(h,g,b,!1),(b&g.childLanes)===0)return null}else return null;if(h!==null&&g.child!==h.child)throw Error(s(153));if(g.child!==null){for(h=g.child,b=bu(h,h.pendingProps),g.child=b,b.return=g;h.sibling!==null;)h=h.sibling,b=b.sibling=bu(h,h.pendingProps),b.return=g;b.sibling=null}return g.child}
vendor: 4,684 bytes, line 49
49function oA(h,g){return(h.lanes&g)!==0?!0:(h=h.dependencies,!!(h!==null&&uw(h)))}function X2e(h,g,b){switch(g.tag){case 3:te(g,g.stateNode.containerInfo),Hd(g,Hr,h.memoizedState.cache),np();break;case 27:case 5:ye(g);break;case 4:te(g,g.stateNode.containerInfo);break;case 10:Hd(g,g.type,g.memoizedProps.value);break;case 31:if(g.memoizedState!==null)return g.flags|=128,L3(g),null;break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Kd(g),g.flags|=128,null):(b&g.child.childLanes)!==0?$z(h,g,b):(Kd(g),h=Tu(h,g,b),h!==null?h.sibling:null);Kd(g);break;case 19:var N=(h.flags&128)!==0;if(C=(b&g.childLanes)!==0,C||(xg(h,g,b,!1),C=(b&g.childLanes)!==0),N){if(C)return Uz(h,g,b);g.flags|=128}if(N=g.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),Y(Or,Or.current),C)break;return null;case 22:return g.lanes=0,Lz(h,g,b,g.pendingProps);case 24:Hd(g,Hr,h.memoizedState.cache)}return Tu(h,g,b)}function Bz(h,g,b){if(h!==null)if(h.memoizedProps!==g.pendingProps)Wr=!0;else{if(!oA(h,b)&&(g.flags&128)===0)return Wr=!1,X2e(h,g,b);Wr=(h.flags&131072)!==0}else Wr=!1,Mn&&(g.flags&1048576)!==0&&yB(g,fx,g.index);switch(g.lanes=0,g.tag){case 16:e:{var C=g.pendingProps;if(h=ap(g.elementType),g.type=h,typeof h=="function")f3(h)?(C=up(h,C),g.tag=1,g=Dz(null,g,h,C,b)):(g.tag=0,g=eA(null,g,h,C,b));else{if(h!=null){var N=h.$$typeof;if(N===T){g.tag=11,g=Az(null,g,h,C,b);break e}else if(N===I){g.tag=14,g=Nz(null,g,h,C,b);break e}}throw g=U(h)||h,Error(s(306,g,""))}}return g;case 0:return eA(h,g,g.type,g.pendingProps,b);case 1:return C=g.type,N=up(C,g.pendingProps),Dz(h,g,C,N,b);case 3:e:{if(te(g,g.stateNode.containerInfo),h===null)throw Error(s(387));C=g.pendingProps;var P=g.memoizedState;N=P.element,k3(h,g),bx(g,C,null,b);var W=g.memoizedState;if(C=W.cache,Hd(g,Hr,C),C!==P.cache&&S3(g,[Hr],b,!0),yx(),C=W.element,P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:W.cache},g.updateQueue.baseState=P,g.memoizedState=P,g.flags&256){g=Oz(h,g,C,b);break e}else if(C!==N){N=Uo(Error(s(424)),g),hx(N),g=Oz(h,g,C,b);break e}else{switch(h=g.stateNode.containerInfo,h.nodeType){case 9:h=h.body;break;default:h=h.nodeName==="HTML"?h.ownerDocument.body:h}for(Ws=Go(h.firstChild),Ri=g,Mn=!0,zd=null,Vo=!0,b=LB(g,null,C,b),g.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling}else{if(np(),C===N){g=Tu(h,g,b);break e}Ni(h,g,C,b)}g=g.child}return g;case 26:return Aw(h,g),h===null?(b=QV(g.type,null,g.pendingProps,null))?g.memoizedState=b:Mn||(b=g.type,h=g.pendingProps,C=Ww(Q.current).createElement(b),C[ut]=g,C[It]=h,Ii(C,b,h),Pt(C),g.stateNode=C):g.memoizedState=QV(g.type,h.memoizedProps,g.pendingProps,h.memoizedState),null;case 27:return ye(g),h===null&&Mn&&(C=g.stateNode=YV(g.type,g.pendingProps,Q.current),Ri=g,Vo=!0,N=Ws,sf(g.type)?(UA=N,Ws=Go(C.firstChild)):Ws=N),Ni(h,g,g.pendingProps.children,b),Aw(h,g),h===null&&(g.flags|=4194304),g.child;case 5:return h===null&&Mn&&((N=C=Ws)&&(C=kSe(C,g.type,g.pendingProps,Vo),C!==null?(g.stateNode=C,Ri=g,Ws=Go(C.firstChild),Vo=!1,N=!0):N=!1),N||Vd(g)),ye(g),N=g.type,P=g.pendingProps,W=h!==null?h.memoizedProps:null,C=P.children,MA(N,P)?C=null:W!==null&&MA(N,W)&&(g.flags|=32),g.memoizedState!==null&&(N=P3(h,g,z2e,null,null,b),Ux._currentValue=N),Aw(h,g),Ni(h,g,C,b),g.child;case 6:return h===null&&Mn&&((h=b=Ws)&&(b=RSe(b,g.pendingProps,Vo),b!==null?(g.stateNode=b,Ri=g,Ws=null,h=!0):h=!1),h||Vd(g)),null;case 13:return $z(h,g,b);case 4:return te(g,g.stateNode.containerInfo),C=g.pendingProps,h===null?g.child=lp(g,null,C,b):Ni(h,g,C,b),g.child;case 11:return Az(h,g,g.type,g.pendingProps,b);case 7:return Ni(h,g,g.pendingProps,b),g.child;case 8:return Ni(h,g,g.pendingProps.children,b),g.child;case 12:return Ni(h,g,g.pendingProps.children,b),g.child;case 10:return C=g.pendingProps,Hd(g,g.type,C.value),Ni(h,g,C.children,b),g.child;case 9:return N=g.type._context,C=g.pendingProps.children,rp(g),N=Ai(N),C=C(N),g.flags|=1,Ni(h,g,C,b),g.child;case 14:return Nz(h,g,g.type,g.pendingProps,b);case 15:return Iz(h,g,g.type,g.pendingProps,b);case 19:return Uz(h,g,b);case 31:return Z2e(h,g,b);case 22:return Lz(h,g,b,g.pendingProps);case 24:return rp(g),C=Ai(Hr),h===null?(N=E3(),N===null&&(N=Ls,P=w3(),N.pooledCache=P,P.refCount++,P!==null&&(N.pooledCacheLanes|=b),N=P),g.memoizedState={parent:C,cache:N},T3(g),Hd(g,Hr,N)):((h.lanes&b)!==0&&(k3(h,g),bx(g,null,null,b),yx()),N=h.memoizedState,P=g.memoizedState,N.parent!==C?(N={parent:C,cache:C},g.memoizedState=N,g.lanes===0&&(g.memoizedState=g.updateQueue.baseState=N),Hd(g,Hr,C)):(C=P.cache,Hd(g,Hr,C),C!==N.cache&&S3(g,[Hr],b,!0))),Ni(h,g,g.pendingProps.children,b),g.child;case 29:throw g.pendingProps}throw Error(s(156,g.tag))}function ku(h){h.flags|=4}
vendor: 4,155 bytes, line 49
49function lA(h,g,b,C,N){if((g=(h.mode&32)!==0)&&(g=!1),g){if(h.flags|=16777216,(N&335544128)===N)if(h.stateNode.complete)h.flags|=8192;else if(pV())h.flags|=8192;else throw op=pw,C3}else h.flags&=-16777217}function zz(h,g){if(g.type!=="stylesheet"||(g.state.loading&4)!==0)h.flags&=-16777217;else if(h.flags|=16777216,!sH(g))if(pV())h.flags|=8192;else throw op=pw,C3}function Iw(h,g){g!==null&&(h.flags|=4),h.flags&16384&&(g=h.tag!==22?gu():536870912,h.lanes|=g,Ng|=g)}function Tx(h,g){if(!Mn)switch(h.tailMode){case"hidden":g=h.tail;for(var b=null;g!==null;)g.alternate!==null&&(b=g),g=g.sibling;b===null?h.tail=null:b.sibling=null;break;case"collapsed":b=h.tail;for(var C=null;b!==null;)b.alternate!==null&&(C=b),b=b.sibling;C===null?g||h.tail===null?h.tail=null:h.tail.sibling=null:C.sibling=null}}function qs(h){var g=h.alternate!==null&&h.alternate.child===h.child,b=0,C=0;if(g)for(var N=h.child;N!==null;)b|=N.lanes|N.childLanes,C|=N.subtreeFlags&65011712,C|=N.flags&65011712,N.return=h,N=N.sibling;else for(N=h.child;N!==null;)b|=N.lanes|N.childLanes,C|=N.subtreeFlags,C|=N.flags,N.return=h,N=N.sibling;return h.subtreeFlags|=C,h.childLanes=b,g}function Q2e(h,g,b){var C=g.pendingProps;switch(g3(g),g.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qs(g),null;case 1:return qs(g),null;case 3:return b=g.stateNode,C=null,h!==null&&(C=h.memoizedState.cache),g.memoizedState.cache!==C&&(g.flags|=2048),_u(Hr),ue(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(h===null||h.child===null)&&(vg(g)?ku(g):h===null||h.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,x3())),qs(g),null;case 26:var N=g.type,P=g.memoizedState;return h===null?(ku(g),P!==null?(qs(g),zz(g,P)):(qs(g),lA(g,N,null,C,b))):P?P!==h.memoizedState?(ku(g),qs(g),zz(g,P)):(qs(g),g.flags&=-16777217):(h=h.memoizedProps,h!==C&&ku(g),qs(g),lA(g,N,h,C,b)),null;case 27:if(je(g),b=Q.current,N=g.type,h!==null&&g.stateNode!=null)h.memoizedProps!==C&&ku(g);else{if(!C){if(g.stateNode===null)throw Error(s(166));return qs(g),null}h=J.current,vg(g)?SB(g):(h=YV(N,C,b),g.stateNode=h,ku(g))}return qs(g),null;case 5:if(je(g),N=g.type,h!==null&&g.stateNode!=null)h.memoizedProps!==C&&ku(g);else{if(!C){if(g.stateNode===null)throw Error(s(166));return qs(g),null}if(P=J.current,vg(g))SB(g);else{var W=Ww(Q.current);switch(P){case 1:P=W.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:P=W.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":P=W.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":P=W.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":P=W.createElement("div"),P.innerHTML="<script><\/script>",P=P.removeChild(P.firstChild);break;case"select":P=typeof C.is=="string"?W.createElement("select",{is:C.is}):W.createElement("select"),C.multiple?P.multiple=!0:C.size&&(P.size=C.size);break;default:P=typeof C.is=="string"?W.createElement(N,{is:C.is}):W.createElement(N)}}P[ut]=g,P[It]=C;e:for(W=g.child;W!==null;){if(W.tag===5||W.tag===6)P.appendChild(W.stateNode);else if(W.tag!==4&&W.tag!==27&&W.child!==null){W.child.return=W,W=W.child;continue}if(W===g)break e;for(;W.sibling===null;){if(W.return===null||W.return===g)break e;W=W.return}W.sibling.return=W.return,W=W.sibling}g.stateNode=P;e:switch(Ii(P,N,C),N){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}C&&ku(g)}}return qs(g),lA(g,g.type,h===null?null:h.memoizedProps,g.pendingProps,b),null;case 6:if(h&&g.stateNode!=null)h.memoizedProps!==C&&ku(g);else{if(typeof C!="string"&&g.stateNode===null)throw Error(s(166));if(h=Q.current,vg(g)){if(h=g.stateNode,b=g.memoizedProps,C=null,N=Ri,N!==null)switch(N.tag){case 27:case 5:C=N.memoizedProps}h[ut]=g,h=!!(h.nodeValue===b||C!==null&&C.suppressHydrationWarning===!0||$V(h.nodeValue,b)),h||Vd(g,!0)}else h=Ww(h).createTextNode(C),h[ut]=g,g.stateNode=h}return qs(g),null;case 31:if(b=g.memoizedState,h===null||h.memoizedState!==null){if(C=vg(g),b!==null){if(h===null){if(!C)throw Error(s(318));if(h=g.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(557)
vendor: 21,683 bytes, line 49
49);h[ut]=g}else np(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;qs(g),h=!1}else b=x3(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=b),h=!0;if(!h)return g.flags&256?(io(g),g):(io(g),null);if((g.flags&128)!==0)throw Error(s(558))}return qs(g),null;case 13:if(C=g.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(N=vg(g),C!==null&&C.dehydrated!==null){if(h===null){if(!N)throw Error(s(318));if(N=g.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(s(317));N[ut]=g}else np(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;qs(g),N=!1}else N=x3(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=N),N=!0;if(!N)return g.flags&256?(io(g),g):(io(g),null)}return io(g),(g.flags&128)!==0?(g.lanes=b,g):(b=C!==null,h=h!==null&&h.memoizedState!==null,b&&(C=g.child,N=null,C.alternate!==null&&C.alternate.memoizedState!==null&&C.alternate.memoizedState.cachePool!==null&&(N=C.alternate.memoizedState.cachePool.pool),P=null,C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(P=C.memoizedState.cachePool.pool),P!==N&&(C.flags|=2048)),b!==h&&b&&(g.child.flags|=8192),Iw(g,g.updateQueue),qs(g),null);case 4:return ue(),h===null&&NA(g.stateNode.containerInfo),qs(g),null;case 10:return _u(g.type),qs(g),null;case 19:if(K(Or),C=g.memoizedState,C===null)return qs(g),null;if(N=(g.flags&128)!==0,P=C.rendering,P===null)if(N)Tx(C,!1);else{if(br!==0||h!==null&&(h.flags&128)!==0)for(h=g.child;h!==null;){if(P=xw(h),P!==null){for(g.flags|=128,Tx(C,!1),h=P.updateQueue,g.updateQueue=h,Iw(g,h),g.subtreeFlags=0,h=b,b=g.child;b!==null;)gB(b,h),b=b.sibling;return Y(Or,Or.current&1|2),Mn&&Su(g,C.treeForkCount),g.child}h=h.sibling}C.tail!==null&&Ke()>Dw&&(g.flags|=128,N=!0,Tx(C,!1),g.lanes=4194304)}else{if(!N)if(h=xw(P),h!==null){if(g.flags|=128,N=!0,h=h.updateQueue,g.updateQueue=h,Iw(g,h),Tx(C,!0),C.tail===null&&C.tailMode==="hidden"&&!P.alternate&&!Mn)return qs(g),null}else 2*Ke()-C.renderingStartTime>Dw&&b!==536870912&&(g.flags|=128,N=!0,Tx(C,!1),g.lanes=4194304);C.isBackwards?(P.sibling=g.child,g.child=P):(h=C.last,h!==null?h.sibling=P:g.child=P,C.last=P)}return C.tail!==null?(h=C.tail,C.rendering=h,C.tail=h.sibling,C.renderingStartTime=Ke(),h.sibling=null,b=Or.current,Y(Or,N?b&1|2:b&1),Mn&&Su(g,C.treeForkCount),h):(qs(g),null);case 22:case 23:return io(g),I3(),C=g.memoizedState!==null,h!==null?h.memoizedState!==null!==C&&(g.flags|=8192):C&&(g.flags|=8192),C?(b&536870912)!==0&&(g.flags&128)===0&&(qs(g),g.subtreeFlags&6&&(g.flags|=8192)):qs(g),b=g.updateQueue,b!==null&&Iw(g,b.retryQueue),b=null,h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),C=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(C=g.memoizedState.cachePool.pool),C!==b&&(g.flags|=2048),h!==null&&K(ip),null;case 24:return b=null,h!==null&&(b=h.memoizedState.cache),g.memoizedState.cache!==b&&(g.flags|=2048),_u(Hr),qs(g),null;case 25:return null;case 30:return null}throw Error(s(156,g.tag))}function J2e(h,g){switch(g3(g),g.tag){case 1:return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 3:return _u(Hr),ue(),h=g.flags,(h&65536)!==0&&(h&128)===0?(g.flags=h&-65537|128,g):null;case 26:case 27:case 5:return je(g),null;case 31:if(g.memoizedState!==null){if(io(g),g.alternate===null)throw Error(s(340));np()}return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 13:if(io(g),h=g.memoizedState,h!==null&&h.dehydrated!==null){if(g.alternate===null)throw Error(s(340));np()}return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 19:return K(Or),null;case 4:return ue(),null;case 10:return _u(g.type),null;case 22:case 23:return io(g),I3(),h!==null&&K(ip),h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 24:return _u(Hr),null;case 25:return null;default:return null}}function Vz(h,g){switch(g3(g),g.tag){case 3:_u(Hr),ue();break;case 26:case 27:case 5:je(g);break;case 4:ue();break;case 31:g.memoizedState!==null&&io(g);break;case 13:io(g);break;case 19:K(Or);break;case 10:_u(g.type);break;case 22:case 23:io(g),I3(),h!==null&&K(ip);break;case 24:_u(Hr)}}function kx(h,g){try{var b=g.updateQueue,C=b!==null?b.lastEffect:null;if(C!==null){var N=C.next;b=N;do{if((b.tag&h)===h){C=void 0;var P=b.create,W=b.inst;C=P(),W.destroy=C}b=b.next}while(b!==N)}}catch(X){bs(g,g.return,X)}}function Zd(h,g,b){try{var C=g.updateQueue,N=C!==null?C.lastEffect:null;if(N!==null){var P=N.next;C=P;do{if((C.tag&h)===h){var W=C.inst,X=W.destroy;if(X!==void 0){W.destroy=void 0,N=g;var oe=b,Se=X;try{Se()}catch(Pe){bs(N,oe,Pe)}}}C=C.next}while(C!==P)}}catch(Pe){bs(g,g.return,Pe)}}function Hz(h){var g=h.updateQueue;if(g!==null){var b=h.stateNode;try{PB(g,b)}catch(C){bs(h,h.return,C)}}}function Gz(h,g,b){b.props=up(h.type,h.memoizedProps),b.state=h.memoizedState;try{b.componentWillUnmount()}catch(C){bs(h,g,C)}}function Rx(h,g){try{var b=h.ref;if(b!==null){switch(h.tag){case 26:case 27:case 5:var C=h.stateNode;break;case 30:C=h.stateNode;break;default:C=h.stateNode}typeof b=="function"?h.refCleanup=b(C):b.current=C}}catch(N){bs(h,g,N)}}function fc(h,g){var b=h.ref,C=h.refCleanup;if(b!==null)if(typeof C=="function")try{C()}catch(N){bs(h,g,N)}finally{h.refCleanup=null,h=h.alternate,h!=null&&(h.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(N){bs(h,g,N)}else b.current=null}function Wz(h){var g=h.type,b=h.memoizedProps,C=h.stateNode;try{e:switch(g){case"button":case"input":case"select":case"textarea":b.autoFocus&&C.focus();break e;case"img":b.src?C.src=b.src:b.srcSet&&(C.srcset=b.srcSet)}}catch(N){bs(h,h.return,N)}}function cA(h,g,b){try{var C=h.stateNode;SSe(C,h.type,b,g),C[It]=g}catch(N){bs(h,h.return,N)}}function qz(h){return h.tag===5||h.tag===3||h.tag===26||h.tag===27&&sf(h.type)||h.tag===4}function uA(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||qz(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.tag===27&&sf(h.type)||h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function dA(h,g,b){var C=h.tag;if(C===5||C===6)h=h.stateNode,g?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(h,g):(g=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,g.appendChild(h),b=b._reactRootContainer,b!=null||g.onclick!==null||(g.onclick=xu));else if(C!==4&&(C===27&&sf(h.type)&&(b=h.stateNode,g=null),h=h.child,h!==null))for(dA(h,g,b),h=h.sibling;h!==null;)dA(h,g,b),h=h.sibling}function Lw(h,g,b){var C=h.tag;if(C===5||C===6)h=h.stateNode,g?b.insertBefore(h,g):b.appendChild(h);else if(C!==4&&(C===27&&sf(h.type)&&(b=h.stateNode),h=h.child,h!==null))for(Lw(h,g,b),h=h.sibling;h!==null;)Lw(h,g,b),h=h.sibling}function Kz(h){var g=h.stateNode,b=h.memoizedProps;try{for(var C=h.type,N=g.attributes;N.length;)g.removeAttributeNode(N[0]);Ii(g,C,b),g[ut]=h,g[It]=b}catch(P){bs(h,h.return,P)}}var Ru=!1,qr=!1,fA=!1,Yz=typeof WeakSet=="function"?WeakSet:Set,hi=null;function eSe(h,g){if(h=h.containerInfo,jA=Jw,h=oB(h),i3(h)){if("selectionStart"in h)var b={start:h.selectionStart,end:h.selectionEnd};else e:{b=(b=h.ownerDocument)&&b.defaultView||window;var C=b.getSelection&&b.getSelection();if(C&&C.rangeCount!==0){b=C.anchorNode;var N=C.anchorOffset,P=C.focusNode;C=C.focusOffset;try{b.nodeType,P.nodeType}catch{b=null;break e}var W=0,X=-1,oe=-1,Se=0,Pe=0,Be=h,_e=null;t:for(;;){for(var Te;Be!==b||N!==0&&Be.nodeType!==3||(X=W+N),Be!==P||C!==0&&Be.nodeType!==3||(oe=W+C),Be.nodeType===3&&(W+=Be.nodeValue.length),(Te=Be.firstChild)!==null;)_e=Be,Be=Te;for(;;){if(Be===h)break t;if(_e===b&&++Se===N&&(X=W),_e===P&&++Pe===C&&(oe=W),(Te=Be.nextSibling)!==null)break;Be=_e,_e=Be.parentNode}Be=Te}b=X===-1||oe===-1?null:{start:X,end:oe}}else b=null}b=b||{start:0,end:0}}else b=null;for(PA={focusedElem:h,selectionRange:b},Jw=!1,hi=g;hi!==null;)if(g=hi,h=g.child,(g.subtreeFlags&1028)!==0&&h!==null)h.return=g,hi=h;else for(;hi!==null;){switch(g=hi,P=g.alternate,h=g.flags,g.tag){case 0:if((h&4)!==0&&(h=g.updateQueue,h=h!==null?h.events:null,h!==null))for(b=0;b<h.length;b++)N=h[b],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((h&1024)!==0&&P!==null){h=void 0,b=g,N=P.memoizedProps,P=P.memoizedState,C=b.stateNode;try{var kt=up(b.type,N);h=C.getSnapshotBeforeUpdate(kt,P),C.__reactInternalSnapshotBeforeUpdate=h}catch(Kt){bs(b,b.return,Kt)}}break;case 3:if((h&1024)!==0){if(h=g.stateNode.containerInfo,b=h.nodeType,b===9)OA(h);else if(b===1)switch(h.nodeName){case"HEAD":case"HTML":case"BODY":OA(h);break;default:h.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(s(163))}if(h=g.sibling,h!==null){h.return=g.return,hi=h;break}hi=g.return}}function Zz(h,g,b){var C=b.flags;switch(b.tag){case 0:case 11:case 15:Nu(h,b),C&4&&kx(5,b);break;case 1:if(Nu(h,b),C&4)if(h=b.stateNode,g===null)try{h.componentDidMount()}catch(W){bs(b,b.return,W)}else{var N=up(b.type,g.memoizedProps);g=g.memoizedState;try{h.componentDidUpdate(N,g,h.__reactInternalSnapshotBeforeUpdate)}catch(W){bs(b,b.return,W)}}C&64&&Hz(b),C&512&&Rx(b,b.return);break;case 3:if(Nu(h,b),C&64&&(h=b.updateQueue,h!==null)){if(g=null,b.child!==null)switch(b.child.tag){case 27:case 5:g=b.child.stateNode;break;case 1:g=b.child.stateNode}try{PB(h,g)}catch(W){bs(b,b.return,W)}}break;case 27:g===null&&C&4&&Kz(b);case 26:case 5:Nu(h,b),g===null&&C&4&&Wz(b),C&512&&Rx(b,b.return);break;case 12:Nu(h,b);break;case 31:Nu(h,b),C&4&&Jz(h,b);break;case 13:Nu(h,b),C&4&&eV(h,b),C&64&&(h=b.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(b=cSe.bind(null,b),ASe(h,b))));break;case 22:if(C=b.memoizedState!==null||Ru,!C){g=g!==null&&g.memoizedState!==null||qr,N=Ru;var P=qr;Ru=C,(qr=g)&&!P?Iu(h,b,(b.subtreeFlags&8772)!==0):Nu(h,b),Ru=N,qr=P}break;case 30:break;default:Nu(h,b)}}function Xz(h){var g=h.alternate;g!==null&&(h.alternate=null,Xz(g)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(g=h.stateNode,g!==null&&tt(g)),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}var ir=null,Oa=!1;function Au(h,g,b){for(b=b.child;b!==null;)Qz(h,g,b),b=b.sibling}function Qz(h,g,b){if(ie&&typeof ie.onCommitFiberUnmount=="function")try{ie.onCommitFiberUnmount(Z,b)}catch{}switch(b.tag){case 26:qr||fc(b,g),Au(h,g,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:qr||fc(b,g);var C=ir,N=Oa;sf(b.type)&&(ir=b.stateNode,Oa=!1),Au(h,g,b),Ox(b.stateNode),ir=C,Oa=N;break;case 5:qr||fc(b,g);case 6:if(C=ir,N=Oa,ir=null,Au(h,g,b),ir=C,Oa=N,ir!==null)if(Oa)try{(ir.nodeType===9?ir.body:ir.nodeName==="HTML"?ir.ownerDocument.body:ir).removeChild(b.stateNode)}catch(P){bs(b,g,P)}else try{ir.removeChild(b.stateNode)}catch(P){bs(b,g,P)}break;case 18:ir!==null&&(Oa?(h=ir,HV(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,b.stateNode),$g(h)):HV(ir,b.stateNode));break;case 4:C=ir,N=Oa,ir=b.stateNode.containerInfo,Oa=!0,Au(h,g,b),ir=C,Oa=N;break;case 0:case 11:case 14:case 15:Zd(2,b,g),qr||Zd(4,b,g),Au(h,g,b);break;case 1:qr||(fc(b,g),C=b.stateNode,typeof C.componentWillUnmount=="function"&&Gz(b,g,C)),Au(h,g,b);break;case 21:Au(h,g,b);break;case 22:qr=(C=qr)||b.memoizedState!==null,Au(h,g,b),qr=C;break;default:Au(h,g,b)}}function Jz(h,g){if(g.memoizedState===null&&(h=g.alternate,h!==null&&(h=h.memoizedState,h!==null))){h=h.dehydrated;try{$g(h)}catch(b){bs(g,g.return,b)}}}function eV(h,g){if(g.memoizedState===null&&(h=g.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null))))try{$g(h)}catch(b){bs(g,g.return,b)}}function tSe(h){switch(h.tag){case 31:case 13:case 19:var g=h.stateNode;return g===null&&(g=h.stateNode=new Yz),g;case 22:return h=h.stateNode,g=h._retryCache,g===null&&(g=h._retryCache=new Yz),g;default:throw Error(s(435,h.tag))}}function jw(h,g){var b=tSe(h);g.forEach(function(C){if(!b.has(C)){b.add(C);var N=uSe.bind(null,h,C);C.then(N,N)}})}function $a(h,g){var b=g.deletions;if(b!==null)for(var C=0;C<b.length;C++){var N=b[C],P=h,W=g,X=W;e:for(;X!==null;){switch(X.tag){case 27:if(sf(X.type)){ir=X.stateNode,Oa=!1;break e}break;case 5:ir=X.stateNode,Oa=!1;break e;case 3:case 4:ir=X.stateNode.containerInfo,Oa=!0;break e}X=X.return}if(ir===null)throw Error(s(160));Qz(P,W,N),ir=null,Oa=!1,P=N.alternate,P!==null&&(P.return=null),N.return=null}if(g.subtreeFlags&13886)for(g=g.child;g!==null;)tV(g,h),g=g.sibling}var wl=null;function tV(h,g){var b=h.alternate,C=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:$a(g,h),Fa(h),C&4&&(Zd(3,h,h.return),kx(3,h),Zd(5,h,h.return));break;case 1:$a(g,h),Fa(h),C&512&&(qr||b===null||fc(b,b.return)),C&64&&Ru&&(h=h.updateQueue,h!==null&&(C=h.callbacks,C!==null&&(b=h.shared.hiddenCallbacks,h.shared.hiddenCallbacks=b===null?C:b.concat(C))));break;case 26:var N=wl;if($a(g,h),Fa(h),C&512&&(qr||b===null||fc(b,b.return)),C&4){var P=b!==null?b.memoizedState:null;if(C=h.memoizedState,b===null)if(C===null)if(h.stateNode===null){e:{C=h.type,b=h.memoizedProps,N=N.ownerDocument||N;t:switch(C){case"title":P=N.getElementsByTagName("title")[0],(!P||P[Fe]||P[ut]||P.namespaceURI==="http://www.w3.org/2000/svg"||P.hasAttribute("itemprop"))&&(P=N.createElement(C),N.head.insertBefore(P,N.querySelector("head > title"))),Ii(P,C,b),P[ut]=h,Pt(P),C=P;break e;case"link":var W=tH("link","href",N).get(C+(b.href||""));if(W){for(var X=0;X<W.length;X++)if(P=W[X],P.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&P.getAttribute("rel")===(b.rel==null?null:b.rel)&&P.getAttribute("title")===(b.title==null?null:b.title)&&P.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){W.splice(X,1);break t}}P=N.createElement(C),Ii(P,C,b),N.head.appendChild(P);break;case"meta":if(W=tH("meta","content",N).get(C+(b.content||""))){for(X=0;X<W.length;X++)if(P=W[X],P.getAttribute("content")===(b.content==null?null:""+b.content)&&P.getAttribute("name")===(b.name==null?null:b.name)&&P.getAttribute("property")===(b.property==null?null:b.property)&&P.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&P.getAttribute("charset")===(b.charSet==null?null:b.charSet)){W.splice(X,1);break t}}P=N.createElement(C),Ii(P,C,b),N.head.appendChild(P);break;default:throw Error(s(468,C))}P[ut]=h,Pt(P),C=P}h.stateNode=C}else nH(N,h.type,h.stateNode);else h.stateNode=eH(N,C,h.memoizedProps);else P!==C?(P===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):P.count--,C===null?nH(N,h.type,h.stateNode):eH(N,C,h.memoizedProps)):C===null&&h.stateNode!==null&&cA(h,h.memoizedProps,b.memoizedProps)}break;case 27:$a(g,h),Fa(h),C&512&&(qr||b===null||fc(b,b.return)),b!==null&&C&4&&cA(h,h.memoizedProps,b.memoizedProps);break;case 5:if($a(g,h),Fa(h),C&512&&(qr||b===null||fc(b,b.return)),h.flags&32){N=h.stateNode;try{og(N,"")}catch(kt){bs(h,h.return,kt)}}C&4&&h.stateNode!=null&&(N=h.memoizedProps,cA(h,N,b!==null?b.memoizedProps:N)),C&1024&&(fA=!0);break;case 6:if($a(g,h),Fa(h),C&4){if(h.stateNode===null)throw Error(s(162));C=h.memoizedProps,b=h.stateNode;try{b.nodeValue=C}catch(kt){bs(h,h.return,kt)}}break;case 3:if(Yw=null,N=wl,wl=qw(g.containerInfo),$a(g,h),wl=N,Fa(h),C&4&&b!==null&&b.memoizedState.isDehydrated)try{$g(g.containerInfo)}catch(kt){bs(h,h.return,kt)}fA&&(fA=!1,nV(h));break;case 4:C=wl,wl=qw(h.stateNode.containerInfo),$a(g,h),Fa(h),wl=C;break;case 12:$a(g,h),Fa(h);break;case 31:$a(g,h),Fa(h),C&4&&(C=h.updateQueue,C!==null&&(h.updateQueue=null,jw(h,C)));break;case 13:$a(g,h),Fa(h),h.child.flags&8192&&h.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(Mw=Ke()),C&4&&(C=h.updateQueue,C!==null&&(h.updateQueue=null,jw(h,C)));break;case 22:N=h.memoizedState!==null;var oe=b!==null&&b.memoizedState!==null,Se=Ru,Pe=qr;if(Ru=Se||N,qr=Pe||oe,$a(g,h),qr=Pe,Ru=Se,Fa(h),C&8192)e:for(g=h.stateNode,g._visibility=N?g._visibility&-2:g._visibility|1,N&&(b===null||oe||Ru||qr||dp(h)),b=null,g=h;;){if(g.tag===5||g.tag===26){if(b===null){oe=b=g;try{if(P=oe.stateNode,N)W=P.style,typeof W.setProperty=="function"?W.setProperty("display","none","important"):W.display="none";else{X=oe.stateNode;var Be=oe.memoizedProps.style,_e=Be!=null&&Be.hasOwnProperty("display")?Be.display:null;X.style.display=_e==null||typeof _e=="boolean"?"":(""+_e).trim()}}catch(kt){bs(oe,oe.return,kt)}}}else if(g.tag===6){if(b===null){oe=g;try{oe.stateNode.nodeValue=N?"":oe.memoizedProps}catch(kt){bs(oe,oe.return,kt)}}}else if(g.tag===18){if(b===null){oe=g;try{var Te=oe.stateNode;N?GV(Te,!0):GV(oe.stateNode,!1)}catch(kt){bs(oe,oe.return,kt)}}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===h)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break e;for(;g.sibling===null;){if(g.return===null||g.return===h)break e;b===g&&(b=null),g=g.return}b===g&&(b=null),g.sibling.return=g.return,g=g.sibling}C&4&&(C=h.updateQueue,C!==null&&(b=C.retryQueue,b!==null&&(C.retryQueue=null,jw(h,b))));break;case 19:$a(g,h),Fa(h),C&4&&(C=h.updateQueue,C!==null&&(h.updateQueue=null,jw(h,C)));break;case 30:break;case 21:break;default:$a(g,h),Fa(h)}}function Fa(h){var g=h.flags;if(g&2){try{for(var b,C=h.return;C!==null;){if(qz(C)){b=C;break}C=C.return}if(b==null)throw Error(s(160));switch(b.tag){case 27:var N=b.stateNode,P=uA(h);Lw(h,P,N);break;case 5:var W=b.stateNode;b.flags&32&&(og(W,""),b.flags&=-33);var X=uA(h);Lw(h,X,W);break;case 3:case 4:var oe=b.stateNode.containerInfo,Se=uA(h);dA(h,Se,oe);break;default:throw Error(s(161))}}catch(Pe){bs(h,h.return,Pe)}h.flags&=-3}g&4096&&(h.flags&=-4097)}function nV(h){if(h.subtreeFlags&1024)for(h=h.child;h!==null;){var g=h;nV(g),g.tag===5&&g.flags&1024&&g.stateNode.reset(),h=h.sibling}}function Nu(h,g){if(g.subtreeFlags&8772)for(g=g.child;g!==null;)Zz(h,g.alternate,g),g=g.sibling}function dp(h){for(h=h.child;h!==null;){var g=h;switch(g.tag){case 0:case 11:case 14:case 15:Zd(4,g,g.return),dp(g);break;case 1:fc(g,g.return);var b=g.stateNode;typeof b.componentWillUnmount=="function"&&Gz(g,g.return,b),dp(g);break;case 27:Ox(g.stateNode);case 26:case 5:fc(g,g.return),dp(g);break;case 22:g.memoizedState===null&&dp(g);break;case 30:dp(g);break;default:dp(g)}h=h.sibling}}function Iu(h,g,b){for(b=b&&(g.subtreeFlags&8772)!==0,g=g.child;g!==null;){var C=g.alternate,N=h,P=g,W=P.flags;switch(P.tag){case 0:case 11:case 15:Iu(N,P,b),kx(4,P);break;case 1:if(Iu(N,P,b),C=P,N=C.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(Se){bs(C,C.return,Se)}if(C=P,N=C.updateQueue,N!==null){var X=C.stateNode;try{var oe=N.shared.hiddenCallbacks;if(oe!==null)for(N.shared.hiddenCallbacks=null,N=0;N<oe.length;N++)jB(oe[N],X)}catch(Se){bs(C,C.return,Se)}}b&&W&64&&Hz(P),Rx(P,P.return);break;case 27:Kz(P);case 26:case 5:Iu(N,P,b),b&&C===null&&W&4&&Wz(P),Rx(P,P.return);break;case 12:Iu(N,P,b);break;case 31:Iu(N,P,b),b&&W&4&&Jz(N,P);break;case 13:Iu(N,P,b),b&&W&4&&eV(N,P);break;case 22:P.memoizedState===null&&Iu(N,P,b),Rx(P,P.return);break;case 30:break;default:Iu(N,P,b)}g=g.sibling}}function hA(h,g){var b=null;h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),h=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(h=g.memoizedState.cachePool.pool),h!==b&&(h!=null&&h.refCount++,b!=null&&px(b))}function pA(h,g){h=null,g.alternate!==null&&(h=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==h&&(g.refCount++,h!=null&&px(h))}function _l(h,g,b,C){if(g.subtreeFlags&10256)for(g=g.child;g!==null;)sV(h,g,b,C),g=g.sibling}function sV(h,g,b,C){var N=g.flags;switch(g.tag){case 0:case 11:case 15:_l(h,g,b,C),N&2048&&kx(9,g);break;case 1:_l(h,g,b,C);break;case 3:_l(h,g,b,C),N&2048&&(h=null,g.alternate!==null&&(h=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==h&&(g.refCount++,h!=null&&px(h)));break;case 12:if(N&2048){_l(h,g,b,C),h=g.stateNode;try{var P=g.memoizedProps,W=P.id,X=P.onPostCommit;typeof X=="function"&&X(W,g.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(oe){bs(g,g.return,oe)}}else _l(h,g,b,C);break;case 31:_l(h,g,b,C);break;case 13:_l(h,g,b,C);break;case 23:break;case 22:P=g.stateNode,W=g.alternate,g.memoizedState!==null?P._visibility&2?_l(h,g,b,C):Ax(h,g):P._visibility&2?_l(h,g,b,C):(P._visibility|=2,kg(h,g,b,C,(g.subtreeFlags&10256)!==0||!1)),N&2048&&hA(W,g);break;case 24:_l(h,g,b,C),N&2048&&pA(g.alternate,g);break;default:_l(h,g,b,C)}}function kg(h,g,b,C,N){for(N=N&&((g.subtreeFlags&10256)!==0||!1),g=g.child;g!==null;){var P=h,W=g,X=b,oe=C,Se=W.flags;switch(W.tag){case 0:case 11:case 15:kg(P,W,X,oe,N),kx(8,W);break;case 23:break;case 22:var Pe=W.stateNode;W.memoizedState!==null?Pe._visibility&2?kg(P,W,X,oe,N):Ax(P,W):(Pe._visibility|=2,kg(P,W,X,oe,N)),N&&Se&2048&&hA(W.alternate,W);break;case 24:kg(P,W,X,oe,N),N&&Se&2048&&pA(W.alternate,W);break;default:kg(P,W,X,oe,N)}g=g.sibling}}function Ax(h,g){if(g.subtreeFlags&10256)for(g=g.child;g!==null;){var b=h,C=g,N=C.flags;switch(C.tag){case 22:Ax(b,C),N&2048&&hA(C.alternate,C);break;case 24:Ax(b,C),N&2048&&pA(C.alternate,C);break;default:Ax(b,C)}g=g.sibling}}var Nx=8192;function Rg(h,g,b){if(h.subtreeFlags&Nx)for(h=h.child;h!==null;)rV(h,g,b),h=h.sibling}function rV(h,g,b){switch(h.tag){case 26:Rg(h,g,b),h.flags&Nx&&h.memoizedState!==null&&BSe(b,wl,h.memoizedState,h.memoizedProps);break;case 5:Rg(h,g,b);break;case 3:case 4:var C=wl;wl=qw(h.stateNode.containerInfo),Rg(h,g,b),wl=C;break;case 22:h.memoizedState===null&&(C=h.alternate,C!==null&&C.memoizedState!==null?(C=Nx,Nx=16777216,Rg(h,g,b),Nx=C):Rg(h,g,b));break;default:Rg(h,g,b)}}function iV(h){var g=h.alternate;if(g!==null&&(h=g.child,h!==null)){g.child=null;do g=h.sibling,h.sibling=null,h=g;while(h!==null)}}
vendor: 4,348 bytes, line 49
49function Ix(h){var g=h.deletions;if((h.flags&16)!==0){if(g!==null)for(var b=0;b<g.length;b++){var C=g[b];hi=C,oV(C,h)}iV(h)}if(h.subtreeFlags&10256)for(h=h.child;h!==null;)aV(h),h=h.sibling}function aV(h){switch(h.tag){case 0:case 11:case 15:Ix(h),h.flags&2048&&Zd(9,h,h.return);break;case 3:Ix(h);break;case 12:Ix(h);break;case 22:var g=h.stateNode;h.memoizedState!==null&&g._visibility&2&&(h.return===null||h.return.tag!==13)?(g._visibility&=-3,Pw(h)):Ix(h);break;default:Ix(h)}}function Pw(h){var g=h.deletions;if((h.flags&16)!==0){if(g!==null)for(var b=0;b<g.length;b++){var C=g[b];hi=C,oV(C,h)}iV(h)}for(h=h.child;h!==null;){switch(g=h,g.tag){case 0:case 11:case 15:Zd(8,g,g.return),Pw(g);break;case 22:b=g.stateNode,b._visibility&2&&(b._visibility&=-3,Pw(g));break;default:Pw(g)}h=h.sibling}}function oV(h,g){for(;hi!==null;){var b=hi;switch(b.tag){case 0:case 11:case 15:Zd(8,b,g);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var C=b.memoizedState.cachePool.pool;C!=null&&C.refCount++}break;case 24:px(b.memoizedState.cache)}if(C=b.child,C!==null)C.return=b,hi=C;else e:for(b=h;hi!==null;){C=hi;var N=C.sibling,P=C.return;if(Xz(C),C===b){hi=null;break e}if(N!==null){N.return=P,hi=N;break e}hi=P}}}var nSe={getCacheForType:function(h){var g=Ai(Hr),b=g.data.get(h);return b===void 0&&(b=h(),g.data.set(h,b)),b},cacheSignal:function(){return Ai(Hr).controller.signal}},sSe=typeof WeakMap=="function"?WeakMap:Map,Jn=0,Ls=null,Tn=null,In=0,ys=0,ao=null,Xd=!1,Ag=!1,mA=!1,Lu=0,br=0,Qd=0,fp=0,gA=0,oo=0,Ng=0,Lx=null,Ua=null,vA=!1,Mw=0,lV=0,Dw=1/0,Ow=null,Jd=null,si=0,ef=null,Ig=null,ju=0,xA=0,yA=null,cV=null,jx=0,bA=null;function lo(){return(Jn&2)!==0&&In!==0?In&-In:$.T!==null?TA():ze()}function uV(){if(oo===0)if((In&536870912)===0||Mn){var h=ft;ft<<=1,(ft&3932160)===0&&(ft=262144),oo=h}else oo=536870912;return h=ro.current,h!==null&&(h.flags|=32),oo}function Ba(h,g,b){(h===Ls&&(ys===2||ys===9)||h.cancelPendingCommit!==null)&&(Lg(h,0),tf(h,In,oo,!1)),Pa(h,b),((Jn&2)===0||h!==Ls)&&(h===Ls&&((Jn&2)===0&&(fp|=b),br===4&&tf(h,In,oo,!1)),hc(h))}function dV(h,g,b){if((Jn&6)!==0)throw Error(s(327));var C=!b&&(g&127)===0&&(g&h.expiredLanes)===0||Cs(h,g),N=C?aSe(h,g):wA(h,g,!0),P=C;do{if(N===0){Ag&&!C&&tf(h,g,0,!1);break}else{if(b=h.current.alternate,P&&!rSe(b)){N=wA(h,g,!1),P=!1;continue}if(N===2){if(P=g,h.errorRecoveryDisabledLanes&P)var W=0;else W=h.pendingLanes&-536870913,W=W!==0?W:W&536870912?536870912:0;if(W!==0){g=W;e:{var X=h;N=Lx;var oe=X.current.memoizedState.isDehydrated;if(oe&&(Lg(X,W).flags|=256),W=wA(X,W,!1),W!==2){if(mA&&!oe){X.errorRecoveryDisabledLanes|=P,fp|=P,N=4;break e}P=Ua,Ua=N,P!==null&&(Ua===null?Ua=P:Ua.push.apply(Ua,P))}N=W}if(P=!1,N!==2)continue}}if(N===1){Lg(h,0),tf(h,g,0,!0);break}e:{switch(C=h,P=N,P){case 0:case 1:throw Error(s(345));case 4:if((g&4194048)!==g)break;case 6:tf(C,g,oo,!Xd);break e;case 2:Ua=null;break;case 3:case 5:break;default:throw Error(s(329))}if((g&62914560)===g&&(N=Mw+300-Ke(),10<N)){if(tf(C,g,oo,!Xd),Nn(C,0,!0)!==0)break e;ju=g,C.timeoutHandle=zV(fV.bind(null,C,b,Ua,Ow,vA,g,oo,fp,Ng,Xd,P,"Throttled",-0,0),N);break e}fV(C,b,Ua,Ow,vA,g,oo,fp,Ng,Xd,P,null,-0,0)}}break}while(!0);hc(h)}function fV(h,g,b,C,N,P,W,X,oe,Se,Pe,Be,_e,Te){if(h.timeoutHandle=-1,Be=g.subtreeFlags,Be&8192||(Be&16785408)===16785408){Be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xu},rV(g,P,Be);var kt=(P&62914560)===P?Mw-Ke():(P&4194048)===P?lV-Ke():0;if(kt=zSe(Be,kt),kt!==null){ju=P,h.cancelPendingCommit=kt(bV.bind(null,h,g,P,b,C,N,W,X,oe,Pe,Be,null,_e,Te)),tf(h,P,W,!Se);return}}bV(h,g,P,b,C,N,W,X,oe)}function rSe(h){for(var g=h;;){var b=g.tag;if((b===0||b===11||b===15)&&g.flags&16384&&(b=g.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var C=0;C<b.length;C++){var N=b[C],P=N.getSnapshot;N=N.value;try{if(!no(P(),N))return!1}catch{return!1}}if(b=g.child,g.subtreeFlags&16384&&b!==null)b.return=g,g=b;else{if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function tf(h,g,b,C){g&=~gA,g&=~fp,h.suspendedLanes|=g,h.pingedLanes&=~g,C&&(h.warmLanes|=g),C=h.expirationTimes;for(var N=g;0<N;){var P=31-Ee(N),W=1<<P;C[P]=-1,N&=~W}b!==0&&Dr(h,b,g)}function $w(){return(Jn&6)===0?(Px(0),!1):!0}
vendor: 2,850 bytes, line 49
49function SA(){if(Tn!==null){if(ys===0)var h=Tn.return;else h=Tn,wu=sp=null,O3(h),wg=null,gx=0,h=Tn;for(;h!==null;)Vz(h.alternate,h),h=h.return;Tn=null}}function Lg(h,g){var b=h.timeoutHandle;b!==-1&&(h.timeoutHandle=-1,ESe(b)),b=h.cancelPendingCommit,b!==null&&(h.cancelPendingCommit=null,b()),ju=0,SA(),Ls=h,Tn=b=bu(h.current,null),In=g,ys=0,ao=null,Xd=!1,Ag=Cs(h,g),mA=!1,Ng=oo=gA=fp=Qd=br=0,Ua=Lx=null,vA=!1,(g&8)!==0&&(g|=g&32);var C=h.entangledLanes;if(C!==0)for(h=h.entanglements,C&=g;0<C;){var N=31-Ee(C),P=1<<N;g|=h[N],C&=~P}return Lu=g,iw(),b}function hV(h,g){mn=null,$.H=Ex,g===Sg||g===hw?(g=AB(),ys=3):g===C3?(g=AB(),ys=4):ys=g===J3?8:g!==null&&typeof g=="object"&&typeof g.then=="function"?6:1,ao=g,Tn===null&&(br=1,kw(h,Uo(g,h.current)))}function pV(){var h=ro.current;return h===null?!0:(In&4194048)===In?Ho===null:(In&62914560)===In||(In&536870912)!==0?h===Ho:!1}function mV(){var h=$.H;return $.H=Ex,h===null?Ex:h}function gV(){var h=$.A;return $.A=nSe,h}function Fw(){br=4,Xd||(In&4194048)!==In&&ro.current!==null||(Ag=!0),(Qd&134217727)===0&&(fp&134217727)===0||Ls===null||tf(Ls,In,oo,!1)}function wA(h,g,b){var C=Jn;Jn|=2;var N=mV(),P=gV();(Ls!==h||In!==g)&&(Ow=null,Lg(h,g)),g=!1;var W=br;e:do try{if(ys!==0&&Tn!==null){var X=Tn,oe=ao;switch(ys){case 8:SA(),W=6;break e;case 3:case 2:case 9:case 6:ro.current===null&&(g=!0);var Se=ys;if(ys=0,ao=null,jg(h,X,oe,Se),b&&Ag){W=0;break e}break;default:Se=ys,ys=0,ao=null,jg(h,X,oe,Se)}}iSe(),W=br;break}catch(Pe){hV(h,Pe)}while(!0);return g&&h.shellSuspendCounter++,wu=sp=null,Jn=C,$.H=N,$.A=P,Tn===null&&(Ls=null,In=0,iw()),W}function iSe(){for(;Tn!==null;)vV(Tn)}function aSe(h,g){var b=Jn;Jn|=2;var C=mV(),N=gV();Ls!==h||In!==g?(Ow=null,Dw=Ke()+500,Lg(h,g)):Ag=Cs(h,g);e:do try{if(ys!==0&&Tn!==null){g=Tn;var P=ao;t:switch(ys){case 1:ys=0,ao=null,jg(h,g,P,1);break;case 2:case 9:if(kB(P)){ys=0,ao=null,xV(g);break}g=function(){ys!==2&&ys!==9||Ls!==h||(ys=7),hc(h)},P.then(g,g);break e;case 3:ys=7;break e;case 4:ys=5;break e;case 7:kB(P)?(ys=0,ao=null,xV(g)):(ys=0,ao=null,jg(h,g,P,7));break;case 5:var W=null;switch(Tn.tag){case 26:W=Tn.memoizedState;case 5:case 27:var X=Tn;if(W?sH(W):X.stateNode.complete){ys=0,ao=null;var oe=X.sibling;if(oe!==null)Tn=oe;else{var Se=X.return;Se!==null?(Tn=Se,Uw(Se)):Tn=null}break t}}ys=0,ao=null,jg(h,g,P,5);break;case 6:ys=0,ao=null,jg(h,g,P,6);break;case 8:SA(),br=6;break e;default:throw Error(s(462))}}oSe();break}catch(Pe){hV(h,Pe)}while(!0);return wu=sp=null,$.H=C,$.A=N,Jn=b,Tn!==null?0:(Ls=null,In=0,iw(),br)}function oSe(){for(;Tn!==null&&!et();)vV(Tn)}function vV(h){var g=Bz(h.alternate,h,Lu);h.memoizedProps=h.pendingProps,g===null?Uw(h):Tn=g}function xV(h){var g=h,b=g.alternate;switch(g.tag){case 15:case 0:g=Mz(b,g,g.pendingProps,g.type,void 0,In);break;case 11:g=Mz(b,g,g.pendingProps,g.type.render,g.ref,In);break;case 5:O3(g);
vendor: 9,203 bytes, line 49
49default:Vz(b,g),g=Tn=gB(g,Lu),g=Bz(b,g,Lu)}h.memoizedProps=h.pendingProps,g===null?Uw(h):Tn=g}function jg(h,g,b,C){wu=sp=null,O3(g),wg=null,gx=0;var N=g.return;try{if(Y2e(h,N,g,b,In)){br=1,kw(h,Uo(b,h.current)),Tn=null;return}}catch(P){if(N!==null)throw Tn=N,P;br=1,kw(h,Uo(b,h.current)),Tn=null;return}g.flags&32768?(Mn||C===1?h=!0:Ag||(In&536870912)!==0?h=!1:(Xd=h=!0,(C===2||C===9||C===3||C===6)&&(C=ro.current,C!==null&&C.tag===13&&(C.flags|=16384))),yV(g,h)):Uw(g)}function Uw(h){var g=h;do{if((g.flags&32768)!==0){yV(g,Xd);return}h=g.return;var b=Q2e(g.alternate,g,Lu);if(b!==null){Tn=b;return}if(g=g.sibling,g!==null){Tn=g;return}Tn=g=h}while(g!==null);br===0&&(br=5)}function yV(h,g){do{var b=J2e(h.alternate,h);if(b!==null){b.flags&=32767,Tn=b;return}if(b=h.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!g&&(h=h.sibling,h!==null)){Tn=h;return}Tn=h=b}while(h!==null);br=6,Tn=null}function bV(h,g,b,C,N,P,W,X,oe){h.cancelPendingCommit=null;do Bw();while(si!==0);if((Jn&6)!==0)throw Error(s(327));if(g!==null){if(g===h.current)throw Error(s(177));if(P=g.lanes|g.childLanes,P|=u3,bl(h,b,P,W,X,oe),h===Ls&&(Tn=Ls=null,In=0),Ig=g,ef=h,ju=b,xA=P,yA=N,cV=C,(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?(h.callbackNode=null,h.callbackPriority=0,dSe(Dt,function(){return CV(),null})):(h.callbackNode=null,h.callbackPriority=0),C=(g.flags&13878)!==0,(g.subtreeFlags&13878)!==0||C){C=$.T,$.T=null,N=V.p,V.p=2,W=Jn,Jn|=4;try{eSe(h,g,b)}finally{Jn=W,V.p=N,$.T=C}}si=1,SV(),wV(),_V()}}function SV(){if(si===1){si=0;var h=ef,g=Ig,b=(g.flags&13878)!==0;if((g.subtreeFlags&13878)!==0||b){b=$.T,$.T=null;var C=V.p;V.p=2;var N=Jn;Jn|=4;try{tV(g,h);var P=PA,W=oB(h.containerInfo),X=P.focusedElem,oe=P.selectionRange;if(W!==X&&X&&X.ownerDocument&&aB(X.ownerDocument.documentElement,X)){if(oe!==null&&i3(X)){var Se=oe.start,Pe=oe.end;if(Pe===void 0&&(Pe=Se),"selectionStart"in X)X.selectionStart=Se,X.selectionEnd=Math.min(Pe,X.value.length);else{var Be=X.ownerDocument||document,_e=Be&&Be.defaultView||window;if(_e.getSelection){var Te=_e.getSelection(),kt=X.textContent.length,Kt=Math.min(oe.start,kt),Rs=oe.end===void 0?Kt:Math.min(oe.end,kt);!Te.extend&&Kt>Rs&&(W=Rs,Rs=Kt,Kt=W);var ge=iB(X,Kt),fe=iB(X,Rs);if(ge&&fe&&(Te.rangeCount!==1||Te.anchorNode!==ge.node||Te.anchorOffset!==ge.offset||Te.focusNode!==fe.node||Te.focusOffset!==fe.offset)){var xe=Be.createRange();xe.setStart(ge.node,ge.offset),Te.removeAllRanges(),Kt>Rs?(Te.addRange(xe),Te.extend(fe.node,fe.offset)):(xe.setEnd(fe.node,fe.offset),Te.addRange(xe))}}}}for(Be=[],Te=X;Te=Te.parentNode;)Te.nodeType===1&&Be.push({element:Te,left:Te.scrollLeft,top:Te.scrollTop});for(typeof X.focus=="function"&&X.focus(),X=0;X<Be.length;X++){var Oe=Be[X];Oe.element.scrollLeft=Oe.left,Oe.element.scrollTop=Oe.top}}Jw=!!jA,PA=jA=null}finally{Jn=N,V.p=C,$.T=b}}h.current=g,si=2}}function wV(){if(si===2){si=0;var h=ef,g=Ig,b=(g.flags&8772)!==0;if((g.subtreeFlags&8772)!==0||b){b=$.T,$.T=null;var C=V.p;V.p=2;var N=Jn;Jn|=4;try{Zz(h,g.alternate,g)}finally{Jn=N,V.p=C,$.T=b}}si=3}}function _V(){if(si===4||si===3){si=0,Ct();var h=ef,g=Ig,b=ju,C=cV;(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?si=5:(si=0,Ig=ef=null,EV(h,h.pendingLanes));var N=h.pendingLanes;if(N===0&&(Jd=null),ve(b),g=g.stateNode,ie&&typeof ie.onCommitFiberRoot=="function")try{ie.onCommitFiberRoot(Z,g,void 0,(g.current.flags&128)===128)}catch{}if(C!==null){g=$.T,N=V.p,V.p=2,$.T=null;try{for(var P=h.onRecoverableError,W=0;W<C.length;W++){var X=C[W];P(X.value,{componentStack:X.stack})}}finally{$.T=g,V.p=N}}(ju&3)!==0&&Bw(),hc(h),N=h.pendingLanes,(b&261930)!==0&&(N&42)!==0?h===bA?jx++:(jx=0,bA=h):jx=0,Px(0)}}function EV(h,g){(h.pooledCacheLanes&=g)===0&&(g=h.pooledCache,g!=null&&(h.pooledCache=null,px(g)))}function Bw(){return SV(),wV(),_V(),CV()}function CV(){if(si!==5)return!1;var h=ef,g=xA;xA=0;var b=ve(ju),C=$.T,N=V.p;try{V.p=32>b?32:b,$.T=null,b=yA,yA=null;var P=ef,W=ju;if(si=0,Ig=ef=null,ju=0,(Jn&6)!==0)throw Error(s(331));var X=Jn;if(Jn|=4,aV(P.current),sV(P,P.current,W,b),Jn=X,Px(0,!1),ie&&typeof ie.onPostCommitFiberRoot=="function")try{ie.onPostCommitFiberRoot(Z,P)}catch{}return!0}finally{V.p=N,$.T=C,EV(h,g)}}function TV(h,g,b){g=Uo(b,g),g=Q3(h.stateNode,g,2),h=qd(h,g,2),h!==null&&(Pa(h,2),hc(h))}function bs(h,g,b){if(h.tag===3)TV(h,h,b);else for(;g!==null;){if(g.tag===3){TV(g,h,b);break}else if(g.tag===1){var C=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(Jd===null||!Jd.has(C))){h=Uo(b,h),b=kz(2),C=qd(g,b,2),C!==null&&(Rz(b,C,g,h),Pa(C,2),hc(C));break}}g=g.return}}function _A(h,g,b){var C=h.pingCache;if(C===null){C=h.pingCache=new sSe;var N=new Set;C.set(g,N)}else N=C.get(g),N===void 0&&(N=new Set,C.set(g,N));N.has(b)||(mA=!0,N.add(b),h=lSe.bind(null,h,g,b),g.then(h,h))}function lSe(h,g,b){var C=h.pingCache;C!==null&&C.delete(g),h.pingedLanes|=h.suspendedLanes&b,h.warmLanes&=~b,Ls===h&&(In&b)===b&&(br===4||br===3&&(In&62914560)===In&&300>Ke()-Mw?(Jn&2)===0&&Lg(h,0):gA|=b,Ng===In&&(Ng=0)),hc(h)}function kV(h,g){g===0&&(g=gu()),h=ep(h,g),h!==null&&(Pa(h,g),hc(h))}function cSe(h){var g=h.memoizedState,b=0;g!==null&&(b=g.retryLane),kV(h,b)}function uSe(h,g){var b=0;switch(h.tag){case 31:case 13:var C=h.stateNode,N=h.memoizedState;N!==null&&(b=N.retryLane);break;case 19:C=h.stateNode;break;case 22:C=h.stateNode._retryCache;break;default:throw Error(s(314))}C!==null&&C.delete(g),kV(h,b)}function dSe(h,g){return Le(h,g)}var zw=null,Pg=null,EA=!1,Vw=!1,CA=!1,nf=0;function hc(h){h!==Pg&&h.next===null&&(Pg===null?zw=Pg=h:Pg=Pg.next=h),Vw=!0,EA||(EA=!0,hSe())}function Px(h,g){if(!CA&&Vw){CA=!0;do for(var b=!1,C=zw;C!==null;){if(h!==0){var N=C.pendingLanes;if(N===0)var P=0;else{var W=C.suspendedLanes,X=C.pingedLanes;P=(1<<31-Ee(42|h)+1)-1,P&=N&~(W&~X),P=P&201326741?P&201326741|1:P?P|2:0}P!==0&&(b=!0,IV(C,P))}else P=In,P=Nn(C,C===Ls?P:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),(P&3)===0||Cs(C,P)||(b=!0,IV(C,P));C=C.next}while(b);CA=!1}}function fSe(){RV()}function RV(){Vw=EA=!1;var h=0;nf!==0&&_Se()&&(h=nf);for(var g=Ke(),b=null,C=zw;C!==null;){var N=C.next,P=AV(C,g);P===0?(C.next=null,b===null?zw=N:b.next=N,N===null&&(Pg=b)):(b=C,(h!==0||(P&3)!==0)&&(Vw=!0)),C=N}si!==0&&si!==5||Px(h),nf!==0&&(nf=0)}function AV(h,g){for(var b=h.suspendedLanes,C=h.pingedLanes,N=h.expirationTimes,P=h.pendingLanes&-62914561;0<P;){var W=31-Ee(P),X=1<<W,oe=N[W];oe===-1?((X&b)===0||(X&C)!==0)&&(N[W]=$o(X,g)):oe<=g&&(h.expiredLanes|=X),P&=~X}if(g=Ls,b=In,b=Nn(h,h===g?b:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),C=h.callbackNode,b===0||h===g&&(ys===2||ys===9)||h.cancelPendingCommit!==null)return C!==null&&C!==null&&qe(C),h.callbackNode=null,h.callbackPriority=0;if((b&3)===0||Cs(h,b)){if(g=b&-b,g===h.callbackPriority)return g;switch(C!==null&&qe(C),ve(b)){case 2:case 8:b=_n;break;case 32:b=Dt;break;case 268435456:b=fn;break;default:b=Dt}return C=NV.bind(null,h),b=Le(b,C),h.callbackPriority=g,h.callbackNode=b,g}return C!==null&&C!==null&&qe(C),h.callbackPriority=2,h.callbackNode=null,2}function NV(h,g){if(si!==0&&si!==5)return h.callbackNode=null,h.callbackPriority=0,null;var b=h.callbackNode;if(Bw()&&h.callbackNode!==b)return null;var C=In;return C=Nn(h,h===Ls?C:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),C===0?null:(dV(h,C,g),AV(h,Ke()),h.callbackNode!=null&&h.callbackNode===b?NV.bind(null,h):null)}function IV(h,g){if(Bw())return null;dV(h,g,!0)}function hSe(){CSe(function(){(Jn&6)!==0?Le(Xt,fSe):RV()})}function TA(){if(nf===0){var h=yg;h===0&&(h=Qe,Qe<<=1,(Qe&261888)===0&&(Qe=256)),nf=h}return nf}function LV(h){return h==null||typeof h=="symbol"||typeof h=="boolean"?null:typeof h=="function"?h:XS(""+h)}function jV(h,g){var b=g.ownerDocument.createElement("input");return b.name=g.name,b.value=g.value,h.id&&b.setAttribute("form",h.id),g.parentNode.insertBefore(b,g),h=new FormData(h),b.parentNode.removeChild(b),h}function pSe(h,g,b,C,N){if(g==="submit"&&b&&b.stateNode===N){var P=LV((N[It]||null).action),W=C.submitter;W&&(g=(g=W[It]||null)?LV(g.formAction):W.getAttribute("formAction"),g!==null&&(P=g,W=null));var X=new tw("action","action",null,C,N);h.push({event:X,listeners:[{instance:null,listener:function(){if(C.defaultPrevented){if(nf!==0){var oe=W?jV(N,W):new FormData(N);W3(b,{pending:!0,data:oe,method:N.method,action:P},null,oe)}}else typeof P=="function"&&(X.preventDefault(),oe=W?jV(N,W):new FormData(N),W3(b,{pending:!0,data:oe,method:N.method,action:P},P,oe))},currentTarget:N}]})}}for(var kA=0;kA<c3.length;kA++){var RA=c3[kA],mSe=RA.toLowerCase(),gSe=RA[0].toUpperCase()+RA.slice(1);Sl(mSe,"on"+gSe)}Sl(uB,"onAnimationEnd"),Sl(dB,"onAnimationIteration"),Sl(fB,"onAnimationStart"),Sl("dblclick","onDoubleClick"),Sl("focusin","onFocus"),Sl("focusout","onBlur"),Sl(L2e,"onTransitionRun"),Sl(j2e,"onTransitionStart"),Sl(P2e,"onTransitionCancel"),Sl(hB,"onTransitionEnd"),vs("onMouseEnter",["mouseout","mouseover"]),vs("onMouseLeave",["mouseout","mouseover"]),vs("onPointerEnter",["pointerout","pointerover"]),vs("onPointerLeave",["pointerout","pointerover"]),pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pn("onSelect","focusout contextmenu dragend focu
49sin keydown keyup mousedown mouseup selectionchange".split(" ")),pn("onBeforeInput",["compositionend","keypress","textInput","paste"]),pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mx="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),vSe=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mx));function PV(h,g){g=(g&4)!==0;for(var b=0;b<h.length;b++){var C=h[b],N=C.event;C=C.listeners;e:{var P=void 0;if(g)for(var W=C.length-1;0<=W;W--){var X=C[W],oe=X.instance,Se=X.currentTarget;if(X=X.listener,oe!==P&&N.isPropagationStopped())break e;P=X,N.currentTarget=Se;try{P(N)}catch(Pe){rw(Pe)}N.currentTarget=null,P=oe}else for(W=0;W<C.length;W++){if(X=C[W],oe=X.instance,Se=X.currentTarget,X=X.listener,oe!==P&&N.isPropagationStopped())break e;P=X,N.currentTarget=Se;try{P(N)}catch(Pe){rw(Pe)}N.currentTarget=null,P=oe}}}}function kn(h,g){var b=g[Lt];b===void 0&&(b=g[Lt]=new Set);var C=h+"__bubble";b.has(C)||(MV(g,h,2,!1),b.add(C))}function AA(h,g,b){var C=0;g&&(C|=4),MV(b,h,C,g)}var Hw="_reactListening"+Math.random().toString(36).slice(2);function NA(h){if(!h[Hw]){h[Hw]=!0,as.forEach(function(b){b!=="selectionchange"&&(vSe.has(b)||AA(b,!1,h),AA(b,!0,h))});var g=h.nodeType===9?h:h.ownerDocument;g===null||g[Hw]||(g[Hw]=!0,AA("selectionchange",!1,g))}}function MV(h,g,b,C){switch(uH(g)){case 2:var N=GSe;break;case 8:N=WSe;break;default:N=GA}b=N.bind(null,g,b,h),N=void 0,!ZR||g!=="touchstart"&&g!=="touchmove"&&g!=="wheel"||(N=!0),C?N!==void 0?h.addEventListener(g,b,{capture:!0,passive:N}):h.addEventListener(g,b,!0):N!==void 0?h.addEventListener(g,b,{passive:N}):h.addEventListener(g,b,!1)}function IA(h,g,b,C,N){var P=C;if((g&1)===0&&(g&2)===0&&C!==null)e:for(;;){if(C===null)return;var W=C.tag;if(W===3||W===4){var X=C.stateNode.containerInfo;if(X===N)break;if(W===4)for(W=C.return;W!==null;){var oe=W.tag;if((oe===3||oe===4)&&W.stateNode.containerInfo===N)return;W=W.return}for(;X!==null;){if(W=st(X),W===null)return;if(oe=W.tag,oe===5||oe===6||oe===26||oe===27){C=P=W;continue e}X=X.parentNode}}C=C.return}UU(function(){var Se=P,Pe=KR(b),Be=[];e:{var _e=pB.get(h);if(_e!==void 0){var Te=tw,kt=h;switch(h){case"keypress":if(JS(b)===0)break e;case"keydown":case"keyup":Te=u2e;break;case"focusin":kt="focus",Te=e3;break;case"focusout":kt="blur",Te=e3;break;case"beforeblur":case"afterblur":Te=e3;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Te=VU;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Te=Qbe;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Te=h2e;break;case uB:case dB:case fB:Te=t2e;break;case hB:Te=m2e;break;case"scroll":case"scrollend":Te=Zbe;break;case"wheel":Te=v2e;break;case"copy":case"cut":case"paste":Te=s2e;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Te=GU;break;case"toggle":case"beforetoggle":Te=y2e}var Kt=(g&4)!==0,Rs=!Kt&&(h==="scroll"||h==="scrollend"),ge=Kt?_e!==null?_e+"Capture":null:_e;Kt=[];for(var fe=Se,xe;fe!==null;){var Oe=fe;if(xe=Oe.stateNode,Oe=Oe.tag,Oe!==5&&Oe!==26&&Oe!==27||xe===null||ge===null||(Oe=sx(fe,ge),Oe!=null&&Kt.push(Dx(fe,Oe,xe))),Rs)break;fe=fe.return}0<Kt.length&&(_e=new Te(_e,kt,null,b,Pe),Be.push({event:_e,listeners:Kt}))}}if((g&7)===0){e:{if(_e=h==="mouseover"||h==="pointerover",Te=h==="mouseout"||h==="pointerout",_e&&b!==qR&&(kt=b.relatedTarget||b.fromElement)&&(st(kt)||kt[ct]))break e;if((Te||_e)&&(_e=Pe.window===Pe?Pe:(_e=Pe.ownerDocument)?_e.defaultView||_e.parentWindow:window,Te?(kt=b.relatedTarget||b.toElement,Te=Se,kt=kt?st(kt):null,kt!==null&&(Rs=i(kt),Kt=kt.tag,kt!==Rs||Kt!==5&&Kt!==27&&Kt!==6)&&(kt=null)):(Te=null,kt=Se),Te!==kt)){if(Kt=VU,Oe="onMouseLeave",ge="onMouseEnter",fe="mou
49se",(h==="pointerout"||h==="pointerover")&&(Kt=GU,Oe="onPointerLeave",ge="onPointerEnter",fe="pointer"),Rs=Te==null?_e:yt(Te),xe=kt==null?_e:yt(kt),_e=new Kt(Oe,fe+"leave",Te,b,Pe),_e.target=Rs,_e.relatedTarget=xe,Oe=null,st(Pe)===Se&&(Kt=new Kt(ge,fe+"enter",kt,b,Pe),Kt.target=xe,Kt.relatedTarget=Rs,Oe=Kt),Rs=Oe,Te&&kt)t:{for(Kt=xSe,ge=Te,fe=kt,xe=0,Oe=ge;Oe;Oe=Kt(Oe))xe++;Oe=0;for(var $t=fe;$t;$t=Kt($t))Oe++;for(;0<xe-Oe;)ge=Kt(ge),xe--;for(;0<Oe-xe;)fe=Kt(fe),Oe--;for(;xe--;){if(ge===fe||fe!==null&&ge===fe.alternate){Kt=ge;break t}ge=Kt(ge),fe=Kt(fe)}Kt=null}else Kt=null;Te!==null&&DV(Be,_e,Te,Kt,!1),kt!==null&&Rs!==null&&DV(Be,Rs,kt,Kt,!0)}}e:{if(_e=Se?yt(Se):window,Te=_e.nodeName&&_e.nodeName.toLowerCase(),Te==="select"||Te==="input"&&_e.type==="file")var Kn=JU;else if(XU(_e))if(eB)Kn=A2e;else{Kn=k2e;var jt=T2e}else Te=_e.nodeName,!Te||Te.toLowerCase()!=="input"||_e.type!=="checkbox"&&_e.type!=="radio"?Se&&WR(Se.elementType)&&(Kn=JU):Kn=R2e;if(Kn&&(Kn=Kn(h,Se))){QU(Be,Kn,b,Pe);break e}jt&&jt(h,_e,Se),h==="focusout"&&Se&&_e.type==="number"&&Se.memoizedProps.value!=null&&GR(_e,"number",_e.value)}switch(jt=Se?yt(Se):window,h){case"focusin":(XU(jt)||jt.contentEditable==="true")&&(dg=jt,a3=Se,dx=null);break;case"focusout":dx=a3=dg=null;break;case"mousedown":o3=!0;break;case"contextmenu":case"mouseup":case"dragend":o3=!1,lB(Be,b,Pe);break;case"selectionchange":if(I2e)break;case"keydown":case"keyup":lB(Be,b,Pe)}var gn;if(n3)e:{switch(h){case"compositionstart":var Ln="onCompositionStart";break e;case"compositionend":Ln="onCompositionEnd";break e;case"compositionupdate":Ln="onCompositionUpdate";break e}Ln=void 0}else ug?YU(h,b)&&(Ln="onCompositionEnd"):h==="keydown"&&b.keyCode===229&&(Ln="onCompositionStart");Ln&&(WU&&b.locale!=="ko"&&(ug||Ln!=="onCompositionStart"?Ln==="onCompositionEnd"&&ug&&(gn=BU()):(Ud=Pe,XR="value"in Ud?Ud.value:Ud.textContent,ug=!0)),jt=Gw(Se,Ln),0<jt.length&&(Ln=new HU(Ln,h,null,b,Pe),Be.push({event:Ln,listeners:jt}),gn?Ln.data=gn:(gn=ZU(b),gn!==null&&(Ln.data=gn)))),(gn=S2e?w2e(h,b):_2e(h,b))&&(Ln=Gw(Se,"onBeforeInput"),0<Ln.length&&(jt=new HU("onBeforeInput","beforeinput",null,b,Pe),Be.push({event:jt,listeners:Ln}),jt.data=gn)),pSe(Be,h,Se,b,Pe)}PV(Be,g)})}function Dx(h,g,b){return{instance:h,listener:g,currentTarget:b}}function Gw(h,g){for(var b=g+"Capture",C=[];h!==null;){var N=h,P=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||P===null||(N=sx(h,b),N!=null&&C.unshift(Dx(h,N,P)),N=sx(h,g),N!=null&&C.push(Dx(h,N,P))),h.tag===3)return C;h=h.return}return[]}function xSe(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5&&h.tag!==27);return h||null}function DV(h,g,b,C,N){for(var P=g._reactName,W=[];b!==null&&b!==C;){var X=b,oe=X.alternate,Se=X.stateNode;if(X=X.tag,oe!==null&&oe===C)break;X!==5&&X!==26&&X!==27||Se===null||(oe=Se,N?(Se=sx(b,P),Se!=null&&W.unshift(Dx(b,Se,oe))):N||(Se=sx(b,P),Se!=null&&W.push(Dx(b,Se,oe)))),b=b.return}W.length!==0&&h.push({event:g,listeners:W})}var ySe=/\r\n?/g,bSe=/\u0000|\uFFFD/g;function OV(h){return(typeof h=="string"?h:""+h).replace(ySe,`
50`).replace(bSe,"")}function $V(h,g){return g=OV(g),OV(h)===g}function ks(h,g,b,C,N,P){switch(b){case"children":typeof C=="string"?g==="body"||g==="textarea"&&C===""||og(h,C):(typeof C=="number"||typeof C=="bigint")&&g!=="body"&&og(h,""+C);break;case"className":ca(h,"class",C);break;case"tabIndex":ca(h,"tabindex",C);break;case"dir":case"role":case"viewBox":case"width":case"height":ca(h,b,C);break;case"style":$U(h,C,P);break;case"data":if(g!=="object"){ca(h,"data",C);break}case"src":case"href":if(C===""&&(g!=="a"||b!=="href")){h.removeAttribute(b);break}if(C==null||typeof C=="function"||typeof C=="symbol"||typeof C=="boolean"){h.removeAttribute(b);break}C=XS(""+C),h.setAttribute(b,C);break;case"action":case"formAction":if(typeof C=="function"){h.setAttribute(b,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof P=="function"&&(b==="formAction"?(g!=="input"&&ks(h,g,"name",N.name,N,null),ks(h,g,"formEncType",N.formEncType,N,null),ks(h,g,"formMethod",N.formMethod,N,null),ks(h,g,"formTarget",N.formTarget,N,null)):(ks(h,g,"encType",N.encType,N,null),ks(h,g,"method",N.method,N,null),ks(h,g,"target",N.target,N,null)));if(C==null||typeof C=="symbol"||typeof C=="boolean"){h.removeAttribute(b);break}C=XS(""+C),h.setAttribute(b,C);break;case"onClick":C!=null&&(h.onclick=xu);break;case"onScroll":C!=null&&kn("scroll",h);break;case"onScrollEnd":C!=null&&kn("scrollend",h);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(s(61));if(b=C.__html,b!=null){if(N.children!=null)throw Error(s(60));h.innerHTML=b}}break;case"multiple":h.multiple=C&&typeof C!="function"&&typeof C!="symbol";break;case"muted":h.muted=C&&typeof C!="function"&&typeof C!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(C==null||typeof C=="function"||typeof C=="boolean"||typeof C=="symbol"){h.removeAttribute("xlink:href");break}b=XS(""+C),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":C!=null&&typeof C!="function"&&typeof C!="symbol"?h.setAttribute(b,""+C):h.removeAttribute(b);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
50ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":C&&typeof C!="function"&&typeof C!="symbol"?h.setAttribute(b,""):h.removeAttribute(b);break;case"capture":case"download":C===!0?h.setAttribute(b,""):C!==!1&&C!=null&&typeof C!="function"&&typeof C!="symbol"?h.setAttribute(b,C):h.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":C!=null&&typeof C!="function"&&typeof C!="symbol"&&!isNaN(C)&&1<=C?h.setAttribute(b,C):h.removeAttribute(b);break;case"rowSpan":case"start":C==null||typeof C=="function"||typeof C=="symbol"||isNaN(C)?h.removeAttribute(b):h.setAttribute(b,C);break;case"popover":kn("beforetoggle",h),kn("toggle",h),ki(h,"popover",C);break;case"xlinkActuate":qt(h,"http://www.w3.org/1999/xlink","xlink:actuate",C);break;case"xlinkArcrole":qt(h,"http://www.w3.org/1999/xlink","xlink:arcrole",C);break;case"xlinkRole":qt(h,"http://www.w3.org/1999/xlink","xlink:role",C);break;case"xlinkShow":qt(h,"http://www.w3.org/1999/xlink","xlink:show",C);break;case"xlinkTitle":qt(h,"http://www.w3.org/1999/xlink","xlink:title",C);break;case"xlinkType":qt(h,"http://www.w3.org/1999/xlink","xlink:type",C);break;case"xmlBase":qt(h,"http://www.w3.org/XML/1998/namespace","xml:base",C);break;case"xmlLang":qt(h,"http://www.w3.org/XML/1998/namespace","xml:lang",C);break;case"xmlSpace":qt(h,"http://www.w3.org/XML/1998/namespace","xml:space",C);break;case"is":ki(h,"is",C);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=Kbe.get(b)||b,ki(h,b,C))}}function LA(h,g,b,C,N,P){switch(b){case"style":$U(h,C,P);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(s(61));if(b=C.__html,b!=null){if(N.children!=null)throw Error(s(60));h.innerHTML=b}}break;case"children":typeof C=="string"?og(h,C):(typeof C=="number"||typeof C=="bigint")&&og(h,""+C);break;case"onScroll":C!=null&&kn("scroll",h);break;case"onScrollEnd":C!=null&&kn("scrollend",h);break;case"onClick":C!=null&&(h.onclick=xu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gs.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(N=b.endsWith("Capture"),g=b.slice(2,N?b.length-7:void 0),P=h[It]||null,P=P!=null?P[b]:null,typeof P=="function"&&h.removeEventListener(g,P,N),typeof C=="function")){typeof P!="function"&&P!==null&&(b in h?h[b]=null:h.hasAttribute(b)&&h.removeAttribute(b)),h.addEventListener(g,C,N);break e}b in h?h[b]=C:C===!0?h.setAttribute(b,""):ki(h,b,C)}}}function Ii(h,g,b){switch(g){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kn("error",h),kn("load",h);var C=!1,N=!1,P;for(P in b)if(b.hasOwnProperty(P)){var W=b[P];if(W!=null)switch(P){case"src":C=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,g));default:ks(h,g,P,W,b,null)}}N&&ks(h,g,"srcSet",b.srcSet,b,null),C&&ks(h,g,"src",b.src,b,null);return;case"input":kn("invalid",h);var X=P=W=N=null,oe=null,Se=null;for(C in b)if(b.hasOwnProperty(C)){var Pe=b[C];if(Pe!=null)switch(C){case"name":N=Pe;break;case"type":W=Pe;break;case"checked":oe=Pe;break;case"defaultChecked":Se=Pe;break;case"value":P=Pe;break;case"defaultValue":X=Pe;break;case"children":case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(s(137,g));break;default:ks(h,g,C,Pe,b,null)}}PU(h,P,X,oe,Se,W,N,!1);return;case"select":kn("invalid",h),C=W=P=null;for(N in b)if(b.hasOwnProperty(N)&&(X=b[N],X!=null))switch(N){case"value":P=X;break;case"defaultValue":W=X;break;case"multiple":C=X;default:ks(h,g,N,X,b,null)}g=P,b=W,h.multiple=!!C,g!=null?ag(h,!!C,g,!1):b!=null&&ag(h,!!C,b,!0);return;case"textarea":kn("invalid",h),P=N=C=null;for(W in b)if(b.hasOwnProperty(W)&&(X=b[W],X!=null))switch(W){case"value":C=X;break;case"defaultValue":N=X;break;case"children":P=X;break;case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(91));break;default:ks(h,g,W,X,b,null)}DU(h,C,N,P);return;case"option":for(oe in b)if(b.hasOwnProperty(oe)&&(C=b[oe],C!=null))switch(oe){case"selected":h.selected=C&&typeof C!="function"&&typeof C!="symbol";break;default:ks(h,g,oe,C,b,null)}return;case"dialog":kn("beforetoggle",h),kn("toggle",h),kn("cancel",h),kn("close",h);break;case"iframe":case"object":kn("load",h);break;case"video":case"audio":for(C=0;C<Mx.length;C++)kn(Mx[C],h);break;case"image":kn("error",h),kn("load",h);break;case"details":kn("toggle",h);break;case"embed":case"source":case"link":kn("error",h),kn("load",h);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Se in b)if(b.hasOwnProperty(Se)&&(C=b[Se],C!=null))switch(Se){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,g));default:ks(h,g,Se,C,b,null)}return;default:if(WR(g)){for(Pe in b)b.hasOwnProperty(Pe)&&(C=b[Pe],C!==void 0&&LA(h,g,Pe,C,b,void 0));return}}for(X in b)b.hasOwnProperty(X)&&(C=b[X],C!=null&&ks(h,g,X,C,b,null))}function SSe(h,g,b,C){switch(g){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,P=null,W=null,X=null,oe=null,Se=null,Pe=null;for(Te in b){var Be=b[Te];if(b.hasOwnProperty(Te)&&Be!=null)switch(Te){case"checked":break;case"value":break;case"defaultValue":oe=Be;default:C.hasOwnProperty(Te)||ks(h,g,Te,null,C,Be)}}for(var _e in C){var Te=C[_e];if(Be=b[_e],C.hasOwnProperty(_e)&&(Te!=null||Be!=null))switch(_e){case"type":P=Te;break;case"name":N=Te;break;case"checked":Se=Te;break;case"defaultChecked":Pe=Te;break;case"value":W=Te;break;case"defaultValue":X=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(s(137,g));break;default:Te!==Be&&ks(h,g,_e,Te,C,Be)}}nx(h,W,X,oe,Se,Pe,P,N);return;case"select":Te=W=X=_e=null;for(P in b)if(oe=b[P],b.hasOwnProperty(P)&&oe!=null)switch(P){case"value":break;case"multiple":Te=oe;default:C.hasOwnProperty(P)||ks(h,g,P,null,C,oe)}for(N in C)if(P=C[N],oe=b[N],C.hasOwnProperty(N)&&(P!=null||oe!=null))switch(N){case"value":_e=P;break;case"defaultValue":X=P;break;case"multiple":W=P;default:P!==oe&&ks(h,g,N,P,C,oe)}g=X,b=W,C=Te,_e!=null?ag(h,!!b,_e,!1):!!C!=!!b&&(g!=null?ag(h,!!b,g,!0):ag(h,!!b,b?[]:"",!1));return;case"textarea":Te=_e=null;for(X in b)if(N=b[X],b.hasOwnProperty(X)&&N!=null&&!C.hasOwnProperty(X))switch(X){case"value":break;case"children":break;default:ks(h,g,X,null,C,N)}for(W in C)if(N=C[W],P=b[W],C.hasOwnProperty(W)&&(N!=null||P!=null))switch(W){case"value":_e=N;break;case"defaultValue":Te=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:N!==P&&ks(h,g,W,N,C,P)}MU(h,_e,Te);return;case"option":for(var kt in b)if(_e=b[kt],b.hasOwnProperty(kt)&&_e!=null&&!C.hasOwnProperty(kt))switch(kt){case"selected":h.selected=!1;break;default:ks(h,g,kt,null,C,_e)}for(oe in C)if(_e=C[oe],Te=b[oe],C.hasOwnProperty(oe)&&_e!==Te&&(_e!=null||Te!=null))switch(oe){case"selected":h.selected=_e&&typeof _e!="function"&&typeof _e!="symbol";break;default:ks(h,g,oe,_e,C,Te)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Kt in b)_e=b[Kt],b.hasOwnProperty(Kt)&&_e!=null&&!C.hasOwnProperty(Kt)&&ks(h,g,Kt,null,C,_e);for(Se in C)if(_e=C[Se],Te=b[Se],C.hasOwnProperty(Se)&&_e!==Te&&(_e!=null||Te!=null))switch(Se){case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(s(137,g));break;default:ks(h,g,Se,_e,C,Te)}return;default:if(WR(g)){for(var Rs in b)_e=b[Rs],b.hasOwnProperty(Rs)&&_e!==void 0&&!C.hasOwnProperty(Rs)&&LA(h,g,Rs,void 0,C,_e);for(Pe in C)_e=C[Pe],Te=b[Pe],!C.hasOwnProperty(Pe)||_e===Te||_e===void 0&&Te===void 0||LA(h,g,Pe,_e,C,Te);return}}for(var ge in b)_e=b[ge],b.hasOwnProperty(ge)&&_e!=null&&!C.hasOwnProperty(ge)&&ks(h,g,ge,null,C,_e);for(Be in C)_e=C[Be],Te=b[Be],!C.hasOwnProperty(Be)||_e===Te||_e==null&&Te==null||ks(h,g,Be,_e,C,Te)}function FV(h){switch(h){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wSe(){if(typeof performance.getEntriesByType=="function"){for(var h=0,g=0,b=performance.getEntriesByType("resource"),C=0;C<b.length;C++){var N=b[C],P=N.transferSize,W=N.initiatorType,X=N.duration;if(P&&X&&FV(W)){for(W=0,X=N.responseEnd,C+=1;C<b.length;C++){var oe=b[C],Se=oe.startTime;if(Se>X)break;var Pe=oe.transferSize,Be=oe.initiatorType;Pe&&FV(Be)&&(oe=oe.responseEnd,W+=Pe*(oe<X?1:(X-Se)/(oe-Se)))}if(--C,g+=8*(P+W)/(N.duration/1e3),h++,10<h)break}}if(0<h)return g/h/1e6}return navigator.connection&&(h=navigator.connection.downlink,typeof h=="number")?h:5}var jA=null,PA=null;
vendor: 13,879 bytes, line 50
50function Ww(h){return h.nodeType===9?h:h.ownerDocument}function UV(h){switch(h){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function BV(h,g){if(h===0)switch(g){case"svg":return 1;case"math":return 2;default:return 0}return h===1&&g==="foreignObject"?0:h}function MA(h,g){return h==="textarea"||h==="noscript"||typeof g.children=="string"||typeof g.children=="number"||typeof g.children=="bigint"||typeof g.dangerouslySetInnerHTML=="object"&&g.dangerouslySetInnerHTML!==null&&g.dangerouslySetInnerHTML.__html!=null}var DA=null;function _Se(){var h=window.event;return h&&h.type==="popstate"?h===DA?!1:(DA=h,!0):(DA=null,!1)}var zV=typeof setTimeout=="function"?setTimeout:void 0,ESe=typeof clearTimeout=="function"?clearTimeout:void 0,VV=typeof Promise=="function"?Promise:void 0,CSe=typeof queueMicrotask=="function"?queueMicrotask:typeof VV<"u"?function(h){return VV.resolve(null).then(h).catch(TSe)}:zV;function TSe(h){setTimeout(function(){throw h})}function sf(h){return h==="head"}function HV(h,g){var b=g,C=0;do{var N=b.nextSibling;if(h.removeChild(b),N&&N.nodeType===8)if(b=N.data,b==="/$"||b==="/&"){if(C===0){h.removeChild(N),$g(g);return}C--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")C++;else if(b==="html")Ox(h.ownerDocument.documentElement);else if(b==="head"){b=h.ownerDocument.head,Ox(b);for(var P=b.firstChild;P;){var W=P.nextSibling,X=P.nodeName;P[Fe]||X==="SCRIPT"||X==="STYLE"||X==="LINK"&&P.rel.toLowerCase()==="stylesheet"||b.removeChild(P),P=W}}else b==="body"&&Ox(h.ownerDocument.body);b=N}while(b);$g(g)}function GV(h,g){var b=h;h=0;do{var C=b.nextSibling;if(b.nodeType===1?g?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(g?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),C&&C.nodeType===8)if(b=C.data,b==="/$"){if(h===0)break;h--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||h++;b=C}while(b)}function OA(h){var g=h.firstChild;for(g&&g.nodeType===10&&(g=g.nextSibling);g;){var b=g;switch(g=g.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":OA(b),tt(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}h.removeChild(b)}}function kSe(h,g,b,C){for(;h.nodeType===1;){var N=b;if(h.nodeName.toLowerCase()!==g.toLowerCase()){if(!C&&(h.nodeName!=="INPUT"||h.type!=="hidden"))break}else if(C){if(!h[Fe])switch(g){case"meta":if(!h.hasAttribute("itemprop"))break;return h;case"link":if(P=h.getAttribute("rel"),P==="stylesheet"&&h.hasAttribute("data-precedence"))break;if(P!==N.rel||h.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||h.getAttribute("title")!==(N.title==null?null:N.title))break;return h;case"style":if(h.hasAttribute("data-precedence"))break;return h;case"script":if(P=h.getAttribute("src"),(P!==(N.src==null?null:N.src)||h.getAttribute("type")!==(N.type==null?null:N.type)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&P&&h.hasAttribute("async")&&!h.hasAttribute("itemprop"))break;return h;default:return h}}else if(g==="input"&&h.type==="hidden"){var P=N.name==null?null:""+N.name;if(N.type==="hidden"&&h.getAttribute("name")===P)return h}else return h;if(h=Go(h.nextSibling),h===null)break}return null}function RSe(h,g,b){if(g==="")return null;for(;h.nodeType!==3;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!b||(h=Go(h.nextSibling),h===null))return null;return h}function WV(h,g){for(;h.nodeType!==8;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!g||(h=Go(h.nextSibling),h===null))return null;return h}function $A(h){return h.data==="$?"||h.data==="$~"}function FA(h){return h.data==="$!"||h.data==="$?"&&h.ownerDocument.readyState!=="loading"}function ASe(h,g){var b=h.ownerDocument;if(h.data==="$~")h._reactRetry=g;else if(h.data!=="$?"||b.readyState!=="loading")g();else{var C=function(){g(),b.removeEventListener("DOMContentLoaded",C)};b.addEventListener("DOMContentLoaded",C),h._reactRetry=C}}function Go(h){for(;h!=null;h=h.nextSibling){var g=h.nodeType;if(g===1||g===3)break;if(g===8){if(g=h.data,g==="$"||g==="$!"||g==="$?"||g==="$~"||g==="&"||g==="F!"||g==="F")break;if(g==="/$"||g==="/&")return null}}return h}var UA=null;function qV(h){h=h.nextSibling;for(var g=0;h;){if(h.nodeType===8){var b=h.data;if(b==="/$"||b==="/&"){if(g===0)return Go(h.nextSibling);g--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||g++}h=h.nextSibling}return null}function KV(h){h=h.previousSibling;for(var g=0;h;){if(h.nodeType===8){var b=h.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(g===0)return h;g--}else b!=="/$"&&b!=="/&"||g++}h=h.previousSibling}return null}function YV(h,g,b){switch(g=Ww(b),h){case"html":if(h=g.documentElement,!h)throw Error(s(452));return h;case"head":if(h=g.head,!h)throw Error(s(453));return h;case"body":if(h=g.body,!h)throw Error(s(454));return h;default:throw Error(s(451))}}function Ox(h){for(var g=h.attributes;g.length;)h.removeAttributeNode(g[0]);tt(h)}var Wo=new Map,ZV=new Set;function qw(h){return typeof h.getRootNode=="function"?h.getRootNode():h.nodeType===9?h:h.ownerDocument}var Pu=V.d;V.d={f:NSe,r:ISe,D:LSe,C:jSe,L:PSe,m:MSe,X:OSe,S:DSe,M:$Se};function NSe(){var h=Pu.f(),g=$w();return h||g}function ISe(h){var g=bt(h);g!==null&&g.tag===5&&g.type==="form"?hz(g):Pu.r(h)}var Mg=typeof document>"u"?null:document;function XV(h,g,b){var C=Mg;if(C&&typeof g=="string"&&g){var N=da(g);N='link[rel="'+h+'"][href="'+N+'"]',typeof b=="string"&&(N+='[crossorigin="'+b+'"]'),ZV.has(N)||(ZV.add(N),h={rel:h,crossOrigin:b,href:g},C.querySelector(N)===null&&(g=C.createElement("link"),Ii(g,"link",h),Pt(g),C.head.appendChild(g)))}}function LSe(h){Pu.D(h),XV("dns-prefetch",h,null)}function jSe(h,g){Pu.C(h,g),XV("preconnect",h,g)}function PSe(h,g,b){Pu.L(h,g,b);var C=Mg;if(C&&h&&g){var N='link[rel="preload"][as="'+da(g)+'"]';g==="image"&&b&&b.imageSrcSet?(N+='[imagesrcset="'+da(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(N+='[imagesizes="'+da(b.imageSizes)+'"]')):N+='[href="'+da(h)+'"]';var P=N;switch(g){case"style":P=Dg(h);break;case"script":P=Og(h)}Wo.has(P)||(h=f({rel:"preload",href:g==="image"&&b&&b.imageSrcSet?void 0:h,as:g},b),Wo.set(P,h),C.querySelector(N)!==null||g==="style"&&C.querySelector($x(P))||g==="script"&&C.querySelector(Fx(P))||(g=C.createElement("link"),Ii(g,"link",h),Pt(g),C.head.appendChild(g)))}}function MSe(h,g){Pu.m(h,g);var b=Mg;if(b&&h){var C=g&&typeof g.as=="string"?g.as:"script",N='link[rel="modulepreload"][as="'+da(C)+'"][href="'+da(h)+'"]',P=N;switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=Og(h)}if(!Wo.has(P)&&(h=f({rel:"modulepreload",href:h},g),Wo.set(P,h),b.querySelector(N)===null)){switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(Fx(P)))return}C=b.createElement("link"),Ii(C,"link",h),Pt(C),b.head.appendChild(C)}}}function DSe(h,g,b){Pu.S(h,g,b);var C=Mg;if(C&&h){var N=Ht(C).hoistableStyles,P=Dg(h);g=g||"default";var W=N.get(P);if(!W){var X={loading:0,preload:null};if(W=C.querySelector($x(P)))X.loading=5;else{h=f({rel:"stylesheet",href:h,"data-precedence":g},b),(b=Wo.get(P))&&BA(h,b);var oe=W=C.createElement("link");Pt(oe),Ii(oe,"link",h),oe._p=new Promise(function(Se,Pe){oe.onload=Se,oe.onerror=Pe}),oe.addEventListener("load",function(){X.loading|=1}),oe.addEventListener("error",function(){X.loading|=2}),X.loading|=4,Kw(W,g,C)}W={type:"stylesheet",instance:W,count:1,state:X},N.set(P,W)}}}function OSe(h,g){Pu.X(h,g);var b=Mg;if(b&&h){var C=Ht(b).hoistableScripts,N=Og(h),P=C.get(N);P||(P=b.querySelector(Fx(N)),P||(h=f({src:h,async:!0},g),(g=Wo.get(N))&&zA(h,g),P=b.createElement("script"),Pt(P),Ii(P,"link",h),b.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},C.set(N,P))}}function $Se(h,g){Pu.M(h,g);var b=Mg;if(b&&h){var C=Ht(b).hoistableScripts,N=Og(h),P=C.get(N);P||(P=b.querySelector(Fx(N)),P||(h=f({src:h,async:!0,type:"module"},g),(g=Wo.get(N))&&zA(h,g),P=b.createElement("script"),Pt(P),Ii(P,"link",h),b.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},C.set(N,P))}}function QV(h,g,b,C){var N=(N=Q.current)?qw(N):null;if(!N)throw Error(s(446));switch(h){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(g=Dg(b.href),b=Ht(N).hoistableStyles,C=b.get(g),C||(C={type:"style",instance:null,count:0,state:null},b.set(g,C)),C):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){h=Dg(b.href);var P=Ht(N).hoistableStyles,W=P.get(h);if(W||(N=N.ownerDocument||N,W={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},P.set(h,W),(P=N.querySelector($x(h)))&&!P._p&&(W.instance=P,W.state.loading=5),Wo.has(h)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},Wo.set(h,b),P||FSe(N,h,b,W.state))),g&&C===null)throw Error(s(528,""));return W}if(g&&C!==null)throw Error(s(529,""));return null;case"script":return g=b.async,b=b.src,typeof b=="string"&&g&&typeof g!="function"&&typeof g!="symbol"?(g=Og(b),b=Ht(N).hoistableScripts,C=b.get(g),C||(C={type:"script",instance:null,count:0,state:null},b.set(g,C)),C):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,h))}}function Dg(h){return'href="'+da(h)+'"'}function $x(h){return'link[rel="stylesheet"]['+h+"]"}function JV(h){return f({},h,{"data-precedence":h.precedence,precedence:null})}function FSe(h,g,b,C){h.querySelector('link[rel="preload"][as="style"]['+g+"]")?C.loading=1:(g=h.createElement("link"),C.preload=g,g.addEventListener("load",function(){return C.loading|=1}),g.addEventListener("error",function(){return C.loading|=2}),Ii(g,"link",b),Pt(g),h.head.appendChild(g))}function Og(h){return'[src="'+da(h)+'"]'}function Fx(h){return"script[async]"+h}function eH(h,g,b){if(g.count++,g.instance===null)switch(g.type){case"style":var C=h.querySelector('style[data-href~="'+da(b.href)+'"]');if(C)return g.instance=C,Pt(C),C;var N=f({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return C=(h.ownerDocument||h).createElement("style"),Pt(C),Ii(C,"style",N),Kw(C,b.precedence,h),g.instance=C;case"stylesheet":N=Dg(b.href);var P=h.querySelector($x(N));if(P)return g.state.loading|=4,g.instance=P,Pt(P),P;C=JV(b),(N=Wo.get(N))&&BA(C,N),P=(h.ownerDocument||h).createElement("link"),Pt(P);var W=P;return W._p=new Promise(function(X,oe){W.onload=X,W.onerror=oe}),Ii(P,"link",C),g.state.loading|=4,Kw(P,b.precedence,h),g.instance=P;case"script":return P=Og(b.src),(N=h.querySelector(Fx(P)))?(g.instance=N,Pt(N),N):(C=b,(N=Wo.get(P))&&(C=f({},b),zA(C,N)),h=h.ownerDocument||h,N=h.createElement("script"),Pt(N),Ii(N,"link",C),h.head.appendChild(N),g.instance=N);case"void":return null;default:throw Error(s(443,g.type))}else g.type==="stylesheet"&&(g.state.loading&4)===0&&(C=g.instance,g.state.loading|=4,Kw(C,b.precedence,h));return g.instance}function Kw(h,g,b){for(var C=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=C.length?C[C.length-1]:null,P=N,W=0;W<C.length;W++){var X=C[W];if(X.dataset.precedence===g)P=X;else if(P!==N)break}P?P.parentNode.insertBefore(h,P.nextSibling):(g=b.nodeType===9?b.head:b,g.insertBefore(h,g.firstChild))}function BA(h,g){h.crossOrigin==null&&(h.crossOrigin=g.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=g.referrerPolicy),h.title==null&&(h.title=g.title)}function zA(h,g){h.crossOrigin==null&&(h.crossOrigin=g.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=g.referrerPolicy),h.integrity==null&&(h.integrity=g.integrity)}var Yw=null;function tH(h,g,b){if(Yw===null){var C=new Map,N=Yw=new Map;N.set(b,C)}else N=Yw,C=N.get(b),C||(C=new Map,N.set(b,C));if(C.has(h))return C;for(C.set(h,null),b=b.getElementsByTagName(h),N=0;N<b.length;N++){var P=b[N];if(!(P[Fe]||P[ut]||h==="link"&&P.getAttribute("rel")==="stylesheet")&&P.namespaceURI!=="http://www.w3.org/2000/svg"){var W=P.getAttribute(g)||"";W=h+W;var X=C.get(W);X?X.push(P):C.set(W,[P])}}return C}function nH(h,g,b){h=h.ownerDocument||h,h.head.insertBefore(b,g==="title"?h.querySelector("head > title"):null)}function USe(h,g,b){if(b===1||g.itemProp!=null)return!1;switch(h){case"meta":case"title":return!0;case"style":if(typeof g.precedence!="string"||typeof g.href!="string"||g.href==="")break;return!0;case"link":if(typeof g.rel!="string"||typeof g.href!="string"||g.href===""||g.onLoad||g.onError)break;switch(g.rel){case"stylesheet":return h=g.disabled,typeof g.precedence=="string"&&h==null;default:return!0}case"script":if(g.async&&typeof g.async!="function"&&typeof g.async!="symbol"&&!g.onLoad&&!g.onError&&g.src&&typeof g.src=="string")return!0}return!1}function sH(h){return!(h.type==="stylesheet"&&(h.state.loading&3)===0)}function BSe(h,g,b,C){if(b.type==="stylesheet"&&(typeof C.media!="string"||matchMedia(C.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var N=Dg(C.href),P=g.querySelector($x(N));if(P){g=P._p,g!==null&&typeof g=="object"&&typeof g.then=="function"&&(h.count++,h=Zw.bind(h),g.then(h,h)),b.state.loading|=4,b.instance=P,Pt(P);return}P=g.ownerDocument||g,C=JV(C),(N=Wo.get(N))&&BA(C,N),P=P.createElement("link"),Pt(P);var W=P;W._p=new Promise(function(X,oe){W.onload=X,W.onerror=oe}),Ii(P,"link",C),b.instance=P}h.stylesheets===null&&(h.stylesheets=new Map),h.stylesheets.set(b,g),(g=b.state.preload)&&(b.state.loading&3)===0&&(h.count++,b=Zw.bind(h),g.addEventListener("load",b),g.addEventListener("error",b))}}var VA=0;
vendor: 4,471 bytes, line 50
50function zSe(h,g){return h.stylesheets&&h.count===0&&Qw(h,h.stylesheets),0<h.count||0<h.imgCount?function(b){var C=setTimeout(function(){if(h.stylesheets&&Qw(h,h.stylesheets),h.unsuspend){var P=h.unsuspend;h.unsuspend=null,P()}},6e4+g);0<h.imgBytes&&VA===0&&(VA=62500*wSe());var N=setTimeout(function(){if(h.waitingForImages=!1,h.count===0&&(h.stylesheets&&Qw(h,h.stylesheets),h.unsuspend)){var P=h.unsuspend;h.unsuspend=null,P()}},(h.imgBytes>VA?50:800)+g);return h.unsuspend=b,function(){h.unsuspend=null,clearTimeout(C),clearTimeout(N)}}:null}function Zw(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qw(this,this.stylesheets);else if(this.unsuspend){var h=this.unsuspend;this.unsuspend=null,h()}}}var Xw=null;function Qw(h,g){h.stylesheets=null,h.unsuspend!==null&&(h.count++,Xw=new Map,g.forEach(VSe,h),Xw=null,Zw.call(h))}function VSe(h,g){if(!(g.state.loading&4)){var b=Xw.get(h);if(b)var C=b.get(null);else{b=new Map,Xw.set(h,b);for(var N=h.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P<N.length;P++){var W=N[P];(W.nodeName==="LINK"||W.getAttribute("media")!=="not all")&&(b.set(W.dataset.precedence,W),C=W)}C&&b.set(null,C)}N=g.instance,W=N.getAttribute("data-precedence"),P=b.get(W)||C,P===C&&b.set(null,N),b.set(W,N),this.count++,C=Zw.bind(this),N.addEventListener("load",C),N.addEventListener("error",C),P?P.parentNode.insertBefore(N,P.nextSibling):(h=h.nodeType===9?h.head:h,h.insertBefore(N,h.firstChild)),g.state.loading|=4}}var Ux={$$typeof:E,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function HSe(h,g,b,C,N,P,W,X,oe){this.tag=1,this.containerInfo=h,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ti(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ti(0),this.hiddenUpdates=Ti(null),this.identifierPrefix=C,this.onUncaughtError=N,this.onCaughtError=P,this.onRecoverableError=W,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function rH(h,g,b,C,N,P,W,X,oe,Se,Pe,Be){return h=new HSe(h,g,b,W,oe,Se,Pe,Be,X),g=1,P===!0&&(g|=24),P=so(3,null,null,g),h.current=P,P.stateNode=h,g=w3(),g.refCount++,h.pooledCache=g,g.refCount++,P.memoizedState={element:C,isDehydrated:b,cache:g},T3(P),h}function iH(h){return h?(h=pg,h):pg}function aH(h,g,b,C,N,P){N=iH(N),C.context===null?C.context=N:C.pendingContext=N,C=Wd(g),C.payload={element:b},P=P===void 0?null:P,P!==null&&(C.callback=P),b=qd(h,C,g),b!==null&&(Ba(b,h,g),xx(b,h,g))}function oH(h,g){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var b=h.retryLane;h.retryLane=b!==0&&b<g?b:g}}function HA(h,g){oH(h,g),(h=h.alternate)&&oH(h,g)}function lH(h){if(h.tag===13||h.tag===31){var g=ep(h,67108864);g!==null&&Ba(g,h,67108864),HA(h,67108864)}}function cH(h){if(h.tag===13||h.tag===31){var g=lo();g=de(g);var b=ep(h,g);b!==null&&Ba(b,h,g),HA(h,g)}}var Jw=!0;function GSe(h,g,b,C){var N=$.T;$.T=null;var P=V.p;try{V.p=2,GA(h,g,b,C)}finally{V.p=P,$.T=N}}function WSe(h,g,b,C){var N=$.T;$.T=null;var P=V.p;try{V.p=8,GA(h,g,b,C)}finally{V.p=P,$.T=N}}function GA(h,g,b,C){if(Jw){var N=WA(C);if(N===null)IA(h,g,C,e_,b),dH(h,C);else if(KSe(N,h,g,b,C))C.stopPropagation();else if(dH(h,C),g&4&&-1<qSe.indexOf(h)){for(;N!==null;){var P=bt(N);if(P!==null)switch(P.tag){case 3:if(P=P.stateNode,P.current.memoizedState.isDehydrated){var W=Ut(P.pendingLanes);if(W!==0){var X=P;for(X.pendingLanes|=2,X.entangledLanes|=2;W;){var oe=1<<31-Ee(W);X.entanglements[1]|=oe,W&=~oe}hc(P),(Jn&6)===0&&(Dw=Ke()+500,Px(0))}}break;case 31:case 13:X=ep(P,2),X!==null&&Ba(X,P,2),$w(),HA(P,2)}if(P=WA(C),P===null&&IA(h,g,C,e_,b),P===N)break;N=P}N!==null&&C.stopPropagation()}else IA(h,g,C,null,b)}}function WA(h){return h=KR(h),qA(h)}var e_=null;function qA(h){if(e_=null,h=st(h),h!==null){var g=i(h);if(g===null)h=null;else{var b=g.tag;if(b===13){if(h=a(g),h!==null)return h;h=null}else if(b===31){if(h=o(g),h!==null)return h;h=null}else if(b===3){if(g.stateNode.current.memoizedState.isDehydrated)return g.tag===3?g.stateNode.containerInfo:null;h=null}else g!==h&&(h=null)}}return e_=h,null}function uH(h){switch(h){case"beforetoggle":case"cancel":case"click":case"close"
vendor: 4,737 bytes, line 50
50:case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dt()){case Xt:return 2;case _n:return 8;case Dt:case nn:return 32;case fn:return 268435456;default:return 32}default:return 32}}var KA=!1,rf=null,af=null,of=null,Bx=new Map,zx=new Map,lf=[],qSe="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function dH(h,g){switch(h){case"focusin":case"focusout":rf=null;break;case"dragenter":case"dragleave":af=null;break;case"mouseover":case"mouseout":of=null;break;case"pointerover":case"pointerout":Bx.delete(g.pointerId);break;case"gotpointercapture":case"lostpointercapture":zx.delete(g.pointerId)}}function Vx(h,g,b,C,N,P){return h===null||h.nativeEvent!==P?(h={blockedOn:g,domEventName:b,eventSystemFlags:C,nativeEvent:P,targetContainers:[N]},g!==null&&(g=bt(g),g!==null&&lH(g)),h):(h.eventSystemFlags|=C,g=h.targetContainers,N!==null&&g.indexOf(N)===-1&&g.push(N),h)}function KSe(h,g,b,C,N){switch(g){case"focusin":return rf=Vx(rf,h,g,b,C,N),!0;case"dragenter":return af=Vx(af,h,g,b,C,N),!0;case"mouseover":return of=Vx(of,h,g,b,C,N),!0;case"pointerover":var P=N.pointerId;return Bx.set(P,Vx(Bx.get(P)||null,h,g,b,C,N)),!0;case"gotpointercapture":return P=N.pointerId,zx.set(P,Vx(zx.get(P)||null,h,g,b,C,N)),!0}return!1}function fH(h){var g=st(h.target);if(g!==null){var b=i(g);if(b!==null){if(g=b.tag,g===13){if(g=a(b),g!==null){h.blockedOn=g,We(h.priority,function(){cH(b)});return}}else if(g===31){if(g=o(b),g!==null){h.blockedOn=g,We(h.priority,function(){cH(b)});return}}else if(g===3&&b.stateNode.current.memoizedState.isDehydrated){h.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}h.blockedOn=null}function t_(h){if(h.blockedOn!==null)return!1;for(var g=h.targetContainers;0<g.length;){var b=WA(h.nativeEvent);if(b===null){b=h.nativeEvent;var C=new b.constructor(b.type,b);qR=C,b.target.dispatchEvent(C),qR=null}else return g=bt(b),g!==null&&lH(g),h.blockedOn=b,!1;g.shift()}return!0}function hH(h,g,b){t_(h)&&b.delete(g)}function YSe(){KA=!1,rf!==null&&t_(rf)&&(rf=null),af!==null&&t_(af)&&(af=null),of!==null&&t_(of)&&(of=null),Bx.forEach(hH),zx.forEach(hH)}function n_(h,g){h.blockedOn===g&&(h.blockedOn=null,KA||(KA=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,YSe)))}var s_=null;function pH(h){s_!==h&&(s_=h,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){s_===h&&(s_=null);for(var g=0;g<h.length;g+=3){var b=h[g],C=h[g+1],N=h[g+2];if(typeof C!="function"){if(qA(C||b)===null)continue;break}var P=bt(b);P!==null&&(h.splice(g,3),g-=3,W3(P,{pending:!0,data:N,method:b.method,action:C},C,N))}}))}function $g(h){function g(oe){return n_(oe,h)}rf!==null&&n_(rf,h),af!==null&&n_(af,h),of!==null&&n_(of,h),Bx.forEach(g),zx.forEach(g);for(var b=0;b<lf.length;b++){var C=lf[b];C.blockedOn===h&&(C.blockedOn=null)}for(;0<lf.length&&(b=lf[0],b.blockedOn===null);)fH(b),b.blockedOn===null&&lf.shift();if(b=(h.ownerDocument||h).$$reactFormReplay,b!=null)for(C=0;C<b.length;C+=3){var N=b[C],P=b[C+1],W=N[It]||null;if(typeof P=="function")W||pH(b);else if(W){var X=null;if(P&&P.hasAttribute("formAction")){if(N=P,W=P[It]||null)X=W.formAction;else if(qA(N)!==null)continue}else X=W.action;typeof X=="function"?b[C+1]=X:(b.splice(C,3),C-=3),pH(b)}}}function mH(){function h(P){P.canIntercept&&P.info==="react-transition"&&P.intercept({handler:function(){return new Promise(function(W){return N=W})},focusReset:"manual",scroll:"manual"})}function g(){N!==null&&(N(),N=null),C||setTimeout(b,20)}function b(){if(!C&&!navigation.transition){var P=navigation.currentEntry;
50P&&P.url!=null&&navigation.navigate(P.url,{state:P.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var C=!1,N=null;return navigation.addEventListener("navigate",h),navigation.addEventListener("navigatesuccess",g),navigation.addEventListener("navigateerror",g),setTimeout(b,100),function(){C=!0,navigation.removeEventListener("navigate",h),navigation.removeEventListener("navigatesuccess",g),navigation.removeEventListener("navigateerror",g),N!==null&&(N(),N=null)}}}function YA(h){this._internalRoot=h}r_.prototype.render=YA.prototype.render=function(h){var g=this._internalRoot;if(g===null)throw Error(s(409));var b=g.current,C=lo();aH(b,C,h,g,null,null)},r_.prototype.unmount=YA.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var g=h.containerInfo;aH(h.current,2,null,h,null,null),$w(),g[ct]=null}};function r_(h){this._internalRoot=h}r_.prototype.unstable_scheduleHydration=function(h){if(h){var g=ze();h={blockedOn:null,target:h,priority:g};for(var b=0;b<lf.length&&g!==0&&g<lf[b].priority;b++);lf.splice(b,0,h),b===0&&fH(h)}};var gH=e.version;if(gH!=="19.2.8")throw Error(s(527,gH,"19.2.8"));V.findDOMNode=function(h){var g=h._reactInternals;if(g===void 0)throw typeof h.render=="function"?Error(s(188)):(h=Object.keys(h).join(","),Error(s(268,h)));return h=u(g),h=h!==null?d(h):null,h=h===null?null:h.stateNode,h};var ZSe={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var i_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!i_.isDisabled&&i_.supportsFiber)try{Z=i_.inject(ZSe),ie=i_}catch{}}return Gx.createRoot=function(h,g){if(!r(h))throw Error(s(299));var b=!1,C="",N=_z,P=Ez,W=Cz;return g!=null&&(g.unstable_strictMode===!0&&(b=!0),g.identifierPrefix!==void 0&&(C=g.identifierPrefix),g.onUncaughtError!==void 0&&(N=g.onUncaughtError),g.onCaughtError!==void 0&&(P=g.onCaughtError),g.onRecoverableError!==void 0&&(W=g.onRecoverableError)),g=rH(h,1,!1,null,null,b,C,null,N,P,W,mH),h[ct]=g.current,NA(h),new YA(g)},Gx.hydrateRoot=function(h,g,b){if(!r(h))throw Error(s(299));var C=!1,N="",P=_z,W=Ez,X=Cz,oe=null;return b!=null&&(b.unstable_strictMode===!0&&(C=!0),b.identifierPrefix!==void 0&&(N=b.identifierPrefix),b.onUncaughtError!==void 0&&(P=b.onUncaughtError),b.onCaughtError!==void 0&&(W=b.onCaughtError),b.onRecoverableError!==void 0&&(X=b.onRecoverableError),b.formState!==void 0&&(oe=b.formState)),g=rH(h,1,!0,g,b??null,C,N,oe,P,W,X,mH),g.context=iH(null),b=g.current,C=lo(),C=de(C),N=Wd(C),N.callback=null,qd(b,N,C),b=C,g.current.lanes=b,Pa(g,b),hc(g),h[ct]=g.current,NA(h),new r_(g)},Gx.version="19.2.8",Gx}var kH;function lwe(){if(kH)return QA.exports;kH=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),QA.exports=owe(),QA.exports}var cwe=lwe();const uwe=Y2(cwe);let H8=null;class Ere extends Error{constructor(){super("Authentication is still loading. Please retry."),this.name="AuthTokenUnavailableError"}}function dwe(t){H8=t}async function Cre(){return H8?H8():null}async function fwe(){const t=await Cre();if(!t)throw new Ere;return t}async function hwe(t,e){const n=await Cre();if(n)t.headers.set("Authorization",`Bearer ${n}`);else if(e)throw new Ere;return t}async function pwe(){return{Authorization:`Bearer ${await fwe()}`}}const mwe={bodySerializer:t=>JSON.stringify(t,(e,n)=>typeof n=="bigint"?n.toString():n)};function gwe({onRequest:t,onSseError:e,onSseEvent:n,responseTransformer:s,responseValidator:r,sseDefaultRetryDelay:i,sseMaxRetryAttempts:a,sseMaxRetryDelay:o,sseSleepFn:l,url:u,...d}){let f;const p=l??(x=>new Promise(y=>setTimeout(y,x)));return{stream:async function*(){let x=i??3e3,y=0;const S=d.signal??new AbortController().signal;for(;!S.aborted;){y++;const _=d.headers instanceof Headers?d.headers:new Headers(d.headers);f!==void 0&&_.set("Last-Event-ID",f);try{const E={redirect:"follow",...d,body:d.serializedBody,headers:_,signal:S};
50let T=new Request(u,E);t&&(T=await t(u,E));const R=await(d.fetch??globalThis.fetch)(T);if(!R.ok)throw new Error(`SSE failed: ${R.status} ${R.statusText}`);if(!R.body)throw new Error("No body in SSE response");const I=R.body.pipeThrough(new TextDecoderStream).getReader();let A="";const L=()=>{try{I.cancel()}catch{}};S.addEventListener("abort",L);try{for(;;){const{done:j,value:F}=await I.read();if(j)break;A+=F,A=A.replace(/\r\n?/g,`
51`);const O=A.split(`
52
53`);A=O.pop()??"";for(const M of O){const U=M.split(`
54`),G=[];let $;for(const q of U)if(q.startsWith("data:"))G.push(q.replace(/^data:\s*/,""));else if(q.startsWith("event:"))$=q.replace(/^event:\s*/,"");else if(q.startsWith("id:"))f=q.replace(/^id:\s*/,"");else if(q.startsWith("retry:")){const z=Number.parseInt(q.replace(/^retry:\s*/,""),10);Number.isNaN(z)||(x=z)}let V,B=!1;if(G.length){const q=G.join(`
55`);try{V=JSON.parse(q),B=!0}catch{V=q}}B&&(r&&await r(V),s&&(V=await s(V))),n==null||n({data:V,event:$,id:f,retry:x}),G.length&&(yield V)}}}finally{S.removeEventListener("abort",L),I.releaseLock()}break}catch(E){if(e==null||e(E),a!==void 0&&y>=a)break;const T=Math.min(x*2**(y-1),o??3e4);await p(T)}}}()}}const vwe=t=>{switch(t){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},xwe=t=>{switch(t){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},ywe=t=>{switch(t){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Tre=({allowReserved:t,explode:e,name:n,style:s,value:r})=>{if(!e){const o=(t?r:r.map(l=>encodeURIComponent(l))).join(xwe(s));switch(s){case"label":return`.${o}`;case"matrix":return`;${n}=${o}`;case"simple":return o;default:return`${n}=${o}`}}const i=vwe(s),a=r.map(o=>s==="label"||s==="simple"?t?o:encodeURIComponent(o):L5({allowReserved:t,name:n,value:o})).join(i);return s==="label"||s==="matrix"?i+a:a},L5=({allowReserved:t,name:e,value:n})=>{if(n==null)return"";if(typeof n=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${t?n:encodeURIComponent(n)}`},kre=({allowReserved:t,explode:e,name:n,style:s,value:r,valueOnly:i})=>{if(r instanceof Date)return i?r.toISOString():`${n}=${r.toISOString()}`;if(s!=="deepObject"&&!e){let l=[];Object.entries(r).forEach(([d,f])=>{l=[...l,d,t?f:encodeURIComponent(f)]});const u=l.join(",");switch(s){case"form":return`${n}=${u}`;case"label":return`.${u}`;case"matrix":return`;${n}=${u}`;default:return u}}const a=ywe(s),o=Object.entries(r).map(([l,u])=>L5({allowReserved:t,name:s==="deepObject"?`${n}[${l}]`:l,value:u})).join(a);return s==="label"||s==="matrix"?a+o:o},bwe=/\{[^{}]+\}/g,Swe=({path:t,url:e})=>{let n=e;const s=e.match(bwe);if(s)for(const r of s){let i=!1,a=r.substring(1,r.length-1),o="simple";a.endsWith("*")&&(i=!0,a=a.substring(0,a.length-1)),a.startsWith(".")?(a=a.substring(1),o="label"):a.startsWith(";")&&(a=a.substring(1),o="matrix");const l=t[a];if(l==null)continue;if(Array.isArray(l)){n=n.replace(r,Tre({explode:i,name:a,style:o,value:l}));continue}if(typeof l=="object"){n=n.replace(r,kre({explode:i,name:a,style:o,value:l,valueOnly:!0}));continue}if(o==="matrix"){n=n.replace(r,`;${L5({name:a,value:l})}`);continue}const u=encodeURIComponent(o==="label"?`.${l}`:l);n=n.replace(r,u)}return n},wwe=({baseUrl:t,path:e,query:n,querySerializer:s,url:r})=>{const i=r.startsWith("/")?r:`/${r}`;let a=(t??"")+i;e&&(a=Swe({path:e,url:a}));let o=n?s(n):"";return o.startsWith("?")&&(o=o.substring(1)),o&&(a+=`?${o}`),a};function RH(t){const e=t.body!==void 0;if(e&&t.bodySerializer)return"serializedBody"in t?t.serializedBody!==void 0&&t.serializedBody!==""?t.serializedBody:null:t.body!==""?t.body:null;if(e)return t.body}const _we=async(t,e)=>{const n=typeof e=="function"?await e(t):e;if(n)return t.scheme==="bearer"?`Bearer ${n}`:t.scheme==="basic"?`Basic ${btoa(n)}`:n},Rre=({parameters:t={},...e}={})=>s=>{const r=[];if(s&&typeof s=="object")for(const i in s){const a=s[i];if(a==null)continue;const o=t[i]||e;if(Array.isArray(a)){const l=Tre({allowReserved:o.allowReserved,explode:!0,name:i,style:"form",value:a,...o.array});l&&r.push(l)}else if(typeof a=="object"){const l=kre({allowReserved:o.allowReserved,explode:!0,name:i,style:"deepObject",value:a,...o.object});l&&r.push(l)}
55else{const l=L5({allowReserved:o.allowReserved,name:i,value:a});l&&r.push(l)}}return r.join("&")},Ewe=t=>{var n;if(!t)return"stream";const e=(n=t.split(";")[0])==null?void 0:n.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(s=>e.startsWith(s)))return"blob";if(e.startsWith("text/"))return"text"}},Cwe=(t,e)=>{var n,s;return e?!!(t.headers.has(e)||(n=t.query)!=null&&n[e]||(s=t.headers.get("Cookie"))!=null&&s.includes(`${e}=`)):!1};async function Twe(t){for(const e of t.security??[]){if(Cwe(t,e.name))continue;const n=await _we(e,t.auth);if(!n)continue;const s=e.name??"Authorization";switch(e.in){case"query":t.query||(t.query={}),t.query[s]=n;break;case"cookie":t.headers.append("Cookie",`${s}=${n}`);break;case"header":default:t.headers.set(s,n);break}}}const AH=t=>wwe({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:Rre(t.querySerializer),url:t.url}),NH=(t,e)=>{var s;const n={...t,...e};return(s=n.baseUrl)!=null&&s.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=Are(t.headers,e.headers),n},kwe=t=>{const e=[];return t.forEach((n,s)=>{e.push([s,n])}),e},Are=(...t)=>{const e=new Headers;for(const n of t){if(!n)continue;const s=n instanceof Headers?kwe(n):Object.entries(n);for(const[r,i]of s)if(i===null)e.delete(r);else if(Array.isArray(i))for(const a of i)e.append(r,a);else i!==void 0&&e.set(r,typeof i=="object"?JSON.stringify(i):i)}return e};class sN{constructor(){js(this,"fns",[])}clear(){this.fns=[]}eject(e){const n=this.getInterceptorIndex(e);this.fns[n]&&(this.fns[n]=null)}exists(e){const n=this.getInterceptorIndex(e);return!!this.fns[n]}getInterceptorIndex(e){return typeof e=="number"?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,n){const s=this.getInterceptorIndex(e);return this.fns[s]?(this.fns[s]=n,e):!1}use(e){return this.fns.push(e),this.fns.length-1}}const Rwe=()=>({error:new sN,request:new sN,response:new sN}),Awe=Rre({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Nwe={"Content-Type":"application/json"},Nre=(t={})=>({...mwe,headers:Nwe,parseAs:"auto",querySerializer:Awe,...t}),Iwe=(t={})=>{let e=NH(Nre(),t);const n=()=>({...e}),s=d=>(e=NH(e,d),n()),r=Rwe(),i=async d=>{const f={...e,...d,fetch:d.fetch??e.fetch??globalThis.fetch,headers:Are(e.headers,d.headers),serializedBody:void 0};f.security&&await Twe(f),f.requestValidator&&await f.requestValidator(f),f.body!==void 0&&f.bodySerializer&&(f.serializedBody=f.bodySerializer(f.body)),(f.body===void 0||f.serializedBody==="")&&f.headers.delete("Content-Type");const p=f,m=AH(p);return{opts:p,url:m}},a=async d=>{const f=d.throwOnError??e.throwOnError,p=d.responseStyle??e.responseStyle;let m,v;try{const{opts:x,url:y}=await i(d),S={redirect:"follow",...x,body:RH(x)};m=new Request(y,S);for(const R of r.request.fns)R&&(m=await R(m,x));const _=x.fetch;v=await _(m);for(const R of r.response.fns)R&&(v=await R(v,m,x));const E={request:m,response:v};if(v.ok){const R=(x.parseAs==="auto"?Ewe(v.headers.get("Content-Type")):x.parseAs)??"json";if(v.status===204||v.headers.get("Content-Length")==="0"){let A;switch(R){case"arrayBuffer":case"blob":case"text":A=await v[R]();break;case"formData":A=new FormData;break;case"stream":A=v.body;break;case"json":default:A={};break}return x.responseStyle==="data"?A:{data:A,...E}}let I;switch(R){case"arrayBuffer":case"blob":case"formData":case"text":I=await v[R]();break;case"json":{const A=await v.text();I=A?JSON.parse(A):{};break}case"stream":return x.responseStyle==="data"?v.body:{data:v.body,...E}}return R==="json"&&(x.responseValidator&&await x.responseValidator(I),x.responseTransformer&&(I=await x.responseTransformer(I))),x.responseStyle==="data"?I:{data:I,...E}}const T=await v.text();let k;try{k=JSON.parse(T)}catch{}throw k??T}catch(x){let y=x;for(const S of r.error.fns)S&&(y=await S(y,v,m,d));if(y=y||{},f)throw y;return p==="data"?void 0:{error:y,request:m,response:v}}},o=d=>f=>a({...f,method:d}),l=d=>
55async f=>{const{opts:p,url:m}=await i(f);return gwe({...p,body:p.body,method:d,onRequest:async(v,x)=>{let y=new Request(v,x);for(const S of r.request.fns)S&&(y=await S(y,p));return y},serializedBody:RH(p),url:m})};return{buildUrl:d=>AH({...e,...d}),connect:o("CONNECT"),delete:o("DELETE"),get:o("GET"),getConfig:n,head:o("HEAD"),interceptors:r,options:o("OPTIONS"),patch:o("PATCH"),post:o("POST"),put:o("PUT"),request:a,setConfig:s,sse:{connect:l("CONNECT"),delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT"),trace:l("TRACE")},trace:o("TRACE")}},ht=Iwe(Nre({baseUrl:"https://api.steel.dev"}));var w=I5();const re=Y2(w),x1=ewe({__proto__:null,default:re},[w]);/**
56 * react-router v7.18.2
57 *
58 * Copyright (c) Remix Software Inc.
59 *
60 * This source code is licensed under the MIT license found in the
61 * LICENSE.md file in the root directory of this source tree.
62 *
63 * @license MIT
64 */var Ire=t=>{throw TypeError(t)},Lre=(t,e,n)=>e.has(t)||Ire("Cannot "+n),Zo=(t,e,n)=>(Lre(t,e,"read from private field"),n?n.call(t):e.get(t)),Ey=(t,e,n)=>e.has(t)?Ire("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pc=(t,e,n,s)=>(Lre(t,e,"write to private field"),e.set(t,n),n),j5=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,C9=/^[\\/]{2}/;function jre(t,e){return e+t.replace(/\\/g,"/")}var IH="popstate";function LH(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function Lwe(t={}){function e(s,r){var u;let i=(u=r.state)==null?void 0:u.masked,{pathname:a,search:o,hash:l}=i||s.location;return Lb("",{pathname:a,search:o,hash:l},r.state&&r.state.usr||null,r.state&&r.state.key||"default",i?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,r){return typeof r=="string"?r:Jc(r)}return Pwe(e,n,null,t)}function dn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Nr(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function jwe(){return Math.random().toString(36).substring(2,10)}function jH(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Lb(t,e,n=null,s,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?du(e):e,state:n,key:e&&e.key||s||jwe(),mask:r}}function Jc({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function du(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substring(s),t=t.substring(0,s)),t&&(e.pathname=t)}return e}function Pwe(t,e,n,s={}){let{window:r=document.defaultView,v5Compat:i=!1}=s,a=r.history,o="POP",l=null,u=d();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function d(){return(a.state||{idx:null}).idx}function f(){o="POP";let y=d(),S=y==null?null:y-u;u=y,l&&l({action:o,location:x.location,delta:S})}function p(y,S){o="PUSH";let _=LH(y)?y:Lb(x.location,y,S);u=d()+1;let E=jH(_,u),T=x.createHref(_.mask||_);try{a.pushState(E,"",T)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;r.location.assign(T)}i&&l&&l({action:o,location:x.location,delta:1})}function m(y,S){o="REPLACE";let _=LH(y)?y:Lb(x.location,y,S);u=d();let E=jH(_,u),T=x.createHref(_.mask||_);a.replaceState(E,"",T),i&&l&&l({action:o,location:x.location,delta:0})}function v(y){return Pre(r,y)}let x={get action(){return o},get location(){return t(r,a)},listen(y){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(IH,f),l=y,()=>{r.removeEventListener(IH,f),l=null}},createHref(y){return e(r,y)},createURL:v,encodeLocation(y){let S=v(y);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:p,replace:m,go(y){return a.go(y)}};return x}function Pre(t,e,n=!1){let s="http://localhost";t&&(s=t.location.origin!=="null"?t.location.origin:t.location.href),dn(s,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Jc(e);return r=r.replace(/ $/,"%20"),!n&&C9.test(r)&&(r=s+r),new URL(r,s)}var Cy,PH=class{constructor(t){if(Ey(this,Cy,new Map),t)for(let[e,n]of t)this.set(e,n)}get(t){if(Zo(this,Cy).has(t))return Zo(this,Cy).get(t);if(t.defaultValue!==void 0)return t.defaultValue;throw new Error("No value found for context")}set(t,e){Zo(this,Cy).set(t,e)}};Cy=new WeakMap;
64var Mwe=new Set(["lazy","caseSensitive","path","id","index","children"]);function Dwe(t){return Mwe.has(t)}var Owe=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function $we(t){return Owe.has(t)}function Fwe(t){return t.index===!0}function jb(t,e,n=[],s={},r=!1){return t.map((i,a)=>{let o=[...n,String(a)],l=typeof i.id=="string"?i.id:o.join("-");if(dn(i.index!==!0||!i.children,"Cannot specify children on an index route"),dn(r||!s[l],`Found a route id collision on id "${l}".  Route id's must be globally unique within Data Router usages`),Fwe(i)){let u={...i,id:l};return s[l]=MH(u,e(u)),u}else{let u={...i,id:l,children:void 0};return s[l]=MH(u,e(u)),i.children&&(u.children=jb(i.children,e,o,s,r)),u}})}function MH(t,e){return Object.assign(t,{...e,...typeof e.lazy=="object"&&e.lazy!=null?{lazy:{...t.lazy,...e.lazy}}:{}})}function T9(t,e,n="/"){return Pl(t,e,n,!1)}function Pl(t,e,n,s,r){let i=typeof e=="string"?du(e):e,a=hl(i.pathname||"/",n);if(a==null)return null;let o=r??pC(t),l=null,u=Fre(a);for(let d=0;l==null&&d<o.length;++d)l=Zwe(o[d],u,s);return l}function Uwe(t,e){let{route:n,pathname:s,params:r}=t;return{id:n.id,pathname:s,params:r,data:e[n.id],loaderData:e[n.id],handle:n.handle}}function pC(t){let e=Mre(t);return Bwe(e),e}function Mre(t,e=[],n=[],s="",r=!1){let i=(a,o,l=r,u)=>{let d={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(s)&&l)return;dn(d.relativePath.startsWith(s),`Absolute route path "${d.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(s.length)}let f=ll([s,d.relativePath]),p=n.concat(d);a.children&&a.children.length>0&&(dn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),Mre(a.children,e,p,f,l)),!(a.path==null&&!a.index)&&e.push({path:f,score:Kwe(f,a.index),routesMeta:p.map((m,v)=>{let[x,y]=$re(m.relativePath,m.caseSensitive,v===p.length-1);return{...m,matcher:x,compiledParams:y}})})};return t.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,o);else for(let u of Dre(a.path))i(a,o,!0,u)}),e}function Dre(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,r=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return r?[i,""]:[i];let a=Dre(s.join("/")),o=[];return o.push(...a.map(l=>l===""?i:[i,l].join("/"))),r&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function Bwe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Ywe(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var zwe=/^:[\w-]+$/,Vwe=3,Hwe=2,Gwe=1,Wwe=10,qwe=-2,DH=t=>t==="*";function Kwe(t,e){let n=t.split("/"),s=n.length;return n.some(DH)&&(s+=qwe),e&&(s+=Hwe),n.filter(r=>!DH(r)).reduce((r,i)=>r+(zwe.test(i)?Vwe:i===""?Gwe:Wwe),s)}function Ywe(t,e){return t.length===e.length&&t.slice(0,-1).every((s,r)=>s===e[r])?t[t.length-1]-e[e.length-1]:0}function Zwe(t,e,n=!1){let{routesMeta:s}=t,r={},i="/",a=[];for(let o=0;o<s.length;++o){let l=s[o],u=o===s.length-1,d=i==="/"?e:e.slice(i.length)||"/",f={path:l.relativePath,caseSensitive:l.caseSensitive,end:u},p=l.matcher&&l.compiledParams?Ore(f,d,l.matcher,l.compiledParams):Pb(f,d),m=l.route;if(!p&&u&&n&&!s[s.length-1].route.index&&(p=Pb({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;
64Object.assign(r,p.params),a.push({params:r,pathname:ll([i,p.pathname]),pathnameBase:Jwe(ll([i,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(i=ll([i,p.pathnameBase]))}return a}function Pb(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,s]=$re(t.path,t.caseSensitive,t.end);return Ore(t,e,n,s)}function Ore(t,e,n,s){let r=e.match(n);if(!r)return null;let i=r[0],a=i.replace(/(.)\/+$/,"$1"),o=r.slice(1);return{params:s.reduce((u,{paramName:d,isOptional:f},p)=>{if(d==="*"){let v=o[p]||"";a=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const m=o[p];return f&&!m?u[d]=void 0:u[d]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:t}}function $re(t,e=!1,n=!0){Nr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let s=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l,u,d)=>{if(s.push({paramName:o,isOptional:l!=null}),l){let f=d.charAt(u+a.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(s.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),s]}function Fre(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Nr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function hl(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}function Xwe({basename:t,pathname:e}){return e==="/"?t:ll([t,e])}var k9=t=>j5.test(t);function Qwe(t,e="/"){let{pathname:n,search:s="",hash:r=""}=typeof t=="string"?du(t):t,i;return n?(n=R9(n),n.startsWith("/")?i=OH(n.substring(1),"/"):i=OH(n,e)):i=e,{pathname:i,search:e_e(s),hash:t_e(r)}}function OH(t,e){let n=_T(e).split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function rN(t,e,n,s){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(s)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ure(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function P5(t){let e=Ure(t);return e.map((n,s)=>s===e.length-1?n.pathname:n.pathnameBase)}function Z2(t,e,n,s=!1){let r;typeof t=="string"?r=du(t):(r={...t},dn(!r.pathname||!r.pathname.includes("?"),rN("?","pathname","search",r)),dn(!r.pathname||!r.pathname.includes("#"),rN("#","pathname","hash",r)),dn(!r.search||!r.search.includes("#"),rN("#","search","hash",r)));let i=t===""||r.pathname==="",a=i?"/":r.pathname,o;if(a==null)o=n;else{let f=e.length-1;if(!s&&a.startsWith("..")){let p=a.split("/");for(;p[0]==="..";)p.shift(),f-=1;r.pathname=p.join("/")}o=f>=0?e[f]:"/"}let l=Qwe(r,o),u=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}var R9=t=>t.replace(/[\\/]{2,}/g,"/"),ll=t=>R9(t.join("/")),_T=t=>t.replace(/\/+$/,""),Jwe=t=>_T(t).replace(/^\/*/,"/"),e_e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,t_e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,n_e=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],X2=class{constructor(t,e,n,s=!1){this.status=t,this.statusText=e||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Mb(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Q2(t){let e=t.map(n=>
64n.route.path).filter(Boolean);return ll(e)||"/"}var Bre=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zre(t,e){let n=t;if(typeof n!="string"||!j5.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,r=!1;if(Bre)try{let i=new URL(window.location.href),a=C9.test(n)?new URL(jre(n,i.protocol)):new URL(n),o=hl(a.pathname,e);a.origin===i.origin&&o!=null?n=o+a.search+a.hash:r=!0}catch{Nr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:r,to:n}}var th=Symbol("Uninstrumented");function s_e(t,e){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};t.forEach(r=>r({id:e.id,index:e.index,path:e.path,instrument(i){let a=Object.keys(n);for(let o of a)i[o]&&n[o].push(i[o])}}));let s={};if(typeof e.lazy=="function"&&n.lazy.length>0){let r=E0(n.lazy,e.lazy,()=>{});r&&(s.lazy=r)}if(typeof e.lazy=="object"){let r=e.lazy;["middleware","loader","action"].forEach(i=>{let a=r[i],o=n[`lazy.${i}`];if(typeof a=="function"&&o.length>0){let l=E0(o,a,()=>{});l&&(s.lazy=Object.assign(s.lazy||{},{[i]:l}))}})}return["loader","action"].forEach(r=>{let i=e[r];if(typeof i=="function"&&n[r].length>0){let a=i[th]??i,o=E0(n[r],a,(...l)=>$H(l[0]));o&&(r==="loader"&&a.hydrate===!0&&(o.hydrate=!0),o[th]=a,s[r]=o)}}),e.middleware&&e.middleware.length>0&&n.middleware.length>0&&(s.middleware=e.middleware.map(r=>{let i=r[th]??r,a=E0(n.middleware,i,(...o)=>$H(o[0]));return a?(a[th]=i,a):r})),s}function r_e(t,e){let n={navigate:[],fetch:[]};if(e.forEach(s=>s({instrument(r){let i=Object.keys(r);for(let a of i)r[a]&&n[a].push(r[a])}})),n.navigate.length>0){let s=t.navigate[th]??t.navigate,r=E0(n.navigate,s,(...i)=>{let[a,o]=i;return{to:typeof a=="number"||typeof a=="string"?a:a?Jc(a):".",...FH(t,o??{})}});r&&(r[th]=s,t.navigate=r)}if(n.fetch.length>0){let s=t.fetch[th]??t.fetch,r=E0(n.fetch,s,(...i)=>{let[a,,o,l]=i;return{href:o??".",fetcherKey:a,...FH(t,l??{})}});r&&(r[th]=s,t.fetch=r)}return t}function E0(t,e,n){return t.length===0?null:async(...s)=>{let r=await Vre(t,n(...s),()=>e(...s),t.length-1);if(r.type==="error")throw r.value;return r.value}}async function Vre(t,e,n,s){let r=t[s],i;if(r){let a,o=async()=>(a?console.error("You cannot call instrumented handlers more than once"):a=Vre(t,e,n,s-1),i=await a,dn(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await r(o,e)}catch(l){console.error("An instrumentation function threw an error:",l)}a||await o(),await a}else try{i={type:"success",value:await n()}}catch(a){i={type:"error",value:a}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function $H(t){let{request:e,context:n,params:s,pattern:r}=t;return{request:i_e(e),params:{...s},pattern:r,context:a_e(n)}}function FH(t,e){return{currentUrl:Jc(t.state.location),..."formMethod"in e?{formMethod:e.formMethod}:{},..."formEncType"in e?{formEncType:e.formEncType}:{},..."formData"in e?{formData:e.formData}:{},..."body"in e?{body:e.body}:{}}}function i_e(t){return{method:t.method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}}}function a_e(t){if(l_e(t)){let e={...t};return Object.freeze(e),e}else return{get:e=>t.get(e)}}var o_e=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function l_e(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||Object.getOwnPropertyNames(e).sort().join("\0")===o_e}var Hre=["POST","PUT","PATCH","DELETE"],c_e=new Set(Hre),u_e=["GET",...Hre],d_e=new Set(u_e),Gre=new Set([301,302,303,307,308]),f_e=new Set([307,308]),iN={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},h_e={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Wx={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},p_e=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),Wre="remix-router-transitions",qre=Symbol("ResetLoaderData"),Ap,i0,Tf,a0,m_e=class{constructor(t){Ey(this,Ap),Ey(this,i0),Ey(this,Tf),Ey(this,a0),pc(this,Ap,t),pc(this,i0,pC(t))}get stableRoutes(){return Zo(this,Ap)}get activeRoutes(){return Zo(this,Tf)??Zo(this,Ap)}get branches(){return Zo(this,a0)??Zo(this,i0)}get hasHMRRoutes(){return Zo(this,Tf)!=null}setRoutes(t){pc(this,Ap,t),pc(this,i0,pC(t))}setHmrRoutes(t){pc(this,Tf,t),pc(this,a0,pC(t))}commitHmrRoutes(){Zo(this,Tf)&&(pc(this,Ap,Zo(this,Tf)),pc(this,i0,Zo(this,a0)),pc(this,Tf,void 0),pc(this,a0,void 0))}};Ap=new WeakMap;i0=new WeakMap;Tf=new WeakMap;a0=new WeakMap;function g_e(t){const e=t.window?t.window:typeof window<"u"?window:void 0,n=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u";dn(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=t.hydrationRouteProperties||[],r=t.mapRouteProperties||p_e,i=r;if(t.instrumentations){let ae=t.instrumentations;i=de=>({...r(de),...s_e(ae.map(ve=>
64ve.route).filter(Boolean),de)})}let a={},o=new m_e(jb(t.routes,i,void 0,a)),l=t.basename||"/";l.startsWith("/")||(l=`/${l}`);let u=t.dataStrategy||S_e,d={...t.future},f=null,p=new Set,m=null,v=null,x=null,y=null,S=t.hydrationData!=null,_=Pl(o.activeRoutes,t.history.location,l,!1,o.branches),E=!1,T=null,k,R;if(_==null&&!t.patchRoutesOnNavigation){let ae=Qo(404,{pathname:t.history.location.pathname}),{matches:de,route:ve}=l_(o.activeRoutes);k=!0,R=!k,_=de,T={[ve.id]:ae}}else if(_&&!t.hydrationData&&Ti(_,o.activeRoutes,t.history.location.pathname).active&&(_=null),_)if(_.some(ae=>ae.route.lazy))k=!1,R=!k;else if(!_.some(ae=>A9(ae.route)))k=!0,R=!k;else{let ae=t.hydrationData?t.hydrationData.loaderData:null,de=t.hydrationData?t.hydrationData.errors:null,ve=_;if(de){let ze=_.findIndex(We=>de[We.route.id]!==void 0);ve=ve.slice(0,ze+1)}R=!1,k=!0,ve.forEach(ze=>{let We=Kre(ze.route,ae,de);R=R||We.renderFallback,k=k&&!We.shouldLoad})}else{k=!1,R=!k,_=[];let ae=Ti(null,o.activeRoutes,t.history.location.pathname);ae.active&&ae.matches&&(E=!0,_=ae.matches)}let I,A={historyAction:t.history.action,location:t.history.location,matches:_,initialized:k,renderFallback:R,navigation:iN,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||T,fetchers:new Map,blockers:new Map},L="POP",j=null,F=!1,O,M=!1,U=new Map,G=null,$=!1,V=!1,B=new Set,q=new Map,z=0,D=-1,K=new Map,Y=new Set,J=new Map,ne=new Map,Q=new Set,ee=new Map,te,ue=null;function ye(){if(f=t.history.listen(({action:ae,location:de,delta:ve})=>{if(te){te(),te=void 0;return}Nr(ee.size===0||ve!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");let ze=Me({currentLocation:A.location,nextLocation:de,historyAction:ae});if(ze&&ve!=null){let We=new Promise(xt=>{te=xt});t.history.go(ve*-1),ft(ze,{state:"blocked",location:de,proceed(){ft(ze,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),We.then(()=>t.history.go(ve))},reset(){let xt=new Map(A.blockers);xt.set(ze,Wx),me({blockers:xt})}}),j==null||j.resolve(),j=null;return}return De(ae,de)}),n){U_e(e,U);let ae=()=>B_e(e,U);e.addEventListener("pagehide",ae),G=()=>e.removeEventListener("pagehide",ae)}return A.initialized||De("POP",A.location,{initialHydration:!0}),I}function je(){f&&f(),G&&G(),p.clear(),O&&O.abort(),A.fetchers.forEach((ae,de)=>Z(A.fetchers,de)),A.blockers.forEach((ae,de)=>Qe(de))}function Re(ae){if(p.add(ae),m){let{newErrors:de}=m;m=null,ae(A,{deletedFetchers:[],newErrors:de,viewTransitionOpts:void 0,flushSync:!1})}return()=>p.delete(ae)}function me(ae,de={}){ae.matches&&(ae.matches=ae.matches.map(We=>{let xt=a[We.route.id],ut=We.route;return ut.element!==xt.element||ut.errorElement!==xt.errorElement||ut.hydrateFallbackElement!==xt.hydrateFallbackElement?{...We,route:xt}:We})),A={...A,...ae};let ve=[],ze=[];A.fetchers.forEach((We,xt)=>{We.state==="idle"&&(Q.has(xt)?ve.push(xt):ze.push(xt))}),Q.forEach(We=>{!A.fetchers.has(We)&&!q.has(We)&&ve.push(We)}),p.size===0&&(m={newErrors:ae.errors??null}),[...p].forEach(We=>We(A,{deletedFetchers:ve,newErrors:ae.errors??null,viewTransitionOpts:de.viewTransitionOpts,flushSync:de.flushSync===!0})),ve.forEach(We=>Z(A.fetchers,We)),ze.forEach(We=>A.fetchers.delete(We))}function Ce(ae,de,{flushSync:ve}={}){var Vt,ce;let ze=A.actionData!=null&&A.navigation.formMethod!=null&&Qi(A.navigation.formMethod)&&A.navigation.state==="loading"&&((Vt=ae.state)==null?void 0:Vt._isRedirect)!==!0,We;de.actionData?Object.keys(de.actionData).length>0?We=de.actionData:We=null:ze?We=A.actionData:We=null;let xt=de.loaderData?YH(A.loaderData,de.loaderData,de.matches||[],de.errors):A.loaderData,ut=A.blockers;ut.size>0&&(ut=new Map(ut),ut.forEach((be,Fe)=>ut.set(Fe,Wx)));let It=$?!1:gu(ae,de.matches||A.matches),ct=F===!0||A.navigation.formMethod!=null&&Qi(A.navigation.formMethod)&&((ce=ae.state)==null?void 0:ce._isRedirect)!==!0;o.commitHmrRoutes(),$||L==="POP"||(L==="PUSH"?t.history.push(ae,ae.state):L==="REPLACE"&&t.history.replace(ae,ae.state));let Lt;if(L==="POP"){let be=U.get(A.location.pathname);be&&be.has(ae.pathname)?Lt={currentLocation:A.location,nextLocation:ae}:U.has(ae.pathname)&&(Lt={currentLocation:ae,nextLocation:A.location})}else if(M){let be=U.get(A.location.pathname);be?be.add(ae.pathname):(be=new Set([ae.pathname]),U.set(A.location.pathname,be)),Lt={currentLocation:A.location,nextLocation:ae}}me({...de,actionData:We,loaderData:xt,historyAction:L,location:ae,initialized:!0,renderFallback:!1,navigation:iN,revalidation:"idle",restoreScrollPosition:It,preventScrollReset:ct,blockers:ut},{viewTransitionOpts:Lt,flushSync:ve===!0}),L="POP",F=!1,M=!1,$=!1,V=!1,j==null||j.resolve(),j=null,ue==null||ue.resolve(),ue=null}async function Xe(ae,de){if(j==null||j.resolve(),j=null,typeof ae=="number"){j||(j=JH());let tt=j.promise;return t.history.go(ae),tt}let ve=G8(A.location,A.matches,l,ae,de==null?void 0:de.fromRouteId,de==null?void 0:de.relative),{path:ze,submission:We,error:xt}=UH(!1,ve,de),ut;de!=null&&de.mask&&(ut={pathname:"",search:"",hash:"",...typeof de.mask=="str
64ing"?du(de.mask):{...A.location.mask,...de.mask}});let It=A.location,ct=Lb(It,ze,de&&de.state,void 0,ut);ct={...ct,...t.history.encodeLocation(ct)};let Lt=de&&de.replace!=null?de.replace:void 0,Vt="PUSH";Lt===!0?Vt="REPLACE":Lt===!1||We!=null&&Qi(We.formMethod)&&We.formAction===A.location.pathname+A.location.search&&(Vt="REPLACE");let ce=de&&"preventScrollReset"in de?de.preventScrollReset===!0:void 0,be=(de&&de.flushSync)===!0,Fe=Me({currentLocation:It,nextLocation:ct,historyAction:Vt});if(Fe){ft(Fe,{state:"blocked",location:ct,proceed(){ft(Fe,{state:"proceeding",proceed:void 0,reset:void 0,location:ct}),Xe(ae,de)},reset(){let tt=new Map(A.blockers);tt.set(Fe,Wx),me({blockers:tt})}});return}await De(Vt,ct,{submission:We,pendingError:xt,preventScrollReset:ce,replace:de&&de.replace,enableViewTransition:de&&de.viewTransition,flushSync:be,callSiteDefaultShouldRevalidate:de&&de.defaultShouldRevalidate})}function he(){ue||(ue=JH()),Dt(),me({revalidation:"loading"});let ae=ue.promise;return A.navigation.state==="submitting"?ae:A.navigation.state==="idle"?(De(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),ae):(De(L||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:M===!0}),ae)}async function De(ae,de,ve){O&&O.abort(),O=null,L=ae,$=(ve&&ve.startUninterruptedRevalidation)===!0,$o(A.location,A.matches),F=(ve&&ve.preventScrollReset)===!0,M=(ve&&ve.enableViewTransition)===!0;let ze=o.activeRoutes,We=ve!=null&&ve.initialHydration&&A.matches&&A.matches.length>0&&!E?A.matches:Pl(ze,de,l,!1,o.branches),xt=(ve&&ve.flushSync)===!0;if(We&&A.initialized&&!V&&N_e(A.location,de)&&!(ve&&ve.submission&&Qi(ve.submission.formMethod))){Ce(de,{matches:We},{flushSync:xt});return}let ut=Ti(We,ze,de.pathname);if(ut.active&&ut.matches&&(We=ut.matches),!We){let{error:bt,notFoundMatches:yt,route:Ht}=Ut(de.pathname);Ce(de,{matches:yt,loaderData:{},errors:{[Ht.id]:bt}},{flushSync:xt});return}let It=ve&&ve.overrideNavigation?{...ve.overrideNavigation,matches:We,historyAction:ae}:void 0;O=new AbortController;let ct=o0(t.history,de,O.signal,ve&&ve.submission),Lt=t.getContext?await t.getContext():new PH,Vt;if(ve&&ve.pendingError)Vt=[Wf(We).route.id,{type:"error",error:ve.pendingError}];else if(ve&&ve.submission&&Qi(ve.submission.formMethod)){let bt=await Ge(ct,de,ve.submission,We,ae,Lt,ut.active,ve&&ve.initialHydration===!0,{replace:ve.replace,flushSync:xt});if(bt.shortCircuited)return;if(bt.pendingActionResult){let[yt,Ht]=bt.pendingActionResult;if(yo(Ht)&&Mb(Ht.error)&&Ht.error.status===404){O=null,Ce(de,{matches:bt.matches,loaderData:{},errors:{[yt]:Ht.error}});return}}We=bt.matches||We,Vt=bt.pendingActionResult,It=aN(de,We,ae,ve.submission),xt=!1,ut.active=!1,ct=o0(t.history,ct.url,ct.signal)}let{shortCircuited:ce,matches:be,loaderData:Fe,errors:tt,workingFetchers:st}=await Je(ct,de,We,ae,Lt,ut.active,It,ve&&ve.submission,ve&&ve.fetcherSubmission,ve&&ve.replace,ve&&ve.initialHydration===!0,xt,Vt,ve&&ve.callSiteDefaultShouldRevalidate);ce||(O=null,Ce(de,{matches:be||We,...ZH(Vt),loaderData:Fe,errors:tt,...st?{fetchers:st}:{}}))}async function Ge(ae,de,ve,ze,We,xt,ut,It,ct={}){Dt();let Lt=$_e(de,ze,We,ve);if(me({navigation:Lt},{flushSync:ct.flushSync===!0}),ut){let be=await Pa(ze,de.pathname,ae.signal);if(be.type==="aborted")return{shortCircuited:!0};if(be.type==="error"){if(be.partialMatches.length===0){let{matches:tt,route:st}=l_(o.activeRoutes);return{matches:tt,pendingActionResult:[st.id,{type:"error",error:be.error}]}}let Fe=Wf(be.partialMatches).route.id;return{matches:be.partialMatches,pendingActionResult:[Fe,{type:"error",error:be.error}]}}else if(be.matches)ze=be.matches;else{let{notFoundMatches:Fe,error:tt,route:st}=Ut(de.pathname);return{matches:Fe,pendingActionResult:[st.id,{type:"error",error:tt}]}}}let Vt,ce=mC(ze,de);if(!ce.route.action&&!ce.route.lazy)Vt={type:"error",error:Qo(405,{method:ae.method,pathname:de.pathname,routeId:ce.route.id})};else{let be=H0(i,a,ae,de,ze,ce,It?[]:s,xt),Fe=await Xt(ae,de,be,xt,null);if(Vt=Fe[ce.route.id],!Vt){for(let tt of ze)if(Fe[tt.route.id]){Vt=Fe[tt.route.id];break}}if(ae.signal.aborted)return{shortCircuited:!0}}if(Fp(Vt)){let be;return ct&&ct.replace!=null?be=ct.replace:be=WH(Vt.response.headers.get("Location"),new URL(ae.url),l,t.history)===A.location.pathname+A.location.search,await dt(ae,Vt,!0,{submission:ve,replace:be}),{shortCircuited:!0}}if(yo(Vt)){let be=Wf(ze,ce.route.id);
64return(ct&&ct.replace)!==!0&&(L="PUSH"),{matches:ze,pendingActionResult:[be.route.id,Vt,ce.route.id]}}return{matches:ze,pendingActionResult:[ce.route.id,Vt]}}async function Je(ae,de,ve,ze,We,xt,ut,It,ct,Lt,Vt,ce,be,Fe){let tt=ut||aN(de,ve,ze,It),st=It||ct||QH(tt),bt=!$&&!Vt;if(xt){if(bt){let qn=Le(be);me({navigation:tt,...qn!==void 0?{actionData:qn}:{}},{flushSync:ce})}let qt=await Pa(ve,de.pathname,ae.signal);if(qt.type==="aborted")return{shortCircuited:!0};if(qt.type==="error"){if(qt.partialMatches.length===0){let{matches:ni,route:ua}=l_(o.activeRoutes);return{matches:ni,loaderData:{},errors:{[ua.id]:qt.error}}}let qn=Wf(qt.partialMatches).route.id;return{matches:qt.partialMatches,loaderData:{},errors:{[qn]:qt.error}}}else if(qt.matches)ve=qt.matches;else{let{error:qn,notFoundMatches:ni,route:ua}=Ut(de.pathname);return{matches:ni,loaderData:{},errors:{[ua.id]:qn}}}}let yt=o.activeRoutes,{dsMatches:Ht,revalidatingFetchers:Pt}=BH(ae,We,i,a,t.history,A,ve,st,de,Vt?[]:s,Vt===!0,V,B,Q,J,Y,yt,l,t.patchRoutesOnNavigation!=null,o.branches,be,Fe);if(D=++z,!t.dataStrategy&&!Ht.some(qt=>qt.shouldLoad)&&!Ht.some(qt=>qt.route.middleware&&qt.route.middleware.length>0)&&Pt.length===0){let qt=new Map(A.fetchers),qn=ke(qt);return Ce(de,{matches:ve,loaderData:{},errors:be&&yo(be[1])?{[be[0]]:be[1].error}:null,...ZH(be),...qn?{fetchers:qt}:{}},{flushSync:ce}),{shortCircuited:!0}}if(bt){let qt={};if(!xt){qt.navigation=tt;let qn=Le(be);qn!==void 0&&(qt.actionData=qn)}Pt.length>0&&(qt.fetchers=qe(Pt)),me(qt,{flushSync:ce})}Pt.forEach(qt=>{le(qt.key),qt.controller&&q.set(qt.key,qt.controller)});let as=()=>Pt.forEach(qt=>le(qt.key));O&&O.signal.addEventListener("abort",as);let{loaderResults:gs,fetcherResults:pn}=await _n(Ht,Pt,ae,de,We);if(ae.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",as),Pt.forEach(qt=>q.delete(qt.key));let vs=c_(gs);if(vs)return await dt(ae,vs.result,!0,{replace:Lt}),{shortCircuited:!0};if(vs=c_(pn),vs)return Y.add(vs.key),await dt(ae,vs.result,!0,{replace:Lt}),{shortCircuited:!0};let fi=new Map(A.fetchers),{loaderData:Ma,errors:pr}=KH(A,ve,gs,be,Pt,pn,fi);Vt&&A.errors&&(pr={...A.errors,...pr});let rr=ke(fi),ki=Ae(D,fi),ca=rr||ki||Pt.length>0;return{matches:ve,loaderData:Ma,errors:pr,...ca?{workingFetchers:fi}:{}}}function Le(ae){if(ae&&!yo(ae[1]))return{[ae[0]]:ae[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function qe(ae){let de=new Map(A.fetchers);return ae.forEach(ve=>{let ze=de.get(ve.key),We=qx(void 0,ze?ze.data:void 0);de.set(ve.key,We)}),de}async function et(ae,de,ve,ze){le(ae);let We=(ze&&ze.flushSync)===!0,xt=o.activeRoutes,ut=G8(A.location,A.matches,l,ve,de,ze==null?void 0:ze.relative),It=Pl(xt,ut,l,!1,o.branches),ct=Ti(It,xt,ut);if(ct.active&&ct.matches&&(It=ct.matches),!It){fn(ae,de,Qo(404,{pathname:ut}),{flushSync:We});return}let{path:Lt,submission:Vt,error:ce}=UH(!0,ut,ze);if(ce){fn(ae,de,ce,{flushSync:We});return}let be=t.getContext?await t.getContext():new PH,Fe=(ze&&ze.preventScrollReset)===!0;if(Vt&&Qi(Vt.formMethod)){await Ct(ae,de,Lt,It,be,ct.active,We,Fe,Vt,ze&&ze.defaultShouldRevalidate);return}J.set(ae,{routeId:de,path:Lt}),await Ke(ae,de,Lt,It,be,ct.active,We,Fe,Vt)}async function Ct(ae,de,ve,ze,We,xt,ut,It,ct,Lt){Dt(),J.delete(ae);let Vt=A.fetchers.get(ae);nn(ae,F_e(ct,Vt),{flushSync:ut});let ce=new AbortController,be=o0(t.history,ve,ce.signal,ct);if(xt){let xs=await Pa(ze,new URL(be.url).pathname,be.signal,ae);if(xs.type==="aborted")return;if(xs.type==="error"){fn(ae,de,xs.error,{flushSync:ut});return}else if(xs.matches)ze=xs.matches;else{fn(ae,de,Qo(404,{pathname:ve}),{flushSync:ut});return}}let Fe=mC(ze,ve);if(!Fe.route.action&&!Fe.route.lazy){let xs=Qo(405,{method:ct.formMethod,pathname:ve,routeId:de});fn(ae,de,xs,{flushSync:ut});return}q.set(ae,ce);let tt=z,st=H0(i,a,be,ve,ze,Fe,s,We),bt=await Xt(be,ve,st,We,ae),yt=bt[Fe.route.id];if(!yt){for(let xs of st)if(bt[xs.route.id]){yt=bt[xs.route.id];break}}if(be.signal.aborted){q.get(ae)===ce&&q.delete(ae);return}if(Q.has(ae)){if(Fp(yt)||yo(yt)){nn(ae,wc(void 0));return}}else{if(Fp(yt))if(q.delete(ae),D>tt){nn(ae,wc(void 0));return}else return Y.add(ae),nn(ae,qx(ct)),dt(be,yt,!1,{fetcherSubmission:ct,preventScrollReset:It});if(yo(yt)){fn(ae,de,yt.error);return}}let Ht=A.navigation.location||A.location,Pt=o0(t.history,Ht,ce.signal),as=o.activeRoutes,gs=A.navigation.state!=="idle"?Pl(as,A.navigation.location,l,!1,o.branches):A.matches;dn(gs,"Didn't find any matches after fetcher action");let pn=++z;K.set(ae,pn);let{dsMatches:vs,revalidatingFetchers:fi}=BH(Pt,We,i,a,t.history,A,gs,ct,Ht,s,!1,V,B,Q,J,Y,as,l,t.patchRoutesOnNavigation!=null,o.branches,[Fe.route.id,yt],Lt),Ma=qx(ct,yt.data),pr=ne
64w Map(A.fetchers);pr.set(ae,Ma),fi.filter(xs=>xs.key!==ae).forEach(xs=>{let vu=xs.key,da=pr.get(vu),nx=qx(void 0,da?da.data:void 0);pr.set(vu,nx),le(vu),xs.controller&&q.set(vu,xs.controller)}),me({fetchers:pr});let rr=()=>fi.forEach(xs=>le(xs.key));ce.signal.addEventListener("abort",rr);let{loaderResults:ki,fetcherResults:ca}=await _n(vs,fi,Pt,Ht,We);if(ce.signal.aborted)return;ce.signal.removeEventListener("abort",rr),K.delete(ae),q.delete(ae),fi.forEach(xs=>q.delete(xs.key));let qt=A.fetchers.has(ae),qn=xs=>{if(!qt)return xs;let vu=new Map(xs.fetchers);return vu.set(ae,wc(yt.data)),{...xs,fetchers:vu}},ni=c_(ki);if(ni)return A=qn(A),dt(Pt,ni.result,!1,{preventScrollReset:It});if(ni=c_(ca),ni)return Y.add(ni.key),A=qn(A),dt(Pt,ni.result,!1,{preventScrollReset:It});let ua=new Map(A.fetchers);qt&&ua.set(ae,wc(yt.data));let{loaderData:rg,errors:ig}=KH(A,gs,ki,void 0,fi,ca,ua);Ae(pn,ua),A.navigation.state==="loading"&&pn>D?(dn(L,"Expected pending action"),O&&O.abort(),Ce(A.navigation.location,{matches:gs,loaderData:rg,errors:ig,fetchers:ua})):(me({errors:ig,loaderData:YH(A.loaderData,rg,gs,ig),fetchers:ua}),V=!1)}async function Ke(ae,de,ve,ze,We,xt,ut,It,ct){let Lt=A.fetchers.get(ae);nn(ae,qx(ct,Lt?Lt.data:void 0),{flushSync:ut});let Vt=new AbortController,ce=o0(t.history,ve,Vt.signal);if(xt){let yt=await Pa(ze,new URL(ce.url).pathname,ce.signal,ae);if(yt.type==="aborted")return;if(yt.type==="error"){fn(ae,de,yt.error,{flushSync:ut});return}else if(yt.matches)ze=yt.matches;else{fn(ae,de,Qo(404,{pathname:ve}),{flushSync:ut});return}}let be=mC(ze,ve);q.set(ae,Vt);let Fe=z,tt=H0(i,a,ce,ve,ze,be,s,We),st=await Xt(ce,ve,tt,We,ae),bt=st[be.route.id];if(!bt){for(let yt of ze)if(st[yt.route.id]){bt=st[yt.route.id];break}}if(q.get(ae)===Vt&&q.delete(ae),!ce.signal.aborted){if(Q.has(ae)){nn(ae,wc(void 0));return}if(Fp(bt))if(D>Fe){nn(ae,wc(void 0));return}else{Y.add(ae),await dt(ce,bt,!1,{preventScrollReset:It});return}if(yo(bt)){fn(ae,de,bt.error);return}nn(ae,wc(bt.data))}}async function dt(ae,de,ve,{submission:ze,fetcherSubmission:We,preventScrollReset:xt,replace:ut}={}){ve||(j==null||j.resolve(),j=null),de.response.headers.has("X-Remix-Revalidate")&&(V=!0);let It=de.response.headers.get("Location");dn(It,"Expected a Location header on the redirect Response"),It=WH(It,new URL(ae.url),l,t.history);let ct=Lb(A.location,It,{_isRedirect:!0});if(n){let tt=!1;if(de.response.headers.has("X-Remix-Reload-Document"))tt=!0;else if(k9(It)){const st=Pre(e,It,!0);tt=st.origin!==e.location.origin||hl(st.pathname,l)==null}if(tt){ut?e.location.replace(It):e.location.assign(It);return}}O=null;let Lt=ut===!0||de.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Vt,formAction:ce,formEncType:be}=A.navigation;!ze&&!We&&Vt&&ce&&be&&(ze=QH(A.navigation));let Fe=ze||We;if(f_e.has(de.response.status)&&Fe&&Qi(Fe.formMethod))await De(Lt,ct,{submission:{...Fe,formAction:It},preventScrollReset:xt||F,enableViewTransition:ve?M:void 0});else{let tt=aN(ct,[],Lt,ze);await De(Lt,ct,{overrideNavigation:tt,fetcherSubmission:We,preventScrollReset:xt||F,enableViewTransition:ve?M:void 0})}}async function Xt(ae,de,ve,ze,We){var It;let xt,ut={};try{xt=await __e(u,ae,de,ve,We,ze,!1)}catch(ct){return ve.filter(Lt=>Lt.shouldLoad).forEach(Lt=>{ut[Lt.route.id]={type:"error",error:ct}}),ut}if(ae.signal.aborted)return ut;if(!Qi(ae.method))for(let ct of ve){if(((It=xt[ct.route.id])==null?void 0:It.type)==="error")break;!xt.hasOwnProperty(ct.route.id)&&!A.loaderData.hasOwnProperty(ct.route.id)&&(!A.errors||!A.errors.hasOwnProperty(ct.route.id))&&ct.shouldCallHandler()&&(xt[ct.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ct.route.id}`)})}for(let[ct,Lt]of Object.entries(xt))if(P_e(Lt)){let Vt=Lt.result;ut[ct]={type:"redirect",response:k_e(Vt,ae,ct,ve,l)}}else ut[ct]=await T_e(Lt);return ut}async function _n(ae,de,ve,ze,We){let xt=Xt(ve,ze,ae,We,null),ut=Promise.all(de.map(async Lt=>{if(Lt.matches&&Lt.match&&Lt.request&&Lt.controller){let ce=(await Xt(Lt.request,Lt.path,Lt.matches,We,Lt.key))[Lt.match.route.id];return{[Lt.key]:ce}}else return Promise.resolve({[Lt.key]:{type:"error",error:Qo(404,{pathname:Lt.path})}})})),It=await xt,ct=(await ut).reduce((Lt,Vt)=>Object.assign(Lt,Vt),{});return{loaderResults:It,fetcherResults:ct}}function Dt(){V=!0,J.forEach((ae,de)=>{q.has(de)&&B.add(de),le(de)})}function nn(ae,de,ve={}){let ze=new Map(A.fetchers);ze.set(ae,de),me({fetchers:ze},{flushSync:(ve&&ve.flushSync)===!0})}function fn(ae,de,ve,ze={}){let We=Wf(A.matches,de),xt=new Map(A.fetchers);Z(xt,ae),me({errors:{[We.route.id]:ve},fetchers:xt},{flushSync:(ze&&ze.flushSync)===!0})}function Tt(ae){return ne.set(ae,(ne.get(ae)||0)+1),Q.has(ae)&&Q.delete(ae),A.fetchers.get(ae)||h_e}function Ie(ae,de){le(ae,de==null?void 0:de.reason),nn(ae,wc(null))}function Z(ae,de){let ve=A.fetchers.get(de);q.has(de)&&!(ve&&ve.state==="loading"&&K.has(de))&&le(de),J.delete(de),K.delete(
64de),Y.delete(de),Q.delete(de),B.delete(de),ae.delete(de)}function ie(ae){let de=(ne.get(ae)||0)-1;de<=0?(ne.delete(ae),Q.add(ae)):ne.set(ae,de),me({fetchers:new Map(A.fetchers)})}function le(ae,de){let ve=q.get(ae);ve&&(ve.abort(de),q.delete(ae))}function Ee(ae,de){for(let ve of ae){let ze=de.get(ve);dn(ze,`Expected fetcher: ${ve}`);let We=wc(ze.data);de.set(ve,We)}}function ke(ae){let de=[],ve=!1;for(let ze of Y){let We=ae.get(ze);dn(We,`Expected fetcher: ${ze}`),We.state==="loading"&&(Y.delete(ze),de.push(ze),ve=!0)}return Ee(de,ae),ve}function Ae(ae,de){let ve=[];for(let[ze,We]of K)if(We<ae){let xt=de.get(ze);dn(xt,`Expected fetcher: ${ze}`),xt.state==="loading"&&(le(ze),K.delete(ze),ve.push(ze))}return Ee(ve,de),ve.length>0}function Ye(ae,de){let ve=A.blockers.get(ae)||Wx;return ee.get(ae)!==de&&ee.set(ae,de),ve}function Qe(ae){A.blockers.delete(ae),ee.delete(ae)}function ft(ae,de){let ve=A.blockers.get(ae)||Wx;dn(ve.state==="unblocked"&&de.state==="blocked"||ve.state==="blocked"&&de.state==="blocked"||ve.state==="blocked"&&de.state==="proceeding"||ve.state==="blocked"&&de.state==="unblocked"||ve.state==="proceeding"&&de.state==="unblocked",`Invalid blocker state transition: ${ve.state} -> ${de.state}`);let ze=new Map(A.blockers);ze.set(ae,de),me({blockers:ze})}function Me({currentLocation:ae,nextLocation:de,historyAction:ve}
64){if(ee.size===0)return;ee.size>1&&Nr(!1,"A router only supports one blocker at a time");let ze=Array.from(ee.entries()),[We,xt]=ze[ze.length-1],ut=A.blockers.get(We);if(!(ut&&ut.state==="proceeding")&&xt({currentLocation:ae,nextLocation:de,historyAction:ve}))return We}function Ut(ae){let de=Qo(404,{pathname:ae}),ve=o.activeRoutes,{matches:ze,route:We}=l_(ve);return{notFoundMatches:ze,route:We,error:de}}function Nn(ae,de,ve){if(v=ae,y=de,x=ve||null,!S&&A.navigation===iN){S=!0;let ze=gu(A.location,A.matches);ze!=null&&me({restoreScrollPosition:ze})}return()=>{v=null,y=null,x=null}}function Cs(ae,de){return x&&x(ae,de.map(ze=>Uwe(ze,A.loaderData)))||ae.key}function $o(ae,de){if(v&&y){let ve=Cs(ae,de);v[ve]=y()}}function gu(ae,de){if(v){let ve=Cs(ae,de),ze=v[ve];if(typeof ze=="number")return ze}return null}function Ti(ae,de,ve){if(t.patchRoutesOnNavigation){let ze=o.branches;if(ae){if(Object.keys(ae[0].params).length>0)return{active:!0,matches:Pl(de,ve,l,!0,ze)}}else return{active:!0,matches:Pl(de,ve,l,!0,ze)||[]}}return{active:!1,matches:null}}async function Pa(ae,de,ve,ze){if(!t.patchRoutesOnNavigation)return{type:"success",matches:ae};let We=ae;for(;;){let xt=a;try{await t.patchRoutesOnNavigation({signal:ve,path:de,matches:We,fetcherKey:ze,patch:(Lt,Vt)=>{ve.aborted||zH(Lt,Vt,o,xt,i,!1)}})}catch(Lt){return{type:"error",error:Lt,partialMatches:We}}if(ve.aborted)return{type:"aborted"};let ut=o.branches,It=Pl(o.activeRoutes,de,l,!1,ut),ct=null;if(It){if(Object.keys(It[0].params).length===0)return{type:"success",matches:It};if(ct=Pl(o.activeRoutes,de,l,!0,ut),!(ct&&We.length<ct.length&&bl(We,ct.slice(0,We.length))))return{type:"success",matches:It}}if(ct||(ct=Pl(o.activeRoutes,de,l,!0,ut)),!ct||bl(We,ct))return{type:"success",matches:null};We=ct}}function bl(ae,de){return ae.length===de.length&&ae.every((ve,ze)=>ve.route.id===de[ze].route.id)}function Dr(ae){a={},o.setHmrRoutes(jb(ae,i,void 0,a))}function Zh(ae,de,ve=!1){zH(ae,de,o,a,i,ve),o.hasHMRRoutes||me({})}return I={get basename(){return l},get future(){return d},get state(){return A},get routes(){return o.stableRoutes},get branches(){return o.branches},get manifest(){return a},get window(){return e},initialize:ye,subscribe:Re,enableScrollRestoration:Nn,navigate:Xe,fetch:et,revalidate:he,createHref:ae=>t.history.createHref(ae),encodeLocation:ae=>t.history.encodeLocation(ae),getFetcher:Tt,resetFetcher:Ie,deleteFetcher:ie,dispose:je,getBlocker:Ye,deleteBlocker:Qe,patchRoutes:Zh,_internalFetchControllers:q,_internalSetRoutes:Dr,_internalSetStateDoNotUseOrYouWillBreakYourApp(ae){me(ae)}},t.instrumentations&&(I=r_e(I,t.instrumentations.map(ae=>ae.router).filter(Boolean))),I}function v_e(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function G8(t,e,n,s,r,i){let a,o;if(r){a=[];for(let u of e)if(a.push(u),u.route.id===r){o=u;break}}else a=e,o=e[e.length-1];let l=Z2(s||".",P5(a),hl(t.pathname,n)||t.pathname,i==="path");if(s==null&&(l.search=t.search,l.hash=t.hash),(s==null||s===""||s===".")&&o){let u=I9(l.search);if(o.route.index&&!u)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&u){let d=new URLSearchParams(l.search),f=d.getAll("index");d.delete("index"),f.filter(m=>m).forEach(m=>d.append("index",m));let p=d.toString();l.search=p?`?${p}`:""}}return n!=="/"&&(l.pathname=Xwe({basename:n,pathname:l.pathname})),Jc(l)}function UH(t,e,n){if(!n||!v_e(n))return{path:e};if(n.formMethod&&!O_e(n.formMethod))return{path:e,error:Qo(405,{method:n.formMethod})};let s=()=>({path:e,error:Qo(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),a=tie(e);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Qi(i))return s();let f=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((p,[m,v])=>`${p}${m}=${v}
65`,""):String(n.body);return{path:e,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:f}}}else if(n.formEncType==="application/json"){if(!Qi(i))return s();
65try{let f=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:f,text:void 0}}}catch{return s()}}}dn(typeof FormData=="function","FormData is not available in this environment");let o,l;if(n.formData)o=K8(n.formData),l=n.formData;else if(n.body instanceof FormData)o=K8(n.body),l=n.body;else if(n.body instanceof URLSearchParams)o=n.body,l=qH(o);else if(n.body==null)o=new URLSearchParams,l=new FormData;else try{o=new URLSearchParams(n.body),l=qH(o)}catch{return s()}let u={formMethod:i,formAction:a,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Qi(u.formMethod))return{path:e,submission:u};let d=du(e);return t&&d.search&&I9(d.search)&&o.append("index",""),d.search=`?${o}`,{path:Jc(d),submission:u}}function BH(t,e,n,s,r,i,a,o,l,u,d,f,p,m,v,x,y,S,_,E,T,k){var $;let R=T?yo(T[1])?T[1].error:T[1].data:void 0,I=r.createURL(i.location),A=r.createURL(l),L;if(d&&i.errors){let V=Object.keys(i.errors)[0];L=a.findIndex(B=>B.route.id===V)}else if(T&&yo(T[1])){let V=T[0];L=a.findIndex(B=>B.route.id===V)-1}let j=T?T[1].statusCode:void 0,F=j&&j>=400,O={currentUrl:I,currentParams:(($=i.matches[0])==null?void 0:$.params)||{},nextUrl:A,nextParams:a[0].params,...o,actionResult:R,actionStatus:j},M=Q2(a),U=a.map((V,B)=>{let{route:q}=V,z=null;if(L!=null&&B>L)z=!1;else if(q.lazy)z=!0;else if(!A9(q))z=!1;else if(d){let{shouldLoad:J}=Kre(q,i.loaderData,i.errors);z=J}else x_e(i.loaderData,i.matches[B],V)&&(z=!0);if(z!==null)return W8(n,s,t,l,M,V,u,e,z);let D=!1;typeof k=="boolean"?D=k:F?D=!1:(f||I.pathname+I.search===A.pathname+A.search||I.search!==A.search||y_e(i.matches[B],V))&&(D=!0);let K={...O,defaultShouldRevalidate:D},Y=qy(V,K);return W8(n,s,t,l,M,V,u,e,Y,K,k)}),G=[];return v.forEach((V,B)=>{if(d||!a.some(Q=>Q.route.id===V.routeId)||m.has(B))return;let q=i.fetchers.get(B),z=q&&q.state!=="idle"&&q.data===void 0,D=Pl(y,V.path,S??"/",!1,E);if(!D){if(_&&z)return;G.push({key:B,routeId:V.routeId,path:V.path,matches:null,match:null,request:null,controller:null});return}if(x.has(B))return;let K=mC(D,V.path),Y=new AbortController,J=o0(r,V.path,Y.signal),ne=null;if(p.has(B))p.delete(B),ne=H0(n,s,J,V.path,D,K,u,e);else if(z)f&&(ne=H0(n,s,J,V.path,D,K,u,e));else{let Q;typeof k=="boolean"?Q=k:F?Q=!1:Q=f;let ee={...O,defaultShouldRevalidate:Q};qy(K,ee)&&(ne=H0(n,s,J,V.path,D,K,u,e,ee))}ne&&G.push({key:B,routeId:V.routeId,path:V.path,matches:ne,match:K,request:J,controller:Y})}),{dsMatches:U,revalidatingFetchers:G}}function A9(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function Kre(t,e,n){if(t.lazy)return{shouldLoad:!0,renderFallback:!0};if(!A9(t))return{shouldLoad:!1,renderFallback:!1};let s=e!=null&&t.id in e,r=n!=null&&n[t.id]!==void 0;if(!s&&r)return{shouldLoad:!1,renderFallback:!1};if(typeof t.loader=="function"&&t.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let i=!s&&!r;return{shouldLoad:i,renderFallback:i}}function x_e(t,e,n){let s=!e||n.route.id!==e.route.id,r=!t.hasOwnProperty(n.route.id);return s||r}function y_e(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function qy(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function zH(t,e,n,s,r,i){let a;if(t){let u=s[t];dn(u,`No route found to patch children into: routeId = ${t}`),u.children||(u.children=[]),a=u.children}else a=n.activeRoutes;let o=[],l=[];if(e.forEach(u=>{let d=a.find(f=>Yre(u,f));d?l.push({existingRoute:d,newRoute:u}):o.push(u)}),o.length>0){let u=jb(o,r,[t||"_","patch",String((a==null?void 0:a.length)||"0")],s);a.push(...u)}if(i&&l.length>0)for(let u=0;u<l.length;u++){let{existingRoute:d,newRoute:f}=l[u],p=d,[m]=jb([f],r,[],{},!0);Object.assign(p,{element:m.element?m.element:p.element,errorElement:m.errorElement?m.errorElement:p.errorElement,hydrateFallbackElement:m.hydrateFallbackElement?m.hydrateFallbackElement:p.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function Yre(t,e){var n;return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:((n=t.children)==null?void 0:n.every((s,r)=>{var i;return(i=e.children)==null?void 0:i.some(a=>Yre(s,a))}))??!1:!1}var VH=new WeakMap,Zre=({key:t,route:e,manifest:n,mapRouteProperties:s})=>{let r=n[e.id];if(dn(r,"No route found in manifest"),!r.lazy||typeof r.lazy!="object")return;let i=r.lazy[t];if(!i)return;let a=VH.get(r);a||(a={},VH.set(r,a));let o=a[t];if(o)return o;let l=(async()=>{let u=Dwe(t),f=r[t]!==void 0&&t!=="hasErrorBoundary";if(u)Nr(!u,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),a[t]=Promise.resolve();else if(f)Nr(!1,`Route "${r.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let p=await i();p!=null&&(Object.assign(r,{[t]:p}),Object.assign(r,s(r)))}typeof r.lazy=="object"&&(r.lazy[t]=void 0,Object.values(r.lazy).every(p=>p===void 0)&&(r.lazy=void 0))})();return a[t]=l,l},HH=new WeakMap;function b_e(t,e,n,s,r){let i=n[t.id];if(dn(i,"No route found in manifest"),!t.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof t.lazy=="function"){let d=HH.get(i);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let f=(async()=>{dn(typeof t.lazy=="function","No lazy route function found");let p=await t.lazy(),m={};for(let v in p){let x=p[v];if(x===void 0)continue;let y=$we(v),_=i[v]!==void 0&&v!=="hasErrorBoundary";y?Nr(!y,"Route property "+v+" is not a supported property to be returned from a lazy route function. This property will be ignored."):_?Nr(!_,`Route "${i.id}" has a static property "${v}" defined but its lazy function is also returning a value for this property. The lazy route property "${v}" will be ignored.`):m[v]=x}Object.assign(i,m),Object.assign(i,{...s(i),lazy:void 0})})();return HH.set(i,f),f.catch(()=>{}),{lazyRoutePromise:f,lazyHandlerPromise:f}}let a=Object.keys(t.lazy),o=[],l;for(let d of a){if(r&&r.includes(d))continue;let f=Zre({key:d,route:t,manifest:n,mapRouteProperties:s});f&&(o.push(f),d===e&&(l=f))}let u=o.length>0?Promise.all(o).then(()=>{}):void 0;return u==null||u.catch(()=>{}),l==null||l.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:l}}async function GH(t){let e=t.matches.filter(r=>r.shouldLoad),n={};return(await Promise.all(e.map(r=>
65r.resolve()))).forEach((r,i)=>{n[e[i].route.id]=r}),n}async function S_e(t){return t.matches.some(e=>e.route.middleware)?Xre(t,()=>GH(t)):GH(t)}function Xre(t,e){return w_e(t,e,s=>{if(D_e(s))throw s;return s},L_e,n);function n(s,r,i){if(i)return Promise.resolve(Object.assign(i.value,{[r]:{type:"error",result:s}}));{let{matches:a}=t,o=Math.min(Math.max(a.findIndex(u=>u.route.id===r),0),Math.max(a.findIndex(u=>u.shouldCallHandler()),0)),l=Wf(a,a[o].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:s}})}}}async function w_e(t,e,n,s,r){let{matches:i,...a}=t,o=i.flatMap(u=>u.route.middleware?u.route.middleware.map(d=>[u.route.id,d]):[]);return await Qre(a,o,e,n,s,r)}async function Qre(t,e,n,s,r,i,a=0){let{request:o}=t;if(o.signal.aborted)throw o.signal.reason??new Error(`Request aborted: ${o.method} ${o.url}`);let l=e[a];if(!l)return await n();let[u,d]=l,f,p=async()=>{if(f)throw new Error("You may only call `next()` once per middleware");try{return f={value:await Qre(t,e,n,s,r,i,a+1)},f.value}catch(m){return f={value:await i(m,u,f)},f.value}};try{let m=await d(t,p),v=m!=null?s(m):void 0;return r(v)?v:f?v??f.value:(f={value:await p()},f.value)}catch(m){return await i(m,u,f)}}function Jre(t,e,n,s,r){let i=Zre({key:"middleware",route:s.route,manifest:e,mapRouteProperties:t}),a=b_e(s.route,Qi(n.method)?"action":"loader",e,t,r);return{middleware:i,route:a.lazyRoutePromise,handler:a.lazyHandlerPromise}}function W8(t,e,n,s,r,i,a,o,l,u=null,d){let f=!1,p=Jre(t,e,n,i,a);return{...i,_lazyPromises:p,shouldLoad:l,shouldRevalidateArgs:u,shouldCallHandler(m){return f=!0,u?typeof d=="boolean"?qy(i,{...u,defaultShouldRevalidate:d}):typeof m=="boolean"?qy(i,{...u,defaultShouldRevalidate:m}):qy(i,u):l},resolve(m){let{lazy:v,loader:x,middleware:y}=i.route,S=f||l||m&&!Qi(n.method)&&(v||x),_=y&&y.length>0&&!x&&!v;return S&&(Qi(n.method)||!_)?E_e({request:n,path:s,pattern:r,match:i,lazyHandlerPromise:p==null?void 0:p.handler,lazyRoutePromise:p==null?void 0:p.route,handlerOverride:m,scopedContext:o}):Promise.resolve({type:"data",result:void 0})}}}function H0(t,e,n,s,r,i,a,o,l=null){return r.map(u=>u.route.id!==i.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:Jre(t,e,n,u,a),resolve:()=>Promise.resolve({type:"data",result:void 0})}:W8(t,e,n,s,Q2(r),u,a,o,!0,l))}async function __e(t,e,n,s,r,i,a){s.some(d=>{var f;return(f=d._lazyPromises)==null?void 0:f.middleware})&&await Promise.all(s.map(d=>{var f;return(f=d._lazyPromises)==null?void 0:f.middleware}));let o={request:e,url:eie(e,n),pattern:Q2(s),params:s[0].params,context:i,matches:s},u=await t({...o,fetcherKey:r,runClientMiddleware:d=>{let f=o;return Xre(f,()=>d({...f,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(d=>{var f,p;return[(f=d._lazyPromises)==null?void 0:f.handler,(p=d._lazyPromises)==null?void 0:p.route]}))}catch{}return u}async function E_e({request:t,path:e,pattern:n,match:s,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:a,scopedContext:o}){let l,u,d=Qi(t.method),f=d?"action":"loader",p=m=>{let v,x=new Promise((_,E)=>v=E);u=()=>v(),t.signal.addEventListener("abort",u);let y=_=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${f}" [routeId: ${s.route.id}]`)):m({request:t,url:eie(t,e),pattern:n,params:s.params,context:o},..._!==void 0?[_]:[]),S=(async()=>{try{return{type:"data",result:await(a?a(E=>y(E)):y())}}catch(_){return{type:"error",result:_}}})();return Promise.race([S,x])};try{let m=d?s.route.action:s.route.loader;if(r||i)if(m){let v,[x]=await Promise.all([p(m).catch(y=>{v=y}),r,i]);if(v!==void 0)throw v;l=x}else{await r;let v=d?s.route.action:s.route.loader;if(v)[l]=await Promise.all([p(v),i]);else if(f==="action"){let x=new URL(t.url),y=x.pathname+x.search;throw Qo(405,{method:t.method,pathname:y,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(m)l=await p(m);else{let v=new URL(t.url),x=v.pathname+v.search;throw Qo(404,{pathname:x})}}catch(m){return{type:"error",result:m}}finally{u&&t.signal.removeEventListener("abort",u)}return l}async function C_e(t){let e=t.headers.get("Content-Type");return e&&/\bapplication\/json\b/.test(e)?t.body==null?null:t.json():t.text()}async function T_e(t){var s,r,i,a,o;let{result:e,type:n}=t;if(N9(e)){let l;try{l=await C_e(e)}catch(u){return{type:"error",error:u}}return n==="error"?{type:"error",error:new X2(e.status,e.statusText,l),statusCode:e.status,headers:e.headers}:{type:"data",data:l,statusCode:e.status,headers:e.headers}}return n==="error"?XH(e)?e.data instanceof Error?{type:"error",error:e.data,statusCode:(s=e.init)==null?void 0:s.status,headers:(r=e.init)!=null&&r.headers?new Headers(e.init.headers):void 0}:{type:"error",error:I_e(e),statusCode:Mb(e)?e.status:void 0,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}:{type:"error",error:e,statusCode:Mb(e)?e.status:void 0}:XH(e)?{type:"data",data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(o=e.init)!=null&&o.headers?new Headers(e.init.headers):void 0}:{type:"data",data:e}}function k_e(t,e,n,s,r){let i=t.headers.get("Location");if(dn(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!k9(i)){let a=s.slice(0,s.findIndex(o=>o.route.id===n)+1);i=G8(new URL(e.url),a,r,i),t.headers.set("Location",i)}return t}var R_e=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function q8(t){try{return R_e.includes(new URL(t).protocol)}catch{return!1}}function WH(t,e,n,s){if(k9(t)){let r=t,i=C9.test(r)?new URL(jre(r,e.protocol)):new URL(r);if(q8(i.toString()))throw new Error("Invalid redirect location");let a=hl(i.pathname,n)!=null;if(i.origin===e.origin&&a)return R9(i.pathname)+i.search+i.hash}try{let r=s.createURL(t);
65if(q8(r.toString()))throw new Error("Invalid redirect location")}catch{}return t}function o0(t,e,n,s){let r=t.createURL(tie(e)).toString(),i={signal:n};if(s&&Qi(s.formMethod)){let{formMethod:a,formEncType:o}=s;i.method=a.toUpperCase(),o==="application/json"?(i.headers=new Headers({"Content-Type":o}),i.body=JSON.stringify(s.json)):o==="text/plain"?i.body=s.text:o==="application/x-www-form-urlencoded"&&s.formData?i.body=K8(s.formData):i.body=s.formData}return new Request(r,i)}function eie(t,e){let n=new URL(t.url),s=typeof e=="string"?du(e):e;if(n.pathname=s.pathname||"/",s.search){let r=new URLSearchParams(s.search),i=r.getAll("index");r.delete("index");for(let a of i.filter(Boolean))r.append("index",a);n.search=r.size?`?${r.toString()}`:""}else n.search="";return n.hash=s.hash||"",n}function K8(t){let e=new URLSearchParams;for(let[n,s]of t.entries())e.append(n,typeof s=="string"?s:s.name);return e}function qH(t){let e=new FormData;for(let[n,s]of t.entries())e.append(n,s);return e}function A_e(t,e,n,s=!1,r=!1){let i={},a=null,o,l=!1,u={},d=n&&yo(n[1])?n[1].error:void 0;return t.forEach(f=>{if(!(f.route.id in e))return;let p=f.route.id,m=e[p];if(dn(!Fp(m),"Cannot handle redirect results in processLoaderData"),yo(m)){let v=m.error;if(d!==void 0&&(v=d,d=void 0),a=a||{},r)a[p]=v;else{let x=Wf(t,p);a[x.route.id]==null&&(a[x.route.id]=v)}s||(i[p]=qre),l||(l=!0,o=Mb(m.error)?m.error.status:500),m.headers&&(u[p]=m.headers)}else i[p]=m.data,m.statusCode&&m.statusCode!==200&&!l&&(o=m.statusCode),m.headers&&(u[p]=m.headers)}),d!==void 0&&n&&(a={[n[0]]:d},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:a,statusCode:o||200,loaderHeaders:u}}function KH(t,e,n,s,r,i,a){let{loaderData:o,errors:l}=A_e(e,n,s);return r.filter(u=>!u.matches||u.matches.some(d=>d.shouldLoad)).forEach(u=>{let{key:d,match:f,controller:p}=u;if(p&&p.signal.aborted)return;let m=i[d];if(dn(m,"Did not find corresponding fetcher result"),yo(m)){let v=Wf(t.matches,f==null?void 0:f.route.id);l&&l[v.route.id]||(l={...l,[v.route.id]:m.error}),a.delete(d)}else if(Fp(m))dn(!1,"Unhandled fetcher revalidation redirect");else{let v=wc(m.data);a.set(d,v)}}),{loaderData:o,errors:l}}function YH(t,e,n,s){let r=Object.entries(e).filter(([,i])=>i!==qre).reduce((i,[a,o])=>(i[a]=o,i),{});for(let i of n){let a=i.route.id;if(!e.hasOwnProperty(a)&&t.hasOwnProperty(a)&&i.route.loader&&(r[a]=t[a]),s&&s.hasOwnProperty(a))break}return r}function ZH(t){return t?yo(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Wf(t,e){return(e?t.slice(0,t.findIndex(s=>s.route.id===e)+1):[...t]).reverse().find(s=>s.route.hasErrorBoundary===!0)||t[0]}function l_(t){let e=t.length===1?t[0]:t.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Qo(t,{pathname:e,routeId:n,method:s,type:r,message:i}={}){let a="Unknown Server Error",o="Unknown @remix-run/router error";return t===400?(a="Bad Request",s&&e&&n?o=`You made a ${s} request to "${e}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:r==="invalid-body"&&(o="Unable to encode submission body")):t===403?(a="Forbidden",o=`Route "${n}" does not match URL "${e}"`):t===404?(a="Not Found",o=`No route matches URL "${e}"`):t===405&&(a="Method Not Allowed",s&&e&&n?o=`You made a ${s.toUpperCase()} request to "${e}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:s&&(o=`Invalid request method "${s.toUpperCase()}"`)),new X2(t||500,a,new Error(o),!0)}function c_(t){let e=Object.entries(t);for(let n=e.length-1;n>=0;n--){let[s,r]=e[n];if(Fp(r))return{key:s,result:r}}}function tie(t){let e=typeof t=="string"?du(t):t;return Jc({...e,hash:""})}function N_e(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function I_e(t){var e,n;return new X2(((e=t.init)==null?void 0:e.status)??500,((n=t.init)==null?void 0:n.statusText)??"Internal Server Error",t.data)}function L_e(t){return t!=null&&typeof t=="object"&&Object.entries(t).every(([e,n])=>typeof e=="string"&&j_e(n))}function j_e(t){return t!=null&&typeof t=="object"&&"type"in t&&"result"in t&&(t.type==="data"||t.type==="error")}function P_e(t){return N9(t.result)&&Gre.has(t.result.status)}function yo(t){return t.type==="error"}function Fp(t){return(t&&t.type)==="redirect"}function XH(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function N9(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function M_e(t){return Gre.has(t)}function D_e(t){return N9(t)&&M_e(t.status)&&t.headers.has("Location")}function O_e(t){return d_e.has(t.toUpperCase())}function Qi(t){return c_e.has(t.toUpperCase())}function I9(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function mC(t,e){let n=typeof e=="string"?du(e).search:e.search;if(t[t.length-1].route.index&&I9(n||""))return t[t.length-1];let s=Ure(t);return s[s.length-1]}function QH(t){let{formMethod:e,formAction:n,formEncType:s,text:r,formData:i,json:a}=t;
65if(!(!e||!n||!s)){if(r!=null)return{formMethod:e,formAction:n,formEncType:s,formData:void 0,json:void 0,text:r};if(i!=null)return{formMethod:e,formAction:n,formEncType:s,formData:i,json:void 0,text:void 0};if(a!==void 0)return{formMethod:e,formAction:n,formEncType:s,formData:void 0,json:a,text:void 0}}}function aN(t,e,n,s){return s?{state:"loading",location:t,matches:e,historyAction:n,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:t,matches:e,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function $_e(t,e,n,s){return{state:"submitting",location:t,matches:e,historyAction:n,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function qx(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function F_e(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function wc(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function U_e(t,e){try{let n=t.sessionStorage.getItem(Wre);if(n){let s=JSON.parse(n);for(let[r,i]of Object.entries(s||{}))i&&Array.isArray(i)&&e.set(r,new Set(i||[]))}}catch{}}function B_e(t,e){if(e.size>0){let n={};for(let[s,r]of e)n[s]=[...r];try{t.sessionStorage.setItem(Wre,JSON.stringify(n))}catch(s){Nr(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function JH(){let t,e,n=new Promise((s,r)=>{t=async i=>{s(i);try{await n}catch{}},e=async i=>{r(i);try{await n}catch{}}});return{promise:n,resolve:t,reject:e}}var Gm=w.createContext(null);Gm.displayName="DataRouter";var J2=w.createContext(null);J2.displayName="DataRouterState";var nie=w.createContext(!1);function sie(){return w.useContext(nie)}var L9=w.createContext({isTransitioning:!1});L9.displayName="ViewTransition";var rie=w.createContext(new Map);rie.displayName="Fetchers";var z_e=w.createContext(null);z_e.displayName="Await";var jo=w.createContext(null);jo.displayName="Navigation";var eS=w.createContext(null);eS.displayName="Location";var vl=w.createContext({outlet:null,matches:[],isDataRoute:!1});vl.displayName="Route";var j9=w.createContext(null);j9.displayName="RouteError";var iie="REACT_ROUTER_ERROR",V_e="REDIRECT",H_e="ROUTE_ERROR_RESPONSE";function G_e(t){if(t.startsWith(`${iie}:${V_e}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function W_e(t){if(t.startsWith(`${iie}:${H_e}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new X2(e.status,e.statusText,e.data)}catch{}}function q_e(t,{relative:e}={}){dn(Wm(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=w.useContext(jo),{hash:r,pathname:i,search:a}=tS(t,{relative:e}),o=i;return n!=="/"&&(o=i==="/"?n:ll([n,i])),s.createHref({pathname:o,search:a,hash:r})}function Wm(){return w.useContext(eS)!=null}function Gs(){return dn(Wm(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(eS).location}function K_e(){return w.useContext(eS).navigationType}function j1t(t){dn(Wm(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:e}=Gs();return w.useMemo(()=>Pb(t,Fre(e)),[e,t])}var aie="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function oie(t){w.useContext(jo).static||w.useLayoutEffect(t)}function di(){let{isDataRoute:t}=w.useContext(vl);return t?lEe():Y_e()}function Y_e(){dn(Wm(),"useNavigate() may be used only in the context of a <Router> component.");
65let t=w.useContext(Gm),{basename:e,navigator:n}=w.useContext(jo),{matches:s}=w.useContext(vl),{pathname:r}=Gs(),i=JSON.stringify(P5(s)),a=w.useRef(!1);return oie(()=>{a.current=!0}),w.useCallback((l,u={})=>{if(Nr(a.current,aie),!a.current)return;if(typeof l=="number"){n.go(l);return}let d=Z2(l,JSON.parse(i),r,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:ll([e,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[e,n,i,r,t])}var lie=w.createContext(null);function P9(){return w.useContext(lie)}function Z_e(t){let e=w.useContext(vl).outlet;return w.useMemo(()=>e&&w.createElement(lie.Provider,{value:t},e),[e,t])}function M5(){let{matches:t}=w.useContext(vl),e=t[t.length-1];return(e==null?void 0:e.params)??{}}function tS(t,{relative:e}={}){let{matches:n}=w.useContext(vl),{pathname:s}=Gs(),r=JSON.stringify(P5(n));return w.useMemo(()=>Z2(t,JSON.parse(r),s,e==="path"),[t,r,s,e])}function X_e(t,e,n){dn(Wm(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=w.useContext(jo),{matches:r}=w.useContext(vl),i=r[r.length-1],a=i?i.params:{},o=i?i.pathname:"/",l=i?i.pathnameBase:"/",u=i&&i.route;{let y=u&&u.path||"";uie(o,!u||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
66
67Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let d=Gs(),f;f=d;let p=f.pathname||"/",m=p;if(l!=="/"){let y=l.replace(/^\//,"").split("/");m="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let v=n&&n.state.matches.length?n.state.matches.map(y=>Object.assign(y,{route:n.manifest[y.route.id]||y.route})):T9(t,{pathname:m});return Nr(u||v!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Nr(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),nEe(v&&v.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:ll([l,s.encodeLocation?s.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:ll([l,s.encodeLocation?s.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),r,n)}function Q_e(){let t=oEe(),e=Mb(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:i},"ErrorBoundary")," or"," ",w.createElement("code",{style:i},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:r},n):null,a)}var J_e=w.createElement(Q_e,null),cie=class extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=W_e(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(vl.Provider,{value:this.props.routeContext},w.createElement(j9.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(eEe,{error:t},e):e}};cie.contextType=nie;var oN=new WeakMap;function eEe({children:t,error:e}){let{basename:n}=w.useContext(jo);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let s=G_e(e.digest);if(s){let r=oN.get(e);if(r)throw r;
67let i=zre(s.location,n),a=i.absoluteURL||i.to;if(q8(a))throw new Error("Invalid redirect location");if(Bre&&!oN.get(e))if(i.isExternal||s.reloadDocument)window.location.href=a;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw oN.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a}`})}}return t}function tEe({routeContext:t,match:e,children:n}){let s=w.useContext(Gm);return s&&s.static&&s.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(vl.Provider,{value:t},n)}function nEe(t,e=[],n){let s=n==null?void 0:n.state;if(t==null){if(!s)return null;if(s.errors)t=s.matches;else if(e.length===0&&!s.initialized&&s.matches.length>0)t=s.matches;else return null}let r=t,i=s==null?void 0:s.errors;if(i!=null){let d=r.findIndex(f=>f.route.id&&(i==null?void 0:i[f.route.id])!==void 0);dn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),r=r.slice(0,Math.min(r.length,d+1))}let a=!1,o=-1;if(n&&s){a=s.renderFallback;for(let d=0;d<r.length;d++){let f=r[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(o=d),f.route.id){let{loaderData:p,errors:m}=s,v=f.route.loader&&!p.hasOwnProperty(f.route.id)&&(!m||m[f.route.id]===void 0);if(f.route.lazy||v){n.isStatic&&(a=!0),o>=0?r=r.slice(0,o+1):r=[r[0]];break}}}}let l=n==null?void 0:n.onError,u=s&&l?(d,f)=>{var p,m;l(d,{location:s.location,params:((m=(p=s.matches)==null?void 0:p[0])==null?void 0:m.params)??{},pattern:Q2(s.matches),errorInfo:f})}:void 0;return r.reduceRight((d,f,p)=>{let m,v=!1,x=null,y=null;s&&(m=i&&f.route.id?i[f.route.id]:void 0,x=f.route.errorElement||J_e,a&&(o<0&&p===0?(uie("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,y=null):o===p&&(v=!0,y=f.route.hydrateFallbackElement||null)));let S=e.concat(r.slice(0,p+1)),_=()=>{let E;return m?E=x:v?E=y:f.route.Component?E=w.createElement(f.route.Component,null):f.route.element?E=f.route.element:E=d,w.createElement(tEe,{match:f,routeContext:{outlet:d,matches:S,isDataRoute:s!=null},children:E})};return s&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?w.createElement(cie,{location:s.location,revalidation:s.revalidation,component:x,error:m,children:_(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:u}):_()},null)}function M9(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function sEe(t){let e=w.useContext(Gm);return dn(e,M9(t)),e}function rEe(t){let e=w.useContext(J2);return dn(e,M9(t)),e}function iEe(t){let e=w.useContext(vl);return dn(e,M9(t)),e}function D9(t){let e=iEe(t),n=e.matches[e.matches.length-1];return dn(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function aEe(){return D9("useRouteId")}function oEe(){var s;let t=w.useContext(j9),e=rEe("useRouteError"),n=D9("useRouteError");return t!==void 0?t:(s=e.errors)==null?void 0:s[n]}function lEe(){let{router:t}=sEe("useNavigate"),e=D9("useNavigate"),n=w.useRef(!1);return oie(()=>{n.current=!0}),w.useCallback(async(r,i={})=>{Nr(n.current,aie),n.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:e,...i}))},[t,e])}var eG={};function uie(t,e,n){!e&&!eG[t]&&(eG[t]=!0,Nr(!1,n))}var tG={};function nG(t,e){!t&&!tG[e]&&(tG[e]=!0,console.warn(e))}var cEe="useOptimistic",sG=x1[cEe],uEe=()=>{};function dEe(t){return sG?sG(t):[t,uEe]}function fEe(t){let e={hasErrorBoundary:t.hasErrorBoundary||t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&(t.element&&Nr(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(e,{element:w.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement&&Nr(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(e,{hydrateFallbackElement:w.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement&&Nr(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(e,{errorElement:w.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),e}var hEe=["HydrateFallback","hydrateFallbackElement"],pEe=class{constructor(){this.status="pending",this.promise=new Promise((t,e)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",e(n))}})}};function mEe({router:t,flushSync:e,onError:n,useTransitions:s}){s=sie()||s;let[i,a]=w.useState(t.state),[o,l]=dEe(i),[u,d]=w.useState(),[f,p]=w.useState({isTransitioning:!1}),[m,v]=w.useState(),[x,y]=w.useState(),[S,_]=w.useState(),E=w.useRef(new Map),T=w.useCallback((A,{deletedFetchers:L,newErrors:j,flushSync:F,viewTransitionOpts:O})=>
67{j&&n&&Object.values(j).forEach(U=>{var G;return n(U,{location:A.location,params:((G=A.matches[0])==null?void 0:G.params)??{},pattern:Q2(A.matches)})}),A.fetchers.forEach((U,G)=>{U.data!==void 0&&E.current.set(G,U.data)}),L.forEach(U=>E.current.delete(U)),nG(F===!1||e!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable.  Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let M=t.window!=null&&t.window.document!=null&&typeof t.window.document.startViewTransition=="function";if(nG(O==null||M,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!O||!M){e&&F?e(()=>a(A)):s===!1?a(A):w.startTransition(()=>{s===!0&&l(U=>rG(U,A)),a(A)});return}if(e&&F){e(()=>{x&&(m==null||m.resolve(),x.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let U=t.window.document.startViewTransition(()=>{e(()=>a(A))});U.finished.finally(()=>{e(()=>{v(void 0),y(void 0),d(void 0),p({isTransitioning:!1})})}),e(()=>y(U));return}x?(m==null||m.resolve(),x.skipTransition(),_({state:A,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(d(A),p({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[t.window,e,x,m,s,l,n]);w.useLayoutEffect(()=>t.subscribe(T),[t,T]),w.useEffect(()=>{f.isTransitioning&&!f.flushSync&&v(new pEe)},[f]),w.useEffect(()=>{if(m&&u&&t.window){let A=u,L=m.promise,j=t.window.document.startViewTransition(async()=>{s===!1?a(A):w.startTransition(()=>{s===!0&&l(F=>rG(F,A)),a(A)}),await L});j.finished.finally(()=>{v(void 0),y(void 0),d(void 0),p({isTransitioning:!1})}),y(j)}},[u,m,t.window,s,l]),w.useEffect(()=>{m&&u&&o.location.key===u.location.key&&m.resolve()},[m,x,o.location,u]),w.useEffect(()=>{!f.isTransitioning&&S&&(d(S.state),p({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),_(void 0))},[f.isTransitioning,S]);let k=w.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:A=>t.navigate(A),push:(A,L,j)=>t.navigate(A,{state:L,preventScrollReset:j==null?void 0:j.preventScrollReset}),replace:(A,L,j)=>t.navigate(A,{replace:!0,state:L,preventScrollReset:j==null?void 0:j.preventScrollReset})}),[t]),R=t.basename||"/",I=w.useMemo(()=>({router:t,navigator:k,static:!1,basename:R,onError:n}),[t,k,R,n]);return w.createElement(w.Fragment,null,w.createElement(Gm.Provider,{value:I},w.createElement(J2.Provider,{value:o},w.createElement(rie.Provider,{value:E.current},w.createElement(L9.Provider,{value:f},w.createElement(yEe,{basename:R,location:o.location,navigationType:o.historyAction,navigator:k,useTransitions:s},w.createElement(gEe,{routes:t.routes,manifest:t.manifest,future:t.future,state:o,isStatic:!1,onError:n})))))),null)}function rG(t,e){return{...t,navigation:e.navigation.state!=="idle"?e.navigation:t.navigation,revalidation:e.revalidation!=="idle"?e.revalidation:t.revalidation,actionData:e.navigation.state!=="submitting"?e.actionData:t.actionData,fetchers:e.fetchers}}var gEe=w.memo(vEe);function vEe({routes:t,manifest:e,future:n,state:s,isStatic:r,onError:i}){return X_e(t,void 0,{manifest:e,state:s,isStatic:r,onError:i})}function il({to:t,replace:e,state:n,relative:s}){dn(Wm(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=w.useContext(jo);Nr(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=w.useContext(vl),{pathname:a}=Gs(),o=di(),l=Z2(t,P5(i),a,s==="path"),u=JSON.stringify(l);return w.useEffect(()=>{o(JSON.parse(u),{replace:e,state:n,relative:s})},[o,u,s,e,n]),null}function Jl(t){return Z_e(t.context)}function xEe(t){dn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yEe({basename:t="/",children:e=null,location:n,navigationType:s="POP",navigator:r,static:i=!1,useTransitions:a}){dn(!Wm(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),l=w.useMemo(()=>({basename:o,navigator:r,static:i,useTransitions:a,future:{}}),[o,r,i,a]);typeof n=="string"&&(n=du(n));
67let{pathname:u="/",search:d="",hash:f="",state:p=null,key:m="default",mask:v}=n,x=w.useMemo(()=>{let y=hl(u,o);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:m,mask:v},navigationType:s}},[o,u,d,f,p,m,s,v]);return Nr(x!=null,`<Router basename="${o}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:w.createElement(jo.Provider,{value:l},w.createElement(eS.Provider,{children:e,value:x}))}function Y8(t,e=[]){let n=[];return w.Children.forEach(t,(s,r)=>{if(!w.isValidElement(s))return;let i=[...e,r];if(s.type===w.Fragment){n.push.apply(n,Y8(s.props.children,i));return}dn(s.type===xEe,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),dn(!s.props.index||!s.props.children,"An index route cannot have child routes.");let a={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(a.children=Y8(s.props.children,i)),n.push(a)}),n}var gC="get",vC="application/x-www-form-urlencoded";function D5(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function bEe(t){return D5(t)&&t.tagName.toLowerCase()==="button"}function SEe(t){return D5(t)&&t.tagName.toLowerCase()==="form"}function wEe(t){return D5(t)&&t.tagName.toLowerCase()==="input"}function _Ee(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function EEe(t,e){return t.button===0&&(!e||e==="_self")&&!_Ee(t)}function Z8(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(r=>[n,r]):[[n,s]])},[]))}function CEe(t,e){let n=Z8(t);return e&&e.forEach((s,r)=>{n.has(r)||e.getAll(r).forEach(i=>{n.append(r,i)})}),n}var u_=null;function TEe(){if(u_===null)try{new FormData(document.createElement("form"),0),u_=!1}catch{u_=!0}return u_}var kEe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function lN(t){return t!=null&&!kEe.has(t)?(Nr(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vC}"`),null):t}function REe(t,e){let n,s,r,i,a;if(SEe(t)){let o=t.getAttribute("action");s=o?hl(o,e):null,n=t.getAttribute("method")||gC,r=lN(t.getAttribute("enctype"))||vC,i=new FormData(t)}else if(bEe(t)||wEe(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||o.getAttribute("action");if(s=l?hl(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||gC,r=lN(t.getAttribute("formenctype"))||lN(o.getAttribute("enctype"))||vC,i=new FormData(o,t),!TEe()){let{name:u,type:d,value:f}=t;if(d==="image"){let p=u?`${u}.`:"";i.append(`${p}x`,"0"),i.append(`${p}y`,"0")}else u&&i.append(u,f)}}else{if(D5(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=gC,s=null,r=vC,a=t}return i&&r==="text/plain"&&(a=i,i=void 0),{action:s,method:n.toLowerCase(),encType:r,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function O9(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function die(t,e,n,s){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${s}`:r.pathname=`${r.pathname}.${s}`:r.pathname==="/"?r.pathname=`_root.${s}`:e&&hl(r.pathname,e)==="/"?r.pathname=`${_T(e)}/_root.${s}`:r.pathname=`${_T(r.pathname)}.${s}`,r}async function AEe(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.
67isSpaMode,window.location.reload(),new Promise(()=>{})}}function NEe(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function IEe(t,e,n){let s=await Promise.all(t.map(async r=>{let i=e.routes[r.route.id];if(i){let a=await AEe(i,n);return a.links?a.links():[]}return[]}));return MEe(s.flat(1).filter(NEe).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function iG(t,e,n,s,r,i){let a=(l,u)=>n[u]?l.route.id!==n[u].route.id:!0,o=(l,u)=>{var d;return n[u].pathname!==l.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==l.params["*"]};return i==="assets"?e.filter((l,u)=>a(l,u)||o(l,u)):i==="data"?e.filter((l,u)=>{var f;let d=s.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,u)||o(l,u))return!0;if(l.route.shouldRevalidate){let p=l.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function LEe(t,e,{includeHydrateFallback:n}={}){return jEe(t.map(s=>{let r=e.routes[s.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function jEe(t){return[...new Set(t)]}function PEe(t){let e={},n=Object.keys(t).sort();for(let s of n)e[s]=t[s];return e}function MEe(t,e){let n=new Set;return new Set(e),t.reduce((s,r)=>{let i=JSON.stringify(PEe(r));return n.has(i)||(n.add(i),s.push({key:i,link:r})),s},[])}function $9(){let t=w.useContext(Gm);return O9(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function DEe(){let t=w.useContext(J2);return O9(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var F9=w.createContext(void 0);F9.displayName="FrameworkContext";function O5(){let t=w.useContext(F9);return O9(t,"You must render this element inside a <HydratedRouter> element"),t}function OEe(t,e){let n=w.useContext(F9),[s,r]=w.useState(!1),[i,a]=w.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=e,p=w.useRef(null);w.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let x=S=>{S.forEach(_=>{a(_.isIntersecting)})},y=new IntersectionObserver(x,{threshold:.5});return p.current&&y.observe(p.current),()=>{y.disconnect()}}},[t]),w.useEffect(()=>{if(s){let x=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(x)}}},[s]);let m=()=>{r(!0)},v=()=>{r(!1),a(!1)};return n?t!=="intent"?[i,p,{}]:[i,p,{onFocus:Kx(o,m),onBlur:Kx(l,v),onMouseEnter:Kx(u,m),onMouseLeave:Kx(d,v),onTouchStart:Kx(f,m)}]:[!1,p,{}]}function Kx(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function $Ee({page:t,...e}){let n=sie(),{nonce:s}=O5(),{router:r}=$9(),i=w.useMemo(()=>T9(r.routes,t,r.basename),[r.routes,t,r.basename]);return i?(e.nonce==null&&s&&(e={...e,nonce:s}),n?w.createElement(UEe,{page:t,matches:i,...e}):w.createElement(BEe,{page:t,matches:i,...e})):null}function FEe(t){let{manifest:e,routeModules:n}=O5(),[s,r]=w.useState([]);return w.useEffect(()=>{let i=!1;return IEe(t,e,n).then(a=>{i||r(a)}),()=>{i=!0}},[t,e,n]),s}function UEe({page:t,matches:e,...n}){let s=Gs(),{future:r}=O5(),{basename:i}=$9(),a=w.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let o=die(t,i,r.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,u=[];for(let d of e)typeof d.route.shouldRevalidate=="function"?l=!0:u.push(d.route.id);return l&&u.length>0&&o.searchParams.set("_routes",u.join(",")),[o.pathname+o.search]},[i,r.v8_trailingSlashAwareDataRequests,t,s,e]);return w.createElement(w.Fragment,null,a.map(o=>w.createElement("link",{key:o,rel:"prefetch",as:"fetch",href:o,...n})))}function BEe({page:t,matches:e,...n}){let s=Gs(),{future:r,manifest:i,routeModules:a}=O5(),{basename:o}=$9(),{loaderData:l,matches:u}=DEe(),d=w.useMemo(()=>iG(t,e,u,i,s,"data"),[t,e,u,i,s]),f=w.useMemo(()=>iG(t,e,u,i,s,"assets"),[t,e,u,i,s]),p=w.useMemo(()=>
67{if(t===s.pathname+s.search+s.hash)return[];let x=new Set,y=!1;if(e.forEach(_=>{var T;let E=i.routes[_.route.id];!E||!E.hasLoader||(!d.some(k=>k.route.id===_.route.id)&&_.route.id in l&&((T=a[_.route.id])!=null&&T.shouldRevalidate)||E.hasClientLoader?y=!0:x.add(_.route.id))}),x.size===0)return[];let S=die(t,o,r.v8_trailingSlashAwareDataRequests,"data");return y&&x.size>0&&S.searchParams.set("_routes",e.filter(_=>x.has(_.route.id)).map(_=>_.route.id).join(",")),[S.pathname+S.search]},[o,r.v8_trailingSlashAwareDataRequests,l,s,i,d,e,t,a]),m=w.useMemo(()=>LEe(f,i),[f,i]),v=FEe(f);return w.createElement(w.Fragment,null,p.map(x=>w.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),m.map(x=>w.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),v.map(({key:x,link:y})=>w.createElement("link",{key:x,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function zEe(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var VEe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{VEe&&(window.__reactRouterVersion="7.18.2")}catch{}function HEe(t,e){return g_e({basename:e==null?void 0:e.basename,getContext:e==null?void 0:e.getContext,future:e==null?void 0:e.future,history:Lwe({window:e==null?void 0:e.window}),hydrationData:GEe(),routes:t,mapRouteProperties:fEe,hydrationRouteProperties:hEe,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation,window:e==null?void 0:e.window,instrumentations:e==null?void 0:e.instrumentations}).initialize()}function GEe(){let t=window==null?void 0:window.__staticRouterHydrationData;return t&&t.errors&&(t={...t,errors:WEe(t.errors)}),t}function WEe(t){if(!t)return null;let e=Object.entries(t),n={};for(let[s,r]of e)if(r&&r.__type==="RouteErrorResponse")n[s]=new X2(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type==="Error"){if(typeof r.__subType=="string"&&n_e.includes(r.__subType)){let i=window[r.__subType];if(typeof i=="function")try{let a=new i(r.message);a.stack="",n[s]=a}catch{}}if(n[s]==null){let i=new Error(r.message);i.stack="",n[s]=i}}else n[s]=r;return n}var Hn=w.forwardRef(function({onClick:e,discover:n="render",prefetch:s="none",relative:r,reloadDocument:i,replace:a,mask:o,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...v},x){let{basename:y,navigator:S,useTransitions:_}=w.useContext(jo),E=typeof d=="string"&&j5.test(d),T=zre(d,y);d=T.to;let k=q_e(d,{relative:r}),R=Gs(),I=null;if(o){let G=Z2(o,[],R.mask?R.mask.pathname:"/",!0);y!=="/"&&(G.pathname=G.pathname==="/"?y:ll([y,G.pathname])),I=S.createHref(G)}let[A,L,j]=OEe(s,v),F=YEe(d,{replace:a,mask:o,state:l,target:u,preventScrollReset:f,relative:r,viewTransition:p,defaultShouldRevalidate:m,useTransitions:_});function O(G){e&&e(G),G.defaultPrevented||F(G)}let M=!(T.isExternal||i),U=w.createElement("a",{...v,...j,href:(M?I:void 0)||T.absoluteURL||k,onClick:M?O:e,ref:zEe(x,L),target:u,"data-discover":!E&&n==="render"?"true":void 0});return A&&!E?w.createElement(w.Fragment,null,U,w.createElement($Ee,{page:k})):U});Hn.displayName="Link";var fie=w.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:s="",end:r=!1,style:i,to:a,viewTransition:o,children:l,...u},d){let f=tS(a,{relative:u.relative}),p=Gs(),m=w.useContext(J2),{navigator:v,basename:x}=w.useContext(jo),y=m!=null&&eCe(f)&&o===!0,S=v.encodeLocation?v.encodeLocation(f).pathname:f.pathname,_=p.pathname,E=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(_=_.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&x&&(E=hl(E,x)||E);const T=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let k=_===S||!r&&_.startsWith(S)&&_.charAt(T)==="/",R=E!=null&&(E===S||!r&&E.startsWith(S)&&E.charAt(S.length)==="/"),I={isActive:k,isPending:R,isTransitioning:y},A=k?e:void 0,L;typeof s=="function"?L=s(I):L=[s,k?"active":null,R?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let j=typeof i=="function"?i(I):i;return w.createElement(Hn,{...u,"aria-current":A,className:L,ref:d,style:j,to:a,viewTransition:o},typeof l=="function"?l(I):l)});fie.displayName="NavLink";var qEe=w.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:s,replace:r,state:i,method:a=gC,action:o,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},v)=>{let{useTransitions:x}=w.useContext(jo),y=QEe(),S=JEe(o,{relative:u}
67),_=a.toLowerCase()==="get"?"get":"post",E=typeof o=="string"&&j5.test(o),T=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let R=k.nativeEvent.submitter,I=(R==null?void 0:R.getAttribute("formmethod"))||a,A=()=>y(R||k.currentTarget,{fetcherKey:e,method:I,navigate:n,replace:r,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});x&&n!==!1?w.startTransition(()=>A()):A()};return w.createElement("form",{ref:v,method:_,action:S,onSubmit:s?l:T,...m,"data-discover":!E&&t==="render"?"true":void 0})});qEe.displayName="Form";function KEe(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function hie(t){let e=w.useContext(Gm);return dn(e,KEe(t)),e}function YEe(t,{target:e,replace:n,mask:s,state:r,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:l,useTransitions:u}={}){let d=di(),f=Gs(),p=tS(t,{relative:a});return w.useCallback(m=>{if(EEe(m,e)){m.preventDefault();let v=n!==void 0?n:Jc(f)===Jc(p),x=()=>d(t,{replace:v,mask:s,state:r,preventScrollReset:i,relative:a,viewTransition:o,defaultShouldRevalidate:l});u?w.startTransition(()=>x()):x()}},[f,d,p,n,s,r,e,t,i,a,o,l,u])}function Po(t){Nr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=w.useRef(Z8(t)),n=w.useRef(!1),s=Gs(),r=w.useMemo(()=>CEe(s.search,n.current?null:e.current),[s.search]),i=di(),a=w.useCallback((o,l)=>{const u=Z8(typeof o=="function"?o(new URLSearchParams(r)):o);n.current=!0,i("?"+u,l)},[i,r]);return[r,a]}var ZEe=0,XEe=()=>`__${String(++ZEe)}__`;function QEe(){let{router:t}=hie("useSubmit"),{basename:e}=w.useContext(jo),n=aEe(),s=t.fetch,r=t.navigate;return w.useCallback(async(i,a={})=>{let{action:o,method:l,encType:u,formData:d,body:f}=REe(i,e);if(a.navigate===!1){let p=a.fetcherKey||XEe();await s(p,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,flushSync:a.flushSync})}else await r(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[s,r,e,n])}function JEe(t,{relative:e}={}){let{basename:n}=w.useContext(jo),s=w.useContext(vl);dn(s,"useFormAction must be used inside a RouteContext");let[r]=s.matches.slice(-1),i={...tS(t||".",{relative:e})},a=Gs();if(t==null){i.search=a.search;let o=new URLSearchParams(i.search),l=o.getAll("index");if(l.some(d=>d==="")){o.delete("index"),l.filter(f=>f).forEach(f=>o.append("index",f));let d=o.toString();i.search=d?`?${d}`:""}}return(!t||t===".")&&r.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:ll([n,i.pathname])),Jc(i)}function eCe(t,{relative:e}={}){let n=w.useContext(L9);dn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=hie("useViewTransitionState"),r=tS(t,{relative:e});if(!n.isTransitioning)return!1;let i=hl(n.currentLocation.pathname,s)||n.currentLocation.pathname,a=hl(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Pb(r.pathname,a)!=null||Pb(r.pathname,i)!=null}var nr=_re();function tCe(t){return w.createElement(mEe,{flushSync:nr.flushSync,...t})}const yn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,fm="8.55.2",hs=globalThis;function $5(t,e,n){const s=n||hs,r=s.__SENTRY__=s.__SENTRY__||{},i=r[fm]=r[fm]||{};return i[t]||(i[t]=e())}const zh=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nCe="Sentry Logger ",X8=["debug","info","warn","error","log","assert","trace"],ET={};function qm(t){if(!("console"in hs))return t();const e=hs.console,n={},s=Object.keys(ET);
vendor: 6,649 bytes, lines 67-71
67s.forEach(r=>{const i=ET[r];n[r]=e[r],e[r]=i});try{return t()}finally{s.forEach(r=>{e[r]=n[r]})}}function sCe(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return zh?X8.forEach(n=>{e[n]=(...s)=>{t&&qm(()=>{hs.console[n](`${nCe}[${n}]:`,...s)})}}):X8.forEach(n=>{e[n]=()=>{}}),e}const gt=$5("logger",sCe),pie=50,Rm="?",aG=/\(error: (.*)\)/,oG=/captureMessage|captureException/;function mie(...t){const e=t.sort((n,s)=>n[0]-s[0]).map(n=>n[1]);return(n,s=0,r=0)=>{const i=[],a=n.split(`
68`);for(let o=s;o<a.length;o++){const l=a[o];if(l.length>1024)continue;const u=aG.test(l)?l.replace(aG,"$1"):l;if(!u.match(/\S*Error: /)){for(const d of e){const f=d(u);if(f){i.push(f);break}}if(i.length>=pie+r)break}}return iCe(i.slice(r))}}function rCe(t){return Array.isArray(t)?mie(...t):t}function iCe(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(d_(e).function||"")&&e.pop(),e.reverse(),oG.test(d_(e).function||"")&&(e.pop(),oG.test(d_(e).function||"")&&e.pop()),e.slice(0,pie).map(n=>({...n,filename:n.filename||d_(e).filename,function:n.function||Rm}))}function d_(t){return t[t.length-1]||{}}const cN="<anonymous>";function bh(t){try{return!t||typeof t!="function"?cN:t.name||cN}catch{return cN}}function lG(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(s=>{s.stacktrace.frames&&n.push(...s.stacktrace.frames)}),n}catch{return}}}const xC={},cG={};function nS(t,e){xC[t]=xC[t]||[],xC[t].push(e)}function sS(t,e){if(!cG[t]){cG[t]=!0;try{e()}catch(n){zh&&gt.error(`Error while instrumenting ${t}`,n)}}}function hm(t,e){const n=t&&xC[t];if(n)for(const s of n)try{s(e)}catch(r){zh&&gt.error(`Error while triggering instrumentation handler.
69Type: ${t}
70Name: ${bh(s)}
71Error:`,r)}}let uN=null;function gie(t){const e="error";nS(e,t),sS(e,aCe)}function aCe(){uN=hs.onerror,hs.onerror=function(t,e,n,s,r){return hm("error",{column:s,error:r,line:n,msg:t,url:e}),uN?uN.apply(this,arguments):!1},hs.onerror.__SENTRY_INSTRUMENTED__=!0}let dN=null;function vie(t){const e="unhandledrejection";nS(e,t),sS(e,oCe)}function oCe(){dN=hs.onunhandledrejection,hs.onunhandledrejection=function(t){return hm("unhandledrejection",t),dN?dN.apply(this,arguments):!0},hs.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Km(){return U9(hs),hs}function U9(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||fm,e[fm]=e[fm]||{}}const xie=Object.prototype.toString;function B9(t){switch(xie.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return _d(t,Error)}}function y1(t,e){return xie.call(t)===`[object ${e}]`}function yie(t){return y1(t,"ErrorEvent")}function uG(t){return y1(t,"DOMError")}function lCe(t){return y1(t,"DOMException")}function Db(t){return y1(t,"String")}function z9(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function V9(t){return t===null||z9(t)||typeof t!="object"&&typeof t!="function"}function Nv(t){return y1(t,"Object")}function F5(t){return typeof Event<"u"&&_d(t,Event)}function cCe(t){return typeof Element<"u"&&_d(t,Element)}function uCe(t){return y1(t,"RegExp")}function U5(t){return!!(t&&t.then&&typeof t.then=="function")}function dCe(t){return Nv(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function _d(t,e){try{return t instanceof e}catch{return!1}}function bie(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}const G0=hs,fCe=80;function Sie(t,e={}){if(!t)return"<unknown>";try{let n=t;const s=5,r=[];let i=0,a=0;const o=" > ",l=o.length;let u;const d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||fCe;for(;n&&i++<s&&(u=hCe(n,d),!(u==="html"||i>1&&a+r.length*l+u.length>=f));)r.push(u),a+=u.length,n=n.parentNode;return r.reverse().join(o)}catch{return"<unknown>"}}function hCe(t,e){const n=t,s=[];if(!n||!n.tagName)return"";if(G0.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}s.push(n.tagName.toLowerCase());const r=e&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(r&&r.length)r.forEach(a=>{s.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&s.push(`#${n.id}`);const a=n.className;if(a&&Db(a)){const o=a.split(/\s+/);for(const l of o)s.push(`.${l}`)}}const i=["aria-label","type","name","title","alt"];for(const a of i){const o=n.getAttribute(a);o&&s.push(`[${a}="${o}"]`)}return s.join("")}function pCe(){try{return G0.document.location.href}catch{return""}}function mCe(t){return G0.document&&G0.document.querySelector?G0.document.querySelector(t):null}function gCe(t){if(!G0.HTMLElement)return null;let e=t;const n=5;for(let s=0;s<n;s++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function W0(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function dG(t,e){if(!Array.isArray(t))return"";const n=[];for(let s=0;s<t.length;s++){const r=t[s];try{bie(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function vCe(t,e,n=!1){return Db(t)?uCe(e)?e.test(t):Db(e)?n?t===e:t.includes(e):!1:!1}function pm(t,e=[],n=!1){return e.some(s=>vCe(t,s,n))}function ud(t,e,n){if(!(e in t))return;const s=t[e],r=n(s);typeof r=="function"&&wie(r,s);try{t[e]=r}catch{zh&&gt.log(`Failed to replace method "${e}" in object`,t)}}function eu(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{zh&&gt.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function wie(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,eu(t,"__sentry_original__",e)}catch{}}function H9(t){return t.__sentry_original__}function _ie(t){if(B9(t))return{message:t.message,name:t.name,stack:t.stack,...hG(t)};if(F5(t)){const e={type:t.type,target:fG(t.target),currentTarget:fG(t.currentTarget),...hG(t)};return typeof CustomEvent<"u"&&_d(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function fG(t){try{return cCe(t)?Sie(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function hG(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function xCe(t,e=40){const n=Object.keys(_ie(t));n.sort();const s=n[0];if(!s)return"[object has no keys]";if(s.length>=e)return W0(s,e);for(let r=n.length;r>0;r--){const i=n.slice(0,r).join(", ");
71if(!(i.length>e))return r===n.length?i:W0(i,e)}return""}function Ca(t){return Q8(t,new Map)}function Q8(t,e){if(yCe(t)){const n=e.get(t);if(n!==void 0)return n;const s={};e.set(t,s);for(const r of Object.getOwnPropertyNames(t))typeof t[r]<"u"&&(s[r]=Q8(t[r],e));return s}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const s=[];return e.set(t,s),t.forEach(r=>{s.push(Q8(r,e))}),s}return t}function yCe(t){if(!Nv(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const Eie=1e3;function rS(){return Date.now()/Eie}function bCe(){const{performance:t}=hs;if(!t||!t.now)return rS;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/Eie}const cl=bCe(),CT=(()=>{const{performance:t}=hs;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),s=Date.now(),r=t.timeOrigin?Math.abs(t.timeOrigin+n-s):e,i=r<e,a=t.timing&&t.timing.navigationStart,l=typeof a=="number"?Math.abs(a+n-s):e,u=l<e;return i||u?r<=l?t.timeOrigin:a:s})();function ec(){const t=hs,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const s=new Uint8Array(1);return e.getRandomValues(s),s[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,s=>(s^(n()&15)>>s/4).toString(16))}function Cie(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Pf(t){const{message:e,event_id:n}=t;if(e)return e;const s=Cie(t);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||n||"<unknown>":n||"<unknown>"}function J8(t,e,n){const s=t.exception=t.exception||{},r=s.values=s.values||[],i=r[0]=r[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Iv(t,e){const n=Cie(t);if(!n)return;const s={type:"generic",handled:!0},r=n.mechanism;if(n.mechanism={...s,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}function pG(t){if(SCe(t))return!0;try{eu(t,"__sentry_captured__",!0)}catch{}return!1}function SCe(t){try{return t.__sentry_captured__}catch{}}var Wu;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const s=2;t[t.REJECTED=s]="REJECTED"})(Wu||(Wu={}));function Am(t){return new iS(e=>{e(t)})}function TT(t){return new iS((e,n)=>{n(t)})}let iS=class Np{constructor(e){Np.prototype.__init.call(this),Np.prototype.__init2.call(this),Np.prototype.__init3.call(this),Np.prototype.__init4.call(this),this._state=Wu.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Np((s,r)=>{this._handlers.push([!1,i=>{if(!e)s(i);else try{s(e(i))}catch(a){r(a)}},i=>{if(!n)r(i);else try{s(n(i))}catch(a){r(a)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Np((n,s)=>{let r,i;return this.then(a=>{i=!1,r=a,e&&e()},a=>{i=!0,r=a,e&&e()}).then(()=>{if(i){s(r);return}n(r)})})}__init(){this._resolve=e=>{this._setResult(Wu.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Wu.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===Wu.PENDING){if(U5(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Wu.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Wu.RESOLVED&&n[1](this._value),this._state===Wu.REJECTED&&n[2](this._value),n[0]=!0)})}}};function wCe(t){const e=cl(),n={sid:ec(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>ECe(n)};return t&&Lv(n,t),n}function Lv(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||cl(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:ec()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),t
71ypeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function _Ce(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Lv(t,n)}function ECe(t){return Ca({sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}function Sh(){return ec()}function wh(){return ec().substring(16)}function B5(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const s={...t};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=B5(s[r],e[r],n-1));return s}const ej="_sentrySpan";function Ob(t,e){e?eu(t,ej,e):delete t[ej]}function kT(t){return t[ej]}const CCe=100;let TCe=class Tie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Sh(),spanId:wh()}}clone(){const e=new Tie;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Ob(e,kT(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lv(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[s,r]=n instanceof _h?[n.getScopeData(),n.getRequestSession()]:Nv(n)?[e,e.requestSession]:[],{tags:i,extra:a,user:o,contexts:l,level:u,fingerprint:d=[],propagationContext:f}=s||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},o&&Object.keys(o).length&&(this._user=o),u&&(this._level=u),d.length&&(this._fingerprint=d),f&&(this._propagationContext=f),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Ob(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Sh()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const s=typeof n=="number"?n:CCe;if(s<=0)return this;const r={timestamp:rS(),...e};return this._breadcrumbs.push(r),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),this._client&&this._client.re
71cordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:kT(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=B5(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:wh(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const s=n&&n.event_id?n.event_id:ec();if(!this._client)return gt.warn("No client configured on scope - will not capture exception!"),s;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...n,event_id:s},this),s}captureMessage(e,n,s){const r=s&&s.event_id?s.event_id:ec();if(!this._client)return gt.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...s,event_id:r},this),r}captureEvent(e,n){const s=n&&n.event_id?n.event_id:ec();return this._client?(this._client.captureEvent(e,{...n,event_id:s},this),s):(gt.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};const _h=TCe;function kCe(){return $5("defaultCurrentScope",()=>new _h)}function RCe(){return $5("defaultIsolationScope",()=>new _h)}let ACe=class{constructor(e,n){let s;e?s=e:s=new _h;let r;n?r=n:r=new _h,this._stack=[{scope:s}],this._isolationScope=r}withScope(e){const n=this._pushScope();let s;try{s=e(n)}catch(r){throw this._popScope(),r}return U5(s)?s.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function jv(){const t=Km(),e=U9(t);return e.stack=e.stack||new ACe(kCe(),RCe())}function NCe(t){return jv().withScope(t)}function ICe(t,e){const n=jv();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function mG(t){return jv().withScope(()=>t(jv().getIsolationScope()))}function LCe(){return{withIsolationScope:mG,withScope:NCe,withSetScope:ICe,withSetIsolationScope:(t,e)=>mG(e),getCurrentScope:()=>jv().getScope(),getIsolationScope:()=>jv().getIsolationScope()}}function b1(t){const e=U9(t);return e.acs?e.acs:LCe()}function jr(){const t=Km();return b1(t).getCurrentScope()}function xl(){const t=Km();return b1(t).getIsolationScope()}function jCe(){return $5("globalScope",()=>new _h)}function z5(...t){const e=Km(),n=b1(e);if(t.length===2){const[s,r]=t;return s?n.withSetScope(s,r):n.withScope(r)}return n.withScope(t[0])}function Us(){return jr().getClient()}function PCe(t){const e=t.getPropagationContext(),{traceId:n,spanId:s,parentSpanId:r}=e;return Ca({trace_id:n,span_id:s,parent_span_id:r})}const MCe="_sentryMetrics";function tj(t){const e=t[MCe];if(!e)return;const n={};for(const[,[s,r]]of e)(n[s]||(n[s]=[])).push(Ca(r));return n}const dd="sentry.source",kie="sentry.sample_rate",$b="sentry.op",Nm="sentry.origin",nj="sentry.idle_span_finish_reason",DCe="sentry.measurement_unit",OCe="sentry.measurement_value",gG="sentry.custom_span_name",$Ce="sentry.profile_id",FCe="sentry.exclusive_time",UCe=0,Rie=1,mi=2;function BCe(t){if(t<400&&t>=100)return{code:Rie};if(t>=400&&t<500)switch(t){case 401:return{code:mi,message:"unauthenticated"};case 403:return{code:mi,message:"permission_denied"};case 404:return{code:mi,message:"not_found"};case 409:return{code:mi,message:"already_exists"};case 413:return{code:mi,message:"failed_precondition"};case 429:return{code:mi,message:"resource_exhausted"};case 499:return{code:mi,message:"cancelled"};default:return{code:mi,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:mi,message:"unimplemented"};case 503:return{code:mi,message:"unavailable"};case 504:return{code:mi,message:"deadline_exceeded"};default:return{code:mi,message:"internal_error"}}return{code:mi,message:"unknown_error"}}function Aie(t,e){t.setAttribute("http.response.status_code",e);const n=BCe(e);n.message!=="unknown_error"&&t.setStatus(n)}const G9="sentry-",zCe=/^sentry-/,VCe=8192;function Nie(t){const e=GCe(t);if(!e)return;const n=Object.entries(e).reduce((s,[r,i])=>{if(r.match(zCe)){const a=r.slice(G9.length);s[a]=i}return s},{});if(Object.keys(n).length>0)return n}function HCe(t){if(!t)return;const e=Object.entries(t).reduce((n,[s,r])=>(r&&(n[`${G9}${s}`]=r),n),{});return WCe(e)}function GCe(t){if(!(!t||!Db(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const s=vG(n);
71return Object.entries(s).forEach(([r,i])=>{e[r]=i}),e},{}):vG(t)}function vG(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,s])=>(n&&s&&(e[n]=s),e),{})}function WCe(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,s],r)=>{const i=`${encodeURIComponent(n)}=${encodeURIComponent(s)}`,a=r===0?i:`${e},${i}`;return a.length>VCe?(zh&&gt.warn(`Not adding key: ${n} with val: ${s} to baggage header due to exceeding baggage size limits.`),e):a},"")}const Iie=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function qCe(t){if(!t)return;const e=t.match(Iie);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function KCe(t,e){const n=qCe(t),s=Nie(e);if(!n||!n.traceId)return{traceId:Sh(),spanId:wh()};const{traceId:r,parentSpanId:i,parentSampled:a}=n,o=wh();return{traceId:r,parentSpanId:i,spanId:o,sampled:a,dsc:s||{}}}function Lie(t=Sh(),e=wh(),n){let s="";return n!==void 0&&(s=n?"-1":"-0"),`${t}-${e}${s}`}const jie=0,Pie=1;let xG=!1;function YCe(t){const{spanId:e,traceId:n}=t.spanContext(),{data:s,op:r,parent_span_id:i,status:a,origin:o}=dr(t);return Ca({parent_span_id:i,span_id:e,trace_id:n,data:s,op:r,status:a,origin:o})}function ZCe(t){const{spanId:e,traceId:n,isRemote:s}=t.spanContext(),r=s?e:dr(t).parent_span_id,i=s?wh():e;return Ca({parent_span_id:r,span_id:i,trace_id:n})}function XCe(t){const{traceId:e,spanId:n}=t.spanContext(),s=Ym(t);return Lie(e,n,s)}function mm(t){return typeof t=="number"?yG(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?yG(t.getTime()):cl()}function yG(t){return t>9999999999?t/1e3:t}function dr(t){if(JCe(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(QCe(t)){const{attributes:s,startTime:r,name:i,endTime:a,parentSpanId:o,status:l}=t;return Ca({span_id:e,trace_id:n,data:s,description:i,parent_span_id:o,start_timestamp:mm(r),timestamp:mm(a)||void 0,status:Mie(l),op:s[$b],origin:s[Nm],_metrics_summary:tj(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function QCe(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function JCe(t){return typeof t.getSpanJSON=="function"}function Ym(t){const{traceFlags:e}=t.spanContext();return e===Pie}function Mie(t){if(!(!t||t.code===UCe))return t.code===Rie?"ok":t.message||"unknown_error"}const gm="_sentryChildSpans",sj="_sentryRootSpan";function Die(t,e){const n=t[sj]||t;eu(e,sj,n),t[gm]?t[gm].add(e):eu(t,gm,new Set([e]))}function eTe(t,e){t[gm]&&t[gm].delete(e)}function yC(t){const e=new Set;function n(s){if(!e.has(s)&&Ym(s)){e.add(s);const r=s[gm]?Array.from(s[gm]):[];for(const i of r)n(i)}}return n(t),Array.from(e)}function ul(t){return t[sj]||t}function Md(){const t=Km(),e=b1(t);return e.getActiveSpan?e.getActiveSpan():kT(jr())}function Oie(){xG||(qm(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),xG=!0)}let bG=!1;function tTe(){bG||(bG=!0,gie(rj),vie(rj))}function rj(){const t=Md(),e=t&&ul(t);if(e){const n="internal_error";yn&&gt.log(`[Tracing] Root span: ${n} -> Global error occurred`),e.setStatus({code:mi,message:n})}}rj.tag="sentry_tracingErrorCallback";const $ie="_sentryScope",Fie="_sentryIsolationScope";function nTe(t,e,n){t&&(eu(t,Fie,n),eu(t,$ie,e))}function SG(t){return{scope:t[$ie],isolationScope:t[Fie]}}function Eh(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=Us(),n=t||e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}let S1=class{constructor(e={}){this._traceId=e.traceId||Sh(),this._spanId=e.spanId||wh()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:jie}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,s){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};const W9="production",Uie="_frozenDsc";function wG(t,e){eu(t,Uie,e)}function Bie(t,e){const n=e.getOptions(),{publicKey:s}=e.getDsn()||{},r=Ca({environment:n.environment||W9,release:n.release,public_key:s,trace_id:t});return e.emit("createDsc",r),r}function zie(t,e){const n=e.getPropagationContext();return n.dsc||Bie(n.traceId,t)}function w1(t){const e=Us();if(!e)return{};const n=ul(t),s=n[Uie];if(s)return s;const r=n.spanContext().traceState,i=r&&r.get("sentry.dsc"),a=i&&Nie(i);if(a)return a;const o=Bie(t.spanContext().traceId,e),l=dr(n),u=l.data||{},d=u[kie];d!=null&&(o.sample_rate=`${d}`);const f=u[dd],p=l.description;return f!=="url"&&p&&(o.transaction=p),Eh()&&(o.sampled=String(Ym(n))),e.emit("createDsc",o,n),o}function sTe(t){if(!yn)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:s}=dr(t),{spanId:r}=t.spanContext(),i=Ym(t),a=ul(t),o=a===t,l=`[Tracing] Starting ${i?"sampled":"unsampled"} ${o?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${r}`];if(s&&u.push(`parent ID: ${s}`),!o){const{op:d,description:f}=dr(a);u.push(`root ID: ${a.spanContext().spanId}`),d&&u.push(`root op: ${d}`),f&&u.push(`root description: ${f}`)}gt.log(`${l}
72  ${u.join(`
73  `)}`)}function rTe(t){if(!yn)return;const{description:e="< unknown name >",op:n="< unknown op >"}=dr(t),{spanId:s}=t.spanContext(),i=ul(t)===t,a=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${s}`;gt.log(a)}function Vie(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>
731){yn&&gt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function iTe(t,e){if(!Eh(t))return[!1];const n=xl().getScopeData().sdkProcessingMetadata.normalizedRequest,s={...e,normalizedRequest:e.normalizedRequest||n};let r;typeof t.tracesSampler=="function"?r=t.tracesSampler(s):s.parentSampled!==void 0?r=s.parentSampled:typeof t.tracesSampleRate<"u"?r=t.tracesSampleRate:r=1;const i=Vie(r);return i===void 0?(yn&&gt.warn("[Tracing] Discarding transaction because of invalid sample rate."),[!1]):i?Math.random()<i?[!0,i]:(yn&&gt.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`),[!1,i]):(yn&&gt.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i])}const aTe=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function oTe(t){return t==="http"||t==="https"}function _1(t,e=!1){const{host:n,path:s,pass:r,port:i,projectId:a,protocol:o,publicKey:l}=t;return`${o}://${l}${e&&r?`:${r}`:""}@${n}${i?`:${i}`:""}/${s&&`${s}/`}${a}
73`}function lTe(t){const e=aTe.exec(t);if(!e){qm(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,s,r="",i="",a="",o=""]=e.slice(1);let l="",u=o;const d=u.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),u=d.pop()),u){const f=u.match(/^\d+/);f&&(u=f[0])}return Hie({host:i,pass:r,path:l,projectId:u,port:a,protocol:n,publicKey:s})}function Hie(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function cTe(t){if(!zh)return!0;const{port:e,projectId:n,protocol:s}=t;return["protocol","publicKey","host","projectId"].find(a=>t[a]?!1:(gt.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:n.match(/^\d+$/)?oTe(s)?e&&isNaN(parseInt(e,10))?(gt.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(gt.error(`Invalid Sentry Dsn: Invalid protocol ${s}`),!1):(gt.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Gie(t){const e=typeof t=="string"?lTe(t):Hie(t);if(!(!e||!cTe(e)))return e}function uTe(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(r){if(t)return e.has(r)?!0:(e.add(r),!1);for(let i=0;i<e.length;i++)if(e[i]===r)return!0;return e.push(r),!1}function s(r){if(t)e.delete(r);else for(let i=0;i<e.length;i++)if(e[i]===r){e.splice(i,1);break}}return[n,s]}function qu(t,e=100,n=1/0){try{return ij("",t,e,n)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function Wie(t,e=3,n=100*1024){const s=qu(t,e);return pTe(s)>n?Wie(t,e-1,n):s}function ij(t,e,n=1/0,s=1/0,r=uTe()){const[i,a]=r;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=dTe(t,e);if(!o.startsWith("[object "))return o;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return o.replace("object ","");if(i(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const m=u.toJSON();return ij("",m,l-1,s,r)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const p=_ie(e);for(const m in p){if(!Object.prototype.hasOwnProperty.call(p,m))continue;if(f>=s){d[m]="[MaxProperties ~]";break}const v=p[m];d[m]=ij(m,v,l-1,s,r),f++}return a(e),d}function dTe(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(bie(e))return"[VueViewModel]";if(dCe(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${bh(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=fTe(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function fTe(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function hTe(t){return~-encodeURI(t).split(/%..|./).length}function pTe(t){return hTe(JSON.stringify(t))}function E1(t,e=[]){return[t,e]}function mTe(t,e){const[n,s]=t;return[n,[...s,e]]}function _G(t,e){const n=t[1];for(const s of n){const r=s[0].type;if(e(s,r))return!0}return!1}function aj(t){return hs.__SENTRY__&&hs.__SENTRY__.encodePolyfill?hs.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function gTe(t){const[e,n]=t;let s=JSON.stringify(e);function r(i){typeof s=="string"?s=typeof i=="string"?s+i:[aj(s),i]:s.push(typeof i=="string"?aj(i):i)}for(const i of n){const[a,o]=i;if(r(`
74${JSON.stringify(a)}
75`),typeof o=="string"||o instanceof Uint8Array)r(o);else{let l;try{l=JSON.stringify(o)}catch{l=JSON.stringify(qu(o))}r(l)}}return typeof s=="string"?s:vTe(s)}function vTe(t){const e=t.reduce((r,i)=>r+i.length,0),n=new Uint8Array(e);let s=0;for(const r of t)n.set(r,s),s+=r.length;return n}function xTe(t){return[{type:"span"},t]}function yTe(t){const e=typeof t.data=="string"?aj(t.data):t.data;return[Ca({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const bTe={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket",raw_
75security:"security"};function EG(t){return bTe[t]}function qie(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function STe(t,e,n,s){const r=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&s&&{dsn:_1(s)},...r&&{trace:Ca({...r})}}}function wTe(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function _Te(t,e,n,s){const r=qie(n),i={sent_at:new Date().toISOString(),...r&&{sdk:r},...!!s&&e&&{dsn:_1(e)}},a="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return E1(i,[a])}function ETe(t,e,n,s){const r=qie(n),i=t.type&&t.type!=="replay_event"?t.type:"event";wTe(t,n&&n.sdk);const a=STe(t,r,s,e);return delete t.sdkProcessingMetadata,E1(a,[[{type:i},t]])}function CTe(t,e){function n(d){return!!d.trace_id&&!!d.public_key}const s=w1(t[0]),r=e&&e.getDsn(),i=e&&e.getOptions().tunnel,a={sent_at:new Date().toISOString(),...n(s)&&{trace:s},...!!i&&r&&{dsn:_1(r)}},o=e&&e.getOptions().beforeSendSpan,l=o?d=>{const f=o(dr(d));return f||Oie(),f}:d=>dr(d),u=[];for(const d of t){const f=l(d);f&&u.push(xTe(f))}return E1(a,u)}function CG(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const s=n.attributes||{},r=s[DCe],i=s[OCe];typeof r=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:r})}),e}const TG=1e3;let q9=class{constructor(e={}){this._traceId=e.traceId||Sh(),this._spanId=e.spanId||wh(),this._startTime=e.startTimestamp||cl(),this._attributes={},this.setAttributes({[Nm]:"manual",[$b]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this}addLinks(e){return this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:s}=this;return{spanId:e,traceId:n,traceFlags:s?Pie:jie}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=mm(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(dd,"custom"),this}end(e){this._endTime||(this._endTime=mm(e),rTe(this),this._onSpanEnded())}getSpanJSON(){return Ca({data:this._attributes,description:this._name,op:this._attributes[$b],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Mie(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Nm],_metrics_summary:tj(this),profile_id:this._attributes[$Ce],exclusive_time:this._attributes[FCe],measurements:CG(this._events),is_segment:this._isStandaloneSpan&&ul(this)===this||void 0,segment_id:this._isStandaloneSpan?ul(this).spanContext().spanId:void 0})}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,s){yn&&gt.log("[Tracing] Adding an event to span:",e);const r=kG(n)?n:s||cl(),i=kG(n)?{}:n||{},a={name:e,time:mm(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=Us();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===ul(this)))return;if(this._isStandaloneSpan){this._sampled?kTe(CTe([this],e)):(yn&&gt.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const s=this._convertSpanToTransaction();s&&(SG(this).scope||jr()).captureEvent(s)}_convertSpanToTransaction(){if(!RG(dr(this)))return;this._name||(yn&&gt.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=SG(this),r=(e||jr()).getClient()||Us();if(this._sampled!==!0){yn&&gt.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),r&&r.recordDroppedEvent("sample_rate","transaction");return}const a=yC(this).filter(f=>f!==this&&!TTe(f)).map(f=>dr(f)).filter(RG),o=this._attributes[dd];delete this._attributes[gG],a.forEach(f=>{f.data&&delete f.data[gG]});const l={contexts:{trace:YCe(this)},spans:a.length>TG?a.sort((f,p)=>f.start_timestamp-p.start_timestamp).slice(0,TG):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,...Ca({dynamicSamplingContext:w1(this)})},_metrics_summary:tj(this),...o&&{transaction_info:{source:o}}},u=CG(this._events);return u&&Object.keys(u).length&&(yn&&gt.log("[Measurements] Adding measurements to transaction event",JSON.stringify(u,void 0,2)),l.measurements=u),l}};function kG(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function RG(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function TTe(t){return t instanceof q9&&t.isStandaloneSpan()}function kTe(t){const e=Us();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}const Kie="__SENTRY_SUPPRESS_TRACING__";function K9(t){const e=Yie();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=NTe(t),{forceTransaction:s,parentSpan:r}=t;return(t.scope?a=>z5(t.scope,a):r!==void 0?a=>RTe(r,a):a=>a())(()=>{const a=jr(),o=LTe(a);return t.onlyIfParent&&!o?new S1:ATe({parentSpan:o,spanArguments:n,forceTransaction:s,scope:a})})}function RTe(t,e){const n=Yie();return n.withActiveSpan?n.withActiveSpan(t,e):z5(s=>(Ob(s,t||void 0),e(s)))}function ATe({parentSpan:t,spanArguments:e,forceTransaction:n,scope:s}){if(!Eh())return new S1;const r=xl();let i;if(t&&!n)i=ITe(t,s,e),Die(t,i);else if(t){const a=w1(t),{traceId:o,spanId:l}=t.spanContext(),u=Ym(t);i=AG({traceId:o,parentSpanId:l,...e},s,u),wG(i,a)}else{const{traceId:a,dsc:o,parentSpanId:l,sampled:u}={...r.getPropagationContext(),...s.getPropagationContext()};i=AG({traceId:a,parentSpanId:l,...e},s,u),o&&wG(i,o)}return sTe(i),nTe(i,s,r),i}function NTe(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const s={...n};return s.startTimestamp=mm(t.startTime),delete s.startTime,s}return n}function Yie(){const t=Km();return b1(t)}function AG(t,e,n){const s=Us(),r=s&&s.getOptions()||{},{name:i="",attributes:a}=t,[o,l]=e.getScopeData().sdkProcessingMetadata[Kie]?[!1]:iTe(r,{name:i,parentSampled:n,attributes:a,transactionContext:{name:i,parentSampled:n}}),u=new q9({...t,attributes:{[dd]:"custom",...t.attributes},sampled:o});return l!==void 0&&u.setAttribute(kie,l),s&&s.emit("spanStart",u),u}function ITe(t,e,n){const{spanId:s,traceId:r}=t.spanContext(),i=e.getScopeData().sdkProcessingMetadata[Kie]?!1:Ym(t),a=i?new q9({...n,parentSpanId:s,traceId:r,sampled:i}):new S1({traceId:r});Die(t,a);const o=Us();return o&&(o.emit("spanStart",a),n.endTimestamp&&o.emit("spanEnd",a)),a}function LTe(t){const e=kT(t);if(!e)return;const n=Us();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?ul(e):e}const bC={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},jTe="heartbeatFailed",PTe="idleTimeout",MTe="finalTimeout",DTe="externalFinish";function Zie(t,e={}){const n=new Map;let s=!1,r,i=DTe,a=!e.disableAutoFinish;const o=[],{idleTimeout:l=bC.idleTimeout,finalTimeout:u=bC.finalTimeout,childSpanTimeout:d=bC.childSpanTimeout,beforeSpanEnd:f}=e,p=Us();if(!p||!Eh())return new S1;const m=jr(),v=Md(),x=OTe(t);x.end=new Proxy(x.end,{apply(R,I,A){f&&f(x);
75const[L,...j]=A,F=L||cl(),O=mm(F),M=yC(x).filter(B=>B!==x);if(!M.length)return k(O),Reflect.apply(R,I,[O,...j]);const U=M.map(B=>dr(B).timestamp).filter(B=>!!B),G=U.length?Math.max(...U):void 0,$=dr(x).start_timestamp,V=Math.min($?$+u/1e3:1/0,Math.max($||-1/0,Math.min(O,G||1/0)));return k(V),Reflect.apply(R,I,[V,...j])}});function y(){r&&(clearTimeout(r),r=void 0)}function S(R){y(),r=setTimeout(()=>{!s&&n.size===0&&a&&(i=PTe,x.end(R))},l)}function _(R){r=setTimeout(()=>{!s&&a&&(i=jTe,x.end(R))},d)}function E(R){y(),n.set(R,!0);const I=cl();_(I+d/1e3)}function T(R){if(n.has(R)&&n.delete(R),n.size===0){const I=cl();S(I+l/1e3)}}function k(R){s=!0,n.clear(),o.forEach(O=>O()),Ob(m,v);const I=dr(x),{start_timestamp:A}=I;if(!A)return;(I.data||{})[nj]||x.setAttribute(nj,i),gt.log(`[Tracing] Idle span "${I.op}" finished`);const j=yC(x).filter(O=>O!==x);let F=0;j.forEach(O=>{O.isRecording()&&(O.setStatus({code:mi,message:"cancelled"}),O.end(R),yn&&gt.log("[Tracing] Cancelling span since span ended early",JSON.stringify(O,void 0,2)));const M=dr(O),{timestamp:U=0,start_timestamp:G=0}=M,$=G<=R,V=(u+l)/1e3,B=U-G<=V;if(yn){const q=JSON.stringify(O,void 0,2);$?B||gt.log("[Tracing] Discarding span since it finished after idle span final timeout",q):gt.log("[Tracing] Discarding span since it happened after idle span was finished",q)}(!B||!$)&&(eTe(x,O),F++)}),F>0&&x.setAttribute("sentry.idle_span_discarded_spans",F)}return o.push(p.on("spanStart",R=>{if(s||R===x||dr(R).timestamp)return;yC(x).includes(R)&&E(R.spanContext().spanId)})),o.push(p.on("spanEnd",R=>{s||T(R.spanContext().spanId)})),o.push(p.on("idleSpanEnableAutoFinish",R=>{R===x&&(a=!0,S(),n.size&&_())})),e.disableAutoFinish||S(),setTimeout(()=>{s||(x.setStatus({code:mi,message:"deadline_exceeded"}),i=MTe,x.end())},u),x}function OTe(t){const e=K9(t);return Ob(jr(),e),yn&&gt.log("[Tracing] Started span is an idle span"),e}function oj(t,e,n,s=0){return new iS((r,i)=>{const a=t[s];if(e===null||typeof a!="function")r(e);else{const o=a({...e},n);yn&&a.id&&o===null&&gt.log(`Event processor "${a.id}" dropped event`),U5(o)?o.then(l=>oj(t,l,n,s+1).then(r)).then(null,i):oj(t,o,n,s+1).then(r).then(null,i)}})}let f_,NG,h_;function $Te(t){const e=hs._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return h_&&n.length===NG||(NG=n.length,h_=n.reduce((s,r)=>{f_||(f_={});const i=f_[r];if(i)s[i[0]]=i[1];else{const a=t(r);for(let o=a.length-1;o>=0;o--){const l=a[o],u=l&&l.filename,d=e[r];if(u&&d){s[u]=d,f_[r]=[u,d];break}}}return s},{})),h_}function FTe(t,e){const{fingerprint:n,span:s,breadcrumbs:r,sdkProcessingMetadata:i}=e;UTe(t,e),s&&VTe(t,s),HTe(t,n),BTe(t,r),zTe(t,i)}function IG(t,e){const{extra:n,tags:s,user:r,contexts:i,level:a,sdkProcessingMetadata:o,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:v}=e;p_(t,"extra",n),p_(t,"tags",s),p_(t,"user",r),p_(t,"contexts",i),t.sdkProcessingMetadata=B5(t.sdkProcessingMetadata,o,2),a&&(t.level=a),m&&(t.transactionName=m),v&&(t.span=v),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...p}}function p_(t,e,n){t[e]=B5(t[e],n,1)}function UTe(t,e){const{extra:n,tags:s,user:r,contexts:i,level:a,transactionName:o}=e,l=Ca(n);l&&Object.keys(l).length&&(t.extra={...l,...t.extra});const u=Ca(s);u&&Object.keys(u).length&&(t.tags={...u,...t.tags});const d=Ca(r);d&&Object.keys(d).length&&(t.user={...d,...t.user});const f=Ca(i);f&&Object.keys(f).length&&(t.contexts={...f,...t.contexts}),a&&(t.level=a),o&&t.type!=="transaction"&&(t.transaction=o)}function BTe(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function zTe(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function VTe(t,e){t.contexts={trace:ZCe(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:w1(e),...t.sdkProcessingMetadata};const n=ul(e),s=dr(n).description;s&&!t.transaction&&t.type==="transaction"&&(t.transaction=s)}function HTe(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function GTe(t,e,n,s,r,i){const{normalizeDepth:a=3,normalizeMaxBreadth:o=1e3}=t,l={...e,event_id:e.event_id||n.event_id||ec(),timestamp:e.timestamp||rS()},u=n.integrations||t.integrations.map(y=>y.name);WTe(l,t),YTe(l,u),r&&r.emit("applyFrameMetadata",e),e.type===void 0&&qTe(l,t.stackParser);const d=XTe(s,n.captureContext);n.mechanism&&Iv(l,n.mechanism);const f=r?r.getEventProcessors():[],p=jCe().getScopeData();if(i){const y=i.getScopeData();IG(p,y)}if(d){const y=d.getScopeData();IG(p,y)}const m=[...n.attachments||[],...p.attachments];m.length&&(n.attachments=m),FTe(l,p);const v=[...f,...p.eventProcessors];return oj(v,l,n).then(y=>(y&&KTe(y),typeof a=="number"&&a>0?ZTe(y,a,o):y))}function WTe(t,e){const{environment:n,release:s,dist:r,maxValueLength:i=250}=e;t.environment=t.environment||n||W9,!t.release&&s&&(t.release=s),!t.dist&&r&&(t.dist=r),t.message&&(t.message=W0(t.message,i));const a=t.exception&&t.exception.values&&t.exception.values[0];
75a&&a.value&&(a.value=W0(a.value,i));const o=t.request;o&&o.url&&(o.url=W0(o.url,i))}function qTe(t,e){const n=$Te(e);try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(r=>{n&&r.filename&&(r.debug_id=n[r.filename])})})}catch{}}function KTe(t){const e={};try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(r=>{r.debug_id&&(r.abs_path?e[r.abs_path]=r.debug_id:r.filename&&(e[r.filename]=r.debug_id),delete r.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([s,r])=>{n.push({type:"sourcemap",code_file:s,debug_id:r})})}function YTe(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ZTe(t,e,n){if(!t)return null;const s={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(r=>({...r,...r.data&&{data:qu(r.data,e,n)}}))},...t.user&&{user:qu(t.user,e,n)},...t.contexts&&{contexts:qu(t.contexts,e,n)},...t.extra&&{extra:qu(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&s.contexts&&(s.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(s.contexts.trace.data=qu(t.contexts.trace.data,e,n))),t.spans&&(s.spans=t.spans.map(r=>({...r,...r.data&&{data:qu(r.data,e,n)}}))),t.contexts&&t.contexts.flags&&s.contexts&&(s.contexts.flags=qu(t.contexts.flags,3,n)),s}function XTe(t,e){if(!e)return t;const n=t?t.clone():new _h;return n.update(e),n}function QTe(t){if(t)return JTe(t)?{captureContext:t}:tke(t)?{captureContext:t}:t}function JTe(t){return t instanceof _h||typeof t=="function"}const eke=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function tke(t){return Object.keys(t).some(e=>eke.includes(e))}function Xie(t,e){return jr().captureException(t,QTe(e))}function Qie(t,e){return jr().captureEvent(t,e)}function V5(t,e){xl().setContext(t,e)}function nke(t){xl().setTags(t)}function Jie(t){xl().setUser(t)}function ske(){return xl().lastEventId()}function rke(){const t=Us();return!!t&&t.getOptions().enabled!==!1&&!!t.getTransport()}function LG(t){const e=Us(),n=xl(),s=jr(),{release:r,environment:i=W9}=e&&e.getOptions()||{},{userAgent:a}=hs.navigator||{},o=wCe({release:r,environment:i,user:s.getUser()||n.getUser(),...a&&{userAgent:a},...t}),l=n.getSession();return l&&l.status==="ok"&&Lv(l,{status:"exited"}),eae(),n.setSession(o),s.setSession(o),o}function eae(){const t=xl(),e=jr(),n=e.getSession()||t.getSession();n&&_Ce(n),tae(),t.setSession(),e.setSession()}function tae(){const t=xl(),e=jr(),n=Us(),s=e.getSession()||t.getSession();s&&n&&n.captureSession(s)}function jG(t=!1){if(t){eae();return}tae()}const ike="7";function nae(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function ake(t){return`${nae(t)}${t.projectId}/envelope/`}function oke(t,e){const n={sentry_version:ike};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function lke(t,e,n){return e||`${ake(t)}?${oke(t,n)}`}function cke(t,e){const n=Gie(t);if(!n)return"";const s=`${nae(n)}embed/error-page/`;let r=`dsn=${_1(n)}`;for(const i in e)if(i!=="dsn"&&i!=="onClose")if(i==="user"){const a=e.user;if(!a)continue;a.name&&(r+=`&name=${encodeURIComponent(a.name)}`),a.email&&(r+=`&email=${encodeURIComponent(a.email)}`)}else r+=`&${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`;return`${s}?${r}`}const PG=[];function uke(t){const e={};return t.forEach(n=>{const{name:s}=n,r=e[s];r&&!r.isDefaultInstance&&n.isDefaultInstance||(e[s]=n)}),Object.values(e)}function dke(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(a=>{a.isDefaultInstance=!0});let s;if(Array.isArray(n))s=[...e,...n];else if(typeof n=="function"){const a=n(e);s=Array.isArray(a)?a:[a]}else s=e;const r=uke(s),i=r.findIndex(a=>a.name==="Debug");if(i>-1){const[a]=r.splice(i,1);r.push(a)}return r}function fke(t,e){const n={};return e.forEach(s=>{s&&sae(t,s,n)}),n}function MG(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function sae(t,e,n){if(n[e.name]){yn&&gt.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,PG.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),PG.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const s=e.preprocessEvent.bind(e);t.on("preprocessEvent",(r,i)=>s(r,i,t))}if(typeof e.processEvent=="function"){const s=e.processEvent.bind(e),r=Object.assign((i,a)=>s(i,a,t),{id:e.name});t.addEventProcessor(r)}yn&&gt.log(`Integration installed: ${e.name}`)}function hke(t,e,n){const s=[{type:"client_report"},{timestamp:rS(),discarded_events:t}];return E1(e?{dsn:e}:{},[s])}
vendor: 1,883 bytes, line 75
75class zl extends Error{constructor(e,n="warn"){super(e),this.message=e,this.logLevel=n}}const DG="Not capturing exception because it's already been captured.";class pke{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Gie(e.dsn):yn&&gt.warn("No DSN provided, client will not send events."),this._dsn){const r=lke(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}const s=["enableTracing","tracesSampleRate","tracesSampler"].find(r=>r in e&&e[r]==null);s&&qm(()=>{console.warn(`[Sentry] Deprecation warning: \`${s}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.`)})}captureException(e,n,s){const r=ec();if(pG(e))return yn&&gt.log(DG),r;const i={event_id:r,...n};return this._process(this.eventFromException(e,i).then(a=>this._captureEvent(a,i,s))),i.event_id}captureMessage(e,n,s,r){const i={event_id:ec(),...s},a=z9(e)?e:String(e),o=V9(e)?this.eventFromMessage(a,n,i):this.eventFromException(e,i);return this._process(o.then(l=>this._captureEvent(l,i,r))),i.event_id}captureEvent(e,n,s){const r=ec();if(n&&n.originalException&&pG(n.originalException))return yn&&gt.log(DG),r;const i={event_id:r,...n},o=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,i,o||s)),i.event_id}captureSession(e){typeof e.release!="string"?yn&&gt.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Lv(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;
75return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(s=>n.flush(e).then(r=>s&&r))):Am(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];sae(this,e,this._integrations),n||MG(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let s=ETe(e,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])s=mTe(s,yTe(i));const r=this.sendEnvelope(s);r&&r.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){const n=_Te(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,s){if(this._options.sendClientReports){const r=typeof s=="number"?s:1,i=`${e}:${n}`;yn&&gt.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,n){const s=this._hooks[e]=this._hooks[e]||[];return s.push(n),()=>{const r=s.indexOf(n);r>-1&&s.splice(r,1)}}emit(e,...n){const s=this._hooks[e];s&&s.forEach(r=>r(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(yn&&gt.error("Error while sending envelope:",n),n)):(yn&&gt.error("Transport disabled"),Am({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=fke(this,e),MG(this,e)}_updateSessionFromEvent(e,n){let s=n.level==="fatal",r=!1;const i=n.exception&&n.exception.values;if(i){r=!0;for(const l of i){const u=l.mechanism;if(u&&u.handled===!1){s=!0;break}}}const a=e.status==="ok";(a&&e.errors===0||a&&s)&&(Lv(e,{...s&&{status:"crashed"},errors:e.errors||Number(r||s)}),this.captureSession(e))}_isClientDoneProcessing(e){return new iS(n=>{let s=0;const r=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(s+=r,e&&s>=e&&(clearInterval(i),n(!1)))},r)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,s=jr(),r=xl()){const i=this.getOptions(),a=Object.keys(this._integrations);return!n.integrations&&a.length>0&&(n.integrations=a),this.emit("preprocessEvent",e,n),e.type||r.setLastEventId(e.event_id||n.event_id),GTe(i,e,n,s,this,r).then(o=>{if(o===null)return o;o.contexts={trace:PCe(s),...o.contexts};const l=zie(this,s);return o.sdkProcessingMetadata={dynamicSamplingContext:l,...o.sdkProcessingMetadata},o})}_captureEvent(e,n={},s){return this._processEvent(e,n,s).then(r=>r.event_id,r=>{yn&&(r instanceof zl&&r.logLevel==="log"?gt.log(r.message):gt.warn(r))})}_processEvent(e,n,s){const r=this.getOptions(),{sampleRate:i}=r,a=iae(e),o=rae(e),l=e.type||"error",u=`before send for type \`${l}\``,d=typeof i>"u"?void 0:Vie(i);if(o&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error",e),TT(new zl(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const f=l==="replay_event"?"replay":l,m=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,s,m).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",f,e),new zl("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return v;const y=gke(this,r,v,n);return mke(y,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",f,e),a){const _=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw new zl(`${u} returned \`null\`, will not send event.`,"log")}const x=s&&s.getSession();if(!a&&x&&this._updateSessionFromEvent(x,v),a){const S=v.sdkProcessingMetadata&&v.sdkProcessingMetadata.spanCountBeforeProcessing||0,_=v.spans?v.spans.length:0,E=S-_;E>0&&this.recordDroppedEvent("before_send","span",E)}const y=v.transaction_info;if(a&&y&&v.transaction!==e.transaction){const S="custom";v.transaction_info={...y,source:S}}return this.sendEvent(v,n),v}).then(null,v=>{throw v instanceof zl?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new zl(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
76Reason: ${v}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,s])=>{const[r,i]=n.split(":");return{reason:r,category:i,quantity:s}})}_flushOutcomes(){yn&&gt.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){yn&&gt.log("No outcomes to send");return}if(!this._dsn){yn&&gt.log("No dsn provided, will not send outcomes");return}yn&&gt.log("Sending outcomes:",e);const n=hke(e,this._options.tunnel&&_1(this._dsn));this.sendEnvelope(n)}}function mke(t,e){const n=`${e} must return \`null\` or a valid event.`;if(U5(t))return t.then(s=>{if(!Nv(s)&&s!==null)throw new zl(n);return s},s=>{throw new zl(`${e} rejected with ${s}`)});if(!Nv(t)&&t!==null)throw new zl(n);return t}function gke(t,e,n,s){const{beforeSend:r,beforeSendTransaction:i,beforeSendSpan:a}=e;if(rae(n)&&r)return r(n,s);if(iae(n)){if(n.spans&&a){const o=[];for(const l of n.spans){const u=a(l);u?o.push(u):(Oie(),t.recordDroppedEvent("before_send","span"))}n.spans=o}if(i){if(n.spans){const o=n.spans.length;n.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:o}}return i(n,s)}}return n}function rae(t){return t.type===void 0}function iae(t){return t.type==="transaction"}function vke(t,e){e.debug===!0&&(yn?gt.enable():qm(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),jr().update(e.initialScope);const s=new t(e);return xke(s),s.init(),s}function xke(t){jr().setClient(t)}function yke(t){const e=[];function n(){return t===void 0||e.length<t}function s(a){return e.splice(e.indexOf(a),1)[0]||Promise.resolve(void 0)}function r(a){if(!n())return TT(new zl("Not adding Promise because buffer limit was reached."));const o=a();return e.indexOf(o)===-1&&e.push(o),o.then(()=>s(o)).then(null,()=>s(o).then(null,()=>{})),o}function i(a){return new iS((o,l)=>{let u=e.length;if(!u)return o(!0);const d=setTimeout(()=>{a&&a>0&&o(!1)},a);e.forEach(f=>{Am(f).then(()=>{--u||(clearTimeout(d),o(!0))},l)})})}return{$:e,add:r,drain:i}}const bke=60*1e3;function Ske(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const s=Date.parse(`${t}`);return isNaN(s)?bke:s-e}function wke(t,e){return t[e]||t.all||0}function _ke(t,e,n=Date.now()){return wke(t,e)>n}function Eke(t,{statusCode:e,headers:n},s=Date.now()){const r={...t},i=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(i)for(const o of i.trim().split(",")){const[l,u,,,d]=o.split(":",5),f=parseInt(l,10),p=(isNaN(f)?60:f)*1e3;if(!u)r.all=s+p;else for(const m of u.split(";"))m==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(r[m]=s+p):r[m]=s+p}else a?r.all=s+Ske(a,s):e===429&&(r.all=s+60*1e3);return r}const Cke=64;function Tke(t,e,n=yke(t.bufferSize||Cke)){let s={};const r=a=>n.drain(a);function i(a){const o=[];if(_G(a,(f,p)=>{const m=EG(p);if(_ke(s,m)){const v=OG(f,p);t.recordDroppedEvent("ratelimit_backoff",m,v)}else o.push(f)}),o.length===0)return Am({});const l=E1(a[0],o),u=f=>{_G(l,(p,m)=>{const v=OG(p,m);t.recordDroppedEvent(f,EG(m),v)})},d=()=>e({body:gTe(l)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&yn&&gt.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),s=Eke(s,f),f),f=>{throw u("network_error"),f});return n.add(d).then(f=>f,f=>{if(f instanceof zl)return yn&&gt.error("Skipped sending event because buffer is full."),u("queue_overflow"),Am({});throw f})}return{send:i,flush:r}}function OG(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function kke(t,e,n=[e],s="npm"){const r=t._metadata||{};r.sdk||(r.sdk={name:`sentry.javascript.${e}`,packages:n.map(i=>({name:`${s}:@sentry/${i}`,version:fm})),version:fm}),t._metadata=r}function aae(t={}){const e=Us();if(!rke()||!e)return{};const n=Km(),s=b1(n);if(s.getTraceData)return s.getTraceData(t);const r=jr(),i=t.span||Md(),a=i?XCe(i):Rke(r),o=i?w1(i):zie(e,r),l=HCe(o);return Iie.test(a)?{"sentry-trace":a,baggage:l}:(gt.warn("Invalid sentry-trace data. Cannot generate trace data"),{})}function Rke(t){const{traceId:e,sampled:n,spanId:s}=t.getPropagationContext();return Lie(e,s,n)}const Ake=100;function tu(t,e){const n=Us(),s=xl();if(!n)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:i=Ake}=n.getOptions();if(i<=0)return;const o={timestamp:rS(),...t},l=r?qm(()=>r(o,e)):o;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),s.addBreadcrumb(l,i))}let $G;const Nke="FunctionToString",FG=new WeakMap,Ike=(()=>({name:Nke,setupOnce(){$G=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=H9(this),n=FG.has(Us())&&e!==void 0?e:this;return $G.apply(n,t)}}catch{}},setup(t){FG.set(t,!0)}})),Lke=Ike,jke=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Pke="InboundFilters",Mke=((t={})=>({name:Pke,processEvent(e,n,s){const r=s.getOptions(),i=Oke(t,r);return $ke(e,i)?null:e}})),Dke=Mke;function Oke(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:jke],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function $ke(t,e){return e.ignoreInternal&&Hke(t)?(yn&&gt.warn(`Event dropped due to being internal Sentry Error.
77Event: ${Pf(t)}`),!0):Fke(t,e.ignoreErrors)?(yn&&gt.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
78Event: ${Pf(t)}`),!0):Wke(t)?(yn&&gt.warn(`Event dropped due to not having an error message, error type or stacktrace.
79Event: ${Pf(t)}`),!0):Uke(t,e.ignoreTransactions)?(yn&&gt.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
80Event: ${Pf(t)}`),!0):Bke(t,e.denyUrls)?(yn&&gt.warn(`Event dropped due to being matched by \`denyUrls\` option.
81Event: ${Pf(t)}.
82Url: ${RT(t)}`),!0):zke(t,e.allowUrls)?!1:(yn&&gt.warn(`Event dropped due to not being matched by \`allowUrls\` option.
83Event: ${Pf(t)}.
84Url: ${RT(t)}`),!0)}function Fke(t,e){return t.type||!e||!e.length?!1:Vke(t).some(n=>pm(n,e))}function Uke(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;const n=t.transaction;return n?pm(n,e):!1}function Bke(t,e){if(!e||!e.length)return!1;const n=RT(t);return n?pm(n,e):!1}function zke(t,e){if(!e||!e.length)return!0;const n=RT(t);return n?pm(n,e):!0}function Vke(t){const e=[];t.message&&e.push(t.message);let n;try{n=t.exception.values[t.exception.values.length-1]}catch{}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),e}function Hke(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Gke(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function RT(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Gke(e):null}catch{return yn&&gt.error(`Cannot extract url for event ${Pf(t)}`),null}}function Wke(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}function qke(t,e,n=250,s,r,i,a){if(!i.exception||!i.exception.values||!a||!_d(a.originalException,Error))return;const o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Kke(lj(t,e,r,a.originalException,s,i.exception.values,o,0),n))}function lj(t,e,n,s,r,i,a,o){if(i.length>=n+1)return i;let l=[...i];if(_d(s[r],Error)){UG(a,o);const u=t(e,s[r]),d=l.length;BG(u,r,d,o),l=lj(t,e,n,s[r],r,[u,...l],u,d)}
84return Array.isArray(s.errors)&&s.errors.forEach((u,d)=>{if(_d(u,Error)){UG(a,o);const f=t(e,u),p=l.length;BG(f,`errors[${d}]`,p,o),l=lj(t,e,n,u,r,[f,...l],f,p)}}),l}function UG(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function BG(t,e,n,s){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:s}}function Kke(t,e){return t.map(n=>(n.value&&(n.value=W0(n.value,e)),n))}function q0(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",s=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:s,relative:e[5]+n+s}}function Yke(t){const e="console";nS(e,t),sS(e,Zke)}function Zke(){"console"in hs&&X8.forEach(function(t){t in hs.console&&ud(hs.console,t,function(e){return ET[t]=e,function(...n){hm("console",{args:n,level:t});const r=ET[t];r&&r.apply(hs.console,n)}})})}function Xke(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Qke="Dedupe",Jke=(()=>{let t;return{name:Qke,processEvent(e){if(e.type)return e;try{if(t5e(e,t))return yn&&gt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}}),e5e=Jke;function t5e(t,e){return e?!!(n5e(t,e)||s5e(t,e)):!1}function n5e(t,e){const n=t.message,s=e.message;return!(!n&&!s||n&&!s||!n&&s||n!==s||!lae(t,e)||!oae(t,e))}function s5e(t,e){const n=zG(e),s=zG(t);return!(!n||!s||n.type!==s.type||n.value!==s.value||!lae(t,e)||!oae(t,e))}function oae(t,e){let n=lG(t),s=lG(e);if(!n&&!s)return!0;if(n&&!s||!n&&s||(n=n,s=s,s.length!==n.length))return!1;for(let r=0;r<s.length;r++){const i=s[r],a=n[r];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function lae(t,e){let n=t.fingerprint,s=e.fingerprint;if(!n&&!s)return!0;if(n&&!s||!n&&s)return!1;n=n,s=s;try{return n.join("")===s.join("")}catch{return!1}}function zG(t){return t.exception&&t.exception.values&&t.exception.values[0]}function r5e(t,e,n,s,r="auto.http.browser"){if(!t.fetchData)return;const i=Eh()&&e(t.fetchData.url);if(t.endTimestamp&&i){const p=t.fetchData.__span;if(!p)return;const m=s[p];m&&(o5e(m,t),delete s[p]);return}const{method:a,url:o}=t.fetchData,l=a5e(o),u=l?q0(l).host:void 0,d=!!Md(),f=i&&d?K9({name:`${a} ${o}`,attributes:{url:o,type:"fetch","http.method":a,"http.url":l,"server.address":u,[Nm]:r,[$b]:"http.client"}}):new S1;if(t.fetchData.__span=f.spanContext().spanId,s[f.spanContext().spanId]=f,n(t.fetchData.url)){const p=t.args[0],m=t.args[1]||{},v=i5e(p,m,Eh()&&d?f:void 0);v&&(t.args[1]=m,m.headers=v)}return f}function i5e(t,e,n){const s=aae({span:n}),r=s["sentry-trace"],i=s.baggage;if(!r)return;const a=e.headers||(l5e(t)?t.headers:void 0);if(a)if(c5e(a)){const o=new Headers(a);if(o.set("sentry-trace",r),i){const l=o.get("baggage");if(l){const u=m_(l);o.set("baggage",u?`${u},${i}`:i)}else o.set("baggage",i)}return o}else if(Array.isArray(a)){const o=[...a.filter(l=>!(Array.isArray(l)&&l[0]==="sentry-trace")).map(l=>{if(Array.isArray(l)&&l[0]==="baggage"&&typeof l[1]=="string"){const[u,d,...f]=l;return[u,m_(d),...f]}else return l}),["sentry-trace",r]];return i&&o.push(["baggage",i]),o}else{const o="baggage"in a?a.baggage:void 0;let l=[];return Array.isArray(o)?l=o.map(u=>typeof u=="string"?m_(u):u).filter(u=>u===""):o&&l.push(m_(o)),i&&l.push(i),{...a,"sentry-trace":r,baggage:l.length>0?l.join(","):void 0}}else return{...s}}function a5e(t){try{return new URL(t).href}catch{return}}function o5e(t,e){if(e.response){Aie(t,e.response.status);const n=e.response&&e.response.headers&&e.response.headers.get("content-length");if(n){const s=parseInt(n);s>0&&t.setAttribute("http.response_content_length",s)}}else e.error&&t.setStatus({code:mi,message:"internal_error"});t.end()}function m_(t){return t.split(",").filter(e=>!e.split("=")[0].startsWith(G9)).join(",")}function l5e(t){return typeof Request<"u"&&_d(t,Request)}function c5e(t){return typeof Headers<"u"&&_d(t,Headers)}function cae(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const cj=hs;function uae(){if(!("fetch"in cj))return!1;
84try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function VG(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function u5e(){if(typeof EdgeRuntime=="string")return!0;if(!uae())return!1;if(VG(cj.fetch))return!0;let t=!1;const e=cj.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=VG(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){zh&&gt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function dae(t,e){const n="fetch";nS(n,t),sS(n,()=>fae(void 0,e))}function d5e(t){const e="fetch-body-resolved";nS(e,t),sS(e,()=>fae(h5e))}function fae(t,e=!1){e&&!u5e()||ud(hs,"fetch",function(n){return function(...s){const r=new Error,{method:i,url:a}=p5e(s),o={args:s,fetchData:{method:i,url:a},startTimestamp:cl()*1e3,virtualError:r};return t||hm("fetch",{...o}),n.apply(hs,s).then(async l=>(t?t(l):hm("fetch",{...o,endTimestamp:cl()*1e3,response:l}),l),l=>{throw hm("fetch",{...o,endTimestamp:cl()*1e3,error:l}),B9(l)&&l.stack===void 0&&(l.stack=r.stack,eu(l,"framesToPop",1)),l})}})}async function f5e(t,e){if(t&&t.body){const n=t.body,s=n.getReader(),r=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let i=!0;for(;i;){let a;try{a=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:o}=await s.read();clearTimeout(a),o&&(e(),i=!1)}catch{i=!1}finally{clearTimeout(a)}}clearTimeout(r),s.releaseLock(),n.cancel().then(null,()=>{})}}function h5e(t){let e;try{e=t.clone()}catch{return}f5e(e,()=>{hm("fetch-body-resolved",{endTimestamp:cl()*1e3,response:t})})}function uj(t,e){return!!t&&typeof t=="object"&&!!t[e]}function HG(t){return typeof t=="string"?t:t?uj(t,"url")?t.url:t.toString?t.toString():"":""}function p5e(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,s]=t;return{url:HG(n),method:uj(s,"method")?String(s.method).toUpperCase():"GET"}}const e=t[0];return{url:HG(e),method:uj(e,"method")?String(e.method).toUpperCase():"GET"}}function m5e(){return"npm"}const Wt=hs;let dj=0;function hae(){return dj>0}function g5e(){dj++,setTimeout(()=>{dj--})}function Pv(t,e={}){function n(r){return typeof r=="function"}if(!n(t))return t;try{const r=t.__sentry_wrapped__;if(r)return typeof r=="function"?r:t;if(H9(t))return t}catch{return t}const s=function(...r){try{const i=r.map(a=>Pv(a,e));return t.apply(this,i)}catch(i){throw g5e(),z5(a=>{a.addEventProcessor(o=>(e.mechanism&&(J8(o,void 0),Iv(o,e.mechanism)),o.extra={...o.extra,arguments:r},o)),Xie(i)}),i}};try{for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}catch{}wie(s,t),eu(t,"__sentry_wrapped__",s);try{Object.getOwnPropertyDescriptor(s,"name").configurable&&Object.defineProperty(s,"name",{get(){return t.name}})}catch{}return s}const ko=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Y9(t,e){const n=Z9(t,e),s={type:S5e(e),value:w5e(e)};return n.length&&(s.stacktrace={frames:n}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function v5e(t,e,n,s){const r=Us(),i=r&&r.getOptions().normalizeDepth,a=k5e(e),o={__serialized__:Wie(e,i)};if(a)return{exception:{values:[Y9(t,a)]},extra:o};const l={exception:{values:[{type:F5(e)?e.constructor.name:s?"UnhandledRejection":"Error",value:C5e(e,{isUnhandledRejection:s})}]},extra:o};if(n){const u=Z9(t,n);u.length&&(l.exception.values[0].stacktrace={frames:u})}return l}function fN(t,e){return{exception:{values:[Y9(t,e)]}}}function Z9(t,e){const n=e.stacktrace||e.stack||"",s=y5e(e),r=b5e(e);try{return t(n,s,r)}catch{}return[]}const x5e=/Minified React error #\d+;/i;function y5e(t){return t&&x5e.test(t.message)?1:0}function b5e(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function pae(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function S5e(t){const e=t&&t.name;return!e&&pae(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function w5e(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:pae(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function _5e(t,e,n,s){const r=n&&n.syntheticException||void 0,i=X9(t,e,r,s);return Iv(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Am(i)}function E5e(t,e,n="info",s,r){const i=s&&s.syntheticException||void 0,a=fj(t,e,i,r);return a.level=n,s&&s.event_id&&(a.event_id=s.event_id),Am(a)}function X9(t,e,n,s,r){let i;if(yie(e)&&e.error)return fN(t,e.error);if(uG(e)||lCe(e)){const a=e;if("stack"in e)i=fN(t,e);else{const o=a.name||(uG(a)?"DOMError":"DOMException"),l=a.message?`${o}: ${a.message}`:o;i=fj(t,l,n,s),J8(i,l)}return"code"in a&&(i.tags={...i.tags,"DOMException.code":`${a.code}`}),i}return B9(e)?fN(t,e):Nv(e)||F5(e)?(i=v5e(t,e,n,r),Iv(i,{synthetic:!0}),i):(i=fj(t,e,n,s),J8(i,`${e}`),Iv(i,{synthetic:!0}),i)}function fj(t,e,n,s){const r={};if(s&&n){const i=Z9(t,n);i.length&&(r.exception={values:[{value:e,stacktrace:{frames:i}}]}),Iv(r,{synthetic:!0})}
84if(z9(e)){const{__sentry_template_string__:i,__sentry_template_values__:a}=e;return r.logentry={message:i,params:a},r}return r.message=e,r}function C5e(t,{isUnhandledRejection:e}){const n=xCe(t),s=e?"promise rejection":"exception";return yie(t)?`Event \`ErrorEvent\` captured as ${s} with message \`${t.message}\``:F5(t)?`Event \`${T5e(t)}\` (type=${t.type}) captured as ${s}`:`Object captured as ${s} with keys: ${n}`}function T5e(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function k5e(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}function R5e(t,{metadata:e,tunnel:n,dsn:s}){const r={event_id:t.event_id,sent_at:new Date().toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!s&&{dsn:_1(s)}},i=A5e(t);return E1(r,[i])}function A5e(t){return[{type:"user_report"},t]}class N5e extends pke{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e},s=Wt.SENTRY_SDK_SOURCE||m5e();kke(n,"browser",["browser"],s),super(n),n.sendClientReports&&Wt.document&&Wt.document.addEventListener("visibilitychange",()=>{Wt.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return _5e(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",s){return E5e(this._options.stackParser,e,n,s,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){ko&&gt.warn("SDK not enabled, will not capture user feedback.");return}const n=R5e(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,s){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,s)}}const nl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ky="8.55.2",pl=globalThis;function Q9(t,e,n){const s=n||pl,r=s.__SENTRY__=s.__SENTRY__||{},i=r[Ky]=r[Ky]||{};return i[t]||(i[t]=e())}const aS=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,I5e="Sentry Logger ",GG=["debug","info","warn","error","log","assert","trace"],WG={};function mae(t){if(!("console"in pl))return t();const e=pl.console,n={},s=Object.keys(WG);s.forEach(r=>{const i=WG[r];n[r]=e[r],e[r]=i});try{return t()}finally{s.forEach(r=>{e[r]=n[r]})}}function L5e(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return aS?GG.forEach(n=>{e[n]=(...s)=>{t&&mae(()=>{pl.console[n](`${I5e}[${n}]:`,...s)})}}):GG.forEach(n=>{e[n]=()=>{}}),e}const Rr=Q9("logger",L5e),hN="<anonymous>";function gae(t){try{return!t||typeof t!="function"?hN:t.name||hN}catch{return hN}}const SC={},qG={};function J9(t,e){SC[t]=SC[t]||[],SC[t].push(e)}function eO(t,e){if(!qG[t]){qG[t]=!0;try{e()}catch(n){aS&&Rr.error(`Error while instrumenting ${t}`,n)}}}function Fb(t,e){const n=t&&SC[t];if(n)for(const s of n)try{s(e)}catch(r){aS&&Rr.error(`Error while triggering instrumentation handler.
85Type: ${t}
86Name: ${gae(s)}
87Error:`,r)}}function C1(){return tO(pl),pl}function tO(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Ky,e[Ky]=e[Ky]||{}}const j5e=Object.prototype.toString;function vae(t,e){return j5e.call(t)===`[object ${e}]`}function K0(t){return vae(t,"String")}function xae(t){return vae(t,"Object")}function P5e(t){return!!(t&&t.then&&typeof t.then=="function")}const yae=pl,M5e=80;function Ub(t,e={}){if(!t)return"<unknown>";try{let n=t;const s=5,r=[];let i=0,a=0;const o=" > ",l=o.length;let u;const d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||M5e;for(;n&&i++<s&&(u=D5e(n,d),!(u==="html"||i>1&&a+r.length*l+u.length>=f));)r.push(u),a+=u.length,n=n.parentNode;return r.reverse().join(o)}catch{return"<unknown>"}}function D5e(t,e){const n=t,s=[];if(!n||!n.tagName)return"";if(yae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}s.push(n.tagName.toLowerCase());const r=e&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(r&&r.length)r.forEach(a=>{s.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&s.push(`#${n.id}`);const a=n.className;if(a&&K0(a)){const o=a.split(/\s+/);for(const l of o)s.push(`.${l}`)}}const i=["aria-label","type","name","title","alt"];for(const a of i){const o=n.getAttribute(a);o&&s.push(`[${a}="${o}"]`)}return s.join("")}function O5e(t){if(!yae.HTMLElement)return null;let e=t;const n=5;for(let s=0;s<n;s++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function AT(t,e,n){if(!(e in t))return;const s=t[e],r=n(s);typeof r=="function"&&$5e(r,s);try{t[e]=r}catch{aS&&Rr.log(`Failed to replace method "${e}" in object`,t)}}function Ed(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{aS&&Rr.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function $5e(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Ed(t,"__sentry_original__",e)}catch{}}function Ch(t){return hj(t,new Map)}function hj(t,e){if(F5e(t)){const n=e.get(t);if(n!==void 0)return n;const s={};e.set(t,s);for(const r of Object.getOwnPropertyNames(t))typeof t[r]<"u"&&(s[r]=hj(t[r],e));return s}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const s=[];return e.set(t,s),t.forEach(r=>{s.push(hj(r,e))}),s}return t}function F5e(t){if(!xae(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const bae=1e3;function Sae(){return Date.now()/bae}function U5e(){const{performance:t}=pl;if(!t||!t.now)return Sae;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/bae}const vm=U5e(),nu=(()=>{const{performance:t}=pl;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),s=Date.now(),r=t.timeOrigin?Math.abs(t.timeOrigin+n-s):e,i=r<e,a=t.timing&&t.timing.navigationStart,l=typeof a=="number"?Math.abs(a+n-s):e,u=l<e;return i||u?r<=l?t.timeOrigin:a:s})();function xm(){const t=pl,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const s=new Uint8Array(1);return e.getRandomValues(s),s[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,s=>(s^(n()&15)>>s/4).toString(16))}function B5e(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||vm(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:xm()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),t
vendor: 5,781 bytes, line 87
87ypeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function NT(){return xm()}function IT(){return xm().substring(16)}function wae(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const s={...t};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=wae(s[r],e[r],n-1));return s}const pj="_sentrySpan";function mj(t,e){e?Ed(t,pj,e):delete t[pj]}function LT(t){return t[pj]}const z5e=100;let V5e=class _ae{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:NT(),spanId:IT()}}clone(){const e=new _ae;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,mj(e,LT(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&B5e(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[s,r]=n instanceof Bb?[n.getScopeData(),n.getRequestSession()]:xae(n)?[e,e.requestSession]:[],{tags:i,extra:a,user:o,contexts:l,level:u,fingerprint:d=[],propagationContext:f}=s||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},o&&Object.keys(o).length&&(this._user=o),u&&(this._level=u),d.length&&(this._fingerprint=d),f&&(this._propagationContext=f),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,mj(this,void 0),this._attachments=[],this.setPropagationContext({traceId:NT()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const s=typeof n=="number"?n:z5e;if(s<=0)return this;const r={timestamp:Sae(),...e};return this._breadcrumbs.push(r),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:LT(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=wae(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:IT(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const s=n&&n.event_id?n.event_id:xm();if(!this._client)return Rr.warn("No client configured on scope - will not capture exception!"),s;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...n,event_id:s},this),s}captureMessage(e,n,s){const r=s&&s.event_id?s.event_id:xm();if(!this._client)return Rr.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...s,event_id:r},this),r}captureEvent(e,n){const s=n&&n.event_id?n.event_id:xm();return this._client?(this._client.captureEvent(e,{...n,event_id:s},this),s):(Rr.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEac
87h(e=>{e(this)}),this._notifyingListeners=!1)}};const Bb=V5e;function H5e(){return Q9("defaultCurrentScope",()=>new Bb)}function G5e(){return Q9("defaultIsolationScope",()=>new Bb)}let W5e=class{constructor(e,n){let s;e?s=e:s=new Bb;let r;n?r=n:r=new Bb,this._stack=[{scope:s}],this._isolationScope=r}withScope(e){const n=this._pushScope();let s;try{s=e(n)}catch(r){throw this._popScope(),r}return P5e(s)?s.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Mv(){const t=C1(),e=tO(t);return e.stack=e.stack||new W5e(H5e(),G5e())}function q5e(t){return Mv().withScope(t)}function K5e(t,e){const n=Mv();return n.withScope(()=>
87(n.getStackTop().scope=t,e(t)))}function KG(t){return Mv().withScope(()=>t(Mv().getIsolationScope()))}function Y5e(){return{withIsolationScope:KG,withScope:q5e,withSetScope:K5e,withSetIsolationScope:(t,e)=>KG(e),getCurrentScope:()=>Mv().getScope(),getIsolationScope:()=>Mv().getIsolationScope()}}function oS(t){const e=tO(t);return e.acs?e.acs:Y5e()}function Th(){const t=C1();return oS(t).getCurrentScope()}function Eae(){const t=C1();return oS(t).getIsolationScope()}function Cae(...t){const e=C1(),n=oS(e);if(t.length===2){const[s,r]=t;return s?n.withSetScope(s,r):n.withScope(r)}return n.withScope(t[0])}function su(){return Th().getClient()}const Z5e="_sentryMetrics";function gj(t){const e=t[Z5e];if(!e)return;const n={};for(const[,[s,r]]of e)(n[s]||(n[s]=[])).push(Ch(r));return n}const jT="sentry.source",Tae="sentry.sample_rate",zb="sentry.op",Xa="sentry.origin",H5="sentry.measurement_unit",G5="sentry.measurement_value",YG="sentry.custom_span_name",X5e="sentry.profile_id",nO="sentry.exclusive_time",Q5e=0,J5e=1,e4e="sentry-",t4e=/^sentry-/;function n4e(t){const e=s4e(t);if(!e)return;const n=Object.entries(e).reduce((s,[r,i])=>{if(r.match(t4e)){const a=r.slice(e4e.length);s[a]=i}return s},{});if(Object.keys(n).length>0)return n}function s4e(t){if(!(!t||!K0(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const s=ZG(n);return Object.entries(s).forEach(([r,i])=>{e[r]=i}),e},{}):ZG(t)}function ZG(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,s])=>(n&&s&&(e[n]=s),e),{})}const kae=0,Rae=1;let XG=!1;function r4e(t){const{spanId:e,traceId:n}=t.spanContext(),{data:s,op:r,parent_span_id:i,status:a,origin:o}=Ia(t);return Ch({parent_span_id:i,span_id:e,trace_id:n,data:s,op:r,status:a,origin:o})}function Y0(t){return typeof t=="number"?QG(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?QG(t.getTime()):vm()}function QG(t){return t>9999999999?t/1e3:t}function Ia(t){if(a4e(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(i4e(t)){const{attributes:s,startTime:r,name:i,endTime:a,parentSpanId:o,status:l}=t;return Ch({span_id:e,trace_id:n,data:s,description:i,parent_span_id:o,start_timestamp:Y0(r),timestamp:Y0(a)||void 0,status:Aae(l),op:s[zb],origin:s[Xa],_metrics_summary:gj(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function i4e(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function a4e(t){return typeof t.getSpanJSON=="function"}function lS(t){const{traceFlags:e}=t.spanContext();return e===Rae}function Aae(t){if(!(!t||t.code===Q5e))return t.code===J5e?"ok":t.message||"unknown_error"}const Yy="_sentryChildSpans",vj="_sentryRootSpan";function Nae(t,e){const n=t[vj]||t;Ed(e,vj,n),t[Yy]?t[Yy].add(e):Ed(t,Yy,new Set([e]))}function o4e(t){const e=new Set;function n(s){if(!e.has(s)&&lS(s)){e.add(s);const r=s[Yy]?Array.from(s[Yy]):[];for(const i of r)n(i)}}return n(t),Array.from(e)}function tc(t){return t[vj]||t}function Zm(){const t=C1(),e=oS(t);return e.getActiveSpan?e.getActiveSpan():LT(Th())}function l4e(){XG||(mae(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),XG=!0)}const Iae="_sentryScope",Lae="_sentryIsolationScope";function c4e(t,e,n){t&&(Ed(t,Lae,n),Ed(t,Iae,e))}function JG(t){return{scope:t[Iae],isolationScope:t[Lae]}}function sO(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=su(),n=t||e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}class rO{constructor(e={}){this._traceId=e.traceId||NT(),this._spanId=e.spanId||IT()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:kae}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,s){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}const u4e="production",jae="_frozenDsc";function eW(t,e){Ed(t,jae,e)}function d4e(t,e){const n=e.getOptions(),{publicKey:s}=e.getDsn()||{},r=Ch({environment:n.environment||u4e,release:n.release,public_key:s,trace_id:t});return e.emit("createDsc",r),r}function iO(t){const e=su();if(!e)return{};const n=tc(t),s=n[jae];if(s)return s;const r=n.spanContext().traceState,i=r&&r.get("sentry.dsc"),a=i&&n4e(i);if(a)return a;const o=d4e(t.spanContext().traceId,e),l=Ia(n),u=l.data||{},d=u[Tae];d!=null&&(o.sample_rate=`${d}`);const f=u[jT],p=l.description;return f!=="url"&&p&&(o.transaction=p),sO()&&(o.sampled=String(lS(n))),e.emit("createDsc",o,n),o}function f4e(t){if(!nl)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:s}=Ia(t),{spanId:r}=t.spanContext(),i=lS(t),a=tc(t),o=a===t,l=`[Tracing] Starting ${i?"sampled":"unsampled"} ${o?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${r}`];if(s&&u.push(`parent ID: ${s}`),!o){const{op:d,description:f}=Ia(a);u.push(`root ID: ${a.spanContext().spanId}`),d&&u.push(`root op: ${d}`),f&&u.push(`root description: ${f}`)}Rr.log(`${l}
88  ${u.join(`
89  `)}`)}function h4e(t){if(!nl)return;const{description:e="< unknown name >",op:n="< unknown op >"}=Ia(t),{spanId:s}=t.spanContext(),i=tc(t)===t,a=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${s}`;Rr.log(a)}function p4e(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>
891){nl&&Rr.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function m4e(t,e){if(!sO(t))return[!1];const n=Eae().getScopeData().sdkProcessingMetadata.normalizedRequest,s={...e,normalizedRequest:e.normalizedRequest||n};let r;typeof t.tracesSampler=="function"?r=t.tracesSampler(s):s.parentSampled!==void 0?r=s.parentSampled:typeof t.tracesSampleRate<"u"?r=t.tracesSampleRate:r=1;const i=p4e(r);return i===void 0?(nl&&Rr.warn("[Tracing] Discarding transaction because of invalid sample rate."),[!1]):i?Math.random()<i?[!0,i]:(nl&&Rr.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`),[!1,i]):(nl&&Rr.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i])}function g4e(t,e=!1){const{host:n,path:s,pass:r,port:i,projectId:a,protocol:o,publicKey:l}=t;return`${o}://${l}${e&&r?`:${r}`:""}@${n}${i?`:${i}`:""}/${s&&`${s}/`}${a}
89`}function v4e(t,e=[]){return[t,e]}function x4e(t){return[{type:"span"},t]}function y4e(t,e){function n(d){return!!d.trace_id&&!!d.public_key}const s=iO(t[0]),r=e&&e.getDsn(),i=e&&e.getOptions().tunnel,a={sent_at:new Date().toISOString(),...n(s)&&{trace:s},...!!i&&r&&{dsn:g4e(r)}},o=e&&e.getOptions().beforeSendSpan,l=o?d=>{const f=o(Ia(d));return f||l4e(),f}:d=>Ia(d),u=[];for(const d of t){const f=l(d);f&&u.push(x4e(f))}return v4e(a,u)}function b4e(t,e,n,s=Zm()){const r=s&&tc(s);r&&(nl&&Rr.log(`[Measurement] Setting measurement on root span: ${t} = ${e} ${n}`),r.addEvent(t,{[G5]:e,[H5]:n}))}function tW(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const s=n.attributes||{},r=s[H5],i=s[G5];typeof r=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:r})}),e}const nW=1e3;class aO{constructor(e={}){this._traceId=e.traceId||NT(),this._spanId=e.spanId||IT(),this._startTime=e.startTimestamp||vm(),this._attributes={},this.setAttributes({[Xa]:"manual",[zb]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this}addLinks(e){return this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:s}=this;return{spanId:e,traceId:n,traceFlags:s?Rae:kae}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Y0(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(jT,"custom"),this}end(e){this._endTime||(this._endTime=Y0(e),h4e(this),this._onSpanEnded())}getSpanJSON(){return Ch({data:this._attributes,description:this._name,op:this._attributes[zb],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Aae(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Xa],_metrics_summary:gj(this),profile_id:this._attributes[X5e],exclusive_time:this._attributes[nO],measurements:tW(this._events),is_segment:this._isStandaloneSpan&&tc(this)===this||void 0,segment_id:this._isStandaloneSpan?tc(this).spanContext().spanId:void 0})}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,s){nl&&Rr.log("[Tracing] Adding an event to span:",e);const r=sW(n)?n:s||vm(),i=sW(n)?{}:n||{},a={name:e,time:Y0(r),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=su();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===tc(this)))return;if(this._isStandaloneSpan){this._sampled?w4e(y4e([this],e)):(nl&&Rr.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const s=this._convertSpanToTransaction();s&&(JG(this).scope||Th()).captureEvent(s)}_convertSpanToTransaction(){if(!rW(Ia(this)))return;this._name||(nl&&Rr.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=JG(this),r=(e||Th()).getClient()||su();if(this._sampled!==!0){nl&&Rr.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),r&&r.recordDroppedEvent("sample_rate","transaction");return}const a=o4e(this).filter(f=>f!==this&&!S4e(f)).map(f=>Ia(f)).filter(rW),o=this._attributes[jT];delete this._attributes[YG],a.forEach(f=>{f.data&&delete f.data[YG]});const l={contexts:{trace:r4e(this)},spans:a.length>nW?a.sort((f,p)=>f.start_timestamp-p.start_timestamp).slice(0,nW):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,...Ch({dynamicSamplingContext:iO(this)})},_metrics_summary:gj(this),...o&&{transaction_info:{source:o}}},u=tW(this._events);return u&&Object.keys(u).length&&(nl&&Rr.log("[Measurements] Adding measurements to transaction event",JSON.stringify(u,void 0,2)),l.measurements=u),l}}function sW(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function rW(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function S4e(t){return t instanceof aO&&t.isStandaloneSpan()}function w4e(t){const e=su();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}const Pae="__SENTRY_SUPPRESS_TRACING__";function Mae(t){const e=Oae();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=E4e(t),{forceTransaction:s,parentSpan:r}=t;return(t.scope?a=>Cae(t.scope,a):r!==void 0?a=>Dae(r,a):a=>a())(()=>{const a=Th(),o=T4e(a);return t.onlyIfParent&&!o?new rO:_4e({parentSpan:o,spanArguments:n,forceTransaction:s,scope:a})})}function Dae(t,e){const n=Oae();return n.withActiveSpan?n.withActiveSpan(t,e):Cae(s=>(mj(s,t||void 0),e(s)))}function _4e({parentSpan:t,spanArguments:e,forceTransaction:n,scope:s}
89){if(!sO())return new rO;const r=Eae();let i;if(t&&!n)i=C4e(t,s,e),Nae(t,i);else if(t){const a=iO(t),{traceId:o,spanId:l}=t.spanContext(),u=lS(t);i=iW({traceId:o,parentSpanId:l,...e},s,u),eW(i,a)}else{const{traceId:a,dsc:o,parentSpanId:l,sampled:u}={...r.getPropagationContext(),...s.getPropagationContext()};i=iW({traceId:a,parentSpanId:l,...e},s,u),o&&eW(i,o)}return f4e(i),c4e(i,s,r),i}function E4e(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const s={...n};return s.startTimestamp=Y0(t.startTime),delete s.startTime,s}return n}function Oae(){const t=C1();return oS(t)}function iW(t,e,n){const s=su(),r=s&&s.getOptions()||{},{name:i="",attributes:a}=t,[o,l]=e.getScopeData().sdkProcessingMetadata[Pae]?[!1]:m4e(r,{name:i,parentSampled:n,attributes:a,transactionContext:{name:i,parentSampled:n}}),u=new aO({...t,attributes:{[jT]:"custom",...t.attributes},sampled:o});return l!==void 0&&u.setAttribute(Tae,l),s&&s.emit("spanStart",u),u}function C4e(t,e,n){const{spanId:s,traceId:r}=t.spanContext(),i=e.getScopeData().sdkProcessingMetadata[Pae]?!1:lS(t),a=i?new aO({...n,parentSpanId:s,traceId:r,sampled:i}):new rO({traceId:r});Nae(t,a);const o=su();return o&&(o.emit("spanStart",a),n.endTimestamp&&o.emit("spanEnd",a)),a}function T4e(t){const e=LT(t);if(!e)return;const n=su();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?tc(e):e}function k4e(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",s=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:s,relative:e[5]+n+s}}function R4e(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}const g_=pl;function A4e(){const t=g_.chrome,e=t&&t.app&&t.app.runtime,n="history"in g_&&!!g_.history.pushState&&!!g_.history.replaceState;return!e&&n}const oO=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,N4e=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",T1=(t,e,n,s)=>{let r,i;return a=>{e.value>=0&&(a||s)&&(i=e.value-(r||0),(i||r===void 0)&&(r=e.value,e.delta=i,e.rating=N4e(e.value,n),t(e)))}},Jt=pl,I4e=()=>`v4-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,cS=(t=!0)=>{const e=Jt.performance&&Jt.performance.getEntriesByType&&Jt.performance.getEntriesByType("navigation")[0];if(!t||e&&e.responseStart>0&&e.responseStart<performance.now())return e},uS=()=>{const t=cS();return t&&t.activationStart||0},k1=(t,e)=>{const n=cS();let s="navigate";return n&&(Jt.document&&Jt.document.prerendering||uS()>0?s="prerender":Jt.document&&Jt.document.wasDiscarded?s="restore":n.type&&(s=n.type.replace(/_/g,"-"))),{name:t,value:typeof e>"u"?-1:e,rating:"good",delta:0,entries:[],id:I4e(),navigationType:s}},Xm=(t,e,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const s=new PerformanceObserver(r=>{Promise.resolve().then(()=>{e(r.getEntries())})});return s.observe(Object.assign({type:t,buffered:!0},n||{})),s}}catch{}},R1=t=>{const e=n=>{(n.type==="pagehide"||Jt.document&&Jt.document.visibilityState==="hidden")&&t(n)};Jt.document&&(addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0))},W5=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let Zy=-1;const L4e=()=>Jt.document.visibilityState==="hidden"&&!Jt.document.prerendering?0:1/0,PT=t=>{Jt.document.visibilityState==="hidden"&&Zy>-1&&(Zy=t.type==="visibilitychange"?t.timeStamp:0,P4e())},j4e=()=>{addEventListener("visibilitychange",PT,!0),addEventListener("prerenderingchange",PT,!0)},P4e=()=>{removeEventListener("visibilitychange",PT,!0),removeEventListener("prerenderingchange",PT,!0)},q5=()=>(Jt.document&&Zy<0&&(Zy=L4e(),j4e()),{get firstHiddenTime(){return Zy}}),dS=t=>{Jt.document&&Jt.document.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()},M4e=[1800,3e3],D4e=(t,e={})=>{dS(()=>{const n=q5(),s=k1("FCP");let r;const a=Xm("paint",o=>{o.forEach(l=>{l.name==="first-contentful-paint"&&(a.disconnect(),l.startTime<n.firstHiddenTime&&(s.value=Math.max(l.startTime-uS(),0),s.entries.push(l),r(!0)))})});a&&(r=T1(t,s,M4e,e.reportAllChanges))})},O4e=[.1,.25],$4e=(t,e={})=>{D4e(W5(()=>{const n=k1("CLS",0);let s,r=0,i=[];const a=l=>{l.forEach(u=>{if(!u.hadRecentInput){const d=i[0],f=i[i.length-1];r&&d&&f&&u.startTime-f.startTime<1e3&&u.startTime-d.startTime<5e3?(r+=u.value,i.push(u)):(r=u.value,i=[u])}}),r>
89n.value&&(n.value=r,n.entries=i,s())},o=Xm("layout-shift",a);o&&(s=T1(t,n,O4e,e.reportAllChanges),R1(()=>{a(o.takeRecords()),s(!0)}),setTimeout(s,0))}))},F4e=[100,300],U4e=(t,e={})=>{dS(()=>{const n=q5(),s=k1("FID");let r;const i=l=>{l.startTime<n.firstHiddenTime&&(s.value=l.processingStart-l.startTime,s.entries.push(l),r(!0))},a=l=>{l.forEach(i)},o=Xm("first-input",a);r=T1(t,s,F4e,e.reportAllChanges),o&&R1(W5(()=>{a(o.takeRecords()),o.disconnect()}))})};let $ae=0,pN=1/0,v_=0;const B4e=t=>{t.forEach(e=>{e.interactionId&&(pN=Math.min(pN,e.interactionId),v_=Math.max(v_,e.interactionId),$ae=v_?(v_-pN)/7+1:0)})};let xj;const z4e=()=>xj?$ae:performance.interactionCount||0,V4e=()=>{"interactionCount"in performance||xj||(xj=Xm("event",B4e,{type:"event",buffered:!0,durationThreshold:0}))},Ku=[],mN=new Map,H4e=40;let G4e=0;const W4e=()=>z4e()-G4e,q4e=()=>{const t=Math.min(Ku.length-1,Math.floor(W4e()/50));return Ku[t]},gN=10,K4e=[],Y4e=t=>{if(K4e.forEach(s=>s(t)),!(t.interactionId||t.entryType==="first-input"))return;const e=Ku[Ku.length-1],n=mN.get(t.interactionId);if(n||Ku.length<gN||e&&t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===(n.entries[0]&&n.entries[0].startTime)&&n.entries.push(t);else{const s={id:t.interactionId,latency:t.duration,entries:[t]};mN.set(s.id,s),Ku.push(s)}Ku.sort((s,r)=>r.latency-s.latency),Ku.length>gN&&Ku.splice(gN).forEach(s=>mN.delete(s.id))}},Fae=t=>{const e=Jt.requestIdleCallback||Jt.setTimeout;let n=-1;return t=W5(t),Jt.document&&Jt.document.visibilityState==="hidden"?t():(n=e(t),R1(t)),n},Z4e=[200,500],X4e=(t,e={})=>{"PerformanceEventTiming"in Jt&&"interactionId"in PerformanceEventTiming.prototype&&dS(()=>{V4e();const n=k1("INP");let s;const r=a=>{Fae(()=>{a.forEach(Y4e);const o=q4e();o&&o.latency!==n.value&&(n.value=o.latency,n.entries=o.entries,s())})},i=Xm("event",r,{durationThreshold:e.durationThreshold!=null?e.durationThreshold:H4e});s=T1(t,n,Z4e,e.reportAllChanges),i&&(i.observe({type:"first-input",buffered:!0}),R1(()=>{r(i.takeRecords()),s(!0)}))})},Q4e=[2500,4e3],aW={},J4e=(t,e={})=>{dS(()=>{const n=q5(),s=k1("LCP");let r;const i=o=>{e.reportAllChanges||(o=o.slice(-1)),o.forEach(l=>{l.startTime<n.firstHiddenTime&&(s.value=Math.max(l.startTime-uS(),0),s.entries=[l],r())})},a=Xm("largest-contentful-paint",i);if(a){r=T1(t,s,Q4e,e.reportAllChanges);const o=W5(()=>{aW[s.id]||(i(a.takeRecords()),a.disconnect(),aW[s.id]=!0,r(!0))});["keydown","click"].forEach(l=>{Jt.document&&addEventListener(l,()=>Fae(o),{once:!0,capture:!0})}),R1(o)}})},eRe=[800,1800],yj=t=>{Jt.document&&Jt.document.prerendering?dS(()=>yj(t)):Jt.document&&Jt.document.readyState!=="complete"?addEventListener("load",()=>yj(t),!0):setTimeout(t,0)},tRe=(t,e={})=>{const n=k1("TTFB"),s=T1(t,n,eRe,e.reportAllChanges);yj(()=>{const r=cS();r&&(n.value=Math.max(r.responseStart-uS(),0),n.entries=[r],s(!0))})},Xy={},MT={};let Uae,Bae,zae,Vae,Hae;function lO(t,e=!1){return fS("cls",t,sRe,Uae,e)}function Gae(t,e=!1){return fS("lcp",t,iRe,zae,e)}function Wae(t){return fS("fid",t,rRe,Bae)}function nRe(t){return fS("ttfb",t,aRe,Vae)}function qae(t){return fS("inp",t,oRe,Hae)}function Dv(t,e){return Kae(t,e),MT[t]||(lRe(t),MT[t]=!0),Yae(t,e)}function A1(t,e){const n=Xy[t];if(!(!n||!n.length))for(const s of n)try{s(e)}catch(r){oO&&Rr.error(`Error while triggering instrumentation handler.
90Type: ${t}
91Name: ${gae(s)}
92Error:`,r)}}function sRe(){return $4e(t=>{A1("cls",{metric:t}),Uae=t},{reportAllChanges:!0})}function rRe(){return U4e(t=>{A1("fid",{metric:t}),Bae=t})}function iRe(){return J4e(t=>{A1("lcp",{metric:t}),zae=t},{reportAllChanges:!0})}function aRe(){return tRe(t=>{A1("ttfb",{metric:t}),Vae=t})}function oRe(){return X4e(t=>{A1("inp",{metric:t}),Hae=t})}function fS(t,e,n,s,r=!1){Kae(t,e);let i;return MT[t]||(i=n(),MT[t]=!0),s&&e({metric:s}),Yae(t,e,r?i:void 0)}function lRe(t){const e={};t==="event"&&(e.durationThreshold=0),Xm(t,n=>{A1(t,{entries:n})},e)}function Kae(t,e){Xy[t]=Xy[t]||[],Xy[t].push(e)}function Yae(t,e,n){return()=>{n&&n();const s=Xy[t];if(!s)return;const r=s.indexOf(e);r!==-1&&s.splice(r,1)}}function cRe(t){return"duration"in t}function vN(t){return typeof t=="number"&&isFinite(t)}
92function Cd(t,e,n,{...s}){const r=Ia(t).start_timestamp;return r&&r>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),Dae(t,()=>{const i=Mae({startTime:e,...s});return i&&i.end(n),i})}function Zae(t){const e=su();if(!e)return;const{name:n,transaction:s,attributes:r,startTime:i}=t,{release:a,environment:o}=e.getOptions(),l=e.getIntegrationByName("Replay"),u=l&&l.getReplayId(),d=Th(),f=d.getUser(),p=f!==void 0?f.email||f.id||f.ip_address:void 0;let m;try{m=d.getScopeData().contexts.profile.profile_id}catch{}const v={release:a,environment:o,user:p||void 0,profile_id:m||void 0,replay_id:u||void 0,transaction:s,"user_agent.original":Jt.navigator&&Jt.navigator.userAgent,...r};return Mae({name:n,attributes:v,startTime:i,experimental:{standalone:!0}})}function cO(){return Jt&&Jt.addEventListener&&Jt.performance}function zr(t){return t/1e3}function Xae(t){let e="unknown",n="unknown",s="";for(const r of t){if(r==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(r))){e=s==="h"?"http":s,n=t.split(s)[1];break}s+=r}return s===t&&(e=s),{name:e,version:n}}function uRe(){let t=0,e,n;if(!fRe())return;let s=!1;function r(){s||(s=!0,n&&dRe(t,e,n),i())}const i=lO(({metric:a})=>{const o=a.entries[a.entries.length-1];o&&(t=a.value,e=o)},!0);R1(()=>{r()}),setTimeout(()=>{const a=su();if(!a)return;const o=a.on("startNavigationSpan",()=>{r(),o&&o()}),l=Zm(),u=l&&tc(l),d=u&&Ia(u);d&&d.op==="pageload"&&(n=u.spanContext().spanId)},0)}function dRe(t,e,n){oO&&Rr.log(`Sending CLS span (${t})`);const s=zr((nu||0)+(e&&e.startTime||0)),r=Th().getScopeData().transactionName,i=e?Ub(e.sources[0]&&e.sources[0].node):"Layout shift",a=Ch({[Xa]:"auto.http.browser.cls",[zb]:"ui.webvital.cls",[nO]:e&&e.duration||0,"sentry.pageload.span_id":n}),o=Zae({name:i,transaction:r,attributes:a,startTime:s});o&&(o.addEvent("cls",{[H5]:"",[G5]:t}),o.end(s))}function fRe(){try{return PerformanceObserver.supportedEntryTypes.includes("layout-shift")}catch{return!1}}const hRe=2147483647;let oW=0,Mi={},Ha,Qy;function pRe({recordClsStandaloneSpans:t}){const e=cO();if(e&&nu){e.mark&&Jt.performance.mark("sentry-tracing-init");const n=bRe(),s=yRe(),r=SRe(),i=t?uRe():xRe();return()=>{n(),s(),r(),i&&i()}}return()=>{}}function mRe(){Dv("longtask",({entries:t})=>{const e=Zm();if(!e)return;const{op:n,start_timestamp:s}=Ia(e);for(const r of t){const i=zr(nu+r.startTime),a=zr(r.duration);n==="navigation"&&s&&i<s||Cd(e,i,i+a,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[Xa]:"auto.ui.browser.metrics"}})}})}function gRe(){new PerformanceObserver(e=>{const n=Zm();if(n)for(const s of e.getEntries()){if(!s.scripts[0])continue;const r=zr(nu+s.startTime),{start_timestamp:i,op:a}=Ia(n);if(a==="navigation"&&i&&r<i)continue;const o=zr(s.duration),l={[Xa]:"auto.ui.browser.metrics"},u=s.scripts[0],{invoker:d,invokerType:f,sourceURL:p,sourceFunctionName:m,sourceCharPosition:v}=u;l["browser.script.invoker"]=d,l["browser.script.invoker_type"]=f,p&&(l["code.filepath"]=p),m&&(l["code.function"]=m),v!==-1&&(l["browser.script.source_char_position"]=v),Cd(n,r,r+o,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:l})}}).observe({type:"long-animation-frame",buffered:!0})}function vRe(){Dv("event",({entries:t})=>{const e=Zm();if(e){for(const n of t)if(n.name==="click"){const s=zr(nu+n.startTime),r=zr(n.duration),i={name:Ub(n.target),op:`ui.interaction.${n.name}`,startTime:s,attributes:{[Xa]:"auto.ui.browser.metrics"}},a=O5e(n.target);a&&(i.attributes["ui.component_name"]=a),Cd(e,s,s+r,i)}}})}function xRe(){return lO(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Mi.cls={value:t.value,unit:""},Qy=e)},!0)}function yRe(){return Gae(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Mi.lcp={value:t.value,unit:"millisecond"},Ha=e)},!0)}function bRe(){return Wae(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=zr(nu),s=zr(e.startTime);Mi.fid={value:t.value,unit:"millisecond"},Mi["mark.fid"]={value:n+s,unit:"second"}})}function SRe(){return nRe(({metric:t})=>{t.entries[t.entries.length-1]&&(Mi.ttfb={value:t.value,unit:"millisecond"})})}function wRe(t,e){const n=cO();if(!n||!n.getEntries||!nu)return;const s=zr(nu),r=n.getEntries(),{op:i,start_timestamp:a}=Ia(t);if(r.slice(oW).forEach(o=>{const l=zr(o.startTime),u=zr(Math.max(0,o.duration));if(!(i==="navigation"&&a&&s+l<a))switch(o.entryType){case"navigation":{ERe(t,o,s);break}case"mark":case"paint":case"measure":{_Re(t,o,l,u,s);
92const d=q5(),f=o.startTime<d.firstHiddenTime;o.name==="first-paint"&&f&&(Mi.fp={value:o.startTime,unit:"millisecond"}),o.name==="first-contentful-paint"&&f&&(Mi.fcp={value:o.startTime,unit:"millisecond"});break}case"resource":{kRe(t,o,o.name,l,u,s);break}}}),oW=Math.max(r.length-1,0),RRe(t),i==="pageload"){NRe(Mi);const o=Mi["mark.fid"];o&&Mi.fid&&(Cd(t,o.value,o.value+zr(Mi.fid.value),{name:"first input delay",op:"ui.action",attributes:{[Xa]:"auto.ui.browser.metrics"}}),delete Mi["mark.fid"]),(!("fcp"in Mi)||!e.recordClsOnPageloadSpan)&&delete Mi.cls,Object.entries(Mi).forEach(([l,u])=>{b4e(l,u.value,u.unit)}),t.setAttribute("performance.timeOrigin",s),t.setAttribute("performance.activationStart",uS()),ARe(t)}Ha=void 0,Qy=void 0,Mi={}}function _Re(t,e,n,s,r){const i=cS(!1),a=zr(i?i.requestStart:0),o=r+Math.max(n,a),l=r+n,u=l+s,d={[Xa]:"auto.resource.browser.metrics"};o!==l&&(d["sentry.browser.measure_happened_before_request"]=!0,d["sentry.browser.measure_start_time"]=o),o<=u&&Cd(t,o,u,{name:e.name,op:e.entryType,attributes:d})}function ERe(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(s=>{x_(t,e,s,n)}),x_(t,e,"secureConnection",n,"TLS/SSL"),x_(t,e,"fetch",n,"cache"),x_(t,e,"domainLookup",n,"DNS"),TRe(t,e,n)}function x_(t,e,n,s,r=n){const i=CRe(n),a=e[i],o=e[`${n}Start`];!o||!a||Cd(t,s+zr(o),s+zr(a),{op:`browser.${r}`,name:e.name,attributes:{[Xa]:"auto.ui.browser.metrics"}})}function CRe(t){return t==="secureConnection"?"connectEnd":t==="fetch"?"domainLookupStart":`${t}End`}function TRe(t,e,n){const s=n+zr(e.requestStart),r=n+zr(e.responseEnd),i=n+zr(e.responseStart);e.responseEnd&&(Cd(t,s,r,{op:"browser.request",name:e.name,attributes:{[Xa]:"auto.ui.browser.metrics"}}),Cd(t,i,r,{op:"browser.response",name:e.name,attributes:{[Xa]:"auto.ui.browser.metrics"}}))}function kRe(t,e,n,s,r,i){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const a=k4e(n),o={[Xa]:"auto.resource.browser.metrics"};xN(o,e,"transferSize","http.response_transfer_size"),xN(o,e,"encodedBodySize","http.response_content_length"),xN(o,e,"decodedBodySize","http.decoded_response_content_length");const l=e.deliveryType;l!=null&&(o["http.response_delivery_type"]=l);const u=e.renderBlockingStatus;u&&(o["resource.render_blocking_status"]=u),a.protocol&&(o["url.scheme"]=a.protocol.split(":").pop()),a.host&&(o["server.address"]=a.host),o["url.same_origin"]=n.includes(Jt.location.origin);const{name:d,version:f}=Xae(e.nextHopProtocol);o["network.protocol.name"]=d,o["network.protocol.version"]=f;const p=i+s,m=p+r;Cd(t,p,m,{name:n.replace(Jt.location.origin,""),op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",attributes:o})}function RRe(t){const e=Jt.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&t.setAttribute("connectionType",n.type),vN(n.rtt)&&(Mi["connection.rtt"]={value:n.rtt,unit:"millisecond"})),vN(e.deviceMemory)&&t.setAttribute("deviceMemory",`${e.deviceMemory} GB`),vN(e.hardwareConcurrency)&&t.setAttribute("hardwareConcurrency",String(e.hardwareConcurrency))}function ARe(t){Ha&&(Ha.element&&t.setAttribute("lcp.element",Ub(Ha.element)),Ha.id&&t.setAttribute("lcp.id",Ha.id),Ha.url&&t.setAttribute("lcp.url",Ha.url.trim().slice(0,200)),Ha.loadTime!=null&&t.setAttribute("lcp.loadTime",Ha.loadTime),Ha.renderTime!=null&&t.setAttribute("lcp.renderTime",Ha.renderTime),t.setAttribute("lcp.size",Ha.size)),Qy&&Qy.sources&&Qy.sources.forEach((e,n)=>t.setAttribute(`cls.source.${n+1}`,Ub(e.node)))}function xN(t,e,n,s){const r=e[n];r!=null&&r<hRe&&(t[s]=r)}function NRe(t){const e=cS(!1);if(!e)return;const{responseStart:n,requestStart:s}=e;s<=n&&(t["ttfb.requestTime"]={value:n-s,unit:"millisecond"})}const IRe=1e3;let lW,bj,Sj;function Qae(t){J9("dom",t),eO("dom",LRe)}function LRe(){if(!Jt.document)return;const t=Fb.bind(null,"dom"),e=cW(t,!0);Jt.document.addEventListener("click",e,!1),Jt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=Jt[n],i=r&&r.prototype;!i||!i.hasOwnProperty||!i.hasOwnProperty("addEventListener")||(AT(i,"addEventListener",function(a){return function(o,l,u){if(o==="click"||o=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},f=d[o]=d[o]||{refCount:0};if(!f.handler){const p=cW(t);f.handler=p,a.call(this,o,p,u)}f.refCount++}catch{}return a.call(this,o,l,u)}}),AT(i,"removeEventListener",function(a){return function(o,l,u){if(o==="click"||o=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},f=d[o];f&&(f.refCount--,f.refCount<=0&&(a.call(this,o,f.handler,u),f.handler=void 0,delete d[o]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,o,l,u)}}))})}function jRe(t){if(t.type!==bj)return!1;try{if(!t.target||t.target._sentryId!==Sj)return!1}catch{}return!0}function PRe(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function cW(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const s=MRe(n);if(PRe(n.type,s))return;Ed(n,"_sentryCaptured",!0),s&&!s._sentryId&&Ed(s,"_sentryId",xm());
92const r=n.type==="keypress"?"input":n.type;jRe(n)||(t({event:n,name:r,global:e}),bj=n.type,Sj=s?s._sentryId:void 0),clearTimeout(lW),lW=Jt.setTimeout(()=>{Sj=void 0,bj=void 0},IRe)}}function MRe(t){try{return t.target}catch{return null}}let y_;function K5(t){const e="history";J9(e,t),eO(e,DRe)}function DRe(){if(!A4e())return;const t=Jt.onpopstate;Jt.onpopstate=function(...n){const s=Jt.location.href,r=y_;if(y_=s,Fb("history",{from:r,to:s}),t)try{return t.apply(this,n)}catch{}};function e(n){return function(...s){const r=s.length>2?s[2]:void 0;if(r){const i=y_,a=String(r);y_=a,Fb("history",{from:i,to:a})}return n.apply(this,s)}}AT(Jt.history,"pushState",e),AT(Jt.history,"replaceState",e)}const wC={};function Jae(t){const e=wC[t];if(e)return e;let n=Jt[t];if(R4e(n))return wC[t]=n.bind(Jt);const s=Jt.document;if(s&&typeof s.createElement=="function")try{const r=s.createElement("iframe");r.hidden=!0,s.head.appendChild(r);const i=r.contentWindow;i&&i[t]&&(n=i[t]),s.head.removeChild(r)}catch(r){oO&&Rr.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,r)}return n&&(wC[t]=n.bind(Jt))}function uW(t){wC[t]=void 0}function Ov(...t){return Jae("setTimeout")(...t)}const Up="__sentry_xhr_v3__";function eoe(t){J9("xhr",t),eO("xhr",ORe)}function ORe(){if(!Jt.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,s){const r=new Error,i=vm()*1e3,a=K0(s[0])?s[0].toUpperCase():void 0,o=$Re(s[1]);if(!a||!o)return e.apply(n,s);n[Up]={method:a,url:o,request_headers:{}},a==="POST"&&o.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const u=n[Up];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:vm()*1e3,startTimestamp:i,xhr:n,virtualError:r};Fb("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,f){return l(),u.apply(d,f)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,f){const[p,m]=f,v=d[Up];return v&&K0(p)&&K0(m)&&(v.request_headers[p.toLowerCase()]=m),u.apply(d,f)}}),e.apply(n,s)}}),t.send=new Proxy(t.send,{apply(e,n,s){const r=n[Up];if(!r)return e.apply(n,s);s[0]!==void 0&&(r.body=s[0]);const i={startTimestamp:vm()*1e3,xhr:n};return Fb("xhr",i),e.apply(n,s)}})}function $Re(t){if(K0(t))return t;try{return t.toString()}catch{}}const yN=[],_C=new Map;function FRe(){if(cO()&&nu){const e=URe();return()=>{e()}}return()=>{}}const dW={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function URe(){return qae(({metric:t})=>{if(t.value==null)return;const e=t.entries.find(v=>v.duration===t.value&&dW[v.name]);if(!e)return;const{interactionId:n}=e,s=dW[e.name],r=zr(nu+e.startTime),i=zr(t.value),a=Zm(),o=a?tc(a):void 0,u=(n!=null?_C.get(n):void 0)||o,d=u?Ia(u).description:Th().getScopeData().transactionName,f=Ub(e.target),p=Ch({[Xa]:"auto.http.browser.inp",[zb]:`ui.interaction.${s}`,[nO]:e.duration}),m=Zae({name:f,transaction:d,attributes:p,startTime:r});m&&(m.addEvent("inp",{[H5]:"millisecond",[G5]:t.value}),m.end(r+i))})}function BRe(t){const e=({entries:n})=>
vendor: 5,864 bytes, line 92
92{const s=Zm(),r=s&&tc(s);n.forEach(i=>{if(!cRe(i)||!r)return;const a=i.interactionId;if(a!=null&&!_C.has(a)){if(yN.length>10){const o=yN.shift();_C.delete(o)}yN.push(a),_C.set(a,r)}})};Dv("event",e),Dv("first-input",e)}function zRe(t,e=Jae("fetch")){let n=0,s=0;function r(i){const a=i.body.length;n+=a,s++;const o={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&s<15,...t.fetchOptions};if(!e)return uW("fetch"),TT("No fetch implementation available");try{return e(t.url,o).then(l=>(n-=a,s--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return uW("fetch"),n-=a,s--,TT(l)}}return Tke(t,r)}const VRe=30,HRe=50;function wj(t,e,n,s){const r={filename:t,function:e==="<anonymous>"?Rm:e,in_app:!0};return n!==void 0&&(r.lineno=n),s!==void 0&&(r.colno=s),r}const GRe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,WRe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qRe=/\((\S*)(?::(\d+))(?::(\d+))\)/,KRe=t=>{const e=GRe.exec(t);if(e){const[,s,r,i]=e;return wj(s,Rm,+r,+i)}const n=WRe.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const a=qRe.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}const[r,i]=toe(n[1]||Rm,n[2]);return wj(i,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},YRe=[VRe,KRe],ZRe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,XRe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,QRe=t=>{const e=ZRe.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=XRe.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let s=e[3],r=e[1]||Rm;return[r,s]=toe(r,s),wj(s,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},JRe=[HRe,QRe],e3e=[YRe,JRe],t3e=mie(...e3e),toe=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,s=t.indexOf("safari-web-extension")!==-1;return n||s?[t.indexOf("@")!==-1?t.split("@")[0]:Rm,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},b_=1024,n3e="Breadcrumbs",s3e=((t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:n3e,setup(n){e.console&&Yke(o3e(n)),e.dom&&Qae(a3e(n,e.dom)),e.xhr&&eoe(l3e(n)),e.fetch&&dae(c3e(n)),e.history&&K5(u3e(n)),e.sentry&&n.on("beforeSendEvent",i3e(n))}}}),r3e=s3e;function i3e(t){return function(n){Us()===t&&tu({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Pf(n)},{event:n})}}function a3e(t,e){return function(s){if(Us()!==t)return;let r,i,a=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>b_&&(ko&&gt.warn(`\`dom.maxStringLength\` cannot exceed ${b_}, but a value of ${o} was configured. Sentry will use ${b_} instead.`),o=b_),typeof a=="string"&&(a=[a]);try{const u=s.event,d=d3e(u)?u.target:u;r=Sie(d,{keyAttrs:a,maxStringLength:o}),i=gCe(d)}catch{r="<unknown>"}if(r.length===0)return;const l={category:`ui.${s.name}`,message:r};i&&(l.data={"ui.component_name":i}),tu(l,{event:s.event,name:s.name,global:s.global})}}function o3e(t){return function(n){if(Us()!==t)return;const s={category:"console",data:{arguments:n.args,logger:"console"},level:Xke(n.level),message:dG(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)s.message=`Assertion failed: ${dG(n.args.slice(1)," ")||"console.assert"}`,s.data.arguments=n.args.slice(1);else return;tu(s,{input:n.args,level:n.level})}}function l3e(t){return function(n){if(Us()!==t)return;const{startTimestamp:s,endTimestamp:r}=n,i=n.xhr[Up];if(!s||!r||!i)return;const{method:a,url:o,status_code:l,body:u}=i,d={method:a,url:o,status_code:l},f={xhr:n.xhr,input:u,startTimestamp:s,endTimestamp:r},p=cae(l);tu({category:"xhr",data:d,type:"http",level:p},f)}}function c3e(t){return function(n){if(Us()!==t)return;const{startTimestamp:s,endTimestamp:r}=n;if(r&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const i=n.fetchData,a={data:n.error,input:n.args,startTimestamp:s,endTimestamp:r};tu({category:"fetch",data:i,level:"error",type:"http"},a)}else{const i=n.response,a={...n.fetchData,status_code:i&&i.status},o={input:n.args,response:i,startTimestamp:s,endTimestamp:r},l=cae(a.status_code);tu({category:"fetch",data:a,type:"http",level:l},o)}}}function u3e(t){return function(n){if(Us()!==t)return;let s=n.from,r=n.to;const i=q0(Wt.location.href);let a=s?q0(s):void 0;const o=q0(r);(!a||!a.path)&&(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(s=a.relative),tu({category:"navigation",data:{from:s,to:r}})}}function d3e(t){return!!t&&!!t.target}const f3e=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],h3e="BrowserApiErrors",p3e=((t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:h3e,setupOnce(){e.setTimeout&&ud(Wt,"setTimeout",fW),e.setInterval&&ud(Wt,"setInterval",fW),e.requestAnimationFrame&&ud(Wt,"requestAnimationFrame",g3e),e.XMLHttpRequest&&"XMLHttpRequest"in Wt&&ud(XMLHttpRequest.prototype,"send",v3e);const n=e.eventTarget;n&&(Array.isArray(n)?n:f3e).forEach(x3e)}}}),m3e=p3e;function fW(t){return function(...e){const n=e[0];return e[0]=Pv(n,{mechanism:{data:{function:bh(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}
92function g3e(t){return function(e){return t.apply(this,[Pv(e,{mechanism:{data:{function:"requestAnimationFrame",handler:bh(t)},handled:!1,type:"instrument"}})])}}function v3e(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&ud(n,r,function(i){const a={mechanism:{data:{function:r,handler:bh(i)},handled:!1,type:"instrument"}},o=H9(i);return o&&(a.mechanism.data.handler=bh(o)),Pv(i,a)})}),t.apply(this,e)}}function x3e(t){const n=Wt[t],s=n&&n.prototype;!s||!s.hasOwnProperty||!s.hasOwnProperty("addEventListener")||(ud(s,"addEventListener",function(r){return function(i,a,o){try{y3e(a)&&(a.handleEvent=Pv(a.handleEvent,{mechanism:{data:{function:"handleEvent",handler:bh(a),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Pv(a,{mechanism:{data:{function:"addEventListener",handler:bh(a),target:t},handled:!1,type:"instrument"}}),o])}}),ud(s,"removeEventListener",function(r){return function(i,a,o){try{const l=a.__sentry_wrapped__;l&&r.call(this,i,l,o)}catch{}return r.call(this,i,a,o)}}))}function y3e(t){return typeof t.handleEvent=="function"}const b3e=()=>({name:"BrowserSession",setupOnce(){if(typeof Wt.document>"u"){ko&&gt.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}LG({ignoreDuration:!0}),jG(),K5(({from:t,to:e})=>{t!==void 0&&t!==e&&(LG({ignoreDuration:!0}),jG())})}}),S3e="GlobalHandlers",w3e=((t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:S3e,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(E3e(n),hW("onerror")),e.onunhandledrejection&&(C3e(n),hW("onunhandledrejection"))}}}),_3e=w3e;function E3e(t){gie(e=>{const{stackParser:n,attachStacktrace:s}=noe();if(Us()!==t||hae())return;const{msg:r,url:i,line:a,column:o,error:l}=e,u=R3e(X9(n,l||r,void 0,s,!1),i,a,o);u.level="error",Qie(u,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function C3e(t){vie(e=>{const{stackParser:n,attachStacktrace:s}=noe();if(Us()!==t||hae())return;const r=T3e(e),i=V9(r)?k3e(r):X9(n,r,void 0,s,!0);i.level="error",Qie(i,{originalException:r,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function T3e(t){if(V9(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function k3e(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function R3e(t,e,n,s){const r=t.exception=t.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{},o=a.stacktrace=a.stacktrace||{},l=o.frames=o.frames||[],u=s,d=n,f=Db(e)&&e.length>0?e:pCe();return l.length===0&&l.push({colno:u,filename:f,function:Rm,in_app:!0,lineno:d}),t}function hW(t){ko&&gt.log(`Global Handler attached: ${t}`)}function noe(){const t=Us();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const A3e=()=>({name:"HttpContext",preprocessEvent(t){if(!Wt.navigator&&!Wt.location&&!Wt.document)return;const e=t.request&&t.request.url||Wt.location&&Wt.location.href,{referrer:n}=Wt.document||{},{userAgent:s}=Wt.navigator||{},r={...t.request&&t.request.headers,...n&&{Referer:n},...s&&{"User-Agent":s}},i={...t.request,...e&&{url:e},headers:r};t.request=i}}),N3e="cause",I3e=5,L3e="LinkedErrors",j3e=((t={})=>{const e=t.limit||I3e,n=t.key||N3e;return{name:L3e,preprocessEvent(s,r,i){const a=i.getOptions();qke(Y9,a.stackParser,a.maxValueLength,n,e,s,r)}}}),P3e=j3e;function M3e(t){const e=[Dke(),Lke(),m3e(),r3e(),_3e(),P3e(),e5e(),A3e()];return t.autoSessionTracking!==!1&&e.push(b3e()),e}function D3e(t={}){const e={defaultIntegrations:M3e(t),release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Wt.SENTRY_RELEASE&&Wt.SENTRY_RELEASE.id?Wt.SENTRY_RELEASE.id:void 0,autoSessionTracking:!0,sendClientReports:!0};return t.defaultIntegrations==null&&delete t.defaultIntegrations,{...e,...t}}function O3e(){const t=typeof Wt.window<"u"&&Wt;if(!t)return!1;const e=t.chrome?"chrome":"browser",n=t[e],s=n&&n.runtime&&n.runtime.id,r=Wt.location&&Wt.location.href||"",i=["chrome-extension:","moz-extension:","ms-browser-extension:","safari-web-extension:"],a=!!s&&Wt===Wt.top&&i.some(l=>r.startsWith(`${l}//`)),o=typeof t.nw<"u";return!!s&&!a&&!o}function $3e(t={}){const e=D3e(t);if(!e.skipBrowserExtensionCheck&&O3e()){qm(()=>{console.error("[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")});return}ko&&(uae()||gt.warn("No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill."));const n={...e,stackParser:rCe(e.stackParser||t3e),integrations:dke(e),transport:e.transport||zRe};return vke(N5e,n)}function F3e(t={}){if(!Wt.document){ko&&gt.error("Global document not defined in showReportDialog call");return}const e=jr(),n=e.getClient(),s=n&&n.getDsn();if(!s){ko&&gt.error("DSN not configured for showReportDialog call");return}if(e&&(t.user={...e.getUser(),...t.user}),!t.eventId){const o=ske();o&&(t.eventId=o)}const r=Wt.document.createElement("script");r.async=!0,r.crossOrigin="anonymous",r.src=cke(s,t),t.onLoad&&(r.onload=t.onLoad);const{onClose:i}=t;if(i){const o=l=>{if(l.data==="__sentry_reportdialog_closed__")try{i()}finally{Wt.removeEventListener("message",o)}};Wt.addEventListener("message",o)}const a=Wt.document.head||Wt.document.body;a?a.appendChild(r):ko&&gt.error("Not injecting report dialog. No injection point found in HTML")}const soe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Jy="8.55.2",Qa=globalThis;function Y5(t,e,n){const s=Qa,r=s.__SENTRY__=s.__SENTRY__||{},i=r[Jy]=r[Jy]||{};return i[t]||(i[t]=e())}const uO=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,U3e="Sentry Logger ",pW=["debug","info","warn","error","log","assert","trace"],mW={};function dO(t){if(!("console"in Qa))return t();const e=Qa.console,n={},s=Object.keys(mW);
92s.forEach(r=>{const i=mW[r];n[r]=e[r],e[r]=i});try{return t()}finally{s.forEach(r=>{e[r]=n[r]})}}function B3e(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return uO?pW.forEach(n=>{e[n]=(...s)=>{t&&dO(()=>{Qa.console[n](`${U3e}[${n}]:`,...s)})}}):pW.forEach(n=>{e[n]=()=>{}}),e}const Kc=Y5("logger",B3e),bN="<anonymous>";function z3e(t){try{return!t||typeof t!="function"?bN:t.name||bN}catch{return bN}}function Z5(){return fO(Qa),Qa}function fO(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Jy,e[Jy]=e[Jy]||{}}const roe=Object.prototype.toString;function V3e(t){switch(roe.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return X5(t,Error)}}function hO(t,e){return roe.call(t)===`[object ${e}]`}function DT(t){return hO(t,"String")}function pO(t){return hO(t,"Object")}function H3e(t){return typeof Event<"u"&&X5(t,Event)}function G3e(t){return typeof Element<"u"&&X5(t,Element)}function W3e(t){return hO(t,"RegExp")}function mO(t){return!!(t&&t.then&&typeof t.then=="function")}function q3e(t){return pO(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function X5(t,e){try{return t instanceof e}catch{return!1}}function K3e(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}const ioe=Qa,Y3e=80;function gO(t,e={}){if(!t)return"<unknown>";try{let n=t;const s=5,r=[];let i=0,a=0;const o=" > ",l=o.length;let u;const d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Y3e;for(;n&&i++<s&&(u=Z3e(n,d),!(u==="html"||i>1&&a+r.length*l+u.length>=f));)r.push(u),a+=u.length,n=n.parentNode;return r.reverse().join(o)}catch{return"<unknown>"}}function Z3e(t,e){const n=t,s=[];if(!n||!n.tagName)return"";if(ioe.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}s.push(n.tagName.toLowerCase());const r=e&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(r&&r.length)r.forEach(a=>{s.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&s.push(`#${n.id}`);const a=n.className;if(a&&DT(a)){const o=a.split(/\s+/);for(const l of o)s.push(`.${l}`)}}const i=["aria-label","type","name","title","alt"];for(const a of i){const o=n.getAttribute(a);o&&s.push(`[${a}="${o}"]`)}return s.join("")}function X3e(){try{return ioe.document.location.href}catch{return""}}function SN(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Q3e(t,e,n=!1){return DT(t)?W3e(e)?e.test(t):DT(e)?n?t===e:t.includes(e):!1:!1}function J3e(t,e=[],n=!1){return e.some(s=>Q3e(t,s,n))}function eAe(t,e,n){if(!(e in t))return;const s=t[e],r=n(s);typeof r=="function"&&tAe(r,s);try{t[e]=r}catch{uO&&Kc.log(`Failed to replace method "${e}" in object`,t)}}function aoe(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{uO&&Kc.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function tAe(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,aoe(t,"__sentry_original__",e)}catch{}}function nAe(t){if(V3e(t))return{message:t.message,name:t.name,stack:t.stack,...vW(t)};if(H3e(t)){const e={type:t.type,target:gW(t.target),currentTarget:gW(t.currentTarget),...vW(t)};return typeof CustomEvent<"u"&&X5(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function gW(t){try{return G3e(t)?gO(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function vW(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function Zl(t){return _j(t,new Map)}function _j(t,e){if(sAe(t)){const n=e.get(t);if(n!==void 0)return n;const s={};e.set(t,s);for(const r of Object.getOwnPropertyNames(t))typeof t[r]<"u"&&(s[r]=_j(t[r],e));return s}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const s=[];return e.set(t,s),t.forEach(r=>{s.push(_j(r,e))}),s}return t}function sAe(t){if(!pO(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const ooe=1e3;function Q5(){return Date.now()/ooe}function rAe(){const{performance:t}=Qa;if(!t||!t.now)return Q5;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/ooe}const loe=rAe(),iAe=(()=>{const{performance:t}=Qa;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),s=Date.now(),r=t.timeOrigin?Math.abs(t.timeOrigin+n-s):e,i=r<e,a=t.timing&&t.timing.navigationStart,l=typeof a=="number"?Math.abs(a+n-s):e,u=l<e;return i||u?r<=l?t.timeOrigin:a:s})();function fh(){const t=Qa,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const s=new Uint8Array(1);return e.getRandomValues(s),s[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,s=>(s^(n()&15)>>s/4).toString(16))}function aAe(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function oAe(t,e){const n=aAe(t);if(!n)return;const s={type:"generic",handled:!0},r=n.mechanism;if(n.mechanism={...s,...r,...e},e&&"data"in e){const i={...r&&r.data,...e.data};n.mechanism.data=i}}var Yu;
92(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const s=2;t[t.REJECTED=s]="REJECTED"})(Yu||(Yu={}));function xW(t){return new ed(e=>{e(t)})}class ed{constructor(e){ed.prototype.__init.call(this),ed.prototype.__init2.call(this),ed.prototype.__init3.call(this),ed.prototype.__init4.call(this),this._state=Yu.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new ed((s,r)=>{this._handlers.push([!1,i=>{if(!e)s(i);else try{s(e(i))}catch(a){r(a)}},i=>{if(!n)r(i);else try{s(n(i))}catch(a){r(a)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new ed((n,s)=>{let r,i;return this.then(a=>{i=!1,r=a,e&&e()},a=>{i=!0,r=a,e&&e()}).then(()=>{if(i){s(r);return}n(r)})})}__init(){this._resolve=e=>{this._setResult(Yu.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Yu.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===Yu.PENDING){if(mO(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Yu.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Yu.RESOLVED&&n[1](this._value),this._state===Yu.REJECTED&&n[2](this._value),n[0]=!0)})}}}function lAe(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||loe(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:fh()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function yW(){return fh()}function Ej(){return fh().substring(16)}function J5(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&e&&Object.keys(e).length===0)return t;const s={...t};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=J5(s[r],e[r],n-1));return s}const Cj="_sentrySpan";function bW(t,e){e?aoe(t,Cj,e):delete t[Cj]}function Tj(t){return t[Cj]}const cAe=100;class vO{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:yW(),spanId:Ej()}}clone(){const e=new vO;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,bW(e,Tj(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&lAe(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[s,r]=n instanceof Im?[n.getScopeData(),n.getRequestSession()]:pO(n)?[e,e.requestSession]:[],{tags:i,extra:a,user:o,contexts:l,level:u,fingerprint:d=[],propagationContext:f}=s||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},o&&Object.keys(o).length&&(this._user=o),u&&(this._level=u),d.length&&(this._fingerprint=d),f&&(this._propagationContext=f),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,bW(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yW()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const s=typeof n=="number"?n:cAe;if(s<=0)return this;const r={timestamp:Q5(),...e};return this._breadcrumbs.push(r),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),this._client&&this._client.re
92cordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Tj(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=J5(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Ej(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,n){const s=n&&n.event_id?n.event_id:fh();if(!this._client)return Kc.warn("No client configured on scope - will not capture exception!"),s;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...n,event_id:s},this),s}captureMessage(e,n,s){const r=s&&s.event_id?s.event_id:fh();if(!this._client)return Kc.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...s,event_id:r},this),r}captureEvent(e,n){const s=n&&n.event_id?n.event_id:fh();return this._client?(this._client.captureEvent(e,{...n,event_id:s},this),s):(Kc.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const Im=vO;function uAe(){return Y5("defaultCurrentScope",()=>new Im)}function dAe(){return Y5("defaultIsolationScope",()=>new Im)}class fAe{constructor(e,n){let s;e?s=e:s=new Im;let r;n?r=n:r=new Im,this._stack=[{scope:s}],this._isolationScope=r}withScope(e){const n=this._pushScope();let s;try{s=e(n)}catch(r){throw this._popScope(),r}return mO(s)?s.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function $v(){const t=Z5(),e=fO(t);return e.stack=e.stack||new fAe(uAe(),dAe())}function hAe(t){return $v().withScope(t)}function pAe(t,e){const n=$v();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function SW(t){return $v().withScope(()=>t($v().getIsolationScope()))}function mAe(){return{withIsolationScope:SW,withScope:hAe,withSetScope:pAe,withSetIsolationScope:(t,e)=>SW(e),getCurrentScope:()=>$v().getScope(),getIsolationScope:()=>$v().getIsolationScope()}}function xO(t){const e=fO(t);return e.acs?e.acs:mAe()}function hS(){const t=Z5();return xO(t).getCurrentScope()}function e4(){const t=Z5();return xO(t).getIsolationScope()}function gAe(){return Y5("globalScope",()=>new Im)}function fu(){return hS().getClient()}const vAe="_sentryMetrics";function xAe(t){const e=t[vAe];if(!e)return;const n={};for(const[,[s,r]]of e)(n[s]||(n[s]=[])).push(Zl(r));return n}const coe="sentry.source",yAe="sentry.sample_rate",bAe="sentry.op",SAe="sentry.origin",wAe=0,_Ae=1,EAe="sentry-",CAe=/^sentry-/;function TAe(t){const e=kAe(t);if(!e)return;const n=Object.entries(e).reduce((s,[r,i])=>{if(r.match(CAe)){const a=r.slice(EAe.length);s[a]=i}return s},{});if(Object.keys(n).length>0)return n}function kAe(t){if(!(!t||!DT(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const s=wW(n);return Object.entries(s).forEach(([r,i])=>{e[r]=i}),e},{}):wW(t)}function wW(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,s])=>(n&&s&&(e[n]=s),e),{})}const RAe=1;function AAe(t){const{spanId:e,traceId:n,isRemote:s}=t.spanContext(),r=s?e:Vb(t).parent_span_id,i=s?Ej():e;return Zl({parent_span_id:r,span_id:i,trace_id:n})}function _W(t){return typeof t=="number"?EW(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?EW(t.getTime()):loe()}function EW(t){return t>9999999999?t/1e3:t}function Vb(t){if(IAe(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(NAe(t)){const{attributes:s,startTime:r,name:i,endTime:a,parentSpanId:o,status:l}=t;return Zl({span_id:e,trace_id:n,data:s,description:i,parent_span_id:o,start_timestamp:_W(r),timestamp:_W(a)||void 0,status:jAe(l),op:s[bAe],origin:s[SAe],_metrics_summary:xAe(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function NAe(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function IAe(t){return typeof t.getSpanJSON=="function"}function LAe(t){const{traceFlags:e}=t.spanContext();return e===RAe}function jAe(t){if(!(!t||t.code===wAe))return t.code===_Ae?"ok":t.message||"unknown_error"}const PAe="_sentryRootSpan";function yO(t){return t[PAe]||t}function uoe(){const t=Z5(),e=xO(t);return e.getActiveSpan?e.getActiveSpan():Tj(hS())}function MAe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=fu(),n=e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}const doe="production",DAe="_frozenDsc";function OAe(t,e){const n=e.getOptions(),{publicKey:s}=e.getDsn()||{},r=Zl({environment:n.environment||doe,release:n.release,public_key:s,trace_id:t});return e.emit("createDsc",r),r}function foe(t){const e=fu();if(!e)return{};const n=yO(t),s=n[DAe];if(s)return s;const r=n.spanContext().traceState,i=r&&r.get("sentry.dsc"),a=i&&TAe(i);if(a)return a;const o=OAe(t.spanContext().traceId,e),l=Vb(n),u=l.data||{},d=u[yAe];d!=null&&(o.sample_rate=`${d}`);const f=u[coe],p=l.description;
vendor: 6,304 bytes, line 92
92return f!=="url"&&p&&(o.transaction=p),MAe()&&(o.sampled=String(LAe(n))),e.emit("createDsc",o,n),o}function CW(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){soe&&Kc.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function $Ae(t,e=!1){const{host:n,path:s,pass:r,port:i,projectId:a,protocol:o,publicKey:l}=t;return`${o}://${l}${e&&r?`:${r}`:""}@${n}${i?`:${i}`:""}/${s&&`${s}/`}${a}`}function FAe(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(r){if(t)return e.has(r)?!0:(e.add(r),!1);for(let i=0;i<e.length;i++)if(e[i]===r)return!0;return e.push(r),!1}function s(r){if(t)e.delete(r);else for(let i=0;i<e.length;i++)if(e[i]===r){e.splice(i,1);break}}return[n,s]}function Zu(t,e=100,n=1/0){try{return kj("",t,e,n)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function kj(t,e,n=1/0,s=1/0,r=FAe()){const[i,a]=r;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=UAe(t,e);if(!o.startsWith("[object "))return o;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return o.replace("object ","");if(i(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const m=u.toJSON();return kj("",m,l-1,s,r)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const p=nAe(e);for(const m in p){if(!Object.prototype.hasOwnProperty.call(p,m))continue;if(f>=s){d[m]="[MaxProperties ~]";break}const v=p[m];d[m]=kj(m,v,l-1,s,r),f++}return a(e),d}function UAe(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(K3e(e))return"[VueViewModel]";if(q3e(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${z3e(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=BAe(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function BAe(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function zAe(t,e=[]){return[t,e]}function VAe(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function HAe(t,e,n,s){const r=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&s&&{dsn:$Ae(s)},...r&&{trace:Zl({...r})}}}function Rj(t,e,n,s=0){return new ed((r,i)=>{const a=t[s];if(e===null||typeof a!="function")r(e);else{const o=a({...e},n);soe&&a.id&&o===null&&Kc.log(`Event processor "${a.id}" dropped event`),mO(o)?o.then(l=>Rj(t,l,n,s+1).then(r)).then(null,i):Rj(t,o,n,s+1).then(r).then(null,i)}})}let S_,TW,w_;function GAe(t){const e=Qa._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return w_&&n.length===TW||(TW=n.length,w_=n.reduce((s,r)=>{S_||(S_={});const i=S_[r];if(i)s[i[0]]=i[1];else{const a=t(r);for(let o=a.length-1;o>=0;o--){const l=a[o],u=l&&l.filename,d=e[r];if(u&&d){s[u]=d,S_[r]=[u,d];break}}}return s},{})),w_}function WAe(t,e){const{fingerprint:n,span:s,breadcrumbs:r,sdkProcessingMetadata:i}=e;qAe(t,e),s&&ZAe(t,s),XAe(t,n),KAe(t,r),YAe(t,i)}function kW(t,e){const{extra:n,tags:s,user:r,contexts:i,level:a,sdkProcessingMetadata:o,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:v}=e;__(t,"extra",n),__(t,"tags",s),__(t,"user",r),__(t,"contexts",i),t.sdkProcessingMetadata=J5(t.sdkProcessingMetadata,o,2),a&&(t.level=a),m&&(t.transactionName=m),v&&(t.span=v),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,...p}}function __(t,e,n){t[e]=J5(t[e],n,1)}function qAe(t,e){const{extra:n,tags:s,user:r,contexts:i,level:a,transactionName:o}=e,l=Zl(n);l&&Object.keys(l).length&&(t.extra={...l,...t.extra});const u=Zl(s);u&&Object.keys(u).length&&(t.tags={...u,...t.tags});const d=Zl(r);d&&Object.keys(d).length&&(t.user={...d,...t.user});const f=Zl(i);f&&Object.keys(f).length&&(t.contexts={...f,...t.contexts}),a&&(t.level=a),o&&t.type!=="transaction"&&(t.transaction=o)}function KAe(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function YAe(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function ZAe(t,e){t.contexts={trace:AAe(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:foe(e),...t.sdkProcessingMetadata};const n=yO(e),s=Vb(n).description;s&&!t.transaction&&t.type==="transaction"&&(t.transaction=s)}function XAe(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function QAe(t,e,n,s,r,i){const{normalizeDepth:a=3,normalizeMaxBreadth:o=1e3}=t,l={...e,event_id:e.event_id||n.event_id||fh(),timestamp:e.timestamp||Q5()},u=n.integrations||t.integrations.map(y=>y.name);JAe(l,t),nNe(l,u),r&&r.emit("applyFrameMetadata",e),e.type===void 0&&eNe(l,t.stackParser);const d=rNe(s,n.captureContext);n.mechanism&&oAe(l,n.mechanism);const f=r?r.getEventProcessors():[],p=gAe().getScopeData();if(i){const y=i.getScopeData();kW(p,y)}if(d){const y=d.getScopeData();kW(p,y)}const m=[...n.attachments||[],...p.attachments];m.length&&(n.attachments=m),WAe(l,p);const v=[...f,...p.eventProcessors];return Rj(v,l,n).then(y=>(y&&tNe(y),typeof a=="number"&&a>0?sNe(y,a,o):y))}function JAe(t,e){const{environment:n,release:s,dist:r,maxValueLength:i=250}=e;t.environment=t.environment||n||doe,!t.release&&s&&(t.release=s),!t.dist&&r&&(t.dist=r),t.message&&(t.message=SN(t.message,i));const a=t.exception&&t.exception.values&&t.exception.values[0];
92a&&a.value&&(a.value=SN(a.value,i));const o=t.request;o&&o.url&&(o.url=SN(o.url,i))}function eNe(t,e){const n=GAe(e);try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(r=>{n&&r.filename&&(r.debug_id=n[r.filename])})})}catch{}}function tNe(t){const e={};try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(r=>{r.debug_id&&(r.abs_path?e[r.abs_path]=r.debug_id:r.filename&&(e[r.filename]=r.debug_id),delete r.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([s,r])=>{n.push({type:"sourcemap",code_file:s,debug_id:r})})}function nNe(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function sNe(t,e,n){if(!t)return null;const s={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(r=>({...r,...r.data&&{data:Zu(r.data,e,n)}}))},...t.user&&{user:Zu(t.user,e,n)},...t.contexts&&{contexts:Zu(t.contexts,e,n)},...t.extra&&{extra:Zu(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&s.contexts&&(s.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(s.contexts.trace.data=Zu(t.contexts.trace.data,e,n))),t.spans&&(s.spans=t.spans.map(r=>({...r,...r.data&&{data:Zu(r.data,e,n)}}))),t.contexts&&t.contexts.flags&&s.contexts&&(s.contexts.flags=Zu(t.contexts.flags,3,n)),s}function rNe(t,e){if(!e)return t;const n=t?t.clone():new Im;return n.update(e),n}function iNe(t,e){return hS().captureException(t,void 0)}function aNe(t,e){e4().setContext(t,e)}function oNe(t){e4().addEventProcessor(t)}const lNe=60*1e3;function cNe(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const s=Date.parse(`${t}`);return isNaN(s)?lNe:s-e}function uNe(t,e){return t[e]||t.all||0}function dNe(t,e,n=Date.now()){return uNe(t,e)>n}function fNe(t,{statusCode:e,headers:n},s=Date.now()){const r={...t},i=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(i)for(const o of i.trim().split(",")){const[l,u,,,d]=o.split(":",5),f=parseInt(l,10),p=(isNaN(f)?60:f)*1e3;if(!u)r.all=s+p;else for(const m of u.split(";"))m==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(r[m]=s+p):r[m]=s+p}else a?r.all=s+cNe(a,s):e===429&&(r.all=s+60*1e3);return r}function hNe(t,e){const n=e&&e.getDsn(),s=e&&e.getOptions().tunnel;return mNe(t,n)||pNe(t,s)}function pNe(t,e){return e?RW(t)===RW(e):!1}function mNe(t,e){return e?t.includes(e.host):!1}function RW(t){return t[t.length-1]==="/"?t.slice(0,-1):t}const gNe=100;function vNe(t,e){const n=fu(),s=e4();if(!n)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:i=gNe}=n.getOptions();if(i<=0)return;const o={timestamp:Q5(),...t},l=r?dO(()=>r(o,e)):o;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),s.addBreadcrumb(l,i))}function xNe(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}function yNe(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function bNe(){return!yNe()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function AW(){return typeof window<"u"&&(!bNe()||SNe())}function SNe(){const t=Qa.process;return!!t&&t.type==="renderer"}function wNe(t,e){return t??e()}function EC(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const Vs=Qa,bO="sentryReplaySession",_Ne="replay_event",SO="Unable to send Replay",ENe=3e5,CNe=9e5,TNe=5e3,kNe=5500,RNe=6e4,ANe=5e3,NNe=3,NW=15e4,E_=5e3,INe=3e3,LNe=300,wO=2e7,jNe=4999,PNe=15e3,IW=36e5;function Aj(t,e){return t??e()}function Hb(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}var li;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(li||(li={}));function MNe(t){return t.nodeType===t.ELEMENT_NODE}function eb(t){const e=Hb([t,"optionalAccess",n=>n.host]);return Hb([e,"optionalAccess",n=>n.shadowRoot])===t}function tb(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function DNe(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function ONe(t){const{cssText:e}=t;if(e.split('"').length<3)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return t.layerName===""?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function OT(t){try{const e=t.rules||t.cssRules;return e?DNe(Array.from(e,hoe).join("")):null}catch{return null}}function $Ne(t){let e="";for(let n=0;n<t.style.length;n++){const s=t.style,r=s[n],i=s.getPropertyPriority(r);e+=`${r}:${s.getPropertyValue(r)}${i?" !important":""};`}return`${t.selectorText} { ${e} }`}function hoe(t){let e;if(UNe(t))try{e=OT(t.styleSheet)||ONe(t)}catch{}else if(BNe(t)){let n=t.cssText;const s=t.selectorText.includes(":"),r=typeof t.style.all=="string"&&t.style.all;if(r&&(n=$Ne(t)),s&&(n=FNe(n)),s||r)return n}return e||t.cssText}function FNe(t){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function UNe(t){return"styleSheet"in t}function BNe(t){return"selectorText"in t}let poe=class{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;
92const n=Hb([this,"access",s=>s.getMeta,"call",s=>s(e),"optionalAccess",s=>s.id]);return Aj(n,()=>-1)}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function zNe(){return new poe}function t4({maskInputOptions:t,tagName:e,type:n}){return e==="OPTION"&&(e="SELECT"),!!(t[e.toLowerCase()]||n&&t[n]||n==="password"||e==="INPUT"&&!n&&t.text)}function Gb({isMasked:t,element:e,value:n,maskInputFn:s}){let r=n||"";return t?(s&&(r=s(r,e)),"*".repeat(r.length)):r}function Fv(t){return t.toLowerCase()}function Nj(t){return t.toUpperCase()}const LW="__rrweb_original__";function VNe(t){const e=t.getContext("2d");if(!e)return!0;const n=50;for(let s=0;s<t.width;s+=n)for(let r=0;r<t.height;r+=n){const i=e.getImageData,a=LW in i?i[LW]:i;if(new Uint32Array(a.call(e,s,r,Math.min(n,t.width-s),Math.min(n,t.height-r)).data.buffer).some(l=>l!==0))return!1}return!0}function _O(t){const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Fv(e):null}function $T(t,e,n){return e==="INPUT"&&(n==="radio"||n==="checkbox")?t.getAttribute("value")||"":t.value}function moe(t,e){let n;try{n=new URL(t,Aj(e,()=>window.location.href))}catch{return null}const s=/\.([0-9a-z]+)(?:$)/i,r=n.pathname.match(s);return Aj(Hb([r,"optionalAccess",i=>i[1]]),()=>null)}const jW={};function goe(t){const e=jW[t];if(e)return e;const n=window.document;let s=window[t];if(n&&typeof n.createElement=="function")try{const r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r);const i=r.contentWindow;i&&i[t]&&(s=i[t]),n.head.removeChild(r)}catch{}return jW[t]=s.bind(window)}function Ij(...t){return goe("setTimeout")(...t)}function voe(...t){return goe("clearTimeout")(...t)}function xoe(t){try{return t.contentDocument}catch{}}let HNe=1;const GNe=new RegExp("[^a-z0-9-_:]"),Wb=-2;function EO(){return HNe++}function WNe(t){if(t instanceof HTMLFormElement)return"form";const e=Fv(t.tagName);return GNe.test(e)?"div":e}function qNe(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}let Fg,PW;const KNe=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,YNe=/^(?:[a-z+]+:)?\/\//i,ZNe=/^www\..*/i,XNe=/^(data:)([^,]*),(.*)/i;function FT(t,e){return(t||"").replace(KNe,(n,s,r,i,a,o)=>{const l=r||a||o,u=s||i||"";if(!l)return n;if(YNe.test(l)||ZNe.test(l))return`url(${u}${l}${u})`;if(XNe.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${qNe(e)+l}${u})`;const d=e.split("/"),f=l.split("/");d.pop();for(const p of f)p!=="."&&(p===".."?d.pop():d.push(p));return`url(${u}${d.join("/")}${u})`})}const QNe=/^[^ \t\n\r\u000c]+/,JNe=/^[, \t\n\r\u000c]+/;function e6e(t,e){if(e.trim()==="")return e;let n=0;function s(i){let a;const o=i.exec(e.substring(n));return o?(a=o[0],n+=a.length,a):""}const r=[];for(;s(JNe),!(n>=e.length);){let i=s(QNe);if(i.slice(-1)===",")i=C0(t,i.substring(0,i.length-1)),r.push(i);else{let a="";i=C0(t,i);let o=!1;for(;;){const l=e.charAt(n);if(l===""){r.push((i+a).trim());break}else if(o)l===")"&&(o=!1);else if(l===","){n+=1,r.push((i+a).trim());break}else l==="("&&(o=!0);a+=l,n+=1}}}return r.join(", ")}const MW=new WeakMap;function C0(t,e){return!e||e.trim()===""?e:n4(t,e)}function t6e(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function n4(t,e){let n=MW.get(t);if(n||(n=t.createElement("a"),MW.set(t,n)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return n.setAttribute("href",e),n.href}function yoe(t,e,n,s,r,i){return s&&(n==="src"||n==="href"&&!(e==="use"&&s[0]==="#")||n==="xlink:href"&&s[0]!=="#"||n==="background"&&(e==="table"||e==="td"||e==="th")?C0(t,s):n==="srcset"?e6e(t,s):n==="style"?FT(s,n4(t)):e==="object"&&n==="data"?C0(t,s):typeof i=="function"?i(n,s,r):s)}function boe(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function n6e(t,e,n,s){try{if(s&&t.matches(s))return!1;if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let r=t.classList.length;r--;){const i=t.classList[r];if(e.test(i))return!0}if(n)return t.matches(n)}catch{}return!1}function s6e(t,e){for(let n=t.classList.length;n--;){const s=t.classList[n];if(e.test(s))return!0}return!1}
92function Bp(t,e,n=1/0,s=0){return!t||t.nodeType!==t.ELEMENT_NODE||s>n?-1:e(t)?s:Bp(t.parentNode,e,n,s+1)}function T0(t,e){return n=>{const s=n;if(s===null)return!1;try{if(t){if(typeof t=="string"){if(s.matches(`.${t}`))return!0}else if(s6e(s,t))return!0}return!!(e&&s.matches(e))}catch{return!1}}}function Uv(t,e,n,s,r,i){try{const a=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(a===null)return!1;if(a.tagName==="INPUT"){const u=a.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let o=-1,l=-1;if(i){if(l=Bp(a,T0(s,r)),l<0)return!0;o=Bp(a,T0(e,n),l>=0?l:1/0)}else{if(o=Bp(a,T0(e,n)),o<0)return!1;l=Bp(a,T0(s,r),o>=0?o:1/0)}return o>=0?l>=0?o<=l:!0:l>=0?!1:!!i}catch{}return!!i}function r6e(t,e,n){const s=t.contentWindow;if(!s)return;let r=!1,i;try{i=s.document.readyState}catch{return}if(i!=="complete"){const o=Ij(()=>{r||(e(),r=!0)},n);t.addEventListener("load",()=>{voe(o),r=!0,e()});return}const a="about:blank";if(s.location.href!==a||t.src===a||t.src==="")return Ij(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function i6e(t,e,n){let s=!1,r;try{r=t.sheet}catch{return}if(r)return;const i=Ij(()=>{s||(e(),s=!0)},n);t.addEventListener("load",()=>{voe(i),s=!0,e()})}function a6e(t,e){const{doc:n,mirror:s,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:o,maskAttributeFn:l,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:m,maskInputOptions:v={},maskTextFn:x,maskInputFn:y,dataURLOptions:S={},inlineImages:_,recordCanvas:E,keepIframeSrcFn:T,newlyAddedElement:k=!1}=e,R=o6e(n,s);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:li.Document,childNodes:[],compatMode:t.compatMode}:{type:li.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:li.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:R};case t.ELEMENT_NODE:return c6e(t,{doc:n,blockClass:r,blockSelector:i,unblockSelector:a,inlineStylesheet:m,maskAttributeFn:l,maskInputOptions:v,maskInputFn:y,dataURLOptions:S,inlineImages:_,recordCanvas:E,keepIframeSrcFn:T,newlyAddedElement:k,rootId:R,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p});case t.TEXT_NODE:return l6e(t,{doc:n,maskAllText:o,maskTextClass:u,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,maskTextFn:x,maskInputOptions:v,maskInputFn:y,rootId:R});case t.CDATA_SECTION_NODE:return{type:li.CDATA,textContent:"",rootId:R};case t.COMMENT_NODE:return{type:li.Comment,textContent:t.textContent||"",rootId:R};default:return!1}}function o6e(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return n===1?void 0:n}function l6e(t,e){const{maskAllText:n,maskTextClass:s,unmaskTextClass:r,maskTextSelector:i,unmaskTextSelector:a,maskTextFn:o,maskInputOptions:l,maskInputFn:u,rootId:d}=e,f=t.parentNode&&t.parentNode.tagName;let p=t.textContent;const m=f==="STYLE"?!0:void 0,v=f==="SCRIPT"?!0:void 0,x=f==="TEXTAREA"?!0:void 0;if(m&&p){try{t.nextSibling||t.previousSibling||Hb([t,"access",S=>S.parentNode,"access",S=>S.sheet,"optionalAccess",S=>S.cssRules])&&(p=OT(t.parentNode.sheet))}catch(S){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${S}`,t)}p=FT(p,n4(e.doc))}v&&(p="SCRIPT_PLACEHOLDER");const y=Uv(t,s,i,r,a,n);if(!m&&!v&&!x&&p&&y&&(p=o?o(p,t.parentElement):p.replace(/[\S]/g,"*")),x&&p&&(l.textarea||y)&&(p=u?u(p,t.parentNode):p.replace(/[\S]/g,"*")),f==="OPTION"&&p){const S=t4({type:null,tagName:f,maskInputOptions:l});p=Gb({isMasked:Uv(t,s,i,r,a,S),element:t,value:p,maskInputFn:u})}return{type:li.Text,textContent:p||"",isStyle:m,rootId:d}}function c6e(t,e){const{doc:n,blockClass:s,blockSelector:r,unblockSelector:i,inlineStylesheet:a,maskInputOptions:o={},maskAttributeFn:l,maskInputFn:u,dataURLOptions:d={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:v=!1,rootId:x,maskTextClass:y,unmaskTextClass:S,maskTextSelector:_,unmaskTextSelector:E}=e,T=n6e(t,s,r,i),k=WNe(t);let R={};const I=t.attributes.length;for(let L=0;L<I;L++){const j=t.attributes[L];j.name&&!boe(k,j.name,j.value)&&(R[j.name]=yoe(n,k,Fv(j.name),j.value,t,l))}if(k==="link"&&a){const L=Array.from(n.styleSheets).find(F=>F.href===t.href);let j=null;L&&(j=OT(L)),j&&(R.rel=null,R.href=null,R.crossorigin=null,R._cssText=FT(j,L.href))}if(k==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const L=OT(t.sheet);L&&(R._cssText=FT(L,n4(n)))}if(k==="input"||k==="textarea"||k==="select"||k==="option"){const L=t,j=_O(L),F=$T(L,Nj(k),j),O=L.checked;if(j!=="submit"&&j!=="button"&&F){const M=Uv(L,y,_,S,E,t4({type:j,tagName:Nj(k),maskInputOptions:o}));R.value=Gb({isMasked:M,element:L,value:F,maskInputFn:u})}O&&(R.checked=O)}if(k==="option"&&(t.selected&&!o.select?R.selected=!0:delete R.selected),k==="canvas"&&p){if(t.__context==="2d")VNe(t)||(R.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){const L=t.toDataURL(d.type,d.quality),j=n.createElement("canvas");j.width=t.width,j.height=t.height;const F=j.toDataURL(d.type,d.quality);L!==F&&(R.rr_dataURL=L)}}if(k==="img"&&f){Fg||(Fg=n.createElement("canvas"),PW=Fg.getContext("2d"));const L=t,j=L.currentSrc||L.getAttribute("src")||"<unknown-src>",F=L.crossOrigin,O=()=>{L.removeEventListener("load",O);
vendor: 4,092 bytes, line 92
92try{Fg.width=L.naturalWidth,Fg.height=L.naturalHeight,PW.drawImage(L,0,0),R.rr_dataURL=Fg.toDataURL(d.type,d.quality)}catch(M){if(L.crossOrigin!=="anonymous"){L.crossOrigin="anonymous",L.complete&&L.naturalWidth!==0?O():L.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${j}! Error: ${M}`)}L.crossOrigin==="anonymous"&&(F?R.crossOrigin=F:L.removeAttribute("crossorigin"))};L.complete&&L.naturalWidth!==0?O():L.addEventListener("load",O)}if((k==="audio"||k==="video")&&(R.rr_mediaState=t.paused?"paused":"played",R.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(R.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(R.rr_scrollTop=t.scrollTop)),T){const{width:L,height:j}=t.getBoundingClientRect();R={class:R.class,rr_width:`${L}px`,rr_height:`${j}px`}}k==="iframe"&&!m(R.src)&&(!T&&!xoe(t)&&(R.rr_src=R.src),delete R.src);let A;try{customElements.get(k)&&(A=!0)}catch{}return{type:li.Element,tagName:k,attributes:R,childNodes:[],isSVG:t6e(t)||void 0,needBlock:T,rootId:x,isCustom:A}}function zs(t){return t==null?"":t.toLowerCase()}function u6e(t,e){if(e.comment&&t.type===li.Comment)return!0;if(t.type===li.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&moe(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(zs(t.attributes.name).match(/^msapplication-tile(image|color)$/)||zs(t.attributes.name)==="application-name"||zs(t.attributes.rel)==="icon"||zs(t.attributes.rel)==="apple-touch-icon"||zs(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&zs(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(zs(t.attributes.property).match(/^(og|twitter|fb):/)||zs(t.attributes.name).match(/^(og|twitter):/)||zs(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(zs(t.attributes.name)==="robots"||zs(t.attributes.name)==="googlebot"||zs(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(zs(t.attributes.name)==="author"||zs(t.attributes.name)==="generator"||zs(t.attributes.name)==="framework"||zs(t.attributes.name)==="publisher"||zs(t.attributes.name)==="progid"||zs(t.attributes.property).match(/^article:/)||zs(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(zs(t.attributes.name)==="google-site-verification"||zs(t.attributes.name)==="yandex-verification"||zs(t.attributes.name)==="csrf-token"||zs(t.attributes.name)==="p:domain_verify"||zs(t.attributes.name)==="verify-v1"||zs(t.attributes.name)==="verification"||zs(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function k0(t,e){const{doc:n,mirror:s,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,skipChild:p=!1,inlineStylesheet:m=!0,maskInputOptions:v={},maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOMOptions:_,dataURLOptions:E={},inlineImages:T=!1,recordCanvas:k=!1,onSerialize:R,onIframeLoad:I,iframeLoadTimeout:A=5e3,onStylesheetLoad:L,stylesheetLoadTimeout:j=5e3,keepIframeSrcFn:F=()=>!1,newlyAddedElement:O=!1}=e;let{preserveWhiteSpace:M=!0}=e;const U=a6e(t,{doc:n,mirror:s,blockClass:r,blockSelector:i,maskAllText:o,unblockSelector:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,inlineStylesheet:m,maskInputOptions:v,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,dataURLOptions:E,inlineImages:T,recordCanvas:k,keepIframeSrcFn:F,newlyAddedElement:O});if(!U)return console.warn(t,"not serialized"),null;let G;s.hasNode(t)?G=s.getId(t):u6e(U,_)||!M&&U.type===li.Text&&!U.isStyle&&!U.textContent.replace(/^\s+|\s+$/gm,"").length?G=Wb:G=EO();const $=Object.assign(U,{id:G});if(s.add(t,$),G===Wb)return null;R&&R(t);let V=!p;if($.type===li.Element){V=V&&!$.needBlock,delete $.needBlock;const B=t.shadowRoot;
92B&&tb(B)&&($.isShadowHost=!0)}if(($.type===li.Document||$.type===li.Element)&&V){_.headWhitespace&&$.type===li.Element&&$.tagName==="head"&&(M=!1);const B={doc:n,mirror:s,blockClass:r,blockSelector:i,maskAllText:o,unblockSelector:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,skipChild:p,inlineStylesheet:m,maskInputOptions:v,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOMOptions:_,dataURLOptions:E,inlineImages:T,recordCanvas:k,preserveWhiteSpace:M,onSerialize:R,onIframeLoad:I,iframeLoadTimeout:A,onStylesheetLoad:L,stylesheetLoadTimeout:j,keepIframeSrcFn:F};for(const q of Array.from(t.childNodes)){const z=k0(q,B);z&&$.childNodes.push(z)}if(MNe(t)&&t.shadowRoot)for(const q of Array.from(t.shadowRoot.childNodes)){const z=k0(q,B);z&&(tb(t.shadowRoot)&&(z.isShadow=!0),$.childNodes.push(z))}}return t.parentNode&&eb(t.parentNode)&&tb(t.parentNode)&&($.isShadow=!0),$.type===li.Element&&$.tagName==="iframe"&&r6e(t,()=>{const B=xoe(t);if(B&&I){const q=k0(B,{doc:B,mirror:s,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,skipChild:!1,inlineStylesheet:m,maskInputOptions:v,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOMOptions:_,dataURLOptions:E,inlineImages:T,recordCanvas:k,preserveWhiteSpace:M,onSerialize:R,onIframeLoad:I,iframeLoadTimeout:A,onStylesheetLoad:L,stylesheetLoadTimeout:j,keepIframeSrcFn:F});q&&I(t,q)}},A),$.type===li.Element&&$.tagName==="link"&&typeof $.attributes.rel=="string"&&($.attributes.rel==="stylesheet"||$.attributes.rel==="preload"&&typeof $.attributes.href=="string"&&moe($.attributes.href)==="css")&&i6e(t,()=>{if(L){const B=k0(t,{doc:n,mirror:s,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:f,skipChild:!1,inlineStylesheet:m,maskInputOptions:v,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOMOptions:_,dataURLOptions:E,inlineImages:T,recordCanvas:k,preserveWhiteSpace:M,onSerialize:R,onIframeLoad:I,iframeLoadTimeout:A,onStylesheetLoad:L,stylesheetLoadTimeout:j,keepIframeSrcFn:F});B&&L(t,B)}},j),$}function d6e(t,e){const{mirror:n=new poe,blockClass:s="rr-block",blockSelector:r=null,unblockSelector:i=null,maskAllText:a=!1,maskTextClass:o="rr-mask",unmaskTextClass:l=null,maskTextSelector:u=null,unmaskTextSelector:d=null,inlineStylesheet:f=!0,inlineImages:p=!1,recordCanvas:m=!1,maskAllInputs:v=!1,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOM:_=!1,dataURLOptions:E,preserveWhiteSpace:T,onSerialize:k,onIframeLoad:R,iframeLoadTimeout:I,onStylesheetLoad:A,stylesheetLoadTimeout:L,keepIframeSrcFn:j=()=>!1}=e||{};return k0(t,{doc:t,mirror:n,blockClass:s,blockSelector:r,unblockSelector:i,maskAllText:a,maskTextClass:o,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:v===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:v===!1?{}:v,maskAttributeFn:x,maskTextFn:y,maskInputFn:S,slimDOMOptions:_===!0||_==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:_==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:_===!1?{}:_,dataURLOptions:E,inlineImages:p,recordCanvas:m,preserveWhiteSpace:T,onSerialize:k,onIframeLoad:R,iframeLoadTimeout:I,onStylesheetLoad:A,stylesheetLoadTimeout:L,keepIframeSrcFn:j,newlyAddedElement:!1})}function Mf(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function Sa(t,e,n=document){const s={capture:!0,passive:!0};return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}const l0=`Please stop import mirror directly. Instead of that,\r
93now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
94or you can use record.mirror to access the mirror instance during recording.`;let DW={map:{},getId(){return console.error(l0),-1},getNode(){return console.error(l0),null},removeNodeFromMap(){console.error(l0)},has(){return console.error(l0),!1},reset(){console.error(l0)}};
94typeof window<"u"&&window.Proxy&&window.Reflect&&(DW=new Proxy(DW,{get(t,e,n){return e==="map"&&console.error(l0),Reflect.get(t,e,n)}}));function qb(t,e,n={}){let s=null,r=0;return function(...i){const a=Date.now();!r&&n.leading===!1&&(r=a);const o=e-(a-r),l=this;o<=0||o>e?(s&&(x6e(s),s=null),r=a,t.apply(l,i)):!s&&n.trailing!==!1&&(s=s4(()=>{r=n.leading===!1?0:Date.now(),s=null,t.apply(l,i)},o))}}function Soe(t,e,n,s,r=window){const i=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,s?n:{set(a){s4(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>Soe(t,e,i||{},!0)}function CO(t,e,n){try{if(!(e in t))return()=>{};const s=t[e],r=n(s);return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s}})),t[e]=r,()=>{t[e]=s}}catch{return()=>{}}}let UT=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(UT=()=>new Date().getTime());function woe(t){const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:Mf([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollLeft])||Mf([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollLeft])||Mf([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollLeft])||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:Mf([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollTop])||Mf([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollTop])||Mf([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollTop])||0}}function _oe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Eoe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Coe(t){return t?t.nodeType===t.ELEMENT_NODE?t:t.parentElement:null}function bo(t,e,n,s,r){if(!t)return!1;const i=Coe(t);if(!i)return!1;const a=T0(e,n);if(!r){const u=s&&i.matches(s);return a(i)&&!u}const o=Bp(i,a);let l=-1;return o<0?!1:(s&&(l=Bp(i,T0(null,s))),o>-1&&l<0?!0:o<l)}function f6e(t,e){return e.getId(t)!==-1}function wN(t,e){return e.getId(t)===Wb}function Toe(t,e){if(eb(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Toe(t.parentNode,e):!0:!0}function Lj(t){return!!t.changedTouches}function h6e(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function koe(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Roe(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function jj(t){return!!Mf([t,"optionalAccess",e=>e.shadowRoot])}let p6e=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return wNe(this.styleIDMap.get(e),()=>-1)}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let s;return n===void 0?s=this.id++:s=n,this.styleIDMap.set(e,s),this.idStyleMap.set(s,e),s}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Aoe(t){let e=null;return Mf([t,"access",n=>n.getRootNode,"optionalCall",n=>n(),"optionalAccess",n=>n.nodeType])===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function m6e(t){let e=t,n;for(;n=Aoe(e);)e=n;return e}function g6e(t){const e=t.ownerDocument;if(!e)return!1;const n=m6e(t);return e.contains(n)}function Noe(t){const e=t.ownerDocument;return e?e.contains(t)||g6e(t):!1}const OW={};function TO(t){const e=OW[t];if(e)return e;const n=window.document;let s=window[t];if(n&&typeof n.createElement=="function")try{const r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r);const i=r.contentWindow;i&&i[t]&&(s=i[t]),n.head.removeChild(r)}catch{}return OW[t]=s.bind(window)}function v6e(...t){return TO("requestAnimationFrame")(...t)}function s4(...t){return TO("setTimeout")(...t)}function x6e(...t){return TO("clearTimeout")(...t)}var En=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(En||{}),ln=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.In
94put=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ln||{}),ma=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(ma||{}),Bu=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Bu||{}),$W;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})($W||($W={}));var FW;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(FW||(FW={}));function kO(t){try{return t.contentDocument}catch{}}function y6e(t){try{return t.contentWindow}catch{}}function b6e(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function UW(t){return"__ln"in t}class S6e{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let s=0;s<e;s++)n=b6e([n,"optionalAccess",r=>r.next])||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&UW(e.previousSibling)){const s=e.previousSibling.__ln.next;n.next=s,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,s&&(s.previous=n)}else if(e.nextSibling&&UW(e.nextSibling)&&e.nextSibling.__ln.previous){const s=e.nextSibling.__ln.previous;n.previous=s,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,s&&(s.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const BW=(t,e)=>`${t}@${e}`;class w6e{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,s=new S6e,r=l=>{let u=l,d=Wb;for(;d===Wb;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},i=l=>{if(!l.parentNode||!Noe(l))return;const u=eb(l.parentNode)?this.mirror.getId(Aoe(l)):this.mirror.getId(l.parentNode),d=r(l);if(u===-1||d===-1)return s.addNode(l);const f=k0(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inl
94ineImages,onSerialize:p=>{koe(p,this.mirror)&&!bo(p,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(p),Roe(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),jj(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(p,m)=>{bo(p,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(p,m),p.contentWindow&&this.canvasManager.addWindow(p.contentWindow),this.shadowDomManager.observeAttachShadow(p))},onStylesheetLoad:(p,m)=>{this.stylesheetManager.attachLinkElement(p,m)}});f&&(e.push({parentId:u,nextId:d,node:f}),n.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)zW(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||i(l);for(const l of this.addedSet)!VW(this.droppedSet,l)&&!zW(this.removes,l,this.mirror)||VW(this.movedSet,l)?i(l):this.droppedSet.add(l);let a=null;for(;s.length;){let l=null;if(a){const u=this.mirror.getId(a.value.parentNode),d=r(a.value);u!==-1&&d!==-1&&(l=a)}if(!l){let u=s.tail;for(;u;){const d=u;if(u=u.previous,d){const f=this.mirror.getId(d.value.parentNode);if(r(d.value)===-1)continue;if(f!==-1){l=d;break}else{const m=d.value;if(m.parentNode&&m.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const v=m.parentNode.host;if(this.mirror.getId(v)!==-1){l=d;break}}}}}}if(!l){for(;s.head;)s.removeNode(s.head.value);break}a=l.previous,s.removeNode(l.value),i(l.value)}const o={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:u}=l;if(typeof u.style=="string"){const d=JSON.stringify(l.styleDiff),f=JSON.stringify(l._unchangedStyles);d.length<u.style.length&&(d+f).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(o))},this.processMutation=e=>{if(!wN(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!bo(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:Uv(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,Coe(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let s=e.attributeName,r=e.target.getAttribute(s);if(s==="value"){const a=_O(n),o=n.tagName;r=$T(n,o,a);const l=t4({maskInputOptions:this.maskInputOptions,tagName:o,type:a}),u=Uv(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);r=Gb({isMasked:u,element:n,value:r,maskInputFn:this.maskInputFn})}if(bo(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&s==="src"&&!this.keepIframeSrcFn(r))if(!kO(n))s="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}
94,this.attributes.push(i),this.attributeMap.set(e.target,i)),s==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!boe(n.tagName,s)&&(i.attributes[s]=yoe(this.doc,Fv(n.tagName),Fv(s),r,n,this.maskAttributeFn),s==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const o of Array.from(n.style)){const l=n.style.getPropertyValue(o),u=n.style.getPropertyPriority(o);l!==a.style.getPropertyValue(o)||u!==a.style.getPropertyPriority(o)?u===""?i.styleDiff[o]=l:i.styleDiff[o]=[l,u]:i._unchangedStyles[o]=[l,u]}for(const o of Array.from(a.style))n.style.getPropertyValue(o)===""&&(i.styleDiff[o]=!1)}break}case"childList":{if(bo(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const s=this.mirror.getId(n),r=eb(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);bo(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||wN(n,this.mirror)||!f6e(n,this.mirror)||(this.addedSet.has(n)?(Pj(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&s===-1||Toe(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[BW(s,r)]?Pj(this.movedSet,n):this.removes.push({parentId:r,id:s,isShadow:eb(e.target)&&tb(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(wN(e,this.mirror))return;this.movedSet.add(e);let s=null;n&&this.mirror.hasNode(n)&&(s=this.mirror.getId(n)),s&&s!==-1&&(this.movedMap[BW(this.mirror.getId(e),s)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);bo(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes.forEach(s=>this.genAdds(s)),jj(e)&&e.shadowRoot.childNodes.forEach(s=>{this.processedNodeManager.add(s,this),this.genAdds(s,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Pj(t,e){t.delete(e),e.childNodes.forEach(n=>Pj(t,n))}function zW(t,e,n){return t.length===0?!1:_6e(t,e,n)}function _6e(t,e,n){let s=e.parentNode;for(;s;){const r=n.getId(s);if(t.some(i=>i.id===r))return!0;s=s.parentNode}return!1}function VW(t,e){return t.size===0?!1:Ioe(t,e)}function Ioe(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:Ioe(t,n):!1}let nb;function E6e(t){nb=t}function C6e(){nb=void 0}const Un=t=>nb?((...n)=>{try{return t(...n)}catch(s){if(nb&&nb(s)===!0)return()=>{};throw s}}):t;function Vl(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const R0=[];function pS(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function Loe(t,e){const n=new w6e;R0.push(n),n.init(t);let s=window.MutationObserver||window.__rrMutationObserver;const r=Vl([window,"optionalAccess",a=>a.Zone,"optionalAccess",a=>a.__symbol__,"optionalCall",a=>a("MutationObserver")]);r&&window[r]&&(s=window[r]);const i=new s(Un(a=>{t.onMutation&&t.onMutation(a)===!1||n.processMutations.bind(n)(a)}));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function T6e({mousemoveCb:t,sampling:e,doc:n,mirror:s}){if(e.mousemove===!1)return()=>{};const r=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],o;const l=qb(Un(f=>{const p=Date.now()-o;t(a.map(m=>(m.timeOffset-=p,m)),f),a=[],o=null}),i),u=Un(qb(Un(f=>{const p=pS(f),{clientX:m,clientY:v}=Lj(f)?f.changedTouches[0]:f;o||(o=UT()),a.push({x:m,y:v,id:s.getId(p),timeOffset:UT()-o}),l(typeof DragEvent<"u"&&f instanceof DragEvent?ln.Drag:f instanceof MouseEvent?ln.MouseMove:ln.TouchMove)}),r,{trailing:!1})),d=[Sa("mousemove",u,n),Sa("touchmove",u,n),Sa("drag",u,n)];return Un(()=>{d.forEach(f=>f())})}function k6e({mouseInteractionCb:t,doc:e,mirror:n,blockClass:s,blockSelector:r,unblockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const o=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,l=[];let u=null;const d=f=>p=>{const m=pS(p);if(bo(m,s,r,i,!0))return;let v=null,x=f;if("pointerType"in p){switch(p.pointerType){case"mouse":v=Bu.Mouse;break;case"touch":v=Bu.Touch;break;case"pen":v=Bu.Pen;break}v===Bu.Touch?ma[f]===ma.MouseDown?x="TouchStart":ma[f]===ma.MouseUp&&(x="TouchEnd"):Bu.Pen}else Lj(p)&&(v=Bu.Touch);v!==null?(u=v,(x.startsWith("Touch")&&v===Bu.Touch||x.startsWith("Mouse")&&v===Bu.Mouse)&&(v=null)):ma[f]===ma.Click&&(v=u,u=null);const y=Lj(p)?p.changedTouches[0]:p;if(!y)return;const S=n.getId(m),{clientX:_,clientY:E}=y;Un(t)({type:ma[x],id:S,x:_,y:E,...v!==null&&{pointerType:v}})};return Object.keys(ma).filter(f=>
vendor: 8,514 bytes, line 94
94Number.isNaN(Number(f))&&!f.endsWith("_Departed")&&o[f]!==!1).forEach(f=>{let p=Fv(f);const m=d(f);if(window.PointerEvent)switch(ma[f]){case ma.MouseDown:case ma.MouseUp:p=p.replace("mouse","pointer");break;case ma.TouchStart:case ma.TouchEnd:return}l.push(Sa(p,m,e))}),Un(()=>{l.forEach(f=>f())})}function joe({scrollCb:t,doc:e,mirror:n,blockClass:s,blockSelector:r,unblockSelector:i,sampling:a}){const o=Un(qb(Un(l=>{const u=pS(l);if(!u||bo(u,s,r,i,!0))return;const d=n.getId(u);if(u===e&&e.defaultView){const f=woe(e.defaultView);t({id:d,x:f.left,y:f.top})}else t({id:d,x:u.scrollLeft,y:u.scrollTop})}),a.scroll||100));return Sa("scroll",o,e)}function R6e({viewportResizeCb:t},{win:e}){let n=-1,s=-1;const r=Un(qb(Un(()=>{const i=_oe(),a=Eoe();(n!==i||s!==a)&&(t({width:Number(a),height:Number(i)}),n=i,s=a)}),200));return Sa("resize",r,e)}const A6e=["INPUT","TEXTAREA","SELECT"],HW=new WeakMap;function N6e({inputCb:t,doc:e,mirror:n,blockClass:s,blockSelector:r,unblockSelector:i,ignoreClass:a,ignoreSelector:o,maskInputOptions:l,maskInputFn:u,sampling:d,userTriggeredOnInput:f,maskTextClass:p,unmaskTextClass:m,maskTextSelector:v,unmaskTextSelector:x}){function y(I){let A=pS(I);const L=I.isTrusted,j=A&&Nj(A.tagName);if(j==="OPTION"&&(A=A.parentElement),!A||!j||A6e.indexOf(j)<0||bo(A,s,r,i,!0))return;const F=A;if(F.classList.contains(a)||o&&F.matches(o))return;const O=_O(A);let M=$T(F,j,O),U=!1;const G=t4({maskInputOptions:l,tagName:j,type:O}),$=Uv(A,p,v,m,x,G);(O==="radio"||O==="checkbox")&&(U=A.checked),M=Gb({isMasked:$,element:A,value:M,maskInputFn:u}),S(A,f?{text:M,isChecked:U,userTriggered:L}:{text:M,isChecked:U});const V=A.name;O==="radio"&&V&&U&&e.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(B=>{if(B!==A){const q=Gb({isMasked:$,element:B,value:$T(B,j,O),maskInputFn:u});S(B,f?{text:q,isChecked:!U,userTriggered:!1}:{text:q,isChecked:!U})}})}function S(I,A){const L=HW.get(I);if(!L||L.text!==A.text||L.isChecked!==A.isChecked){HW.set(I,A);const j=n.getId(I);Un(t)({...A,id:j})}}const E=(d.input==="last"?["change"]:["input","change"]).map(I=>Sa(I,Un(y),e)),T=e.defaultView;if(!T)return()=>{E.forEach(I=>I())};const k=T.Object.getOwnPropertyDescriptor(T.HTMLInputElement.prototype,"value"),R=[[T.HTMLInputElement.prototype,"value"],[T.HTMLInputElement.prototype,"checked"],[T.HTMLSelectElement.prototype,"value"],[T.HTMLTextAreaElement.prototype,"value"],[T.HTMLSelectElement.prototype,"selectedIndex"],[T.HTMLOptionElement.prototype,"selected"]];return k&&k.set&&E.push(...R.map(I=>Soe(I[0],I[1],{set(){Un(y)({target:this,isTrusted:!1})}},!1,T))),Un(()=>{E.forEach(I=>I())})}function BT(t){const e=[];function n(s,r){if(C_("CSSGroupingRule")&&s.parentRule instanceof CSSGroupingRule||C_("CSSMediaRule")&&s.parentRule instanceof CSSMediaRule||C_("CSSSupportsRule")&&s.parentRule instanceof CSSSupportsRule||C_("CSSConditionRule")&&s.parentRule instanceof CSSConditionRule){const a=Array.from(s.parentRule.cssRules).indexOf(s);r.unshift(a)}else if(s.parentStyleSheet){const a=Array.from(s.parentStyleSheet.cssRules).indexOf(s);r.unshift(a)}return r}return n(t,e)}function Df(t,e,n){let s,r;return t?(t.ownerNode?s=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:s}):{}}function I6e({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:s}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const r=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Un((d,f,p)=>{const[m,v]=p,{id:x,styleId:y}=Df(f,e,n.styleMirror);return(x&&x!==-1||y&&y!==-1)&&t({id:x,styleId:y,adds:[{rule:m,index:v}]}),d.apply(f,p)})});const i=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:Un((d,f,p)=>{const[m]=p,{id:v,styleId:x}=Df(f,e,n.styleMirror);return(v&&v!==-1||x&&x!==-1)&&t({id:v,styleId:x,removes:[{index:m}]}),d.apply(f,p)})});let a;s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Un((d,f,p)=>{const[m]=p,{id:v,styleId:x}=Df(f,e,n.styleMirror);return(v&&v!==-1||x&&x!==-1)&&t({id:v,styleId:x,replace:m}),d.apply(f,p)})}));let o;s.CSSStyleSheet.prototype.replaceSync&&(o=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(o,{apply:Un((d,f,p)=>{const[m]=p,{id:v,styleId:x}=Df(f,e,n.styleMirror);return(v&&v!==-1||x&&x!==-1)&&t({id:v,styleId:x,replaceSync:m}),d.apply(f,p)})}));const l={};T_("CSSGroupingRule")?l.CSSGroupingRule=s.CSSGroupingRule:(T_("CSSMediaRule")&&(l.CSSMediaRule=s.CSSMediaRule),T_("CSSConditionRule")&&(l.CSSConditionRule=s.CSSConditionRule),T_("CSSSupportsRule")&&(l.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(l).forEach(([d,f])=>{u[d]={insertRule:f.prototype.insertRule,deleteRule:f.prototype.deleteRule},f.prototype.insertRule=new Proxy(u[d].insertRule,{apply:Un((p,m,v)=>{const[x,y]=v,{id:S,styleId:_}=Df(m.parentStyleSheet,e,n.styleMirror);return(S&&S!==-1||_&&_!==-1)&&t({id:S,styleId:_,adds:[{rule:x,index:[...BT(m),y||0]}]}),p.apply(m,v)})}),f.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:Un((p,m,v)=>{const[x]=v,{id:y,styleId:S}=Df(m.parentStyleSheet,e,n.styleMirror);return(y&&y!==-1||S&&S!==-1)&&t({id:y,styleId:S,removes:[{index:[...BT(m),x]}]}),p.apply(m,v)})})}),Un(()=>{s.CSSStyleSheet.prototype.insertRule=r,s.CSSStyleSheet.prototype.deleteRule=i,a&&(s.CSSStyleSheet.prototype.replace=a),o&&(s.CSSStyleSheet.prototype.replaceSync=o),Object.entries(l).forEach(([d,f])=>{f.prototype.insertRule=u[d].insertRule,f.prototype.deleteRule=u[d].deleteRule})})}function Poe({mirror:t,stylesheetManager:e},n){let s=null;n.nodeName==="#document"?s=t.getId(n):s=t.getId(n.host);const r=n.nodeName==="#document"?Vl([n,"access",a=>a.defaultView,"optionalAccess",a=>a.Document]):Vl([n,"access",a=>a.ownerDocument,"optionalAccess",a=>a.defaultView,"optionalAccess",a=>a.ShadowRoot]),i=Vl([r,"optionalAccess",a=>a.prototype])?Object.getOwnPropertyDescriptor(Vl([r,"optionalAccess",a=>a.prototype]),"adoptedStyleSheets"):void 0;return s===null||s===-1||!r||!i?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return Vl([i,"access",a=>a.get,"optionalAccess",a=>a.call,"call",a=>a(this)])},set(a){const o=Vl([i,"access",l=>l.set,"optionalAccess",l=>l.call,"call",l=>l(this,a)]);if(s!==null&&s!==-1)try{e.adoptStyleSheets(a,s)}catch{}return o}}),Un(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function L6e({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:s},{win:r}){const i=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:Un((o,l,u)=>{const[d,f,p]=u;if(n.has(d))return i.apply(l,[d,f,p]);const{id:m,styleId:v}=Df(Vl([l,"access",x=>x.parentRule,"optionalAccess",x=>x.parentStyleSheet]),e,s.styleMirror);return(m&&m!==-1||v&&v!==-1)&&t({id:m,styleId:v,set:{property:d,value:f,priority:p},index:BT(l.parentRule)}),o.apply(l,u)})});const a=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Un((o,l,u)=>{const[d]=u;if(n.has(d))return a.apply(l,[d]);const{id:f,styleId:p}=Df(Vl([l,"access",m=>m.parentRule,"optionalAccess",m=>m.parentStyleSheet]),e,s.styleMirror);return(f&&f!==-1||p&&p!==-1)&&t({id:f,styleId:p,remove:{property:d},index:BT(l.parentRule)}),o.apply(l,u)})}),Un(()=>{r.CSSStyleDeclaration.prototype.setProperty=i,r.CSSStyleDeclaration.prototype.removeProperty=a})}function j6e({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:s,mirror:r,sampling:i,doc:a}){const o=Un(u=>qb(Un(d=>{const f=pS(d);if(!f||bo(f,e,n,s,!0))return;const{currentTime:p,volume:m,muted:v,playbackRate:x}=f;t({type:u,id:r.getId(f),currentTime:p,volume:m,muted:v,playbackRate:x})}),i.media||500)),l=[Sa("play",o(0),a),Sa("pause",o(1),a),Sa("seeked",o(2),a),Sa("volumechange",o(3),a),Sa("ratechange",o(4),a)];return Un(()=>{l.forEach(u=>u())})}function P6e({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const s=[],r=new WeakMap,i=n.FontFace;n.FontFace=function(l,u,d){const f=new i(l,u,d);return r.set(f,{family:l,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),f};const a=CO(e.fonts,"add",function(o){return function(l){return s4(Un(()=>{const u=r.get(l);u&&(t(u),r.delete(l))}),0),o.apply(this,[l])}});return s.push(()=>{n.FontFace=i}),s.push(a),Un(()=>
94{s.forEach(o=>o())})}function M6e(t){const{doc:e,mirror:n,blockClass:s,blockSelector:r,unblockSelector:i,selectionCb:a}=t;let o=!0;const l=Un(()=>{const u=e.getSelection();if(!u||o&&Vl([u,"optionalAccess",p=>p.isCollapsed]))return;o=u.isCollapsed||!1;const d=[],f=u.rangeCount||0;for(let p=0;p<f;p++){const m=u.getRangeAt(p),{startContainer:v,startOffset:x,endContainer:y,endOffset:S}=m;bo(v,s,r,i,!0)||bo(y,s,r,i,!0)||d.push({start:n.getId(v),startOffset:x,end:n.getId(y),endOffset:S})}a({ranges:d})});return l(),Sa("selectionchange",l)}function D6e({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:CO(n.customElements,"define",function(r){return function(i,a,o){try{e({define:{name:i}})}catch{}return r.apply(this,[i,a,o])}})}function O6e(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let s;t.recordDOM&&(s=Loe(t,t.doc));const r=T6e(t),i=k6e(t),a=joe(t),o=R6e(t,{win:n}),l=N6e(t),u=j6e(t);let d=()=>{},f=()=>{},p=()=>{},m=()=>{};t.recordDOM&&(d=I6e(t,{win:n}),f=Poe(t,t.doc),p=L6e(t,{win:n}),t.collectFonts&&(m=P6e(t)));const v=M6e(t),x=D6e(t),y=[];for(const S of t.plugins)y.push(S.observer(S.callback,n,S.options));return Un(()=>{R0.forEach(S=>S.reset()),Vl([s,"optionalAccess",S=>S.disconnect,"call",S=>S()]),r(),i(),a(),o(),l(),u(),d(),f(),p(),m(),v(),x(),y.forEach(S=>S())})}function C_(t){return typeof window[t]<"u"}function T_(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Mj{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,s,r){const i=s||this.getIdToRemoteIdMap(e),a=r||this.getRemoteIdToIdMap(e);let o=i.get(n);return o||(o=this.generateIdFn(),i.set(n,o),a.set(o,n)),o}getIds(e,n){const s=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return n.map(i=>this.getId(e,i,s,r))}getRemoteId(e,n,s){const r=s||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const i=r.get(n);return i||-1}getRemoteIds(e,n){const s=this.getRemoteIdToIdMap(e);return n.map(r=>this.getRemoteId(e,r,s))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}function GW(t){let e,n=t[0],s=1;for(;s<t.length;){const r=t[s],i=t[s+1];if(s+=2,(r==="optionalAccess"||r==="optionalCall")&&n==null)return;r==="access"||r==="optionalAccess"?(e=n,n=i(n)):(r==="call"||r==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}class $6e{constructor(){this.crossOriginIframeMirror=new Mj(EO),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class F6e{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Mj(EO),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Mj(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),GW([this,"access",r=>r.loadListener,"optionalCall",r=>r(e)]);const s=kO(e);s&&s.adoptedStyleSheets&&s.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(s.adoptedStyleSheets,this.mirror.getId(s))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const r=this.crossOriginIframeMap.get(e.source);if(!r)return;const i=this.transformCrossOriginEvent(r,n.data.event);i&&this.wrappedEmit(i,n.data.isCheckout)}transformCrossOriginEvent(e,n){switch(n.type){case En.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const s=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(n.data.node,s),{timestamp:n.timestamp,type:En.IncrementalSnapshot,data:{source:ln.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case En.Meta:case En.Load:case En.DomContentLoaded:return!1;case En.Plugin:return n;case En.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case En.IncrementalSnapshot:switch(n.data.source){case ln.Mutation:return n.data.adds.forEach(s=>{this.replaceIds(s,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,e);const r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(s.node,r)}
94),n.data.removes.forEach(s=>{this.replaceIds(s,e,["parentId","id"])}),n.data.attributes.forEach(s=>{this.replaceIds(s,e,["id"])}),n.data.texts.forEach(s=>{this.replaceIds(s,e,["id"])}),n;case ln.Drag:case ln.TouchMove:case ln.MouseMove:return n.data.positions.forEach(s=>{this.replaceIds(s,e,["id"])}),n;case ln.ViewportResize:return!1;case ln.MediaInteraction:case ln.MouseInteraction:case ln.Scroll:case ln.CanvasMutation:case ln.Input:return this.replaceIds(n.data,e,["id"]),n;case ln.StyleSheetRule:case ln.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case ln.Font:return n;case ln.Selection:return n.data.ranges.forEach(s=>{this.replaceIds(s,e,["start","end"])}),n;case ln.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),GW([n,"access",s=>s.data,"access",s=>s.styles,"optionalAccess",s=>s.forEach,"call",s=>s(r=>{this.replaceStyleIds(r,e,["styleId"])})]),n}}return!1}replace(e,n,s,r){for(const i of r)!Array.isArray(n[i])&&typeof n[i]!="number"||(Array.isArray(n[i])?n[i]=e.getIds(s,n[i]):n[i]=e.getId(s,n[i]));return n}replaceIds(e,n,s){return this.replace(this.crossOriginIframeMirror,e,n,s)}replaceStyleIds(e,n,s){return this.replace(this.crossOriginIframeStyleMirror,e,n,s)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(s=>{this.replaceIdOnNode(s,n)})}patchRootIdOnNode(e,n){e.type!==li.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(s=>{this.patchRootIdOnNode(s,n)})}}class U6e{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class B6e{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!tb(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const s=Loe({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(joe({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),s4(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Poe({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const n=kO(e),s=y6e(e);!n||!s||this.patchAttachShadow(s.Element,n)}patchAttachShadow(e,n){const s=this;this.restoreHandlers.push(CO(e.prototype,"attachShadow",function(r){return function(i){const a=r.call(this,i);return this.shadowRoot&&Noe(this)&&s.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}class WW{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class z6e{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new p6e,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const s={id:n,styleIds:[]},r=[];for(const i of e){let a;this.styleMirror.has(i)?a=this.styleMirror.getId(i):(a=this.styleMirror.add(i),r.push({styleId:a,rules:Array.from(i.rules||CSSRule,(o,l)=>({rule:hoe(o),index:l}))})),s.styleIds.push(a)}r.length>0&&(s.styles=r),this.adoptedStyleSheetCb(s)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class V6e{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){const s=this.nodeMap.get(e);return s&&Array.from(s).some(r=>r!==n)}add(e,n){this.active||(this.active=!0,v6e(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}}let Sr,zT;try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=EC([t,"access",e=>e.contentWindow,"optionalAccess",e=>e.Array,"access",e=>e.from])||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}const Nl=zNe();function vd(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:a=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskAllText:u=!1,maskTextClass:d="rr-mask",unmaskTextClass:f=null,maskTextSelector:p=null,unmaskTextSelector:m=null,inlineStylesheet:v=!0,maskAllInputs:x,maskInputOptions:y,slimDOMOptions:S,maskAttributeFn:_,maskInputFn:E,maskTextFn:T,maxCanvasSize:k=null,packFn:R,sampling:I={},dataURLOptions:A={},mousemoveWait:L,recordDOM:j=!0,recordCanvas:F=!1,recordCrossOriginIframes:O=!1,recordAfter:M=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:U=!1,collectFonts:G=!1,inlineImages:$=!1,plugins:V,keepIframeSrcFn:B=()=>!1,ignoreCSSAttributes:q=new Set([]),errorHandler:z,onMutation:D,getCanvasManager:K}=t;E6e(z);const Y=O?window.parent===window:!0;let J=!1;if(!Y)try{window.parent.document&&(J=!1)}catch{J=!0}if(Y&&!e)throw new Error("emit function is required");if(!Y&&!J)return()=>{};L!==void 0&&I.mousemove===void 0&&(I.mousemove=L),Nl.reset();const ne=x===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:y!==void 0?y:{},Q=S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:S==="all",headMetaDescKeywords:S==="all"}:S||{};h6e();let ee,te=0;const ue=Le=>{for(const qe of V||[])qe.eventProcessor&&(Le=qe.eventProcessor(Le));return R&&!J&&(Le=R(Le)),Le};Sr=(Le,qe)=>{const et=Le;if(et.timestamp=UT(),EC([R0,"access",Ct=>Ct[0],"optionalAccess",Ct=>Ct.isFrozen,"call",Ct=>Ct()])&&et.type!==En.FullSnapshot&&!(et.type===En.IncrementalSnapshot&&et.data.source===ln.Mutation)&&R0.forEach(Ct=>Ct.unfreeze()),Y)EC([e,"optionalCall",Ct=>Ct(ue(et),qe)]);else if(J){const Ct={type:"rrweb",event:ue(et),origin:window.location.origin,isCheckout:qe};window.parent.postMessage(Ct,"*")}if(et.type===En.FullSnapshot)ee=et,te=0;else if(et.type===En.IncrementalSnapshot){if(et.data.source===ln.Mutation&&et.data.isAttachIframe)return;te++;const Ct=s&&te>=s,Ke=n&&ee&&et.timestamp-ee.timestamp>n;(Ct||Ke)&&Je(!0)}};const ye=Le=>{Sr({type:En.IncrementalSnapshot,data:{source:ln.Mutation,...Le}})},je=Le=>Sr({type:En.IncrementalSnapshot,data:{source:ln.Scroll,...Le}}),Re=Le=>Sr({type:En.IncrementalSnapshot,data:{source:ln.CanvasMutation,...Le}}),me=Le=>Sr({type:En.IncrementalSnapshot,data:{source:ln.AdoptedStyleSheet,...Le}}),Ce=new z6e({mutationCb:ye,adoptedStyleSheetCb:me}),Xe=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new $6e:new F6e({mirror:Nl,mutationCb:ye,stylesheetManager:Ce,recordCrossOriginIframes:O,wrappedEmit:Sr});for(const Le of V||[])Le.getMirror&&Le.getMirror({nodeMirror:Nl,crossOriginIframeMirror:Xe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Xe.crossOriginIframeStyleMirror});
94const he=new V6e,De=G6e(K,{mirror:Nl,win:window,mutationCb:Le=>Sr({type:En.IncrementalSnapshot,data:{source:ln.CanvasMutation,...Le}}),recordCanvas:F,blockClass:r,blockSelector:i,unblockSelector:a,maxCanvasSize:k,sampling:I.canvas,dataURLOptions:A,errorHandler:z}),Ge=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new U6e:new B6e({mutationCb:ye,scrollCb:je,bypassOptions:{onMutation:D,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:u,maskTextClass:d,unmaskTextClass:f,maskTextSelector:p,unmaskTextSelector:m,inlineStylesheet:v,maskInputOptions:ne,dataURLOptions:A,maskAttributeFn:_,maskTextFn:T,maskInputFn:E,recordCanvas:F,inlineImages:$,sampling:I,slimDOMOptions:Q,iframeManager:Xe,stylesheetManager:Ce,canvasManager:De,keepIframeSrcFn:B,processedNodeManager:he},mirror:Nl}),Je=(Le=!1)=>{if(!j)return;Sr({type:En.Meta,data:{href:window.location.href,width:Eoe(),height:_oe()}},Le),Ce.reset(),Ge.init(),R0.forEach(et=>et.lock());const qe=d6e(document,{mirror:Nl,blockClass:r,blockSelector:i,unblockSelector:a,maskAllText:u,maskTextClass:d,unmaskTextClass:f,maskTextSelector:p,unmaskTextSelector:m,inlineStylesheet:v,maskAllInputs:ne,maskAttributeFn:_,maskInputFn:E,maskTextFn:T,slimDOM:Q,dataURLOptions:A,recordCanvas:F,inlineImages:$,onSerialize:et=>{koe(et,Nl)&&Xe.addIframe(et),Roe(et,Nl)&&Ce.trackLinkElement(et),jj(et)&&Ge.addShadowRoot(et.shadowRoot,document)},onIframeLoad:(et,Ct)=>{Xe.attachIframe(et,Ct),et.contentWindow&&De.addWindow(et.contentWindow),Ge.observeAttachShadow(et)},onStylesheetLoad:(et,Ct)=>{Ce.attachLinkElement(et,Ct)},keepIframeSrcFn:B});if(!qe)return console.warn("Failed to snapshot the document");Sr({type:En.FullSnapshot,data:{node:qe,initialOffset:woe(window)}}),R0.forEach(et=>et.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ce.adoptStyleSheets(document.adoptedStyleSheets,Nl.getId(document))};zT=Je;try{const Le=[],qe=Ct=>Un(O6e)({onMutation:D,mutationCb:ye,mousemoveCb:(Ke,dt)=>Sr({type:En.IncrementalSnapshot,data:{source:dt,positions:Ke}}),mouseInteractionCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.MouseInteraction,...Ke}}),scrollCb:je,viewportResizeCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.ViewportResize,...Ke}}),inputCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.Input,...Ke}}),mediaInteractionCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.MediaInteraction,...Ke}}),styleSheetRuleCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.StyleSheetRule,...Ke}}),styleDeclarationCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.StyleDeclaration,...Ke}}),canvasMutationCb:Re,fontCb:Ke=>Sr({type:En.IncrementalSnapshot,data:{source:ln.Font,...Ke}}),selectionCb:Ke=>{Sr({type:En.IncrementalSnapshot,data:{source:ln.Selection,...Ke}})},customElementCb:Ke=>{Sr({type:En.IncrementalSnapshot,data:{source:ln.CustomElement,...Ke}})},blockClass:r,ignoreClass:o,ignoreSelector:l,maskAllText:u,maskTextClass:d,unmaskTextClass:f,maskTextSelector:p,unmaskTextSelector:m,maskInputOptions:ne,inlineStylesheet:v,sampling:I,recordDOM:j,recordCanvas:F,inlineImages:$,userTriggeredOnInput:U,collectFonts:G,doc:Ct,maskAttributeFn:_,maskInputFn:E,maskTextFn:T,keepIframeSrcFn:B,blockSelector:i,unblockSelector:a,slimDOMOptions:Q,dataURLOptions:A,mirror:Nl,iframeManager:Xe,stylesheetManager:Ce,shadowDomManager:Ge,processedNodeManager:he,canvasManager:De,ignoreCSSAttributes:q,plugins:EC([V,"optionalAccess",Ke=>Ke.filter,"call",Ke=>Ke(dt=>dt.observer),"optionalAccess",Ke=>Ke.map,"call",Ke=>Ke(dt=>({observer:dt.observer,options:dt.options,callback:Xt=>Sr({type:En.Plugin,data:{plugin:dt.name,payload:Xt}})}))])||[]},{});Xe.addLoadListener(Ct=>{try{Le.push(qe(Ct.contentDocument))}catch(Ke){console.warn(Ke)}});const et=()=>{Je(),Le.push(qe(document))};return document.readyState==="interactive"||document.readyState==="complete"?et():(Le.push(Sa("DOMContentLoaded",()=>{Sr({type:En.DomContentLoaded,data:{}}),M==="DOMContentLoaded"&&et()})),Le.push(Sa("load",()=>{Sr({type:En.Load,data:{}}),M==="load"&&et()},window))),()=>{Le.forEach(Ct=>Ct()),he.destroy(),zT=void 0,C6e()}}catch(Le){console.warn(Le)}}function H6e(t){if(!zT)throw new Error("please take full snapshot after start recording");zT(t)}vd.mirror=Nl;vd.takeFullSnapshot=H6e;function G6e(t,e){try{return t?t(e):new WW}catch{return console.warn("Unable to initialize CanvasManager"),new WW}}const W6e=3,q6e=5;function RO(t){return t>9999999999?t:t*1e3}function _N(t){return t>9999999999?t/1e3:t}function mS(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:En.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Zu(e,10,1e3)}}),e.category==="console")))}const K6e="button,a";function Moe(t){return t.closest(K6e)||t}function Doe(t){const e=Ooe(t);return!e||!(e instanceof Element)?e:Moe(e)}function Ooe(t){return Y6e(t)?t.target:t}function Y6e(t){return typeof t=="object"&&!!t&&"target"in t}let Of;function Z6e(t){return Of||(Of=[],X6e()),Of.push(t),()=>{const e=Of?Of.indexOf(t):-1;e>-1&&Of.splice(e,1)}}function X6e(){eAe(Vs,"open",function(t){return function(...e){if(Of)try{Of.forEach(n=>n())}catch{}return t.apply(Vs,e)}})}const Q6e=new Set([ln.Mutation,ln.StyleSheetRule,ln.StyleDeclaration,ln.AdoptedStyleSheet,ln.CanvasMutation,ln.Selection,ln.MediaInteraction]);function J6e(t,e,n){t.handleClick(e,n)}
94class eIe{constructor(e,n,s=mS){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=s}addListeners(){const e=Z6e(()=>{this._lastMutation=qW()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(nIe(n,this._ignoreSelector)||!sIe(e))return;const s={timestamp:_N(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(r=>r.node===s.node&&Math.abs(r.timestamp-s.timestamp)<1)||(this._clicks.push(s),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=_N(e)}registerScroll(e=Date.now()){this._lastScroll=_N(e)}registerClick(e){const n=Moe(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=qW();this._clicks.forEach(s=>{!s.mutationAfter&&this._lastMutation&&(s.mutationAfter=s.timestamp<=this._lastMutation?this._lastMutation-s.timestamp:void 0),!s.scrollAfter&&this._lastScroll&&(s.scrollAfter=s.timestamp<=this._lastScroll?this._lastScroll-s.timestamp:void 0),s.timestamp+this._timeout<=n&&e.push(s)});for(const s of e){const r=this._clicks.indexOf(s);r>-1&&(this._generateBreadcrumbs(s),this._clicks.splice(r,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const n=this._replay,s=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,r=e.mutationAfter&&e.mutationAfter<=this._threshold,i=!s&&!r,{clickCount:a,clickBreadcrumb:o}=e;if(i){const l=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,u=l<this._timeout*1e3?"mutation":"timeout",d={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.slowClickDetected",data:{...o.data,url:Vs.location.href,route:n.getCurrentRoute(),timeAfterClickMs:l,endReason:u,clickCount:a||1}};this._addBreadcrumbEvent(n,d);return}if(a>1){const l={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.multiClick",data:{...o.data,url:Vs.location.href,route:n.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(n,l)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Ov(()=>this._checkClicks(),1e3)}}const tIe=["A","BUTTON","INPUT"];function nIe(t,e){return!!(!tIe.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function sIe(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function qW(){return Date.now()/1e3}function rIe(t,e){try{if(!iIe(e))return;const{source:n}=e.data;if(Q6e.has(n)&&t.registerMutation(e.timestamp),n===ln.Scroll&&t.registerScroll(e.timestamp),aIe(e)){const{type:s,id:r}=e.data,i=vd.mirror.getNode(r);i instanceof HTMLElement&&s===ma.Click&&t.registerClick(i)}}catch{}}function iIe(t){return t.type===W6e}function aIe(t){return t.data.source===ln.MouseInteraction}function zc(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var VT;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(VT||(VT={}));const oIe=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function lIe(t){const e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(const n in t)if(oIe.has(n)){let s=n;(n==="data-testid"||n==="data-test-id")&&(s="testId"),e[s]=t[n]}return e}const cIe=t=>e=>{if(!t.isEnabled())return;const n=uIe(e);if(!n)return;const s=e.name==="click",r=s?e.event:void 0;s&&t.clickDetector&&r&&r.target&&!r.altKey&&!r.metaKey&&!r.ctrlKey&&!r.shiftKey&&J6e(t.clickDetector,n,Doe(e.event)),mS(t,n)};function $oe(t,e){const n=vd.mirror.getId(t),s=n&&vd.mirror.getNode(n),r=s&&vd.mirror.getMeta(s),i=r&&fIe(r)?r:null;return{message:e,data:i?{nodeId:n,node:{id:n,tagName:i.tagName,textContent:Array.from(i.childNodes).map(a=>
94a.type===VT.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:lIe(i.attributes)}}:{}}}function uIe(t){const{target:e,message:n}=dIe(t);return zc({category:`ui.${t.name}`,...$oe(e,n)})}function dIe(t){const e=t.name==="click";let n,s=null;try{s=e?Doe(t.event):Ooe(t.event),n=gO(s,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:s,message:n}}function fIe(t){return t.type===VT.Element}function hIe(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=pIe(e);n&&mS(t,n)}function pIe(t){const{metaKey:e,shiftKey:n,ctrlKey:s,altKey:r,key:i,target:a}=t;if(!a||mIe(a)||!i)return null;const o=e||s||r,l=i.length===1;if(!o&&l)return null;const u=gO(a,{maxStringLength:200})||"<unknown>",d=$oe(a,u);return zc({category:"ui.keyDown",message:u,data:{...d.data,metaKey:e,shiftKey:n,ctrlKey:s,altKey:r,key:i}})}function mIe(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const gIe={resource:SIe,paint:yIe,navigation:bIe};function k_(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}
94function vIe(t){return t.map(xIe).filter(Boolean)}function xIe(t){const e=gIe[t.entryType];return e?e(t):null}function Bv(t){return((iAe||Vs.performance.timeOrigin)+t)/1e3}function yIe(t){const{duration:e,entryType:n,name:s,startTime:r}=t,i=Bv(r);return{type:n,name:s,start:i,end:i+e,data:void 0}}function bIe(t){const{entryType:e,name:n,decodedBodySize:s,duration:r,domComplete:i,encodedBodySize:a,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,domInteractive:u,loadEventStart:d,loadEventEnd:f,redirectCount:p,startTime:m,transferSize:v,type:x}=t;return r===0?null:{type:`${e}.${x}`,start:Bv(m),end:Bv(i),name:n,data:{size:v,decodedBodySize:s,encodedBodySize:a,duration:r,domInteractive:u,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,loadEventStart:d,loadEventEnd:f,domComplete:i,redirectCount:p}}}function SIe(t){const{entryType:e,initiatorType:n,name:s,responseEnd:r,startTime:i,decodedBodySize:a,encodedBodySize:o,responseStatus:l,transferSize:u}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:Bv(i),end:Bv(r),name:s,data:{size:u,statusCode:l,decodedBodySize:a,encodedBodySize:o}}}function wIe(t){const e=t.entries[t.entries.length-1],n=e&&e.element?[e.element]:void 0;return r4(t,"largest-contentful-paint",n)}function _Ie(t){return t.sources!==void 0}function EIe(t){const e=[],n=[];for(const s of t.entries)if(_Ie(s)){const r=[];for(const i of s.sources)if(i.node){n.push(i.node);const a=vd.mirror.getId(i.node);a&&r.push(a)}e.push({value:s.value,nodeIds:r.length?r:void 0})}return r4(t,"cumulative-layout-shift",n,e)}function CIe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return r4(t,"first-input-delay",n)}function TIe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return r4(t,"interaction-to-next-paint",n)}function r4(t,e,n,s){const r=t.value,i=t.rating,a=Bv(r);return{type:"web-vital",name:e,start:a,end:a,data:{value:r,size:r,rating:i,nodeIds:n?n.map(o=>vd.mirror.getId(o)):void 0,attributions:s}}}function kIe(t){function e(r){t.performanceEntries.includes(r)||t.performanceEntries.push(r)}function n({entries:r}){r.forEach(e)}const s=[];return["navigation","paint","resource"].forEach(r=>{s.push(Dv(r,n))}),s.push(Gae(k_(wIe,t)),lO(k_(EIe,t)),Wae(k_(CIe,t)),qae(k_(TIe,t))),()=>{s.forEach(r=>r())}}const tn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,RIe='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))}
vendor: 4,591 bytes, line 94
94,M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},U=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=x(f,15),M=b.t,E=b.l,A=x(h,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(a[t]^a[t+1]<<A^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;
94++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=U(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;o<e;++o){if(a+5>i.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function AIe(){const t=new Blob([RIe]);return URL.createObjectURL(t)}const KW=["info","warn","error","log"],CC="[Replay] ";function EN(t,e="info"){vNe({category:"console",data:{logger:"replay"},level:e,message:`${CC}${t}`},{level:e})}function NIe(){let t=!1,e=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:s=>{t=s.captureExceptions,e=s.traceInternals}};return tn?(KW.forEach(s=>
94{n[s]=(...r)=>{Kc[s](CC,...r),e&&EN(r.join(""),xNe(s))}}),n.exception=(s,...r)=>{r.length&&n.error&&n.error(...r),Kc.error(CC,s),t?iNe(s):e&&EN(s,"error")},n.infoTick=(...s)=>{Kc.info(CC,...s),e&&setTimeout(()=>EN(s[0]),0)}):KW.forEach(s=>{n[s]=()=>{}}),n}const rn=NIe();class AO extends Error{constructor(){super(`Event buffer exceeded maximum size of ${wO}.`)}}class Foe{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>wO)throw new AO;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?RO(e):null}}class IIe{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:s})=>{s.success?e():n()},{once:!0}),this._worker.addEventListener("error",s=>{n(s)},{once:!0})}),this._ensureReadyPromise)}destroy(){tn&&rn.info("Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const s=this._getAndIncrementId();return new Promise((r,i)=>{const a=({data:o})=>{const l=o;if(l.method===e&&l.id===s){if(this._worker.removeEventListener("message",a),!l.success){tn&&rn.error("Error in compression worker: ",l.response),i(new Error("Error in compression worker"));return}r(l.response)}};this._worker.addEventListener("message",a),this._worker.postMessage({id:s,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class LIe{constructor(e){this._worker=new IIe(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const n=RO(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const s=JSON.stringify(e);return this._totalSize+=s.length,this._totalSize>wO?Promise.reject(new AO):this._sendEventToWorker(s)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{tn&&rn.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class jIe{constructor(e){this._fallback=new Foe,this._compression=new LIe(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){tn&&rn.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n,waitForCheckout:s}=this._fallback,r=[];for(const i of e)r.push(this._compression.addEvent(i));this._compression.hasCheckout=n,this._compression.waitForCheckout=s,this._used=this._compression;try{await Promise.all(r),this._fallback.clear()}catch(i){tn&&rn.exception(i,"Failed to add events when switching buffers.")}}}function PIe({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=MIe(e);if(n)return n}return tn&&rn.info("Using simple buffer"),new Foe}function MIe(t){try{const e=t||DIe();if(!e)return;tn&&rn.info(`Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new jIe(n)}catch(e){tn&&rn.exception(e,"Failed to create compression worker")}}function DIe(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?AIe():""}function NO(){try{return"sessionStorage"in Vs&&!!Vs.sessionStorage}catch{return!1}}function OIe(t){$Ie(),t.session=void 0}function $Ie(){if(NO())try{Vs.sessionStorage.removeItem(bO)}catch{}}function Uoe(t){return t===void 0?!1:Math.random()<t}function Boe(t){const e=Date.now(),n=t.id||fh(),s=t.started||e,r=t.lastActivity||e,i=t.segmentId||0,a=t.sampled,o=t.previousSessionId;return{id:n,started:s,lastActivity:r,segmentId:i,sampled:a,previousSessionId:o}}function IO(t){if(NO())try{Vs.sessionStorage.setItem(bO,JSON.stringify(t))}catch{}}function FIe(t,e){return Uoe(t)?"session":e?"buffer":!1}function YW({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:s}={}){const r=FIe(t,e),i=Boe({sampled:r,previousSessionId:s});return n&&IO(i),i}function UIe(){if(!NO())return null;try{const t=Vs.sessionStorage.getItem(bO);if(!t)return null;const e=JSON.parse(t);return tn&&rn.infoTick("Loading existing session"),Boe(e)}catch{return null}}function Dj(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function zoe(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:s=Date.now()}){return Dj(t.started,e,s)||Dj(t.lastActivity,n,s)}function Voe(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!zoe(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function CN({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},s){const r=s.stickySession&&UIe();return r?Voe(r,{sessionIdleExpire:t,maxReplayDuration:e})?(tn&&rn.infoTick("Session in sessionStorage is expired, creating new one..."),YW(s,{previousSessionId:r.id})):r:(tn&&rn.infoTick("Creating new session"),YW(s,{previousSessionId:n}))}function BIe(t){return t.type===En.Custom}function LO(t,e,n){return Goe(t,e)?(Hoe(t,e,n),!0):!1}function zIe(t,e,n){return Goe(t,e)?Hoe(t,e,n):Promise.resolve(null)}async function Hoe(t,e,n){const{eventBuffer:s}=t;if(!s||s.waitForCheckout&&!n)return null;const r=t.recordingMode==="buffer";try{n&&r&&s.clear(),n&&(s.hasCheckout=!0,s.waitForCheckout=!1);const i=t.getOptions(),a=VIe(e,i.beforeAddRecordingEvent);return a?await s.addEvent(a):void 0}catch(i){const a=i&&i instanceof AO,o=a?"addEventSizeExceeded":"addEvent";if(a&&r)return s.clear(),s.waitForCheckout=!0,null;t.handleException(i),await t.stop({reason:o});const l=fu();l&&l.recordDroppedEvent("internal_sdk_error","replay")}}function Goe(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=RO(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(tn&&rn.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function VIe(t,e){try{if(typeof e=="function"&&BIe(t))return e(t)}catch(n){return tn&&rn.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}function jO(t){return!t.type}function Oj(t){return t.type==="transaction"}function HIe(t){return t.type==="replay_event"}function ZW(t){return t.type==="feedback"}function GIe(t){return(e,n)=>{if(!t.isEnabled()||!jO(e)&&!Oj(e))return;const s=n&&n.statusCode;if(!(!s||s<200||s>=300)){if(Oj(e)){WIe(t,e);return}qIe(t,e)}}}function WIe(t,e){const n=t.getContext();e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function qIe(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:s}=t.getOptions();typeof s=="function"&&!s(e)||Ov(async()=>{try{await t.sendBufferedReplayOrFlush()}catch(r){t.handleException(r)}})}function KIe(t){return e=>{!t.isEnabled()||!jO(e)||YIe(t,e)}}function YIe(t,e){const n=e.exception&&e.exception.values&&e.exception.values[0]&&e.exception.values[0].value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const s=zc({category:"replay.hydrate-error",data:{url:X3e()}});mS(t,s)}}function ZIe(t){const e=fu();e&&e.on("beforeAddBreadcrumb",n=>XIe(t,n))}function XIe(t,e){if(!t.isEnabled()||!Woe(e))return;const n=QIe(e);n&&mS(t,n)}function QIe(t){return!Woe(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?JIe(t):zc(t)}function JIe(t){const e=t.data&&t.data.arguments;if(!Array.isArray(e)||e.length===0)return zc(t);let n=!1;const s=e.map(r=>{if(!r)return r;if(typeof r=="string")return r.length>E_?(n=!0,`${r.slice(0,E_)}…`):r;if(typeof r=="object")try{const i=Zu(r,7);return JSON.stringify(i).length>E_?(n=!0,`${JSON.stringify(i,null,2).slice(0,E_)}…`):i}catch{}return r});return zc({...t,data:{...t.data,arguments:s,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function Woe(t){return!!t.category}function eLe(t,e){return t.type||!t.exception||!t.exception.values||!t.exception.values.length?!1:!!(e.originalException&&e.originalException.__rrweb__)}function qoe(){const t=hS().getPropagationContext().dsc;t&&delete t.replay_id;const e=uoe();if(e){const n=foe(e);delete n.replay_id}}function tLe(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:En.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function nLe(t,e){return t.recordingMode!=="buffer"||e.message===SO||!e.exception||e.type?!1:Uoe(t.getOptions().errorSampleRate)}function sLe(t){return Object.assign((e,n)=>!t.isEnabled()||t.isPaused()?e:HIe(e)?(delete e.breadcrumbs,e):!jO(e)&&!Oj(e)&&!ZW(e)?e:t.checkAndHandleExpiredSession()?ZW(e)?(t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),tLe(t,e),e):eLe(e,n)&&!t.getOptions()._experiments.captureExceptions?(tn&&rn.log("Ignoring error from rrweb internals",e),null):((nLe(t,e)||t.recordingMode==="session")&&(e.tags={...e.tags,replayId:t.getSessionId()}),e):(qoe(),e),{id:"Replay"})}function i4(t,e){return e.map(({type:n,start:s,end:r,name:i,data:a})=>{const o=t.throttledAddEvent({type:En.Custom,timestamp:s,data:{tag:"performanceSpan",payload:{op:n,description:i,startTimestamp:s,endTimestamp:r,data:a}}});
94return typeof o=="string"?Promise.resolve(null):o})}function rLe(t){const{from:e,to:n}=t,s=Date.now()/1e3;return{type:"navigation.push",start:s,end:s,name:n,data:{previous:e}}}function iLe(t){return e=>{if(!t.isEnabled())return;const n=rLe(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(i4(t,[n]),!1)))}}function aLe(t,e){return tn&&t.getOptions()._experiments.traceInternals?!1:hNe(e,fu())}function Koe(t,e){t.isEnabled()&&e!==null&&(aLe(t,e.name)||t.addUpdate(()=>(i4(t,[e]),!0)))}function a4(t){if(!t)return;const e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=Qoe(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function Yoe(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function Zoe(t){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[Qoe(t)];if(!t)return[void 0]}catch(e){return tn&&rn.exception(e,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return tn&&rn.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function HT(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},s=n.warnings||[];return n.warnings=[...s,e],t._meta=n,t}function Xoe(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:s,url:r,method:i,statusCode:a,request:o,response:l}=e;return{type:t,start:n/1e3,end:s/1e3,name:r,data:Zl({method:i,statusCode:a,request:o,response:l})}}function Kb(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function hh(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const s={headers:t,size:e},{body:r,warnings:i}=oLe(n);return s.body=r,i&&i.length>0&&(s._meta={warnings:i}),s}function $j(t,e){return Object.entries(t).reduce((n,[s,r])=>{const i=s.toLowerCase();return e.includes(i)&&t[s]&&(n[i]=r),n},{})}function Qoe(t){return new URLSearchParams(t).toString()}function oLe(t){if(!t||typeof t!="string")return{body:t};const e=t.length>NW,n=lLe(t);if(e){const s=t.slice(0,NW);return n?{body:s,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${s}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function lLe(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function GT(t,e){const n=cLe(t);return J3e(n,e)}function cLe(t,e=Vs.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(Vs.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const s=n.href;return!t.endsWith("/")&&s.endsWith("/")?s.slice(0,-1):s}async function uLe(t,e,n){try{const s=await fLe(t,e,n),r=Xoe("resource.fetch",s);Koe(n.replay,r)}catch(s){tn&&rn.exception(s,"Failed to capture fetch breadcrumb")}}function dLe(t,e){const{input:n,response:s}=e,r=n?Joe(n):void 0,i=a4(r),a=s?Yoe(s.headers.get("content-length")):void 0;i!==void 0&&(t.data.request_body_size=i),a!==void 0&&(t.data.response_body_size=a)}async function fLe(t,e,n){const s=Date.now(),{startTimestamp:r=s,endTimestamp:i=s}=e,{url:a,method:o,status_code:l=0,request_body_size:u,response_body_size:d}=t.data,f=GT(a,n.networkDetailAllowUrls)&&!GT(a,n.networkDetailDenyUrls),p=f?hLe(n,e.input,u):Kb(u),m=await pLe(f,n,e.response,d);return{startTimestamp:r,endTimestamp:i,url:a,method:o,statusCode:l,request:p,response:m}}function hLe({networkCaptureBodies:t,networkRequestHeaders:e},n,s){const r=n?vLe(n,e):{};if(!t)return hh(r,s,void 0);const i=Joe(n),[a,o]=Zoe(i),l=hh(r,s,a);return o?HT(l,o):l}async function pLe(t,{networkCaptureBodies:e,networkResponseHeaders:n},s,r){if(!t&&r!==void 0)return Kb(r);const i=s?ele(s.headers,n):{};if(!s||!e&&r!==void 0)return hh(i,r,void 0);const[a,o]=await gLe(s),l=mLe(a,{networkCaptureBodies:e,responseBodySize:r,captureDetails:t,headers:i});return o?HT(l,o):l}function mLe(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:s,headers:r}){try{const i=t&&t.length&&n===void 0?a4(t):n;return s?e?hh(r,i,t):hh(r,i,void 0):Kb(i)}catch(i){return tn&&rn.exception(i,"Failed to serialize response body"),hh(r,n,void 0)}}async function gLe(t){const e=xLe(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await yLe(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(tn&&rn.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(tn&&rn.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function Joe(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}function ele(t,e){const n={};return e.forEach(s=>{t.get(s)&&(n[s]=t.get(s))}),n}
94function vLe(t,e){return t.length===1&&typeof t[0]!="string"?XW(t[0],e):t.length===2?XW(t[1],e):{}}function XW(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?ele(n,e):Array.isArray(n)?{}:$j(n,e):{}}function xLe(t){try{return t.clone()}catch(e){tn&&rn.exception(e,"Failed to clone response body")}}function yLe(t){return new Promise((e,n)=>{const s=Ov(()=>n(new Error("Timeout while trying to read response body")),500);bLe(t).then(r=>e(r),r=>n(r)).finally(()=>clearTimeout(s))})}async function bLe(t){return await t.text()}async function SLe(t,e,n){try{const s=_Le(t,e,n),r=Xoe("resource.xhr",s);Koe(n.replay,r)}catch(s){tn&&rn.exception(s,"Failed to capture xhr breadcrumb")}}function wLe(t,e){const{xhr:n,input:s}=e;if(!n)return;const r=a4(s),i=n.getResponseHeader("content-length")?Yoe(n.getResponseHeader("content-length")):kLe(n.response,n.responseType);r!==void 0&&(t.data.request_body_size=r),i!==void 0&&(t.data.response_body_size=i)}function _Le(t,e,n){const s=Date.now(),{startTimestamp:r=s,endTimestamp:i=s,input:a,xhr:o}=e,{url:l,method:u,status_code:d=0,request_body_size:f,response_body_size:p}=t.data;if(!l)return null;if(!o||!GT(l,n.networkDetailAllowUrls)||GT(l,n.networkDetailDenyUrls)){const R=Kb(f),I=Kb(p);return{startTimestamp:r,endTimestamp:i,url:l,method:u,statusCode:d,request:R,response:I}}const m=o[Up],v=m?$j(m.request_headers,n.networkRequestHeaders):{},x=$j(ELe(o),n.networkResponseHeaders),[y,S]=n.networkCaptureBodies?Zoe(a):[void 0],[_,E]=n.networkCaptureBodies?CLe(o):[void 0],T=hh(v,f,y),k=hh(x,p,_);return{startTimestamp:r,endTimestamp:i,url:l,method:u,statusCode:d,request:S?HT(T,S):T,response:E?HT(k,E):k}}function ELe(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
95`).reduce((n,s)=>{const[r,i]=s.split(": ");return i&&(n[r.toLowerCase()]=i),n},{}):{}}function CLe(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return TLe(t.response,t.responseType)}catch(n){e.push(n)}return tn&&rn.warn("Failed to get xhr response body",...e),[void 0]}function TLe(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return tn&&rn.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return tn&&rn.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function kLe(t,e){try{const n=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return a4(n)}catch{return}}function RLe(t){const e=fu();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:s,networkCaptureBodies:r,networkRequestHeaders:i,networkResponseHeaders:a}=t.getOptions(),o={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:s,networkCaptureBodies:r,networkRequestHeaders:i,networkResponseHeaders:a};e&&e.on("beforeAddBreadcrumb",(l,u)=>ALe(o,l,u))}catch{}}function ALe(t,e,n){if(e.data)try{NLe(e)&&LLe(n)&&(wLe(e,n),SLe(e,n,t)),ILe(e)&&jLe(n)&&(dLe(e,n),uLe(e,n,t))}catch(s){tn&&rn.exception(s,"Error when enriching network breadcrumb")}}function NLe(t){return t.category==="xhr"}function ILe(t){return t.category==="fetch"}function LLe(t){return t&&t.xhr}function jLe(t){return t&&t.response}function PLe(t){const e=fu();Qae(cIe(t)),K5(iLe(t)),ZIe(t),RLe(t);const n=sLe(t);oNe(n),e&&(e.on("beforeSendEvent",KIe(t)),e.on("afterSendEvent",GIe(t)),e.on("createDsc",s=>{const r=t.getSessionId();r&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(s.replay_id=r)}),e.on("spanStart",s=>{t.lastActiveSpan=s}),e.on("spanEnd",s=>{t.lastActiveSpan=s}),e.on("beforeSendFeedback",(s,r)=>{const i=t.getSessionId();r&&r.includeReplay&&t.isEnabled()&&i&&s.contexts&&s.contexts.feedback&&(s.contexts.feedback.replay_id=i)}))}async function MLe(t){try{return Promise.all(i4(t,[DLe(Vs.performance.memory)]))}catch{return[]}}function DLe(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:s}=t,r=Date.now()/1e3;return{type:"memory",name:"memory",start:r,end:r,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:s}}}}function OLe(t,e,n){let s,r,i;const a=n&&n.maxWait?Math.max(n.maxWait,e):0;function o(){return l(),s=t(),s}function l(){r!==void 0&&clearTimeout(r),i!==void 0&&clearTimeout(i),r=i=void 0}function u(){return r!==void 0||i!==void 0?o():s}function d(){return r&&clearTimeout(r),r=Ov(o,e),a&&i===void 0&&(i=Ov(o,a)),s}return d.cancel=l,d.flush=u,d}const hp=Qa.navigator;function $Le(){return/iPhone|iPad|iPod/i.test(hp&&hp.userAgent||"")||/Macintosh/i.test(hp&&hp.userAgent||"")&&hp&&hp.maxTouchPoints&&hp.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function FLe(t){let e=!1;return(n,s)=>{if(!t.checkAndHandleExpiredSession()){tn&&rn.warn("Received replay event after session expired.");return}const r=s||!e;e=!0,t.clickDetector&&rIe(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&r&&t.setInitialState(),!LO(t,n,r))return!0;
95if(!r)return!1;const i=t.session;if(BLe(t,r),t.recordingMode==="buffer"&&i&&t.eventBuffer){const a=t.eventBuffer.getEarliestTimestamp();a&&(tn&&rn.info(`Updating session start time to earliest event in buffer to ${new Date(a)}`),i.started=a,t.getOptions().stickySession&&IO(i))}return i&&i.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}}function ULe(t){const e=t.getOptions();return{type:En.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function BLe(t,e){!e||!t.session||t.session.segmentId!==0||LO(t,ULe(t),!1)}function zLe(t,e,n,s){return zAe(HAe(t,VAe(t),s,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function VLe({recordingData:t,headers:e}){let n;const s=`${JSON.stringify(e)}
96`;if(typeof t=="string")n=`${s}${t}`;else{const i=new TextEncoder().encode(s);n=new Uint8Array(i.length+t.length),n.set(i),n.set(t,i.length)}return n}async function HLe({client:t,scope:e,replayId:n,event:s}){const r=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,i={event_id:n,integrations:r};t.emit("preprocessEvent",s,i);const a=await QAe(t.getOptions(),s,i,e,t,e4());if(!a)return null;a.platform=a.platform||"javascript";const o=t.getSdkMetadata(),{name:l,version:u}=o&&o.sdk||{};return a.sdk={...a.sdk,name:l||"sentry.javascript.unknown",version:u||"0.0.0"},a}async function GLe({recordingData:t,replayId:e,segmentId:n,eventContext:s,timestamp:r,session:i}){const a=VLe({recordingData:t,headers:{segment_id:n}}),{urls:o,errorIds:l,traceIds:u,initialTimestamp:d}=s,f=fu(),p=hS(),m=f&&f.getTransport(),v=f&&f.getDsn();if(!f||!m||!v||!i.sampled)return xW({});const x={type:_Ne,replay_start_timestamp:d/1e3,timestamp:r/1e3,error_ids:l,trace_ids:u,urls:o,replay_id:e,segment_id:n,replay_type:i.sampled},y=await HLe({scope:p,client:f,replayId:e,event:x});if(!y)return f.recordDroppedEvent("event_processor","replay",x),tn&&rn.info("An event processor returned `null`, will not send event."),xW({});delete y.sdkProcessingMetadata;const S=zLe(y,a,v,f.getOptions().tunnel);let _;try{_=await m.send(S)}catch(T){const k=new Error(SO);try{k.cause=T}catch{}throw k}if(typeof _.statusCode=="number"&&(_.statusCode<200||_.statusCode>=300))throw new tle(_.statusCode);const E=fNe({},_);if(dNe(E,"replay"))throw new PO(E);return _}class tle extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class PO extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function nle(t,e={count:0,interval:ANe}){const{recordingData:n,onError:s}=t;if(n.length)try{return await GLe(t),!0}catch(r){if(r instanceof tle||r instanceof PO)throw r;if(aNe("Replays",{_retryCount:e.count}),s&&s(r),e.count>=NNe){const i=new Error(`${SO} - max retries exceeded`);try{i.cause=r}catch{}throw i}return e.interval*=++e.count,new Promise((i,a)=>{Ov(async()=>{try{await nle(t,e),i(!0)}catch(o){a(o)}},e.interval)})}}const sle="__THROTTLED",WLe="__SKIPPED";function qLe(t,e,n){const s=new Map,r=o=>{const l=o-n;s.forEach((u,d)=>{d<l&&s.delete(d)})},i=()=>[...s.values()].reduce((o,l)=>o+l,0);let a=!1;return(...o)=>{const l=Math.floor(Date.now()/1e3);if(r(l),i()>=e){const d=a;return a=!0,d?WLe:sle}a=!1;const u=s.get(l)||0;return s.set(l,u+1),t(...o)}}class $f{constructor({options:e,recordingOptions:n}){$f.prototype.__init.call(this),$f.prototype.__init2.call(this),$f.prototype.__init3.call(this),$f.prototype.__init4.call(this),$f.prototype.__init5.call(this),$f.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:ENe,sessionIdleExpire:CNe},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=OLe(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=qLe((a,o)=>zIe(this,a,o),300,5);const{slowClickTimeout:s,slowClickIgnoreSelectors:r}=this.getOptions(),i=s?{threshold:Math.min(INe,s),timeout:s,scrollTimeout:LNe,ignoreSelector:r?r.join(","):""}:void 0;if(i&&(this.clickDetector=new eIe(this,i)),tn){const a=e._experiments;rn.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){tn&&rn.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:s}=this._options,r=n<=0&&s<=0;if(this._requiresManualStart=r,!r){if(this._initializeSessionForSampling(e),!this.session){tn&&rn.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",tn&&rn.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}
96start(){if(this._isEnabled&&this.recordingMode==="session"){tn&&rn.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){tn&&rn.info("Buffering is in progress, call `flush()` to save the replay");return}tn&&rn.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=CN({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this._initializeRecording()}startBuffering(){if(this._isEnabled){tn&&rn.info("Buffering is in progress, call `flush()` to save the replay");return}tn&&rn.infoTick("Starting replay in buffer mode");const e=CN({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=vd({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:RNe}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:FLe(this),...$Le(),onMutation:this._onMutationHandler,...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}async stop({forceFlush:e=!1,reason:n}={}){if(this._isEnabled){this._isEnabled=!1;try{tn&&rn.info(`Stopping Replay${n?` triggered by ${n}`:""}`),qoe(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,OIe(this)}catch(s){this.handleException(s)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),tn&&rn.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),tn&&rn.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();tn&&rn.info("Converting buffer to session"),await this.flushImmediate();const s=this.stopRecording();!e||!s||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode!=="buffer"&&n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&Dj(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${Vs.location.pathname}${Vs.location.hash}${Vs.location.search}`,n=`${Vs.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const s=this._throttledAddEvent(e,n);if(s===sle){const r=zc({category:"replay.throttled"});this.addUpdate(()=>!LO(this,{type:q6e,timestamp:r.timestamp||0,data:{tag:"breadcrumb",payload:r,metric:!0}}))}return s}getCurrentRoute(){const e=this.lastActiveSpan||uoe(),n=e&&yO(e),r=(n&&Vb(n).data||{})[coe];if(!(!n||!r||!["route","custom"].includes(r)))return Vb(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=PIe({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,s=CN({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=s}_checkSession(){if(!this.session)return!1;const e=this.session;return Voe(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{Vs.document.addEventListener("visibilitychange",this._handleVisibilityChange),Vs.addEventListener("blur",this._handleWindowBlur),Vs.addEventListener("focus",this._handleWindowFocus),Vs.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(PLe(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=kIe(this)}_removeListeners(){try{Vs.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Vs.removeEventListener("blur",this._handleWindowBlur),Vs.removeEventListener("focus",this._handleWindowFocus),Vs.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}__init(){this._handleVisibilityChange=()=>{Vs.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroun
96dTasks()}}__init2(){this._handleWindowBlur=()=>{const e=zc({category:"ui.blur"});this._doChangeToBackgroundTasks(e)}}__init3(){this._handleWindowFocus=()=>{const e=zc({category:"ui.focus"});this._doChangeToForegroundTasks(e)}}__init4(){this._handleKeyboardEvent=e=>{hIe(this,e)}}_doChangeToBackgroundTasks(e){!this.session||zoe(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){tn&&rn.info("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:En.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=vIe(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;e=e.filter(s=>s.start>=n)}return Promise.all(i4(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;const s=n.getEarliestTimestamp();s&&s<this._context.initialTimestamp&&(this._context.initialTimestamp=s)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){tn&&rn.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await MLe(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const s=this._popEventContext(),r=this.session.segmentId++;this._maybeSaveSession();const i=await this.eventBuffer.finish();await nle({replayId:e,recordingData:i,segmentId:r,eventContext:s,session:this.session,timestamp:n,onError:a=>this.handleException(a)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const s=fu();if(s){const r=n instanceof PO?"ratelimit_backoff":"send_error";s.recordDroppedEvent(r,"replay")}}}__init5(){this._flush=async({force:e=!1}={})=>{if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){tn&&rn.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,r=Date.now()-n;this._debouncedFlush.cancel();const i=r<this._options.minReplayDuration,a=r>this._options.maxReplayDuration+5e3;if(i||a){tn&&rn.info(`Session duration (${Math.floor(r/1e3)}s) is too ${i?"short":"long"}, not sending replay.`),i&&this._debouncedFlush();return}const o=this.eventBuffer;o&&this.session.segmentId===0&&!o.hasCheckout&&tn&&rn.info("Flushing initial segment without checkout.");const l=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,l&&this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&IO(this.session)}__init6(){this._onMutationHandler=e=>{const n=e.length,s=this._options.mutationLimit,r=this._options.mutationBreadcrumbLimit,i=s&&n>s;if(n>r||i){const a=zc({category:"replay.mutations",data:{count:n,limit:i}});this._createCustomBreadcrumb(a)}return i?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function Yx(t,e){return[...t,...e].join(",")}function KLe({mask:t,unmask:e,block:n,unblock:s,ignore:r}
96){const i=["base","iframe[srcdoc]:not([src])"],a=Yx(t,[".sentry-mask","[data-sentry-mask]"]),o=Yx(e,[]);return{maskTextSelector:a,unmaskTextSelector:o,blockSelector:Yx(n,[".sentry-block","[data-sentry-block]",...i]),unblockSelector:Yx(s,[]),ignoreSelector:Yx(r,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function YLe({el:t,key:e,maskAttributes:n,maskAllText:s,privacyOptions:r,value:i}){return!s||r.unmaskTextSelector&&t.matches(r.unmaskTextSelector)?i:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?i.replace(/[\S]/g,"*"):i}const QW='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',ZLe=["content-length","content-type","accept"];let JW=!1;const XLe=(t=>new o4(t));class o4{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:e=TNe,flushMaxDelay:n=kNe,minReplayDuration:s=jNe,maxReplayDuration:r=IW,stickySession:i=!0,useCompression:a=!0,workerUrl:o,_experiments:l={},maskAllText:u=!0,maskAllInputs:d=!0,blockAllMedia:f=!0,mutationBreadcrumbLimit:p=750,mutationLimit:m=1e4,slowClickTimeout:v=7e3,slowClickIgnoreSelectors:x=[],networkDetailAllowUrls:y=[],networkDetailDenyUrls:S=[],networkCaptureBodies:_=!0,networkRequestHeaders:E=[],networkResponseHeaders:T=[],mask:k=[],maskAttributes:R=["title","placeholder"],unmask:I=[],block:A=[],unblock:L=[],ignore:j=[],maskFn:F,beforeAddRecordingEvent:O,beforeErrorSampling:M,onError:U}={}){this.name=o4.id;const G=KLe({mask:k,unmask:I,block:A,unblock:L,ignore:j});if(this._recordingOptions={maskAllInputs:d,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:F,maskInputFn:F,maskAttributeFn:($,V,B)=>YLe({maskAttributes:R,maskAllText:u,privacyOptions:G,key:$,value:V,el:B}),...G,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:$=>{try{$.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(s,PNe),maxReplayDuration:Math.min(r,IW),stickySession:i,useCompression:a,workerUrl:o,blockAllMedia:f,maskAllInputs:d,maskAllText:u,mutationBreadcrumbLimit:p,mutationLimit:m,slowClickTimeout:v,slowClickIgnoreSelectors:x,networkDetailAllowUrls:y,networkDetailDenyUrls:S,networkCaptureBodies:_,networkRequestHeaders:eq(E),networkResponseHeaders:eq(T),beforeAddRecordingEvent:O,beforeErrorSampling:M,onError:U,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${QW}`:QW),this._isInitialized&&AW())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return JW}set _isInitialized(e){JW=e}afterAllSetup(e){!AW()||this._replay||(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}getRecordingMode(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const n=QLe(this._initialOptions,e);this._replay=new $f({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}o4.__initStatic();function QLe(t,e){const n=e.getOptions(),s={sessionSampleRate:0,errorSampleRate:0,...Zl(t)},r=CW(n.replaysSessionSampleRate),i=CW(n.replaysOnErrorSampleRate);return r==null&&i==null&&dO(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),r!=null&&(s.sessionSampleRate=r),i!=null&&(s.errorSampleRate=i),s}function eq(t){return[...ZLe,...t.map(e=>e.toLowerCase())]}const tq=new WeakMap,TN=new Map,TC={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function JLe(t,e){const{traceFetch:n,traceXHR:s,trackFetchStreamPerformance:r,shouldCreateSpanForRequest:i,enableHTTPTimings:a,tracePropagationTargets:o}={traceFetch:TC.traceFetch,traceXHR:TC.traceXHR,trackFetchStreamPerformance:TC.trackFetchStreamPerformance,...e},l=typeof i=="function"?i:f=>!0,u=f=>n8e(f,o),d={};n&&(t.addEventProcessor(f=>(f.type==="transaction"&&f.spans&&f.spans.forEach(p=>{if(p.op==="http.client"){const m=TN.get(p.span_id);m&&(p.timestamp=m/1e3,TN.delete(p.span_id))}}),f)),r&&d5e(f=>{if(f.response){const p=tq.get(f.response);p&&f.endTimestamp&&TN.set(p,f.endTimestamp)}}),dae(f=>{const p=r5e(f,l,u,d);if(f.response&&f.fetchData.__span&&tq.set(f.response,f.fetchData.__span),p){const m=rle(f.fetchData.url),v=m?q0(m).host:void 0;p.setAttributes({"http.url":m,"server.address":v})}a&&p&&nq(p)})),s&&eoe(f=>{const p=s8e(f,l,u,d);a&&p&&nq(p)})}function e8e(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function nq(t){const{url:e}=dr(t).data||{};if(!e||typeof e!="string")return;const n=Dv("resource",({entries:s})=>
96{s.forEach(r=>{e8e(r)&&r.name.endsWith(e)&&(t8e(r).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function mc(t=0){return((CT||performance.timeOrigin)+t)/1e3}function t8e(t){const{name:e,version:n}=Xae(t.nextHopProtocol),s=[];return s.push(["network.protocol.version",n],["network.protocol.name",e]),CT?[...s,["http.request.redirect_start",mc(t.redirectStart)],["http.request.fetch_start",mc(t.fetchStart)],["http.request.domain_lookup_start",mc(t.domainLookupStart)],["http.request.domain_lookup_end",mc(t.domainLookupEnd)],["http.request.connect_start",mc(t.connectStart)],["http.request.secure_connection_start",mc(t.secureConnectionStart)],["http.request.connection_end",mc(t.connectEnd)],["http.request.request_start",mc(t.requestStart)],["http.request.response_start",mc(t.responseStart)],["http.request.response_end",mc(t.responseEnd)]]:s}function n8e(t,e){const n=Wt.location&&Wt.location.href;if(n){let s,r;try{s=new URL(t,n),r=new URL(n).origin}catch{return!1}const i=s.origin===r;return e?pm(s.toString(),e)||i&&pm(s.pathname,e):i}else{const s=!!t.match(/^\/(?!\/)/);return e?pm(t,e):s}}function s8e(t,e,n,s){const r=t.xhr,i=r&&r[Up];if(!r||r.__sentry_own_request__||!i)return;const a=Eh()&&e(i.url);if(t.endTimestamp&&a){const f=r.__sentry_xhr_span_id__;if(!f)return;const p=s[f];p&&i.status_code!==void 0&&(Aie(p,i.status_code),p.end(),delete s[f]);return}const o=rle(i.url),l=o?q0(o).host:void 0,u=!!Md(),d=a&&u?K9({name:`${i.method} ${i.url}`,attributes:{type:"xhr","http.method":i.method,"http.url":o,url:i.url,"server.address":l,[Nm]:"auto.http.browser",[$b]:"http.client"}}):new S1;return r.__sentry_xhr_span_id__=d.spanContext().spanId,s[r.__sentry_xhr_span_id__]=d,n(i.url)&&r8e(r,Eh()&&u?d:void 0),d}function r8e(t,e){const{"sentry-trace":n,baggage:s}=aae({span:e});n&&i8e(t,n,s)}function i8e(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader("baggage",n)}catch{}}function rle(t){try{return new URL(t,Wt.location.origin).href}catch{return}}function a8e(){Wt&&Wt.document?Wt.document.addEventListener("visibilitychange",()=>{const t=Md();if(!t)return;const e=ul(t);if(Wt.document.hidden&&e){const n="cancelled",{op:s,status:r}=dr(e);ko&&gt.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${s}`),r||e.setStatus({code:mi,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):ko&&gt.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const o8e="BrowserTracing",l8e={...bC,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...TC},ile=((t={})=>{tTe();const{enableInp:e,enableLongTask:n,enableLongAnimationFrame:s,_experiments:{enableInteractions:r,enableStandaloneClsSpans:i},beforeStartSpan:a,idleTimeout:o,finalTimeout:l,childSpanTimeout:u,markBackgroundSpan:d,traceFetch:f,traceXHR:p,trackFetchStreamPerformance:m,shouldCreateSpanForRequest:v,enableHTTPTimings:x,instrumentPageLoad:y,instrumentNavigation:S}={...l8e,...t},_=pRe({recordClsStandaloneSpans:i||!1});e&&FRe(),s&&hs.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?gRe():n&&mRe(),r&&vRe();const E={name:void 0,source:void 0};function T(k,R){const I=R.op==="pageload",A=a?a(R):R,L=A.attributes||{};R.name!==A.name&&(L[dd]="custom",A.attributes=L),E.name=A.name,E.source=L[dd];const j=Zie(A,{idleTimeout:o,finalTimeout:l,childSpanTimeout:u,disableAutoFinish:I,beforeSpanEnd:O=>{_(),wRe(O,{recordClsOnPageloadSpan:!i})}});function F(){["interactive","complete"].includes(Wt.document.readyState)&&k.emit("idleSpanEnableAutoFinish",j)}return I&&Wt.document&&(Wt.document.addEventListener("readystatechange",()=>{F()}),F()),j}return{name:o8e,afterAllSetup(k){let R,I=Wt.location&&Wt.location.href;function A(){R&&!dr(R).timestamp&&(ko&&gt.log(`[Tracing] Finishing current active span with op: ${dr(R).op}`),R.end())}k.on("startNavigationSpan",L=>{Us()===k&&(A(),R=T(k,{op:"navigation",...L}))}),k.on("startPageLoadSpan",(L,j={})=>
96{if(Us()!==k)return;A();const F=j.sentryTrace||sq("sentry-trace"),O=j.baggage||sq("baggage"),M=KCe(F,O);jr().setPropagationContext(M),R=T(k,{op:"pageload",...L})}),k.on("spanEnd",L=>{const j=dr(L).op;if(L!==ul(L)||j!=="navigation"&&j!=="pageload")return;const F=jr(),O=F.getPropagationContext();F.setPropagationContext({...O,sampled:O.sampled!==void 0?O.sampled:Ym(L),dsc:O.dsc||w1(L)})}),Wt.location&&(y&&ale(k,{name:Wt.location.pathname,startTime:CT?CT/1e3:void 0,attributes:{[dd]:"url",[Nm]:"auto.pageload.browser"}}),S&&K5(({to:L,from:j})=>{if(j===void 0&&I&&I.indexOf(L)!==-1){I=void 0;return}j!==L&&(I=void 0,c8e(k,{name:Wt.location.pathname,attributes:{[dd]:"url",[Nm]:"auto.navigation.browser"}}))})),d&&a8e(),r&&u8e(o,l,u,E),e&&BRe(),JLe(k,{traceFetch:f,traceXHR:p,trackFetchStreamPerformance:m,tracePropagationTargets:k.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:v,enableHTTPTimings:x})}}});function ale(t,e,n){t.emit("startPageLoadSpan",e,n),jr().setTransactionName(e.name);const s=Md();return(s&&dr(s).op)==="pageload"?s:void 0}function c8e(t,e){xl().setPropagationContext({traceId:Sh()}),jr().setPropagationContext({traceId:Sh()}),t.emit("startNavigationSpan",e),jr().setTransactionName(e.name);const n=Md();return(n&&dr(n).op)==="navigation"?n:void 0}function sq(t){const e=mCe(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function u8e(t,e,n,s){let r;const i=()=>{const a="ui.action.click",o=Md(),l=o&&ul(o);if(l){const u=dr(l).op;if(["navigation","pageload"].includes(u)){ko&&gt.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(r&&(r.setAttribute(nj,"interactionInterrupted"),r.end(),r=void 0),!s.name){ko&&gt.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}r=Zie({name:s.name,op:a,attributes:{[dd]:s.source||"url"}},{idleTimeout:t,finalTimeout:e,childSpanTimeout:n})};Wt.document&&addEventListener("click",i,{once:!1,capture:!0})}const rq="8.55.2",d8e="sentry.source",f8e="sentry.op",h8e="sentry.origin";function p8e(t,e,n=[e],s="npm"){const r=t._metadata||{};r.sdk||(r.sdk={name:`sentry.javascript.${e}`,packages:n.map(i=>({name:`${s}:@sentry/${i}`,version:rq})),version:rq}),t._metadata=r}function m8e(t){const e={...t};return p8e(e,"react"),V5("react",{version:w.version}),$3e(e)}var kN={exports:{}},os={};/** @license React v16.13.1
97 * react-is.production.min.js
98 *
99 * Copyright (c) Facebook, Inc. and its affiliates.
100 *
101 * This source code is licensed under the MIT license found in the
102 * LICENSE file in the root directory of this source tree.
103 */var iq;function g8e(){if(iq)return os;iq=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,o=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,f=t?Symbol.for("react.suspense"):60113,p=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,x=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,S=t?Symbol.for("react.responder"):60118,_=t?Symbol.for("react.scope"):60119;function E(k){if(typeof k=="object"&&k!==null){var R=k.$$typeof;switch(R){case e:switch(k=k.type,k){case l:case u:case s:case i:case r:case f:return k;default:switch(k=k&&k.$$typeof,k){case o:case d:case v:case m:case a:return k;default:return R}}case n:return R}}}function T(k){return E(k)===u}return os.AsyncMode=l,os.ConcurrentMode=u,os.ContextConsumer=o,os.ContextProvider=a,os.Element=e,os.ForwardRef=d,os.Fragment=s,os.Lazy=v,os.Memo=m,os.Portal=n,os.Profiler=i,os.StrictMode=r,os.Suspense=f,os.isAsyncMode=function(k){return T(k)||E(k)===l},os.isConcurrentMode=T,os.isContextConsumer=function(k){return E(k)===o},os.isContextProvider=function(k){return E(k)===a},os.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===e},os.isForwardRef=function(k){return E(k)===d},os.isFragment=function(k){return E(k)===s},os.isLazy=function(k){return E(k)===v},os.isMemo=function(k){return E(k)===m},os.isPortal=function(k){return E(k)===n},os.isProfiler=function(k){return E(k)===i},os.isStrictMode=function(k){return E(k)===r},os.isSuspense=function(k){return E(k)===f},os.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===s||k===u||k===i||k===r||k===f||k===p||typeof k=="object"&&k!==null&&(k.$$typeof===v||k.$$typeof===m||k.$$typeof===a||k.$$typeof===o||k.$$typeof===d||k.$$typeof===y||k.$$typeof===S||k.$$typeof===_||k.$$typeof===x)},os.typeOf=E,os}var aq;function v8e(){return aq||(aq=1,kN.exports=g8e()),kN.exports}var RN,oq;function x8e(){if(oq)return RN;oq=1;var t=v8e(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};i[t.ForwardRef]=s,i[t.Memo]=r;function a(v){return t.isMemo(v)?r:i[v.$$typeof]||e}var o=Object.defineProperty,l=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;function m(v,x,y){if(typeof x!="string"){if(p){var S=f(x);S&&S!==p&&m(v,S,y)}var _=l(x);u&&(_=_.concat(u(x)));for(var E=a(v),T=a(x),k=0;k<_.length;++k){var R=_[k];if(!n[R]&&!(y&&y[R])&&!(T&&T[R])&&!(E&&E[R])){var I=d(x,R);try{o(v,R,I)}catch{}}}}return v}return RN=m,RN}x8e();const y8e=new WeakSet;function b8e(t,e){const n=ile({...t,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:s,useLocation:r,useNavigationType:i,createRoutesFromChildren:a,matchRoutes:o,stripBasename:l,instrumentPageLoad:u=!0,instrumentNavigation:d=!0}=t;return{...n,setup(){},afterAllSetup(f){n.afterAllSetup(f);const p=Wt&&Wt.location&&Wt.location.pathname;u&&p&&ale(f,{name:p,attributes:{[d8e]:"url",[f8e]:"pageload",[h8e]:`auto.pageload.react.reactrouter_v${e}`}}),d&&y8e.add(f)}}}function S8e(t){return b8e(t,"7")}m8e({dsn:"https://e86879167e4ea2f5e51da0eaf475b2e2@o4505060702289920.ingest.us.sentry.io/4508480606240768",environment:"production",integrations:[S8e({useEffect:w.useEffect,useLocation:Gs,useNavigationType:K_e,createRoutesFromChildren:Y8,matchRoutes:T9}),ile(),XLe()],tracesSampleRate:1,tracePropagationTargets:["localhost",/^https:\/\/api\.steel\.dev/],replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1});function w8e(t){function e(n){var r;const s=n??this;
103if(!s)throw new TypeError(`${t.kind||t.name} type guard requires an error object`);return t.kind&&typeof s=="object"&&s!==null&&"constructor"in s&&((r=s.constructor)==null?void 0:r.kind)===t.kind?!0:s instanceof t}return e}var V8,_8e=(V8=class{constructor(t){js(this,"code");js(this,"message");js(this,"longMessage");js(this,"meta");var n,s,r,i,a,o,l;const e={code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:(n=t.meta)==null?void 0:n.param_name,sessionId:(s=t.meta)==null?void 0:s.session_id,emailAddresses:(r=t.meta)==null?void 0:r.email_addresses,identifiers:(i=t.meta)==null?void 0:i.identifiers,zxcvbn:(a=t.meta)==null?void 0:a.zxcvbn,plan:(o=t.meta)==null?void 0:o.plan,isPlanUpgradePossible:(l=t.meta)==null?void 0:l.is_plan_upgrade_possible}};this.code=e.code,this.message=e.message,this.longMessage=e.longMessage,this.meta=e.meta}},js(V8,"kind","ClerkApiError"),V8),Qp,ole=(Qp=class extends Error{constructor(n){super(new.target.formatMessage(new.target.kind,n.message,n.code,n.docsUrl),{cause:n.cause});js(this,"clerkError",!0);js(this,"code");js(this,"longMessage");js(this,"docsUrl");js(this,"cause");Object.setPrototypeOf(this,Qp.prototype),this.code=n.code,this.docsUrl=n.docsUrl,this.longMessage=n.longMessage,this.cause=n.cause}get name(){return this.constructor.name}toString(){return`[${this.name}]
104Message:${this.message}`}static formatMessage(n,s,r,i){const a="Clerk:",o=new RegExp(a.replace(" ","\\s*"),"i");return s=s.replace(o,""),s=`${a} ${s.trim()}
105
106(code="${r}")
107
108`,i&&(s+=`
109
110Docs: ${i}`),s}},js(Qp,"kind","ClerkError"),Qp),Jp,E8e=(Jp=class extends ole{constructor(n,s){const{data:r,status:i,clerkTraceId:a,retryAfter:o}=s;super({...s,message:n,code:"api_response_error"});js(this,"status");js(this,"clerkTraceId");js(this,"retryAfter");js(this,"errors");Object.setPrototypeOf(this,Jp.prototype),this.status=i,this.clerkTraceId=a,this.retryAfter=o,this.errors=(r||[]).map(l=>new _8e(l))}toString(){let n=`[${this.name}]
111Message:${this.message}
112Status:${this.status}
113Serialized errors: ${this.errors.map(s=>JSON.stringify(s))}`;return this.clerkTraceId&&(n+=`
114Clerk Trace ID: ${this.clerkTraceId}`),n}static formatMessage(n,s,r,i){return s}},js(Jp,"kind","ClerkAPIResponseError"),Jp);const lle=w8e(E8e),C8e=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invali
114d. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});function cle({packageName:t,customMessages:e}){let n=t;function s(i,a){if(!a)return`${n}: ${i}`;let o=i;const l=i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(const u of l){const d=(a[u[1]]||"").toString();o=o.replace(`{{${u[1]}}}`,d)}return`${n}: ${o}`}const r={...C8e,...e};return{setPackageName({packageName:i}){return typeof i=="string"&&(n=i),this},setMessages({customMessages:i}){return Object.assign(r,i||{}),this},throwInvalidPublishableKeyError(i){throw new Error(s(r.InvalidPublishableKeyErrorMessage,i))},throwInvalidProxyUrl(i){throw new Error(s(r.InvalidProxyUrlErrorMessage,i))},throwMissingPublishableKeyError(){throw new Error(s(r.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw new Error(s(r.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(i){throw new Error(s(r.MissingClerkProvider,i))},throw(i){throw new Error(s(i))}}}var em,Fj=(em=class extends ole{constructor(n,s){super({...s,message:n});js(this,"clerkRuntimeError",!0);Object.setPrototypeOf(this,em.prototype)}},js(em,"kind","ClerkRuntimeError"),em);const T8e={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},k8e=new Set(["first_factor","second_factor","multi_factor"]),R8e=new Set(["strict_mfa","strict","moderate","lax"]),A8e=t=>typeof t=="number"&&t>0,N8e=t=>k8e.has(t),I8e=t=>R8e.has(t),lq=t=>typeof t=="number"&&Number.isFinite(t)&&(t===-1||t>=0),AN=t=>t.replace(/^(org:)*/,"org:"),L8e=(t,e)=>{const{orgId:n,orgRole:s,orgPermissions:r}=e,i=t.role!==void 0,a=t.permission!==void 0;return!i&&!a?"skip":i&&typeof t.role!="string"||a&&typeof t.permission!="string"||!n||i&&(typeof s!="string"||!s||AN(s)!==AN(t.role))||a&&(!Array.isArray(r)||!r.includes(AN(t.permission)))?"fail":"pass"},cq=(t,e)=>{const{org:n,user:s}=P8e(t),[r,i]=e.split(":"),a=i||r;return r==="org"?n.includes(a):r==="user"?s.includes(a):[...n,...s].includes(a)},j8e=(t,e)=>{const{features:n,plans:s}=e,r=t.feature!==void 0,i=t.plan!==void 0;if(!r&&!i)return"skip";if(r&&typeof t.feature!="string"||i&&typeof t.plan!="string")return"fail";if(r){if(typeof n!="string"||!n)return"fail";try{if(!cq(n,t.feature))return"fail"}catch{return"fail"}}if(i){if(typeof s!="string"||!s)return"fail";try{if(!cq(s,t.plan))return"fail"}catch{return"fail"}}return"pass"},P8e=t=>{const e=t?t.split(",").map(n=>n.trim()):[];return{org:e.filter(n=>n.split(":")[0].includes("o")).map(n=>n.split(":")[1]),user:e.filter(n=>n.split(":")[0].includes("u")).map(n=>n.split(":")[1])}},M8e=t=>{if(!t)return!1;const e=r=>typeof r=="string"?T8e[r]:r,n=typeof t=="string"&&I8e(t),s=typeof t=="object"&&N8e(t.level)&&A8e(t.afterMinutes);return n||s?e.bind(null,t):!1},D8e=(t,{factorVerificationAge:e})=>{if(t.reverification===void 0)return"skip";if(!e||!Array.isArray(e)||e.length!==2||!lq(e[0])||!lq(e[1]))return"fail";const n=M8e(t.reverification);if(!n)return"fail";const{level:s,afterMinutes:r}=n(),[i,a]=e;if(i===-1&&a===-1)return"fail";const o=i!==-1&&r>i,l=a!==-1&&r>a;switch(s){case"first_factor":return o?"pass":"fail";case"second_factor":return a===-1?o?"pass":"fail":l?"pass":"fail";case"multi_factor":return a===-1?o?"pass":"fail":i===-1?"fail":o&&l?"pass":"fail"}},O8e=t=>t.some(e=>e==="pass")&&t.every(e=>e==="pass"||e==="skip"),$8e=t=>e=>t.userId?O8e([L8e(e,t),j8e(e,t),D8e(e,t)]):!1,F8e=({authObject:{sessionId:t,sessionStatus:e,userId:n,actor:s,orgId:r,orgRole:i,orgSlug:a,signOut:o,getToken:l,has:u,sessionClaims:d},options:{treatPendingAsSignedOut:f=!0}})=>{if(t===void 0&&n===void 0)return{isLoaded:!1,isSignedIn:void 0,sessionId:t,sessionClaims:void 0,userId:n,actor:void 0,orgId:void 0,orgRole:void 0,orgSlug:void 0,has:void 0,signOut:o,getToken:l};if(t===null&&n===null)return{isLoaded:!0,isSignedIn:!1,sessionId:t,userId:n,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:o,getToken:l};if(f&&e==="pending")return{isLoaded:!0,isSignedIn:!1,sessionId:null,userId:null,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:o,getToken:l};if(t&&d&&n&&r&&i)return{isLoaded:!0,isSignedIn:!0,sessionId:t,sessionClaims:d,userId:n,actor:s||null,orgId:r,orgRole:i,orgSlug:a||null,has:u,signOut:o,getToken:l};if(t&&d&&n&&!r)return{isLoaded:!0,isSignedIn:!0,sessionId:t,sessionClaims:d,userId:n,actor:s||null,orgId:null,orgRole:null,orgSlug:null,has:u,signOut:o,getToken:l}},U8e=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],ule=t=>typeof atob<"u"&&typeof atob=="function"?atob(t):typeof global<"u"&&global.Buffer?new global.Buffer(t,"base64").toString():t,dle="pk_live_",B8e="pk_test_";function fle(t){if(!t.endsWith("$"))return!1;const e=t.slice(0,-1);return e.includes("$")?!1:e.includes(".")}function uq(t,e={}){if(t=t||"",!t||!Uj(t)){if(e.fatal&&!t)throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment c
114onfiguration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(e.fatal&&!Uj(t))throw new Error("Publishable key not valid.");return null}const n=t.startsWith(dle)?"production":"development";let s;try{s=ule(t.split("_")[2])}catch{if(e.fatal)throw new Error("Publishable key not valid: Failed to decode key.");return null}if(!fle(s)){if(e.fatal)throw new Error("Publishable key not valid: Decoded key has invalid format.");return null}let r=s.slice(0,-1);return e.proxyUrl?r=e.proxyUrl:n!=="development"&&e.domain&&e.isSatellite&&(r=`clerk.${e.domain}`),{instanceType:n,frontendApi:r}}function Uj(t=""){try{if(!(t.startsWith(dle)||t.startsWith(B8e)))return!1;const e=t.split("_");if(e.length!==3)return!1;const n=e[2];return n?fle(ule(n)):!1}catch{return!1}}function z8e(){const t=new Map;return{isDevOrStagingUrl:e=>{if(!e)return!1;const n=typeof e=="string"?e:e.hostname;let s=t.get(n);return s===void 0&&(s=U8e.some(r=>n.endsWith(r)),t.set(n,s)),s}}}const V8e="METHOD_CALLED",H8e=.1;function N1(t,e){return{event:V8e,eventSamplingRate:H8e,payload:{method:t,...e}}}function G8e(t,e){return t.find(n=>n.organization.id===e)}var NN={exports:{}},IN={};/**
115 * @license React
116 * use-sync-external-store-shim.production.js
117 *
118 * Copyright (c) Meta Platforms, Inc. and affiliates.
119 *
120 * This source code is licensed under the MIT license found in the
121 * LICENSE file in the root directory of this source tree.
122 */var dq;function W8e(){if(dq)return IN;dq=1;var t=I5();function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,r=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function o(f,p){var m=p(),v=s({inst:{value:m,getSnapshot:p}}),x=v[0].inst,y=v[1];return i(function(){x.value=m,x.getSnapshot=p,l(x)&&y({inst:x})},[f,m,p]),r(function(){return l(x)&&y({inst:x}),f(function(){l(x)&&y({inst:x})})},[f]),a(m),m}function l(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!n(f,m)}catch{return!0}}function u(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return IN.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,IN}var fq;function q8e(){return fq||(fq=1,NN.exports=W8e()),NN.exports}var hle=q8e();const ple=0,mle=1,gle=2,hq=3;var pq=Object.prototype.hasOwnProperty;function Bj(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&Bj(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(pq.call(t,n)&&++s&&!pq.call(e,n)||!(n in e)||!Bj(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Fc=new WeakMap,nh=()=>{},ci=nh(),WT=Object,Sn=t=>t===ci,sl=t=>typeof t=="function",Td=(t,e)=>({...t,...e}),vle=t=>sl(t.then),LN={},R_={},MO="undefined",gS=typeof window!=MO,zj=typeof document!=MO,K8e=gS&&"Deno"in window,Y8e=()=>gS&&typeof window.requestAnimationFrame!=MO,Ff=(t,e)=>{const n=Fc.get(t);return[()=>!Sn(e)&&t.get(e)||LN,s=>{if(!Sn(e)){const r=t.get(e);e in R_||(R_[e]=r),n[5](e,Td(r,s),r||LN)}},n[6],()=>!Sn(e)&&e in R_?R_[e]:!Sn(e)&&t.get(e)||LN]};let Vj=!0;const Z8e=()=>Vj,[Hj,Gj]=gS&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[nh,nh],X8e=()=>{const t=zj&&document.visibilityState;return Sn(t)||t!=="hidden"},Q8e=t=>(zj&&document.addEventListener("visibilitychange",t),Hj("focus",t),()=>{zj&&document.removeEventListener("visibilitychange",t),Gj("focus",t)}),J8e=t=>{const e=()=>{Vj=!0,t()},n=()=>{Vj=!1};
122return Hj("online",e),Hj("offline",n),()=>{Gj("online",e),Gj("offline",n)}},eje={isOnline:Z8e,isVisible:X8e},tje={initFocus:Q8e,initReconnect:J8e},mq=!re.useId,Yb=!gS||K8e,nje=t=>Y8e()?window.requestAnimationFrame(t):setTimeout(t,1),sb=Yb?w.useEffect:w.useLayoutEffect,jN=typeof navigator<"u"&&navigator.connection,gq=!Yb&&jN&&(["slow-2g","2g"].includes(jN.effectiveType)||jN.saveData),A_=new WeakMap,sje=t=>WT.prototype.toString.call(t),PN=(t,e)=>t===`[object ${e}]`;let rje=0;const Wj=t=>{const e=typeof t,n=sje(t),s=PN(n,"Date"),r=PN(n,"RegExp"),i=PN(n,"Object");let a,o;if(WT(t)===t&&!s&&!r){if(a=A_.get(t),a)return a;if(a=++rje+"~",A_.set(t,a),Array.isArray(t)){for(a="@",o=0;o<t.length;o++)a+=Wj(t[o])+",";A_.set(t,a)}if(i){a="#";const l=WT.keys(t).sort();for(;!Sn(o=l.pop());)Sn(t[o])||(a+=o+":"+Wj(t[o])+",");A_.set(t,a)}}else a=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Zb=t=>{if(sl(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Wj(t):"",[t,e]};let ije=0;const qj=()=>++ije;async function xle(...t){const[e,n,s,r]=t,i=Td({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let a=i.populateCache;const o=i.rollbackOnError;let l=i.optimisticData;const u=p=>typeof o=="function"?o(p):o!==!1,d=i.throwOnError;if(sl(n)){const p=n,m=[],v=e.keys();for(const x of v)!/^\$(inf|sub)\$/.test(x)&&p(e.get(x)._k)&&m.push(x);return Promise.all(m.map(f))}return f(n);async function f(p){const[m]=Zb(p);if(!m)return;const[v,x]=Ff(e,m),[y,S,_,E]=Fc.get(e),T=()=>{const U=y[m];return(sl(i.revalidate)?i.revalidate(v().data,p):i.revalidate!==!1)&&(delete _[m],delete E[m],U&&U[0])?U[0](gle).then(()=>v().data):v().data};if(t.length<3)return T();let k=s,R,I=!1;const A=qj();S[m]=[A,0];const L=!Sn(l),j=v(),F=j.data,O=j._c,M=Sn(O)?F:O;if(L&&(l=sl(l)?l(M,F):l,x({data:l,_c:M})),sl(k))try{k=k(M)}catch(U){R=U,I=!0}if(k&&vle(k))if(k=await k.catch(U=>{R=U,I=!0}),A!==S[m][0]){if(I)throw R;return k}else I&&L&&u(R)&&(a=!0,x({data:M,_c:ci}));if(a&&!I)if(sl(a)){const U=a(k,M);x({data:U,error:ci,_c:ci})}else x({data:k,error:ci,_c:ci});if(S[m][1]=qj(),Promise.resolve(T()).then(()=>
122{x({_c:ci})}),I){if(d)throw R;return}return k}}const vq=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},yle=(t,e)=>{if(!Fc.has(t)){const n=Td(tje,e),s=Object.create(null),r=xle.bind(ci,t);let i=nh;const a=Object.create(null),o=(d,f)=>{const p=a[d]||[];return a[d]=p,p.push(f),()=>p.splice(p.indexOf(f),1)},l=(d,f,p)=>{t.set(d,f);const m=a[d];if(m)for(const v of m)v(f,p)},u=()=>{if(!Fc.has(t)&&(Fc.set(t,[s,Object.create(null),Object.create(null),Object.create(null),r,l,o]),!Yb)){const d=n.initFocus(setTimeout.bind(ci,vq.bind(ci,s,ple))),f=n.initReconnect(setTimeout.bind(ci,vq.bind(ci,s,mle)));i=()=>{d&&d(),f&&f(),Fc.delete(t)}}};return u(),[t,r,u,i]}return[t,Fc.get(t)[4]]},aje=(t,e,n,s,r)=>{const i=n.errorRetryCount,a=r.retryCount,o=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!Sn(i)&&a>i||setTimeout(s,o,r)},oje=Bj,[l4,lje]=yle(new Map),ble=Td({onLoadingSlow:nh,onSuccess:nh,onError:nh,onErrorRetry:aje,onDiscarded:nh,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:gq?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:gq?5e3:3e3,compare:oje,isPaused:()=>!1,cache:l4,mutate:lje,fallback:{}},eje),Sle=(t,e)=>{const n=Td(t,e);if(e){const{use:s,fallback:r}=t,{use:i,fallback:a}=e;s&&i&&(n.use=s.concat(i)),r&&a&&(n.fallback=Td(r,a))}return n},Kj=w.createContext({}),cje=t=>{const{value:e}=t,n=w.useContext(Kj),s=sl(e),r=w.useMemo(()=>s?e(n):e,[s,n,e]),i=w.useMemo(()=>s?r:Sle(n,r),[s,n,r]),a=r&&r.provider,o=w.useRef(ci);a&&!o.current&&(o.current=yle(a(i.cache||l4),r));const l=o.current;return l&&(i.cache=l[0],i.mutate=l[1]),sb(()=>{if(l)return l[2]&&l[2](),l[3]},[]),w.createElement(Kj.Provider,Td(t,{value:i}))},wle="$inf$",_le=gS&&window.__SWR_DEVTOOLS_USE__,uje=_le?window.__SWR_DEVTOOLS_USE__:[],dje=()=>{_le&&(window.__SWR_DEVTOOLS_REACT__=re)},Ele=t=>sl(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],fje=()=>Td(ble,w.useContext(Kj)),hje=t=>(e,n,s)=>t(e,n&&((...i)=>{const[a]=Zb(e),[,,,o]=Fc.get(l4);if(a.startsWith(wle))return n(...i);const l=o[a];return Sn(l)?n(...i):(delete o[a],l)}),s),pje=uje.concat(hje),mje=t=>function(...n){const s=fje(),[r,i,a]=Ele(n),o=Sle(s,a);let l=t;const{use:u}=o,d=(u||[]).concat(pje);for(let f=d.length;f--;)l=d[f](l);return l(r,i||o.fetcher||null,o)},gje=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r>=0&&(s[r]=s[s.length-1],s.pop())}},vje=(t,e)=>(...n)=>{const[s,r,i]=Ele(n),a=(i.use||[]).concat(e);return t(s,r,{...i,use:a})};dje();const MN=re.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),DN={dedupe:!0},xje=(t,e,n)=>{const{cache:s,compare:r,suspense:i,fallbackData:a,revalidateOnMount:o,revalidateIfStale:l,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:p}=n,[m,v,x,y]=Fc.get(s),[S,_]=Zb(t),E=w.useRef(!1),T=w.useRef(!1),k=w.useRef(S),R=w.useRef(e),I=w.useRef(n),A=()=>I.current,L=()=>A().isVisible()&&A().isOnline(),[j,F,O,M]=Ff(s,S),U=w.useRef({}).current,G=Sn(a)?Sn(n.fallback)?ci:n.fallback[S]:a,$=(me,Ce)=>{for(const Xe in U){const he=Xe;if(he==="data"){if(!r(me[he],Ce[he])&&(!Sn(me[he])||!r(ne,Ce[he])))return!1}else if(Ce[he]!==me[he])return!1}return!0},V=w.useMemo(()=>{const me=!S||!e?!1:Sn(o)?A().isPaused()||i?!1:l!==!1:o,Ce=Le=>{const qe=Td(Le);return delete qe._k,me?{isValidating:!0,isLoading:!0,...qe}:qe},Xe=j(),he=M(),De=Ce(Xe),Ge=Xe===he?De:Ce(he);let Je=De;return[()=>{const Le=Ce(j());return $(Le,Je)?(Je.data=Le.data,Je.isLoading=Le.isLoading,Je.isValidating=Le.isValidating,Je.error=Le.error,Je):(Je=Le,Le)},()=>Ge]},[s,S]),B=hle.useSyncExternalStore(w.useCallback(me=>O(S,(Ce,Xe)=>{$(Xe,Ce)||me()}),[s,S]),V[0],V[1]),q=!E.current,z=m[S]&&m[S].length>0,D=B.data,K=Sn(D)?G&&vle(G)?MN(G):G:D,Y=B.error,J=w.useRef(K),ne=p?Sn(D)?Sn(J.current)?K:J.current:D:K,Q=z&&!Sn(Y)?!1:q&&!Sn(o)?o:A().isPaused()?!1:i?Sn(K)?!1:l:Sn(K)||l,ee=!!(S&&e&&q&&Q),te=Sn(B.isValidating)?ee:B.isValidating,ue=Sn(B.isLoading)?ee:B.isLoading,ye=w.useCallback(async me=>{const Ce=R.current;if(!S||!Ce||T.current||A().isPaused())return!1;let Xe,he,De=!0;const Ge=me||{},Je=!x[S]||!Ge.dedupe,Le=()=>mq?!T.current&&S===k.current&&E.current:S===k.current,qe={isValidating:!1,isLoading:!1},et=()=>{F(qe)},Ct=()=>{const dt=x[S];dt&&dt[1]===he&&delete x[S]},Ke={isValidating:!0};Sn(j().data)&&(Ke.isLoading=!0);try{if(Je&&(F(Ke),n.loadingTimeout&&Sn(j().data)&&setTimeout(()=>{De&&Le()&&A().onLoadingSlow(S,n)},n.loadingTimeout),x[S]=[Ce(_),qj()]),[Xe,he]=x[S],Xe=await Xe,Je&&setTimeout(Ct,n.dedupingInterval),!x[S]||x[S][1]!==he)return Je&&Le()&&A().onDiscarded(S),!1;qe.error=ci;const dt=v[S];if(!Sn(dt)&&(he<=dt[0]||he<=dt[1]||dt[1]===0))return et(),Je&&Le()&&A().onDiscarded(S),!1;const Xt=j().data;qe.data=r(Xt,Xe)?Xt:Xe,Je&&Le()&&A().onSuccess(Xe,S,n)}catch(dt){Ct();const Xt=A(),{shouldRetryOnError:_n}=Xt;Xt.isPaused()||(qe.error=dt,Je&&Le()&&(Xt.onError(dt,S,Xt),(_n===!0||sl(_n)&&_n(dt))&&(!A().revalidateOnFocus||!A().revalidateOnReconnect||L())&&Xt.onErrorRetry(dt,S,Xt,Dt=>{const nn=m[S];nn&&nn[0]&&nn[0](hq,Dt)},{retryCount:(Ge.retryCount||0)+1,dedupe:!0})))}return De=!1,et(),!0},[S,s]),je=w.useCallback((...me)=>xle(s,k.current,...me),[]);if(sb(()=>{R.current=e,I.current=n,Sn(D)||(J.current=D)}),sb(()=>{if(!S)return;const me=ye.bind(ci,DN);let Ce=0;A().revalidateOnFocus&&(Ce=Date.now()+A().focusThrottleInterval);const he=gje(S,m,(De,Ge={})=>
122{if(De==ple){const Je=Date.now();A().revalidateOnFocus&&Je>Ce&&L()&&(Ce=Je+A().focusThrottleInterval,me())}else if(De==mle)A().revalidateOnReconnect&&L()&&me();else{if(De==gle)return ye();if(De==hq)return ye(Ge)}});return T.current=!1,k.current=S,E.current=!0,F({_k:_}),Q&&(x[S]||(Sn(K)||Yb?me():nje(me))),()=>{T.current=!0,he()}},[S]),sb(()=>{let me;function Ce(){const he=sl(u)?u(j().data):u;he&&me!==-1&&(me=setTimeout(Xe,he))}function Xe(){!j().error&&(d||A().isVisible())&&(f||A().isOnline())?ye(DN).then(Ce):Ce()}return Ce(),()=>{me&&(clearTimeout(me),me=-1)}},[u,d,f,S]),w.useDebugValue(ne),i&&Sn(K)&&S){if(!mq&&Yb)throw new Error("Fallback data is required when using Suspense in SSR.");R.current=e,I.current=n,T.current=!1;const me=y[S];if(!Sn(me)){const Ce=je(me);MN(Ce)}if(Sn(Y)){const Ce=ye(DN);Sn(ne)||(Ce.status="fulfilled",Ce.value=!0),MN(Ce)}else throw Y}return{mutate:je,get data(){return U.data=!0,ne},get error(){return U.error=!0,Y},get isValidating(){return U.isValidating=!0,te},get isLoading(){return U.isLoading=!0,ue}}},yje=WT.defineProperty(cje,"defaultValue",{value:ble}),Cle=mje(xje),bje=()=>{},Sje=bje(),Yj=Object,xq=t=>t===Sje,wje=t=>typeof t=="function",N_=new WeakMap,_je=t=>Yj.prototype.toString.call(t),ON=(t,e)=>t===`[object ${e}]`;let Eje=0;const Zj=t=>{const e=typeof t,n=_je(t),s=ON(n,"Date"),r=ON(n,"RegExp"),i=ON(n,"Object");let a,o;if(Yj(t)===t&&!s&&!r){if(a=N_.get(t),a)return a;if(a=++Eje+"~",N_.set(t,a),Array.isArray(t)){for(a="@",o=0;o<t.length;o++)a+=Zj(t[o])+",";N_.set(t,a)}if(i){a="#";const l=Yj.keys(t).sort();for(;!xq(o=l.pop());)xq(t[o])||(a+=o+":"+Zj(t[o])+",");N_.set(t,a)}}else a=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Cje=t=>{if(wje(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Zj(t):"",[t,e]},Tje=t=>Cje(t?t(0,null):null)[0],$N=Promise.resolve(),kje=t=>(e,n,s)=>{const r=w.useRef(!1),{cache:i,initialSize:a=1,revalidateAll:o=!1,persistSize:l=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:f=!1}=s,[,,,p]=Fc.get(l4);let m;try{m=Tje(e),m&&(m=wle+m)}catch{}const[v,x,y]=Ff(i,m),S=w.useCallback(()=>Sn(v()._l)?a:v()._l,[i,m,a]);hle.useSyncExternalStore(w.useCallback(A=>m?y(m,()=>{A()}):()=>{},[i,m]),S,S);const _=w.useCallback(()=>{const A=v()._l;return Sn(A)?a:A},[m,a]),E=w.useRef(_());sb(()=>{if(!r.current){r.current=!0;return}m&&x({_l:l?E.current:_()})},[m,i]);const T=d&&!r.current,k=t(m,async A=>{const L=v()._i,j=v()._r;x({_r:ci});const F=[],O=_(),[M]=Ff(i,A),U=M().data,G=[];let $=null;for(let V=0;V<O;++V){const[B,q]=Zb(e(V,f?null:$));if(!B)break;const[z,D]=Ff(i,B);let K=z().data;const Y=o||L||Sn(K)||u&&!V&&!Sn(U)||T||U&&!Sn(U[V])&&!s.compare(U[V],K);if(n&&(typeof j=="function"?j(K,q):Y)){const J=async()=>{if(!(B in p))K=await n(q);else{const Q=p[B];delete p[B],K=await Q}D({data:K,_k:q}),F[V]=K};f?G.push(J):await J()}else F[V]=K;f||($=K)}return f&&await Promise.all(G.map(V=>V())),x({_i:ci}),F},s),R=w.useCallback(function(A,L){const j=typeof L=="boolean"?{revalidate:L}:L||{},F=j.revalidate!==!1;return m?(F&&(Sn(A)?x({_i:!0,_r:j.revalidate}):x({_i:!1,_r:j.revalidate})),arguments.length?k.mutate(A,{...j,revalidate:F}):k.mutate()):$N},[m,i]),I=w.useCallback(A=>{if(!m)return $N;const[,L]=Ff(i,m);let j;if(sl(A)?j=A(_()):typeof A=="number"&&(j=A),typeof j!="number")return $N;L({_l:j}),E.current=j;const F=[],[O]=Ff(i,m);let M=null;for(let U=0;U<j;++U){const[G]=Zb(e(U,M)),[$]=Ff(i,G),V=G?$().data:ci;if(Sn(V))return R(O().data);F.push(V),M=V}return R(F)},[m,i,R,_]);return{size:_(),setSize:I,mutate:R,get data(){return k.data},get error(){return k.error},get isValidating(){return k.isValidating},get isLoading(){return k.isLoading}}},Rje=vje(Cle,kje);var yq=Object.prototype.hasOwnProperty;function bq(t,e,n){for(n of t.keys())if(rb(n,e))return n}function rb(t,e){var n,s,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&rb(t[s],e[s]););return s===-1}if(n===Set){if(t.size!==e.size)return!1;for(s of t)if(r=s,r&&typeof r=="object"&&(r=bq(e,r),!r)||!e.has(r))return!1;return!0}
122if(n===Map){if(t.size!==e.size)return!1;for(s of t)if(r=s[0],r&&typeof r=="object"&&(r=bq(e,r),!r)||!rb(s[1],e.get(r)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return s===-1}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(yq.call(t,n)&&++s&&!yq.call(e,n)||!(n in e)||!rb(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}function Aje(t,e){if(!t)throw typeof e=="string"?new Error(e):new Error(`${e.displayName} not found`)}const Dd=(t,e)=>{const{assertCtxFn:n=Aje}={},s=re.createContext(void 0);return s.displayName=t,[s,()=>{const a=re.useContext(s);return n(a,`${t} not found`),a.value},()=>{const a=re.useContext(s);return a?a.value:{}}]};function Nje({swrConfig:t,children:e}){return re.createElement(yje,{value:t},e)}const[Tle,vS]=Dd("ClerkInstanceContext"),[Ije,kle]=Dd("UserContext"),[Lje,Rle]=Dd("ClientContext"),[jje,Pje]=Dd("SessionContext");re.createContext({});const[Mje]=Dd("CheckoutContext"),Dje=({children:t,...e})=>re.createElement(Mje.Provider,{value:{value:e}},t),[Oje,$je]=Dd("OrganizationContext"),Fje=({children:t,organization:e,swrConfig:n})=>re.createElement(Nje,{swrConfig:n},re.createElement(Oje.Provider,{value:{value:{organization:e}}},t));function xS(t){if(!re.useContext(Tle)){if(typeof t=="function"){t();return}throw new Error(`${t} can only be used within the <ClerkProvider /> component.
123
124Possible fixes:
1251. Ensure that the <ClerkProvider /> is correctly wrapping your application where this component is used.
1262. Check for multiple versions of the \`@clerk/shared\` package in your project. Use a tool like \`npm ls @clerk/shared\` to identify multiple versions, and update your dependencies to only rely on one.
127
128Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}const Uje="userMemberships",Bje="userInvitations",zje="userSuggestions",Vje="domains",Hje="membershipRequests",Gje="memberships",Wje="invitations",zp={USER_MEMBERSHIPS_KEY:Uje,USER_INVITATIONS_KEY:Bje,USER_SUGGESTIONS_KEY:zje,DOMAINS_KEY:Vje,MEMBERSHIP_REQUESTS_KEY:Hje,MEMBERSHIPS_KEY:Gje,INVITATIONS_KEY:Wje};function Vp(t){return{queryKey:[t.stablePrefix,t.authenticated,t.tracked,t.untracked],invalidationKey:[t.stablePrefix,t.authenticated,t.tracked],stableKey:t.stablePrefix,authenticated:t.authenticated}}function Sq(t){const{queryKey:e}=t;return{type:e[0],...e[2],...e[3].args}}const Hp=(t,e)=>{const n=typeof t=="boolean"&&t,s=w.useRef(n?e.initialPage:(t==null?void 0:t.initialPage)??e.initialPage),r=w.useRef(n?e.pageSize:(t==null?void 0:t.pageSize)??e.pageSize),i={};for(const a of Object.keys(e))i[a]=n?e[a]:(t==null?void 0:t[a])??e[a];return{...i,initialPage:s.current,pageSize:r.current}};function wq(t,e){const n=new Set(Object.keys(e)),s={};for(const r of Object.keys(t))n.has(r)||(s[r]=t[r]);return s}function qje(t){const e=w.useRef(t),n=w.useRef(null);return e.current!==t&&(n.current=e.current,e.current=t),n.current}const Ale={dedupingInterval:1e3*60,focusThrottleInterval:1e3*60*2},Kje={...Ale,revalidateFirstPage:!1},Gp=t=>{const{fetcher:e,config:n,keys:s}=t,[r,i]=w.useState(n.initialPage??1),a=w.useRef(n.initialPage??1),o=w.useRef(n.pageSize??10),l=n.enabled??!0,u=n.__experimental_mode==="cache",d=n.infinite??!1,f=n.keepPreviousData??!1,p=n.isSignedIn,m={...Sq(s),initialPage:r,pageSize:o.current},v=qje(p),x=!d&&l&&(u?!0:!!e),{data:y,isValidating:S,isLoading:_,error:E,mutate:T}=Cle(typeof p=="boolean"?v===!0&&p===!1||p&&x?m:null:x?m:null,!u&&e?Y=>p===!1||x===!1?null:e(wq(Y,{type:s.queryKey[0],...s.queryKey[2]})):null,{keepPreviousData:f,...Ale}),{data:k,isLoading:R,isValidating:I,error:A,size:L,setSize:j,mutate:F}=Rje(Y=>!d||!l||p===!1?null:{...Sq(s),initialPage:a.current+Y,pageSize:o.current},Y=>{const J=wq(Y,{type:s.queryKey[0],...s.queryKey[2]});return e==null?void 0:e(J)},Kje),O=w.useMemo(()=>d?L:r,[d,L,r]),M=w.useCallback(Y=>{if(d){j(Y);return}return i(Y)},[j,d]),U=w.useMemo(()=>d?(k==null?void 0:k.map(Y=>Y==null?void 0:Y.data).flat())??[]:(y==null?void 0:y.data)??[],[d,y,k]),G=w.useMemo(()=>{var Y;return d?((Y=k==null?void 0:k[(k==null?void 0:k.length)-1])==null?void 0:Y.total_count)||0:(y==null?void 0:y.total_count)??0},[d,y,k]),$=d?R:_,V=d?I:S,B=(d?A:E)??null,q=!!B,z=w.useCallback(()=>{M(Y=>Math.max(0,Y+1))},[M]),D=w.useCallback(()=>{M(Y=>Math.max(0,Y-1))},[M]),K=(a.current-1)*o.current;return{data:U,count:G,error:B,isLoading:$,isFetching:V,isError:q,page:O,pageCount:Math.ceil((G-K)/o.current),fetchPage:M,fetchNext:z,fetchPrevious:D,hasNextPage:G-K*o.current>O*o.current,hasPreviousPage:(O-1)*o.current>K*o.current,revalidate:d?()=>F():()=>T(),setData:d?Y=>F(Y,{revalidate:!1}):Y=>T(Y,{revalidate:!1})}},Qm=()=>(xS("useClerk"),vS());function Nle(t){const e=Qm(),n=w.useRef(!1);w.useEffect(()=>{var s;n.current||(n.current=!0,(s=e.__internal_attemptToEnableEnvironmentSetting)==null||s.call(e,{for:"organizations",caller:t}))},[e,t])}const uf={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0};function Mo(t){var T;const{domains:e,membershipRequests:n,memberships:s,invitations:r}=t||{};xS("useOrganization"),Nle("useOrganization");const{organization:i}=$je(),a=Pje(),o=Hp(e,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1,enrollmentMode:void 0}),l=Hp(n,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),u=Hp(s,{initialPage:1,pageSize:10,role:void 0,keepPreviousData:!1,infinite:!1,query:void 0}),d=Hp(r,{initialPage:1,pageSize:10,status:["pending"],keepPreviousData:!1,infinite:!1}),f=vS();(T=f.telemetry)==null||T.record(N1("useOrganization"));const p=typeof e>"u"?void 0:{initialPage:o.initialPage,pageSize:o.pageSize,enrollmentMode:o.enrollmentMode},m=typeof n>"u"?void 0:{initialPage:l.initialPage,pageSize:l.pageSize,status:l.status},v=typeof s>"u"?void 0:{initialPage:u.initialPage,pageSize:u.pageSize,role:u.role,query:u.query},x=typeof r>"u"?void 0:{initialPage:d.initialPage,pageSize:d.pageSize,status:d.status},y=Gp({fetcher:i==null?void 0:i.getDomains,config:{keepPreviousData:o.keepPreviousData,infinite:o.infinite,enabled:!!p,isSignedIn:!!i,initialPage:o.initialPage,pageSize:o.pageSize},keys:Vp({stablePrefix:zp.DOMAINS_KEY,authenticated:!!i,tracked:{organizationId:i==null?void 0:i.id},untracked:{args:p}})}),S=Gp({fetcher:i==null?void 0:i.getMembershipRequests,config:{keepPreviousData:l.keepPreviousData,infinite:l.infinite,enabled:!!m,isSignedIn:!!i,initialPage:l.initialPage,pageSize:l.pageSize},keys:Vp({stablePrefix:zp.MEMBERSHIP_REQUESTS_KEY,authenticated:!!i,tracked:{organizationId:i==null?void 0:i.id},untracked:{args:m}})}),_=Gp({fetcher:i==null?void 0:i.getMemberships,config:{keepPreviousData:u.keepPreviousData,infinite:u.infinite,enabled:!!v,isSignedIn:!!i,initialPage:u.initialPage,pageSize:u.pageSize},keys:Vp({stablePrefix:zp.MEMBERSHIPS_KEY,authenticated:!!i,tracked:{organizationId:i==null?void 0:i.id},untracked:{args:v}})}),E=Gp({fetcher:i==null?void 0:i.getInvitations,config:{keepPreviousData:d.keepPreviousData,infinite:d.infinite,enabled:!!x,isSignedIn:!!i,initialPage:d.initialPage,pageSize:d.pageSize},keys:Vp({stablePrefix:zp.INVITATIONS_KEY,authenticated:!!i,tracked:{organizationId:i==null?void 0:i.id},untracked:{args:x}})});return i===void 0?{isLoaded:!1,organization:void 0,membership:void 0,domains:uf,membershipRequests:uf,memberships:uf,invitations:uf}:i===null?{isLoaded:!0,organization:null,membership:null,domains:null,membershipRequests:null,memberships:null,invitations:null}:!f.loaded&&i?{isLoaded:!0,organization:i,membership:void 0,domains:uf,membershipRequests:uf,memberships:uf,invitations:uf}:{isLoaded:f.loaded,organization:i,membership:G8e(a.user.organizationMemberships,i.id),domains:y,membershipRequests:S,memberships:_,invitations:E}}const FN={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0};function Ile(t){var y;const{userMemberships:e,userInvitations:n,userSuggestions:s}={};xS("useOrganizationList"),Nle("useOrganizationList");const r=Hp(e,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1}),i=Hp(n,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),a=Hp(s,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),o=vS(),l=kle();(y=o.telemetry)==null||y.record(N1("useOrganizationList"));const u=typeof e>"u"?void 0:{initialPage:r.initialPage,pageSize:r.pageSize},d=typeof n>"u"?void 0:{initialPage:i.initialPage,pageSize:i.pageSize,status:i.status},f=typeof s>"u"?void 0:{initialPage:a.initialPage,pageSize:a.pageSize,status:a.status},p=!!(o.loaded&&l),m=Gp({fetcher:l==null?void 0:l.getOrganizationMemberships,config:{keepPreviousData:r.keepPreviousData,infinite:r.infinite,enabled:!!u,isSignedIn:!!l,initialPage:r.initialPage,pageSize:r.pageSize},keys:Vp({stablePrefix:zp.USER_MEMBERSHIPS_KEY,authenticated:!!l,tracked:{userId:l==null?void 0:l.id},untracked:{args:u}})}),v=Gp({fetcher:l==null?void 0:l.getOrganizationInvitations,config:{keepPreviousData:i.keepPreviousData,infinite:i.infinite,enabled:!!d,isSignedIn:!!l,initialPage:i.initialPage,pageSize:i.pageSize},keys:Vp({stablePrefix:zp.USER_INVITATIONS_KEY,authenticated:!!l,tracked:{userId:l==null?void 0:l.id},untracked:{args:d}})}),x=Gp({fetcher:l==null?void 0:l.getOrganizationSuggestions,config:{keepPreviousData:a.keepPreviousData,infinite:a.infinite,enabled:!!f,isSignedIn:!!l,initialPage:a.initialPage,pageSize:a.pageSize},keys:Vp({stablePrefix:zp.USER_SUGGESTIONS_KEY,authenticated:!!l,tracked:{userId:l==null?void 0:l.id},untracked:{args:f}})});return p?{isLoaded:p,setActive:o.setActive,createOrganization:o.createOrganization,userMemberships:m,userInvitations:v,userSuggestions:x}
128:{isLoaded:!1,createOrganization:void 0,setActive:void 0,userMemberships:FN,userInvitations:FN,userSuggestions:FN}}typeof window<"u"?re.useLayoutEffect:re.useEffect;const _q="useUser";function Vi(){var e;xS(_q);const t=kle();return(e=vS().telemetry)==null||e.record(N1(_q)),t===void 0?{isLoaded:!1,isSignedIn:void 0,user:void 0}:t===null?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:t}}const Eq=rb,Yje=t=>{const e=w.useRef(t);return w.useEffect(()=>{e.current=t},[t]),e.current},co=(t,e,n)=>{const s=!!n,r=w.useRef(n);w.useEffect(()=>{r.current=n},[n]),w.useEffect(()=>{if(!s||!t)return()=>{};const i=(...a)=>{r.current&&r.current(...a)};return t.on(e,i),()=>{t.off(e,i)}},[s,e,t,r])},Lle=re.createContext(null);Lle.displayName="ElementsContext";const Zje=(t,e)=>{if(!t)throw new Error(`Could not find Elements context; You need to wrap the part of your app that ${e} in an <Elements> provider.`);return t},qT=t=>t!==null&&typeof t=="object",Xje=(t,e,n)=>qT(t)?Object.keys(t).reduce((s,r)=>{const i=!qT(e)||!jle(t[r],e[r]);return n.includes(r)?(i&&console.warn(`Unsupported prop change: options.${r} is not a mutable property.`),s):i?{...s||{},[r]:t[r]}:s},null):null,Cq="[object Object]",jle=(t,e)=>{if(!qT(t)||!qT(e))return t===e;const n=Array.isArray(t);if(n!==Array.isArray(e))return!1;const s=Object.prototype.toString.call(t)===Cq;if(s!==(Object.prototype.toString.call(e)===Cq))return!1;if(!s&&!n)return t===e;const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;const a={};for(let f=0;f<r.length;f+=1)a[r[f]]=!0;for(let f=0;f<i.length;f+=1)a[i[f]]=!0;const o=Object.keys(a);if(o.length!==r.length)return!1;const l=t,u=e,d=f=>jle(l[f],u[f]);return o.every(d)},Tq=t=>Zje(re.useContext(Lle),t),Qje=t=>t.charAt(0).toUpperCase()+t.slice(1),Jje=(t,e)=>{const n=`${Qje(t)}Element`,i=e?a=>{Tq(`mounts <${n}>`);const{id:o,className:l}=a;return re.createElement("div",{id:o,className:l})}:({id:a,className:o,fallback:l,options:u={},onBlur:d,onFocus:f,onReady:p,onChange:m,onEscape:v,onClick:x,onLoadError:y,onLoaderStart:S,onNetworksChange:_,onConfirm:E,onCancel:T,onShippingAddressChange:k,onShippingRateChange:R})=>{const I=Tq(`mounts <${n}>`),A="elements"in I?I.elements:null,[L,j]=re.useState(null),F=re.useRef(null),O=re.useRef(null),[M,U]=w.useState(!1);co(L,"blur",d),co(L,"focus",f),co(L,"escape",v),co(L,"click",x),co(L,"loaderror",y),co(L,"loaderstart",S),co(L,"networkschange",_),co(L,"confirm",E),co(L,"cancel",T),co(L,"shippingaddresschange",k),co(L,"shippingratechange",R),co(L,"change",m);let G;p&&(G=()=>{U(!0),p(L)}),co(L,"ready",G),re.useLayoutEffect(()=>{if(F.current===null&&O.current!==null&&A){let V=null;A&&(V=A.create(t,u)),F.current=V,j(V),V&&V.mount(O.current)}},[A,u]);const $=Yje(u);return re.useEffect(()=>{if(!F.current)return;const V=Xje(u,$,["paymentRequest"]);V&&"update"in F.current&&F.current.update(V)},[u,$]),re.useLayoutEffect(()=>()=>{if(F.current&&typeof F.current.destroy=="function")try{F.current.destroy(),F.current=null}catch{}},[]),re.createElement(re.Fragment,null,!M&&l,re.createElement("div",{id:a,style:{height:M?"unset":"0px",visibility:M?"visible":"hidden"},className:o,ref:O}))};return i.displayName=n,i.__elementType=t,i};Jje("payment",typeof window>"u");Dd("PaymentElementContext");Dd("StripeUtilsContext");var nc=cle({packageName:"@clerk/clerk-react"});function ePe(t){nc.setMessages(t).setPackageName(t)}var[tPe,nPe]=Dd("AuthContext"),sPe=Tle,c4=vS,rPe="You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.",iPe=t=>`You've passed multiple children components to <${t}/>. You can only pass a single child component or text.`,aPe="Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/support",UN="Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.",oPe="<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",lPe="<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",cPe="<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",uPe="<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",dPe=t=>`<${t} /> can only accept <${t}.Page /> and <${t}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`,fPe=t=>`Missing props. <${t}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`,hPe=t=>`Missing props. <${t}.Link /> component requires the following props: url, label and labelIcon.`,pPe="<UserButton /> can only accept <UserButton.UserProfilePage />, <UserButton.UserProfileLink /> and <UserButton.MenuItems /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",mPe="<UserButton.MenuItems /> component can only accept <UserButton.Action /> and <UserButton.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",gPe="<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.",vPe="<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.",xPe="<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.",yPe="Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.",bPe="Missing props. <UserButton.Action /> component requires the following props: label.",I1=t=>{xS(()=>{nc.throwMissingClerkProviderError({source:t})})},Ple=t=>new Promise(e=>{const n=s=>{["ready","degraded"].includes(s)&&(e(),t.off("status",n))};t.on("status",n,{notify:!0})}),SPe=t=>async e=>(await Ple(t),t.session?t.session.getToken(e):null),wPe=t=>async(...e)=>(await Ple(t),t.signOut(...e)),zt=(t={})=>{var e;I1("useAuth");const{treatPendingAsSignedOut:n,...s}=t??{},r=s;let a=nPe();a.sessionId===void 0&&a.userId===void 0&&(a=r??{});const o=c4(),l=w.useCallback(SPe(o),[o]),u=w.useCallback(wPe(o),[o]);return(e=o.telemetry)==null||e.record(N1("useAuth",{treatPendingAsSignedOut:n})),_Pe({...a,getToken:l,signOut:u},{treatPendingAsSignedOut:n})};function _Pe(t,{treatPendingAsSignedOut:e=!0}={}){const{userId:n,orgId:s,orgRole:r,has:i,signOut:a,getToken:o,orgPermissions:l,factorVerificationAge:u,sessionClaims:d}=t??{},f=w.useCallback(m=>i?i(m):$8e({userId:n,orgId:s,orgRole:r,orgPermissions:l,factorVerificationAge:u,features:(d==null?void 0:d.fea)||"",plans:(d==null?void 0:d.pla)||""})(m),[i,n,s,r,l,u,d]),p=F8e({authObject:{...t,getToken:o,signOut:a,has:f},options:{treatPendingAsSignedOut:e}});return p||nc.throw(aPe)}var DO=()=>{var t;
128I1("useSignIn");const e=c4(),n=Rle();return(t=e.telemetry)==null||t.record(N1("useSignIn")),n?{isLoaded:!0,signIn:n.signIn,setActive:e.setActive}:{isLoaded:!1,signIn:void 0,setActive:void 0}},Mle=()=>{var t;I1("useSignUp");const e=c4(),n=Rle();return(t=e.telemetry)==null||t.record(N1("useSignUp")),n?{isLoaded:!0,signUp:n.signUp,setActive:e.setActive}:{isLoaded:!1,signUp:void 0,setActive:void 0}},Bs=(t,e)=>{const s=(typeof e=="string"?e:e==null?void 0:e.component)||t.displayName||t.name||"Component";t.displayName=s;const r=typeof e=="string"?void 0:e,i=a=>{I1(s||"withClerk");const o=c4();return!o.loaded&&!(r!=null&&r.renderWhileLoading)?null:re.createElement(t,{...a,component:s,clerk:o})};return i.displayName=`withClerk(${s})`,i};const EPe=()=>{try{return!1}catch{}return!1},CPe=()=>{try{return!1}catch{}return!1},TPe=()=>{try{return!0}catch{}return!1},kq=new Set,OO=(t,e,n)=>{const s=CPe()||TPe(),r=t;kq.has(r)||s||(kq.add(r),console.warn(`Clerk - DEPRECATION WARNING: "${t}" is deprecated and will be removed in the next major release.
129${e}`))};var $O=({children:t,treatPendingAsSignedOut:e})=>{I1("SignedIn");const{userId:n}=zt({treatPendingAsSignedOut:e});return n?t:null},FO=({children:t,treatPendingAsSignedOut:e})=>{I1("SignedOut");const{userId:n}=zt({treatPendingAsSignedOut:e});return n===null?t:null};Bs(({clerk:t,...e})=>{const{client:n,session:s}=t,r=n.signedInSessions?n.signedInSessions.length>0:n.activeSessions&&n.activeSessions.length>0;return re.useEffect(()=>{s===null&&r?t.redirectToAfterSignOut():t.redirectToSignIn(e)},[]),null},"RedirectToSignIn");Bs(({clerk:t,...e})=>(re.useEffect(()=>{t.redirectToSignUp(e)},[]),null),"RedirectToSignUp");Bs(({clerk:t,...e})=>(re.useEffect(()=>{t.redirectToTasks(e)},[]),null),"RedirectToTasks");Bs(({clerk:t})=>(re.useEffect(()=>{OO("RedirectToUserProfile","Use the `redirectToUserProfile()` method instead."),t.redirectToUserProfile()},[]),null),"RedirectToUserProfile");Bs(({clerk:t})=>(re.useEffect(()=>{OO("RedirectToOrganizationProfile","Use the `redirectToOrganizationProfile()` method instead."),t.redirectToOrganizationProfile()},[]),null),"RedirectToOrganizationProfile");Bs(({clerk:t})=>(re.useEffect(()=>{OO("RedirectToCreateOrganization","Use the `redirectToCreateOrganization()` method instead."),t.redirectToCreateOrganization()},[]),null),"RedirectToCreateOrganization");var kPe=Bs(({clerk:t,...e})=>(re.useEffect(()=>{t.handleRedirectCallback(e)},[]),null),"AuthenticateWithRedirectCallback");function BN(t,e,n){if(typeof t=="function")return t(e);if(typeof t<"u")return t;if(typeof n<"u")return n}const wa=t=>{EPe()},Rq=(t,...e)=>{const n={...t};for(const s of e)delete n[s];return n};var u4=t=>e=>{try{return re.Children.only(t)}catch{return nc.throw(iPe(e))}},d4=(t,e)=>(t||(t=e),typeof t=="string"&&(t=re.createElement("button",null,t)),t),f4=t=>(...e)=>{if(t&&typeof t=="function")return t(...e)};function RPe(t){return typeof t=="function"}var I_=new Map;function APe(t,e,n=1){re.useEffect(()=>{const s=I_.get(t)||0;return s==n?nc.throw(e):(I_.set(t,s+1),()=>{I_.set(t,(I_.get(t)||1)-1)})},[])}function NPe(t,e,n){const s=t.displayName||t.name||e||"Component",r=i=>(APe(e,n),re.createElement(t,{...i}));return r.displayName=`withMaxAllowedInstancesGuard(${s})`,r}var ib=t=>{const[e,n]=w.useState(new Map);return t.map(s=>({id:s.id,mount:r=>n(i=>new Map(i).set(String(s.id),r)),unmount:()=>n(r=>{const i=new Map(r);return i.set(String(s.id),null),i}),portal:()=>{const r=e.get(String(s.id));return r?nr.createPortal(s.component,r):null}}))},xa=(t,e)=>!!t&&re.isValidElement(t)&&(t==null?void 0:t.type)===e,Dle=(t,e)=>Fle({children:t,reorderItemsLabels:["account","security","billing","apiKeys"],LinkComponent:bS,PageComponent:yS,MenuItemsComponent:p4,componentName:"UserProfile"},e),Ole=(t,e)=>Fle({children:t,reorderItemsLabels:["general","members","billing","apiKeys"],LinkComponent:g4,PageComponent:m4,componentName:"OrganizationProfile"},e),$le=t=>{const e=[],n=[g4,m4,p4,yS,bS];return re.Children.forEach(t,s=>{n.some(r=>xa(s,r))||e.push(s)}),e},Fle=(t,e)=>{const{children:n,LinkComponent:s,PageComponent:r,MenuItemsComponent:i,reorderItemsLabels:a,componentName:o}=t,{allowForAnyChildren:l=!1}=e||{},u=[];
129re.Children.forEach(n,_=>{if(!xa(_,r)&&!xa(_,s)&&!xa(_,i)){_&&!l&&wa(dPe(o));return}const{props:E}=_,{children:T,label:k,url:R,labelIcon:I}=E;if(xa(_,r))if(Aq(E,a))u.push({label:k});else if(zN(E))u.push({label:k,labelIcon:I,children:T,url:R});else{wa(fPe(o));return}if(xa(_,s))if(VN(E))u.push({label:k,labelIcon:I,url:R});else{wa(hPe(o));return}});const d=[],f=[],p=[];u.forEach((_,E)=>{if(zN(_)){d.push({component:_.children,id:E}),f.push({component:_.labelIcon,id:E});return}VN(_)&&p.push({component:_.labelIcon,id:E})});const m=ib(d),v=ib(f),x=ib(p),y=[],S=[];return u.forEach((_,E)=>{if(Aq(_,a)){y.push({label:_.label});return}if(zN(_)){const{portal:T,mount:k,unmount:R}=m.find(j=>j.id===E),{portal:I,mount:A,unmount:L}=v.find(j=>j.id===E);y.push({label:_.label,url:_.url,mount:k,unmount:R,mountIcon:A,unmountIcon:L}),S.push(T),S.push(I);return}if(VN(_)){const{portal:T,mount:k,unmount:R}=x.find(I=>I.id===E);y.push({label:_.label,url:_.url,mountIcon:k,unmountIcon:R}),S.push(T);return}}),{customPages:y,customPagesPortals:S}},Aq=(t,e)=>{const{children:n,label:s,url:r,labelIcon:i}=t;return!n&&!r&&!i&&e.some(a=>a===s)},zN=t=>{const{children:e,label:n,url:s,labelIcon:r}=t;return!!e&&!!s&&!!r&&!!n},VN=t=>{const{children:e,label:n,url:s,labelIcon:r}=t;return!e&&!!s&&!!r&&!!n},IPe=(t,e)=>{var n;return LPe({children:t,reorderItemsLabels:["manageAccount","signOut"],MenuItemsComponent:p4,MenuActionComponent:Ble,MenuLinkComponent:zle,UserProfileLinkComponent:bS,UserProfilePageComponent:yS,allowForAnyChildren:(n=e==null?void 0:e.allowForAnyChildren)!=null?n:!1})},LPe=({children:t,MenuItemsComponent:e,MenuActionComponent:n,MenuLinkComponent:s,UserProfileLinkComponent:r,UserProfilePageComponent:i,reorderItemsLabels:a,allowForAnyChildren:o=!1})=>{const l=[],u=[],d=[];re.Children.forEach(t,x=>{if(!xa(x,e)&&!xa(x,r)&&!xa(x,i)){x&&!o&&wa(pPe);return}if(xa(x,r)||xa(x,i))return;const{props:y}=x;re.Children.forEach(y.children,S=>{if(!xa(S,n)&&!xa(S,s)){S&&wa(mPe);return}const{props:_}=S,{label:E,labelIcon:T,href:k,onClick:R,open:I}=_;if(xa(S,n))if(Nq(_,a))l.push({label:E});else if(HN(_)){const A={label:E,labelIcon:T};if(R!==void 0)l.push({...A,onClick:R});else if(I!==void 0)l.push({...A,open:I.startsWith("/")?I:`/${I}`});else{wa("Custom menu item must have either onClick or open property");return}}else{wa(bPe);return}if(xa(S,s))if(GN(_))l.push({label:E,labelIcon:T,href:k});else{wa(yPe);return}})});const f=[],p=[];l.forEach((x,y)=>{HN(x)&&f.push({component:x.labelIcon,id:y}),GN(x)&&p.push({component:x.labelIcon,id:y})});const m=ib(f),v=ib(p);return l.forEach((x,y)=>{if(Nq(x,a)&&u.push({label:x.label}),HN(x)){const{portal:S,mount:_,unmount:E}=m.find(k=>k.id===y),T={label:x.label,mountIcon:_,unmountIcon:E};"onClick"in x?T.onClick=x.onClick:"open"in x&&(T.open=x.open),u.push(T),d.push(S)}if(GN(x)){const{portal:S,mount:_,unmount:E}=v.find(T=>T.id===y);u.push({label:x.label,href:x.href,mountIcon:_,unmountIcon:E}),d.push(S)}}),{customMenuItems:u,customMenuItemsPortals:d}},Nq=(t,e)=>{const{children:n,label:s,onClick:r,labelIcon:i}=t;return!n&&!r&&!i&&e.some(a=>a===s)},HN=t=>{const{label:e,labelIcon:n,onClick:s,open:r}=t;return!!n&&!!e&&(typeof s=="function"||typeof r=="string")},GN=t=>{const{label:e,href:n,labelIcon:s}=t;return!!n&&!!s&&!!e},jPe=t=>{const e=t==null?void 0:t.isReady;return n=>new Promise((s,r)=>{const{root:i=document==null?void 0:document.body,selector:a,timeout:o=0}=n;if(!i){r(new Error("No root element provided"));return}let l=i;if(a&&(l=i==null?void 0:i.querySelector(a)),e(l,a)){s();return}const u=new MutationObserver(d=>{for(const f of d)if(!l&&a&&(l=i==null?void 0:i.querySelector(a)),(t.childList&&f.type==="childList"||t.attributes&&f.type==="attributes")&&e(l,a)){u.disconnect(),s();return}});u.observe(i,t),o>0&&setTimeout(()=>{u.disconnect(),r(new Error(`Timeout waiting for ${a}`))},o)})},PPe=jPe({childList:!0,subtree:!0,isReady:(t,e)=>{var n;return!!(t!=null&&t.childElementCount)&&((n=t==null?void 0:t.matches)==null?void 0:n.call(t,e))&&t.childElementCount>0}});function ia(t,e){const n=w.useRef(),[s,r]=w.useState("rendering");return w.useEffect(()=>{if(!t)throw new Error("Clerk: no component name provided, unable to detect mount.");if(typeof window<"u"&&!n.current){const i=`[data-clerk-component="${t}"]`,a=e==null?void 0:e.selector;n.current=PPe({selector:a?i+a:i}).then(()=>{r("rendered")}
129).catch(()=>{r("error")})}},[t,e==null?void 0:e.selector]),s}var L_=t=>"mount"in t,Iq=t=>"open"in t,Lq=t=>t==null?void 0:t.map(({mountIcon:e,unmountIcon:n,...s})=>s),Ci=class extends re.PureComponent{constructor(){super(...arguments),this.rootRef=re.createRef()}componentDidUpdate(t){var e,n,s,r;if(!L_(t)||!L_(this.props))return;const i=Rq(t.props,"customPages","customMenuItems","children"),a=Rq(this.props.props,"customPages","customMenuItems","children"),o=((e=i.customPages)==null?void 0:e.length)!==((n=a.customPages)==null?void 0:n.length),l=((s=i.customMenuItems)==null?void 0:s.length)!==((r=a.customMenuItems)==null?void 0:r.length),u=Lq(t.props.customMenuItems),d=Lq(this.props.props.customMenuItems);(!Eq(i,a)||!Eq(u,d)||o||l)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(L_(this.props)&&this.props.mount(this.rootRef.current,this.props.props),Iq(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(L_(this.props)&&this.props.unmount(this.rootRef.current),Iq(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:t=!1}=this.props,e={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-clerk-component":this.props.component}};return re.createElement(re.Fragment,null,!t&&re.createElement("div",{...e}),this.props.children)}},h4=t=>{var e,n;return re.createElement(re.Fragment,null,(e=t==null?void 0:t.customPagesPortals)==null?void 0:e.map((s,r)=>w.createElement(s,{key:r})),(n=t==null?void 0:t.customMenuItemsPortals)==null?void 0:n.map((s,r)=>w.createElement(s,{key:r})))};Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountSignIn,unmount:t.unmountSignIn,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"SignIn",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountSignUp,unmount:t.unmountSignUp,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"SignUp",renderWhileLoading:!0});function yS({children:t}){return wa(oPe),re.createElement(re.Fragment,null,t)}function bS({children:t}){return wa(lPe),re.createElement(re.Fragment,null,t)}var MPe=Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}},{customPages:o,customPagesPortals:l}=Dle(s.children);return re.createElement(re.Fragment,null,i&&n,re.createElement(Ci,{component:e,mount:t.mountUserProfile,unmount:t.unmountUserProfile,updateProps:t.__unstable__updateProps,props:{...s,customPages:o},rootProps:a},re.createElement(h4,{customPagesPortals:l})))},{component:"UserProfile",renderWhileLoading:!0});Object.assign(MPe,{Page:yS,Link:bS});var Ule=w.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),DPe=Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}},{customPages:o,customPagesPortals:l}=Dle(s.children,{allowForAnyChildren:!!s.__experimental_asProvider}),u={...s.userProfileProps,customPages:o},{customMenuItems:d,customMenuItemsPortals:f}=IPe(s.children,{allowForAnyChildren:!!s.__experimental_asProvider}),p=$le(s.children),m={mount:t.mountUserButton,unmount:t.unmountUserButton,updateProps:t.__unstable__updateProps,props:{...s,userProfileProps:u,customMenuItems:d}},v={customPagesPortals:l,customMenuItemsPortals:f};return re.createElement(Ule.Provider,{value:m},i&&n,t.loaded&&re.createElement(Ci,{component:e,...m,hideRootHtmlElement:!!s.__experimental_asProvider,rootProps:a},s.__experimental_asProvider?p:null,re.createElement(h4,{...v})))},{component:"UserButton",renderWhileLoading:!0});function p4({children:t}){return wa(gPe),re.createElement(re.Fragment,null,t)}function Ble({children:t}){return wa(vPe),re.createElement(re.Fragment,null,t)}function zle({children:t}){return wa(xPe),re.createElement(re.Fragment,null,t)}function OPe(t){const e=w.useContext(Ule),n={...e,props:{...e.props,...t}};return re.createElement(Ci,{...n})}Object.assign(DPe,{UserProfilePage:yS,UserProfileLink:bS,MenuItems:p4,Action:Ble,Link:zle,__experimental_Outlet:OPe});function m4({children:t}){return wa(cPe),re.createElement(re.Fragment,null,t)}function g4({children:t}){return wa(uPe),re.createElement(re.Fragment,null,t)}var $Pe=Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}},{customPages:o,customPagesPortals:l}=Ole(s.children);return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountOrganizationProfile,unmount:t.unmountOrganizationProfile,updateProps:t.__unstable__updateProps,props:{...s,customPages:o},rootProps:a},re.createElement(h4,{customPagesPortals:l})))},{component:"OrganizationProfile",renderWhileLoading:!0}),FPe=Object.assign($Pe,{Page:m4,Link:g4}),UPe=Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountCreateOrganization,unmount:t.unmountCreateOrganization,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"CreateOrganization",renderWhileLoading:!0}),Vle=w.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),BPe=Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}},{customPages:o,customPagesPortals:l}=Ole(s.children,{allowForAnyChildren:!!s.__experimental_asProvider}),u={...s.organizationProfileProps,customPages:o},d=$le(s.children),f={mount:t.mountOrganizationSwitcher,unmount:t.unmountOrganizationSwitcher,updateProps:t.__unstable__updateProps,props:{...s,organizationProfileProps:u},rootProps:a,component:e};return t.__experimental_prefetchOrganizationSwitcher(),re.createElement(Vle.Provider,{value:f},re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{...f,hideRootHtmlElement:!!s.__experimental_asProvider},s.__experimental_asProvider?d:null,re.createElement(h4,{customPagesPortals:l}))))},{component:"OrganizationSwitcher",renderWhileLoading:!0});function zPe(t){const e=w.useContext(Vle),n={...e,props:{...e.props,...t}};return re.createElement(Ci,{...n})}Object.assign(BPe,{OrganizationProfilePage:m4,OrganizationProfileLink:g4,__experimental_Outlet:zPe});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountOrganizationList,unmount:t.unmountOrganizationList,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"OrganizationList",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,open:t.openGoogleOneTap,close:t.closeGoogleOneTap,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"GoogleOneTap",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountWaitlist,unmount:t.unmountWaitlist,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"Waitlist",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e,{selector:'[data-component-status="ready"]'})==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountPricingTable,unmount:t.unmountPricingTable,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"PricingTable",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountAPIKeys,unmount:t.unmountAPIKeys,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"ApiKeys",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountUserAvatar,unmount:t.unmountUserAvatar,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"UserAvatar",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountTaskChooseOrganization,unmount:t.unmountTaskChooseOrganization,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"TaskChooseOrganization",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountTaskResetPassword,unmount:t.unmountTaskResetPassword,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"TaskResetPassword",renderWhileLoading:!0});Bs(({clerk:t,component:e,fallback:n,...s})=>{const i=ia(e)==="rendering"||!t.loaded,a={...i&&n&&{style:{display:"none"}}};return re.createElement(re.Fragment,null,i&&n,t.loaded&&re.createElement(Ci,{component:e,mount:t.mountTaskSetupMFA,unmount:t.unmountTaskSetupMFA,updateProps:t.__unstable__updateProps,props:s,rootProps:a}))},{component:"TaskSetupMFA",renderWhileLoading:!0});var Hle=t=>{throw TypeError(t)},UO=(t,e,n)=>e.has(t)||Hle("Cannot "+n),Ks=(t,e,n)=>(UO(t,e,"read from private field"),n?n.call(t):e.get(t)),kf=(t,e,n)=>e.has(t)?Hle("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pp=(t,e,n,s)=>(UO(t,e,"write to private field"),e.set(t,n),n),WN=(t,e,n)=>(UO(t,e,"access private method"),n);
129const VPe={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(t,e)=>e<5,retryImmediately:!1,jitter:!0},HPe=100,Gle=async t=>new Promise(e=>setTimeout(e,t)),Wle=(t,e)=>e?t*(1+Math.random()):t,GPe=t=>{let e=0;const n=()=>{const s=t.initialDelay,r=t.factor;let i=s*Math.pow(r,e);return i=Wle(i,t.jitter),Math.min(t.maxDelayBetweenRetries||i,i)};return async()=>{await Gle(n()),e++}},WPe=async(t,e={})=>{let n=0;const{shouldRetry:s,initialDelay:r,maxDelayBetweenRetries:i,factor:a,retryImmediately:o,jitter:l,onBeforeRetry:u}={...VPe,...e},d=GPe({initialDelay:r,maxDelayBetweenRetries:i,factor:a,jitter:l});for(;;)try{return await t()}catch(f){if(n++,!s(f,n))throw f;u&&await u(n),o&&n===1?await Gle(Wle(HPe,l)):await d()}},qPe="loadScript cannot be called when document does not exist",KPe="loadScript cannot be called without a src";async function YPe(t="",e){const{async:n,defer:s,beforeLoad:r,crossOrigin:i,nonce:a}=e||{};return WPe(()=>new Promise((l,u)=>{t||u(new Error(KPe)),(!document||!document.body)&&u(new Error(qPe));const d=document.createElement("script");i&&d.setAttribute("crossorigin",i),d.async=n||!1,d.defer=s||!1,d.addEventListener("load",()=>{d.remove(),l(d)}),d.addEventListener("error",f=>{d.remove(),u(f.error??new Error(`failed to load script: ${t}`))}),d.src=t,d.nonce=a,r==null||r(d),document.body.appendChild(d)}),{shouldRetry:(l,u)=>u<=5})}function ZPe(t){return t?XPe(t)||qle(t):!0}function XPe(t){return/^http(s)?:\/\//.test(t||"")}function qle(t){return t.startsWith("/")}function QPe(t){return t?qle(t)?new URL(t,window.location.origin).toString():t:""}function JPe(t){if(!t)return"";let e;if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return`clerk.${t.replace(e,"")}`}const eMe=(t,e="5.127.1")=>{if(t)return t;const n=tMe(e);return n?n==="snapshot"?"5.127.1":n:nMe(e)},tMe=t=>{var e;return(e=t.trim().replace(/^v/,"").match(/-(.+?)(\.|$)/))==null?void 0:e[1]},nMe=t=>t.trim().replace(/^v/,"").split(".")[0],Kle="failed_to_load_clerk_js",sMe="failed_to_load_clerk_js_timeout",Xj="Failed to load Clerk",{isDevOrStagingUrl:rMe}=z8e(),Yle=cle({packageName:"@clerk/shared"});function iMe(t){Yle.setPackageName({packageName:t})}function Qj(){if(typeof window>"u"||!window.Clerk)return!1;const t=window.Clerk;return typeof t=="object"&&typeof t.load=="function"}function aMe(t){if(typeof window>"u"||!window.performance)return!1;const e=performance.getEntriesByName(t,"resource");if(e.length===0)return!1;const n=e[e.length-1];return n.transferSize===0&&n.decodedBodySize===0&&(n.responseEnd===0||n.responseEnd>0&&n.responseStart>0||"responseStatus"in n&&(n.responseStatus>=400||n.responseStatus===0))}function jq(t,e){return new Promise((n,s)=>{let r=!1;const i=(d,f)=>{clearTimeout(d),clearInterval(f)};e==null||e.addEventListener("error",()=>{i(l,u),s(new Fj(Xj,{code:Kle}))});const a=()=>{r||Qj()&&(r=!0,i(l,u),n(null))},l=setTimeout(()=>{r||(r=!0,i(l,u),Qj()?n(null):s(new Fj(Xj,{code:sMe})))},t);a();const u=setInterval(()=>{if(r){clearInterval(u);return}a()},100)})}const oMe=async t=>{const e=(t==null?void 0:t.scriptLoadTimeout)??15e3;if(Qj())return null;if(!(t!=null&&t.publishableKey))return Yle.throwMissingPublishableKeyError(),null;const n=lMe(t),s=document.querySelector("script[data-clerk-js-script]");if(s)if(aMe(n))s.remove();else try{return await jq(e,s),null}catch{s.remove()}const r=jq(e);return YPe(n,{async:!0,crossOrigin:"anonymous",nonce:t.nonce,beforeLoad:uMe(t)}).catch(i=>{throw new Fj(Xj+(i.message?`, ${i.message}`:""),{code:Kle,cause:i})}),r},lMe=t=>{var d,f;const{clerkJSUrl:e,clerkJSVariant:n,clerkJSVersion:s,proxyUrl:r,domain:i,publishableKey:a}=t;if(e)return e;let o="";r&&ZPe(r)?o=QPe(r).replace(/http(s)?:\/\//,""):i&&!rMe(((d=uq(a))==null?void 0:d.frontendApi)||"")?o=JPe(i):o=((f=uq(a))==null?void 0:f.frontendApi)||"";const l=n?`${n.replace(/\.+$/,"")}.`:"",u=eMe(s);return`https://${o}/npm/@clerk/clerk-js@${u}/dist/clerk.${l}browser.js`},cMe=t=>{const e={};return t.publishableKey&&(e["data-clerk-publishable-key"]=t.publishableKey),t.proxyUrl&&(e["data-clerk-proxy-url"]=t.proxyUrl),t.domain&&(e["data-clerk-domain"]=t.domain),t.nonce&&(e.nonce=t.nonce),e},uMe=t=>e=>{const n=cMe(t);for(const s in n)e.setAttribute(s,n[s])},dMe=(t,e,n)=>!t&&n?fMe(n):hMe(e),fMe=t=>{const e=t.userId,n=t.user,s=t.sessionId,r=t.sessionStatus,i=t.sessionClaims;return{userId:e,user:n,sessionId:s,session:t.session,sessionStatus:r,sessionClaims:i,organization:t.organization,orgId:t.orgId,orgRole:t.orgRole,orgPermissions:t.orgPermissions,orgSlug:t.orgSlug,actor:t.actor,factorVerificationAge:t.factorVerificationAge}},hMe=t=>{var v,x,y,S;const e=t.user?t.user.id:t.user,n=t.user,s=t.session?t.session.id:t.session,r=t.session,i=(v=t.session)==null?void 0:v.status,a=t.session?(y=(x=t.session.lastActiveToken)==null?void 0:x.jwt)==null?void 0:y.claims:null,o=t.session?t.session.factorVerificationAge:null,l=r==null?void 0:r.actor,u=t.organization,d=t.organization?t.organization.id:t.organization,f=u==null?void 0:u.slug,p=u&&((S=n==null?void 0:n.organizationMemberships)==null?void 0:S.find(_=>_.organization.id===d)),m=p&&p.permissions;return{userId:e,user:n,sessionId:s,session:r,sessionStatus:i,sessionClaims:a,organization:u,orgId:d,orgRole:p&&p.role,orgSlug:f,orgPermissions:m,actor:l,factorVerificationAge:o}};function KT(){return typeof window<"u"}const Pq=(t,e,n,s,r)=>{const{notify:i}=r||{};let a=t.get(n);a||(a=[],t.set(n,a)),a.push(s),i&&e.has(n)&&s(e.get(n))},Mq=(t,e,n)=>(t.get(e)||[]).map(s=>s(n)),Dq=(t,e,n)=>{const s=t.get(e);s&&(n?s.splice(s.indexOf(n)>>>0,1):t.set(e,[]))},pMe=()=>{const t=new Map,e=new Map,n=new Map;return{on:(...r)=>Pq(t,e,...r),prioritizedOn:(...r)=>Pq(n,e,...r),emit:(r,i)=>{e.set(r,i),Mq(n,r,i),Mq(t,r,i)},off:(...r)=>Dq(t,...r),prioritizedOff:(...r)=>Dq(n,...r),internal:{retrieveListeners:r=>t.get(r)||[]}}},j_={Status:"status"},mMe=()=>pMe();typeof window<"u"&&!window.global&&(window.global=typeof global>"u"?window:global);Bs(({clerk:t,children:e,...n})=>{const{appearance:s,signUpFallbackRedirectUrl:r,forceRedirectUrl:i,fallbackRedirectUrl:a,signUpForceRedirectUrl:o,mode:l,initialValues:u,withSignUp:d,oauthFlow:f,...p}=n;e=d4(e,"Sign in");const m=u4(e)("SignInButton"),v=()=>{const S={forceRedirectUrl:i,fallbackRedirectUrl:a,signUpFallbackRedirectUrl:r,signUpForceRedirectUrl:o,initialValues:u,withSignUp:d,oauthFlow:f};return l==="modal"?t.openSignIn({...S,appearance:s}):t.redirectToSignIn({...S,signInFallbackRedirectUrl:a,signInForceRedirectUrl:i})},y={...p,onClick:async S=>(m&&typeof m=="object"&&"props"in m&&await f4(m.props.onClick)(S),v())};return re.cloneElement(m,y)}
129,{component:"SignInButton",renderWhileLoading:!0});Bs(({clerk:t,children:e,...n})=>{const{redirectUrl:s,...r}=n;e=d4(e,"Sign in with Metamask");const i=u4(e)("SignInWithMetamaskButton"),a=async()=>{async function u(){await t.authenticateWithMetamask({redirectUrl:s||void 0})}u()},l={...r,onClick:async u=>(await f4(i.props.onClick)(u),a())};return re.cloneElement(i,l)},{component:"SignInWithMetamask",renderWhileLoading:!0});Bs(({clerk:t,children:e,...n})=>{const{redirectUrl:s="/",signOutOptions:r,...i}=n;e=d4(e,"Sign out");const a=u4(e)("SignOutButton"),o=()=>t.signOut({redirectUrl:s,...r}),u={...i,onClick:async d=>(await f4(a.props.onClick)(d),o())};return re.cloneElement(a,u)},{component:"SignOutButton",renderWhileLoading:!0});Bs(({clerk:t,children:e,...n})=>{const{appearance:s,unsafeMetadata:r,fallbackRedirectUrl:i,forceRedirectUrl:a,signInFallbackRedirectUrl:o,signInForceRedirectUrl:l,mode:u,initialValues:d,oauthFlow:f,...p}=n;e=d4(e,"Sign up");const m=u4(e)("SignUpButton"),v=()=>{const S={fallbackRedirectUrl:i,forceRedirectUrl:a,signInFallbackRedirectUrl:o,signInForceRedirectUrl:l,initialValues:d,oauthFlow:f};return u==="modal"?t.openSignUp({...S,appearance:s,unsafeMetadata:r}):t.redirectToSignUp({...S,signUpFallbackRedirectUrl:i,signUpForceRedirectUrl:a})},y={...p,onClick:async S=>(m&&typeof m=="object"&&"props"in m&&await f4(m.props.onClick)(S),v())};return re.cloneElement(m,y)},{component:"SignUpButton",renderWhileLoading:!0});var gMe=()=>({fields:{identifier:null,password:null,code:null},raw:null,global:null}),vMe=()=>({fields:{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null},raw:null,global:null}),xMe=class{constructor(t){this.isomorphicClerk=t,this.signInSignalProxy=this.buildSignInProxy(),this.signUpSignalProxy=this.buildSignUpProxy()}signInSignal(){return this.signInSignalProxy}signUpSignal(){return this.signUpSignalProxy}buildSignInProxy(){const t=this.gateProperty.bind(this),e=()=>this.client.signIn.__internal_future;return{errors:gMe(),fetchStatus:"idle",signIn:{status:"needs_identifier",availableStrategies:[],isTransferable:!1,get id(){return t(e,"id",void 0)},get supportedFirstFactors(){return t(e,"supportedFirstFactors",[])},get supportedSecondFactors(){return t(e,"supportedSecondFactors",[])},get secondFactorVerification(){return t(e,"secondFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},get identifier(){return t(e,"identifier",null)}
129,get createdSessionId(){return t(e,"createdSessionId",null)},get userData(){return t(e,"userData",{})},get firstFactorVerification(){return t(e,"firstFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},create:this.gateMethod(e,"create"),password:this.gateMethod(e,"password"),sso:this.gateMethod(e,"sso"),finalize:this.gateMethod(e,"finalize"),emailCode:this.wrapMethods(()=>e().emailCode,["sendCode","verifyCode"]),emailLink:this.wrapStruct(()=>e().emailLink,["sendLink","waitForVerification"],["verification"],{verification:null}),resetPasswordEmailCode:this.wrapMethods(()=>e().resetPasswordEmailCode,["sendCode","verifyCode","submitPassword"]),phoneCode:this.wrapMethods(()=>e().phoneCode,["sendCode","verifyCode"]),mfa:this.wrapMethods(()=>e().mfa,["sendPhoneCode","verifyPhoneCode","verifyTOTP","verifyBackupCode"]),ticket:this.gateMethod(e,"ticket"),passkey:this.gateMethod(e,"passkey"),web3:this.gateMethod(e,"web3")}}}buildSignUpProxy(){const t=this.gateProperty.bind(this),e=this.gateMethod.bind(this),n=this.wrapMethods.bind(this),s=()=>this.client.signUp.__internal_future;return{errors:vMe(),fetchStatus:"idle",signUp:{get id(){return t(s,"id",void 0)},get requiredFields(){return t(s,"requiredFields",[])},get optionalFields(){return t(s,"optionalFields",[])},get missingFields(){return t(s,"missingFields",[])},get username(){return t(s,"username",null)},get firstName(){return t(s,"firstName",null)},get lastName(){return t(s,"lastName",null)},get emailAddress(){return t(s,"emailAddress",null)},get phoneNumber(){return t(s,"phoneNumber",null)},get web3Wallet(){return t(s,"web3Wallet",null)},get hasPassword(){return t(s,"hasPassword",!1)},get unsafeMetadata(){return t(s,"unsafeMetadata",{})},get createdSessionId(){return t(s,"createdSessionId",null)},get createdUserId(){return t(s,"createdUserId",null)},get abandonAt(){return t(s,"abandonAt",null)},get legalAcceptedAt(){return t(s,"legalAcceptedAt",null)},get locale(){return t(s,"locale",null)},get status(){return t(s,"status","missing_requirements")},get unverifiedFields(){return t(s,"unverifiedFields",[])},get isTransferable(){return t(s,"isTransferable",!1)},create:e(s,"create"),update:e(s,"update"),sso:e(s,"sso"),password:e(s,"password"),ticket:e(s,"ticket"),web3:e(s,"web3"),finalize:e(s,"finalize"),verifications:n(()=>s().verifications,["sendEmailCode","verifyEmailCode","sendPhoneCode","verifyPhoneCode"])}}}__internal_effect(t){throw new Error("__internal_effect called before Clerk is loaded")}__internal_computed(t){throw new Error("__internal_computed called before Clerk is loaded")}get client(){const t=this.isomorphicClerk.client;if(!t)throw new Error("Clerk client not ready");return t}gateProperty(t,e,n){return!KT()||!this.isomorphicClerk.loaded?n:t()[e]}gateMethod(t,e){return(async(...n)=>{if(!KT())return nc.throw(`Attempted to call a method (${e}) that is not supported on the server.`);this.isomorphicClerk.loaded||await new Promise(r=>this.isomorphicClerk.addOnLoaded(r));const s=t();return s[e].apply(s,n)})}wrapMethods(t,e){return Object.fromEntries(e.map(n=>[n,this.gateMethod(t,n)]))}wrapStruct(t,e,n,s){const r={};for(const i of e)r[i]=this.gateMethod(t,i);for(const i of n)Object.defineProperty(r,i,{get:()=>this.gateProperty(t,i,s[i]),enumerable:!0});return r}};typeof globalThis.__BUILD_DISABLE_RHC__>"u"&&(globalThis.__BUILD_DISABLE_RHC__=!1);var yMe={name:"@clerk/clerk-react",version:"5.61.9",environment:"production"},kC,c0,u0,Rf,_c,RC,Uf,Ty,AC,Zle=class Xle{constructor(e){kf(this,Ty),this.clerkjs=null,this.preopenOneTap=null,this.preopenUserVerification=null,this.preopenEnableOrganizationsPrompt=null,this.preopenSignIn=null,this.preopenCheckout=null,this.preopenPlanDetails=null,this.preopenSubscriptionDetails=null,this.preopenSignUp=null,this.preopenUserProfile=null,this.preopenOrganizationProfile=null,this.preopenCreateOrganization=null,this.preOpenWaitlist=null,this.premountSign
129InNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserAvatarNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountOrganizationProfileNodes=new Map,this.premountCreateOrganizationNodes=new Map,this.premountOrganizationSwitcherNodes=new Map,this.premountOrganizationListNodes=new Map,this.premountMethodCalls=new Map,this.premountWaitlistNodes=new Map,this.premountPricingTableNodes=new Map,this.premountAPIKeysNodes=new Map,this.premountOAuthConsentNodes=new Map,this.premountTaskChooseOrganizationNodes=new Map,this.premountTaskResetPasswordNodes=new Map,this.premountTaskSetupMFANodes=new Map,this.premountAddListenerCalls=new Map,this.loadedListeners=[],kf(this,kC,"loading"),kf(this,c0),kf(this,u0),kf(this,Rf),kf(this,_c,mMe()),kf(this,RC),this.buildSignInUrl=r=>{const i=()=>{var a;return((a=this.clerkjs)==null?void 0:a.buildSignInUrl(r))||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildSignInUrl",i)},this.buildSignUpUrl=r=>{const i=()=>{var a;return((a=this.clerkjs)==null?void 0:a.buildSignUpUrl(r))||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildSignUpUrl",i)},this.buildAfterSignInUrl=(...r)=>{const i=()=>{var a;return((a=this.clerkjs)==null?void 0:a.buildAfterSignInUrl(...r))||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildAfterSignInUrl",i)},this.buildAfterSignUpUrl=(...r)=>{const i=()=>{var a;return((a=this.clerkjs)==null?void 0:a.buildAfterSignUpUrl(...r))||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildAfterSignUpUrl",i)},this.buildAfterSignOutUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildAfterSignOutUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterSignOutUrl",r)},this.buildNewSubscriptionRedirectUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildNewSubscriptionRedirectUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl",r)},this.buildAfterMultiSessionSingleSignOutUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildAfterMultiSessionSingleSignOutUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl",r)},this.buildUserProfileUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildUserProfileUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildUserProfileUrl",r)},this.buildCreateOrganizationUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildCreateOrganizationUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildCreateOrganizationUrl",r)},this.buildOrganizationProfileUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildOrganizationProfileUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildOrganizationProfileUrl",r)},this.buildWaitlistUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildWaitlistUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildWaitlistUrl",r)},this.buildTasksUrl=()=>{const r=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildTasksUrl())||""};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildTasksUrl",r)},this.buildUrlWithAuth=r=>{const i=()=>{var a;return((a=this.clerkjs)==null?void 0:a.buildUrlWithAuth(r))||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildUrlWithAuth",i)},this.handleUnauthenticated=async()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.handleUnauthenticated()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("handleUnauthenticated",r)},this.on=(...r)=>{var i;if((i=this.clerkjs)!=null&&i.on)return this.clerkjs.on(...r);Ks(this,_c).on(...r)},this.off=(...r)=>{var i;if((i=this.clerkjs)!=null&&i.off)return this.clerkjs.off(...r);Ks(this,_c).off(...r)},this.addOnLoaded=r=>{this.loadedListeners.push(r),this.loaded&&this.emitLoaded()},this.emitLoaded=()=>
129{this.loadedListeners.forEach(r=>r()),this.loadedListeners=[]},this.beforeLoad=r=>{if(!r)throw new Error("Failed to hydrate latest Clerk JS")},this.hydrateClerkJS=r=>{var i,a;if(!r)throw new Error("Failed to hydrate latest Clerk JS");return this.clerkjs=r,this.premountMethodCalls.forEach(o=>o()),this.premountAddListenerCalls.forEach((o,l)=>{o.nativeUnsubscribe=r.addListener(l)}),(i=Ks(this,_c).internal.retrieveListeners("status"))==null||i.forEach(o=>{this.on("status",o,{notify:!0})}),(a=Ks(this,_c).internal.retrieveListeners("queryClientStatus"))==null||a.forEach(o=>{this.on("queryClientStatus",o,{notify:!0})}),this.preopenSignIn!==null&&r.openSignIn(this.preopenSignIn),this.preopenCheckout!==null&&r.__internal_openCheckout(this.preopenCheckout),this.preopenPlanDetails!==null&&r.__internal_openPlanDetails(this.preopenPlanDetails),this.preopenSubscriptionDetails!==null&&r.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails),this.preopenSignUp!==null&&r.openSignUp(this.preopenSignUp),this.preopenUserProfile!==null&&r.openUserProfile(this.preopenUserProfile),this.preopenUserVerification!==null&&r.__internal_openReverification(this.preopenUserVerification),this.preopenOneTap!==null&&r.openGoogleOneTap(this.preopenOneTap),this.preopenOrganizationProfile!==null&&r.openOrganizationProfile(this.preopenOrganizationProfile),this.preopenCreateOrganization!==null&&r.openCreateOrganization(this.preopenCreateOrganization),this.preOpenWaitlist!==null&&r.openWaitlist(this.preOpenWaitlist),this.preopenEnableOrganizationsPrompt&&r.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt),this.premountSignInNodes.forEach((o,l)=>{r.mountSignIn(l,o)}),this.premountSignUpNodes.forEach((o,l)=>{r.mountSignUp(l,o)}),this.premountUserProfileNodes.forEach((o,l)=>{r.mountUserProfile(l,o)}),this.premountUserAvatarNodes.forEach((o,l)=>{r.mountUserAvatar(l,o)}),this.premountUserButtonNodes.forEach((o,l)=>{r.mountUserButton(l,o)}),this.premountOrganizationListNodes.forEach((o,l)=>{r.mountOrganizationList(l,o)}),this.premountWaitlistNodes.forEach((o,l)=>{r.mountWaitlist(l,o)}),this.premountPricingTableNodes.forEach((o,l)=>{r.mountPricingTable(l,o)}),this.premountAPIKeysNodes.forEach((o,l)=>{r.mountAPIKeys(l,o)}),this.premountOAuthConsentNodes.forEach((o,l)=>{r.__internal_mountOAuthConsent(l,o)}),this.premountTaskChooseOrganizationNodes.forEach((o,l)=>{r.mountTaskChooseOrganization(l,o)}),this.premountTaskResetPasswordNodes.forEach((o,l)=>{r.mountTaskResetPassword(l,o)}),this.premountTaskSetupMFANodes.forEach((o,l)=>{r.mountTaskSetupMFA(l,o)}),typeof this.clerkjs.status>"u"&&Ks(this,_c).emit(j_.Status,"ready"),this.emitLoaded(),this.clerkjs},this.__experimental_checkout=(...r)=>{var i;return(i=this.clerkjs)==null?void 0:i.__experimental_checkout(...r)},this.__unstable__updateProps=async r=>{const i=await WN(this,Ty,AC).call(this);if(i&&"__unstable__updateProps"in i)return i.__unstable__updateProps(r)},this.setActive=r=>this.clerkjs?this.clerkjs.setActive(r):Promise.reject(),this.openSignIn=r=>{this.clerkjs&&this.loaded?this.clerkjs.openSignIn(r):this.preopenSignIn=r},this.closeSignIn=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignIn():this.preopenSignIn=null},this.__internal_openCheckout=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openCheckout(r):this.preopenCheckout=r},this.__internal_closeCheckout=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeCheckout():this.preopenCheckout=null},this.__internal_openPlanDetails=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openPlanDetails(r):this.preopenPlanDetails=r},this.__internal_closePlanDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closePlanDetails():this.preopenPlanDetails=null},this.__internal_openSubscriptionDetails=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openSubscriptionDetails(r):this.preopenSubscriptionDetails=r??null},this.__internal_closeSubscriptionDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeSubscriptionDetails():this.preopenSubscriptionDetails=null},this.__internal_openReverification=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openReverification(r):this.preopenUserVerification=r},this.__internal_closeReverification=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeReverification():this.preopenUserVerification=null},this.__internal_openEnableOrganizationsPrompt=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openEnableOrganizationsPrompt(r):this.preopenEnableOrganizationsPrompt=r},this.__internal_closeEnableOrganizationsPrompt=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeEnableOrganizationsPrompt():this.preopenEnableOrganizationsPrompt=null},this.openGoogleOneTap=r=>{this.clerkjs&&this.loaded?this.clerkjs.openGoogleOneTap(r):this.preopenOneTap=r},this.closeGoogleOneTap=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeGoogleOneTap():this.preopenOneTap=null},this.openUserProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.openUserProfile(r):this.preopenUserProfile=r},this.closeUserProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeUserProfile():this.preopenUserProfile=null},this.openOrganizationProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.openOrganizationProfile(r):this.preopenOrganizationProfile=r},this.closeOrganizationProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeOrganizationProfile():this.preopenOrganizationProfile=null},this.openCreateOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.openCreateOrganization(r):this.preopenCreateOrganization=r},this.closeCreateOrganization=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeCreateOrganization():this.preopenCreateOrganization=null},this.openWaitlist=r=>{this.clerkjs&&this.loaded?this.clerkjs.openWaitlist(r):this.preOpenWaitlist=r},this.closeWaitlist=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeWaitlist():this.preOpenWaitlist=null},this.openSignUp=r=>{this.clerkjs&&this.loaded?this.clerkjs.openSignUp(r):this.preopenSignUp=r},this.closeSignUp=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignUp():this.preopenSignUp=null}
129,this.mountSignIn=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignIn(r,i):this.premountSignInNodes.set(r,i)},this.unmountSignIn=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignIn(r):this.premountSignInNodes.delete(r)},this.mountSignUp=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignUp(r,i):this.premountSignUpNodes.set(r,i)},this.unmountSignUp=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignUp(r):this.premountSignUpNodes.delete(r)},this.mountUserAvatar=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserAvatar(r,i):this.premountUserAvatarNodes.set(r,i)},this.unmountUserAvatar=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserAvatar(r):this.premountUserAvatarNodes.delete(r)},this.mountUserProfile=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserProfile(r,i):this.premountUserProfileNodes.set(r,i)},this.unmountUserProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserProfile(r):this.premountUserProfileNodes.delete(r)},this.mountOrganizationProfile=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationProfile(r,i):this.premountOrganizationProfileNodes.set(r,i)},this.unmountOrganizationProfile=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationProfile(r):this.premountOrganizationProfileNodes.delete(r)},this.mountCreateOrganization=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountCreateOrganization(r,i):this.premountCreateOrganizationNodes.set(r,i)},this.unmountCreateOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountCreateOrganization(r):this.premountCreateOrganizationNodes.delete(r)},this.mountOrganizationSwitcher=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationSwitcher(r,i):this.premountOrganizationSwitcherNodes.set(r,i)},this.unmountOrganizationSwitcher=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationSwitcher(r):this.premountOrganizationSwitcherNodes.delete(r)},this.__experimental_prefetchOrganizationSwitcher=()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.__experimental_prefetchOrganizationSwitcher()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher",r)},this.mountOrganizationList=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationList(r,i):this.premountOrganizationListNodes.set(r,i)},this.unmountOrganizationList=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationList(r):this.premountOrganizationListNodes.delete(r)},this.mountUserButton=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserButton(r,i):this.premountUserButtonNodes.set(r,i)},this.unmountUserButton=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserButton(r):this.premountUserButtonNodes.delete(r)},this.mountWaitlist=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountWaitlist(r,i):this.premountWaitlistNodes.set(r,i)},this.unmountWaitlist=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountWaitlist(r):this.premountWaitlistNodes.delete(r)},this.mountPricingTable=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountPricingTable(r,i):this.premountPricingTableNodes.set(r,i)},this.unmountPricingTable=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountPricingTable(r):this.premountPricingTableNodes.delete(r)},this.mountAPIKeys=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountAPIKeys(r,i):this.premountAPIKeysNodes.set(r,i)},this.unmountAPIKeys=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountAPIKeys(r):this.premountAPIKeysNodes.delete(r)},this.__internal_mountOAuthConsent=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountOAuthConsent(r,i):this.premountOAuthConsentNodes.set(r,i)},this.__internal_unmountOAuthConsent=r=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountOAuthConsent(r):this.premountOAuthConsentNodes.delete(r)},this.mountTaskChooseOrganization=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskChooseOrganization(r,i):this.premountTaskChooseOrganizationNodes.set(r,i)},this.unmountTaskChooseOrganization=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskChooseOrganization(r):this.premountTaskChooseOrganizationNodes.delete(r)},this.mountTaskResetPassword=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskResetPassword(r,i):this.premountTaskResetPasswordNodes.set(r,i)},this.unmountTaskResetPassword=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskResetPassword(r):this.premountTaskResetPasswordNodes.delete(r)},this.mountTaskSetupMFA=(r,i)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskSetupMFA(r,i):this.premountTaskSetupMFANodes.set(r,i)},this.unmountTaskSetupMFA=r=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskSetupMFA(r):this.premountTaskSetupMFANodes.delete(r)},this.addListener=r=>{if(this.clerkjs)return this.clerkjs.addListener(r);{const i=()=>{var a;const o=this.premountAddListenerCalls.get(r);o&&((a=o.nativeUnsubscribe)==null||a.call(o),this.premountAddListenerCalls.delete(r))};return this.premountAddListenerCalls.set(r,{unsubscribe:i,nativeUnsubscribe:void 0}),i}},this.navigate=r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.navigate(r)};this.clerkjs&&this.loaded?i():this.premountMethodCalls.set("navigate",i)},this.redirectWithAuth=async(...r)=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.redirectWithAuth(...r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectWithAuth",i)},this.redirectToSignIn=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.redirectToSignIn(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToSignIn",i)},this.redirectToSignUp=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.redirectToSignUp(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToSignUp",i)},this.redirectToUserProfile=async()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToUserProfile()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToUserProfile",r)},this.redirectToAfterSignUp=()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToAfterSignUp()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToAfterSignUp",r)},this.redirectToAfterSignIn=()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToAfterSignIn()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("redirectToAfterSignIn",r)},this.redirectToAfterSignOut=()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToAfterSignOut()};this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("redirectToAfterSignOut",r)},this.redirectToOrganizationProfile=async()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToOrganizationProfile()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToOrganizationProfile",r)},this.redirectToCreateOrganization=async()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToCreateOrganization()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToCreateOrganization",r)},this.redirectToWaitlist=async()=>{const r=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToWaitlist()};if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToWaitlist",r)},this.redirectToTasks=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.redirectToTasks(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToTasks",i)},this.handleRedirectCallback=async r=>{var i;const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.handleRedirectCallback(r)};this.clerkjs&&this.loaded?(i=a())==null||i.catch(()=>{}):this.premountMethodCalls.set("handleRedirectCallback",a)},this.handleGoogleOneTapCallback=async(r,i)=>{var a;const o=()=>{var l;return(l=this.clerkjs)==null?void 0:l.handleGoogleOneTapCallback(r,i)};
129this.clerkjs&&this.loaded?(a=o())==null||a.catch(()=>{}):this.premountMethodCalls.set("handleGoogleOneTapCallback",o)},this.handleEmailLinkVerification=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.handleEmailLinkVerification(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("handleEmailLinkVerification",i)},this.authenticateWithMetamask=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithMetamask(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithMetamask",i)},this.authenticateWithCoinbaseWallet=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithCoinbaseWallet(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithCoinbaseWallet",i)},this.authenticateWithBase=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithBase(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithBase",i)},this.authenticateWithOKXWallet=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithOKXWallet(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithOKXWallet",i)},this.authenticateWithSolana=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithSolana(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithSolana",i)},this.authenticateWithWeb3=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.authenticateWithWeb3(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("authenticateWithWeb3",i)},this.authenticateWithGoogleOneTap=async r=>(await WN(this,Ty,AC).call(this)).authenticateWithGoogleOneTap(r),this.__internal_loadStripeJs=async()=>(await WN(this,Ty,AC).call(this)).__internal_loadStripeJs(),this.createOrganization=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.createOrganization(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("createOrganization",i)},this.getOrganization=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.getOrganization(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("getOrganization",i)},this.joinWaitlist=async r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.joinWaitlist(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("joinWaitlist",i)},this.signOut=async(...r)=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.signOut(...r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("signOut",i)},this.__internal_attemptToEnableEnvironmentSetting=r=>{const i=()=>{var a;return(a=this.clerkjs)==null?void 0:a.__internal_attemptToEnableEnvironmentSetting(r)};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting",i)};const{Clerk:n=null,publishableKey:s}=e||{};pp(this,Rf,s),pp(this,u0,e==null?void 0:e.proxyUrl),pp(this,c0,e==null?void 0:e.domain),this.options=e,this.Clerk=n,this.mode=KT()?"browser":"server",pp(this,RC,new xMe(this)),this.options.sdkMetadata||(this.options.sdkMetadata=yMe),Ks(this,_c).emit(j_.Status,"loading"),Ks(this,_c).prioritizedOn(j_.Status,r=>pp(this,kC,r)),Ks(this,Rf)&&this.loadClerkJS()}get publishableKey(){return Ks(this,Rf)}get loaded(){var e;return((e=this.clerkjs)==null?void 0:e.loaded)||!1}get status(){var e;return this.clerkjs?((e=this.clerkjs)==null?void 0:e.status)||(this.clerkjs.loaded?"ready":"loading"):Ks(this,kC)}static getOrCreateInstance(e){return(!KT()||!Ks(this,Uf)||e.Clerk&&Ks(this,Uf).Clerk!==e.Clerk||Ks(this,Uf).publishableKey!==e.publishableKey)&&pp(this,Uf,new Xle(e)),Ks(this,Uf)}static clearInstance(){pp(this,Uf,null)}get domain(){return typeof window<"u"&&window.location?BN(Ks(this,c0),new URL(window.location.href),""):typeof Ks(this,c0)=="function"?nc.throw(UN):Ks(this,c0)||""}get proxyUrl(){return typeof window<"u"&&window.location?BN(Ks(this,u0),new URL(window.location.href),""):typeof Ks(this,u0)=="function"?nc.throw(UN):Ks(this,u0)||""}__internal_getOption(e){var n,s;return(n=this.clerkjs)!=null&&n.__internal_getOption?(s=this.clerkjs)==null?void 0:s.__internal_getOption(e):this.options[e]}get sdkMetadata(){var e;return((e=this.clerkjs)==null?void 0:e.sdkMetadata)||this.options.sdkMetadata||void 0}get instanceType(){var e;return(e=this.clerkjs)==null?void 0:e.instanceType}get frontendApi(){var e;return((e=this.clerkjs)==null?void 0:e.frontendApi)||""}get isStandardBrowser(){var e;return((e=this.clerkjs)==null?void 0:e.isStandardBrowser)||this.options.standardBrowser||!1}get __internal_queryClient(){var e;return(e=this.clerkjs)==null?void 0:e.__internal_queryClient}get isSatellite(){return typeof window<"u"&&window.location?BN(this.options.isSatellite,new URL(window.location.href),!1):typeof this.options.isSatellite=="function"?nc.throw(UN):!1}async loadClerkJS(){var e;if(!(this.mode!=="browser"||this.loaded)){typeof window<"u"&&(window.__clerk_publishable_key=Ks(this,Rf),window.__clerk_proxy_url=this.proxyUrl,window.__clerk_domain=this.domain);try{if(this.Clerk){let n;RPe(this.Clerk)?(n=new this.Clerk(Ks(this,Rf),{proxyUrl:this.proxyUrl,domain:this.domain}),this.beforeLoad(n),await n.load(this.options)):(n=this.Clerk,n.loaded||(this.beforeLoad(n),await n.load(this.options))),global.Clerk=n}else if(!__BUILD_DISABLE_RHC__){if(global.Clerk||await oMe({...this.options,publishableKey:Ks(this,Rf),proxyUrl:this.proxyUrl,domain:this.domain,nonce:this.options.nonce}),!global.Clerk)throw new Error("Failed to download latest ClerkJS. Contact [email protected].");this.beforeLoad(global.Clerk),await global.Clerk.load(this.options)}return(e=global.Clerk)!=null&&e.loaded?this.hydrateClerkJS(global.Clerk):void 0}catch(n){const s=n;Ks(this,_c).emit(j_.Status,"error"),console.error(s.stack||s.message||s);return}}}get version(){var e;return(e=this.clerkjs)==null?void 0:e.version}get client(){if(this.clerkjs)return this.clerkjs.client}get session(){if(this.clerkjs)return this.clerkjs.session}
129get user(){if(this.clerkjs)return this.clerkjs.user}get organization(){if(this.clerkjs)return this.clerkjs.organization}get telemetry(){if(this.clerkjs)return this.clerkjs.telemetry}get __unstable__environment(){if(this.clerkjs)return this.clerkjs.__unstable__environment}get isSignedIn(){return this.clerkjs?this.clerkjs.isSignedIn:!1}get billing(){var e;return(e=this.clerkjs)==null?void 0:e.billing}get __internal_state(){return this.loaded&&this.clerkjs?this.clerkjs.__internal_state:Ks(this,RC)}get apiKeys(){var e;return(e=this.clerkjs)==null?void 0:e.apiKeys}__unstable__setEnvironment(...e){if(this.clerkjs&&"__unstable__setEnvironment"in this.clerkjs)this.clerkjs.__unstable__setEnvironment(e);else return}};kC=new WeakMap;c0=new WeakMap;u0=new WeakMap;Rf=new WeakMap;_c=new WeakMap;RC=new WeakMap;Uf=new WeakMap;Ty=new WeakSet;AC=function(){return new Promise(t=>{this.addOnLoaded(()=>t(this.clerkjs))})};kf(Zle,Uf);var Oq=Zle;function bMe(t){const{isomorphicClerkOptions:e,initialState:n,children:s}=t,{isomorphicClerk:r,clerkStatus:i}=SMe(e),[a,o]=re.useState({client:r.client,session:r.session,user:r.user,organization:r.organization});re.useEffect(()=>r.addListener(O=>o({...O})),[]);const l=dMe(r.loaded,a,n),u=re.useMemo(()=>({value:r}),[i]),d=re.useMemo(()=>({value:a.client}),[a.client]),{sessionId:f,sessionStatus:p,sessionClaims:m,session:v,userId:x,user:y,orgId:S,actor:_,organization:E,orgRole:T,orgSlug:k,orgPermissions:R,factorVerificationAge:I}=l,A=re.useMemo(()=>({value:{sessionId:f,sessionStatus:p,sessionClaims:m,userId:x,actor:_,orgId:S,orgRole:T,orgSlug:k,orgPermissions:R,factorVerificationAge:I}}),[f,p,x,_,S,T,k,I,m==null?void 0:m.__raw]),L=re.useMemo(()=>({value:v}),[f,v]),j=re.useMemo(()=>({value:y}),[x,y]),F=re.useMemo(()=>({value:{organization:E}}),[S,E]);return re.createElement(sPe.Provider,{value:u},re.createElement(Lje.Provider,{value:d},re.createElement(jje.Provider,{value:L},re.createElement(Fje,{...F.value},re.createElement(tPe.Provider,{value:A},re.createElement(Ije.Provider,{value:j},re.createElement(Dje,{value:void 0},s)))))))}var SMe=t=>{const e=re.useRef(Oq.getOrCreateInstance(t)),[n,s]=re.useState(e.current.status);return re.useEffect(()=>{e.current.__unstable__updateProps({appearance:t.appearance})},[t.appearance]),re.useEffect(()=>{e.current.__unstable__updateProps({options:t})},[t.localization]),re.useEffect(()=>(e.current.on("status",s),()=>{e.current&&e.current.off("status",s),Oq.clearInstance()}),[]),{isomorphicClerk:e.current,clerkStatus:n}};function wMe(t){const{initialState:e,children:n,__internal_bypassMissingPublishableKey:s,...r}=t,{publishableKey:i="",Clerk:a}=r;return!a&&!s&&(i?i&&!Uj(i)&&nc.throwInvalidPublishableKeyError({key:i}):nc.throwMissingPublishableKeyError()),re.createElement(bMe,{initialState:e,isomorphicClerkOptions:r},n)}var Qle=NPe(wMe,"ClerkProvider",rPe);Qle.displayName="ClerkProvider";ePe({packageName:"@clerk/clerk-react"});iMe("@clerk/clerk-react");const BO=w.createContext({});function SS(t){const e=w.useRef(null);return e.current===null&&(e.current=t()),e.current}const _Me=typeof window<"u",v4=_Me?w.useLayoutEffect:w.useEffect,x4=w.createContext(null);function zO(t,e){t.indexOf(e)===-1&&t.push(e)}function YT(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const ru=(t,e,n)=>n>e?e:n<t?t:n;let y4=()=>{};const kh={},Jle=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),ece=t=>typeof t=="object"&&t!==null,tce=t=>/^0[^.\s]+$/u.test(t);function nce(t){let e;return()=>(e===void 0&&(e=t()),e)}const dl=t=>t,wS=(...t)=>t.reduce((e,n)=>s=>n(e(s))),Xb=(t,e,n)=>{const s=e-t;return s?(n-t)/s:1};class VO{constructor(){this.subscriptions=[]}add(e){return zO(this.subscriptions,e),()=>YT(this.subscriptions,e)}notify(e,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,s);else for(let i=0;i<r;i++){const a=this.subscriptions[i];a&&a(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ro=t=>t*1e3,al=t=>t/1e3,sce=(t,e)=>e?t*(1e3/e):0,rce=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,EMe=1e-7,CMe=12;function TMe(t,e,n,s,r){let i,a,o=0;do a=e+(n-e)/2,i=rce(a,s,r)-t,i>0?n=a:e=a;while(Math.abs(i)>EMe&&++o<CMe);return a}function _S(t,e,n,s){if(t===e&&n===s)return dl;const r=i=>TMe(i,0,1,t,n);return i=>i===0||i===1?i:rce(r(i),e,s)}const ice=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ace=t=>e=>1-t(1-e),oce=_S(.33,1.53,.69,.99),HO=ace(oce),lce=ice(HO),cce=t=>t>=1?1:(t*=2)<1?.5*HO(t):.5*(2-Math.pow(2,-10*(t-1))),GO=t=>1-Math.sin(Math.acos(t)),uce=ace(GO),dce=ice(GO),kMe=_S(.42,0,1,1),RMe=_S(0,0,.58,1),fce=_S(.42,0,.58,1),AMe=t=>Array.isArray(t)&&typeof t[0]!="number",hce=t=>Array.isArray(t)&&typeof t[0]=="number",NMe={linear:dl,easeIn:kMe,easeInOut:fce,easeOut:RMe,circIn:GO,circInOut:dce,circOut:uce,backIn:HO,backInOut:lce,backOut:oce,anticipate:cce},IMe=t=>typeof t=="string",$q=t=>{if(hce(t)){y4(t.length===4);const[e,n,s,r]=t;return _S(e,n,s,r)}else if(IMe(t))return NMe[t];return t},P_=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function LMe(t){let e=new Set,n=new Set,s=!1,r=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(l.schedule(u),t()),u(a)}const l={schedule:(u,d=!1,f=!1)=>{const m=f&&s?e:n;return d&&i.add(u),m.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,s){r=!0;return}s=!0;const d=e;e=n,n=d,e.forEach(o),e.clear(),s=!1,r&&(r=!1,l.process(u))}};return l}const jMe=40;function pce(t,e){let n=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=P_.reduce((E,T)=>(E[T]=LMe(i),E),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:d,update:f,preRender:p,render:m,postRender:v}=a,x=()=>{const E=kh.useManualTiming,T=E?r.timestamp:performance.now();n=!1,E||(r.delta=s?1e3/60:Math.max(Math.min(T-r.timestamp,jMe),1)),r.timestamp=T,r.isProcessing=!0,o.process(r),l.process(r),u.process(r),d.process(r),f.process(r),p.process(r),m.process(r),v.process(r),r.isProcessing=!1,n&&e&&(s=!1,t(x))},y=()=>{n=!0,s=!0,r.isProcessing||t(x)};return{schedule:P_.reduce((E,T)=>{const k=a[T];return E[T]=(R,I=!1,A=!1)=>(n||y(),k.schedule(R,I,A)),E},{}),cancel:E=>{for(let T=0;T<P_.length;T++)a[P_[T]].cancel(E)},state:r,steps:a}}const{schedule:$s,cancel:Rh,state:Di,steps:qN}=pce(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0);let NC;function PMe(){NC=void 0}const Ta={now:()=>(NC===void 0&&Ta.set(Di.isProcessing||kh.useManualTiming?Di.timestamp:performance.now()),NC),set:t=>{NC=t,queueMicrotask(PMe)}},mce=t=>e=>typeof e=="string"&&e.startsWith(t),gce=mce("--"),MMe=mce("var(--"),WO=t=>MMe(t)?DMe.test(t.split("/*")[0].trim()):!1,DMe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Fq(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const L1={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Qb={...L1,transform:t=>ru(0,1,t)},M_={...L1,default:1},ab=t=>
vendor: 1,869 bytes, line 129
129Math.round(t*1e5)/1e5,qO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function OMe(t){return t==null}const $Me=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,KO=(t,e)=>n=>!!(typeof n=="string"&&$Me.test(n)&&n.startsWith(t)||e&&!OMe(n)&&Object.prototype.hasOwnProperty.call(n,e)),vce=(t,e,n)=>s=>{if(typeof s!="string")return s;const[r,i,a,o]=s.match(qO);return{[t]:parseFloat(r),[e]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},FMe=t=>ru(0,255,t),KN={...L1,transform:t=>Math.round(FMe(t))},Wp={test:KO("rgb","red"),parse:vce("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+KN.transform(t)+", "+KN.transform(e)+", "+KN.transform(n)+", "+ab(Qb.transform(s))+")"};function UMe(t){let e="",n="",s="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Jj={test:KO("#"),parse:UMe,transform:Wp.transform},ES=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),zu=ES("deg"),Yc=ES("%"),At=ES("px"),BMe=ES("vh"),zMe=ES("vw"),Uq={...Yc,parse:t=>Yc.parse(t)/100,transform:t=>Yc.transform(t*100)},A0={test:KO("hsl","hue"),parse:vce("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+Yc.transform(ab(e))+", "+Yc.transform(ab(n))+", "+ab(Qb.transform(s))+")"},Xr={test:t=>Wp.test(t)||Jj.test(t)||A0.test(t),parse:t=>Wp.test(t)?Wp.parse(t):A0.test(t)?A0.parse(t):Jj.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Wp.transform(t):A0.transform(t),getAnimatableNone:t=>{const e=Xr.parse(t);
vendor: 24,036 bytes, line 129
129return e.alpha=0,Xr.transform(e)}},VMe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function HMe(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(qO))==null?void 0:e.length)||0)+(((n=t.match(VMe))==null?void 0:n.length)||0)>0}const xce="number",yce="color",GMe="var",WMe="var(",Bq="${}",qMe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function zv(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const o=e.replace(qMe,l=>(Xr.test(l)?(s.color.push(i),r.push(yce),n.push(Xr.parse(l))):l.startsWith(WMe)?(s.var.push(i),r.push(GMe),n.push(l)):(s.number.push(i),r.push(xce),n.push(parseFloat(l))),++i,Bq)).split(Bq);return{values:n,split:o,indexes:s,types:r}}function KMe(t){return zv(t).values}function bce({split:t,types:e}){const n=t.length;return s=>{let r="";for(let i=0;i<n;i++)if(r+=t[i],s[i]!==void 0){const a=e[i];a===xce?r+=ab(s[i]):a===yce?r+=Xr.transform(s[i]):r+=s[i]}return r}}function YMe(t){return bce(zv(t))}const ZMe=t=>typeof t=="number"?0:Xr.test(t)?Xr.getAnimatableNone(t):t,XMe=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:ZMe(t);function QMe(t){const e=zv(t);return bce(e)(e.values.map((s,r)=>XMe(s,e.split[r])))}const sc={test:HMe,parse:KMe,createTransformer:YMe,getAnimatableNone:QMe};function YN(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function JMe({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let r=0,i=0,a=0;if(!e)r=i=a=n;else{const o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;r=YN(l,o,t+1/3),i=YN(l,o,t),a=YN(l,o,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:s}}function ZT(t,e){return n=>n>0?e:t}const Os=(t,e,n)=>t+(e-t)*n,ZN=(t,e,n)=>{const s=t*t,r=n*(e*e-s)+s;return r<0?0:Math.sqrt(r)},eDe=[Jj,Wp,A0],tDe=t=>eDe.find(e=>e.test(t));function zq(t){const e=tDe(t);if(!e)return!1;let n=e.parse(t);return e===A0&&(n=JMe(n)),n}const Vq=(t,e)=>{const n=zq(t),s=zq(e);if(!n||!s)return ZT(t,e);const r={...n};return i=>(r.red=ZN(n.red,s.red,i),r.green=ZN(n.green,s.green,i),r.blue=ZN(n.blue,s.blue,i),r.alpha=Os(n.alpha,s.alpha,i),Wp.transform(r))},eP=new Set(["none","hidden"]);function nDe(t,e){return eP.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function sDe(t,e){return n=>Os(t,e,n)}function YO(t){return typeof t=="number"?sDe:typeof t=="string"?WO(t)?ZT:Xr.test(t)?Vq:aDe:Array.isArray(t)?Sce:typeof t=="object"?Xr.test(t)?Vq:rDe:ZT}function Sce(t,e){const n=[...t],s=n.length,r=t.map((i,a)=>YO(i)(i,e[a]));return i=>{for(let a=0;a<s;a++)n[a]=r[a](i);return n}}function rDe(t,e){const n={...t,...e},s={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(s[r]=YO(t[r])(t[r],e[r]));return r=>{for(const i in s)n[i]=s[i](r);return n}}function iDe(t,e){const n=[],s={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const i=e.types[r],a=t.indexes[i][s[i]],o=t.values[a]??0;n[r]=o,s[i]++}return n}const aDe=(t,e)=>{const n=sc.createTransformer(e),s=zv(t),r=zv(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?eP.has(t)&&!r.values.length||eP.has(e)&&!s.values.length?nDe(t,e):wS(Sce(iDe(s,r),r.values),n):ZT(t,e)};function wce(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Os(t,e,n):YO(t)(t,e)}const oDe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>$s.update(e,n),stop:()=>Rh(e),now:()=>Di.isProcessing?Di.timestamp:Ta.now()}},_ce=(t,e,n=10)=>{let s="";const r=Math.max(Math.round(e/n),2);for(let i=0;i<r;i++)s+=Math.round(t(i/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},XT=2e4;function ZO(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<XT;)e+=n,s=t.next(e);return e>=XT?1/0:e}function lDe(t,e=100,n){const s=n({...t,keyframes:[0,e]}),r=Math.min(ZO(s),XT);return{type:"keyframes",ease:i=>s.next(r*i).value/e,duration:al(r)}}const Cr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function tP(t,e){return t*Math.sqrt(1-e*e)}const cDe=12;function uDe(t,e,n){let s=n;for(let r=1;r<cDe;r++)s=s-t(s)/e(s);return s}const XN=.001;function dDe({duration:t=Cr.duration,bounce:e=Cr.bounce,velocity:n=Cr.velocity,mass:s=Cr.mass}){let r,i,a=1-e;a=ru(Cr.minDamping,Cr.maxDamping,a),t=ru(Cr.minDuration,Cr.maxDuration,al(t)),a<1?(r=u=>{const d=u*a,f=d*t,p=d-n,m=tP(u,a),v=Math.exp(-f);return XN-p/m*v},i=u=>{const f=u*a*t,p=f*n+n,m=Math.pow(a,2)*Math.pow(u,2)*t,v=Math.exp(-f),x=tP(Math.pow(u,2),a);return(-r(u)+XN>0?-1:1)*((p-m)*v)/x}):(r=u=>{const d=Math.exp(-u*t),f=(u-n)*t+1;return-XN+d*f},i=u=>{const d=Math.exp(-u*t),f=(n-u)*(t*t);return d*f});const o=5/t,l=uDe(r,i,o);if(t=Ro(t),isNaN(l))return{stiffness:Cr.stiffness,damping:Cr.damping,duration:t};{const u=Math.pow(l,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:t}}}const fDe=["duration","bounce"],hDe=["stiffness","damping","mass"];function Hq(t,e){return e.some(n=>t[n]!==void 0)}function pDe(t){let e={velocity:Cr.velocity,stiffness:Cr.stiffness,damping:Cr.damping,mass:Cr.mass,isResolvedFromDuration:!1,...t};if(!Hq(t,hDe)&&Hq(t,fDe))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),r=s*s,i=2*ru(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Cr.mass,stiffness:r,damping:i}}else{const n=dDe({...t,velocity:0});e={...e,...n,mass:Cr.mass},e.isResolvedFromDuration=!0}return e}function QT(t=Cr.visualDuration,e=Cr.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:r}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:f,velocity:p,isResolvedFromDuration:m}=pDe({...n,velocity:-al(n.velocity||0)}),v=p||0,x=u/(2*Math.sqrt(l*d)),y=a-i,S=al(Math.sqrt(l/d)),_=Math.abs(y)<5;s||(s=_?Cr.restSpeed.granular:Cr.restSpeed.default),r||(r=_?Cr.restDelta.granular:Cr.restDelta.default);let E,T,k,R,I,A;if(x<1)k=tP(S,x),R=(v+x*S*y)/k,E=j=>{const F=Math.exp(-x*S*j);return a-F*(R*Math.sin(k*j)+y*Math.cos(k*j))},I=x*S*R+y*k,A=x*S*y-R*k,T=j=>Math.exp(-x*S*j)*(I*Math.sin(k*j)+A*Math.cos(k*j));else if(x===1){E=F=>a-Math.exp(-S*F)*(y+(v+S*y)*F);const j=v+S*y;T=F=>Math.exp(-S*F)*(S*j*F-v)}else{const j=S*Math.sqrt(x*x-1);E=U=>{const G=Math.exp(-x*S*U),$=Math.min(j*U,300);return a-G*((v+x*S*y)*Math.sinh($)+j*y*Math.cosh($))/j};const F=(v+x*S*y)/j,O=x*S*F-y*j,M=x*S*y-F*j;T=U=>{const G=Math.exp(-x*S*U),$=Math.min(j*U,300);return G*(O*Math.sinh($)+M*Math.cosh($))}}const L={calculatedDuration:m&&f||null,velocity:j=>Ro(T(j)),next:j=>{if(!m&&x<1){const O=Math.exp(-x*S*j),M=Math.sin(k*j),U=Math.cos(k*j),G=a-O*(R*M+y*U),$=Ro(O*(I*M+A*U));return o.done=Math.abs($)<=s&&Math.abs(a-G)<=r,o.value=o.done?a:G,o}const F=E(j);if(m)o.done=j>=f;else{const O=Ro(T(j));o.done=Math.abs(O)<=s&&Math.abs(a-F)<=r}return o.value=o.done?a:F,o},toString:()=>{const j=Math.min(ZO(L),XT),F=_ce(O=>L.next(j*O).value,j,30);return j+"ms "+F},toTransition:()=>{}};return L}QT.applyToOptions=t=>{const e=lDe(t,100,QT);return t.ease=e.ease,t.duration=Ro(e.duration),t.type="keyframes",t};const mDe=5;function Ece(t,e,n){const s=Math.max(e-mDe,0);return sce(n-t(s),e-s)}function nP({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:d}){const f=t[0],p={done:!1,value:f},m=A=>o!==void 0&&A<o||l!==void 0&&A>l,v=A=>o===void 0?l:l===void 0||Math.abs(o-A)<Math.abs(l-A)?o:l;let x=n*e;const y=f+x,S=a===void 0?y:a(y);S!==y&&(x=S-f);const _=A=>-x*Math.exp(-A/s),E=A=>S+_(A),T=A=>{const L=_(A),j=E(A);p.done=Math.abs(L)<=u,p.value=p.done?S:j};let k,R;const I=A=>{m(p.value)&&(k=A,R=QT({keyframes:[p.value,v(p.value)],velocity:Ece(E,A,p.value),damping:r,stiffness:i,restDelta:u,restSpeed:d}))};return I(0),{calculatedDuration:null,next:A=>{let L=!1;return!R&&k===void 0&&(L=!0,T(A),I(A)),k!==void 0&&A>=k?R.next(A-k):(!L&&T(A),p)}}}function gDe(t,e,n){const s=[],r=n||kh.mix||wce,i=t.length-1;for(let a=0;a<i;a++){let o=r(t[a],t[a+1]);if(e){const l=Array.isArray(e)?e[a]||dl:e;o=wS(l,o)}s.push(o)}return s}function vDe(t,e,{clamp:n=!0,ease:s,mixer:r}={}){const i=t.length;if(y4(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=gDe(e,s,r),l=o.length,u=d=>{if(a&&d<t[0])return e[0];let f=0;if(l>1)for(;f<t.length-2&&!(d<t[f+1]);f++);const p=Xb(t[f],t[f+1],d);return o[f](p)};return n?d=>u(ru(t[0],t[i-1],d)):u}function xDe(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=Xb(0,e,s);t.push(Os(n,1,r))}}function yDe(t){const e=[0];return xDe(e,t.length-1),e}function bDe(t,e){return t.map(n=>n*e)}function SDe(t,e){return t.map(()=>e||fce).splice(0,t.length-1)}function ob({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const r=AMe(s)?s.map($q):$q(s),i={done:!1,value:e[0]},a=bDe(n&&n.length===e.length?n:yDe(e),t),o=vDe(a,e,{ease:Array.isArray(r)?r:SDe(e,r)});return{calculatedDuration:t,next:l=>(i.value=o(l),i.done=l>=t,i)}}const wDe=t=>t!==null;function b4(t,{repeat:e,repeatType:n="loop"},s,r=1){const i=t.filter(wDe),o=r<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!o||s===void 0?i[o]:s}const _De={decay:nP,inertia:nP,tween:ob,keyframes:ob,spring:QT};function Cce(t){typeof t.type=="string"&&(t.type=_De[t.type])}class XO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const EDe=t=>t/100;class JT extends XO{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var s,r;const{motionValue:n}=this.options;n&&n.updatedAt!==Ta.now()&&this.tick(Ta.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Cce(e);const{type:n=ob,repeat:s=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e;let{keyframes:o}=e;const l=n||ob;l!==ob&&typeof o[0]!="number"&&(this.mixKeyframes=wS(EDe,wce(o[0],o[1])),o=[0,100]);const u=l({...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...o].reverse(),velocity:-a})),u.calculatedDuration===null&&(u.calculatedDuration=ZO(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:s,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return s.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:p,repeatDelay:m,type:v,onUpdate:x,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const S=this.currentTime-u*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?S<0:S>r;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let E=this.currentTime,T=s;if(f){const A=Math.min(this.currentTime,r)/o;let L=Math.floor(A),j=A%1;!j&&A>=1&&(j=1),j===1&&L--,L=Math.min(L,f+1),!!(L%2)&&(p==="reverse"?(j=1-j,m&&(j-=m/o)):p==="mirror"&&(T=a)),E=ru(0,1,j)*o}let k;_?(this.delayState.value=d[0],k=this.delayState):k=T.next(E),i&&!_&&(k.value=i(k.value));let{done:R}=k;!_&&l!==null&&(R=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return I&&v!==nP&&(k.value=b4(d,this.options,y,this.speed)),x&&x(k.value),I&&this.finish(),k}then(e,n){return this.finished.then(e,n)}get duration(){return al(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+al(e)}get time(){return al(this.currentTime)}set time(e){e=Ro(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return Ece(s=>this.generator.next(s).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(Ta.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=al(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:e=oDe,startTime:n}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),(i=(r=this.options).onPlay)==null||i.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ta.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function CDe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const qp=t=>t*180/Math.PI,sP=t=>{const e=qp(Math.atan2(t[1],t[0]));return rP(e)},TDe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:sP,rotateZ:sP,skewX:t=>qp(Math.atan(t[1])),skewY:t=>qp(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},rP=t=>(t=t%360,t<0&&(t+=360),t),Gq=sP,Wq=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),qq=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),kDe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Wq,scaleY:qq,scale:t=>(Wq(t)+qq(t))/2,rotateX:t=>rP(qp(Math.atan2(t[6],t[5]))),rotateY:t=>rP(qp(Math.atan2(-t[2],t[0]))),rotateZ:Gq,rotate:Gq,skewX:t=>qp(Math.atan(t[4])),skewY:t=>qp(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function iP(t){return t.includes("scale")?1:0}function aP(t,e){if(!t||t==="none")return iP(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=kDe,r=n;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=TDe,r=o}if(!r)return iP(e);const i=s[e],a=r[1].split(",").map(ADe);return typeof i=="function"?i(a):a[i]}const RDe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return aP(n,e)};function ADe(t){return parseFloat(t.trim())}const j1=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],P1=new Set([...j1,"pathRotation"]),Kq=t=>t===L1||t===At,NDe=new Set(["x","y","z"]),IDe=j1.filter(t=>!NDe.has(t));function LDe(t){const e=[];return IDe.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}const sh={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:s})=>{const r=t.max-t.min;return s==="border-box"?r:r-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:s})=>{const r=t.max-t.min;return s==="border-box"?r:r-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>aP(e,"x"),y:(t,{transform:e})=>aP(e,"y")};sh.translateX=sh.x;sh.translateY=sh.y;const ym=new Set;let oP=!1,lP=!1,cP=!1;function Tce(){if(lP){const t=Array.from(ym).filter(s=>s.needsMeasurement),e=new Set(t.map(s=>s.element)),n=new Map;e.forEach(s=>{const r=LDe(s);r.length&&(n.set(s,r),s.render())}),t.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const r=n.get(s);r&&r.forEach(([i,a])=>{var o;(o=s.getValue(i))==null||o.set(a)})}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}lP=!1,oP=!1,ym.forEach(t=>t.complete(cP)),ym.clear()}function kce(){ym.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(lP=!0)})}function jDe(){cP=!0,kce(),Tce(),cP=!1}class QO{constructor(e,n,s,r,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=s,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(ym.add(this),oP||(oP=!0,$s.read(kce),$s.resolveKeyframes(Tce))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:s,motionValue:r}=this;if(e[0]===null){const i=r==null?void 0:r.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(s&&n){const o=s.readValue(n,a);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}CDe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ym.delete(this)}cancel(){this.state==="scheduled"&&(ym.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const PDe=t=>t.startsWith("--");function Rce(t,e,n){PDe(e)?t.style.setProperty(e,n):t.style[e]=n}const MDe={};function Ace(t,e){const n=nce(t);return()=>MDe[e]??n()}const DDe=Ace(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Nce=Ace(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ky=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Yq={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ky([0,.65,.55,1]),circOut:ky([.55,0,1,.45]),backIn:ky([.31,.01,.66,-.59]),backOut:ky([.33,1.53,.69,.99])};function Ice(t,e){if(t)return typeof t=="function"?Nce()?_ce(t,e):"ease-out":hce(t)?ky(t):Array.isArray(t)?t.map(n=>Ice(n,e)||Yq.easeOut):Yq[t]}function ODe(t,e,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const d={[e]:n};l&&(d.offset=l);const f=Ice(o,r);Array.isArray(f)&&(d.easing=f);const p={delay:s,duration:r,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),t.animate(d,p)}function Lce(t){return typeof t=="function"&&"applyToOptions"in t}function $De({type:t,...e}){return Lce(t)&&Nce()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class jce extends XO{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:s,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,y4(typeof e.type!="string");const u=$De(e);this.animation=ODe(n,s,r,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=b4(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(d),Rce(n,s,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,s,r;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(s=this.animation).commitStyles)==null||r.call(s))}get duration(){var n,s;const e=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return al(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+al(e)}get time(){return al(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ro(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:s,observe:r}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&DDe()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),s&&(this.animation.rangeEnd=s),dl):r(this)}}const Pce={anticipate:cce,backInOut:lce,circInOut:dce};function FDe(t){return t in Pce}function UDe(t){typeof t.ease=="string"&&FDe(t.ease)&&(t.ease=Pce[t.ease])}const QN=10;class BDe extends jce{constructor(e){UDe(e),Cce(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:s,onComplete:r,element:i,...a}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const o=new JT({...a,autoplay:!1}),l=Math.max(QN,Ta.now()-this.startTime),u=ru(0,QN,l-QN),d=o.sample(l).value,{name:f}=this.options;i&&f&&Rce(i,f,d),n.setWithVelocity(o.sample(Math.max(0,l-u)).value,d,u),o.stop()}}const Zq=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(sc.test(t)||t==="0")&&!t.startsWith("url("));function zDe(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function VDe(t,e,n,s){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=Zq(r,e),o=Zq(i,e);return!a||!o?!1:zDe(t)||(n==="spring"||Lce(n))&&s}function uP(t){t.duration=0,t.type="keyframes"}const Mce=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),HDe=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function GDe(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&HDe.test(t[e]))return!0;return!1}const WDe=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),qDe=nce(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function KDe(t){var f;const{motionValue:e,name:n,repeatDelay:s,repeatType:r,damping:i,type:a,keyframes:o}=t,l=(f=e==null?void 0:e.owner)==null?void 0:f.current;if(!(l instanceof HTMLElement)&&!(l instanceof SVGElement))return!1;const{onUpdate:u,transformTemplate:d}=e.owner.getProps();
129return qDe()&&n&&(Mce.has(n)||WDe.has(n)&&GDe(o))&&(n!=="transform"||!d)&&!u&&!s&&r!=="mirror"&&i!==0&&a!=="inertia"}const YDe=40;class ZDe extends XO{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:a="loop",keyframes:o,name:l,motionValue:u,element:d,...f}){var v;super(),this.stop=()=>{var x,y;this._animation&&(this._animation.stop(),(x=this.stopTimeline)==null||x.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=Ta.now();const p={autoplay:e,delay:n,type:s,repeat:r,repeatDelay:i,repeatType:a,name:l,motionValue:u,element:d,...f},m=(d==null?void 0:d.KeyframeResolver)||QO;this.keyframeResolver=new m(o,(x,y,S)=>this.onKeyframesResolved(x,y,p,!S),l,u,d),(v=this.keyframeResolver)==null||v.scheduleResolve()}onKeyframesResolved(e,n,s,r){var S,_;this.keyframeResolver=void 0;const{name:i,type:a,velocity:o,delay:l,isHandoff:u,onUpdate:d}=s;this.resolvedAt=Ta.now();let f=!0;VDe(e,i,a,o)||(f=!1,(kh.instantAnimations||!l)&&(d==null||d(b4(e,s,n))),e[0]=e[e.length-1],uP(s),s.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>YDe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:e},v=f&&!u&&KDe(m),x=(_=(S=m.motionValue)==null?void 0:S.owner)==null?void 0:_.current;let y;if(v)try{y=new BDe({...m,element:x})}catch{y=new JT(m)}else y=new JT(m);y.finished.then(()=>{this.notifyFinished()}).catch(dl),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),jDe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function Dce(t,e,n,s=0,r=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),a=t.size,o=(a-1)*s;return typeof n=="function"?n(i,a):r===1?i*s:o-i*s}const Xq=30,XDe=t=>!isNaN(parseFloat(t));class QDe{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var i;const r=Ta.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Ta.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=XDe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new VO);const s=this.events[e].add(n);return e==="change"?()=>{s(),$s.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ta.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Xq)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Xq);return sce(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Vv(t,e){return new QDe(t,e)}function JO(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function e7(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?JO(n,t):n}const JDe={type:"spring",stiffness:500,damping:25,restSpeed:10},e9e=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),t9e={type:"keyframes",duration:.8},n9e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},s9e=(t,{keyframes:e})=>e.length>2?t9e:P1.has(t)?t.startsWith("scale")?e9e(e[1]):JDe:n9e,r9e=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function i9e(t){for(const e in t)if(!r9e.has(e))return!0;return!1}const t7=(t,e,n,s={},r,i)=>a=>{const o=e7(s,t)||{},l=o.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Ro(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:p=>{e.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:i?void 0:r};i9e(o)||Object.assign(d,s9e(t,d)),d.duration&&(d.duration=Ro(d.duration)),d.repeatDelay&&(d.repeatDelay=Ro(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(uP(d),d.delay===0&&(f=!0)),(kh.instantAnimations||kh.skipAnimations||r!=null&&r.shouldSkipAnimations||o.skipAnimations)&&(f=!0,uP(d),d.delay=0),d.allowFlatten=!o.type&&!o.ease,f&&!i&&e.get()!==void 0){const p=b4(d.keyframes,o);if(p!==void 0){$s.update(()=>{d.onUpdate(p),d.onComplete()});return}}return o.isSync?new JT(d):new ZDe(d)},a9e=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function o9e(t){const e=a9e.exec(t);if(!e)return[,];const[,n,s,r]=e;return[`--${n??s}`,r]}function Oce(t,e,n=1){const[s,r]=o9e(t);if(!s)return;const i=window.getComputedStyle(e).getPropertyValue(s);if(i){const a=i.trim();return Jle(a)?parseFloat(a):a}return WO(r)?Oce(r,e,n+1):r}function Qq(t){const e=[{},{}];
vendor: 5,681 bytes, line 129
129return t==null||t.values.forEach((n,s)=>{e[0][s]=n.get(),e[1][s]=n.getVelocity()}),e}function n7(t,e,n,s){if(typeof e=="function"){const[r,i]=Qq(s);e=e(n!==void 0?n:t.custom,r,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,i]=Qq(s);e=e(n!==void 0?n:t.custom,r,i)}return e}function bm(t,e,n){const s=t.getProps();return n7(s,e,n!==void 0?n:s.custom,t)}const $ce=new Set(["width","height","top","left","right","bottom",...j1]),dP=t=>Array.isArray(t);function l9e(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Vv(n))}function c9e(t){return dP(t)?t[t.length-1]||0:t}function s7(t,e){const n=bm(t,e);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const a in i){const o=c9e(i[a]);l9e(t,a,o)}}const Ui=t=>!!(t&&t.getVelocity);function u9e(t){return!!(Ui(t)&&t.add)}function fP(t,e){const n=t.getValue("willChange");if(u9e(n))return n.add(e);if(!n&&kh.WillChange){const s=new kh.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function r7(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const d9e="framerAppearId",Fce="data-"+r7(d9e);function Uce(t){return t.props[Fce]}function f9e({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function Bce(t,e,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:i,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();i=i?JO(i,l):l;const u=i==null?void 0:i.reduceMotion,d=i==null?void 0:i.skipAnimations;s&&(i=s);const f=[],p=r&&t.animationState&&t.animationState.getState()[r],m=i==null?void 0:i.path;m&&m.animateVisualElement(t,o,i,n,f);for(const v in o){const x=t.getValue(v,t.latestValues[v]??null),y=o[v];if(y===void 0||p&&f9e(p,v))continue;const S={delay:n,...e7(i||{},v)};d&&(S.skipAnimations=!0);const _=x.get();if(_!==void 0&&!x.isAnimating()&&!Array.isArray(y)&&y===_&&!S.velocity){$s.update(()=>x.set(y));continue}let E=!1;if(window.MotionHandoffAnimation){const R=Uce(t);if(R){const I=window.MotionHandoffAnimation(R,v,$s);I!==null&&(S.startTime=I,E=!0)}}fP(t,v);const T=u??t.shouldReduceMotion;x.start(t7(v,x,y,T&&$ce.has(v)?{type:!1}:S,t,E));const k=x.animation;k&&f.push(k)}if(a){const v=()=>$s.update(()=>{a&&s7(t,a)});f.length?Promise.all(f).then(v):v()}return f}function hP(t,e,n={}){var l;const s=bm(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const i=s?()=>Promise.all(Bce(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:p}=r;return h9e(t,e,u,d,f,p,n)}:()=>Promise.resolve(),{when:o}=r;if(o){const[u,d]=o==="beforeChildren"?[i,a]:[a,i];return u().then(()=>d())}else return Promise.all([i(),a(n.delay)])}function h9e(t,e,n=0,s=0,r=0,i=1,a){const o=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),o.push(hP(l,e,{...a,delay:n+(typeof s=="function"?0:s)+Dce(t.variantChildren,l,s,r,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(o)}function zce(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const r=e.map(i=>hP(t,i,n));s=Promise.all(r)}else if(typeof e=="string")s=hP(t,e,n);else{const r=typeof e=="function"?bm(t,e,n.custom):e;s=Promise.all(Bce(t,r,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}const p9e={test:t=>t==="auto",parse:t=>t},Vce=t=>e=>e.test(t),Hce=[L1,At,Yc,zu,zMe,BMe,p9e],Jq=t=>Hce.find(Vce(t));function m9e(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||tce(t):!0}const g9e=new Set(["brightness","contrast","saturate","opacity"]);function v9e(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(qO)||[];if(!s)return t;const r=n.replace(s,"");let i=g9e.has(e)?1:0;return s!==n&&(i*=100),e+"("+i+r+")"}const x9e=/\b([a-z-]*)\(.*?\)/gu,pP={...sc,getAnimatableNone:t=>{const e=t.match(x9e);return e?e.map(v9e).join(" "):t}},mP={...sc,getAnimatableNone:t=>{const e=sc.parse(t);return sc.createTransformer(t)(e.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},eK={...L1,transform:Math.round},y9e={rotate:zu,pathRotation:zu,rotateX:zu,rotateY:zu,rotateZ:zu,scale:M_,scaleX:M_,scaleY:M_,scaleZ:M_,skew:zu,skewX:zu,skewY:zu,distance:At,translateX:At,translateY:At,translateZ:At,x:At,y:At,z:At,perspective:At,transformPerspective:At,opacity:Qb,originX:Uq,originY:Uq,originZ:At},ek={borderWidth:At,borderTopWidth:At,borderRightWidth:At,borderBottomWidth:At,borderLeftWidth:At,borderRadius:At,borderTopLeftRadius:At,borderTopRightRadius:At,borderBottomRightRadius:At,borderBottomLeftRadius:At,width:At,maxWidth:At,height:At,maxHeight:At,top:At,right:At,bottom:At,left:At,inset:At,insetBlock:At,insetBlockStart:At,insetBlockEnd:At,insetInline:At,insetInlineStart:At,insetInlineEnd:At,padding:At,paddingTop:At,paddingRight:At,paddingBottom:At,paddingLeft:At,paddingBlock:At,paddingBlockStart:At,paddingBlockEnd:At,paddingInline:At,paddingInlineStart:At,paddingInlineEnd:At,margin:At,marginTop:At,marginRight:At,marginBottom:At,marginLeft:At,marginBlock:At,marginBlockStart:At,marginBlockEnd:At,marginInline:At,marginInlineStart:At,marginInlineEnd:At,fontSize:At,backgroundPositionX:At,backgroundPositionY:At,...y9e,zIndex:eK,fillOpacity:Qb,strokeOpacity:Qb,numOctaves:eK},b9e={...ek,color:Xr,backgroundColor:Xr,outlineColor:Xr,fill:Xr,stroke:Xr,borderColor:Xr,borderTopColor:Xr,borderRightColor:Xr,borderBottomColor:Xr,borderLeftColor:Xr,filter:pP,WebkitFilter:pP,mask:mP,WebkitMask:mP},Gce=t=>b9e[t],S9e=new Set([pP,mP]);function Wce(t,e){let n=Gce(t);return S9e.has(n)||(n=sc),n.getAnimatableNone?n.getAnimatableNone(e):void 0}
vendor: 1,726 bytes, line 129
129const w9e=new Set(["auto","none","0"]);function _9e(t,e,n){let s=0,r;for(;s<t.length&&!r;){const i=t[s];typeof i=="string"&&!w9e.has(i)&&zv(i).values.length&&(r=t[s]),s++}if(r&&n)for(const i of e)t[i]=Wce(n,r)}class E9e extends QO{constructor(e,n,s,r,i){super(e,n,s,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let f=e[d];if(typeof f=="string"&&(f=f.trim(),WO(f))){const p=Oce(f,n.current);p!==void 0&&(e[d]=p),d===e.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!$ce.has(s)||e.length!==2)return;const[r,i]=e,a=Jq(r),o=Jq(i),l=Fq(r),u=Fq(i);if(l!==u&&sh[s]){this.needsMeasurement=!0;return}if(a!==o)if(Kq(a)&&Kq(o))for(let d=0;d<e.length;d++){const f=e[d];typeof f=="string"&&(e[d]=parseFloat(f))}else sh[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let r=0;r<e.length;r++)(e[r]===null||m9e(e[r]))&&s.push(r);s.length&&_9e(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=sh[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(s,r).jump(r,!1)}measureEndState(){var o;const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=s.length-1,a=s[i];s[i]=sh[n](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEac
vendor: 41,183 bytes, line 129
129h(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const i7=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function qce(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const r=(n==null?void 0:n[t])??s.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t).filter(s=>s!=null)}const gP=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function IC(t){return ece(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:a7}=pce(queueMicrotask,!1),Ml={x:!1,y:!1};function Kce(){return Ml.x||Ml.y}function C9e(t){return t==="x"||t==="y"?Ml[t]?null:(Ml[t]=!0,()=>{Ml[t]=!1}):Ml.x||Ml.y?null:(Ml.x=Ml.y=!0,()=>{Ml.x=Ml.y=!1})}function Yce(t,e){const n=qce(t),s=new AbortController,r={passive:!0,...e,signal:s.signal};return[n,r,()=>s.abort()]}function T9e(t){return!(t.pointerType==="touch"||Kce())}function k9e(t,e,n={}){const[s,r,i]=Yce(t,n);return s.forEach(a=>{let o=!1,l=!1,u;const d=()=>{a.removeEventListener("pointerleave",v)},f=y=>{u&&(u(y),u=void 0),d()},p=y=>{o=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,f(y))},m=()=>{o=!0,window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",p,r)},v=y=>{if(y.pointerType!=="touch"){if(o){l=!0;return}f(y)}},x=y=>{if(!T9e(y))return;l=!1;const S=e(a,y);typeof S=="function"&&(u=S,a.addEventListener("pointerleave",v,r))};a.addEventListener("pointerenter",x,r),a.addEventListener("pointerdown",m,r)}),i}const Zce=(t,e)=>e?t===e?!0:Zce(t,e.parentElement):!1,o7=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,R9e=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function A9e(t){return R9e.has(t.tagName)||t.isContentEditable===!0}const N9e=new Set(["INPUT","SELECT","TEXTAREA"]);function I9e(t){return N9e.has(t.tagName)||t.isContentEditable===!0}const LC=new WeakSet;function tK(t){return e=>{e.key==="Enter"&&t(e)}}function JN(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const L9e=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=tK(()=>{if(LC.has(n))return;JN(n,"down");const r=tK(()=>{JN(n,"up")}),i=()=>JN(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function nK(t){return o7(t)&&!Kce()}const sK=new WeakSet;function j9e(t,e,n={}){const[s,r,i]=Yce(t,n),a=o=>{const l=o.currentTarget;if(!nK(o)||sK.has(o))return;LC.add(l),n.stopPropagation&&sK.add(o);const u=e(l,o),d={...r,capture:!0},f=(v,x)=>{window.removeEventListener("pointerup",p,d),window.removeEventListener("pointercancel",m,d),LC.has(l)&&LC.delete(l),nK(v)&&typeof u=="function"&&u(v,{success:x})},p=v=>{f(v,l===window||l===document||n.useGlobalTarget||Zce(l,v.target))},m=v=>{f(v,!1)};window.addEventListener("pointerup",p,d),window.addEventListener("pointercancel",m,d)};return s.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,r),IC(o)&&(o.addEventListener("focus",u=>L9e(u,r)),!A9e(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function l7(t){return ece(t)&&"ownerSVGElement"in t}const jC=new WeakMap;let Af;const Xce=(t,e,n)=>(s,r)=>r&&r[0]?r[0][t+"Size"]:l7(s)&&"getBBox"in s?s.getBBox()[e]:s[n],P9e=Xce("inline","width","offsetWidth"),M9e=Xce("block","height","offsetHeight");function D9e({target:t,borderBoxSize:e}){var n;(n=jC.get(t))==null||n.forEach(s=>{s(t,{get width(){return P9e(t,e)},get height(){return M9e(t,e)}})})}function O9e(t){t.forEach(D9e)}function $9e(){typeof ResizeObserver>"u"||(Af=new ResizeObserver(O9e))}function F9e(t,e){Af||$9e();const n=qce(t);return n.forEach(s=>{let r=jC.get(s);r||(r=new Set,jC.set(s,r)),r.add(e),Af==null||Af.observe(s)}),()=>{n.forEach(s=>{const r=jC.get(s);r==null||r.delete(e),r!=null&&r.size||Af==null||Af.unobserve(s)})}}const PC=new Set;let N0;function U9e(){N0=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};PC.forEach(e=>e(t))},window.addEventListener("resize",N0)}function B9e(t){return PC.add(t),N0||U9e(),()=>{PC.delete(t),!PC.size&&typeof N0=="function"&&(window.removeEventListener("resize",N0),N0=void 0)}}function rK(t,e){return typeof t=="function"?B9e(t):F9e(t,e)}function z9e(t){return l7(t)&&t.tagName==="svg"}const V9e=[...Hce,Xr,sc],H9e=t=>V9e.find(Vce(t)),iK=()=>({translate:0,scale:1,origin:0,originPoint:0}),I0=()=>({x:iK(),y:iK()}),aK=()=>({min:0,max:0}),ai=()=>({x:aK(),y:aK()}),G9e=new WeakMap;function S4(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Jb(t){return typeof t=="string"||Array.isArray(t)}const c7=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],u7=["initial",...c7];function w4(t){return S4(t.animate)||u7.some(e=>Jb(t[e]))}function Qce(t){return!!(w4(t)||t.variants)}function W9e(t,e,n){for(const s in e){const r=e[s],i=n[s];if(Ui(r))t.addValue(s,r);else if(Ui(i))t.addValue(s,Vv(r,{owner:t}));else if(i!==r)if(t.hasValue(s)){const a=t.getValue(s);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=t.getStaticValue(s);t.addValue(s,Vv(a!==void 0?a:r,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const tk={current:null},d7={current:!1},q9e=typeof window<"u";function Jce(){if(d7.current=!0,!!q9e)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>tk.current=t.matches;t.addEventListener("change",e),e()}else tk.current=!1}const oK=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let nk={};function eue(t){nk=t}function K9e(){return nk}class Y9e{scrapeMotionValuesFromProps(e,n,s){return{}}constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=QO,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Ta.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,$s.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=w4(n),this.isVariantNode=Qce(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in p){const v=p[m];u[m]!==void 0&&Ui(v)&&v.set(u[m])}}mount(e){var n,s;if(this.hasBeenMounted)for(const r in this.initialValues)(n=this.values.get(r))==null||n.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,G9e.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(d7.current||Jce(),this.shouldReduceMotion=tk.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Rh(this.notifyUpdate),Rh(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&Mce.has(e)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:u,duration:d}=n.accelerate,f=new jce({element:this.current,name:e,keyframes:o,times:l,ease:u,duration:Ro(d)}),p=a(f);this.valueSubscriptions.set(e,()=>{p(),f.cancel()});return}const s=P1.has(e);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&$s.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in nk){const n=nk[e];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ai()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<oK.length;s++){const r=oK[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,a=e[i];a&&(this.propEventSubscriptions[r]=this.on(r,a))}this.prevMotionValues=W9e(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const s=this.values.get(e);n!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=Vv(n===null?void 0:n,{owner:this}),this.addValue(e,s)),s}readValue(e,n){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(Jle(s)||tce(s))?s=parseFloat(s):!H9e(s)&&sc.test(n)&&(s=Wce(e,n)),this.setBaseTarget(e,Ui(s)?s.get():s)),Ui(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const a=n7(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);a&&(s=a[e])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Ui(r)?r:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new VO),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){a7.render(this.render)}}class tue extends Y9e{constructor(){super(...arguments),this.KeyframeResolver=E9e}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const s=e.style;return s?s[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ui(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Vh{constructor(e){this.isMounted=!1,this.node=e}update(){}}function nue({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function Z9e({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function X9e(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function e6(t){return t===void 0||t===1}function vP({scale:t,scaleX:e,scaleY:n}){return!e6(t)||!e6(e)||!e6(n)}function Ip(t){return vP(t)||sue(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function sue(t){return lK(t.x)||lK(t.y)}function lK(t){return t&&t!=="0%"}function sk(t,e,n){const s=t-n,r=e*s;return n+r}function cK(t,e,n,s,r){return r!==void 0&&(t=sk(t,r,s)),sk(t,n,s)+e}function xP(t,e=0,n=1,s,r){t.min=cK(t.min,e,n,s,r),t.max=cK(t.max,e,n,s,r)}function rue(t,{x:e,y:n}){xP(t.x,e.translate,e.scale,e.originPoint),xP(t.y,n.translate,n.scale,n.originPoint)}const uK=.999999999999,dK=1.0000000000001;function Q9e(t,e,n,s=!1){var o;const r=n.length;if(!r)return;e.x=e.y=1;let i,a;for(let l=0;l<r;l++){i=n[l],a=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(Mc(t.x,-i.scroll.offset.x),Mc(t.y,-i.scroll.offset.y)),a&&(e.x*=a.x.scale,e.y*=a.y.scale,rue(t,a)),s&&Ip(i.latestValues)&&MC(t,i.latestValues,(o=i.layout)==null?void 0:o.layoutBox))}e.x<dK&&e.x>uK&&(e.x=1),e.y<dK&&e.y>uK&&(e.y=1)}function Mc(t,e){t.min+=e,t.max+=e}function fK(t,e,n,s,r=.5){const i=Os(t.min,t.max,r);xP(t,e,n,i,s)}function hK(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function MC(t,e,n){const s=n??t;fK(t.x,hK(e.x,s.x),e.scaleX,e.scale,e.originX),fK(t.y,hK(e.y,s.y),e.scaleY,e.scale,e.originY)}function iue(t,e){return nue(X9e(t.getBoundingClientRect(),e))}function J9e(t,e,n){const s=iue(t,n),{scroll:r}=e;return r&&(Mc(s.x,r.offset.x),Mc(s.y,r.offset.y)),s}const eOe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tOe=j1.length;function nOe(t,e,n){let s="",r=!0;for(let a=0;a<tOe;a++){const o=j1[a],l=t[o];if(l===void 0)continue;let u=!0;if(typeof l=="number")u=l===(o.startsWith("scale")?1:0);else{const d=parseFloat(l);u=o.startsWith("scale")?d===1:d===0}if(!u||n){const d=gP(l,ek[o]);if(!u){r=!1;const f=eOe[o]||o;s+=`${f}(${d}) `}n&&(e[o]=d)}}const i=t.pathRotation;return i&&(r=!1,s+=`rotate(${gP(i,ek.pathRotation)}) `),s=s.trim(),n?s=n(e,r?"":s):r&&(s="none"),s}function f7(t,e,n){const{style:s,vars:r,transformOrigin:i}=t;let a=!1,o=!1;for(const l in e){const u=e[l];if(P1.has(l)){a=!0;continue}else if(gce(l)){r[l]=u;continue}else{const d=gP(u,ek[l]);l.startsWith("origin")?(o=!0,i[l]=d):s[l]=d}}if(e.transform||(a||n?s.transform=nOe(e,t.transform,n):s.transform&&(s.transform="none")),o){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;s.transformOrigin=`${l} ${u} ${d}`}}function aue(t,{style:e,vars:n},s,r){const i=t.style;let a;for(a in e)i[a]=e[a];r==null||r.applyProjectionStyles(i,s);for(a in n)i.setProperty(a,n[a])}function pK(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Zx={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(At.test(t))t=parseFloat(t);else return t;const n=pK(t,e.target.x),s=pK(t,e.target.y);return`${n}% ${s}%`}},sOe={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,r=sc.parse(t);if(r.length>5)return s;const i=sc.createTransformer(t),a=typeof r[0]!="number"?1:0,o=n.x.scale*e.x,l=n.y.scale*e.y;r[0+a]/=o,r[1+a]/=l;const u=Os(o,l,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),i(r)}},yP={borderRadius:{...Zx,applyTo:[...i7]},borderTopLeftRadius:Zx,borderTopRightRadius:Zx,borderBottomLeftRadius:Zx,borderBottomRightRadius:Zx,boxShadow:sOe};function oue(t,{layout:e,layoutId:n}){return P1.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!yP[t]||t==="opacity")}function h7(t,e,n){var a;const s=t.style,r=e==null?void 0:e.style,i={};if(!s)return i;for(const o in s)(Ui(s[o])||r&&Ui(r[o])||oue(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function rOe(t){return window.getComputedStyle(t)}class iOe extends tue{constructor(){super(...arguments),this.type="html",this.renderInstance=aue}mount(e){y4(!!e.style),super.mount(e)}readValueFromInstance(e,n){var s;if(P1.has(n))return(s=this.projection)!=null&&s.isProjecting?iP(n):RDe(e,n);{const r=rOe(e),i=(gce(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return iue(e,n)}build(e,n,s){f7(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return h7(e,n,s)}}const aOe={offset:"stroke-dashoffset",array:"stroke-dasharray"},oOe={offset:"strokeDashoffset",array:"strokeDasharray"};function lOe(t,e,n=1,s=0,r=!0){t.pathLength=1;const i=r?aOe:oOe;t[i.offset]=`${-s}`,t[i.array]=`${e} ${n}`}const cOe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function lue(t,{attrX:e,attrY:n,attrScale:s,pathLength:r,pathSpacing:i=1,pathOffset:a=0,...o},l,u,d){if(f7(t,o,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:p}=t;f.transform&&(p.transform=f.transform,delete f.transform),(p.transform||f.transformOrigin)&&(p.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox);for(const m of cOe)f[m]!==void 0&&(p[m]=f[m],delete f[m]);e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),s!==void 0&&(f.scale=s),r!==void 0&&lOe(f,r,i,a,!1)}const cue=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),uue=t=>typeof t=="string"&&t.toLowerCase()==="svg";function uOe(t,e,n,s){aue(t,e,void 0,s);for(const r in e.attrs)t.setAttribute(cue.has(r)?r:r7(r),e.attrs[r])}function due(t,e,n){const s=h7(t,e,n);for(const r in t)if(Ui(t[r])||Ui(e[r])){const i=j1.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[i]=t[r]}return s}class dOe extends tue{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ai}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(P1.has(n)){const s=Gce(n);return s&&s.default||0}return n=cue.has(n)?n:r7(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return due(e,n,s)}build(e,n,s){lue(e,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,n,s,r){uOe(e,n,s,r)}mount(e){this.isSVGTag=uue(e.tagName),super.mount(e)}}const fOe=u7.length;function fue(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?fue(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<fOe;n++){const s=u7[n],r=t.props[s];(Jb(r)||r===!1)&&(e[s]=r)}return e}function hue(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const hOe=[...c7].reverse(),pOe=c7.length;function mOe(t){return e=>Promise.all(e.map(({animation:n,options:s})=>zce(t,n,s)))}function gOe(t){let e=mOe(t),n=mK(),s=!0,r=!1;const i=u=>(d,f)=>{var m;const p=bm(t,f,u==="exit"?(m=t.presenceContext)==null?void 0:m.custom:void 0);if(p){const{transition:v,transitionEnd:x,...y}=p;d={...d,...y,...x}}return d};function a(u){e=u(t)}function o(u){const{props:d}=t,f=fue(t.parent)||{},p=[],m=new Set;let v={},x=1/0;for(let S=0;S<pOe;S++){const _=hOe[S],E=n[_],T=d[_]!==void 0?d[_]:f[_],k=Jb(T),R=_===u?E.isActive:null;R===!1&&(x=S);let I=T===f[_]&&T!==d[_]&&k;if(I&&(s||r)&&t.manuallyAnimateOnMount&&(I=!1),E.protectedKeys={...v},!E.isActive&&R===null||!T&&!E.prevProp||S4(T)||typeof T=="boolean")continue;if(_==="exit"&&E.isActive&&R!==!0){E.prevResolvedValues&&(v={...v,...E.prevResolvedValues});continue}const A=vOe(E.prevProp,T);let L=A||_===u&&E.isActive&&!I&&k||S>x&&k,j=!1;const F=Array.isArray(T)?T:[T];let O=F.reduce(i(_),{});R===!1&&(O={});const{prevResolvedValues:M={}}=E,U={...M,...O},G=B=>{L=!0,m.has(B)&&(j=!0,m.delete(B)),E.needsAnimating[B]=!0;const q=t.getValue(B);q&&(q.liveStyle=!1)};for(const B in U){const q=O[B],z=M[B];if(v.hasOwnProperty(B))continue;let D=!1;dP(q)&&dP(z)?D=!hue(q,z)||A:D=q!==z,D?q!=null?G(B):m.add(B):q!==void 0&&m.has(B)?G(B):E.protectedKeys[B]=!0}E.prevProp=T,E.prevResolvedValues=O,E.isActive&&(v={...v,...O}),(s||r)&&t.blockInitialAnimation&&(L=!1);const $=I&&A;L&&(!$||j)&&p.push(...F.map(B=>{const q={type:_};if(typeof B=="string"&&(s||r)&&!$&&t.manuallyAnimateOnMount&&t.parent){const{parent:z}=t,D=bm(z,B);if(z.enteringChildren&&D){const{delayChildren:K}=D.transition||{};q.delay=Dce(z.enteringChildren,t,K)}}return{animation:B,options:q}}))}if(m.size){const S={};if(typeof d.initial!="boolean"){const _=bm(t,Array.isArray(d.initial)?d.initial[0]:d.initial);_&&_.transition&&(S.transition=_.transition)}m.forEach(_=>{const E=t.getBaseTarget(_),T=t.getValue(_);T&&(T.liveStyle=!0),S[_]=E??null}),p.push({animation:S})}let y=!!p.length;return s&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(y=!1),s=!1,r=!1,y?e(p):Promise.resolve()}function l(u,d){var p;if(n[u].isActive===d)return Promise.resolve();(p=t.variantChildren)==null||p.forEach(m=>{var v;return(v=m.animationState)==null?void 0:v.setActive(u,d)}),n[u].isActive=d;const f=o(u);for(const m in n)n[m].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=mK(),r=!0}}}function vOe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!hue(e,t):!1}function mp(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function mK(){return{animate:mp(!0),whileInView:mp(),whileHover:mp(),whileTap:mp(),whileDrag:mp(),whileFocus:mp(),exit:mp()}}function bP(t,e){t.min=e.min,t.max=e.max}function El(t,e){bP(t.x,e.x),bP(t.y,e.y)}function gK(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const pue=1e-4,xOe=1-pue,yOe=1+pue,mue=.01,bOe=0-mue,SOe=0+mue;function ka(t){return t.max-t.min}function wOe(t,e,n){return Math.abs(t-e)<=n}function vK(t,e,n,s=.5){t.origin=s,t.originPoint=Os(e.min,e.max,t.origin),t.scale=ka(n)/ka(e),t.translate=Os(n.min,n.max,t.origin)-t.originPoint,(t.scale>=xOe&&t.scale<=yOe||isNaN(t.scale))&&(t.scale=1),(t.translate>=bOe&&t.translate<=SOe||isNaN(t.translate))&&(t.translate=0)}function lb(t,e,n,s){vK(t.x,e.x,n.x,s?s.originX:void 0),vK(t.y,e.y,n.y,s?s.originY:void 0)}function xK(t,e,n,s=0){const r=s?Os(n.min,n.max,s):n.min;t.min=r+e.min,t.max=t.min+ka(e)}function _Oe(t,e,n,s){xK(t.x,e.x,n.x,s==null?void 0:s.x),xK(t.y,e.y,n.y,s==null?void 0:s.y)}function yK(t,e,n,s=0){const r=s?Os(n.min,n.max,s):n.min;t.min=e.min-r,t.max=t.min+ka(e)}function rk(t,e,n,s){yK(t.x,e.x,n.x,s==null?void 0:s.x),yK(t.y,e.y,n.y,s==null?void 0:s.y)}function bK(t,e,n,s,r){return t-=e,t=sk(t,1/n,s),r!==void 0&&(t=sk(t,1/r,s)),t}function EOe(t,e=0,n=1,s=.5,r,i=t,a=t){if(Yc.test(e)&&(e=parseFloat(e),e=Os(a.min,a.max,e/100)-a.min),typeof e!="number")return;let o=Os(i.min,i.max,s);t===i&&(o-=e),t.min=bK(t.min,e,n,o,r),t.max=bK(t.max,e,n,o,r)}function SK(t,e,[n,s,r],i,a){EOe(t,e[n],e[s],e[r],e.scale,i,a)}const COe=["x","scaleX","originX"],TOe=["y","scaleY","originY"];function wK(t,e,n,s){SK(t.x,e,COe,n?n.x:void 0,s?s.x:void 0),SK(t.y,e,TOe,n?n.y:void 0,s?s.y:void 0)}function _K(t){return t.translate===0&&t.scale===1}function gue(t){return _K(t.x)&&_K(t.y)}function EK(t,e){return t.min===e.min&&t.max===e.max}function kOe(t,e){return EK(t.x,e.x)&&EK(t.y,e.y)}function CK(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function vue(t,e){return CK(t.x,e.x)&&CK(t.y,e.y)}function TK(t){return ka(t.x)/ka(t.y)}function kK(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function kc(t){return[t("x"),t("y")]}function ROe(t,e,n){let s="";const r=t.x.translate/e.x,i=t.y.translate/e.y,a=(n==null?void 0:n.z)||0;if((r||i||a)&&(s=`translate3d(${r}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,pathRotation:f,rotateX:p,rotateY:m,skewX:v,skewY:x}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotate(${f}deg) `),p&&(s+=`rotateX(${p}deg) `),m&&(s+=`rotateY(${m}deg) `),v&&(s+=`skewX(${v}deg) `),x&&(s+=`skewY(${x}deg) `)}const o=t.x.scale*e.x,l=t.y.scale*e.y;return(o!==1||l!==1)&&(s+=`scale(${o}, ${l})`),s||"none"}const AOe=i7.length,RK=t=>typeof t=="string"?parseFloat(t):t,AK=t=>typeof t=="number"||At.test(t);function NOe(t,e,n,s,r,i){r?(t.opacity=Os(0,n.opacity??1,IOe(s)),t.opacityExit=Os(e.opacity??1,0,LOe(s))):i&&(t.opacity=Os(e.opacity??1,n.opacity??1,s));for(let a=0;a<AOe;a++){const o=i7[a];let l=NK(e,o),u=NK(n,o);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||AK(l)===AK(u)?(t[o]=Math.max(Os(RK(l),RK(u),s),0),(Yc.test(u)||Yc.test(l))&&(t[o]+="%")):t[o]=u}(e.rotate||n.rotate)&&(t.rotate=Os(e.rotate||0,n.rotate||0,s))}function NK(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const IOe=xue(0,.5,uce),LOe=xue(.5,.95,dl);function xue(t,e,n){return s=>s<t?0:s>e?1:n(Xb(t,e,s))}function jOe(t,e,n){const s=Ui(t)?t:Vv(t);return s.start(t7("",s,e,n)),s.animation}function e2(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n,s)}const POe=(t,e)=>t.depth-e.depth;class MOe{constructor(){this.children=[],this.isDirty=!1}add(e){zO(this.children,e),this.isDirty=!0}remove(e){YT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(POe),this.isDirty=!1,this.children.forEach(e)}}function DOe(t,e){const n=Ta.now(),s=({timestamp:r})=>{const i=r-n;i>=e&&(Rh(s),t(i-e))};return $s.setup(s,!0),()=>Rh(s)}function DC(t){return Ui(t)?t.get():t}class OOe{constructor(){this.members=[]}add(e){zO(this.members,e);for(let n=this.members.length-1;n>=0;n--){const s=this.members[n];if(s===e||s===this.lead||s===this.prevLead)continue;const r=s.instance;(!r||r.isConnected===!1)&&!s.snapshot&&(YT(this.members,s),s.unmount())}e.scheduleRender()}remove(e){if(YT(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){var n;for(let s=this.members.indexOf(e)-1;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1&&((n=r.instance)==null?void 0:n.isConnected)!==!1)return this.promote(r),!0}return!1}promote(e,n){var r;const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=s.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=s,n&&(s.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),(r=e.root)!=null&&r.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var n,s,r,i,a;(s=(n=e.options).onExitComplete)==null||s.call(n),(a=(r=e.resumingFrom)==null?void 0:(i=r.options).onExitComplete)==null||a.call(i)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const OC={hasAnimatedSinceResize:!0,hasEverUpdated:!1},t6=["","X","Y","Z"],$Oe=1e3;let FOe=0;function n6(t,e,n,s){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),s&&(s[t]=0))}function yue(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Uce(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",$s,!(r||i))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&yue(s)}function bue({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(a={},o=e==null?void 0:e()){this.id=FOe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zOe),this.nodes.forEach(KOe),this.nodes.forEach(YOe),this.nodes.forEach(VOe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new MOe)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new VO),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=l7(a)&&!z9e(a),this.instance=a;const{layoutId:o,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),t){let d,f=0;const p=()=>this.root.updateBlockedByResize=!1;$s.read(()=>{f=window.innerWidth}),t(a,()=>{const m=window.innerWidth;m!==f&&(f=m,this.root.updateBlockedByResize=!0,d&&d(),d=DOe(p,250),OC.hasAnimatedSinceResize&&(OC.hasAnimatedSinceResize=!1,this.nodes.forEach(jK)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&u&&(o||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||u.getDefaultTransition()||e7e,{onLayoutAnimationStart:x,onLayoutAnimationComplete:y}=u.getProps(),S=!this.targetLayout||!vue(this.targetLayout,m),_=!f&&p;if(this.options.layoutRoot||this.resumeFrom||_||f&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...e7(v,"layout"),onPlay:x,onComplete:y};(u.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(d,_,E.path)}else f||jK(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Rh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ZOe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&yue(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,(typeof f.latestValues.x=="string"||typeof f.latestValues.y=="string")&&(f.isLayoutDirty=!0),f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(GOe),this.nodes.forEach(IK);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(LK);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(WOe),this.nodes.forEach(qOe),this.nodes.forEach(UOe),this.nodes.forEach(BOe)):this.nodes.forEach(LK),this.clearAllSnapshots();const o=Ta.now();Di.delta=ru(0,1e3/60,o-Di.timestamp),Di.timestamp=o,Di.isProcessing=!0,qN.update.process(Di),qN.preRender.process(Di),qN.render.process(Di),Di.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,a7.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(HOe),this.sharedNodes.forEach(XOe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,$s.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){$s.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ka(this.snapshot.measuredBox.x)&&!ka(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=ai()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!gue(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;a&&this.instance&&(o||Ip(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),t7e(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:a}=this.options;if(!a)return ai();const o=a.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(n7e))){const{scroll:d}=this.root;d&&(Mc(o.x,d.offset.x),Mc(o.y,d.offset.y))}return o}removeElementScroll(a){var l;const o=ai();if(El(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:p}=d;d!==this.root&&f&&p.layoutScroll&&(f.wasRoot&&El(o,a),Mc(o.x,f.offset.x),Mc(o.y,f.offset.y))}return o}applyTransform(a,o=!1,l){var d,f;const u=l||ai();El(u,a);for(let p=0;p<this.path.length;p++){const m=this.path[p];!o&&m.options.layoutScroll&&m.scroll&&m!==m.root&&(Mc(u.x,-m.scroll.offset.x),Mc(u.y,-m.scroll.offset.y)),Ip(m.latestValues)&&MC(u,m.latestValues,(d=m.layout)==null?void 0:d.layoutBox)}return Ip(this.latestValues)&&MC(u,this.latestValues,(f=this.layout)==null?void 0:f.layoutBox),u}removeTransform(a){var l;const o=ai();El(o,a);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!Ip(d.latestValues))continue;let f;d.instance&&(vP(d.latestValues)&&d.updateSnapshot(),f=ai(),El(f,d.measurePageBox())),wK(o,d.latestValues,(l=d.snapshot)==null?void 0:l.layoutBox,f)}return Ip(this.latestValues)&&wK(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Di.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var m;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!this.layout||!(d||f))return;this.resolvedRelativeTargetAt=Di.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ai(),this.targetWithTransforms=ai()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_Oe(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):El(this.target,this.layout.layoutBox),rue(this.target,this.targetDelta)):El(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||vP(this.parent.latestValues)||sue(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ai(),this.relativeTargetOrigin=ai(),rk(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),El(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var v;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty)&&
vendor: 5,722 bytes, line 129
129(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Di.timestamp&&(l=!1),l)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;El(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,p=this.treeScale.y;Q9e(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=ai());const{target:m}=a;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(gK(this.prevProjectionDelta.x,this.projectionDelta.x),gK(this.prevProjectionDelta.y,this.projectionDelta.y)),lb(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==p||!kK(this.projectionDelta.x,this.prevProjectionDelta.x)||!kK(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=I0(),this.projectionDelta=I0(),this.projectionDeltaWithTransform=I0()}setAnimationOrigin(a,o=!1,l){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},p=I0();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const m=ai(),v=u?u.source:void 0,x=this.layout?this.layout.source:void 0,y=v!==x,S=this.getStack(),_=!S||S.members.length<=1,E=!!(y&&!_&&this.options.crossfade===!0&&!this.path.some(JOe));this.animationProgress=0;let T;const k=l==null?void 0:l.interpolateProjection(a);this.mixTargetDelta=R=>{const I=R/1e3,A=k==null?void 0:k(I);A?(p.x.translate=A.x,p.x.scale=Os(a.x.scale,1,I),p.x.origin=a.x.origin,p.x.originPoint=a.x.originPoint,p.y.translate=A.y,p.y.scale=Os(a.y.scale,1,I),p.y.origin=a.y.origin,p.y.originPoint=a.y.originPoint):(PK(p.x,a.x,I),PK(p.y,a.y,I)),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rk(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),QOe(this.relativeTarget,this.relativeTargetOrigin,m,I),T&&kOe(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=ai()),El(T,this.relativeTarget)),y&&(this.animationValues=f,NOe(f,d,this.latestValues,I,E,_)),A&&A.rotate!==void 0&&(this.animationValues||(this.animationValues=f),this.animationValues.pathRotation=A.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,u;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Rh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$s.update(()=>{OC.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Vv(0)),this.motionValue.jump(0,!1),this.currentAnimation=jOe(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta($Oe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:d}=a;if(!(!o||!l||!u)){if(this!==a&&this.layout&&u&&Sue(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||ai();const f=ka(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+f;const p=ka(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+p}El(o,l),MC(o,d),lb(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new OOe),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}
vendor: 4,520 bytes, line 129
129resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&n6("z",a,u,this.animationValues);for(let d=0;d<t6.length;d++)n6(`rotate${t6[d]}`,a,u,this.animationValues),n6(`skew${t6[d]}`,a,u,this.animationValues);a.render();for(const d in u)a.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=DC(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=DC(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Ip(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=ROe(this.projectionDeltaWithTransform,this.treeScale,d);l&&(f=l(d,f)),a.transform=f;const{x:p,y:m}=this.projectionDelta;a.transformOrigin=`${p.origin*100}% ${m.origin*100}% 0`,u.animationValues?a.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:a.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const v in yP){if(d[v]===void 0)continue;const{correct:x,applyTo:y,isCSSVariable:S}=yP[v],_=f==="none"?d[v]:x(d[v],u);if(y){const E=y.length;for(let T=0;T<E;T++)a[y[T]]=_}else S?this.options.visualElement.renderState.vars[v]=_:a[v]=_}this.options.layoutId&&(a.pointerEvents=u===this?DC(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(IK),this.root.sharedNodes.clear()}}}function UOe(t){t.updateLayout()}function BOe(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=t.layout,{animationType:i}=t.options,a=e.source!==t.layout.source;if(i==="size")kc(f=>{const p=a?e.measuredBox[f]:e.layoutBox[f],m=ka(p);p.min=s[f].min,p.max=p.min+m});else if(i==="x"||i==="y"){const f=i==="x"?"y":"x";bP(a?e.measuredBox[f]:e.layoutBox[f],s[f])}else Sue(i,e.layoutBox,s)&&kc(f=>{const p=a?e.measuredBox[f]:e.layoutBox[f],m=ka(s[f]);p.max=p.min+m,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+m)});const o=I0();lb(o,s,e.layoutBox);const l=I0();a?lb(l,t.applyTransform(r,!0),e.measuredBox):lb(l,s,e.layoutBox);const u=!gue(o);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:p,layout:m}=f;if(p&&m){const v=t.options.layoutAnchor||void 0,x=ai();rk(x,e.layoutBox,p.layoutBox,v);const y=ai();rk(y,s,m.layoutBox,v),vue(x,y)||(d=!0),f.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=x,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function zOe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function VOe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function HOe(t){t.clearSnapshot()}function IK(t){t.clearMeasurements()}function GOe(t){t.isLayoutDirty=!0,t.updateLayout()}function LK(t){t.isLayoutDirty=!1}function WOe(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function qOe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function jK(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function KOe(t){t.resolveTargetDelta()}function YOe(t){t.calcProjection()}
129function ZOe(t){t.resetSkewAndRotation()}function XOe(t){t.removeLeadSnapshot()}function PK(t,e,n){t.translate=Os(e.translate,0,n),t.scale=Os(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function MK(t,e,n,s){t.min=Os(e.min,n.min,s),t.max=Os(e.max,n.max,s)}function QOe(t,e,n,s){MK(t.x,e.x,n.x,s),MK(t.y,e.y,n.y,s)}function JOe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const e7e={duration:.45,ease:[.4,0,.1,1]},DK=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),OK=DK("applewebkit/")&&!DK("chrome/")?Math.round:dl;function $K(t){t.min=OK(t.min),t.max=OK(t.max)}function t7e(t){$K(t.x),$K(t.y)}function Sue(t,e,n){return t==="position"||t==="preserve-aspect"&&!wOe(TK(e),TK(n),.2)}function n7e(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const s7e=bue({attachResizeListener:(t,e)=>e2(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),s6={current:void 0},wue=bue({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!s6.current){const t=new s7e({});t.mount(window),t.setOptions({layoutScroll:!0}),s6.current=t}return s6.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),t2=w.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function FK(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function r7e(...t){return e=>{let n=!1;const s=t.map(r=>{const i=FK(r,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():FK(t[r],null)}}}}function i7e(...t){return w.useCallback(r7e(...t),t)}class a7e extends w.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(IC(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,r=IC(s)&&s.offsetWidth||0,i=IC(s)&&s.offsetHeight||0,a=getComputedStyle(n),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=n.offsetTop,o.left=n.offsetLeft,o.right=r-o.width-o.left,o.bottom=i-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function o7e({children:t,isPresent:e,anchorX:n,anchorY:s,root:r,pop:i}){var p;const a=w.useId(),o=w.useRef(null),l=w.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:u}=w.useContext(t2),d=i!==!1?((p=t.props)==null?void 0:p.ref)??(t==null?void 0:t.ref):void 0,f=i7e(o,d);return w.useInsertionEffect(()=>{const{width:m,height:v,top:x,left:y,right:S,bottom:_,direction:E}=l.current;if(e||i===!1||!o.current||!m||!v)return;const T=E==="rtl",k=n==="left"?T?`right: ${S}`:`left: ${y}`:T?`left: ${y}`:`right: ${S}`,R=s==="bottom"?`bottom: ${_}`:`top: ${x}`;o.current.dataset.motionPopId=a;const I=document.createElement("style");u&&(I.nonce=u);const A=r??document.head;return A.appendChild(I),I.sheet&&I.sheet.insertRule(`
130          [data-motion-pop-id="${a}"] {
131            position: absolute !important;
132            width: ${m}px !important;
133            height: ${v}px !important;
134            ${k}px !important;
135            ${R}px !important;
136          }
137        `),()=>{var L;(L=o.current)==null||L.removeAttribute("data-motion-pop-id"),A.contains(I)&&A.removeChild(I)}},[e]),c.jsx(a7e,{isPresent:e,childRef:o,sizeRef:l,pop:i,children:i===!1?t:w.cloneElement(t,{ref:f})})}const l7e=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:a,anchorX:o,anchorY:l,root:u})=>{const d=SS(c7e),f=w.useId(),p=w.useRef(n),m=w.useRef(s);v4(()=>{p.current=n,m.current=s});let v=!0,x=w.useMemo(()=>(v=!1,{id:f,initial:e,isPresent:n,custom:r,onExitComplete:y=>{d.set(y,!0);for(const S of d.values())if(!S)return;s&&s()},register:y=>(d.set(y,!1),()=>{var S;d.delete(y),!p.current&&!d.size&&((S=m.current)==null||S.call(m))})}),[n,d,s]);return i&&v&&(x={...x}),w.useMemo(()=>{d.forEach((y,S)=>d.set(S,!1))},[n]),w.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),t=c.jsx(o7e,{pop:a==="popLayout",isPresent:n,anchorX:o,anchorY:l,root:u,children:t}),c.jsx(x4.Provider,{value:x,children:t})};function c7e(){return new Map}function _ue(t=!0){const e=w.useContext(x4);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=e,i=w.useId();w.useEffect(()=>{if(t)return r(i)},[t]);const a=w.useCallback(()=>t&&s&&s(i),[i,s,t]);return!n&&s?[!1,a]:[!0]}const D_=t=>t.key||"";function UK(t){const e=[];
vendor: 5,768 bytes, line 137
137return w.Children.forEach(t,n=>{w.isValidElement(n)&&e.push(n)}),e}const xr=({children:t,custom:e,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:u})=>{const[d,f]=_ue(a),p=w.useMemo(()=>UK(t),[t]),m=a&&!d?[]:p.map(D_),v=w.useRef(!0),x=w.useRef(p),y=SS(()=>new Map),S=w.useRef(new Set),[_,E]=w.useState(p),[T,k]=w.useState(p);v4(()=>{v.current=!1,x.current=p;for(let A=0;A<T.length;A++){const L=D_(T[A]);m.includes(L)?(y.delete(L),S.current.delete(L)):y.get(L)!==!0&&y.set(L,!1)}},[T,m.length,m.join("-")]);const R=[];if(p!==_){let A=[...p];for(let L=0;L<T.length;L++){const j=T[L],F=D_(j);m.includes(F)||(A.splice(L,0,j),R.push(j))}return i==="wait"&&R.length&&(A=R),k(UK(A)),E(p),null}const{forceRender:I}=w.useContext(BO);return c.jsx(c.Fragment,{children:T.map(A=>{const L=D_(A),j=a&&!d?!1:p===T||m.includes(L),F=()=>{if(S.current.has(L))return;if(y.has(L))S.current.add(L),y.set(L,!0);else return;let O=!0;y.forEach(M=>{M||(O=!1)}),O&&(I==null||I(),k(x.current),a&&(f==null||f()),s&&s())};return c.jsx(l7e,{isPresent:j,initial:!v.current||n?void 0:!1,custom:e,presenceAffectsLayout:r,mode:i,root:u,onExitComplete:j?void 0:F,anchorX:o,anchorY:l,children:A},L)})})},Eue=w.createContext({strict:!1}),BK={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 zK=!1;function u7e(){if(zK)return;const t={};for(const e in BK)t[e]={isEnabled:n=>BK[e].some(s=>!!n[s])};eue(t),zK=!0}function Cue(){return u7e(),K9e()}function d7e(t){const e=Cue();for(const n in t)e[n]={...e[n],...t[n]};eue(e)}const f7e=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 ik(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||f7e.has(t)}let Tue=t=>!ik(t);function kue(t){typeof t=="function"&&(Tue=e=>e.startsWith("on")?!ik(e):t(e))}try{kue(require("@emotion/is-prop-valid").default)}catch{}function h7e(t,e,n){const s={};for(const r in t)r==="values"&&typeof t.values=="object"||Ui(t[r])||(Tue(r)||n===!0&&ik(r)||!e&&!ik(r)||t.draggable&&r.startsWith("onDrag"))&&(s[r]=t[r]);return s}function p7e({children:t,isValidProp:e,...n}){e&&kue(e);const s=w.useContext(t2);n={...s,...n},n.transition=JO(n.transition,s.transition),n.isStatic=SS(()=>n.isStatic);const r=w.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion,n.skipAnimations]);return c.jsx(t2.Provider,{value:r,children:t})}const _4=w.createContext({});function m7e(t,e){if(w4(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Jb(n)?n:void 0,animate:Jb(s)?s:void 0}}return t.inherit!==!1?e:{}}function g7e(t){const{initial:e,animate:n}=m7e(t,w.useContext(_4));return w.useMemo(()=>({initial:e,animate:n}),[VK(e),VK(n)])}function VK(t){return Array.isArray(t)?t.join(" "):t}const p7=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Rue(t,e,n){for(const s in e)!Ui(e[s])&&!oue(s,n)&&(t[s]=e[s])}function v7e({transformTemplate:t},e){return w.useMemo(()=>{const n=p7();return f7(n,e,t),Object.assign({},n.vars,n.style)},[e])}function x7e(t,e){const n=t.style||{},s={};return Rue(s,n,t),Object.assign(s,v7e(t,e)),s}function y7e(t,e){const n={},s=x7e(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.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=s,n}const Aue=()=>({...p7(),attrs:{}});function b7e(t,e,n,s){const r=w.useMemo(()=>{const i=Aue();return lue(i,e,uue(s),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Rue(i,t.style,t),r.style={...i,...r.style}}return r}const S7e=["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 m7(t){return typeof t!="string"||t.includes("-")?!1:!!(S7e.indexOf(t)>-1||/[A-Z]/u.test(t))}function w7e(t,e,n,{latestValues:s},r,i=!1,a){const l=(a??m7(t)?b7e:y7e)(e,s,r,t),u=h7e(e,typeof t=="string",i),d=t!==w.Fragment?{...u,...l,ref:n}:{},{children:f}=e,p=w.useMemo(()=>Ui(f)?f.get():f,[f]);return w.createElement(t,{...d,children:p})}function _7e({scrapeMotionValuesFromProps:t,createRenderState:e},n,s,r){return{latestValues:E7e(n,s,r,t),renderState:e()}}function E7e(t,e,n,s){const r={},i=s(t,{});for(const p in i)r[p]=DC(i[p]);let{initial:a,animate:o}=t;const l=w4(t),u=Qce(t);e&&u&&!l&&t.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!S4(f)){const p=Array.isArray(f)?f:[f];for(let m=0;m<p.length;m++){const v=n7(t,p[m]);if(v){const{transitionEnd:x,transition:y,...S}=v;for(const _ in S){let E=S[_];if(Array.isArray(E)){const T=d?E.length-1:0;E=E[T]}E!==null&&(r[_]=E)}for(const _ in x)r[_]=x[_]}}}return r}const Nue=t=>
vendor: 22,042 bytes, line 137
137(e,n)=>{const s=w.useContext(_4),r=w.useContext(x4),i=()=>_7e(t,e,s,r);return n?i():SS(i)},C7e=Nue({scrapeMotionValuesFromProps:h7,createRenderState:p7}),T7e=Nue({scrapeMotionValuesFromProps:due,createRenderState:Aue}),k7e=Symbol.for("motionComponentSymbol");function R7e(t,e,n){const s=w.useRef(n);w.useInsertionEffect(()=>{s.current=n});const r=w.useRef(null);return w.useCallback(i=>{var o;i&&((o=t.onMount)==null||o.call(t,i)),e&&(i?e.mount(i):e.unmount());const a=s.current;if(typeof a=="function")if(i){const l=a(i);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):a(i);else a&&(a.current=i)},[e])}const Iue=w.createContext({});function d0(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function A7e(t,e,n,s,r,i){var E,T;const{visualElement:a}=w.useContext(_4),o=w.useContext(Eue),l=w.useContext(x4),u=w.useContext(t2),d=u.reducedMotion,f=u.skipAnimations,p=w.useRef(null),m=w.useRef(!1);s=s||o.renderer,!p.current&&s&&(p.current=s(t,{visualState:e,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:f,isSVG:i}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const v=p.current,x=w.useContext(Iue);v&&!v.projection&&r&&(v.type==="html"||v.type==="svg")&&N7e(p.current,n,r,x);const y=w.useRef(!1);w.useInsertionEffect(()=>{v&&y.current&&v.update(n,l)});const S=n[Fce],_=w.useRef(!!S&&typeof window<"u"&&!((E=window.MotionHandoffIsComplete)!=null&&E.call(window,S))&&((T=window.MotionHasOptimisedAnimation)==null?void 0:T.call(window,S)));return v4(()=>{m.current=!0,v&&(y.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),_.current&&v.animationState&&v.animationState.animateChanges())}),w.useEffect(()=>{v&&(!_.current&&v.animationState&&v.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)==null||k.call(window,S)}),_.current=!1),v.enteringChildren=void 0)}),v}function N7e(t,e,n,s){const{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutAnchor:d,layoutCrossfade:f}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Lue(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&d0(o),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,crossfade:f,layoutScroll:l,layoutRoot:u,layoutAnchor:d})}function Lue(t){if(t)return t.options.allowProjection!==!1?t.projection:Lue(t.parent)}function r6(t,{forwardMotionProps:e=!1,type:n}={},s,r){s&&d7e(s);const i=n?n==="svg":m7(t),a=i?T7e:C7e;function o(u,d){let f;const p={...w.useContext(t2),...u,layoutId:I7e(u)},{isStatic:m}=p,v=g7e(u),x=a(u,m);if(!m&&typeof window<"u"){L7e();const y=j7e(p);f=y.MeasureLayout,v.visualElement=A7e(t,x,p,r,y.ProjectionNode,i)}return c.jsxs(_4.Provider,{value:v,children:[f&&v.visualElement?c.jsx(f,{visualElement:v.visualElement,...p}):null,w7e(t,u,R7e(x,v.visualElement,d),x,m,e,i)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=w.forwardRef(o);return l[k7e]=t,l}function I7e({layoutId:t}){const e=w.useContext(BO).id;return e&&t!==void 0?e+"-"+t:t}function L7e(t,e){w.useContext(Eue).strict}function j7e(t){const e=Cue(),{drag:n,layout:s}=e;if(!n&&!s)return{};const r={...n,...s};return{MeasureLayout:n!=null&&n.isEnabled(t)||s!=null&&s.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function P7e(t,e){if(typeof Proxy>"u")return r6;const n=new Map,s=(i,a)=>r6(i,a,t,e),r=(i,a)=>s(i,a);return new Proxy(r,{get:(i,a)=>a==="create"?s:(n.has(a)||n.set(a,r6(a,void 0,t,e)),n.get(a))})}const M7e=(t,e)=>e.isSVG??m7(t)?new dOe(e):new iOe(e,{allowProjection:t!==w.Fragment});class D7e extends Vh{constructor(e){super(e),e.animationState||(e.animationState=gOe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();S4(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let O7e=0;class $7e extends Vh{constructor(){super(...arguments),this.id=O7e++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a)){const l=bm(this.node,a,o);if(l){const{transition:u,transitionEnd:d,...f}=l;for(const p in f)(i=this.node.getValue(p))==null||i.jump(f[p])}}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 F7e={animation:{Feature:D7e},exit:{Feature:$7e}};function CS(t){return{point:{x:t.pageX,y:t.pageY}}}const U7e=t=>e=>o7(e)&&t(e,CS(e));function cb(t,e,n,s){return e2(t,e,U7e(n),s)}const jue=({current:t})=>t?t.ownerDocument.defaultView:null,HK=(t,e)=>Math.abs(t-e);function B7e(t,e){const n=HK(t.x,e.x),s=HK(t.y,e.y);return Math.sqrt(n**2+s**2)}const GK=new Set(["auto","scroll"]);class Pue{constructor(e,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){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=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=O_(this.lastRawMoveEventInfo,this.transformPagePoint));const v=i6(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,y=B7e(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!y)return;const{point:S}=v,{timestamp:_}=Di;this.history.push({...S,timestamp:_});const{onStart:E,onMove:T}=this.handlers;x||(E&&E(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,v)},this.handlePointerMove=(v,x)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=x,this.lastMoveEventInfo=O_(x,this.transformPagePoint),$s.update(this.updatePoint,!0)},this.handlePointerUp=(v,x)=>{this.end();const{onEnd:y,onSessionEnd:S,resumeAnimation:_}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=i6(v.type==="pointercancel"?this.lastMoveEventInfo:O_(x,this.transformPagePoint),this.history);this.startEvent&&y&&y(v,E),S&&S(v,E)},!o7(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=a,this.contextWindow=r||window;const l=CS(e),u=O_(l,this.transformPagePoint),{point:d}=u,{timestamp:f}=Di;this.history=[{...d,timestamp:f}];const{onSessionStart:p}=n;p&&p(e,i6(u,this.history));const m={passive:!0,capture:!0};this.removeListeners=wS(cb(this.contextWindow,"pointermove",this.handlePointerMove,m),cb(this.contextWindow,"pointerup",this.handlePointerUp,m),cb(this.contextWindow,"pointercancel",this.handlePointerUp,m)),o&&this.startScrollTracking(o)}startScrollTracking(e){let n=e.parentElement;for(;n;){const s=getComputedStyle(n);(GK.has(s.overflowX)||GK.has(s.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 s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-n.x,y:r.y-n.y};i.x===0&&i.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),$s.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Rh(this.updatePoint)}}function O_(t,e){return e?{point:e(t.point)}:t}function WK(t,e){return{x:t.x-e.x,y:t.y-e.y}}function i6({point:t},e){return{point:t,delta:WK(t,Mue(e)),offset:WK(t,z7e(e)),velocity:V7e(e,.1)}}function z7e(t){return t[0]}function Mue(t){return t[t.length-1]}function V7e(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const r=Mue(t);for(;n>=0&&(s=t[n],!(r.timestamp-s.timestamp>Ro(e)));)n--;if(!s)return{x:0,y:0};s===t[0]&&t.length>2&&r.timestamp-s.timestamp>Ro(e)*2&&(s=t[1]);const i=al(r.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const a={x:(r.x-s.x)/i,y:(r.y-s.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function H7e(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?Os(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?Os(n,t,s.max):Math.min(t,n)),t}function qK(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 G7e(t,{top:e,left:n,bottom:s,right:r}){return{x:qK(t.x,n,r),y:qK(t.y,e,s)}}function KK(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function W7e(t,e){return{x:KK(t.x,e.x),y:KK(t.y,e.y)}}function q7e(t,e){let n=.5;const s=ka(t),r=ka(e);return r>s?n=Xb(e.min,e.max-s,t.min):s>r&&(n=Xb(t.min,t.max-r,e.min)),ru(0,1,n)}function K7e(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 SP=.35;function Y7e(t=SP){return t===!1?t=0:t===!0&&(t=SP),{x:YK(t,"left","right"),y:YK(t,"top","bottom")}}function YK(t,e,n){return{min:ZK(t,e),max:ZK(t,n)}}function ZK(t,e){return typeof t=="number"?t:t[e]||0}const Z7e=new WeakMap;class X7e{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=ai(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=f=>{n&&this.snapToCursor(CS(f).point),this.stopAnimation()},a=(f,p)=>{const{drag:m,dragPropagation:v,onDragStart:x}=this.getProps();if(m&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=C9e(m),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),kc(S=>{let _=this.getAxisMotionValue(S).get()||0;if(Yc.test(_)){const{projection:E}=this.visualElement;if(E&&E.layout){const T=E.layout.layoutBox[S];T&&(_=ka(T)*(parseFloat(_)/100))}}this.originPoint[S]=_}),x&&$s.update(()=>x(f,p),!1,!0),fP(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},o=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p;const{dragPropagation:m,dragDirectionLock:v,onDirectionLock:x,onDrag:y}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:S}=p;if(v&&this.currentDirection===null){this.currentDirection=J7e(S),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",p.point,S),this.updateAxis("y",p.point,S),this.visualElement.render(),y&&$s.update(()=>y(f,p),!1,!0)},l=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p,this.stop(f,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new Pue(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:jue(this.visualElement),element:this.visualElement.current})}stop(e,n){const s=e||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!s)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&$s.postRender(()=>o(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&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,s){const{drag:r}=this.getProps();if(!s||!$_(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=H7e(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;e&&d0(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=G7e(s.layoutBox,e):this.constraints=!1,this.elastic=Y7e(n),r!==this.constraints&&!d0(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&kc(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=K7e(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!d0(e))return!1;const s=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const i=J9e(s,r.root,this.visualElement.getTransformPagePoint());let a=W7e(r.layout.layoutBox,i);if(n){const o=n(Z9e(a));this.hasMutatedConstraints=!!o,o&&(a=nue(o))}return a}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=kc(d=>{if(!$_(d,n,this.currentDirection))return;let f=l&&l[d]||{};(a===!0||a===d)&&(f={min:0,max:0});const p=r?200:1e6,m=r?40:1e7,v={type:"inertia",velocity:s?e[d]:0,bounceStiffness:p,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,v)});return Promise.all(u).then(o)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return fP(this.visualElement,e),s.start(t7(e,s,0,n,this.visualElement,!1))}stopAnimation(){kc(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){kc(n=>{const{drag:s}=this.getProps();if(!$_(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-Os(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!d0(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};kc(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();r[a]=q7e({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),kc(a=>{if(!$_(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(Os(l,u,r[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Z7e.set(this.visualElement,this);const e=this.visualElement.current,n=cb(e,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps(),p=u.target,m=p!==e&&I9e(p);d&&f&&!m&&this.start(u)});let s;const r=()=>{const{dragConstraints:u}=this.getProps();d0(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),s||(s=Q7e(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),$s.read(r);const o=e2(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(kc(f=>{const p=this.getAxisMotionValue(f);p&&(this.originPoint[f]+=u[f].translate,p.set(p.get()+u[f].translate))}),this.visualElement.render())}));return()=>{o(),n(),a(),l&&l(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=SP,dragMomentum:o=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function XK(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Q7e(t,e,n){const s=rK(t,XK(n)),r=rK(e,XK(n));return()=>{s(),r()}}function $_(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function J7e(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class e$e extends Vh{constructor(e){super(e),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new X7e(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}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 a6=t=>(e,n)=>{t&&$s.update(()=>t(e,n),!1,!0)};class t$e extends Vh{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(e){this.session=new Pue(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jue(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:a6(e),onStart:a6(n),onMove:a6(s),onEnd:(i,a)=>{delete this.session,r&&$s.postRender(()=>r(i,a))}}}mount(){this.removePointerDownListener=cb(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 o6=!1;class n$e extends w.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),s&&s.register&&r&&s.register(i),o6&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),OC.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:r,isPresent:i}=this.props,{projection:a}=s;return a&&(a.isPresent=i,e.layoutDependency!==n&&a.setOptions({...a.options,layoutDependency:n}),o6=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||$s.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:s}=e;s&&(s.options.layoutAnchor=n,s.root.didUpdate(),a7.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=e;o6=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Due(t){const[e,n]=_ue(),s=w.useContext(BO);return c.jsx(n$e,{...t,layoutGroup:s,switchLayoutGroup:w.useContext(Iue),isPresent:e,safeToRemove:n})}const s$e={pan:{Feature:t$e},drag:{Feature:e$e,ProjectionNode:wue,MeasureLayout:Due}};function QK(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&$s.postRender(()=>i(e,CS(e)))}class r$e extends Vh{mount(){const{current:e}=this.node;e&&(this.unmount=k9e(e,(n,s)=>(QK(this.node,s,"Start"),r=>QK(this.node,r,"End"))))}unmount(){}}class i$e extends Vh{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=wS(e2(this.node.current,"focus",()=>this.onFocus()),e2(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function JK(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&$s.postRender(()=>i(e,CS(e)))}class a$e extends Vh{mount(){const{current:e}=this.node;if(!e)return;
137const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=j9e(e,(r,i)=>(JK(this.node,i,"Start"),(a,{success:o})=>JK(this.node,a,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const wP=new WeakMap,l6=new WeakMap,o$e=t=>{const e=wP.get(t.target);e&&e(t)},l$e=t=>{t.forEach(o$e)};function c$e({root:t,...e}){const n=t||document;l6.has(n)||l6.set(n,{});const s=l6.get(n),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(l$e,{root:t,...e})),s[r]}function u$e(t,e,n){const s=c$e(e);return wP.set(t,n),s.observe(t),()=>{wP.delete(t),s.unobserve(t)}}const d$e={some:0,all:1};class f$e extends Vh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:d$e[r]},o=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:p}=this.node.getProps(),m=d?f:p;m&&m(u)};this.stopObserver=u$e(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(h$e(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function h$e({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const p$e={inView:{Feature:f$e},tap:{Feature:a$e},focus:{Feature:i$e},hover:{Feature:r$e}},m$e={layout:{ProjectionNode:wue,MeasureLayout:Due}},g$e={...F7e,...p$e,...s$e,...m$e},v$e=P7e(g$e,M7e);function Hh(){!d7.current&&Jce();const[t]=w.useState(tk.current);return t}function x$e(t){t.values.forEach(e=>e.stop())}function _P(t,e){[...e].reverse().forEach(s=>{const r=t.getVariant(s);r&&s7(t,r),t.variantChildren&&t.variantChildren.forEach(i=>{_P(i,e)})})}function y$e(t,e){if(Array.isArray(e))return _P(t,e);if(typeof e=="string")return _P(t,[e]);s7(t,e)}function b$e(){const t=new Set,e={subscribe(n){return t.add(n),()=>void t.delete(n)},start(n,s){const r=[];return t.forEach(i=>{r.push(zce(i,n,{transitionOverride:s}))}),Promise.all(r)},set(n){return t.forEach(s=>{y$e(s,n)})},stop(){t.forEach(n=>{x$e(n)})},mount(){return()=>{e.stop()}}};return e}function S$e(){const t=SS(b$e);return v4(t.mount,[]),t}const wt=v$e,Oue=w.createContext(void 0),aa=t=>{const e=w.useContext(Oue);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},w$e=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),c.jsx(Oue.Provider,{value:t,children:e})),_$e={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)};var qf,E9,ure,E$e=(ure=class{constructor(){St(this,qf,_$e);St(this,E9,!1)}setTimeoutProvider(t){nt(this,qf,t)}setTimeout(t,e){return se(this,qf).setTimeout(t,e)}clearTimeout(t){se(this,qf).clearTimeout(t)}setInterval(t,e){return se(this,qf).setInterval(t,e)}clearInterval(t){se(this,qf).clearInterval(t)}},qf=new WeakMap,E9=new WeakMap,ure);const Kp=new E$e;function C$e(t){setTimeout(t,0)}const T$e=typeof window>"u"||"Deno"in globalThis;function Ji(){}function k$e(t,e){return typeof t=="function"?t(e):t}function $ue(t){return typeof t=="number"&&t>=0&&t!==1/0}function Fue(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xd(t,e){return typeof t=="function"?t(e):t}function So(t,e){return typeof t=="function"?t(e):t}function eY(t,e){const{type:n="all",exact:s,fetchStatus:r,predicate:i,queryKey:a,stale:o}=t;if(a){if(s){if(e.queryHash!==g7(a,e.options))return!1}else if(!Hv(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||r&&r!==e.state.fetchStatus||i&&!i(e))}function tY(t,e){const{exact:n,status:s,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(Lm(e.options.mutationKey)!==Lm(i))return!1}else if(!Hv(e.options.mutationKey,i))return!1}return!(s&&e.state.status!==s||r&&!r(e))}function g7(t,e){return((e==null?void 0:e.queryKeyHashFn)||Lm)(t)}function Lm(t){return JSON.stringify(t,(e,n)=>EP(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function Hv(t,e){if(t===e)return!0;
137if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let s=0;s<e.length;s++)if(!Hv(t[s],e[s]))return!1;return!0}const n=Object.keys(e);for(const s of n)if(!Hv(t[s],e[s]))return!1;return!0}return!1}const R$e=Object.prototype.hasOwnProperty;function v7(t,e,n=0){if(t===e)return t;if(n>500)return e;const s=nY(t)&&nY(e);if(!s&&!(EP(t)&&EP(e)))return e;const r=(s?t:Object.keys(t)).length,i=s?e:Object.keys(e),a=i.length,o=s?new Array(a):{};let l=0;for(let u=0;u<a;u++){const d=s?u:i[u],f=t[d],p=e[d];if(f===p){o[d]=f,(s?u<r:R$e.call(t,d))&&l++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){o[d]=p;continue}const m=v7(f,p,n+1);o[d]=m,m===f&&l++}return r===a&&l===r?t:o}function n2(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function nY(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function EP(t){if(!sY(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!sY(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function sY(t){return Object.prototype.toString.call(t)==="[object Object]"}function A$e(t){return new Promise(e=>{Kp.setTimeout(e,t)})}function CP(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?v7(t,e):e}function N$e(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function I$e(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}const x7=Symbol();function Uue(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===x7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function y7(t,e){return typeof t=="function"?t(...e):!!t}function L$e(t,e,n){let s=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??(r=e()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),t}const b7=(()=>{let t=()=>T$e;return{isServer(){return t()},setIsServer(e){t=e}}})();var Jm=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tm,Kf,mv,dre,j$e=(dre=class extends Jm{constructor(){super();St(this,tm);St(this,Kf);St(this,mv);nt(this,mv,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){se(this,Kf)||this.setEventListener(se(this,mv))}onUnsubscribe(){var e;this.hasListeners()||((e=se(this,Kf))==null||e.call(this),nt(this,Kf,void 0))}setEventListener(e){var n;nt(this,mv,e),(n=se(this,Kf))==null||n.call(this),nt(this,Kf,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){se(this,tm)!==e&&(nt(this,tm,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof se(this,tm)=="boolean"?se(this,tm):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},tm=new WeakMap,Kf=new WeakMap,mv=new WeakMap,dre);const S7=new j$e,P$e=C$e;function M$e(){let t=[],e=0,n=o=>{o()},s=o=>{o()},r=P$e;const i=o=>{e?t.push(o):r(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&r(()=>{s(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{s=o},setScheduler:o=>{r=o}}}const kr=M$e();var gv,Yf,vv,fre,D$e=(fre=class extends Jm{constructor(){super();St(this,gv,!0);St(this,Yf);St(this,vv);nt(this,vv,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){se(this,Yf)||this.setEventListener(se(this,vv))}onUnsubscribe(){var e;this.hasListeners()||((e=se(this,Yf))==null||e.call(this),nt(this,Yf,void 0))}setEventListener(e){var n;nt(this,vv,e),(n=se(this,Yf))==null||n.call(this),nt(this,Yf,e(this.setOnline.bind(this)))}setOnline(e){se(this,gv)!==e&&(nt(this,gv,e),this.listeners.forEac
137h(n=>{n(e)}))}isOnline(){return se(this,gv)}},gv=new WeakMap,Yf=new WeakMap,vv=new WeakMap,fre);const ak=new D$e;function O$e(t){return Math.min(1e3*2**t,3e4)}function Bue(t){return(t??"online")==="online"?ak.isOnline():!0}var TP=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function zue(t){let e=!1,n=0,s,r="pending",i,a;const o=new Promise((_,E)=>{i=_,a=E});o.catch(Ji);const l=()=>r!=="pending",u=_=>{var E;if(!l()){const T=new TP(_);x(T),(E=t.onCancel)==null||E.call(t,T)}},d=()=>{e=!0},f=()=>{e=!1},p=()=>S7.isFocused()&&(t.networkMode==="always"||ak.isOnline())&&t.canRun(),m=()=>Bue(t.networkMode)&&t.canRun(),v=_=>{l()||(s==null||s(),r="resolved",i(_))},x=_=>{l()||(s==null||s(),r="rejected",a(_))},y=()=>new Promise(_=>{var E;s=T=>{(l()||p())&&_(T)},(E=t.onPause)==null||E.call(t)}).then(()=>{var _;s=void 0,l()||(_=t.onContinue)==null||_.call(t)}),S=()=>{if(l())return;let _;const E=n===0?t.initialPromise:void 0;try{_=E??t.fn()}catch(T){_=Promise.reject(T)}Promise.resolve(_).then(v).catch(T=>{var L;if(l())return;const k=t.retry??(b7.isServer()?0:3),R=t.retryDelay??O$e,I=typeof R=="function"?R(n,T):R,A=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,T);if(e||!A){x(T);return}n++,(L=t.onFail)==null||L.call(t,n,T),A$e(I).then(()=>p()?void 0:y()).then(()=>{e?x(T):S()})})};return{promise:o,status:()=>r,cancel:u,continue:()=>(s==null||s(),o),cancelRetry:d,continueRetry:f,canStart:m,start:()=>(m()?S():y().then(S),o)}}var nm,hre,Vue=(hre=class{constructor(){St(this,nm)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$ue(this.gcTime)&&nt(this,nm,Kp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(b7.isServer()?1/0:3e5))}clearGcTimeout(){se(this,nm)!==void 0&&(Kp.clearTimeout(se(this,nm)),nt(this,nm,void 0))}},nm=new WeakMap,hre);function $$e(t){return{onFetch:(e,n)=>{var d,f,p,m,v;const s=e.options,r=(p=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,i=((m=e.state.data)==null?void 0:m.pages)||[],a=((v=e.state.data)==null?void 0:v.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let x=!1;const y=E=>{L$e(E,()=>e.signal,()=>x=!0)},S=Uue(e.options,e.fetchOptions),_=async(E,T,k)=>{if(x)return Promise.reject(e.signal.reason);if(T==null&&E.pages.length)return Promise.resolve(E);const I=(()=>{const F={client:e.client,queryKey:e.queryKey,pageParam:T,direction:k?"backward":"forward",meta:e.options.meta};return y(F),F})(),A=await S(I),{maxPages:L}=e.options,j=k?I$e:N$e;return{pages:j(E.pages,A,L),pageParams:j(E.pageParams,T,L)}};if(r&&i.length){const E=r==="backward",T=E?Hue:kP,k={pages:i,pageParams:a};o=await _(k,T(s,k),E)}else{const E=t??i.length;do{const T=l===0?a[0]??s.initialPageParam:kP(s,o);if(l>0&&T==null)break;o=await _(o,T),l++}while(l<E)}return o};e.options.persister?e.fetchFn=()=>{var x,y;return(y=(x=e.options).persister)==null?void 0:y.call(x,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function kP(t,{pages:e,pageParams:n}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,n[s],n):void 0}function Hue(t,{pages:e,pageParams:n}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,n[0],n):void 0}function F$e(t,e){return e?kP(t,e)!=null:!1}function U$e(t,e){return!e||!t.getPreviousPageParam?!1:Hue(t,e)!=null}var xv,sm,yv,Xo,rm,ii,U2,im,vo,Gue,Vu,pre,B$e=(pre=class extends Vue{constructor(e){super();St(this,vo);St(this,xv);St(this,sm);St(this,yv);St(this,Xo);St(this,rm);St(this,ii);St(this,U2);St(this,im);nt(this,im,!1),nt(this,U2,e.defaultOptions),this.setOptions(e.options),this.observers=[],nt(this,rm,e.client),nt(this,Xo,se(this,rm).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,nt(this,sm,iY(this.options)),this.state=e.state??se(this,sm),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return se(this,xv)}get promise(){var e;return(e=se(this,ii))==null?void 0:e.promise}setOptions(e){if(this.options={...se(this,U2),...e}
137,e!=null&&e._type&&nt(this,xv,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=iY(this.options);n.data!==void 0&&(this.setState(rY(n.data,n.dataUpdatedAt)),nt(this,sm,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&se(this,Xo).remove(this)}setData(e,n){const s=CP(this.state.data,e,this.options);return Ft(this,vo,Vu).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e){Ft(this,vo,Vu).call(this,{type:"setState",state:e})}cancel(e){var s,r;const n=(s=se(this,ii))==null?void 0:s.promise;return(r=se(this,ii))==null||r.cancel(e),n?n.then(Ji).catch(Ji):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return se(this,sm)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>So(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===x7||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Fue(this.state.dataUpdatedAt,e)}onFocus(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnWindowFocus()))==null||e.refetch({cancelRefetch:!1}),(n=se(this,ii))==null||n.continue()}onOnline(){var e,n;(e=this.observers.find(s=>s.shouldFetchOnReconnect()))==null||e.refetch({cancelRefetch:!1}),(n=se(this,ii))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),se(this,Xo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const n=this.observers.indexOf(e);n!==-1&&(this.observers.splice(n,1),this.observers.length||(se(this,ii)&&(se(this,im)||Ft(this,vo,Gue).call(this)?se(this,ii).cancel({revert:!0}):se(this,ii).cancelRetry()),this.scheduleGc()),se(this,Xo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ft(this,vo,Vu).call(this,{type:"invalidate"})}async fetch(e,n){var u,d,f,p,m,v,x,y,S,_,E,T;if(this.state.fetchStatus!=="idle"&&((u=se(this,ii))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(se(this,ii))return se(this,ii).continueRetry(),se(this,ii).promise}if(e&&this.setOptions(e),!this.options.queryFn){const k=this.observers.find(R=>R.options.queryFn);k&&this.setOptions(k.options)}const s=new AbortController,r=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(nt(this,im,!0),s.signal)})},i=()=>{const k=Uue(this.options,n),I=(()=>{const A={client:se(this,rm),queryKey:this.queryKey,meta:this.meta};return r(A),A})();return nt(this,im,!1),this.options.persister?this.options.persister(k,I,this):k(I)},o=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:se(this,rm),state:this.state,fetchFn:i};return r(k),k})();(d=se(this,xv)==="infinite"?$$e(this.options.pages):this.options.behavior)==null||d.onFetch(o,this),nt(this,yv,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=o.fetchOptions)==null?void 0:f.meta))&&Ft(this,vo,Vu).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const l=nt(this,ii,zue({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:k=>{k instanceof TP&&k.revert&&this.setState({...se(this,yv),fetchStatus:"idle"}),s.abort()},onFail:(k,R)=>{Ft(this,vo,Vu).call(this,{type:"failed",failureCount:k,error:R})},onPause:()=>{Ft(this,vo,Vu).call(this,{type:"pause"})},onContinue:()=>{Ft(this,vo,Vu).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const k=await l.start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(v=(m=se(this,Xo).config).onSuccess)==null||v.call(m,k,this),(y=(x=se(this,Xo).config).onSettled)==null||y.call(x,k,this.state.error,this),k}catch(k){if(k instanceof TP){if(k.silent)return se(this,ii).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Ft(this,vo,Vu).call(this,{type:"error",error:k}),(_=(S=se(this,Xo).config).onError)==null||_.call(S,k,this),(T=(E=se(this,Xo).config).onSettled)==null||T.call(E,this.state.data,k,this),k}finally{se(this,ii)===l&&nt(this,ii,void 0),this.scheduleGc()}}},xv=new WeakMap,sm=new WeakMap,yv=new WeakMap,Xo=new WeakMap,rm=new WeakMap,ii=new WeakMap,U2=new WeakMap,im=new WeakMap,vo=new WeakSet,Gue=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Vu=function(e){const n=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Wue(s.data,this.options),fetchMeta:e.meta??null};case"success":const r={...s,...rY(e.data,e.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return nt(this,yv,e.manual?r:void 0),r;case"error":const i=e.error;
137return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=n(this.state),kr.batch(()=>{this.observers.slice().forEach(s=>{s.onQueryUpdate()}),se(this,Xo).notify({query:this,type:"updated",action:e})})},pre);function Wue(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bue(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function rY(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function iY(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,s=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ga,Dn,B2,va,am,bv,sd,z2,Sv,wv,om,lm,Zf,_v,Wn,Ry,RP,AP,NP,IP,LP,jP,PP,MP,que,mre,E4=(mre=class extends Jm{constructor(e,n){super();St(this,Wn);St(this,ga);St(this,Dn);St(this,B2);St(this,va);St(this,am);St(this,bv);St(this,sd);St(this,z2);St(this,Sv);St(this,wv);St(this,om);St(this,lm);St(this,Zf);St(this,_v,new Set);this.options=n,nt(this,ga,e),nt(this,sd,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(se(this,Dn).addObserver(this),aY(se(this,Dn),this.options)?Ft(this,Wn,Ry).call(this):this.updateResult(),Ft(this,Wn,LP).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return DP(se(this,Dn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return DP(se(this,Dn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ft(this,Wn,jP).call(this),Ft(this,Wn,PP).call(this),se(this,Dn).removeObserver(this)}setOptions(e){const n=this.options,s=se(this,Dn);if(this.options=se(this,ga).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof So(this.options.enabled,se(this,Dn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ft(this,Wn,MP).call(this),se(this,Dn).setOptions(this.options),n._defaulted&&!n2(this.options,n)&&se(this,ga).getQueryCache().notify({type:"observerOptionsUpdated",query:se(this,Dn),observer:this});const r=this.hasListeners();r&&oY(se(this,Dn),s,this.options,n)&&Ft(this,Wn,Ry).call(this),this.updateResult(),r&&(se(this,Dn)!==s||So(this.options.enabled,se(this,Dn))!==So(n.enabled,se(this,Dn))||xd(this.options.staleTime,se(this,Dn))!==xd(n.staleTime,se(this,Dn)))&&Ft(this,Wn,AP).call(this);const i=Ft(this,Wn,NP).call(this);r&&(se(this,Dn)!==s||So(this.options.enabled,se(this,Dn))!==So(n.enabled,se(this,Dn))||i!==se(this,Zf))&&Ft(this,Wn,IP).call(this,i)}getOptimisticResult(e){const n=se(this,ga).getQueryCache().build(se(this,ga),e),s=this.createResult(n,e);return V$e(this,s)&&(nt(this,va,s),nt(this,bv,this.options),nt(this,am,se(this,Dn).state)),s}getCurrentResult(){return se(this,va)}trackResult(e,n){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),n==null||n(r),Reflect.get(s,r))})}trackProp(e){se(this,_v).add(e)}getCurrentQuery(){return se(this,Dn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=se(this,ga).defaultQueryOptions(e),s=se(this,ga).getQueryCache().build(se(this,ga),n);let r=()=>{},i;const a=new Promise(o=>{i=o,r=se(this,ga).getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===s.queryHash&&s.state.data!==void 0&&(r(),o(this.createResult(s,n)))})});return Promise.race([s.fetch().then(()=>{const o=this.createResult(s,n);return i==null||i(o),o}).finally(()=>{r()}),a])}fetch(e){return Ft(this,Wn,Ry).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),se(this,va)))}createResult(e,n){var R;const s=se(this,Dn),r=this.options,i=se(this,va),a=se(this,am),o=se(this,bv),l=e!==s?e.state:se(this,B2),{state:u}=e;let d={...u},f=!1,p;if(n._optimisticResults){const I=this.hasListeners(),A=!I&&aY(e,n),L=I&&oY(e,s,n,r);(A||L)&&(d={...d,...Wue(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:v,status:x}=d;p=d.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&x==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(I=i.data,y=!0):I=typeof n.placeholderData=="function"?n.placeholderData((R=se(this,wv))==null?void 0:R.state.data,se(this,wv)):n.placeholderData,I!==void 0&&(x="success",p=CP(i==null?void 0:i.data,I,n),f=!0)}if(n.select&&p!==void 0&&!y)if(i&&p===(a==null?void 0:a.data)&&n.select===se(this,z2))p=se(this,Sv);else try{nt(this,z2,n.select),p=n.select(p),p=CP(i==null?void 0:i.data,p,n),nt(this,Sv,p),nt(this,sd,null)}catch(I){nt(this,sd,I)}else p===void 0&&nt(this,sd,null);se(this,sd)&&(m=se(this,sd),p=se(this,Sv),v=Date.now(),x="error",f=!1);const S=d.fetchStatus==="fetching",_=x==="pending",E=x==="error",T=_&&S,k=p!==void 0;return{status:x,fetchStatus:d.fetchStatus,isPending:_,isSuccess:x==="success",isError:E,isInitialLoading:T,isLoading:T,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdate
137Count:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:S,isRefetching:S&&!_,isLoadingError:E&&!k,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:E&&k,isStale:w7(e,n),refetch:this.refetch,isEnabled:So(n.enabled,e)!==!1}}updateResult(){const e=se(this,va),n=this.createResult(se(this,Dn),this.options);if(nt(this,am,se(this,Dn).state),nt(this,bv,this.options),se(this,am).data!==void 0&&nt(this,wv,se(this,Dn)),n2(n,e))return;nt(this,va,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!se(this,_v).size)return!0;const a=new Set(i??se(this,_v));return this.options.throwOnError&&a.add("error"),Object.keys(se(this,va)).some(o=>{const l=o;return se(this,va)[l]!==e[l]&&a.has(l)})};Ft(this,Wn,que).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ft(this,Wn,LP).call(this)}},ga=new WeakMap,Dn=new WeakMap,B2=new WeakMap,va=new WeakMap,am=new WeakMap,bv=new WeakMap,sd=new WeakMap,z2=new WeakMap,Sv=new WeakMap,wv=new WeakMap,om=new WeakMap,lm=new WeakMap,Zf=new WeakMap,_v=new WeakMap,Wn=new WeakSet,Ry=function(e){Ft(this,Wn,MP).call(this);let n=se(this,Dn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ji)),n},RP=function(e){return!b7.isServer()&&So(this.options.enabled,se(this,Dn))!==!1&&$ue(e)},AP=function(){Ft(this,Wn,jP).call(this);const e=xd(this.options.staleTime,se(this,Dn));if(se(this,va).isStale||!Ft(this,Wn,RP).call(this,e))return;const n=Fue(se(this,va).dataUpdatedAt,e)+1;nt(this,om,Kp.setTimeout(()=>{se(this,va).isStale||this.updateResult()},n))},NP=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(se(this,Dn)):this.options.refetchInterval)??!1},IP=function(e){Ft(this,Wn,PP).call(this),nt(this,Zf,e),!(se(this,Zf)===0||!Ft(this,Wn,RP).call(this,se(this,Zf)))&&nt(this,lm,Kp.setInterval(()=>{(this.options.refetchIntervalInBackground||S7.isFocused())&&Ft(this,Wn,Ry).call(this)},se(this,Zf)))},LP=function(){Ft(this,Wn,AP).call(this),Ft(this,Wn,IP).call(this,Ft(this,Wn,NP).call(this))},jP=function(){se(this,om)!==void 0&&(Kp.clearTimeout(se(this,om)),nt(this,om,void 0))},PP=function(){se(this,lm)!==void 0&&(Kp.clearInterval(se(this,lm)),nt(this,lm,void 0))},MP=function(){const e=se(this,ga).getQueryCache().build(se(this,ga),this.options);if(e===se(this,Dn))return;const n=se(this,Dn);nt(this,Dn,e),nt(this,B2,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},que=function(e){kr.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(se(this,va))}),se(this,ga).getQueryCache().notify({query:se(this,Dn),type:"observerResultsUpdated"})})},mre);function z$e(t,e){return So(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&So(e.retryOnMount,t)===!1)}function aY(t,e){return z$e(t,e)||t.state.data!==void 0&&DP(t,e,e.refetchOnMount)}function DP(t,e,n){if(So(e.enabled,t)!==!1&&xd(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&w7(t,e)}return!1}function oY(t,e,n,s){return(t!==e||So(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&w7(t,n)}function w7(t,e){return So(e.enabled,t)!==!1&&t.isStaleByTime(xd(e.staleTime,t))}function V$e(t,e){return!n2(t.getCurrentResult(),e)}var H$e=class extends E4{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){t._type="infinite",super.setOptions(t)}getOptimisticResult(t){return t._type="infinite",super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var m,v;const{state:n}=t,s=super.createResult(t,e),{isFetching:r,isRefetching:i,isError:a,isRefetchError:o}=s,l=(v=(m=n.fetchMeta)==null?void 0:m.fetchMore)==null?void 0:v.direction,u=a&&l==="forward",d=r&&l==="forward",f=a&&l==="backward",p=r&&l==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:F$e(e,n.data),hasPreviousPage:U$e(e,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:o&&!u&&!f,isRefetching:i&&!d&&!p}}},V2,Lc,Yi,cm,jc,Nf,gre,G$e=(gre=class extends Vue{constructor(e){super();St(this,jc);St(this,V2);St(this,Lc);St(this,Yi);St(this,cm);nt(this,V2,e.client),this.mutationId=e.mutationId,nt(this,Yi,e.mutationCache),nt(this,Lc,[]),this.state=e.state||Kue(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){se(this,Lc).includes(e)||(se(this,Lc).push(e),this.clearGcTimeout(),se(this,Yi).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){nt(this,Lc,se(this,Lc).filter(n=>n!==e)),this.scheduleGc(),se(this,Yi).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){se(this,Lc).length||(this.state.status==="pending"?this.scheduleGc():se(this,Yi).remove(this))}continue(){var e;return((e=se(this,cm))==null?void 0:e.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){var o,l,u,d,f,p,m,v,x,y,S,_,E,T,k,R,I,A;const n=()=>{Ft(this,jc,Nf).call(this,{type:"continue"})},s={client:se(this,V2),meta:this.options.meta,mutationKey:this.options.mutationKey},r=nt(this,cm,zue({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(new Error("No mutationFn found")),onFail:(L,j)=>{Ft(this,jc,Nf).call(this,{type:"failed",failureCount:L,error:j})},onPause:()=>{Ft(this,jc,Nf).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>se(this,Yi).canRun(this)})),i=this.state.status==="pending",a=!r.canStart();try{if(i)n();else{Ft(this,jc,Nf).call(this,{type:"pending",variables:e,isPaused:a}),se(this,Yi).config.onMutate&&await se(this,Yi).config.onMutate(e,this,s);
137const j=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,e,s));j!==this.state.context&&Ft(this,jc,Nf).call(this,{type:"pending",context:j,variables:e,isPaused:a})}const L=await r.start();return await((d=(u=se(this,Yi).config).onSuccess)==null?void 0:d.call(u,L,e,this.state.context,this,s)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,L,e,this.state.context,s)),await((v=(m=se(this,Yi).config).onSettled)==null?void 0:v.call(m,L,null,this.state.variables,this.state.context,this,s)),await((y=(x=this.options).onSettled)==null?void 0:y.call(x,L,null,e,this.state.context,s)),Ft(this,jc,Nf).call(this,{type:"success",data:L}),L}catch(L){try{await((_=(S=se(this,Yi).config).onError)==null?void 0:_.call(S,L,e,this.state.context,this,s))}catch(j){Promise.reject(j)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,L,e,this.state.context,s))}catch(j){Promise.reject(j)}try{await((R=(k=se(this,Yi).config).onSettled)==null?void 0:R.call(k,void 0,L,this.state.variables,this.state.context,this,s))}catch(j){Promise.reject(j)}try{await((A=(I=this.options).onSettled)==null?void 0:A.call(I,void 0,L,e,this.state.context,s))}catch(j){Promise.reject(j)}throw Ft(this,jc,Nf).call(this,{type:"error",error:L}),L}finally{se(this,cm)===r&&nt(this,cm,void 0),se(this,Yi).runNext(this)}}},V2=new WeakMap,Lc=new WeakMap,Yi=new WeakMap,cm=new WeakMap,jc=new WeakSet,Nf=function(e){const n=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),kr.batch(()=>
137{se(this,Lc).forEach(s=>{s.onMutationUpdate(e)}),se(this,Yi).notify({mutation:this,type:"updated",action:e})})},gre);function Kue(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var rd,Ul,H2,vre,W$e=(vre=class extends Jm{constructor(e={}){super();St(this,rd);St(this,Ul);St(this,H2);this.config=e,nt(this,rd,new Set),nt(this,Ul,new Map),nt(this,H2,0)}build(e,n,s){const r=new G$e({client:e,mutationCache:this,mutationId:++a_(this,H2)._,options:e.defaultMutationOptions(n),state:s});return this.add(r),r}add(e){se(this,rd).add(e);const n=F_(e);if(typeof n=="string"){const s=se(this,Ul).get(n);s?s.push(e):se(this,Ul).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(se(this,rd).delete(e)){const n=F_(e);if(typeof n=="string"){const s=se(this,Ul).get(n);if(s)if(s.length>1){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}else s[0]===e&&se(this,Ul).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){var s;const n=F_(e);if(typeof n=="string"){const r=(s=se(this,Ul).get(n))==null?void 0:s.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){var s,r;const n=F_(e);return typeof n=="string"?((r=(s=se(this,Ul).get(n))==null?void 0:s.find(i=>i!==e&&i.state.isPaused))==null?void 0:r.continue())??Promise.resolve():Promise.resolve()}clear(){kr.batch(()=>{se(this,rd).forEach(e=>{this.notify({type:"removed",mutation:e})}),se(this,rd).clear(),se(this,Ul).clear()})}getAll(){return Array.from(se(this,rd))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>tY(n,s))}findAll(e={}){return this.getAll().filter(n=>tY(e,n))}notify(e){kr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return kr.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ji))))}},rd=new WeakMap,Ul=new WeakMap,H2=new WeakMap,vre);function F_(t){var e;return(e=t.options.scope)==null?void 0:e.id}var id,Xf,Zi,ad,qc,Ay,OP,xre,q$e=(xre=class extends Jm{constructor(n,s){super();St(this,qc);St(this,id);St(this,Xf);St(this,Zi);St(this,ad);nt(this,id,n),this.setOptions(s),this.bindMethods(),Ft(this,qc,Ay).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=se(this,id).defaultMutationOptions(n),n2(this.options,s)||se(this,id).getMutationCache().notify({type:"observerOptionsUpdated",mutation:se(this,Zi),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Lm(s.mutationKey)!==Lm(this.options.mutationKey)?this.reset():((r=se(this,Zi))==null?void 0:r.state.status)==="pending"&&se(this,Zi).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&se(this,Zi)&&(se(this,Zi).addObserver(this),Ft(this,qc,Ay).call(this))}onUnsubscribe(){var n;this.hasListeners()||(n=se(this,Zi))==null||n.removeObserver(this)}onMutationUpdate(n){Ft(this,qc,Ay).call(this),Ft(this,qc,OP).call(this,n)}getCurrentResult(){return se(this,Xf)}reset(){var n;(n=se(this,Zi))==null||n.removeObserver(this),nt(this,Zi,void 0),Ft(this,qc,Ay).call(this),Ft(this,qc,OP).call(this)}mutate(n,s){var r;return nt(this,ad,s),(r=se(this,Zi))==null||r.removeObserver(this),nt(this,Zi,se(this,id).getMutationCache().build(se(this,id),this.options)),se(this,Zi).addObserver(this),se(this,Zi).execute(n)}},id=new WeakMap,Xf=new WeakMap,Zi=new WeakMap,ad=new WeakMap,qc=new WeakSet,Ay=function(){var s;const n=((s=se(this,Zi))==null?void 0:s.state)??Kue();nt(this,Xf,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},OP=function(n){kr.batch(()=>{var s,r,i,a,o,l,u,d;if(se(this,ad)&&this.hasListeners()){const f=se(this,Xf).variables,p=se(this,Xf).context,m={client:se(this,id),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=se(this,ad)).onSuccess)==null||r.call(s,n.data,f,p,m)}catch(v){Promise.reject(v)}try{(a=(i=se(this,ad)).onSettled)==null||a.call(i,n.data,null,f,p,m)}catch(v){Promise.reject(v)}}else if((n==null?void 0:n.type)==="error"){try{(l=(o=se(this,ad)).onError)==null||l.call(o,n.error,f,p,m)}catch(v){Promise.reject(v)}try{(d=(u=se(this,ad)).onSettled)==null||d.call(u,void 0,n.error,f,p,m)}catch(v){Promise.reject(v)}}}
137this.listeners.forEach(f=>{f(se(this,Xf))})})},xre);function lY(t,e){const n=new Set(e);return t.filter(s=>!n.has(s))}function K$e(t,e,n){const s=t.slice(0);return s[e]=n,s}var Ev,Ga,Cv,um,po,dm,G2,W2,q2,K2,ui,$P,FP,Yue,UP,BP,zP,yre,Y$e=(yre=class extends Jm{constructor(e,n,s){super();St(this,ui);St(this,Ev);St(this,Ga);St(this,Cv);St(this,um);St(this,po);St(this,dm);St(this,G2);St(this,W2);St(this,q2);St(this,K2,[]);nt(this,Ev,e),nt(this,um,s),nt(this,Cv,[]),nt(this,po,[]),nt(this,Ga,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&se(this,po).forEach(e=>{e.subscribe(n=>{Ft(this,ui,BP).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,se(this,po).forEach(e=>{e.destroy()})}setQueries(e,n){nt(this,Cv,e),nt(this,um,n),kr.batch(()=>{const s=se(this,po),r=Ft(this,ui,UP).call(this,se(this,Cv));r.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const i=r.map(f=>f.observer),a=i.map(f=>f.getCurrentResult()),o=s.length!==i.length,l=i.some((f,p)=>f!==s[p]),u=o||l,d=u?!0:a.some((f,p)=>{const m=se(this,Ga)[p];return!m||!n2(f,m)});!u&&!d||(u&&(nt(this,K2,r),nt(this,po,i)),nt(this,Ga,a),this.hasListeners()&&(u&&(lY(s,i).forEach(f=>{f.destroy()}),lY(i,s).forEach(f=>{f.subscribe(p=>{Ft(this,ui,BP).call(this,f,p)})})),Ft(this,ui,zP).call(this)))})}getCurrentResult(){return se(this,Ga)}getQueries(){return se(this,po).map(e=>e.getCurrentQuery())}getObservers(){return se(this,po)}getOptimisticResult(e,n){const s=Ft(this,ui,UP).call(this,e),r=s.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),i=s.map(a=>a.defaultedQueryOptions.queryHash);return[r,a=>Ft(this,ui,FP).call(this,a??r,n,i),()=>Ft(this,ui,$P).call(this,r,s)]}},Ev=new WeakMap,Ga=new WeakMap,Cv=new WeakMap,um=new WeakMap,po=new WeakMap,dm=new WeakMap,G2=new WeakMap,W2=new WeakMap,q2=new WeakMap,K2=new WeakMap,ui=new WeakSet,$P=function(e,n){const s=new Set;return n.map((r,i)=>{const a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,o=>
137{s.has(o)||(s.add(o),n.forEach(l=>{l.observer.trackProp(o)}))})})},FP=function(e,n,s){if(n){const r=se(this,q2),i=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((a,o)=>a!==r[o]));return(se(this,Ga)!==se(this,W2)||i||n!==se(this,G2))&&(nt(this,G2,n),nt(this,W2,se(this,Ga)),s!==void 0&&nt(this,q2,s),nt(this,dm,v7(se(this,dm),n(e)))),se(this,dm)}return e},Yue=function(){var e;return!((e=se(this,um))!=null&&e.combine)||se(this,po).some((n,s)=>{var r;return n.options.suspense&&((r=se(this,Ga)[s])==null?void 0:r.data)===void 0})},UP=function(e){const n=new Map;se(this,po).forEach(r=>{const i=r.options.queryHash;if(!i)return;const a=n.get(i);a?a.push(r):n.set(i,[r])});const s=[];return e.forEach(r=>{var o;const i=se(this,Ev).defaultQueryOptions(r),a=((o=n.get(i.queryHash))==null?void 0:o.shift())??new E4(se(this,Ev),i);s.push({defaultedQueryOptions:i,observer:a})}),s},BP=function(e,n){const s=se(this,po).indexOf(e);s!==-1&&(nt(this,Ga,K$e(se(this,Ga),s,n)),Ft(this,ui,zP).call(this))},zP=function(){var e;if(this.hasListeners()){const n=Ft(this,ui,Yue).call(this),s=se(this,dm),r=n?s:Ft(this,ui,FP).call(this,Ft(this,ui,$P).call(this,se(this,Ga),se(this,K2)),(e=se(this,um))==null?void 0:e.combine);(n||s!==r)&&kr.batch(()=>{this.listeners.forEach(i=>{i(se(this,Ga))})})}},yre),Pc,bre,Z$e=(bre=class extends Jm{constructor(e={}){super();St(this,Pc);this.config=e,nt(this,Pc,new Map)}build(e,n,s){const r=n.queryKey,i=n.queryHash??g7(r,n);let a=this.get(i);return a||(a=new B$e({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){se(this,Pc).has(e.queryHash)||(se(this,Pc).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=se(this,Pc).get(e.queryHash);n&&(e.destroy(),n===e&&se(this,Pc).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){kr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return se(this,Pc).get(e)}getAll(){return[...se(this,Pc).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>eY(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>eY(e,s)):n}notify(e){kr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){kr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){kr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Pc=new WeakMap,bre),mr,Qf,Jf,Tv,kv,eh,Rv,Av,Sre,X$e=(Sre=class{constructor(t={}){St(this,mr);St(this,Qf);St(this,Jf);St(this,Tv);St(this,kv);St(this,eh);St(this,Rv);St(this,Av);nt(this,mr,t.queryCache||new Z$e),nt(this,Qf,t.mutationCache||new W$e),nt(this,Jf,t.defaultOptions||{}),nt(this,Tv,new Map),nt(this,kv,new Map),nt(this,eh,0)}mount(){a_(this,eh)._++,se(this,eh)===1&&(nt(this,Rv,S7.subscribe(async t=>{t&&(await this.resumePausedMutations(),se(this,mr).onFocus())})),nt(this,Av,ak.subscribe(async t=>{t&&(await this.resumePausedMutations(),se(this,mr).onOnline())})))}unmount(){var t,e;a_(this,eh)._--,se(this,eh)===0&&((t=se(this,Rv))==null||t.call(this),nt(this,Rv,void 0),(e=se(this,Av))==null||e.call(this),nt(this,Av,void 0))}isFetching(t){return se(this,mr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return se(this,Qf).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=se(this,mr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=se(this,mr).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return se(this,mr).findAll(t).map(({queryKey:e,state:n})=>[e,n.data])}setQueryData(t,e,n){var a;const s=this.defaultQueryOptions({queryKey:t}),r=(a=se(this,mr).get(s.queryHash))==null?void 0:a.state.data,i=k$e(e,r);if(i!==void 0)return se(this,mr).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(t,e,n){return kr.batch(()=>se(this,mr).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=se(this,mr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=se(this,mr);kr.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=se(this,mr);return kr.batch(()=>{const s=n.findAll(t),r=new Set(s);
137return s.forEach(i=>{i.reset()}),this.refetchQueries({type:"active",predicate:i=>r.has(i)},e)})}cancelQueries(t,e={}){const n={revert:!0,...e},s=kr.batch(()=>se(this,mr).findAll(t).map(r=>r.cancel(n)));return Promise.all(s).then(Ji).catch(Ji)}invalidateQueries(t,e={}){return kr.batch(()=>(se(this,mr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},s=kr.batch(()=>se(this,mr).findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ji)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(Ji)}async query(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=se(this,mr).build(this,e),s=n.isStaleByTime(xd(e.staleTime,n))?await n.fetch(e):n.state.data,r=e.select;return r?r(s):s}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=se(this,mr).build(this,e);return n.isStaleByTime(xd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ji).catch(Ji)}infiniteQuery(t){return t._type="infinite",this.query(t)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ji).catch(Ji)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ak.isOnline()?se(this,Qf).resumePausedMutations():Promise.resolve()}getQueryCache(){return se(this,mr)}getMutationCache(){return se(this,Qf)}getDefaultOptions(){return se(this,Jf)}setDefaultOptions(t){nt(this,Jf,t)}setQueryDefaults(t,e){se(this,Tv).set(Lm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...se(this,Tv).values()],n={};return e.forEach(s=>{Hv(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){se(this,kv).set(Lm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...se(this,kv).values()],n={};return e.forEach(s=>{Hv(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...se(this,Jf).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=g7(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===x7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...se(this,Jf).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){se(this,mr).clear(),se(this,Qf).clear()}},mr=new WeakMap,Qf=new WeakMap,Jf=new WeakMap,Tv=new WeakMap,kv=new WeakMap,eh=new WeakMap,Rv=new WeakMap,Av=new WeakMap,Sre);const Zue=w.createContext(!1),Xue=()=>w.useContext(Zue);Zue.Provider;function Q$e(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const J$e=w.createContext(Q$e()),Que=()=>w.useContext(J$e),Jue=(t,e,n)=>{const s=n!=null&&n.state.error&&typeof t.throwOnError=="function"?y7(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||s)&&(e.isReset()||(t.retryOnMount=!1))},ede=t=>{w.useEffect(()=>{t.clearReset()},[t])},tde=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(r&&t.data===void 0||y7(n,[t.error,s])),nde=t=>{if(t.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},VP=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sde=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function eFe({queries:t,...e},n){const s=aa(),r=Xue(),i=Que(),a=e.subscribed!==!1,o=w.useMemo(()=>t.map(x=>{const y=s.defaultQueryOptions(x);return y._optimisticResults=r?"isRestoring":a?"optimistic":void 0,y}),[t,s,r,a]);o.forEach(x=>{nde(x);const y=s.getQueryCache().get(x.queryHash);Jue(x,i,y)}),ede(i);const[l]=w.useState(()=>new Y$e(s,o,e)),[u,d,f]=l.getOptimisticResult(o,e.combine),p=!r&&a;
137w.useSyncExternalStore(w.useCallback(x=>p?l.subscribe(kr.batchCalls(x)):Ji,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setQueries(o,e)},[o,e,l]);const m=u.some((x,y)=>VP(o[y],x))?u.flatMap((x,y)=>{const S=o[y];if(S&&VP(S,x)){const _=new E4(s,S);return sde(S,_,i)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=u.find((x,y)=>{const S=o[y];return S&&tde({result:x,errorResetBoundary:i,throwOnError:S.throwOnError,query:s.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(v!=null&&v.error)throw v.error;return d(f())}function rde(t,e,n){const s=Xue(),r=Que(),i=aa(),a=i.defaultQueryOptions(t),o=i.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=s?"isRestoring":l?"optimistic":void 0,nde(a),Jue(a,r,o),ede(r);const[u]=w.useState(()=>new e(i,a)),d=u.getOptimisticResult(a),f=!s&&l;if(w.useSyncExternalStore(w.useCallback(p=>{const m=f?u.subscribe(kr.batchCalls(p)):Ji;return u.updateResult(),m},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(a)},[a,u]),VP(a,d))throw sde(a,u,r);if(tde({result:d,errorResetBoundary:r,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:u.trackResult(d)}function rs(t,e){return rde(t,E4)}function Bi(t,e){const n=aa(),[s]=w.useState(()=>new q$e(n,t));w.useEffect(()=>{s.setOptions(t)},[s,t]);const r=w.useSyncExternalStore(w.useCallback(a=>s.subscribe(kr.batchCalls(a)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=w.useCallback((...a)=>{s.mutate(a[0],a[1]).catch(Ji)},[s]);if(r.error&&y7(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}function tFe(t,e){return rde(t,H$e)}class ide extends Error{constructor(n,s){super(n);js(this,"status");this.name="ComputerRequestError",this.status=s}}function z1t(t){return t instanceof ide&&t.status===404}function oa(t,e){var n;if(t.error||t.data===void 0){const s=(n=t.response)==null?void 0:n.status,r=typeof t.error=="object"&&t.error&&"message"in t.error?String(t.error.message):void 0;throw new ide(r??(s?`${e} failed (${s})`:`${e} failed`),s)}return t.data}const la=t=>({Authorization:`Bearer ${t}`});function ade(t){return t?t.computerLimit>0||t.computerCount>0:!1}async function nFe(t){const e=await ht.get({url:"/v1/computers/quota",headers:la(t)});return oa(e,"Loading the computer quota")}async function V1t(t){const e=await ht.get({url:"/v1/computers",headers:la(t)});return oa(e,"Listing computers").computers}async function H1t(t,e){const n=await ht.get({url:"/v1/computers/{id}",path:{id:e},headers:la(t)});return oa(n,"Loading the computer")}async function G1t(t,e){const n=await ht.post({url:"/v1/computers",headers:la(t),body:e});return oa(n,"Creating the computer")}async function W1t(t,e){const n=await ht.post({url:"/v1/computers/{id}/pause",path:{id:e},headers:la(t)});return oa(n,"Pausing the computer")}async function q1t(t,e){const n=await ht.post({url:"/v1/computers/{id}/resume",path:{id:e},headers:la(t)});return oa(n,"Resuming the computer")}async function K1t(t,e){const n=await ht.delete({url:"/v1/computers/{id}",path:{id:e},headers:la(t)});return oa(n,"Deleting the computer")}async function Y1t(t){const e=await ht.get({url:"/v1/checkpoints",headers:la(t)});return oa(e,"Listing checkpoints").checkpoints}async function Z1t(t,e){const n=await ht.get({url:"/v1/checkpoints/{id}",path:{id:e},headers:la(t)});return oa(n,"Loading the checkpoint")}async function X1t(t,e,n){const s=await ht.post({url:"/v1/computers/{id}/checkpoints",path:{id:e},headers:la(t),body:n});return oa(s,"Creating the checkpoint")}async function Q1t(t,e,n){const s=await ht.post({url:"/v1/checkpoints/{id}/computers",path:{id:e},headers:la(t),body:n});return oa(s,"Creating the computer")}async function J1t(t,e){const n=await ht.delete({url:"/v1/checkpoints/{id}",path:{id:e},headers:la(t)});return oa(n,"Deleting the checkpoint")}async function ext(t,e){const n=await ht.post({url:"/v1/computers/{id}/attach-token",path:{id:e},headers:la(t)});return oa(n,"Minting a terminal token")}async function txt(t,e){const n=await ht.get({url:"/v1/computers/{i
137d}/desktop/stream",path:{id:e},headers:la(t)});return oa(n,"Loading the desktop stream")}async function nxt(t,e){const n=await ht.post({url:"/v1/computers/{id}/desktop/stream",path:{id:e},headers:la(t)});return oa(n,"Starting the desktop stream")}async function sxt(t,e){var s;const n=await ht.delete({url:"/v1/computers/{id}/desktop/stream",path:{id:e},headers:la(t)});(n.error||!((s=n.response)!=null&&s.ok))&&oa(n,"Stopping the desktop stream")}function rxt(t){return`${t.vcpu} vCPU · ${cY(t.memoryMib)} · ${cY(t.diskMib)} disk`}function cY(t){return t>=1024&&t%1024===0?`${t/1024} GiB`:`${t} MiB`}const sFe=6e4,rFe=1;function _7(){const{getToken:t,isLoaded:e,isSignedIn:n,orgId:s}=zt(),r=w.useCallback(async()=>{const i=await t();if(!i)throw new Error("Computers require an authenticated organization");return nFe(i)},[t]);return rs({queryKey:["computers",s,"quota"],queryFn:r,enabled:e&&!!(n&&s),staleTime:sFe,retry:rFe})}function iFe(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt();return t&&!!(e&&n)}function E7(){return ade(_7().data)}function aFe({children:t,redirectTo:e="/"}){const{isLoaded:n,isSignedIn:s,orgId:r}=zt(),i=_7();return n?!s||!r?c.jsx(il,{to:e,replace:!0}):i.isLoading?null:ade(i.data)?c.jsx(oFe,{children:t}):c.jsx(il,{to:e,replace:!0}):null}function oFe({children:t}){return c.jsx(p7e,{reducedMotion:"user",children:t})}function Vr(t,e){if(t==null)return{};var n={},s=Object.keys(t),r,i;for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&(n[r]=t[r]);return n}var lFe=["color"],ode=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,lFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M6.85355 3.14645C7.04882 3.34171 7.04882 3.65829 6.85355 3.85355L3.70711 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H3.70711L6.85355 11.1464C7.04882 11.3417 7.04882 11.6583 6.85355 11.8536C6.65829 12.0488 6.34171 12.0488 6.14645 11.8536L2.14645 7.85355C1.95118 7.65829 1.95118 7.34171 2.14645 7.14645L6.14645 3.14645C6.34171 2.95118 6.65829 2.95118 6.85355 3.14645Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),cFe=["color"],uFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,cFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M8.14645 3.14645C8.34171 2.95118 8.65829 2.95118 8.85355 3.14645L12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L8.85355 11.8536C8.65829 12.0488 8.34171 12.0488 8.14645 11.8536C7.95118 11.6583 7.95118 11.3417 8.14645 11.1464L11.2929 8H2.5C2.22386 8 2 7.77614 2 7.5C2 7.22386 2.22386 7 2.5 7H11.2929L8.14645 3.85355C7.95118 3.65829 7.95118 3.34171 8.14645 3.14645Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),dFe=["color"],fFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,dFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M4.5 1C4.77614 1 5 1.22386 5 1.5V2H10V1.5C10 1.22386 10.2239 1 10.5 1C10.7761 1 11 1.22386 11 1.5V2H12.5C13.3284 2 14 2.67157 14 3.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V3.5C1 2.67157 1.67157 2 2.5 2H4V1.5C4 1.22386 4.22386 1 4.5 1ZM10 3V3.5C10 3.77614 10.2239 4 10.5 4C10.7761 4 11 3.77614 11 3.5V3H12.5C12.7761 3 13 3.22386 13 3.5V5H2V3.5C2 3.22386 2.22386 3 2.5 3H4V3.5C4 3.77614 4.22386 4 4.5 4C4.77614 4 5 3.77614 5 3.5V3H10ZM2 6V12.5C2 12.7761 2.22386 13 2.5 13H12.5C12.7761 13 13 12.7761 13 12.5V6H2ZM7 7.5C7 7.22386 7.22386 7 7.5 7C7.77614 7 8 7.22386 8 7.5C8 7.77614 7.77614 8 7.5 8C7.22386 8 7 7.77614 7 7.5ZM9.5 7C9.22386 7 9 7.22386 9 7.5C9 7.77614 9.22386 8 9.5 8C9.77614 8 10 7.77614 10 7.5C10 7.22386 9.77614 7 9.5 7ZM11 7.5C11 7.22386 11.2239 7 11.5 7C11.7761 7 12 7.22386 12 7.5C12 7.77614 11.7761 8 11.5 8C11.2239 8 11 7.77614 11 7.5ZM11.5 9C11.2239 9 11 9.22386 11 9.5C11 9.77614 11.2239 10 11.5 10C11.7761 10 12 9.77614 12 9.5C12 9.22386 11.7761 9 11.5 9ZM9 9.5C9 9.22386 9.22386 9 9.5 9C9.77614 9 10 9.22386 10 9.5C10 9.77614 9.77614 10 9.5 10C9.22386 10 9 9.77614 9 9.5ZM7.5 9C7.22386 9 7 9.22386 7 9.5C7 9.77614 7.22386 10 7.5 10C7.77614 10 8 9.77614 8 9.5C8 9.22386 7.77614 9 7.5 9ZM5 9.5C5 9.22386 5.22386 9 5.5 9C5.77614 9 6 9.22386 6 9.5C6 9.77614 5.77614 10 5.5 10C5.22386 10 5 9.77614 5 9.5ZM3.5 9C3.22386 9 3 9.22386 3 9.5C3 9.77614 3.22386 10 3.5 10C3.77614 10 4 9.77614 4 9.5C4 9.22386 3.77614 9 3.5 9ZM3 11.5C3 11.2239 3.22386 11 3.5 11C3.77614 11 4 11.2239 4 11.5C4 11.7761 3.77614 12 3.5 12C3.22386 12 3 11.7761 3 11.5ZM5.5 11C5.22386 11 5 11.2239 5 11.5C5 11.7761 5.22386 12 5.5 12C5.77614 12 6 11.7761 6 11.5C6 11.2239 5.77614 11 5.5 11ZM7 11.5C7 11.2239 7.22386 11 7.5 11C7.77614 11 8 11.2239 8 11.5C8 11.7761 7.77614 12 7.5 12C7.22386 12 7 11.7761 7 11.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12C9.77614 12 10 11.7761 10 11.5C10 11.2239 9.77614 11 9.5 11Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),hFe=["color"],pFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,hFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M2 3.5C2 3.22386 2.22386 3 2.5 3H12.5C12.7761 3 13 3.22386 13 3.5V9.5C13 9.77614 12.7761 10 12.5 10H2.5C2.22386 10 2 9.77614 2 9.5V3.5ZM2 10.9146C1.4174 10.7087 1 10.1531 1 9.5V3.5C1 2.67157 1.67157 2 2.5 2H12.5C13.3284 2 14 2.67157 14 3.5V9.5C14 10.1531 13.5826 10.7087 13 10.9146V11.5C13 12.3284 12.3284 13 11.5 13H3.5C2.67157 13 2 12.3284 2 11.5V10.9146ZM12 11V11.5C12 11.7761 11.7761 12 11.5 12H3.5C3.22386 12 3 11.7761 3 11.5V11H12Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),mFe=["color"],lde=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,mFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819
137L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),gFe=["color"],cde=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,gFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),vFe=["color"],xFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,vFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M7.49991 0.877045C3.84222 0.877045 0.877075 3.84219 0.877075 7.49988C0.877075 11.1575 3.84222 14.1227 7.49991 14.1227C11.1576 14.1227 14.1227 11.1575 14.1227 7.49988C14.1227 3.84219 11.1576 0.877045 7.49991 0.877045ZM1.82708 7.49988C1.82708 4.36686 4.36689 1.82704 7.49991 1.82704C10.6329 1.82704 13.1727 4.36686 13.1727 7.49988C13.1727 10.6329 10.6329 13.1727 7.49991 13.1727C4.36689 13.1727 1.82708 10.6329 1.82708 7.49988ZM10.1589 5.53774C10.3178 5.31191 10.2636 5.00001 10.0378 4.84109C9.81194 4.68217 9.50004 4.73642 9.34112 4.96225L6.51977 8.97154L5.35681 7.78706C5.16334 7.59002 4.84677 7.58711 4.64973 7.78058C4.45268 7.97404 4.44978 8.29061 4.64325 8.48765L6.22658 10.1003C6.33054 10.2062 6.47617 10.2604 6.62407 10.2483C6.77197 10.2363 6.90686 10.1591 6.99226 10.0377L10.1589 5.53774Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),yFe=["color"],ude=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,yFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),bFe=["color"],dde=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,bFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),SFe=["color"],wFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,SFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M9.96424 2.68571C10.0668 2.42931 9.94209 2.13833 9.6857 2.03577C9.4293 1.93322 9.13832 2.05792 9.03576 2.31432L5.03576 12.3143C4.9332 12.5707 5.05791 12.8617 5.3143 12.9642C5.5707 13.0668 5.86168 12.9421 5.96424 12.6857L9.96424 2.68571ZM3.85355 5.14646C4.04882 5.34172 4.04882 5.6583 3.85355 5.85356L2.20711 7.50001L3.85355 9.14646C4.04882 9.34172 4.04882 9.6583 3.85355 9.85356C3.65829 10.0488 3.34171 10.0488 3.14645 9.85356L1.14645 7.85356C0.951184 7.6583 0.951184 7.34172 1.14645 7.14646L3.14645 5.14646C3.34171 4.9512 3.65829 4.9512 3.85355 5.14646ZM11.1464 5.14646C11.3417 4.9512 11.6583 4.9512 11.8536 5.14646L13.8536 7.14646C14.0488 7.34172 14.0488 7.6583 13.8536 7.85356L11.8536 9.85356C11.6583 10.0488 11.3417 10.0488 11.1464 9.85356C10.9512 9.6583 10.9512 9.34172 11.1464 9.14646L12.7929 7.50001L11.1464 5.85356C10.9512 5.6583 10.9512 5.34172 11.1464 5.14646Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),_Fe=["color"],C7=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,_Fe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),EFe=["color"],ok=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,EFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),CFe=["color"],TFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,CFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M8.625 2.5C8.625 3.12132 8.12132 3.625 7.5 3.625C6.87868 3.625 6.375 3.12132 6.375 2.5C6.375 1.87868 6.87868 1.375 7.5 1.375C8.12132 1.375 8.625 1.87868 8.625 2.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM7.5 13.625C8.12132 13.625 8.625 13.1213 8.625 12.5C8.625 11.8787 8.12132 11.375 7.5 11.375C6.87868 11.375 6.375 11.8787 6.375 12.5C6.375 13.1213 6.87868 13.625 7.5 13.625Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),kFe=["color"],T7=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,kFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.8
1371819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),RFe=["color"],k7=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,RFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),AFe=["color"],NFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,AFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M7.07095 0.650238C6.67391 0.650238 6.32977 0.925096 6.24198 1.31231L6.0039 2.36247C5.6249 2.47269 5.26335 2.62363 4.92436 2.81013L4.01335 2.23585C3.67748 2.02413 3.23978 2.07312 2.95903 2.35386L2.35294 2.95996C2.0722 3.2407 2.0232 3.6784 2.23493 4.01427L2.80942 4.92561C2.62307 5.2645 2.47227 5.62594 2.36216 6.00481L1.31209 6.24287C0.924883 6.33065 0.650024 6.6748 0.650024 7.07183V7.92897C0.650024 8.32601 0.924883 8.67015 1.31209 8.75794L2.36228 8.99603C2.47246 9.375 2.62335 9.73652 2.80979 10.0755L2.2354 10.9867C2.02367 11.3225 2.07267 11.7602 2.35341 12.041L2.95951 12.6471C3.24025 12.9278 3.67795 12.9768 4.01382 12.7651L4.92506 12.1907C5.26384 12.377 5.62516 12.5278 6.0039 12.6379L6.24198 13.6881C6.32977 14.0753 6.67391 14.3502 7.07095 14.3502H7.92809C8.32512 14.3502 8.66927 14.0753 8.75705 13.6881L8.99505 12.6383C9.37411 12.5282 9.73573 12.3773 10.0748 12.1909L10.986 12.7653C11.3218 12.977 11.7595 12.928 12.0403 12.6473L12.6464 12.0412C12.9271 11.7604 12.9761 11.3227 12.7644 10.9869L12.1902 10.076C12.3768 9.73688 12.5278 9.37515 12.638 8.99596L13.6879 8.75794C14.0751 8.67015 14.35 8.32601 14.35 7.92897V7.07183C14.35 6.6748 14.0751 6.33065 13.6879 6.24287L12.6381 6.00488C12.528 5.62578 12.3771 5.26414 12.1906 4.92507L12.7648 4.01407C12.9766 3.6782 12.9276 3.2405 12.6468 2.95975L12.0407 2.35366C11.76 2.07292 11.3223 2.02392 10.9864 2.23565L10.0755 2.80989C9.73622 2.62328 9.37437 2.47229 8.99505 2.36209L8.75705 1.31231C8.66927 0.925096 8.32512 0.650238 7.92809 0.650238H7.07095ZM4.92053 3.81251C5.44724 3.44339 6.05665 3.18424 6.71543 3.06839L7.07095 1.50024H7.92809L8.28355 3.06816C8.94267 3.18387 9.5524 3.44302 10.0794 3.81224L11.4397 2.9547L12.0458 3.56079L11.1882 4.92117C11.5573 5.44798 11.8164 6.0575 11.9321 6.71638L13.5 7.07183V7.92897L11.932 8.28444C11.8162 8.94342 11.557 9.55301 11.1878 10.0798L12.0453 11.4402L11.4392 12.0462L10.0787 11.1886C9.55192 11.5576 8.94241 11.8166 8.28355 11.9323L7.92809 13.5002H7.07095L6.71543 11.932C6.0569 11.8162 5.44772 11.5572 4.92116 11.1883L3.56055 12.046L2.95445 11.4399L3.81213 10.0794C3.4431 9.55266 3.18403 8.94326 3.06825 8.2845L1.50002 7.92897V7.07183L3.06818 6.71632C3.18388 6.05765 3.44283 5.44833 3.81171 4.92165L2.95398 3.561L3.56008 2.95491L4.92053 3.81251ZM9.02496 7.50008C9.02496 8.34226 8.34223 9.02499 7.50005 9.02499C6.65786 9.02499 5.97513 8.34226 5.97513 7.50008C5.97513 6.65789 6.65786 5.97516 7.50005 5.97516C8.34223 5.97516 9.02496 6.65789 9.02496 7.50008ZM9.92496 7.50008C9.92496 8.83932 8.83929 9.92499 7.50005 9.92499C6.1608 9.92499 5.07513 8.83932 5.07513 7.50008C5.07513 6.16084 6.1608 5.07516 7.50005 5.07516C8.83929 5.07516 9.92496 6.16084 9.92496 7.50008Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),IFe=["color"],LFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,IFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}
137),w.createElement("path",{d:"M7.07926 0.222253C7.31275 -0.007434 7.6873 -0.007434 7.92079 0.222253L14.6708 6.86227C14.907 7.09465 14.9101 7.47453 14.6778 7.71076C14.4454 7.947 14.0655 7.95012 13.8293 7.71773L13 6.90201V12.5C13 12.7761 12.7762 13 12.5 13H2.50002C2.22388 13 2.00002 12.7761 2.00002 12.5V6.90201L1.17079 7.71773C0.934558 7.95012 0.554672 7.947 0.32229 7.71076C0.0899079 7.47453 0.0930283 7.09465 0.32926 6.86227L7.07926 0.222253ZM7.50002 1.49163L12 5.91831V12H10V8.49999C10 8.22385 9.77617 7.99999 9.50002 7.99999H6.50002C6.22388 7.99999 6.00002 8.22385 6.00002 8.49999V12H3.00002V5.91831L7.50002 1.49163ZM7.00002 12H9.00002V8.99999H7.00002V12Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),jFe=["color"],PFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,jFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),MFe=["color"],DFe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,MFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),OFe=["color"],$Fe=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,OFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),FFe=["color"],HP=w.forwardRef(function(t,e){var n=t.color,s=n===void 0?"currentColor":n,r=Vr(t,FFe);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),w.createElement("path",{d:"M1.84998 7.49998C1.84998 4.66458 4.05979 1.84998 7.49998 1.84998C10.2783 1.84998 11.6515 3.9064 12.2367 5H10.5C10.2239 5 10 5.22386 10 5.5C10 5.77614 10.2239 6 10.5 6H13.5C13.7761 6 14 5.77614 14 5.5V2.5C14 2.22386 13.7761 2 13.5 2C13.2239 2 13 2.22386 13 2.5V4.31318C12.2955 3.07126 10.6659 0.849976 7.49998 0.849976C3.43716 0.849976 0.849976 4.18537 0.849976 7.49998C0.849976 10.8146 3.43716 14.15 7.49998 14.15C9.44382 
13714.15 11.0622 13.3808 12.2145 12.2084C12.8315 11.5806 13.3133 10.839 13.6418 10.0407C13.7469 9.78536 13.6251 9.49315 13.3698 9.38806C13.1144 9.28296 12.8222 9.40478 12.7171 9.66014C12.4363 10.3425 12.0251 10.9745 11.5013 11.5074C10.5295 12.4963 9.16504 13.15 7.49998 13.15C4.05979 13.15 1.84998 10.3354 1.84998 7.49998Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))}),UFe=Object.defineProperty,R7=(t,e)=>UFe(t,"name",{value:e,configurable:!0});function GP(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}R7(GP,"setRef");function fde(...t){return e=>{let n=!1;const s=t.map(r=>{const i=GP(r,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():GP(t[r],null)}}}}R7(fde,"composeRefs");function ps(...t){return w.useCallback(fde(...t),t)}R7(ps,"useComposedRefs");var BFe=Object.defineProperty,ac=(t,e)=>BFe(t,"name",{value:e,configurable:!0});function iu(t){const e=w.forwardRef((n,s)=>{let{children:r,...i}=n,a=null,o=!1;const l=[];WP(r)&&typeof U_=="function"&&(r=U_(r._payload)),w.Children.forEach(r,p=>{var m;if(vde(p)){o=!0;const v=p;let x="child"in v.props?v.props.child:v.props.children;WP(x)&&typeof U_=="function"&&(x=U_(x._payload)),a=zFe(v,x),l.push((m=a==null?void 0:a.props)==null?void 0:m.children)}else l.push(p)}),a?a=w.cloneElement(a,void 0,l):!o&&w.Children.count(r)===1&&w.isValidElement(r)&&(a=r);const u=a?gde(a):void 0,d=ps(s,u);if(!a){if(r||r===0)throw new Error(o?GFe(t):HFe(t));return r}const f=mde(i,a.props??{});return a.type!==w.Fragment&&(f.ref=s?d:u),w.cloneElement(a,f)});return e.displayName=`${t}.Slot`,e}ac(iu,"createSlot");var C4=iu("Slot"),hde=Symbol.for("radix.slottable");function pde(t){const e=ac(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=hde,e}ac(pde,"createSlottable");var zFe=ac((t,e)=>{if("child"in t.props){const n=t.props.child;return w.isValidElement(n)?w.cloneElement(n,void 0,t.props.children(n.props.children)):null}return w.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function mde(t,e){const n={...e};for(const s in e){const r=t[s],i=e[s];/^on[A-Z]/.test(s)?r&&i?n[s]=(...o)=>{const l=i(...o);return r(...o),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...i}:s==="className"&&(n[s]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}ac(mde,"mergeProps");function gde(t){var s,r;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}ac(gde,"getElementRef");function vde(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===hde}ac(vde,"isSlottable");var VFe=Symbol.for("react.lazy");function WP(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===VFe&&"_payload"in t&&xde(t._payload)}ac(WP,"isLazyComponent");function xde(t){return typeof t=="object"&&t!==null&&"then"in t}ac(xde,"isPromiseLike");var HFe=ac(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),GFe=ac(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),U_=x1[" use ".trim().toString()];function yde(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=yde(t[e]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function cs(){for(var t,e,n=0,s="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=yde(t))&&(s&&(s+=" "),s+=e);return s}const uY=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,dY=cs,A7=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return dY(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=e,a=Object.keys(r).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const p=uY(d)||uY(f);return r[u][p]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),l=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:p,...m}=d;return Object.entries(m).every(v=>{let[x,y]=v;return Array.isArray(y)?y.includes({...i,...o}[x]):{...i,...o}[x]===y})?[...u,f,p]:u},[]);return dY(t,a,l,n==null?void 0:n.class,n==null?void 0:n.className)},N7="-",WFe=t=>{const e=KFe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:a=>{const o=a.split(N7);return o[0]===""&&o.length!==1&&o.shift(),bde(o,e)||qFe(a)},getConflictingClassGroupIds:(a,o)=>{const l=n[a]||[];return o&&s[a]?[...l,...s[a]]:l}}},bde=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),r=s?bde(t.slice(1),s):void 0;if(r)return r;if(e.validators.length===0)return;const i=t.join(N7);return(a=e.validators.find(({validator:o})=>o(i)))==null?void 0:a.classGroupId},fY=/^\[(.+)\]$/,qFe=t=>{if(fY.test(t)){const e=fY.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},KFe=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};
vendor: 5,192 bytes, line 137
137return ZFe(Object.entries(t.classGroups),n).forEach(([i,a])=>{qP(a,s,i,e)}),s},qP=(t,e,n,s)=>{t.forEach(r=>{if(typeof r=="string"){const i=r===""?e:hY(e,r);i.classGroupId=n;return}if(typeof r=="function"){if(YFe(r)){qP(r(s),e,n,s);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,a])=>{qP(a,hY(e,i),n,s)})})},hY=(t,e)=>{let n=t;return e.split(N7).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},YFe=t=>t.isThemeGetter,ZFe=(t,e)=>e?t.map(([n,s])=>{const r=s.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,o])=>[e+a,o])):i);return[n,r]}):t,XFe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,s=new Map;const r=(i,a)=>{n.set(i,a),e++,e>t&&(e=0,s=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=s.get(i))!==void 0)return r(i,a),a},set(i,a){n.has(i)?n.set(i,a):r(i,a)}}},Sde="!",QFe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,r=e[0],i=e.length,a=o=>{const l=[];let u=0,d=0,f;for(let y=0;y<o.length;y++){let S=o[y];if(u===0){if(S===r&&(s||o.slice(y,y+i)===e)){l.push(o.slice(d,y)),d=y+i;continue}if(S==="/"){f=y;continue}}S==="["?u++:S==="]"&&u--}const p=l.length===0?o:o.substring(d),m=p.startsWith(Sde),v=m?p.substring(1):p,x=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:x}};return n?o=>n({className:o,parseClassName:a}):a},JFe=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(s=>{s[0]==="["?(e.push(...n.sort(),s),n=[]):n.push(s)}),e.push(...n.sort()),e},eUe=t=>({cache:XFe(t.cacheSize),parseClassName:QFe(t),...WFe(t)}),tUe=/\s+/,nUe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r}=e,i=[],a=t.trim().split(tUe);let o="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(u);let v=!!m,x=s(v?p.substring(0,m):p);if(!x){if(!v){o=u+(o.length>0?" "+o:o);continue}if(x=s(p),!x){o=u+(o.length>0?" "+o:o);continue}v=!1}const y=JFe(d).join(":"),S=f?y+Sde:y,_=S+x;if(i.includes(_))continue;i.push(_);const E=r(x,v);for(let T=0;T<E.length;++T){const k=E[T];i.push(S+k)}o=u+(o.length>0?" "+o:o)}return o};function sUe(){let t=0,e,n,s="";for(;t<arguments.length;)(e=arguments[t++])&&(n=wde(e))&&(s&&(s+=" "),s+=n);return s}const wde=t=>{if(typeof t=="string")return t;let e,n="";for(let s=0;s<t.length;s++)t[s]&&(e=wde(t[s]))&&(n&&(n+=" "),n+=e);return n};function rUe(t,...e){let n,s,r,i=a;function a(l){const u=e.reduce((d,f)=>f(d),t());return n=eUe(u),s=n.cache.get,r=n.cache.set,i=o,o(l)}function o(l){const u=s(l);if(u)return u;const d=nUe(l,n);return r(l,d),d}return function(){return i(sUe.apply(null,arguments))}}const Ys=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},_de=/^\[(?:([a-z-]+):)?(.+)\]$/i,iUe=/^\d+\/\d+$/,aUe=new Set(["px","full","screen"]),oUe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lUe=/\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$/,cUe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uUe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dUe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mu=t=>Z0(t)||aUe.has(t)||iUe.test(t),df=t=>M1(t,"length",yUe),Z0=t=>!!t&&!Number.isNaN(Number(t)),c6=t=>M1(t,"number",Z0),Xx=t=>!!t&&Number.isInteger(Number(t)),fUe=t=>t.endsWith("%")&&Z0(t.slice(0,-1)),vn=t=>_de.test(t),ff=t=>oUe.test(t),hUe=new Set(["length","size","percentage"]),pUe=t=>M1(t,hUe,Ede),mUe=t=>M1(t,"position",Ede),gUe=new Set(["image","url"]),vUe=t=>M1(t,gUe,SUe),xUe=t=>M1(t,"",bUe),Qx=()=>!0,M1=(t,e,n)=>{const s=_de.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},yUe=t=>lUe.test(t)&&!cUe.test(t),Ede=()=>!1,bUe=t=>uUe.test(t),SUe=t=>dUe.test(t),wUe=()=>{const t=Ys("colors"),e=Ys("spacing"),n=Ys("blur"),s=Ys("brightness"),r=Ys("borderColor"),i=Ys("borderRadius"),a=Ys("borderSpacing"),o=Ys("borderWidth"),l=Ys("contrast"),u=Ys("grayscale"),d=Ys("hueRotate"),f=Ys("invert"),p=Ys("gap"),m=Ys("gradientColorStops"),v=Ys("gradientColorStopPositions"),x=Ys("inset"),y=Ys("margin"),S=Ys("opacity"),_=Ys("padding"),E=Ys("saturate"),T=Ys("scale"),k=Ys("sepia"),R=Ys("skew"),I=Ys("space"),A=Ys("translate"),L=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",vn,e],O=()=>[vn,e],M=()=>["",Mu,df],U=()=>["auto",Z0,vn],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",vn],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[Z0,vn];return{cacheSize:500,separator:":",theme:{colors:[Qx],spacing:[Mu,df],blur:["none","",ff,vn],brightness:D(),borderColor:[t],borderRadius:["n
137one","","full",ff,vn],borderSpacing:O(),borderWidth:M(),contrast:D(),grayscale:q(),hueRotate:D(),invert:q(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[fUe,df],inset:F(),margin:F(),opacity:D(),padding:O(),saturate:D(),scale:D(),sepia:q(),skew:D(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",vn]}],container:["container"],columns:[{columns:[ff]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),vn]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xx,vn]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",vn]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",Xx,vn]}],"grid-cols":[{"grid-cols":[Qx]}],"col-start-end":[{col:["auto",{span:["full",Xx,vn]},vn]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[Qx]}],"row-start-end":[{row:["auto",{span:[Xx,vn]},vn]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",vn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",vn]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",vn,e]}],"min-w":[{"min-w":[vn,e,"min","max","fit"]}],"max-w":[{"max-w":[vn,e,"none","full","min","max","fit","prose",{screen:[ff]},ff]}],h:[{h:[vn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[vn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[vn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[vn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ff,df]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",c6]}],"font-family":[{font:[Qx]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",vn]}],"line-clamp":[{"line-clamp":["none",Z0,c6]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Mu,vn]}],"list-image":[{"list-image":["none",vn]}],"list-style-type":[{list:["none","disc","decimal",vn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Mu,df]}],"underline-offset":[{"underline-offset":["auto",Mu,vn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",vn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),mUe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pUe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vUe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}
137],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}
vendor: 4,468 bytes, line 137
137],"divide-style":[{divide:$()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[Mu,vn]}],"outline-w":[{outline:[Mu,df]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[Mu,df]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ff,xUe]}],"shadow-color":[{shadow:[Qx]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ff,vn]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",vn]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",vn]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",vn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Xx,vn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",vn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",vn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",vn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Mu,df,c6]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
137none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},_Ue=rUe(wUe);function He(...t){return _Ue(cs(t))}const EUe=A7("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",tertiary:"bg-[var(--sand-2)] hover:bg-[var(--sand-3)] active:bg-[var(--sand-2)] border border-[var(--sand-6)] hover:border-[var(--sand-7)] active:border-[var(--sand-6)] text-[var(--sand-12)] dark:bg-dark-gray-1 dark:hover:bg-dark-gray-2 dark:active:bg-dark-gray-1 dark:border-dark-gray-3 dark:hover:border-dark-gray-4 dark:active:border-dark-gray-3 dark:text-white rounded-lg"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Zt=w.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...r},i)=>{const a=s?C4:"button";return c.jsx(a,{className:He(EUe({variant:e,size:n,className:t})),ref:i,...r})});Zt.displayName="Button";const TS=w.forwardRef(({className:t,...e},n)=>c.jsx("div",{ref:n,className:He("rounded-xl border bg-card text-card-foreground shadow",t),...e}));TS.displayName="Card";const T4=w.forwardRef(({className:t,...e},n)=>c.jsx("div",{ref:n,className:He("flex flex-col space-y-1.5 p-6",t),...e}));T4.displayName="CardHeader";const k4=w.forwardRef(({className:t,...e},n)=>c.jsx("h3",{ref:n,className:He("font-semibold leading-none tracking-tight",t),...e}));
137k4.displayName="CardTitle";const R4=w.forwardRef(({className:t,...e},n)=>c.jsx("p",{ref:n,className:He("text-sm text-muted-foreground",t),...e}));R4.displayName="CardDescription";const A4=w.forwardRef(({className:t,...e},n)=>c.jsx("div",{ref:n,className:He("p-6 pt-0",t),...e}));A4.displayName="CardContent";const Cde=w.forwardRef(({className:t,...e},n)=>c.jsx("div",{ref:n,className:He("flex items-center p-6 pt-0",t),...e}));Cde.displayName="CardFooter";class Sm extends w.Component{constructor(n){super(n);js(this,"handleReload",()=>{window.location.reload()});js(this,"handleGoHome",()=>{window.location.href="/"});js(this,"handleReportFeedback",()=>{this.state.eventId&&F3e({eventId:this.state.eventId})});js(this,"resetErrorBoundary",()=>{this.setState({hasError:!1,error:null,errorInfo:null,eventId:null})});js(this,"handleCustomReload",()=>{this.props.onReload&&(this.props.onReload(),this.resetErrorBoundary())});this.state={hasError:!1,error:null,errorInfo:null,eventId:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){const{context:r,onError:i}=this.props,a=Xie(n,{contexts:{react:{componentStack:s.componentStack},errorBoundary:{level:this.props.level||"component",context:r||"unknown"}},tags:{errorBoundary:!0,level:this.props.level||"component"}});this.setState({errorInfo:s,eventId:a}),i&&i(n,s)}render(){const{hasError:n,error:s,errorInfo:r,eventId:i}=this.state,{children:a,fallback:o,level:l="component",showDetails:u=!1}=this.props;if(n){if(o)return o;const d=l==="page",f=l==="section";return c.jsx("div",{className:He("flex items-center justify-center p-4",d&&"bg-background",f&&"min-h-[400px]",!d&&!f&&"min-h-[200px]"),children:c.jsxs(TS,{className:He("w-full max-w-2xl",d&&"shadow-lg"),children:[c.jsxs(T4,{className:"text-center",children:[c.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10",children:c.jsx(k7,{className:"h-8 w-8 text-destructive"})}),c.jsx(k4,{className:"text-xl",children:d?"Something went wrong":"Error occurred"}),c.jsx(R4,{children:d?"We encountered an unexpected error. Our team has been notified.":"This section encountered an error and couldn't load properly."})]}),c.jsxs(A4,{className:"space-y-4",children:[u&&s&&c.jsxs("div",{className:"rounded-md bg-muted p-4",children:[c.jsx("h4",{className:"mb-2 font-medium text-sm",children:"Error Details:"}),c.jsx("code",{className:"text-xs text-muted-foreground break-all",children:s.message}),!1]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-center",children:[c.jsxs(Zt,{onClick:this.props.onReload?this.handleCustomReload:this.handleReload,variant:"default",className:"flex items-center gap-2",children:[c.jsx(HP,{className:"h-4 w-4"}),"Try Again"]}),d&&c.jsxs(Zt,{onClick:this.handleGoHome,variant:"outline",className:"flex items-center gap-2",children:[c.jsx(LFe,{className:"h-4 w-4"}),"Go Home"]}),i&&c.jsx(Zt,{onClick:this.handleReportFeedback,variant:"ghost",size:"sm",className:"text-muted-foreground",children:"Report Issue"})]}),i&&c.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:["Error ID: ",i]})]})]})})}return a}}const Fn=({children:t,routeName:e})=>{const n=Gs(),s=(r,i)=>{V5("route",{pathname:n.pathname,search:n.search,hash:n.hash,state:n.state,routeName:e||"unknown"}),tu({category:"navigation",message:`Error occurred on route: ${n.pathname}`,level:"error",data:{routeName:e,pathname:n.pathname}})};return c.jsx(Sm,{level:"page",context:`route:${e||n.pathname}`,showDetails:!1,onError:s,children:t})},u6=({children:t,sessionId:e,context:n="session"})=>{const s=M5(),{organization:r}=Mo(),{user:i}=Vi(),a=e||s.id,o=(l,u)=>{var d,f;V5("session",{sessionId:a,organizationId:r==null?void 0:r.id,userId:i==null?void 0:i.id,context:n}),Jie({id:(i==null?void 0:i.id)||void 0,email:(f=(d=i==null?void 0:i.emailAddresses)==null?void 0:d[0])==null?void 0:f.emailAddress,username:(i==null?void 0:i.username)||(i==null?void 0:i.firstName)||void 0}),tu({category:"session",message:`Session error in ${n}`,level:"error",data:{sessionId:a,organizationId:r==null?void 0:r.id,context:n}})};return c.jsx(Sm,{level:"section",context:`session:${a}:${n}
137`,showDetails:!1,onError:o,children:t})},pY=({children:t,context:e="subscription",planName:n,subscriptionId:s,customerId:r,amount:i,currency:a="USD"})=>{const[o,l]=Po(),{organization:u}=Mo(),{user:d}=Vi(),f=o.get("success")==="true",p=o.get("cancelled")==="true",m=o.get("incoming_plan"),v=o.get("session_id"),x=o.get("payment_intent"),y=S=>{var _,E;V5("subscription",{context:e,planName:n||m,subscriptionId:s,customerId:r,amount:i,currency:a,isSuccess:f,isCancelled:p,sessionId:v,paymentIntentId:x,organizationId:u==null?void 0:u.id,userId:d==null?void 0:d.id,urlParams:Object.fromEntries(o.entries())}),Jie({id:(d==null?void 0:d.id)||void 0,email:(E=(_=d==null?void 0:d.emailAddresses)==null?void 0:_[0])==null?void 0:E.emailAddress,username:(d==null?void 0:d.username)||(d==null?void 0:d.firstName)||void 0}),tu({category:"subscription",message:`Subscription error in ${e}`,level:"error",data:{context:e,planName:n||m,subscriptionId:s,organizationId:u==null?void 0:u.id,errorMessage:S.message,isSuccess:f,isCancelled:p}}),nke({subscriptionError:!0,subscriptionContext:e,planName:n||m||"unknown",subscriptionFlow:f?"success":p?"cancelled":"unknown"}),z5(T=>{T.setFingerprint(["subscription-error",e,n||m||"unknown",S.name])})};return c.jsx(Sm,{level:"section",context:`subscription:${e}${n?`:${n}`:""}`,showDetails:!1,onReload:()=>{console.log("onReload running bitches"),console.log("Clearing search params:",Object.fromEntries(o.entries())),l(new URLSearchParams),console.log("Search params cleared, error boundary should reset")},onError:y,children:t})},CUe=(t,e)=>["feature-flag",e,t];class mY extends Error{constructor(e){super(e),this.name="FeatureFlagAuthError"}}function TUe(t,e){const n=e?`Failed to fetch feature flag (${e})`:"Failed to fetch feature flag";return typeof t=="object"&&t&&"message"in t?`${n}: ${String(t.message)}`:typeof t=="string"?`${n}: ${t}`:n}function I7(t,e={}){const{getToken:n,isLoaded:s,isSignedIn:r,orgId:i}=zt(),a=w.useCallback(async()=>{var d;if(!await n()||!i)throw new mY("Feature flags require an authenticated organization");const u=await ht.get({url:"/v1/feature-flags/{featureName}",path:{featureName:t}});if(u.error)throw new Error(TUe(u.error,(d=u.response)==null?void 0:d.status));if(!u.data)throw new Error("No data returned from feature flag endpoint");return u.data},[t,n,i]),o={queryKey:CUe(t,i),queryFn:a,enabled:(e.enabled??!0)&&s&&!!(r&&i&&t),retry:(l,u)=>!(u instanceof mY),staleTime:e.staleTime??6e4};return rs(o)}function N4(t,e={}){var s;return((s=I7(t,e).data)==null?void 0:s.isEnabled)??e.defaultEnabled??!1}function B_({flag:t,children:e,redirectTo:n="/"}){var o;const{isLoaded:s,isSignedIn:r,orgId:i}=zt(),a=I7(t);return s?!r||!i?c.jsx(il,{to:n,replace:!0}):a.isLoading?null:(o=a.data)!=null&&o.isEnabled?c.jsx(c.Fragment,{children:e}):c.jsx(il,{to:n,replace:!0}):null}const kUe={theme:"system",resolvedTheme:"dark",setTheme:()=>null},Tde=w.createContext(kUe),kde="(prefers-color-scheme: dark)";function RUe(t){try{const e=localStorage.getItem(t);return e==="dark"||e==="light"||e==="system"?e:null}catch{return null}}function AUe(){return window.matchMedia(kde).matches?"dark":"light"}function NUe({children:t,defaultTheme:e="system",storageKey:n="steel-ui-theme",...s}){const[r,i]=w.useState(()=>RUe(n)??e),[a,o]=w.useState(AUe),l=r==="system"?a:r;w.useEffect(()=>{const f=window.matchMedia(kde),p=()=>o(f.matches?"dark":"light");return f.addEventListener("change",p),()=>f.removeEventListener("change",p)},[]),w.useEffect(()=>{const f=window.document.documentElement;f.classList.remove("light","dark"),f.classList.add(l),f.style.colorScheme=l},[l]);const u=w.useCallback(f=>{try{localStorage.setItem(n,f)}catch{}i(f)},[n]),d=w.useMemo(()=>({theme:r,resolvedTheme:l,setTheme:u}),[r,l,u]);return c.jsx(Tde,{...s,value:d,children:t})}const I4=()=>{const t=w.useContext(Tde);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};var d6={exports:{}};const D1=t=>({...t,__type:"prebuilt_appearance"}),IUe=Object.freeze(Object.defineProperty({__proto__:null,experimental_createTheme:D1},Symbol.toStringTag,{value:"Module"}
137)),LUe=wre(IUe),Rde=D1({name:"dark",variables:{colorBackground:"#212126",colorNeutral:"white",colorPrimary:"#ffffff",colorPrimaryForeground:"black",colorForeground:"white",colorInputForeground:"white",colorInput:"#26262B"},elements:{providerIcon__apple:{filter:"invert(1)"},providerIcon__github:{filter:"invert(1)"},providerIcon__okx_wallet:{filter:"invert(1)"},providerIcon__vercel:{filter:"invert(1)"},activeDeviceIcon:{"--cl-chassis-bottom":"#d2d2d2","--cl-chassis-back":"#e6e6e6","--cl-chassis-screen":"#e6e6e6","--cl-screen":"#111111"}}}),jUe=D1({name:"shadesOfPurple",baseTheme:Rde,variables:{colorBackground:"#3f3c77",colorPrimary:"#f8d80d",colorPrimaryForeground:"#38375f",colorInputForeground:"#a1fdfe",colorShimmer:"rgba(161,253,254,0.36)"}}),hf={boxShadow:"3px 3px 0px #000",border:"2px solid #000","&:focus":{boxShadow:"4px 4px 0px #000",border:"2px solid #000",transform:"scale(1.01)"},"&:active":{boxShadow:"2px 2px 0px #000",transform:"translate(1px)"}},gp={boxShadow:"3px 3px 0px #000",border:"2px solid #000"},PUe=D1({name:"neobrutalism",simpleStyles:!0,variables:{colorPrimary:"#DF1B1B",colorShimmer:"rgba(255,255,255,0.64)",fontWeight:{normal:500,medium:600,bold:700}},elements:{cardBox:{boxShadow:"7px 7px 0px #000",border:"3px solid #000"},card:{borderRadius:"0"},headerSubtitle:{color:"#212126"},alternativeMethodsBlockButton:hf,socialButtonsIconButton:{...hf},selectButton:{...hf,...gp,transition:"all 0.2s ease-in-out","&:focus":{boxShadow:"4px 4px 0px #000",border:"2px solid #000",transform:"scale(1.01)"}},socialButtonsBlockButton:{...hf,color:"#212126"},profileSectionPrimaryButton:hf,profileSectionItem:{color:"#212126"},avatarImageActionsUpload:hf,menuButton:gp,menuList:gp,formButtonPrimary:hf,navbarButton:hf,formFieldAction:{fontWeight:"700"},formFieldInput:{...gp,transition:"all 0.2s ease-in-out","&:focus":{boxShadow:"4px 4px 0px #000",border:"2px solid #000",transform:"scale(1.01)"},"&:hover":{...gp,transform:"scale(1.01)"}},table:gp,tableHead:{color:"#212126"},dividerLine:{background:"#000"},dividerText:{fontWeight:"700",color:"#212126"},footer:{background:"#fff","& div":{color:"#212126"}},footerActionText:{color:"#212126"},footerActionLink:{fontWeight:"700",borderBottom:"3px solid","&:focus":{boxShadow:"none"}},actionCard:{...gp},badge:{border:"1px solid #000",background:"#fff",color:"#212126"}}}),MUe=D1({name:"shadcn",cssLayerName:"components",variables:{colorBackground:"var(--card)",colorDanger:"var(--destructive)",colorForeground:"var(--card-foreground)",colorInput:"var(--input)",colorInputForeground:"var(--card-foreground)",colorModalBackdrop:"var(--color-black)",colorMuted:"var(--muted)",colorMutedForeground:"var(--muted-foreground)",colorNeutral:"var(--foreground)",colorPrimary:"var(--primary)",colorPrimaryForeground:"var(--primary-foreground)",colorRing:"var(--ring)",fontWeight:{normal:"var(--font-weight-normal)",medium:"var(--font-weight-medium)",semibold:"var(--font-weight-semibold)",bold:"var(--font-weight-semibold)"}},elements:{input:"bg-transparent dark:bg-input/30",cardBox:"shadow-sm border",popoverBox:"shadow-sm border",button:{'&[data-variant="solid"]::after':{display:"none"}},providerIcon__apple:"dark:invert",providerIcon__github:"dark:invert",providerIcon__okx_wallet:"dark:invert",providerIcon__vercel:"dark:invert"}}),DUe=D1({name:"simple",simpleStyles:!0}),OUe=Object.freeze(Object.defineProperty({__proto__:null,dark:Rde,experimental__simple:DUe,neobrutalism:PUe,shadcn:MUe,shadesOfPurple:jUe},Symbol.toStringTag,{value:"Module"})),$Ue=wre(OUe);var gY;function FUe(){return gY||(gY=1,(function(t){var e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(u,d,f,p)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of s(d))!r.call(u,m)&&m!==f&&e(u,m,{get:()=>d[m],enumerable:!(p=n(d,m))||p.enumerable});return u},a=(u,d,f)=>(i(u,d,"default"),f&&i(f,d,"default")),o=u=>i(e({},"__esModule",{value:!0}),u),l={};t.exports=o(l),a(l,LUe,t.exports),a(l,$Ue,t.exports)})(d6)),d6.exports}var UUe=FUe();const BUe="pk_live_Y2xlcmsuc3RlZWwuZGV2JA",zUe={signIn:{start:{title:"Sign in to Steel®"}},socialButtonsBlockButton:"Sign in with {{provider|titleize}}",socialButtonsBlockButtonManyInView:"Sign in with {{provider|titleize}}"},vY={variables:{colorPrimary:"#f76a15"},elements:{formButtonPrimary:{color:"#FFFFFF !important"}}},VUe={dark:{...vY,baseTheme:UUe.dark},light:vY};function HUe({children:t}){const{resolvedTheme:e}=I4();return c.jsx(Qle,{publishableKey:BUe,localization:zUe,appearance:VUe[e],children:t})}const Ade=!0,GUe=w.createContext(void 0);function WUe({children:t}){const n={loadingBarRef:w.useRef(null)};return c.jsx(GUe,{value:n,children:t})}function qUe(){return c.jsx("div",{className:"flex flex-1 h-full py-[150px] justify-center items-center",children:c.jsx(UPe,{afterCreateOrganizationUrl:"/quickstart"})})}const xY=t=>{let e;const n=new Set,s=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const p=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({}
137,e,f),n.forEach(m=>m(e,p))}},r=()=>e,o={setState:s,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=e=t(s,r,o);return o},KUe=(t=>t?xY(t):xY),YUe=t=>t;function ZUe(t,e=YUe){const n=re.useSyncExternalStore(t.subscribe,re.useCallback(()=>e(t.getState()),[t,e]),re.useCallback(()=>e(t.getInitialState()),[t,e]));return re.useDebugValue(n),n}const yY=t=>{const e=KUe(t),n=s=>ZUe(e,s);return Object.assign(n,e),n},L7=(t=>t?yY(t):yY);function XUe(t,e){let n;try{n=t()}catch{return}return{getItem:r=>{var i;const a=l=>l===null?null:JSON.parse(l,void 0),o=(i=n.getItem(r))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(r,i)=>n.setItem(r,JSON.stringify(i,void 0)),removeItem:r=>n.removeItem(r)}}const KP=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return KP(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return KP(s)(n)}}}},QUe=(t,e)=>(n,s,r)=>{let i={storage:XUe(()=>window.localStorage),partialize:y=>y,version:0,merge:(y,S)=>({...S,...y}),...e},a=!1,o=0;const l=new Set,u=new Set;let d=i.storage;if(!d)return t((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...y)},s,r);const f=()=>{const y=i.partialize({...s()});return d.setItem(i.name,{state:y,version:i.version})},p=r.setState;r.setState=(y,S)=>(p(y,S),f());const m=t((...y)=>(n(...y),f()),s,r);r.getInitialState=()=>m;let v;const x=()=>{var y,S;if(!d)return;const _=++o;a=!1,l.forEach(T=>{var k;return T((k=s())!=null?k:m)});const E=((S=i.onRehydrateStorage)==null?void 0:S.call(i,(y=s())!=null?y:m))||void 0;return KP(d.getItem.bind(d))(i.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==i.version){if(i.migrate){const k=i.migrate(T.state,T.version);return k instanceof Promise?k.then(R=>[!0,R]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var k;if(_!==o)return;const[R,I]=T;if(v=i.merge(I,(k=s())!=null?k:m),n(v,!0),R)return f()}).then(()=>{_===o&&(E==null||E(s(),void 0),v=s(),a=!0,u.forEach(T=>T(v)))}).catch(T=>{_===o&&(E==null||E(void 0,T))})};return r.persist={setOptions:y=>{i={...i,...y},y.storage&&(d=y.storage)},clearStorage:()=>{++o,d==null||d.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>x(),hasHydrated:()=>a,onHydrate:y=>(l.add(y),()=>{l.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},i.skipHydration||x(),v||m},Nde=QUe;/**
138 * @license lucide-react v0.447.0 - ISC
139 *
140 * This source code is licensed under the ISC license.
141 * See the LICENSE file in the root directory of this source tree.
142 */const JUe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ide=(...t)=>t.filter((e,n,s)=>!!e&&s.indexOf(e)===n).join(" ");/**
143 * @license lucide-react v0.447.0 - ISC
144 *
145 * This source code is licensed under the ISC license.
146 * See the LICENSE file in the root directory of this source tree.
147 */var eBe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
148 * @license lucide-react v0.447.0 - ISC
149 *
150 * This source code is licensed under the ISC license.
151 * See the LICENSE file in the root directory of this source tree.
152 */const tBe=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:a,...o},l)=>w.createElement("svg",{ref:l,...eBe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:Ide("lucide",r),...o},[...a.map(([u,d])=>w.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
153 * @license lucide-react v0.447.0 - ISC
154 *
155 * This source code is licensed under the ISC license.
156 * See the LICENSE file in the root directory of this source tree.
157 */const ti=(t,e)=>{const n=w.forwardRef(({className:s,...r},i)=>w.createElement(tBe,{ref:i,iconNode:e,className:Ide(`lucide-${JUe(t)}`,s),...r}));return n.displayName=`${t}`,n};/**
158 * @license lucide-react v0.447.0 - ISC
159 *
160 * This source code is licensed under the ISC license.
161 * See the LICENSE file in the root directory of this source tree.
162 */const nBe=ti("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/**
163 * @license lucide-react v0.447.0 - ISC
164 *
165 * This source code is licensed under the ISC license.
166 * See the LICENSE file in the root directory of this source tree.
167 */const sBe=ti("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
168 * @license lucide-react v0.447.0 - ISC
169 *
170 * This source code is licensed under the ISC license.
171 * See the LICENSE file in the root directory of this source tree.
172 */const YP=ti("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
173 * @license lucide-react v0.447.0 - ISC
174 *
175 * This source code is licensed under the ISC license.
176 * See the LICENSE file in the root directory of this source tree.
177 */const Lde=ti("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
178 * @license lucide-react v0.447.0 - ISC
179 *
180 * This source code is licensed under the ISC license.
181 * See the LICENSE file in the root directory of this source tree.
182 */const jde=ti("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
183 * @license lucide-react v0.447.0 - ISC
184 *
185 * This source code is licensed under the ISC license.
186 * See the LICENSE file in the root directory of this source tree.
187 */const rBe=ti("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
188 * @license lucide-react v0.447.0 - ISC
189 *
190 * This source code is licensed under the ISC license.
191 * See the LICENSE file in the root directory of this source tree.
192 */const iBe=ti("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
193 * @license lucide-react v0.447.0 - ISC
194 *
195 * This source code is licensed under the ISC license.
196 * See the LICENSE file in the root directory of this source tree.
197 */const j7=ti("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
198 * @license lucide-react v0.447.0 - ISC
199 *
200 * This source code is licensed under the ISC license.
201 * See the LICENSE file in the root directory of this source tree.
202 */const aBe=ti("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
203 * @license lucide-react v0.447.0 - ISC
204 *
205 * This source code is licensed under the ISC license.
206 * See the LICENSE file in the root directory of this source tree.
207 */const Pde=ti("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
208 * @license lucide-react v0.447.0 - ISC
209 *
210 * This source code is licensed under the ISC license.
211 * See the LICENSE file in the root directory of this source tree.
212 */const bY=ti("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
213 * @license lucide-react v0.447.0 - ISC
214 *
215 * This source code is licensed under the ISC license.
216 * See the LICENSE file in the root directory of this source tree.
217 */const Mde=ti("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
218 * @license lucide-react v0.447.0 - ISC
219 *
220 * This source code is licensed under the ISC license.
221 * See the LICENSE file in the root directory of this source tree.
222 */const oBe=ti("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
223 * @license lucide-react v0.447.0 - ISC
224 *
225 * This source code is licensed under the ISC license.
226 * See the LICENSE file in the root directory of this source tree.
227 */const lBe=ti("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
228 * @license lucide-react v0.447.0 - ISC
229 *
230 * This source code is licensed under the ISC license.
231 * See the LICENSE file in the root directory of this source tree.
232 */const kd=ti("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
233 * @license lucide-react v0.447.0 - ISC
234 *
235 * This source code is licensed under the ISC license.
236 * See the LICENSE file in the root directory of this source tree.
237 */const Dde=ti("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
238 * @license lucide-react v0.447.0 - ISC
239 *
240 * This source code is licensed under the ISC license.
241 * See the LICENSE file in the root directory of this source tree.
242 */const cBe=ti("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
243 * @license lucide-react v0.447.0 - ISC
244 *
245 * This source code is licensed under the ISC license.
246 * See the LICENSE file in the root directory of this source tree.
247 */const uBe=ti("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
248 * @license lucide-react v0.447.0 - ISC
249 *
250 * This source code is licensed under the ISC license.
251 * See the LICENSE file in the root directory of this source tree.
252 */const dBe=ti("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
253 * @license lucide-react v0.447.0 - ISC
254 *
255 * This source code is licensed under the ISC license.
256 * See the LICENSE file in the root directory of this source tree.
257 */const fBe=ti("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}
257],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),Ah=w.forwardRef(({className:t,type:e,...n},s)=>c.jsx("input",{type:e,className:He("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...n}));Ah.displayName="Input";var hBe=Object.defineProperty,pBe=(t,e)=>hBe(t,"name",{value:e,configurable:!0}),mBe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],is=mBe.reduce((t,e)=>{const n=iu(`Primitive.${e}`),s=w.forwardRef((r,i)=>{const{asChild:a,...o}=r,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...o,ref:i})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Ode(t,e){t&&nr.flushSync(()=>t.dispatchEvent(e))}pBe(Ode,"dispatchDiscreteCustomEvent");var gBe=Object.defineProperty,$de=(t,e)=>gBe(t,"name",{value:e,configurable:!0}),SY="horizontal",vBe=["horizontal","vertical"],xBe=w.forwardRef($de(function(e,n){const{decorative:s,orientation:r=SY,...i}=e,a=Fde(r)?r:SY,l=s?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return c.jsx(is.div,{"data-orientation":a,...l,...i,ref:n})},"Separator"));function Fde(t){return vBe.includes(t)}$de(Fde,"isValidOrientation");var Ude=xBe;const s2=w.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},r)=>c.jsx(Ude,{ref:r,decorative:n,orientation:e,className:He("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));s2.displayName=Ude.displayName;const yBe="form_identifier_not_found",wY="Something went wrong. Please try again.",bBe=t=>lle(t)?t.errors.some(e=>e.code===yBe):t instanceof Error&&t.message.includes("find your account"),Ny=t=>{if(lle(t)){const e=t.errors[0];return(e==null?void 0:e.longMessage)||(e==null?void 0:e.message)||wY}return t instanceof Error&&t.message?t.message:wY};function rt({children:t,size:e=24,color:n,style:s,...r}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",role:"img",width:typeof e=="number"?`${e}px`:e,height:typeof e=="number"?`${e}px`:e,style:{color:n,...s},...r,children:t})}function SBe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M4.09202 18.782L4.54601 17.891H4.54601L4.09202 18.782ZM3.21799 17.908L4.10899 17.454L4.10899 17.454L3.21799 17.908ZM20.782 17.908L19.891 17.454L19.891 17.454L20.782 17.908ZM19.908 18.782L20.362 19.673L19.908 18.782ZM20.782 6.09202L19.891 6.54601L19.891 6.54601L20.782 6.09202ZM19.908 5.21799L20.362 4.32698V4.32698L19.908 5.21799ZM3.21799 6.09202L2.32698 5.63803L2.32698 5.63803L3.21799 6.09202ZM4.09202 5.21799L3.63803 4.32698L3.63803 4.32698L4.09202 5.21799ZM13.2665 11.9638L13.8997 12.7378L13.2665 11.9638ZM10.7335 11.9638L10.1003 12.7378L10.7335 11.9638ZM20 8.2V15.8H22V8.2H20ZM17.8 18H6.2V20H17.8V18ZM4 15.8V8.2H2V15.8H4ZM6.2 6H17.8V4H6.2V6ZM6.2 18C5.62345 18 5.25117 17.9992 4.96784 17.9761C4.69617 17.9539 4.59545 17.9162 4.54601 17.891L3.63803 19.673C4.01641 19.8658 4.40963 19.9371 4.80497 19.9694C5.18864 20.0008 5.65645 20 6.2 20V18ZM2 15.8C2 16.3435 1.99922 16.8114 2.03057 17.195C2.06287 17.5904 2.13419 17.9836 2.32698 18.362L4.10899 17.454C4.0838 17.4045 4.04612 17.3038 4.02393 17.0322C4.00078 16.7488 4 16.3765 4 15.8H2ZM4.54601 17.891C4.35785 17.7951 4.20487 17.6421 4.10899 17.454L2.32698 18.362C2.6146 18.9265 3.07354 19.3854 3.63803 19.673L4.54601 17.891ZM20 15.8C20 16.3765 19.9992 16.7488 19.9761 17.0322C19.9539 17.3038 19.9162 17.4045 19.891 17.454L21.673 18.362C21.8658 17.9836 21.9371 17.5904 21.9694 17.195C22.0008 16.8114 22 16.3435 22 15.8H20ZM17.8 20C18.3436 20 18.8114 20.0008 19.195 19.9694C19.5904 19.9371 19.9836 19.8658 20.362 19.673L19.454 17.891C19.4045 17.9162 19.3038 17.9539 19.0322 17.9761C18.7488 17.9992 18.3766 18 17.8 18V20ZM19.891 17.454C19.7951 17.6421 19.6422 17.7951 19.454 17.891L20.362 19.673C20.9265 19.3854 21.3854 18.9265 21.673 18.362L19.891 17.454ZM22 8.2C22 7.65645 22.0008 7.18864 21.9
257694 6.80497C21.9371 6.40963 21.8658 6.01641 21.673 5.63803L19.891 6.54601C19.9162 6.59545 19.9539 6.69617 19.9761 6.96784C19.9992 7.25117 20 7.62345 20 8.2H22ZM17.8 6C18.3766 6 18.7488 6.00078 19.0322 6.02393C19.3038 6.04612 19.4045 6.0838 19.454 6.10899L20.362 4.32698C19.9836 4.13419 19.5904 4.06287 19.195 4.03057C18.8114 3.99922 18.3436 4 17.8 4V6ZM21.673 5.63803C21.3854 5.07354 20.9265 4.6146 20.362 4.32698L19.454 6.10899C19.6422 6.20487 19.7951 6.35785 19.891 6.54601L21.673 5.63803ZM4 8.2C4 7.62345 4.00078 7.25117 4.02393 6.96784C4.04612 6.69617 4.0838 6.59545 4.10899 6.54601L2.32698 5.63803C2.13419 6.01641 2.06287 6.40963 2.03057 6.80497C1.99922 7.18864 2 7.65645 2 8.2H4ZM6.2 4C5.65645 4 5.18864 3.99922 4.80497 4.03057C4.40963 4.06287 4.01641 4.13419 3.63803 4.32698L4.54601 6.10899C4.59545 6.0838 4.69617 6.04612 4.96784 6.02393C5.25117 6.00078 5.62345 6 6.2 6V4ZM4.10899 6.54601C4.20487 6.35785 4.35785 6.20487 4.54601 6.10899L3.63803 4.32698C3.07354 4.6146 2.6146 5.07354 2.32698 5.63803L4.10899 6.54601ZM20.3668 4.86241L12.6332 11.1898L13.8997 12.7378L21.6332 6.41033L20.3668 4.86241ZM11.3668 11.1898L3.63324 4.86241L2.36676 6.41033L10.1003 12.7378L11.3668 11.1898ZM12.6332 11.1898C12.2649 11.4912 11.7351 11.4912 11.3668 11.1898L10.1003 12.7378C11.2054 13.6419 12.7946 13.6419 13.8997 12.7378L12.6332 11.1898Z",fill:"currentColor"})})}const Bde=()=>{const{toggleMode:t,mode:e}=Vde();return c.jsxs(Zt,{className:"!rounded-lg !bg-[var(--gray-3)] !text-[var(--gray-12)] !py-[1.2rem] !border !border-[var(--gray-3)] hover:!bg-[var(--gray-4)] hover:!border-[var(--gray-4)] transition-colors duration-200 font-normal",onClick:t,children:[e==="oauth"&&c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(SBe,{size:20,className:"text-[var(--gray-12)]"}),c.jsx("p",{className:"!text-[var(--gray-12)] text-[14px] font-normal",children:"Continue with Email"})]}),e==="email"&&c.jsx("p",{className:"!text-[var(--gray-12)] text-[14px] font-normal",children:"Other Sign-in Methods"})]})},kS=L7()(Nde(t=>({email:"",setEmail:e=>t({email:e}),state:{type:"idle"},setState:e=>t({state:e}),resetState:()=>t({state:{type:"idle"},email:""})}),{name:"steel-email-view-state",partialize:t=>({email:t.email})})),wBe=()=>{const{state:t,resetState:e}=kS(),n=()=>{e()};switch(t.type){case"idle":case"loading":case"error":return c.jsx(_Y,{});case"emailSent":return c.jsx(_Be,{onBack:n});case"verifying":return c.jsx(EBe,{});case"success":return c.jsx(CBe,{});default:return c.jsx(_Y,{})}},zde=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim()),_Y=()=>{const{email:t,setEmail:e,state:n,setState:s}=kS(),{sendEmailAuth:r}=P7(),i=async a=>{if(a.key==="Enter"&&n.type!=="loading"&&t.trim()){if(a.preventDefault(),!zde(t)){s({type:"error",message:"Please enter a valid email address."});return}s({type:"loading"});try{await r(t,s)}catch{s({type:"error",message:"Something went wrong. Please try again."})}}};return c.jsxs("div",{className:"flex flex-col gap-4",children:[n.type==="error"&&c.jsx("div",{className:"w-full rounded-lg bg-red-500/10 border border-red-500/20 p-3",children:c.jsx("p",{className:"text-[var(--red-11)] dark:text-red-400 text-sm",children:n.message})}),c.jsx(Ah,{value:t,onChange:a=>e(a.target.value),onKeyDown:i,placeholder:"Email Address",className:"!rounded-lg !bg-[var(--gray-3)] !text-[var(--gray-12)] !py-[1.2rem] !border !border-transparent hover:!bg-[var(--gray-4)] transition-colors duration-200 placeholder:text-[var(--gray-10)]",disabled:n.type==="loading"}),c.jsx(TBe,{}),c.jsx("div",{id:"clerk-captcha",className:"empty:hidden"}),c.jsxs("div",{className:"flex items-center gap-3 w-full",children:[c.jsx(s2,{className:"flex-1 !bg-[var(--gray-3)]"}),c.jsx("div",{className:"text-[var(--gray-10)] text-[0.8125rem] font-normal",children:"or"}),c.jsx(s2,{className:"flex-1 !bg-[var(--gray-3)]"})]}),c.jsx(Bde,{})]})},P7=()=>{const{signIn:t,setActive:e}=DO(),{signUp:n}=Mle(),[s]=Po(),r=()=>{const a=s.get("redirect");let o=a?a.startsWith("/")?a:`/${a}`:"/quickstart";const l=s.get("cli_redirect")==="true",u=s.get("port"),d=s.get("state");if(l&&u&&d){const f=new URL(o,window.location.origin);return f.searchParams.set("cli_redirect","true"),f.searchParams.set("port",u),f.searchParams.set("state",d),f.toString()}return new URL(o,window.location.origin).toString()};return{sendEmailAuth:async(a,o)=>{var u;const l=r();if(!t||!n){o({type:"error",message:"Sign-in is still loading. Please try again in a moment."});return}try{await t.create({identifier:a});
257const d=(u=t.supportedFirstFactors)==null?void 0:u.find(m=>m.strategy==="email_link");if(!d){o({type:"error",message:"This account can't sign in with an email link. Try another sign-in method."});return}const f=t.createEmailLinkFlow();o({type:"emailSent",email:a});const p=await f.startEmailLinkFlow({emailAddressId:d.emailAddressId,redirectUrl:l}).catch(m=>(console.error(m),o({type:"error",message:Ny(m)}),null));(p==null?void 0:p.status)==="complete"&&(o({type:"verifying"}),await(e==null?void 0:e({session:p.createdSessionId}).then(()=>{o({type:"success"}),setTimeout(()=>window.location.assign(l),1500)}))),f.cancelEmailLinkFlow()}catch(d){if(bBe(d))try{await n.create({emailAddress:a});const f=n.createEmailLinkFlow();o({type:"emailSent",email:a});const p=await f.startEmailLinkFlow({redirectUrl:l}).catch(m=>(console.error(m),o({type:"error",message:Ny(m)}),null));(p==null?void 0:p.status)==="complete"&&(o({type:"verifying"}),await(e==null?void 0:e({session:p.createdSessionId}).then(()=>{o({type:"success"}),setTimeout(()=>window.location.assign(l),1e3)})))}catch(f){console.error(f),o({type:"error",message:Ny(f)})}else console.error(d),o({type:"error",message:Ny(d)})}}}},_Be=({onBack:t})=>{const[e,n]=w.useState(30),[s,r]=w.useState(!1),{email:i,setState:a}=kS(),{sendEmailAuth:o}=P7();w.useEffect(()=>{if(e>0){const f=setTimeout(()=>{n(e-1)},1e3);return()=>clearTimeout(f)}},[e]);const l=async()=>{if(!(e>0||s)){r(!0),n(30);try{await o(i,a)}catch{a({type:"error",message:"Failed to resend email. Please try again."})}finally{r(!1)}}},u=e>0||s,d=e>0?`Resend Email (${e}s)`:s?"Sending...":"Resend Email";return c.jsxs("div",{className:"flex flex-col gap-4 text-center",children:[c.jsx("div",{className:"border border-[var(--blue-6)] bg-[var(--blue-3)] text-[var(--blue-11)] dark:border-[#104D87] dark:bg-[#122640CC] dark:text-[#0090FF] font-normal text-sm py-2 px-4 rounded-lg",children:"Email Sent. Check your Inbox"}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx(Zt,{className:"!rounded-lg !bg-[var(--gray-2)] !text-[var(--gray-12)] !py-[1.2rem] !border !border-[var(--gray-3)] hover:!bg-[var(--gray-2)] hover:!border-[var(--gray-4)] transition-colors duration-200 font-normal disabled:opacity-50",disabled:u,onClick:l,children:d}),c.jsx(Zt,{className:"!rounded-lg !bg-[var(--gray-1)] !text-[var(--gray-12)] !py-[1.2rem] !border !border-[var(--gray-3)] hover:!bg-[var(--gray-2)] hover:!border-[var(--gray-4)] transition-colors duration-200 font-normal",onClick:t,children:"Back"})]})]})},EBe=()=>c.jsx("div",{className:"flex flex-col gap-6 text-center",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("div",{className:"w-16 h-16 mx-auto bg-blue-500/10 rounded-full flex items-center justify-center",children:c.jsx(kd,{className:"w-8 h-8 text-[var(--blue-11)] dark:text-blue-400 animate-spin"})}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h3",{className:"text-[var(--gray-12)] font-medium text-lg",children:"Signing you in..."}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"Please wait while we verify your email and sign you in."})]})]})}),CBe=()=>{const{resetState:t}=kS(),{isLoaded:e,isSignedIn:n}=zt();return w.useEffect(()=>{e&&!n&&t()},[e,n,t]),c.jsx("div",{className:"flex flex-col gap-6 text-center",children:c.jsx("div",{className:"flex flex-col gap-4",children:c.jsx("div",{className:"flex flex-col gap-2",children:c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"You're now signed in. Redirecting..."})})})})},TBe=()=>{const{state:t,setState:e,email:n}=kS(),{sendEmailAuth:s}=P7(),r=t.type==="loading",i=r||!n.trim(),a=async()=>{if(n.trim()){if(!zde(n)){e({type:"error",message:"Please enter a valid email address."});return}e({type:"loading"});try{await s(n,e)}catch{e({type:"error",message:"Something went wrong. Please try again."})}}};return c.jsxs(Zt,{className:"flex rounded-lg !items-center gap-2 !bg-[var(--gray-12)] !py-[1.2rem] !border hover:!bg-[var(--gray-11)] transition-colors duration-200 font-normal disabled:opacity-50",disabled:i,onClick:a,children:[r&&c.jsx("div",{className:"scale-75",children:c.jsx(kd,{className:"animate-spin text-[var(--gray-1)]"})}),"Continue with Email"]})},kBe=()=>{const{signIn:t,setActive:e,isLoaded:n}=DO(),{signUp:s,isLoaded:r}=Mle(),[i]=Po(),a=w.useRef(null),o=n&&r;return w.useEffect(()=>{const l=i.get("__clerk_ticket"),u=i.get("__clerk_status");if(!l||!o||!e||u==="complete"||a.current===l)return;a.current=l,(async()=>{try{if(u==="sign_up"){const p=await s.create({strategy:"ticket",ticket:l});
257p.status==="complete"&&p.createdSessionId&&await e({session:p.createdSessionId});return}const f=await t.create({strategy:"ticket",ticket:l});f.status==="complete"&&f.createdSessionId&&await e({session:f.createdSessionId})}catch(f){console.error("Invitation ticket redemption failed:",f)}})()},[i,t,s,e,o]),null},RBe=()=>c.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:"text-[var(--gray-12)] dark:text-white",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M12 2.80786C17.525 2.80786 22 7.28286 22 12.8079C21.9995 14.9031 21.3419 16.9454 20.1198 18.6474C18.8977 20.3493 17.1727 21.6252 15.1875 22.2954C14.6875 22.3954 14.5 22.0829 14.5 21.8204C14.5 21.4829 14.5125 20.4079 14.5125 19.0704C14.5125 18.1329 14.2 17.5329 13.8375 17.2204C16.0625 16.9704 18.4 16.1204 18.4 12.2829C18.4 11.1829 18.0125 10.2954 17.375 9.59536C17.475 9.34536 17.825 8.32036 17.275 6.94536C17.275 6.94536 16.4375 6.67036 14.525 7.97036C13.725 7.74536 12.875 7.63286 12.025 7.63286C11.175 7.63286 10.325 7.74536 9.525 7.97036C7.6125 6.68286 6.775 6.94536 6.775 6.94536C6.225 8.32036 6.575 9.34536 6.675 9.59536C6.0375 10.2954 5.65 11.1954 5.65 12.2829C5.65 16.1079 7.975 16.9704 10.2 17.2204C9.9125 17.4704 9.65 17.9079 9.5625 18.5579C8.9875 18.8204 7.55 19.2454 6.65 17.7329C6.4625 17.4329 5.9 16.6954 5.1125 16.7079C4.275 16.7204 4.775 17.1829 5.125 17.3704C5.55 17.6079 6.0375 18.4954 6.15 18.7829C6.35 19.3454 7 20.4204 9.5125 19.9579C9.5125 20.7954 9.525 21.5829 9.525 21.8204C9.525 22.0829 9.3375 22.3829 8.8375 22.2954C6.8458 21.6324 5.11342 20.3591 3.88611 18.6562C2.65881 16.9532 1.9989 14.907 2 12.8079C2 7.28286 6.475 2.80786 12 2.80786Z",fill:"currentColor"})}),ABe=()=>c.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:"text-[var(--gray-12)] dark:text-white",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M2.5 13C2.5 7.486 6.986 3 12.5 3C14.727 3 16.8348 3.71648 18.5956 5.072L16.2718 8.09067C15.183 7.25257 13.8788 6.80952 12.5 6.80952C9.08657 6.80952 6.30952 9.58657 6.30952 13C6.30952 16.4134 9.08657 19.1905 12.5 19.1905C15.2492 19.1905 17.5855 17.3892 18.3907 14.9048H12.5V11.0952H22.5V13C22.5 18.514 18.014 23 12.5 23C6.986 23 2.5 18.514 2.5 13Z",fill:"currentColor"})}),NBe=()=>{const[t,e]=w.useState(null);return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex flex-col gap-4",children:[t&&c.jsx("div",{className:"w-full rounded-lg bg-red-500/10 border border-red-500/20 p-3",children:c.jsx("p",{className:"text-[var(--red-11)] dark:text-red-400 text-sm",children:t})}),c.jsx(EY,{icon:c.jsx(RBe,{}),label:"Continue with GitHub",strategy:"oauth_github",onError:e}),c.jsx(EY,{icon:c.jsx(ABe,{}),label:"Continue with Google",strategy:"oauth_google",onError:e}),c.jsxs("div",{className:"flex items-center gap-3 w-full",children:[c.jsx(s2,{className:"flex-1 !bg-[var(--gray-3)]"}),c.jsx("div",{className:"text-[var(--gray-10)] text-[0.8125rem] font-normal",children:"or"}),c.jsx(s2,{className:"flex-1 !bg-[var(--gray-3)]"})]}),c.jsx(Bde,{})]})})},EY=({icon:t,label:e,strategy:n,onError:s})=>{const{signIn:r}=DO(),[i,a]=w.useState(!1),[o]=Po(),l=w.useMemo(()=>{const d=o.get("redirect"),f=o.get("cli_redirect")==="true",p=o.get("port"),m=o.get("state");if(f&&p&&m){const x=new URL("/sign-in/cli-signing-in",window.location.origin);return x.searchParams.set("cli_redirect","true"),x.searchParams.set("port",p),x.searchParams.set("state",m),x.pathname+x.search}return d?d.startsWith("/")?d:`/${d}`:"/quickstart"},[o]),u=w.useCallback(async()=>{if(!r){s("Sign-in is still loading. Please try again in a moment.");return}a(!0),s(null);try{await r.authenticateWithRedirect({strategy:n,redirectUrl:"/sign-in/sso-callback",redirectUrlComplete:l})}catch(d){console.error(d),s(Ny(d)),a(!1)}},[r,n,l,s]);return c.jsxs(Zt,{className:"flex !rounded-lg !items-center gap-2 !bg-[var(--gray-3)] !py-[1.2rem] !border !border-[var(--gray-3)] hover:!bg-[var(--gray-4)] hover:!border-[var(--gray-4)] transition-colors duration-200",disabled:i,onClick:u,children:[c.jsxs("div",{className:"scale-90",children:[i&&c.jsx(kd,{className:"animate-spin text-[var(--gray-12)]"}),!i&&t]}),c.jsx("p",{className:"!text-[var(--gray-12)] text-[0.8125rem] font-normal",children:e})]})},O1=({className:t})=>c.jsx("svg",{width:"45",height:"32",viewBox:"0 0 45 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:c.jsx("path",{d:"M10.6578 0C4.77167 0 0 4.60503 0 10.2856C0 15.9662 4.77167 20.5713 10.6578 20.5713H22.4998C23.1539 20.5713 23.684 21.0829 23.684 21.7141C23.684 22.3453 23.1539 22.857 22.4998 22.857H0.828942C0.371131 22.857 0 23.2151 0 23.657V31.1997C0 31.6416 0.371131 31.9997 0.828942 31.9997H22.4998C28.386 31.9997 33.1576 27.3947 33.1576 21.7141C33.1576 16.0335 28.386 11.4285 22.4998 11.4285H10.6578C10.0038 11.4285 9.47361 10.9168 9.47361 10.2856C9.47361 9.65445 10.0038 9.14279 10.6578 9.14279H30.739C30.7558 9.14295 30.7727 9.14304 30.7895 9.14304H34.3422C34.9962 9.14304 35.5264 9.65471 35.5264 10.2859V31.2C35.5264 31.6418 35.8975 32 36.3553 32H44.1711C44.6289 32 45 31.6418 45 31.2V10.2859C45 4.60529 40.2283 0.000256326 34.3422 0.000256326H33.1576L10.6578 0Z",fill:"currentColor"})}),Vde=L7()(Nde(t=>
257({mode:"oauth",setMode:e=>t({mode:e}),toggleMode:()=>t(e=>({mode:e.mode==="oauth"?"email":"oauth"}))}),{name:"steel-signin-store"}));function IBe(){const{mode:t}=Vde(),[e]=Po(),n=e.get("redirect"),s=n!=null&&n.startsWith("/")&&!n.startsWith("//")?n:"/";return c.jsxs(c.Fragment,{children:[c.jsx($O,{children:c.jsx(il,{to:e.get("cli_redirect")==="true"?`/sign-in/cli-signing-in?${e.toString()}`:s})}),c.jsxs(FO,{children:[c.jsx("div",{className:"flex h-full w-full bg-[var(--sand-1)]",children:c.jsxs("div",{className:"relative flex flex-1 items-center justify-center overflow-hidden p-8",children:[c.jsxs("div",{className:"relative z-10 w-full max-w-[405px] overflow-hidden rounded-[24px] border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex gap-[10px] border-b-[0.5px] border-b-[var(--sand-6)] bg-[var(--sand-1)] p-6",children:[c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"}),c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"}),c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"})]}),c.jsxs("div",{className:"space-y-5 p-8",children:[c.jsxs("div",{className:"flex flex-col items-center justify-center gap-4",children:[c.jsx("a",{href:"https://steel.dev",className:"flex items-center gap-2",children:c.jsx(O1,{className:"text-[var(--sand-12)] dark:text-white"})}),c.jsx("p",{className:"text-base font-normal text-[var(--sand-12)]",children:"Sign in to Steel®"})]}),c.jsx(xr,{mode:"wait",initial:!1,children:c.jsx(wt.div,{className:"flex flex-col gap-4",initial:{opacity:0,filter:"blur(4px)"},animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:{duration:.2,ease:"easeOut"},children:t==="oauth"?c.jsx(NBe,{}):c.jsx(wBe,{})},t)})]})]}),c.jsxs("div",{className:"pointer-events-none absolute bottom-6 left-6 z-10 text-[13px] font-medium text-[var(--sand-10)]",children:["© Steel ",new Date().getFullYear()]})]})}),c.jsx(kBe,{})]})]})}function Hde(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 4V7C8 7.55228 8.44772 8 9 8H15C15.5523 8 16 7.55228 16 7V4M20 7.82843V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V6C4 4.89543 4.89543 4 6 4H16.1716C16.702 4 17.2107 4.21071 17.5858 4.58579L19.4142 6.41421C19.7893 6.78929 20 7.29799 20 7.82843ZM8 14V19C8 19.5523 8.44772 20 9 20H15C15.5523 20 16 19.5523 16 19V14C16 13.4477 15.5523 13 15 13H9C8.44772 13 8 13.4477 8 14Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function RS(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M15.4 8.5H15.5H15.6M16 8.5C16 8.77614 15.7761 9 15.5 9C15.2239 9 15 8.77614 15 8.5C15 8.22386 15.2239 8 15.5 8C15.7761 8 16 8.22386 16 8.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M15.5 14C18.5376 14 21 11.5376 21 8.5C21 5.46243 18.5376 3 15.5 3C12.4624 3 10 5.46243 10 8.5C10 8.96094 10.0567 9.40863 10.1635 9.83649L4.58579 15.4142C4.21071 15.7893 4 16.298 4 16.8284V19C4 19.5523 4.44772 20 5 20H7.17157C7.70201 20 8.21071 19.7893 8.58579 19.4142L10 18V15.5H12.5L14.1635 13.8365C14.5914 13.9433 15.0391 14 15.5 14Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",strokeLinejoin:"round"})]})}function AS(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M19 5.5C19 6.88071 15.866 8 12 8C8.13401 8 5 6.88071 5 5.5M19 5.5C19 4.11929 15.866 3 12 3C8.13401 3 5 4.11929 5 5.5M19 5.5V18.5C19 19.8807 15.866 21 12 21C8.13401 21 5 19.8807 5 18.5V5.5M19 12C19 13.3807 15.866 14.5 12 14.5C8.13401 14.5 5 13.3807 5 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function LBe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M5.95123 20.004V14.0015M5.95123 9.99999V3.99707M11.9998 20.0038V13.0005M11.9998 8.99915V3.99707M18.0484 20.0036V16.002M18.0484 12.0008V3.99707M3.99609 14.0015H7.90643M10.0446 8.99902H13.955M16.0932 16.002H20.0035",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const jBe=1e3,PBe=4e3,Gde=w.createContext(null);function L4(){var t;return((t=w.useContext(Gde))==null?void 0:t.newNav)??!1}function MBe(){const{isLoaded:t,isSignedIn:e,orgId:n,userId:s}=zt(),{isFetched:r,isError:i}=_7(),a=E7(),[o,l]=w.useState(null),u=t&&!!e,d=u&&!!n,f=d&&(r||i),p=t?s??null:void 0,m=o!==null&&(p===void 0||p===o.owner)?o:null,v=m!==null;w.useEffect(()=>{typeof p!="string"||!f||l(_=>_!==null&&_.owner===p&&!_.provisional?_:{owner:p,newNav:a,provisional:!1})},[p,f,a]);const x=w.useEffectEvent(()=>{typeof p=="string"&&l(_=>_!==null&&_.owner===p?_:{owner:p,newNav:a,provisional:!0})});w.useEffect(()=>{if(!u||f||v)return;const _=setTimeout(x,d?jBe:PBe);return()=>clearTimeout(_)},[u,d,f,v]);const y=(m==null?void 0:m.newNav)??a,S=m!==null;return w.useMemo(()=>({newNav:y,resolved:S}),[y,S])}const DBe=[{label:"Computers",to:"/computers",end:!0,Icon:AS},{label:"Checkpoints",to:"/computers/checkpoints",end:!1,Icon:Hde},{label:"Environments",to:"/computers/environments",end:!1,Icon:LBe},{label:"Secrets",to:"/computers/secrets",end:!1,Icon:RS}];function OBe(){return L4()?c.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[var(--sand-1)]",children:c.jsx(Jl,{})}):c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden bg-[var(--sand-1)]",children:[c.jsx("aside",{className:"flex h-full min-h-0 w-[18.5rem] shrink-0 flex-col overflow-y-auto border-r-[0.5px] border-[var(--sand-6)] max-sm:w-[4.5rem]",children:c.jsx("nav",{"aria-label":"Computer resources",className:"flex flex-col gap-2 p-4 max-sm:px-3",children:DBe.map(e=>c.jsxs(fie,{to:e.to,end:e.end,title:e.label,className:({isActive:n})=>He("flex items-center gap-2 rounded-lg p-2 text-sm font-medium transition-colors duration-150 max-sm:justify-center",n?"bg-[var(--sand-3)] text-[var(--sand-12)]":"text-[var(--sand-10)] hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]"),children:[c.jsx(e.Icon,{size:20,className:"shrink-0"}),c.jsx("span",{className:"leading-5 max-sm:sr-only",children:e.label})]},e.to))})}),c.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:c.jsx(Jl,{})})]})}const $Be="modulepreload",FBe=function(t){return"/"+t},CY={},Jx=function(e,n,s){let r=Promise.resolve();if(n&&n.length>0){let a=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}
257))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=a(n.map(u=>{if(u=FBe(u),u in CY)return;CY[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":$Be,d||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((m,v)=>{p.addEventListener("load",m),p.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return e().catch(i)})},$1={list:()=>Jx(()=>import("./page-CeBr9QvP.js"),__vite__mapDeps([0,1,2,3,4,5])),checkpoints:()=>Jx(()=>import("./checkpoints-CVOnnQp7.js"),__vite__mapDeps([6,1,2,4,5,7])),environments:()=>Jx(()=>import("./environments-fGX-VtYD.js"),__vite__mapDeps([8,9,1,3,5,7])),secrets:()=>Jx(()=>import("./secrets-9ELAAVGn.js"),__vite__mapDeps([10,9,1,5,7])),detail:()=>Jx(()=>import("./page-ChH3AEj9.js"),__vite__mapDeps([11,2,7,5,12]))},UBe=w.lazy(async()=>({default:(await $1.list()).ComputersPage})),BBe=w.lazy(async()=>({default:(await $1.checkpoints()).CheckpointsPage})),zBe=w.lazy($1.environments),VBe=w.lazy($1.secrets),HBe=w.lazy(async()=>({default:(await $1.detail()).ComputerPage}));function GBe(t){const[e,n]=t.split("/").filter(Boolean);return e!=="computers"?null:n?n==="checkpoints"||n==="environments"||n==="secrets"?n:"detail":"list"}function WBe(t){const e=GBe(t);e&&$1[e]().catch(()=>{})}function La(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M18 15V6M18 6H9M18 6L6.25 17.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function r2(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M4 19H14M4 19V6C4 4.89543 4.89543 4 6 4H12C13.1046 4 14 4.89543 14 6V8M4 19H2M14 19V8M14 19H20M14 8H18C19.1046 8 20 8.89543 20 10V19M20 19H22M10 9H8M8 13H10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function j4(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 13L11 16L16 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function fd(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M10 16L13.2929 12.7071C13.6834 12.3166 13.6834 11.6834 13.2929 11.2929L10 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wde(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"3 4"})})}function qde(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12 5H5C3.89543 5 3 5.89543 3 7V17C3 18.1046 3.89543 19 5 19H12M16 5H19C20.1046 5 21 5.89543 21 7V17C21 18.1046 20.1046 19 19 19H16M16 5V2.5M16 5V19M16 19V21.5M8 9.5L10.5 12L8 14.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Kde(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7.5 8L9.25 9.75L7.5 11.5M12 11.5H14M6 20H18C19.1046 20 20 19.1046 20 18V6C20 4.89543 19.1046 4 18 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nh(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M21 12C21 16.9706 16.9706 21 12 21M21 12C21 7.02944 16.9706 3 12 3M21 12H3M12 21C7.02944 21 3 16.9706 3 12M12 21C9.79086 21 8 16.9706 8 12C8 7.02944 9.79086 3 12 3M12 21C14.2091 21 16 16.9706 16 12C16 7.02944 14.2091 3 12 3M3 12C3 7.02944 7.02944 3 12 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square"})})}function Yde(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9.5 12.25L11 13.75L14.5 10.25M6 4H18C19.1046 4 20 4.89543 20 6V16.7639C20 17.5215 19.572 18.214 18.8944 18.5528L12.8944 21.5528C12.3314 21.8343 11.6686 21.8343 11.1056 21.5528L5.10557 18.5528C4.428 18.214 4 17.5215 4 16.7639V6C4 4.89543 4.89543 4 6 4Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function qBe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M11.5288 2.29524C11.7179 1.90159 12.2821 1.90159 12.4712 2.29524L14.9458 7.44648C15.0219 7.60491 15.1735 7.71434 15.3487 7.73728L21.0456 8.4832C21.4809 8.5402 21.6552 9.07312 21.3368 9.37342L17.1693 13.303C17.0412 13.4238 16.9832 13.6009 17.0154 13.7735L18.0616 19.3857C18.1416 19.8146 17.6852 20.144 17.2993 19.9359L12.249 17.2133C12.0937 17.1296 11.9063 17.1296 11.751 17.2133L6.70073 19.9359C6.3148 20.144 5.85841 19.8146 5.93837 19.3857L6.98459 13.7735C7.01677 13.6009 6.95885 13.4238 6.83068 13.303L2.66324 9.37342C2.34476 9.07312 2.51909 8.5402 2.95444 8.4832L8.65127 7.73728C8.82648 7.71434 8.97811 7.60491 9.05422 7.44648L11.5288 2.29524Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function P4(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9.47198 17.9403C7.93861 19.2403 6.41602 19.0782 4.87996 17.4542C8.45153 13.9086 12.8981 19.0461 8.96175 21M14.528 17.9403C16.0614 19.2403 17.584 19.0782 19.12 17.4542C15.5485 13.9086 11.1019 19.0461 15.0382 21M6.91867 15.0804C6.34958 12.6711 4.88628 11.8324 2.5 12.5478C3.06909 14.9571 4.53239 15.7958 6.91867 15.0804ZM5.74053 11.7104C6.46112 9.34144 5.61628 7.88874 3.18941 7.32378C2.46882 9.69276 3.31366 11.1455 5.74053 11.7104ZM6.85306 3C4.76718 4.35492 4.47378 6.00687 5.96706 7.98831C8.05294 6.6334 8.34634 4.98145 6.85306 3ZM17.0813 15.0804C17.6504 12.6711 19.1137 11.8324 21.5 12.5478C20.9309 14.9571 19.4676 15.7958 17.0813 15.0804ZM18.2595 11.7104C17.5389 9.34144 18.3837 7.88874 20.8106 7.32378C21.5312 9.69276 20.6863 11.1455 18.2595 11.7104ZM17.1469 3C19.2328 4.35492 19.5262 6.00687 18.0329 7.98831C15.9471 6.6334 15.6537 4.98145 17.1469 3Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const KBe=1,YBe=1e6;let f6=0;function ZBe(){return f6=(f6+1)%Number.MAX_SAFE_INTEGER,f6.toString()}const h6=new Map,TY=t=>{if(h6.has(t))return;const e=setTimeout(()=>{h6.delete(t),X0({type:"REMOVE_TOAST",toastId:t})},YBe);h6.set(t,e)},XBe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,KBe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;
257return n?TY(n):t.toasts.forEach(s=>{TY(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},$C=[];let FC={toasts:[]};function X0(t){FC=XBe(FC,t),$C.forEach(e=>{e(FC)})}function M4({...t}){const e=ZBe(),n=r=>X0({type:"UPDATE_TOAST",toast:{...r,id:e}}),s=()=>X0({type:"DISMISS_TOAST",toastId:e});return X0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||s()}}}),{id:e,dismiss:s,update:n}}function QBe(t){X0({type:"DISMISS_TOAST",toastId:t})}function JBe(){const[t,e]=w.useState(FC);return w.useEffect(()=>($C.push(e),()=>{const n=$C.indexOf(e);n>-1&&$C.splice(n,1)}),[t]),{...t,toast:M4,dismiss:n=>X0({type:"DISMISS_TOAST",toastId:n})}}const na=({title:t,actionLabel:e,onAction:n,duration:s,sweep:r,shapes:i})=>M4({title:t,actionLabel:e,onClick:n,duration:s,sweep:r,shapes:i}),Bn=({title:t,actionLabel:e,onAction:n,duration:s,shapes:r=!1})=>M4({tone:"error",title:t,actionLabel:e??(n?"Try again":"Close"),onClick:n,duration:s,shapes:r}),Ao=({title:t,actionLabel:e,onAction:n,duration:s})=>M4({tone:"neutral",title:t,actionLabel:e,onClick:n,shapes:!1,duration:s}),Ja=(t,e)=>{navigator.clipboard.writeText(t),Ao({title:e?`${e} copied to clipboard`:"Text copied to clipboard",duration:2e3})},eze="https://github.com/steel-dev/steel-browser",lk=[{id:"session",title:"Run your first session",Icon:Nh,reward:5,docsUrl:"https://docs.steel.dev",docsLabel:"session",tasks:[{id:"create",label:"Create a browser session",description:"Launch a managed cloud browser you can control over the API.",href:"/sessions",done:!0},{id:"scrape",label:"Scrape an item from a page",description:"Pull text, links, or structured data out of any page.",href:"https://docs.steel.dev",done:!1},{id:"twomin",label:"Run a 2-minute session",description:"Keep a session alive and interact with it for a couple of minutes.",href:"/sessions",done:!1},{id:"screenshot",label:"Capture a screenshot",description:"Grab a full-page or element screenshot from a live session.",href:"https://docs.steel.dev",done:!1}]},{id:"install-cli",title:"Install Steel CLI",Icon:Kde,docsUrl:"https://docs.steel.dev",docsLabel:"CLI",tasks:[{id:"install",label:"Install the Steel CLI",description:"Run this in your terminal to get set up.",command:"curl -fsS https://setup.steel.dev | sh",done:!1}]},{id:"automate",title:"Automate with agents",Icon:qde,reward:5,docsUrl:"https://docs.steel.dev/overview/skills",docsLabel:"agent",tasks:[{id:"agent",label:"Connect a coding agent",description:"Let a coding agent like Claude Code or Cursor drive Steel for you.",href:"https://docs.steel.dev/overview/skills",done:!1},{id:"playwright",label:"Run a Playwright script",description:"Point your existing Playwright scripts at Steel's managed browsers.",href:"https://docs.steel.dev",done:!1},{id:"proxy",label:"Route through a proxy network",description:"Send traffic through a proxy to avoid rate limits and blocks.",href:"/settings/network",done:!1}]},{id:"antibot",title:"Verify your account to unlock Antibot bypass",Icon:Yde,docsUrl:"https://docs.steel.dev",docsLabel:"Antibot",tasks:[{id:"verify",label:"Verify your account",description:"Confirm your account to unlock the Antibot bypass add-on.",href:"/settings/organization",done:!1}]},{id:"dedicated-ip",title:"Set up a dedicated IP",Icon:AS,docsUrl:"https://docs.steel.dev",docsLabel:"dedicated IP",tasks:[{id:"lease",label:"Lease a dedicated IP",description:"Reserve a static IP that belongs only to your account.",href:"/settings/network",done:!1},{id:"assign",label:"Assign it to your Dedicated Network",description:"Attach the IP so your sessions egress from that single address.",href:"/settings/network",done:!1}]},{id:"star-github",title:"Star the steel-browser GitHub repo",Icon:qBe,reward:5,tasks:[{id:"star",label:"Star steel-dev/steel-browser",description:"Give the open-source Steel browser a star on GitHub.",href:eze,done:!1}]},{id:"workspace",title:"Set up your workspace",Icon:r2,reward:5,docsUrl:"https://docs.steel.dev",docsLabel:"workspace",tasks:[{id:"apikey",label:"Create an API key",description:"Generate a key to authenticate your requests to Steel.",href:"/settings/api-keys",done:!0},{id:"invite",label:"Invite a teammate",description:"Add teammates so they can build in the same workspace.",href:"/settings/organization",done:!0},{id:"payment",label:"Add a payment method",description:"Save a card so you can move beyond the free tier when you're ready.",href:"/settings/billing/wallet",done:!0}]},{id:"onboarding",title:"Complete onboarding",Icon:P4,reward:20,docsUrl:"https://docs.steel.dev",docsLabel:"onboarding",tasks:[{id:"onboard",label:"Complete the onboarding flow",de
257scription:"You already did this when you set up your account.",done:!0}]}],kY=lk.reduce((t,e)=>t+e.tasks.length,0),tze=lk.reduce((t,e)=>t+e.tasks.filter(n=>n.done).length,0),ZP=kY?tze/kY:0;function nze({progress:t,size:e=56,stroke:n=5,children:s}){const r=(e-n)/2,i=Math.min(4,Math.max(0,t*4)),a=Math.floor(i),o=i-a,l=a<4?a:-1,u=a>0?`${"0.78 0.22 ".repeat(a-1)}0.78 ${(4-a+.22).toFixed(2)}`:null,d=.78*o,f=l>=0?Math.max(0,3-l):0,p=f>0?`${"0.78 0.22 ".repeat(f-1)}0.78 ${(4-f+.22).toFixed(2)}`:null,m={cx:e/2,cy:e/2,r,fill:"none",strokeWidth:n};return c.jsxs("div",{className:"relative shrink-0",style:{width:e,height:e},children:[c.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,className:"-rotate-90",children:[c.jsx("circle",{...m,stroke:"var(--sand-4)",strokeLinecap:"round",pathLength:4,strokeDasharray:"0.78 0.22"}),p&&c.jsx("circle",{...m,stroke:"#10243e",className:"stroke-[var(--blue-4)] dark:stroke-[#10243e]",strokeLinecap:"round",pathLength:4,strokeDasharray:p,strokeDashoffset:-l}),u&&c.jsx("circle",{...m,stroke:"#0091ff",strokeLinecap:"round",pathLength:4,strokeDasharray:u}),l>=0&&d>0&&c.jsx("circle",{...m,stroke:"#0091ff",strokeLinecap:"round",pathLength:4,strokeDasharray:`${d.toFixed(3)} ${(4-d).toFixed(3)}`,strokeDashoffset:-l})]}),c.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s})]})}function XP(){return c.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--blue-9)]",children:c.jsx(j4,{size:20,className:"text-white"})})}function sze({task:t}){return c.jsxs("div",{className:"flex flex-col gap-2 border-t-[0.5px] border-solid border-[var(--sand-6)] px-5 py-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[t.done?c.jsx(XP,{}):c.jsx(Wde,{size:20,className:"mt-px shrink-0 text-[var(--sand-8)]"}),c.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c.jsx("span",{className:"text-[14px] leading-[20px] text-[var(--sand-12)]",children:t.label}),c.jsx("span",{className:"text-[13px] leading-[18px] text-[var(--sand-10)]",children:t.description})]})]}),c.jsxs("div",{className:"ml-8 flex items-center gap-2 rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--gray-4)] py-2 pl-3 pr-2",children:[c.jsx("code",{className:"min-w-0 flex-1 truncate text-[13px] text-[var(--sand-11)]",children:t.command}),c.jsx("button",{type:"button",onClick:()=>{t.command&&(navigator.clipboard.writeText(t.command),Ao({title:"Command copied to clipboard",duration:2500}))},"aria-label":"Copy command",className:"flex h-[26px] shrink-0 cursor-pointer items-center rounded-[999px] bg-[var(--sand-7)] px-[10px] text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-8)]",children:"Copy text"})]})]})}function rze(){const[t,e]=w.useState(lk[0].id),n=d=>e(f=>f===d?null:d),s=Hh()??!1,r=Math.round(ZP*100),i=lk.map(d=>({group:d,complete:d.tasks.every(f=>f.done)})),a=[...i.filter(d=>!d.complete&&d.group.reward!=null),...i.filter(d=>!d.complete&&d.group.reward==null),...i.filter(d=>d.complete)],o=a.findIndex(d=>d.complete),l=.06,u=d=>({initial:s?{opacity:0}:{opacity:0,y:16},animate:{opacity:1,y:0},transition:s?{duration:.2,delay:d}:{type:"spring",bounce:.2,duration:.5,delay:d}});return c.jsx("main",{className:"flex flex-1 justify-center overflow-y-auto [scrollbar-gutter:stable_both-edges]",children:c.jsxs("div",{className:"flex w-full max-w-[720px] flex-col gap-10 self-start px-6 pb-12 pt-12",children:[c.jsxs(wt.div,{...u(0),className:"sticky top-[24px] z-10 flex w-full items-center justify-between gap-6 border-b-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-1)] pb-[24px] before:pointer-events-none before:absolute before:inset-x-0 before:bottom-full before:h-[24px] before:bg-[var(--sand-1)] before:content-['']",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("h1",{className:"text-[24px] font-medium leading-[30px] text-[var(--sand-12)]",children:"Finish setting up Steel"}),c.jsxs("p",{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:["Complete at least ",c.jsx("span",{className:"font-medium text-[var(--sand-12)]",children:"75%"})," of onboarding to"," ",c.jsx("span",{className:"font-medium text-[var(--sand-12)]",children:"earn $15 in credits"})]})]}),c.jsx(nze,{progress:ZP,children:c.jsxs("span",{className:"text-[14px] font-semibold leading-none text-[var(--sand-12)]",children:[r,"%"]})})]}),c.jsx("div",{className:"flex w-full flex-col gap-5",children:a.map(({group:d,complete:f},p)=>{const m=d.tasks.filter(y=>y.done).length,v=d.tasks.length,x=!f&&t===d.id;return c.jsxs(w.Fragment,{children:[p===o&&p>
2570&&c.jsx(wt.div,{...u((p+1)*l),className:"w-full border-t-[0.5px] border-solid border-[var(--sand-6)]",role:"separator"}),c.jsxs(wt.div,{...u((p+1)*l),className:"overflow-hidden rounded-[16px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsxs("button",{type:"button",disabled:f,onClick:()=>n(d.id),className:He("flex w-full items-center gap-3 px-5 py-4 text-left transition-colors",f?"cursor-default":x?"bg-[var(--sand-3)]":"hover:bg-[var(--sand-3)]"),children:[c.jsx(d.Icon,{size:20,className:"shrink-0 text-[var(--sand-11)]"}),c.jsx("span",{className:"text-[14px] font-medium text-[var(--sand-12)]",children:d.title}),c.jsxs("span",{className:"shrink-0 text-[13px] font-medium text-[var(--sand-10)]",children:[m,"/",v]}),c.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:f?c.jsx(XP,{}):c.jsx(fd,{size:20,className:He("shrink-0 text-[var(--sand-9)] transition-transform duration-200",x?"-rotate-90":"rotate-90")})})]}),c.jsx(xr,{initial:!1,children:x&&c.jsxs(wt.div,{initial:{height:0,opacity:0,filter:"blur(4px)"},animate:{height:"auto",opacity:1,filter:"blur(0px)"},exit:{height:0,opacity:0,filter:"blur(4px)"},transition:{type:"spring",bounce:.2,duration:.45},className:"overflow-hidden",children:[d.tasks.map(y=>{var E,T;if(y.command)return c.jsx(sze,{task:y},y.id);const S=c.jsxs(c.Fragment,{children:[y.done?c.jsx(XP,{}):c.jsx(Wde,{size:20,className:"mt-px shrink-0 text-[var(--sand-8)]"}),c.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c.jsx("span",{className:He("text-[14px] leading-[20px]",y.done?"text-[var(--sand-10)] line-through":"text-[var(--sand-12)]"),children:y.label}),c.jsx("span",{className:"text-[13px] leading-[18px] text-[var(--sand-10)]",children:y.description})]})]}),_="flex items-start gap-3 border-t-[0.5px] border-solid border-[var(--sand-6)] px-5 py-3";return(E=y.href)!=null&&E.startsWith("/")?c.jsx(Hn,{to:y.href,className:_,children:S},y.id):(T=y.href)!=null&&T.includes("github.com")?c.jsxs("a",{href:y.href,target:"_blank",rel:"noreferrer",className:He(_,"group/sub transition-colors hover:bg-[var(--sand-3)]"),children:[S,c.jsx(La,{size:16,className:"ml-auto mt-0.5 shrink-0 text-[var(--sand-10)] transition-colors group-hover/sub:text-[var(--sand-12)]"})]},y.id):c.jsx("div",{className:_,children:S},y.id)}),d.docsUrl&&c.jsxs("a",{href:d.docsUrl,target:"_blank",rel:"noreferrer",className:"flex items-center gap-0.5 border-t-[0.5px] border-solid border-[var(--sand-6)] px-5 py-3 text-[13px] font-medium text-[var(--sand-11)] transition-colors hover:text-[var(--sand-12)]",children:[`View ${d.docsLabel} docs`,c.jsx(La,{size:16})]})]})})]})]},d.id)})})]})})}function ize({src:t,label:e,startFraction:n=0}){const s=oze(),r=w.useRef(null);return w.useEffect(()=>{const i=r.current;if(!i||!n)return;const a=()=>{const{duration:o}=i;Number.isFinite(o)&&o>0&&(i.currentTime=n%1*o)};return i.readyState>=1?a():i.addEventListener("loadedmetadata",a,{once:!0}),()=>i.removeEventListener("loadedmetadata",a)},[n]),w.useEffect(()=>{if(s)return;const i=r.current;if(!i)return;const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting?i.play().catch(()=>{}):i.pause()},{rootMargin:"200px"});return a.observe(i),()=>a.disconnect()},[s]),c.jsx("div",{className:"relative aspect-[320/180] w-full overflow-hidden",style:{border:"0.5px solid var(--sand-6)"},children:c.jsx("video",{ref:r,src:t,className:"block h-full w-full object-cover",muted:!0,loop:!0,playsInline:!0,controls:s,preload:"metadata","aria-label":e})})}const Zde="(prefers-reduced-motion: reduce)";function aze(t){const e=window.matchMedia(Zde);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function oze(){return w.useSyncExternalStore(aze,()=>window.matchMedia(Zde).matches,()=>!1)}const Jo={w:2400,h:1600},QP={w:typeof window>"u"?1440:window.innerWidth,h:typeof window>"u"?900:window.innerHeight},rh={min:.55,max:2.2,start:.75},lze=260,cze=.0012,p6=1200,uze=.94,RY=.02,z_=.28,AY=2.5,NY=.012,dze={"/hackathon-canvas/slot-note.webp":"note.png","/hackathon-canvas/slot-xray.webp":"x-ray.jpg","/hackathon-canvas/slot-wide.webp":"panorama.jpg","/hackathon-canvas/slot-portrait.webp":"portrait.png","/hackathon-canvas/slot-metro.webp":"metro.jpg","/hackathon-canvas/slot-book.webp":"spread.png","/hackathon-canvas/slot-hill.webp":"hillside.jpg","/hackathon-canvas/slot-square.webp":"square.png","/hackathon-canvas/slot-tall.webp":"tower.jpg","/hackathon-canvas/slot-panel.webp":"panel.png","/hackathon-canvas/slot-horse.webp":"horse.jpg","/hackathon-canvas/tee.webp":"tee-back.jpg","/hackathon-canvas/turntable.webp":"turntable.png","/hackathon-canvas/quote.webp":"on-craft.png","/hackathon-canvas/folder-bag.webp":"folder-bag.jpg"},fze=(t,e,n)=>Math.min(n,Math.max(e,t)),ck={x:-Math.round((Jo.w*rh.start-QP.w)/2),y:-Math.round((Jo.h*rh.start-QP.h)/2)},hze=()=>({x:ck.x-Math.round(Math.random()*Jo.w*rh.start),y:ck.y-Math.round(Math.random()*Jo.h*rh.start)}),IY=["/hackathon-canvas/browser-1.mp4","/hackathon-canvas/browser-2.mp4","/hackathon-canvas/browser-3.mp4","/hackathon-canvas/browser-4.mp4","/hackathon-canvas/browser-5.mp4","/hackathon-canvas/browser-6.mp4","/hackathon-canvas/browser-7.mp4"],pze=t=>IY[t*3%IY.length],mze=t=>t*.618033988749895%1,gze=[{kind:"prompt",text:"“Scrape the web for me”",x:60,y:20,w:200},{kind:"tab",x:120,y:90,w:260},{kind:"tab",x:470,y:40,w:300},{kind:"photo",src:"/hackathon-canvas/slot-note.webp",x:830,y:60,w:155,h:201},{kind:"prompt",text:"“Apply instead of me”",x:1040,y:20,w:180},{kind:"tab",x:1040,y:130,w:240},{kind:"folder",x:1350,y:70,w:110},{kind:"tab",x:1520,y:60,w:280},{kind:"photo",src:"/hackathon-canvas/slot-xray.webp",x:1880,y:100,w:260,h:146},{kind:"prompt",text:"“Read the inbox and qualify candidates”",x:250,y:250,w:310},{kind:"terminal",x:470,y:250,w:300},{kind:"photo",src:"/hackathon-canvas/slot-wide.webp",x:250,y:300,w:250,h:158},{kind:"photo",src:"/hackathon-canvas/slot-portrait.webp",x:700,y:300,w:145,h:198},{kind:"prompt",text:"“Reconcile every invoice this month”",x:900,y:300,w:290},{kind:"folder",x:1180,y:300,w:110},{kind:"prompt",text:"“Scrape the web for me”",x:1490,y:320,w:200},{kind:"terminal",x:1720,y:130,w:260},{kind:"prompt",text:"“File the compliance reports”",x:1880,y:290,w:235},{kind:"prompt",text:"“Apply instead of me”",x:350,y:470,w:180},{kind:"tab",x:60,y:500,w:300},{kind:"tab",x:480,y:560,w:240},{kind:"photo",src:"/hackathon-canvas/slot-metro.webp",x:900,y:540,w:160,h:200},{kind:"tab",x:1140,y:480,w:220},{kind:"photo",src:"/hackathon-canvas/slot-book.webp",x:1440,y:560,w:240,h:160},{kind:"tab",x:1780,y:490,w:300},{kind:"prompt",text:"“Pull users from our database experiencing issues”",x:60,y:690,w:390},{kind:"prompt",text:"“Log in and manage for me”",x:700,y:700,w:220},{kind:"prompt",text:"“Read the inbox and qualify candidates”",x:1420,y:720,w:310},{kind:"prompt",text:"“Qualify our inbound leads”",x:2130,y:700,w:230},{kind:"photo",src:"/hackathon-canvas/slot-hill.webp",x:320,y:830,w:150,h:203},{kind:"tab",x:560,y:800,w:280},{kind:"folder",x:950,y:850,w:110},{kind:"terminal",x:880,y:990,w:280},{kind:"tab",x:1130,y:790,w:300},{kind:"photo",src:"/hackathon-canvas/slot-square.webp",x:1520,y:830,w:190,h:190},{kind:"tab",x:1810,y:810,w:240},{kind:"prompt",text:"“Watch our Instagram chat and forward issues”",x:300,y:1010,w:355},{kind:"prompt",text:"“Reconcile every invoice this month”",x:1180,y:1030,w:290},{kind:"prompt",text:"“Qualify our inbound leads”",x:1760,y:1030,w:230},{kind:"photo",src:"/hackathon-canvas/slot-tall.webp",x:120,y:1150,w:150,h:200},{kind:"prompt",text:"“File the compliance reports”",x:180,y:1080,w:235},{kind:"tab",x:340,y:1180,w:260},{kind:"photo",src:"/hackathon-canvas/slot-panel.webp",x:680,y:1210,w:230,h:154},{kind:"tab",x:990,y:1160,w:300},{kind:"prompt",text:"“Pull users from our database experiencing issues”",x:1e3,y:1450,w:390},{kind:"folder",x:1370,y:1200,w:110},{kind:"photo",src:"/hackathon-canvas/slot-horse.webp",x:1550,y:1180,w:170,h:213},{kind:"tab",x:1820,y:1230,w:280},{kind:"prompt",text:"“Log in and manage for me”",x:1560,y:1450,w:220},{kind:"prompt",text:"“Watch our Instagram chat and forward issues”",x:640,y:1440,w:355},{kind:"terminal",x:30,y:1290,w:240},{kind:"photo",src:"/hackathon-canvas/tee.webp",x:2150,y:380,w:200,h:200},{kind:"photo",src:"/hackathon-canvas/turntable.webp",x:2160,y:1140,w:180,h:225},{kind:"photo",src:"/hackathon-canvas/quote.webp",x:2150,y:830,w:160,h:200},{kind:"photo",src:"/hackathon-canvas/folder-bag.webp",x:1800,y:1440,w:210,h:210}],LY=.85,vze=.95,xze=t=>{if(t.kind==="photo")return{w:Math.round(t.w*LY),h:Math.round(t.h*LY)};if(t.kind==="tab"){const e=Math.round(t.w*vze);return{w:e,h:Math.round(e*9/16)}}return t.kind==="folder"?{w:t.w,h:t.w}:t.kind==="terminal"?{w:t.w,h:Math.round(t.w*202/512)}:{w:t.w,h:24}},yze=t=>-260+t*5%9*65,bze=typeof window<"u"?w.useLayoutEffect:w.useEffect;function Sze(){const[t,e]=w.useState(ck),[n,s]=w.useState(rh.start),[r,i]=w.useState(!1),a=w.useRef(ck),o=w.useRef(rh.start),l=w.useRef(!0),u=w.useRef({px:0,py:0,ox:0,oy:0}),d=w.useRef({x:0,y:0}),f=w.useRef({x:0,y:0,t:0}),p=w.useRef(null),m=w.useRef(0),v=w.useRef(null),[x,y]=w.useState(QP);w.useEffect(()=>{const L=v.current;if(!L)return;const j=()=>y(O=>O.w===L.clientWidth&&O.h===L.clientHeight?O:{w:L.clientWidth,h:L.clientHeight});j();const F=new ResizeObserver(j);return F.observe(L),()=>F.disconnect()},[]);const S=(L,j)=>{const F={x:L,y:j};return a.current=F,e(F),F},_=()=>{p.current!==null&&cancelAnimationFrame(p.current),p.current=null};bze(()=>{const{x:L,y:j}=hze();S(L,j)},[]);const E=L=>{const j=Math.min(32,L-m.current);if(m.current=L,!l.current){const O=Math.pow(uze,j/16.667);if(d.current={x:d.current.x*O,y:d.current.y*O},Math.hypot(d.current.x,d.current.y)<RY){p.current=null;return}}const F=a.current;S(F.x+d.current.x*j,F.y+d.current.y*j),p.current=requestAnimationFrame(E)};w.useEffect(()=>{const L=v.current;if(!L)return;const j=F=>{if(!F.ctrlKey&&!F.metaKey)return;F.preventDefault(),l.current=!1;const O=o.current,M=fze(O*Math.exp(-F.deltaY*cze),rh.min,rh.max);if(M===O)return;_();const U=L.getBoundingClientRect(),G=F.clientX-U.left,$=F.clientY-U.top,V=a.current;o.current=M,s(M),S(G-(G-V.x)*(M/O),$-($-V.y)*(M/O))};return L.addEventListener("wheel",j,{passive:!1}),()=>L.removeEventListener("wheel",j)},[]),w.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){l.current=!1;return}return d.current={x:-NY*.82,y:NY*.57},m.current=performance.now(),p.current=requestAnimationFrame(E),_},[]);const T=L=>{l.current=!1,_(),L.currentTarget.setPointerCapture(L.pointerId),u.current={px:L.clientX,py:L.clientY,ox:a.current.x,oy:a.current.y},d.current={x:0,y:0},f.current={x:L.clientX,y:L.clientY,t:performance.now()},i(!0)},k=L=>{if(!r)return;const{px:j,py:F,ox:O,oy:M}=u.current;S(O+(L.clientX-j),M+(L.clientY-F));const U=performance.now(),G=U-f.current.t;if(G>0){const $=(L.clientX-f.current.x)/G,V=(L.clientY-f.current.y)/G;d.current={x:d.current.x*(1-z_)+$*z_,y:d.current.y*(1-z_)+V*z_},f.current={x:L.clientX,y:L.clientY,t:U}}},R=L=>{L.currentTarget.hasPointerCapture(L.pointerId)&&L.currentTarget.releasePointerCapture(L.pointerId),i(!1);const j=performance.now()-f.current.t>80,F=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(j||F||Math.hypot(d.current.x,d.current.y)<RY){d.current={x:0,y:0};return}const O=Math.hypot(d.current.x,d.current.y);if(O>AY){const M=AY/O;d.current={x:d.current.x*M,y:d.current.y*M}}m.current=performance.now(),p.current=requestAnimationFrame(E)},I=(-t.x+x.w/2)/n,A=(-t.y+x.h/2)/n;return c.jsxs("div",{ref:v,"aria-hidden":!0,onPointerDown:T,onPointerMove:k,onPointerUp:R,onPointerCancel:R,className:`relative h-full w-full touch-p
257an-y overflow-hidden select-none ${r?"cursor-grabbing":"cursor-grab"}`,children:[c.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-[var(--sand-1)]"}),c.jsx("div",{className:"absolute inset-0",style:{perspective:`${p6}px`,perspectiveOrigin:"50% 50%"},children:c.jsx("div",{className:"absolute top-0 left-0",style:{width:Jo.w,height:Jo.h,transformOrigin:"0 0",transform:`translate3d(${t.x}px, ${t.y}px, 0) scale(${n})`,transformStyle:"preserve-3d"},children:gze.flatMap((L,j)=>{const F=xze(L),O=Math.round((I-L.x-F.w/2)/Jo.w)*Jo.w,M=Math.round((A-L.y-F.h/2)/Jo.h)*Jo.h,U=p6/(p6+lze),G=x.w/2/(n*U)+F.w,$=x.h/2/(n*U)+F.h,V=[];for(const B of[-1,0,1])for(const q of[-1,0,1]){const z=O+B*Jo.w,D=M+q*Jo.h;Math.abs(L.x+F.w/2+z-I)>G||Math.abs(L.y+F.h/2+D-A)>$||V.push({wx:z,wy:D})}return V.map(({wx:B,wy:q})=>c.jsxs("div",{className:L.kind==="prompt"?"absolute flex w-max items-center gap-[5px]":"absolute",style:{left:L.x,top:L.y,...L.kind==="prompt"?{}:{width:F.w,height:F.h},transform:`translate3d(${B}px, ${q}px, ${yze(j)}px)`},children:[L.kind==="tab"?c.jsx(ize,{src:pze(j),startFraction:mze(j)}):L.kind==="prompt"?c.jsx("p",{className:"text-[14px] leading-[18px] font-[450] whitespace-nowrap text-[var(--sand-11)] [text-shadow:0_1px_3px_rgb(255_255_255/0.7)] dark:text-[var(--sand-10)] dark:[text-shadow:0_1px_3px_rgb(0_0_0/0.5)]",children:L.text}):c.jsx("img",{src:L.kind==="folder"?"/hackathon-canvas/folder.png":L.kind==="terminal"?"/hackathon-canvas/terminal.png":L.src,alt:"",draggable:!1,width:F.w,height:F.h,className:L.kind==="folder"?"h-full w-full object-contain":"h-full w-full object-cover",style:L.kind==="folder"?void 0:{border:"0.5px solid var(--sand-6)"}}),L.kind==="photo"&&c.jsx("span",{"aria-hidden":!0,className:"absolute top-full left-1/2 mt-1 w-max -translate-x-1/2 text-[13px] leading-[16px] font-[450] whitespace-nowrap text-[var(--sand-11)] [text-shadow:0_1px_2px_rgb(255_255_255/0.7)] dark:text-[var(--sand-10)] dark:[text-shadow:0_1px_2px_rgb(0_0_0/0.45)]",children:dze[L.src]??"untitled.png"})]},`${L.kind}-${L.x}-${L.y}-${B}-${q}`))})})})]})}function m6(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M14 6L20 12L14 18M19 12H4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const wze=({className:t})=>c.jsxs("svg",{width:"73",height:"42",viewBox:"0 0 73 42",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":!0,children:[c.jsx("path",{d:"M11.8751 8.8367C18.9452 1.92926 30.2304 -6.9404 18.8099 12.8405L4.41729 37.7692C3.74893 38.9269 2.12853 39.1123 1.50733 37.9287C-0.990442 33.1695 1.56878 26.489 26.5553 26.489H71.2693",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("path",{d:"M35.0148 0.75C23.8232 16.9313 4.84061 47.3304 18.4432 39.477",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("path",{d:"M32.0684 16.9614L18.7693 39.2163",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),V_="cursor-pointer flex h-[40px] w-full items-center justify-between rounded-[8px] bg-[var(--sand-12)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-1)] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-95 active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100";function _ze({isAuthLoaded:t,isSignedIn:e,unavailable:n,isAccessLoading:s,isPending:r,isSuccess:i,error:a,onActivate:o}){return c.jsxs("div",{className:"relative z-10 flex h-auto w-full max-w-[605px] flex-col overflow-hidden rounded-[20px] border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] shadow-[0_24px_48px_-16px_rgba(0,0,0,0.15)] dark:shadow-[0_24px_48px_-16px_rgba(0,0,0,0.55)] sm:h-[586px] sm:rounded-[24px]",children:[c.jsxs("div",{className:"flex gap-[10px] border-b-[0.5px] border-b-[var(--sand-6)] bg-[var(--sand-3)] px-5 py-4 sm:px-6 sm:py-5",children:[c.jsx("span",{className:"size-3 rounded-full bg-[#E0443E]"}),c.jsx("span",{className:"size-3 rounded-full bg-[#DEA123]"}),c.jsx("span",{className:"size-3 rounded-full bg-[#1AAB29]"})]}),c.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-5 sm:gap-5 sm:p-6",children:[c.jsx("h1",{className:"text-[20px] leading-[28px] font-medium text-[var(--sand-12)]",children:"Battle of the Schools Hackathon"}),c.jsx("p",{className:"text-[15px] leading-relaxed font-normal text-[var(--sand-12)]",children:"Give your agent a computer. See what it can build."}),c.jsx("p",{className:"text-[15px] leading-relaxed font-normal text-[var(--sand-10)]",children:"Steel Computer gives your agent a persistent computer in the cloud, with a browser, terminal, desktop, and shared filesystem. Build an agent that downloads a dataset and analyzes it, runs an app and tests it, or gets work done across websites and desktop tools."}),c.jsx("p",{className:"text-[15px] leading-relaxed font-normal text-[var(--sand-10)]",children:"Activate your account to get access, grab your API key, and follow the quickstart to launch your first computer."}),c.jsxs("div",{className:"mt-auto flex flex-col items-start self-stretch",children:[c.jsx(wze,{className:"text-[var(--sand-12)] dark:text-white"}
257),c.jsx("p",{className:"mt-2 text-[12px] leading-[16px] font-normal text-[var(--sand-11)]",children:"Hussien Hussien, CEO of Steel"}),a&&c.jsx("p",{className:"mt-4 text-[13px] leading-[18px] text-[var(--red-11)]",children:a.message}),n&&c.jsx("p",{className:"mt-4 text-[13px] leading-[18px] text-[var(--sand-10)]",children:"This invitation is not active right now. Please check with your challenge organizer."}),t?e?i?c.jsxs(Hn,{to:"/computers",className:`${V_} mt-5`,children:["Open computers",c.jsx(m6,{size:16})]}):c.jsxs("button",{type:"button",className:`${V_} mt-5`,onClick:o,disabled:s||n||r,children:[r?"Activating Steel Computer...":"Activate Steel Computer",r?c.jsx(kd,{className:"size-4 animate-spin"}):c.jsx(m6,{size:16})]}):c.jsxs(Hn,{to:"/sign-in?redirect=%2Fcomputer-access",className:`${V_} mt-5`,children:["Sign up",c.jsx(m6,{size:16})]}):c.jsxs("button",{type:"button",className:`${V_} mt-5`,disabled:!0,children:["Preparing account...",c.jsx(kd,{className:"size-4 animate-spin"})]})]})]})]})}function Eze(t,e){return typeof t=="object"&&t&&"message"in t?new Error(String(t.message)):new Error(e?`Activation failed (${e})`:"Activation failed")}function Cze(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),{createOrganization:s}=Qm(),{setActive:r}=Ile(),{user:i}=Vi(),a=aa(),o=w.useRef(!1),[l,u]=w.useState(null),d=I7("hackathon-july",{enabled:e,staleTime:0}),f=Bi({mutationFn:async()=>{var m;const p=await ht.post({url:"/v1/hackathon-july/activate"});if(p.error||!p.data)throw Eze(p.error,(m=p.response)==null?void 0:m.status);return p.data},onSuccess:()=>{a.invalidateQueries({queryKey:["computers",n,"quota"]})}});return w.useEffect(()=>{var m;if(!e||!i||n||!r||o.current)return;o.current=!0;const p=(m=i.organizationMemberships[0])==null?void 0:m.organization;(async()=>{try{const v=p??await s({name:`${i.firstName||i.username||"Anon"}'s Team`});await r({organization:v})}catch(v){u(v instanceof Error?v:new Error("Unable to prepare your Steel organization"))}finally{o.current=!1}})()},[s,e,n,r,i]),c.jsxs("div",{className:"relative flex min-h-dvh w-full items-start justify-center overflow-x-hidden overflow-y-auto bg-[var(--sand-1)] p-4 sm:items-center sm:p-8",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(Sze,{})}),c.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-white/55 dark:bg-black/65"}),c.jsx(_ze,{isAuthLoaded:t,isSignedIn:!!e,unavailable:!!(e&&d.isSuccess&&!d.data.isEnabled),isAccessLoading:!!(e&&(!n||d.isLoading)),isPending:f.isPending,isSuccess:f.isSuccess,error:l??f.error,onActivate:()=>f.mutate()})]})}function Tze(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9 16C5.68629 16 3 13.3137 3 10C3 6.68629 5.68629 4 9 4C11.4597 4 13.5737 5.48012 14.5 7.59829M21 14C21 17.3137 18.3137 20 15 20C12.3841 20 10.1591 18.3259 9.33811 15.9906C9.11911 15.3677 9 14.6978 9 14C9 10.7998 11.5055 8.1847 14.6619 8.00937C14.7738 8.00315 14.8865 8 15 8C18.3137 8 21 10.6863 21 14Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square"})})}function yd(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M19 11.7324V18C19 19.1046 18.1046 20 17 20H7C5.89543 20 5 19.1046 5 18V11.7324M19 11.7324V11.5M19 11.7324C19.5978 11.3866 20 10.7403 20 10C20 8.89543 19.1046 8 18 8H6C4.89543 8 4 8.89543 4 10C4 10.7403 4.4022 11.3866 5 11.7324M19 11.7324C18.7058 11.9026 18.3643 12 18 12H6C5.63571 12 5.29417 11.9026 5 11.7324M5 11.5V11.7324M12 8V6.33333M12 8H10.3333C8.49238 8 7 6.50762 7 4.66667C7 3.74619 7.74619 3 8.66667 3C10.5076 3 12 4.49238 12 6.33333M12 8H13.6667C15.5076 8 17 6.50762 17 4.66667C17 3.74619 16.2538 3 15.3333 3C13.4924 3 12 4.49238 12 6.33333M12 8V20",stroke:"currentColor",strokeWidth:"2"})})}const Xde=({height:t=24}={})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t*32/24,height:t,viewBox:"0 0 32 24",fill:"none",children:c.jsx("path",{d:"M7.57889 0.571289C3.39319 0.571289 0 3.8606 0 7.91817C0 11.9757 3.39319 15.265 7.57889 15.265H15.9999C16.465 15.265 16.842 15.6305 16.842 16.0814C16.842 16.5322 16.465 16.8977 15.9999 16.8977H0.58947C0.263915 16.8977 0 17.1535 0 17.4691V22.8568C0 23.1724 0.263915 23.4282 0.58947 23.4282H15.9999C20.1856 23.4282 23.5788 20.1389 23.5788 16.0814C23.5788 12.0238 20.1856 8.73449 15.9999 8.73449H7.57889C7.11382 8.73449 6.73679 8.36901 6.73679 7.91817C6.73679 7.46733 7.11382 7.10185 7.57889 7.10185H21.8588C21.8708 7.10197 21.8828 7.10203 21.8948 7.10203H24.4211C24.8862 7.10203 25.2632 7.46751 25.2632 7.91835V22.857C25.2632 23.1726 25.5271 23.4284 25.8527 23.4284H31.4105C31.7361 23.4284 32 23.1726 32 22.857V7.91835C32 3.86078 28.6068 0.571472 24.4211 0.571472H23.5788V0.571289H7.57889Z",fill:"var(--sand-12)"})});
vendor: 4,559 bytes, line 257
257var Zs="-ms-",ub="-moz-",es="-webkit-",Qde="comm",D4="rule",M7="decl",kze="@import",Rze="@namespace",Jde="@keyframes",Aze="@layer",efe=Math.abs,D7=String.fromCharCode,JP=Object.assign;function Nze(t,e){return oi(t,0)^45?(((e<<2^oi(t,0))<<2^oi(t,1))<<2^oi(t,2))<<2^oi(t,3):0}function tfe(t){return t.trim()}function Xu(t,e){return(t=e.exec(t))?t[0]:t}function bn(t,e,n){return t.replace(e,n)}function UC(t,e,n){return t.indexOf(e,n)}function oi(t,e){return t.charCodeAt(e)|0}function jm(t,e,n){return t.slice(e,n)}function Bl(t){return t.length}function nfe(t){return t.length}function Iy(t,e){return e.push(t),t}function Ize(t,e){return t.map(e).join("")}function jY(t,e){return t.filter(function(n){return!Xu(n,e)})}var O4=1,Gv=1,sfe=0,ml=0,Jr=0,F1="";function $4(t,e,n,s,r,i,a,o){return{value:t,root:e,parent:n,type:s,props:r,children:i,line:O4,column:Gv,length:a,return:"",siblings:o}}function If(t,e){return JP($4("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},e)}function Ug(t){for(;t.root;)t=If(t.root,{children:[t]});Iy(t,t.siblings)}function Lze(){return Jr}function jze(){return Jr=ml>0?oi(F1,--ml):0,Gv--,Jr===10&&(Gv=1,O4--),Jr}function rc(){return Jr=ml<sfe?oi(F1,ml++):0,Gv++,Jr===10&&(Gv=1,O4++),Jr}function ih(){return oi(F1,ml)}function BC(){return ml}function F4(t,e){return jm(F1,t,e)}function i2(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Pze(t){return O4=Gv=1,sfe=Bl(F1=t),ml=0,[]}function Mze(t){return F1="",t}function g6(t){return tfe(F4(ml-1,eM(t===91?t+2:t===40?t+1:t)))}function Dze(t){for(;(Jr=ih())&&Jr<33;)rc();return i2(t)>2||i2(Jr)>3?"":" "}function Oze(t,e){for(;--e&&rc()&&!(Jr<48||Jr>102||Jr>57&&Jr<65||Jr>70&&Jr<97););return F4(t,BC()+(e<6&&ih()==32&&rc()==32))}function eM(t){for(;rc();)switch(Jr){case t:return ml;case 34:case 39:t!==34&&t!==39&&eM(Jr);break;case 40:t===41&&eM(t);break;case 92:rc();break}return ml}function $ze(t,e){for(;rc()&&t+Jr!==57;)if(t+Jr===84&&ih()===47)break;return"/*"+F4(e,ml-1)+"*"+D7(t===47?t:rc())}function Fze(t){for(;!i2(ih());)rc();return F4(t,ml)}function Uze(t){return Mze(zC("",null,null,null,[""],t=Pze(t),0,[0],t))}function zC(t,e,n,s,r,i,a,o,l){for(var u=0,d=0,f=a,p=0,m=0,v=0,x=1,y=1,S=1,_=0,E="",T=r,k=i,R=s,I=E;y;)switch(v=_,_=rc()){case 40:if(v!=108&&oi(I,f-1)==58){UC(I+=bn(g6(_),"&","&\f"),"&\f",efe(u?o[u-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:I+=g6(_);break;case 9:case 10:case 13:case 32:I+=Dze(v);break;case 92:I+=Oze(BC()-1,7);continue;case 47:switch(ih()){case 42:case 47:Iy(Bze($ze(rc(),BC()),e,n,l),l),(i2(v||1)==5||i2(ih()||1)==5)&&Bl(I)&&jm(I,-1,void 0)!==" "&&(I+=" ");break;default:I+="/"}break;case 123*x:o[u++]=Bl(I)*S;case 125*x:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:S==-1&&(I=bn(I,/\f/g,"")),m>0&&(Bl(I)-f||x===0&&v===47)&&Iy(m>32?MY(I+";",s,n,f-1,l):MY(bn(I," ","")+";",s,n,f-2,l),l);break;case 59:I+=";";default:if(Iy(R=PY(I,e,n,u,d,r,o,E,T=[],k=[],f,i),i),_===123)if(d===0)zC(I,e,R,R,T,i,f,o,k);else{switch(p){case 99:if(oi(I,3)===110)break;case 108:if(oi(I,2)===97)break;default:d=0;case 100:case 109:case 115:}d?zC(t,R,R,s&&Iy(PY(t,R,R,0,0,r,o,E,r,T=[],f,k),k),r,k,f,o,s?T:k):zC(I,R,R,R,[""],k,0,o,k)}}u=d=m=0,x=S=1,E=I="",f=a;break;case 58:f=1+Bl(I),m=v;default:if(x<1){if(_==123)--x;else if(_==125&&x++==0&&jze()==125)continue}switch(I+=D7(_),_*x){case 38:S=d>0?1:(I+="\f",-1);break;case 44:o[u++]=(Bl(I)-1)*S,S=1;break;case 64:ih()===45&&(I+=g6(rc())),p=ih(),d=f=Bl(E=I+=Fze(BC())),_++;break;case 45:v===45&&Bl(I)==2&&(x=0)}}return i}function PY(t,e,n,s,r,i,a,o,l,u,d,f){for(var p=r-1,m=r===0?i:[""],v=nfe(m),x=0,y=0,S=0;x<s;++x)for(var _=0,E=jm(t,p+1,p=efe(y=a[x])),T=t;_<v;++_)(T=tfe(y>0?m[_]+" "+E:bn(E,/&\f/g,m[_])))&&(l[S++]=T);return $4(t,e,n,r===0?D4:o,l,u,d,f)}function Bze(t,e,n,s){return $4(t,e,n,Qde,D7(Lze()),jm(t,2,-2),0,s)}function MY(t,e,n,s,r){return $4(t,e,n,M7,jm(t,0,s),jm(t,s+1,-1),s,r)}function rfe(t,e,n){switch(Nze(t,e)){case 5103:return es+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return es+t+t;case 4855:return es+t.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+t;case 4789:return ub+t+t;
vendor: 4,774 bytes, lines 257-258
257case 5349:case 4246:case 4810:case 6968:case 2756:return es+t+ub+t+Zs+t+t;case 5936:switch(oi(t,e+11)){case 114:return es+t+Zs+bn(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return es+t+Zs+bn(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return es+t+Zs+bn(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return es+t+Zs+t+t;case 6165:return es+t+Zs+"flex-"+t+t;case 5187:return es+t+bn(t,/(\w+).+(:[^]+)/,es+"box-$1$2"+Zs+"flex-$1$2")+t;case 5443:return es+t+Zs+"flex-item-"+bn(t,/flex-|-self/g,"")+(Xu(t,/flex-|baseline/)?"":Zs+"grid-row-"+bn(t,/flex-|-self/g,""))+t;case 4675:return es+t+Zs+"flex-line-pack"+bn(t,/align-content|flex-|-self/g,"")+t;case 5548:return es+t+Zs+bn(t,"shrink","negative")+t;case 5292:return es+t+Zs+bn(t,"basis","preferred-size")+t;case 6060:return es+"box-"+bn(t,"-grow","")+es+t+Zs+bn(t,"grow","positive")+t;case 4554:return es+bn(t,/([^-])(transform)/g,"$1"+es+"$2")+t;case 6187:return bn(bn(bn(t,/(zoom-|grab)/,es+"$1"),/(image-set)/,es+"$1"),t,"")+t;case 5495:case 3959:return bn(t,/(image-set\([^]*)/,es+"$1$`$1");case 4968:return bn(bn(t,/(.+:)(flex-)?(.*)/,es+"box-pack:$3"+Zs+"flex-pack:$3"),/space-between/,"justify")+es+t+t;case 4200:if(!Xu(t,/flex-|baseline/))return Zs+"grid-column-align"+jm(t,e)+t;break;case 2592:case 3360:return Zs+bn(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(s,r){return e=r,Xu(s.props,/grid-\w+-end/)})?~UC(t+(n=n[e].value),"span",0)?t:Zs+bn(t,"-start","")+t+Zs+"grid-row-span:"+(~UC(n,"span",0)?Xu(n,/\d+/):+Xu(n,/\d+/)-+Xu(t,/\d+/))+";":Zs+bn(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(s){return Xu(s.props,/grid-\w+-start/)})?t:Zs+bn(bn(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return bn(t,/(.+)-inline(.+)/,es+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Bl(t)-1-e>6)switch(oi(t,e+1)){case 109:if(oi(t,e+4)!==45)break;case 102:return bn(t,/(.+:)(.+)-([^]+)/,"$1"+es+"$2-$3$1"+ub+(oi(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~UC(t,"stretch",0)?rfe(bn(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return bn(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(s,r,i,a,o,l,u){return Zs+r+":"+i+u+(a?Zs+r+"-span:"+(o?l:+l-+i)+u:"")+t});case 4949:if(oi(t,e+6)===121)return bn(t,":",":"+es)+t;break;case 6444:switch(oi(t,oi(t,14)===45?18:11)){case 120:return bn(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+es+(oi(t,14)===45?"inline-":"")+"box$3$1"+es+"$2$3$1"+Zs+"$2box$3")+t;case 100:return bn(t,":",":"+Zs)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return bn(t,"scroll-","scroll-snap-")+t}return t}function uk(t,e){for(var n="",s=0;s<t.length;s++)n+=e(t[s],s,t,e)||"";return n}function zze(t,e,n,s){switch(t.type){case Aze:if(t.children.length)break;case kze:case Rze:case M7:return t.return=t.return||t.value;case Qde:return"";case Jde:return t.return=t.value+"{"+uk(t.children,s)+"}";case D4:if(!Bl(t.value=t.props.join(",")))return""}return Bl(n=uk(t.children,s))?t.return=t.value+"{"+n+"}":""}function Vze(t){var e=nfe(t);return function(n,s,r,i){for(var a="",o=0;o<e;o++)a+=t[o](n,s,r,i)||"";return a}}function Hze(t){return function(e){e.root||(e=e.return)&&t(e)}}function Gze(t,e,n,s){if(t.length>-1&&!t.return)switch(t.type){case M7:t.return=rfe(t.value,t.length,n);return;case Jde:return uk([If(t,{value:bn(t.value,"@","@"+es)})],s);case D4:if(t.length)return Ize(n=t.props,function(r){switch(Xu(r,s=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Ug(If(t,{props:[bn(r,/:(read-\w+)/,":"+ub+"$1")]})),Ug(If(t,{props:[r]})),JP(t,{props:jY(n,s)});break;case"::placeholder":Ug(If(t,{props:[bn(r,/:(plac\w+)/,":"+es+"input-$1")]})),Ug(If(t,{props:[bn(r,/:(plac\w+)/,":"+ub+"$1")]})),Ug(If(t,{props:[bn(r,/:(plac\w+)/,Zs+"input-$1")]})),Ug(If(t,{props:[r]})),JP(t,{props:jY(n,s)});break}return""})}}var Q0={},v6,x6;const Wv=typeof process<"u"&&Q0!==void 0&&(Q0.REACT_APP_SC_ATTR||Q0.SC_ATTR)||"data-styled",ife="active",afe="data-styled-version",U4="6.5.3",O7=`/*!sc*/
258`,db=typeof window<"u"&&typeof document<"u";function DY(t){if(typeof process<"u"&&Q0!==void 0){const e=Q0[t];if(e!==void 0&&e!=="")return e!=="false"}}const Wze=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:(x6=(v6=DY("REACT_APP_SC_DISABLE_SPEEDY"))!==null&&v6!==void 0?v6:DY("SC_DISABLE_SPEEDY"))!==null&&x6!==void 0?x6:typeof process<"u"&&Q0!==void 0&&!1),qze="sc-keyframes-";function B4(t,...e){return new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${t} for more information.${e.length>0?` Args: ${e.join(", ")}`:""}`)}let VC=new Map,dk=new Map,HC=1;const H_=t=>{if(VC.has(t))return VC.get(t);for(;dk.has(HC);
vendor: 5,797 bytes, line 258
258)HC++;const e=HC++;return VC.set(t,e),dk.set(e,t),e},Kze=t=>dk.get(t),Yze=(t,e)=>{HC=e+1,VC.set(t,e),dk.set(e,t)},$7=Object.freeze([]),qv=Object.freeze({});function Zze(t,e,n=qv){return t.theme!==n.theme&&t.theme||e||n.theme}const Xze=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Qze=/(^-|-$)/g;function ofe(t){return t.replace(Xze,"-").replace(Qze,"")}const Jze=/(a)(d)/gi,OY=t=>String.fromCharCode(t+(t>25?39:97));function lfe(t){let e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=OY(e%52)+n;return(OY(e%52)+n).replace(Jze,"$1-$2")}const tM=5381,wm=(t,e)=>{let n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return t},cfe=t=>wm(tM,t);function eVe(t){return lfe(cfe(t)>>>0)}function tVe(t){return t.displayName||t.name||"Component"}function nM(t){return typeof t=="string"&&!0}function nVe(t){return nM(t)?`styled.${t}`:`Styled(${tVe(t)})`}const ufe=Symbol.for("react.memo"),sVe=Symbol.for("react.forward_ref"),rVe={contextType:!0,defaultProps:!0,displayName:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,propTypes:!0,type:!0},iVe={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},dfe={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},aVe={[sVe]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[ufe]:dfe};function $Y(t){return("type"in(e=t)&&e.type.$$typeof)===ufe?dfe:"$$typeof"in t?aVe[t.$$typeof]:rVe;var e}const oVe=Object.defineProperty,lVe=Object.getOwnPropertyNames,cVe=Object.getOwnPropertySymbols,uVe=Object.getOwnPropertyDescriptor,dVe=Object.getPrototypeOf,fVe=Object.prototype;function ffe(t,e,n){if(typeof e!="string"){const s=dVe(e);s&&s!==fVe&&ffe(t,s,n);const r=lVe(e).concat(cVe(e)),i=$Y(t),a=$Y(e);for(let o=0;o<r.length;++o){const l=r[o];if(!(l in iVe||n&&n[l]||a&&l in a||i&&l in i)){const u=uVe(e,l);try{oVe(t,l,u)}catch{}}}}return t}function z4(t){return typeof t=="function"}const hVe=Symbol.for("react.forward_ref");function hfe(t){return t!=null&&(typeof t=="object"||typeof t=="function")&&t.$$typeof===hVe&&"styledComponentId"in t}function Ly(t,e){return t&&e?t+" "+e:t||e||""}function FY(t,e){return t.join("")}function a2(t){return t!==null&&typeof t=="object"&&t.constructor.name===Object.name&&!("props"in t&&t.$$typeof)}function sM(t,e,n=!1){if(!n&&!a2(t)&&!Array.isArray(t))return e;if(Array.isArray(e))for(let s=0;s<e.length;s++)t[s]=sM(t[s],e[s]);else if(a2(e))for(const s in e)t[s]=sM(t[s],e[s]);return t}function pfe(t,e){Object.defineProperty(t,"toString",{value:e})}const pVe=class{constructor(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e,this._cGroup=0,this._cIndex=0}indexOfGroup(e){if(e===this._cGroup)return this._cIndex;let n=this._cIndex;if(e>this._cGroup)for(let s=this._cGroup;s<e;s++)n+=this.groupSizes[s];else for(let s=this._cGroup-1;s>=e;s--)n-=this.groupSizes[s];return this._cGroup=e,this._cIndex=n,n}insertRules(e,n){if(e>=this.groupSizes.length){const i=this.groupSizes,a=i.length;let o=a;for(;e>=o;)if(o<<=1,o<0)throw B4(16,`${e}`);this.groupSizes=new Uint32Array(o),this.groupSizes.set(i),this.length=o;for(let l=a;l<o;l++)this.groupSizes[l]=0}let s=this.indexOfGroup(e+1),r=0;for(let i=0,a=n.length;i<a;i++)this.tag.insertRule(s,n[i])&&(this.groupSizes[e]++,s++,r++);r>0&&this._cGroup>e&&(this._cIndex+=r)}clearGroup(e){if(e<this.length){const n=this.groupSizes[e],s=this.indexOfGroup(e),r=s+n;this.groupSizes[e]=0;for(let i=s;i<r;i++)this.tag.deleteRule(s);n>0&&this._cGroup>e&&(this._cIndex-=n)}}getGroup(e){let n="";if(e>=this.length||this.groupSizes[e]===0)return n;const s=this.groupSizes[e],r=this.indexOfGroup(e),i=r+s;for(let a=r;a<i;a++)n+=this.tag.getRule(a)+O7;return n}},mVe=`style[${Wv}][${afe}="${U4}"]`,gVe=new RegExp(`^${Wv}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`),UY=t=>typeof ShadowRoot<"u"&&t instanceof ShadowRoot||"host"in t&&t.nodeType===11,rM=t=>{if(!t)return document;if(UY(t))return t;if("getRootNode"in t){const e=t.getRootNode();if(UY(e))return e}return document},vVe=(t,e,n)=>{const s=n.split(",");let r;for(let i=0,a=s.length;i<a;i++)(r=s[i])&&t.registerName(e,r)},xVe=(t,e)=>{var n;const s=((n=e.textContent)!==null&&n!==void 0?n:"").split(O7),r=[];for(let i=0,a=s.length;i<a;i++){const o=s[i].trim();if(!o)continue;const l=o.match(gVe);if(l){const u=0|parseInt(l[1],10),d=l[2];u!==0&&(Yze(d,u),vVe(t,d,l[3]),t.getTag().insertRules(u,r)),r.length=0}else r.push(o)}},y6=t=>{const e=rM(t.options.target).querySelectorAll(mVe);for(let n=0,s=e.length;n<s;n++){const r=e[n];r&&r.getAttribute(Wv)!==ife&&(xVe(t,r),r.parentNode&&r.parentNode.removeChild(r))}};let ey=!1;function yVe(){if(ey!==!1)return ey;if(typeof document<"u"){const t=document.head.querySelector('meta[property="csp-nonce"]');if(t)return ey=t.nonce||t.getAttribute("content")||void 0;const e=document.head.querySelector('meta[name="sc-nonce"]');if(e)return ey=e.getAttribute("content")||void 0}return ey=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0}const mfe=(t,e)=>{const n=document.head,s=t||n,r=document.createElement("style"),i=(l=>{const u=Array.from(l.querySelectorAll(`style[${Wv}]`));return u[u.length-1]})(s),a=i!==void 0?i.nextSibling:null;r.setAttribute(Wv,ife),r.setAttribute(afe,U4);const o=e||yVe();return o&&r.setAttribute("nonce",o),s.insertBefore(r,a),r},bVe=class{constructor(e,n){this.element=mfe(e,n),this.element.appendChild(document.createTextNode("")),this.sheet=(s=>{var r;if(s.sheet)return s.sheet;const i=(r=s.getRootNode().styleSheets)!==null&&r!==void 0?r:document.styleSheets;for(let a=0,o=i.length;a<o;a++){const l=i[a];if(l.ownerNode===s)return l}throw B4(17)})(this.element),this.length=0}insertRule(e,n){try{return this.sheet.insertRule(n,e),this.length++,!0}catch{return!1}}deleteRule(e){this.sheet.deleteRule(e),this.length--}getRule(e){const n=this.sheet.cssRules[e];return n&&n.cssText?n.cssText:""}}
258,SVe=class{constructor(e,n){this.element=mfe(e,n),this.nodes=this.element.childNodes,this.length=0}insertRule(e,n){if(e<=this.length&&e>=0){const s=document.createTextNode(n);return this.element.insertBefore(s,this.nodes[e]||null),this.length++,!0}return!1}deleteRule(e){this.element.removeChild(this.nodes[e]),this.length--}getRule(e){return e<this.length?this.nodes[e].textContent:""}};let BY=db;const wVe={isServer:!db,useCSSOMInjection:!Wze};let gfe=class vfe{static registerId(e){return H_(e)}constructor(e=qv,n={},s){this.options=Object.assign(Object.assign({},wVe),e),this.gs=n,this.keyframeIds=new Set,this.names=new Map(s),this.server=!!e.isServer,!this.server&&db&&BY&&(BY=!1,y6(this)),pfe(this,()=>(r=>{const i=r.getTag(),{length:a}=i;let o="";for(let l=0;l<a;l++){const u=Kze(l);if(u===void 0)continue;const d=r.names.get(u);if(d===void 0||!d.size)continue;const f=i.getGroup(l);if(f.length===0)continue;const p=Wv+".g"+l+'[id="'+u+'"]';let m="";for(const v of d)v.length>0&&(m+=v+",");o+=f+p+'{content:"'+m+'"}'+O7}return o})(this))}rehydrate(){!this.server&&db&&y6(this)}reconstructWithOptions(e,n=!0){const s=new vfe(Object.assign(Object.assign({},this.options),e),this.gs,n&&this.names||void 0);return s.keyframeIds=new Set(this.keyframeIds),!this.server&&db&&e.target!==this.options.target&&rM(this.options.target)!==rM(e.target)&&y6(s),s}allocateGSInstance(e){return this.gs[e]=(this.gs[e]||0)+1}getTag(){return this.tag||(this.tag=(e=(({useCSSOMInjection:n,target:s,nonce:r})=>n?new bVe(s,r):new SVe(s,r))(this.options),new pVe(e)));var e}hasNameForId(e,n){var s,r;return(r=(s=this.names.get(e))===null||s===void 0?void 0:s.has(n))!==null&&r!==void 0&&r}registerName(e,n){H_(e),e.startsWith(qze)&&this.keyframeIds.add(e);const s=this.names.get(e);s?s.add(n):this.names.set(e,new Set([n]))}insertRules(e,n,s){this.registerName(e,n),this.getTag().insertRules(H_(e),s)}clearNames(e){this.names.has(e)&&this.names.get(e).clear()}clearRules(e){this.getTag().clearGroup(H_(e)),this.clearNames(e)}clearTag(){this.tag=void 0}};const xfe=new WeakSet,_Ve={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexShrink:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function EVe(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e!="number"||e===0||t in _Ve||t.startsWith("--")?String(e).trim():e+"px"}const $p=47;function zY(t){if(t.charCodeAt(0)===45&&t.charCodeAt(1)===45)return t;let e="";for(let n=0;n<t.length;n++){const s=t.charCodeAt(n);e+=s>=65&&s<=90?"-"+String.fromCharCode(s+32):t[n]}return e.startsWith("ms-")?"-"+e:e}const CVe=Symbol.for("sc-keyframes");function TVe(t){return typeof t=="object"&&t!==null&&CVe in t}function yfe(t){return z4(t)&&!(t.prototype&&t.prototype.isReactComponent)}const bfe=t=>t==null||t===!1||t==="",kVe=Symbol.for("react.client.reference");function VY(t){return t.$$typeof===kVe}function Sfe(t,e){for(const n in t){const s=t[n];t.hasOwnProperty(n)&&!bfe(s)&&(Array.isArray(s)&&xfe.has(s)||z4(s)?e.push(zY(n)+":",s,";"):a2(s)?(e.push(n+" {"),Sfe(s,e),e.push("}")):e.push(zY(n)+": "+EVe(n,s)+";"))}}function _m(t,e,n,s,r=[]){if(bfe(t))return r;const i=typeof t;if(i==="string")return r.push(t),r;if(i==="function"){if(VY(t))return r;if(yfe(t)&&e){const a=t(e);return _m(a,e,n,s,r)}return r.push(t),r}if(Array.isArray(t)){for(let a=0;a<t.length;a++)_m(t[a],e,n,s,r);return r}return hfe(t)?(r.push(`.${t.styledComponentId}`),r):TVe(t)?(n?(t.inject(n,s),r.push(t.getName(s))):r.push(t),r):VY(t)?r:a2(t)?t.toString!==Object.prototype.toString?(r.push(t.toString()),r):(Sfe(t,r),r):(r.push(t.toString()),r)}const RVe=cfe(U4);let AVe=class{constructor(e,n,s){this.rules=e,this.componentId=n,this.baseHash=wm(RVe,n),this.baseStyle=s,gfe.registerId(n)}generateAndInjectStyles(e,n,s){let r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,n,s):"";{let i="";for(let a=0;a<this.rules.length;a++){const o=this.rules[a];
258if(typeof o=="string")i+=o;else if(o)if(yfe(o)){const l=o(e);typeof l=="string"?i+=l:l!=null&&l!==!1&&(i+=FY(_m(l,e,n,s)))}else i+=FY(_m(o,e,n,s))}if(i){this.dynamicNameCache||(this.dynamicNameCache=new Map);const a=s.hash?s.hash+i:i;let o=this.dynamicNameCache.get(a);if(!o){if(o=lfe(wm(wm(this.baseHash,s.hash),i)>>>0),this.dynamicNameCache.size>=200){const l=this.dynamicNameCache.keys().next().value;l!==void 0&&this.dynamicNameCache.delete(l)}this.dynamicNameCache.set(a,o)}if(!n.hasNameForId(this.componentId,o)){const l=s(i,"."+o,void 0,this.componentId);n.insertRules(this.componentId,o,l)}r=Ly(r,o)}}return r}};const NVe=/&/g;function wfe(t,e){let n=0;for(;--e>=0&&t.charCodeAt(e)===92;)n++;return!(1&~n)}function b6(t){const e=t.length;let n="",s=0,r=0,i=0,a=!1,o=!1;for(let l=0;l<e;l++){const u=t.charCodeAt(l);if(i!==0||a||u!==$p||t.charCodeAt(l+1)!==42)if(a)u===42&&t.charCodeAt(l+1)===$p&&(a=!1,l++);else if(u!==34&&u!==39||wfe(t,l)){if(i===0)if(u===123)r++;else if(u===125){if(r--,r<0){o=!0;let d=l+1;for(;d<e;){const f=t.charCodeAt(d);if(f===59||f===10)break;d++}d<e&&t.charCodeAt(d)===59&&d++,r=0,l=d-1,s=d;continue}r===0&&(n+=t.substring(s,l+1),s=l+1)}else u===59&&r===0&&(n+=t.substring(s,l+1),s=l+1)}else i===0?i=u:i===u&&(i=0);else a=!0,l++}return o||r!==0||i!==0?(s<e&&r===0&&i===0&&(n+=t.substring(s)),n):t}function _fe(t,e){const n=e+" ",s=","+n;for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="rule"){i.value=(n+i.value).replaceAll(",",s);const a=i.props,o=[];for(let l=0;l<a.length;l++)o[l]=n+a[l];i.props=o}Array.isArray(i.children)&&i.type!=="@keyframes"&&_fe(i.children,e)}return t}function IVe({options:t=qv,plugins:e=$7}=qv){let n,s,r;const i=(p,m,v)=>v.startsWith(s)&&v.endsWith(s)&&v.replaceAll(s,"").length>0?`.${n}`:p,a=e.slice();a.push(p=>{p.type===D4&&p.value.includes("&")&&(r||(r=new RegExp(`\\${s}\\b`,"g")),p.props[0]=p.props[0].replace(NVe,s).replace(r,i))}),t.prefix&&a.push(Gze),a.push(zze);let o=[];const l=Vze(a.concat(Hze(p=>o.push(p)))),u=(p,m="",v="",x="&")=>{n=x,s=m,r=void 0;const y=(function(_){const E=_.indexOf("//")!==-1,T=_.indexOf("}")!==-1;if(!E&&!T)return _;if(!E)return b6(_);const k=_.length;let R="",I=0,A=0,L=0,j=0,F=0,O=!1;for(;A<k;){const M=_.charCodeAt(A);if(M!==34&&M!==39||wfe(_,A))if(L===0)if(M===$p&&A+1<k&&_.charCodeAt(A+1)===42){for(A+=2;A+1<k&&(_.charCodeAt(A)!==42||_.charCodeAt(A+1)!==$p);)A++;A+=2}else if(M!==40)if(M!==41)if(j>0)A++;else if(M===42&&A+1<k&&_.charCodeAt(A+1)===$p)R+=_.substring(I,A),A+=2,I=A,O=!0;else if(M===$p&&A+1<k&&_.charCodeAt(A+1)===$p){for(R+=_.substring(I,A);A<k&&_.charCodeAt(A)!==10;)A++;I=A,O=!0}else M===123?F++:M===125&&F--,A++;else j>0&&j--,A++;else j++,A++;else A++;else L===0?L=M:L===M&&(L=0),A++}return O?(I<k&&(R+=_.substring(I)),F===0?R:b6(R)):F===0?_:b6(_)})(p);let S=Uze(v||m?v+" "+m+" { "+y+" }":y);return t.namespace&&(S=_fe(S,t.namespace)),o=[],uk(S,l),o},d=t;let f=tM;for(let p=0;p<e.length;p++)e[p].name||B4(15),f=wm(f,e[p].name);return d!=null&&d.namespace&&(f=wm(f,d.namespace)),d!=null&&d.prefix&&(f=wm(f,"p")),u.hash=f!==tM?f.toString():"",u}const LVe=new gfe,jVe=IVe(),Efe=re.createContext({shouldForwardProp:void 0,styleSheet:LVe,stylis:jVe,stylisPlugins:void 0});Efe.Consumer;function PVe(){return re.useContext(Efe)}const Cfe=re.createContext(void 0);Cfe.Consumer;const HY=Object.prototype.hasOwnProperty,S6={};function MVe(t,e){const n=typeof t!="string"?"sc":ofe(t);S6[n]=(S6[n]||0)+1;const s=n+"-"+eVe(U4+n+S6[n]);return e?e+"-"+s:s}function DVe(t,e,n){const s=hfe(t),r=t,i=!nM(t),{attrs:a=$7,componentId:o=MVe(e.displayName,e.parentComponentId),displayName:l=nVe(t)}=e,u=e.displayName&&e.componentId?ofe(e.displayName)+"-"+e.componentId:e.componentId||o,d=s&&r.attrs?r.attrs.concat(a).filter(Boolean):a;let{shouldForwardProp:f}=e;if(s&&r.shouldForwardProp){const x=r.shouldForwardProp;if(e.shouldForwardProp){const y=e.shouldForwardProp;f=(S,_)=>x(S,_)&&y(S,_)}else f=x}const p=new AVe(n,u,s?r.componentStyle:void 0);function m(x,y){return(function(S,_,E){const{attrs:T,componentStyle:k,defaultProps:R,foldedComponentIds:I,styledComponentId:A,target:L}=S,j=re.useContext(Cfe),F=PVe(),O=S.shouldForwardProp||F.shouldForwardProp,M=Zze(_,j,R)||qv;let U,G;{const q=re.useRef(null),z=q.current;if(z!==null&&z[1]===M&&z[2]===F.styleSheet&&z[3]===F.stylis&&z[7]===k&&(function(D,K,Y){const J=D,ne=K;let Q=0;for(const ee in ne)if(HY.call(ne,ee)&&(Q++,J[ee]!==ne[ee]))return!1;return Q===Y})(z[0],_,z[4]))U=z[5],G=z[6];else{U=(function(K,Y,J){const ne=Object.assign(Object.assign({},Y),{className:void 0,theme:J}),Q=K.length>1;for(let ee=0;ee<K.length;ee++){const te=K[ee],ue=z4(te)?te(Q?Object.assign({},ne):ne):te;
258for(const ye in ue)ye==="className"?ne.className=Ly(ne.className,ue[ye]):ye==="style"?ne.style=Object.assign(Object.assign({},ne.style),ue[ye]):ye in Y&&Y[ye]===void 0||(ne[ye]=ue[ye])}return"className"in Y&&typeof Y.className=="string"&&(ne.className=Ly(ne.className,Y.className)),ne})(T,_,M),G=k.generateAndInjectStyles(U,F.styleSheet,F.stylis);let D=0;for(const K in _)HY.call(_,K)&&D++;q.current=[_,M,F.styleSheet,F.stylis,D,U,G,k]}}const $=U.as||L,V=(function(q,z,D,K){const Y={};for(const J in q)q[J]===void 0||J[0]==="$"||J==="as"||J==="theme"&&q.theme===D||(J==="forwardedAs"?Y.as=q.forwardedAs:K&&!K(J,z)||(Y[J]=q[J]));return Y})(U,$,M,O);let B=Ly(I,A);return G&&(B+=" "+G),U.className&&(B+=" "+U.className),V[nM($)&&$.includes("-")?"class":"className"]=B,E&&(V.ref=E),w.createElement($,V)})(v,x,y)}m.displayName=l;let v=re.forwardRef(m);return v.attrs=d,v.componentStyle=p,v.displayName=l,v.shouldForwardProp=f,v.foldedComponentIds=s?Ly(r.foldedComponentIds,r.styledComponentId):"",v.styledComponentId=u,v.target=s?r.target:t,Object.defineProperty(v,"defaultProps",{get(){return this._foldedDefaultProps},set(x){this._foldedDefaultProps=s?(function(y,...S){for(const _ of S)sM(y,_,!0);return y})({},r.defaultProps,x):x}}),pfe(v,()=>`.${v.styledComponentId}`),i&&ffe(v,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),v}var OVe=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]);function GY(t,e){const n=[t[0]];for(let s=0,r=e.length;s<r;s+=1)n.push(e[s],t[s+1]);return n}const WY=t=>(xfe.add(t),t);function $Ve(t,...e){if(z4(t)||a2(t))return WY(_m(GY($7,[t,...e])));const n=t;return e.length===0&&n.length===1&&typeof n[0]=="string"?_m(n):WY(_m(GY(n,e)))}function iM(t,e,n=qv){if(!e)throw B4(1,e);const s=(r,...i)=>t(e,n,$Ve(r,...i));return s.attrs=r=>iM(t,e,Object.assign(Object.assign({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)})),s.withConfig=r=>iM(t,e,Object.assign(Object.assign({},n),r)),s}const Tfe=t=>iM(DVe,t),F7=Tfe;OVe.forEach(t=>{F7[t]=Tfe(t)});const FVe=F7.div`
259  display: flex;
260  flex-direction: column;
261  align-items: center;
262  justify-content: center;
263  flex: 1;
264`,UVe=F7.div`
265  font-size: 2rem;
266  color: var(--sand-12);
267  margin-bottom: 20px;
268`;function w6(){return c.jsx(FVe,{children:c.jsx(UVe,{children:"Page Not Found"})})}function BVe(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14 16C12.6786 14.6346 11.9633 13.5 12.0014 11.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10 16C11.409 14.6492 12.0389 13.5 11.9981 11.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 10.75C9 10.75 10.819 11 11.9997 11C13.1804 11 15 10.75 15 10.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M11.9 8H12.1M12.5 8C12.5 8.27614 12.2761 8.5 12 8.5C11.7239 8.5 11.5 8.27614 11.5 8C11.5 7.72386 11.7239 7.5 12 7.5C12.2761 7.5 12.5 7.72386 12.5 8Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function U7(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M3 13V12C3 10.8954 3.89543 10 5 10H19C20.1046 10 21 10.8954 21 12V13M5 4H9.17157C9.70201 4 10.2107 4.21071 10.5858 4.58579L11.4142 5.41421C11.7893 5.78929 12.298 6 12.8284 6H19C20.1046 6 21 6.89543 21 8V17C21 18.1046 20.1046 19 19 19H5C3.89543 19 3 18.1046 3 17V6C3 4.89543 3.89543 4 5 4Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function zVe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M4 14.2105L6.84488 12.0821C7.66137 11.5378 8.75215 11.6663 9.41987 12.3853C10.9123 13.9926 12.6426 15.4538 15 15.4538C17.1727 15.4538 18.6125 14.6485 20 13.261M6 20H18C19.1046 20 20 19.1046 20 18V6C20 4.89543 19.1046 4 18 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20ZM17 9C17 10.1046 16.1046 11 15 11C13.8954 11 13 10.1046 13 9C13 7.89543 13.8954 7 15 7C16.1046 7 17 7.89543 17 9Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function B7(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M16 10V7C16 4.79086 14.2091 3 12 3C9.79086 3 8 4.79086 8 7V10M12 14V17M7 21H17C18.1046 21 19 20.1046 19 19V12C19 10.8954 18.1046 10 17 10H7C5.89543 10 5 10.8954 5 12V19C5 20.1046 5.89543 21 7 21Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function U1(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M6.11594 18.8103C7.44562 17.0943 9.50054 16 12 16C14.4995 16 16.5544 17.0943 17.8841 18.8103M6.11594 18.8103C7.69368 20.1747 9.75046 21 12 21C14.2495 21 16.3063 20.1747 17.8841 18.8103M6.11594 18.8103C4.20753 17.16 3 14.721 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 14.721 19.7925 17.16 17.8841 18.8103M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function z7(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M4 20V19C4 16.7909 5.79086 15 8 15H16C18.2091 15 20 16.7909 20 19V20M16.5 7.5C16.5 9.98528 14.4853 12 12 12C9.51472 12 7.5 9.98528 7.5 7.5C7.5 5.01472 9.51472 3 12 3C14.4853 3 16.5 5.01472 16.5 7.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function V7(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C15.9187 21 19.2524 18.4956 20.4879 15M12 3C16.9706 3 21 7.02944 21 12C21 13.0519 20.8195 14.0617 20.4879 15M12 3V12L20.4879 
26815",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C15.9187 21 19.2524 18.4956 20.4879 15M12 3C16.9706 3 21 7.02944 21 12C21 13.0519 20.8195 14.0617 20.4879 15M12 3V12L20.4879 15",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})]})}function NS(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M21 11V17C21 18.1046 20.1046 19 19 19H5C3.89543 19 3 18.1046 3 17V11M21 11H18M21 11V7C21 5.89543 20.1046 5 19 5H5C3.89543 5 3 5.89543 3 7V11M3 11H6M6 11H7.17157C7.70201 11 8.21071 11.2107 8.58579 11.5858L9.41421 12.4142C9.78929 12.7893 10.298 13 10.8284 13H13.1716C13.702 13 14.2107 12.7893 14.5858 12.4142L15.4142 11.5858C15.7893 11.2107 16.298 11 16.8284 11H18M6 11V8.5C6 8.22386 6.22386 8 6.5 8H17.5C17.7761 8 18 8.22386 18 8.5V11",stroke:"currentColor",strokeWidth:"2"})})}const VVe=[{value:"student-learning",label:"Student/Learning"},{value:"solo-developer-hobbyist",label:"Solo Developer/Hobbyist"},{value:"small-team-startup",label:"Small Team/Startup (2-10)"},{value:"growing-company",label:"Growing Company (11-50)"},{value:"established-organization",label:"Established Organization (51+)"}],HVe=[{value:"scraping-public-websites",label:"Scraping public websites"},{value:"scraping-auth-walled-websites",label:"Scraping auth-walled websites"},{value:"internal-tooling",label:"Internal Tooling"},{value:"customer-facing-product",label:"Customer-facing product"},{value:"building-ai-agents",label:"Building AI agents"},{value:"small-personal-project",label:"Small personal project"},{value:"bypassing-solving-captchas",label:"Bypassing/Solving captchas"},{value:"data-for-ml-llm-fine-tuning",label:"Data for ML/LLM fine-tuning"},{value:"just-learning",label:"Just Learning"}],GVe=[{value:"friend-or-colleague",label:"Friend or Colleague"},{value:"x",label:"Twitter (X)"},{value:"youtube",label:"YouTube"},{value:"github",label:"GitHub"},{value:"reddit",label:"Reddit"},{value:"ai-assistant",label:"AI Assistant"},{value:"search-engine",label:"Search Engine"},{value:"other",label:"Other (specify below)"}],_6=[{id:"what_describes_you",options:VVe,mode:"single"},{id:"what_planning_to_build",options:HVe,mode:"multi"},{id:"how_hear_about_steel",options:GVe,mode:"single"}];var WVe=Object.defineProperty,qVe=(t,e)=>WVe(t,"name",{value:e,configurable:!0}),KVe=w.forwardRef(qVe(function(e,n){return c.jsx(is.label,{...e,ref:n,onMouseDown:s=>{var i;s.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}})},"Label")),kfe=KVe;const YVe=A7("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ah=w.forwardRef(({className:t,...e},n)=>c.jsx(kfe,{ref:n,className:He(YVe(),t),...e}));ah.displayName=kfe.displayName;const ZVe=({question:t,selectedValues:e,onSelectionChange:n,hasError:s=!1,hideHeading:r=!1})=>{const[i,a]=w.useState(""),o=d=>{if(d.value==="other")if(t.mode==="single")u?(n([]),a("")):n([i.trim()||"Other"]);else if(u){const f=e.filter(p=>p!=="Other"&&p!==i.trim());n(f),a("")}else{const f=[...e,i.trim()||"Other"];n(f)}else{const f=d.label;if(t.mode==="single"){const p=e.includes(f);n(p?[]:[f])}else{const p=e.includes(f)?e.filter(m=>m!==f):[...e,f];n(p)}}},l=d=>{const f=d.target.value;if(a(f),u){const p=e.filter(m=>m!=="Other"&&m!==i.trim());f.trim()?p.push(f.trim()):p.push("Other"),n(p)}},u=w.useMemo(()=>e.includes("Other")||e.some(d=>d!=="Other"&&t.options.every(f=>f.label!==d)),[e,t.options]);return c.jsxs("div",{className:"space-y-[16px] rounded-3xl transition-all",children:[!r&&c.jsx("h2",{className:He("text-[16px] text-[var(--sand-12)] dark:text-[#EDEDED] font-medium",s?"text-[var(--red-11)] dark:text-red-400":""),children:"What are you planning to build with Steel?"}),c.jsx("div",{className:"flex flex-wrap gap-[12px]",children:t.options.map(d=>{const f=d.value==="other"?e.includes("Other")||e.some(p=>p!=="Other"&&t.options.every(m=>m.label!==p)):e.includes(d.label);return c.jsx("div",{children:c.jsx("div",{className:He("flex px-3 py-2 rounded-full cursor-pointer transition-all duration-200 hover:bg-opacity-80",s&&!f?"ring-1 ring-red-400/30 hover:ring-red-400/50":"","text-[var(--sand-11)] dark:text-[#A0A0A0] bg-[var(--sand-4)]",f?"text-[var(--yellow-11)] dark:text-[var(--yellow-9)] bg-[var(--yellow-a3)]":"hover:bg-[var(--gray-a3)] hover:text-[var(--gray-12)] dark:hover:text-[var(--gray-12)]"),onClick:()=>o(d),children:c.jsx("div",{className:"text-[14px]",children:d.label})})},d.value)})}),u&&c.jsxs("div",{className:"mt-3 space-y-4",children:[c.jsx(ah,{className:"text-[16px] text-[var(--sand-10)] font-medium",children:"Other (specify)"}),c.jsx(Ah,{type:"text",placeholder:"What are you planning to build with Steel?",value:i,onChange:l,className:"w-full px-4 py-6 text-base rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-opacity-50 placeholder:text-[var(--sand-9)] dark:placeholder:text-[#3B3A37] bg-[var(--sand-1)] border-[var(--sand-6)] dark:border-[var(--sand-3)] text-[var(--sand-12)]",onClick:d=>d.stopPropagation()})]})]})};var XVe=Object.defineProperty,QVe=(t,e)=>XVe(t,"name",{value:e,configurable:!0});function aM(t,[e,n]){return Math.min(n,Math.max(e,t))}QVe(aM,"clamp");var JVe=Object.defineProperty,B1=(t,e)=>JVe(t,"name",{value:e,configurable:!0}),Rfe=!!(typeof window<"u"&&window.document&&window.document.createElement);function Cn(t,e,{checkForDefaultPrevented:n=!0}={}){return B1(function(r){if(t==null||t(r),n===!1||!r||!r.defaultPrevented)return e==null?void 0:e(r)},"handleEvent")}B1(Cn,"composeEventHandlers");function eHe(t){var e;if(!Rfe)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}B1(eHe,"getOwnerWindow");function oM(t){if(!Rfe)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}B1(oM,"getOwnerDocument");function Afe(t,e=!1){const{activeElement:n}=oM(t);if(!(n!=null&&n.nodeName))return null;if(Nfe(n)&&n.contentDocument)return Afe(n.contentDocument.body,e);if(e){const s=n.getAttribute("aria-activedescendant");if(s){const r=oM(n).getElementById(s);if(r)return r}}return n}B1(Afe,"getActiveElement");function Nfe(t){return t.tagName==="IFRAME"}B1(Nfe,"isFrame");var tHe=Object.defineProperty,rl=(t,e)=>tHe(t,"name",{value:e,configurable:!0});function nHe(t,e){const n=w.createContext(e);n.displayName=t+"Context";const s=rl(i=>{const{children:a,...o}=i,l=w.useMemo(()=>o,Object.values(o));return c.jsx(n.Provider,{value:l,children:a})},"Provider");s.displayName=t+"Provider";function r(i,a={}){const{optional:o=!1}=a,l=w.useContext(n);if(l)return l;if(e!==void 0)return e;if(!o)throw new Error(`\`${i}\` must be used within \`${t}\``)}return rl(r,"useContext"),[s,r]}rl(nHe,"createContext");function hu(t,e=[]){let n=[];function s(i,a){const o=w.createContext(a);o.displayName=i+"Context";const l=n.length;n=[...n,a];const u=rl(f=>{var S;const{scope:p,children:m,...v}=f,x=((S=p==null?void 0:p[t])==null?void 0:S[l])||o,y=w.useMemo(()=>v,Object.values(v));return c.jsx(x.Provider,{value:y,children:m})},"Provider");u.displayName=i+"Provider";function d(f,p,m={}){var S;const{optional:v=!1}=m,x=((S=p==null?void 0:p[t])==null?void 0:S[l])||o,y=w.useContext(x);if(y)return y;if(a!==void 0)return a;
268if(!v)throw new Error(`\`${f}\` must be used within \`${i}\``)}return rl(d,"useContext"),[u,d]}rl(s,"createContext");const r=rl(()=>{const i=n.map(a=>w.createContext(a));return rl(function(o){const l=(o==null?void 0:o[t])||i;return w.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])},"useScope")},"createScope");return r.scopeName=t,[s,Ife(r,...e)]}rl(hu,"createContextScope");function Ife(...t){const e=t[0];if(t.length===1)return e;const n=rl(()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return rl(function(i){const a=s.reduce((o,{useScope:l,scopeName:u})=>{const f=l(i)[`__scope${u}`];return{...o,...f}},{});return w.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}rl(Ife,"composeContextScopes");var sHe=Object.defineProperty,wi=(t,e)=>sHe(t,"name",{value:e,configurable:!0});function H7(t){const e=t+"CollectionProvider",[n,s]=hu(e),[r,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=wi(x=>{const{scope:y,children:S}=x,_=w.useRef(null),E=w.useRef(new Map).current;return c.jsx(r,{scope:y,itemMap:E,collectionRef:_,children:S})},"CollectionProvider");a.displayName=e;const o=t+"CollectionSlot",l=iu(o),u=w.forwardRef((x,y)=>{const{scope:S,children:_}=x,E=i(o,S),T=ps(y,E.collectionRef);return c.jsx(l,{ref:T,children:_})});u.displayName=o;const d=t+"CollectionItemSlot",f="data-radix-collection-item",p=iu(d),m=w.forwardRef((x,y)=>{const{scope:S,children:_,...E}=x,T=w.useRef(null),k=ps(y,T),R=i(d,S);return w.useEffect(()=>(R.itemMap.set(T,{ref:T,...E}),()=>void R.itemMap.delete(T))),c.jsx(p,{[f]:"",ref:k,children:_})});m.displayName=d;function v(x){const y=i(t+"CollectionConsumer",x);return w.useCallback(()=>{const _=y.collectionRef.current;if(!_)return[];const E=Array.from(_.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((R,I)=>E.indexOf(R.ref.current)-E.indexOf(I.ref.current))},[y.collectionRef,y.itemMap])}return wi(v,"useCollection"),[{Provider:a,Slot:u,ItemSlot:m},v,s]}wi(H7,"createCollection");var qY=new WeakMap,Yr,xo,E6=(xo=class extends Map{constructor(n){super(n);St(this,Yr);nt(this,Yr,[...super.keys()]),qY.set(this,!0)}set(n,s){return qY.get(this)&&(this.has(n)?se(this,Yr)[se(this,Yr).indexOf(n)]=n:se(this,Yr).push(n)),super.set(n,s),this}insert(n,s,r){const i=this.has(s),a=se(this,Yr).length,o=G7(n);let l=o>=0?o:a+o;const u=l<0||l>=a?-1:l;if(u===this.size||i&&u===this.size-1||u===-1)return this.set(s,r),this;const d=this.size+(i?0:1);o<0&&l++;const f=[...se(this,Yr)];let p,m=!1;for(let v=l;v<d;v++)if(l===v){let x=f[v];f[v]===s&&(x=f[v+1]),i&&this.delete(s),p=this.get(x),this.set(s,r)}else{!m&&f[v-1]===s&&(m=!0);const x=f[m?v:v-1],y=p;p=this.get(x),this.delete(x),this.set(x,y)}return this}with(n,s,r){const i=new xo(this);return i.insert(n,s,r),i}before(n){const s=se(this,Yr).indexOf(n)-1;if(!(s<0))return this.entryAt(s)}setBefore(n,s,r){const i=se(this,Yr).indexOf(n);return i===-1?this:this.insert(i,s,r)}after(n){let s=se(this,Yr).indexOf(n);if(s=s===-1||s===this.size-1?-1:s+1,s!==-1)return this.entryAt(s)}setAfter(n,s,r){const i=se(this,Yr).indexOf(n);return i===-1?this:this.insert(i+1,s,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return nt(this,Yr,[]),super.clear()}delete(n){const s=super.delete(n);return s&&se(this,Yr).splice(se(this,Yr).indexOf(n),1),s}deleteAt(n){const s=this.keyAt(n);return s!==void 0?this.delete(s):!1}at(n){const s=GC(se(this,Yr),n);if(s!==void 0)return this.get(s)}entryAt(n){const s=GC(se(this,Yr),n);if(s!==void 0)return[s,this.get(s)]}indexOf(n){return se(this,Yr).indexOf(n)}keyAt(n){return GC(se(this,Yr),n)}from(n,s){const r=this.indexOf(n);if(r===-1)return;let i=r+s;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(n,s){const r=this.indexOf(n);if(r===-1)return;let i=r+s;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(n,s){let r=0;for(const i of this){if(Reflect.apply(n,s,[i,r,this]))return i;r++}}findIndex(n,s){let r=0;for(const i of this){if(Reflect.apply(n,s,[i,r,this]))return r;r++}return-1}filter(n,s){const r=[];let i=0;for(const a of this)Reflect.apply(n,s,[a,i,this])&&r.push(a),i++;return new xo(r)}map(n,s){const r=[];let i=0;for(const a of this)r.push([a[0],Reflect.apply(n,s,[a,i,this])]),i++;return new xo(r)}reduce(...n){const[s,r]=n;let i=0,a=r??this.at(0);for(const o of this)i===0&&n.length===1?a=o:a=Reflect.apply(s,this,[a,o,i,this]),i++;return a}reduceRight(...n){const[s,r]=n;let i=r??this.at(-1);for(let a=this.size-1;a>=0;a--){const o=this.at(a);a===this.size-1&&n.length===1?i=o:i=Reflect.apply(s,this,[i,o,a,this])}return i}toSorted(n){const s=[...this.entries()].sort(n);return new xo(s)}toReversed(){const n=new xo;for(let s=this.size-1;s>=0;s--){const r=this.keyAt(s),i=this.get(r);n.set(r,i)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new xo(s)}slice(n,s){const r=new xo;let i=this.size-1;if(n===void 0)return r;n<0&&(n=n+this.size),s!==void 0&&s>0&&(i=s-1);for(let a=n;a<=i;a++){const o=this.keyAt(a),l=this.get(o);r.set(o,l)}return r}every(n,s){let r=0;for(const i of this){if(!Reflect.apply(n,s,[i,r,this]))return!1;r++}return!0}some(n,s){let r=0;for(const i of this){if(Reflect.apply(n,s,[i,r,this]))return!0;r++}return!1}},Yr=new WeakMap,wi(xo,"OrderedDict"),xo);function GC(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Lfe(t,e);return n===-1?void 0:t[n]}wi(GC,"at");function Lfe(t,e){const n=t.length,s=G7(e),r=s>=0?s:n+s;return r<0||r>=n?-1:r}wi(Lfe,"toSafeIndex");function G7(t){return t!==t||t===0?0:Math.trunc(t)}wi(G7,"toSafeInteger");function rHe(t){const e=t+"CollectionProvider",[n,s]=hu(e),[r,i]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new E6,setItemMap:wi(()=>{},"setItemMap")}),a=wi(({state:E,...T})=>E?c.jsx(l,{...T,state:E}):c.jsx(o,{...T}),"CollectionProvider");a.displayName=e;const o=wi(E=>{const T=y();return c.jsx(l,{...E,state:T})},"CollectionInit");o.displayName=e+"Init";const l=wi(E=>{const{scope:T,children:k,state:R}=E,I=w.useRef(null),[A,L]=w.useState(null),j=ps(I,L),[F,O]=R;return w.useEffect(()=>{if(!A)return;const M=Mfe(()=>{});return M.observe(A,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[A]),c.jsx(r,{scope:T,itemMap:F,setItemMap:O,collectionRef:j,collectionRefObject:I,collectionElement:A,children:k})},"CollectionProviderImpl");l.displayName=e+"Impl";const u=t+"CollectionSlot",d=iu(u),f=w.forwardRef((E,T)=>{const{scope:k,children:R}=E,I=i(u,k),A=ps(T,I.collectionRef);return c.jsx(d,{ref:A,children:R})});f.displayName=u;const p=t+"CollectionItemSlot",m="data-radix-collection-item",v=iu(p),x=w.forwardRef((E,T)=>{const{scope:k,children:R,...I}=E,A=w.useRef(null),[L,j]=w.useState(null),F=ps(T,A,j),O=i(p,k),{setItemMap:M}=O,U=w.useRef(I);jfe(U.current,I)||(U.current=I);const G=U.current;return w.useEffect(()=>{const $=G;return M(V=>L?V.has(L)?V.set(L,{...$,element:L}).toSorted(lM):(V.set(L,{...$,element:L}),V.toSorted(lM)):V),()=>{M(V=>!L||!V.has(L)?V:(V.delete(L),new E6(V)))}},[L,G,M]),c.jsx(v,{[m]:"",ref:F,children:R})});x.displayName=p;function y(){return w.useState(new E6)}wi(y,"useInitCollection");function S(E){const{itemMap:T}=i(t+"CollectionConsumer",E);return T}return wi(S,"useCollection"),[{Provider:a,Slot:f,ItemSlot:x},{createCollectionScope:s,useCollection:S,useInitCollection:y}]}wi(rHe,"createCollection");function jfe(t,e){if(t===e)return!0;
268if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1;return!0}wi(jfe,"shallowEqual");function Pfe(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}wi(Pfe,"isElementPreceding");function lM(t,e){return!t[1].element||!e[1].element?0:Pfe(t[1].element,e[1].element)?-1:1}wi(lM,"sortByDocumentPosition");function Mfe(t){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){t();return}})}wi(Mfe,"getChildListObserver");var iHe=Object.defineProperty,aHe=(t,e)=>iHe(t,"name",{value:e,configurable:!0}),oHe=w.createContext(void 0);function W7(t){const e=w.useContext(oHe);return t||e||"ltr"}aHe(W7,"useDirection");var lHe=Object.defineProperty,cHe=(t,e)=>lHe(t,"name",{value:e,configurable:!0});function au(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>((...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)}),[])}cHe(au,"useCallbackRef");var uHe=Object.defineProperty,yi=(t,e)=>uHe(t,"name",{value:e,configurable:!0}),cM="dismissableLayer.update",dHe="dismissableLayer.pointerDownOutside",fHe="dismissableLayer.focusOutside",KY,Dfe=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),V4=w.forwardRef(yi(function(e,n){const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...d}=e,f=w.useContext(Dfe),[p,m]=w.useState(null),v=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=w.useState({}),y=ps(n,m),S=Array.from(f.layers),[_]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),E=_?S.indexOf(_):-1,T=p?S.indexOf(p):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,R=T>=E,I=w.useRef(!1),A=$fe(O=>{a==null||a(O),l==null||l(O),O.defaultPrevented||u==null||u()},{ownerDocument:v,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(O=>{if(!(O instanceof Node))return!1;const M=[...f.branches].some(U=>U.contains(O));return R&&!M},[f.branches,R])}),L=Ffe(O=>{if(r&&I.current)return;const M=O.target;[...f.branches].some(G=>G.contains(M))||(o==null||o(O),l==null||l(O),O.defaultPrevented||u==null||u())},v),j=p?T===S.length-1:!1,F=au(O=>{O.key==="Escape"&&(i==null||i(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))});return w.useEffect(()=>{if(j)return v.addEventListener("keydown",F,{capture:!0}),()=>v.removeEventListener("keydown",F,{capture:!0})},[v,j,F]),w.useEffect(()=>{if(p)return s&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(KY=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),uM(),()=>{s&&(f.layersWithOutsidePointerEventsDisabled.delete(p),f.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=KY))}},[p,v,s,f]),w.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),uM())},[p,f]),w.useEffect(()=>{const O=yi(()=>x({}),"handleUpdate");return document.addEventListener(cM,O),()=>document.removeEventListener(cM,O)},[]),c.jsx(is.div,{...d,ref:y,style:{pointerEvents:k?R?"auto":"none":void 0,...e.style},onFocusCapture:Cn(e.onFocusCapture,L.onFocusCapture),onBlurCapture:Cn(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Cn(e.onPointerDownCapture,A.onPointerDownCapture)})},"DismissableLayer"));function Ofe(){const t=w.useContext(Dfe),[e,n]=w.useState(null);return w.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}yi(Ofe,"useDismissableLayerSurface");var hHe=yi(()=>!0,"IS_TRUE");function $fe(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:i,shouldHandlePointerDownOutside:a=hHe}=e,o=au(t),l=w.useRef(!1),u=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function p(){u.current=!1,r.current=!1,d.current.clear()}yi(p,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}yi(m,"isOutsideInteractionIntercepted");function v(E){if(!u.current)return;const T=E.target;T instanceof Node&&[...i].some(R=>R.contains(T))||d.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}yi(v,"handleInteractionCapture");function x(E){u.current&&d.current.set(E.type,!1)}yi(x,"handleInteractionBubble");const y=yi(E=>{if(E.target&&!l.current){let T=function(){n.removeEventListener("click",f.current);const R=m();p(),R||q7(dHe,o,k,{discrete:!0})};if(yi(T,"handleAndDispatchPointerDownOutsideEvent"),!a(E.target)){n.removeEventListener("click",f.current),p(),l.current=!1;return}const k={originalEvent:E};u.current=!0,r.current=s&&E.button===0,d.current.clear(),!s||E.button!==0?T():(n.removeEventListener("click",f.current),f.current=T,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),p();l.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of S)n.addEventListener(E,v,!0),n.addEventListener(E,x);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",y),n.removeEventListener("click",f.current);for(const E of S)n.removeEventListener(E,v,!0),n.removeEventListener(E,x)}},[n,o,s,r,i,a]),{onPointerDownCapture:yi(()=>l.current=!0,"onPointerDownCapture")}}yi($fe,"usePointerDownOutside");function Ffe(t,e=globalThis==null?void 0:globalThis.document){const n=au(t),s=w.useRef(!1);return w.useEffect(()=>{const r=yi(i=>{i.target&&!s.current&&q7(fHe,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:yi(()=>s.current=!0,"onFocusCapture"),onBlurCapture:yi(()=>s.current=!1,"onBlurCapture")}}yi(Ffe,"useFocusOutside");function uM(){const t=new CustomEvent(cM);document.dispatchEvent(t)}
268yi(uM,"dispatchUpdate");function q7(t,e,n,{discrete:s}){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),s?Ode(r,i):r.dispatchEvent(i)}yi(q7,"handleAndDispatchCustomEvent");var pHe=Object.defineProperty,K7=(t,e)=>pHe(t,"name",{value:e,configurable:!0}),G_=0,gc=null;function mHe(t){return IS(),t.children}K7(mHe,"FocusGuards");function IS(){w.useEffect(()=>{gc||(gc={start:dM(),end:dM()});const{start:t,end:e}=gc;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),G_++,()=>{G_===1&&(gc==null||gc.start.remove(),gc==null||gc.end.remove(),gc=null),G_=Math.max(0,G_-1)}},[])}K7(IS,"useFocusGuards");function dM(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}K7(dM,"createFocusGuard");var gHe=Object.defineProperty,Ra=(t,e)=>gHe(t,"name",{value:e,configurable:!0}),C6="focusScope.autoFocusOnMount",T6="focusScope.autoFocusOnUnmount",YY={bubbles:!1,cancelable:!0},Y7=w.forwardRef(Ra(function(e,n){const{loop:s=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[l,u]=w.useState(null),d=au(i),f=au(a),p=w.useRef(null),m=ps(n,u),v=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let y=function(T){if(v.paused||!l)return;const k=T.target;l.contains(k)?p.current=k:Qu(p.current,{select:!0})},S=function(T){if(v.paused||!l)return;const k=T.relatedTarget;k!==null&&(l.contains(k)||Qu(p.current,{select:!0}))},_=function(T){if(document.activeElement===document.body)for(const R of T)R.removedNodes.length>0&&Qu(l)};Ra(y,"handleFocusIn"),Ra(S,"handleFocusOut"),Ra(_,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",S);const E=new MutationObserver(_);return l&&E.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),E.disconnect()}}},[r,l,v.paused]),w.useEffect(()=>{if(l){ZY.add(v);const y=document.activeElement;if(!l.contains(y)){const _=new CustomEvent(C6,YY);l.addEventListener(C6,d),l.dispatchEvent(_),_.defaultPrevented||(Ufe(Gfe(Z7(l)),{select:!0}),document.activeElement===y&&Qu(l))}return()=>{l.removeEventListener(C6,d),setTimeout(()=>{const _=new CustomEvent(T6,YY);l.addEventListener(T6,f),l.dispatchEvent(_),_.defaultPrevented||Qu(y??document.body,{select:!0}),l.removeEventListener(T6,f),ZY.remove(v)},0)}}},[l,d,f,v]);const x=w.useCallback(y=>{if(!s&&!r||v.paused)return;const S=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,_=document.activeElement;if(S&&_){const E=y.currentTarget,[T,k]=Bfe(E);T&&k?!y.shiftKey&&_===k?(y.preventDefault(),s&&Qu(T,{select:!0})):y.shiftKey&&_===T&&(y.preventDefault(),s&&Qu(k,{select:!0})):_===E&&y.preventDefault()}},[s,r,v.paused]);return c.jsx(is.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})},"FocusScope"));function Ufe(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(Qu(s,{select:e}),document.activeElement!==n)return}Ra(Ufe,"focusFirst");function Bfe(t){const e=Z7(t),n=fM(e,t),s=fM(e.reverse(),t);return[n,s]}Ra(Bfe,"getTabbableEdges");function Z7(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Ra(s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Ra(Z7,"getTabbableCandidates");function fM(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const s of t)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):zfe(s,{upTo:e})))return s}Ra(fM,"findVisible");function zfe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Ra(zfe,"isHidden");function Vfe(t){return t instanceof HTMLInputElement&&"select"in t}Ra(Vfe,"isSelectableInput");function Qu(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Vfe(t)&&e&&t.select()}}Ra(Qu,"focus");var ZY=Hfe();function Hfe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=hM(t,e),t.unshift(e)},remove(e){var n;t=hM(t,e),(n=t[0])==null||n.resume()}}}
268Ra(Hfe,"createFocusScopesStack");function hM(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}Ra(hM,"arrayRemove");function Gfe(t){return t.filter(e=>e.tagName!=="A")}Ra(Gfe,"removeLinks");var Ir=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},vHe=Object.defineProperty,xHe=(t,e)=>vHe(t,"name",{value:e,configurable:!0}),yHe=x1[" useId ".trim().toString()]||(()=>{}),bHe=0;function Zc(t){const[e,n]=w.useState(yHe());return Ir(()=>{t||n(s=>s??String(bHe++))},[t]),t||(e?`radix-${e}`:"")}xHe(Zc,"useId");const SHe=["top","right","bottom","left"],Ih=Math.min,bd=Math.max,fk=Math.round,W_=Math.floor,Sd=t=>({x:t,y:t}),wHe={left:"right",right:"left",bottom:"top",top:"bottom"};function Wfe(t,e,n){return bd(t,Ih(e,n))}function Rd(t,e){return typeof t=="function"?t(e):t}function Lh(t){return t.split("-")[0]}function z1(t){return t.split("-")[1]}function X7(t){return t==="x"?"y":"x"}function Q7(t){return t==="y"?"height":"width"}function Vc(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function J7(t){return X7(Vc(t))}function _He(t,e,n){n===void 0&&(n=!1);const s=z1(t),r=J7(t),i=Q7(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=hk(a)),[a,hk(a)]}function EHe(t){const e=hk(t);return[pM(t),e,pM(e)]}function pM(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const XY=["left","right"],QY=["right","left"],CHe=["top","bottom"],THe=["bottom","top"];function kHe(t,e,n){switch(t){case"top":case"bottom":return n?e?QY:XY:e?XY:QY;case"left":case"right":return e?CHe:THe;default:return[]}}function RHe(t,e,n,s){const r=z1(t);let i=kHe(Lh(t),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),e&&(i=i.concat(i.map(pM)))),i}function hk(t){const e=Lh(t);return wHe[e]+t.slice(e.length)}function AHe(t){var e,n,s,r;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(s=t.bottom)!=null?s:0,left:(r=t.left)!=null?r:0}}function qfe(t){return typeof t!="number"?AHe(t):{top:t,right:t,bottom:t,left:t}}function pk(t){const{x:e,y:n,width:s,height:r}=t;return{width:s,height:r,top:n,left:e,right:e+s,bottom:n+r,x:e,y:n}}function JY(t,e,n){let{reference:s,floating:r}=t;const i=Vc(e),a=J7(e),o=Q7(a),l=Lh(e),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[o]/2-r[o]/2;let m;switch(l){case"top":m={x:d,y:s.y-r.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:f};break;case"left":m={x:s.x-r.width,y:f};break;default:m={x:s.x,y:s.y}}const v=z1(e);
vendor: 3,908 bytes, line 268
268return v&&(m[a]+=p*(v==="end"?1:-1)*(n&&u?-1:1)),m}async function NHe(t,e){var n;e===void 0&&(e={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=Rd(e,t),v=qfe(m),y=o[p?f==="floating"?"reference":"floating":f],S=pk(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),_=f==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),T=await(i.isElement==null?void 0:i.isElement(E))&&await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1},k=pk(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:E,strategy:l}):_);return{top:(S.top-k.top+v.top)/T.y,bottom:(k.bottom-S.bottom+v.bottom)/T.y,left:(S.left-k.left+v.left)/T.x,right:(k.right-S.right+v.right)/T.x}}const IHe=50,LHe=async(t,e,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=a.detectOverflow?a:{...a,detectOverflow:NHe},l=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:f}=JY(u,s,l),p=s,m=0;const v={};for(let x=0;x<i.length;x++){const y=i[x];if(!y)continue;const{name:S,fn:_}=y,{x:E,y:T,data:k,reset:R}=await _({x:d,y:f,initialPlacement:s,placement:p,strategy:r,middlewareData:v,rects:u,platform:o,elements:{reference:t,floating:e}});d=E??d,f=T??f,v[S]={...v[S],...k},R&&m<IHe&&(m++,typeof R=="object"&&(R.placement&&(p=R.placement),R.rects&&(u=R.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:d,y:f}=JY(u,p,l)),x=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:v}},jHe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=e,{element:u,padding:d=0}=Rd(t,e)||{};if(u==null)return{};const f=qfe(d),p={x:n,y:s},m=J7(r),v=Q7(m),x=await a.getDimensions(u),y=m==="y",S=y?"top":"left",_=y?"bottom":"right",E=y?"clientHeight":"clientWidth",T=i.reference[v]+i.reference[m]-p[m]-i.floating[v],k=p[m]-i.reference[m],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let I=R?R[E]:0;(!I||!await(a.isElement==null?void 0:a.isElement(R)))&&(I=o.floating[E]||i.floating[v]);const A=T/2-k/2,L=I/2-x[v]/2-1,j=Ih(f[S],L),F=Ih(f[_],L),O=I-x[v]-F,M=I/2-x[v]/2+A,U=Wfe(j,M,O),G=!l.arrow&&z1(r)!=null&&M!==U&&i.reference[v]/2-(M<j?j:F)-x[v]/2<0,$=G?M<j?M-j:M-O:0;return{[m]:p[m]+$,data:{[m]:U,centerOffset:M-U-$,...G&&{alignmentOffset:$}},reset:G}}}),PHe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...y}=Rd(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=Lh(r),_=Vc(o),E=Lh(o)===o,T=await(l.isRTL==null?void 0:l.isRTL(u.floating)),k=p||(E||!x?[hk(o)]:EHe(o)),R=v!=="none";!p&&R&&k.push(...RHe(o,x,v,T));const I=[o,...k],A=await l.detectOverflow(e,y),L=[];let j=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&L.push(A[S]),f){const U=_He(r,a,T);L.push(A[U[0]],A[U[1]])}if(j=[...j,{placement:r,overflows:L}],!L.every(U=>U<=0)){var F,O;const U=(((F=i.flip)==null?void 0:F.index)||0)+1,G=I[U];if(G&&(!(f==="alignment"?_!==Vc(G):!1)||j.every(B=>Vc(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:U,overflows:j},reset:{placement:G}};let $=(O=j.filter(V=>V.overflows[0]<=0).sort((V,B)=>V.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!$)switch(m){case"bestFit":{var M;
vendor: 5,934 bytes, line 268
268const V=(M=j.filter(B=>{if(R){const q=Vc(B.placement);return q===_||q==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(q=>q>0).reduce((q,z)=>q+z,0)]).sort((B,q)=>B[1]-q[1])[0])==null?void 0:M[0];V&&($=V);break}case"initialPlacement":$=o;break}if(r!==$)return{reset:{placement:$}}}return{}}}};function eZ(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function tZ(t){return SHe.some(e=>t[e]>=0)}const MHe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:s}=e,{strategy:r="referenceHidden",...i}=Rd(t,e);switch(r){case"referenceHidden":{const a=await s.detectOverflow(e,{...i,elementContext:"reference"}),o=eZ(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:tZ(o)}}}case"escaped":{const a=await s.detectOverflow(e,{...i,altBoundary:!0}),o=eZ(a,n.floating);return{data:{escapedOffsets:o,escaped:tZ(o)}}}default:return{}}}}},Kfe=new Set(["left","top"]);async function DHe(t,e){const{placement:n,platform:s,elements:r}=t,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),a=Lh(n),o=z1(n),l=Vc(n)==="y",u=Kfe.has(a)?-1:1,d=i&&l?-1:1,f=Rd(e,t);let{mainAxis:p,crossAxis:m,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return o&&typeof v=="number"&&(m=o==="end"?v*-1:v),l?{x:m*d,y:p*u}:{x:p*u,y:m*d}}const OHe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:r,y:i,placement:a,middlewareData:o}=e,l=await DHe(e,t);return a===((n=o.offset)==null?void 0:n.placement)&&(s=o.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:a}}}}},$He=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:r,platform:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:_=>{let{x:E,y:T}=_;return{x:E,y:T}}},...u}=Rd(t,e),d={x:n,y:s},f=await i.detectOverflow(e,u),p=Vc(r),m=X7(p);let v=d[m],x=d[p];const y=(_,E)=>Wfe(E+f[_==="y"?"top":"left"],E,E-f[_==="y"?"bottom":"right"]);a&&(v=y(m,v)),o&&(x=y(p,x));const S=l.fn({...e,[m]:v,[p]:x});return{...S,data:{x:S.x-n,y:S.y-s,enabled:{[m]:a,[p]:o}}}}}},FHe=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,s;const{x:r,y:i,placement:a,rects:o,middlewareData:l}=e,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=Rd(t,e),p={x:r,y:i},m=Vc(a),v=X7(m);let x=p[v],y=p[m];const S=Rd(u,e),_=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(s=S.crossAxis)!=null?s:0};if(d){const k=v==="y"?"height":"width",R=o.reference[v]-o.floating[k]+_.mainAxis,I=o.reference[v]+o.reference[k]-_.mainAxis;x<R?x=R:x>I&&(x=I)}if(f){var E,T;const k=v==="y"?"width":"height",R=Kfe.has(Lh(a)),I=o.reference[m]-o.floating[k]+(R&&((E=l.offset)==null?void 0:E[m])||0)+(R?0:_.crossAxis),A=o.reference[m]+o.reference[k]+(R?0:((T=l.offset)==null?void 0:T[m])||0)-(R?_.crossAxis:0);y<I?y=I:y>A&&(y=A)}return{[v]:x,[m]:y}}}},UHe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:s,platform:r,elements:i}=e,{apply:a=()=>{},...o}=Rd(t,e),l=await r.detectOverflow(e,o),u=Lh(n),d=z1(n),f=Vc(n)==="y",{width:p,height:m}=s.floating;let v,x;u==="top"||u==="bottom"?(v=u,x=d===(await(r.isRTL==null?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(x=u,v=d==="end"?"top":"bottom");const y=m-l.top-l.bottom,S=p-l.left-l.right,_=Ih(m-l[v],y),E=Ih(p-l[x],S),T=e.middlewareData.shift,k=!T;let R=_,I=E;T!=null&&T.enabled.x&&(I=S),T!=null&&T.enabled.y&&(R=y),k&&!d&&(f?I=p-2*bd(l.left,l.right):R=m-2*bd(l.top,l.bottom)),await a({...e,availableWidth:I,availableHeight:R});const A=await r.getDimensions(i.floating);return p!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function H4(){return typeof window<"u"}function V1(t){return Yfe(t)?(t.nodeName||"").toLowerCase():"#document"}function Za(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Od(t){var e;return(e=(Yfe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Yfe(t){return H4()?t instanceof Node||t instanceof Za(t).Node:!1}function ou(t){return H4()?t instanceof Element||t instanceof Za(t).Element:!1}function Gh(t){return H4()?t instanceof HTMLElement||t instanceof Za(t).HTMLElement:!1}function nZ(t){return!H4()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Za(t).ShadowRoot}function G4(t){const{overflow:e,overflowX:n,overflowY:s,display:r}=lu(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&r!=="inline"&&r!=="contents"}function BHe(t){return/^(table|td|th)$/.test(V1(t))}function W4(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const zHe=/transform|translate|scale|rotate|perspective|filter/,VHe=/paint|layout|strict|content/,vp=t=>!!t&&t!=="none";let k6;function e$(t){const e=ou(t)?lu(t):t;return vp(e.transform)||vp(e.translate)||vp(e.scale)||vp(e.rotate)||vp(e.perspective)||!t$()&&(vp(e.backdropFilter)||vp(e.filter))||zHe.test(e.willChange||"")||VHe.test(e.contain||"")}function HHe(t){let e=Pm(t);for(;Gh(e)&&!o2(e);){if(e$(e))return e;if(W4(e))return null;e=Pm(e)}return null}function t$(){return k6==null&&(k6=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),k6}function o2(t){return/^(html|body|#document)$/.test(V1(t))}function lu(t){return Za(t).getComputedStyle(t)}function q4(t){return ou(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Pm(t){if(V1(t)==="html")return t;const e=t.assignedSlot||t.parentNode||nZ(t)&&t.host||Od(t);return nZ(e)?e.host:e}function Zfe(t){const e=Pm(t);return o2(e)?(t.ownerDocument||t).body:Gh(e)&&G4(e)?e:Zfe(e)}function l2(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Zfe(t),i=r===((s=t.ownerDocument)==null?void 0:s.body),a=Za(r);if(i){const o=mM(a);
268return e.concat(a,a.visualViewport||[],G4(r)?r:[],o&&n?l2(o):[])}else return e.concat(r,l2(r,[],n))}function mM(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Xfe(t){const e=lu(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const r=Gh(t),i=r?t.offsetWidth:n,a=r?t.offsetHeight:s,o=fk(n)!==i||fk(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function n$(t){return ou(t)?t:t.contextElement}function J0(t){const e=n$(t);if(!Gh(e))return Sd(1);const n=e.getBoundingClientRect(),{width:s,height:r,$:i}=Xfe(e);let a=(i?fk(n.width):n.width)/s,o=(i?fk(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const GHe=Sd(0);function Qfe(t){const e=Za(t);return!t$()||!e.visualViewport?GHe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WHe(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===Za(t)}function Mm(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=n$(t);let a=Sd(1);e&&(s?ou(s)&&(a=J0(s)):a=J0(t));const o=WHe(i,n,s)?Qfe(i):Sd(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,f=r.height/a.y;if(i&&s){const p=Za(i),m=ou(s)?Za(s):s;let v=p,x=mM(v);for(;x&&m!==v;){const y=J0(x),S=x.getBoundingClientRect(),_=lu(x),E=S.left+(x.clientLeft+parseFloat(_.paddingLeft))*y.x,T=S.top+(x.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,f*=y.y,l+=E,u+=T,v=Za(x),x=mM(v)}}return pk({width:d,height:f,x:l,y:u})}function K4(t,e){const n=q4(t).scrollLeft;return e?e.left+n:Mm(Od(t)).left+n}function Jfe(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-K4(t,n),r=n.top+e.scrollTop;return{x:s,y:r}}function qHe(t){let{elements:e,rect:n,offsetParent:s,strategy:r}=t;const i=r==="fixed",a=Od(s),o=e?W4(e.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Sd(1);const d=Sd(0),f=Gh(s);if((f||!i)&&((V1(s)!=="body"||G4(a))&&(l=q4(s)),f)){const m=Mm(s);u=J0(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}const p=a&&!f&&!i?Jfe(a,l):Sd(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function KHe(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function YHe(t){const e=q4(t),n=t.ownerDocument.body,s=bd(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),r=bd(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+K4(t);const a=-e.scrollTop;return lu(n).direction==="rtl"&&(i+=bd(t.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:a}}const ZHe=25;function XHe(t,e,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Za(t),i=Od(t),a=r.visualViewport;let o=i.clientWidth,l=i.clientHeight,u=0,d=0;if(a){const p=!t$()||e==="fixed";s?p||(u=-a.offsetLeft,d=-a.offsetTop):(o=a.width,l=a.height,p&&(u=a.offsetLeft,d=a.offsetTop))}if(K4(i)<=0){const p=i.ownerDocument,m=p.body,v=getComputedStyle(m),x=p.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,y=Math.abs(i.clientWidth-m.clientWidth-x),S=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;S<=ZHe&&(o-=S)}return{width:o,height:l,x:u,y:d}}function QHe(t,e){const n=Mm(t,!0,e==="fixed"),s=n.top+t.clientTop,r=n.left+t.clientLeft,i=J0(t),a=t.clientWidth*i.x,o=t.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function sZ(t,e,n){let s;if(e==="viewport"||e==="layoutViewport")s=XHe(t,n,e);else if(e==="document")s=YHe(Od(t));else if(ou(e))s=QHe(e,n);else{const r=Qfe(t);s={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return pk(s)}function JHe(t,e){const n=e.get(t);if(n)return n;let s=l2(t,[],!1).filter(o=>ou(o)&&V1(o)!=="body"),r=null;const i=lu(t).position==="fixed";let a=i?Pm(t):t;for(;ou(a)&&!o2(a);){const o=lu(a),l=e$(a),u=r?r.position:i?"fixed":"";!l&&(u==="fixed"||u==="absolute"&&o.position==="static")?s=s.filter(f=>f!==a):r=o,a=Pm(a)}return e.set(t,s),s}function eGe(t){let{element:e,boundary:n,rootBoundary:s,strategy:r}=t;const a=[...n==="clippingAncestors"?W4(e)?[]:JHe(e,this._c):[].concat(n),s],o=sZ(e,a[0],r);let l=o.top,u=o.right,d=o.bottom,f=o.left;for(let p=1;p<a.length;p++){const m=sZ(e,a[p],r);l=bd(m.top,l),u=Ih(m.right,u),d=Ih(m.bottom,d),f=bd(m.left,f)}return{width:u-f,height:d-l,x:f,y:l}}function tGe(t){const{width:e,height:n}=Xfe(t);return{width:e,height:n}}function nGe(t,e,n){const s=Gh(e),r=Od(e),i=n==="fixed",a=Mm(t,!0,i,e);let o={scrollLeft:0,scrollTop:0};const l=Sd(0);
vendor: 4,566 bytes, line 268
268if((s||!i)&&((V1(e)!=="body"||G4(r))&&(o=q4(e)),s)){const p=Mm(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}!s&&r&&(l.x=K4(r));const u=r&&!s&&!i?Jfe(r,o):Sd(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function R6(t){return lu(t).position==="static"}function rZ(t,e){if(!Gh(t)||lu(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Od(t)===n&&(n=n.ownerDocument.body),n}function ehe(t,e){const n=Za(t);if(W4(t))return n;if(!Gh(t)){let r=Pm(t);for(;r&&!o2(r);){if(ou(r)&&!R6(r))return r;r=Pm(r)}return n}let s=rZ(t,e);for(;s&&BHe(s)&&R6(s);)s=rZ(s,e);return s&&o2(s)&&R6(s)&&!e$(s)?n:s||HHe(t)||n}const sGe=async function(t){const e=this.getOffsetParent||ehe,n=this.getDimensions,s=await n(t.floating);return{reference:nGe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function rGe(t){return lu(t).direction==="rtl"}const iGe={convertOffsetParentRelativeRectToViewportRelativeRect:qHe,getDocumentElement:Od,getClippingRect:eGe,getOffsetParent:ehe,getElementRects:sGe,getClientRects:KHe,getDimensions:tGe,getScale:J0,isElement:ou,isRTL:rGe};function the(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function aGe(t,e,n){let s=null,r;const i=Od(t);function a(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function o(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),a();const p=t.getBoundingClientRect(),{left:m,top:v,width:x,height:y}=p;if(d||e(),!x||!y)return;const S=W_(v),_=W_(i.clientWidth-(m+x)),E=W_(i.clientHeight-(v+y)),T=W_(m),R={rootMargin:-S+"px "+-_+"px "+-E+"px "+-T+"px",threshold:bd(0,Ih(1,f))||1};let I=!0;function A(L){const j=L[0].intersectionRatio;if(!the(p,t.getBoundingClientRect()))return o();if(j!==f){if(!I)return o();j?o(!1,j):r=setTimeout(()=>{o(!1,1e-7)},1e3)}I=!1}try{s=new IntersectionObserver(A,{...R,root:i.ownerDocument})}catch{s=new IntersectionObserver(A,R)}s.observe(t)}const l=Za(t),u=()=>o(n);return l.addEventListener("resize",u),o(!0),()=>{l.removeEventListener("resize",u),a()}}function oGe(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=n$(t),d=r||i?[...u?l2(u):[],...e?l2(e):[]]:[];d.forEach(S=>{r&&S.addEventListener("scroll",n),i&&S.addEventListener("resize",n)});const f=u&&o?aGe(u,n,i):null;let p=-1,m=null;a&&(m=new ResizeObserver(S=>{let[_]=S;_&&_.target===u&&m&&e&&(m.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(e)})),n()}),u&&!l&&m.observe(u),e&&m.observe(e));let v,x=l?Mm(t):null;l&&y();function y(){const S=Mm(t);x&&!the(x,S)&&n(),x=S,v=requestAnimationFrame(y)}return n(),()=>{var S;d.forEach(_=>{r&&_.removeEventListener("scroll",n),i&&_.removeEventListener("resize",n)}),f==null||f(),(S=m)==null||S.disconnect(),m=null,l&&cancelAnimationFrame(v)}}const lGe=OHe,cGe=$He,uGe=PHe,dGe=UHe,fGe=MHe,iZ=jHe,hGe=FHe,pGe=(t,e,n)=>{const s=new Map,r=n??{},i={...iGe,...r.platform,_c:s};return LHe(t,e,{...r,platform:i})};var mGe=typeof document<"u",gGe=function(){},WC=mGe?w.useLayoutEffect:gGe;function mk(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!mk(t[s],e[s]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&t.$$typeof)&&!mk(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function nhe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function aZ(t,e){const n=nhe(t);return Math.round(e*n)/n}function A6(t){const e=w.useRef(t);return WC(()=>{e.current=t}),e}function vGe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:a}={},transform:o=!0,whileElementsMounted:l,open:u}=t,[d,f]=w.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,m]=w.useState(s);mk(p,s)||m(s);const[v,x]=w.useState(null),[y,S]=w.useState(null),_=w.useCallback(B=>{B!==R.current&&(R.current=B,x(B))},[]),E=w.useCallback(B=>{B!==I.current&&(I.current=B,S(B))},[]),T=i||v,k=a||y,R=w.useRef(null),I=w.useRef(null),A=w.useRef(d),L=l!=null,j=A6(l),F=A6(r),O=A6(u),M=w.useCallback(()=>
268{if(!R.current||!I.current)return;const B={placement:e,strategy:n,middleware:p};F.current&&(B.platform=F.current),pGe(R.current,I.current,B).then(q=>{const z={...q,isPositioned:O.current!==!1};U.current&&!mk(A.current,z)&&(A.current=z,nr.flushSync(()=>{f(z)}))})},[p,e,n,F,O]);WC(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[u]);const U=w.useRef(!1);WC(()=>(U.current=!0,()=>{U.current=!1}),[]),WC(()=>{if(T&&(R.current=T),k&&(I.current=k),T&&k){if(j.current)return j.current(T,k,M);M()}},[T,k,M,j,L]);const G=w.useMemo(()=>({reference:R,floating:I,setReference:_,setFloating:E}),[_,E]),$=w.useMemo(()=>({reference:T,floating:k}),[T,k]),V=w.useMemo(()=>{const B={position:n,left:0,top:0};if(!$.floating)return B;const q=aZ($.floating,d.x),z=aZ($.floating,d.y);return o?{...B,transform:"translate("+q+"px, "+z+"px)",...nhe($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:z}},[n,o,$.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:M,refs:G,elements:$,floatingStyles:V}),[d,M,G,$,V])}const xGe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:r}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?iZ({element:s.current,padding:r}).fn(n):{}:s?iZ({element:s,padding:r}).fn(n):{}}}},yGe=(t,e)=>{const n=lGe(t);return{name:n.name,fn:n.fn,options:[t,e]}},bGe=(t,e)=>{const n=cGe(t);return{name:n.name,fn:n.fn,options:[t,e]}},SGe=(t,e)=>({fn:hGe(t).fn,options:[t,e]}),wGe=(t,e)=>{const n=uGe(t);return{name:n.name,fn:n.fn,options:[t,e]}},_Ge=(t,e)=>{const n=dGe(t);return{name:n.name,fn:n.fn,options:[t,e]}},EGe=(t,e)=>{const n=fGe(t);return{name:n.name,fn:n.fn,options:[t,e]}},CGe=(t,e)=>{const n=xGe(t);return{name:n.name,fn:n.fn,options:[t,e]}};var TGe=Object.defineProperty,kGe=(t,e)=>TGe(t,"name",{value:e,configurable:!0});function she(t){const[e,n]=w.useState(void 0);return Ir(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let a,o;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,o=u.blockSize}else a=t.offsetWidth,o=t.offsetHeight;n({width:a,height:o})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}kGe(she,"useSize");var RGe=Object.defineProperty,ph=(t,e)=>RGe(t,"name",{value:e,configurable:!0}),rhe="Popper",[ihe,H1]=hu(rhe),[AGe,ahe]=ihe(rhe),NGe=ph(t=>{const{__scopePopper:e,children:n}=t,[s,r]=w.useState(null),[i,a]=w.useState(void 0);return c.jsx(AGe,{scope:e,anchor:s,onAnchorChange:r,placementState:i,setPlacementState:a,children:n})},"Popper"),IGe="PopperAnchor",LGe=w.forwardRef(ph(function(e,n){const{__scopePopper:s,virtualRef:r,...i}=e,a=ahe(IGe,s),o=w.useRef(null),l=a.onAnchorChange,u=w.useCallback(x=>{o.current=x,x&&l(x)},[l]),d=ps(n,u),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const x=f.current;f.current=r.current,x!==f.current&&l(f.current)});const p=a.placementState&&Y4(a.placementState),m=p==null?void 0:p[0],v=p==null?void 0:p[1];return r?null:c.jsx(is.div,{"data-radix-popper-side":m,"data-radix-popper-align":v,...i,ref:d})},"PopperAnchor")),ohe="PopperContent",[jGe,cxt]=ihe(ohe),PGe=w.forwardRef(ph(function(e,n){var ue,ye,je,Re,me,Ce,Xe;const{__scopePopper:s,side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:v="optimized",onPlaced:x,...y}=e,S=ahe(ohe,s),[_,E]=w.useState(null),T=ps(n,E),[k,R]=w.useState(null),I=she(k),A=(I==null?void 0:I.width)??0,L=(I==null?void 0:I.height)??0,j=r+(a!=="center"?"-"+a:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},O=Array.isArray(d)?d:[d],M=O.length>0,U={padding:F,boundary:O.filter(lhe),altBoundary:M},{refs:G,floatingStyles:$,placement:V,isPositioned:B,middlewareData:q}=vGe({strategy:"fixed",placement:j,whileElementsMounted:ph((...he)=>oGe(...he,{animationFrame:v==="always"}
268),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[yGe({mainAxis:i+L,alignmentAxis:o}),u&&bGe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?SGe():void 0,...U}),u&&wGe({...U}),_Ge({...U,apply:ph(({elements:he,rects:De,availableWidth:Ge,availableHeight:Je})=>{const{width:Le,height:qe}=De.reference,et=he.floating.style;et.setProperty("--radix-popper-available-width",`${Ge}px`),et.setProperty("--radix-popper-available-height",`${Je}px`),et.setProperty("--radix-popper-anchor-width",`${Le}px`),et.setProperty("--radix-popper-anchor-height",`${qe}px`)},"apply")}),k&&CGe({element:k,padding:l}),MGe({arrowWidth:A,arrowHeight:L}),m&&EGe({strategy:"referenceHidden",...U,boundary:M?U.boundary:void 0})]}),z=S.setPlacementState;Ir(()=>(z(V),()=>{z(void 0)}),[V,z]);const[D,K]=Y4(V),Y=au(x);Ir(()=>{B&&(Y==null||Y())},[B,Y]);const J=(ue=q.arrow)==null?void 0:ue.x,ne=(ye=q.arrow)==null?void 0:ye.y,Q=((je=q.arrow)==null?void 0:je.centerOffset)!==0,[ee,te]=w.useState();return Ir(()=>{_&&te(window.getComputedStyle(_).zIndex)},[_]),c.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:B?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(Re=q.transformOrigin)==null?void 0:Re.x,(me=q.transformOrigin)==null?void 0:me.y].join(" "),...((Ce=q.hide)==null?void 0:Ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(jGe,{scope:s,placedSide:D,placedAlign:K,onArrowChange:R,arrowX:J,arrowY:ne,shouldHideArrow:Q,children:c.jsx(is.div,{"data-side":D,"data-align":K,...y,ref:T,style:{...y.style,animation:B?(Xe=y.style)==null?void 0:Xe.animation:"none"}})})})},"PopperContent"));function lhe(t){return t!==null}ph(lhe,"isNotNull");var MGe=ph(t=>({name:"transformOrigin",options:t,fn(e){var y,S,_;const{placement:n,rects:s,middlewareData:r}=e,a=((y=r.arrow)==null?void 0:y.centerOffset)!==0,o=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[u,d]=Y4(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((S=r.arrow)==null?void 0:S.x)??0)+o/2,m=(((_=r.arrow)==null?void 0:_.y)??0)+l/2;let v="",x="";return u==="bottom"?(v=a?f:`${p}px`,x=`${-l}px`):u==="top"?(v=a?f:`${p}px`,x=`${s.floating.height+l}px`):u==="right"?(v=`${-l}px`,x=a?f:`${m}px`):u==="left"&&(v=`${s.floating.width+l}px`,x=a?f:`${m}px`),{data:{x:v,y:x}}}}),"transformOrigin");function Y4(t){const[e,n="center"]=t.split("-");return[e,n]}ph(Y4,"getSideAndAlignFromPlacement");var s$=NGe,r$=LGe,i$=PGe,DGe=Object.defineProperty,OGe=(t,e)=>DGe(t,"name",{value:e,configurable:!0}),Z4=w.forwardRef(OGe(function(e,n){var l;const{container:s,...r}=e,[i,a]=w.useState(!1);Ir(()=>a(!0),[]);const o=s||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?nr.createPortal(c.jsx(is.div,{...r,ref:n}),o):null},"Portal")),$Ge=Object.defineProperty,Ad=(t,e)=>$Ge(t,"name",{value:e,configurable:!0});function che(t,e){return w.useReducer((n,s)=>e[n][s]??n,t)}Ad(che,"useStateMachine");var $d=Ad(t=>{const{present:e,children:n}=t,s=uhe(e),r=typeof n=="function"?n({present:s.isPresent}):w.Children.only(n),i=dhe(s.ref,fhe(r));return typeof n=="function"||s.isPresent?w.cloneElement(r,{ref:i}):null},"Presence");function uhe(t){const[e,n]=w.useState(),s=w.useRef(null),r=w.useRef(t),i=w.useRef("none"),a=w.useRef(void 0),o=t?"mounted":"unmounted",[l,u]=che(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{l==="mounted"?(i.current=a.current??f0(s.current),a.current=void 0):i.current="none"},[l]),Ir(()=>{const d=s.current,f=r.current;if(f!==t){const m=i.current,v=f0(d);t?(a.current=v,u("MOUNT")):v==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&m!==v?"ANIMATION_OUT":"UNMOUNT"),r.current=t}},[t,u]),Ir(()=>{if(e){let d;const f=e.ownerDocument.defaultView??window,p=Ad(v=>{const y=f0(s.current).includes(CSS.escape(v.animationName));if(v.target===e&&y&&(u("ANIMATION_END"),!r.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",d=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},"handleAnimationEnd"),m=Ad(v=>{v.target===e&&(i.current=f0(s.current))},"handleAnimationStart");return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{f.clearTimeout(d),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:w.useCallback(d=>
268{if(d){const f=getComputedStyle(d);s.current=f,a.current=f0(f)}else s.current=null;n(d)},[])}}Ad(uhe,"usePresence");function gM(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ad(gM,"setRef");function dhe(...t){const e=w.useRef(t);return e.current=t,w.useCallback(n=>{const s=e.current;let r=!1;const i=s.map(a=>{const o=gM(a,n);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let a=0;a<i.length;a++){const o=i[a];typeof o=="function"?o():gM(s[a],null)}}},[])}Ad(dhe,"useStableComposedRefs");function f0(t){return(t==null?void 0:t.animationName)||"none"}Ad(f0,"getAnimationName");function fhe(t){var s,r;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Ad(fhe,"getElementRef");var FGe=Object.defineProperty,UGe=(t,e)=>FGe(t,"name",{value:e,configurable:!0}),oZ=x1[" useEffectEvent ".trim().toString()],lZ=x1[" useInsertionEffect ".trim().toString()];function hhe(t){if(typeof oZ=="function")return oZ(t);const e=w.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof lZ=="function"?lZ(()=>{e.current=t}):Ir(()=>{e.current=t}),w.useMemo(()=>((...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)}),[])}UGe(hhe,"useEffectEvent");var BGe=Object.defineProperty,LS=(t,e)=>BGe(t,"name",{value:e,configurable:!0}),zGe=x1[" useInsertionEffect ".trim().toString()]||Ir;function Nd({prop:t,defaultProp:e,onChange:n=LS(()=>{},"onChange"),caller:s}){const[r,i,a]=phe({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:r,u=w.useCallback(d=>{var f;if(o){const p=mhe(d)?d(t):d;p!==t&&((f=a.current)==null||f.call(a,p))}else i(d)},[o,t,i,a]);return[l,u]}LS(Nd,"useControllableState");function phe({defaultProp:t,onChange:e}){const[n,s]=w.useState(t),r=w.useRef(n),i=w.useRef(e);return zGe(()=>{i.current=e},[e]),w.useEffect(()=>{var a;r.current!==n&&((a=i.current)==null||a.call(i,n),r.current=n)},[n,r]),[n,s,i]}LS(phe,"useUncontrolledState");function mhe(t){return typeof t=="function"}LS(mhe,"isFunction");var cZ=Symbol("RADIX:SYNC_STATE");function VGe(t,e,n,s){const{prop:r,defaultProp:i,onChange:a,caller:o}=e,l=r!==void 0,u=hhe(a),d=[{...n,state:i}];s&&d.push(s);const[f,p]=w.useReducer((y,S)=>{if(S.type===cZ)return{...y,state:S.state};const _=t(y,S);return l&&!Object.is(_.state,y.state)&&u(_.state),_},...d),m=f.state,v=w.useRef(m);w.useEffect(()=>{v.current!==m&&(v.current=m,l||u(m))},[m,v,l]);const x=w.useMemo(()=>r!==void 0?{...f,state:r}:f,[f,r]);return w.useEffect(()=>{l&&!Object.is(r,f.state)&&p({type:cZ,state:r})},[r,f.state,l]),[x,p]}LS(VGe,"useControllableStateReducer");var HGe=Object.defineProperty,GGe=(t,e)=>HGe(t,"name",{value:e,configurable:!0});function ghe(t){const e=w.useRef({value:t,previous:t});return w.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}GGe(ghe,"usePrevious");var WGe=Object.defineProperty,qGe=(t,e)=>WGe(t,"name",{value:e,configurable:!0}),vhe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),KGe=w.forwardRef(qGe(function(e,n){return c.jsx(is.span,{...e,ref:n,style:{...vhe,...e.style}})},"VisuallyHidden")),YGe=KGe,ZGe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Bg=new WeakMap,q_=new WeakMap,K_={},N6=0,xhe=function(t){return t&&(t.host||xhe(t.parentNode))},XGe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=xhe(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},QGe=function(t,e,n,s){var r=XGe(e,Array.isArray(t)?t:[t]);K_[n]||(K_[n]=new WeakMap);var i=K_[n],a=[],o=new Set,l=new Set(r),u=function(f){!f||o.has(f)||(o.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(o.has(p))d(p);else try{var m=p.getAttribute(s),v=m!==null&&m!=="false",x=(Bg.get(p)||0)+1,y=(i.get(p)||0)+1;Bg.set(p,x),i.set(p,y),a.push(p),x===1&&v&&q_.set(p,!0),y===1&&p.setAttribute(n,"true"),v||p.setAttribute(s,"true")}catch(S){console.error("aria-hidden: cannot operate on ",p,S)}})};return d(e),o.clear(),N6++,function(){a.forEach(function(f){var p=Bg.get(f)-1,m=i.get(f)-1;Bg.set(f,p),i.set(f,m),p||(q_.has(f)||f.removeAttribute(s),q_.delete(f)),m||f.removeAttribute(n)}),N6--,N6||(Bg=new WeakMap,Bg=new WeakMap,q_=new WeakMap,K_={})}},a$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),r=ZGe(t);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),QGe(s,r,n,"aria-hidden")):function(){return null}},Uc=function(){return Uc=Object.assign||function(e){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Uc.apply(this,arguments)};function yhe(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]]);return n}function JGe(t,e,n){if(n||arguments.length===2)for(var s=0,r=e.length,i;s<r;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}var qC="right-scroll-bar-position",KC="width-before-scroll-bar",eWe="with-scroll-bars-hidden",tWe="--removed-body-scroll-bar-size";function I6(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function nWe(t,e){var n=w.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=e,n.facade}var sWe=typeof window<"u"?w.useLayoutEffect:w.useEffect,uZ=new WeakMap;function rWe(t,e){var n=nWe(null,function(s){return t.forEach(function(r){return I6(r,s)})});return sWe(function(){var s=uZ.get(n);if(s){var r=new Set(s),i=new Set(t),a=n.current;r.forEach(function(o){i.has(o)||I6(o,null)}
vendor: 4,190 bytes, lines 268-283
268),i.forEach(function(o){r.has(o)||I6(o,a)})}uZ.set(n,t)},[t]),n}function iWe(t){return t}function aWe(t,e){e===void 0&&(e=iWe);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var a=e(i,s);return n.push(a),function(){n=n.filter(function(o){return o!==a})}},assignSyncMedium:function(i){for(s=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){s=!0;var a=[];if(n.length){var o=n;n=[],o.forEach(i),a=n}var l=function(){var d=a;a=[],d.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return r}function oWe(t){t===void 0&&(t={});var e=aWe(null);return e.options=Uc({async:!0,ssr:!1},t),e}var bhe=function(t){var e=t.sideCar,n=yhe(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return w.createElement(s,Uc({},n))};bhe.isSideCarExport=!0;function lWe(t,e){return t.useMedium(e),bhe}var She=oWe(),L6=function(){},X4=w.forwardRef(function(t,e){var n=w.useRef(null),s=w.useState({onScrollCapture:L6,onWheelCapture:L6,onTouchMoveCapture:L6}),r=s[0],i=s[1],a=t.forwardProps,o=t.children,l=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,p=t.sideCar,m=t.noRelative,v=t.noIsolation,x=t.inert,y=t.allowPinchZoom,S=t.as,_=S===void 0?"div":S,E=t.gapMode,T=yhe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=p,R=rWe([n,e]),I=Uc(Uc({},T),r);return w.createElement(w.Fragment,null,d&&w.createElement(k,{sideCar:She,removeScrollBar:u,shards:f,noRelative:m,noIsolation:v,inert:x,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:E}),a?w.cloneElement(w.Children.only(o),Uc(Uc({},I),{ref:R})):w.createElement(_,Uc({},I,{className:l,ref:R}),o))});X4.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};X4.classNames={fullWidth:KC,zeroRight:qC};var cWe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uWe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=cWe();return e&&t.setAttribute("nonce",e),t}function dWe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function fWe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var hWe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=uWe())&&(dWe(e,n),fWe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},pWe=function(){var t=hWe();return function(e,n){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},whe=function(){var t=pWe(),e=function(n){var s=n.styles,r=n.dynamic;return t(s,r),null};return e},mWe={left:0,top:0,right:0,gap:0},j6=function(t){return parseInt(t||"",10)||0},gWe=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],r=e[t==="padding"?"paddingRight":"marginRight"];return[j6(n),j6(s),j6(r)]},vWe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return mWe;var e=gWe(t),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-n+e[2]-e[0])}},xWe=whe(),ev="data-scroll-locked",yWe=function(t,e,n,s){var r=t.left,i=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),`
269  .`.concat(eWe,` {
270   overflow: hidden `).concat(s,`;
271   padding-right: `).concat(o,"px ").concat(s,`;
272  }
273  body[`).concat(ev,`] {
274    overflow: hidden `).concat(s,`;
275    overscroll-behavior: contain;
276    `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&`
277    padding-left: `.concat(r,`px;
278    padding-top: `).concat(i,`px;
279    padding-right: `).concat(a,`px;
280    margin-left:0;
281    margin-top:0;
282    margin-right: `).concat(o,"px ").concat(s,`;
283    `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(s,";
283")].filter(Boolean).join(""),`
284  }
285  
286  .`).concat(qC,` {
287    right: `).concat(o,"px ").concat(s,`;
288  }
289  
290  .`).concat(KC,` {
291    margin-right: `).concat(o,"px ").concat(s,`;
292  }
293  
294  .`).concat(qC," .").concat(qC,` {
295    right: 0 `).concat(s,`;
296  }
297  
298  .`).concat(KC," .").concat(KC,` {
299    margin-right: 0 `).concat(s,`;
300  }
301  
302  body[`).concat(ev,`] {
303    `).concat(tWe,": ").concat(o,`px;
304  }
305`)},dZ=function(){var t=parseInt(document.body.getAttribute(ev)||"0",10);return isFinite(t)?t:0},bWe=function(){w.useEffect(function(){return document.body.setAttribute(ev,(dZ()+1).toString()),function(){var t=dZ()-1;t<=0?document.body.removeAttribute(ev):document.body.setAttribute(ev,t.toString())}},[])},SWe=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,r=s===void 0?"margin":s;bWe();var i=w.useMemo(function(){return vWe(r)},[r]);return w.createElement(xWe,{styles:yWe(i,!e,r,n?"":"!important")})},vM=!1;if(typeof window<"u")try{var Y_=Object.defineProperty({},"passive",{get:function(){return vM=!0,!0}});window.addEventListener("test",Y_,Y_),window.removeEventListener("test",Y_,Y_)}catch{vM=!1}var zg=vM?{passive:!1}:!1,wWe=function(t){return t.tagName==="TEXTAREA"},_he=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!wWe(t)&&n[e]==="visible")},_We=function(t){return _he(t,"overflowY")},EWe=function(t){return _he(t,"overflowX")},fZ=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=Ehe(t,s);if(r){var i=Che(t,s),a=i[1],o=i[2];if(a>o)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},CWe=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},TWe=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},Ehe=function(t,e){return t==="v"?_We(e):EWe(e)},Che=function(t,e){return t==="v"?CWe(e):TWe(e)},kWe=function(t,e){return t==="h"&&e==="rtl"?-1:1},RWe=function(t,e,n,s,r){var i=kWe(t,window.getComputedStyle(e).direction),a=i*s,o=n.target,l=e.contains(o),u=!1,d=a>0,f=0,p=0;do{if(!o)break;var m=Che(t,o),v=m[0],x=m[1],y=m[2],S=x-y-i*v;(v||S)&&Ehe(t,o)&&(f+=S,p+=v);var _=o.parentNode;o=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(u=!0),u},Z_=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},hZ=function(t){return[t.deltaX,t.deltaY]},pZ=function(t){return t&&"current"in t?t.current:t},AWe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},NWe=function(t){return`
306  .block-interactivity-`.concat(t,` {pointer-events: none;}
307  .allow-interactivity-`).concat(t,` {pointer-events: all;}
308`)},IWe=0,Vg=[];function LWe(t){var e=w.useRef([]),n=w.useRef([0,0]),s=w.useRef(),r=w.useState(IWe++)[0],i=w.useState(whe)[0],a=w.useRef(t);w.useEffect(function(){a.current=t},[t]),w.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var x=JGe([t.lockRef.current],(t.shards||[]).map(pZ),!0).filter(Boolean);return x.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),x.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var o=w.useCallback(function(x,y){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var S=Z_(x),_=n.current,E="deltaX"in x?x.deltaX:_[0]-S[0],T="deltaY"in x?x.deltaY:_[1]-S[1],k,R=x.target,I=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in x&&I==="h"&&R.type==="range")return!1;var A=window.getSelection(),L=A&&A.anchorNode,j=L?L===R||L.contains(R):!1;if(j)return!1;var F=fZ(I,R);if(!F)return!0;if(F?k=I:(k=I==="v"?"h":"v",F=fZ(I,R)),!F)return!1;if(!s.current&&"changedTouches"in x&&(E||T)&&(s.current=k),!k)return!0;var O=s.current||k;return RWe(O,y,x,O==="h"?E:T)},[]),l=w.useCallback(function(x){var y=x;if(!(!Vg.length||Vg[Vg.length-1]!==i)){var S="deltaY"in y?hZ(y):Z_(y),_=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&AWe(k.delta,S)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}
308if(!_){var E=(a.current.shards||[]).map(pZ).filter(Boolean).filter(function(k){return k.contains(y.target)}),T=E.length>0?o(y,E[0]):!a.current.noIsolation;T&&y.cancelable&&y.preventDefault()}}},[]),u=w.useCallback(function(x,y,S,_){var E={name:x,delta:y,target:S,should:_,shadowParent:jWe(S)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),d=w.useCallback(function(x){n.current=Z_(x),s.current=void 0},[]),f=w.useCallback(function(x){u(x.type,hZ(x),x.target,o(x,t.lockRef.current))},[]),p=w.useCallback(function(x){u(x.type,Z_(x),x.target,o(x,t.lockRef.current))},[]);w.useEffect(function(){return Vg.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,zg),document.addEventListener("touchmove",l,zg),document.addEventListener("touchstart",d,zg),function(){Vg=Vg.filter(function(x){return x!==i}),document.removeEventListener("wheel",l,zg),document.removeEventListener("touchmove",l,zg),document.removeEventListener("touchstart",d,zg)}},[]);var m=t.removeScrollBar,v=t.inert;return w.createElement(w.Fragment,null,v?w.createElement(i,{styles:NWe(r)}):null,m?w.createElement(SWe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function jWe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const PWe=lWe(She,LWe);var Q4=w.forwardRef(function(t,e){return w.createElement(X4,Uc({},t,{ref:e,sideCar:PWe}))});Q4.classNames=X4.classNames;var MWe=Object.defineProperty,zn=(t,e)=>MWe(t,"name",{value:e,configurable:!0}),DWe=[" ","Enter","ArrowUp","ArrowDown"],OWe=[" ","Enter"],Kv="Select",[J4,eR,$We]=H7(Kv),[eg,uxt]=hu(Kv,[$We,H1]),o$=H1(),[FWe,Wh]=eg(Kv),[UWe,BWe]=eg(Kv);function The(t){const{__scopeSelect:e,children:n,open:s,defaultOpen:r,onOpenChange:i,value:a,defaultValue:o,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:v,internal_do_not_use_render:x}=t,y=o$(e),[S,_]=w.useState(null),[E,T]=w.useState(null),[k,R]=w.useState(!1),I=W7(u),[A,L]=Nd({prop:s,defaultProp:r??!1,onChange:i,caller:Kv}),[j,F]=Nd({prop:a,defaultProp:o,onChange:l,caller:Kv}),O=w.useRef(null),M=w.useRef(j);w.useEffect(()=>{const K=v?S==null?void 0:S.ownerDocument.getElementById(v):S==null?void 0:S.form;if(K instanceof HTMLFormElement){const Y=zn(()=>F(M.current),"reset");return K.addEventListener("reset",Y),()=>K.removeEventListener("reset",Y)}},[v,S,F]);const U=S?!!v||!!S.closest("form"):!0,[G,$]=w.useState(new Set),V=Zc(),B=Array.from(G).map(K=>K.props.value).join(";"),q=w.useCallback(K=>{$(Y=>new Set(Y).add(K))},[]),z=w.useCallback(K=>{$(Y=>{const J=new Set(Y);return J.delete(K),J})},[]),D={required:m,trigger:S,onTriggerChange:_,valueNode:E,onValueNodeChange:T,valueNodeHasChildren:k,onValueNodeHasChildrenChange:R,contentId:V,value:j,onValueChange:F,open:A,onOpenChange:L,dir:I,triggerPointerDownPosRef:O,disabled:p,name:d,autoComplete:f,form:v,nativeOptions:G,nativeSelectKey:B,isFormControl:U};return c.jsx(s$,{...y,children:c.jsx(FWe,{scope:e,...D,children:c.jsx(J4.Provider,{scope:e,children:c.jsx(UWe,{scope:e,onNativeOptionAdd:q,onNativeOptionRemove:z,children:Dhe(x)?x(D):n})})})})}zn(The,"SelectProvider");var zWe=zn(t=>{const{__scopeSelect:e,children:n,...s}=t;return c.jsx(The,{__scopeSelect:e,...s,internal_do_not_use_render:({isFormControl:r})=>c.jsxs(c.Fragment,{children:[n,r?c.jsx(lqe,{__scopeSelect:e}):null]})})},"Select"),VWe="SelectTrigger",tR=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,disabled:r=!1,...i}=e,a=o$(s),o=Wh(VWe,s),l=o.disabled||r,u=ps(n,o.onTriggerChange),d=eR(s),f=w.useRef("touch"),[p,m,v]=c$(y=>{const S=d().filter(T=>!T.disabled),_=S.find(T=>T.value===o.value),E=u$(S,y,_);E!==void 0&&o.onValueChange(E.value)}),x=zn(y=>{l||(o.onOpenChange(!0),v()),y&&(o.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return c.jsx(r$,{asChild:!0,...a,children:c.jsx(is.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":jS(o.value)?"":void 0,...i,ref:u,onClick:Cn(i.onClick,y=>
308{y.currentTarget.focus(),f.current!=="mouse"&&x(y)}),onPointerDown:Cn(i.onPointerDown,y=>{f.current=y.pointerType;const S=y.target;S.hasPointerCapture(y.pointerId)&&S.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:Cn(i.onKeyDown,y=>{const S=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&m(y.key),!(S&&y.key===" ")&&DWe.includes(y.key)&&(x(),y.preventDefault())})})})},"SelectTrigger")),HWe="SelectValue",GWe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,className:r,style:i,children:a,placeholder:o="",...l}=e,u=Wh(HWe,s),{onValueNodeHasChildrenChange:d}=u,f=a!==void 0,p=ps(n,u.onValueNodeChange);Ir(()=>{d(f)},[d,f]);const m=jS(u.value);return c.jsx(is.span,{...l,asChild:m?!1:l.asChild,ref:p,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:m?o:a},m?"placeholder":"value")})},"SelectValue")),khe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,children:r,...i}=e;return c.jsx(is.span,{"aria-hidden":!0,...i,ref:n,children:r||"▼"})},"SelectIcon")),WWe="SelectPortal",[qWe,KWe]=eg(WWe,{forceMount:void 0}),YWe=zn(t=>{const{__scopeSelect:e,forceMount:n,...s}=t;return c.jsx(qWe,{scope:t.__scopeSelect,forceMount:n,children:c.jsx(Z4,{asChild:!0,...s})})},"SelectPortal"),Dm="SelectContent",Rhe=w.forwardRef(zn(function(e,n){const s=KWe(Dm,e.__scopeSelect),{forceMount:r=s.forceMount,...i}=e,a=Wh(Dm,e.__scopeSelect),[o,l]=w.useState();return Ir(()=>{l(new DocumentFragment)},[]),c.jsx($d,{present:r||a.open,children:({present:u})=>u?c.jsx(QWe,{...i,ref:n}):c.jsx(ZWe,{...i,fragment:o})})},"SelectContent")),ZWe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,children:r,fragment:i}=e;return i?nr.createPortal(c.jsx(Ahe,{scope:s,children:c.jsx(J4.Slot,{scope:s,children:c.jsx("div",{ref:n,children:r})})}),i):null},"SelectContentFragment")),Dl=10,[Ahe,tg]=eg(Dm),XWe=iu("SelectContent.RemoveScroll"),QWe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s}=e,{position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:S,..._}=e,E=Wh(Dm,s),[T,k]=w.useState(null),[R,I]=w.useState(null),A=ps(n,k),[L,j]=w.useState(null),[F,O]=w.useState(null),M=eR(s),[U,G]=w.useState(!1),$=w.useRef(!1);w.useEffect(()=>{if(T)return a$(T)},[T]),IS();const V=w.useCallback(te=>{const[ue,...ye]=M().map(me=>me.ref.current),[je]=ye.slice(-1),Re=document.activeElement;for(const me of te)if(me===Re||(me==null||me.scrollIntoView({block:"nearest"}),me===ue&&R&&(R.scrollTop=0),me===je&&R&&(R.scrollTop=R.scrollHeight),me==null||me.focus(),document.activeElement!==Re))return},[M,R]),B=w.useCallback(()=>V([L,T]),[V,L,T]);w.useEffect(()=>{U&&B()},[U,B]);const{onOpenChange:q,triggerPointerDownPosRef:z}=E;w.useEffect(()=>{if(T){let te={x:0,y:0};const ue=zn(je=>{var Re,me;te={x:Math.abs(Math.round(je.pageX)-(((Re=z.current)==null?void 0:Re.x)??0)),y:Math.abs(Math.round(je.pageY)-(((me=z.current)==null?void 0:me.y)??0))}},"handlePointerMove"),ye=zn(je=>{te.x<=10&&te.y<=10?je.preventDefault():je.composedPath().includes(T)||q(!1),document.removeEventListener("pointermove",ue),z.current=null},"handlePointerUp");return z.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ye,{capture:!0})}}},[T,q,z]),w.useEffect(()=>{const te=zn(()=>q(!1),"close");return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[q]);const[D,K]=c$(te=>{const ue=M().filter(Re=>!Re.disabled),ye=ue.find(Re=>Re.ref.current===document.activeElement),je=u$(ue,te,ye);je&&setTimeout(()=>{var Re;return(Re=je.ref.current)==null?void 0:Re.focus()})}),Y=w.useCallback((te,ue,ye)=>{const je=!$.current&&!ye;(E.value!==void 0&&E.value===ue||je)&&(j(te),je&&($.current=!0))},[E.value]),J=w.useCallback(()=>T==null?void 0:T.focus(),[T]),ne=w.useCallback((te,ue,ye)=>{const je=!$.current&&!ye;(E.value!==void 0&&E.value===ue||je)&&O(te)},[E.value]),Q=r==="popper"?mZ:JWe,ee=Q===mZ?{side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:S}:{};return c.jsx(Ahe,{scope:s,content:T,viewport:R,onViewportChange:I,itemRefCallback:Y,selectedItem:L,onItemLeave:J,itemTextRefCallback:ne,focu
vendor: 6,741 bytes, line 308
308sSelectedItem:B,selectedItemText:F,position:r,isPositioned:U,searchRef:D,children:c.jsx(Q4,{as:XWe,allowPinchZoom:!0,children:c.jsx(Y7,{asChild:!0,trapped:E.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Cn(i,te=>{var ue;(ue=E.trigger)==null||ue.focus({preventScroll:!0}),te.preventDefault()}),children:c.jsx(V4,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:c.jsx(Q,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:te=>te.preventDefault(),..._,...ee,onPlaced:()=>G(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Cn(_.onKeyDown,te=>{const ue=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ue&&te.key.length===1&&K(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let je=M().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);if(["ArrowUp","End"].includes(te.key)&&(je=je.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Re=te.target,me=je.indexOf(Re);je=je.slice(me+1)}setTimeout(()=>V(je)),te.preventDefault()}})})})})})})},"SelectContentImpl")),JWe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,onPlaced:r,...i}=e,a=Wh(Dm,s),o=tg(Dm,s),[l,u]=w.useState(null),[d,f]=w.useState(null),p=ps(n,f),m=eR(s),v=w.useRef(!1),x=w.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:_,focusSelectedItem:E}=o,T=w.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&d&&y&&S&&_){const A=a.trigger.getBoundingClientRect(),L=d.getBoundingClientRect(),j=a.valueNode.getBoundingClientRect(),F=_.getBoundingClientRect();if(a.dir!=="rtl"){const Re=F.left-L.left,me=j.left-Re,Ce=A.left-me,Xe=A.width+Ce,he=Math.max(Xe,L.width),De=window.innerWidth-Dl,Ge=aM(me,[Dl,Math.max(Dl,De-he)]);l.style.minWidth=Xe+"px",l.style.left=Ge+"px"}else{const Re=L.right-F.right,me=window.innerWidth-j.right-Re,Ce=window.innerWidth-A.right-me,Xe=A.width+Ce,he=Math.max(Xe,L.width),De=window.innerWidth-Dl,Ge=aM(me,[Dl,Math.max(Dl,De-he)]);l.style.minWidth=Xe+"px",l.style.right=Ge+"px"}const O=m(),M=window.innerHeight-Dl*2,U=y.scrollHeight,G=window.getComputedStyle(d),$=parseInt(G.borderTopWidth,10),V=parseInt(G.paddingTop,10),B=parseInt(G.borderBottomWidth,10),q=parseInt(G.paddingBottom,10),z=$+V+U+q+B,D=Math.min(S.offsetHeight*5,z),K=window.getComputedStyle(y),Y=parseInt(K.paddingTop,10),J=parseInt(K.paddingBottom,10),ne=A.top+A.height/2-Dl,Q=M-ne,ee=S.offsetHeight/2,te=S.offsetTop+ee,ue=$+V+te,ye=z-ue;if(ue<=ne){const Re=O.length>0&&S===O[O.length-1].ref.current;l.style.bottom="0px";const me=d.clientHeight-y.offsetTop-y.offsetHeight,Ce=Math.max(Q,ee+(Re?J:0)+me+B),Xe=ue+Ce;l.style.height=Xe+"px"}else{const Re=O.length>0&&S===O[0].ref.current;l.style.top="0px";const Ce=Math.max(ne,$+y.offsetTop+(Re?Y:0)+ee)+ye;l.style.height=Ce+"px",y.scrollTop=ue-ne+y.offsetTop}l.style.margin=`${Dl}px 0`,l.style.minHeight=D+"px",l.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[m,a.trigger,a.valueNode,l,d,y,S,_,a.dir,r]);Ir(()=>T(),[T]);const[k,R]=w.useState();Ir(()=>{d&&R(window.getComputedStyle(d).zIndex)},[d]);const I=w.useCallback(A=>{A&&x.current===!0&&(T(),E==null||E(),x.current=!1)},[T,E]);return c.jsx(eqe,{scope:s,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:I,children:c.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:c.jsx(is.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),mZ=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,align:r="start",collisionPadding:i=Dl,...a}=e,o=o$(s);return c.jsx(i$,{...o,...a,ref:n,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[eqe,l$]=eg(Dm,{}),gZ="SelectViewport",tqe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,nonce:r,...i}=e,a=tg(gZ,s),o=l$(gZ,s),l=ps(n,a.onViewportChange),u=w.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(J4.Slot,{scope:s,children:c.jsx(is.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Cn(i.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&p){const v=Math.abs(u.current-f.scrollTop);if(v>0){const x=window.innerHeight-Dl*2,y=parseFloat(p.style.minHeight),S=parseFloat(p.style.height),_=Math.max(y,S);if(_<x){const E=_+v,T=Math.min(x,E),k=E-T;p.style.height=T+"px",p.style.bottom==="0px"&&(f.scrollTop=k>0?k:0,p.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})},"SelectViewport")),nqe="SelectGroup",[dxt,sqe]=eg(nqe),rqe="SelectLabel",Nhe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,...r}=e,i=sqe(rqe,s);return c.jsx(is.div,{id:i.id,...r,ref:n})},"SelectLabel")),xM="SelectItem",[iqe,aqe]=eg(xM),nR=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,value:r,disabled:i=!1,textValue:a,...o}=e,l=Wh(xM,s),u=tg(xM,s),d=l.value===r,[f,p]=w.useState(a??""),[m,v]=w.useState(!1),x=au(T=>{var k;return(k=u.itemRefCallback)==null?void 0:k.call(u,T,r,i)}),y=ps(n,x),S=Zc(),_=w.useRef("touch"),E=zn(()=>{i||(l.onValueChange(r),l.onOpenChange(!1))},"handleSelect");return c.jsx(iqe,{scope:s,value:r,disabled:i,textId:S,isSelected:d,onItemTextChange:w.useCallback(T=>{p(k=>k||((T==null?void 0:T.textContent)??"").trim())},[]),children:c.jsx(J4.ItemSlot,{scope:s,value:r,disabled:i,textValue:f,children:c.jsx(is.div,{role:"option","aria-labelledby":S,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:y,onFocus:Cn(o.onFocus,()=>v(!0)),onBlur:Cn(o.onBlur,()=>v(!1)),onClick:Cn(o.onClick,()=>{_.current!=="mouse"&&E()}),onPointerUp:Cn(o.onPointerUp,()=>{_.current==="mouse"&&E()}),onPointerDown:Cn(o.onPointerDown,T=>{_.current=T.pointerType}),onPointerMove:Cn(o.onPointerMove,T=>{var k;_.current=T.pointerType,i?(k=u.onItemLeave)==null||k.call(u):_.current==="mouse"&&T.currentTarget.focu
308s({preventScroll:!0})}),onPointerLeave:Cn(o.onPointerLeave,T=>{var k;T.currentTarget===document.activeElement&&((k=u.onItemLeave)==null||k.call(u))}),onKeyDown:Cn(o.onKeyDown,T=>{var R;i||T.target!==T.currentTarget||((R=u.searchRef)==null?void 0:R.current)!==""&&T.key===" "||(OWe.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})},"SelectItem")),X_="SelectItemText",Ihe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,className:r,style:i,...a}=e,o=Wh(X_,s),l=tg(X_,s),u=aqe(X_,s),d=BWe(X_,s),[f,p]=w.useState(null),m=au(E=>{var T;return(T=l.itemTextRefCallback)==null?void 0:T.call(l,E,u.value,u.disabled)}),v=ps(n,p,u.onItemTextChange,m),x=f==null?void 0:f.textContent,y=w.useMemo(()=>c.jsx("option",{value:u.value,disabled:u.disabled,children:x},u.value),[u.disabled,u.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:_}=d;return Ir(()=>(S(y),()=>_(y)),[S,_,y]),c.jsxs(c.Fragment,{children:[c.jsx(is.span,{id:u.textId,...a,ref:v}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!jS(o.value)?nr.createPortal(a.children,o.valueNode):null]})},"SelectItemText")),vZ="SelectScrollUpButton",Lhe=w.forwardRef(zn(function(e,n){const s=tg(vZ,e.__scopeSelect),r=l$(vZ,e.__scopeSelect),[i,a]=w.useState(!1),o=ps(n,r.onScrollButtonChange);return Ir(()=>{if(s.viewport&&s.isPositioned){let l=function(){const d=u.scrollTop>0;a(d)};zn(l,"handleScroll");const u=s.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[s.viewport,s.isPositioned]),i?c.jsx(Phe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=s;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}}):null},"SelectScrollUpButton")),xZ="SelectScrollDownButton",jhe=w.forwardRef(zn(function(e,n){const s=tg(xZ,e.__scopeSelect),r=l$(xZ,e.__scopeSelect),[i,a]=w.useState(!1),o=ps(n,r.onScrollButtonChange);return Ir(()=>{if(s.viewport&&s.isPositioned){let l=function(){const d=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)<d;a(f)};zn(l,"handleScroll");const u=s.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[s.viewport,s.isPositioned]),i?c.jsx(Phe,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=s;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}}):null},"SelectScrollDownButton")),Phe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,onAutoScroll:r,...i}=e,a=tg("SelectScrollButton",s),o=w.useRef(null),l=eR(s),u=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>u(),[u]),Ir(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),c.jsx(is.div,{"aria-hidden":!0,...i,ref:n,style:{flexShrink:0,...i.style},onPointerDown:Cn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Cn(i.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Cn(i.onPointerLeave,()=>{u()})})},"SelectScrollButtonImpl")),Mhe=w.forwardRef(zn(function(e,n){const{__scopeSelect:s,...r}=e;return c.jsx(is.div,{"aria-hidden":!0,...r,ref:n})},"SelectSeparator")),oqe="SelectBubbleInput",lqe=w.forwardRef(zn(function({__scopeSelect:e,...n},s){const r=Wh(oqe,e),{value:i,onValueChange:a,required:o,disabled:l,name:u,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,v=w.useRef(null),x=ps(s,v),y=i??"",S=ghe(y),_=Array.from(p).some(E=>(E.props.value??"")==="");return w.useEffect(()=>{const E=v.current;if(!E)return;const T=window.HTMLSelectElement.prototype,R=Object.getOwnPropertyDescriptor(T,"value").set;if(S!==y&&R){const I=new Event("change",{bubbles:!0});R.call(E,y),E.dispatchEvent(I)}},[S,y]),c.jsxs(is.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:u,autoComplete:d,disabled:l,form:f,onChange:E=>a(E.target.value),...n,style:{...vhe,...n.style},ref:x,defaultValue:y,children:[jS(i)&&!_?c.jsx("option",{value:""}):null,Array.from(p)]},m)},"SelectBubbleInput"));function Dhe(t){return typeof t=="function"}zn(Dhe,"isFunction");function jS(t){return t===""||t===void 0}zn(jS,"shouldShowPlaceholder");function c$(t){const e=au(t),n=w.useRef(""),s=w.useRef(0),r=w.useCallback(a=>
308{const o=n.current+a;e(o),zn((function l(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>l(""),1e3))}),"updateSearch")(o)},[e]),i=w.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,r,i]}zn(c$,"useTypeaheadSearch");function u$(t,e,n){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=Ohe(t,Math.max(i,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}zn(u$,"findNextItem");function Ohe(t,e){return t.map((n,s)=>t[(e+s)%t.length])}zn(Ohe,"wrapArray");function G1(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 9.00009L11.2929 5.7072C11.6834 5.31668 12.3166 5.31668 12.7071 5.7072L16 9.00009M8 15.0001L11.2929 18.293C11.6834 18.6835 12.3166 18.6835 12.7071 18.293L16 15.0001",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const PS=zWe,MS=GWe,DS=w.forwardRef(({className:t,children:e,...n},s)=>c.jsxs(tR,{ref:s,className:He("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,c.jsx(khe,{asChild:!0,children:c.jsx(lde,{className:"h-4 w-4 opacity-50"})})]}));DS.displayName=tR.displayName;const $he=w.forwardRef(({className:t,...e},n)=>c.jsx(Lhe,{ref:n,className:He("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(dde,{})}));$he.displayName=Lhe.displayName;const Fhe=w.forwardRef(({className:t,...e},n)=>c.jsx(jhe,{ref:n,className:He("flex cursor-default items-center justify-center py-1",t),...e,children:c.jsx(ude,{})}));Fhe.displayName=jhe.displayName;const W1=w.forwardRef(({className:t,children:e,position:n="popper",...s},r)=>c.jsx(YWe,{children:c.jsxs(Rhe,{ref:r,className:He("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:[c.jsx($he,{}),c.jsx(tqe,{className:He("space-y-1 p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),c.jsx(Fhe,{})]})}));W1.displayName=Rhe.displayName;const cqe=w.forwardRef(({className:t,...e},n)=>c.jsx(Nhe,{ref:n,className:He("px-2 py-1.5 text-sm font-semibold",t),...e}));cqe.displayName=Nhe.displayName;const hd=w.forwardRef(({className:t,children:e,...n},s)=>c.jsx(nR,{ref:s,className:He("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 px-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=checked]:bg-[var(--sand-4)] data-[state=checked]:text-[var(--sand-12)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:c.jsx(Ihe,{children:e})}));hd.displayName=nR.displayName;const uqe=w.forwardRef(({className:t,...e},n)=>c.jsx(Mhe,{ref:n,className:He("-mx-1 my-1 h-px bg-muted",t),...e}));uqe.displayName=Mhe.displayName;const yZ=({question:t,selectedValue:e,onSelectionChange:n,hasError:s=!1,placeholder:r="Select an option"})=>c.jsxs(PS,{value:e,onValueChange:n,children:[c.jsx(Uhe,{className:He("h-9 rounded-lg pl-3 pr-[6px] font-medium border-0 text-[var(--sand-12)] bg-[var(--sand-3)] transition-colors hover:bg-[var(--sand-4)]",s?"ring-1 ring-red-400":""),children:c.jsx(MS,{placeholder:r,className:"text-[var(--sand-12)] font-normal"})}),c.jsx(W1,{className:"rounded-[8px] border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] shadow-menu",children:t.options.map(i=>c.jsx(Bhe,{value:i.label,className:"hover:!bg-[var(--sand-4)] font-normal focus:!bg-[var(--sand-4)] data-[state=checked]:!bg-[var(--sand-4)] data-[state=checked]:!text-[var(--sand-12)] dark:data-[state=checked]:!text-white h-9 items-center rounded-[6px] bg-transparent px-[8px] text-[var(--sand-10)]",children:i.label},i.value))})]}),Uhe=w.forwardRef(({className:t,children:e,...n},s)=>c.jsxs(tR,{ref:s,className:He("flex h-[40px] text-[14px] w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-1 py-2 text-sm shadow-sm disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,c.jsx(khe,{asChild:!0,children:c.jsx("span",{className:"flex",children:c.jsx(G1,{size:20,className:"text-[var(--sand-9)]"})})})]}));Uhe.displayName=tR.displayName;const Bhe=w.forwardRef(({className:t,children:e,...n},s)=>c.jsxs(nR,{ref:s,className:He("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center"}),c.jsx(Ihe,{children:e})]}));Bhe.displayName=nR.displayName;const dqe=520,fqe=1.15,hqe=220,bZ=400,SZ=48,pqe=600,mqe=3700,gqe=.12,vqe=560,xqe=1350,yqe=2500,bqe={success:{pill:"var(--green-3)",accent:"var(--green-9)",title:"var(--toast-title)",buttonText:"#ffffff",fill:"var(--green-6)",vars:"[--toast-title:var(--green-11)] dark:[--toast-title:var(--green-9)]"},warning:{pill:"var(--toast-pill)",accent:"var(--toast-accent)",title:"var(--toast-title)",buttonText:"#1c1500",fill:"var(--toast-fill)",vars:"[--toast-pill:var(--yellow-3)] [--toast-accent:var
308(--yellow-9)] [--toast-title:var(--yellow-11)] [--toast-fill:var(--yellow-6)] dark:[--toast-pill:#2c2100] dark:[--toast-accent:#f5d90a] dark:[--toast-title:#f5d90a] dark:[--toast-fill:#493c00]"},error:{pill:"var(--red-3)",accent:"var(--red-9)",title:"var(--toast-title)",buttonText:"#ffffff",fill:"var(--red-6)",vars:"[--toast-title:var(--red-11)] dark:[--toast-title:var(--red-9)]"},neutral:{pill:"var(--sand-3)",accent:"var(--sand-9)",title:"var(--sand-12)",buttonText:"#ffffff",fill:"var(--sand-6)"}},zhe=[{id:"pink",color:"#D6409F",viewBox:"0 0 32 32",path:"M0 0H8V8H0V0ZM16 8H8V16H0V24H8V32H16V24H24V32H32V24H24V16H32V8H24V0H16V8ZM16 16H24V8H16V16ZM16 16V24H8V16H16Z",size:26,style:{top:-16,left:20},rotate:-12,spin:360,spinDuration:42,drift:4},{id:"blue",color:"#0091FF",viewBox:"0 0 32 32",path:"M32 16.1074L16 0L0 16.1074H15.7867L0 32H32L16.2133 16.1074H32Z",size:28,style:{top:-22,left:"42%"},rotate:33,spin:-360,spinDuration:55,drift:6,front:!0},{id:"orange",color:"#F76808",viewBox:"0 0 55.9545 32",path:"M9.58207 2.55435e-07L46.3542 0.0176804C46.6246 0.0178909 46.7975 0.147862 46.8729 0.407593L55.9299 31.6088C56.0053 31.8686 55.9077 31.9984 55.6372 31.9984L0.317299 32C0.0468335 32 -0.0507236 31.8701 0.024628 31.6104L9.06334 0.389598C9.1387 0.129656 9.3116 -0.000210224 9.58207 2.55435e-07Z",size:34,style:{top:-18,right:-8},rotate:-16,spin:360,spinDuration:60,drift:5},{id:"yellow",color:"#F5D90A",viewBox:"0 0 29.4 32",path:"M19.6463 7.53073C19.9316 6.87377 20.09 6.14883 20.09 5.38693C20.09 2.41181 17.6768 0 14.6999 0C11.7232 0 9.30996 2.41181 9.30996 5.38693C9.30996 6.14883 9.46823 6.87377 9.75369 7.53073C8.77399 6.18289 7.18438 5.30653 5.38998 5.30653C2.41317 5.30653 0 7.71835 0 10.6935C0 13.3505 1.92489 15.5584 4.45704 16C1.92489 16.4416 0 18.6495 0 21.3065C0 24.2816 2.41317 26.6935 5.38998 26.6935C7.18438 26.6935 8.77399 25.8171 9.75369 24.4693C9.46823 25.1263 9.30996 25.8512 9.30996 26.6131C9.30996 29.5881 11.7232 32 14.6999 32C17.6768 32 20.09 29.5881 20.09 26.6131C20.09 25.8512 19.9316 25.1263 19.6463 24.4693C20.626 25.8171 22.2154 26.6935 24.01 26.6935C26.9868 26.6935 29.4 24.2816 29.4 21.3065C29.4 18.6495 27.475 16.4416 24.9428 16C27.475 15.5584 29.4 13.3505 29.4 10.6935C29.4 7.71835 26.9868 5.30653 24.01 5.30653C22.2154 5.30653 20.626 6.18289 19.6463 7.53073ZM19.0636 23.4504C18.7783 22.7935 18.62 22.0685 18.62 21.3065C18.62 18.6495 20.5449 16.4416 23.077 16C20.5449 15.5584 18.62 13.3505 18.62 10.6935C18.62 9.93157 18.7783 9.20663 19.0636 8.54967C18.0839 9.89751 16.4945 10.7739 14.6999 10.7739C12.9056 10.7739 11.316 9.89751 10.3363 8.54967C10.6217 9.20663 10.78 9.93157 10.78 10.6935C10.78 13.3505 8.85509 15.5584 6.32294 16C8.85509 16.4416 10.78 18.6495 10.78 21.3065C10.78 22.0685 10.6217 22.7935 10.3363 23.4504C11.316 22.1025 12.9056 21.2261 14.6999 21.2261C16.4945 21.2261 18.0839 22.1025 19.0636 23.4504Z",size:26,style:{bottom:-16,left:"38%"},rotate:8,spin:-360,spinDuration:48,drift:4}],jy=zhe.map(({id:t,color:e,viewBox:n,path:s})=>({id:t,color:e,viewBox:n,path:s}));function Vhe({glyph:t,className:e}){return c.jsx("svg",{viewBox:t.viewBox,className:e,fill:"none",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:t.path,fill:t.color})})}function Sqe({spec:t,index:e,reduce:n,fade:s,leaving:r,sweep:i}){return c.jsx(wt.div,{className:"pointer-events-none absolute",style:{...t.style,width:t.size,height:t.size,zIndex:t.front?20:void 0},initial:{opacity:0,scale:s?1:.6},animate:{opacity:r?0:1,scale:r?.7:1},transition:r?{delay:i?e*gqe:0,duration:.18,ease:"easeIn"}:s?{delay:.1,duration:.2}:{delay:fqe+e*.08,type:"spring",bounce:.45,duration:.6},children:c.jsx(wt.div,{className:"h-full w-full",style:{rotate:t.rotate},animate:n?void 0:{rotate:t.rotate+t.spin,y:[0,-t.drift,0]},transition:n?void 0:{rotate:{duration:t.spinDuration,repeat:1/0,ease:"linear"},y:{duration:t.spinDuration/3,repeat:1/0,ease:"easeInOut"}},children:c.jsx(Vhe,{glyph:t,className:"block h-full w-full overflow-visible"})})})}const wZ="whitespace-nowrap text-[14px] font-medium leading-[20px]",_Z="whitespace-nowrap text-[12px] font-medium leading-[20px]";function wqe({title:t,actionLabel:e,onAction:n,onDismiss:s,duration:r=6e3,sweep:i=!1,tone:a="success",progress:o,shapes:l=!0}){const u=bqe[a],d=Hh()??!1,f=w.useRef(null),p=w.useRef(null),[m,v]=w.useState(!1),[x,y]=w.useState(!1),[S,_]=w.useState(!1),E=w.useRef(!1),[T,k]=w.useState(null),[R,I]=w.useState(28);w.useLayoutEffect(()=>{var q,z;const $=((q=f.current)==null?void 0:q.offsetWidth)??0,V=((z=p.current)==null?void 0:z.offsetWidth)??0,B=e?V+20:0;I(e?B:28),k(e?Math.max(bZ,16+$+16+B+10):$+32)},[t,e]);const A=T!=null&&T>pqe,L=d||A,j=w.useCallback(()=>{E.current||(E.current=!0,y(!0),setTimeout(s,d?40:i?vqe:hqe))},[s,d,i]),F=w.useCallback(()=>{n==null||n(),j()},[n,j]);w.useLayoutEffect(()=>{if(T==null||L)return;const $=setTimeout(()=>v(!0),dqe);return()=>clearTimeout($)},[T,L]),w.useLayoutEffect(()=>{const V=setTimeout(j,i?d?800:mqe:r);return()=>clearTimeout(V)},[i,d,r,j]),w.useLayoutEffect(()=>{if(o==null)return;const $=setTimeout(()=>_(!0),L?250:xqe);return()=>clearTimeout($)},[o,L]);const O=m||L,M=O?T??bZ:SZ,U=O&&e?R:28,G=L?{duration:.2}:{type:"spring",bounce:.35,duration:.7};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{"aria-hidden":!0,
308className:"pointer-events-none fixed left-0 top-0 h-0 w-0 overflow-hidden",style:{visibility:"hidden"},children:[c.jsx("span",{ref:f,className:wZ,children:t}),c.jsx("span",{ref:p,className:_Z,children:e})]}),T!=null&&c.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-[24px] z-[120] flex justify-center",children:c.jsxs(wt.div,{className:"pointer-events-auto relative",initial:{y:L?0:140,opacity:0},animate:{y:0,opacity:1},exit:{y:L?0:24,opacity:0,transition:{duration:.2}},transition:L?{duration:.28,ease:"easeOut"}:{type:"spring",bounce:.32,duration:.5},children:[l&&zhe.map(($,V)=>c.jsx(Sqe,{spec:$,index:V,reduce:d,fade:L,leaving:x,sweep:i},$.id)),c.jsxs(wt.div,{role:"status",onClick:F,className:`relative z-[10] flex h-[48px] cursor-pointer items-center rounded-full ${u.vars??""}`,style:{backgroundColor:u.pill,clipPath:"inset(0 round 9999px)"},initial:{width:L?T:SZ},animate:{width:M},transition:G,children:[o!=null&&c.jsx(wt.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0",style:{backgroundColor:u.fill},initial:{width:0},animate:{width:S?Math.round(o*T):0},transition:d?{duration:.35}:{type:"spring",bounce:.2,duration:yqe/1e3}}),c.jsx("div",{className:`pointer-events-none absolute inset-y-0 flex items-center ${e?"left-[16px]":"inset-x-0 justify-center px-[16px]"}`,children:c.jsx(wt.span,{className:wZ,style:{color:u.title},initial:{opacity:L?1:0,x:L?0:-6},animate:{opacity:O?1:0,x:O?0:-6},transition:{delay:O&&!L?.14:0,duration:.25},children:t})}),c.jsx("div",{className:"absolute inset-y-0 right-[10px] flex items-center",children:c.jsx(wt.button,{type:"button",onClick:$=>{$.stopPropagation(),F()},"aria-label":e,className:`flex h-[28px] items-center justify-center rounded-full transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-95 active:scale-[0.97] ${e?"cursor-pointer":"pointer-events-none"}`,style:{backgroundColor:u.accent,clipPath:"inset(0 round 9999px)"},initial:{width:L?U:28,opacity:L&&!e?0:1},animate:{width:U,opacity:O&&!e?0:1},transition:G,children:c.jsx(wt.span,{className:_Z,style:{color:u.buttonText},initial:{opacity:L&&e?1:0},animate:{opacity:O&&e?1:0},transition:{delay:O&&!L?.24:0,duration:.2},children:e})})})]})]})})]})}function _qe({toasts:t}){return c.jsx(xr,{children:t.map(e=>c.jsx(wqe,{title:e.title,actionLabel:e.actionLabel,onAction:e.onAction,onDismiss:e.onDismiss,duration:e.duration,sweep:e.sweep,tone:e.tone,progress:e.progress,shapes:e.shapes},e.id))})}const sR=w.forwardRef(({className:t,...e},n)=>c.jsx("textarea",{className:He("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));sR.displayName="Textarea";const Q_=4,Eqe=1440,EZ=100,Py="!text-[var(--sand-12)] text-[0.8125rem] font-normal",CZ="!rounded-lg !bg-[var(--sand-3)] !text-[var(--sand-12)] !py-[1.2rem] !border-0 hover:!bg-[var(--sand-4)] transition-colors duration-200 placeholder:text-[var(--sand-10)]",Cqe="[scrollbar-width:thin] [scrollbar-color:var(--gray-6)_transparent] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-[var(--gray-6)]",Tqe=`!rounded-lg !bg-[var(--sand-3)] !text-[var(--sand-12)] !border-0 min-h-[84px] resize-none text-sm hover:!bg-[var(--sand-4)] transition-colors duration-200 placeholder:text-[var(--sand-10)] ${Cqe}`,kqe="flex h-9 items-center gap-2 whitespace-nowrap rounded-lg bg-[var(--sand-3)] px-3 text-[13px] font-medium text-[var(--sand-12)] transition-colors hover:bg-[var(--sand-4)]",Rqe="rounded-lg px-2 py-2 text-[13px] font-medium text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",Aqe="flex h-9 items-center justify-center rounded-lg bg-[var(--sand-3)] px-4 text-[14px] font-medium text-[var(--sand-12)] dark:text-white transition-[filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-125",Nqe="w-full !rou
308nded-lg !bg-[var(--sand-12)] !text-[var(--sand-1)] text-[14px] font-medium !shadow-none transition-[transform,background-color] duration-150 hover:!bg-[var(--sand-11)] active:!scale-[0.99]";function Iqe(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:"size-[18px] shrink-0 text-[var(--sand-12)]",children:[c.jsx("path",{d:"M12 15V3.5m0 0L8 7.5m4-4 4 4",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M4.5 14v4.5A1.5 1.5 0 0 0 6 20h12a1.5 1.5 0 0 0 1.5-1.5V14",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}const TZ="linear-gradient(to bottom, #000 0%, #000 42%, transparent 74%)",kZ=[["w-[64px]","w-[52px]","w-[58px]","w-[82px]","w-[62px]"],["w-[48px]","w-[46px]","w-[92px]","w-[40px]"],["w-[54px]","w-[60px]"]],RZ=[[{Icon:RS,label:"API Keys"},{Icon:Nh,label:"Network"},{Icon:U7,label:"Projects"},{Icon:r2,label:"Organization"},{Icon:z7,label:"Members"}],[{Icon:NS,label:"Wallet"},{Icon:V7,label:"Usage"},{Icon:AS,label:"Limits & alerts"},{Icon:P4,label:"Plans"}],[{Icon:U1,label:"Profile"},{Icon:B7,label:"Security"}]],Lqe=["r1","r2","r3","r4","r5","r6","r7","r8","r9"],Hhe=4,jqe=44,yM=10,d$=[.5,.42,.58,.36,.64,.48,.3,.7,.54,.4,.6,.46,.52],J_=["#D6409F","#0091FF","#F76808","#F5D90A","#99D52A","#8E4EC6","#12A594"],bM=d$.map((t,e)=>e<Hhe?{glyph:jy[e%jy.length],color:J_[e%J_.length]}:{glyph:jy[Math.floor(Math.random()*jy.length)],color:J_[Math.floor(Math.random()*J_.length)]}),Hu=bM.map(({glyph:t})=>{const e=t.viewBox.split(" ").map(Number),n=e[2]||1,s=e[3]||1,r=jqe/Math.max(n,s),i=n*r,a=s*r,o=i/2,l=a/2;return{w:i,h:a,hw:o,hh:l,rc:(o+l)/2,rad:Math.hypot(o,l)}});function ty({className:t}){return c.jsx("div",{className:He("animate-pulse rounded-[6px] bg-[var(--sand-3)]",t)})}function eE({title:t,subtitle:e}){return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h1",{className:"text-[20px] font-medium leading-[28px] text-[var(--sand-12)]",children:t}),c.jsx("p",{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:e})]})}const Pqe=6e3,AZ=["The average Steel agent clears a captcha in under 4 seconds.","Developers in more than 60 countries are building on Steel.","Over 23,531,750 sessions have been launched using Steel.","Steel has accumulated over 1M browser hours served, which equals roughly 850 dog years.","Steel ran more sessions than the population of Taiwan."];function Mqe({reduce:t}){const[e,n]=w.useState(0);return w.useEffect(()=>{if(t)return;const s=setInterval(()=>n(r=>(r+1)%AZ.length),Pqe);return()=>clearInterval(s)},[t]),c.jsxs(wt.div,{className:"z-20 flex max-w-[500px] flex-col items-start gap-4 px-6 text-left",initial:t?{opacity:0}:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:t?.2:.35},children:[c.jsx("span",{className:"text-[14px] font-medium text-[var(--sand-10)]",children:"Did you know?"}),c.jsx("div",{className:"h-[84px] w-full",children:c.jsx(xr,{mode:"wait",initial:!1,children:c.jsx(wt.p,{className:"text-[20px] leading-[28px] text-[var(--sand-12)] dark:text-white",initial:t?{opacity:0}:{opacity:0,filter:"blur(6px)",y:6},animate:{opacity:1,filter:"blur(0px)",y:0},exit:t?{opacity:0}:{opacity:0,filter:"blur(6px)",y:-6},transition:{duration:t?.2:.35,ease:"easeInOut"},children:AZ[e]},e)})})]})}function NZ(){const[t,e]=w.useState(null),[n,s]=w.useState(null);return{url:t,file:n,onPick:a=>{var l;const o=(l=a.target.files)==null?void 0:l[0];if(o){const u=URL.createObjectURL(o);e(d=>(d&&URL.revokeObjectURL(d),u)),s(o)}a.target.value=""},onRemove:()=>{e(a=>(a&&URL.revokeObjectURL(a),null)),s(null)}}}function IZ({label:t,url:e,onPick:n,onRemove:s,round:r=!1}){const i=Hh()??!1,a=w.useRef(null);return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ah,{className:Py,children:t}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:He("flex size-9 shrink-0 items-center justify-center overflow-hidden bg-[var(--sand-4)]",r?"rounded-full":"rounded-[8px]"),children:c.jsx(xr,{mode:"wait",initial:!1,children:e?c.jsx(wt.img,{src:e,alt:"",className:"size-full object-cover",initial:i?{opacity:0}
308:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:i?{opacity:0}:{opacity:0,scale:.5},transition:i?{duration:.15}:{type:"spring",bounce:.4,duration:.4}},e):c.jsx(zVe,{size:20,className:"text-[var(--sand-9)]"},"placeholder")})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>{var o;return(o=a.current)==null?void 0:o.click()},className:kqe,children:[c.jsx(Iqe,{}),e?"Reupload":"Upload image"]}),c.jsx(xr,{initial:!1,children:e&&c.jsx(wt.button,{type:"button",onClick:s,className:Rqe,initial:i?{opacity:0}:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:i?{opacity:0}:{opacity:0,scale:.85},transition:i?{duration:.15}:{type:"spring",bounce:.3,duration:.35},children:"Remove"},"remove")})]}),c.jsx("input",{ref:a,type:"file",accept:"image/*",className:"hidden",onChange:n})]})]})}function Dqe(t,e,n){const s=Hu[t],r=s.rad+yM;return{x:r+Math.random()*Math.max(1,e-2*r),y:s.rad+Math.random()*Math.max(1,n*.18),vx:(Math.random()-.5)*4,vy:Math.random()*2,angle:Math.random()*360,av:(Math.random()-.5)*12}}function Oqe({count:t,panelW:e,panelH:n,reduce:s}){const r=w.useRef([]),i=w.useRef([]);return w.useEffect(()=>{const a=r.current;for(;a.length<t;)a.push(Dqe(a.length,e,n));a.length>t&&(a.length=t),s&&a.forEach((o,l)=>{const u=Hu[l],d=u.hw+yM;o.x=d+(l+.5)/Math.max(1,t)*Math.max(1,e-2*d),o.y=n-u.hh,o.angle=0}),a.forEach((o,l)=>{const u=Hu[l],d=i.current[l];d&&(d.style.transform=`translate(${o.x-u.hw}px, ${o.y-u.hh}px) rotate(${o.angle}deg)`)})},[t,e,n,s]),w.useEffect(()=>{if(s)return;let a=0;const o=.5,l=.42,u=()=>{const d=r.current;for(let f=0;f<d.length;f++){const p=d[f],m=Hu[f];p.vy+=o,p.vx*=.995,p.av*=.99,p.x+=p.vx,p.y+=p.vy,p.angle+=p.av;const v=p.angle*Math.PI/180,x=Math.abs(Math.cos(v)),y=Math.abs(Math.sin(v)),S=m.hw*x+m.hh*y+yM,_=m.hw*y+m.hh*x;p.x<S?(p.x=S,p.vx=Math.abs(p.vx)*l):p.x>e-S&&(p.x=e-S,p.vx=-Math.abs(p.vx)*l),p.y>n-_&&(p.y=n-_,p.vy=p.vy>1?-p.vy*l:0,p.vx*=.86,p.av*=.9)}for(let f=0;f<d.length;f++)for(let p=f+1;p<d.length;p++){const m=d[f],v=d[p],x=v.x-m.x,y=v.y-m.y,S=Math.hypot(x,y)||.001,_=Hu[f].rc+Hu[p].rc;if(S<_){const E=(_-S)/2,T=x/S,k=y/S;m.x-=T*E,m.y-=k*E,v.x+=T*E,v.y+=k*E;const R=(v.vx-m.vx)*T+(v.vy-m.vy)*k;if(R<0){const I=-1.42*R/2;m.vx-=I*T,m.vy-=I*k,v.vx+=I*T,v.vy+=I*k;const A=-(v.vx-m.vx)*k+(v.vy-m.vy)*T;m.av-=A*.1,v.av+=A*.1}}}for(let f=0;f<d.length;f++){const p=d[f],m=Hu[f],v=i.current[f];v&&(v.style.transform=`translate(${p.x-m.hw}px, ${p.y-m.hh}px) rotate(${p.angle}deg)`)}a=requestAnimationFrame(u)};return a=requestAnimationFrame(u),()=>cancelAnimationFrame(a)},[e,n,s]),c.jsx("div",{className:"pointer-events-none absolute inset-0 z-20",children:Array.from({length:t}).map((a,o)=>c.jsx("div",{ref:l=>{i.current[o]=l},className:"absolute left-0 top-0",style:{width:Hu[o].w,height:Hu[o].h,transform:"translate(-9999px,0)"},children:c.jsx(Vhe,{glyph:{...bM[o].glyph,color:bM[o].color},className:"h-full w-full"})},d$[o]))})}function $qe({name:t,logoUrl:e,profileUrl:n,real:s=!1}){const r=Hh()??!1;return c.jsxs("div",{className:"flex h-[900px] w-[1440px] flex-col bg-[var(--sand-1)] text-[var(--sand-12)]",children:[c.jsxs("header",{className:"flex items-center gap-2 border-b-[0.5px] border-[var(--sand-6)] bg-[var(--gray-2)] px-[1.5rem] py-[1rem]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Xde,{}),c.jsx(fd,{size:20,className:"size-[20px] text-[var(--sand-10)]"}),c.jsxs("div",{className:"flex h-[40px] items-center gap-[8px] overflow-hidden rounded-[8px] bg-[var(--sand-3)] px-[12px]",children:[c.jsx(wt.span,{className:"flex size-[22px] shrink-0 items-center justify-center overflow-hidden rounded-[6px] bg-[var(--sand-7)]",animate:!e&&!r?{opacity:[1,.4,1]}:{opacity:1},transition:!e&&!r?{duration:2,repeat:1/0,ease:"easeInOut"}:{duration:.2},children:e&&c.jsx("img",{src:e,alt:"",className:"size-full object-cover"})}),c.jsx("span",{className:"max-w-[220px] truncate whitespace-nowrap text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:t.trim()||"Your organization"})]})]}),c.jsxs("nav",{className:"flex flex-1 items-center justify-end gap-3",children:[c.jsxs("div",{className:"flex h-[40px] items-center gap-2 rounded-md bg-[var(--sand-3)] px-2.5 text-sm text-[var(--sand-12)]",children:[c.jsx(NS,{size:20}),"$0.00"]}),c.jsxs(wt.div,{className:"flex size-[30px] shrink-0 items-center justify-center overflow-hidden rounded-[999px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)]",animate:!n&&!r?{opacity:[1,.4,1]}:{opacity:1},transition:!n&&!r?{duration:2,repeat:1/0,ease:"easeInOut"}:{duration:.2},children:[!n&&c.jsx(BVe,{size:20,className:"text-[var(--sand-10)]"}),c.jsx(xr,{children:n&&c.jsx(wt.img,{src:n,alt:"",className:"size-full object-cover",initial:r?{opacity:0}
308:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:r?{opacity:0}:{opacity:0,scale:.5},transition:r?{duration:.15}:{type:"spring",bounce:.4,duration:.4}},n)})]})]})]}),c.jsxs("div",{className:"flex min-h-0 flex-1",children:[c.jsx("div",{className:"flex w-[18.5rem] shrink-0 flex-col overflow-hidden border-r-[0.5px] border-[var(--sand-6)]",children:s?RZ.map((i,a)=>c.jsx("div",{className:He("flex flex-col gap-2 p-4",a<RZ.length-1&&"border-b-[0.5px] border-[var(--sand-6)]"),children:i.map(o=>{const l=o.label==="API Keys";return c.jsxs("div",{className:He("flex w-full items-center gap-2 rounded-lg p-2",l?"bg-[var(--sand-3)] text-[var(--sand-12)]":"text-[var(--sand-10)]"),children:[c.jsx(o.Icon,{size:20,className:"shrink-0"}),c.jsx("span",{className:"text-[14px] font-medium leading-5",children:o.label})]},o.label)})},i[0].label)):kZ.map((i,a)=>c.jsx("div",{className:He("flex flex-col gap-2 p-4",a<kZ.length-1&&"border-b-[0.5px] border-[var(--sand-6)]"),children:i.map(o=>c.jsxs("div",{className:"flex w-full items-center gap-2 rounded-lg p-2",children:[c.jsx(ty,{className:"size-5 shrink-0 rounded-[6px]"}),c.jsx(ty,{className:"h-[10px] flex-1"})]},o))},i[0]))}),c.jsx("div",{className:"flex flex-1 flex-col gap-6 p-8",children:s?c.jsxs("div",{className:"flex w-full max-w-[800px] flex-col gap-6",children:[c.jsxs("div",{className:"flex justify-between gap-4",children:[c.jsxs("h2",{className:"text-[2rem] font-medium leading-[2.5rem] text-[var(--sand-11)]",children:["Get started with ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"Steel"})]}),c.jsxs("div",{className:"flex shrink-0 gap-3",children:[c.jsx(Zt,{variant:"tertiary",children:"Read Docs"}),c.jsxs(Zt,{variant:"tertiary",children:[c.jsxs("span",{className:"mr-1.5 flex -space-x-3",children:[c.jsx("span",{className:"inline-block size-5 rounded-full border-[1.33px] border-[var(--sand-1)] bg-[var(--sand-7)]"}),c.jsx("span",{className:"inline-block size-5 rounded-full border-[1.33px] border-[var(--sand-1)] bg-[var(--sand-8)]"})]}),"Chat with Founders"]})]})]}),c.jsxs("div",{className:"flex w-full flex-col gap-2 rounded-2xl bg-[var(--sand-2)] p-5",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("h3",{className:"text-[16px] font-medium text-[var(--sand-12)]",children:"Get API Key"}),c.jsxs("span",{className:"flex items-center text-[var(--sand-9)]",children:["Docs",c.jsx(La,{size:20})]})]}),c.jsx("p",{className:"text-[var(--sand-11)]",children:"Quickly start building with our API Keys."}),c.jsx("div",{className:"mt-2 flex items-center gap-4",children:c.jsxs(Zt,{variant:"default",size:"lg",className:"pl-4 pr-4",children:[c.jsx(PFe,{className:"mr-2 h-4 w-4"}),"Generate API Key"]})})]}),c.jsx("hr",{className:"w-full border-t-[0.5px] border-[var(--sand-6)]"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("h2",{className:"text-[20px] font-medium leading-[28px] text-[var(--sand-12)]",children:"Quick Build with Steel"}),c.jsx("span",{className:"flex items-center rounded-full bg-[var(--yellow-3)] px-2 py-1 text-sm text-[var(--yellow-11)] dark:bg-dark-yellow-3 dark:text-dark-yellow-9",children:"Automatic Setup"})]}),c.jsx("p",{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-11)]",children:"The fastest way to get started, with the CLI or your favorite coding agent."})]}),c.jsx("div",{className:"rounded-xl border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] p-4",children:c.jsx("code",{className:"text-[13px] text-[var(--sand-11)]",children:"npx steel-dev init"})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx(ty,{className:"h-[20px] w-[220px]"}),c.jsx(ty,{className:"h-[12px] w-[340px]"})]}),c.jsx("div",{className:"h-[120px] w-full rounded-2xl border-[0.5px] border-[var(--sand-6)]"}),c.jsx("div",{className:"flex flex-col",children:Lqe.map(i=>c.jsx("div",{className:"border-t-[0.5px] border-[var(--sand-6)] py-4",children:c.jsx(ty,{className:"h-[12px] w-full"})},i))})]})})]})]})}function Fqe(t){if(!t)return!1;const e=t.tagName;if(e==="INPUT"||e==="TEXTAREA"||e==="SELECT"||t.isContentEditable)return!0;const n=t.getAttribute("role");return n==="combobox"||n==="slider"||n==="listbox"}function Uqe({onFinish:t,initialOrganizationName:e=""}){var q;const n=Hh()??!1,[s,r]=w.useState(1),[i,a]=w.useState(e),[o,l]=w.useState(""),[u,d]=w.useState(""),f=NZ(),p=NZ(),[m,v]=w.useState({}),[x,y]=w.useState({}),[S,_]=w.useState(!1),E=w.useRef(null),[T,k]=w.useState({w:0,h:0});w.useEffect(()=>{const z=E.current;if(!z)return;const D=()=>k({w:z.clientWidth,h:z.clientHeight});D();const K=new ResizeObserver(D);return K.observe(z),()=>K.disconnect()},[]);const R=_6.find(z=>z.id==="what_describes_you"),I=_6.find(z=>z.id==="what_planning_to_build"),A=_6.find(z=>z.id==="how_hear_about_steel"),L=()=>r(z=>Math.max(1,z-1)),j=w.useCallback(async()=>
308{if(s<Q_){r(z=>Math.min(Q_,z+1));return}if(!S){_(!0);try{await t({organizationName:i,organizationDescription:o,fullName:u,singleAnswers:m,questionAnswers:x,logoFile:f.file,profileFile:p.file})}finally{_(!1)}}},[s,S,t,i,o,u,m,x,f.file,p.file]),F=I?((q=x[I.id])==null?void 0:q.length)??0:0,O=A?(m[A.id]??"")!=="":!1,M=s===2?i.trim().length>=5:s===3?F>0:s===4?O:!0,U=s>2;w.useEffect(()=>{const z=D=>{if(!D.defaultPrevented&&!document.querySelector("[data-radix-popper-content-wrapper]")){if(D.key==="Enter"&&M)D.preventDefault(),j();else if(D.key==="Escape"&&U)D.preventDefault(),j();else if(D.key==="ArrowRight"||D.key==="ArrowLeft"){if(Fqe(document.activeElement))return;D.key==="ArrowRight"?M&&(D.preventDefault(),j()):(D.preventDefault(),r(K=>Math.max(1,K-1)))}}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[M,U,j]);const G=T.w-Eqe-EZ,$=s===1?G:EZ,V=Math.min(Hhe+F,d$.length);let B;return s===1?B=c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx(eE,{title:"Introduce yourself",subtitle:"Tell us a few things about yourself."}),c.jsx(IZ,{label:"Profile picture",url:p.url,onPick:p.onPick,onRemove:p.onRemove,round:!0}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ah,{className:Py,children:"What’s your name?"}),c.jsx(Ah,{autoFocus:!0,value:u,onChange:z=>d(z.target.value),placeholder:"Enter your name...",className:CZ})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ah,{className:Py,children:"What best describes you?"}),R&&c.jsx(yZ,{question:R,selectedValue:m[R.id]||"",onSelectionChange:z=>v(D=>({...D,[R.id]:z})),hasError:!1,placeholder:"Select an option"})]})]}):s===2?B=c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx(eE,{title:"Let’s set up your organization",subtitle:"This is how your workspace will appear across Steel."}),c.jsx(IZ,{label:"Company logo",url:f.url,onPick:f.onPick,onRemove:f.onRemove}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ah,{className:Py,children:"Organization name"}),c.jsx(Ah,{value:i,onChange:z=>a(z.target.value),placeholder:"Enter your organization name...",className:CZ})]}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx(ah,{className:Py,children:"Organization description (optional)"}),c.jsx(sR,{value:o,onChange:z=>l(z.target.value),placeholder:"What does your organization do?",className:Tqe,rows:3})]})]}):s===3?B=I?c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx(eE,{title:"What are you planning to build?",subtitle:"Select everything you’d like to use Steel for."}),c.jsx(ZVe,{question:I,selectedValues:x[I.id]||[],onSelectionChange:z=>y(D=>({...D,[I.id]:z})),hasError:!1,hideHeading:!0})]}):null:B=A?c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx(eE,{title:"One last thing…",subtitle:"Where did you hear about us?"}),c.jsx(yZ,{question:{...A,options:A.options.filter(z=>z.value!=="other")},selectedValue:m[A.id]||"",onSelectionChange:z=>v(D=>({...D,[A.id]:z})),hasError:!1,placeholder:"Select an option"})]}):null,c.jsxs("div",{className:"flex h-full w-full bg-[var(--sand-1)]",children:[c.jsxs("div",{className:"relative flex flex-1 items-center justify-center overflow-hidden border-r-[0.5px] border-[var(--sand-6)] bg-[var(--gray-2)] p-8",children:[s>1&&c.jsxs("button",{type:"button",onClick:L,className:"absolute left-6 top-6 z-20 flex items-center gap-1 text-[13px] font-medium text-[var(--sand-10)] outline-none transition-colors hover:text-[var(--sand-12)] focus:outline-none focus-visible:outline-none",children:[c.jsx(fd,{size:20,className:"rotate-180"}),"Back"]}),c.jsxs("div",{className:"relative z-10 flex w-full max-w-[420px] flex-col gap-6",children:[c.jsx("div",{className:"flex w-full gap-1.5",children:Array.from({length:Q_},(z,D)=>D+1).map(z=>c.jsx("div",{className:"h-1 flex-1 overflow-hidden rounded-full bg-[var(--sand-6)]",children:c.jsx(wt.div,{className:"h-full w-full rounded-full bg-[var(--sand-12)]",initial:!1,animate:{opacity:s>=z?1:0},transition:n?{duration:0}:{duration:.35,ease:"easeOut"}})},z))}),c.jsx("div",{className:"h-[440px] overflow-visible",children:c.jsx(xr,{mode:"wait",initial:!1,children:c.jsx(wt.div,{initial:n?{opacity:0}
308:{opacity:0,filter:"blur(6px)",y:8},animate:{opacity:1,filter:"blur(0px)",y:0},exit:n?{opacity:0}:{opacity:0,filter:"blur(6px)",y:-8},transition:{duration:n?.2:.35,ease:"easeInOut"},children:B},s)})}),c.jsx("div",{className:"flex gap-3",children:c.jsxs(xr,{initial:!1,mode:"popLayout",children:[U&&c.jsx(wt.button,{layout:!0,type:"button",onClick:()=>void j(),disabled:S,className:Aqe,initial:n?{opacity:0}:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:n?{opacity:0,pointerEvents:"none"}:{opacity:0,scale:.8,pointerEvents:"none"},transition:n?{duration:.15}:{type:"spring",bounce:.4,duration:.45},children:"Skip"},"skip"),c.jsx(wt.div,{layout:!0,className:"relative z-10 flex-1",transition:n?{duration:0}:{type:"spring",bounce:.35,duration:.5},children:c.jsx(Zt,{type:"button",onClick:()=>void j(),disabled:!M||S,className:Nqe,children:S?c.jsx(kd,{className:"mx-auto size-4 animate-spin"}):s===Q_?"Continue to Steel":"Continue"})},"continue")]})})]}),c.jsxs("div",{className:"pointer-events-none absolute bottom-6 left-6 z-10 text-[13px] font-medium text-[var(--sand-10)]",children:["© Steel ",new Date().getFullYear()]})]}),c.jsxs("div",{ref:E,className:"relative flex flex-1 items-center justify-center overflow-hidden bg-[var(--sand-1)]",children:[c.jsx(wt.div,{"aria-hidden":!0,className:"pointer-events-none absolute left-0 top-[180px] z-10 w-[1440px] overflow-hidden rounded-t-[16px] border-[0.5px] border-[var(--sand-6)]",style:{maskImage:TZ,WebkitMaskImage:TZ},initial:!1,animate:{x:$,y:s>=3?60:0,opacity:s>=3?0:1},transition:n?{duration:.2}:{type:"spring",bounce:.15,duration:.7},children:c.jsx($qe,{name:i,logoUrl:f.url,profileUrl:p.url})}),s===3&&c.jsx(Oqe,{count:V,panelW:T.w,panelH:T.h,reduce:n}),s>=4&&c.jsx(Mqe,{reduce:n})]})]})}const Bqe=[{id:"lime",color:"#99D52A",viewBox:"0 0 40.2068 40",path:"M0.320252 0.0490425L40.0063 1.78814e-07L40.2068 19.8452C40.0506 30.7143 31.1178 39.9228 20.1387 40C9.23138 39.7912 0.188685 30.7349 0 19.8452L0.320252 0.0490425Z"},{id:"purple",color:"#8E4EC6",viewBox:"0 0 39.8998 40.0001",path:"M0.0661351 0.00254411C21.9866 -0.246577 39.9166 17.8322 39.8998 40L0.000243689 39.893L0.0661351 0.00254411Z"},{id:"teal",color:"#12A594",viewBox:"0 0 40.0781 40",path:"M20.0205 40C30.9836 39.8363 40.034 30.9306 40.0781 19.9392C40.0391 8.94509 31.0154 -0.0155101 20.0205 0.000777227C8.98086 -0.0965493 0.0284035 8.95959 0 19.9392C0.0335677 30.9159 9.01244 39.9174 20.0205 40Z"}];[...jy,...Bqe];function zqe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M15 10C13.3431 10 12 8.65685 12 7M9 14C10.6569 14 12 15.3431 12 17M12 20.2422C12.7151 20.7209 13.5749 21 14.5 21C16.5553 21 18.2888 19.6221 18.8271 17.7396C20.102 17.2168 21 15.9633 21 14.5C21 13.5207 20.5978 12.6353 19.9495 12C20.5978 11.3647 21 10.4793 21 9.5C21 7.69511 19.6338 6.20931 17.8792 6.0203C17.4422 4.28478 15.8711 3 14 3C13.2714 3 12.5883 3.19479 12 3.53513M12 20.2422C11.285 20.7209 10.4251 21 9.5 21C7.44468 21 5.71119 19.6221 5.17291 17.7396C3.89797 17.2168 3 15.9633 3 14.5C3 13.5207 3.40223 12.6353 4.05051 12C3.40223 11.3647 3 10.4793 3 9.5C3 7.69511 4.36618 6.20931 6.12085 6.0203C6.55779 4.28478 8.12886 3 10 3C10.7286 3 11.4117 3.19479 12 3.53513M12 20.2422L12 3.53513",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vqe(t){return c.jsxs(rt,{...t,children:[c.jsx("g",{clipPath:"url(#clip0_9885_24886)",children:c.jsx("path",{d:"M19.0037 9.98686H12.9944L15.466 2.32508C15.8017 1.28423 14.4862 0.525745 13.773 1.34898L4.24869 12.3429C3.68506 12.9935 4.14148 14.0131 4.99634 14.0131H11.0056L8.53401 21.6749C8.19825 22.7158 9.51377 23.4743 10.227 22.651L19.7513 11.6571C20.3149 11.0065 19.8585 9.98686 19.0037 9.98686Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_9885_24886",children:c.jsx("rect",{width:"24",height:"24",fill:"white"})})})]})}function Ghe({className:t}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","aria-label":"JavaScript",role:"img",viewBox:"0 0 21 20",fill:"none",className:t,children:c.jsx("path",{d:"M20.666 20H0.666016V0H20.666V20ZM9.6709 9.18164V15.5723C9.6709 16.512 9.28066 16.7539 8.66309 16.7539C8.01906 16.7537 7.75033 16.3105 7.45508 15.7871L5.9248 16.7129C6.36785 17.6527 7.24062 18.4316 8.74414 18.4316C10.4089 18.4316 11.5498 17.5452 11.5498 15.5986V9.18164H9.6709ZM15.8867 9.07422C14.2086 9.07426 13.1348 10.1489 13.1348 11.5586C13.1349 13.0886 14.034 13.8136 15.3896 14.3906L15.8604 14.5928C16.7192 14.9684 17.2295 15.1966 17.2295 15.8408C17.2295 16.3778 16.7328 16.7675 15.9541 16.7676C15.0279 16.7676 14.5044 16.2838 14.1016 15.626L12.5703 16.5117C13.1207 17.5992 14.2489 18.4316 15.9941 18.4316C17.7795 18.4316 19.1082 17.50
30859 19.1084 15.8145C19.1084 14.2438 18.209 13.5451 16.6113 12.8604L16.1416 12.6592C15.3362 12.3101 14.9873 12.0814 14.9873 11.5176C14.9875 11.0614 15.3364 10.7129 15.8867 10.7129C16.4236 10.7129 16.7725 10.9406 17.0947 11.5176L18.5586 10.5781C17.9411 9.4907 17.0816 9.07422 15.8867 9.07422Z",fill:"currentColor"})})}function Whe({className:t}){return c.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:c.jsxs("g",{children:[c.jsx("path",{d:"M9.92813 20C4.85063 20 5.1675 17.7981 5.1675 17.7981L5.17375 15.5169H10.0187V14.8325H3.24813C3.24813 14.8325 0 15.2013 0 10.0775C0 4.955 2.83563 5.13625 2.83563 5.13625H4.52813V7.51375C4.52813 7.51375 4.43687 10.3494 7.31875 10.3494H12.1237C12.1237 10.3494 14.8237 10.3056 14.8237 12.9587V17.3456C14.8237 17.3456 15.2338 20 9.92813 20ZM7.25625 18.4662C7.73813 18.4662 8.12812 18.0762 8.12812 17.5944C8.12812 17.1125 7.73813 16.7225 7.25625 16.7225C7.14171 16.7223 7.02826 16.7448 6.9224 16.7885C6.81655 16.8323 6.72037 16.8965 6.63937 16.9775C6.55838 17.0585 6.49416 17.1547 6.45041 17.2605C6.40665 17.3664 6.38421 17.4798 6.38438 17.5944C6.38438 18.0762 6.77438 18.4662 7.25625 18.4662Z",fill:"currentColor"}),c.jsx("path",{d:"M10.0676 0.102627C15.1451 0.102627 14.8282 2.3045 14.8282 2.3045L14.822 4.58575H9.97696V5.27013H16.747C16.747 5.27013 19.9957 4.90138 19.9957 10.0245C19.9957 15.1476 17.1601 14.9658 17.1601 14.9658H15.4676V12.5889C15.4676 12.5889 15.5588 9.75325 12.677 9.75325H7.87196C7.87196 9.75325 5.17196 9.797 5.17196 7.14388V2.757C5.17196 2.757 4.76196 0.102627 10.0676 0.102627ZM12.7395 1.63638C12.6249 1.63621 12.5115 1.65865 12.4056 1.70241C12.2998 1.74617 12.2036 1.81038 12.1226 1.89138C12.0416 1.97237 11.9774 2.06855 11.9336 2.17441C11.8899 2.28026 11.8674 2.39371 11.8676 2.50825C11.8676 2.9895 12.2576 3.3795 12.7395 3.3795C13.2213 3.3795 13.6113 2.99013 13.6113 2.50825C13.6113 2.02575 13.2213 1.63638 12.7395 1.63638Z",fill:"currentColor"})]})})}function qhe({className:t}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg","aria-label":"TypeScript",role:"img",viewBox:"0 0 512 512",fill:"currentColor",className:t,children:[c.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),c.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsxs("g",{id:"SVGRepo_iconCarrier",children:[c.jsx("rect",{width:"512",height:"512",rx:"15%",fill:"currentColor"}),c.jsx("path",{fill:"var(--sand-1)",d:"m233 284h64v-41H118v41h64v183h51zm84 173c8.1 4.2 18 7.3 29 9.4s23 3.1 35 3.1c12 0 23-1.1 34-3.4c11-2.3 20-6.1 28-11c8.1-5.3 15-12 19-21s7.1-19 7.1-32c0-9.1-1.4-17-4.1-24s-6.6-13-12-18c-5.1-5.3-11-10-18-14s-15-8.2-24-12c-6.6-2.7-12-5.3-18-7.9c-5.2-2.6-9.7-5.2-13-7.8c-3.7-2.7-6.5-5.5-8.5-8.4c-2-3-3-6.3-3-10c0-3.4.89-6.5 2.7-9.3s4.3-5.1 7.5-7.1c3.2-2 7.2-3.5 12-4.6c4.7-1.1 9.9-1.6 16-1.6c4.2 0 8.6.31 13 .94c4.6.63 9.3 1.6 14 2.9c4.7 1.3 9.3 2.9 14 4.9c4.4 2 8.5 4.3 12 6.9v-47c-7.6-2.9-16-5.1-25-6.5s-19-2.1-31-2.1c-12 0-23 1.3-34 3.8s-20 6.5-28 12c-8.1 5.4-14 12-19 21c-4.7 8.4-7 18-7 30c0 15 4.3 28 13 38c8.6 11 22 19 39 27c6.9 2.8 13 5.6 19 8.3s11 5.5 15 8.4c4.3 2.9 7.7 6.1 10 9.5c2.5 3.4 3.8 7.4 3.8 12c0 3.2-.78 6.2-2.3 9s-3.9 5.2-7.1 7.2s-7.1 3.6-12 4.8c-4.7 1.1-10 1.7-17 1.7c-11 0-22-1.9-32-5.7c-11-3.8-21-9.5-28.1-15.44z"})]})]})}var we=typeof window<"u"?window:void 0,sa=typeof globalThis<"u"?globalThis:we,Aa=sa==null?void 0:sa.navigator,Ve=sa==null?void 0:sa.document,Xs=sa==null?void 0:sa.location,f$=sa==null?void 0:sa.fetch,SM=sa!=null&&sa.XMLHttpRequest&&"withCredentials"in new sa.XMLHttpRequest?sa.XMLHttpRequest:void 0,LZ=sa==null?void 0:sa.AbortController,Hqe=sa==null?void 0:sa.CompressionStream,Wa=Aa==null?void 0:Aa.userAgent;function Khe(){return!(!we||we.navigator.onLine===!1)}var ny=typeof globalThis<"u"?globalThis:we;ny&&typeof self>"u"&&(ny.self=ny),ny&&typeof File>"u"&&(ny.File=function(){});var Ot=we??{},As={DEBUG:!1,LIB_VERSION:"0.6.0",LIB_NAME:"browser-common"};function jZ(t,e,n,s,r,i,a){try{var o=t[i](a),l=o.value}catch(u){return void n(u)}o.done?e(l):Promise.resolve(l).then(s,r)}function Ns(t){return function(){var e=this,n=arguments;return new Promise((function(s,r){var i=t.apply(e,n);function a(l){jZ(i,s,r,a,o,"next",l)}
308function o(l){jZ(i,s,r,a,o,"throw",l)}a(void 0)}))}}function $e(){return $e=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},$e.apply(null,arguments)}function Yhe(t,e){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(e.indexOf(s)!==-1)continue;n[s]=t[s]}return n}var PZ=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function MZ(t){return typeof t=="string"||t}function DZ(t){return typeof t=="string"?t:void 0}var sy,Gqe=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Ju=(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.AiCaptureQueue="ai_capture_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.PushRegistered="push_registered",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})({}),OZ=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),Wqe=["$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"],qqe=["token"],Zhe="NativeGzipValidationError",wM=t=>t.length>=2&&t[0]===31&&t[1]===139,$Z=(t,e)=>t===OZ.GZipJS||e===OZ.GZipJS||e==="gzip",FZ=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",tE=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Zhe,e},Kqe=(function(){var t=Ns((function*(e,n){18>e.size&&tE("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());wM(s)&&s[2]===8||tE("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(sy)return sy;sy=[];for(var d=0;256>d;d++){for(var f=d,p=0;8>p;p++)f=1&f?3988292384^f>>>1:f>>>1;sy[d]=f>>>0}return sy})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(n)&&tE("invalid-crc");var i=n.length>>>0;r.getUint32(4,!0)!==i&&tE("invalid-size")}));return function(e,n){return t.apply(this,arguments)}})();function _M(){return _M=Ns((function*(t,e,n){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),i=r.writable.getWriter(),a=i.write(s).then((()=>i.close())).catch((function(){var u=Ns((function*(d){try{yield i.abort(d)}catch{}throw d}));return function(d){return u.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Kqe(l,s),l}catch(u){if(n!=null&&n.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}})),_M.apply(this,arguments)}var Yqe=20,Xhe=1e3,Zqe=1e4,Xqe="[Circular]",EM="[Truncated]",rR="[Unserializable]",Qqe="[Function]";function tv(t){for(var e="",n=0;t.length>n;n++){var s=t.charCodeAt(n);if(55296>s||s>56319)e+=56320>s||s>57343?t[n]:"�";else{var r=t.charCodeAt(n+1);56320>r||r>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}var Jqe=["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","hub
308spot","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"],UZ=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return Jqe.concat(e).some((s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1}))};function en(t,e){return t.indexOf(e)!==-1}var iR=function(t){return t.trim()},CM=function(t){return t.replace(/^\$/,"")};function Qhe(t){var e,n=[];return(e=JSON.stringify(t,(function(s,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 Jhe=Object.prototype,epe=Jhe.hasOwnProperty,aR=Jhe.toString,Qt=Array.isArray||function(t){return aR.call(t)==="[object Array]"},Xi=t=>typeof t=="function",Ss=t=>t===Object(t)&&!Qt(t),Kl=t=>{if(Ss(t)){for(var e in t)if(epe.call(t,e))return!1;return!0}return!1},Ue=t=>t===void 0,jn=t=>aR.call(t)=="[object String]",gk=t=>jn(t)&&t.trim().length===0,zi=t=>t===null,an=t=>Ue(t)||zi(t),Lr=t=>aR.call(t)=="[object Number]"&&t==t,Gu=t=>Lr(t)&&t>0,_a=t=>aR.call(t)==="[object Boolean]",eKe=t=>t instanceof FormData,tKe=t=>en(Wqe,t),nKe=t=>en(qqe,t);function tpe(t){return t===null||typeof t!="object"}function vk(t,e){return{}.toString.call(t)==="[object "+e+"]"}function npe(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return spe(t,Error)}}function h$(t){return typeof Event<"u"&&spe(t,Event)}function spe(t,e){try{return t instanceof e}catch{return!1}}var sKe=[!0,"true",1,"1","yes"],P6=t=>en(sKe,t),rKe=[!1,"false",0,"0","no"];function Hc(t,e,n,s,r){return e>n&&(s.warn("min cannot be greater than max."),e=n),Lr(t)?t>n?(s.warn(" cannot be  greater than max: "+n+". Using max value instead."),n):e>t?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(s.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),Hc(r||n,e,n,s))}class iKe{constructor(e){this.k={},this.S=e.S,this.C=Hc(e.bucketSize,0,100,e.I),this.R=Hc(e.refillRate,0,this.C,e.I),this.A=Hc(e.refillInterval,0,864e5,e.I)}O(e,n){var s=Math.floor((n-e.lastAccess)/this.A);s>0&&(e.tokens=Math.min(e.tokens+s*this.R,this.C),e.lastAccess=e.lastAccess+s*this.A)}consumeRateLimit(e){var n,s=Date.now(),r=String(e),i=this.k[r];return i?this.O(i,s):this.k[r]=i={tokens:this.C,lastAccess:s},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.S)==null||n.call(this,e)),i.tokens===0)}stop(){this.k={}}}var No="Mobile",xk="iOS",pd="Android",Yv="Tablet",rpe=pd+" "+Yv,ipe="iPad",ape="Apple",ope=ape+" Watch",fb="Safari",Zv="BlackBerry",lpe="Samsung",cpe=lpe+"Browser",upe=lpe+" Internet",Em="Chrome",aKe=Em+" OS",dpe=Em+" "+xk,p$="Internet Explorer",fpe=p$+" "+No,m$="Opera",oKe=m$+" Mini",g$="Edge",hpe="Microsoft "+g$,nv="Firefox",ppe=nv+" "+xk,c2="Nintendo",u2="PlayStation",sv="Xbox",mpe=pd+" "+No,gpe=No+" "+fb,My="Windows",TM=My+" Phone",BZ="Nokia",kM="Ouya",vpe="Generic",lKe=vpe+" "+No.toLowerCase(),xpe=vpe+" "+Yv.toLowerCase(),RM="Konqueror",ype="Oculus Browser",yk="Vivaldi",bpe="Yandex",bk="Whale",AM="DuckDuckGo",Spe="Pale Moon",Sk="Waterfox",hb="Brave",wpe="Google Search App",ar="(\\d+(\\.\\d+)?)",M6=new RegExp("Version/"+ar),cKe=new RegExp(sv,"i"),uKe=new RegExp(u2+" \\w+","i"),dKe=new RegExp(c2+" \\w+","i"),v$=new RegExp(Zv+"|PlayBook|BB10","i"),fKe={"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"},_pe=function(t,e,n,s){e=e||"";var r=(function(i){return i!=null&&i.brave?hb:null})(n);return r||(s!=null&&s.detectGoogleSearchApp&&en(t,"GSA/")?wpe:en(t," OPR/")&&en(t,"Mini")?oKe:en(t," OPR/")?m$:v$.test(t)?Zv:en(t,"IE"+No)||en(t,"WPDesktop")?fpe:en(t,"OculusBrowser")?ype:en(t,cpe)?upe:en(t,g$)||en(t,"Edg/")?hpe:en(t,yk+"/")?yk:en(t,"YaBrowser/")?bpe:en(t,bk+"/")?bk:en(t,AM+"/")||en(t,"Ddg/")?AM:en(t,"FBIOS")?"Facebook "+No:en(t,"UCWEB")||en(t,"UCBrowser")?"UC Browser":en(t,"CriOS")?dpe:en(t,"CrMo")||en(t,Em)?Em:en(t,pd)&&en(t,fb)?mpe:en(t,"FxiOS")?ppe:en(t.toLowerCase(),RM.toLowerCase())?RM:en(t,hb+"/")?hb:((i,a)=>a&&en(a,ape)||(function(o){return en(o,fb)&&!en(o,Em)&&!en(o,pd)})(i))(t,e)?en(t,No)?gpe:fb:en(t,"PaleMoon/")?Spe:en(t,Sk+"/")?Sk:en(t,nv)?nv:en(t,"MSIE")||en(t,"Trident/")?p$:en(t,"Gecko")?nv:"")},hKe={[fpe]:[new RegExp("rv:"+ar)],[hpe]:[new RegExp(g$+"?\\/"+ar)],[Em]:[new RegExp("("+Em+"|CrMo)\\/"+ar)],[dpe]:[new RegExp("CriOS\\/"+ar)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ar)],[fb]:[M6],[gpe]:[M6],[m$]:[new RegExp("(Opera|OPR)\\/"+ar)],[nv]:[new RegExp(nv+"\\/"+ar)],[ppe]:[new RegExp("FxiOS\\/"+ar)],[RM]:[new RegExp("Konqueror[:/]?"+ar,"i")],[Zv]:[new RegExp(Zv+" "+ar),M6],[mpe]:[new RegExp("android\\s"+ar,"i")],[upe]:[new RegExp(cpe+"\\/"+ar)],[ype]:[new RegExp("OculusBrowser\\/"+ar)],[yk]:[new RegExp(yk+"\\/"+ar)],[bpe]:[new RegExp("YaBrowser\\/"+ar)],[bk]:[new RegExp(bk+"\\/"+ar)],[hb]:[new RegExp(hb+"\\/"+ar)],[AM]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ar)],[Spe]:[new RegExp("PaleMoon\\/"+ar)],[Sk]:[new RegExp(Sk+"\\/"+ar)],[wpe]:[new RegExp("GSA\\/"+ar)],[p$]:[new RegExp("(rv:|MSIE )"+ar)],Mozilla:[new RegExp("rv:"+ar)]},pKe=function(t,e,n,s){var r=_pe(t,e,n,s),i=hKe[r];if(Ue(i))return null;for(var a=0;i.length>a;a++){var o=t.match(i[a]);if(o)return parseFloat(o[o.length-2])}return null},zZ=[[new RegExp(sv+"; "+sv+" (.*?)[);]","i"),t=>[sv,t&&t[1]||""]],[new RegExp(c2,"i"),[c2,""]],[new RegExp(u2,"i"),[u2,""]],[v$,[Zv,""]],[new RegExp(My,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[TM,""];if(new RegExp(No).test(e)&&!/IEMobile\b/.test(e))return[My+" "+No,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var s=fKe[n[1]]||"";return/arm/i.test(e)&&(s="RT"),[My,s]}return[My,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xk,[t[3],t[4],t[5]||"0"].join(".")]:[xk,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Ue(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+pd+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+pd+")","i"),t=>t&&t[2]?[pd,[t[2],t[3],t[4]||"0"].join(".")]:[pd,""]],[/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/,[aKe,""]],[/Linux|debian/i,["Linux",""]]],VZ=function(t){return dKe.test(t)?c2:uKe.test(t)?u2:cKe.test(t)?sv:new RegExp(kM,"i").test(t)?kM:new RegExp("("+TM+"|WPDesktop)","i").test(t)?TM:/iPad/.test(t)?ipe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ope:v$.test(t)?Zv:/(kobo)\s(ereader|touch)/i.test(t)?"K
308obo":new RegExp(BZ,"i").test(t)?BZ:/(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(No).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)?pd:rpe:new RegExp("(pda|"+No+")","i").test(t)?lKe:new RegExp(Yv,"i").test(t)&&!new RegExp(Yv+" pc","i").test(t)?xpe:""},mKe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function HZ(t,e){return typeof(n=t)=="string"&&mKe.test(n)?t:e();var n}function jh(t){return t&&t.split("#")[0]}function x$(t,e){var n=setTimeout(t,e);return n!=null&&n.unref&&(n==null||n.unref()),n}function GZ(t,e,n){return Epe.apply(this,arguments)}function Epe(){return(Epe=Ns((function*(t,e,n){var s;try{return yield Promise.race([t,new Promise(((r,i)=>{s=x$((()=>{try{n==null||n(),r()}catch(a){i(a)}}),e)}))])}finally{clearTimeout(s)}}))).apply(this,arguments)}var Cpe={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}},gKe=Cpe.info,WZ=9223372036854776e3,vKe={}.propertyIsEnumerable;function wk(t,e){try{return Tpe(t,e,{ancestors:new WeakSet,remainingNodes:Zqe},0)}catch{return[]}}function y$(t,e,n,s){if(0>=n.remainingNodes)return{stringValue:EM};if(n.remainingNodes--,_a(t))return{boolValue:t};if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var r=BigInt(t).toString();return t>=WZ||-WZ>t?(e==null||e.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:tv(t)};if(typeof t=="function")return{stringValue:Qqe};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:Xqe};if(s>=Yqe)return{stringValue:EM};if(t instanceof Date){var i=t.getTime(),a=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof a=="string"?tv(a):String(a)}}n.ancestors.add(t);try{try{var o=t.toJSON;if(typeof o=="function")return y$(o.call(t),e,n,s+1)}catch{}return Qt(t)?{arrayValue:{values:xKe(t,e,n,s+1)}}:{kvlistValue:{values:Tpe(t,e,n,s+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:tv(String(t))}}function xKe(t,e,n,s){for(var r=[],i=Math.min(t.length,Xhe),a=0;i>a&&n.remainingNodes>0;a++)try{var o=a in t?t[a]:void 0;if(an(o))continue;r.push(y$(o,e,n,s))}catch{r.push({stringValue:rR})}return t.length>a&&r.push({stringValue:EM}),r}function Tpe(t,e,n,s){var r=[];for(var i in t)if(vKe.call(t,i)){if(r.length>=Xhe||0>=n.remainingNodes){e==null||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=t[i];if(zi(a)||Ue(a))continue;r.push({key:tv(i),value:y$(a,e,n,s)})}catch{r.push({key:tv(i),value:{stringValue:rR}})}}return r}function yKe(t){try{return tv(String(t))}catch{return rR}}function bKe(t,e,n){var s=Cpe[t.level||"info"]||gKe,r=s.text,i=s.number,a=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),an(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),an(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var l=$e({},o),u=t.attributes;if(u){var d=[];try{d=Object.keys(u)}catch{d=[]}for(var f of d){var p=void 0;try{p=u[f]}catch{p=rR}Object.defineProperty(l,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var m={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:i,severityText:r,body:{stringValue:yKe(t.body)},attributes:wk(l,n)};return t.trace_id&&(m.traceId=t.trace_id),t.span_id&&(m.spanId=t.span_id),Ue(t.trace_flags)||(m.flags=t.trace_flags),m}function kpe(t,e,n){return $e({},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 Rpe(t,e,n,s){return{resourceLogs:[{resource:{attributes:wk(e)},scopeLogs:[{scope:{name:n,version:s},logRecords:t}]}]}}let SKe=class{constructor(t,e,n,s,r,i,a){var o;i===void 0&&(i=()=>Promise.resolve()),this._instance=t,this.ji=e,this.I=n,this.nn=s,this.sn=r,this.an=i,this.ln=a,this.un=null,this.hn=0,this.dn=0,this.vn=0,this.cn=0,this.fn=!1,this.pn=e.maxBufferSize,this.gn=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.mn=e.flushIntervalMs,this.yn=e.maxBatchRecordsPerPost,this.bn=e.rateCapWindowMs,this._n=e.maxLogsPerInterval}reset(){this.wn(),this.un=null,this.vn=0,this.cn=0,this.fn=!1,this.hn=0,this.dn=0,this.yn=this.ji.maxBatchRecordsPerPost}onReconnect(){this.dn=0,this.kn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.Sn(t);if(e!==null)if(e.body){if(this.xn()){var n={record:bKe(e,this.nn(),this.I)};this.sn((()=>this.Cn(n)))}}else this.I.info("Log was rejected in beforeSend function")}}Sn(t){var e=this.ji.beforeSend;if(!e)return t;var n=Qt(e)?e:[e],s=t;for(var r of n)try{var i=r(s);if(!i)return this.I.info("Log was rejected in beforeSend function"),null;s=i}catch(a){return this.I.error("Error in beforeSend function for log:",a),null}return s}xn(){if(this._n===void 0)return!0;var t=Date.now(),e=t-this.vn;return this.bn>e&&e>=0||(this.vn=t,this.cn=0,this.fn=!1),this._n>this.cn?(this.cn++,!0):(this.fn||(this.I.warn("captureLog dropping logs: exceeded "+this._n+" logs per "+this.bn+"ms"),this.fn=!0),!1)}flush(){var t=this;return Ns((function*(){if(!t._instance.isDisabled)return t.un||(t.un=t.Tn().finally((()=>{t.un=null}))),t.un}))()}Tn(){var t=this;return Ns((function*(){var e;t.wn();var n=(e=t._instance.getPersistedProperty(Ju.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var s=n.length,r=0;n.length>0&&s>r;){var i,a;t.hn=0;var o=Math.min(n.length,t.yn),l=n.slice(0,o),u=Rpe(l.map((f=>
308f.record)),t.Mn(),(i=t.ln)!==null&&i!==void 0?i:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.En(u);if(d.kind==="too-large"&&l.length>1)t.yn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.yn);else if(d.kind==="retry-later"||(d.kind==="too-large"?t.I.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."):d.kind==="ok"&&t.ji.maxBatchRecordsPerPost>t.yn&&(t.yn=Math.min(t.ji.maxBatchRecordsPerPost,t.yn+1)),yield t.In(l.length),n=(a=t._instance.getPersistedProperty(Ju.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,d.kind==="fatal"))throw d.error}}))()}In(t){var e=this;return Ns((function*(){var n,s=Math.max(0,t-e.hn),r=(n=e._instance.getPersistedProperty(Ju.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(Ju.LogsQueue,r.slice(s)),yield e.an()}))()}Mn(){return kpe(this.ji,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Cn(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(Ju.LogsQueue))!==null&&e!==void 0?e:[];this.gn>n.length||(n.shift(),this.hn++,this.I.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(Ju.LogsQueue,n),this.pn>n.length?this.Rn():this.kn()}}Rn(t){t===void 0&&(t=this.mn),this.Pn||(this.Pn=x$((()=>{this.Pn=void 0,this.kn()}),t))}An(){var t=Math.min(Math.max(0,this.dn-1),6);return this.mn*Math.pow(2,t)}Fn(){var t=this._instance.getPersistedProperty(Ju.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return Ns((function*(){e.wn();var n=e.flush().catch((()=>{}));t!==void 0?yield GZ(n,t):yield n}))()}flushWithTimeout(t){var e=this;return Ns((function*(){var n=e.flush();yield GZ(n,t,(()=>{n.catch((()=>{}))}))}))()}kn(){this.flush().then((()=>{this.dn=0}),(t=>{this.dn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Fn()&&this.Rn(this.An())}))}wn(){this.Pn&&(clearTimeout(this.Pn),this.Pn=void 0)}};var D6=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function qZ(t){return String(t)+"000000"}function KZ(t,e,n,s){var r="";return s&&(r=Object.keys(s).sort().map((i=>JSON.stringify(i)+":"+JSON.stringify(s[i]))).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+r}let wKe=class{constructor(t,e,n){this._instance=t,this.ji=e,this.I=n,this.Ln=new Map,this.un=null,this.On=!1,this.Dn=new Map,this.$n=new Set,this.Nn=0}count(t,e,n){e===void 0&&(e=1),this.qn({name:t,type:"count",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(t,e,n){this.qn({name:t,type:"gauge",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(t,e,n){this.qn({name:t,type:"histogram",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var t=this,e=this.un,n=(function(){var r=Ns((function*(){e&&(yield e.catch((()=>{}))),yield t.jn()}));return function(){return r.apply(this,arguments)}})(),s=n().finally((()=>{this.un===s&&(this.un=null)}));return this.un=s,s}drainWindow(){if(this.Ln.size===0)return null;var t=this.Ln;return this.Ln=new Map,this.On=!1,this.Dn=new Map,this.$n=new Set,this.Bn(t)}reset(){this.Nn++,this.wn(),this.Ln=new Map,this.un=null,this.On=!1,this.Dn=new Map,this.$n=new Set}qn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Sn(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.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n,s;try{n=e.attributes?$e({},e.attributes):void 0,s=KZ(e.type,e.name,e.unit,n)}catch(a){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.Ln.get(s);if(!r){if(!this.Hn())return;r={name:e.name,type:e.type,unit:e.unit,attributes:n,windowStartMs:Date.now()},this.Ln.set(s,r)}var i=this.Dn.get(e.name);i===void 0?this.Dn.set(e.name,e.type):i===e.type||this.$n.has(e.name)||(this.$n.add(e.name),this.I.warn("Metric name '"+e.n
308ame+"' is already used as a "+i+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Un(r,e.value),this.Rn()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Hn(){return this.ji.maxSeriesPerFlush>this.Ln.size||(this.On||(this.On=!0,this.I.warn("Metric series cap reached ("+this.ji.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Un(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(D6.length+1).fill(0)});var s=t.hist;s.count+=1,s.sum+=e,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e),s.bucketCounts[(function(r,i){for(var a=0;i.length>a;a++)if(i[a]>=r)return a;return i.length})(e,D6)]+=1}}Sn(t){var e=this.ji.beforeSend;if(!e)return t;var n=Qt(e)?e:[e],s=t;for(var r of n)try{var i=r(s);if(!i)return this.I.info("Metric was rejected in beforeSend function"),null;s=i}catch(a){return this.I.error("Error in beforeSend function for metric:",a),null}return s}Rn(){this.Pn||(this.Pn=x$((()=>{this.Pn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.ji.flushIntervalMs))}wn(){this.Pn&&(clearTimeout(this.Pn),this.Pn=void 0)}jn(){var t=this;return Ns((function*(){if(t.Ln.size!==0){var e=t.Ln;t.Ln=new Map,t.On=!1,t.Dn=new Map,t.$n=new Set;var n=t.Nn,s=yield t._instance.zn(t.Bn(e));if(n===t.Nn)switch(s.kind){case"ok":return;case"retry-later":return t.Wn(e),void t.Rn();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",s.error)}}}))()}Bn(t){return e=this.Vn(t),n=(function(i,a,o){return $e({},i.resourceAttributes,{"service.name":i.serviceName||"unknown_service"},i.environment&&{"deployment.environment":i.environment},i.serviceVersion&&{"service.version":i.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o})})(this.ji,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:wk(n)},scopeMetrics:[{scope:{name:s,version:r},metrics:e}]}]};var e,n,s,r}Vn(t){var e=qZ(Date.now()),n=new Map;for(var s of t.values()){var r,i=KZ(s.type,s.name,s.unit,void 0),a=n.get(i);a||(a=$e({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},n.set(i,a));var o=wk((r=s.attributes)!==null&&r!==void 0?r:{},this.I),l=qZ(s.windowStartMs);if(s.type==="count"){var u,d={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=s.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(d)}else if(s.type==="gauge"){var f,p={attributes:o,timeUnixNano:e,asDouble:(f=s.last)!==null&&f!==void 0?f:0};a.gauge.dataPoints.push(p)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:D6})}return Array.from(n.values())}Wn(t){var e,n;for(var s of t){var r=s[0],i=s[1],a=this.Ln.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,i.windowStartMs),a.type){case"count":a.total=((e=a.total)!==null&&e!==void 0?e:0)+((n=i.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(i.hist)if(a.hist){a.hist.count+=i.hist.count,a.hist.sum+=i.hist.sum,a.hist.min=Math.min(a.hist.min,i.hist.min),a.hist.max=Math.max(a.hist.max,i.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=i.hist.bucketCounts[o]}else a.hist=i.hist}else this.Hn()&&this.Ln.set(r,i)}}};var nE,YZ,O6;function _Ke(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return O6&&n.length===YZ||(YZ=n.length,O6=n.reduce(((s,r)=>{nE||(nE={});var i=nE[r];if(i)s[i[0]]=i[1];else for(var a=t(r),o=a.length-1;o>=0;o--){var l=a[o],u=l==null?void 0:l.filename,d=e[r];if(u&&d){s[u]=d,nE[r]=[u,d];break}}return s}),{})),O6}}class EKe{constructor(e,n,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=n,this.modifiers=s}buildFromUnknown(e,n){n===void 0&&(n={});var s=n&&n.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,n,0).apply(e),i=this.buildParsingContext(n),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var n=this;return Ns((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&Qt(s.stacktrace.frames)&&(s.stacktrace.frames=yield n.applyModifiers(s.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 s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),$e({},e,{cause:s,stack:r})}applyChunkIds(e,n){return e.map((s=>
308(s.filename&&n&&(s.chunk_id=n[s.filename]),s)))}applyCoercers(e,n){for(var s of this.coercers)if(s.match(e))return s.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return Ns((function*(){var s=e;for(var r of n.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,n){var s,r,i,a={type:e.type,value:e.value,mechanism:{type:(s=n.type)!==null&&s!==void 0?s:"generic",handled:(r=n.handled)===null||r===void 0||r,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,$e({},n,{handled:!0}))),o}buildParsingContext(e){var n;return{chunkIdMap:_Ke(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,s){s===void 0&&(s=0);var r=(i,a)=>{if(4>=a){var o=this.buildCoercingContext(e,n,a);return this.applyCoercers(i,o)}};return $e({},n,{syntheticException:s==0?n.syntheticException:void 0,mechanism:e,apply:i=>r(i,s),next:i=>r(i,s+1)})}}var Xv="?";function NM(t,e,n,s,r){var i={platform:t,filename:e,function:n==="<anonymous>"?Xv:n,in_app:!(e!=null&&e.startsWith("webkit-masked-url://"))&&e!=="<anonymous>"};return Ue(s)||(i.lineno=s),Ue(r)||(i.colno=r),i}var Ape=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,s=t.indexOf("safari-web-extension")!==-1;return n||s?[t.indexOf("@")!==-1?t.split("@")[0]:Xv,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},CKe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,TKe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kKe=/\((\S*)(?::(\d+))(?::(\d+))\)/,RKe=(t,e)=>{var n=CKe.exec(t);if(n)return NM(e,n[1],Xv,+n[2],+n[3]);var s=TKe.exec(t);if(s){if(s[2]&&s[2].indexOf("eval")===0){var r=kKe.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var i=Ape(s[1]||Xv,s[2]);return NM(e,i[1],i[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},AKe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,NKe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,IKe=(t,e)=>{var n=AKe.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var s=NKe.exec(n[3]);s&&(n[1]=n[1]||"eval",n[3]=s[1],n[4]=s[2],n[5]="")}var r=n[3],i=n[1]||Xv,a=Ape(i,r);return NM(e,r=a[1],i=a[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ZZ=/\(error: (.*)\)/;class LKe{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var s=jn(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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 vk(e,"DOMException")}isDOMError(e){return vk(e,"DOMError")}}class jKe{match(e){return npe(e)}coerce(e,n){var s,r=this.getStack(e),i=r===void 0;return{type:this.getType(e),value:this.getMessage(e,n),stack:r??((s=n.syntheticException)==null?void 0:s.stack),cause:e.cause?n.next(e.cause):void 0,synthetic:i}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class PKe{constructor(){}match(e){return!!vk(e,"ErrorEvent")&&(e.error!=null||this.pi(e))}coerce(e,n){var s;if(e.error!=null)return n.apply(e.error);var r=n.apply(e.message);return $e({},r,{stack:(s=this.mi(e))!==null&&s!==void 0?s:r.stack,synthetic:!0})}pi(e){return jn(e.message)&&e.message.length>0}mi(e){var n,s,r=e,i=(n=r.lineno)!==null&&n!==void 0?n:0,a=(s=r.colno)!==null&&s!==void 0?s:0;if(jn(r.filename)&&r.filename.length!==0&&i!==0)return`Error
309    at `+r.filename+":"+i+":"+a}}var MKe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class DKe{match(e){return typeof e=="string"}coerce(e,n){var s,r=this.getInfos(e),i=r[0],a=r[1];return{type:i??"Error",value:a??e,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var n="Error",s=e,r=e.match(MKe);return r&&(n=r[1],s=r[2]),[n,s]}}var OKe=["fatal","error","warning","log","info","debug"];function Npe(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var s=n.length;s>0;s--){var r=n.slice(0,s).join(", ");
309if(e>=r.length)return s===n.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class $Ke{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var s,r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(s=this.getStack(e))!==null&&s!==void 0?s:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(h$(e))return e.constructor.name;var n="name"in e?e.name:void 0;return jn(n)&&!gk(n)?n:"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 s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+Npe(e)}isSeverityLevel(e){return jn(e)&&!gk(e)&&OKe.indexOf(e)>=0}getStack(e){try{return jn(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:jn(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var s=e[n];if(npe(s))return s}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class FKe{match(e){return h$(e)}coerce(e,n){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Npe(e),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class UKe{match(e){return tpe(e)}coerce(e,n){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class BKe{match(e){return vk(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!h$(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var s,r=this.getUnhandledRejectionReason(e);return tpe(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=n.syntheticException)==null?void 0:s.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 _k="$message",Ek="$timestamp",zKe=new Set([_k,Ek]),$6={enabled:!0,max_bytes:32768};function Ck(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:$6.enabled,max_bytes:HKe(t.max_bytes,$6.max_bytes)}:$e({},$6)}class VKe{constructor(e){this.Gn=[],this.Zn=0,this.ji=Ck(e)}setConfig(e){this.ji=Ck(e),this.Qn()}add(e){var n=(function(r){var i;try{i=Qhe(r)}catch{return}try{var a=JSON.parse(i);if(!Ss(a))return;var o=a,l=o[_k],u=o[Ek];return!jn(l)||l.trim().length===0||!jn(u)&&!Lr(u)?void 0:{step:o,json:i}}catch{return}})(e);if(n){var s=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var i=encodeURIComponent(r),a=0,o=0;i.length>o;o++)i[o]==="%"?(a+=1,o+=2):a+=1;return a})(n.json);s>this.ji.max_bytes||(this.Gn.push({step:n.step,bytes:s}),this.Zn+=s,this.Qn())}}getAttachable(){return this.Gn.map((e=>e.step))}clear(){this.Gn=[],this.Zn=0}size(){return this.Gn.length}Qn(){for(;this.Zn>this.ji.max_bytes&&this.Gn.length>0;){var e=this.Gn.shift();e&&(this.Zn-=e.bytes)}}}function HKe(t,e){if(!Lr(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var Ipe=function(t,e){var n=(e===void 0?{}:e).debugEnabled,s={F(r){if(we&&(As.DEBUG||we.POSTHOG_DEBUG||n)&&!Ue(we.console)&&we.console){for(var i=("__rrweb_original__"in we.console[r])?we.console[r].__rrweb_original__:we.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];i(t,...o)}},debug(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];s.F("debug",...i)},info(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];s.F("log",...i)},warn(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];s.F("warn",...i)},error(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];s.F("error",...i)},critical(){for(var r=arguments.length,i=new Array(r),a=0;r>a;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,i)=>Ipe(t+" "+r,i)};return s},Ze=Ipe("[PostHog.js]"),Hs=Ze.createLogger,GKe=Hs("[ExternalScriptsLoader]"),Tk=t=>{var e=Ve==null?void 0:Ve.querySelectorAll("script");
309if(e){for(var n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},Lp=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return GKe.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var s=Tk(e);if(s){if(s.__posthog_loading_callback_fired)return n();var r=s.__posthog_loading_error;return r?n(r):(s.addEventListener("load",(a=>{s.__posthog_loading_callback_fired=!0,n(void 0,a)})),void s.addEventListener("error",(a=>{s.__posthog_loading_error=a,n(a)})))}var i=()=>{if(!Ve)return n("document not found");if(Tk(e))return Lp(t,e,n);var a=Ve.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=e,a.onload=u=>{a.__posthog_loading_callback_fired=!0,n(void 0,u)},a.onerror=u=>{a.__posthog_loading_error=u,n(u)},t.config.prepare_external_dependency_script&&(a=t.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")Ve.head.appendChild(a);else{var o,l=Ve.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)==null||o.insertBefore(a,l[0]):Ve.body.appendChild(a)}};Ve!=null&&Ve.body?i():Ve==null||Ve.addEventListener("DOMContentLoaded",i)},F6={},XZ=(t,e)=>{var n="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;n=n+"&t="+Math.floor(Date.now()/s)*s}return t.requestRouter.endpointFor("assets",n)};Ot.__PosthogExtensions__=Ot.__PosthogExtensions__||{},Ot.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var s=t.config.strict_script_versioning;if(s){var r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),i=F6[r];if(s==="fallback"&&i){if(Tk(i))return void Lp(t,i,n);delete F6[r]}Lp(t,r,s==="fallback"?(o,l)=>{if(o)if(typeof o=="string")n(o);else{var u,d=XZ(t,e);F6[r]=d;var f=Tk(r);f==null||(u=f.parentNode)==null||u.removeChild(f),Lp(t,d,n)}else n(void 0,l)}:n)}else Lp(t,XZ(t,e),n)}else{var a=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Lp(t,a,n)}},Ot.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var s=t.requestRouter.endpointFor("api",e);Lp(t,s,n)};
309As.DEBUG=!1,As.LIB_VERSION="1.419.4",As.LIB_NAME="web";var Lpe="$people_distinct_id",pa="distinct_id",d2="$device_id",U6="$device_model",L0="__alias",Dy="__timers",IM="$autocapture_disabled_server_side",LM="$heatmaps_enabled_server_side",jM="$exception_capture_enabled_server_side",PM="$error_tracking_suppression_rules",MM="$error_tracking_capture_extension_exceptions",DM="$web_vitals_enabled_server_side",b$="$dead_clicks_enabled_server_side",S$="$product_tours_enabled_server_side",OM="$web_vitals_allowed_metrics",Yp="$session_recording_remote_config",jpe="$replay_sample_rate",Ppe="$replay_override_sampling",Mpe="$replay_override_linked_flag",Dpe="$replay_override_url_trigger",Ope="$replay_override_event_trigger",j0="$sesid",w$="$session_is_sampled",td="$enabled_feature_flags",Zp="$active_feature_flags",YC="$early_access_features",f2="$feature_flag_details",Xp="$feature_flag_payloads",rv="$feature_flag_request_id",kk="$minimal_flag_called_events",Ec="$override_feature_flags",jp="$override_feature_flag_payloads",Fl="$stored_person_properties",Dc="$stored_group_properties",$pe="$groups",$M="$surveys",Rk="$surveys_loaded_at",FM="$surveys_activated",ZC="$surveys_activated_session",XC="$surveys_activated_timestamps",Oy="ph_product_tours",od="$flag_call_reported",$y="$flag_call_reported_session_id",iv="$feature_flag_errors",Cm="$feature_flag_evaluated_at",xn="$user_state",UM="$client_session_props",BM="$capture_rate_limit",zM="$initial_campaign_params",VM="$initial_referrer_info",Ak="$initial_person_info",Nk="$epp",Hg="$posthog_cookieless",Fpe="$cookieless_mode",Upe="$sdk_debug_extensions_init_method",Bpe="$sdk_debug_extensions_init_time_ms",HM="$sdk_debug_recording_script_not_loaded",_$="PostHog loadExternalDependency extension not found.",Pp="on_reject",ld="always",Er="anonymous",$i="identified",GM="identified_only",Qv="visibilitychange",Ik="beforeunload",h0="$pageview",B6="$pageleave",z6="$identify",QZ="$groupidentify";function sE(t,e){Qt(t)&&t.forEach(e)}function ts(t,e){if(!an(t))if(Qt(t))t.forEach(e);else if(eKe(t))t.forEach(((s,r)=>e(s,r)));else for(var n in t)epe.call(t,n)&&e(t[n],n)}var ws=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;e>s;s++)n[s-1]=arguments[s];for(var r of n)for(var i in r)r[i]!==void 0&&(t[i]=r[i]);return t};function QC(t){for(var e=Object.keys(t),n=e.length,s=new Array(n);n--;)s[n]=[e[n],t[e[n]]];return s}var JZ=function(t){try{return t()}catch{return}},WKe=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),s=0;e>s;s++)n[s]=arguments[s];return t.apply(this,n)}catch(r){Ze.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ze.critical(r)}}},E$=function(t){var e={};return ts(t,(function(n,s){(jn(n)&&n.length>0||Lr(n))&&(e[s]=n)})),e},qKe=["herokuapp.com","vercel.app","netlify.app"];function KKe(t){var e=t==null?void 0:t.hostname;if(!jn(e))return!1;var n=e.split(".").slice(-2).join(".");for(var s of qKe)if(n===s)return!1;return!0}function Ds(t,e,n,s){var r=s??{},i=r.capture,a=r.passive;t==null||t.addEventListener(e,n,{capture:i!==void 0&&i,passive:a===void 0||a})}function WM(t){return t.name==="ph_toolbar_internal"}var zpe=t=>{if(Ve){try{for(var e=t+"=",n=Ve.cookie.split(";").filter((i=>i.length)),s=0;n.length>s;s++){for(var r=n[s];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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Lr(t)&&isFinite(t)&&Math.floor(t)===t});class Lk{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,s,r){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>n||0>s||0>r||e>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/256,i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>
309>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new Lk(i)}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 Lk(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var s=this.bytes[n]-e.bytes[n];if(s!==0)return Math.sign(s)}return 0}}class YKe{generate(){var e=this.generateOrAbort();if(!Ue(e))return e;this.Rr=0;var n=this.generateOrAbort();if(Ue(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var e=Date.now();if(e>this.Rr)this.Rr=e,this.Ar();else{if(this.Rr>=e+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return Lk.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new ZKe}}var eX,Vpe=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};we&&!Ue(we.crypto)&&crypto.getRandomValues&&(Vpe=t=>crypto.getRandomValues(t));class ZKe{nextUint32(){return this.ft.length>this.Fr||(Vpe(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var Nc=()=>XKe().toString(),XKe=()=>(eX||(eX=new YKe)).generate(),ry="",QKe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ur={Nr:()=>!!Ve,jr(t){Ze.error("cookieStore error: "+t)},Pr:zpe,Br(t){var e;try{e=JSON.parse(Ur.Pr(t))||{}}catch{}return e},Dr(t,e,n,s,r){if(!Ve)return!1;try{var i="",a="",o=(function(d,f){if(f){var p=(function(v,x){if(x===void 0&&(x=Ve),ry)return ry;if(!x||["localhost","127.0.0.1"].includes(v))return"";for(var y=v.split("."),S=Math.min(y.length,8),_="dmn_chk_"+Nc();!ry&&S--;){var E=y.slice(S).join("."),T=_+"=1;domain=."+E+";path=/";x.cookie=T+";max-age=3",x.cookie.includes(_)&&(x.cookie=T+";max-age=0",ry=E)}return ry})(d);if(!p){var m=(v=>{var x=v.match(QKe);return x?x[0]:""})(d);m!==p&&Ze.info("Warning: cookie subdomain discovery mismatch",m,p),p=m}return p?"; domain=."+p:""}return""})(Ve.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&Ze.warn("cookieStore warning: large cookie, len="+u.length),Ve.cookie=u,!0}catch{return!1}},qr(t,e){if(Ve!=null&&Ve.cookie)try{Ur.Dr(t,"",-1,e)}catch{return}}},V6=null,ds={Nr(){if(!zi(V6))return V6;var t=!0;if(Ue(we))t=!1;else try{var e="__mplssupport__";ds.Dr(e,"xyz"),ds.Pr(e)!=='"xyz"'&&(t=!1),ds.qr(e)}catch{t=!1}return t||Ze.error("localStorage unsupported; falling back to cookie store"),V6=t,t},jr(t){Ze.error("localStorage error: "+t)},Pr(t){try{return we==null?void 0:we.localStorage.getItem(t)}catch(e){ds.jr(e)}return null},Br(t){try{return JSON.parse(ds.Pr(t))||{}}catch{}return null},Dr(t,e){try{return we==null||we.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){ds.jr(n)}return!1},qr(t){try{we==null||we.localStorage.removeItem(t)}catch(e){ds.jr(e)}}},H6=[Fl,Zp,td,f2,Xp,rv,Cm,iv,od],Mp=[d2,pa,j0,w$,Nk,Ak,xn],jk=t=>t+"_cpm",JKe=["__proto__","constructor","prototype"],G6=t=>{if(!Ss(t))return{};var e={};return Object.keys(t).forEach((n=>{JKe.indexOf(n)===-1&&(e[n]=t[n])})),e},W6=function(t,e){e===void 0&&(e=[]);var n={};return[...Mp,...e].forEach((s=>{var r=t[s];Ue(r)||zi(r)||r===""||(n[s]=r)})),n},Hpe=t=>{for(var e=5381,n=2166136261,s=0;t.length>s;s++){var r=t.charCodeAt(s);e=33*e^r,n=Math.imul(n^r,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},tX=(t,e)=>({p:e,f:Hpe(JSON.stringify(t))}),nX=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var n=Ur.Br(jk(t)),s=(n==null?void 0:n.f)===Hpe(e)&&Qt(n.p);return{properties:s?n.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},q6=(t,e)=>e+"|"+(Ur.Pr(jk(t))||""),rE={},eYe={Nr:()=>!0,jr(t){Ze.error("memoryStorage error: "+t)},Pr:t=>rE[t]||null,Br:t=>rE[t]||null,Dr:(t,e)=>(rE[t]=e,!0),qr(t){delete rE[t]}}
309,xp=null,_s={Nr(){if(!zi(xp))return xp;if(xp=!0,Ue(we))xp=!1;else try{var t="__support__";_s.Dr(t,"xyz"),_s.Pr(t)!=='"xyz"'&&(xp=!1),_s.qr(t)}catch{xp=!1}return xp},jr(t){Ze.error("sessionStorage error: ",t)},Pr(t){try{return we==null?void 0:we.sessionStorage.getItem(t)}catch(e){_s.jr(e)}return null},Br(t){try{return JSON.parse(_s.Pr(t))||null}catch{}return null},Dr(t,e){try{return we==null||we.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){_s.jr(n)}return!1},qr(t){try{we==null||we.sessionStorage.removeItem(t)}catch(e){_s.jr(e)}}};class tYe{constructor(e){this._instance=e}get ji(){return this._instance.config}get consent(){return this.fs()?0:this.ps}isOptedOut(){return this.ji.cookieless_mode===ld||this.isRejected()||this.consent===-1&&this.ji.cookieless_mode===Pp}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.ji.opt_out_capturing_by_default}optInOut(e){this.gs.Dr(this.ys,e?1:0,this.ji.cookie_expiration,this.ji.cross_subdomain_cookie,this.ji.secure_cookie)}reset(){this.gs.qr(this.ys,this.ji.cross_subdomain_cookie)}get ys(){var e=this._instance.config,n=e.token,s=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(s?s+n:"__ph_opt_in_out_"+n)}get ps(){var e=this.gs.Pr(this.ys);return P6(e)?1:en(rKe,e)?0:-1}get gs(){var e=this.ji.opt_out_capturing_persistence_type,n=e==="localStorage"?ds:Ur;if(!this.bs||this.bs!==n){this.bs=n;var s=e==="localStorage"?Ur:ds;s.Pr(this.ys)&&(this.bs.Pr(this.ys)||this.optInOut(P6(s.Pr(this.ys))),s.qr(this.ys,this.ji.cross_subdomain_cookie))}return this.bs}fs(){return!!this.ji.respect_dnt&&[Aa==null?void 0:Aa.doNotTrack,Aa==null?void 0:Aa.msDoNotTrack,Ot.doNotTrack].some((e=>P6(e)))}}function Gpe(t,e){var n,s=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!Xi(s))return e;try{var r=s(e);return jn(r)&&r?r:e}catch(i){return Ze.error("Error in get_current_url, falling back to window.location.href",i),e}}var Wpe="__POSTHOG_TOOLBAR__",nYe=1,sYe=3,rYe=11;function sX(t){return t instanceof Element&&(t.id===Wpe||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Ph(t){return!!t&&t.nodeType===nYe}function Co(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function qpe(t){return!!t&&t.nodeType===sYe}function Kpe(t){return!!t&&t.nodeType===rYe&&Ph(t.host)}var Ype=1e3;function C$(t){return t?iR(t).split(/\s+/):[]}function rX(t,e){var n=(function(s){var r,i=we==null||(r=we.location)==null?void 0:r.href;return Ue(i)?void 0:Gpe(s,i)})(e);return!!(n&&t&&t.some((s=>n.match(s))))}function Pk(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 C$(e)}function Zpe(t){return an(t)?null:iR(t).split(/(\s+)/).filter((e=>pb(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function h2(t){var e="";return YM(t)&&!tme(t)&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(n){var s;qpe(n)&&n.textContent&&(e+=(s=Zpe(n.textContent))!==null&&s!==void 0?s:"")})),iR(e)}function qM(t){var e;return Ue(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var T$=["a","button","form","input","select","textarea","label"];function KM(t,e){if(Ue(e))return!0;var n,s=function(i){if(e.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(i,a))))return{v:!0}};for(var r of t)if(n=s(r))return n.v;return!1}function Xpe(t){var e=t.parentNode;return!(!e||!Ph(e))&&e}var iYe=[".ph-no-autocapture","[data-ph-no-autocapture]"],Qpe=["next","previous","prev",">","<"],aYe=[...Qpe,"+","-","−","–"],iX=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,aX=[".ph-no-rageclick",".ph-no-capture"],oYe=["","text","search","email","password","url","tel","number"];function Jpe(t,e){if(!we||k$(t))return!1;var n,s,r,i,a;if(_a(e)?(n=!!e&&aX,s=void 0,r=!1):(n=(i=e==null?void 0:e.css_selector_ignorelist)!==null&&i!==void 0?i:aX,s=e==null?void 0:e.content_ignorelist,r=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),n===!1||r&&(function(l){return!(!l||!Ph(l))&&(!!Co(l,"textarea")||(Co(l,"input")?en(oYe,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var d=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return d==="true"||d===""})(l)))})(t))return!1;var o=eme(t,!1).targetElementList;return!(function(l,u){if(l===!1||Ue(l))return!1;var d;if(l===!0)d=Qpe;else{if(!Qt(l))return!1;if(l.length>10)return Ze.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;d=l.map((f=>f.toLowerCase()))}return u.some((f=>{var p=f.safeText,m=f.ariaLabel;return d.some((v=>iX(p,v)||iX(m,v)))}))})(s,o.map((l=>{var u;return{safeText:h2(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!KM(o,n)}var k$=t=>!t||Co(t,"html")||!Ph(t),eme=(t,e)=>{if(!we||k$(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,s=[t],r=t;r.parentNode&&!Co(r,"body");)if(Kpe(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var i=Xpe(r);if(!i)break;if(e||T$.indexOf(i.tagName.toLowerCase())>-1)n=!0;else try{var a=we.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}s.push(i),r=i}return{parentIsUsefulElement:n,targetElementList:s}};function YM(t){for(var e=new Set,n=0,s=t;s.parentNode&&!Co(s,"body");s=s.parentNode){if(n++>=Ype||e.has(s))return!1;e.add(s);var r=Pk(s);if(en(r,"ph-sensitive")||en(r,"ph-no-capture"))return!1}if(en(Pk(t),"ph-include"))return!0;var i=t.type||"";if(jn(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var a=t.name||t.id||"";return!jn(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function tme(t){return!!(Co(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Co(t,"select")||Co(t,"textarea")||t.getAttribute("contenteditable")==="true")}var oX=new RegExp("^(?:(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}
309)|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),lX=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,lYe=[16,15,14,13],cYe=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),cX=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),uX=/[0-9A-Za-z_]/;function uYe(t){for(var e=0,n=!1,s=t.length-1;s>=0;s--){var r=t.charCodeAt(s)-48;n&&(r*=2)>9&&(r-=9),e+=r,n=!n}return e%10==0}function pb(t,e){if(e===void 0&&(e=!0),an(t))return!1;if(jn(t)){t=iR(t);var n=e?oX.test((t||"").replace(/[- ]/g,"")):(function(r){var i;for(lX.lastIndex=0;i=lX.exec(r);){var a=i[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var u of lYe){var d=l+u;if(o.length>=d){var f=o.slice(l,d);if(oX.test(f)&&uYe(f))return!0}}}return!1})(t);if(n)return!1;var s=e?cYe.test(t):(function(r){var i;for(cX.lastIndex=0;i=cX.exec(r);){var a=i[1],o=i[3];if(!(a&&o&&uX.test(a)&&uX.test(o)))return!0}return!1})(t);if(s)return!1}return!0}function dX(t){var e=h2(t);return pb(e=(e+" "+nme(t)).trim())?e:""}function nme(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(n){var s;if(n&&((s=n.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=h2(n);e=(e+" "+r).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+nme(n)).trim())}catch(i){Ze.error("[AutoCapture]",i)}})),e}function fX(t){return t.replace(/"|\\"/g,'\\"')}function dYe(t){var e=t.attr__class;if(e)return Qt(e)?e:C$(e)}var iE=Hs("[Dead Clicks]"),fYe=()=>!0,hYe=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(b$)),s=t.instance.config.capture_dead_clicks;return _a(s)?s:!!Ss(s)||n};class hX{get lazyLoadedDeadClicksAutocapture(){return this._s}constructor(e,n,s){this.instance=e,this.isEnabled=n,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[b$]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.ws((()=>{this.ks()})):this.stop()}ws(e){var n,s;(n=Ot.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(s=Ot.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?iE.error("failed to load script",r):e()}))}ks(){var e;if(Ve){if(!this._s&&(e=Ot.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=Ss(this.instance.config.capture_dead_clicks)?$e({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this._s=Ot.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._s.start(Ve),iE.info("starting...")}}else iE.error("`document` not found. Cannot start.")}stop(){this._s&&(this._s.stop(),this._s=void 0,iE.info("stopping..."))}}var K6=Hs("[SegmentIntegration]"),sme="posthog-js";function rme(t,e){var n=e===void 0?{}:e,s=n.organization,r=n.projectId,i=n.prefix,a=n.severityAllowList,o=a===void 0?["error"]:a,l=n.sendExceptionsToPostHog,u=l===void 0||l;return d=>{var f,p,m,v,x;if(o!=="*"&&!o.includes(d.level)||!t.__loaded)return d;d.tags||(d.tags={});var y=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());d.tags["PostHog Person URL"]=y,t.sessionRecordingStarted()&&(d.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var S,_=((f=d.exception)==null?void 0:f.values)||[],E=_.map((k=>$e({},k,{stacktrace:k.stacktrace?$e({},k.stacktrace,{type:"raw",frames:(k.stacktrace.frames||[]).map((R=>$e({},R,{platform:"web:javascript"})))}):void 0}))),T={$exception_message:((p=_[0])==null?void 0:p.value)||d.message,$exception_type:(m=_[0])==null?void 0:m.type,$exception_level:d.level,$exception_list:E,$sentry_event_id:d.event_id,$sentry_exception:d.exception,$sentry_exception_message:((v=_[0])==null?void 0:v.value)||d.message,$sentry_exception_type:(x=_[0])==null?void 0:x.type,$sentry_tags:d.tags};return s&&r&&(T.$sentry_url=(i||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+d.event_id),u&&((S=t.exceptions)==null||S.sendExceptionEvent(T)),d}}class pYe{constructor(e,n,s,r,i,a){this.name=sme,this.setupOnce=function(o){o(rme(e,{organization:n,projectId:s,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}class pX{constructor(e){this.Ss=(n,s,r)=>
309{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Ze.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:r}),this.xs=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Cs()}Cs(){var e;this.Ts=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ss)}destroy(){var e;(e=this.Ts)==null||e.call(this),this.Ts=void 0}doPageView(e,n){var s,r=this.Ms(e,n);return this.xs={pathname:(s=we==null?void 0:we.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var n;return this.Ms(e,(n=this.xs)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.xs)==null?void 0:e.pageViewId}}Ms(e,n){var s=this.xs;if(!s)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:s.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var a=i.maxScrollHeight,o=i.lastScrollY,l=i.maxScrollY,u=i.maxContentHeight,d=i.lastContentY,f=i.maxContentY;if(!(Ue(a)||Ue(o)||Ue(l)||Ue(u)||Ue(d)||Ue(f))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=a>1?Hc(o/a,0,1,Ze):1,m=a>1?Hc(l/a,0,1,Ze):1,v=u>1?Hc(d/u,0,1,Ze):1,x=u>1?Hc(f/u,0,1,Ze):1;r=ws(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:x})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var Y6=["flags","surveys"],mYe={[Lpe]:{exposure:"hidden"},[L0]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Dy]:{exposure:"hidden"},[IM]:{exposure:"event"},[LM]:{exposure:"hidden"},[jM]:{exposure:"event"},[PM]:{exposure:"hidden"},[MM]:{exposure:"event"},[DM]:{exposure:"event"},[b$]:{exposure:"event"},[S$]:{exposure:"hidden"},[OM]:{exposure:"event"},[Yp]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[j0]:{exposure:"hidden"},[w$]:{exposure:"event"},[jpe]:{exposure:"event",shouldSkipFromEventProperties:t=>zi(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"},[td]:{exposure:"hidden",storageGroup:"flags"},[Zp]:{exposure:"hidden",storageGroup:"flags"},[YC]:{exposure:"hidden"},[f2]:{exposure:"hidden",storageGroup:"flags"},[Xp]:{exposure:"hidden",storageGroup:"flags"},[rv]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[kk]:{exposure:"hidden",storageGroup:"flags"},[Ec]:{exposure:"hidden"},[jp]:{exposure:"hidden"},[Fl]:{exposure:"hidden"},[Dc]:{exposure:"hidden"},[$M]:{exposure:"hidden",storageGroup:"surveys"},[Rk]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[FM]:{exposure:"event"},[ZC]:{exposure:"hidden"},[XC]:{exposure:"hidden"},[Oy]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[od]:{exposure:"hidden"},[$y]:{exposure:"hidden"},[$pe]:{exposure:"event"},[iv]:{exposure:"hidden"},[Cm]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xn]:{exposure:"hidden"},[UM]:{exposure:"hidden"},[BM]:{exposure:"hidden"},[zM]:{exposure:"hidden"},[VM]:{exposure:"hidden"},[Ak]:{exposure:"hidden"},[Nk]:{exposure:"hidden"},[Ppe]:{exposure:"event"},[Mpe]:{exposure:"event"},[Dpe]:{exposure:"event"},[Ope]:{exposure:"event"},[Upe]:{exposure:"event"},[Bpe]:{exposure:"event"},[HM]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"}
309,$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{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"}},gYe=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Cc=t=>{var e=mYe[t];if(e)return e;for(var n of gYe){var s=n[1];if(t.indexOf(n[0])===0)return s}},P0=(t,e)=>{try{return JSON.stringify(t,((n,s)=>typeof s=="bigint"?s.toString():s),e)}catch{return Qhe(t)}},Jv=t=>{var e=Ve==null?void 0:Ve.createElement("a");return Ue(e)?null:(e.href=t,e)},e1=function(t,e){for(var n,s=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var i=s[r].split("=");if(i[0]===e){n=i;break}}if(!Qt(n)||2>n.length)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Ze.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},p2=function(t,e,n){if(!t||!e||!e.length)return t;for(var s=t.split("#"),r=s[1],i=(s[0]||"").split("?"),a=i[1],o=i[0],l=(a||"").split("&"),u=[],d=0;l.length>d;d++){var f=l[d].split("=");Qt(f)&&(e.includes(f[0])?u.push(f[0]+"="+n):u.push(l[d]))}var p=o;return a!=null&&(p+="?"+u.join("&")),r!=null&&(p+="#"+r),p},Mk=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},ime=(t,e)=>t>=e&&Khe(),ame=(t,e,n,s)=>{if(t===0){if(Khe()){var r=e+1;return r===n&&s(),r}return e}return 0},aE="https?://(.*)",t1=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vYe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...t1],m2="<masked>",xYe=["li_fat_id"];function ome(t,e,n){if(!Ve)return{};var s,r=e?[...t1,...n||[]]:[],i=lme(p2(Ve.URL,r,m2),t),a=(s={},ts(xYe,(function(o){var l=zpe(o);s[o]=l||null})),s);return ws(a,i)}function lme(t,e){var n=vYe.concat(e||[]),s={};return ts(n,(function(r){var i=e1(t,r);s[r]=i||null})),s}function cme(t){var e=(function(i){return i?i.search(aE+"google.([^/?]*)")===0?"google":i.search(aE+"bing.com")===0?"bing":i.search(aE+"yahoo.com")===0?"yahoo":i.search(aE+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",s={};if(!zi(e)){s.$search_engine=e;var r=Ve?e1(Ve.referrer,n):"";r.length&&(s.ph_keyword=r)}return s}function mX(){return navigator.language||navigator.userLanguage}var Dk="$direct";function ume(){return(Ve==null?void 0:Ve.referrer)||Dk}function dme(t,e,n){n===void 0&&(n=!1);var s=t?[...t1,...e||[]]:[],r=n?jh(Xs==null?void 0:Xs.href):Xs==null?void 0:Xs.href,i=r==null?void 0:r.substring(0,1e3);return{r:ume().substring(0,1e3),u:i?p2(i,s,m2):void 0}}function fme(t,e){var n;e===void 0&&(e=!1);var s=t.r,r=t.u,i=e?jh(r):r,a={$referrer:s,$referring_domain:s==null?void 0:s==Dk?Dk:(n=Jv(s))==null?void 0:n.host};
309if(i){a.$current_url=i;var o=Jv(i);a.$host=o==null?void 0:o.host,a.$pathname=o==null?void 0:o.pathname;var l=lme(i);ws(a,l)}if(s){var u=cme(s);ws(a,u)}return a}function hme(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function yYe(){try{return new Date().getTimezoneOffset()}catch{return}}var bYe={flags:Cm,surveys:Rk},SYe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oE=t=>t+"_cookie_identity_change_pending",pf="main",gX=(t,e)=>{ts(t,((n,s)=>{var r=Cc(s);r&&r.exposure!=="event"||{}.hasOwnProperty.call(e,s)||delete t[s]}))};class Z6{constructor(e,n,s){if(s===void 0&&(s=!0),this.Es={},this.Is=!1,this.Rs=!1,this.Ps=!1,this.As=!1,this.ji=e,this.Fs=s,this.props={},this.Ls=void 0,this.Os=(i=>{var a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.gs=this.Ds(e),this.Rs=this.$s(e),this.load(),e.debug&&Ze.info("Persistence loaded",e.persistence,$e({},this.props)),this.update_config(e,e,n),this.save(),we){var r=()=>this.flush();Ds(we,"beforeunload",r,{capture:!1}),Ds(we,"pagehide",r,{capture:!1})}}Ns(){var e,n=(e=this.ji)==null?void 0:e.persistence_save_debounce_ms;return Lr(n)&&n>0?n:0}qs(e){if(this.ji.cookieWinsOnConflict&&this.ji.persistence.toLowerCase()==="localstorage+cookie")if(e)try{var n=W6(e,this.ji.cookie_persisted_properties||[]),s=tX(n,this.ji.cookie_persisted_properties||[]),r=JSON.stringify(n)+"|"+JSON.stringify(s),i=Ur.Pr(this.Os)||void 0;i&&q6(this.Os,i)===r&&(this.js=r,this.Bs=i)}catch{}else try{var a=Ur.Pr(this.Os)||void 0;this.js=a?q6(this.Os,a):void 0,this.Bs=a}catch{}}syncCookieProperties(){return this.Hs(this.ji)}Hs(e,n){if(n===void 0&&(n=!1),this.Us&&!n||this.As||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;var s;try{s=Ur.Pr(this.Os)||void 0}catch{}if(!s||s===this.Bs)return!1;var r,i=q6(this.Os,s);try{r=G6(JSON.parse(s))}catch{return!1}if((Ur.Pr(this.Os)||void 0)!==s)return!1;this.js=i,this.Bs=s;var a=nX(this.Os,s),o=[...Mp,...a.properties],l={};if(Object.keys(r).forEach((x=>{var y=r[x];(Ue(y)||zi(y)||y===""||x===xn&&y!==Er&&y!==$i)&&(l[x]=!0,delete r[x])})),Kl(r))return!1;var u=pa in r||r[xn]===Er||r[xn]===$i,d=this.props[pa],f=this.props[xn],p=ws({},this.props);[...Mp,...e.cookie_persisted_properties||[]].forEach((x=>{if(o.indexOf(x)!==-1&&!(x in r)&&!l[x]&&(u||x!==pa&&x!==xn)){var y=p[x];!a.isValid&&Mp.indexOf(x)!==-1&&(y===!1||y===0)||delete p[x]}})),this.props=ws(p,r),!u||xn in r||xn in this.props||this.zs(xn,Er);var m=this.props[pa],v=this.props[xn];return!u||m===d&&v===f||(this.Ps=!0,_s.Dr(oE(this.Os),!0),this.Ws(Fl),this.Ws(Zp),this.Ws(td),this.Ws(f2),this.Ws(Xp),this.Ws(rv),this.Ws(Cm),this.Ws(iv),this.Ws(od),v===Er&&(f===$i||r[xn]===Er||!Ue(d)&&m!==d)&&(gX(this.props,r),this.Ws(Dc)),v===$i?this.props.$user_id=m:delete this.props.$user_id,this.Ws(L0)),!0}
309consumeCookieIdentityChange(){var e=oE(this.Os),n=this.Ps||!!_s.Pr(e);return this.Ps=!1,n&&_s.qr(e),n}Vs(e){return e===void 0&&(e=!1),!(this.As||this.Us&&!e||!this.ji.cookieWinsOnConflict||this.ji.persistence.toLowerCase()!=="localstorage+cookie"||(this.As=!0,0))}Gs(){this.As&&(Ue(this.Zs)||(clearTimeout(this.Zs),this.Zs=void 0),delete this.Es[pf],this.Qs(!0))}Js(e){if(e===void 0&&(e=!0),this.As)try{e?this.Gs():Ue(this.Zs)||(clearTimeout(this.Zs),this.Zs=void 0)}finally{this.As=!1}}isDisabled(){return!!this.Us}Ds(e){SYe.indexOf(e.persistence.toLowerCase())===-1&&(Ze.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,s=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...Mp,...a];return $e({},ds,{Br(u){try{var d,f={};try{d=Ur.Pr(u)||void 0,f=d?G6(JSON.parse(d)):{}}catch{}var p,m=JSON.parse(ds.Pr(u)||"{}");if(o){var v=nX(u,d),x=[...Mp,...v.properties],y={};Object.keys(f).forEach((k=>{var R=f[k];zi(R)||R===""||k===xn&&R!==Er&&R!==$i||(y[k]=R)}));var S=pa in y||y[xn]===Er||y[xn]===$i;if(Object.keys(y).length>0){var _,E=m[pa],T=(_=m[xn])!==null&&_!==void 0?_:Er;l.forEach((k=>{if(x.indexOf(k)!==-1&&!(k in f)&&(S||k!==pa&&k!==xn)){var R=m[k];!v.isValid&&Mp.indexOf(k)!==-1&&(R===!1||R===0)||delete m[k]}})),!S||xn in f||xn in m||(m[xn]=Er),!S||(pa in y?y[pa]:m[pa])===E&&(xn in y?y[xn]:m[xn])===T||(H6.forEach((k=>delete m[k])),y[xn]===$i&&pa in y?m.$user_id=y[pa]:delete m.$user_id,y[xn]!==$i&&(delete m[$pe],delete m[Dc]),delete m.__alias)}p=ws(m,y)}else p=ws(f,m);return ds.Dr(u,p),p}catch{}return null},Dr(u,d,f,p,m,v){var x=ds.Dr(u,d,void 0,void 0,v);try{var y=W6(d,a);if(Object.keys(y).length){if(o){var S=jk(u),_=tX(y,a);if(Ur.Dr(S,_,f,p,m,v),Ur.Pr(S)!==JSON.stringify(_)){Ur.qr(S,p);var E=W6(d);return Ur.Dr(u,E,f,p,m,v),x}}Ur.Dr(u,y,f,p,m,v)}}catch(T){ds.jr(T)}return x},qr(u,d){try{we==null||we.localStorage.removeItem(u),Ur.qr(u,d),Ur.qr(jk(u),d)}catch(f){ds.jr(f)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,i=e.persistence.toLowerCase();return i==="localstorage"&&ds.Nr()?(n=ds,r=!0):i==="localstorage+cookie"&&s.Nr()?(n=s,r=!0):i==="sessionstorage"&&_s.Nr()?n=_s:i==="memory"?n=eYe:i==="cookie"?n=Ur:s.Nr()?(n=s,r=!0):n=Ur,this.Is=r,n}Ks(e){return this.Os+"__"+e}$s(e){return this.Is&&!!e.split_storage}properties(){var e={};return ts(this.props,((n,s)=>{var r=Cc(s);if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(n))return;e[s]=n}})),e}load(e){if(e===void 0&&(e=!1),!this.Us||e){var n=this.ji.cookieWinsOnConflict&&this.ji.persistence.toLowerCase()==="localstorage+cookie",s=n?ds.Br(this.Os):null,r={};if(n)try{ts(r=G6(Ur.Br(this.Os)),((v,x)=>{(Ue(v)||zi(v)||v==="")&&delete r[x]}))}catch{}var i=this.gs.Br(this.Os);if(i&&(this.props=ws({},i)),this.Rs&&this.Ys(),n&&i){var a,o,l=s==null?void 0:s[pa],u=(a=s==null?void 0:s[xn])!==null&&a!==void 0?a:Er,d=i[pa],f=(o=i[xn])!==null&&o!==void 0?o:Er;if(d!==l||f!==u){this.Ps=!0,_s.Dr(oE(this.Os),!0);var p=ws({},this.props);H6.forEach((v=>delete p[v])),f===Er&&(u===$i||r[xn]===Er||!Ue(l)&&d!==l)&&(gX(p,r),delete p[Dc]),this.props=p;var m=new Set;H6.forEach((v=>{var x,y=(x=Cc(v))==null?void 0:x.storageGroup;y&&m.add(y)})),m.forEach((v=>{var x={};ts(this.props,((y,S)=>{var _;((_=Cc(S))==null?void 0:_.storageGroup)===v&&(x[S]=y)})),Kl(x)?(ds.qr(this.Ks(v)),this.Es[v]={}):ds.Dr(this.Ks(v),x)&&(this.Es[v]={persisted:!0,fingerprint:this.Xs(x,v)})}))}}_s.Pr(oE(this.Os))&&(this.Ps=!0)}}Ys(){for(var e of Y6){var n=ds.Br(this.Ks(e));if(n&&!Kl(n)){var s=this.ta(e);s.persisted=!0,this.ea(e)||(s.fingerprint=this.Xs(n,e)),this.ia(e,n)||ws(this.props,n)}}}ea(e){return Object.keys(this.props).some((n=>{var s;return((s=Cc(n))==null?void 0:s.storageGroup)===e}))}ia(e,n){var s=bYe[e];if(!s)return!1;var r=n[s],i=this.props[s];return Lr(r)&&Lr(i)&&i>r}refreshKey(e){var n;if(!this.Us){var s=this.Rs?(n=Cc(e))==null?void 0:n.storageGroup:void 0,r=s?ds.Br(this.Ks(s)):this.gs.Br(this.Os);if(r&&e in r)this.zs(e,r[e]);else{if(s){var i=this.gs.Br(this.Os);if(i&&e in i)return void this.zs(e,i[e])}this.Ws(e)}}}save(){if(!this.Us){var e=this.Ns();e>0?Ue(this.Zs)&&(this.Zs=setTimeout((()=>{this.Zs=void 0,this.Qs()}),e)):this.Qs()}}flush(){Ue(this.Zs)||(clearTimeout(this.Zs),this.Zs=void 0,this.Qs())}Qs(e){e===void 0&&(e=!1),this.Us||this.As&&!e||(e||this.syncCookieProperties(),this.Rs?this.ra():this.na(this.gs,this.Os,this.props,pf)&&this.qs(this.props))}ra(){var e=this.sa(),n=e.main,s=e.groups;
309for(var r of(this.na(this.gs,this.Os,n,pf)&&this.qs(n),Y6)){var i,a=s[r];(!Kl(a)||(i=this.Es[r])!=null&&i.persisted)&&this.na(ds,this.Ks(r),a,r)}}sa(){var e={},n={flags:{},surveys:{}};return ts(this.props,((s,r)=>{var i,a=(i=Cc(r))==null?void 0:i.storageGroup;a?n[a][r]=s:e[r]=s})),{main:e,groups:n}}Xs(e,n){if(n===pf)return JSON.stringify(e)+"|"+this.aa+"|"+this.oa+"|"+this.la;var s={};return ts(e,((r,i)=>{var a;s[i]=(a=Cc(i))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(s)}na(e,n,s,r){var i,a=this.ta(r);if(r!==pf&&!a.dirty&&!Ue(a.fingerprint))return!1;try{if((i=this.Xs(s,r))===a.fingerprint)return a.dirty=!1,!1}catch{i=void 0}return e.Dr(n,s,this.aa,this.oa,this.la,this.ji.debug)?(a.dirty=!1,r!==pf&&(a.persisted=!0),Ue(i)||(a.fingerprint=i),!0):(this.ji.debug&&Ze.warn('failed to persist storage entry "'+n+'"; will retry on next save'),!1)}remove(e){var n=(e===void 0?{}:e).keepGroupEntries,s=n!==void 0&&n;if(Ue(this.Zs)||(clearTimeout(this.Zs),this.Zs=void 0),this.gs.qr(this.Os,!1),this.gs.qr(this.Os,!0),!s&&this.Fs)for(var r of Y6)ds.qr(this.Ks(r));s?delete this.Es[pf]:this.Es={},this.js=void 0,this.Bs=void 0}clear(){this.remove(),this.props={}}register_once(e,n,s){if(Ss(e)){this.syncCookieProperties(),Ue(n)&&(n="None"),this.aa=Ue(s)?this.ua:s;var r=!1;if(ts(e,((i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.zs(a,i),r=!0)})),r)return this.save(),!0}return!1}register(e,n){if(Ss(e)){this.syncCookieProperties(),this.aa=Ue(n)?this.ua:n;var s=!1;if(ts(e,((r,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==r||Ss(r)||Qt(r))&&(this.zs(i,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var n=typeof e=="string"?[e]:e,s=!1;for(var r of n)r in this.props&&(this.Ws(r),s=!0);s&&this.save()}update_campaign_params(){var e=Ve==null?void 0:Ve.URL;if(e!==this.Ls){var n=ome(this.ji.custom_campaign_params,this.ji.mask_personal_data_properties,this.ji.custom_personal_data_properties);Kl(E$(n))||this.register(n),this.Ls=e}}update_search_keyword(){var e;
309this.register((e=Ve==null?void 0:Ve.referrer)?cme(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ume(),$referring_domain:Ve!=null&&Ve.referrer&&((e=Jv(Ve.referrer))==null?void 0:e.host)||Dk},void 0)}set_initial_person_info(){this.props[zM]||this.props[VM]||this.register_once({[Ak]:dme(this.ji.mask_personal_data_properties,this.ji.custom_personal_data_properties,this.ji.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};ts([VM,zM],(r=>{var i=this.props[r];i&&ts(i,(function(a,o){e["$initial_"+CM(o)]=a}))}));var n=this.props[Ak];if(n){var s=(function(r,i){i===void 0&&(i=!1);var a=fme(r,i),o={};return ts(a,(function(l,u){o["$initial_"+CM(u)]=l})),o})(n,this.ji.disable_capture_url_hashes);ws(e,s)}return e}safe_merge(e){return ts(this.props,(function(n,s){s in e||(e[s]=n)})),e}update_config(e,n,s){var r=e.persistence!==n.persistence,i=!((x,y)=>{if(x.length!==y.length)return!1;var S=[...x].sort(),_=[...y].sort();return S.every(((E,T)=>E===_[T]))})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),a=r||i,o=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,l=e.disable_persistence||!!s,u=!!this.Us&&!l;l||this.Hs(n,u),this.ji=e,!l&&(r||i||o)&&(this.js=void 0,this.Bs=void 0,this.Hs($e({},e,{cookie_persisted_properties:n.cookie_persisted_properties}),u));var d=a||o?this.Ds(e):this.gs,f=this.$s(e),p=a||f!==this.Rs,m=!l&&(p||e.cross_subdomain_cookie!==this.oa||e.secure_cookie!==this.la)&&this.Vs(u);try{if(this.ua=this.aa=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),p){var v=this.props;this.clear(),this.gs=d,this.Rs=f,this.props=v,this.save()}else o&&(this.gs=d,l||(delete this.Es[pf],this.Qs()))}finally{m&&this.Js()}}set_disabled(e){this.Us=e,this.Us?this.remove():this.save()}set_cross_subdomain(e){e!==this.oa&&(this.oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.la&&(this.la=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var s=this.props[Dy]||{};s[e]=n,this.zs(Dy,s),this.save()}remove_event_timer(e){var n=this.props[Dy]||{},s=n[e];return Ue(s)||(delete n[e],this.zs(Dy,n),this.save()),s}get_property(e){return this.props[e]}set_property(e,n){this.zs(e,n),this.save()}zs(e,n){var s;this.props[e]=n,(s=Cc(e))!=null&&s.volatile||this.ha(e)}Ws(e){delete this.props[e],this.ha(e)}ha(e){var n,s=(n=Cc(e))==null?void 0:n.storageGroup;s&&(this.ta(s).dirty=!0)}ta(e){return this.Es[e]||(this.Es[e]={})}}function lE(t){var e=!0;return{dispose(){if(e){e=!1;var n=t();n&&Xi(n.then)&&n.then(void 0,(()=>{}))}}}}var ya={GZipJS:"gzip-js",Base64:"base64"},iy={Activation:"events",Cancellation:"cancelEvents"},X6={Popover:"popover",API:"api",Widget:"widget"},cd={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Q6={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ZM={Popover:"popover",Inline:"inline"},wYe={SHOWN:"product tour shown"},vX={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},xX=Hs("[RateLimiter]");class _Ye{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{xX.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void xX.warn('could not rate limit - continuing. Error: "'+(r==null?void 0:r.message)+'"',{text:s})}},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,s,r;e===void 0&&(e=!1);var i=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(n=(s=this.instance.persistence)==null?void 0:s.get_property(BM))!==null&&n!==void 0?n:{tokens:i,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>i&&(l.tokens=i);var u=1>l.tokens;if(u||e||(l.tokens=Math.max(0,l.tokens-1)),u&&!e){var d=(Lr(l.dropped)?l.dropped:0)+1;l.dropped=d,!this.lastEventRateLimited&&this.da(d)&&(l.dropped=0)}return this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(BM,l),{isRateLimited:u,remainingTokens:l.tokens}
309}va(e){var n=this.instance.config.property_denylist;return!Qt(n)||!n.includes(e)}ca(){var e;if(this.va("$current_url")&&this.va("$pathname")&&Xs!=null&&Xs.pathname)return""+((e=Xs.origin)!==null&&e!==void 0?e:"")+Xs.pathname}da(e){var n,s,r=this.captureEventsBurstLimit,i=this.captureEventsPerSecond,a=this.ca(),o=this.va("$session_id")?(n=(s=this.instance).get_session_id)==null?void 0:n.call(s):void 0,l=[e+" event(s) dropped since the last warning",a?"triggered on "+a:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+i+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var mf=Hs("[RemoteConfig]");class pme{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Ot._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}fa(e){var n,s;(n=Ot.__PosthogExtensions__)!=null&&n.loadExternalDependency?(s=Ot.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}pa(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return mf.info("Using preloaded remote config",this.remoteConfig),void this.ga(this.remoteConfig);if(this._instance.ma())return void mf.warn("Remote config is disabled. Falling back to local config.");this.fa((e=>{if(!e)return mf.info("No config found after loading remote JS config. Falling back to JSON."),void this.pa((n=>{this.ga(n.json,n)}));this.ga(e)}))}catch(e){mf.error("Error loading remote config",e),this.ga()}}ga(e,n){!e&&n&&(n.statusCode===0?n.error||mf.warn("Failed to fetch remote config from PostHog."):mf.error("Failed to fetch remote config from PostHog."));try{this._instance.ga(e?{ok:!0,config:e}:{ok:!1})}catch(r){mf.error("Error applying remote config",r)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var s;(s=this._instance.featureFlags)==null||s.ensureFlagsLoaded()}catch(r){mf.error("Error loading feature flags",r)}}}var fl=Uint8Array,Ka=Uint16Array,n1=Uint32Array,R$=new fl([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]),A$=new fl([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]),yX=new fl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mme=function(t,e){for(var n=new Ka(31),s=0;31>s;++s)n[s]=e+=1<<t[s-1];var r=new n1(n[30]);for(s=1;30>s;++s)for(var i=n[s];n[s+1]>i;++i)r[i]=i-n[s]<<5|s;return[n,r]},gme=mme(R$,2),XM=gme[1];gme[0][28]=258,XM[258]=28;for(var bX=mme(A$,0)[1],vme=new Ka(32768),Js=0;32768>Js;++Js){var Gg=(43690&Js)>>>1|(21845&Js)<<1;vme[Js]=((65280&(Gg=(61680&(Gg=(52428&Gg)>>>2|(13107&Gg)<<2))>>>4|(3855&Gg)<<4))>>>8|(255&Gg)<<8)>>>1}var mb=function(t,e,n){for(var s=t.length,r=0,i=new Ka(e);s>r;++r)++i[t[r]-1];var a,o=new Ka(e);for(r=0;e>r;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new Ka(s),r=0;s>r;++r)a[r]=vme[o[t[r]-1]++]>>>15-t[r];return a},Om=new fl(288);for(Js=0;144>Js;++Js)Om[Js]=8;for(Js=144;256>Js;++Js)Om[Js]=9;for(Js=256;280>Js;++Js)Om[Js]=7;for(Js=280;288>Js;++Js)Om[Js]=8;var Ok=new fl(32);for(Js=0;32>Js;++Js)Ok[Js]=5;var EYe=mb(Om,9),CYe=mb(Ok,5),xme=function(t){return(t/8>>0)+(7&t&&1)},yme=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var s=new(t instanceof Ka?Ka:t instanceof n1?n1:fl)(n-e);return s.set(t.subarray(e,n)),s},Du=function(t,e,n){var s=e/8>>0;t[s]|=n<<=7&e,t[s+1]|=n>>>8},ay=function(t,e,n){var s=e/8>>0;t[s]|=n<<=7&e,t[s+1]|=n>>>8,t[s+2]|=n>>>16},J6=function(t,e){for(var n=[],s=0;t.length>s;++s)t[s]&&n.push({s,f:t[s]});var r=n.length,i=n.slice();if(!r)return[new fl(0),0];if(r==1){var a=new fl(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(k,R){return k.f-R.f})),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[f].f>n[u].f?u++:f++],l=n[u!=d&&n[f].f>n[u].f?u++:f++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var p=i[0].s;for(s=1;r>s;++s)i[s].s>p&&(p=i[s].s);var m=new Ka(p+1),v=QM(n[d-1],m,0);if(v>e){s=0;var x=0,y=v-e,S=1<<y;for(i.sort((function(k,R){return m[R.s]-m[k.s]||k.f-R.f}));r>s;++s){var _=i[s].s;if(e>=m[_])break;x+=S-(1<<v-m[_]),m[_]=e}for(x>>>=y;x>0;){var E=i[s].s;e>m[E]?x-=1<<e-m[E]++-1:++s}for(;s>=0&&x;--s){var T=i[s].s;m[T]==e&&(--m[T],++x)}v=e}return[new fl(m),v]},QM=function(t,e,n){return t.s==-1?Math.max(QM(t.l,e,n+1),QM(t.r,e,n+1)):e[t.s]=n},SX=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Ka(++e),s=0,r=t[0],i=1,a=function(l){n[s++]=l},o=1;e>=o;++o)if(t[o]==r&&o!=e)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=t[o]}return[n.subarray(0,s),e]},oy=function(t,e){for(var n=0,s=0;e.length>s;++s)n+=t[s]*e[s];return n},JM=function(t,e,n){var s=n.length,r=xme(e+2);t[r]=255&s,t[r+1]=s>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var i=0;s>i;++i)t[r+i+4]=n[i];return 8*(r+4+s)},wX=function(t,e,n,s,r,i,a,o,l,u,d){Du(e,d++,n),++r[256];for(var f=J6(r,15),p=f[0],m=f[1],v=J6(i,15),x=v[0],y=v[1],S=SX(p),_=S[0],E=S[1],T=SX(x),k=T[0],R=T[1],I=new Ka(19),A=0;_.length>A;++A)I[31&_[A]]++;for(A=0;k.length>A;++A)I[31&k[A]]++;for(var L=J6(I,7),j=L[0],F=L[1],O=19;O>4&&!j[yX[O-1]];--O);var M,U,G,$,V=u+5<<3,B=oy(r,Om)+oy(i,Ok)+a,q=oy(r,p)+oy(i,x)+a+14+3*O+oy(I,j)+(2*I[16]+3*I[17]+7*I[18]);if(B>=V&&q>=V)return JM(e,d,t.subarray(l,l+u));if(Du(e,d,1+(B>q)),d+=2,B>q){M=mb(p,m),U=p,G=mb(x,y),$=x;var z=mb(j,F);for(Du(e,d,E-257),Du(e,d+5,R-1),Du(e,d+10,O-4),d+=14,A=0;O>A;++A)Du(e,d+3*A,j[yX[A]]);d+=3*O;for(var D=[_,k],K=0;2>K;++K){var Y=D[K];for(A=0;Y.length>A;
vendor: 1,358 bytes, line 309
309++A)Du(e,d,z[J=31&Y[A]]),d+=j[J],J>15&&(Du(e,d,Y[A]>>>5&127),d+=Y[A]>>>12)}}else M=EYe,U=Om,G=CYe,$=Ok;for(A=0;o>A;++A)if(s[A]>255){var J;ay(e,d,M[257+(J=s[A]>>>18&31)]),d+=U[J+257],J>7&&(Du(e,d,s[A]>>>23&31),d+=R$[J]);var ne=31&s[A];ay(e,d,G[ne]),d+=$[ne],ne>3&&(ay(e,d,s[A]>>>5&8191),d+=A$[ne])}else ay(e,d,M[s[A]]),d+=U[s[A]];return ay(e,d,M[256]),d+U[256]},TYe=new n1([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),kYe=(function(){for(var t=new n1(256),e=0;256>e;++e){for(var n=e,s=9;--s;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),eI=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function RYe(t,e){e===void 0&&(e={});var n=(function(){var f=4294967295;return{p(p){for(var m=f,v=0;p.length>v;++v)m=kYe[255&m^p[v]]^m>>>8;f=m},d(){return 4294967295^f}}})(),s=t.length;n.p(t);var r,i,a,o,l,u=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(f,p,m,v,x,y){var S=f.length,_=new fl(v+S+5*(1+Math.floor(S/7e3))+x),E=_.subarray(v,_.length-x),T=0;if(!p||8>S)for(var k=0;S>=k;k+=65535){var R=k+65535;S>R?T=JM(E,T,f.subarray(k,R)):(E[k]=!0,T=JM(E,T,f.subarray(k,S)))}else{for(var I=TYe[p-1],A=I>>>13,L=8191&I,j=(1<<m)-1,F=new Ka(32768),O=new Ka(j+1),M=Math.ceil(m/3),U=2*M,G=function(Ct){return(f[Ct]^f[Ct+1]<<M^f[Ct+2]<<U)&j},$=new n1(25e3),V=new Ka(288),B=new Ka(32),q=0,z=0,D=(k=0,0),K=0,Y=0;S>k;++k){var J=G(k),ne=32767&k,Q=O[J];
309if(F[ne]=Q,O[J]=ne,k>=K){var ee=S-k;if((q>7e3||D>24576)&&ee>423){T=wX(f,E,0,$,V,B,z,D,Y,k-Y,T),D=q=z=0,Y=k;for(var te=0;286>te;++te)V[te]=0;for(te=0;30>te;++te)B[te]=0}var ue=2,ye=0,je=L,Re=ne-Q&32767;if(ee>2&&J==G(k-Re))for(var me=Math.min(A,ee)-1,Ce=Math.min(32767,k),Xe=Math.min(258,ee);Ce>=Re&&--je&&ne!=Q;){if(f[k+ue]==f[k+ue-Re]){for(var he=0;Xe>he&&f[k+he]==f[k+he-Re];++he);if(he>ue){if(ue=he,ye=Re,he>me)break;var De=Math.min(Re,he-2),Ge=0;for(te=0;De>te;++te){var Je=k-Re+te+32768&32767,Le=Je-F[Je]+32768&32767;Le>Ge&&(Ge=Le,Q=Je)}}}Re+=(ne=Q)-(Q=F[ne])+32768&32767}if(ye){$[D++]=268435456|XM[ue]<<18|bX[ye];var qe=31&XM[ue],et=31&bX[ye];z+=R$[qe]+A$[et],++V[257+qe],++B[et],K=k+ue,++q}else $[D++]=f[k],++V[f[k]]}}T=wX(f,E,!0,$,V,B,z,D,Y,k-Y,T)}return yme(_,0,v+xme(T)+x)})(i=t,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+a.mem,o,l)),d=u.length;return(function(f,p){var m=p.filename;if(f[0]=31,f[1]=139,f[2]=8,f[8]=2>p.level?4:p.level==9?2:0,f[9]=3,p.mtime!=0&&eI(f,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),m){f[3]=8;for(var v=0;m.length>=v;++v)f[v+10]=m.charCodeAt(v)}})(u,e),eI(u,d-8,n.d()),eI(u,d-4,s),u}var AYe=!!SM||!!f$,bme="text/plain",JC=!1,Sme=(t,e)=>{var n=t.split("#"),s=n[1],r=n[0].split("?"),i=r[0],a=r[1];if(!a)return t;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return i+(o?"?"+o:"")+(s?"#"+s:"")},OS=function(t,e,n){var s;n===void 0&&(n=!0);var r=t.split("?"),i=r[0],a=r[1],o=$e({},e),l=(s=a==null?void 0:a.split("&").map((d=>{var f,p=d.split("="),m=p[0],v=n&&(f=o[m])!==null&&f!==void 0?f:p[1];return delete o[m],m+"="+v})))!==null&&s!==void 0?s:[],u=(function(d,f){var p,m;f===void 0&&(f="&");var v=[];return ts(d,(function(x,y){Ue(x)||Ue(y)||y==="undefined"||(p=encodeURIComponent((S=>S instanceof File)(x)?x.name:x.toString()),m=encodeURIComponent(y),v[v.length]=m+"="+p)})),v.join(f)})(o);return u&&l.push(u),l.length>0?i+"?"+l.join("&"):i},tI=t=>{if(t.ya)return t.ya;var e=t.data,n=t.compression;if(e){if(n===ya.GZipJS){var s=RYe((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var d=new fl(o.length+(o.length>>>1)),f=0,p=function(y){d[f++]=y},m=0;u>m;++m){if(f+5>d.length){var v=new fl(f+8+(u-m<<1));v.set(d),d=v}var x=o.charCodeAt(m);128>x?p(x):2048>x?(p(192|x>>>6),p(128|63&x)):x>55295&&57344>x?(p(240|(x=65536+(1047552&x)|1023&o.charCodeAt(++m))>>>18),p(128|x>>>12&63),p(128|x>>>6&63),p(128|63&x)):(p(224|x>>>12),p(128|x>>>6&63),p(128|63&x))}return yme(d,0,f)})(P0(e)),{mtime:0});return{contentType:bme,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(n===ya.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(P0(e)),i=(o=>"data="+encodeURIComponent(typeof o=="string"?o:P0(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var a=P0(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},wme=t=>{var e,n,s=()=>t.transport==="sendBeacon"?{url:OS(t.url,{compression:ya.Base64}),encodedBody:tI($e({},t,{compression:ya.Base64,ya:void 0}))}:{url:Sme(t.url,"compression"),encodedBody:tI($e({},t,{compression:void 0,ya:void 0}))};try{e=tI(t)}catch(r){if($Z(t.compression,e1(t.url,"compression")))return Ze.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&$Z(t.compression,e1(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?wM(new Uint8Array(n)):ArrayBuffer.isView(n)&&wM(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(JC=!0,s()):{url:t.url,encodedBody:e}},_me=t=>{try{return wme(t)}catch(e){return Ze.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},NYe=(function(){var t=Ns((function*(e){var n=P0(e.data),s=yield(function(i,a,o){return _M.apply(this,arguments)})(n,As.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return $e({},e,{ya:{contentType:bme,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),IYe=/Failed to fetch|NetworkError|Load failed/i,Eme=t=>(t==null?void 0:t.name)==="TypeError"&&IYe.test((t==null?void 0:t.message)||""),Cme=t=>{var e=_me(t);if(e){var n=e.url,s=e.encodedBody,r=s??{},i=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;ts(t.headers,(function(v,x){l.append(x,v)})),i&&l.append("Content-Type",i);var u=null,d=!1;if(LZ){var f=new LZ;
309u={signal:f.signal,timeout:setTimeout((()=>{var v,x;d=!0,f.abort((v=t.timeout,(x=new Error("PostHog request timed out"+(v?" after "+v+"ms":""))).name="AbortError",x))}),t.timeout)}}var p=v=>{d&&(v==null?void 0:v.name)==="AbortError"||Eme(v)?Ze.warn(v):Ze.error(v),t.callback==null||t.callback({statusCode:0,error:v})};try{var m;f$(n,$e({method:(t==null?void 0:t.method)||"GET",headers:l,keepalive:t.method==="POST"&&!t.ba&&52428.8>(o||0),body:a,signal:(m=u)==null?void 0:m.signal},t.fetchOptions)).then((v=>v.text().then((x=>{var y={statusCode:v.status,text:x};if(v.status===200)try{y.json=JSON.parse(x)}catch(S){Ze.error(S)}t.callback==null||t.callback(y)})))).catch(p).finally((()=>u?clearTimeout(u.timeout):null))}catch(v){u&&clearTimeout(u.timeout),p(v)}}},eD=t=>{try{var e,n=wme(t),s=n.url,r=n.encodedBody,i=r??{},a=i.body,o=i.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:i.contentType});if(Aa.sendBeacon(s,l))return;var u=Qt(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(Qt(u)&&u.length>1&&(o??0)>16384){var d=Math.ceil(u.length/2),f=p=>Qt(t.data)?p:$e({},t.data,{batch:p});return eD($e({},t,{data:f(u.slice(0,d))})),void eD($e({},t,{data:f(u.slice(d))}))}Ze.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),Cme($e({},t,{ba:!0}))}catch(p){Ze.warn("Beacon send failed",p)}},_X=(t,e,n,s)=>{var r=s==="query"?e==="POST"?"sent_at":"_":void 0;return OS(n===ya.GZipJS?Sme(t,"compression"):t,$e({},r?{[r]:Date.now().toString()}:{},n===ya.GZipJS?{}:{compression:n}))},eT=[];f$&&eT.push({transport:"fetch",method:Cme}),SM&&eT.push({transport:"XHR",method(t){var e=_me(t);if(e){var n=new SM,s=e.encodedBody;n.open(t.method||"GET",e.url,!0);var r=s??{},i=r.contentType,a=r.body;ts(t.headers,(function(o,l){n.setRequestHeader(l,o)})),i&&n.setRequestHeader("Content-Type",i),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var o={statusCode:n.status,text:n.responseText};if(n.status===200)try{o.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(o)}},n.send(a)}}}),Aa!=null&&Aa.sendBeacon&&eT.push({transport:"sendBeacon",method:eD});var tD=3e3;class LYe{constructor(e,n){this._a=!0,this.wa=[],this.ka=Hc((n==null?void 0:n.flush_interval_ms)||tD,250,5e3,Ze.createLogger("flush interval"),tD),this.Sa=e}enqueue(e){this.wa.push(e),this.xa||this.Ca()}unload(){this.Ta();var e=this.wa.length>0?this.Ma():{},n=Object.values(e);[...n.filter((s=>s.url.indexOf("/e")===0)),...n.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.Ea($e({},s,{transport:"sendBeacon"}))}))}enable(){this._a=!1,this.Ca()}Ca(){var e=this;this._a||(this.xa=setTimeout((()=>{if(this.Ta(),this.wa.length>0){var n=this.Ma(),s=function(){var i=n[r],a=new Date().getTime();i.data&&Qt(i.data)&&ts(i.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.Ea(i)};for(var r in n)s()}}),this.ka))}Ea(e){try{this.Sa(e)}catch(n){Ze.error(n)}}Ta(){clearTimeout(this.xa),this.xa=void 0}Ma(){var e={};return ts(this.wa,(n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;Ue(e[i])&&(e[i]=$e({},r,{data:[]})),(s=e[i].data)==null||s.push(r.data)})),this.wa=[],e}}var jYe=["retriesPerformedSoFar"];class PYe{constructor(e){this.Ia=!1,this.Ra=3e3,this.wa=[],this._instance=e,this.wa=[],this.Pa=!0,!Ue(we)&&"onLine"in we.navigator&&(this.Pa=we.navigator.onLine,this.Aa=()=>{this.Pa=!0,this.Fa()},this.La=()=>{this.Pa=!1},Ds(we,"online",this.Aa),Ds(we,"offline",this.La))}get length(){return this.wa.length}retriableRequest(e){var n=e.retriesPerformedSoFar,s=Yhe(e,jYe);Gu(n)&&(s.url=OS(s.url,{retry_count:n})),this._instance._send_request($e({},s,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(n??0))return void this.Cn($e({retriesPerformedSoFar:n},s));r.statusCode===0&&Ze.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.")}s.callback==null||s.callback(r)}}))}Cn(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),d=Math.random()-.5;return Math.ceil(u+d*(u-l))})(n),r=Date.now()+s;this.wa.push({retryAt:r,requestOptions:e});var i="Enqueued failed request for retry in "+s;navigator.onLine||(i+=" (Browser is offline)"),Ze.warn(i),this.Ia||(this.Ia=!0,this.Oa())}Oa(){if(this.Da&&clearTimeout(this.Da),this.wa.length===0)return this.Ia=!1,void(this.Da=void 0);this.Da=setTimeout((()=>{this.Pa&&this.wa.length>0&&this.Fa(),this.Oa()}),this.Ra)}Fa(){var e=Date.now(),n=[],s=this.wa.filter((i=>e>i.retryAt||(n.push(i),!1)));if(this.wa=n,s.length>0)for(var r of s)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Da&&(clearTimeout(this.Da),this.Da=void 0),this.Ia=!1,Ue(we)||(this.Aa&&(we.removeEventListener("online",this.Aa),this.Aa=void 0),this.La&&(we.removeEventListener("offline",this.La),this.La=void 0)),this.wa)){var n=e.requestOptions;try{this._instance._send_request($e({},n,{transport:"sendBeacon"}))}catch(s){Ze.error(s)}}this.wa=[]}}class MYe{constructor(e){this.$a=()=>{var n,s,r,i;this.Na||(this.Na={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+((a==null?void 0:a.clientHeight)||0),d=(a==null?void 0:a.scrollHeight)||0;this.Na.lastScrollY=Math.ceil(o),this.Na.maxScrollY=Math.max(o,(n=this.Na.maxScrollY)!==null&&n!==void 0?n:0),this.Na.maxScrollHeight=Math.max(l,(s=this.Na.maxScrollHeight)!==null&&s!==void 0?s:0),this.Na.lastContentY=u,this.Na.maxContentY=Math.max(u,(r=this.Na.maxContentY)!==null&&r!==void 0?r:0),this.Na.maxContentHeight=Math.max(d,(i=this.Na.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get qa(){return this._instance.config.scroll_root_selector}getContext(){return this.Na}resetContext(){var e=this.Na;return setTimeout(this.$a,0),e}startMeasuringScrollPosition(){Ds(we,"scroll",this.$a,{capture:!0}),Ds(we,"scrollend",this.$a,{capture:!0}),Ds(we,"resize",this.$a)}scrollElement(){if(!this.qa)return we==null?void 0:we.document.documentElement;var e=Qt(this.qa)?this.qa:[this.qa];for(var n of e){var s=we==null?void 0:we.document.querySelector(n);if(s)return s}}ja(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.qa){var s=this.scrollElement();return s&&s[n]||0}return we?e==="y"?we.scrollY||we.pageYOffset||we.document.documentElement.scrollTop||0:we.scrollX||we.pageXOffset||we.document.documentElement.scrollLeft||0:0}scrollY(){return this.ja("y")}scrollX(){return this.ja("x")}}var DYe=t=>dme(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes
309);class EX{constructor(e,n,s,r){this.ot=i=>{var a=this.Ba();if(!a||a.sessionId!==i){var o={sessionId:i,props:this.Ha(this._instance)};this.Ua.register({[UM]:o})}},this._instance=e,this.za=n,this.Ua=s,this.Ha=r||DYe,this.za.onSessionId(this.ot)}Ba(){return this.Ua.props[UM]}getSetOnceProps(){var e,n=(e=this.Ba())==null?void 0:e.props;return n?"r"in n?fme(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 ts(E$(this.getSetOnceProps()),((n,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+CM(s)]=n})),e}}class $k{on(e,n){return this.Wa[e]||(this.Wa[e]=[]),this.Wa[e].push(n),()=>{this.Wa[e]=this.Wa[e].filter((s=>s!==n))}}emit(e,n){for(var s of this.Wa[e]||[])s(n);for(var r of this.Wa["*"]||[])r(e,n)}constructor(){this.Wa={}}}var Wg=Hs("[SessionId]"),CX=864e5;class TX{on(e,n){return this.Va.on(e,n)}constructor(e,n,s){var r;if(this.Ga=null,this.Za=null,this.Qa=[],this.Ja=void 0,this.Ka=!1,this.Va=new $k,this.Ya=(l,u)=>!(!Gu(l)||!Gu(u))&&Math.abs(l-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ld)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.ji=e.config,this.Ua=e.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.Xa=void 0,this._sessionActivityTimestamp=null,this.eo=n||Nc,this.io=s||Nc;var i=this.ji.persistence_name||this.ji.token;if(this._sessionTimeoutMs=1e3*Hc(this.ji.session_idle_timeout_seconds||1800,60,36e3,Wg.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ro(),this.no="ph_"+i+"_window_id",this.so="ph_"+i+"_primary_window_exists",this.ao()){var a=_s.Br(this.no),o=_s.Br(this.so);a&&!o?this.st=a:_s.qr(this.no),_s.Dr(this.so,!0)}(r=this.ji.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.ji.bootstrap.sessionID),this.oo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ue(this.Qa)&&(this.Qa=[]),this.Qa.push(e),this._e&&e(this._e,this.st),()=>{this.Qa=this.Qa.filter((n=>n!==e))}}ao(){return this.ji.persistence!=="memory"&&!this.Ua.Us&&_s.Nr()}lo(e){e!==this.st&&(this.st=e,this.ao()&&_s.Dr(this.no,e))}uo(){return this.st?this.st:this.ao()?_s.Br(this.no):null}ho(e){var n=this.Ga;return!zi(n)&&!zi(e)&&5e3>Math.abs(e-n)}do(e,n,s){var r=n!==this._sessionActivityTimestamp,i=!(e!==this._e||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this._e=e,i&&!r||i&&this.ho(n)||(this.Ga=n,this.Ua.register({[j0]:[n,e,s]}))}vo(){var e,n=(e=this.ji)==null?void 0:e.persistence_save_debounce_ms;return Gu(n)&&n>0}co(){this.vo()?this.Ua.refreshKey(j0):(this.Ua.flush(),this.Ua.load())}fo(){var e;if(!zi(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ga){this.co();var n=this.po();n[1]===this._e&&n[2]===this._sessionStartTimestamp&&(this.Ga=this._sessionActivityTimestamp,this.Ua.register({[j0]:[this._sessionActivityTimestamp,(e=this._e)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ua.flush())}}mo(){var e=this.po()[0],n=Gu(e)?e:0,s=Gu(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,s)}yo(e){return this.co(),this.Ya(e,this.mo())}po(){var e=this.Ua.props[j0];return Qt(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ga=null,this.Xa=void 0,clearTimeout(this.bo),this.bo=void 0,this.do(null,null,null)}setBootstrapSessionId(e,n){n===void 0&&(n=!1);var s=(function(r,i){i===void 0&&(i=new Date().getTime());try{var a=(o=>{var l=o.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return a>i+6e4?void Wg.error("Bootstrap sessionID cannot be in the future"):a}catch(o){return void Wg.error("Invalid sessionID in bootstrap",o)}})(e);return!Ue(s)&&(n?this.Xa={sessionId:e,sessionStartTimestamp:s}:this.do(e,new Date().getTime(),s),!0)}destroy(){this.Ka=!0,this.fo(),clearTimeout(this.bo),this.bo=void 0,this.Ja&&we&&(we.removeEventListener(Ik,this.Ja,{capture:!1}),this.Ja=void 0),this.Qa=[]}oo(){this.Ja=()=>{this.fo(),this.ao()&&_s.qr(this.so)},Ds(we,Ik,this.Ja,{capture:!1})}
309checkAndGetSessionAndWindowId(e,n,s){if(e===void 0&&(e=!1),n===void 0&&(n=null),s===void 0&&(s=!1),this.ji.cookieless_mode===ld)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),i=this._e;if(s)this.Za=r;else if(zi(this.Za)||this.Za>r||r-this.Za>=1e3){var a,o;(a=(o=this.Ua).syncCookieProperties)==null||a.call(o),this.Za=r}var l=this.po(),u=l[1],d=l[2],f=!Ue(i)&&u!==i,p=this.mo(),m=this.uo(),v=this.Xa,x=!!v&&(v.sessionStartTimestamp>r+6e4||r-v.sessionStartTimestamp>CX),y=v?x:Gu(d)&&Math.abs(r-d)>CX,S=!1,_=f,E=!u||!!v,T=u,k=!E&&!e&&this.Ya(r,p);if(k){(k=this.yo(r))||Wg.info("cross-tab refresh kept the session alive",{sessionId:u});var R=this.po();u=R[1],d=R[2]}if(E||k||y){_=!1;var I=v&&!x;u=I?v.sessionId:this.eo(),m=this.io(),Wg.info("new session ID assigned",{sessionId:u,windowId:m,bootstrapped:!!I,changeReason:{noSessionId:E,activityTimeout:k,sessionPastMaximumLength:y}}),d=I?v.sessionStartTimestamp:r,this.Xa=void 0,S=!0}else m||(m=this.io(),S=!0),(_=_||u!==T)&&(Wg.info("adopted cross-tab session id",{sessionId:u,windowId:m}),S=!0);var A=Gu(p)&&e&&!y?p:r,L=Gu(d)?d:new Date().getTime();this.lo(m),this.do(u,A,L),e||this.ro();var j={noSessionId:E,activityTimeout:k,sessionPastMaximumLength:y,crossTabAdoption:_};return S&&this.Qa.forEach((F=>F(u,m,j))),{sessionId:u,windowId:m,sessionStartTimestamp:L,changeReason:S?j:void 0,lastActivityTimestamp:p}}ro(){this.Ka||(clearTimeout(this.bo),this.bo=setTimeout((()=>{if(!this.Ka)if(this.yo(new Date().getTime())){var e=this._e;this.resetSessionId(),this.Va.emit("forcedIdleReset",{idleSessionId:e})}else this.ro()}),1.1*this.sessionTimeoutMs))}}var Tme=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&UZ(n,e))return!0;try{var s=t==null?void 0:t.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>UZ(r==null?void 0:r.brand,e))))return!0}catch{}return!!t.webdriver};function kme(){return(kme=Ns((function*(){var t=Aa==null?void 0:Aa.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e==null?void 0:e.model;return jn(n)&&n.length>0?n:void 0}catch(s){return void Ze.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}function Rme(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var Fk=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},cE=t=>t.toLowerCase(),Ame={exact:(t,e)=>e.some((n=>t.some((s=>n===s)))),is_not:(t,e)=>e.every((n=>t.every((s=>n!==s)))),regex:(t,e)=>e.some((n=>t.some((s=>Fk(n,s))))),not_regex:(t,e)=>e.every((n=>t.every((s=>!Fk(n,s))))),icontains:(t,e)=>e.map(cE).some((n=>t.map(cE).some((s=>n.includes(s))))),not_icontains:(t,e)=>e.map(cE).every((n=>t.map(cE).every((s=>!n.includes(s))))),gt:(t,e)=>e.some((n=>{var s=parseFloat(n);return!isNaN(s)&&t.some((r=>s>parseFloat(r)))})),lt:(t,e)=>e.some((n=>{var s=parseFloat(n);return!isNaN(s)&&t.some((r=>s<parseFloat(r)))}))};function Nme(t,e){return!t||Object.entries(t).every((n=>{var s=n[1],r=e==null?void 0:e[n[0]];if(r==null)return!1;var i=Ame[s.operator];return!!i&&i(s.values,[String(r)])}))}function nI(t,e,n){return P0({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var nD="custom",kX="i.posthog.com",OYe=/^\/static\//,$Ye=["/s/","/e/","/i/"];class FYe{constructor(e){this._o={},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("."+kX,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._o[this.apiHost]||(this._o[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":nD),this._o[this.apiHost]}wo(e){if(OYe.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}ko(e){var n=Jv(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}So(e,n,s){if(e==="ui")return s;var r=s,i=this.instance.config.rewriteRequestPath;if(i){var a,o=((a=Jv(s))==null?void 0:a.href)||s;r=i(new URL(o)).toString()}if(i&&e==="api"&&$Ye.some((p=>n.indexOf(p)===0))){var l=this.ko(r);
309if(l){var u,d=this.apiHost,f=this.xo;((u=f)==null?void 0:u.apiHost)===d&&f.rewriteRequestPath===i||(f={apiHost:d,rewriteRequestPath:i,urls:new Set},this.xo=f),f.urls.add(l)}}return r}isIngestionEndpoint(e){var n=this.xo,s=this.ko(e);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!s&&n.urls.has(s)}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.So(e,n,this.uiHost+n);if(e==="flags")return this.So(e,n,this.flagsApiHost+n);if(e==="assets"){var s=this.wo(n);if(s)return this.So(e,n,""+s+n)}if(this.region===nD)return this.So(e,n,this.apiHost+n);var r=kX+n;switch(e){case"assets":return this.So(e,n,"https://"+this.region+"-assets."+r);case"api":return this.So(e,n,"https://"+this.region+"."+r)}}}var Vn=Hs("[Surveys]"),Ime="seenSurvey_",Lme=t=>{try{var e=(n=>((s,r)=>""+Ime+(function(i){return i.current_iteration&&i.current_iteration>0?i.id+"_"+i.current_iteration:i.id})(r))(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){Vn.error("Failed to persist survey seen state",n)}},UYe=[X6.Popover,X6.Widget,X6.API],BYe={ignoreConditions:!1,ignoreDelay:!1,displayType:ZM.Popover},zYe=Hs("[PostHog ExternalIntegrations]"),VYe={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class HYe{constructor(e){this._instance=e}ws(e,n){var s;(s=Ot.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return zYe.error("failed to load script",r);n()}))}startIfEnabledOrStop(){var e=this,n=function(){var i,a,o,l=s[0],u=s[1];!u||(i=Ot.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[l]||e.ws(VYe[l],(()=>{var d;(d=Ot.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[l])==null||d.start(e._instance)})),!u&&(a=Ot.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=Ot.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var s of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;n()}}}class GYe{constructor(e,n){this.I=e,this.ss=n,this.Co=new Map,this.ts=!1}add(e){var n=this;return Ns((function*(){if(n.ts)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Co.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');n.Co.set(e.name,e);try{var s=e.setup(n.ss);s&&(yield s)}catch(i){var r=n.Co.get(e.name)===e;r&&n.Co.delete(e.name),n.I.error('Failed to set up browser extension "'+e.name+'"',i),r&&n.To(e)}}))()}getExtension(e){return this.Co.get(e)}dispose(){if(!this.ts){this.ts=!0;var e=Array.from(this.Co.values()).reverse();for(var n of(this.Co.clear(),e))this.To(n)}}To(e){try{var n=e.dispose==null?void 0:e.dispose();n&&Xi(n.then)&&n.then(void 0,(s=>{this.I.error('Failed to dispose browser extension "'+e.name+'"',s)}))}catch(s){this.I.error('Failed to dispose browser extension "'+e.name+'"',s)}}}class WYe{constructor(e){this._instance=e}initialize(){}get(e){var n=this._instance.persistence;if(typeof e=="string")return n==null?void 0:n.get_property(e);var s={};for(var r of e){var i=n==null?void 0:n.get_property(r);Ue(i)||(s[r]=i)}return s}set(e,n){var s;(s=this._instance.persistence)==null||s.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)==null||n.unregister(e)}}var RX="extensionsRemoteConfig";class qYe{constructor(e){this.ts=!1,this.instance=e,this.I=Ze,this.Mo=e.Eo,this.kv=new WYe(e),this.onEvent=n=>lE(this.instance.on("eventCaptured",(s=>{try{n({event:s.event,properties:s.properties})}catch(r){this.I.error("Browser extension event listener failed",r)}}))),this.onRemoteConfig=n=>{if(this.ts)return lE((()=>{}));var s=i=>{try{n(i)}catch(a){this.I.error("Browser extension remote config listener failed",a)}},r=this.instance.Io.on(RX,s);return this.Mo&&s(this.Mo),lE(r)},this.Ro=new GYe(Ze.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(d2))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(d2);return typeof e=="string"?e:void 0}get library(){return{name:As.LIB_NAME,version:As.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,s,r,i=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=i==null?void 0:i.sessionId)!==null&&n!==void 0?n:"",windowId:(s=i==null?void 0:i.windowId)!==null&&s!==void 0?s:"",sessionStartTimestamp:(r=i==null?void 0:i.sessionStartTimestamp)!==null&&r!==void 0?r:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.Ro.add(e)}getExtension(e){return this.Ro.getExtension(e)}capture(e,n,s){var r=this;return Ns((function*(){s?r.instance.capture(e,n,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):r.instance.capture(e,n)}))()}registerDynamicEventProperties(e){return lE(this.instance.Po(e))}handleRemoteConfig(e){this.ts||(this.Mo=e,this.instance.Io.emit(RX,e))}sendRequest(e,n){var s=this;return Ns((function*(){var r;n===void 0&&(n={});var i=s.instance.requestRouter.endpointFor((r=n.target)!==null&&r!==void 0?r:"api",e),a={method:n.method,url:n.query?OS(i,n.query):i,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(s.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,s.instance._send_request(a)}
309))}))()}dispose(){this.ts||(this.ts=!0,this.Ro.dispose())}}var gb={},sI=0,Uk=()=>{},AX='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ly="Surveys module not available",NX="sanitize_properties is deprecated. Use before_send instead",jme="Invalid value for property_denylist config: ",KYe=["token","distinct_id",Fpe],p0="posthog",Pme=!AYe&&(Wa==null?void 0:Wa.indexOf("MSIE"))===-1&&(Wa==null?void 0:Wa.indexOf("Mozilla"))===-1,rI=t=>{var e;return $e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:KKe(Ve==null?void 0:Ve.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Uk,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:Xs&&jn(Xs==null?void 0:Xs.search)&&Xs.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:"fallback",enable_recording_console_log:void 0,secure_cookie:(we==null||(e=we.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){Ze.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:GM,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:tD},error_tracking:{},_onCapture:Uk},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:aYe,ignore_text_selection:!0}
309:!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),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},YYe=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],IX=t=>{var e={};for(var n of YYe){var s=n[0],r=n[1];Ue(t[s])||(e[r]=t[s])}var i=ws({},e,t),a=t.__preview_external_dependency_versioned_paths;return Ue(a)||(Ue(t.strict_script_versioning)&&(i.strict_script_versioning=!!a),jn(a)&&Ue(t.asset_host)&&(i.asset_host=a)),Qt(t.property_blacklist)&&(Ue(t.property_denylist)?i.property_denylist=t.property_blacklist:Qt(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ze.error(jme+t.property_denylist)),i};class ZYe{constructor(){this.__forceAllowLocalhost=!1}get Ao(){return this.__forceAllowLocalhost}set Ao(e){Ze.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class wo{Fo(e,n){if(e){var s=this.Co.indexOf(e);s!==-1&&this.Co.splice(s,1)}return this.Co.push(n),n.initialize==null||n.initialize(),n}Lo(){return this.config.cookieless_mode===ld||this.config.cookieless_mode===Pp&&this.consent.isRejected()}Oo(){if(!this.Lo()&&this.get_distinct_id()===Hg){var e=this.persistence;if(e){this.Do()||e.load(!0);var n=this.get_distinct_id();if(!n||n===Hg){var s=this.config.get_device_id(Nc());this.register({distinct_id:s,$device_id:s}),e.set_property(xn,Er)}this.$o()}}}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 ZYe,this.No=!1,this.version=As.LIB_VERSION,this.qo=new Set,this.jo="",this.Io=new $k,this.Co=[],this.Bo=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rI(),this.SentryIntegration=pYe,this.sentryIntegration=s=>(function(r,i){var a=rme(r,i);return{name:sme,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ho=!1,this.Uo=null,this.zo=null,this.Wo=null,this.scrollManager=new MYe(this),this.pageViewManager=new pX(this),this.rateLimiter=new _Ye(this),this.requestRouter=new FYe(this),this.consent=new tYe(this),this.externalIntegrations=new HYe(this);var n=(e=wo.__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:(s,r,i)=>{var a=jn(s)?{[s]:r}:s;this.setPersonProperties(a),i==null||i({})},set_once:(s,r,i)=>{var a=jn(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),i==null||i({})}},this.on("eventCaptured",(s=>Ze.info('send "'+(s==null?void 0:s.event)+'"',s)))}init(e,n,s){if(s&&s!==p0){var r,i=(r=gb[s])!==null&&r!==void 0?r:new wo;return i._init(e,n,s),gb[s]=i,gb[p0][s]=i,i}return this._init(e,n,s)}_init(e,n,s){var r,i;n===void 0&&(n={});var a,o=jn(e)?e.trim():"";if(!o)return Ze.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 o!==((a=this.config)==null?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+o+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=rI(n.defaults),n.debug=this.Vo(n.debug),this.Go=n,this.Zo=[],n.person_profiles?this.zo=n.person_profiles:n.process_person&&(this.zo=n.process_person);var l=rI(n.defaults),u=IX(n),d=ws({},l,u,{name:s,token:o});Ss(l.rageclick)&&Ss(u.rageclick)&&(d.rageclick=ws({},l.rageclick,u.rageclick)),Ss(l.session_recording)&&Ss(u.session_recording)&&(d.session_recording=ws({},l.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Ze.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ya.GZipJS;var f=this.Do();if(this.persistence=new Z6(this.config,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Z6($e({},this.config,{persistence:"sessionStorage"}),f,!1),this.jo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!f&&_s.Nr()){var p=_s.Br(this.jo);Qt(p)&&p.forEach((R=>{jn(R)&&this.qo.add(R)}))}else _s.qr(this.jo);var m=$e({},this.persistence.props),v=$e({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Qo=new LYe((R=>this.Jo(R)),this.config.request_queue_config),this.Ko=new PYe(this),this.__request_queue=[];var x=this.Lo();if(x||(this.sessionManager=new TX(this),this.sessionPropsManager=new EX(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((R,I,A)=>{(A!=null&&A.activityTimeout||A!=null&&A.sessionPastMaximumLength||A!=null&&A.crossTabAdoption)&&this.Yo()}))),this.Xo(),this.config.__preview_deferred_init_extensions?(Ze.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tl(x)}),0)):(Ze.info("Initializing extensions synchronously"),this.tl(x)),As.DEBUG=As.DEBUG||this.config.debug,As.DEBUG&&Ze.info("Starting in debug mode",{this:this,config:n,thisC:$e({},this.config),p:m,s:v}),!this.config.identity_distinct_id||(r=n.bootstrap)!=null&&r.distinctID||(n.bootstrap=$e({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((i=n.bootstrap)==null?void 0:i.distinctID)!==void 0){var y=n.bootstrap.distinctID,S=this.get_distinct_id(),_=this.persistence.get_property(xn);if(n.bootstrap.isIdentifiedID&&S!=null&&S!==y&&_===Er)this.identify(y);else if(n.bootstrap.isIdentifiedID&&S!=null&&S!==y&&_===$i)Ze.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 E=this.config.get_device_id(Nc()),T=n.bootstrap.isIdentifiedID?E:y;this.persistence.set_property(xn,n.bootstrap.isIdentifiedID?$i:Er),this.register({distinct_id:y,$device_id:T})}}if(x)this.register_once({distinct_id:Hg,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Nc());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(xn,Er)}return Ds(we,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(R,I){var A=R.config.segment;if(!A)return I();(function(L,j){var F=L.config.segment;if(!F)return j();var O=U=>{var G=()=>U.anonymousId()||Nc();L.config.get_device_id=G,U.id()&&(L.register({distinct_id:U.id(),$device_id:G()}),L.persistence.set_property(xn,$i)),j()},M=F.user();"then"in M&&Xi(M.then)?M.then(O):O(M)})(R,(()=>{A.register((L=>{typeof Promise<"u"&&Promise.resolve||K6.warn("This browser does not have Promise support, and can not use the segment integration");var j=(F,O)=>
309{if(!O)return F;F.event.userId||F.event.anonymousId===L.get_distinct_id()||(K6.info("No userId set, resetting PostHog"),L.reset()),F.event.userId&&F.event.userId!==L.get_distinct_id()&&(K6.info("UserId set, identifying with PostHog"),L.identify(F.event.userId));var M=L.calculateEventProperties(O,F.event.properties);return F.event.properties=Object.assign({},M,F.event.properties),F};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:F=>j(F,F.event.event),page:F=>j(F,h0),identify:F=>j(F,z6),screen:F=>j(F,"$screen")}})(R)).then((()=>{I()}))}))})(this,(()=>this.el())):this.el(),Xi(this.config._onCapture)&&this.config._onCapture!==Uk&&(Ze.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(R=>this.config._onCapture(R.event,R)))),this.config.ip&&Ze.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 kme.apply(this,arguments)})().then((R=>{R&&this.register({[U6]:R})})).catch(Uk),this}il(e){var n=e;return jn(n.name)&&Xi(n.setup)}rl(e,n){this.il(e)?n.push((()=>{this.nl().add(e).catch((()=>e.dispose==null?void 0:e.dispose())).catch((s=>{Ze.error('Failed to dispose browser extension "'+e.name+'"',s)}))})):this.Co.push(e)}Xo(){var e,n,s,r,i,a,o=(e=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&e!==void 0?e:(s=wo.__defaultExtensionClasses)==null?void 0:s.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||((r=this.sl)==null||r.call(this),this.sl=void 0,this.featureFlags=new o(this)),Xi(this.featureFlags.onReloading)&&Xi(this.featureFlags.setup)?this.sl||(this.sl=this.featureFlags.onReloading((()=>{this.Io.emit("featureFlagsReloading",!0)})),this.nl().add(this.featureFlags)):(i=(a=this.featureFlags).initialize)==null||i.call(a))}tl(e){var n,s,r,i,a,o,l,u=performance.now(),d=$e({},wo.__defaultExtensionClasses,this.config.__extensionClasses),f=[];d.exceptions&&this.Co.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new d.exceptions(this)),d.historyAutocapture&&this.Co.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Co.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Co.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.Co.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||f.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.rl(this.autocapture=new d.autocapture(this),f),d.surveys&&this.rl(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new d.surveys(this),f),d.logs&&this.rl(this.logs=(r=this.logs)!==null&&r!==void 0?r:new d.logs(this),f),d.metrics&&this.Co.push(this.metrics=(i=this.metrics)!==null&&i!==void 0?i:new d.metrics(this)),d.conversations&&this.Co.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new d.conversations(this)),d.productTours&&this.Co.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Co.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Co.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Co.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Co.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,hYe)),d.toolbar&&this.Co.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new d.toolbar(this)),d.experiments&&this.Co.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new d.experiments(this)),this.Co.forEach((p=>{p.initialize&&f.push((()=>{p.initialize==null||p.initialize()}))})),f.push((()=>{if(this.al){var p=this.al;this.al=void 0,this.Co.forEach((m=>m.onRemoteConfig==null?void 0:m.onRemoteConfig(p)))}})),this.ol(f,u)}ol(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout((()=>{this.ol(e,n)}),0);var s=e.shift();if(s)try{s()}catch(i){Ze.error("Error initializing extension:",i)}}
309var r=Math.round(performance.now()-n);this.register_for_session({[Upe]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Bpe]:r}),this.config.__preview_deferred_init_extensions&&Ze.info("PostHog extensions initialized ("+r+"ms)")}ga(e){var n;if(!Ve||!Ve.body)return Ze.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ga(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.al=e),this.Eo=e,this.compression=void 0,e.ok){var s,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=en(r.supportedCompression,ya.GZipJS)?ya.GZipJS:en(r.supportedCompression,ya.Base64)?ya.Base64:void 0),(s=r.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.zo?this.zo:GM}),(n=this.ll)==null||n.handleRemoteConfig(e),this.Co.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(e)))}el(){try{this.config.loaded(this)}catch(s){Ze.critical("`loaded` function failed",s)}if(this.ul(),this.config.internal_or_test_user_hostname&&Xs!=null&&Xs.hostname){var e=Xs.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.Lo())&&this.hl()}),1),this.dl=new pme(this),this.dl.load()}ul(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Qo)==null||e.enable())}_dom_loaded(){this.is_capturing()&&sE(this.__request_queue,(e=>this.Jo(e))),this.__request_queue=[],this.ul()}_handle_unload(){var e,n,s,r,i;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.vl()&&this.capture(B6),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.Qo)==null||r.unload(),(i=this.Ko)==null||i.unload()):this.vl()&&this.capture(B6,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Pme?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=$e({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(Ue(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 s,r,i,a=$e({},n);a.timeout=a.timeout||6e4;var o,l,u,d,f,p=(s=a.transport)!==null&&s!==void 0?s:"fetch";p==="sendBeacon"&&Ue(a.compression)&&a.data&&(a.compression=ya.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(f=(d=(Qt(o=a.data)?o:[o]).map((y=>$e({},y,y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{}))))[0])==null||(u=f.properties)==null?void 0:u.token)!==null&&l!==void 0?l:f==null?void 0:f.token,batch:d,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(y,S){return S===void 0&&(S=new Date().toISOString()),Qt(y)?y.map((_=>$e({},_,{sent_at:S}))):$e({},y,{sent_at:S})})(a.data))),a.url=_X(a.url,a.method,a.compression,a.timestampMode);var m=eT.filter((y=>!a.disableTransport||!y.transport||!a.disableTransport.includes(y.transport))),v=(r=(i=(function(y,S){for(var _=0;y.length>_;_++)if(y[_].transport===p)return y[_]})(m))==null?void 0:i.method)!==null&&r!==void 0?r:m[0].method;if(!v)throw new Error("No available transport method");var x=y=>{try{v(y)}catch(S){Eme(S)?Ze.warn(S):Ze.error(S),a.callback==null||a.callback({statusCode:0,error:S})}};p!=="sendBeacon"&&a.data&&a.compression===ya.GZipJS&&Hqe&&typeof Promise<"u"&&!JC?NYe(a).then((y=>{x(y)})).catch((y=>{if(FZ(y))return JC=!0,void x($e({},a,{compression:void 0,url:_X(n.url,n.method,void 0,n.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;var _="name"in S?String(S.name):"";return FZ(S)||_===Zhe})(y)&&(JC=!0),x(a)})):v(a)})($e({},e,{callback:n=>{var s,r;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Jo(e){this.Ko?this.Ko.retriableRequest(e):this._send_request(e)}_execute_array(e){sI++;try{var n,s=[],r=[],i=[];sE(e,(o=>{if(o)if(Qt(n=o[0]))i.push(o);else if(Xi(o))try{o.call(this)}catch(l){Ze.error("Error executing queued PostHog call",o,l)}else Qt(o)&&n==="alias"?s.push(o):Qt(o)&&n.indexOf("capture")!==-1&&Xi(this[n])?i.push(o):r.push(o)}));var a=function(o,l){sE(o,(function(u){try{if(Qt(u[0])){var d=l;ts(u,(function(f){d=d[f[0]].apply(d,f.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(f){Ze.error("Error executing queued PostHog call",u,f)}}))};a(s,this),a(r,this),a(i,this)}finally{sI--}}push(e){if(sI>0&&Qt(e)&&jn(e[0])){var n=wo.prototype[e[0]];Xi(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,s){var r,i,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Qo){if(this.is_capturing())if(!Ue(e)&&jn(e)){this.Oo();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var d=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(d==null||!d.isRateLimited){n!=null&&n.$current_url&&!jn(n==null?void 0:n.$current_url)&&(Ze.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"||s!=null&&s.cl||Ze.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 f=new Date,p=(s==null?void 0:s.timestamp)||f,m=HZ(s==null?void 0:s.uuid,Nc),v={uuid:m,event:e,properties:this.calculateEventProperties(e,n||{},p,m)};e===h0&&this.config.__preview_capture_bot_pageviews&&u&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),d&&(v.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);var x=e==="$feature_flag_called"&&v.properties.$feature_flag_has_experiment===!1&&this.get_property(kk)===!0;s!=null&&s.$set&&!x&&(v.$set=s==null?void 0:s.$set);var y=s==null?void 0:s.$unset;y&&(v.$unset=y);var S,_,E,T=x?void 0:this.fl(s==null?void 0:s.$set_once,e!==QZ,e===z6);if(T&&(v.$set_once=T),s!=null&&s._noTruncate||(i=this.config.properties_string_max_length,a=v,o=O=>
309jn(O)?O.slice(0,i):O,l=new Set,v=(function O(M,U){if(M!==Object(M))return o?o(M):M;if(!l.has(M)){var G;if(l.add(M),Qt(M))G=[],sE(M,(V=>{G.push(O(V))}));else{var $={};ts(M,((V,B)=>{l.has(V)||($[B]=O(V))})),G=$}return G}})(a)),v.timestamp=p,Ue(s==null?void 0:s.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=f),x&&(v.properties=(function(O,M){M===void 0&&(M=[]);var U={},G=$=>{O[$]!==void 0&&(U[$]=O[$])};return Gqe.forEach(G),M.forEach(G),U})(v.properties,KYe)),e===cd.DISMISSED||e===cd.SENT){var k=n==null?void 0:n[Q6.SURVEY_ID],R=n==null?void 0:n[Q6.SURVEY_ITERATION];Lme({id:k,current_iteration:R}),v.$set=$e({},v.$set,{[(S={id:k,current_iteration:R},_=e===cd.SENT?"responded":"dismissed",E="$survey_"+_+"/"+S.id,S.current_iteration&&S.current_iteration>0&&(E="$survey_"+_+"/"+S.id+"/"+S.current_iteration),E)]:!0})}else e===cd.SHOWN&&(v.$set=$e({},v.$set,{[Q6.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===wYe.SHOWN){var I=n==null?void 0:n[vX.TOUR_TYPE];I&&(v.$set=$e({},v.$set,{[vX.TOUR_LAST_SEEN_DATE+"/"+I]:new Date().toISOString()}))}var A=$e({},v.properties.$set,v.$set);if(Kl(A)||this.setPersonPropertiesForFlags(A),!an(this.config.before_send)){var L=this.Sn(v);if(!L)return;(v=L).uuid=HZ(v.uuid,Nc)}this.Io.emit("eventCaptured",v);var j=(r=s==null?void 0:s._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),F={method:"POST",url:j,data:v,compression:"best-available",timestampMode:(s==null?void 0:s._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(j)?"body":"capture-body",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Jo(F):this.Qo.enqueue(F),v}Ze.critical("This capture call is ignored due to client rate limiting.")}}else Ze.error("No event name provided to posthog.capture")}else Ze.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(n=>e(n.event,n)))}getExtension(e){var n;return(n=this.ll)==null?void 0:n.getExtension(e)}nl(){var e;return(e=this.ll)!==null&&e!==void 0?e:this.ll=new qYe(this)}Po(e){this.Bo.push(e);var n=!0;return()=>{if(n){n=!1;var s=this.Bo.indexOf(e);s!==-1&&this.Bo.splice(s,1)}}}pl(e){var n,s,r;return e===void 0&&(e=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Wo=null,this.persistence.get_property(xn)===Er&&((r=this.sessionPersistence)==null||r.clear(),this.qo.clear(),this.gl()),(s=this.featureFlags)==null||s.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,s,r,i){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.pl();var a=i?void 0:this.persistence.remove_event_timer(e),o=$e({},n);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Lo()&&(o[Fpe]=!0),e==="$snapshot"){var l=$e({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!jn(o.distinct_id)&&!Lr(o.distinct_id)||gk(o.distinct_id))&&Ze.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,d=(function(k,R,I,A){var L,j,F,O;if(A===void 0&&(A=!1),!Wa)return{};var M,U=k?[...t1,...R||[]]:[],G=(function(Xe){for(var he=0;zZ.length>he;he++){var De=zZ[he],Ge=De[1],Je=De[0].exec(Xe),Le=Je&&(Xi(Ge)?Ge(Je,Xe):Ge);if(Le)return Le}return["",""]})(Wa),$=G[0],V=G[1],B=(M=typeof navigator<"u"?navigator:void 0)!=null&&M.brave?{brave:!0}:{},q={};Ue(I)||(q.detectGoogleSearchApp=I);var z={},D=(L=navigator)==null||(L=L.userAgentData)==null?void 0:L.platform,K=(j=navigator)==null?void 0:j.maxTouchPoints,Y=we==null||(F=we.screen)==null?void 0:F.width,J=we==null||(O=we.screen)==null?void 0:O.height,ne=we==null?void 0:we.devicePixelRatio;Ue(D)||(z.userAgentDataPlatform=D),Ue(K)||(z.maxTouchPoints=K),Ue(Y)||(z.screenWidth=Y),Ue(J)||(z.screenHeight=J),Ue(ne)||(z.devicePixelRatio=ne);var Q,ee,te,ue,ye,je,Re,me,Ce=ws(E$({$os:$,$os_version:V,$browser:_pe(Wa,navigator.vendor,B,q),$device:VZ(Wa),$device_type:(ee=Wa,te=z,me=VZ(ee),me===ipe||me===rpe||me==="Kobo"||me==="Kindle Fire"||me===xpe?Yv:me===c2||me===sv||me===u2||me===kM?"Console":me===ope?"Wearable":me?No:(te==null?void 0:te.userAgentDataPlatform)==="Android"&&((ue=te==null?void 0:te.maxTouchPoints)!==null&&ue!==void 0?ue:0)>0?600>Math.min((ye=te==null?void 0:te.screenWidth)!==null&&ye!==void 0?ye:0,(je=te==null?void 0:te.screenHeight)!==null&&je!==void 0?je:0)/((Re=te==null?void 0:te.devicePixelRatio)!==null&&Re!==void 0?Re:1)?No:Yv:"Desktop"),$timezone:hme(),$timezone_offset:yYe()}),{$current_url:p2(A?jh(Xs==null?void 0:Xs.href):Xs==null?void 0:Xs.href,U,m2),$host:Xs==null?void 0:Xs.host,$pathname:Xs==null?void 0:Xs.pathname,$raw_user_agent:Wa.length>1e3?Wa.substring(0,997)+"...":Wa,$browser_version:pKe(Wa,navigator.vendor,B,q),$browser_language:mX(),$browser_language_prefix:(Q=mX(),typeof Q=="string"?Q.split("-")[0]:void 0),$screen_height:we==null?void 0:we.screen.height,$screen_width:we==null?void 0:we.screen.width,$viewport_height:we==null?void 0:we.innerHe
309ight,$viewport_width:we==null?void 0:we.innerWidth,$lib:As.LIB_NAME,$lib_version:As.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return As.SDK_DIST_CHANNEL&&(Ce.$sdk_dist_channel=As.SDK_DIST_CHANNEL),Ce})(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 f=this.sessionManager.checkAndGetSessionAndWindowId(i,s.getTime(),!0),p=f.windowId;o.$session_id=f.sessionId,o.$window_id=p}this.sessionPropsManager&&ws(o,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&ws(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(m=this.Ko)==null?void 0:m.length}catch(k){o.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===nD&&(o.$lib_custom_api_host=this.config.api_host),u=e!==h0||i?e!==B6||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=ws(o,u),e===h0&&Ve&&(o.title=Ve.title),!Ue(a)){var v=s.getTime()-a;o.$duration=parseFloat((v/1e3).toFixed(3))}Wa&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var x=this.persistence.properties(),y=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(k=>{k in x&&delete y[k]}));var S={};if(this.Bo.length>0)for(var _ of this.Bo.slice())try{ws(S,_())}catch(k){Ze.error("Failed to produce browser extension event properties",k)}(o=ws({},d,x,y,$e({},S,o))).$is_identified=this._isIdentified(),Qt(this.config.property_denylist)?ts(this.config.property_denylist,(function(k){delete o[k]})):Ze.error(jme+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(Ze.error(NX),o=E(o,e));var T=this.ml();return o.$process_person_profile=T,T&&!i&&this.yl("_calculate_event_properties"),o}fl(e,n,s){var r;if(n===void 0&&(n=!0),s===void 0&&(s=!1),!this.persistence||!this.ml()||this.No&&!s)return e;var i=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=ws({},i,a||{},e||{}),l=this.config.sanitize_properties;return l&&(Ze.error(NX),o=l(o,"$set_once")),n&&(this.No=!0),Kl(o)?void 0:o}register(e,n){var s;(s=this.persistence)==null||s.register(e,n)}register_once(e,n,s){var r;(r=this.persistence)==null||r.register_once(e,n,s)}register_for_session(e){var n,s;(n=this.persistence)==null||n.syncCookieProperties(),this.pl(),(s=this.sessionPersistence)==null||s.register(e),Object.keys(e).forEach((r=>this.qo.add(r))),this.gl()}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e),this.qo.delete(e),this.gl()}bl(e,n){this.register({[e]:n})}Yo(){this.qo.forEach((e=>{var n;(n=this.sessionPersistence)==null||n.unregister(e)})),this.qo.clear(),this.gl()}gl(){var e;if(this.jo)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.Us||!_s.Nr())_s.qr(this.jo);else{var n=[];this.qo.forEach((s=>n.push(s))),n.length>0?_s.Dr(this.jo,n):_s.qr(this.jo)}}getFeatureFlag(e,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var s;return(s=this.featureFlags)==null?void 0:s.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 s,r;return(s=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n))!==null&&s!==void 0?s:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,n,s)}updateEarlyAccessFeatureEnrollment(e,n,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,n,s)}getEarlyAccessFeatures(e,n,s){var r;return n===void 0&&(n=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,n,s)}on(e,n){return this.Io.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:ly}),()=>{})}onSessionId(e){var n,s;return(n=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&n!==void 0?n:()=>{}}
309getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:ly})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:ly})}renderSurvey(e,n){var s;(s=this.surveys)==null||s.renderSurvey(e,n)}displaySurvey(e,n){var s;n===void 0&&(n=BYe),(s=this.surveys)==null||s.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,s;return(n=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:ly}}canRenderSurveyAsync(e,n){var s,r;return n===void 0&&(n=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,n))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:ly})}_l(e){return!e||gk(e)?(Ze.critical("Unique user id has not been set in posthog.identify"),!1):e===Hg?(Ze.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())||(Ze.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,s){if(!this.__loaded||!this.persistence)return Ze.uninitializedWarning("posthog.identify");if(Lr(e)&&(e=e.toString(),Ze.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._l(e)&&this.yl("posthog.identify")){this.Oo();var r=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.pl(!1),o=this.persistence.Vs(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property(d2)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property(L0)&&(this.unregister(L0),this.register({distinct_id:e}));var d,f=(this.persistence.get_property(xn)||Er)===Er,p=e!==u,m=!p&&f;if(p&&f)this.persistence.set_property(xn,$i),this.setPersonPropertiesForFlags({$set:n||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Gs(),this.capture(z6,{distinct_id:e,$anon_distinct_id:u},{$set:n||{},$set_once:s||{}}),this.Wo=nI(e,n,s),(d=this.featureFlags)==null||d.setAnonymousDistinctId(u);else if(m){this.persistence.set_property(xn,$i);var v=n||{},x=s||{};this.setPersonPropertiesForFlags({$set:v,$set_once:x},!1),this.config.cookieWinsOnConflict&&this.persistence.Gs(),this.capture("$set",{$set:v,$set_once:x}),this.Wo=nI(e,n,s)}else(n||s)&&this.setPersonProperties(n,s);p||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(od)):m&&(n||s)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Js(l)}}}setPersonProperties(e,n){if((e||n)&&this.yl("posthog.setPersonProperties")){var s=nI(this.get_distinct_id(),e,n);this.Wo!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Wo=s):Ze.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,s=(Qt(e)?e:[e]).filter((r=>jn(r)&&r.length>0));s.length!==0&&this.yl("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Wo=null)}group(e,n,s){var r;if(e&&n){(r=this.persistence)==null||r.syncCookieProperties(),this.pl();var i=this.getGroups(),a=i[e]!==n;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:$e({},i,{[e]:n})}),a||s){var o={$group_type:e,$group_key:n};s&&(o.$group_set=s),this.capture(QZ,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),a&&!s&&this.reloadFeatureFlags()}else Ze.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var s;n===void 0&&(n=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var s;n===void 0&&(n=!0),this.yl("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n=_a(e)?e:e==null?void 0:e.resetDeviceID,s=_a(e)||e==null?void 0:e.bootstrap;this.wl(n,!1,s)}wl(e,n,s){var r,i,a;if(n===void 0&&(n=!1),Ze.info("reset"),!this.__loaded)return Ze.uninitializedWarning("posthog.reset");var o=s==null?void 0:s.sessionID;this.config.bootstrap=s||((r=this.Go)==null?void 0:r.bootstrap)||{},(i=this.featureFlags)==null||i.updateConfig==null||i.updateConfig(this.config,this.ma());var l=this.get_property(d2),u=this.get_property(U6),d=this.get_property(Yp),f=this.is_capturing();this.consent.reset(),n||!f||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var p=(a=this.persistence)==null||a.Vs==null?void 0:a.Vs(),m=!1;try{var v,x,y,S,_,E,T,k,R,I,A,L,j;if((v=this.persistence)==null||v.clear(),(x=this.sessionPersistence)==null||x.clear(),this.qo.clear(),this.gl(),Ue(d)||(I=this.persistence)==null||I.register({[Yp]:d}),(y=this.surveys)==null||y.reset(),(S=this.featureFlags)==null||S.reset(),(_=this.conversations)==null||_.reset(),(E=this.logs)==null||E.reset(),(T=this.metrics)==null||T.reset(),(k=this.persistence)==null||k.set_property(xn,Er),(
309R=this.sessionManager)==null||R.resetSessionId(),this.Wo=null,this.config.cookieless_mode===ld)this.register_once({distinct_id:Hg,$device_id:null},"");else{var F=this.config.get_device_id(Nc());this.register_once({distinct_id:F,$device_id:e?F:l},""),e||Ue(u)||this.register({[U6]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID===void 0||this.Lo()||((j=this.persistence)==null||j.set_property(xn,s.isIdentifiedID?$i:Er),this.register({distinct_id:s.distinctID})),(A=this.featureFlags)==null||A.initialize(),!(Ue(o)||(L=this.sessionManager)!=null&&L.setBootstrapSessionId(o,!0)))){var O=$e({},s);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,m=!0}finally{var M;p&&((M=this.persistence)==null||M.Js==null||M.Js(m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return Ns((function*(){var s,r,i,a,o;if(n.__loaded){n.nl().dispose(),(s=n.sessionRecording)==null||s.dispose(),(r=n.logs)==null||r.flushLogs("sendBeacon"),(i=n.metrics)==null||i.flush("sendBeacon"),(a=n.Qo)==null||a.unload(),(o=n.Ko)==null||o.unload();try{var l;(l=n.featureFlags)==null||l.destroy()}catch(u){Ze.error("Error while destroying feature flags",u)}}else Ze.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,n){var s;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(s=this.conversations)==null||s.kl()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Sl()}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),s=n.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(e!=null&&e.withTimestamp&&s){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,n){return e===this.get_property(Lpe)?(Ze.critical("Attempting to create alias for existing People user - aborting."),-2):this.yl("posthog.alias")?(Ue(n)&&(n=this.get_distinct_id()),e!==n?(this.bl(L0,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(Ze.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=$e({},this.config);if(Ss(e)){var s,r,i,a,o,l,u,d,f,p,m,v;ws(this.config,IX(e));var x=this.Do();(s=this.persistence)==null||s.update_config(this.config,n,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Z6($e({},this.config,{persistence:"sessionStorage"}),x,!1);var y,S=this.Vo(this.config.debug);_a(S)&&(this.config.debug=S),_a(this.config.debug)&&(this.config.debug?(As.DEBUG=!0,ds.Nr()&&ds.Dr("ph_debug",!0),Ze.info("set_config",{config:e,oldConfig:n,newConfig:$e({},this.config)})):(As.DEBUG=!1,ds.Nr()&&ds.qr("ph_debug"))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.ma()),(i=this.exceptionObserver)==null||i.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(d=this.heatmaps)==null||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((y=this.historyAutocapture)==null||y.startIfEnabledOrStop()),(f=this.exceptionObserver)==null||f.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(m=this.surveys)==null||m.loadIfEnabled(),this.$o(),(v=this.externalIntegrations)==null||v.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){As.LIB_NAME=e,As.LIB_VERSION=n}startSessionRecording(e){var n,s,r,i,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.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 s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent($e({},r,n))}}addExceptionStep(e,n){var s;(s=this.exceptions)==null||s.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:wo.xl}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,s;return(n=(s=this.toolbar)==null?void 0:s.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:p0;return n!==p0&&(n=p0+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(xn))===$i||((n=this.sessionPersistence)==null?void 0:n.get_property(xn))===$i}ml(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===GM&&!this._isIdentified()&&Kl(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[L0])&&((n=this.persistence)==null||(n=n.props)==null||!n[Nk]))}vl(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.ml()||this.yl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.yl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}yl(e){return this.config.person_profiles==="never"?(Ze.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bl(Nk,!0),!0)}Do(){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!==Pp)}$o(){var e,n,s,r,i=this.Do();return((e=this.persistence)==null?void 0:e.Us)!==i&&((s=this.persistence)==null||s.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.Us)!==i&&((r=this.sessionPersistence)==null||r.set_disabled(i)),i&&(this.qo.clear(),this.gl()),i}opt_in_capturing(e){var n;
309if(this.config.cookieless_mode!==ld){if(this.Lo()){var s,r,i,a,o;this.wl(!0,!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new TX(this),this.pageViewManager=new pX(this),this.persistence&&(this.sessionPropsManager=new EX(this,this.sessionManager,this.persistence));var l,u=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(o=wo.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Fo(this.sessionRecording,new u(this)),this.Eo&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Eo)))}var d,f;this.consent.optInOut(!0),this.$o(),this.ul(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Pp&&((d=this.surveys)==null||d.loadIfEnabled()),(Ue(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((f=e==null?void 0:e.captureEventName)!==null&&f!==void 0?f:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hl()}else Ze.warn(AX)}opt_out_capturing(){var e,n,s;this.config.cookieless_mode!==ld?(this.config.cookieless_mode===Pp&&this.consent.isOptedIn()&&this.wl(!0,!0),this.consent.optInOut(!1),this.$o(),this.config.cookieless_mode===Pp&&(this.register({distinct_id:Hg,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hl(),this.ul())):Ze.warn(AX)}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===ld||(this.config.cookieless_mode===Pp?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$o()}_is_bot(){return Aa?Tme(Aa,this.config.custom_blocked_useragents):void 0}hl(){Ve&&(Ve.visibilityState==="visible"?this.Ho||(this.Ho=!0,this.capture(h0,{title:Ve.title},{send_instantly:!0}),this.Uo&&(Ve.removeEventListener(Qv,this.Uo),this.Uo=null)):this.Uo||(this.Uo=this.hl.bind(this),Ds(Ve,Qv,this.Uo)))}debug(e){e===!1?(we==null||we.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(we==null||we.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}))}ma(){var e=this.Go||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Ze.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):(function(n,s,r,i,a){var o=s in n&&!an(n[s]),l=r in n&&!an(n[r]);return o?n[s]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+s+"' instead. The old field will be removed in a future major version."),n[r])})(e,"advanced_disable_flags","advanced_disable_decide",0,Ze)}Sn(e){var n;if(an(this.config.before_send))return e;var s=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(nKe),r=Qt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var a of r)try{if(i=a(i),an(i)){var o="Event '"+e.event+"' was rejected in beforeSend function";return tKe(e.event)?Ze.warn(o+". This can cause unexpected behavior."):Ze.info(o),null}i.properties&&!Kl(i.properties)||Ze.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(u){return Ze.error("Error in beforeSend function for event '"+e.event+"':",u),null}for(var l of s)if(i.properties&&an(i.properties[l]))return Ze.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var e;
309return(e=this.pageViewManager.xs)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(s)})}Vo(e){var n=_a(e)&&!e,s=ds.Nr()&&ds.Pr("ph_debug")==="true";return!n&&(!!s||e)}}wo.__defaultExtensionClasses={},wo.xl=(()=>{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]]=WKe(t.prototype[e[n]])})(wo,["identify"]);class Mme{constructor(e){this.disabled=e===!1;var n=Ss(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,s){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>s-r.timestamp){if(this.clicks.push({x:e,y:n,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:s}];return!1}}var iI="$copy_autocapture",uE=Hs("[AutoCapture]");function aI(t,e){return e.length>t?e.slice(0,t)+"...":e}function XYe(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Ph(e));return e}function QYe(t,e){var n,s,r=e.e,i=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Ph(t))return{props:{}};for(var d=[t],f=new Set([t]),p=t;p.parentNode&&!Co(p,"body")&&Ype>d.length;)if(Kpe(p.parentNode)){var m=p.parentNode.host;if(f.has(m))break;f.add(m),d.push(m),p=m}else{if(!Ph(p.parentNode)||f.has(p.parentNode))break;f.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var v,x,y=[],S={},_=!1,E=!1;if(ts(d,(A=>{var L=YM(A);if(Co(A,"a")){var j=A.getAttribute("href");_=!!(L&&j&&pb(j))&&(u?jh(j):j)}en(Pk(A),"ph-no-capture")&&(E=!0),y.push((function(O,M,U,G,$){$===void 0&&($=!1);var V=O.tagName.toLowerCase(),B={tag_name:V};T$.indexOf(V)>-1&&!U&&(B.$el_text=V.toLowerCase()==="a"||V.toLowerCase()==="button"?aI(1024,dX(O)):aI(1024,h2(O)));var q=Pk(O);q.length>0&&(B.classes=q.filter((function(Y){return Y!==""}))),ts(O.attributes,(function(Y){var J;if((!tme(O)||["name","id","class","aria-label"].indexOf(Y.name)!==-1)&&(G==null||!G.includes(Y.name))&&
309!M&&pb(Y.value)&&(!jn(J=Y.name)||J.substring(0,10)!=="_ngcontent"&&J.substring(0,7)!=="_nghost")){var ne=Y.value;Y.name==="class"&&(ne=C$(ne).join(" ")),B["attr__"+Y.name]=aI(1024,Y.name==="href"&&$?jh(ne):ne)}}));for(var z=1,D=1,K=O;K=XYe(K);)z++,K.tagName===O.tagName&&D++;return B.nth_child=z,B.nth_of_type=D,B})(A,i,a,o,u));var F=(function(O){if(!YM(O))return{};var M={};return ts(O.attributes,(function(U){if(U.name&&U.name.indexOf("data-ph-capture-attribute")===0){var G=U.name.replace("data-ph-capture-attribute-",""),$=U.value;G&&$&&pb($)&&(M[G]=$)}})),M})(A);ws(S,F)})),E)return{props:{},explicitNoCapture:E};if(a||(y[0].$el_text=Co(t,"a")||Co(t,"button")?dX(t):h2(t)),_){var T,k;y[0].attr__href=_;var R=(T=Jv(_))==null?void 0:T.host,I=we==null||(k=we.location)==null?void 0:k.host;R&&I&&R!==I&&(v=_)}return{props:ws({$event_type:r.type,$ce_version:1},l?{}:{$elements:y},{$elements_chain:(x=y,(function(A){return A.map((L=>{var j,F,O="";if(L.tag_name&&(O+=L.tag_name),L.attr_class)for(var M of(L.attr_class.sort(),L.attr_class))O+="."+M.replace(/"/g,"");var U=$e({},L.text?{text:L.text}:{},{"nth-child":(j=L.nth_child)!==null&&j!==void 0?j:0,"nth-of-type":(F=L.nth_of_type)!==null&&F!==void 0?F:0},L.href?{href:L.href}:{},L.attr_id?{attr_id:L.attr_id}:{},L.attributes),G={};return QC(U).sort((($,V)=>$[0].localeCompare(V[0]))).forEach(($=>{var V=$[1];return G[fX($[0].toString())]=fX(V.toString())})),(O+=":")+QC(G).map(($=>$[0]+'="'+$[1]+'"')).join("")})).join(";")})((function(A){return A.map((L=>{var j,F,O={text:(j=L.$el_text)==null?void 0:j.slice(0,400),tag_name:L.tag_name,href:(F=L.attr__href)==null?void 0:F.slice(0,2048),attr_class:dYe(L),attr_id:L.attr__id,nth_child:L.nth_child,nth_of_type:L.nth_of_type,attributes:{}};return QC(L).filter((M=>M[0].indexOf("attr__")===0)).forEach((M=>O.attributes[M[0]]=M[1])),O}))})(x)))},(n=y[0])!=null&&n.$el_text?{$el_text:(s=y[0])==null?void 0:s.$el_text}:{},v&&r.type==="click"?{$external_click_url:v}:{},S)}}class JYe{constructor(e){this.name="autocapture",this.Jn=!1,this.Kn=null,this.Yn=!1,this.Xn=!1,this.ji={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.ts=!1,this.es=e,this.es.refresh(this.ji),this.rageclicks=new Mme(this.ji.rageclick),this.rs=null}setup(e){this.ns(),this.ss=e;var n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.ts?n.dispose():(this.os=n,this.startIfEnabled())}dispose(){var e;this.ts||(this.ts=!0,this.ss=void 0,(e=this.os)==null||e.dispose(),this.os=void 0,this.ls())}us(){return this.es.refresh(this.ji),this.ji}ns(){var e,n;return this.us(),this.ji.url_allowlist=(e=this.ji.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),this.ji.url_ignorelist=(n=this.ji.url_ignorelist)==null?void 0:n.map((s=>new RegExp(s))),this.ji}hs(){if(this.isBrowserSupported()){if(we&&Ve){var e=this.ds=s=>{s=s||(we==null?void 0:we.event);try{this.vs(s)}catch(r){uE.error("Failed to capture event",r)}};if(Ds(Ve,"submit",e,{capture:!0}),Ds(Ve,"change",e,{capture:!0}),Ds(Ve,"click",e,{capture:!0}),this.us().capture_copied_text){var n=this.cs=s=>{s=s||(we==null?void 0:we.event);try{this.vs(s,iI)}catch(r){uE.error("Failed to capture copy/cut event",r)}};Ds(Ve,"copy",n,{capture:!0}),Ds(Ve,"cut",n,{capture:!0})}}}else uE.info("Disabling Automatic Event Collection because this browser is not supported")}ls(){this.ds&&(Ve==null||Ve.removeEventListener("submit",this.ds,!0),Ve==null||Ve.removeEventListener("change",this.ds,!0),Ve==null||Ve.removeEventListener("click",this.ds,!0),this.ds=void 0),this.cs&&(Ve==null||Ve.removeEventListener("copy",this.cs,!0),Ve==null||Ve.removeEventListener("cut",this.cs,!0),this.cs=void 0),this.Jn=!1}startIfEnabled(){!this.ts&&this.ss&&this.isEnabled&&!this.Jn&&(this.hs(),this.Jn=!0)}onRemoteConfig(e){if(!this.ts)if(this.Yn=!0,e.ok){var n=e.config;
309n.elementsChainAsString&&(this.Xn=n.elementsChainAsString);var s,r=n.autocapture_opt_out;_a(r)&&((s=this.ss)==null||s.kv.set(IM,r),this.Kn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.rs=e}getElementSelectors(e){var n,s=[];return(n=this.rs)==null||n.forEach((r=>{var i=Ve==null?void 0:Ve.querySelectorAll(r);i==null||i.forEach((a=>{e===a&&s.push(r)}))})),s}get isEnabled(){var e,n;if(this.ts)return!1;var s=(e=this.ss)==null?void 0:e.kv.get(IM),r=this.Kn,i=this.us(),a=i.remoteRequestsDisabled&&!this.Yn;if(zi(r)&&!_a(s)&&!a)return!1;var o=(n=this.Kn)!==null&&n!==void 0?n:!!s;return!!i.enabled&&!o}vs(e,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var s=qM(e);qpe(s)&&(s=s.parentNode||null);var r,i=this.ns();n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&i.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Jpe(s,i.rageclick)&&this.vs(e,"$rageclick");var a=n===iI;if(s&&(function(v,x,y,S,_,E){var T;if(!we||k$(v)||y!=null&&y.url_allowlist&&!rX(y.url_allowlist,E)||y!=null&&y.url_ignorelist&&rX(y.url_ignorelist,E))return!1;if(y!=null&&y.dom_event_allowlist){var k=y.dom_event_allowlist;if(k&&!k.some((F=>x.type===F)))return!1}var R=eme(v,S),I=R.parentIsUsefulElement,A=R.targetElementList;if(!(function(F,O){var M=O==null?void 0:O.element_allowlist;if(Ue(M))return!0;var U,G=function(V){if(M.some((B=>V.tagName.toLowerCase()===B)))return{v:!0}};for(var $ of F)if(U=G($))return U.v;return!1})(A,y)||!KM(A,y==null?void 0:y.css_selector_allowlist)||KM(A,(T=y==null?void 0:y.css_selector_ignorelist)!==null&&T!==void 0?T:iYe))return!1;try{var L=we.getComputedStyle(v);if(L&&L.getPropertyValue("cursor")==="pointer"&&x.type==="click")return!0}catch{}var j=v.tagName.toLowerCase();switch(j){case"html":return!1;case"form":return(_||["submit"]).indexOf(x.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(x.type)>=0;default:return I?(_||["click"]).indexOf(x.type)>=0:(_||["click"]).indexOf(x.type)>=0&&(T$.indexOf(j)>-1||v.getAttribute("contenteditable")==="true")}})(s,e,i,a,a?["copy","cut"]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var o,l=QYe(s,{e,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.Xn,disableCaptureUrlHashes:i.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var d=this.getElementSelectors(s);if(d&&d.length>0&&(u.$element_selectors=d),n===iI){var f,p=Zpe(we==null||(f=we.getSelection())==null?void 0:f.toString()),m=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=m}return(o=this.ss)==null||o.capture(n,u).catch((v=>uE.error("Failed to capture event",v))),!0}}}isBrowserSupported(){return Xi(Ve==null?void 0:Ve.querySelectorAll)}}class eZe{constructor(e){this._instance=e}refresh(e){var n=this._instance.config,s=Ss(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.ma(),e.url_allowlist=s==null?void 0:s.url_allowlist,e.url_ignorelist=s==null?void 0:s.url_ignorelist,e.dom_event_allowlist=s==null?void 0:s.dom_event_allowlist,e.element_allowlist=s==null?void 0:s.element_allowlist,e.css_selector_allowlist=s==null?void 0:s.css_selector_allowlist,e.css_selector_ignorelist=s==null?void 0:s.css_selector_ignorelist,e.element_attribute_ignorelist=s==null?void 0:s.element_attribute_ignorelist,e.capture_copied_text=s==null?void 0:s.capture_copied_text}}var cy=Hs("[ExceptionAutocapture]"),LX=()=>{},tZe=Hs("[TracingHeaders]"),yp=Hs("[Web Vitals]"),jX=9e5,PX=["CLS","FCP","INP","LCP"],nZe=["INP","LCP"],sZe=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],MX="disabled",DX="lazy_loading",uy="awaiting_config",dE="missing_config";Hs("[SessionRecording]"),Hs("[SessionRecording]");var sD="[SessionRecording]",Ou=Hs(sD),rZe=Hs("[Heatmaps]");function oI(t){return Ss(t)&&"clientX"in t&&"clientY"in t&&Lr(t.clientX)&&Lr(t.clientY)}var fE=Hs("[Product Tours]"),lI=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(S$))},iZe=["$set_once","$set"],vc=Hs("[SiteApps]"),OX="Error while initializing PostHog app with config id ",Dme=(t,e)=>t!=null&&t.then?t.then(e):e(t),qg="SDK is not enabled or survey functionality is not yet loaded",$X="Disabled. Not loading surveys.";class aZe{constructor(e,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Cl=!1,this.Tl=[],this.Ml=null,this.El=null,this.ts=!1,this.Il=new Set,this.onRemoteConfig=s=>{if(!this.ts&&!this.ji.disableSurveys){if(!s.ok)return Vn.warn("Remote config unavailable. Not loading surveys.");var r=s.config.surveys;if(an(r))return Vn.warn("Flags not loaded yet. Not loading surveys.");this.Rl=_a(r)?r:r.length>0,Vn.info("flags response received, isSurveysEnabled: "+this.Rl),this.loadIfEnabled()}},this.es=e,this.Pl=n}setup(e){if(!this.ts)return this.Al=e,Dme(e.kv.initialize(),(()=>{if(this.Al===e&&!this.ts){this.Al=void 0,this.ss=e;var n=e.onRemoteConfig(this.onRemoteConfig);this.ts?n.dispose():(this.os=n,this.loadIfEnabled())}}))}dispose(){var e,n,s;this.ts||(this.ts=!0,this.Al=void 0,this.ss=void 0,(e=this.os)==null||e.dispose(),this.os=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(s=this._surveyManager)==null||s.dispose==null||s.dispose(),this._surveyManager=null,this.Tl=[],this.Ml=null,this.Il.forEach((r=>clearTimeout(r))),this.Il.clear())}get ji(){return this.es.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],s=0;s<localStorage.length;s++){var r=localStorage.key(s);(r!=null&&r.startsWith(Ime)||r!=null&&r.startsWith("inProgressSurvey_"))&&n.push(r)}n.forEach((i=>localStorage.removeItem(i)))}catch{}}loadIfEnabled(){if(!this.ts&&this.ss){var e=this.ji;if(!this._surveyManager)if(this.Cl)Vn.info("Already initializing surveys, skipping...");else if(e.disableSurveys)Vn.info($X);else if(e.cookielessMode&&this.es.isOptedOut())Vn.info("Not loading surveys in cookieless mode without consent.");else{var n=this.es.getExtensions();if(n){if(!Ue(this.Rl)||e.advancedEnableSurveys){var s=this.Rl||e.advancedEnableSurveys;this.Cl=!0;try{var r=n.generateSurveys;if(r)return this.Fl(r,s),void(this.Cl=!1);var i=n.loadExternalDependency;if(!i)return this.Ll(_$),void(this.Cl=!1);i((a=>{try{if(this.ts)return;var o=this.es.getExtensions();a||o==null||!o.generateSurveys?this.Ll("Could not load surveys script",a):this.Fl(o.generateSurveys,s)}finally{this.Cl=!1}}))}catch(a){throw this.Cl=!1,this.Ll("Error initializing surveys",a),a}}}else Vn.error("PostHog Extensions not found.")}}}Fl(e,n){this.ts||(this._surveyManager=e(n),this._surveyEventReceiver=this.es.createEventReceiver(),Vn.info("Surveys loaded successfully"),this.Ol({isLoaded:!0}))}Ll(e,n){Vn.error(e,n),this.Ol({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Tl.push(e),this._surveyManager&&this.Ol({isLoaded:!0}),()=>{this.Tl=this.Tl.filter((n=>n!==e))}}getSurveys(e,n){var s;n===void 0&&(n=!1);var r=(s=this.ss)!==null&&s!==void 0?s:this.Pl;if(r&&!this.ts){if(this.ji.disableSurveys)return Vn.info($X),e([]);var i=r.kv.get($M);if(i&&!n)return e(i,{isLoaded:!0}
309),void(this.Dl()&&this.getSurveys((()=>{}),!0));if(this.Ml)this.Ml.then((l=>{this.ts||e(l.surveys,l.context)})).catch((l=>Vn.error("Error in survey callback",l)));else{var a=this.$l("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.ji.requestTimeoutMs}).then((l=>{try{return this.Nl(r,l)}catch(u){return Vn.error("Error processing surveys response",u),this.Nl(r,{statusCode:0,error:u})}}),(l=>this.Nl(r,{statusCode:0,error:l})));this.Ml=a;var o=()=>{this.Ml===a&&(this.Ml=null)};a.then((l=>{o(),this.ts||e(l.surveys,l.context)}),o).catch((l=>Vn.error("Error in survey callback",l)))}}}$l(e,n){var s=this.ss;return s?s.sendRequest(e,n):new Promise((r=>r({statusCode:0,error:new Error(qg)})))}Nl(e,n){if(this.ts)return{surveys:[],context:{isLoaded:!1,error:qg}};var s=n.statusCode;if(s!==200||!n.json){var r="Surveys API could not be loaded, status: "+s;return s!==0?Vn.error(r):n.error||Vn.warn(r),this.El=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.El=null;var i,a=n.json.surveys||[],o=a.filter((l=>(function(u){return!(!u.start_date||u.end_date)})(l)&&(Rme(l)||(function(u){var d;return!((d=u.conditions)==null||(d=d.actions)==null||(d=d.values)==null||!d.length)})(l))));return o.length>0&&((i=this._surveyEventReceiver)==null||i.register(o)),e.kv.set({[$M]:a,[Rk]:Date.now()}),{surveys:a,context:{isLoaded:!0}}}Dl(){return this.ql()&&!this.Ml&&!this.jl()}ql(){var e,n,s=(e=(n=this.ss)!==null&&n!==void 0?n:this.Pl)==null?void 0:e.kv.get(Rk);return Lr(s)&&Date.now()-s>3e5}jl(){return Lr(this.El)&&3e5>Date.now()-this.El}markSurveyAsSeen(e,n){var s,r={id:e,current_iteration:(s=n==null?void 0:n.iteration)!==null&&s!==void 0?s:null};Lme(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Ol(e){for(var n of this.Tl)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(s){Vn.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!an(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Vn.warn("init was not called")}Bl(e){var n=null;return this.getSurveys((s=>{var r;n=(r=s.find((i=>i.id===e)))!==null&&r!==void 0?r:null})),n}Hl(e){if(an(this._surveyManager))return{eligible:!1,reason:qg};var n=typeof e=="string"?this.Bl(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Ul(e){if(an(this._surveyManager))return{eligible:!1,reason:qg};var n=typeof e=="string"?this.Bl(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(an(this._surveyManager))return Vn.warn("init was not called"),{visible:!1,disabledReason:qg};var n=this.Ul(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return an(this._surveyManager)?(Vn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:qg})):new Promise((s=>{this.getSurveys((r=>{var i,a=(i=r.find((l=>l.id===e)))!==null&&i!==void 0?i:null;if(a){var o=this.Ul(a);s({visible:o.eligible,disabledReason:o.reason})}else s({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(e,n,s){var r;if(an(this._surveyManager))Vn.warn("init was not called");else{var i=typeof e=="string"?this.Bl(e):e;if(i!=null&&i.id)if(UYe.includes(i.type)){var a=Ve==null?void 0:Ve.querySelector(n);if(a)if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds){Vn.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var l,u;this.Il.delete(o),this.ts||(Vn.info("Rendering survey "+i.id+" with delay of "+((l=i.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.render
309Survey(i,a,s),Vn.info("Survey "+i.id+" rendered"))}),1e3*i.appearance.surveyPopupDelaySeconds);this.Il.add(o)}else this._surveyManager.renderSurvey(i,a,s);else Vn.warn("Survey element not found")}else Vn.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Vn.warn("Survey not found")}}displaySurvey(e,n){var s;if(an(this._surveyManager))Vn.warn("init was not called");else{var r=this.Bl(e);if(r){var i=r;if((s=r.appearance)!=null&&s.surveyPopupDelaySeconds&&n.ignoreDelay&&(i=$e({},r,{appearance:$e({},r.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==ZM.Popover&&n.initialResponses&&Vn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var a=this.Hl(r);if(!a.eligible)return void Vn.warn("Survey is not eligible to be displayed: ",a.reason)}n.displayType!==ZM.Inline?this._surveyManager.handlePopoverSurvey(i,n):this.renderSurvey(i,n.selector,n.properties)}else Vn.warn("Survey not found")}}cancelPendingSurvey(e){an(this._surveyManager)?Vn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}function Kg(t,e,n){if(an(t))return!1;switch(n){case"exact":return t===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class oZe{constructor(e){this.zl=new Set,this.Wl=new Set,this.Vl=new $k,this.Gl=(n,s)=>this.Zl(n,s)&&this.Ql(n,s)&&this.Jl(n,s)&&this.Kl(n,s),this.Zl=(n,s)=>s==null||!s.event||(n==null?void 0:n.event)===(s==null?void 0:s.event),this._instance=e}init(){var e,n;Ue((e=this._instance)==null?void 0:e._addCaptureHook)||(this.Yl=(n=this._instance)==null?void 0:n._addCaptureHook(((s,r)=>{this.on(s,r)})))}dispose(){var e;(e=this.Yl)==null||e.call(this),this.Yl=void 0,this.Vl=new $k}register(e){var n,s;if(!Ue((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach((i=>{var a;this.zl.add(i),(a=i.steps)==null||a.forEach((o=>{this.Wl.add((o==null?void 0:o.event)||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r=new Set;this.zl.forEach((i=>{var a;(a=i.steps)==null||a.forEach((o=>{o!=null&&o.selector&&r.add(o.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(e){this.zl.clear(),this.Wl.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Wl.has(e)||this.Wl.has(n.event))&&this.zl.forEach((s=>{this.Xl(n,s)&&this.Vl.emit("actionCaptured",s.name)}))}tu(e){this.onAction("actionCaptured",(n=>e(n)))}Xl(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var s of n.steps)if(this.Gl(e,s))return!0;return!1}onAction(e,n){return this.Vl.on(e,n)}Ql(e,n){if(n!=null&&n.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!Kg(r,n.url,n.url_matching||"contains"))return!1}return!0}Jl(e,n){return!!this.eu(e,n)&&!!this.iu(e,n)&&!!this.ru(e,n)}eu(e,n){var s;if(n==null||!n.href)return!0;var r=this.nu(e);if(r.length>0)return r.some((o=>Kg(o.href,n.href,n.href_matching||"exact")));var i,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&Kg((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}iu(e,n){var s;if(n==null||!n.text)return!0;var r=this.nu(e);if(r.length>0)return r.some((u=>Kg(u.text,n.text,n.text_matching||"exact")||Kg(u.$el_text,n.text,n.text_matching||"exact")));var i,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(i=(function(u){for(var d,f=[],p=/(?::|")text="(.*?)"/g;!an(d=p.exec(u));)f.includes(d[1])||f.push(d[1]);return f})(l),a=n.text,o=n.text_matching||"exact",i.some((u=>Kg(u,a,o))))}ru(e,n){var s,r;if(n==null||!n.selector)return!0;var i=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(n.selector_regex&&a)try{return new RegExp(n.selector_regex).test(a)}catch{return!1}return!1}nu(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}Kl(e,n){return n==null||!n.properties||n.properties.length===0||Nme(n.properties.reduce(((s,r)=>{var i=Qt(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:i,operator:r.operator||"exact"},s}),{}),e==null?void 0:e.properties)}}class lZe{constructor(e){var n;this.su=[],this._instance=e,this.au=new Map,this.ou=new Map,this.lu=new Map,this.uu=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId((s=>this.hu(s)))}du(e){return!1}vu(){return null}cu(e){}
309fu(){}pu(e,n){return!!e&&Nme(e.propertyFilters,n==null?void 0:n.properties)}gu(e,n){var s=new Map;return e.forEach((r=>{var i;(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach((a=>{if(a!=null&&a.name){var o=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}}))})),s}mu(e,n,s){var r=(s===iy.Activation?this.au:this.ou).get(e),i=[];return this.yu((a=>{i=a.filter((o=>r==null?void 0:r.includes(o.id)))})),i.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find((u=>u.name===e));return this.pu(l,n)}))}register(e){this.bu(e,!1)}replace(e){this.bu(e,!0)}bu(e,n){var s;Ue((s=this._instance)==null?void 0:s._addCaptureHook)||(this._u(e,n),this.wu(e,n))}wu(e,n){var s=e.filter((a=>{var o;return(o=a.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length}));if(n&&this.lu.clear(),s.length!==0){this.ku||(this.ku=new oZe(this._instance),this.ku.init(),this.ku.tu((a=>this.onAction(a))));var r=[];s.forEach((a=>{var o;(o=a.conditions)==null||(o=o.actions)==null||o.values.forEach((l=>{if(r.push(l),l.name){var u,d=(u=this.lu.get(l.name))!==null&&u!==void 0?u:[];d.includes(a.id)||d.push(a.id),this.lu.set(l.name,d)}}))})),n?this.ku.replace(r):this.ku.register(r)}else{var i;n&&((i=this.ku)==null||i.replace([]))}}Su(e,n){n.forEach(((s,r)=>{var i,a=(i=e.get(r))!==null&&i!==void 0?i:[];s.forEach((o=>{a.includes(o)||a.push(o)})),e.set(r,a)}))}_u(e,n){var s,r,i=e.filter((u=>{var d,f;return((d=u.conditions)==null?void 0:d.events)&&((f=u.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=e.filter((u=>{var d,f;return((d=u.conditions)==null?void 0:d.cancelEvents)&&((f=u.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0})),o=this.gu(e,iy.Activation),l=this.gu(e,iy.Cancellation);n?(this.au=o,this.ou=l):(this.Su(this.au,o),this.Su(this.ou,l)),(i.length!==0||a.length!==0)&&((s=this.Yl)!==null&&s!==void 0||(this.Yl=(r=this._instance)==null?void 0:r._addCaptureHook(((u,d)=>{this.onEvent(u,d)}))))}onEvent(e,n){var s,r,i=this.xu(),a=(n==null||(s=n.properties)==null?void 0:s.$survey_id)||(n==null||(r=n.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Cu(e,a);if(o==="consume")return i.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.Tu([a]);if(o==="persist")return i.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.Mu(a),void this.Eu([a])}if(this.ou.has(e)){var l=this.mu(e,n,iy.Cancellation);l.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((d=>d.id))}),this.Tu(l.map((d=>d.id))),l.forEach((d=>this.Iu(d.id))))}
309if(this.au.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.au.get(e)});var u=this.mu(e,n,iy.Activation);this.Ru(u.map((d=>d.id)))}}onAction(e){this.lu.has(e)&&this.Ru(this.lu.get(e)||[])}Ru(e){var n;if(e.length!==0){var s=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),r=[];for(var i of e)s&&this.du(i)?this.Mu(i)&&this.Pu(i):r.push(i);r.length>0&&(this.su=[...new Set([...this.su,...r])]),this.xu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Mu(e){this.su=this.su.filter((s=>s!==e));var n=this.Au();return!n.includes(e)&&(this.Fu([...n,e]),this.Lu(),!0)}Tu(e){var n=new Set(e);this.su=this.su.filter((i=>!n.has(i)));var s=this.Ou(),r=s.filter((i=>!n.has(i)));r.length!==s.length&&(this.Fu(r),r.length===0&&this.Du()),this.Eu(e)}$u(){var e,n=this.vu();if(!n)return{};var s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n];return s&&typeof s=="object"?s:{}}Pu(e){if(this.vu()){var n=this.$u();this.cu($e({},n,{[e]:Date.now()}))}}Eu(e){if(this.vu()){var n=this.$u(),s={},r=!1;for(var i of Object.entries(n)){var a=i[0],o=i[1];e.includes(a)?r=!0:s[a]=o}r&&(Kl(s)?this.fu():this.cu(s))}}Nu(){this.vu()&&this.fu()}getActivationTimestamp(e){if(this.Au().includes(e)){var n=this.$u()[e];return Lr(n)?n:void 0}}Ou(){var e,n=this.qu();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}Au(){var e,n,s=this.Ou();if(s.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.ju()],i=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return i&&r===i?s:[]}Lu(){var e,n=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();n&&this.Bu(n)}Du(){this.Hu()}hu(e){var n,s=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.ju()];if(s&&s!==e){var r=this.Ou(),i=this.$u();r.length>0&&(this.Fu([]),r.filter((a=>Lr(i[a]))).forEach((a=>this.Iu(a)))),this.Du(),this.Nu()}}getActivatedIds(){return[...new Set([...this.Au(),...this.su])].filter((e=>!this.Uu(e)))}dispose(){var e,n,s;(e=this.uu)==null||e.call(this),this.uu=void 0,(n=this.Yl)==null||n.call(this),this.Yl=void 0,(s=this.ku)==null||s.dispose(),this.ku=void 0}reset(){this.su=[],this.Ou().length>0&&this.Fu([]),this.Du(),this.Nu()}getEventToItemsMap(){return this.au}zu(){return this.ku}}class cZe extends lZe{constructor(e){super(e)}qu(){return FM}ju(){return ZC}vu(){return XC}cu(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[XC]:e})}fu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(XC)}du(e){var n,s;this.yu((i=>{s=i.find((a=>a.id===e))}));var r=(n=s)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return Lr(r)&&r>0}Wu(){return cd.SHOWN}yu(e){var n;(n=this._instance)==null||n.getSurveys(e)}Iu(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}xu(){return Vn}Fu(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[FM]:e})}Bu(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[ZC]:e})}Hu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(ZC)}Uu(){return!1}Cu(e,n){var s;this.yu((i=>{s=i.find((a=>a.id===n))}));var r=!s||(function(i){var a;return Rme(i)&&!((a=i.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||i.schedule==="always"})(s);return r?e===cd.SHOWN?"consume":"ignore":e===cd.SHOWN?"persist":e===cd.DISMISSED||e===cd.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class uZe{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);var n={};for(var s of e){var r=this._instance.get_property(s);Ue(r)||(n[s]=r)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach((n=>this._instance.unregister(n))):this._instance.unregister(e)}}class dZe{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=Ot==null?void 0:Ot.__PosthogExtensions__;if(e){var n=e.generateSurveys,s=e.loadExternalDependency;return{generateSurveys:n?r=>n(this._instance,r):void 0,loadExternalDependency:s?r=>s(this._instance,"surveys",r):void 0}}}createEventReceiver(){return new cZe(this._instance)}}var fZe=we!=null&&we.location?Mk(we.location.hash,"__posthog")||Mk(location.hash,"state"):null,FX="_postHogToolbarParam
309s",UX=Hs("[Toolbar]"),BX=Hs("[FeatureFlags]");class hZe{constructor(e,n){n===void 0&&(n=!1),this.Vu=!1,this.update(e,n)}update(e,n){this.Gu=((s,r)=>{var i,a,o,l,u;return{bootstrap:{featureFlags:(i=s.bootstrap)==null?void 0:i.featureFlags,featureFlagPayloads:(a=s.bootstrap)==null?void 0:a.featureFlagPayloads},remoteRequestsDisabled:r,featureFlagsDisabled:!!s.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!s.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!s.advanced_feature_flags_dedup_per_session,cacheTtlMs:s.feature_flag_cache_ttl_ms,refreshIntervalMs:(o=s.remote_config_refresh_interval_ms)!==null&&o!==void 0?o:3e5,requestTimeoutMs:s.feature_flag_request_timeout_ms,compression:s.disable_compression?"none":"base64",evaluationContexts:(l=(u=s.evaluation_contexts)!==null&&u!==void 0?u:s.evaluation_environments)!==null&&l!==void 0?l:[],flagKeys:Qt(s.flag_keys)?s.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Vu||(BX.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Vu=!0),Ue(e.flag_keys)||Qt(e.flag_keys)||BX.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Gu}}var zX=Hs("[FeatureFlags]"),bp=Hs("[FeatureFlags]",{debugEnabled:!0}),cI=`" failed. Feature flags didn't load in time.`,VX="connection_error",HX=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},GX=t=>{var e={};for(var n of QC(t||{})){var s=n[1];s&&(e[n[0]]=s)}return e},Cl=Hs("[Error tracking]"),pZe=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],mZe=["__firefox__","__gCrWeb"],WX="Refusing to render web experiment since the viewer is a likely bot",gZe={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Fk(e,t),not_regex:(t,e)=>!Fk(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Ki{get ji(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),n.getWebExperiments((r=>{Ki.Zu("retrieved web experiments from the server"),n.Qu=new Map,r.forEach((i=>{if(i.feature_flag_key){var a;n.Qu&&(Ki.Zu("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n.Qu)==null||a.set(i.feature_flag_key,i));var o=n._instance.getFeatureFlag(i.feature_flag_key);jn(o)&&i.variants[o]&&n.Ju(i.name,o,i.variants[o].transforms)}else if(i.variants)for(var l in i.variants){var u=i.variants[l];Ki.Ku(u,n._instance)&&n.Ju(i.name,l,u.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Ki.Zu(WX);else if(!this.ji.disable_web_experiments){if(an(this.Qu))return this.Qu=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ki.Zu("applying feature flags",e),e.forEach((n=>{var s;if(this.Qu&&(s=this.Qu)!=null&&s.has(n)){var r,i=this._instance.getFeatureFlag(n),a=(r=this.Qu)==null?void 0:r.get(n);i&&a!=null&&a.variants[i]&&this.Ju(a.name,i,a.variants[i].transforms)}}))}}previewWebExperiment(){var e=Ki.getWindowLocation();if(e!=null&&e.search){var n=e1(e==null?void 0:e.search,"__experiment_id"),s=e1(e==null?void 0:e.search,"__experiment_variant");n&&s&&(Ki.Zu("previewing web experiments "+n+" && "+s),this.getWebExperiments((r=>{this.Yu(parseInt(n),s,r)}),!1,!0))}}loadIfEnabled(){this.ji.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,s){if(this.ji.disable_web_experiments&&!s)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.ji.token),method:"GET",timestampMode:"query",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}Yu(e,n,s){var r=s.filter((i=>i.id===e));r&&r.length>0&&(Ki.Zu("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.Ju(r[0].name,n,r[0].variants[n].transforms))}static Ku(e,n){return!an(e.conditions)&&Ki.Xu(e,n)&&Ki.th(e)}static Xu(e,n){var s;if(an(e.conditions)||an((s=e.conditions)==null?void 0:s.url))return!0;var r=Ki.getWindowLocation();if(r){var i,a,o,l=Gpe(n,r.href);return(i=e.conditions)==null||!i.url||gZe[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}
309static getWindowLocation(){return we==null?void 0:we.location}static th(e){var n;if(an(e.conditions)||an((n=e.conditions)==null?void 0:n.utm))return!0;var s=ome();if(s.utm_source){var r,i,a,o,l,u,d,f,p=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==s.utm_campaign,m=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==s.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,x=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==s.utm_term;return p&&v&&x&&m}return!1}static Zu(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;n>r;r++)s[r-1]=arguments[r];Ze.info("[WebExperiments] "+e,s)}Ju(e,n,s){this._is_bot()?Ki.Zu(WX):n!=="control"?s.forEach((r=>{if(r.selector){var i;Ki.Zu("applying transform of variant "+n+" for experiment "+e+" ",r);var a=(i=document)==null?void 0:i.querySelectorAll(r.selector);a==null||a.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):Ki.Zu("Control variants leave the page unmodified.")}_is_bot(){return Aa&&this._instance?Tme(Aa,this.ji.custom_blocked_useragents):void 0}}var qo=Hs("[Conversations]"),Sp="Conversations not available yet.",qX="console",Ome="__posthogHandledLogsRequestError",uI=(t,e)=>{var n=t instanceof Error?t:new Error(e);return n[Ome]=!0,n},KX=t=>!!t&&typeof t=="object"&&t[Ome]===!0,oR={featureFlags:class{constructor(t){this.name="featureFlags",this.eh=!1,this.featureFlagEventHandlers=[],this.I=zX,this.ih={},this.rh={},this.nh=[],this.sh=!1,this.ah=!1,this.oh=0,this.lh=!1,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=0,this.Tt=()=>{var e=this.ph();this.fh=0,e&&this.reloadFeatureFlags()},this.gh=()=>{var e,n=this.mh;Ue(n)||this.ji.remoteRequestsDisabled||!Ve||Ve.visibilityState==="hidden"||Date.now()-((e=this.yh)!==null&&e!==void 0?e:0)<n||(this.reloadFeatureFlags(),this.bh())},this.It=()=>{(Ve==null?void 0:Ve.visibilityState)==="visible"&&this.gh()},"get"in t?this.es=t:(this._h=new hZe(t.config,t.ma()),this.es=this._h)}updateConfig(t,e){var n;(n=this._h)==null||n.update(t,e),this.ss&&this.wh()}setup(t){return this.Al=t,this.I=t.logger.createLogger("[FeatureFlags]"),Dme(t.kv.initialize(),(()=>{this.Al===t&&(this.Al=void 0,this.ss=t,this.kh(t))}))}kh(t){if(this.ss===t)return we&&Ds(we,"online",this.Tt),this.wh(),this.Sh=t.registerDynamicEventProperties((()=>this.xh()?this.ih:this.rh)),this.Ch(),this.initialize()}wh(){var t=this.ji.refreshIntervalMs,e=!this.ji.remoteRequestsDisabled&&Ve&&!Ue(t)&&t>0?t:void 0;e!==this.mh&&(this.Th(),Ue(e)||(this.mh=e,this.bh(),Ve!=null&&Ve.addEventListener&&Ds(Ve,Qv,this.It)))}bh(){Ue(this.mh)||(Ue(this.Mh)||clearInterval(this.Mh),this.yh=Date.now(),this.Mh=setInterval(this.gh,this.mh))}Th(){Ue(this.Mh)||(clearInterval(this.Mh),this.Mh=void 0,Ve==null||Ve.removeEventListener==null||Ve.removeEventListener(Qv,this.It)),this.mh=void 0,this.yh=void 0}destroy(){this.Eh()}dispose(){this.Eh()}Eh(){var t;this.Th(),this.oh++,this.uh=!1,this.Al=void 0,this.ss&&(this.Ih(),(t=this.Sh)==null||t.dispose(),this.Sh=void 0,this.nh=[],we==null||we.removeEventListener("online",this.Tt),this.ss=void 0)}get ji(){return this.es.get()}Rh(t){var e;return(e=this.ss)==null?void 0:e.kv.get(t)}Dr(t){this.Ph((()=>{var e;return(e=this.ss)==null?void 0:e.kv.set(t)}))}qr(t){this.Ph((()=>{var e;return(e=this.ss)==null?void 0:e.kv.remove(t)}))}Ph(t){try{t()}catch(e){this.I.error("Failed to update feature flag persistence",e)}}Ch(){var t={};for(var e of[Zp,Xp,rv,Ec]){var n=this.Rh(e);Ue(n)||(t[e]=n)}this.ih=t;var s=$e({},t),r=this.Rh(td);if(r)for(var i of Object.entries(r))s["$feature/"+i[0]]=i[1];this.rh=s}xh(){var t=this.ji.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Rh(Cm);return typeof e!="number"||Date.now()-e>t}Ah(){return!!this.xh()&&(this.dh||this.ah||(this.dh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Fh(){var t=this.ji.evaluationContexts;return t!=null&&t.length?t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||this.I.error("Invalid evaluation context found:",e,"Expected non-empty string"),n})):[]}Lh(){var t=this.ji.flagKeys;if(!Ue(t))return t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||this.I.error("Invalid flag key found:",e,"Expected non-empty string"),n}))}initialize(){var t,e,n=this.ji,s=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(s).length){var r,i,a=(r=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter((u=>!!s[u])).reduce(((u,d)=>(u[d]=s[d]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,d)=>(u[d]=a[d],u)),{});return this.Oh({featureFlags:o,featureFlagPayloads:l})}}updateFlags(t,e,n){var s,r,i=n!=null&&n.merge&&(s=this.Rh(td))!==null&&s!==void 0?s:{},a=n!=null&&n.merge&&(r=this.Rh(Xp))!==null&&r!==void 0?r:{},o=$e({},i,t),l=$e({},a,e),u={};
309for(var d of Object.entries(o)){var f=d[0],p=d[1];u[f]={key:f,enabled:MZ(p),variant:DZ(p),reason:void 0,metadata:Ue(l==null?void 0:l[f])?void 0:{id:0,version:void 0,description:void 0,payload:l[f]}}}this.Oh({flags:u})}get hasLoadedFlags(){return this.sh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Rh(f2),e=this.Rh(Ec),n=this.Rh(jp);if(!n&&!e)return t||{};var s=ws({},t||{}),r=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var i of r){var a,o,l=s[i],u=e==null?void 0:e[i],d=Ue(u)?(a=l==null?void 0:l.enabled)!==null&&a!==void 0&&a:!!u,f=Ue(u)?l==null?void 0:l.variant:typeof u=="string"?u:void 0,p=n==null?void 0:n[i],m=$e({},l,{enabled:d,variant:d?f??(l==null?void 0:l.variant):void 0});d!==(l==null?void 0:l.enabled)&&(m.original_enabled=l==null?void 0:l.enabled),f!==(l==null?void 0:l.variant)&&(m.original_variant=l==null?void 0:l.variant),p&&(m.metadata=$e({},l==null?void 0:l.metadata,{payload:p,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[i]=m}return this.eh||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:s}),this.eh=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((n=>{var s=t[n];return{key:n,enabled:MZ(s),variant:DZ(s),payload:PZ(e[n])}}))}getFlagVariants(){var t=this.Rh(td),e=this.Rh(Ec);if(!e)return t||{};for(var n=ws({},t||{}),s=Object.keys(e),r=0;s.length>r;r++)n[s[r]]=e[s[r]];return this.eh||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.eh=!0),n}getFlagPayloads(){var t=this.Rh(Xp),e=this.Rh(jp);if(!e)return t||{};for(var n=ws({},t||{}),s=Object.keys(e),r=0;s.length>r;r++)n[s[r]]=e[s[r]];return this.eh||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.eh=!0),n}reloadFeatureFlags(){this.lh||this.ji.featureFlagsDisabled||this.ph()||this.Dh||(this.nh.slice().forEach((t=>{try{t()}catch(e){this.I.error("Error while running feature flags reloading callback",e)}})),this.Dh=setTimeout((()=>{this.$h()}),5))}Ih(){clearTimeout(this.Dh),this.Dh=void 0}onReloading(t){return this.nh.push(t),()=>{this.nh=this.nh.filter((e=>e!==t))}}ensureFlagsLoaded(){this.sh||this.ah||this.Dh||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.lh=t}resetFlagCallReported(){this.qr(od)}$h(t){this.Ih();var e=this.ss;if(e&&!this.ji.remoteRequestsDisabled&&!this.ph())if(this.ah)this.uh=!0;else{var n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:$e({},e.initialPersonProperties,this.Rh(Fl)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Rh(Dc),timezone:hme()};Ue(e.deviceId)||(n.$device_id=e.deviceId),(t!=null&&t.disableFlags||this.ji.featureFlagsDisabled)&&(n.disable_flags=!0);var s=this.Fh();s.length&&(n.evaluation_contexts=s);var r=this.Lh();Ue(r)||(n.flag_keys=r);var i=this.ji.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(i?"&only_evaluate_survey_feature_flags=true":""),o=this.oh;this.ah=!0;var l=()=>{this.uh&&(this.uh=!1,this.$h())},u=d=>{this.ah=!1,o===this.oh&&(this.Dr({[iv]:[VX]}),this.I.error("Feature flag request failed",d)),l()};try{e.sendRequest(a,{target:"flags",method:"POST",body:n,compression:this.ji.compression==="base64"?ya.Base64:void 0,sentAt:"body",timeoutMs:this.ji.requestTimeoutMs}).then((d=>{var f,p,m=(f=d.json)!==null&&f!==void 0?f:{},v=d.statusCode!==200;if(this.ah=!1,o===this.oh){if(this.Nh(d.statusCode),v||this.uh||(this.$anon_distinct_id=void 0),!n.disable_flags||this.uh){this.hh=!v;var x=[];d.error?x.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?VX:"unknown_error"):d.statusCode!==200&&x.push("api_error_"+d.statusCode),m.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");var y=!((p=m.quotaLimited)==null||!p.includes("feature_flags"));y&&x.push("quota_limited"),this.Dr({[iv]:x}),y?this.I.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."):n.disable_flags||this.Oh(m,v,{partialResponse:i}),l()}}else l()})).catch(u)}catch(d){u(d)}}}ph(){return ime(this.fh,3)}Nh(t){this.fh=ame(t,this.fh,3,(()=>this.I.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.hh)if(this.sh||this.getFlags()&&this.getFlags().length>0){if(!this.Ah()){var s=this.getFeatureFlagResult(t,e);return(n=s==null?void 0:s.variant)!==null&&n!==void 0?n:s==null?void 0:s.enabled}}else this.I.warn('getFeatureFlag for key "'+t+cI)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.hh)if(this.sh||this.getFlags()&&this.getFlags().length>0){if(!this.Ah()){var n,s=this.getFlagVariants(),r=t in s,i=s[t],a=this.getFlagPayloads()[t],o=String(i),l=this.Rh(rv)||void 0,u=this.Rh(Cm)||void 0,d=this.Rh(od)||{};if(this.ji.deduplicateCallsPerSession){var f,p=(f=this.ss)==null?void 0:f.session.sessionId,m=this.Rh($y);p&&p!==m&&(d={},n=p)}if(e.send_event||!("send_event"in e))if(t in d&&d[t].includes(o))n&&this.Dr({[od]:d,[$y]:n});else{var v,x,y,S,_,E,T,k,R,I,A,L;Qt(d[t])?d[t].push(o):d[t]=[o],this.Dr($e({[od]:d},n?{[$y]:n}:{}));var j=this.getFeatureFlagDetails(t),F=[...(v=this.Rh(iv))!==null&&v!==void 0?v:[]];Ue(i)&&F.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:a??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:(x=(y=this.ji.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[t])!==null&&x!==void 0?x:null,$feature_flag_bootstrapped_payload:(S=(_=this.ji.bootstrap)==null||(_=_.featureFlagPayloads)==null?void 0:_[t])!==null&&S!==void 0?S:null,$used_bootstrap_value:!this.hh};Ue(j==null||(E=j.metadata)==null?void 0:E.has_experiment)||(O.$feature_flag_has_experiment=j.metadata.has_experiment),Ue(j==null||(T=j.metadata)==null?void 0:T.version)||(O.$feature_flag_version=j.metadata.version);var M,U=(k=j==null||(R=j.reason)==null?void 0:R.description)!==null&&k!==void 0?k:j==null||(I=j.reason)==null?void 0:I.code;U&&(O.$feature_flag_reason=U),j!=null&&(A=j.metadata)!=null&&A.id&&(O.$feature_flag_id=j.metadata.id),Ue(j==null?void 0:j.original_variant)&&Ue(j==null?void 0:j.original_enabled)||(O.$feature_flag_original_response=Ue(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(L=j.metadata)!=null&&L.original_payload&&(O.$feature_flag_original_payload=j==null||(M=j.metadata)==null?void 0:M.original_payload),F.length&&(O.$feature_flag_error=F.join(",")),this.qh(O)}else n&&this.Dr({[od]:d,[$y]:n});if(r)return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:PZ(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+cI)}qh(t){try{var e;(e=this.ss)==null||e.capture("$feature_flag_called",t).catch((n=>{this.I.error("Failed to capture feature flag call",n)}))}catch(n){this.I.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.jh(t,e)}jh(t,e){var n=this;return Ns((function*(){var s=n.ss;if(s){var r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},i=n.Fh();i.length&&(r.evaluation_contexts=i);var a,o=n.Lh();Ue(o)||(r.flag_keys=o);try{var l,u=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:n.ji.compression==="base64"?ya.Base64:void 0,sentAt:"body",timeoutMs:n.ji.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;a=(u==null?void 0:u[t])||void 0}catch(d){return void n.I.error("Remote config feature flag request failed",d)}try{e(a)}catch(d){n.I.error("Remote config feature flag callback failed",d)}}}))()}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.hh)return e.defaultValue;if(!(this.sh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+cI),e.defaultValue;var n=this.getFeatureFlag(t,e);return Ue(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,n){this.Oh(t,e,n)}Oh(t,e,n){if(this.ss){this.sh=!0;var s=(function(r,i,a,o,l,u){i===void 0&&(i={}),a===void 0&&(a={}),o===void 0&&(o={}),u===void 0&&(u=zX);var d=((R,I)=>{var A=R.flags;return A?$e({},R,{featureFlags:Object.fromEntries(Object.keys(A).map((L=>{var j;return[L,(j=A[L].variant)!==null&&j!==void 0?j:A[L].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(A).filter((L=>A[L].enabled)).filter((L=>{var j;return(j=A[L].metadata)==null?void 0:j.payload})).map((L=>{var j;return[L,(j=A[L].metadata)==null?void 0:j.payload]})))}):(R.featureFlags&&I.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),R)})(r,u),f=d.flags,p=d.featureFlags,m=d.featureFlagPayloads;if(p){var v=r.requestId,x=r.evaluatedAt;if(Qt(p)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(p)for(var S=0;p.length>S;S++)y[p[S]]=!0;return{[Zp]:p,[td]:y,[kk]:!1}}var _=p,E=m,T=f;if(l!=null&&l.partialResponse)_=$e({},i,_),E=$e({},a,E),T=$e({},o,T);else if(r.errorsWhileComputingFlags)if(f){var k=new Set(Object.keys(f).filter((R=>{var I;return!((I=f[R])!=null&&I.failed)})));_=$e({},i,Object.fromEntries(Object.entries(_).filter((R=>k.has(R[0]))))),E=$e({},a,Object.fromEntries(Object.entries(E||{}).filter((R=>k.has(R[0]))))),T=$e({},o,Object.fromEntries(Object.entries(T||{}).filter((R=>k.has(R[0])))))}else _=$e({},i,_),E=$e({},a,E),T=$e({},o,T);return $e({[Zp]:Object.keys(GX(_)),[td]:_||{},[Xp]:E||{},[f2]:T||{},[kk]:r.minimalFlagCalledEvents===!0},v?{[rv]:v}:{},x?{[Cm]:x}:{})}})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.I);s&&this.Dr(s),e||(this.dh=!1),this.Bh(e)}}override(t,e){e===void 0&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Hh(t)}Hh(t){if(this.ss){if(t===!1)return this.qr([Ec,jp]),this.Bh(),void bp.info("All overrides cleared");if(Qt(t))return this.Dr({[Ec]:HX(t)}),this.Bh(),void bp.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e,n=t;this.eh=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);var s={},r=n.flags,i=n.payloads;return r&&(s[Ec]=Qt(r)?HX(r):r),i&&(s[jp]=i),Object.keys(s).length&&this.Dr(s),r===!1&&i===!1?this.qr([Ec,jp]):r===!1?this.qr(Ec):i===!1&&this.qr(jp),this.Bh(),r===!1?bp.info("Flag overrides cleared"):r&&bp.info("Flag overrides set",{flags:r}),void(i===!1?bp.info("Payload overrides cleared"):i&&bp.info("Payload overrides set",{payloads:i}))}if(t&&typeof t=="object")return this.Dr({[Ec]:t}),this.Bh(),void bp.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.sh){var e=this.Uh(),n=e.flags,s=e.flagVariants;try{t(n,s)}catch(r){this.I.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var s=(this.Rh(YC)||[]).find((l=>l.flagKey===t)),r={["$feature_enrollment/"+t]:e},i={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(i.$early_access_feature_name=s.name),n&&(i.$feature_enrollment_stage=n);var a=$e({},this.getFlagVariants(),{[t]:e});this.Dr({[Zp]:Object.keys(GX(a)),[td]:a,[Fl]:$e({},this.Rh(Fl)||{},r)}),this.Bh();try{var o;(o=this.ss)==null||o.capture("$feature_enrollment_update",i).catch((l=>{this.I.error("Failed to capture early access feature enrollment",l)}))}catch(l){this.I.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var s=this.Rh(YC);!s||e?this.zh(t,n):t(s)}zh(t,e){var n=this;return Ns((function*(){var s=n.ss;if(s){var r,i=e?"&"+e.map((o=>"stage="+o)).join("&"):"";try{var a=yield s.sendRequest("/api/early_access_features/?token="+s.projectToken+i,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;n.Dr({[YC]:r=a.json.earlyAccessFeatures})}catch(o){return void n.I.error("Early access feature request failed",o)}try{t(r)}catch(o){n.I.error("Early access feature callback failed",o)}}}))()}Uh(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((n=>e[n])),flagVariants:Object.keys(e).filter((n=>e[n])).reduce(((n,s)=>(n[s]=e[s],n)),{})}}Bh(t){this.Ch();var e=this.Uh(),n=e.flags,s=e.flagVariants;
309this.featureFlagEventHandlers.forEach((r=>{try{r(n,s,{errorsLoading:t})}catch(i){this.I.error("Error while running feature flags callback",i)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0),this.Wh(t,e)}Wh(t,e){e===void 0&&(e=!0);var n=this.Rh(Fl)||{},s=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),r=t==null?void 0:t.$set_once,i={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in n||(i[a]=r[a]));this.Dr({[Fl]:$e({},n,i,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=$e({},this.Rh(Fl)||{});t.forEach((s=>{delete n[s]})),this.Dr({[Fl]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this.qr(Fl),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Rh(Dc)||{},s=$e({},n);for(var r of Object.keys(t))s[r]=$e({},n[r],t[r]);this.Dr({[Dc]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Rh(Dc)||{};this.Dr({[Dc]:$e({},e,{[t]:{}})})}else this.qr(Dc)}reset(){this.oh++,this.uh=!1,this.ih={},this.rh={},this.sh=!1,this.lh=!1,this.hh=!1,this.$anon_distinct_id=void 0,this.Ih(),this.eh=!1,this.fh=0}}},vZe={sessionRecording:class{get ji(){return this._instance.config}get Ua(){return this._instance.persistence}get started(){var t;return!((t=this.Vh)==null||!t.isStarted)}get status(){var t,e;return this.Gh===uy||this.Gh===dE?this.Gh:(t=(e=this.Vh)==null?void 0:e.status)!==null&&t!==void 0?t:this.Gh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Gh=MX,this.Zh=void 0,this.Qh=!1,this.kt=(()=>{var e;if(Ve==null||!Ve.visibilityState||Ve.visibilityState==="visible")return!0;var n=we==null||(e=we.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((s=>s.name==="visible"))})(),this.It=()=>{var e;(Ve==null?void 0:Ve.visibilityState)==="visible"&&(this.kt=!0,(e=this.Vh)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ou.error("started without valid sessionManager"),new Error(sD+" started without valid sessionManager. This is a bug.");if(this.ji.cookieless_mode===ld)throw new Error(sD+' cannot be used with cookieless_mode="always"');Ve!=null&&Ve.addEventListener&&Ds(Ve,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Qh=!0,Ve==null||Ve.removeEventListener==null||Ve.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Jh(){var t,e=!((t=this._instance.get_property(Yp))==null||!t.enabled),n=!this.ji.disable_session_recording,s=this.ji.disable_session_recording||this._instance.consent.isOptedOut();return we&&e&&n&&!s}startIfEnabledOrStop(t){var e;if(!(this.Qh||this.Jh&&(e=this.Vh)!=null&&e.isStarted)){var n=!Ue(Object.assign)&&!Ue(Array.from);this.Jh&&n?(this.Kh(t),Ou.info("starting")):(this.Gh=MX,this.stopRecording())}}Kh(t){var e,n,s;this.Jh&&(this.Gh!==uy&&this.Gh!==dE&&(this.Gh=DX),Ot!=null&&(e=Ot.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=Ot.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Yh(t):(s=Ot.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Xh,(r=>{if(r)return this._instance.register_for_session({[HM]:!0}),Ou.error("could not load recorder",r);this.Yh(t)})))}stopRecording(){var t,e;(t=this.Zh)==null||t.call(this),this.Zh=void 0,(e=this.Vh)==null||e.stop()}td(){var t,e;(t=this.Zh)==null||t.call(this),this.Zh=void 0,(e=this.Vh)==null||e.discard()}ed(){var t,e;(t=this.Ua)==null||t.unregister(w$),(e=this.Ua)==null||e.unregister(jpe)}rd(t,e){if(an(t))return null;var n,s=Lr(t)?t:parseFloat(t);return typeof(n=s)!="number"||!Number.isFinite(n)||0>n||n>1?(Ou.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):s}nd(t){if(this.Ua){var e,n,s=this.Ua,r=()=>{var i,a=t.sessionRecording===!1?void 0:t.sessionRecording,o=this.rd((i=this.ji.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),l=this.rd(a==null?void 0:a.sampleRate,"remote config sampleRate"),u=o??l;an(u)&&this.ed();var d=a==null?void 0:a.minimumDurationMilliseconds;s.register({[Yp]:$e({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:$e({capturePerformance:t.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Ue(d)?null:d,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};r(),(e=this.Zh)==null||e.call(this),this.Zh=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(r)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.nd(e),void this.td()):(this.nd(e),void this.startIfEnabledOrStop()):(this.Gh===uy&&(this.Gh=dE,Ou.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.Vh)!=null&&n.log?this.Vh.log(t,e):Ou.warn("log called before recorder was ready")}get Xh(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(Yp);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}sd(){var t,e=this._instance.get_property(Yp);if(!e)return!1;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return Ou.warn("persisted remote config for session recording is invali
309d and will be ignored",n),!1}return!an(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Yh(t){var e,n,s;if(!this.Qh){if((e=Ot.__PosthogExtensions__)==null||!e.initSessionRecording)return Ou.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[HM]:!0});var r;if(this.Vh||(this.Vh=(r=Ot.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance,this.kt),this.Vh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.sd())return this.Gh===dE||this.Gh===uy?void 0:(this.Gh=uy,Ou.info("persisted remote config is stale, requesting fresh config before starting"),void new pme(this._instance).load());this.Gh=DX,(n=(s=this.Vh).setDocumentWasEverVisible)==null||n.call(s,this.kt),this.Vh.start(t)}}onRRwebEmit(t){var e;(e=this.Vh)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Vh||(e=this.Ua)==null||e.register({[Mpe]:!0}),(t=this.Vh)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Vh||(e=this.Ua)==null||e.register({[Ppe]:!0}),(t=this.Vh)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Vh||(n=this.Ua)==null||n.register({[t==="url"?Dpe:Ope]:!0}),(e=this.Vh)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Vh)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Vh)==null||!n.tryAddCustomEvent(t,e))}}},xZe={autocapture:class extends JYe{constructor(t){super(new eZe(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ad=this.od()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.ld();return!!(t.path||t.search||this.ud(t))}startIfEnabled(){this.isEnabled&&(Ze.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ad=this.od(),this.startIfEnabled()}stop(){this.hd&&this.hd(),this.hd=void 0,this.dd&&this.dd(),this.dd=void 0,Ze.info("History API monitoring stopped")}monitorHistoryChanges(){we&&we.history&&(this.vd("pushState"),this.vd("replaceState"),this.fd(),this.ud()&&this.pd())}vd(t){var e;if(we&&((e=we.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(s,r,i){try{if(!(r in s))return LX;var a={next:s[r]},o=i((function(){for(var l=arguments.length,u=new Array(l),d=0;l>d;d++)u[d]=arguments[d];return a.next.apply(this,u)}));return Xi(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),s[r]=o,()=>{if(s[r]!==o)for(var l=s[r];Xi(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else s[r]=a.next}}catch{return LX}})(we.history,t,(s=>function(r,i,a){s.call(this,r,i,a),n.gd(t)}))}}od(){var t=we==null?void 0:we.location;if(t!=null&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}ld(){var t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:Ss(t)?t:{}}ud(t){return t===void 0&&(t=this.ld()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}md(t){var e=this.ld(),n=this.ad;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.ud(e)&&t.hash!==n.hash))}gd(t){try{var e=this.od();if(!e)return;this.md(e)&&this._instance.capture(h0,{navigation_type:t}),this.ad=e}catch(n){Ze.error("Error capturing "+t+" pageview",n)}}fd(){if(!this.hd){var t=()=>{this.gd("popstate")};Ds(we,"popstate",t),this.hd=()=>{we&&we.removeEventListener("popstate",t)}}}pd(){if(!this.dd){var t=()=>{this.gd("hashchange")};Ds(we,"hashchange",t),this.dd=()=>{we&&we.removeEventListener("hashchange",t)}}}},heatmaps:class{get ji(){return this.instance.config}constructor(t){var e;this.yd=!1,this.Jn=!1,this.bd=null,this.instance=t,this.yd=!((e=this.instance.persistence)==null||!e.props[LM]),this.rageclicks=new Mme(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Ss(this.ji.capture_heatmaps)&&this.ji.capture_heatmaps.flush_interval_milliseconds&&(t=this.ji.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return an(this.ji.capture_heatmaps)?an(this.ji.enable_heatmaps)?this.yd:this.ji.enable_heatmaps:this.ji.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Jn)return;rZe.info("starting..."),this._d(),this.It()}else{var t;clearInterval((t=this.bd)!==null&&t!==void 0?t:void 0),this.wd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[LM]:n}),this.yd=n,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}kd(t){oI(t.originalEvent)&&this.Si(t.originalEvent,"deadclick")}It(){this.bd&&clearInterval(this.bd),this.bd=(Ve==null?void 0:Ve.visibilityState)==="visible"?setInterval(this.Fa.bind(this),this.flushIntervalMilliseconds):null}_d(){we&&Ve&&(this.Sd=this.Fa.bind(this),Ds(we,Ik,this.Sd),this.xd=t=>this.Si(t||(we==null?void 0:we.event)),Ds(Ve,"click",this.xd,{capture:!0}),this.Cd=t=>this.Td(t||(we==null?void 0:we.event)),Ds(Ve,"mousemove",this.Cd,{capture:!0}),this.Md=new hX(this.instance,fYe,this.kd.bind(this)),this.Md.startIfEnabledOrStop(),this.Ed=this.It.bind(this),Ds(Ve,Qv,this.Ed),this.Jn=!0)}wd(){var t;we&&Ve&&(this.Sd&&we.removeEventListener(Ik,this.Sd),this.xd&&Ve.removeEventListener("click",this.xd,{capture:!0}),this.Cd&&Ve.removeEventListener("mousemove",this.Cd,{capture:!0}),this.Ed&&Ve.removeEventListener(Qv,this.Ed),clearTimeout(this.Id),(t=this.Md)==null||t.stop(),this.Jn=!1)}Rd(t,e){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),i=(function(a,o,l){for(var u=a;u&&Ph(u)&&!Co(u,"body");){if(u===l)return!1;var d=void 0;try{var f,p,m;d=(f=(p=(m=u.ownerDocument)==null?void 0:m.defaultView)!==null&&p!==void 0?p:we)==null?void 0:f.getComputedStyle(u).position}catch{return!1}if(en(o,d))return!0;u=Xpe(u)}return!1})(qM(t),["fixed","sticky"],r);return{x:t.clientX+(i?0:s),y:t.clientY+(i?0:n),target_fixed:i,type:e}}Si(t,e){var n;if(e===void 0&&(e="click"),!sX(t.target)&&oI(t)){var s=this.Rd(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Jpe(qM(t),this.instance.config.rageclick)&&this.qn($e({}
309,s,{type:"rageclick"})),this.qn(s)}}Td(t){!sX(t.target)&&oI(t)&&(clearTimeout(this.Id),this.Id=setTimeout((()=>{this.qn(this.Rd(t,"mousemove"))}),500))}qn(t){if(we){var e=this.ji.disable_capture_url_hashes?jh(we.location.href):we.location.href,n=this.ji.custom_personal_data_properties,s=this.ji.mask_personal_data_properties?[...t1,...n||[]]:[],r=p2(e,s,m2);this.ft=this.ft||{},this.ft[r]||(this.ft[r]=[]),this.ft[r].push(t)}}Fa(){this.ft&&!Kl(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:hX,webVitalsAutocapture:class{constructor(t){var e;this.yd=!1,this.Jn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pd=()=>{clearTimeout(this.Ad),this.Ad=void 0,this.ft.metrics.length!==0&&(this._instance.capture("$web_vitals",$e({$current_url:this.ft.url},this.ft.metrics.reduce(((n,s)=>$e({},n,{["$web_vitals_"+s.name+"_event"]:$e({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fd=n=>{var s;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},an(n==null?void 0:n.name)||an(n==null?void 0:n.value))yp.error("Invalid metric received",n);else{var r=typeof n.navigationURL=="string"?n.navigationURL:void 0,i=this.Ld(r);if(!Ue(i)){var a=Lr(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+i;if(!this.Od||this.Od>n.value){this.ft.navigationKey!==a&&(this.Pd(),this.Ad=setTimeout(this.Pd,this.flushToCaptureTimeoutMs)),Ue(this.ft.navigationKey)&&(this.ft.navigationKey=a,this.ft.url=i),this.ft.firstMetricTimestamp=Ue(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var o=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),l=$e({},n,r?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete l.entries,Ss(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){var u={};for(var d of sZe){var f=d==="url"&&typeof n.attribution[d]=="string"?this.Ld(n.attribution[d]):n.attribution[d];Ue(f)||(u[d]=f)}l.attribution=u}else delete l.attribution;Ue(o)||(l.$session_id=o.sessionId,l.$window_id=o.windowId),this.ft.metrics.push(l),this.ft.metrics.length===this.allowedMetrics.length&&this.Pd()}else yp.error("Ignoring metric with value >= "+this.Od,n)}}},this.Dd=()=>{if(!this.Jn){var n,s,r,i,a=!1,o=Ot.__PosthogExtensions__,l=o==null?void 0:o.postHogWebVitalsCallbacksByFlavor,u=(l==null?void 0:l[this.$d])||(this.$d==="web-vitals"&&Ue(l)?o==null?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Ue(u)){var d=u.withoutAttribution,f=this.attributionMetrics;a=!Ue(d),n=f.indexOf("LCP")>-1?u.onLCP:(d==null?void 0:d.onLCP)||u.onLCP,s=f.indexOf("CLS")>-1?u.onCLS:(d==null?void 0:d.onCLS)||u.onCLS,r=f.indexOf("FCP")>-1?u.onFCP:(d==null?void 0:d.onFCP)||u.onFCP,i=f.indexOf("INP")>-1?u.onINP:(d==null?void 0:d.onINP)||u.onINP}if(n&&s&&r&&i){var p={reportSoftNavs:this.useSoftNavs},m=a&&this.attributionMetrics.indexOf("INP")>-1?$e({},p,{includeProcessedEventEntries:!1}):p;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Fd.bind(this),p),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Fd.bind(this),p),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Fd.bind(this),p),this.allowedMetrics.indexOf("INP")>-1&&i(this.Fd.bind(this),m),this.Jn=!0}else yp.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.yd=!((e=this._instance.persistence)==null||!e.props[DM]),this.startIfEnabled()}get Nd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=Ss(this.Nd)?(t=this.Nd)==null?void 0:t.web_vitals_allowed_metrics:void 0;return an(n)?((e=this._instance.persistence)==null?void 0:e.props[OM])||PX:n}get flushToCaptureTimeoutMs(){return(Ss(this.Nd)?this.Nd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=Ss(this.Nd)?this.Nd.web_vitals_attribution:void 0;return _a(t)?t?PX:[]:Qt(t)?t:nZe}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=Ss(this.Nd)?this.Nd.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Od(){var t=Ss(this.Nd)&&Lr(this.Nd.__web_vitals_max_value)?this.Nd.__web_vitals_max_value:jX;return t>0&&6e4>=t?jX:t}get isEnabled(){var t=Xs==null?void 0:Xs.protocol;if(t!=="http:"&&t!=="https:")return yp.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Ss(this.Nd)?this.Nd.web_vitals:_a(this.Nd)?this.Nd:void 0;return _a(e)?e:this.yd}startIfEnabled(){this.isEnabled&&!this.Jn&&(yp.info("enabled, starting..."),this.ws(this.Dd))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var n=Ss(e.capturePerformance)&&!!e.capturePerformance.web_vitals,s=Ss(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[DM]:n}),this._instance.persistence.register({[OM]:s})),this.yd=n,this.startIfEnabled()}}}get $d(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ws(t){var e=Ot.__PosthogExtensions__,n=this.$d,s=e==null?void 0:e.postHogWebVitalsCallbacksByFlavor;s!=null&&s[n]||n==="web-vitals"&&Ue(s)&&e!=null&&e.postHogWebVitalsCallbacks?t():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,n,(r=>{r?yp.error("failed to load script",r):t()}))}Ld(t){var e=t||(we==null?void 0:we.location.href);if(e){var n=this._instance.config.disable_capture_url_hashes?jh(e):e,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...t1,...s||[]]:[];return p2(n,r,m2)}yp.error("Could not determine current URL")}}},yZe={exceptionObserver:class{constructor(t){var e;this.Dd=()=>{var n;if(we&&this.isEnabled&&(n=Ot.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var s=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.qd&&this.ji.capture_unhandled_errors&&(this.qd=s(this.captureException.bind(this))),!this.jd&&this.ji.capture_unhandled_rejections&&(this.jd=r(this.captureException.bind(this))),!this.Bd&&this.ji.capture_console_errors&&(this.Bd=i(this.captureException.bind(this)))}catch(a){cy.error("failed to start",a),this.Hd()}}},this._instance=t,this.Ud=!((e=this._instance.persistence)==null||!e.props[jM]),this.oe=new iKe($e({},(function(n){var s,r,i,a;return n===void 0&&(n={}),{refillRate:(s=(r=n.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:n.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(i=(a=n.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:n.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}})(this._instance.config.error_tracking),{refillInterval:1e4,I:cy})),this.ji=this.zd(),this.startIfEnabledOrStop()}zd(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ss(t)?e=$e({},e,t):(Ue(t)?this.Ud:t)&&(e=$e({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.ji.capture_console_errors||this.ji.capture_unhandled_errors||this.ji.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(cy.info("enabled"),this.Hd(),this.ws(this.Dd)):this.Hd()}ws(t){var e,n;(e=Ot.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=Ot.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return cy.error("failed to load script",s);t()}))}Hd(){var t,e,n;(t=this.qd)==null||t.call(this),this.qd=void 0,(e=this.jd)==null||e.call(this),this.jd=void 0,(n=this.Bd)==null||n.call(this),this.Bd=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Ud=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[jM]:this.Ud}),this.ji=this.zd(),this.startIfEnabledOrStop())}}onConfigChange(){this.ji=this.zd()}captureException(t){var e,n,s,r=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.oe.consumeRateLimit(r)?cy.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Wd=[],this.Vd=new EKe([new LKe,new BKe,new PKe,new jKe,new FKe,new $Ke,new DKe,new UKe],(function(s){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;r>a;a++)i[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var u=[],d=o.split(`
310`),f=l;d.length>f;f++){var p=d[f];if(1024>=p.length){var m=ZZ.test(p)?p.replace(ZZ,"$1"):p;if(!m.match(/\S*Error: /)){for(var v of i){var x=v(m,s);if(x){u.push(x);break}}if(u.length>=50)break}}}return(function(y){if(!y.length)return[];var S=Array.from(y);return S.reverse(),S.slice(0,50).map((_=>{return $e({},_,{filename:_.filename||(E=S,E[E.length-1]||{}).filename,function:_.function||Xv});var E}))})(u)}})("web:javascript",RKe,IKe)),this._instance=t,this.Wd=(e=(n=this._instance.persistence)==null?void 0:n.get_property(PM))!==null&&e!==void 0?e:[],this.Gd=Ck(this.Zd()),this.Qd=new VKe(this.Gd)}onConfigChange(){this.Gd=Ck(this.Zd()),this.Qd.setConfig(this.Gd)}onRemoteConfig(t){var e,n,s;if(t.ok){var r=t.config;if("errorTracking"in r){var i=(e=(n=r.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],a=(s=r.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Wd=i,this._instance.persistence&&this._instance.persistence.register({[PM]:this.Wd,[MM]:a})}}}get Jd(){var t,e=!!this._instance.get_property(MM),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Vd.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(t,e){if(this.Gd.enabled)try{if(!jn(t)||t.trim().length===0)return void Cl.warn("Ignoring exception step because message must be a non-empty string");var n=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(i).reduce(((o,l)=>zKe.has(l)?(a.push(l),o):(o[l]=i[l],o)),{}),droppedKeys:a}})(this.Kd(e)),s=n.sanitizedProperties,r=n.droppedKeys;r.length>0&&Cl.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Qd.add($e({[_k]:t,[Ek]:new Date().toISOString()}
310,s))}catch(i){Cl.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Yd(e)){if(this.Xd(e))return this.tv("Exception dropped: matched a suppression rule"),void Cl.info("Skipping exception capture because a suppression rule matched");if(!this.Jd&&this.ev(e))return this.tv("Exception dropped: thrown by a browser extension"),void Cl.info("Skipping exception capture because it was thrown by an extension");if(!this.Jd&&this.iv(e))return this.tv("Exception dropped: thrown by an injected browser script"),void Cl.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.rv(e))return this.tv("Exception dropped: thrown by the PostHog SDK"),void Cl.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.Gd.enabled&&an(t.$exception_steps)?this.nv(t):t,s=typeof(i=globalThis._posthogReleaseId)=="string"&&i.length>0?i:void 0;s&&(n.$release_id=s);try{var r=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",cl:!0});return r&&this.Qd.clear(),r}catch(a){return Cl.error("Failed to capture exception event. Dropping this exception.",a),void this.Qd.clear()}}catch(a){return void Cl.error("Failed to process exception event. Ignoring this exception.",a)}var i}nv(t){try{var e=this.Qd.getAttachable();return e.length===0?t:$e({},t,{$exception_steps:e})}catch(n){return Cl.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}tv(t){this.Gd.enabled&&this.Qd.add({[_k]:t,[Ek]:new Date().toISOString()})}Kd(t){return Ss(t)?$e({},t):{}}Zd(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Xd(t){if(t.length===0)return!1;try{var e=t.reduce(((n,s)=>{var r=s.type,i=s.value;return jn(r)&&r.length>0&&n.$exception_types.push(r),jn(i)&&i.length>0&&n.$exception_values.push(i),n}),{$exception_types:[],$exception_values:[]});return this.Wd.some((n=>{var s=n.values.map((r=>{var i=Ame[r.operator],a=e[r.key];if(!i||!a)return!1;var o=Qt(r.value)?r.value:[r.value];return o.length>0&&i(o,a)}));return n.type==="OR"?s.some(Boolean):s.every(Boolean)}))}catch(n){return Cl.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}ev(t){return t.flatMap((e=>{var n,s;return(n=(s=e.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]})).some((e=>{var n=e.filename;return!!n&&pZe.some((s=>n.startsWith(s)))}))}iv(t){return t.some((e=>{var n=e.value;return jn(n)&&mZe.some((s=>n.includes(s)))}))}rv(t){if(t.length>0){var e,n,s,r,i=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],a=i[i.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Yd(t){return!an(t)&&Qt(t)}}},bZe=$e({productTours:class{get Ua(){return this._instance.persistence}constructor(t){this.sv=null,this.av=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var n,s;if(this.Ua&&this.Ua.register({[S$]:!!e.productTours}),!lI(this._instance))return!this.sv&&an((n=this.Ua)==null?void 0:n.props[Oy])||fE.info("product tours disabled; stopping and clearing cached tours"),(s=this.sv)==null||s.stop(),this.sv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.sv&&lI(this._instance)&&this.ws((()=>this.ov()))}ws(t){var e,n;(e=Ot.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=Ot.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(s=>{s?fE.error("Could not load product tours script",s):t()}))}ov(){var t;!this.sv&&(t=Ot.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.sv=Ot.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Qt(this.av)||e){var n=this.Ua;if(n){var s=n.props[Oy];if(Qt(s)&&!e)return this.av=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:r=>{if(lI(this._instance)){var i=r.statusCode;if(i!==200||!r.json){var a="Product Tours API could not be loaded, status: "+i;return i===0?r.error||fE.warn(a):fE.error(a),void t([],{isLoaded:!1,error:a})}var o=Qt(r.json.product_tours)?r.json.product_tours:[];this.av=o,n&&n.register({[Oy]:o}),t(o,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.av,{isLoaded:!0})}getActiveProductTours(t){an(this.sv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.sv.getActiveProductTours(t)}showProductTour(t){var e;(e=this.sv)==null||e.showTourById(t)}previewTour(t){this.sv?this.sv.previewTour(t):this.ws((()=>{var e;this.ov(),(e=this.sv)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.sv)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.sv)==null||t.nextStep()}previousStep(){var t;(t=this.sv)==null||t.previousStep()}clearCache(){var t;this.av=null,(t=this.Ua)==null||t.unregister(Oy)}resetTour(t){var e;(e=this.sv)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.sv)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.sv)==null||e.cancelPendingTour(t)}}},oR),SZe={siteApps:class{constructor(t){this.lv=0,this._instance=t,this.uv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}hv(t,e){if(e){var n=this.globalsForEvent(e);this.uv.push(n),this.uv.length>1e3&&(this.uv=this.uv.slice(10))}}get siteAppLoaders(){var t;return(t=Ot._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.hv.bind(this));this.dv=()=>{t(),this.uv=[],this.dv=void 0}}}globalsForEvent(t){var e,n,s,r,i,a,o;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(d)){var p=f[0];l[p]={id:u[p],type:p,properties:f[1]}}var m=t.$set_once,v=t.$set;return{event:$e({},Yhe(t,iZe),{properties:$e({},t.properties,v?{$set:$e({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},v)}:{},m?{$set_once:$e({},(s=(r=t.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},m)}:{}),elements_chain:(i=(a=t.properties)==null?void 0:a.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(o=t.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}vv(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)||(vc.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)||(vc.error("prepare_external_dependency_script returned null"),null):t}fv(){var t,e,n,s,r,i,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=Ve==null?void 0:Ve.defaultView,u=l==null||(t=l.Node)==null?void 0:t.prototype;if(!l||!u)return()=>{};if(this.lv++,this.pv)return this.gv();var d=[],f=this,p=new WeakSet,m=(y,S,_)=>{if(y!=null&&y[S]){var E=y[S];y[S]=_(E),d.push((()=>{y[S]=E}))}},v=y=>{if(p.has(y))return y;var S=f.vv(y);return S&&p.add(S),S},x=y=>y.map((S=>typeof S=="string"?S:v(S))).filter((S=>!zi(S)));return m(u,"appendChild",(y=>function(S){var _=v(S);return _?y.call(this,_):S})),m(u,"insertBefore",(y=>function(S,_){var E=v(S);return E?y.call(this,E,_):S})),m(u,"replaceChild",(y=>function(S,_){var E=v(S);return E?y.call(this,E,_):_})),[(e=l.Element)==null?void 0:e.prototype,(n=l.Document)==null?void 0:n.prototype,(s=l.DocumentFragment)==null?void 0:s.prototype].forEach((y=>{m(y,"append",(S=>function(){for(var _=arguments.length,E=new Array(_),T=0;_>T;T++)E[T]=arguments[T];return S.apply(this,x(E))})),m(y,"prepend",(S=>function(){for(var _=arguments.length,E=new Array(_),T=0;_>T;T++)E[T]=arguments[T];return S.apply(this,x(E))}))})),[(r=l.Element)==null?void 0:r.prototype,(i=l.CharacterData)==null?void 0:i.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((y=>{m(y,"before",(S=>function(){for(var _=arguments.length,E=new Array(_),T=0;_>T;T++)E[T]=arguments[T];return S.apply(this,x(E))})),m(y,"after",(S=>function(){for(var _=arguments.length,E=new Array(_),T=0;_>T;T++)E[T]=arguments[T];return S.apply(this,x(E))})),m(y,"replaceWith",(S=>function(){for(var _=arguments.length,E=new Array(_),T=0;_>T;T++)E[T]=arguments[T];var k=x(E);return E.length&&!k.length?void 0:S.apply(this,k)}))})),m((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(y=>function(S,_){var E=v(_);return E?y.call(this,S,E):null})),this.pv=()=>{d.forEach((y=>y())),this.pv=void 0},this.gv()}gv(){var t=!1;return()=>{var e;t||(t=!0,this.lv--,this.lv===0&&((e=this.pv)==null||e.call(this)))}}mv(t,e){e===void 0&&(e=!0);var n=this.fv();try{var s=t(n);return e&&n(),s}catch(r){throw n(),r}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var a;!e.errored&&this.uv.length&&(vc.info("Processing "+this.uv.length+" events for site app with id "+t.id),this.uv.forEach((o=>this.mv((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.dv)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,vc.info("Site app with id "+t.id+" "+(a?"loaded":"errored")),s&&n()};try{var i=this.mv((a=>t.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;i&&(e.processEvent=i),s=!0}catch(a){vc.error(OX+t.id,a),r(!1)}if(s&&e.loaded)try{n()}catch(a){vc.error("Error while processing buffered events PostHog app with config id "+t.id,a),e.errored=!0}}yv(){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)}bv(t){var e=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t),s=function(i){try{e.mv((()=>i.processEvent==null?void 0:i.processEvent(n)))}catch(a){vc.error("Error while processing event "+t.event+" for site app "+i.id,a)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(t){var e,n,s,r=this;
310if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.yv(),void this._instance.on("eventCaptured",(l=>this.bv(l)))):void vc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.dv)==null||n.call(this),t.ok){var i=t.config;if((s=i.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(){var l,u=o.id,d=o.url;Ot["__$$ph_site_app_"+u]=r._instance,(l=Ot.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,d,(f=>{if(f)return vc.error(OX+u,f)}))};for(var o of i.siteApps)a()}else vc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},wZe={tracingHeaders:class{constructor(t){this._v=void 0,this.wv=void 0,this.Sv=void 0,this.Dd=()=>{var e,n,s=this.xv();s?(Ue(this._v)&&(this._v=(e=Ot.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Ue(this.wv)&&(this.wv=(n=Ot.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Hd()},this._instance=t}initialize(){this.startIfEnabledOrStop()}ws(t){var e,n;(e=Ot.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(n=Ot.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return tZe.error("failed to load script",s);t()}))}Cv(){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}xv(){var t=this.Cv();return Qt(t)?(Qt(this.Sv)?this.Sv.splice(0,this.Sv.length,...t):this.Sv=[...t],t.length>0?this.Sv:void 0):(Qt(this.Sv)&&this.Sv.splice(0),this.Sv=t||void 0,this.Sv)}Hd(){var t,e;(t=this._v)==null||t.call(this),(e=this.wv)==null||e.call(this),this._v=void 0,this.wv=void 0}startIfEnabledOrStop(){this.xv()?this.ws(this.Dd):this.Hd()}}},_Ze=$e({surveys:class extends aZe{constructor(t){var e;super(new dZe(t),{get projectToken(){return e.config.token},kv:new uZe(e=t)}),this._instance=t}$l(t,e){var n=e.query?OS(t,e.query):t;return new Promise((s=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((r=e.target)!==null&&r!==void 0?r:"api",n),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:s})}))}}},oR),EZe={toolbar:class{constructor(t){this.instance=t}Tv(t){Ot.ph_toolbar_state=t}Mv(){var t;return(t=Ot.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),WM(this.instance.config)||!we||!Ve)return!1;t=t??we.location,n=n??we.history;try{if(!e){try{we.localStorage.setItem("test","test"),we.localStorage.removeItem("test")}catch{return!1}e=we==null?void 0:we.localStorage}var s,r=fZe||Mk(t.hash,"__posthog")||Mk(t.hash,"state"),i=r?JZ((()=>JSON.parse(atob(decodeURIComponent(r)))))||JZ((()=>JSON.parse(decodeURIComponent(r)))):null;return i&&i.action==="ph_authorize"?((s=i).source="url",s&&Object.keys(s).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((s=JSON.parse(e.getItem(FX)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Ev(t){var e=Ot.ph_load_toolbar||Ot.ph_load_editor;!an(e)&&Xi(e)?e(t,this.instance):UX.warn("No toolbar load function found")}loadToolbar(t){var e=!(Ve==null||!Ve.getElementById(Wpe));if(!we||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=$e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(we.localStorage.setItem(FX,JSON.stringify($e({},s,{source:void 0}))),this.Mv()===2)this.Ev(s);else if(this.Mv()===0){var r;this.Tv(1),(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(i=>{if(i)return UX.error("[Toolbar] Failed to load",i),void this.Tv(0);this.Tv(2),this.Ev(s)})),Ds(we,"turbolinks:load",(()=>{this.Tv(0),this.loadToolbar(s)}))}return!0}Iv(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)}}},CZe=$e({experiments:Ki},oR),TZe={conversations:class{constructor(t){this.Rv=void 0,this._conversationsManager=null,this.Pv=!1,this.Me=null,this.Av=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Fv=t.ok,t.ok)){var e=t.config.conversations;an(e)||(_a(e)?this.Rv=e:(this.Rv=e.enabled,this.Me=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Rv=void 0,this.Me=null,this.Fv=void 0,this.Av=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pv||this._instance.config.disable_conversations||WM(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=Ot==null?void 0:Ot.__PosthogExtensions__;if(t&&!Ue(this.Rv)&&this.Rv)if(this.Me&&this.Me.token){this.Pv=!0;try{var e=t.initConversations;if(e)return this.Lv(e),void(this.Pv=!1);var n=t.loadExternalDependency;if(!n)return void this.Ov(_$);n(this._instance,"conversations",(s=>{s||!t.initConversations?this.Ov("Could not load conversations script",s):this.Lv(t.initConversations),this.Pv=!1}))}catch(s){this.Ov("Error initializing conversations",s),this.Pv=!1}}else qo.error("Conversations enabled but missing token in remote config.")}}Lv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Av=!1,qo.info("Conversations loaded successfully")}catch(e){this.Ov("Error completing conversations initialization",e)}else qo.error("Cannot complete initialization: remote config is null")}Ov(t,e){qo.error(t,e),this._conversationsManager=null,this.Pv=!1,this.Av=!0}show(){this._conversationsManager?this._conversationsManager.show():qo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rv===!0&&!zi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":WM(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Fv===!1?"remote_config_failed":Ue(this.Rv)?this.Fv?"disabled_in_project":"remote_config_pending":this.Rv?an(this.Me)||!this.Me.token?"missing_token":Ot!=null&&Ot.__PosthogExtensions__?this.Pv?"initializing":this.Av?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var s=this;return Ns((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,n):(qo.warn(Sp),null)}))()}getMessages(t,e){var n=this;return Ns((function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(qo.warn(Sp),null)}))()}markAsRead(t){var e=this;return Ns((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(qo.warn(Sp),null)}))()}getTickets(t){var e=this;return Ns((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(qo.warn(Sp),null)}))()}requestRestoreLink(t){var e=this;return Ns((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(qo.warn(Sp),null)}))()}restoreFromToken(t){var e=this;return Ns((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(qo.warn(Sp),null)}))()}restoreFromUrlToken(){var t=this;return Ns((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(qo.warn(Sp),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}kl(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Sl(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},kZe={logs:class{constructor(t){var e,n=this;this.name="logs",this.Dv=!1,this.$v=!1,this.Nv=!1,this.I=Hs("[logs]"),this.qv=$e({},this.I,{error(){for(var s=arguments.length,r=new Array(s),i=0;s>i;i++)r[i]=arguments[i];r.some(KX)||n.I.error(...r)}}),this.wa=[],this.jv=[],this.fh=0,this.ts=!1,this.Bv=()=>{var s,r;this.ts||(this.fh=0,(s=this.Hv)==null||s.onReconnect(),(r=this.Uv)==null||r.onReconnect())},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Dv=!0),we&&Ds(we,"online",this.Bv)}zv(t,e,n,s){var r,i=(function(a,o){var l,u,d,f,p,m,v,x=(l=a==null?void 0:a.flushIntervalMs)!==null&&l!==void 0?l:3e3,y=(u=a==null?void 0:a.maxBufferSize)!==null&&u!==void 0?u:100,S=o!=null&&o.consoleCapture?void 0:(d=a==null?void 0:a.maxLogsPerInterval)!==null&&d!==void 0?d:1e3,_=Ue(S)?Math.max(y,2048):Math.max(y,S),E=a==null?void 0:a.resourceAttributes;return{serviceName:(f=(p=E==null?void 0:E["service.name"])!==null&&p!==void 0?p:a==null?void 0:a.serviceName)!==null&&f!==void 0?f:o==null?void 0:o.serviceNameDefault,serviceVersion:(m=E==null?void 0:E["service.version"])!==null&&m!==void 0?m:a==null?void 0:a.serviceVersion,environment:(v=E==null?void 0:E["deployment.environment"])!==null&&v!==void 0?v:a==null?void 0:a.environment,resourceAttributes:E,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:x,maxBufferSize:y,maxQueueSize:_,maxBatchRecordsPerPost:100,rateCapWindowMs:x,maxLogsPerInterval:S,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,n);return[new SKe(this.Wv(t,e),i,this.qv,(()=>this.Vv()),(a=>a()),void 0,s),i]}Gv(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Hv||this.Zv!==e){var n;(n=this.Hv)==null||n.reset(),this.Zv=e;var s=this.zv((()=>this.wa),(r=>{this.wa=r}));this.Hv=s[0],this.Qv=s[1]}return this.Hv}
310Jv(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Uv||this.Kv!==e){var n;(n=this.Uv)==null||n.reset(),this.Kv=e;var s=this.zv((()=>this.jv),(r=>{this.jv=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},qX);this.Uv=s[0],this.Yv=s[1]}return this.Uv}setup(t){if(!this.ts){this.ss=t;var e=!1,n=t.onRemoteConfig((s=>{var r;e=s.ok&&((r=s.config.logs)==null?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(s)}));this.ts?n.dispose():(this.os=n,e||this.loadIfEnabled())}}dispose(){var t,e,n,s;this.ts||(this.ts=!0,(t=this.os)==null||t.dispose(),this.os=void 0,this.ss=void 0,this.Nv=!1,we==null||we.removeEventListener("online",this.Bv),(e=this.Xv)==null||e.call(this),this.Xv=void 0,(n=this.Hv)==null||n.reset(),(s=this.Uv)==null||s.reset())}onRemoteConfig(t){var e;if(!this.ts&&t.ok){var n=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!an(n)&&n&&(this.Dv=!0,this.loadIfEnabled())}}reset(){var t,e;this.wa=[],(t=this.Hv)==null||t.reset(),this.jv=[],(e=this.Uv)==null||e.reset(),this.fh=0}captureLog(t){this.ts||this.Gv().captureLog(t)}captureConsoleLog(t){this.ts||this.Jv().captureLog(t)}get logger(){return this.tc||(this.tc={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.tc}flushLogs(t){t?this.ec(t):(this.Hv&&this.Hv.flush().catch((e=>this.ic(e))),this.Uv&&this.Uv.flush().catch((e=>this.ic(e))))}ic(t){KX(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.ts&&this.Dv&&!this.$v&&!this.Nv){var t=Ot==null?void 0:Ot.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;if(e){this.Nv=!0;try{e(this._instance,"logs",(n=>{if(this.Nv=!1,!this.ts){var s,r=t.logs;n||r==null||!r.initializeLogs?this.I.error("Could not load logs script",n):(this.Xv=r.initializeLogs((s=this.ss)!==null&&s!==void 0?s:this._instance),this.$v=!0)}}))}catch(n){throw this.Nv=!1,n}}else this.I.error(_$)}else this.I.error("PostHog Extensions not found.")}}Wv(t,e){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:s=>s===Ju.LogsQueue?t():void 0,setPersistedProperty(s,r){var i;s===Ju.LogsQueue&&e((i=r)!==null&&i!==void 0?i:[])},En:s=>this.En(s),getLibraryId:()=>As.LIB_NAME,getLibraryVersion:()=>As.LIB_VERSION}}En(t){return new Promise((e=>{if(ime(this.fh,3))e({kind:"fatal",error:uI(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,s=i=>{n||(n=!0,clearTimeout(r),e(i))},r=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:uI(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.rc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{var a=i.statusCode;if(this.nc(a),a>=200&&300>a)s({kind:"ok"});else if(a===413)s({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)s({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;a===0?(i.error||this.I.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:uI(i.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(o=i.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}nc(t){(t!==0||this._instance.__loaded)&&(this.fh=ame(t,this.fh,3,(()=>this.I.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."))))}ec(t){this.wa.length>0&&this.sc(t,this.wa,this.Qv,As.LIB_NAME,(e=>{this.wa=e})),this.jv.length>0&&this.sc(t,this.jv,this.Yv,qX,(e=>{this.jv=e}))}sc(t,e,n,s,r){if(e.length!==0){var i=e.map((o=>o.record));r([]);var a=Rpe(i,kpe(n,As.LIB_NAME,As.LIB_VERSION),s,As.LIB_VERSION);this._instance._send_request({method:"POST",url:this.rc(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}rc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Vv(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=n.windowId,r=n.sessionStartTimestamp,i=n.lastActivityTimestamp;e.sessionId=n.sessionId,e.windowId=s,an(r)||(e.sessionStartTimestamp=r),an(i)||(e.lastActivityTimestamp=i)}if(Ot!=null&&(t=Ot.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?jh(Ot.location.href):Ot.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},RZe={metrics:class{constructor(t){this.I=Hs("[metrics]"),this._instance=t}initialize(){}Gv(){var t,e,n=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.Hv&&this.Zv===n||((e=this.Hv)==null||e.reset(),this.Zv=n,this.Hv=new wKe(this.Wv(),(function(s){var r,i,a,o,l,u=s==null?void 0:s.resourceAttributes;return{serviceName:(r=u==null?void 0:u["service.name"])!==null&&r!==void 0?r:s==null?void 0:s.serviceName,serviceVersion:(i=u==null?void 0:u["service.version"])!==null&&i!==void 0?i:s==null?void 0:s.serviceVersion,environment:(a=u==null?void 0:u["deployment.environment"])!==null&&a!==void 0?a:s==null?void 0:s.environment,resourceAttributes:u,beforeSend:s==null?void 0:s.beforeSend,flushIntervalMs:(o=s==null?void 0:s.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=s==null?void 0:s.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(n),this.I)),this.Hv}count(t,e,n){e===void 0&&(e=1),this.Gv().count(t,e,n)}
310gauge(t,e,n){this.Gv().gauge(t,e,n)}histogram(t,e,n){this.Gv().histogram(t,e,n)}flush(t){if(!this.Hv)return Promise.resolve();if(t){var e=this.Hv.drainWindow();return e&&this.zn(e,t),Promise.resolve()}return this.Hv.flush().catch((n=>this.I.error("PostHog metrics flush failed:",n)))}reset(){var t;(t=this.Hv)==null||t.reset()}Wv(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},zn:n=>e.zn(n),getLibraryId:()=>As.LIB_NAME,getLibraryVersion:()=>As.LIB_VERSION}}zn(t,e){return new Promise((n=>{var s=!1,r=a=>{s||(s=!0,clearTimeout(i),n(a))},i=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request($e({method:"POST",url:this.ac(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;r({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}ac(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},AZe=$e({},oR,vZe,xZe,yZe,bZe,SZe,_Ze,wZe,EZe,CZe,TZe,kZe,RZe);wo.__defaultExtensionClasses=$e({},AZe);var q1=(function(){As.SDK_DIST_CHANNEL="npm";var t=gb[p0]=new wo;return(function(){function e(){e.done||(e.done=!0,Pme=!1,ts(gb,(function(n){n._dom_loaded()})))}Ve!=null&&Ve.addEventListener?Ve.readyState==="complete"?e():Ds(Ve,"DOMContentLoaded",e,{capture:!1}):we&&Ze.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();const Il=t=>t??null;function K1(t,e,n,s){return(e==null?void 0:e.queryKey[s])===Il(n)?t:void 0}const to={usageDetails:t=>["usageDetails",Il(t)],orgDetails:t=>["org_details",Il(t)],apiKeys:t=>["api-keys",Il(t)],secrets:(t,e)=>["secrets",Il(t),e??null],environments:(t,e)=>["environments",Il(t),e??null],onboardingApiKey:t=>["onboarding-api-key",Il(t)],dailyBreakdown:(t,e,n,s,r)=>["dailyBreakdown",Il(t),e,n,s,r??null],sessionCounts:(t,e,n,s,r)=>["sessionCounts",Il(t),e,n,s,r??null],analyticsToken:t=>["analytics","tinybird_token",Il(t)],analytics:(t,e,n)=>["analytics",e,Il(t),n]},Pn=new X$e({defaultOptions:{queries:{staleTime:1e3*60*5}}}),NZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/analytics/token",...t}),$me=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/api-keys",...t}),Fme=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/api-keys",...t,headers:{"Content-Type":"application/json",...t.headers}}),IZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/api-keys/onboarding",...t}),LZe=t=>(t.client??ht).delete({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/api-keys/{id}",...t}),jZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/auth/device/verify",...t,headers:{"Content-Type":"application/json",...t.headers}}),PZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/auto-topup",...t}),MZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/auto-topup",...t,headers:{"Content-Type":"application/json",...t.headers}}),DZe=t=>((t==null?void 0:t.client)??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/billing-session",...t}),OZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/billing/invoices",...t}),$Ze=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/billing/invoices/{invoiceId}",...t}),FZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/budget",...t}),UZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/budget",...t,headers:{"Content-Type":"application/json",...t.headers}}),BZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/budget/alerts",...t,headers:{"Content-Type":"application/json",...t.headers}}),zZe=t=>(t.client??ht).delete({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/budget/alerts/{alertId}",...t}),VZe=t=>(t.client??ht).patch({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/budget/alerts/{alertId}",...t,headers:{"Content-Type":"application/json",...t.headers}}),HZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/checkout-session",...t,headers:{"Content-Type":"application/json",...t.headers}}),GZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/coupons/redeem",...t,headers:{"Content-Type":"application/json",...t.headers}}),WZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/credits/balance",...t}),qZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/credits/purchase",...t,headers:{"Content-Type":"application/json",...t.headers}}),KZe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/daily-breakdown",...t}),Ume=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/details",...t}),Bme=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/feedback",...t,headers:{"Content-Type":"application/json",...t.headers}}),zme=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/payment-method/default",...t,headers:{"Content-Type":"application/json",...t.headers}}),YZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/payment-method/detach",...t,headers:{"Content-Type":"application/json",...t.headers}}),Vme=t=>((t==null?void 0:t.client)??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/payment-method/setup-intent",...t}),ZZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/payment-methods",...t}),XZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/plan-change",...t,headers:{"Content-Type":"application/json",...t.headers}}),QZe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/plan-change/preview",...t,headers:{"Content-Type":"application/json",...t.headers}}),JZe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/projects",...t}),Hme=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/projects",...t,headers:{"Content-Type":"application/json",...t.headers}}),eXe=t=>(t.client??ht).delete({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/projects/{id}",...t}),tXe=t=>(t.client??ht).patch({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/projects/{id}",...t,headers:{"Content-Type":"application/json",...t.headers}}),nXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/projects/{id}/promote",...t}),Gme=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/proxy-ips",...t}),sXe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/proxy-ips/availability",...t}),rXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/proxy-ips/checkout-session",...t,headers:{"Content-Type":"application/json",...t.headers}}),iXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/proxy-ips/{identifier}/unsubscribe",...t}),aXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/proxy-ips/{identifier}/unsubscribe/recover",...t}),oXe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/questionnaire",...t}),lXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/questionnaire",...t,headers:{"Content-Type":"application/json",...t.headers}}),cXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/session-counts",...t}),uXe=t=>((t==null?void 0:t.client)??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions",...t}),dXe=t=>((t==null?void 0:t.client)??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions",...t,headers:{"Content-Type":"application/json",...t==null?void 0:t.headers}}),fXe=t=>((t==null?void 0:t.client)??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/release",...t}),hXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}",...t}),pXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/agent-logs",...t}),mXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/agent-traces",...t}),gXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/hls",...t}),vXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/logs",...t}),xXe=t=>(t.client??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/release",...t}),yXe=t=>(t.client??ht).get({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/sessions/{id}/rrweb-events",...t}),bXe=t=>((t==null?void 0:t.client)??ht).post({security:[{name:"steel-api-key",type:"apiKey"}],url:"/v1/usage-details",...t}),rD={MOBILE:"mobile"},tT={LIVE:"live"};function Wme(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),[s,r]=w.useState(null),[i,a]=w.useState(()=>{try{return localStorage.getItem("steel-api-key-visible")==="true"}catch{return!1}});w.useEffect(()=>{try{localStorage.setItem("steel-api-key-visible",i.toString())}catch{}},[i]);const{mutate:o,isPending:l}=Bi({mutationFn:async p=>{const m=p==="create"?await Fme({body:{name:"Onboarding"}}):await ht.post({url:"/v1/api-keys/onboarding/rotate",security:[{name:"steel-api-key",type:"apiKey"}]});if(m.error)throw m.error;return m.data},onSuccess:p=>{p&&(a(!0),Pn.invalidateQueries({queryKey:["api-keys"]}),r({orgId:n,key:p.key}),q1.capture("onboarding-api-key-created",{name:p.name}),Pn.invalidateQueries({queryKey:["onboarding-api-key"]}))},onError:()=>Bn({title:"Could not generate API key"})}),{data:u,isLoading:d,isSuccess:f}=rs({queryKey:to.onboardingApiKey(n),queryFn:async()=>{const p=await IZe({});if(p.error)throw p.error;return p.data},enabled:t&&!!e&&!!n,staleTime:1/0});return{onboardingApiKey:u,revealedKey:s&&s.orgId===n?s.key:null,isApiKeyVisible:i,setIsApiKeyVisible:a,createNewApiKey:o,isCreateApiKeyLoading:l,isOnboardingApiKeyLoading:d,isOnboardingApiKeySuccess:f}}const qme=w.createContext({apiKey:null,isVisible:!1,setIsVisible:()=>{}});function SXe({children:t}){const{onboardingApiKey:e,isApiKeyVisible:n,setIsApiKeyVisible:s}=Wme(),r={apiKey:(e==null?void 0:e.key)||null,isVisible:n,setIsVisible:s};return c.jsx(qme,{value:r,children:t})}function Kme(){return w.useContext(qme)}function wXe(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12 8V12L14.5 14.5M21 12C2
3101 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function _Xe(t){return c.jsx(rt,{...t,children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 12.5C14.75 12.5 12 15.4028 12 22C12 15.4028 9.25 12.5 3 12.5C9.25 12.5 12 9.59722 12 3C12 9.59722 14.75 12.5 21 12.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function Yme(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 8V7.2C8 6.0799 8 5.51984 8.21799 5.09202C8.40973 4.71569 8.71569 4.40973 9.09202 4.21799C9.51984 4 10.0799 4 11.2 4H16.8C17.9201 4 18.4802 4 18.908 4.21799C19.2843 4.40973 19.5903 4.71569 19.782 5.09202C20 5.51984 20 6.0799 20 7.2V12.8C20 13.9201 20 14.4802 19.782 14.908C19.5903 15.2843 19.2843 15.5903 18.908 15.782C18.4802 16 17.9201 16 16.8 16H16M16 11.2V16.8C16 17.9201 16 18.4802 15.782 18.908C15.5903 19.2843 15.2843 19.5903 14.908 19.782C14.4802 20 13.9201 20 12.8 20H7.2C6.0799 20 5.51984 20 5.09202 19.782C4.71569 19.5903 4.40973 19.2843 4.21799 18.908C4 18.4802 4 17.9201 4 16.8V11.2C4 10.0799 4 9.51984 4.21799 9.09202C4.40973 8.71569 4.71569 8.40973 5.09202 8.21799C5.51984 8 6.0799 8 7.2 8H12.8C13.9201 8 14.4802 8 14.908 8.21799C15.2843 8.40973 15.5903 8.71569 15.782 9.09202C16 9.51984 16 10.0799 16 11.2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function N$({options:t,value:e,onChange:n,layoutId:s="segmented-pill",labelledBy:r,trackClassName:i="bg-[var(--sand-1)]",pillClassName:a="bg-[var(--sand-3)]"}){const o=w.useRef([]);function l(u,d){var m;const f=u.key==="ArrowRight"?1:u.key==="ArrowLeft"?-1:0;if(f===0)return;u.preventDefault();const p=(d+f+t.length)%t.length;n(t[p].value),(m=o.current[p])==null||m.focus()}return c.jsx("div",{role:"radiogroup","aria-labelledby":r,className:`flex items-center gap-[4px] overflow-hidden rounded-full p-[4px] ${i}`,children:t.map((u,d)=>{const f=u.value===e;return c.jsxs("button",{ref:p=>{o.current[d]=p},type:"button",role:"radio","aria-checked":f,tabIndex:f?0:-1,onKeyDown:p=>l(p,d),onClick:()=>n(u.value),className:`relative flex h-[32px] items-center justify-center rounded-full px-[12px] text-[14px] font-medium leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer ${f?"text-[var(--sand-12)]":"text-[var(--sand-11)] hover:text-[var(--sand-12)]"}`,children:[f&&c.jsx(wt.span,{layoutId:s,transition:{type:"spring",bounce:.35,duration:.45},className:`absolute inset-0 z-0 rounded-full ${a}`}),c.jsx("span",{className:"relative z-[1]",children:u.label})]},u.value)})})}const nT=[{id:"curl",label:"curl",command:"curl -fsS https://setup.steel.dev | sh",time:"1-2m"},{id:"npm",label:"npm",command:"npm install -g @steel-dev/cli",time:"1-2m"}],Zme=[{id:"claude-code",label:"Claude Code",time:"2-3m"},{id:"cursor",label:"Cursor",time:"2-3m"},{id:"opencode",label:"OpenCode",time:"2-3m"},{id:"codex",label:"Codex",time:"2-3m"}],EXe=Math.max(nT.length,Zme.length),CXe=t=>`Set up Steel for me:
311curl -fsS https://setup.steel.dev | sh -s -- --agent --from ${t}`;function TXe(){var d;const[t,e]=w.useState("terminal"),[n,s]=w.useState("curl"),[r,i]=w.useState("claude-code"),a=t==="terminal",o=((d=nT.find(f=>f.id===n))==null?void 0:d.command)??nT[0].command,l=a?nT.map(f=>({id:f.id,label:f.label,time:f.time,selected:n===f.id,onClick:()=>s(f.id)})):Zme.map(f=>({id:f.id,label:f.label,time:f.time,selected:r===f.id,onClick:()=>i(f.id)})),u=EXe-l.length;return c.jsxs("div",{className:"flex w-full flex-col gap-[21px]",children:[c.jsx("div",{className:"self-start",children:c.jsx(N$,{trackClassName:"bg-[var(--sand-2)]",layoutId:"cli-mode-pill",value:t,onChange:f=>e(f),options:[{value:"terminal",label:"Human (Terminal)"},{value:"agent",label:"AI Agent"}]})}),c.jsxs("div",{className:"flex w-full overflow-hidden rounded-[16px] border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)]",children:[c.jsxs("div",{className:"flex w-[300px] shrink-0 flex-col overflow-hidden border-r-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)]",children:[c.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 border-b-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)] px-4",children:[c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"}),c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"}),c.jsx("span",{className:"size-3 rounded-full bg-[var(--sand-8)]"})]}),l.map((f,p)=>c.jsx(kXe,{label:f.label,time:f.time,selected:f.selected,onClick:f.onClick,last:u===0&&p===l.length-1},f.id)),Array.from({length:u}).map((f,p)=>c.jsx("div",{className:He("h-11 shrink-0 bg-[var(--sand-2)]",p!==u-1&&"border-b-[0.5px] border-[var(--sand-6)]")},`filler-${p}`))]}),c.jsxs("div",{className:"flex min-w-px flex-1 flex-col self-stretch overflow-hidden",children:[c.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 border-b-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)] px-3",children:[a?c.jsx(Kde,{size:20,className:"shrink-0 text-[var(--sand-12)]"}):c.jsx(_Xe,{size:20,className:"shrink-0 text-[var(--sand-12)]"}),c.jsx("span",{className:"text-[14px] font-medium leading-5 text-[var(--sand-12)]",children:a?"Terminal":"AI Agent"})]}),a?c.jsx(YX,{displayText:o,copyLabel:"Copy text"}):c.jsx(YX,{displayText:CXe(r),copyLabel:"Copy Prompt",onCopy:()=>q1.capture("quickstart-hero-prompt-copied",{lane:"agent",agent:r})})]})]})]})}function kXe({label:t,time:e,selected:n,onClick:s,last:r}){return c.jsxs("button",{type:"button",onClick:s,className:He("flex h-11 items-center justify-between gap-2 px-4 transition-colors",!r&&"border-b-[0.5px] border-[var(--sand-6)]",n?"bg-[var(--sand-3)]":"bg-[var(--sand-2)] hover:bg-[var(--sand-3)]"),children:[c.jsx("span",{className:He("min-w-0 truncate text-[14px] font-medium leading-5",n?"text-[var(--sand-12)]":"text-[var(--sand-10)]"),children:t}),c.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(wXe,{size:16,className:n?"text-[var(--sand-12)]":"text-[var(--sand-10)]"}),c.jsx("span",{className:He("text-[12px] font-medium leading-5",n?"text-[var(--sand-12)]":"text-[var(--sand-10)]"),children:e})]})]})}function YX({displayText:t,onCopy:e,copyLabel:n="Copy Prompt"}){const[s,r]=w.useState(!1),[i,a]=w.useState(0),o=()=>{const l=n.replace(/^copy\s+/i,"").trim();Ja(t,l?l.charAt(0).toUpperCase()+l.slice(1):void 0),e==null||e(),r(!0),a(u=>u+1),window.setTimeout(()=>r(!1),1500)};return c.jsxs("div",{className:"flex min-h-px flex-1 flex-col gap-3 p-3",children:[c.jsx(xr,{mode:"wait",children:c.jsx(wt.p,{initial:{opacity:0,filter:"blur(4px)"}
311,animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:{duration:.2,ease:"easeOut"},className:He("whitespace-pre-wrap break-all font-medium text-[14px] leading-5",s?"copy-shimmer-text":"text-[var(--sand-10)]"),children:t},t)}),c.jsxs("button",{type:"button",onClick:o,className:"mt-auto flex shrink-0 cursor-pointer items-center gap-[6px] self-end text-[14px] font-medium leading-5 text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",children:[c.jsx(Yme,{className:"size-5"}),c.jsx("span",{className:i>0?"copy-flash":void 0,children:n},i)]})]})}function RXe({label:t,languageIcons:e,text:n,heroImage:s,accentColor:r="#7CE2FE",onMouseEnter:i,onMouseLeave:a}){return c.jsxs("div",{onMouseEnter:i,onMouseLeave:a,className:He("relative rounded-[16px] overflow-hidden transition-colors","bg-[var(--sand-2)]","hover:bg-[var(--sand-4)]"),children:[c.jsx("div",{className:"absolute right-3 top-3 z-[1] flex size-7 items-center justify-center rounded-full bg-[#00000066] backdrop-blur-md",children:c.jsx(La,{size:20,className:"text-white dark:text-[var(--sand-12)]"})}),c.jsx("div",{className:"w-full h-[126px] flex flex-col-reverse justify-between p-3 relative",style:{background:s?`linear-gradient(186.96deg, rgba(0, 0, 0, 0.14) 60.19%, rgba(0, 0, 0, 0.7) 94.56%), linear-gradient(0deg, ${r}, ${r}), url(${s})`:`radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.28), transparent 28%), linear-gradient(135deg, ${r}, #10243E)`,backgroundBlendMode:"normal, soft-light, normal",backgroundSize:"cover, cover, cover"},children:(e==null?void 0:e.length)>0&&c.jsx("div",{className:"backdrop-blur-md w-fit rounded-full bg-[#00000066] py-1 px-2 gap-1 flex",children:e.map((o,l)=>c.jsx("div",{className:"flex items-center justify-center text-white dark:text-[var(--sand-12)]",children:o},l))})}),c.jsxs("div",{className:"px-4 pt-3 pb-4",children:[c.jsx("h3",{className:"truncate text-base font-medium text-green-dark-12",children:t}),c.jsx("p",{className:"text-sm leading-[20px] font-medium text-[var(--sand-11)] mt-2 line-clamp-2",children:n})]})]})}var AXe=Object.defineProperty,$S=(t,e)=>AXe(t,"name",{value:e,configurable:!0}),I$="Collapsible",[NXe,Xme]=hu(I$),[IXe,L$]=NXe(I$),LXe=w.forwardRef($S(function(e,n){const{__scopeCollapsible:s,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...l}=e,[u,d]=Nd({prop:r,defaultProp:i??!1,onChange:o,caller:I$});return c.jsx(IXe,{scope:s,disabled:a,contentId:Zc(),open:u,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(is.div,{"data-state":lR(u),"data-disabled":a?"":void 0,...l,ref:n})})},"Collapsible")),jXe="CollapsibleTrigger",PXe=w.forwardRef($S(function(e,n){const{__scopeCollapsible:s,...r}=e,i=L$(jXe,s);return c.jsx(is.button,{type:"button","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":lR(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:n,onClick:Cn(e.onClick,i.onOpenToggle)})},"CollapsibleTrigger")),Qme="CollapsibleContent",MXe=w.forwardRef($S(function(e,n){const{forceMount:s,...r}=e,i=L$(Qme,e.__scopeCollapsible);return c.jsx($d,{present:s||i.open,children:({present:a})=>c.jsx(DXe,{...r,ref:n,present:a})})},"CollapsibleContent")),DXe=w.forwardRef($S(function(e,n){const{__scopeCollapsible:s,present:r,children:i,...a}=e,o=L$(Qme,s),[l,u]=w.useState(r),d=w.useRef(null),f=ps(n,d),p=w.useRef(0),m=p.current,v=w.useRef(0),x=v.current,y=o.open||l,S=w.useRef(y),_=w.useRef(void 0);return w.useEffect(()=>{const E=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(E)},[]),Ir(()=>{const E=d.current;if(E){_.current=_.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const T=E.getBoundingClientRect();p.current=T.height,v.current=T.width,S.current||(E.style.transitionDuration=_.current.transitionDuration,E.style.animationName=_.current.animationName),u(r)}},[o.open,r]),c.jsx(is.div,{"data-state":lR(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...a,ref:f,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:y&&i})},"CollapsibleContentImpl"));function lR(t){return t?"open":"closed"}$S(lR,"getState");var OXe=LXe,$Xe=PXe,FXe=MXe,UXe=Object.defineProperty,Io=(t,e)=>UXe(t,"name",{value:e,configurable:!0}),pu="Accordion",BXe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[j$,zXe,VXe]=H7(pu),[cR,fxt]=hu(pu,[VXe,Xme]),P$=Xme(),HXe=w.forwardRef(
311Io(function(e,n){const{type:s,...r}=e,i=r,a=r;return c.jsx(j$.Provider,{scope:e.__scopeAccordion,children:s==="multiple"?c.jsx(KXe,{...a,ref:n}):c.jsx(qXe,{...i,ref:n})})},"Accordion")),[Jme,GXe]=cR(pu),[ege,WXe]=cR(pu,{collapsible:!1}),qXe=w.forwardRef(Io(function(e,n){const{value:s,defaultValue:r,onValueChange:i=Io(()=>{},"onValueChange"),collapsible:a=!1,...o}=e,[l,u]=Nd({prop:s,defaultProp:r??"",onChange:i,caller:pu});return c.jsx(Jme,{scope:e.__scopeAccordion,value:w.useMemo(()=>l?[l]:[],[l]),onItemOpen:u,onItemClose:w.useCallback(()=>a&&u(""),[a,u]),children:c.jsx(ege,{scope:e.__scopeAccordion,collapsible:a,children:c.jsx(tge,{...o,ref:n})})})},"AccordionImplSingle")),KXe=w.forwardRef(Io(function(e,n){const{value:s,defaultValue:r,onValueChange:i=Io(()=>{},"onValueChange"),...a}=e,[o,l]=Nd({prop:s,defaultProp:r??[],onChange:i,caller:pu}),u=w.useCallback(f=>l((p=[])=>[...p,f]),[l]),d=w.useCallback(f=>l((p=[])=>p.filter(m=>m!==f)),[l]);return c.jsx(Jme,{scope:e.__scopeAccordion,value:o,onItemOpen:u,onItemClose:d,children:c.jsx(ege,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(tge,{...a,ref:n})})})},"AccordionImplMultiple")),[YXe,uR]=cR(pu),tge=w.forwardRef(Io(function(e,n){const{__scopeAccordion:s,disabled:r,dir:i,orientation:a="vertical",...o}=e,l=w.useRef(null),u=ps(l,n),d=zXe(s),p=W7(i)==="ltr",m=Cn(e.onKeyDown,v=>{var L;if(!BXe.includes(v.key))return;const x=v.target,y=d().filter(j=>{var F;return!((F=j.ref.current)!=null&&F.disabled)}),S=y.findIndex(j=>j.ref.current===x),_=y.length;if(S===-1)return;v.preventDefault();let E=S;const T=0,k=_-1,R=Io(()=>{E=S+1,E>k&&(E=T)},"moveNext"),I=Io(()=>{E=S-1,E<T&&(E=k)},"movePrev");switch(v.key){case"Home":E=T;break;case"End":E=k;break;case"ArrowRight":a==="horizontal"&&(p?R():I());break;case"ArrowDown":a==="vertical"&&R();break;case"ArrowLeft":a==="horizontal"&&(p?I():R());break;case"ArrowUp":a==="vertical"&&I();break}const A=E%_;(L=y[A].ref.current)==null||L.focus()});return c.jsx(YXe,{scope:s,disabled:r,direction:i,orientation:a,children:c.jsx(j$.Slot,{scope:s,children:c.jsx(is.div,{...o,"data-orientation":a,ref:u,onKeyDown:r?void 0:m})})})},"AccordionImpl")),iD="AccordionItem",[ZXe,M$]=cR(iD),XXe=w.forwardRef(Io(function(e,n){const{__scopeAccordion:s,value:r,...i}=e,a=uR(iD,s),o=GXe(iD,s),l=P$(s),u=Zc(),d=r&&o.value.includes(r)||!1,f=a.disabled||e.disabled;return c.jsx(ZXe,{scope:s,open:d,disabled:f,triggerId:u,children:c.jsx(OXe,{"data-orientation":a.orientation,"data-state":D$(d),...l,...i,ref:n,disabled:f,open:d,onOpenChange:p=>{p?o.onItemOpen(r):o.onItemClose(r)}})})},"AccordionItem")),QXe="AccordionHeader",JXe=w.forwardRef(Io(function(e,n){const{__scopeAccordion:s,...r}=e,i=uR(pu,s),a=M$(QXe,s);return c.jsx(is.h3,{"data-orientation":i.orientation,"data-state":D$(a.open),"data-disabled":a.disabled?"":void 0,...r,ref:n})},"AccordionHeader")),ZX="AccordionTrigger",eQe=w.forwardRef(Io(function(e,n){const{__scopeAccordion:s,...r}=e,i=uR(pu,s),a=M$(ZX,s),o=WXe(ZX,s),l=P$(s);return c.jsx(j$.ItemSlot,{scope:s,children:c.jsx($Xe,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...l,...r,ref:n})})},"AccordionTrigger")),tQe="AccordionContent",nQe=w.forwardRef(Io(function(e,n){const{__scopeAccordion:s,...r}=e,i=uR(pu,s),a=M$(tQe,s),o=P$(s);return c.jsx(FXe,{role:"region","aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})},"AccordionContent"));function D$(t){return t?"open":"closed"}Io(D$,"getState");var sQe=HXe,rQe=XXe,iQe=JXe,nge=eQe,sge=nQe,aQe=Object.defineProperty,Do=(t,e)=>aQe(t,"name",{value:e,configurable:!0}),O$="Dialog",[rge,hxt]=hu(O$),[oQe,oc]=rge(O$),lQe=Do(t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:a=!0}=t,o=w.useRef(null),l=w.useRef(null),[u,d]=Nd({prop:s,defaultProp:r??!1,onChange:i,caller:O$}),[f,p]=w.useState(0),[m,v]=w.useState(0);return c.jsx(oQe,{scope:e,triggerRef:o,contentRef:l,contentId:Zc(),titleId:Zc(),descriptionId:Zc(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:v,open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(x=>!x),[d]),modal:a,children:n})},"Dialog"),cQe="DialogTrigger",uQe=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,...r}=e,i=oc(cQe,s),a=ps(n,i.triggerRef);return c.jsx(is.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":dR(i.open),...r,ref:a,onClick:Cn(e.onClick,i.onOpenToggle)})},"DialogTrigger")),ige="DialogPortal",[dQe,age]=rge(ige,{forceMount:void 0}),fQe=Do(t=>{const{__scopeDialog:e,forceMount:n,children:s,container:r}=t,i=oc(ige,e);return c.jsx(dQe,{scope:e,forceMount:n,children:w.Children.map(s,a=>c.jsx($d,{present:n||i.open,children:c.jsx(Z4,{asChild:!0,container:r,children:a})}))})},"DialogPortal"),aD="DialogOverlay",oge=w.forwardRef(Do(function(e,n){const s=age(aD,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,a=oc(aD,e.__scopeDialog);return a.modal?c.jsx($d,{present:r||a.open,children:c.jsx(pQe,{...i,ref:n})}):null},"DialogOverlay")),hQe=iu("DialogOverlay.RemoveScroll"),pQe=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,...r}=e,i=oc(aD,s),a=Ofe(),o=ps(n,a);return c.jsx(Q4,{as:hQe,allowPinchZoom:!0,shards:[i.contentRef],children:c.jsx(is.div,{"data-state":dR(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),g2="DialogContent",lge=w.forwardRef(Do(function(e,n){const s=age(g2,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,a=oc(g2,e.__scopeDialog);return c.jsx($d,{present:r||a.open,children:a.modal?c.jsx(mQe,{...i,ref:n}):c.jsx(gQe,{...i,ref:n})})},"DialogContent")),mQe=w.forwardRef(Do(function(e,n){const s=oc(g2,e.__scopeDialog),r=w.useRef(null),i=ps(n,s.contentRef,r);return w.useEffect(()=>{const a=r.current;if(a)return a$(a)},[]),c.jsx(cge,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:Cn(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=s.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Cn(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:Cn(e.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),gQe=w.forwardRef(Do(function(e,n){const s=oc(g2,e.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return c.jsx(cge,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(l=s.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((d=s.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})},"DialogContentNonModal")),cge=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=oc(g2,s);return IS(),c.jsx(c.Fragment,{children:c.jsx(Y7,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:c.jsx(V4,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":dR(l.open),...o,ref:n,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),vQe="DialogTitle",uge=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,...r}=e,i=oc(vQe,s),{setTitleCount:a}=i;return Ir(()=>(a(o=>o+1),()=>a(o=>
311o-1)),[a]),c.jsx(is.h2,{id:i.titleId,...r,ref:n})},"DialogTitle")),xQe="DialogDescription",dge=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,...r}=e,i=oc(xQe,s),{setDescriptionCount:a}=i;return Ir(()=>(a(o=>o+1),()=>a(o=>o-1)),[a]),c.jsx(is.p,{id:i.descriptionId,...r,ref:n})},"DialogDescription")),yQe="DialogClose",bQe=w.forwardRef(Do(function(e,n){const{__scopeDialog:s,...r}=e,i=oc(yQe,s);return c.jsx(is.button,{type:"button",...r,ref:n,onClick:Cn(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function dR(t){return t?"open":"closed"}Do(dR,"getState");var SQe=Object.defineProperty,qh=(t,e)=>SQe(t,"name",{value:e,configurable:!0}),$$="Popover",[fge,pxt]=hu($$,[H1]),F$=H1(),[wQe,Y1]=fge($$),_Qe=qh(t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:r,onOpenChange:i,modal:a=!1}=t,o=F$(e),l=w.useRef(null),[u,d]=w.useState(!1),[f,p]=Nd({prop:s,defaultProp:r??!1,onChange:i,caller:$$});return c.jsx(s$,{...o,children:c.jsx(wQe,{scope:e,contentId:Zc(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(m=>!m),[p]),hasCustomAnchor:u,onCustomAnchorAdd:w.useCallback(()=>d(!0),[]),onCustomAnchorRemove:w.useCallback(()=>d(!1),[]),modal:a,children:n})})},"Popover"),EQe="PopoverTrigger",CQe=w.forwardRef(qh(function(e,n){const{__scopePopover:s,...r}=e,i=Y1(EQe,s),a=F$(s),o=ps(n,i.triggerRef),l=c.jsx(is.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":U$(i.open),...r,ref:o,onClick:Cn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:c.jsx(r$,{asChild:!0,...a,children:l})},"PopoverTrigger")),hge="PopoverPortal",[TQe,kQe]=fge(hge,{forceMount:void 0}),RQe=qh(t=>{const{__scopePopover:e,forceMount:n,children:s,container:r}=t,i=Y1(hge,e);return c.jsx(TQe,{scope:e,forceMount:n,children:c.jsx($d,{present:n||i.open,children:c.jsx(Z4,{asChild:!0,container:r,children:s})})})},"PopoverPortal"),v2="PopoverContent",AQe=w.forwardRef(qh(function(e,n){const s=kQe(v2,e.__scopePopover),{forceMount:r=s.forceMount,...i}=e,a=Y1(v2,e.__scopePopover);return c.jsx($d,{present:r||a.open,children:a.modal?c.jsx(IQe,{...i,ref:n}):c.jsx(LQe,{...i,ref:n})})},"PopoverContent")),NQe=iu("PopoverContent.RemoveScroll"),IQe=w.forwardRef(qh(function(e,n){const s=Y1(v2,e.__scopePopover),r=w.useRef(null),i=ps(n,r),a=w.useRef(!1);return w.useEffect(()=>{const o=r.current;if(o)return a$(o)},[]),c.jsx(Q4,{as:NQe,allowPinchZoom:!0,children:c.jsx(pge,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Cn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),a.current||(l=s.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Cn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Cn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),LQe=w.forwardRef(qh(function(e,n){const s=Y1(v2,e.__scopePopover),r=w.useRef(!1),i=w.useRef(!1);return c.jsx(pge,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(l=s.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((d=s.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})},"PopoverContentNonModal")),pge=w.forwardRef(qh(function(e,n){const{__scopePopover:s,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...p}=e,m=Y1(v2,s),v=F$(s);return IS(),c.jsx(Y7,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:c.jsx(V4,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:c.jsx(i$,{"data-state":U$(m.open),role:"dialog",id:m.contentId,...v,...p,ref:n,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function U$(t){return t?"open":"closed"}qh(U$,"getState");var jQe=_Qe,PQe=CQe,MQe=RQe,mge=AQe,DQe=Object.defineProperty,Ei=(t,e)=>DQe(t,"name",{value:e,configurable:!0}),[B$,mxt]=hu("Tooltip",[H1]),z$=H1(),OQe="TooltipProvider",$Qe=700,oD="tooltip.open",[FQe,V$]=B$(OQe),UQe=Ei(t=>{const{__scopeTooltip:e,delayDuration:n=$Qe,skipDelayDuration:s=300,disableHoverableContent:r=!1,
vendor: 6,261 bytes, line 311
311children:i}=t,a=w.useRef(!0),o=w.useRef(!1),l=w.useRef(0);return w.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(FQe,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:w.useCallback(()=>{s<=0||(window.clearTimeout(l.current),a.current=!1)},[s]),onClose:w.useCallback(()=>{s<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,s))},[s]),isPointerInTransitRef:o,onPointerInTransitChange:w.useCallback(u=>{o.current=u},[]),disableHoverableContent:r,children:i})},"TooltipProvider"),lD="Tooltip",[BQe,FS]=B$(lD),zQe=Ei(t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:r,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=t,l=V$(lD,t.__scopeTooltip),u=z$(e),[d,f]=w.useState(null),[p,m]=w.useState(void 0),v=Zc(),x=w.useRef(0),y=a??l.disableHoverableContent,S=o??l.delayDuration,_=w.useRef(!1),[E,T]=Nd({prop:s,defaultProp:r??!1,onChange:Ei(j=>{j?(l.onOpen(),document.dispatchEvent(new CustomEvent(oD))):l.onClose(),i==null||i(j)},"onChange"),caller:lD}),k=w.useMemo(()=>E?_.current?"delayed-open":"instant-open":"closed",[E]),R=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,_.current=!1,T(!0)},[T]),I=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),A=w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{_.current=!0,T(!0),x.current=0},S)},[S,T]);w.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]);const L=p??v;return c.jsx(s$,{...u,children:c.jsx(BQe,{scope:e,contentId:L,setContentId:m,open:E,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:w.useCallback(()=>{l.isOpenDelayedRef.current?A():R()},[l.isOpenDelayedRef,A,R]),onTriggerLeave:w.useCallback(()=>{y?I():(window.clearTimeout(x.current),x.current=0)},[I,y]),onOpen:R,onClose:I,disableHoverableContent:y,children:n})})},"Tooltip"),XX="TooltipTrigger",VQe=w.forwardRef(Ei(function(e,n){const{__scopeTooltip:s,...r}=e,i=FS(XX,s),a=V$(XX,s),o=z$(s),l=w.useRef(null),u=ps(n,l,i.onTriggerChange),d=w.useRef(!1),f=w.useRef(!1),p=w.useCallback(()=>d.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),c.jsx(r$,{asChild:!0,...o,children:c.jsx(is.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:Cn(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Cn(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Cn(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Cn(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Cn(e.onBlur,i.onClose),onClick:Cn(e.onClick,i.onClose)})})},"TooltipTrigger")),gge="TooltipPortal",[HQe,GQe]=B$(gge,{forceMount:void 0}),WQe=Ei(t=>{const{__scopeTooltip:e,forceMount:n,children:s,container:r}=t,i=FS(gge,e);return c.jsx(HQe,{scope:e,forceMount:n,children:c.jsx($d,{present:n||i.open,children:c.jsx(Z4,{asChild:!0,container:r,children:s})})})},"TooltipPortal"),x2="TooltipContent",qQe=w.forwardRef(Ei(function(e,n){const s=GQe(x2,e.__scopeTooltip),{forceMount:r=s.forceMount,side:i="top",...a}=e,o=FS(x2,e.__scopeTooltip);return c.jsx($d,{present:r||o.open,children:o.disableHoverableContent?c.jsx(vge,{side:i,...a,ref:n}):c.jsx(KQe,{side:i,...a,ref:n})})},"TooltipContent")),KQe=w.forwardRef(Ei(function(e,n){const s=FS(x2,e.__scopeTooltip),r=V$(x2,e.__scopeTooltip),i=w.useRef(null),a=ps(n,i),[o,l]=w.useState(null),{trigger:u,onClose:d}=s,f=i.current,{onPointerInTransitChange:p}=r,m=w.useCallback(()=>{l(null),p(!1)},[p]),v=w.useCallback((x,y)=>{const S=x.currentTarget,_={x:x.clientX,y:x.clientY},E=xge(_,S.getBoundingClientRect()),T=yge(_,E),k=bge(y.getBoundingClientRect()),R=wge([...T,...k]);l(R),p(!0)},[p]);return w.useEffect(()=>()=>m(),[m]),w.useEffect(()=>{if(u&&f){const x=Ei(S=>v(S,f),"handleTriggerLeave"),y=Ei(S=>v(S,u),"handleContentLeave");return u.addEventListener("pointerleave",x),f.addEventListener("pointerleave",y),()=>{u.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",y)}}},[u,f,v,m]),w.useEffect(()=>{if(o){const x=Ei(y=>{const S=y.target,_={x:y.clientX,y:y.clientY},E=(u==null?void 0:u.contains(S))||(f==null?void 0:f.contains(S)),T=!Sge(_,o);E?m():T&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,f,o,d,m]),c.jsx(vge,{...e,ref:a})},"TooltipContentHoverable")),YQe=pde("TooltipContent"),vge=w.forwardRef(Ei(function(e,n){const{__scopeTooltip:s,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=e,d=FS(x2,s),f=z$(s),{onClose:p}=d;w.useEffect(()=>(document.addEventListener(oD,p),()=>document.removeEventListener(oD,p)),[p]),w.useEffect(()=>{if(d.trigger){const v=Ei(x=>{x.target instanceof Node&&x.target.contains(d.trigger)&&p()},"handleScroll");return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[d.trigger,p]);const{setContentId:m}=d;return Ir(()=>(m(a),()=>{m(void 0)}),[a,m]),c.jsx(V4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:p,children:c.jsxs(i$,{"data-state":d.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:d.contentId,...f,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(YQe,{children:r}),i?c.jsx(YGe,{id:d.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function xge(t,e){const n=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),r=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,s,r,i)){case i:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}Ei(xge,"getExitSideFromRect");function yge(t,e,n=5){const s=[];
311switch(e){case"top":s.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":s.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":s.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":s.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return s}Ei(yge,"getPaddedExitPoints");function bge(t){const{top:e,right:n,bottom:s,left:r}=t;return[{x:r,y:e},{x:n,y:e},{x:n,y:s},{x:r,y:s}]}Ei(bge,"getPointsFromRect");function Sge(t,e){const{x:n,y:s}=t;let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const o=e[i],l=e[a],u=o.x,d=o.y,f=l.x,p=l.y;d>s!=p>s&&n<(f-u)*(s-d)/(p-d)+u&&(r=!r)}return r}Ei(Sge,"isPointInPolygon");function wge(t){const e=t.slice();return e.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),_ge(e)}Ei(wge,"getHull");function _ge(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s<t.length;s++){const r=t[s];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(r.y-a.y)>=(i.y-a.y)*(r.x-a.x))e.pop();else break}e.push(r)}e.pop();const n=[];for(let s=t.length-1;s>=0;s--){const r=t[s];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(r.y-a.y)>=(i.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}Ei(_ge,"getHullPresorted");var ZQe=UQe,XQe=zQe,QQe=VQe,JQe=WQe,Ege=qQe,dI={exports:{}};/*!
312	Copyright (c) 2018 Jed Watson.
313	Licensed under the MIT License (MIT), see
314	http://jedwatson.github.io/classnames
315*/var QX;function eJe(){return QX||(QX=1,(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",a=0;a<arguments.length;a++){var o=arguments[a];o&&(i=r(i,s(o)))}return i}function s(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var a="";for(var o in i)e.call(i,o)&&i[o]&&(a=r(a,o));return a}function r(i,a){return a?i?i+" "+a:i+a:i}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(dI)),dI.exports}var tJe=eJe();const M0=Y2(tJe),nJe={asChild:{type:"boolean"}},sJe={width:{type:"string",className:"rt-r-w",customProperties:["--width"],responsive:!0},minWidth:{type:"string",className:"rt-r-min-w",customProperties:["--min-width"],responsive:!0},maxWidth:{type:"string",className:"rt-r-max-w",customProperties:["--max-width"],responsive:!0}},rJe={height:{type:"string",className:"rt-r-h",customProperties:["--height"],responsive:!0},minHeight:{type:"string",className:"rt-r-min-h",customProperties:["--min-height"],responsive:!0},maxHeight:{type:"string",className:"rt-r-max-h",customProperties:["--max-height"],responsive:!0}},iJe=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],aJe={color:{type:"enum",values:iJe,default:void 0}},oJe={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}},lJe=["normal","start","end","both"],cJe={trim:{type:"enum",className:"rt-r-lt",values:lJe,responsive:!0}},uJe=["left","center","right"],dJe={align:{type:"enum",className:"rt-r-ta",values:uJe,responsive:!0}},fJe=["wrap","nowrap","pretty","balance"],hJe={wrap:{type:"enum",className:"rt-r-tw",values:fJe,responsive:!0}},pJe={truncate:{type:"boolean",className:"rt-truncate"}},mJe=["light","regular","medium","bold"],gJe={weight:{type:"enum",className:"rt-r-weight",values:mJe,responsive:!0}},vJe=["initial","xs","sm","md","lg","xl"],H$=new Set(vJe);function Cge(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function vb(t){return typeof t=="object"&&t!==null&&Object.keys(t).some(e=>H$.has(e))}function xJe({className:t,customProperties:e,...n}){const s=Tge({allowArbitraryValues:!0,className:t,...n}),r=yJe({customProperties:e,...n});return[s,r]}function Tge({allowArbitraryValues:t,value:e,className:n,propValues:s,parseValue:r=i=>i}){const i=[];if(e){if(typeof e=="string"&&s.includes(e))return JX(n,e,r);if(vb(e)){const a=e;
315for(const o in a){if(!Cge(a,o)||!H$.has(o))continue;const l=a[o];if(l!==void 0){if(s.includes(l)){const u=JX(n,l,r),d=o==="initial"?u:`${o}:${u}`;i.push(d)}else if(t){const u=o==="initial"?n:`${o}:${n}`;i.push(u)}}}return i.join(" ")}if(t)return n}}function JX(t,e,n){const s=t?"-":"",r=n(e),i=r==null?void 0:r.startsWith("-"),a=i?"-":"",o=i?r==null?void 0:r.substring(1):r;return`${a}${t}${s}${o}`}function yJe({customProperties:t,value:e,propValues:n,parseValue:s=r=>r}){let r={};if(!(!e||typeof e=="string"&&n.includes(e))){if(typeof e=="string"&&(r=Object.fromEntries(t.map(i=>[i,e]))),vb(e)){const i=e;for(const a in i){if(!Cge(i,a)||!H$.has(a))continue;const o=i[a];if(!n.includes(o))for(const l of t)r={[a==="initial"?l:`${l}-${a}`]:o,...r}}}for(const i in r){const a=r[i];a!==void 0&&(r[i]=s(a))}return r}}function eQ(...t){let e={};for(const n of t)n&&(e={...e,...n});return Object.keys(e).length?e:void 0}function bJe(...t){return Object.assign({},...t)}function kge(t,...e){let n,s;const r={...t},i=bJe(...e);for(const a in i){let o=r[a];const l=i[a];if(l.default!==void 0&&o===void 0&&(o=l.default),l.type==="enum"&&![l.default,...l.values].includes(o)&&!vb(o)&&(o=l.default),r[a]=o,"className"in l&&l.className){delete r[a];const u="responsive"in l;if(!o||vb(o)&&!u)continue;if(vb(o)&&(l.default!==void 0&&o.initial===void 0&&(o.initial=l.default),l.type==="enum"&&([l.default,...l.values].includes(o.initial)||(o.initial=l.default))),l.type==="enum"){const d=Tge({allowArbitraryValues:!1,value:o,className:l.className,propValues:l.values,parseValue:l.parseValue});n=M0(n,d);continue}if(l.type==="string"||l.type==="enum | string"){const d=l.type==="string"?[]:l.values,[f,p]=xJe({className:l.className,customProperties:l.customProperties,propValues:d,parseValue:l.parseValue,value:o});s=eQ(s,p),n=M0(n,f);continue}if(l.type==="boolean"&&o){n=M0(n,l.className);continue}}}return r.className=M0(n,t.className),r.style=eQ(s,t.style),r}const wp=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Rge={m:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:wp,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}},SJe=["span","div","label","p"],wJe=["1","2","3","4","5","6","7","8","9"],_Je={as:{type:"enum",values:SJe,default:"span"},...nJe,size:{type:"enum",className:"rt-r-size",values:wJe,responsive:!0},...gJe,...dJe,...cJe,...pJe,...hJe,...aJe,...oJe},G$=w.forwardRef((t,e)=>{const{children:n,className:s,asChild:r,as:i="span",color:a,...o}=kge(t,_Je,Rge);return w.createElement(C4,{"data-accent-color":a,...o,ref:e,className:M0("rt-Text",s)},r?n:w.createElement(i,null,n))});G$.displayName="Text";const EJe=parseFloat(w.version)>=19||"",CJe={loading:{type:"boolean",default:!0},...sJe,...rJe},US=w.forwardRef((t,e)=>{const{children:n,className:s,loading:r,...i}=kge(t,CJe,Rge);if(!r)return n;const a=w.isValidElement(n)?C4:"span";return w.createElement(a,{ref:e,"aria-hidden":!0,className:M0("rt-Skeleton",s),"data-inline-skeleton":w.isValidElement(n)?void 0:!0,tabIndex:-1,inert:EJe,...i},n)});US.displayName="Skeleton";const Age=w.createContext(void 0);var Nge;function TJe(t){Nge=t}function cD(){return Nge}var W$=w.createContext({get client(){return cD()},bootstrap:void 0});function Ige(t,e,n){if(n===void 0&&(n=new WeakMap),t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(n.has(t)&&n.get(t)===e)return!0;n.set(t,e);var s=Object.keys(t),r=Object.keys(e);if(s.length!==r.length)return!1;for(var i=0,a=s;i<a.length;i++){var o=a[i];if(!r.includes(o)||!Ige(t[o],e[o],n))return!1}return!0}function kJe(t){var e,n,s=t.children,r=t.client,i=t.apiKey,a=t.options,o=w.useRef(null),l=w.useMemo(function(){if(r)return i&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),a&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),r;var u=cD();return i||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),u},[r,i,JSON.stringify(a)]);return w.useEffect(function(){if(!(r||!i)){var u=cD(),d=o.current;d?(i!==d.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),a&&!Ige(a,d.options)&&u.set_config(a),o.current={apiKey:i,options:a??{}}):(u.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),u.init(i,a),o.current={apiKey:i,options:a??{}})}},[r,i,JSON.stringify(a)]),re.createElement(W$.Provider,{value:{client:l,bootstrap:(e=a==null?void 0:a.bootstrap)!==null&&e!==void 0?e:(n=r==null?void 0:r.config)===null||n===void 0?void 0:n.bootstrap}},s)}var fI=function(t){return typeof t=="function"},RJe=function(t){return t===void 0},Z1=function(){var t=w.useContext(W$).client;return t}
315,uD=function(t,e){return uD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[r]=s[r])},uD(t,e)};function AJe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");uD(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var sT=function(t){var e=Object.prototype.toString.call(t);return t instanceof Error||e==="[object Error]"||e==="[object Exception]"||e==="[object DOMException]"||e==="[object DOMError]"},NJe=function(t,e){for(var n=new WeakSet,s=t;!n.has(s);){if(n.add(s),!sT(s.cause)){RJe(s.cause)||(e.cause=s.cause),s.cause=e;return}s=s.cause}},IJe=function(t,e){if(!e)return t;var n=new Error(sT(t)?t.message:"Primitive value captured as exception: ".concat(String(t)));return n.name="React ErrorBoundary ".concat(sT(t)?t.name:"Error"),n.stack=e,sT(t)?(NJe(t,n),t):n},LJe={componentStack:null,exceptionEvent:null,error:null},jJe={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(t){AJe(e,t);function e(n){var s=t.call(this,n)||this;return s.state=LJe,s}return e.prototype.componentDidCatch=function(n,s){var r=this.props.additionalProperties,i;fI(r)?i=r(n,s):typeof r=="object"&&(i=r);var a=this.context.client,o=s.componentStack,l=a.captureException(IJe(n,o),i);this.setState({error:n,componentStack:o??null,exceptionEvent:l})},e.prototype.render=function(){var n=this.props,s=n.children,r=n.fallback,i=this.state;if(i.componentStack==null)return fI(s)?s():s;var a=fI(r)?re.createElement(r,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent}):r;return re.isValidElement(a)?a:(console.warn(jJe.INVALID_FALLBACK),re.createElement(re.Fragment,null))},e.contextType=W$,e})(re.Component);TJe(q1);function PJe(t){const{isLoaded:e,isSignedIn:n,orgId:s}=zt();return rs({queryKey:to.usageDetails(s),queryFn:async()=>{const{error:r,data:i}=await bXe({});if(r)throw r;return i},staleTime:3e4,refetchInterval:3e4,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1,enabled:((t==null?void 0:t.enabled)??!0)&&e&&!!n&&!!s})}function MJe(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt();return rs({queryKey:to.orgDetails(n),queryFn:async()=>{const{error:s,data:r}=await Ume({});if(s)throw s;return r},staleTime:6e4,enabled:t&&!!e&&!!n})}async function DJe(t){const{data:e,error:n}=await HZe({body:t});if(n)throw new Error(typeof n=="object"&&n&&"message"in n?String(n.message):"Failed to create checkout session");if(!e)throw new Error("Failed to create checkout session");return e}function OJe(){const{isLoaded:t,orgId:e}=zt(),n=Z1(),s=w.useRef(void 0),r=w.useRef(!1);w.useEffect(()=>{if(!t)return;if(!r.current){r.current=!0,s.current=e;return}const i=s.current;s.current=e,!(!i||!e||i===e)&&n.capture("organization-changed",{from_organization_id:i,organization_id:e})},[t,e,n])}const Na={all:["sessions"],lists:["sessions","list"],list:t=>["sessions","list",t],liveCounts:t=>["sessions","live-count",t],liveCount:(t,e)=>["sessions","live-count",t,e],detail:(t,e)=>["session",t,e],agentTraces:(t,e)=>["sessionAgentTraces",t,e]};function Lge(t,e,n){return{cursorId:t.cursorId,limit:t.limit??10,status:t.status,orgId:n,projectId:t.projectId??e??null}}function q$(t){return{...t,createdAt:new Date(t.createdAt)}}function $Je(t){return t[2]}function FJe(t,e){return!(e.status&&e.status!==t.status||e.projectId&&t.projectId!=null&&e.projectId!==t.projectId)}function K$(t,e,n){t.getQueryCache().findAll({queryKey:Na.lists}).forEach(s=>{const r=s.queryKey,i=$Je(r),a=s.state.data;(i==null?void 0:i.orgId)===e&&(a!=null&&a.sessions)&&n(i,a,r)})}function Y$(t,e){t.invalidateQueries({queryKey:Na.liveCounts(e)})}function jge(t,e,n){t.setQueryData(Na.detail(n,e.id),q$(e))}function Pge(t,e,n){const s=q$(e);jge(t,s,n),K$(t,n,(r,i,a)=>{if(r.cursorId){t.invalidateQueries({queryKey:a,exact:!0,refetchType:"none"});return}FJe(s,r)&&(i.sessions.some(o=>o.id===s.id)||t.setQueryData(a,{...i,sessions:[s,...i.sessions].slice(0,r.limit)}))}),Y$(t,n)}function UJe(t,e,n){const s=q$(e);jge(t,s,n),K$(t,n,(r,i,a)=>
315{if(r.projectId&&r.projectId!==s.projectId)return;const o=r.status==="live"&&s.status!=="live";t.setQueryData(a,{...i,sessions:i.sessions.filter(l=>!(o&&l.id===s.id)).map(l=>l.id===s.id?{...l,...s}:l)})}),Y$(t,n);for(const r of["sessionLogs","sessionEvents","sessionHlsPlaylist","sessionRRWebEvents"])t.invalidateQueries({queryKey:[r,n,s.id]})}function BJe(t,e,n){K$(t,n,(s,r,i)=>{const a=s.status==="live";t.setQueryData(i,{...r,sessions:r.sessions.filter(o=>!(a&&o.id===e)).map(o=>{if(o.id!==e)return o;const l=Date.now()-new Date(o.createdAt).getTime();return{...o,status:"released",duration:Math.max(o.duration,l)}})})}),Y$(t,n)}function zJe(t){const{isLoaded:e,isSignedIn:n,orgId:s}=zt(),r=aa();return rs({queryKey:Na.detail(s??"",t),enabled:e&&!!n&&!!s&&!!t,queryFn:async()=>{if(!t)return null;const{error:i,data:a,response:o}=await hXe({path:{id:t}});if(i)throw{...i,status:(o==null?void 0:o.status)??500};return(a==null?void 0:a.status)!=="live"&&r.setQueryDefaults(Na.detail(s??"",t),{staleTime:1/0,gcTime:1/0}),a??null},retry:!1,staleTime:0,gcTime:0})}function VJe(t,e={}){const{isLoaded:n,isSignedIn:s,orgId:r}=zt();return rs({queryKey:["sessionTags",r??null,t],enabled:n&&!!s&&!!r&&!!t&&(e.enabled??!0),queryFn:async()=>{const i=await fetch(`https://api.steel.dev/v1/sessions/${t}/tags`,{headers:await pwe()});if(!i.ok){if(i.status===404)return[];throw{message:await i.text().catch(()=>i.statusText)||`Failed to load tags (${i.status})`}}return(await i.json()).tags??[]},retry:!1,staleTime:3e4,refetchOnWindowFocus:!1})}function HJe(t){const{isLoaded:e,isSignedIn:n,orgId:s}=zt();return rs({queryKey:["sessionLogs",s??null,t],enabled:e&&!!n&&!!s&&!!t,queryFn:async()=>{const{error:r,data:i}=await vXe({path:{id:t}});if(r)throw r;return i},staleTime:0})}function GJe(t,e={}){const{isLoaded:n,isSignedIn:s,orgId:r}=zt();return rs({queryKey:["sessionAgentLogs",r??null,t],enabled:n&&!!s&&!!r&&!!t&&(e.enabled??!0),queryFn:async()=>{const{error:i,data:a}=await pXe({path:{id:t}});if(i)throw i;return a},staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1})}function WJe(t){const{isLoaded:e,isSignedIn:n,orgId:s}=zt();return rs({queryKey:Na.agentTraces(s??"",t),enabled:e&&!!n&&!!s&&!!t,queryFn:async()=>{const{error:r,data:i}=await mXe({path:{id:t}});if(r)throw r;return i},staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1})}var ol=Uint8Array,oh=Uint16Array,dD=Uint32Array,Mge=new ol([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]),Dge=new ol([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]),qJe=new ol([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oge=function(t,e){for(var n=new oh(31),s=0;s<31;++s)n[s]=e+=1<<t[s-1];for(var r=new dD(n[30]),s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return[n,r]},$ge=Oge(Mge,2),Fge=$ge[0],KJe=$ge[1];Fge[28]=258,KJe[258]=28;var YJe=Oge(Dge,0),ZJe=YJe[0],fD=new oh(32768);for(var er=0;er<32768;++er){var gf=(er&43690)>>>1|(er&21845)<<1;gf=(gf&52428)>>>2|(gf&13107)<<2,gf=(gf&61680)>>>4|(gf&3855)<<4,fD[er]=((gf&65280)>>>8|(gf&255)<<8)>>>1}var xb=function(t,e,n){for(var s=t.length,r=0,i=new oh(e);r<s;++r)++i[t[r]-1];var a=new oh(e);for(r=0;r<e;++r)a[r]=a[r-1]+i[r-1]<<1;var o;if(n){o=new oh(1<<e);var l=15-e;for(r=0;r<s;++r)if(t[r])for(var u=r<<4|t[r],d=e-t[r],f=a[t[r]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)o[fD[f]>>>l]=u}else for(o=new oh(s),r=0;r<s;++r)o[r]=fD[a[t[r]-1]++]>>>15-t[r];return o},BS=new ol(288);for(var er=0;er<144;++er)BS[er]=8;for(var er=144;er<256;++er)BS[er]=9;for(var er=256;er<280;++er)BS[er]=7;for(var er=280;er<288;++er)BS[er]=8;var Uge=new ol(32);for(var er=0;er<32;++er)Uge[er]=5;var XJe=xb(BS,9,1),QJe=xb(Uge,5,1),hI=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Tl=function(t,e,n){var s=e/8>>0;return(t[s]|t[s+1]<<8)>>>(e&7)&n},pI=function(t,e){var n=e/8>>0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>>(e&7)},JJe=function(t){return(t/8>>0)+(t&7&&1)},Bge=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var s=new(t instanceof oh?oh:t instanceof dD?dD:ol)(n-e);return s.set(t.subarray(e,n)),s},eet=function(t,e,n){var s=t.length,r=!e||n,i=!n||n.i;n||(n={}),e||(e=new ol(s*3));var a=function(Q){var ee=e.length;if(Q>ee){var te=new ol(Math.max(ee*2,Q));te.set(e),e=te}},o=n.f||0,l=n.p||0,u=n.b||0,d=n.l,f=n.d,p=n.m,m=n.n,v=s*8;
315do{if(!d){n.f=o=Tl(t,l,1);var x=Tl(t,l+1,3);if(l+=3,x)if(x==1)d=XJe,f=QJe,p=9,m=5;else if(x==2){var E=Tl(t,l,31)+257,T=Tl(t,l+10,15)+4,k=E+Tl(t,l+5,31)+1;l+=14;for(var R=new ol(k),I=new ol(19),A=0;A<T;++A)I[qJe[A]]=Tl(t,l+A*3,7);l+=T*3;var L=hI(I),j=(1<<L)-1;if(!i&&l+k*(L+7)>v)break;for(var F=xb(I,L,1),A=0;A<k;){var O=F[Tl(t,l,j)];l+=O&15;var y=O>>>4;if(y<16)R[A++]=y;else{var M=0,U=0;for(y==16?(U=3+Tl(t,l,3),l+=2,M=R[A-1]):y==17?(U=3+Tl(t,l,7),l+=3):y==18&&(U=11+Tl(t,l,127),l+=7);U--;)R[A++]=M}}var G=R.subarray(0,E),$=R.subarray(E);p=hI(G),m=hI($),d=xb(G,p,1),f=xb($,m,1)}else throw"invalid block type";else{var y=JJe(l)+4,S=t[y-4]|t[y-3]<<8,_=y+S;if(_>s){if(i)throw"unexpected EOF";break}r&&a(u+S),e.set(t.subarray(y,_),u),n.b=u+=S,n.p=l=_*8;continue}if(l>v)throw"unexpected EOF"}r&&a(u+131072);for(var V=(1<<p)-1,B=(1<<m)-1,q=p+m+18;i||l+q<v;){var M=d[pI(t,l)&V],z=M>>>4;if(l+=M&15,l>v)throw"unexpected EOF";if(!M)throw"invalid length/literal";if(z<256)e[u++]=z;else if(z==256){d=null;break}else{var D=z-254;if(z>264){var A=z-257,K=Mge[A];D=Tl(t,l,(1<<K)-1)+Fge[A],l+=K}var Y=f[pI(t,l)&B],J=Y>>>4;if(!Y)throw"invalid distance";l+=Y&15;var $=ZJe[J];if(J>3){var K=Dge[J];$+=pI(t,l)&(1<<K)-1,l+=K}if(l>v)throw"unexpected EOF";r&&a(u+131072);for(var ne=u+D;u<ne;u+=4)e[u]=e[u-$],e[u+1]=e[u+1-$],e[u+2]=e[u+2-$],e[u+3]=e[u+3-$];u=ne}}n.l=d,n.p=l,n.b=u,d&&(o=1,n.m=p,n.d=f,n.n=m)}while(!o);return u==e.length?e:Bge(e,0,u)},tet=function(t){if((t[0]&15)!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(t[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function net(t,e){return eet((tet(t),t.subarray(2,-4)),e)}function set(t,e){for(var n=t.length,s=new ol(t.length+(t.length>>>1)),r=0,i=function(u){s[r++]=u},a=0;a<n;++a){if(r+5>s.length){var o=new ol(r+8+(n-a<<1));o.set(s),s=o}var l=t.charCodeAt(a);i(l)}return Bge(s,0,r)}function ret(t,e){var n="";if(typeof TextDecoder<"u")return new TextDecoder().decode(t);for(var s=0;s<t.length;){var r=t[s++];r<128||e?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((r&31)<<6|t[s++]&63):r<240?n+=String.fromCharCode((r&15)<<12|(t[s++]&63)<<6|t[s++]&63):(r=((r&15)<<18|(t[s++]&63)<<12|(t[s++]&63)<<6|t[s++]&63)-65536,n+=String.fromCharCode(55296|r>>10,56320|r&1023))}return n}const tQ="v1",zge=t=>{if(typeof t!="string")return t;try{const e=JSON.parse(t);if(e.timestamp)return e}catch{}try{const e=JSON.parse(ret(net(set(t,!0))));if(e.v===tQ)return e;throw new Error(`These events were packed with packer ${e.v} which is incompatible with current packer ${tQ}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}},iet="https://ironveil.fec.workers.dev/";function Vge(t){return/^https?:/.test(t)?`${iet}${encodeURIComponent(t)}`:t}const aet=/url\((['"]?)(https?:[^)'" ]+)\1\)/g;function Hge(t){return t.replace(aet,(e,n,s)=>`url(${n}${Vge(s)}${n})`)}function Gge(t){if(t)for(const e in t){const n=t[e];typeof n=="string"&&(t[e]=e==="style"||e==="_cssText"?Hge(n):Vge(n))}}function oet(t){t.type===3&&t.isStyle&&typeof t.textContent=="string"&&(t.textContent=Hge(t.textContent)),Gge(t.attributes)}const nQ="SCRIPT_PLACEHOLDER";function cet(t){if(t.type===3&&t.textContent===nQ&&(t.textContent=""),t.attributes)for(const e in t.attributes){const n=t.attributes[e];typeof n=="string"&&n.includes(nQ)&&delete t.attributes[e]}}const uet=[oet,cet];function det(t){for(const e of uet)e(t)}function hD(t){t&&(det(t),Array.isArray(t.childNodes)&&t.childNodes.forEach(hD))}function fet(t){var e,n;if(t.type===2)hD(t.data.node);else if(t.type===3&&t.data.source===0){const s=t.data;(e=s.adds)==null||e.forEach(r=>hD(r.node)),(n=s.attributes)==null||n.forEach(r=>Gge(r.attributes))}return t}function het(t){const{isLoaded:e,isSignedIn:n,orgId:s}=zt();return rs({queryKey:["sessionHlsPlaylist",s??null,t],enabled:e&&!!n&&!!s&&!!t,queryFn:async()=>{const{error:r,data:i,response:a}=await gXe({path:{id:t}});if(r)throw{...r,status:(a==null?void 0:a.status)??(r==null?void 0:r.status)??500};return i},retry:(r,i)=>{const a=(i==null?void 0:i.status)??0;return(a===404||a>=500)&&r<30},retryDelay:r=>{const i=[500,1e3,1500,2e3,5e3],a=Math.max(0,Math.min(r,i.length)-1);return i[a]},staleTime:1800*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!0})}function pet(t,e){const{isLoaded:n,isSignedIn:s,orgId:r}=zt();return rs({queryKey:["sessionRRWebEvents",r??null,t],enabled:n&&!!s&&!!r&&!!t&&((e==null?void 0:e.enabled)??!0),queryFn:async()=>{const{error:i,data:a}=await yXe({path:{id:t}});if(i)throw i;
315const o=a.events.map(l=>{const u=typeof l=="string"?zge(l):l;return fet(u)});return{...a,events:o}},staleTime:0,gcTime:0,retry:!1})}function Wge(t){if(!(t!=null&&t.message))return null;const e=t.message;return e.includes("Session limit reached")?"concurrency":e.includes("Captcha solving is not available")?"captcha":e.includes("Steel proxies are not available")?"steel_proxy":e.includes("Session timeout of")&&e.includes("exceeds the maximum allowed time")?"session_timeout":/in paid balance to use|refundable \$10 deposit/i.test(e)?"steel_proxy":null}const qge=w.createContext(void 0);var mI,sQ;function met(){if(sQ)return mI;sQ=1;var t="Expected a function",e=NaN,n="[object Symbol]",s=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,l=typeof o_=="object"&&o_&&o_.Object===Object&&o_,u=typeof self=="object"&&self&&self.Object===Object&&self,d=l||u||Function("return this")(),f=Object.prototype,p=f.toString,m=Math.max,v=Math.min,x=function(){return d.Date.now()};function y(k,R,I){var A,L,j,F,O,M,U=0,G=!1,$=!1,V=!0;if(typeof k!="function")throw new TypeError(t);R=T(R)||0,S(I)&&(G=!!I.leading,$="maxWait"in I,j=$?m(T(I.maxWait)||0,R):j,V="trailing"in I?!!I.trailing:V);function B(ee){var te=A,ue=L;return A=L=void 0,U=ee,F=k.apply(ue,te),F}function q(ee){return U=ee,O=setTimeout(K,R),G?B(ee):F}function z(ee){var te=ee-M,ue=ee-U,ye=R-te;return $?v(ye,j-ue):ye}function D(ee){var te=ee-M,ue=ee-U;return M===void 0||te>=R||te<0||$&&ue>=j}function K(){var ee=x();if(D(ee))return Y(ee);O=setTimeout(K,z(ee))}function Y(ee){return O=void 0,V&&A?B(ee):(A=L=void 0,F)}function J(){O!==void 0&&clearTimeout(O),U=0,A=M=L=O=void 0}function ne(){return O===void 0?F:Y(x())}function Q(){var ee=x(),te=D(ee);if(A=arguments,L=this,M=ee,te){if(O===void 0)return q(M);if($)return O=setTimeout(K,R),B(M)}return O===void 0&&(O=setTimeout(K,R)),F}return Q.cancel=J,Q.flush=ne,Q}function S(k){var R=typeof k;return!!k&&(R=="object"||R=="function")}function _(k){return!!k&&typeof k=="object"}function E(k){return typeof k=="symbol"||_(k)&&p.call(k)==n}function T(k){if(typeof k=="number")return k;if(E(k))return e;if(S(k)){var R=typeof k.valueOf=="function"?k.valueOf():k;k=S(R)?R+"":R}if(typeof k!="string")return k===0?k:+k;k=k.replace(s,"");var I=i.test(k);return I||a.test(k)?o(k.slice(2),I?2:8):r.test(k)?e:+k}return mI=y,mI}met();var Kge=typeof window<"u"?w.useLayoutEffect:w.useEffect;function rQ(t,e,n,s){const r=w.useRef(e);Kge(()=>{r.current=e},[e]),w.useEffect(()=>{const i=window;if(!(i&&i.addEventListener))return;const a=o=>{r.current(o)};return i.addEventListener(t,a,s),()=>{i.removeEventListener(t,a,s)}},[t,n,s])}function iQ(t){const e=w.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return Kge(()=>{e.current=t},[t]),w.useCallback((...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)},[e])}var gI=typeof window>"u";function get(t,e,n={}){const{initializeWithValue:s=!0}=n,r=w.useCallback(p=>n.serializer?n.serializer(p):JSON.stringify(p),[n]),i=w.useCallback(p=>{if(n.deserializer)return n.deserializer(p);if(p==="undefined")return;const m=e instanceof Function?e():e;let v;try{v=JSON.parse(p)}catch(x){return console.error("Error parsing JSON:",x),m}return v},[n,e]),a=w.useCallback(()=>{const p=e instanceof Function?e():e;if(gI)return p;try{const m=window.localStorage.getItem(t);return m?i(m):p}catch(m){return console.warn(`Error reading localStorage key “${t}”:`,m),p}},[e,t,i]),[o,l]=w.useState(()=>s?a():e instanceof Function?e():e),u=iQ(p=>{gI&&console.warn(`Tried setting localStorage key “${t}” even though environment is not a client`);try{const m=p instanceof Function?p(a()):p;window.localStorage.setItem(t,r(m)),l(m),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))}catch(m){console.warn(`Error setting localStorage key “${t}”:`,m)}}),d=iQ(()=>{gI&&console.warn(`Tried removing localStorage key “${t}” even though environment is not a client`);const p=e instanceof Function?e():e;window.localStorage.removeItem(t),l(p),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))});w.useEffect(()=>{l(a())},[t]);const f=w.useCallback(p=>{p.key&&p.key!==t||l(a())},[t,a]);return rQ("storage",f),rQ("local-storage",f),[o,u,d]}const vet="steel:selected-project-by-org";function xet({children:t}){var k;const{orgId:e,isLoaded:n,isSignedIn:s}=zt(),[r,i]=get(vet,{}),a=rs({queryKey:["projects",e],enabled:n&&!!s&&!!e,queryFn:async()=>{const{error:R,data:I}=await JZe({});if(R)throw R;return I},staleTime:6e4,refetchOnWindowFocus:!1}),o=((k=a.data)==null?void 0:k.projects)??[],l=w.useMemo(()=>o.find(R=>R.isDefault)??o[0]??null,[o]),u=e?Object.prototype.hasOwnProperty.call(r,e):!1,d=e?r[e]??null:null,f=w.useMemo(()=>o.find(R=>R.id===d)??null,[o,d]),p=(f==null?void 0:f.id)??(l==null?void 0:l.id)??null,m=w.useMemo(()=>o.find(R=>R.id===p)??null,[o,p]),v=a.isSuccess&&!!p,x=w.useCallback(async()=>{await Promise.all([Pn.invalidateQueries({queryKey:["sessions"]}),Pn.invalidateQueries({queryKey:["credentials"]}),Pn.invalidateQueries({queryKey:["secrets"]}),Pn.invalidateQueries({queryKey:["environments"]}),Pn.invalidateQueries({queryKey:["api-keys"]}),Pn.invalidateQueries({queryKey:["profiles"]})])},[]),y=w.useCallback(R=>{e&&(i(I=>({...I,[e]:R})),x())},[x,e,i]),S=w.useCallback(()=>{y((l==null?void 0:l.id)??null)},[l==null?void 0:l.id,y]);w.useEffect(()=>{!a.isSuccess||!e||u||!(l!=null&&l.id)||i(R=>({...R,[e]:l.id}))},[l==null?void 0:l.id,u,e,a.isSuccess,i]),w.useEffect(()=>{if(!a.isSuccess||!e||!d)return;o.some(I=>I.id===d)||S()},[S,e,o,a.isSuccess,d]);const _=w.useMemo(()=>p?{projectId:p}:{},[p]),E=w.useCallback(R=>!p||!R?R:{...R,projectId:p},[p]),T=w.useMemo(()=>({projects:o,projectsQuery:a,selectedProjectId:p,selectedProject:m,defaultProject:l,isProjectSelectionReady:v,projectQueryScope:_,setSelectedProjectId:y,clearSelectedProject:S,invalidateProjectScopedQueries:x,withSelectedProjectId:E}),[o,a,p,m,l,v,_,y,S,x,E]);return c.jsx(qge,{value:T,children:t})}function lc(){const t=w.useContext(qge);if(!t)throw new Error("useProjectsContext must be used within a ProjectsProvider");return t}const aQ="lowerBitrate",yet=250;function bet(t){const e=t??{},n=e.experimentalFeatures??[];return n.includes(aQ)?e:{...e,experimentalFeatures:[...n,aQ]}}function wet(){return _et()}function _et(){if(typeof navigator>"u")return!1;const t=navigator,e=t.connection??t.mozConnection??t.webkitConnection;return e?!!(e.saveData||e.effectiveType==="slow-2g"||e.effectiveType==="2g"||e.effectiveType==="3g"||typeof e.rtt=="number"&&e.rtt>=yet||typeof e.downlink=="number"&&e.downlink>0&&e.downlink<=2):!1}function Eet(){const{orgId:t}=zt(),{selectedProjectId:e}=lc(),n=aa(),s=di();return Bi({mutationFn:async r=>{const i={...r,...e?{projectId:e}:{}};if(!i.projectId)throw{message:"Project selection is still loading"};const a=wet()?bet(i):i,{error:o,data:l}=await dXe({body:a});if(o)throw o;return l},onSuccess:r=>{t&&Pge(n,r,t),na({title:"Your session is live!",actionLabel:"View Session",onAction:()=>
315{r!=null&&r.id&&s(`/sessions/${r.id}`)}})},onError:r=>{Wge(r)||Bn({title:(r==null?void 0:r.message)||"Failed to create session"})}})}function Cet(){const{orgId:t}=zt(),e=aa();return Bi({mutationFn:async n=>{const{error:s,data:r}=await xXe({path:{id:n}});if(s)throw s;return r},onSuccess:(n,s)=>{t&&BJe(e,s,t),t&&e.refetchQueries({queryKey:Na.detail(t,s)})}})}function Tet(){const{selectedProjectId:t}=lc(),e=aa();return Bi({mutationFn:async()=>{const n=t,{error:s,data:r}=await fXe({query:n?{projectId:n}:void 0});if(s)throw s;return r},onSuccess:()=>{e.invalidateQueries({queryKey:Na.all}),na({title:"Releasing all live sessions",actionLabel:"Close",sweep:!0})},onError:n=>{Bn({title:(n==null?void 0:n.message)||"Failed to release sessions"})}})}async function Z$(t,e){const n=(t==null?void 0:t.projectId)??e??void 0,{error:s,data:r}=await uXe({query:{cursorId:t==null?void 0:t.cursorId,limit:(t==null?void 0:t.limit)??10,status:t==null?void 0:t.status,projectId:n}});if(s)throw s;return r}function ket(t={limit:10}){const{isLoaded:e,isSignedIn:n,orgId:s}=zt(),{selectedProjectId:r}=lc(),i=aa();return rs({queryKey:Na.list(Lge(t,r,s??"")),queryFn:async()=>{const a=await Z$(t,r);return a.sessions.forEach(o=>{s&&o.status!=="live"&&(i.setQueryData(Na.detail(s,o.id),o),i.setQueryDefaults(Na.detail(s,o.id),{staleTime:1/0,gcTime:1/0}))}),a},enabled:e&&!!n&&!!s&&!!((t==null?void 0:t.projectId)??r),retry:!1,staleTime:15e3,gcTime:300*1e3,refetchOnWindowFocus:"always",refetchOnReconnect:"always",refetchOnMount:!0})}function Ret(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),{selectedProjectId:s,isProjectSelectionReady:r}=lc();return rs({queryKey:Na.liveCount(n??"",s??null),enabled:t&&!!e&&!!n&&r,queryFn:async()=>(await Z$({limit:1,status:"live"},s)).totalCount??0,staleTime:15e3,gcTime:300*1e3,refetchOnWindowFocus:"always",refetchOnReconnect:"always",refetchOnMount:!0})}function Aet(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),{selectedProjectId:s}=lc(),r=aa();return w.useCallback(async i=>{if(!t||!e||!n||!((i==null?void 0:i.projectId)??s))return;const a=Na.list(Lge(i??{limit:10},s,n)),o=r.getQueryState(a);o!=null&&o.data&&o.dataUpdatedAt>Date.now()-15e3||await r.prefetchQuery({queryKey:a,queryFn:()=>Z$(i,s),staleTime:15e3,gcTime:300*1e3})},[t,e,n,r,s])}const Net={createCheckoutSession:DJe,useCreateSessionMutation:Eet,useLiveSessionsCount:Ret,useOrgDetails:MJe,useRRWebEvents:pet,useReleaseAllSessionsMutation:Tet,useReleaseSessionMutation:Cet,useSession:zJe,useSessionAgentLogs:GJe,useSessionAgentTraces:WJe,useSessionHlsPlaylist:het,useSessionLogs:HJe,useSessionTags:VJe,useSessions:ket,useUsageDetails:PJe};function Iet({children:t}){OJe();const e=Aet(),n=w.useMemo(()=>({...Net,prefetchSessions:e}),[e]);return c.jsx(Age,{value:n,children:t})}function fr(){const t=w.useContext(Age);if(!t)throw new Error("useSessionsContext must be used within an SessionsProvider");return t}function Kh(t,e=220){const[n,s]=w.useState(t),[r,i]=w.useState(!1),a=w.useRef(t);return a.current=n,w.useEffect(()=>{if(t)s(!0),i(!1);else if(a.current){i(!0);const o=setTimeout(()=>{s(!1),i(!1)},e);return()=>clearTimeout(o)}},[t,e]),{render:n,exiting:r}}function ss({open:t,onClose:e,title:n,subtitle:s,children:r,footer:i,danger:a}){const o=w.useRef(null),l=w.useRef(e),u=w.useId(),{render:d,exiting:f}=Kh(t);return l.current=e,w.useEffect(()=>{if(!t)return;const p=document.activeElement,m='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',v=()=>{var _;return Array.from(((_=o.current)==null?void 0:_.querySelectorAll(m))??[])},x=_=>{var R;if(_.key==="Escape"){l.current();return}if(_.key!=="Tab")return;const E=v();if(E.length===0){_.preventDefault(),(R=o.current)==null||R.focus();return}const T=E[0],k=E[E.length-1];_.shiftKey&&document.activeElement===T?(_.preventDefault(),k.focus()):!_.shiftKey&&document.activeElement===k&&(_.preventDefault(),T.focus())};document.addEventListener("keydown",x);const y=requestAnimationFrame(()=>{var _,E;(_=o.current)!=null&&_.contains(document.activeElement)||(E=v()[0]??o.current)==null||E.focus()}),S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",x),cancelAnimationFrame(y),document.body.style.overflow=S,p==null||p.focus()}},[t]),!d||typeof document>"u"?null:nr.createPortal(c.jsx("div",{className:`${f?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:p=>
315{o.current&&!o.current.contains(p.target)&&e()},children:c.jsx("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,className:`${f?"modal-card-out":"modal-card-in"} bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full flex flex-col shadow-modal`,children:r!=null&&r!==!1?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{id:u,className:`text-[16px] leading-[24px] ${a?"text-danger":"text-[var(--sand-12)]"}`,children:n}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:s})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsx("div",{className:"p-[16px]",children:r}),i&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsx("div",{className:"flex justify-between gap-[12px] p-[12px]",children:i})]})]}):c.jsxs("div",{className:"flex flex-col gap-[20px] p-[20px]",children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium",children:[c.jsx("p",{id:u,className:`text-[16px] leading-[24px] ${a?"text-danger":"text-[var(--sand-12)]"}`,children:n}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:s})]}),i&&c.jsx("div",{className:"flex justify-between gap-[12px]",children:i})]})})}),document.body)}function oQ({color:t="#FBE32D",width:e=20,height:n=20,className:s=""}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:n,viewBox:"0 0 20 20",fill:"none",className:s,children:c.jsx("path",{d:"M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",stroke:t,strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"3 4"})})}var Bk=1e3,lQ=1e3,cQ=500,pD=(t=>(t.SESSION_CREATED="session_created",t.SESSION_ENDED="session_ended",t.USER_ONBOARDED="user_onboarded",t.API_REQUEST_SENT="api_request_sent",t.API_REQUEST_RECEIVED="api_request_received",t.API_REQUEST_ERROR="api_request_error",t.API_REQUEST_SUCCESS="api_request_success",t))(pD||{}),Yge=["gov_domain_accessed","captcha_encountered","proxy_connection_failed","session_timeout_exceeded","high_bandwidth_usage","bot_detection_triggered","context_restored","datadome_detected","imperva_detected","amazon_waf_detected","funcaptcha_detected","slow_startup","slow_time_to_interactive","poor_nav_success","high_error_rate","browser_crashed","evicted"],Zge={gov_domain_accessed:{severity:"info",visibility:"public",source:"derived",label:"Gov Domain",description:"Session accessed a .gov domain",derivation:"event_name = 'nav_completed' AND endsWith(domain, '.gov')"},captcha_encountered:{severity:"warning",visibility:"public",source:"derived",label:"Captcha Encountered",description:"A captcha was detected during the session",derivation:"event_name = 'captcha_detected'"},proxy_connection_failed:{severity:"danger",visibility:"public",source:"derived",label:"Proxy Failed",description:"Proxy connection failed or was unreliable",derivation:"event_category = 'network' AND event_name IN ('proxy_error', 'http_5xx')"},session_timeout_exceeded:{severity:"warning",visibility:"public",source:"derived",label:"Timeout Exceeded",description:"Session hit its configured timeout limit",derivation:"summary.termination_reason = 'idle_timeout'"},high_bandwidth_usage:{severity:"info",visibility:"admin",source:"derived",label:"High Bandwidth",description:"Session consumed unusually high proxy bandwidth",derivation:"sum(bytes_sent + bytes_received) over session > threshold"},bot_detection_triggered:{severity:"warning",visibility:"public",source:"derived",label:"Bot Detection",description:"Anti-bot or bot-wall detection was triggered on a page",derivation:"event_name = 'bot_wall_detected'"},context_restored:{severity:"success",visibility:"public",source:"derived",label:"Context Restored",description:"Session restored from a previously saved browser context",derivation:"event_name = 'context_restored'"},slow_startup:{severity:"warning",visibility:"admin",source:"derived",label:"Slow Startup",description:"Session took longer than expected to reach a ready browser",derivation:"summary.time_to_ready_ms > 5000"},slow_time_to_interactive:{severity:"warning",visibility:"admin",source:"derived",label:"Slow TTI",description:"First successful navigation / CDP command took too long",derivation:"summary.time_to_interactive_ms > 10000"},poor_nav_success:{severity:"warning",visibility:"admin",source:"derived",label:"Poor Nav Success",description:"Fewer than 80% of navigations succeeded",derivation:"navigations_total > 0 AND navigations_succeeded / navigations_total < 0.8"},high_error_rate:{severity:"warning",visibility:"admin",source:"derived",label:"High Error Rate",description:"More than 10% of HTTP requests returned 4xx/5xx",derivation:"http_requests_total >
315 0 AND (http_4xx + http_5xx) / http_requests_total > 0.1"},browser_crashed:{severity:"danger",visibility:"admin",source:"derived",label:"Browser Crashed",description:"Session terminated due to a browser crash",derivation:"summary.termination_reason = 'crash'"},evicted:{severity:"danger",visibility:"admin",source:"derived",label:"Evicted",description:"Session was evicted (pod drain / scale-down)",derivation:"summary.termination_reason = 'evicted'"},datadome_detected:{severity:"info",visibility:"admin",source:"derived",label:"DataDome",description:"DataDome anti-bot system was detected during the session",derivation:"event_name = 'antibot_datadome_detected'"},imperva_detected:{severity:"info",visibility:"admin",source:"derived",label:"Imperva",description:"Imperva anti-bot system was detected during the session",derivation:"event_name = 'antibot_imperva_detected'"},amazon_waf_detected:{severity:"info",visibility:"admin",source:"derived",label:"Amazon WAF",description:"Amazon WAF challenge was detected during the session",derivation:"event_name = 'antibot_amazon_waf_detected'"},funcaptcha_detected:{severity:"info",visibility:"admin",source:"derived",label:"FunCaptcha",description:"FunCaptcha (Arkose Labs) was detected during the session",derivation:"event_name = 'antibot_funcaptcha_detected'"}};Yge.filter(t=>{var e;return((e=Zge[t])==null?void 0:e.visibility)==="public"});function mD(t){return Zge[t]}function Let(t){return typeof t=="string"&&Yge.includes(t)}const Xge=w.createContext(null);function jet(){const t=w.useContext(Xge);if(!t)throw new Error("useWebSocket must be used within a WebSocketProvider");return t}function Pet({children:t,authToken:e,orgId:n,refreshToken:s}){const r=w.useRef(null),i=w.useRef({}),a=w.useRef(0),o=5,l=w.useRef(null),u=(p,m)=>(i.current[p]||(i.current[p]=new Set),i.current[p].add(m),()=>d(p,m)),d=(p,m)=>{i.current[p]&&(i.current[p].delete(m),i.current[p].size===0&&delete i.current[p])},f=w.useEffectEvent(()=>{if(!e)return;r.current&&r.current.readyState===WebSocket.OPEN&&r.current.close();const p=`wss://connect.steel.dev/v1/app-events?token=${e}${n?`&orgId=${n}`:""}`;r.current=new WebSocket(p),r.current.onopen=()=>{console.log("WebSocket connection established"),a.current=0},r.current.onclose=m=>{if(console.log("WebSocket connection closed",m),!m.wasClean&&a.current<o){const v=Math.min(1e3*2**a.current,3e4);a.current++,l.current=setTimeout(()=>{console.log(`Attempting to reconnect (${a.current}/${o})`),f()},v)}},r.current.onerror=()=>{console.log("WebSocket connection error"),s()},r.current.onmessage=m=>{try{const v=JSON.parse(m.data);i.current[v.type]&&i.current[v.type].forEach(x=>{try{x(v.payload)}catch(y){console.error("Error in subscriber callback:",y)}}),i.current["*"]&&i.current["*"].forEach(x=>{try{x(v)}catch(y){console.error("Error in wildcard subscriber callback:",y)}})}catch(v){console.error("Error processing WebSocket message:",v)}}});return w.useEffect(()=>(e&&f(),()=>{r.current&&r.current.close(),l.current&&clearTimeout(l.current)}),[e,n]),c.jsx(Xge,{value:[u,d],children:t})}function uQ(t,e,n=[]){const[s]=jet();w.useEffect(()=>{const r=s(t,e);return()=>{r()}},[t,...n])}const Qge=w.createContext(null);function Met(){const t=w.useContext(Qge);if(!t)throw new Error("useSessionState must be used within a SessionStateProvider");return t}function Det({children:t}){const{orgId:e}=zt(),[n,s]=w.useState(null),[r,i]=w.useState(null),a=w.useCallback(u=>{e&&Pge(Pn,u,e),s(u)},[e]),o=w.useCallback(u=>{e&&UJe(Pn,u,e),i(u)},[e]);uQ(pD.SESSION_CREATED,a,[a]),uQ(pD.SESSION_ENDED,o,[o]);const l=w.useMemo(()=>({recentlyCreatedSession:n,recentlyEndedSession:r}),[n,r]);return c.jsx(Qge,{value:l,children:t})}function Oet({open:t,onClose:e,existingSession:n}){const{orgId:s}=zt(),r=["rounded-[1.25rem]","border","border-[var(--green-6)]"],i=["rounded-full","border","border-[var(--sand-6)]"],[a,o]=w.useState(n),[l,u]=w.useState(n?r:i),{recentlyCreatedSession:d,recentlyEndedSession:f}=Met();return w.useEffect(()=>{d&&(o(d),u(r))},[d]),w.useEffect(()=>{f&&a&&f.id===a.id&&(o(null),s&&Pn.refetchQueries({queryKey:Na.detail(s,a.id)}))},[s,f,a]),a&&(a==null?void 0:a.status)!=="live"||!t?null:c.jsx("div",{className:`${l.join(" ")} fixed bottom-4 left-4 z-50 ${a?"w-[325px]":"w-[250px]"} transition-all duration-1000 [transition-timing-function:cubic-bezier(0.4,0,0.2,1)] bg-[var(--sand-1)]`,children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:`transition-all duration-1000 [transition-timing-function:cubic-bezier(0.4,0,0.2,1)] ${a?"opacity-0 pointer-events-none h-0":"opacity-100"}`,children:c.jsxs("div",{className:"flex items-center gap-3 p-3 pr-8",children:[c.jsxs("div",{className:"flex items-center gap-3 relative overflow-hidden",children:[c.jsx(oQ,{className:"relative z-2 animate-spin-slow [&>path]:stroke-[var(--shimmer-a)] [&>circle]:stroke-[var(--shimmer-a)] [&>line]:stroke-[var(--shimmer-a)] [&>path]:animate-svg-shimmer [&>circle]:animate-svg-shimmer [&>line]:animate-svg-shimmer"}),c.jsx("span",{className:"relative bg-gradient-to-r from-[var(--shimmer-a)] via-[var(--shimmer-b)] to-[var(--shimmer-a)] bg-[length:200%_auto] text-transparent bg-clip-text animate-text-shimmer text-[14px]",children:"Listening for Session..."})]}),e&&c.jsx("button",{onClick:e,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1",children:c.jsx(ok,{className:"w-[16px] h-[16px] text-[var(--sand-9)] hover:text-[var(--sand-12)] active:text-[var(--sand-10)]"})})]})}),c.jsx("div",{className:`transition-all duration-1000 [transition-timing-function:cubic-bezier(0.4,0,0.2,1)] ${a?"opacity-100 max-h-[500px]":"opacity-0 pointer-events-none max-h-0"}`,children:c.jsxs("div",{className:"flex flex-col w-full rounded-[1.25rem] pr-[0.75rem] pl-[0.75rem] pb-[0.75rem] bg-[var(--green-4)]",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-[0.5rem] py-[0.75rem]",children:[c.jsx(oQ,{className:"animate-spin-slow w-[16px] h-[16px] [&>path]:stroke-[var(--green-11)] dark:[&>path]:stroke-[var(--green-9)]",color:"var(--green-9)"}),c.jsx("span",{className:"text-[14px] text-[var(--green-11)] dark:text-[var(--green-9)]",children:"Session Live!"})]}),e&&c.jsx("button",{onClick:e,className:"p-1",children:c.jsx(ok,{className:"w-[16px] h-[16px] text-[var(--sand-12)] hover:text-[var(--sand-11)] active:text-[var(--sand-10)] dark:hover:text-[var(--sand-3)] dark:active:text-[var(--sand-4)]"})})]}),c.jsxs("span",{className:"text-[14px] text-[var(--sand-11)] pb-[0.75rem]",children:["This session is up and running. You can access it from"," ",c.jsx(Hn,{to:"/sessions",className:"underline hover:text-[var(--green-12)] active:text-[var(--green-10)]",children:"Sessions"})," ","at any point."]}),a&&c.jsxs("div",{className:"relative group shadow-xl rounded-[0.875rem] overflow-hidden",children:[c.jsx("div",{className:"absolute inset-0 w-full h-full rounded-[0.875rem] bg-[linear-gradient(180deg,rgba(21,51,38,0.03)_0%,rgba(21,51,38,0.20)_100%)] dark:bg-[linear-gradient(180deg,rgba(21,51,38,0.06)_0%,rgba(21,51,38,0.50)_100%)] pointer-events-none z-10 shadow-xl"}),c.jsx("iframe",{src:a.debugUrl+"?showControls=false&interactive=false",className:"ph-no-capture w-full aspect-video border-0 rounded-[0.875rem] transition-all duration-200 group-hover:opacity-70 group-hover:bg-[linear-gradient(135deg,var(--green-4)_0%,var(--green-5)_100%)] animate-[fadeIn_6s_ease-in_forwards]",title:"Debug Session"}),c.jsx(Hn,{to:`/sessions/${a.id}`,className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-[var(--sand-a12)] text-[var(--sand-1)] px-3 py-2 rounded-full hover:text-[var(--sand-1)] hover:bg-[var(--sand-12)] z-20",children:"View Session"})]})]})})]})})}function fR(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M19.5165 14.6667C18.4182 17.7738 15.4549 20 11.9717 20C7.5534 20 3.97168 16.4183 3.97168 12C3.97168 7.58172 7.5534 4 11.9717 4C14.8553 4 16.7295 5.30135 18.5891 7.5M19 4V7.25C19 7.66421 18.6642 8 18.25 8H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const zk="shrink-0 cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[14px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] disabled:opacity-60 disabled:cursor-not-allowed",Jge="relative flex h-[40px] min-w-0 flex-1 items-center gap-[10px] overflow-hidden rounded-[8px] bg-[var(--sand-2)] pl-[12px] pr-[8px]",e0e="relative z-[1] shrink-0 flex h-[26px] items-center px-[10px] rounded-[999px] bg-[var(--sand-4)] text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer hover:bg-[var(--sand-5)]",$et="•".repeat(120);function Fet({maskedKey:t,isRotating:e,onRotate:n}){const[s,r=""]=t.split("...");return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Jge,children:[c.jsxs("span",{className:"ph-no-capture flex min-w-0 flex-1 text-[14px] font-medium leading-[40px] text-[var(--sand-12)] whitespace-nowrap",children:[c.jsx("span",{className:"shrink-0",children:s}
315),c.jsx("span",{"aria-hidden":!0,className:"min-w-0 flex-1 overflow-hidden tracking-[1px]",children:$et}),c.jsx("span",{className:"shrink-0",children:r})]}),c.jsxs("button",{type:"button",title:"Rotate API key",disabled:e,onClick:n,className:He(e0e,"h-[32px] gap-[6px] px-[12px] text-[14px] disabled:opacity-60 disabled:cursor-not-allowed"),children:[c.jsx(fR,{size:18,className:e?"animate-spin":void 0}),"Rotate"]})]}),c.jsx(Hn,{to:"/settings/api-keys",className:zk,children:"Manage API Keys"})]})}function Uet({apiKey:t,isVisible:e,setIsVisible:n}){const[s,r]=w.useState(0),i=()=>{navigator.clipboard.writeText(t),r(a=>a+1),Ao({title:"API key copied to clipboard",duration:1e3})};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Jge,children:[s>0&&c.jsx("span",{"aria-hidden":!0,className:"api-key-flash pointer-events-none absolute inset-0 z-0 rounded-[8px] bg-[var(--sand-6)]"},s),c.jsx("div",{className:"relative z-[1] min-w-0 flex-1 self-stretch",children:c.jsx(xr,{mode:"wait",initial:!1,children:c.jsx(wt.span,{initial:{opacity:0,filter:"blur(4px)"},animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:{duration:.2,ease:"easeOut"},className:`ph-no-capture absolute inset-0 block leading-[40px] text-[14px] font-medium text-[var(--sand-12)] ${e?"truncate":"overflow-hidden whitespace-nowrap tracking-[1px]"}`,children:e?t:"•".repeat(t.length||40)},e?"shown":"hidden")})}),c.jsx("button",{type:"button",onClick:()=>n(!e),className:e0e,children:e?"Hide key":"Show key"})]}),c.jsx("button",{type:"button",className:zk,onClick:i,children:"Copy API Key"})]})}function cr({children:t,id:e,divider:n,dividerTop:s}){const[,r]=Bet(t);return c.jsxs(c.Fragment,{children:[s&&c.jsx("hr",{className:"w-full border-t-[0.5px] border-solid border-[var(--sand-6)]"}),c.jsx("section",{className:cs("flex flex-col items-center w-full"),id:e,children:c.jsx("div",{className:"flex w-full max-w-[800px]",children:c.jsx("div",{className:"flex-1",children:r})})}),n&&c.jsx("hr",{className:"w-full border-t-[0.5px] border-solid border-[var(--sand-6)]"})]})}cr.Icon=function({children:e,connection:n}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-center my-[1.625rem] w-10 h-10 rounded-full bg-[var(--sand-1)] border-[0.5px] border-[var(--sand-6)] text-[var(--sand-9)]",children:e}),n&&c.jsx("div",{className:"flex-1 w-px bg-[var(--sand-3)]"})]})};cr.Content=function({children:e,className:n}){return c.jsx("div",{className:He("w-full flex flex-col gap-6 py-8",n),children:e})};function Bet(t){const e=[],n=[],s=Array.isArray(t)?t:[t];for(const r of s){if(!w.isValidElement(r))continue;const i=r;i.type===cr.Icon?e.push(i):i.type===cr.Content&&n.push(i)}return[e.length?e:null,n]}function zet(){const[t,e]=w.useState(!0),[n,s]=w.useState(!1),[r,i]=w.useState(!1),{onboardingApiKey:a,revealedKey:o,createNewApiKey:l,isCreateApiKeyLoading:u,isOnboardingApiKeyLoading:d,isOnboardingApiKeySuccess:f}=Wme(),p=o?"revealed":f&&(a!=null&&a.key)?"masked":d?"loading":"none",{useSessions:m}=fr(),{data:v}=m(),{isVisible:x,setIsVisible:y}=Kme();return w.useEffect(()=>{v!=null&&v.sessions.length&&(v==null?void 0:v.sessions.length)>0&&((v==null?void 0:v.sessions.length)>1||(v==null?void 0:v.sessions[0].status)==="released")&&s(!0)},[v]),c.jsxs(cr,{divider:!0,children:[(a==null?void 0:a.key)&&n===!1&&c.jsx(Oet,{open:t,onClose:()=>{e(!1)},existingSession:v!=null&&v.sessions[0]&&(v==null?void 0:v.sessions[0].status)==="live"?v==null?void 0:v.sessions[0]:null}),c.jsxs(cr.Content,{children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsxs("h2",{className:"text-[2rem] leading-[2.5rem] text-[var(--sand-11)] font-medium",children:["Get started with ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"Steel"})]}),c.jsxs("div",{className:"flex gap-[12px]",children:[c.jsxs("a",{href:"https://docs.steel.dev",target:"_blank",className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[8px] h-[40p
315x] items-center pl-[12px] pr-[10px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",rel:"noreferrer",children:["Docs",c.jsx(La,{size:20,className:"text-[var(--sand-9)]"})]}),c.jsxs("a",{href:"https://cal.com/hussien-hussien-fjxt3x/intro-chat-w-steel-founders",target:"_blank",className:"group cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[8px] h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",rel:"noreferrer",children:[c.jsxs("div",{className:"flex shrink-0 -space-x-[10px]",children:[c.jsx("img",{alt:"",src:"https://cdn.discordapp.com/avatars/711439146589356052/c94ebbecca8a46af928f155054723d3d.webp?size=80",className:"inline-block box-content size-5 rounded-full border-[2.33px] border-[var(--sand-3)] transition-[border-color] duration-150 [transition-timing-function:var(--ease-out)] group-hover:border-[var(--sand-4)]"}),c.jsx("img",{alt:"",src:"https://cdn.discordapp.com/avatars/540729274408370206/6a305ece7f5adb7131ecc412365145e1.webp?size=80",className:"inline-block box-content size-5 rounded-full border-[2.33px] border-[var(--sand-3)] transition-[border-color] duration-150 [transition-timing-function:var(--ease-out)] group-hover:border-[var(--sand-4)]"})]}),"Chat with Founders"]})]})]}),c.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[c.jsx("div",{className:"flex justify-between",children:c.jsx("h3",{className:"text-[20px] leading-[28px] font-medium text-[var(--sand-12)]",children:"Get API Key"})}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px] font-medium",children:"Quickly start building with our API Keys."}),c.jsxs("div",{className:"flex w-full min-w-0 gap-4 items-center mt-2",children:[p==="loading"&&c.jsx(US,{className:"w-full h-10 rounded-md"}),p==="revealed"&&o&&c.jsx(Uet,{apiKey:o,isVisible:x,setIsVisible:y}),p==="masked"&&(a==null?void 0:a.key)&&c.jsx(Fet,{maskedKey:a.key,isRotating:u,onRotate:()=>i(!0)}),p==="none"&&c.jsx("button",{type:"button",disabled:u,onClick:()=>l("create"),className:zk,children:u?"Generating…":"Generate API Key"})]}),(p==="revealed"||p==="masked")&&c.jsx("p",{className:"text-[var(--sand-11)] text-[13px] leading-[18px]",children:p==="revealed"?"Copy this key now. It won't be shown again after you leave this page.":"For security, keys are only shown once. Rotate to get a new one."}),c.jsx(ss,{open:r,onClose:()=>i(!1),noIcon:!0,title:"Rotate API key?",subtitle:"Your current key stops working immediately. The new key is shown once, so copy it before leaving this page.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>i(!1),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>{i(!1),l("rotate")},className:zk,children:"Rotate key"})]})})]})]})]})}const Vet="https://cdn.jsdelivr.net/gh/steel-dev/skills@main/manifest.json",dQ={version:"2026.06.02",schema:1,source:"fallback",skills:{"steel-browser":{title:"Steel Browser",description:"Live browser tasks: scrape, click, fill forms, screenshots, PDFs, and multi-step navigation.",category:"operate",stage:"ga",path:"steel-browser",version:"0.1.0",owner:"Jun",agents:["claude-code","cursor","codex","opencode","pi"],docs_url:"https://docs.steel.dev/overview/agent-skills/steel-browser",install:{skills_cli:"npx skills add steel-dev/skills --skill steel-browser",steel_cli:"steel skills install steel-browser"},requires:["steel-cli"],platform_features:["browser-actions","sessions"]},"steel-developer":{title:"Steel Developer",description:"Reusable Steel code with SDKs, APIs, Playwright, Puppeteer, Stagehand, Browser Use, and embeds.",category:"build",stage:"ga",path:"steel-developer",version:"0.1.0",owner:"Dane",agents:["claude-code","cursor","codex","opencode","pi"],docs_url:"https://docs.steel.dev/overview/agent-skills/steel-developer",install:{skills_cli:"npx skills add steel-dev/skills --skill steel-developer",steel_cli:"steel skills install steel-developer"},requires:["steel-cli"],platform_features:["sdk","sessions"]}
315,"steel-session-debugging":{title:"Debug Failed Sessions",description:"Diagnose failed sessions from metadata, logs, traces, replay links, and network evidence.",category:"debug",stage:"beta",path:"steel-session-debugging",version:"0.1.0",owner:"Nas",agents:["claude-code","cursor","codex","opencode","pi"],docs_url:"https://docs.steel.dev/overview/agent-skills/steel-session-debugging",install:{skills_cli:"npx skills add steel-dev/skills --skill steel-session-debugging",steel_cli:"steel skills install steel-session-debugging"},requires:["steel-cli"],platform_features:["sessions","agent-traces"]},"steel-reliability":{title:"Diagnose Bot Detection",description:"Plan bot-detection, CAPTCHA, proxy, identity, login persistence, pacing, and retry mitigations.",category:"reliability",stage:"beta",path:"steel-reliability",version:"0.1.0",owner:"Nas",agents:["claude-code","cursor","codex","opencode","pi"],docs_url:"https://docs.steel.dev/overview/agent-skills/steel-reliability",install:{skills_cli:"npx skills add steel-dev/skills --skill steel-reliability",steel_cli:"steel skills install steel-reliability"},requires:["steel-cli","steel-session-debugging"],platform_features:["proxies","captchas","profiles"]},"steel-skill-creator":{title:"Create Reusable Skills",description:"Turn recurring browser workflows into reusable, parameterized agent skills.",category:"create",stage:"beta",path:"steel-skill-creator",version:"0.1.0",owner:"Niko",agents:["claude-code"],docs_url:"https://docs.steel.dev/overview/agent-skills/steel-skill-creator",install:{skills_cli:"npx skills add steel-dev/skills --skill steel-skill-creator",steel_cli:"steel skills install steel-skill-creator"},requires:["steel-cli","steel-browser"],platform_features:["sessions","agent-traces"]}}};function Het(){return rs({queryKey:["skills-manifest"],queryFn:async()=>{try{const t=await fetch(Vet);return t.ok?{...await t.json(),source:"remote"}:dQ}catch{return dQ}},staleTime:300*1e3})}const fQ=["steel-browser","steel-developer","steel-skill-creator","steel-session-debugging","steel-reliability"],Get={"steel-browser":"Let your agent control a cloud browser via the Session API","steel-developer":"Start building with Steel with all-you-need-to-know guide","steel-skill-creator":"Turn repeated browser workflows into reusable skills","steel-session-debugging":"Diagnose failed sessions from logs, traces, and replay","steel-reliability":"Plan fixes for CAPTCHA, proxies, identity, and pacing"},Wet={"steel-browser":"1.8k","steel-developer":"1.4k","steel-skill-creator":"1.1k","steel-session-debugging":"1.2k","steel-reliability":"1.3k"};function qet(){const{data:t,isLoading:e}=Het(),n=w.useMemo(()=>{const s=(t==null?void 0:t.skills)??{},r=fQ.flatMap(a=>{const o=s[a];return o?[[a,o]]:[]}),i=Object.entries(s).filter(([a])=>!fQ.includes(a));return[...r,...i]},[t==null?void 0:t.skills]);return e?c.jsx("div",{className:"grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:5}).map((s,r)=>c.jsxs("div",{className:"min-h-[136px] rounded-2xl border border-transparent bg-[var(--sand-2)] p-4",children:[c.jsx("div",{className:"h-5 w-2/3 rounded bg-[var(--sand-3)]"}),c.jsx("div",{className:"mt-4 h-4 w-full rounded bg-[var(--sand-3)]"}),c.jsx("div",{className:"mt-2 h-4 w-3/4 rounded bg-[var(--sand-3)]"}),c.jsx("div",{className:"mt-6 h-3 w-1/2 rounded bg-[var(--sand-3)]"})]},r))}):c.jsxs("div",{className:"flex flex-col gap-3",children:[(t==null?void 0:t.source)==="fallback"&&c.jsx("p",{className:"text-xs font-medium text-[var(--sand-9)]",children:"Showing fallback Steel Skills while the live catalog is unavailable."}),c.jsx("div",{className:"grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:n.map(([s,r])=>{var a;const i=(a=r.install)==null?void 0:a.skills_cli;return c.jsxs("a",{href:r.docs_url,target:"_blank",rel:"noreferrer",onClick:()=>q1.capture("quickstart-skill-card-clicked",{skill:s,...i?{install_command:i}:{}}
315),className:"group flex min-h-[136px] flex-col gap-4 rounded-2xl border border-transparent bg-[var(--sand-2)] p-4 transition-colors hover:bg-[var(--sand-4)]",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 text-[var(--sand-12)]",children:[c.jsx("p",{className:"min-w-0 flex-1 truncate text-[16px] font-medium leading-6",children:s}),c.jsx(La,{size:24,className:"shrink-0 text-[var(--sand-10)] transition-colors group-hover:text-[var(--sand-12)]"})]}),c.jsx("p",{className:"line-clamp-2 min-h-10 text-sm font-medium leading-5 text-[var(--sand-11)]",children:Get[s]??r.description}),c.jsxs("div",{className:"mt-auto truncate text-[12px] font-medium leading-[20px] text-[var(--sand-11)]",children:[Wet[s]??"1.0k"," Installs"]})]},s)})})]})}const Ket={hobby:1e3,launch:3e3,scale:1e4,starter:2900,developer:9900,pro:49900,enterprise:3e5,admin:1e6},Yet={hobby:{browser:.0017,proxy:0,captcha:0,scrape:0},launch:{browser:.0016666667,proxy:1e-8,captcha:.003,scrape:.005},scale:{browser:.0013333333,proxy:6e-9,captcha:.001,scrape:.005},starter:{browser:.001677,proxy:1e-8,captcha:.004,scrape:0},developer:{browser:.0014,proxy:8e-9,captcha:.0035,scrape:0},pro:{browser:84e-5,proxy:5e-9,captcha:.003,scrape:0},enterprise:{browser:67e-5,proxy:3e-9,captcha:.003,scrape:0},admin:{browser:1e-10,proxy:1e-10,captcha:.03,scrape:.005}},hQ={hobby:"Hobby",starter:"Starter",developer:"Developer",pro:"Startups"};function Zet(t,e){const n=t==null?void 0:t.usageRates;return n?{browser:n.browserCentsPerHour/100/(e==="second"?3600:60),proxy:n.proxyCentsPerGb/100/1e9,captcha:n.captchaCentsPer1k/100/1e3,scrape:n.scrapeCentsPer1k/100/1e3}:null}function Xet(t,e){var I,A,L,j,F,O,M;const n=t==null?void 0:t.plan,s=t==null?void 0:t.planConfig,r=t==null?void 0:t.balanceBreakdown,i=n==null?void 0:n.trim().toLowerCase(),a=t==null?void 0:t.planMetadataOverrides,o=i?i in hQ:!1,l=(t==null?void 0:t.browserUsageUnit)??"minute",u=Zet(s,l),d=Yet[i||""]??{browser:0,proxy:0,captcha:0,scrape:0},f=i?(I=a==null?void 0:a.planRates)==null?void 0:I[i]:void 0,p=u??{browser:l==="second"&&(f==null?void 0:f.browser)===void 0?((f==null?void 0:f.browser)??d.browser)/60:(f==null?void 0:f.browser)??d.browser,proxy:(f==null?void 0:f.proxy)??d.proxy,captcha:(f==null?void 0:f.captcha)??d.captcha,scrape:(f==null?void 0:f.scrape)??d.scrape},m=U=>{var G;return((G=U==null?void 0:U.data)==null?void 0:G.reduce(($,V)=>$+V.aggregated_value,0))??0},v=m(t==null?void 0:t.browserUsageDetails),x=m(t==null?void 0:t.proxyUsageDetails),y=m(t==null?void 0:t.captchaUsageDetails),S=m(t==null?void 0:t.scrapeUsageDetails),_=l==="second"?v/60:v,E=v*p.browser+x*p.proxy+y*p.captcha+S*p.scrape,T=s&&s.status!=="grandfathered"?s.includedCreditCents:i==null?void 0:((A=a==null?void 0:a.planAmountCredits)==null?void 0:A[i])??Ket[i]??0,k=((M=(O=(F=(j=(L=t==null?void 0:t.creditBalanceSummary)==null?void 0:L.balances)==null?void 0:j[0])==null?void 0:F.available_balance)==null?void 0:O.monetary)==null?void 0:M.value)??T,R=r!=null?(r.freeCents+r.paidCents)/100:T==null?k==null?void 0:k/100:Math.max(0,T/100-E);return{isLoading:e,plan:n,planLabel:i?hQ[i]??i.charAt(0).toUpperCase()+i.slice(1):void 0,isLegacyPlan:o,browserUsageUnit:l,browserMinutes:_,browserHours:_/60,proxyBytes:x,proxyGB:x/1e9,captchaSolves:y,spendDollars:E,balanceDollars:R,includedCreditDollars:T==null?void 0:T/100,usedCreditDollars:E,balanceBreakdownDollars:r?{freeDollars:r.freeCents/100,paidDollars:r.paidCents/100,paidTotalDollars:r.paidTotalCents/100}:T==null?void 0:{freeDollars:Math.max(0,T/100-E),paidDollars:0,paidTotalDollars:0},lastBillingDate:t==null?void 0:t.lastBillingDate,nextBillingDate:t==null?void 0:t.nextBillingDate,rates:p,planConfig:s}}function mu(){const{useUsageDetails:t}=fr(),{data:e,isLoading:n}=t({enabled:!0});return w.useMemo(()=>Xet(e,n),[e,n])}function X$(t,e=1){return t>=1e6?`${(t/1e6).toFixed(e)}M`:t>=1e3?`${(t/1e3).toFixed(e)}K`:t.toLocaleString("en-US",{maximumFractionDigits:0})}const Qet=t=>"$"+Math.round(t).toLocaleString("en-US"),Jet=t=>"$"+t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});function ett({open:t,onClose:e}){const n=di(),s=Hh()??!1,{balanceBreakdownDollars:r}=mu(),i=r==null?void 0:r.freeDollars,a=i!=null&&i>
3150?`$${i.toLocaleString("en-US",{maximumFractionDigits:2})}`:null;return w.useEffect(()=>{if(!t)return;const o=u=>u.key==="Escape"&&e();document.addEventListener("keydown",o);const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",o),document.body.style.overflow=l}},[t,e]),typeof document>"u"?null:nr.createPortal(c.jsx(xr,{children:t&&c.jsx(wt.div,{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 dark:bg-black/90 p-4 backdrop-blur-[2px]",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:s?0:.2},onMouseDown:o=>{o.target===o.currentTarget&&e()},children:c.jsxs(wt.div,{role:"dialog","aria-modal":"true",className:"flex w-[620px] max-w-full flex-col overflow-hidden rounded-[20px] border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] shadow-modal",initial:s?{opacity:0}:{opacity:0,scale:.96,y:8},animate:{opacity:1,scale:1,y:0},exit:s?{opacity:0}:{opacity:0,scale:.96,y:8},transition:s?{duration:.15}:{type:"spring",bounce:.28,duration:.4},children:[c.jsxs("div",{className:"flex flex-col gap-[6px] rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] font-medium leading-[24px] text-[var(--sand-12)]",children:a?`You got ${a} in credits for free!`:"You got free credits to get started!"}),c.jsx("p",{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-11)]",children:"A small gift from the Steel community, so you can try out and experiment using the capabilities of Steel."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>n("/settings/billing/plans"),className:"flex h-[40px] cursor-pointer items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[16px] text-[14px] font-medium leading-5 text-[var(--sand-12)] dark:text-white transition-colors hover:bg-[var(--sand-5)]",children:"Explore Paid Plans"}),c.jsx("button",{type:"button",onClick:e,className:"flex h-[40px] cursor-pointer items-center justify-center rounded-[8px] bg-[var(--sand-12)] dark:bg-white px-[16px] text-[14px] font-medium leading-5 text-[var(--sand-2)] transition-colors hover:bg-[var(--sand-11)] dark:hover:bg-[#e6e6e4]",children:"Okay, thanks!"})]})]})})}),document.body)}const ttt={hidden:{},show:{transition:{staggerChildren:.06}}},hE={hidden:{opacity:0,y:16},show:{opacity:1,y:0,transition:{duration:.3,ease:"easeOut"}}},uo={python:c.jsx(Whe,{className:"size-[0.875rem]"}),typescript:c.jsx(qhe,{className:"size-[0.875rem]"}),javascript:c.jsx(Ghe,{className:"size-[0.875rem]"})};function fo(t,e){return e[t]}const ntt=[{id:"browser-use",title:"Browser Use",description:"Build an AI Agent with Steel and browser-use",docsUrl:"https://docs.steel.dev/integrations/browser-use",accentColor:"#7CE2FE",thumbnail:"https://registry.steel-edge.net/steel-browser-use-starter/thumbnail.webp?v=a741351",languageIcons:[fo("python",uo)]},{id:"openai-computer-use",title:"OpenAI Computer Use",description:"Create a browser automation agent with Steel and OpenAI's Computer Use Assistant.",docsUrl:"https://docs.steel.dev/integrations/openai-computer-use",accentColor:"#7CE2FE",thumbnail:"https://registry.steel-edge.net/oai-computer-use/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo),fo("python",uo)]},{id:"claude-computer-use",title:"Claude Computer Use",description:"Create a browser automation agent with Steel and Claude's Computer Use API.",docsUrl:"https://docs.steel.dev/integrations/claude-computer-use",accentColor:"#F76808",thumbnail:"https://registry.steel-edge.net/claude-computer-use/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo),fo("python",uo)]},{id:"puppeteer",title:"Puppeteer",description:"Control Steel's managed browser infrastructure with Puppeteer in Node.js.",docsUrl:"https://docs.steel.dev/integrations/puppeteer",accentColor:"#F5D90A",thumbnail:"https://registry.steel-edge.net/puppeteer-starter/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo),fo("javascript",uo)]},{id:"playwright",title:"Playwright",description:"Control Steel's managed browser infrastru
315cture with Playwright.",docsUrl:"https://docs.steel.dev/integrations/playwright",accentColor:"#68DDFD",thumbnail:"https://registry.steel-edge.net/playwright-starter/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo),fo("python",uo)]},{id:"stagehand",title:"Stagehand",description:"Use Steel with Stagehand for AI-powered browser automations.",docsUrl:"https://docs.steel.dev/integrations/stagehand",accentColor:"#22C55E",thumbnail:"https://registry.steel-edge.net/stagehand-starter/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo),fo("python",uo)]},{id:"magnitude",title:"Magnitude",description:"Build an AI Agent with Steel and Magnitude",docsUrl:"https://docs.steel.dev/integrations/magnitude",accentColor:"#0091FF",thumbnail:"https://registry.steel-edge.net/steel-magnitude-starter/thumbnail.webp?v=a741351",languageIcons:[fo("typescript",uo)]},{id:"notte",title:"Notte",description:"Build an AI Agent with Steel and Notte",docsUrl:"https://docs.steel.dev/integrations/notte",accentColor:"#8B5CF6",thumbnail:"https://registry.steel-edge.net/steel-notte-starter/thumbnail.webp?v=a741351",languageIcons:[fo("python",uo)]}];function stt(){const t=Gs(),e=di(),[n,s]=w.useState(()=>{var r;return!!((r=t.state)!=null&&r.welcomeCredits)});return w.useEffect(()=>{var r;(r=t.state)!=null&&r.welcomeCredits&&e(".",{replace:!0,state:null})},[]),c.jsxs(SXe,{children:[c.jsx("main",{className:"flex justify-center overflow-y-auto scroll-auto",children:c.jsxs(wt.div,{variants:ttt,initial:"hidden",animate:"show",className:"flex flex-col items-center w-full pt-[12px]",children:[c.jsx(wt.div,{variants:hE,className:"flex w-full flex-col items-center",children:c.jsx(zet,{})}),c.jsx(wt.div,{variants:hE,className:"flex w-full flex-col items-center",children:c.jsxs(cr,{divider:!0,children:[c.jsx(cr.Icon,{children:c.jsx(Vqe,{className:"text-[var(--sand-9)]"})}),c.jsxs(cr.Content,{children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("h2",{className:"text-[20px] leading-[28px] font-medium text-[var(--sand-12)]",children:"Quick Build with Steel"}),c.jsx("div",{className:"flex text-sm items-center bg-[var(--yellow-3)] hover:bg-[var(--yellow-3)] text-[var(--yellow-11)] dark:bg-dark-yellow-3 dark:hover:bg-dark-yellow-3 dark:text-dark-yellow-9 px-2 py-1 rounded-full",children:"Automatic Setup"})]}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px] font-medium",children:"The fastest way to get started, with the CLI or your favorite coding agent."})]}),c.jsx(TXe,{})]})]})}),c.jsx(wt.div,{variants:hE,className:"flex w-full flex-col items-center",children:c.jsxs(cr,{divider:!0,children:[c.jsx(cr.Icon,{connection:!0,children:c.jsx(zqe,{className:"text-[var(--sand-9)]",size:20})}),c.jsxs(cr.Content,{children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h2",{className:"text-[20px] leading-[28px] font-medium text-[var(--sand-12)]",children:"Agent skills"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px] font-medium",children:"Get started with Skills that help your agent build on Steel"})]}),c.jsx(qet,{})]})]})}),c.jsx(wt.div,{variants:hE,className:"flex w-full flex-col items-center",children:c.jsxs(cr,{children:[c.jsx(cr.Icon,{connection:!0,children:c.jsx(qde,{className:"text-[var(--sand-9)]",size:20})}),c.jsxs(cr.Content,{children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h2",{className:"text-[20px] leading-[28px] font-semibold text-[var(--sand-12)]",children:"Guides"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px] font-medium",children:"Select one of the Cookbook Templates to get a breakdown behind how they work."})]}),c.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ntt.map(r=>c.jsx("a",{href:r.docsUrl,target:"_blank",rel:"noreferrer",className:"block h-full rounded-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sand-12)]",children:c.jsx(RXe,{value:r.id,label:r.title,languageIcons:r.languageIcons,text:r.description,heroImage:r.thumbnail,accentColor:r.accentColor})},r.id))})]})]})}),c.jsx("div",{className:"w-full pb-16"})]})}),c.jsx(ett,{open:n,onClose:()=>s(!1)})]})}const Mh=({className:t,strokeWidth:e=2})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",className:He("animate-spin",t),children:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});var pQ={},rtt=(function(t,e,n,s,r){var i=new Worker(pQ[e]||(pQ[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(a){var o=a.data,l=o.$e$;if(l){var u=new Error(l[0]);u.code=l[1],u.stack=l[2],r(u,null)}else r(null,o)},i.postMessage(n,s),i}),ra=Uint8Array,Ya=Uint16Array,hR=Int32Array,pR=new ra([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]),mR=new ra([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]),gD=new ra([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t0e=function(t,e){for(var n=new Ya(31),s=0;s<31;++s)n[s]=e+=1<<t[s-1];for(var r=new hR(n[30]),s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return{b:n,r}},n0e=t0e(pR,2),itt=n0e.b,Vk=n0e.r;itt[28]=258,Vk[258]=28;var att=t0e(mR,0),vD=att.r,Hk=new Ya(32768);for(var tr=0;tr<32768;++tr){var vf=(tr&43690)>>1|(tr&21845)<<1;vf=(vf&52428)>>2|(vf&13107)<<2,vf=(vf&61680)>>4|(vf&3855)<<4,Hk[tr]=((vf&65280)>>8|(vf&255)<<8)>>1}var av=(function(t,e,n){for(var s=t.length,r=0,i=new Ya(e);r<s;++r)t[r]&&++i[t[r]-1];var a=new Ya(e);for(r=1;r<e;++r)a[r]=a[r-1]+i[r-1]<<1;var o;if(n){o=new Ya(1<<e);var l=15-e;for(r=0;r<s;++r)if(t[r])for(var u=r<<4|t[r],d=e-t[r],f=a[t[r]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)o[Hk[f]>>l]=u}else for(o=new Ya(s),r=0;r<s;++r)t[r]&&(o[r]=Hk[a[t[r]-1]++]>>15-t[r]);return o}
vendor: 3,982 bytes, line 315
315),Dh=new ra(288);for(var tr=0;tr<144;++tr)Dh[tr]=8;for(var tr=144;tr<256;++tr)Dh[tr]=9;for(var tr=256;tr<280;++tr)Dh[tr]=7;for(var tr=280;tr<288;++tr)Dh[tr]=8;var y2=new ra(32);for(var tr=0;tr<32;++tr)y2[tr]=5;var s0e=av(Dh,9,0),r0e=av(y2,5,0),Q$=function(t){return(t+7)/8|0},J$=function(t,e,n){return(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length),new ra(t.subarray(e,n))},ott=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],s1=function(t,e,n){var s=new Error(e||ott[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,s1),!n)throw s;return s},Tc=function(t,e,n){n<<=e&7;var s=e/8|0;t[s]|=n,t[s+1]|=n>>8},m0=function(t,e,n){n<<=e&7;var s=e/8|0;t[s]|=n,t[s+1]|=n>>8,t[s+2]|=n>>16},rT=function(t,e){for(var n=[],s=0;s<t.length;++s)t[s]&&n.push({s,f:t[s]});var r=n.length,i=n.slice();if(!r)return{t:tF,l:0};if(r==1){var a=new ra(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(k,R){return k.f-R.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[u].f<n[f].f?u++:f++],l=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};for(var p=i[0].s,s=1;s<r;++s)i[s].s>p&&(p=i[s].s);var m=new Ya(p+1),v=Gk(n[d-1],m,0);if(v>e){var s=0,x=0,y=v-e,S=1<<y;for(i.sort(function(R,I){return m[I.s]-m[R.s]||R.f-I.f});s<r;++s){var _=i[s].s;if(m[_]>e)x+=S-(1<<v-m[_]),m[_]=e;else break}for(x>>=y;x>0;){var E=i[s].s;m[E]<e?x-=1<<e-m[E]++-1:++s}for(;s>=0&&x;--s){var T=i[s].s;m[T]==e&&(--m[T],++x)}v=e}return{t:new ra(m),l:v}},Gk=function(t,e,n){return t.s==-1?Math.max(Gk(t.l,e,n+1),Gk(t.r,e,n+1)):e[t.s]=n},xD=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Ya(++e),s=0,r=t[0],i=1,a=function(l){n[s++]=l},o=1;o<=e;++o)if(t[o]==r&&o!=e)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=t[o]}return{c:n.subarray(0,s),n:e}},g0=function(t,e){for(var n=0,s=0;s<e.length;++s)n+=t[s]*e[s];return n},eF=function(t,e,n){var s=n.length,r=Q$(e+2);t[r]=s&255,t[r+1]=s>>8,t[r+2]=t[r]^255,t[r+3]=t[r+1]^255;for(var i=0;i<s;++i)t[r+i+4]=n[i];return(r+4+s)*8},yD=function(t,e,n,s,r,i,a,o,l,u,d){Tc(e,d++,n),++r[256];for(var f=rT(r,15),p=f.t,m=f.l,v=rT(i,15),x=v.t,y=v.l,S=xD(p),_=S.c,E=S.n,T=xD(x),k=T.c,R=T.n,I=new Ya(19),A=0;A<_.length;++A)++I[_[A]&31];for(var A=0;A<k.length;++A)++I[k[A]&31];for(var L=rT(I,7),j=L.t,F=L.l,O=19;O>4&&!j[gD[O-1]];--O);var M=u+5<<3,U=g0(r,Dh)+g0(i,y2)+a,G=g0(r,p)+g0(i,x)+a+14+3*O+g0(I,j)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&M<=U&&M<=G)return eF(e,d,t.subarray(l,l+u));var $,V,B,q;if(Tc(e,d,1+(G<U)),d+=2,G<U){$=av(p,m,0),V=p,B=av(x,y,0),q=x;var z=av(j,F,0);Tc(e,d,E-257),Tc(e,d+5,R-1),Tc(e,d+10,O-4),d+=14;for(var A=0;A<O;++A)Tc(e,d+3*A,j[gD[A]]);d+=3*O;for(var D=[_,k],K=0;K<2;++K)for(var Y=D[K],A=0;A<Y.length;++A){var J=Y[A]&31;Tc(e,d,z[J]),d+=j[J],J>15&&(Tc(e,d,Y[A]>>5&127),d+=Y[A]>>12)}}else $=s0e,V=Dh,B=r0e,q=y2;for(var A=0;A<o;++A){var ne=s[A];if(ne>255){var J=ne>>18&31;m0(e,d,$[J+257]),d+=V[J+257],J>7&&(Tc(e,d,ne>>23&31),d+=pR[J]);var Q=ne&31;m0(e,d,B[Q]),d+=q[Q],Q>3&&(m0(e,d,ne>>5&8191),d+=mR[Q])}else m0(e,d,$[ne]),d+=V[ne]}return m0(e,d,$[256]),d+V[256]},i0e=new hR([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tF=new ra(0),a0e=function(t,e,n,s,r,i){var a=i.z||t.length,o=new ra(s+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(s,o.length-r),u=i.l,d=(i.r||0)&7;if(e){d&&(l[0]=i.r>>3);for(var f=i0e[e-1],p=f>>13,m=f&8191,v=(1<<n)-1,x=i.p||new Ya(32768),y=i.h||new Ya(v+1),S=Math.ceil(n/3),_=2*S,E=function(Ce){return(t[Ce]^t[Ce+1]<<S^t[Ce+2]<<_)&v},T=new hR(25e3),k=new Ya(288),R=new Ya(32),I=0,A=0,L=i.i||0,j=0,F=i.w||0,O=0;L+2<a;++L){var M=E(L),U=L&32767,G=y[M];if(x[U]=G,y[M]=U,F<=L){var $=a-L;
vendor: 6,091 bytes, line 315
315if((I>7e3||j>24576)&&($>423||!u)){d=yD(t,l,0,T,k,R,A,j,O,L-O,d),j=I=A=0,O=L;for(var V=0;V<286;++V)k[V]=0;for(var V=0;V<30;++V)R[V]=0}var B=2,q=0,z=m,D=U-G&32767;if($>2&&M==E(L-D))for(var K=Math.min(p,$)-1,Y=Math.min(32767,L),J=Math.min(258,$);D<=Y&&--z&&U!=G;){if(t[L+B]==t[L+B-D]){for(var ne=0;ne<J&&t[L+ne]==t[L+ne-D];++ne);if(ne>B){if(B=ne,q=D,ne>K)break;for(var Q=Math.min(D,ne-2),ee=0,V=0;V<Q;++V){var te=L-D+V&32767,ue=x[te],ye=te-ue&32767;ye>ee&&(ee=ye,G=te)}}}U=G,G=x[U],D+=U-G&32767}if(q){T[j++]=268435456|Vk[B]<<18|vD[q];var je=Vk[B]&31,Re=vD[q]&31;A+=pR[je]+mR[Re],++k[257+je],++R[Re],F=L+B,++I}else T[j++]=t[L],++k[t[L]]}}for(L=Math.max(L,F);L<a;++L)T[j++]=t[L],++k[t[L]];d=yD(t,l,u,T,k,R,A,j,O,L-O,d),u||(i.r=d&7|l[d/8|0]<<3,d-=7,i.h=y,i.p=x,i.i=L,i.w=F)}else{for(var L=i.w||0;L<a+u;L+=65535){var me=L+65535;me>=a&&(l[d/8|0]=u,me=a),d=eF(l,d+1,t.subarray(L,me))}i.i=a}return J$(o,0,s+Q$(d)+r)},ltt=(function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,s=9;--s;)n=(n&1&&-306674912)^n>>>1;t[e]=n}return t})(),ctt=function(){var t=-1;return{p:function(e){for(var n=t,s=0;s<e.length;++s)n=ltt[n&255^e[s]]^n>>>8;t=n},d:function(){return~t}}},o0e=function(t,e,n,s,r){if(!r&&(r={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),a=new ra(i.length+t.length);a.set(i),a.set(t,i.length),t=a,r.w=i.length}return a0e(t,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,s,r)},nF=function(t,e){var n={};for(var s in t)n[s]=t[s];for(var s in e)n[s]=e[s];return n},mQ=function(t,e,n){for(var s=t(),r=t.toString(),i=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a<s.length;++a){var o=s[a],l=i[a];if(typeof o=="function"){e+=";"+l+"=";var u=o.toString();if(o.prototype)if(u.indexOf("[native code]")!=-1){var d=u.indexOf(" ",8)+1;e+=u.slice(d,u.indexOf("(",d))}else{e+=u;for(var f in o.prototype)e+=";"+l+".prototype."+f+"="+o.prototype[f].toString()}else e+=u}else n[l]=o}return e},pE=[],utt=function(t){var e=[];for(var n in t)t[n].buffer&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e},dtt=function(t,e,n,s){if(!pE[n]){for(var r="",i={},a=t.length-1,o=0;o<a;++o)r=mQ(t[o],r,i);pE[n]={c:mQ(t[a],r,i),e:i}}var l=nF({},pE[n].e);return rtt(pE[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,l,utt(l),s)},ftt=function(){return[ra,Ya,hR,pR,mR,gD,Vk,vD,s0e,Dh,r0e,y2,Hk,i0e,tF,av,Tc,m0,rT,Gk,xD,g0,eF,yD,Q$,J$,a0e,o0e,sF,l0e]},l0e=function(t){return postMessage(t,[t.buffer])},htt=function(t,e,n,s,r,i){var a=dtt(n,s,r,function(o,l){a.terminate(),i(o,l)});return a.postMessage([t,e],e.consume?[t.buffer]:[]),function(){a.terminate()}},Pi=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function ptt(t,e,n){return n||(n=e,e={}),typeof n!="function"&&s1(7),htt(t,e,[ftt],function(s){return l0e(sF(s.data[0],s.data[1]))},0,n)}function sF(t,e){return o0e(t,e||{},0,0)}var c0e=function(t,e,n,s){for(var r in t){var i=t[r],a=e+r,o=s;Array.isArray(i)&&(o=nF(s,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[a]=[i,o]:(n[a+="/"]=[new ra(0),o],c0e(i,a,n,s))}},gQ=typeof TextEncoder<"u"&&new TextEncoder,mtt=typeof TextDecoder<"u"&&new TextDecoder,gtt=0;try{mtt.decode(tF,{stream:!0}),gtt=1}catch{}function vQ(t,e){var n;if(gQ)return gQ.encode(t);for(var s=t.length,r=new ra(t.length+(t.length>>1)),i=0,a=function(u){r[i++]=u},n=0;n<s;++n){if(i+5>r.length){var o=new ra(i+8+(s-n<<1));o.set(r),r=o}var l=t.charCodeAt(n);l<128||e?a(l):l<2048?(a(192|l>>6),a(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|t.charCodeAt(++n)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63)):(a(224|l>>12),a(128|l>>6&63),a(128|l&63))}return J$(r,0,i)}var bD=function(t){var e=0;if(t)for(var n in t){var s=t[n].length;s>65535&&s1(9),e+=s+4}return e},xQ=function(t,e,n,s,r,i,a,o){var l=s.length,u=n.extra,d=o&&o.length,f=bD(u);Pi(t,e,a!=null?33639248:67324752),e+=4,a!=null&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(i<0&&8),t[e++]=r&&8,t[e++]=n.compression&255,t[e++]=n.compression>>8;var p=new Date(n.mtime==null?Date.now():n.mtime),m=p.getFullYear()-1980;if((m<0||m>119)&&s1(10),Pi(t,e,m<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1),e+=4,i!=-1&&(Pi(t,e,n.crc),Pi(t,e+4,i<0?-i-2:i),Pi(t,e+8,n.size)),Pi(t,e+12,l),Pi(t,e+14,f),e+=16,a!=null&&(Pi(t,e,d),Pi(t,e+6,n.attrs),Pi(t,e+10,a),e+=14),t.set(s,e),e+=l,f)for(var v in u){var x=u[v],y=x.length;Pi(t,e,+v),Pi(t,e+2,y),t.set(x,e+4),e+=4+y}return d&&(t.set(o,e),e+=d),e},vtt=function(t,e,n,s,r){Pi(t,e,101010256),Pi(t,e+8,n),Pi(t,e+10,n),Pi(t,e+12,s),Pi(t,e+16,r)};function xtt(t,e,n){n||(n=e,e={}),typeof n!="function"&&s1(7);var s={};c0e(t,"",s,e);var r=Object.keys(s),i=r.length,a=0,o=0,l=i,u=new Array(i),d=[],f=function(){for(var y=0;y<d.length;++y)d[y]()},p=function(y,S){yQ(function(){n(y,S)})};yQ(function(){p=n});var m=function(){var y=new ra(o+22),S=a,_=o-a;o=0;for(var E=0;E<l;++E){var T=u[E];try{var k=T.c.length;xQ(y,o,T,T.f,T.u,k);var R=30+T.f.length+bD(T.extra),I=o+R;y.set(T.c,I),xQ(y,a,T,T.f,T.u,k,o,T.m),a+=16+R+(T.m?T.m.length:0),o=I+k}catch(A){return p(A,null)}}vtt(y,a,u.length,_,S),p(null,y)};i||m();for(var v=function(y){var S=r[y],_=s[S],E=_[0],T=_[1],k=ctt(),R=E.length;k.p(E);var I=vQ(S),A=I.length,L=T.comment,j=L&&vQ(L),F=j&&j.length,O=bD(T.extra),M=T.level==0?0:8,U=function(G,$){if(G)f(),p(G,null);else{var V=$.length;u[y]=nF(T,{size:R,crc:k.d(),c:$,f:I,m:j,u:A!=S.length||j&&L.length!=F,compression:M}),a+=30+A+O+V,o+=76+2*(A+O)+(F||0)+V,--i||m()}};if(A>65535&&U(s1(11,0,1),null),!M)U(null,E);else if(R<16e4)try{U(null,sF(E,T))}catch(G){U(G,null)}else d.push(ptt(E,T,U))},x=0;x<l;++x)v(x);return f}var yQ=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(t){t()},zS=t=>t.type==="checkbox",gR=t=>t.type==="file",lh=t=>t instanceof Date,xi=t=>t==null;const rF=t=>typeof t=="object";var Ar=t=>!xi(t)&&!Array.isArray(t)&&rF(t)&&!lh(t),SD=t=>Ar(t)&&t.target?zS(t.target)?t.target.checked:gR(t.target)?t.target.files:t.target.value:t,u0e=(t,e)=>e.split(".").some((n,s,r)=>
315!isNaN(Number(n))&&t.has(r.slice(0,s).join("."))),vR=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function or(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(vR&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&t.constructor!==Object)return t;const s=n?[]:Object.create(Object.getPrototypeOf(t));for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=or(t[r]));return s}const Bf={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Yl={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ol={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},d0e="root",iF=["__proto__","constructor","prototype"],ytt=/^\w*$/;var $m=t=>ytt.test(t),fs=t=>t===void 0;const btt=/[.[\]'"]/;var r1=t=>t.split(btt).filter(Boolean),ot=(t,e,n)=>{if(!e||!Ar(t))return n;const s=$m(e)?[e]:r1(e);if(s.some(i=>iF.includes(i)))return n;const r=s.reduce((i,a)=>xi(i)?void 0:i[a],t);return fs(r)||r===t?fs(t[e])?n:t[e]:r},_o=t=>typeof t=="boolean",ta=t=>typeof t=="function",us=(t,e,n)=>{let s=-1;const r=$m(e)?[e]:r1(e),i=r.length,a=i-1;for(;++s<i;){const o=r[s];let l=n;if(s!==a){const u=t[o];l=Ar(u)||Array.isArray(u)?u:isNaN(+r[s+1])?{}:[]}if(iF.includes(o))return;t[o]=l,t=t[o]}};const aF=re.createContext(null);aF.displayName="HookFormControlContext";const oF=()=>re.useContext(aF);var f0e=(t,e,n,s=!0)=>{const r={};for(const i in t)Object.defineProperty(r,i,{get:()=>{const a=i;return e._proxyFormState[a]!==Yl.all&&(e._proxyFormState[a]=!s||Yl.all),n&&(n[a]=!0),t[a]}});return r};const lF=vR?re.useLayoutEffect:re.useEffect;var Stt=t=>{const e=t.constructor&&t.constructor.prototype;return Ar(e)&&e.hasOwnProperty("isPrototypeOf")},wD=t=>xi(t)||!rF(t);const bQ=(t,e)=>e.length===0&&!Array.isArray(t)&&!Stt(t);function qa(t,e,n=new WeakMap){if(t===e)return!0;if(wD(t)||wD(e))return Object.is(t,e);if(lh(t)&&lh(e))return Object.is(t.getTime(),e.getTime());const s=Object.keys(t),r=Object.keys(e);if(s.length!==r.length)return!1;if(bQ(t,s)||bQ(e,r))return Object.is(t,e);if(!s.length&&Array.isArray(t)!==Array.isArray(e))return!1;const i=n.get(t);if(i&&i.has(e))return!0;if(i)i.add(e);else{const a=new WeakSet;a.add(e),n.set(t,a)}for(const a of s){const o=t[a];if(!(a in e))return!1;if(a!=="ref"){const l=e[a];if(lh(o)&&lh(l)||(Ar(o)||Array.isArray(o))&&(Ar(l)||Array.isArray(l))?!qa(o,l,n):!Object.is(o,l))return!1}}return!0}function cF(){const t=re.useRef(!1),e=re.useRef(void 0),n=re.useCallback((r,i,a)=>{if(r&&t.current){const o=i();qa(e.current,o)||a(o)}t.current=!0},[]),s=re.useCallback((r,i)=>{r&&(e.current=or(i()))},[]);return{resyncIfNeeded:n,snapshot:s}}function wtt(t){const e=oF(),{control:n=e,disabled:s,name:r,exact:i}=t||{},[a,o]=re.useState(()=>({...n._formState,defaultValues:n._defaultValues})),l=re.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:d}=cF();return lF(()=>{const f=()=>({...n._formState,defaultValues:n._defaultValues});u(!s,f,o);const p=n._subscribe({name:r,formState:l.current,exact:i,callback:m=>{!s&&o({...n._formState,...m,defaultValues:n._defaultValues})}});return()=>{p(),d(!s,f)}},[r,s,i,u,d]),re.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),re.useMemo(()=>f0e(a,n,l.current,!1),[a,n])}var bi=t=>typeof t=="string",_D=(t,e,n,s,r)=>bi(t)?(s&&e.watch.add(t),ot(n,t,r)):Array.isArray(t)?t.map(i=>(s&&e.watch.add(i),ot(n,i))):(s&&(e.watchAll=!0),n);function _tt(t){const e=oF(),{control:n=e,name:s,defaultValue:r,disabled:i,exact:a,compute:o}=t||{},l=re.useRef(r),u=re.useRef(o),d=re.useRef(void 0),f=re.useRef(n),p=re.useRef(s);u.current=o;const[m,v]=re.useState(()=>{const A=n._getWatch(s,l.current);return u.current?u.current(A):A}),x=re.useCallback(A=>{const L=_D(s,n._names,A||n._formValues,!1,l.current);return u.current?u.current(L):L},[n._formValues,n._names,s]),y=re.useCallback(A=>{if(!i){const L=_D(s,n._names,A||n._formValues,!1,l.current);if(u.current){const j=u.current(L);qa(j,d.current)||(v(j),d.current=j)}else v(L)}},[n._formValues,n._names,i,s]),{resyncIfNeeded:S,snapshot:_}=cF(),E=re.useRef(y);E.current=y;const T=re.useRef(x);T.current=x,lF(()=>{f.current!==n||!qa(p.current,s)?(f.current=n,p.current=s,E.current()):S(!i,()=>T.current(),L=>
vendor: 4,412 bytes, line 315
315{v(L),d.current=L});const A=n._subscribe({name:s,formState:{values:!0},exact:a,callback:L=>{E.current(L.values)}});return()=>{A(),_(!i,()=>T.current())}},[n,a,s,i,S,_]),re.useEffect(()=>n._removeUnmounted());const k=f.current!==n,R=p.current;return re.useMemo(()=>{if(i)return!1;const A=!k&&!qa(R,s);return k||A},[i,k,s,R])?x():m}function Ett(t){const e=oF(),{name:n,disabled:s,control:r=e,shouldUnregister:i,defaultValue:a,exact:o=!0}=t,l=u0e(r._names.array,n),u=re.useMemo(()=>ot(r._formValues,n,ot(r._defaultValues,n,a)),[r,n,a]),d=_tt({control:r,name:n,defaultValue:u,exact:o}),f=wtt({control:r,name:n,exact:o}),p=re.useRef(t),m=re.useRef(null),v=re.useRef(r.register(n,{...t.rules,value:d,..._o(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const x=re.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ot(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!ot(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ot(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ot(f.validatingFields,n)},error:{enumerable:!0,get:()=>ot(f.errors,n)}}),[f,n]),y=re.useCallback(T=>{const k=SD(T);return ot(r._fields,n)||(v.current=r.register(n,{...p.current.rules,value:k})),v.current.onChange({target:{value:SD(T),name:n},type:Bf.CHANGE})},[n,r]),S=re.useCallback(()=>v.current.onBlur({target:{value:ot(r._formValues,n),name:n},type:Bf.BLUR}),[n,r._formValues]),_=re.useCallback(T=>{T&&(m.current={focus:()=>ta(T.focus)&&T.focus(),select:()=>ta(T.select)&&T.select(),setCustomValidity:R=>ta(T.setCustomValidity)&&T.setCustomValidity(R),reportValidity:()=>ta(T.reportValidity)&&T.reportValidity()});const k=ot(r._fields,n);k&&k._f&&T&&(k._f.ref=m.current)},[r._fields,n]),E=re.useMemo(()=>({name:n,value:d,..._o(s)||f.disabled?{disabled:f.disabled||s}:{},onChange:y,onBlur:S,ref:_}),[n,s,f.disabled,y,S,_,d]);return re.useEffect(()=>{const T=r._options.shouldUnregister||i;v.current=r.register(n,{...p.current.rules,..._o(p.current.disabled)?{disabled:p.current.disabled}:{}});const k=(R,I)=>{const A=ot(r._fields,R);A&&A._f&&(A._f.mount=I)};if(k(n,!0),T){const R=or(ot(i?r._defaultValues:r._options.values||r._defaultValues,n,ot(r._options.defaultValues,n,p.current.defaultValue)));us(r._defaultValues,n,R),fs(ot(r._formValues,n))&&us(r._formValues,n,R)}if(!l&&r.register(n),m.current){const R=ot(r._fields,n);R&&R._f&&(R._f.ref=m.current)}return()=>{(l?T&&!r._state.action:T)?r.unregister(n):k(n,!1)}},[n,r,l,i]),re.useEffect(()=>{r._setDisabledField({disabled:s,name:n})},[s,n,r]),re.useMemo(()=>({field:E,formState:f,fieldState:x}),[E,f,x])}const Ctt=t=>t.render(Ett(t));var mE=t=>({isOnSubmit:!t||t===Yl.onSubmit,isOnBlur:t===Yl.onBlur,isOnChange:t===Yl.onChange,isOnAll:t===Yl.all,isOnTouch:t===Yl.onTouched}),vI=(t,e,n)=>{if(n)return!1;if(e.watchAll||e.watch.has(t))return!0;for(const s of e.watch)if(t.startsWith(s)&&t.charAt(s.length)===".")return!0;return!1};const yb=(t,e,n,s)=>{for(const r of n||Object.keys(t)){if(r==="_f")continue;const i=n?ot(t,r):t[r];if(i){const{_f:a}=i;if(a){if(a.refs&&a.refs[0]&&e(a.refs[0],r)&&!s)return!0;if(a.ref&&e(a.ref,a.name)&&!s)return!0;if(yb(i,e))break}else if((Ar(i)||Array.isArray(i))&&yb(i,e))break}}};var SQ=(t,e,n)=>{const s=ot(t,n),r=Array.isArray(s)?s:[];return us(r,d0e,e[n]),us(t,n,r),t},ji=t=>Ar(t)&&!Object.keys(t).length,Wk=t=>{if(!vR)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},uF=t=>t.type==="radio",qk=t=>t instanceof RegExp,h0e=(t,e,n,s,r)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:r||!0}}:{};const wQ={value:!1,isValid:!1},_Q={value:!0,isValid:!0};var p0e=t=>{if(!Array.isArray(t))return wQ;if(t.length>1){const n=t.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}const e=t[0];return!e||!e.checked||e.disabled?wQ:!e.attributes||!("value"in e.attributes)||fs(e.value)||e.value===""?_Q:{value:e.value,isValid:!0}};const EQ={isValid:!1,value:null};var m0e=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,EQ):EQ;function CQ(t,e,n="validate"){if(bi(t)||Array.isArray(t)&&t.every(bi)||_o(t)&&!t)return{type:n,message:bi(t)?t:"",ref:e}}var Yg=t=>Ar(t)&&!qk(t)?t:{value:t,message:""},TQ=async(t,e,n,s,r,i)=>{const{ref:a,refs:o,required:l,maxLength:u,minLength:d,min:f,max:p,pattern:m,validate:v,name:x,valueAsNumber:y,mount:S}=t._f,_=ot(n,x);if(!S||e.has(x))return{};
315const E=o?o[0]:a,T=M=>{if(r&&E.reportValidity){const U=_o(M)?"":M||"";o?o.forEach(G=>G.setCustomValidity(U)):E.setCustomValidity(U),E.reportValidity()}},k={},R=uF(a),I=zS(a),A=R||I,L=(y||gR(a))&&fs(a.value)&&fs(_)||Wk(a)&&a.value===""||_===""||Array.isArray(_)&&!_.length,j=h0e.bind(null,x,s,k),F=(M,U,G,$=Ol.maxLength,V=Ol.minLength)=>{const B=M?U:G;k[x]={type:M?$:V,message:B,ref:a,...j(M?$:V,B)}};if(i?!Array.isArray(_)||!_.length:l&&(!A&&(L||xi(_))||_o(_)&&!_||I&&!p0e(o).isValid||R&&!m0e(o).isValid)){const{value:M,message:U}=bi(l)?{value:!!l,message:l}:Yg(l);if(M&&(k[x]={type:Ol.required,message:U,ref:E,...j(Ol.required,U)},!s))return T(U),k}if(!L&&(!xi(f)||!xi(p))){let M,U;const G=Yg(p),$=Yg(f);if(!xi(_)&&!lh(_)&&!isNaN(_)){const V=a.valueAsNumber||_&&+_;xi(G.value)||(M=V>G.value),xi($.value)||(U=V<$.value)}else{const V=a.valueAsDate||new Date(_),B=D=>new Date(new Date().toDateString()+" "+D),q=a.type=="time",z=a.type=="week";bi(G.value)&&_&&(M=q?B(_)>B(G.value):z?_>G.value:V>new Date(G.value)),bi($.value)&&_&&(U=q?B(_)<B($.value):z?_<$.value:V<new Date($.value))}if((M||U)&&(F(!!M,G.message,$.message,Ol.max,Ol.min),!s))return T(k[x].message),k}if((u||d)&&!L&&(bi(_)||i&&Array.isArray(_))){const M=Yg(u),U=Yg(d),G=!xi(M.value)&&_.length>+M.value,$=!xi(U.value)&&_.length<+U.value;if((G||$)&&(F(G,M.message,U.message),!s))return T(k[x].message),k}if(m&&!L&&bi(_)){const{value:M,message:U}=Yg(m);if(qk(M)&&!_.match(M)&&(k[x]={type:Ol.pattern,message:U,ref:a,...j(Ol.pattern,U)},!s))return T(U),k}if(v){if(ta(v)){const M=await v(_,n),U=CQ(M,E);if(U&&(k[x]={...U,...j(Ol.validate,U.message)},!s))return T(U.message),k}else if(Ar(v)){let M={};for(const U in v){if(!ji(M)&&!s)break;const G=CQ(await v[U](_,n),E,U);G&&(M={...G,...j(U,G.message)},T(G.message),s&&(k[x]=M))}if(!ji(M)&&(k[x]={ref:E,...M},!s))return k}}const O=k[x];return T(O?O.message:!0),k},iT=t=>Array.isArray(t)?t:[t],g0e=t=>Array.isArray(t)?t.filter(Boolean):[];function Ttt(t,e){const n=e.length-1;let s=0;for(;s<n;){if(xi(t)){t=void 0;break}t=t[e[s]],s++}return t}function ktt(t){for(const e in t)if(t.hasOwnProperty(e)&&!fs(t[e]))return!1;return!0}function Fr(t,e){if(bi(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:$m(e)?[e]:r1(e);if(n.some(a=>iF.includes(String(a))))return t;const s=n.length===1?t:Ttt(t,n),r=n.length-1,i=n[r];return s&&delete s[i],r!==0&&(Ar(s)&&ji(s)||Array.isArray(s)&&ktt(s))&&Fr(t,n.slice(0,-1)),t}const dF=re.createContext(null);dF.displayName="HookFormContext";const Rtt=()=>re.useContext(dF),Att=({children:t,watch:e,getValues:n,getErrors:s,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:l,trigger:u,formState:d,resetField:f,reset:p,resetDefaultValues:m,handleSubmit:v,unregister:x,control:y,register:S,setFocus:_,subscribe:E})=>{const T=re.useMemo(()=>({watch:e,getValues:n,getErrors:s,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:l,trigger:u,formState:d,resetField:f,reset:p,resetDefaultValues:m,handleSubmit:v,unregister:x,control:y,register:S,setFocus:_,subscribe:E}),[a,y,d,s,r,n,v,S,p,m,f,i,_,o,l,E,u,x,e]);return re.createElement(dF.Provider,{value:T},re.createElement(aF.Provider,{value:T.control},t))};var kQ=()=>{let t=[];return{get observers(){return t},next:r=>{for(const i of t)i.next&&i.next(r)},subscribe:r=>(t.push(r),{unsubscribe:()=>{t=t.filter(i=>i!==r)}}),unsubscribe:()=>{t=[]}}};function v0e(t,e){const n={};for(const s in t)if(t.hasOwnProperty(s)){const r=t[s],i=e[s];if(r&&Ar(r)&&i){const a=v0e(r,i);Ar(a)&&(n[s]=a)}else t[s]&&(n[s]=i)}return n}const RQ=(t,e)=>t!==null&&rF(t)&&Object.prototype.hasOwnProperty.call(t,e);var Ntt=(t,e)=>{if(!e)return!1;let n=t;for(const s of $m(e)?[e]:r1(e)){if(!RQ(n,s))return RQ(t,e);n=n[s]}return!0},x0e=t=>t.type==="select-multiple",Itt=t=>uF(t)||zS(t),xI=t=>Wk(t)&&t.isConnected;function AQ(t){return Array.isArray(t)||Ar(t)}function y0e(t,e,n="",s=[]){for(const r in t){const i=n?`${n}.${r}`:r,a=t[r];AQ(a)&&AQ(ot(e,i))?y0e(a,e,i,s):s.push(i)}return s}var Ltt=t=>{for(const e in t)if(ta(t[e]))return!0;return!1};function b0e(t){return Array.isArray(t)||Ar(t)&&!Ltt(t)}function S0e(t){return!!(t&&"_f"in t)}function w0e(t){return Array.isArray(t)?!t.some(e=>!fs(e)):!Object.keys(t).length}function ED(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function CD(t,e={},n){for(const s in t){const r=t[s],i=n&&n[s];b0e(r)&&(!Array.isArray(r)||!S0e(i))?(e[s]=Array.isArray(r)?[]:{},CD(r,e[s],i),w0e(e[s])&&ED(e,s)):fs(r)||(e[s]=!0)}return e}function Dp(t,e,n,s){n||(n=CD(e,{},s));for(const r in t){const i=t[r],a=s&&s[r];b0e(i)&&(!Array.isArray(i)||!S0e(a))?(fs(e)||wD(n[r])?n[r]=CD(i,Array.isArray(i)?[]:{},a):Dp(i,xi(e)?{}:e[r],n[r],a),w0e(n[r])&&ED(n,r)):qa(i,e[r])?ED(n,r):n[r]=!0}return n}var jtt=(t,e)=>{const n=e.split("."),s=[];let r=n[0];for(let i=1;i<n.length;r+="."+n[i++])!isNaN(+n[i])&&t.has(r)&&s.push(`${r}.${n[i]}`);return s},_0e=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>fs(t)?t:e?t===""?NaN:t&&+t:n&&bi(t)?new Date(t):s?s(t):t;function NQ(t){const e=t.ref;return gR(e)?e.files:uF(e)?m0e(t.refs).value:x0e(e)?[...e.selectedOptions].map(({value:n})=>n):zS(e)?p0e(t.refs).value:_0e(e.value,t)}var Ptt=(t,e,n,s)=>{const r={};for(const i of t){const a=ot(e,i);a&&us(r,i,a._f)}return{criteriaMode:n,names:[...t],fields:r,shouldUseNativeValidation:s}},dy=t=>
315fs(t)?t:qk(t)?t.source:Ar(t)?qk(t.value)?t.value.source:t.value:t;const IQ="AsyncFunction";var Mtt=t=>{if(!t||!t.validate)return!1;if(ta(t.validate))return t.validate.constructor.name===IQ;if(Ar(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===IQ)return!0}return!1},Dtt=t=>t.mount&&(t.required||!fs(t.required)&&t.required!==!1||!fs(t.min)||!fs(t.max)||!fs(t.maxLength)||!fs(t.minLength)||t.pattern||t.validate);function LQ(t,e,n){const s=ot(t,n);if(s||$m(n))return{error:s,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),a=ot(e,i),o=ot(t,i);if(a&&!Array.isArray(a)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:n}}var Ott=(t,e,n,s)=>{n(t);const r=Object.keys(t).filter(i=>i!=="name");return!r.length||s&&r.length>=Object.keys(e).length||r.find(i=>e[i]===(!s||Yl.all))},$tt=(t,e,n)=>!t||!e||t===e||iT(t).some(s=>s&&(n?s===e||s.startsWith(e+"."):s.startsWith(e)||e.startsWith(s))),Ftt=(t,e,n,s,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(e||t):(n?s.isOnBlur:r.isOnBlur)?!t:(n?s.isOnChange:r.isOnChange)?t:!0,Utt=(t,e)=>{const n=ot(t,e);!g0e(n).length&&!(n!=null&&n.root)&&Fr(t,e)};const Btt={mode:Yl.onSubmit,reValidateMode:Yl.onChange,shouldFocusError:!0},yI="form",ztt=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},E0e={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Vtt(t={}){let e={...Btt,...t},n={...or(E0e),isLoading:ta(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},s={},r=Ar(e.defaultValues)||Ar(e.values)?or(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:or(r),a={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const l={},u={};let d=0,f=mE(e.mode),p=mE(e.reValidateMode);const m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...m};let x={...v};const y={array:kQ(),state:kQ()};let S=0;const _=e.criteriaMode===Yl.all,E=(Z,ie)=>le=>{clearTimeout(u[Z]),u[Z]=setTimeout(ie,le)},T=async Z=>{if(!a.keepIsValid&&!e.disabled&&(v.isValid||x.isValid||Z)){const ie=++S;let le;e.resolver?(le=ji((await G()).errors),ie===S&&k()):le=await B({fields:s,onlyCheckValid:!0,eventType:Bf.VALID}),ie===S&&le!==n.isValid&&y.state.next({isValid:le})}},k=(Z,ie)=>{!e.disabled&&(v.isValidating||v.validatingFields||x.isValidating||x.validatingFields)&&((Z||o.mount).forEach(le=>{le&&(ie?us(n.validatingFields,le,ie):Fr(n.validatingFields,le))}),y.state.next({validatingFields:n.validatingFields,isValidating:!ji(n.validatingFields)}))},R=()=>{n.dirtyFields=Dp(r,i,void 0,s)},I=(Z,ie=[],le,Ee,ke=!0,Ae=!0)=>{if(Ee&&le&&!e.disabled){a.action=!0;const Ye=ot(s,Z);if(a.actionArrayLengths.has(Z)||a.actionArrayLengths.set(Z,Array.isArray(Ye)?Ye.length:0),Ae&&Array.isArray(Ye)){const Me=le(Ye,Ee.argA,Ee.argB);ke&&us(s,Z,Me)}const Qe=ot(n.errors,Z);if(Ae&&Array.isArray(Qe)){const Me=Qe.root,Ut=le(Qe,Ee.argA,Ee.argB)||Qe;Me&&(Ut.root=Me),ke&&us(n.errors,Z,Ut),Utt(n.errors,Z)}const ft=ot(n.touchedFields,Z);if((v.touchedFields||x.touchedFields)&&Ae&&Array.isArray(ft)){const Me=le(ft,Ee.argA,Ee.argB);ke&&us(n.touchedFields,Z,Me)}(v.dirtyFields||x.dirtyFields)&&R(),y.state.next({name:Z,isDirty:z(Z,ie),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else us(i,Z,ie)},A=(Z,ie)=>{us(n.errors,Z,ie),n.errors={...n.errors},y.state.next({errors:n.errors})},L=Z=>{n.errors=Z,y.state.next({errors:n.errors,isValid:!1})},j=Z=>{const ie=$m(Z)?[Z]:r1(Z);let le=i,Ee=r;for(let ke=0;ke<ie.length-1;ke++){const Ae=ie[ke];if(le=xi(le)?le:le[Ae],Ee=xi(Ee)?Ee:Ee[Ae],le===null&&Ee!==null)return!0}return!1},F=Z=>{if(!a.actionArrayLengths.size)return!1;const ie=$m(Z)?[Z]:r1(Z);let le=i,Ee="",ke=-1,Ae=0;for(let Ye=0;Ye<ie.length;Ye++){if(xi(le))return!1;const Qe=ie[Ye];if(Ee=Ee?`${Ee}.${Qe}`:Qe,Array.isArray(le)&&+Qe>=le.length)return ke===-1?!1:Ye===ke?+Qe<Ae:!0;a.actionArrayLengths.has(Ee)&&(ke=Ye+1,Ae=a.actionArrayLengths.get(Ee)),le=le[Qe]}return!1},O=(Z,ie,le,Ee)=>{const ke=ot(s,Z);if(ke){if(j(Z)||F(Z))return;const Ae=fs(ot(i,Z)),Ye=ot(i,Z,fs(le)?ot(r,Z):le);fs(Ye)||Ee&&Ee.defaultChecked||ie?us(i,Z,ie?Ye:NQ(ke._f)):Y(Z,Ye),a.mount&&!a.action&&(T(),Ae&&n.isDirty&&(v.isDirty||x.isDirty)&&
vendor: 4,115 bytes, line 315
315(z()||(n.isDirty=!1,y.state.next({...n}))),t.shouldUnregister&&Ae&&!fs(ot(i,Z))&&vI(Z,o)&&(a.watch=!0))}},M=(Z,ie,le,Ee,ke)=>{let Ae=!1,Ye=!1;const Qe={name:Z};if(!e.disabled||Ee===!0){if(!le||Ee){const ft=qa(ot(r,Z),ie);(v.isDirty||x.isDirty)&&(Ye=n.isDirty,n.isDirty=Qe.isDirty=!ft||z(),Ae=Ye!==Qe.isDirty),Ye=!!ot(n.dirtyFields,Z),ft!==n.isDirty?ztt(n.dirtyFields,Dp(r,i,void 0,s)):ft?Fr(n.dirtyFields,Z):us(n.dirtyFields,Z,!0),Qe.dirtyFields=n.dirtyFields,Ae=Ae||(v.dirtyFields||x.dirtyFields)&&Ye!==!ft}if(le){const ft=ot(n.touchedFields,Z);ft||(us(n.touchedFields,Z,le),Qe.touchedFields=n.touchedFields,Ae=Ae||(v.touchedFields||x.touchedFields)&&ft!==le)}Ae&&ke&&y.state.next(Qe)}return Ae?Qe:{}},U=(Z,ie,le,Ee)=>{const ke=ot(n.errors,Z),Ae=(v.isValid||x.isValid)&&_o(ie)&&n.isValid!==ie;if(e.delayError&&le?(l[Z]=E(Z,()=>A(Z,le)),l[Z](e.delayError)):(clearTimeout(u[Z]),delete l[Z],le?us(n.errors,Z,le):Fr(n.errors,Z),n.errors={...n.errors}),(le?!qa(ke,le):ke)||!ji(Ee)||Ae){const Ye={...Ee,...Ae&&_o(ie)?{isValid:ie}:{},errors:n.errors,name:Z};y.state.next(Ye)}},G=async Z=>(k(Z,!0),await e.resolver(i,e.context,Ptt(Z||o.mount,s,e.criteriaMode,e.shouldUseNativeValidation))),$=async Z=>{const{errors:ie}=await G(Z);if(k(Z),Z){for(const le of Z){const Ee=ot(ie,le);Ee?o.array.has(le)&&Ar(Ee)&&!Object.keys(Ee).some(ke=>!Number.isNaN(Number(ke)))?SQ(n.errors,{[le]:Ee},le):us(n.errors,le,Ee):Fr(n.errors,le)}n.errors={...n.errors}}else n.errors=ie;return ie},V=async({name:Z,eventType:ie})=>{if(t.validate){const le=await t.validate({formValues:i,formState:n,name:Z,eventType:ie});if(Ar(le))for(const Ee in le){const ke=le[Ee];ke&&Xe(`${yI}.${Ee}`,{message:bi(ke.message)?ke.message:"",type:ke.type||Ol.validate})}else bi(le)||!le?Xe(yI,{message:le||"",type:Ol.validate}):Ce(yI);return le}return!0},B=async({fields:Z,onlyCheckValid:ie,name:le,eventType:Ee,context:ke={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(ke.runRootValidation=!0,!await V({name:le,eventType:Ee})&&(ke.valid=!1,ie)))return ke.valid;for(const Ae in Z){const Ye=Z[Ae];if(Ye){const{_f:Qe,...ft}=Ye;if(Qe){const Me=o.array.has(Qe.name),Ut=Ye._f&&Mtt(Ye._f),Nn=v.validatingFields||v.isValidating||x.validatingFields||x.isValidating;Ut&&Nn&&k([Qe.name],!0);const Cs=await TQ(Ye,o.disabled,i,_,e.shouldUseNativeValidation&&!ie,Me);if(Ut&&Nn&&k([Qe.name]),Cs[Qe.name]&&(ke.valid=!1,ie)||(!ie&&(ot(Cs,Qe.name)?Me?SQ(n.errors,Cs,Qe.name):us(n.errors,Qe.name,Cs[Qe.name]):Fr(n.errors,Qe.name)),t.shouldUseNativeValidation&&Cs[Qe.name]))break}!ji(ft)&&await B({context:ke,onlyCheckValid:ie,fields:ft,name:Ae,eventType:Ee})}}return ke.valid},q=()=>{for(const Z of o.unMount){const ie=ot(s,Z);ie&&(ie._f.refs?ie._f.refs.every(le=>!xI(le)):!xI(ie._f.ref))&&Je(Z)}o.unMount=new Set},z=(Z,ie)=>(Z&&ie&&us(i,Z,ie),!qa(a.mount?i:r,r)),D=(Z,ie,le)=>_D(Z,o,{...a.mount?i:fs(ie)||bi(Z)?r:ie},le,ie),K=Z=>g0e(ot(a.mount?i:r,Z,e.shouldUnregister?ot(r,Z,[]):[])),Y=(Z,ie,le={},Ee=!1,ke=!1,Ae=!1)=>{const Ye=ot(s,Z);let Qe=ie;if(Ye){const ft=Ye._f;ft&&(!ft.disabled&&us(i,Z,_0e(ie,ft)),Qe=Wk(ft.ref)&&xi(ie)?"":ie,x0e(ft.ref)?[...ft.ref.options].forEach(Me=>Me.selected=Qe.includes(Me.value)):ft.refs?zS(ft.ref)?ft.refs.forEach(Me=>{(!Me.defaultChecked||!Me.disabled)&&(Array.isArray(Qe)?Me.checked=!!Qe.find(Ut=>Ut===Me.value):Me.checked=Qe===Me.value||!!Qe)}):ft.refs.forEach(Me=>Me.checked=Me.value===Qe):gR(ft.ref)?ft.ref.value="":(ft.ref.value=Qe,!ft.ref.type&&!ke&&!Ae&&y.state.next({name:Z,values:Ee?i:or(i)})))}(le.shouldDirty||le.shouldTouch)&&M(Z,Qe,le.shouldTouch,le.shouldDirty,!ke),le.shouldValidate&&ye(Z,{delayError:le.delayError})},J=(Z,ie,le,Ee=!1,ke=!1,Ae=!1)=>{o.array.has(Z)&&y.array.next({name:Z,values:Ee?i:or(i)});for(const Ye in ie){if(!ie.hasOwnProperty(Ye))return;const Qe=ie[Ye],ft=Z+"."+Ye,Me=ot(s,ft);(o.array.has(Z)||Ar(Qe)||Me&&!Me._f)&&!lh(Qe)?J(ft,Qe,le,Ee,ke,Ae):Y(ft,Qe,le,Ee,ke,Ae)}},ne=(Z,ie,le,Ee,ke=!1)=>{const Ae=ot(s,Z),Ye=o.array.has(Z),Qe=Ee?ie:or(ie),ft=ot(i,Z),Me=qa(ft,Qe);if(Me||us(i,Z,Qe),Ye)y.array.next({name:Z,values:Ee?i:or(i)}),(v.isDirty||v.dirtyFields||x.isDirty||x.dirtyFields)&&le.shouldDirty&&(R(),
315ke||y.state.next({name:Z,dirtyFields:n.dirtyFields,isDirty:z(Z,Qe)}));else{const Ut=Array.isArray(Qe)&&!Qe.length||ji(Qe),Nn=!Me&&!ke;!Ae||Ae._f||xi(Qe)||Ut?Y(Z,Qe,le,Ee,ke,Nn):J(Z,Qe,le,Ee,ke,Nn)}if(!Me&&!ke){const Ut=vI(Z,o),Nn=Ee?i:or(i);if(y.state.next({...Ut&&n,name:a.mount||Ut?Z:void 0,values:Nn}),!Ye)for(const Cs of jtt(o.array,Z))y.state.next({name:Cs,values:Nn})}},Q=(Z,ie,le={})=>ne(Z,ie,le,!1),ee=(Z,ie={})=>{const le=ta(Z)?Z(i):Z;if(!qa(i,le)){i={...i,...le};for(const Ee of o.mount)Ntt(le,Ee)&&ne(Ee,ot(le,Ee),ie,!0,!0);y.state.next({...n,name:void 0,type:void 0,...d?{values:i}:{}}),ie.shouldValidate&&T()}},te=async Z=>{a.mount=!0;const ie=Z.target;let le=ie.name,Ee=!0;const ke=ot(s,le),Ae=Ye=>{Ee=Number.isNaN(Ye)||lh(Ye)&&isNaN(Ye.getTime())||qa(Ye,ot(i,le,Ye))};if(ke){let Ye,Qe;const ft=ie.type?NQ(ke._f):SD(Z),Me=Z.type===Bf.BLUR||Z.type===Bf.FOCUS_OUT,Ut=!Dtt(ke._f)&&!t.validate&&!e.resolver&&!ot(n.errors,le)&&!ke._f.deps,Nn=Ut||Ftt(Me,ot(n.touchedFields,le),n.isSubmitted,p,f),Cs=vI(le,o,Me);if(us(i,le,ft),Me){if(!ie||!ie.readOnly){ke._f.onBlur&&ke._f.onBlur(Z);const Ti=l[le];Ti&&Ti(0)}}else ke._f.onChange&&ke._f.onChange(Z);const $o=M(le,ft,Me),gu=!ji($o)||Cs;if(!Me&&y.state.next({name:le,type:Z.type,...d?{values:or(i)}:{}}),Nn)return(!Ut||!n.isValid)&&(v.isValid||x.isValid)&&(e.mode==="onBlur"?Me&&T():Me||T()),gu&&y.state.next({name:le,...Cs?{}:$o});if(!e.resolver&&t.validate&&await V({name:le,eventType:Z.type}),!Me&&Cs&&y.state.next({...n}),e.resolver){const{errors:Ti}=await G([le]);if(k([le]),Ae(ft),!Ee){!ji($o)&&y.state.next($o);return}const Pa=LQ(n.errors,s,le),bl=LQ(Ti,s,Pa.name||le);Ye=bl.error,le=bl.name,Qe=ji(Ti)}else k([le],!0),Ye=(await TQ(ke,o.disabled,i,_,e.shouldUseNativeValidation))[le],k([le]),Ae(ft),Ee&&(Ye?Qe=!1:(v.isValid||x.isValid)&&(Qe=await B({fields:s,onlyCheckValid:!0,name:le,eventType:Z.type})));Ee&&(ke._f.deps&&(!Array.isArray(ke._f.deps)||ke._f.deps.length>0)&&ye(ke._f.deps),U(le,Qe,Ye,$o))}},ue=(Z,ie)=>{if(ot(n.errors,ie)&&Z.focus)return Z.focus(),1},ye=async(Z,ie={})=>{let le,Ee;const ke=iT(Z);if(e.resolver){const Ae=await $(fs(Z)?Z:ke);le=ji(Ae),Ee=Z?!ke.some(Ye=>ot(Ae,Ye)):le}else Z?(Ee=(await Promise.all(ke.map(async Ae=>{const Ye=ot(s,Ae);return await B({fields:Ye&&Ye._f?{[Ae]:Ye}:Ye,eventType:Bf.TRIGGER})}))).every(Boolean),!(!Ee&&!n.isValid)&&T()):Ee=le=await B({fields:s,name:Z,eventType:Bf.TRIGGER});if(ie.delayError&&e.delayError&&bi(Z)){const Ae=ot(n.errors,Z);Ae?(Fr(n.errors,Z),l[Z]=E(Z,()=>A(Z,Ae)),l[Z](e.delayError)):(clearTimeout(u[Z]),delete l[Z])}return y.state.next({...!bi(Z)||(v.isValid||x.isValid)&&le!==n.isValid?{}:{name:Z},...e.resolver||!Z?{isValid:le}:{},errors:n.errors}),ie.shouldFocus&&!Ee&&yb(s,ue,Z?ke:o.mount),Ee},je=(Z,ie)=>{let le={...a.mount?i:r};return ie&&(le=v0e(ie.dirtyFields?n.dirtyFields:n.touchedFields,le)),fs(Z)?le:bi(Z)?ot(le,Z):Z.map(Ee=>ot(le,Ee))},Re=Z=>fs(Z)?{...n.errors}:bi(Z)?ot(n.errors,Z):Z.map(ie=>ot(n.errors,ie)),me=(Z,ie)=>{const le=ie||n,Ee=ot(le.errors,Z);return{invalid:!!Ee,isDirty:!!ot(le.dirtyFields,Z),error:Ee,isValidating:!!ot(n.validatingFields,Z),isTouched:!!ot(le.touchedFields,Z)}},Ce=Z=>{const ie=Z?iT(Z):void 0;ie==null||ie.forEach(le=>Fr(n.errors,le)),ie?ie.forEach(le=>{y.state.next({name:le,errors:n.errors})}):(n.errors={},y.state.next({errors:n.errors}))},Xe=(Z,ie,le)=>{const Ee=(ot(s,Z,{_f:{}})._f||{}).ref,ke=ot(n.errors,Z)||{},{ref:Ae,message:Ye,type:Qe,...ft}=ke;us(n.errors,Z,{...ft,...ie,ref:Ee}),y.state.next({name:Z,errors:n.errors,isValid:!1}),le&&le.shouldFocus&&Ee&&Ee.focus&&Ee.focus()},he=(Z,ie)=>{if(ta(Z)){d++;const{unsubscribe:le}=y.state.subscribe({next:ke=>"values"in ke&&Z(ke.values||D(void 0,ie),ke)});let Ee=!1;return{unsubscribe:()=>{Ee||(Ee=!0,d--,le())}}}return D(Z,ie,!0)},De=Z=>{var ie;const le=!!(!((ie=Z.formState)===null||ie===void 0)&&ie.values);le&&d++;const{unsubscribe:Ee}=y.state.subscribe({next:Ae=>{if($tt(Z.name,Ae.name,Z.exact)&&Ott(Ae,Z.formState||v,nn,Z.reRenderRoot)){const Ye={...i};Z.callback({values:Ye,...n,...Ae,defaultValues:r})}}});if(!le)return Ee;let ke=!1;return()=>{ke||(ke=!0,d--,Ee())}},Ge=Z=>(a.mount=!0,x={...x,...Z.formState},De({...Z,formState:{...m,...Z.formState}})),Je=(Z,ie={})=>{for(const le of Z?iT(Z):o.mount)o.mount.delete(le),o.array.delete(le),ie.keepValue||(Fr(s,le),Fr(i,le)),!ie.keepError&&Fr
vendor: 4,698 bytes, line 315
315(n.errors,le),!ie.keepDirty&&Fr(n.dirtyFields,le),!ie.keepTouched&&Fr(n.touchedFields,le),!ie.keepIsValidating&&Fr(n.validatingFields,le),!e.shouldUnregister&&!ie.keepDefaultValue&&Fr(r,le);d&&y.state.next({values:or(i)}),y.state.next({...n,...ie.keepDirty?{}:{isDirty:z()}}),!ie.keepIsValid&&T()},Le=({disabled:Z,name:ie})=>{if(_o(Z)&&a.mount||Z||o.disabled.has(ie)){const ke=o.disabled.has(ie)!==!!Z;Z?o.disabled.add(ie):o.disabled.delete(ie),ke&&a.mount&&!a.action&&T()}},qe=(Z,ie={})=>{let le=ot(s,Z);const Ee=_o(ie.disabled)||_o(e.disabled),ke=!o.registerName.has(Z)&&le&&le._f&&!le._f.mount;return us(s,Z,{...le||{},_f:{...le&&le._f?le._f:{ref:{name:Z}},name:Z,mount:!0,...ie}}),o.mount.add(Z),le&&!ke?Le({disabled:_o(ie.disabled)?ie.disabled:e.disabled,name:Z}):O(Z,!0,ie.value),{...Ee?{disabled:ie.disabled||e.disabled}:{},...e.progressive?{required:!!ie.required,min:dy(ie.min),max:dy(ie.max),minLength:dy(ie.minLength),maxLength:dy(ie.maxLength),pattern:dy(ie.pattern)}:{},name:Z,onChange:te,onBlur:te,ref:Ae=>{if(Ae){o.registerName.add(Z),qe(Z,ie),o.registerName.delete(Z),le=ot(s,Z);const Ye=fs(Ae.value)&&Ae.querySelectorAll&&Ae.querySelectorAll("input,select,textarea")[0]||Ae,Qe=Itt(Ye),ft=le._f.refs||[];if(Qe?ft.find(Ut=>Ut===Ye):Ye===le._f.ref)return;const Me={...le._f};Qe?(Me.refs=[...ft.filter(xI),Ye,...Array.isArray(ot(r,Z))?[{}]:[]],Me.ref={type:Ye.type,name:Z}):(Me.ref=Ye,delete Me.refs),us(s,Z,{_f:Me}),O(Z,!1,void 0,Ye)}else le=ot(s,Z,{}),le._f&&(le._f.mount=!1),(e.shouldUnregister||ie.shouldUnregister)&&!(u0e(o.array,Z)&&a.action)&&o.unMount.add(Z)}}},et=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&yb(s,ue,o.mount),Ct=Z=>{_o(Z)&&(y.state.next({disabled:Z}),yb(s,(ie,le)=>{const Ee=ot(s,le);Ee&&(ie.disabled=Ee._f.disabled||Z,Array.isArray(Ee._f.refs)&&Ee._f.refs.forEach(ke=>{ke.disabled=Ee._f.disabled||Z}))},0,!1))},Ke=(Z,ie)=>async le=>{let Ee,ke;le&&(le.preventDefault&&le.preventDefault(),le.persist&&le.persist());let Ae=or(i);if(y.state.next({isSubmitting:!0}),e.resolver){const{errors:Ye,values:Qe}=await G();k(),n.errors=Ye,Ae=or(Qe)}else await B({fields:s,eventType:Bf.SUBMIT});if(o.disabled.size)for(const Ye of o.disabled)Fr(Ae,Ye);if(Fr(n.errors,d0e),ji(n.errors)){y.state.next({errors:{}});try{Ee=await Z(Ae,le)}catch(Ye){ke=Ye}}else ie&&await ie({...n.errors},le),et(),setTimeout(et);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ji(n.errors)&&!ke,submitCount:n.submitCount+1,errors:n.errors}),ke)throw ke;return Ee},dt=(Z,ie={})=>{ot(s,Z)&&(fs(ie.defaultValue)?Q(Z,or(ot(r,Z))):(Q(Z,ie.defaultValue),us(r,Z,or(ie.defaultValue))),ie.keepTouched||Fr(n.touchedFields,Z),ie.keepDirty||(Fr(n.dirtyFields,Z),n.isDirty=ie.defaultValue?z(Z,or(ot(r,Z))):z()),ie.keepError||(Fr(n.errors,Z),v.isValid&&T()),y.state.next({...n}))},Xt=(Z,ie={})=>{const le=Z?or(Z):r,Ee=or(le),ke=ji(Z),Ae=Ee,Ye=s;if(ie.keepDefaultValues||(r=le),!ie.keepValues){if(ie.keepDirtyValues){const Qe=new Set([...o.mount,...y0e(Dp(r,i,void 0,Ye),n.dirtyFields)]);for(const ft of Qe){const Me=ot(n.dirtyFields,ft),Ut=ot(i,ft),Nn=ot(Ae,ft);Me&&!fs(Ut)?us(Ae,ft,Ut):!Me&&!fs(Nn)&&Q(ft,Nn)}}else{if(vR&&fs(Z))for(const Qe of o.mount){const ft=ot(s,Qe);if(ft&&ft._f){const Me=Array.isArray(ft._f.refs)?ft._f.refs[0]:ft._f.ref;if(Wk(Me)){const Ut=Me.closest("form");if(Ut){Ut.reset();break}}}}if(ie.keepFieldsRef)for(const Qe of o.mount)Q(Qe,ot(Ae,Qe));else s={}}if(e.shouldUnregister){if(i=ie.keepDefaultValues?or(r):{},ie.keepFieldsRef)for(const Qe of o.mount)us(i,Qe,ot(Ae,Qe))}else i=or(Ae);y.array.next({values:{...Ae}}),y.state.next({name:void 0,type:void 0,values:{...Ae}})}o={mount:ie.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!v.isValid||!!ie.keepIsValid||!!ie.keepDirtyValues||!e.shouldUnregister&&!ji(Ae),a.watch=!!e.shouldUnregister,a.keepIsValid=!!ie.keepIsValid,a.action=!1,a.actionArrayLengths.clear(),ie.keepErrors||(n.errors={}),y.state.next({submitCount:ie.keepSubmitCount?n.submitCount:0,isDirty:ke?!1:ie.keepDirty?n.isDirty:ie.keepValues?z():!!(ie.keepDefaultValues&&!qa(Z,r)),isSubmitted:ie.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ke?{}:ie.keepDirtyValues?ie.keepDefaultValues&&i?Dp(r,i,void 0,Ye):n.dirtyFields:ie.keepDefaultValues&&Z?Dp(r,Z,void 0,Ye):ie.keepDirty?n.dirtyFields:{},touchedFields:ie.keepTouched?n.touchedFields:{},errors:ie.keepErrors?n.errors:{},isSubmitSuccessful:ie.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},_n=(Z,ie)=>Xt(ta(Z)?Z(i):Z,{...e.resetOptions,...ie}),Dt=(Z,ie={})=>{const le=ot(s,Z),Ee=le&&le._f;if(Ee){const ke=Ee.refs?Ee.refs[0]:Ee.ref;ke.focus&&setTimeout(()=>
315{ke.focus(),ie.shouldSelect&&ta(ke.select)&&ke.select()})}},nn=Z=>{const{name:ie,type:le,values:Ee,...ke}=Z;n={...n,...ke}};y.state.subscribe({next:nn});const Ie={control:{register:qe,unregister:Je,getFieldState:me,handleSubmit:Ke,setError:Xe,_subscribe:De,_runSchema:G,_updateIsValidating:k,_focusError:et,_getWatch:D,_getDirty:z,_setValid:T,_setFieldArray:I,_setDisabledField:Le,_setErrors:L,_getFieldArray:K,_reset:Xt,_resetDefaultValues:()=>ta(e.defaultValues)&&e.defaultValues().then(Z=>{_n(Z,e.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:q,_disableForm:Ct,_subjects:y,_proxyFormState:v,get _fields(){return s},get _formValues(){return i},get _state(){return a},set _state(Z){a=Z},get _defaultValues(){return r},get _names(){return o},set _names(Z){o=Z},get _formState(){return n},get _options(){return e},set _options(Z){e={...e,...Z},f=mE(e.mode),p=mE(e.reValidateMode)}},subscribe:Ge,trigger:ye,register:qe,handleSubmit:Ke,watch:he,setValue:Q,setValues:ee,getValues:je,getErrors:Re,reset:_n,resetField:dt,resetDefaultValues:(Z,ie={})=>{if(r=or(Z),!ie.keepDirty){const le=Dp(r,i,void 0,s);n.dirtyFields=le,n.isDirty=!ji(le)}ie.keepIsValid||T(),y.state.next({...n,defaultValues:r})},clearErrors:Ce,unregister:Je,setError:Xe,setFocus:Dt,getFieldState:me};return{...Ie,formControl:Ie}}function C0e(t={}){const e=re.useRef(void 0),n=re.useRef(void 0),s=re.useRef(t.formControl),[r,i]=re.useState(()=>({...or(E0e),isLoading:ta(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:ta(t.defaultValues)?void 0:t.defaultValues}));if(!e.current||t.formControl&&s.current!==t.formControl)if(s.current=t.formControl,t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!ta(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:u,...d}=Vtt(t);e.current={...d,formState:r}}const a=e.current.control;a._options=t;const{resyncIfNeeded:o,snapshot:l}=cF();return lF(()=>{const u=()=>({...a._formState,defaultValues:a._defaultValues});o(!0,u,i);const d=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState,defaultValues:a._defaultValues}),reRenderRoot:!0});return i(f=>({...f,isReady:!0})),a._formState.isReady=!0,()=>{d(),l(!0,u)}},[a,o,l]),re.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),re.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),re.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),re.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),re.useEffect(()=>{if(a._proxyFormState.isDirty){const u=a._getDirty();u!==r.isDirty&&a._subjects.state.next({isDirty:u})}},[a,r.isDirty]),re.useEffect(()=>{var u;t.values&&!qa(t.values,n.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((u=a._options.resetOptions)===null||u===void 0)&&u.keepIsValid||a._setValid(),n.current=t.values,i(d=>({...d}))):a._resetDefaultValues()},[a,t.values]),re.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=re.useMemo(()=>f0e(r,a),[a,r]),e.current}const jQ=(t,e,n)=>{if(t&&"reportValidity"in t){const s=ot(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},T0e=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?jQ(s.ref,n,t):s.refs&&s.refs.forEach(r=>jQ(r,n,t))}},Htt=(t,e)=>{e.shouldUseNativeValidation&&T0e(t,e);const n={};for(const s in t){const r=ot(e.fields,s),i=Object.assign(t[s]||{},{ref:r&&r.ref});if(Gtt(e.names||Object.keys(t),s)){const a=Object.assign({},ot(n,s));us(a,"root",i),us(n,s,a)}else us(n,s,i)}return n},Gtt=(t,e)=>t.some(n=>n.startsWith(e+"."));var Wtt=function(t,e){for(var n={};t.length;){var s=t[0],r=s.code,i=s.message,a=s.path.join(".");if(!n[a])if("unionErrors"in s){var o=s.unionErrors[0].errors[0];n[a]={message:o.message,type:o.code}}else n[a]={message:i,type:r};
vendor: 2,511 bytes, line 315
315if("unionErrors"in s&&s.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var l=n[a].types,u=l&&l[s.code];n[a]=h0e(a,e,n,r,u?[].concat(u,s.message):s.message)}t.shift()}return n},k0e=function(t,e,n){return n===void 0&&(n={}),function(s,r,i){try{return Promise.resolve((function(a,o){try{var l=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(u){return i.shouldUseNativeValidation&&T0e({},i),{errors:{},values:n.raw?s:u}})}catch(u){return o(u)}return l&&l.then?l.then(void 0,o):l})(0,function(a){if((function(o){return Array.isArray(o==null?void 0:o.errors)})(a))return{values:{},errors:Htt(Wtt(a.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}},Qn;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const i={};for(const a of r)i[a]=a;return i},t.getValidEnumValues=r=>{const i=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of i)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(const a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(Qn||(Qn={}));var PQ;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(PQ||(PQ={}));const Nt=Qn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zf=t=>{switch(typeof t){case"undefined":return Nt.undefined;case"string":return Nt.string;case"number":return Number.isNaN(t)?Nt.nan:Nt.number;case"boolean":return Nt.boolean;case"function":return Nt.function;case"bigint":return Nt.bigint;case"symbol":return Nt.symbol;case"object":return Array.isArray(t)?Nt.array:t===null?Nt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Nt.promise:typeof Map<"u"&&t instanceof Map?Nt.map:typeof Set<"u"&&t instanceof Set?Nt.set:typeof Date<"u"&&t instanceof Date?Nt.date:Nt.object;default:return Nt.unknown}}
vendor: 4,379 bytes, line 315
315,it=Qn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Id extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},s={_errors:[]},r=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)s._errors.push(n(a));else{let o=s,l=0;for(;l<a.path.length;){const u=a.path[l];l===a.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(a))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return r(this),s}static assert(e){if(!(e instanceof Id))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},s=[];for(const r of this.issues)if(r.path.length>0){const i=r.path[0];n[i]=n[i]||[],n[i].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Id.create=t=>new Id(t);const TD=(t,e)=>{let n;switch(t.code){case it.invalid_type:t.received===Nt.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case it.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Qn.jsonStringifyReplacer)}`;break;case it.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qn.joinValues(t.keys,", ")}`;break;case it.invalid_union:n="Invalid input";break;case it.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qn.joinValues(t.options)}`;break;case it.invalid_enum_value:n=`Invalid enum value. Expected ${Qn.joinValues(t.options)}, received '${t.received}'`;break;case it.invalid_arguments:n="Invalid function arguments";break;case it.invalid_return_type:n="Invalid function return type";break;case it.invalid_date:n="Invalid date";break;case it.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Qn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case it.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case it.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case it.custom:n="Invalid input";break;
vendor: 5,147 bytes, line 315
315case it.invalid_intersection_types:n="Intersection results could not be merged";break;case it.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case it.not_finite:n="Number must be finite";break;default:n=e.defaultError,Qn.assertNever(t)}return{message:n}};let qtt=TD;function Ktt(){return qtt}const Ytt=t=>{const{data:e,path:n,errorMaps:s,issueData:r}=t,i=[...n,...r.path||[]],a={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let o="";const l=s.filter(u=>!!u).slice().reverse();for(const u of l)o=u(a,{data:e,defaultError:o}).message;return{...r,path:i,message:o}};function mt(t,e){const n=Ktt(),s=Ytt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===TD?void 0:TD].filter(r=>!!r)});t.common.issues.push(s)}class ja{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const r of n){if(r.status==="aborted")return cn;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){const s=[];for(const r of n){const i=await r.key,a=await r.value;s.push({key:i,value:a})}return ja.mergeObjectSync(e,s)}static mergeObjectSync(e,n){const s={};for(const r of n){const{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return cn;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}}const cn=Object.freeze({status:"aborted"}),Fy=t=>({status:"dirty",value:t}),yl=t=>({status:"valid",value:t}),MQ=t=>t.status==="aborted",DQ=t=>t.status==="dirty",i1=t=>t.status==="valid",Kk=t=>typeof Promise<"u"&&t instanceof Promise;var Mt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Mt||(Mt={}));class cu{constructor(e,n,s,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const OQ=(t,e)=>{if(i1(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Id(t.common.issues);return this._error=n,this._error}}};function wn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:r}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{const{message:l}=t;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class $n{get description(){return this._def.description}_getType(e){return zf(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:zf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ja,ctx:{common:e.parent.common,data:e.data,parsedType:zf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Kk(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zf(e)},r=this._parseSync({data:e,path:s.path,parent:s});return OQ(s,r)}"~validate"(e){var s,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zf(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return i1(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(r=(s=i==null?void 0:i.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>i1(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const s=await this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error}async safeParseAsync(e,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zf(e)},r=this._parse({data:e,path:s.path,parent:s}),i=await(Kk(r)?r:Promise.resolve(r));return OQ(s,i)}refine(e,n){const s=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,i)=>{const a=e(r),o=()=>i.addIssue({code:it.custom,...s(r)});
vendor: 6,120 bytes, line 315
315return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,n){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(e){return new l1({schema:this,typeName:on.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return mh.create(this,this._def)}nullable(){return c1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xc.create(this)}promise(){return Jk.create(this,this._def)}or(e){return Zk.create([this,e],this._def)}and(e){return Xk.create(this,e,this._def)}transform(e){return new l1({...wn(this._def),schema:this,typeName:on.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ND({...wn(this._def),innerType:this,defaultValue:n,typeName:on.ZodDefault})}brand(){return new xnt({typeName:on.ZodBranded,type:this,...wn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ID({...wn(this._def),innerType:this,catchValue:n,typeName:on.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return fF.create(this,e)}readonly(){return LD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ztt=/^c[^\s-]{8,}$/i,Xtt=/^[0-9a-z]+$/,Qtt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jtt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ent=/^[a-z0-9_-]{21}$/i,tnt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,nnt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,snt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rnt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bI;const int=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ant=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ont=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lnt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cnt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,unt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R0e="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dnt=new RegExp(`^${R0e}$`);function A0e(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function fnt(t){return new RegExp(`^${A0e(t)}$`)}function hnt(t){let e=`${R0e}T${A0e(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function pnt(t,e){return!!((e==="v4"||!e)&&int.test(t)||(e==="v6"||!e)&&ont.test(t))}function mnt(t,e){if(!tnt.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function gnt(t,e){return!!((e==="v4"||!e)&&ant.test(t)||(e==="v6"||!e)&&lnt.test(t))}class md extends $n{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Nt.string){const i=this._getOrReturnCtx(e);
vendor: 17,372 bytes, line 315
315return mt(i,{code:it.invalid_type,expected:Nt.string,received:i.parsedType}),cn}const s=new ja;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),mt(r,{code:it.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),mt(r,{code:it.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?mt(r,{code:it.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&mt(r,{code:it.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")snt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"email",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")bI||(bI=new RegExp(rnt,"u")),bI.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"emoji",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")Jtt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"uuid",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ent.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"nanoid",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")Ztt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"cuid",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Xtt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"cuid2",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")Qtt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"ulid",code:it.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),mt(r,{validation:"url",code:it.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"regex",code:it.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?hnt(i).test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?dnt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?fnt(i).test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{code:it.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?nnt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"duration",code:it.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?pnt(e.data,i.version)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"ip",code:it.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?mnt(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"jwt",code:it.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?gnt(e.data,i.version)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"cidr",code:it.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?cnt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"base64",code:it.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?unt.test(e.data)||(r=this._getOrReturnCtx(e,r),mt(r,{validation:"base64url",code:it.invalid_string,message:i.message}),s.dirty()):Qn.assertNever(i);return{status:s.value,value:e.data}}_regex(e,n,s){return this.refinement(r=>e.test(r),{validation:n,code:it.invalid_string,...Mt.errToObj(s)})}_addCheck(e){return new md({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Mt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Mt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Mt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Mt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Mt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Mt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Mt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Mt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Mt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Mt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Mt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Mt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Mt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Mt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Mt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Mt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Mt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Mt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Mt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Mt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Mt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Mt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Mt.errToObj(n)})}nonempty(e){return this.min(1,Mt.errToObj(e))}trim(){return new md({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new md({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new md({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}md.create=t=>new md({checks:[],typeName:on.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...wn(t)});function vnt(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=n>s?n:s,i=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return i%a/10**r}class a1 extends $n{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Nt.number){const i=this._getOrReturnCtx(e);return mt(i,{code:it.invalid_type,expected:Nt.number,received:i.parsedType}),cn}let s;const r=new ja;for(const i of this._def.checks)i.kind==="int"?Qn.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),mt(s,{code:it.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?vnt(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),mt(s,{code:it.not_finite,message:i.message}),r.dirty()):Qn.assertNever(i);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Mt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Mt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Mt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Mt.toString(n))}setLimit(e,n,s,r){return new a1({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Mt.toString(r)}]})}_addCheck(e){return new a1({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Mt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Mt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Mt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Mt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Mt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Mt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Qn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(n)&&Number.isFinite(e)}}a1.create=t=>new a1({checks:[],typeName:on.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...wn(t)});class b2 extends $n{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Nt.bigint)return this._getInvalidInput(e);let s;const r=new ja;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),mt(s,{code:it.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):Qn.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return mt(n,{code:it.invalid_type,expected:Nt.bigint,received:n.parsedType}),cn}gte(e,n){return this.setLimit("min",e,!0,Mt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Mt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Mt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Mt.toString(n))}setLimit(e,n,s,r){return new b2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Mt.toString(r)}]})}_addCheck(e){return new b2({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Mt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}b2.create=t=>new b2({checks:[],typeName:on.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...wn(t)});class kD extends $n{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Nt.boolean){const s=this._getOrReturnCtx(e);return mt(s,{code:it.invalid_type,expected:Nt.boolean,received:s.parsedType}),cn}return yl(e.data)}}kD.create=t=>new kD({typeName:on.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...wn(t)});class Yk extends $n{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Nt.date){const i=this._getOrReturnCtx(e);return mt(i,{code:it.invalid_type,expected:Nt.date,received:i.parsedType}),cn}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return mt(i,{code:it.invalid_date}),cn}const s=new ja;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),mt(r,{code:it.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),mt(r,{code:it.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):Qn.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yk({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Mt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Mt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Yk.create=t=>new Yk({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:on.ZodDate,...wn(t)});class $Q extends $n{_parse(e){if(this._getType(e)!==Nt.symbol){const s=this._getOrReturnCtx(e);return mt(s,{code:it.invalid_type,expected:Nt.symbol,received:s.parsedType}),cn}return yl(e.data)}}$Q.create=t=>new $Q({typeName:on.ZodSymbol,...wn(t)});class FQ extends $n{_parse(e){if(this._getType(e)!==Nt.undefined){const s=this._getOrReturnCtx(e);return mt(s,{code:it.invalid_type,expected:Nt.undefined,received:s.parsedType}),cn}return yl(e.data)}}FQ.create=t=>new FQ({typeName:on.ZodUndefined,...wn(t)});class UQ extends $n{_parse(e){if(this._getType(e)!==Nt.null){const s=this._getOrReturnCtx(e);return mt(s,{code:it.invalid_type,expected:Nt.null,received:s.parsedType}),cn}return yl(e.data)}}UQ.create=t=>new UQ({typeName:on.ZodNull,...wn(t)});class RD extends $n{constructor(){super(...arguments),this._any=!0}_parse(e){return yl(e.data)}}RD.create=t=>new RD({typeName:on.ZodAny,...wn(t)});class BQ extends $n{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yl(e.data)}}BQ.create=t=>new BQ({typeName:on.ZodUnknown,...wn(t)});class Oh extends $n{_parse(e){const n=this._getOrReturnCtx(e);return mt(n,{code:it.invalid_type,expected:Nt.never,received:n.parsedType}),cn}}Oh.create=t=>new Oh({typeName:on.ZodNever,...wn(t)});class zQ extends $n{_parse(e){if(this._getType(e)!==Nt.undefined){const s=this._getOrReturnCtx(e);return mt(s,{code:it.invalid_type,expected:Nt.void,received:s.parsedType}),cn}return yl(e.data)}}zQ.create=t=>new zQ({typeName:on.ZodVoid,...wn(t)});class Xc extends $n{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),r=this._def;
vendor: 5,495 bytes, line 315
315if(n.parsedType!==Nt.array)return mt(n,{code:it.invalid_type,expected:Nt.array,received:n.parsedType}),cn;if(r.exactLength!==null){const a=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(a||o)&&(mt(n,{code:a?it.too_big:it.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(mt(n,{code:it.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(mt(n,{code:it.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((a,o)=>r.type._parseAsync(new cu(n,a,n.path,o)))).then(a=>ja.mergeArray(s,a));const i=[...n.data].map((a,o)=>r.type._parseSync(new cu(n,a,n.path,o)));return ja.mergeArray(s,i)}get element(){return this._def.type}min(e,n){return new Xc({...this._def,minLength:{value:e,message:Mt.toString(n)}})}max(e,n){return new Xc({...this._def,maxLength:{value:e,message:Mt.toString(n)}})}length(e,n){return new Xc({...this._def,exactLength:{value:e,message:Mt.toString(n)}})}nonempty(e){return this.min(1,e)}}Xc.create=(t,e)=>new Xc({type:t,minLength:null,maxLength:null,exactLength:null,typeName:on.ZodArray,...wn(e)});function v0(t){if(t instanceof Qr){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=mh.create(v0(s))}return new Qr({...t._def,shape:()=>e})}else return t instanceof Xc?new Xc({...t._def,type:v0(t.element)}):t instanceof mh?mh.create(v0(t.unwrap())):t instanceof c1?c1.create(v0(t.unwrap())):t instanceof Fm?Fm.create(t.items.map(e=>v0(e))):t}class Qr extends $n{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Qn.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Nt.object){const u=this._getOrReturnCtx(e);return mt(u,{code:it.invalid_type,expected:Nt.object,received:u.parsedType}),cn}const{status:s,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Oh&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||o.push(u);const l=[];for(const u of a){const d=i[u],f=r.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new cu(r,f,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Oh){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(u==="strict")o.length>0&&(mt(r,{code:it.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const f=r.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new cu(r,f,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>ja.mergeObjectSync(s,u)):ja.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return Mt.errToObj,new Qr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,s)=>{var i,a;const r=((a=(i=this._def).errorMap)==null?void 0:a.call(i,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Mt.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Qr({...this._def,unknownKeys:"strip"})}passthrough(){return new Qr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Qr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Qr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:on.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Qr({...this._def,catchall:e})}pick(e){const n={};for(const s of Qn.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Qr({...this._def,shape:()=>n})}omit(e){const n={};for(const s of Qn.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new Qr({...this._def,shape:()=>n})}deepPartial(){return v0(this)}partial(e){const n={};for(const s of Qn.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?n[s]=r:n[s]=r.optional()}return new Qr({...this._def,shape:()=>n})}required(e){const n={};for(const s of Qn.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof mh;)i=i._def.innerType;n[s]=i}return new Qr({...this._def,shape:()=>n})}keyof(){return N0e(Qn.objectKeys(this.shape))}}Qr.create=(t,e)=>new Qr({shape:()=>t,unknownKeys:"strip",catchall:Oh.create(),typeName:on.ZodObject,...wn(e)});Qr.strictCreate=(t,e)=>new Qr({shape:()=>t,unknownKeys:"strict",catchall:Oh.create(),typeName:on.ZodObject,...wn(e)});Qr.lazycreate=(t,e)=>new Qr({shape:t,unknownKeys:"strip",catchall:Oh.create(),typeName:on.ZodObject,...wn(e)});class Zk extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function r(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new Id(o.ctx.common.issues));
vendor: 4,098 bytes, line 315
315return mt(n,{code:it.invalid_union,unionErrors:a}),cn}if(n.common.async)return Promise.all(s.map(async i=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let i;const a=[];for(const l of s){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(l=>new Id(l));return mt(n,{code:it.invalid_union,unionErrors:o}),cn}}get options(){return this._def.options}}Zk.create=(t,e)=>new Zk({options:t,typeName:on.ZodUnion,...wn(e)});function AD(t,e){const n=zf(t),s=zf(e);if(t===e)return{valid:!0,data:t};if(n===Nt.object&&s===Nt.object){const r=Qn.objectKeys(e),i=Qn.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of i){const l=AD(t[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(n===Nt.array&&s===Nt.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],l=AD(a,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===Nt.date&&s===Nt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Xk extends $n{_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=(i,a)=>{if(MQ(i)||MQ(a))return cn;const o=AD(i.value,a.value);return o.valid?((DQ(i)||DQ(a))&&n.dirty(),{status:n.value,value:o.data}):(mt(s,{code:it.invalid_intersection_types}),cn)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Xk.create=(t,e,n)=>new Xk({left:t,right:e,typeName:on.ZodIntersection,...wn(n)});class Fm extends $n{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Nt.array)return mt(s,{code:it.invalid_type,expected:Nt.array,received:s.parsedType}),cn;if(s.data.length<this._def.items.length)return mt(s,{code:it.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),cn;!this._def.rest&&s.data.length>this._def.items.length&&(mt(s,{code:it.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...s.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new cu(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>ja.mergeArray(n,a)):ja.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Fm({...this._def,rest:e})}}Fm.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fm({items:t,typeName:on.ZodTuple,rest:null,...wn(e)})};class Qk extends $n{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Nt.object)return mt(s,{code:it.invalid_type,expected:Nt.object,received:s.parsedType}),cn;const r=[],i=this._def.keyType,a=this._def.valueType;for(const o in s.data)r.push({key:i._parse(new cu(s,o,s.path,o)),value:a._parse(new cu(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?ja.mergeObjectAsync(n,r):ja.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,s){return n instanceof $n?new Qk({keyType:e,valueType:n,typeName:on.ZodRecord,...wn(s)}):new Qk({keyType:md.create(),valueType:e,typeName:on.ZodRecord,...wn(n)})}}class VQ extends $n{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Nt.map)return mt(s,{code:it.invalid_type,expected:Nt.map,received:s.parsedType}),cn;const r=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([o,l],u)=>
vendor: 4,126 bytes, line 315
315({key:r._parse(new cu(s,o,s.path,[u,"key"])),value:i._parse(new cu(s,l,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return cn;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of a){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return cn;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}}}}VQ.create=(t,e,n)=>new VQ({valueType:e,keyType:t,typeName:on.ZodMap,...wn(n)});class S2 extends $n{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Nt.set)return mt(s,{code:it.invalid_type,expected:Nt.set,received:s.parsedType}),cn;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(mt(s,{code:it.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(mt(s,{code:it.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const i=this._def.valueType;function a(l){const u=new Set;for(const d of l){if(d.status==="aborted")return cn;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const o=[...s.data.values()].map((l,u)=>i._parse(new cu(s,l,s.path,u)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,n){return new S2({...this._def,minSize:{value:e,message:Mt.toString(n)}})}max(e,n){return new S2({...this._def,maxSize:{value:e,message:Mt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}S2.create=(t,e)=>new S2({valueType:t,minSize:null,maxSize:null,typeName:on.ZodSet,...wn(e)});class HQ extends $n{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}HQ.create=(t,e)=>new HQ({getter:t,typeName:on.ZodLazy,...wn(e)});class GQ extends $n{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return mt(n,{received:n.data,code:it.invalid_literal,expected:this._def.value}),cn}return{status:"valid",value:e.data}}get value(){return this._def.value}}GQ.create=(t,e)=>new GQ({value:t,typeName:on.ZodLiteral,...wn(e)});function N0e(t,e){return new o1({values:t,typeName:on.ZodEnum,...wn(e)})}class o1 extends $n{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return mt(n,{expected:Qn.joinValues(s),received:n.parsedType,code:it.invalid_type}),cn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return mt(n,{received:n.data,code:it.invalid_enum_value,options:s}),cn}return yl(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return o1.create(e,{...this._def,...n})}exclude(e,n=this._def){return o1.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}o1.create=N0e;class WQ extends $n{_parse(e){const n=Qn.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Nt.string&&s.parsedType!==Nt.number){const r=Qn.objectValues(n);return mt(s,{expected:Qn.joinValues(r),received:s.parsedType,code:it.invalid_type}),cn}if(this._cache||(this._cache=new Set(Qn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Qn.objectValues(n);return mt(s,{received:s.data,code:it.invalid_enum_value,options:r}),cn}return yl(e.data)}get enum(){return this._def.values}}WQ.create=(t,e)=>new WQ({values:t,typeName:on.ZodNativeEnum,...wn(e)});class Jk extends $n{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Nt.promise&&n.common.async===!1)return mt(n,{code:it.invali
vendor: 4,075 bytes, line 315
315d_type,expected:Nt.promise,received:n.parsedType}),cn;const s=n.parsedType===Nt.promise?n.data:Promise.resolve(n.data);return yl(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Jk.create=(t,e)=>new Jk({type:t,typeName:on.ZodPromise,...wn(e)});class l1 extends $n{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===on.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:a=>{mt(s,a),a.fatal?n.abort():n.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const a=r.transform(s.data,i);if(s.common.async)return Promise.resolve(a).then(async o=>{if(n.value==="aborted")return cn;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?cn:l.status==="dirty"||n.value==="dirty"?Fy(l.value):l});{if(n.value==="aborted")return cn;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?cn:o.status==="dirty"||n.value==="dirty"?Fy(o.value):o}}if(r.type==="refinement"){const a=o=>{const l=r.refinement(o,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?cn:(o.status==="dirty"&&n.dirty(),a(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?cn:(o.status==="dirty"&&n.dirty(),a(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!i1(a))return cn;const o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>i1(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:n.value,value:o})):cn);Qn.assertNever(r)}}l1.create=(t,e,n)=>new l1({schema:t,typeName:on.ZodEffects,effect:e,...wn(n)});l1.createWithPreprocess=(t,e,n)=>new l1({schema:e,effect:{type:"preprocess",transform:t},typeName:on.ZodEffects,...wn(n)});class mh extends $n{_parse(e){return this._getType(e)===Nt.undefined?yl(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}mh.create=(t,e)=>new mh({innerType:t,typeName:on.ZodOptional,...wn(e)});class c1 extends $n{_parse(e){return this._getType(e)===Nt.null?yl(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}c1.create=(t,e)=>new c1({innerType:t,typeName:on.ZodNullable,...wn(e)});class ND extends $n{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===Nt.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ND.create=(t,e)=>new ND({innerType:t,typeName:on.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...wn(e)});class ID extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Kk(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Id(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Id(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ID.create=(t,e)=>new ID({innerType:t,typeName:on.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...wn(e)});class qQ extends $n{_parse(e){if(this._getType(e)!==Nt.nan){const s=this._getOrReturnCtx(e);
315return mt(s,{code:it.invalid_type,expected:Nt.nan,received:s.parsedType}),cn}return{status:"valid",value:e.data}}}qQ.create=t=>new qQ({typeName:on.ZodNaN,...wn(t)});class xnt extends $n{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class fF extends $n{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?cn:i.status==="dirty"?(n.dirty(),Fy(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?cn:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,n){return new fF({in:e,out:n,typeName:on.ZodPipeline})}}class LD extends $n{_parse(e){const n=this._def.innerType._parse(e),s=r=>(i1(r)&&(r.value=Object.freeze(r.value)),r);return Kk(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}}LD.create=(t,e)=>new LD({innerType:t,typeName:on.ZodReadonly,...wn(e)});var on;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(on||(on={}));const D0=md.create,KQ=a1.create,fy=kD.create,YQ=RD.create;Oh.create;const ZQ=Xc.create,jD=Qr.create;Zk.create;Xk.create;Fm.create;const XQ=Qk.create;o1.create;Jk.create;mh.create;c1.create;const Um=lQe,hF=uQe,ynt=fQe,I0e=w.forwardRef(({className:t,...e},n)=>c.jsx(oge,{ref:n,className:He("fixed inset-0 z-50 bg-black/30 dark:bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));I0e.displayName=oge.displayName;const $h=w.forwardRef(({className:t,children:e,hideClose:n,...s},r)=>c.jsxs(ynt,{children:[c.jsx(I0e,{}),c.jsxs(lge,{ref:r,className:He("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s,children:[e,!n&&c.jsxs(bQe,{className:"absolute right-[20px] top-[20px] flex size-[28px] items-center justify-center rounded-full text-[var(--sand-10)] transition-colors duration-150 hover:bg-[var(--sand-3)] hover:text-[var(--sand-12)] focus:outline-none disabled:pointer-events-none",children:[c.jsx(ok,{className:"h-[18px] w-[18px]"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$h.displayName=lge.displayName;const Fh=({className:t,...e})=>c.jsx("div",{className:He("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Fh.displayName="DialogHeader";const X1=({className:t,...e})=>c.jsx("div",{className:He("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});X1.displayName="DialogFooter";const Ld=w.forwardRef(({className:t,...e},n)=>c.jsx(uge,{ref:n,className:He("text-lg font-semibold leading-none tracking-tight",t),...e}));Ld.displayName=uge.displayName;const jd=w.forwardRef(({className:t,...e},n)=>c.jsx(dge,{ref:n,className:He("text-sm text-muted-foreground",t),...e}));jd.displayName=dge.displayName;const L0e=Att,j0e=w.createContext({}),Oc=({...t})=>c.jsx(j0e.Provider,{value:{name:t.name},children:c.jsx(Ctt,{...t})}),xR=()=>{const t=w.useContext(j0e),e=w.useContext(P0e),{getFieldState:n,formState:s}
315=Rtt(),r=n(t.name,s);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=e;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...r}},P0e=w.createContext({}),Hl=w.forwardRef(({className:t,...e},n)=>{const s=w.useId();return c.jsx(P0e.Provider,{value:{id:s},children:c.jsx("div",{ref:n,className:He("space-y-2",t),...e})})});Hl.displayName="FormItem";const Gl=w.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:r}=xR();return c.jsx(ah,{ref:n,className:He(s&&"text-destructive",t),htmlFor:r,...e})});Gl.displayName="FormLabel";const Wl=w.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:r,formMessageId:i}=xR();return c.jsx(C4,{ref:e,id:s,"aria-describedby":n?`${r} ${i}`:`${r}`,"aria-invalid":!!n,...t})});Wl.displayName="FormControl";const O0=w.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=xR();return c.jsx("p",{ref:n,id:s,className:He("text-[0.8rem] text-muted-foreground",t),...e})});O0.displayName="FormDescription";const Tm=w.forwardRef(({className:t,children:e,...n},s)=>{const{error:r,formMessageId:i}=xR(),a=r?String(r==null?void 0:r.message):e;return a?c.jsx("p",{ref:s,id:i,className:He("text-[0.8rem] font-medium text-destructive",t),...n,children:a}):null});Tm.displayName="FormMessage";const M0e=t=>{const e=Math.floor(t/1e3),n=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60;return`${n}:${s.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},D0e=t=>{if(t<1e3)return`${t}ms`;const e=Math.floor(t/1e3),n=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60;return n>0?`${n}h ${s}m ${r}s`:s>0?`${s}m ${r}s`:`${r}s`},bnt=t=>Math.ceil(t/6e4),Snt=t=>{if(t===0)return"0 Bytes";const e=1024,n=["Bytes","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,s)).toFixed(2))+" "+n[s]},gxt=t=>{const e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/86400),s=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return n>0?s>0?`${n}d ${s}h`:`${n}d`:s>0?r>0?`${s}h ${r}m`:`${s}h`:r>0?`${r}m`:`${e}s`},QQ=[{value:"proxy",label:"Proxy"},{value:"captcha",label:"Captcha"},{value:"timeout",label:"Timeout"},{value:"navigation",label:"Navigation"},{value:"recording",label:"Recording"},{value:"live_viewer",label:"Live Viewer"},{value:"other",label:"Other"}],wnt=jD({category:D0().min(1,"Select a category"),description:D0().trim().min(10,"Description must be at least 10 characters").max(3e3,"Description must be under 3000 characters")});function _nt({sessionId:t,children:e,open:n,onOpenChange:s}){const[r,i]=w.useState(!1),a=n!==void 0,o=a?n:r,[l,u]=w.useState(!1),[d,f]=w.useState(!1),p=w.useRef(null),{getToken:m,userId:v}=zt(),{useSession:x,useOrgDetails:y}=fr(),{data:S}=x(t),{data:_}=y(),E=C0e({resolver:k0e(wnt),defaultValues:{category:"",description:""}});function T(I){var j;const L=[`**Category:** ${((j=QQ.find(F=>F.value===I.category))==null?void 0:j.label)??I.category}`,"","**Description:**",I.description,"","**Session Context**"];if(S){const F=S.stealthConfig;L.push(`• Session ID: \`${S.id}\``),L.push(`• Status: ${S.status}`),L.push(`• Duration: ${D0e(S.duration??0)}`),S.region&&L.push(`• Region: ${S.region}`),L.push(`• Proxy Source: ${S.proxySource??"N/A"}`),L.push(`• Captcha Solving: ${S.solveCaptcha?"enabled":"disabled"}`),L.push(`• Selenium Mode: ${S.isSelenium?"enabled":"disabled"}`),L.push(`• Headless: ${S.headless??!0?"yes":"no (headful)"}`),F&&(L.push(`• Stealth - Humanize Interactions: ${F.humanizeInteractions??!1}`),L.push(`• Stealth - Skip Fingerprint: ${F.skipFingerprintInjection??!1}`),L.push(`• Stealth - Auto Captcha Solving: ${F.autoCaptchaSolving??!1}`))}return _!=null&&_.plan&&L.push(`• Plan: ${_.plan}`),v&&L.push(`• Reported by (Clerk User ID): \`${v}\``),L.join(`
316`)}async function k(I){var A,L;u(!0);try{if(!await m())throw new Error("Not authenticated");const F=T(I),O=await Bme({body:{topic:"session_report",feedback:F}});if(!((A=O.data)!=null&&A.success))throw new Error(((L=O.data)==null?void 0:L.message)??"Failed to submit report");f(!0),E.reset()}catch(j){E.setError("root",{message:j instanceof Error?j.message:"Failed to submit. Please try again."})}finally{u(!1)}}function R(I){I?p.current!==null&&(clearTimeout(p.current),p.current=null):p.current=setTimeout(()=>{f(!1),E.reset()},300),a?s==null||s(I):i(I)}return c.jsxs(Um,{open:o,onOpenChange:R,children:[!a&&c.jsx(hF,{asChild:!0,children:e??c.jsx(Zt,{variant:"ghost",size:"sm",title:"Report an issue with this session","aria-label":"Report an issue with this session",className:"flex size-[40px] shrink-0 items-center justify-center rounded-full border-[0.5px] border-[var(--gray-6)] bg-[var(--gray-3)] p-0 text-[var(--red-9)] hover:bg-[var(--gray-4)] hover:text-[var(--red-9)]",children:c.jsx(Mde,{fill:"currentColor",className:"w-[16px] h-[16px]"})})}),c.jsx($h,{className:"max-w-md rounded-[20px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[32px] text-[var(--sand-12)] shadow-modal",children:d?c.jsxs("div",{className:"flex flex-col items-center gap-5 py-8 text-center",children:[c.jsx("div",{className:"flex items-center justify-center w-14 h-14 roun
316ded-full bg-[var(--green-a3)] border border-[var(--green-6)]",children:c.jsx("svg",{className:"w-7 h-7 text-[var(--green-11)] dark:text-[var(--green-10)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Ld,{className:"text-[20px] font-medium leading-[24px] text-[var(--sand-12)]",children:"Report submitted"}),c.jsx(jd,{className:"text-sm text-[var(--sand-11)] max-w-[280px] mx-auto",children:"Thanks for flagging this, our team will look into the session and follow up if needed."})]}),c.jsx(Zt,{onClick:()=>R(!1),size:"sm",className:"mt-1 bg-[var(--sand-3)] text-[var(--sand-12)] hover:bg-[var(--sand-4)] border-[0.5px] border-[var(--sand-6)]",children:"Done"})]}):c.jsx(L0e,{...E,children:c.jsxs("form",{onSubmit:E.handleSubmit(k),className:"space-y-4",children:[c.jsxs(Fh,{children:[c.jsx(Ld,{className:"text-[20px] font-medium leading-[24px] text-[var(--sand-12)]",children:"Report Session Issue"}),c.jsx(jd,{className:"text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Describe what went wrong. Session context is attached automatically."})]}),c.jsx(Oc,{control:E.control,name:"category",render:({field:I})=>c.jsxs(Hl,{children:[c.jsxs(Gl,{className:"text-[var(--sand-12)]",children:["Issue Category ",c.jsx("span",{className:"text-[var(--red-9)]",children:"*"})]}),c.jsxs(PS,{onValueChange:I.onChange,value:I.value,children:[c.jsx(Wl,{children:c.jsx(DS,{className:"h-[44px] w-full rounded-[8px] border-0 bg-[var(--sand-3)] px-[12px] text-[14px] font-medium text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-[var(--sand-4)]",children:c.jsx(MS,{placeholder:"Select a category"})})}),c.jsx(W1,{className:"rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[4px] text-[var(--sand-12)] shadow-menu",children:QQ.map(A=>c.jsx(hd,{value:A.value,className:"rounded-[6px] text-[14px] text-[var(--sand-11)] focus:bg-[var(--sand-4)] focus:text-[var(--sand-12)] data-[highlighted]:bg-[var(--sand-4)] data-[highlighted]:text-[var(--sand-12)]",children:A.label},A.value))})]}),c.jsx(Tm,{})]})}),c.jsx(Oc,{control:E.control,name:"description",render:({field:I})=>c.jsxs(Hl,{children:[c.jsxs(Gl,{className:"text-[var(--sand-12)]",children:["Description ",c.jsx("span",{className:"text-[var(--red-9)]",children:"*"})]}),c.jsx(Wl,{children:c.jsx(sR,{placeholder:"Describe what happened with more details.",className:"min-h-[100px] bg-[var(--sand-a2)] border-[var(--sand-6)] text-[var(--sand-12)] placeholder:text-[var(--sand-9)] resize-none",...I})}),c.jsx(Tm,{})]})}),E.formState.errors.root&&c.jsxs("p",{role:"alert",className:"flex items-center gap-2 text-xs text-[var(--red-11)] bg-[var(--red-a2)] border border-[var(--red-6)] rounded-md px-3 py-2 animate-[shake_0.35s_ease-in-out]",children:[c.jsx(j7,{className:"w-3.5 h-3.5 shrink-0"}),E.formState.errors.root.message]}),c.jsxs(X1,{className:"flex-row gap-2 sm:space-x-0",children:[c.jsx(Zt,{type:"button",variant:"outline",disabled:l,onClick:()=>R(!1),className:"flex-1 border-[var(--sand-6)] text-[var(--sand-12)] hover:bg-[var(--sand-3)]",children:"Cancel"}),c.jsx(Zt,{type:"submit",disabled:l,className:"flex-1 bg-[var(--red-10)] text-[var(--sand-12)] hover:bg-[var(--red-9)]",children:l?"Submitting…":"Submit Report"})]})]})})})]})}const O0e=w.createContext(null);function $0e({children:t}){const e=w.useRef(null),n=w.useRef(null),[s,r]=w.useState(null),[i,a]=w.useState([]),[o,l]=w.useState(null),[u,d]=w.useState(null),[f,p]=w.useState(null),[m,v]=w.useState(!1),x=w.useCallback(k=>{p(R=>({key:k,nonce:((R==null?void 0:R.nonce)??0)+1}))},[]),y=w.useCallback(k=>{var R;(R=e.current)==null||R.call(e,k)},[]),S=w.useCallback(k=>{e.current=k},[]),_=w.useCallback(async(k,R)=>{const I=n.current;return I?I(k,R):null},[]),E=w.useCallback(k=>{n.current=k,v(k!==null)},[]),T=w.useMemo(()=>({seek:y,registerSeek:S,recordingStartedAt:s,setRecordingStartedAt:r,fragmentMappings:i,setFragmentMappings:a,hoveredActivityKey:o,setHoveredActivityKey:l,playingActivityKey:u,setPlayingActivityKey:d,openActivityRequest:f,openActivity:x,getThumbnail:m?_:null,registerGetThumbnail:E}),[y,S,s,i,o,u,f,x,_,E,m]);return c.jsx(O0e,{value:T,children:t})}function VS(){return w.useContext(O0e)}function PD(t,e){const n=VS(),s=(n==null?void 0:n.getThumbnail)??null,[r,i]=w.useState(null);return w.useEffect(()=>{if(t===null||!s){i(null);return}let a=!1;return s(t,e).then(o=>{a||i(o)}),()=>{a=!0}},[t,e,s]),r}function Vf(t){return`${t.timestamp}_${t.type}`}function pF(t,e){if(!e.length)return null;const n=e[0];if(t<n.wallClockMs)return null;const s=e[e.length-1],r=s.wallClockMs+s.duration*1e3;if(t>=r)return s.videoStart+(t-s.wallClockMs)/1e3;let i=0,a=e.length-1;for(;i<=a;){const o=i+a>>1,l=e[o],u=l.wallClockMs+l.duration*1e3;if(t<l.wallClockMs)a=o-1;else if(t>=u)i=o+1;else return l.videoStart+(t-l.wallClockMs)/1e3}return null}const MD={click:"pointer",doubleClick:"pointer",submit:"pointer",drag:"pointer",keyPress:"keyboard",input:"keyboard",change:"keyboard",navigate:"navigation",scroll:"navigation",error:"navigation"},F0e={pointer:"var(--green-9)",keyboard:"var(--yellow-9)",navigation:"var(--blue-9)"},Ent={pointer:"text-[var(--green-11)] dark:text-[var(--green-9)]",keyboard:"text-[var(--yellow-11)] dark:text-[var(--yellow-9)]",navigation:"text-[var(--blue-11)] dark:text-[var(--blue-9)]"};Object.fromEntries(Object.entries(MD).map(([t,e])=>[t,F0e[e]]));const Cnt={mousePress:"click",mouseClick:"click",mouseWheel:"scroll",keyboardDown:"keyPress",keyboardUp:"keyPress",typed:"keyPress"};function U0e(t){return MD[t]??MD[Cnt[t]??""]}function JQ(t){const e=U0e(t);return e&&F0e[e]}function B0e(t){return Ent[U0e(t)??"navigation"]}const HS=jQe,GS=PQe,Q1=w.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},r)=>c.jsx(MQe,{children:c.jsx(mge,{ref:r,align:e,sideOffset:n,className:He("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
316de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Q1.displayName=mge.displayName;function u1(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 10L11.2929 13.2929C11.6834 13.6834 12.3166 13.6834 12.7071 13.2929L16 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function z0e(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 8L16 16M16 8L8 16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function bb(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M11 3V4.5M16.6569 5.34326L15.5962 6.40392M6.40381 15.5962L5.34315 16.6569M4.5 11H3M6.40381 6.40381L5.34315 5.34315M14.1365 20.8008L10.4008 11.0466C10.2461 10.6426 10.6426 10.2461 11.0466 10.4008L20.8008 14.1365C21.1883 14.2849 21.2368 14.8136 20.8827 15.03L17.353 17.1871C17.2853 17.2284 17.2284 17.2853 17.1871 17.353L15.03 20.8827C14.8136 21.2368 14.2849 21.1883 14.1365 20.8008Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function DD(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M3.68921 4.96392L9.08016 20.3265C9.38205 21.1868 10.5835 21.2274 10.9428 20.3895L13.6203 14.1453C13.7214 13.9094 13.9094 13.7214 14.1453 13.6203L20.3895 10.9428C21.2274 10.5835 21.1868 9.38205 20.3265 9.08016L4.96392 3.68921C4.17261 3.41153 3.41153 4.17261 3.68921 4.96392Z",stroke:"currentColor",strokeWidth:"2.05556",strokeLinejoin:"round"})})}function Tnt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M14.8287 15.1716C13.2666 13.6095 10.734 13.6095 9.17188 15.1716",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.75 9.5H14.76M15 9.5C15 9.63807 14.8881 9.75 14.75 9.75C14.6119 9.75 14.5 9.63807 14.5 9.5C14.5 9.36193 14.6119 9.25 14.75 9.25C14.8881 9.25 15 9.36193 15 9.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9.25 9.5H9.26M9.5 9.5C9.5 9.63807 9.38807 9.75 9.25 9.75C9.11193 9.75 9 9.63807 9 9.5C9 9.36193 9.11193 9.25 9.25 9.25C9.38807 9.25 9.5 9.36193 9.5 9.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function mF(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 4H6C4.89543 4 4 4.89543 4 6V8M16 4H18C19.1046 4 20 4.89543 20 6V8M20 16V18C20 19.1046 19.1046 20 18 20H16M8 20H6C4.89543 20 4 19.1046 4 18V16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function gF(t){return c.jsx(Nh,{...t})}function V0e(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M16 8V7C16 5.89543 16.8954 5 18 5C19.1046 5 20 5.89543 20 7V13.8292M20 13.8292V11M20 13.8292C20 17.7895 16.7895 21 12.8292 21C10.1669 21 7.72366 19.525 6.48368 17.169L3.5 11.5L4.25061 10.5617C4.94063 9.69921 6.19921 9.55937 7.06174 10.2494L8 11V6C8 4.89543 8.89543 4 10 4C11.1046 4 12 4.89543 12 6V10M12 8V5C12 3.89543 12.8954 3 14 3C15.1046 3 16 3.89543 16 5V11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function H0e(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M10 19L12 21L14 19M10 11H14M4 3H20C21.1046 3 22 3.89543 22 5V13C22 14.1046 21.1046 15 20 15H4C2.89543 15 2 14.1046 2 13V5C2 3.89543 2.89543 3 4 3Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.125 7C5.125 7.48325 5.51675 7.875 6 7.875C6.48325 7.875 6.875 7.48325 6.875 7C6.875 6.51675 6.48325 6.125 6 6.125C5.51675 6.125 5.125 6.51675 5.125 7ZM17.125 7C17.125 7.48325 17.5168 7.875 18 7.875C18.4832 7.875 18.875 7.48325 18.875 7C18.875 6.51675 18.4832 6.125 18 6.125C17.5168 6.125 17.125 6.51675 17.125 7ZM13.125 7C13.125 7.48325 13.5168 7.875 14 7.875C14.4832 7.875 14.875 7.48325 14.875 7C14.875 6.51675 14.4832 6.125 14 6.125C13.5168 6.125 13.125 6.51675 13.125 7ZM9.125 7C9.125 7.48325 9.51675 7.875 10 7.875C10.4832 7.875 10.875 7.48325 10.875 7C10.875 6.51675 10.4832 6.125 10 6.125C9.51675 6.125 9.125 6.51675 9.125 7ZM5.125 11C5.125 11.4832 5.51675 11.875 6 11.875C6.48325 11.875 6.875 11.4832 6.875 11C6.875 10.5168 6.48325 10.125 6 10.125C5.51675 10.125 5.125 10.5168 5.125 11ZM17.125 11C17.125 11.4832 17.5168 11.875 18 11.875C18.4832 11.875 18.875 11.4832 18.875 11C18.875 10.5168 18.4832 10.125 18 10.125C17.5168 10.125 17.125 10.5168 17.125 11Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.75",strokeLinecap:"square"})]})}function knt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M5.125 13C5.125 13.4832 5.51675 13.875 6 13.875C6.48325 13.875 6.875 13.4832 6.875 13C6.875 12.5168 6.48325 12.125 6 12.125C5.51675 12.125 5.125 12.5168 5.125 13ZM17.125 13C17.125 13.4832 17.5168 13.875 18 13.875C18.4832 13.875 18.875 13.4832 18.875 13C18.875 12.5168 18.4832 12.125 18 12.125C17.5168 12.125 17.125 12.5168 17.125 13ZM13.125 13C13.125 13.4832 13.5168 13.875 14 13.875C14.4832 13.875 14.875 13.4832 14.875 13C14.875 12.5168 14.4832 12.125 14 12.125C13.5168 12.125 13.125 12.5168 13.125 13ZM9.125 13C9.125 13.4832 9.51675 13.875 10 13.875C10.4832 13.875 10.875 13.4832 10.875 13C10.875 12.5168 10.4832 12.125 10 12.125C9.51675 12.125 9.125 12.5168 9.125 13ZM5.125 17C5.125 17.4832 5.51675 17.875 6 17.875C6.48325 17.875 6.875 17.4832 6.875 17C6.875 16.5168 6.48325 16.125 6 16.125C5.51675 16.125 5.125 16.5168 5.125 17ZM17.125 17C17.125 17.4832 17.5168 17.875 18 17.875C18.4832 17.875 18.875 17.4832 18.875 17C18.875 16.5168 18.4832 16.125 18 16.125C17.5168 16.125 17.125 16.5168 17.125 17Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.75",strokeLinecap:"square"}),c.jsx("path",{d:"M10 17H14M14 5L12 3L10 5M4 9H20C21.1046 9 22 9.89543 22 11V19C22 20.1046 21.1046 21 20 21H4C2.89543 21 2 20.1046 2 19V11C2 9.89543 2.89543 9 4 9Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function G0e(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M15 20L13.1094 21.2604C12.4376 21.7083 11.5624 21.7083 10.8906 21.2604L9 20M12 6V8M12 17C9.23858 17 7 14.7614 7 12V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7V12C17 14.7614 14.7614 17 12 17Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pd(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M15 9V4.25C15 3.55964 14.4404 3 13.75 3H4.25C3.55964 3 3 3.55964 3 4.25V13.75C3 14.4404 3.55964 15 4.25 15H9M10.25 9H19.75C20.4404 9 21 9.55964 21 10.25V19.75C21 20.4404 20.4404 21 19.75 21H10.25C9.55964 21 9 20.4404 9 19.75V10.25C9 9.55964 9.55964 9 10.25 9Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function W0e(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12 9.01917V12.0134M12 15H12.01M10.2765 3.99036L3.27481 15.998C2.49885 17.3288 3.45836 19 4.99836 19H19.0016C20.5416 19 21.5011 17.3288 20.7252 15.998L13.7235 3.99035C12.9536 2.66988 11.0464 2.66988 10.2765 3.99036ZM12.25 15C12.25 15.1381 12.1381 15.25 12 15.25C11.8619 15.25 11.75 15.1381 11.75 15C11.75 14.8619 11.8619 14.75 12 14.75C12.1381 14.75 12.25 14.8619 12.25 15Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Si(t){return typeof t=="object"&&t!==null}function e5(t){if(typeof t=="string"||typeof t=="number"||t instanceof Date){const e=new Date(t);if(Number.isFinite(e.getTime()))return e.toISOString()}return new Date().toISOString()}function Ms(t){return typeof t=="string"?t:void 0}function Ps(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function eJ(t){return typeof t=="boolean"?t:void 0}function tJ(t){if(Si(t))return Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}function nJ(t){if(typeof t=="string")return t;if(t===0)return"left";if(t===1)return"middle";if(t===2)return"right"}function ea(t){return new Date(t.timestamp).getTime()}function sJ(t){if(!Si(t))return;const e=Si(t.boundingBox)?t.boundingBox:void 0,n=Ps(e==null?void 0:e.x),s=Ps(e==null?void 0:e.y),r=Ps(e==null?void 0:e.width),i=Ps(e==null?void 0:e.he
316ight);return{tagName:Ms(t.tagName),role:Ms(t.role),accessibleName:Ms(t.accessibleName),text:Ms(t.text),attributes:tJ(t.attributes),selector:tJ(t.selector),boundingBox:n!==void 0&&s!==void 0&&r!==void 0&&i!==void 0?{x:n,y:s,width:r,height:i}:void 0}}function q0e(t){if(!Si(t)||t.type!=="BrowserInteraction")return null;const e=Si(t.interaction)?t.interaction:void 0;if(!e)return null;const n=Ms(e.action),s=Si(e.pointer)?e.pointer:void 0,r=Si(e.keyboard)?e.keyboard:void 0,i=Si(e.value)?e.value:void 0,a=Si(e.navigation)?e.navigation:void 0,o=Si(e.page)?e.page:void 0,l=e5(t.timestamp??t.createdAt);if(n==="navigate"){const d=Ms(a==null?void 0:a.url)??Ms(o==null?void 0:o.url);return d?{timestamp:l,type:"navigate",navigation:{url:d}}:null}const u={timestamp:l,target:sJ(e.target),page:{url:Ms(o==null?void 0:o.url)}};if(n==="click"||n==="doubleClick")return{...u,type:n,pointer:{x:Ps(s==null?void 0:s.x),y:Ps(s==null?void 0:s.y),button:nJ(s==null?void 0:s.button),clickCount:Ps(s==null?void 0:s.clickCount)}};if(n==="keyPress")return{...u,type:"keyPress",keyboard:{key:Ms(r==null?void 0:r.key),code:Ms(r==null?void 0:r.code),text:Ms(r==null?void 0:r.text)}};if(n==="input"||n==="change")return{...u,type:n,value:{inputType:Ms(i==null?void 0:i.inputType),valueLength:Ps(i==null?void 0:i.valueLength),text:Ms(i==null?void 0:i.text),redacted:eJ(i==null?void 0:i.redacted),checked:eJ(i==null?void 0:i.checked)}};if(n==="submit")return{...u,type:"submit"};if(n==="scroll")return{timestamp:l,type:"scroll",pointer:{x:Ps(s==null?void 0:s.x),y:Ps(s==null?void 0:s.y)}};if(n==="drag"){const d=e5(e.endTimestamp);return{...u,type:"drag",endTimestamp:d!==l?d:void 0,endTarget:sJ(e.endTarget),pointer:{startX:Ps(s==null?void 0:s.startX),startY:Ps(s==null?void 0:s.startY),endX:Ps(s==null?void 0:s.endX),endY:Ps(s==null?void 0:s.endY),button:nJ(s==null?void 0:s.button)}}}return null}function Rnt(t){if(!Si(t))return null;const e=Ms(t.type);let n;switch(e){case"PageError":n="page";break;case"BrowserError":n="browser";break;case"RequestFailed":return null;case"Error":n="other";break;default:return null}const s=Si(t.error)?t.error:void 0,r=Ms(s==null?void 0:s.message);return r?{timestamp:e5(t.timestamp??t.createdAt),type:"error",error:{kind:n,message:r,stack:Ms(s==null?void 0:s.stack),url:Ms(s==null?void 0:s.url)}}:null}function Ant(t){if(!Si(t))return null;const e=e5(t.timestamp??t.createdAt),n=Si(t.cdp)?t.cdp:void 0,s=Ms(n==null?void 0:n.command),r=Ms(n==null?void 0:n.name),i=Si(n==null?void 0:n.params)?n.params:{};if(s==="Input.dispatchMouseEvent"){if(i.type==="mousePressed")return{timestamp:e,action:"mousePress",x:Ps(i.x),y:Ps(i.y),button:Ms(i.button),clickCount:Ps(i.clickCount),modifiers:Ps(i.modifiers)??0};if(i.type==="mouseReleased")return{timestamp:e,action:"mouseReleased",x:Ps(i.x),y:Ps(i.y),button:Ms(i.button),clickCount:Ps(i.clickCount),modifiers:Ps(i.modifiers)??0};if(i.type==="mouseWheel")return{timestamp:e,action:"mouseWheel",x:Ps(i.x),y:Ps(i.y),deltaX:Ps(i.deltaX),deltaY:Ps(i.deltaY),modifiers:Ps(i.modifiers)??0}}if(s==="Input.dispatchKeyEvent"){if(i.type==="keyDown")return{timestamp:e,action:"keyboardDown",code:Ms(i.code),key:Ms(i.key),text:Ms(i.text)};if(i.type==="keyUp")return{timestamp:e,action:"keyboardUp",code:Ms(i.code),key:Ms(i.key),text:Ms(i.text)}}if(s==="Page.navigate"&&typeof i.url=="string")return{timestamp:e,action:"navigate",url:i.url};const a=Si(i.frame)?i.frame:void 0;return r==="Page.frameNavigated"&&typeof(a==null?void 0:a.url)=="string"&&!a.parentId?{timestamp:e,action:"navigate",url:a.url}:null}function Nnt(t,e=400){if(t.length===0)return t;const n=[];let s=0;for(;s<t.length;){const a=t[s],o=t[s+1];if(!o){n.push(a);break}const l=ea(o)-ea(a);if(a.action==="mousePress"&&o.action==="mouseReleased"&&l<=e&&a.x===o.x&&a.y===o.y&&a.button===o.button){n.push({timestamp:a.timestamp,action:"mouseClick",x:a.x,y:a.y,button:a.button,clickCount:a.clickCount,modifiers:a.modifiers}),s+=2;continue}if(a.action==="keyboardDown"&&o.action==="keyboardUp"&&l<=e&&a.key===o.key&&a.code===o.code){n.push({timestamp:a.timestamp,action:"keyPress",key:a.key,code:a.code,text:a.text}),s+=2;continue}n.push(a),s++}const r=[];let i=0;for(;i<n.length;){const a=n[i],o=l=>(l.action==="keyPress"||l.action==="keyboardDown"||l.action==="keyboardUp")&&l.key!==void 0&&l.key.length===1;if(a.action==="navigate"){let l=i+1;for(;l<n.length;){const u=n[l],d=ea(u)-ea(a);if(u.action==="navigate"&&u.url===a.url&&d<=20)l++;else break}r.push(a),i=l}else if(o(a)){const l=[a.key],u=a.timestamp;let d=i+1;for(;d<n.length;){const f=n[d],p=ea(f)-ea(n[d-1]);if(o(f)&&p<=e)l.push(f.key),d++;else break}l.length>1?(r.push({timestamp:u,action:"typed",text:l.join("")}),i=d):(r.push(a),i++)}else if(a.action==="mouseWheel"){let l=a.deltaX||0,u=a.deltaY||0;const d=a.timestamp;let f=i+1;for(;f<n.length;){const p=n[f],m=ea(p)-ea(n[f-1]);if(p.action==="mouseWheel"&&p.x===a.x&&p.y===a.y&&m<=e)l+=p.deltaX||0,u+=p.deltaY||0,f++;else break}f>i+1?(r.push({timestamp:d,action:"mouseWheel",x:a.x,y:a.y,deltaX:l,deltaY:u,modifiers:a.modifiers}),i=f):(r.push(a),i++)}else r.push(a),i++}return r}function Int(t){return t.action==="navigate"&&t.url?{timestamp:t.timestamp,type:"navigate",navigation:{url:t.url}}:t.action==="mouseClick"?{timestamp:t.timestamp,type:t.clickCount&&t.clickCount>1?"doubleClick":"click",pointer:{x:t.x,y:t.y,button:t.button,clickCount:t.clickCount}}:t.action==="keyPress"?{timestamp:t.timestamp,type:"keyPress",keyboard:{key:t.key,code:t.code,text:t.text}}:t.action==="mouseWheel"?{timestamp:t.timestamp,type:"scroll",pointer:{x:t.x,y:t.y},delta:{x:t.deltaX,y:t.deltaY}}:null}function Lnt(t){const e=t.map(Ant).filter(n=>!!n);return Nnt(e).sort((n,s)=>ea(n)-ea(s))}var jnt=500;function gE(t){if(!("target"in t))return;const e=t.target,n=e==null?void 0:e.selector;if(n)return n.testId??n.id??n.aria??n.name??n.css??void 0}function Pnt(t,e){var n,s;if(!e)return!1;if(t.type==="navigate"&&e.type==="navigate")return t.navigation.url===e.navigation.url;if((t.type==="click"||t.type==="doubleClick")&&(e.type==="click"||e.type==="doubleClick")){if(gE(t)!==gE(e))return!1;const r=ea(t)-ea(e)<jnt,i=((n=t.pointer)==null?void 0:n.clickCount)??1,a=((s=e.pointer)==null?void 0:s.clickCount)??1;return r&&i>a}return(t.type==="input"||t.type==="change")&&(e.type==="input"||e.type==="change")?gE(t)===gE(e):!1}function K0e(t){const e=[];for(const n of t){const s=e[e.length-1];Pnt(n,s)?e[e.length-1]={...n,timestamp:s.timestamp,endTimestamp:n.endTimestamp??n.timestamp}:e.push(n)}return e}function Mnt(t,e){const n=t.map(a=>Si(a)?q0e(a):null).filter(a=>!!a);n.length===0&&(e!=null&&e.strict);const s=t.map(a=>Si(a)?Rnt(a):null).filter(a=>!!a),i=[...n.length>0?n:Lnt(t).map(Int).filter(a=>!!a),...s].sort((a,o)=>ea(a)-ea(o));return K0e(i)}function rJ(t){var e,n,s,r,i,a,o,l;return t.type==="click"||t.type==="doubleClick"||t.type==="scroll"?`${t.timestamp}-${t.type}-${(e=t.pointer)==null?void 0:e.x}-${(n=t.pointer)==null?void 0:n.y}
316`:t.type==="keyPress"?`${t.timestamp}-${t.type}-${(s=t.keyboard)==null?void 0:s.key}-${(r=t.keyboard)==null?void 0:r.code}`:t.type==="drag"?`${t.timestamp}-drag-${(i=t.pointer)==null?void 0:i.startX}-${(a=t.pointer)==null?void 0:a.startY}-${(o=t.pointer)==null?void 0:o.endX}-${(l=t.pointer)==null?void 0:l.endY}`:t.type==="error"?`${t.timestamp}-error-${t.error.kind}-${t.error.message.slice(0,64)}`:`${t.timestamp}-${t.type}`}function SI(t,e){const n=new Set(t.map(rJ)),s=e.filter(i=>!n.has(rJ(i)));if(s.length===0)return t;const r=[...t,...s].sort((i,a)=>ea(i)-ea(a));return K0e(r)}const Dnt="top 0.3s cubic-bezier(0.22,1,0.36,1), left 0.3s cubic-bezier(0.22,1,0.36,1), width 0.3s cubic-bezier(0.22,1,0.36,1), height 0.3s cubic-bezier(0.22,1,0.36,1)",Ont=({action:t})=>{const e=B0e(t),n=s=>c.jsx("span",{className:`flex-shrink-0 ${e}`,style:{display:"inline-flex"},children:c.jsx(s,{size:20})});return n(t==="mousePress"||t==="mouseClick"||t==="click"||t==="doubleClick"||t==="submit"?bb:t==="keyboardDown"||t==="keyPress"||t==="typed"?H0e:t==="keyboardUp"?knt:t==="navigate"?gF:t==="mouseWheel"||t==="scroll"?G0e:t==="drag"?V0e:t==="error"?W0e:DD)},Y0e=t=>"target"in t?t.target:void 0,t5=t=>{if(typeof t=="string"&&t.length>0)return t;if(typeof t=="number"||typeof t=="boolean")return String(t)},To=(t,e)=>{var n;return t5((n=t==null?void 0:t.attributes)==null?void 0:n[e])},$nt=t=>{const{tagName:e}=t;if(!e)return null;const n=To(t,"id");if(n)return`${e}#${n}`;const s=To(t,"class");if(s){const i=s.split(/\s+/).filter(Boolean)[0];if(i)return`${e}.${i}`}const r=To(t,"type");return r?`${e}[${r}]`:e},OD=t=>t&&(t.accessibleName||To(t,"ariaLabel")||To(t,"placeholder")||t.text||To(t,"testId")||To(t,"name")||$nt(t))||null,Fnt=t=>t?!(t.accessibleName||To(t,"ariaLabel")||To(t,"placeholder")||t.text||To(t,"testId")||To(t,"name")):!0,Z0e=(t,e)=>{const n=[];return e<0&&n.push(`up ${Math.abs(e)}px`),e>0&&n.push(`down ${e}px`),t<0&&n.push(`left ${Math.abs(t)}px`),t>0&&n.push(`right ${t}px`),n.length?n.join(", "):null},Unt=({activity:t})=>{var s,r,i,a,o,l,u,d,f,p,m,v;const e=Y0e(t),n=OD(e);if(t.type==="click"||t.type==="doubleClick"||t.type==="submit"){const x="pointer"in t?t.pointer:void 0,y=x==null?void 0:x.button,S=x==null?void 0:x.clickCount,_=t.type==="doubleClick"?2:1,E=Fnt(e),T=x&&typeof x.x=="number"&&typeof x.y=="number";return c.jsxs("div",{className:"flex flex-wrap gap-1 text-[var(--sand-11)]",children:[n&&c.jsxs("span",{className:"font-semibold text-[var(--sand-12)]",children:[e!=null&&e.role?`${e.role}: `:"",n]}),E&&T&&c.jsxs("span",{className:"text-[var(--sand-10)]",children:["at (",x.x,", ",x.y,")"]}),y&&y!=="left"&&c.jsxs("span",{children:["Button: ",y]}),S&&S>_&&c.jsxs("span",{children:["Clicks: ",S]})]})}if(t.type==="keyPress"){const x=((s=t.keyboard)==null?void 0:s.key)===((r=t.keyboard)==null?void 0:r.code);return c.jsxs("div",{className:"flex flex-wrap gap-1 text-[var(--sand-11)]",children:[n&&c.jsxs("span",{className:"font-semibold text-[var(--sand-12)]",children:[e!=null&&e.role?`${e.role}: `:"",n]}),((i=t.keyboard)==null?void 0:i.key)&&c.jsxs("span",{children:["Key: ",t.keyboard.key]}),((a=t.keyboard)==null?void 0:a.code)&&!x&&c.jsxs("span",{children:["Code: ",t.keyboard.code]}),((o=t.keyboard)==null?void 0:o.text)&&c.jsxs("span",{className:"font-semibold",children:['"',t.keyboard.text,'"']})]})}if(t.type==="input"||t.type==="change"){const x=(l=t.value)==null?void 0:l.inputType,y=(u=t.value)==null?void 0:u.text,S=(d=t.value)==null?void 0:d.redacted;return c.jsxs("div",{className:"flex flex-wrap gap-1 text-[var(--sand-11)]",children:[n&&c.jsxs("span",{className:"font-semibold text-[var(--sand-12)]",children:[e!=null&&e.role?`${e.role}: `:"",n]}),y&&c.jsxs("span",{className:"font-mono text-[var(--sand-12)] bg-[var(--sand-3)] px-1.5 py-0.5 rounded text-[11px]",children:['"',y,'"']}),S&&c.jsx("span",{className:"text-[var(--sand-10)] italic",children:"redacted"}),x&&x!=="text"&&c.jsxs("span",{children:["Type: ",x]}),!y&&typeof((f=t.value)==null?void 0:f.valueLength)=="number"&&c.jsxs("span",{children:["Value length: ",t.value.valueLength]}),typeof((p=t.value)==null?void 0:p.checked)=="boolean"&&c.jsxs("span",{children:["Checked: ",String(t.value.checked)]})]})}if(t.type==="navigate")return c.jsx("div",{className:"min-w-0 text-[var(--sand-11)]",children:c.jsx("span",{className:"block truncate",children:t.navigation.url})});if(t.type==="scroll"){const x=Z0e(((m=t.delta)==null?void 0:m.x)??0,((v=t.delta)==null?void 0:v.y)??0),y=t.pointer,S=y&&typeof y.x=="number"&&typeof y.y=="number";return x?c.jsx("div",{className:"flex gap-3 text-[var(--sand-11)]",children:c.jsx("span",{children:x})}):S?c.jsx("div",{className:"flex gap-3 text-[var(--sand-11)]",children:c.jsxs("span",{children:["at (",y.x,", ",y.y,")"]})}):c.jsx("div",{className:"flex gap-3 text-[var(--sand-10)] italic",children:c.jsx("span",{children:"no scroll detail"})})}if(t.type==="drag"){const{startX:x,startY:y,endX:S,endY:_}=t.pointer??{},E=OD(t.endTarget),T=typeof x=="number"&&typeof y=="number"&&typeof S=="number"&&typeof _=="number";return c.jsxs("div",{className:"flex flex-wrap gap-1 text-[var(--sand-11)]",children:[n&&c.jsxs("span",{className:"font-semibold text-[var(--sand-12)]",children:[e!=null&&e.role?`${e.role}: `:"",n]}),T&&c.jsxs("span",{children:["(",x,", ",y,") → (",S,", ",_,")"]}),E&&E!==n&&c.jsxs("span",{children:["→ ",E]})]})}return t.type==="error"?c.jsxs("div",{className:"flex flex-col gap-1 text-[var(--sand-11)]",children:[c.jsx("span",{className:"font-mono text-[var(--tomato-11)] break-all",children:t.error.message}),t.error.url&&c.jsx("span",{className:"text-[10px] break-all text-[var(--sand-10)]",children:t.error.url})]}):null},X0e=(t,e)=>{if(!e){const d=new Date(t),f=d.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),p=d.getMilliseconds().toString().padStart(3,"0");return`${f}.${p}`}const n=new Date(t).getTime(),s=new Date(e).getTime(),r=n-s;if(r<0)return"0:00.000";const i=Math.floor(r/1e3),a=r%1e3,o=Math.floor(i/3600),l=Math.floor(i%3600/60),u=i%60;return o>0?`${o}:${l.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}.${a.toString().padStart(3,"0")}`:`${l}:${u.toString().padStart(2,"0")}.${a.toString().padStart(3,"0")}`},Bnt=t=>{var e,n,s,r,i;return t.type==="input"||t.type==="change"?`${t.type}:${(e=t.value)==null?void 0:e.valueLength}:${(n=t.value)==null?void 0:n.checked}`:t.type==="click"||t.type==="doubleClick"?`${t.type}:${(s=t.pointer)==null?void 0:s.clickCount}`:t.type==="scroll"?`scroll:${(r=t.pointer)==null?void 0:r.x}:${(i=t.pointer)==null?void 0:i.y}`:t.type},znt=t=>{var o,l,u,d,f,p,m,v,x,y,S,_,E;const e=[],n="target"in t?t.target:void 0,s=[];n&&(n.tagName&&s.push({label:"Tag",value:n.tagName}),n.role&&s.push({label:"Role",value:n.role}),n.accessibleName&&s.push({label:"Accessible name",value:n.accessibleName}),n.text&&s.push({label:"Text",value:n.text})),s.length&&e.push({section:"Target",rows:s});const r=[];(o=n==null?void 0:n.selector)!=null&&o.css&&r.push({label:"CSS",value:n.selector.css,kind:"code"}),(l=n==null?void 0:n.selector)!=null&&l.xpath&&r.push({label:"XPath",value:n.selector.xpath,kind:"code"}),r.length&&e.push({section:"Selector",rows:r});const i=[];if("pointer"in t&&t.pointer&&t.type!=="drag"){const{x:T,y:k}=t.pointer;typeof T=="number"&&typeof k=="number"&&i.push({label:"Pointer",value:`(${T}, ${k})`,kind:"chip"})}if(n!=null&&n.boundingBox){const{x:T,y:k,width:R,height:I}=n.boundingBox;i.push({label:"Box",value:`(${Math.round(T)}, ${Math.round(k)}) · ${Math.round(R)}×${Math.round(I)}`,kind:"chip"})}if((t.type==="click"||t.type==="doubleClick")&&t.pointer){const{button:T,clickCount:k}=t.pointer;T&&i.push({label:"Button",value:T}),k&&k>1&&i.push({label:"Clicks",value:String(k)})}i.length&&e.push({section:"Position",rows:i});const a=[];if(t.type==="navigate"?a.push({label:"URL",value:t.navigation.url,kind:"url"}):"page"in t&&((u=t.page)!=null&&u.url)&&a.push({label:"URL",value:t.page.url,kind:"url"}),a.length&&e.push({section:"Page",rows:a}
316),t.type==="keyPress"){const T=[];(d=t.keyboard)!=null&&d.key&&T.push({label:"Key",value:t.keyboard.key}),(f=t.keyboard)!=null&&f.code&&T.push({label:"Code",value:t.keyboard.code}),(p=t.keyboard)!=null&&p.text&&T.push({label:"Text",value:t.keyboard.text}),T.length&&e.push({section:"Keyboard",rows:T})}if(t.type==="input"||t.type==="change"){const T=[];(m=t.value)!=null&&m.inputType&&T.push({label:"Type",value:t.value.inputType}),(v=t.value)!=null&&v.text&&T.push({label:"Value",value:t.value.text,kind:"code"}),(x=t.value)!=null&&x.redacted&&T.push({label:"Value",value:"(redacted)"}),typeof((y=t.value)==null?void 0:y.valueLength)=="number"&&T.push({label:"Value length",value:String(t.value.valueLength)}),typeof((S=t.value)==null?void 0:S.checked)=="boolean"&&T.push({label:"Checked",value:String(t.value.checked),kind:"boolean"}),T.length&&e.push({section:"Input",rows:T})}if(t.type==="scroll"&&t.delta&&e.push({section:"Scroll",rows:[{label:"Delta",value:`(${t.delta.x??0}, ${t.delta.y??0})`}]}),t.type==="drag"){const T=[],{startX:k,startY:R,endX:I,endY:A,button:L}=t.pointer??{};typeof k=="number"&&typeof R=="number"&&T.push({label:"Start",value:`(${k}, ${R})`,kind:"chip"}),typeof I=="number"&&typeof A=="number"&&T.push({label:"End",value:`(${I}, ${A})`,kind:"chip"}),L&&T.push({label:"Button",value:L}),(E=(_=t.endTarget)==null?void 0:_.selector)!=null&&E.css&&T.push({label:"End CSS",value:t.endTarget.selector.css,kind:"code"}),T.length&&e.push({section:"Drag",rows:T})}if(t.type==="error"){const T=[{label:"Kind",value:t.error.kind},{label:"Message",value:t.error.message,kind:"code"}];t.error.url&&T.push({label:"URL",value:t.error.url,kind:"url"}),t.error.stack&&T.push({label:"Stack",value:t.error.stack,kind:"code"}),e.push({section:"Error",rows:T})}if(n!=null&&n.attributes){const T=[];for(const[k,R]of Object.entries(n.attributes)){const I=t5(R);
316I&&T.push({label:k,value:I})}T.length&&e.push({section:"Attributes",rows:T})}return e},Vnt=t=>{if(t.kind==="code")return c.jsx("code",{className:"font-mono text-[12px] leading-[20px] text-[var(--sand-12)] bg-[var(--sand-4)] px-1.5 rounded break-all inline-block",children:t.value});if(t.kind==="url")return c.jsx("a",{href:t.value,target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[12px] leading-none text-[var(--blue-11)] bg-[var(--sand-4)] px-1.5 py-1 rounded break-all inline-block hover:underline",children:t.value});if(t.kind==="chip")return c.jsx("span",{className:"text-[12px] leading-[20px] text-[var(--sand-12)] bg-[var(--sand-4)] px-1.5 rounded inline-block",children:t.value});if(t.kind==="boolean"){const e=t.value==="true";return c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[var(--sand-12)]",children:[c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:e?"var(--green-9)":"var(--red-9)"}}),t.value]})}return c.jsx("span",{className:"text-[var(--sand-12)] break-all",children:t.value})},wI=t=>{if(!t)return"";const{x:e,y:n}=t;return typeof e!="number"||typeof n!="number"?"":` at (${e}, ${n})`},Hnt=t=>{const e=t==null?void 0:t.boundingBox;return e?`   - Box: (${Math.round(e.x)}, ${Math.round(e.y)}) · ${Math.round(e.width)}×${Math.round(e.height)}`:null},Gnt=t=>{const e=t==null?void 0:t.attributes;if(!e)return[];const n=[],s=new Set,r=["testId","name","href","type","placeholder","ariaLabel","id","title"];for(const i of r){const a=t5(e[i]);a&&!s.has(i)&&(n.push(`   - ${i}: \`${a}\``),s.add(i))}for(const[i,a]of Object.entries(e)){const o=t5(a);o&&!s.has(i)&&(n.push(`   - ${i}: \`${o}\``),s.add(i))}return n},Wnt=t=>{var n,s;const e=[];return(n=t==null?void 0:t.selector)!=null&&n.css&&e.push(`   - CSS: \`${t.selector.css}\``),(s=t==null?void 0:t.selector)!=null&&s.xpath&&e.push(`   - XPath: \`${t.selector.xpath}\``),e},iJ=(t,e)=>{const n=[];return t!=null&&t.button&&t.button!=="left"&&n.push(`   - Button: ${t.button}`),t!=null&&t.clickCount&&t.clickCount>e&&n.push(`   - Clicks: ${t.clickCount}`),n},xf=t=>t.filter(e=>!!e).join(`
317`),qnt=(t,e,n)=>{var p,m,v,x,y,S,_,E,T,k,R,I,A,L,j,F,O;const s=Y0e(t),r=(s==null?void 0:s.accessibleName)||(s==null?void 0:s.text)||To(s,"testId")||To(s,"name")||(s==null?void 0:s.tagName)||"element",i=s==null?void 0:s.role,a=i?`${i} "${r}"`:`"${r}"`,o=X0e(t.timestamp,n),l=`${e}. \`${o}\``,u=Gnt(s),d=Wnt(s),f=Hnt(s);switch(t.type){case"click":return xf([`${l} **Click** ${a}${wI(t.pointer)}`,...u,...d,f,...iJ(t.pointer,1)]);case"doubleClick":return xf([`${l} **Double-click** ${a}${wI(t.pointer)}`,...u,...d,f,...iJ(t.pointer,2)]);case"submit":return xf([`${l} **Submit** ${a}`,...u,...d,f]);case"keyPress":{const M=((p=t.keyboard)==null?void 0:p.key)||((m=t.keyboard)==null?void 0:m.text)||"",U=[];return(v=t.keyboard)!=null&&v.code&&t.keyboard.code!==t.keyboard.key&&U.push(`   - Code: \`${t.keyboard.code}\``),(x=t.keyboard)!=null&&x.text&&t.keyboard.text!==t.keyboard.key&&U.push(`   - Text: \`${t.keyboard.text}\``),xf([`${l} **Press ${M||"key"}** on ${a}`,...u,...d,f,...U])}case"input":{const M=(y=t.value)==null?void 0:y.valueLength,U=(S=t.value)==null?void 0:S.inputType,G=(_=t.value)==null?void 0:_.text,$=(E=t.value)==null?void 0:E.redacted,V=U&&U!=="text"?`[${U}] `:"",B=G?`"${G}" into `:$?`<redacted${M?`, ${M} chars`:""}> into `:M?`${M} chars into `:"value of ",q=[];return typeof((T=t.value)==null?void 0:T.checked)=="boolean"&&q.push(`   - Checked: ${t.value.checked}`),xf([`${l} **Type** ${B}${V}${a}`,...u,...d,f,...q])}case"change":{const M=(k=t.value)==null?void 0:k.inputType,U=(R=t.value)==null?void 0:R.text,G=(I=t.value)==null?void 0:I.redacted,$=M&&M!=="text"?`[${M}] `:"",V=U?` to "${U}"`:G?" to <redacted>":"",B=[];return typeof((A=t.value)==null?void 0:A.checked)=="boolean"&&B.push(`   - Checked: ${t.value.checked}`),xf([`${l} **Change** value of ${$}${a}${V}`,...u,...d,f,...B])}case"scroll":{const M=Z0e(((L=t.delta)==null?void 0:L.x)??0,((j=t.delta)==null?void 0:j.y)??0);return`${l} **Scroll** ${M??"(in place)"}${wI(t.pointer)}`}case"drag":{const{startX:M,startY:U,endX:G,endY:$,button:V}=t.pointer??{},q=typeof M=="number"&&typeof U=="number"&&typeof G=="number"&&typeof $=="number"?`from (${M}, ${U}) to (${G}, ${$})`:"",z=OD(t.endTarget),D=z&&z!==r?` onto "${z}"`:"",K=[];return(O=(F=t.endTarget)==null?void 0:F.selector)!=null&&O.css&&K.push(`   - End CSS: \`${t.endTarget.selector.css}\``),V&&V!=="left"&&K.push(`   - Button: ${V}`),xf([`${l} **Drag** ${a}${q?` ${q}`:""}${D}`,...u,...d,f,...K])}case"navigate":return null;case"error":{const M=t.error.kind==="request"?"Request failed":t.error.kind==="page"?"Page error":t.error.kind==="browser"?"Browser error":"Error",U=[];if(t.error.url&&U.push(`   - URL: \`${t.error.url}\``),t.error.stack){const G=t.error.stack.split(`
318`).slice(0,3).join(" | ");U.push(`   - Stack: \`${G}\``)}return xf([`${l} **${M}** — ${t.error.message}`,...U])}}return null},_I=(t,e,n)=>{var l,u;if(!t.length)return`# Browser session
319
320(no activities recorded)`;const s=[...t].sort((d,f)=>new Date(d.timestamp).getTime()-new Date(f.timestamp).getTime()),r=["# Browser session",""];r.push("Recording of a real user's interaction with a web app, structured for replay by an automation agent. Read top to bottom.","","- `##` headings mark page visits (the URL the user landed on).","- Numbered steps under each heading are actions taken on that page, in chronological order. The backticked time after each step number (e.g. `0:02.345`) is the offset from session start — useful for cross-referencing with the recording.","- Sub-bullets on each step expose stable identifiers (`testId`, `name`, `href`, …) and selectors (`CSS`, `XPath`) for locating the element again.","- `at (x, y)` is the pointer position at the moment of the action; `Box: (x, y) · w×h` is the target element's bounding rectangle in CSS pixels.","- `*(idle Xs)*` between steps marks a gap of user inactivity.","- Sensitive values (passwords, cards, etc.) are redacted; the action is still recorded but the text is replaced with `<redacted>`."),n!=null&&n.screenshotPaths&&n.screenshotPaths.size>0&&r.push("- `![Page screenshot](…)` after a heading refers to the page state at the start of that chapter.");const i=[];e!=null&&e.sessionId&&i.push(`- Session ID: \`${e.sessionId}\``),e!=null&&e.createdAt&&i.push(`- Started: ${e.createdAt}`),(l=e==null?void 0:e.viewport)!=null&&l.width&&e.viewport.height&&i.push(`- Viewport: ${e.viewport.width}×${e.viewport.height}`),e!=null&&e.userAgent&&i.push(`- User-Agent: ${e.userAgent}
320`),e!=null&&e.region&&i.push(`- Region: ${e.region}`),e!=null&&e.isHeadful&&i.push("- Headful: true"),i.length&&r.push("","## Environment",...i),r.push("");let a=1,o=null;for(let d=0;d<s.length;d++){const f=s[d],p=s[d-1];if(p){const v=new Date(p.endTimestamp??p.timestamp).getTime(),y=new Date(f.timestamp).getTime()-v;y>=Q0e&&r.push("",`*(idle ${J0e(y)})*`,"")}if(f.type==="navigate"){const v=f.navigation.url;if(!v)continue;if(v!==o){o=v,r.push("",`## ${v}`);const x=(u=n==null?void 0:n.screenshotPaths)==null?void 0:u.get(v);x&&r.push("",`![Page screenshot](${x})`),r.push("")}continue}const m=qnt(f,a,e==null?void 0:e.createdAt);m&&(r.push(m),a++)}return r.join(`
321`)},Q0e=1e4,J0e=t=>{if(t>=36e5){const e=Math.floor(t/36e5),n=Math.round(t%36e5/6e4);return n>0?`${e}h ${n}m`:`${e}h`}if(t>=6e4){const e=Math.floor(t/6e4),n=Math.round(t%6e4/1e3);return n>0?`${e}m ${n}s`:`${e}m`}return t>=1e4?`${Math.round(t/1e3)}s`:`${(t/1e3).toFixed(1)}s`},Knt=({deltaMs:t})=>c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 min-h-[20px]",children:[c.jsx("div",{className:"h-px flex-1 bg-[var(--sand-6)]"}),c.jsxs("span",{className:"shrink-0 text-[12px] font-sans font-medium text-[var(--sand-10)]",children:[J0e(t)," idle"]}),c.jsx("div",{className:"h-px flex-1 bg-[var(--sand-6)]"})]}),Ynt=(t,e,n)=>{const s=new Date(t).getTime();if(e.length)return pF(s,e);if(n===null)return null;const r=(s-n)/1e3;return r>=0?r:null},Znt=({activity:t,sessionCreatedAt:e,isLatest:n,isExpanded:s,onToggleExpand:r})=>{const i=Q=>{switch(Q){case"click":return"Click";case"doubleClick":return"Double Click";case"keyPress":return"Key Press";case"input":return"Input";case"change":return"Change";case"submit":return"Submit";case"navigate":return"Navigate";case"scroll":return"Scroll";case"drag":return"Drag";case"error":return"Error";default:return Q}},a=Bnt(t),o=w.useRef(void 0),[l,u]=w.useState(!1);w.useEffect(()=>{if(o.current===void 0){o.current=a;return}if(o.current!==a){o.current=a,u(!0);const Q=setTimeout(()=>u(!1),700);return()=>clearTimeout(Q)}},[a]);const d=VS(),f=(d==null?void 0:d.recordingStartedAt)??(e?new Date(e).getTime():null),p=Ynt(t.timestamp,(d==null?void 0:d.fragmentMappings)??[],f),m=Vf(t),v=(d==null?void 0:d.hoveredActivityKey)===m,x=(d==null?void 0:d.playingActivityKey)===m,[y,S]=w.useState(!1),_=w.useRef(null),E=w.useRef(null),[T,k]=w.useState(null),[R,I]=w.useState(!1),[A,L]=w.useState(!1),j=PD(s?p:null,320),F=PD(T?p:null,1280),O=()=>{const Q=_.current;if(!(!Q||!Q.naturalWidth||!Q.naturalHeight))try{const ee=document.createElement("canvas");ee.width=24,ee.height=8;const te=ee.getContext("2d",{willReadFrequently:!0});if(!te)return;const ue=Math.max(1,Math.round(Q.naturalHeight*.3));te.drawImage(Q,0,0,Q.naturalWidth,ue,0,0,24,8);const{data:ye}=te.getImageData(0,0,24,8);let je=0;for(let Re=0;Re<ye.length;Re+=4)je+=.299*ye[Re]+.587*ye[Re+1]+.114*ye[Re+2];L(je/(ye.length/4)>150)}catch{}},M=t.endTimestamp?new Date(t.endTimestamp).getTime()-new Date(t.timestamp).getTime():null,U=()=>{d&&d.seek(p??0)},G=Q=>{Q.stopPropagation(),r()},$=()=>{const Q=window.innerWidth,ee=window.innerHeight,te=16/9,ue=Math.min(Q*.8,ee*.8*te),ye=ue/te;return{top:(ee-ye)/2,left:(Q-ue)/2,width:ue,height:ye}},V=Q=>{var te;Q.stopPropagation();const ee=(te=_.current)==null?void 0:te.getBoundingClientRect();ee&&(E.current&&(clearTimeout(E.current),E.current=null),I(!1),k({top:ee.top,left:ee.left,width:ee.width,height:ee.height}),S(!0),requestAnimationFrame(()=>{I(!0),k($())}))},B=()=>{var ee;const Q=(ee=_.current)==null?void 0:ee.getBoundingClientRect();if(S(!1),!Q){k(null);return}I(!0),k({top:Q.top,left:Q.left,width:Q.width,height:Q.height}),E.current=window.setTimeout(()=>{k(null),E.current=null},320)};w.useEffect(()=>{if(!y)return;const Q=ee=>{ee.key==="Escape"&&B()};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[y]),w.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const q=async()=>{const Q=F??j;if(!Q)return null;const ee=new Image;ee.src=Q,await ee.decode();const te=document.createElement("canvas");te.width=ee.naturalWidth,te.height=ee.naturalHeight;const ue=te.getContext("2d");return ue?(ue.drawImage(ee,0,0),new Promise(ye=>te.toBlob(ye,"image/png"))):null},z=async Q=>{Q.stopPropagation();const ee=await q();ee&&(await navigator.clipboard.write([new ClipboardItem({"image/png":ee})]),Ao({title:"Screenshot copied"}))},D=async Q=>{Q.stopPropagation();const ee=await q();if(!ee)return;const te=URL.createObjectURL(ee),ue=document.createElement("a");ue.href=te,ue.download=`trace-${m}.png`,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),setTimeout(()=>URL.revokeObjectURL(te),1e3),Ao({title:"Screenshot downloaded"})}
321,K=y?$():null,Y=["group flex gap-3 px-4 py-3 min-h-[60px] cursor-pointer transition-colors",v||s||n||x?"bg-[var(--sand-3)]":"bg-[var(--sand-2)] hover:bg-[var(--sand-3)]"].filter(Boolean).join(" "),J=["relative rounded-[8px] overflow-hidden",l?"animate-merge-pulse":""].filter(Boolean).join(" "),ne=`flex size-[32px] items-center justify-center rounded-full text-white backdrop-blur-md transition-colors ${A?"bg-black/40 hover:bg-black/60":"bg-white/15 hover:bg-white/25"}`;return c.jsxs("div",{className:J,children:[c.jsxs("div",{className:Y,onMouseEnter:()=>d==null?void 0:d.setHoveredActivityKey(m),onMouseLeave:()=>d==null?void 0:d.setHoveredActivityKey(null),onClick:()=>{U(),r()},role:"button",tabIndex:0,onKeyDown:Q=>{Q.target===Q.currentTarget&&(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),U(),r())},children:[c.jsx("div",{className:"flex h-5 w-6 flex-shrink-0 items-center justify-center",children:c.jsx(Ont,{action:t.type})}),c.jsxs("div",{className:"flex-1 flex flex-col gap-1 min-w-0 font-sans text-[14px] leading-[20px]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[c.jsx("span",{className:"font-semibold text-[14px] text-[var(--sand-12)]",children:i(t.type)}),c.jsxs("span",{className:"text-[14px] font-mono tabular-nums text-[var(--sand-10)]",children:["@ ",X0e(t.timestamp,e)]})]}),M!==null&&M>=100&&c.jsxs("span",{className:`shrink-0 text-[11px] font-mono font-medium text-[var(--sand-12)] dark:text-white px-2 py-0.5 rounded-full ${s?"bg-[var(--sand-5)]":v||n?"bg-[var(--sand-4)]":"bg-[var(--sand-3)]"}`,children:[M,"ms"]})]}),c.jsx(Unt,{activity:t})]}),c.jsx("div",{className:"flex items-center flex-shrink-0",children:c.jsx("button",{type:"button","aria-label":s?"Hide details":"Show details","aria-expanded":s,onClick:G,className:`p-1.5 rounded transition-colors ${s?"text-[var(--sand-12)]":"text-[var(--sand-10)] hover:text-[var(--sand-12)]"}`,children:c.jsxs("span",{className:"relative inline-flex size-5 items-center justify-center",children:[c.jsx(u1,{size:20,className:`absolute -rotate-90 transition-[opacity,filter] duration-300 ${s?"opacity-0 [filter:blur(4px)]":"opacity-100 [filter:blur(0)]"}`}),c.jsx(u1,{size:20,className:`absolute rotate-180 transition-[opacity,filter] duration-300 ${s?"opacity-100 [filter:blur(0)]":"opacity-0 [filter:blur(4px)]"}`})]})})})]}),c.jsx(xr,{initial:!1,children:s&&c.jsx(wt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",bounce:.2,duration:.35},className:"overflow-hidden bg-[var(--sand-2)]",children:c.jsxs("div",{className:"p-4 flex flex-col gap-4 font-sans text-[14px] text-[var(--sand-11)]",children:[p!==null&&(d==null?void 0:d.getThumbnail)&&c.jsxs("div",{className:"relative w-full aspect-video overflow-hidden rounded bg-[var(--sand-3)]",children:[j?c.jsx("img",{ref:_,src:j,alt:"",onClick:V,onLoad:O,className:"w-full h-full cursor-pointer object-cover"}):c.jsx("div",{className:"w-full h-full animate-pulse"}),j&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-2",children:[c.jsx("button",{type:"button","aria-label":"Copy screenshot as PNG",onClick:z,className:ne,children:c.jsx(C7,{className:"h-4 w-4"})}),c.jsx("button",{type:"button","aria-label":"Download screenshot as PNG",onClick:D,className:ne,children:c.jsx(T7,{className:"h-4 w-4"})})]}),c.jsx("button",{type:"button","aria-label":"Expand screenshot",onClick:V,className:`absolute right-2 top-2 ${ne}`,children:c.jsx(mF,{size:16,className:"text-white"})})]})]}),znt(t).map(Q=>c.jsxs("section",{className:"flex flex-col gap-2",children:[c.jsx("h4",{className:"text-[14px] font-medium text-[var(--sand-11)]",children:Q.section}),c.jsx("dl",{className:"flex flex-col gap-y-2",children:Q.rows.map((ee,te)=>c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx("dt",{className:"shrink-0 text-[14px] text-[var(--sand-10)]",children:ee.label}),c.jsxs("dd",{className:"flex min-w-0 items-center justify-end gap-1.5 text-right text-[14px]",children:[Vnt(ee),ee.kind&&ee.kind!=="boolean"&&c.jsx("button",{type:"button","aria-label":`Copy ${ee.label}`,onClick:()=>{navigator.clipboard.writeText(ee.value),Ao({title:`${ee.label} copied`})},className:"shrink-0 text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",children:c.jsx(Pd,{size:16})})]})]},te))})]},Q.section))]})})}),nr.createPortal(c.jsx(xr,{children:y&&c.jsx(wt.div,{initial:{opacity:0}
321,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},onClick:B,className:"fixed inset-0 z-[95] bg-black/30 dark:bg-black/70 backdrop-blur-sm"},"trace-thumb-backdrop")}),document.body),T&&nr.createPortal(c.jsx("img",{src:F??j??void 0,alt:"",onClick:B,style:{position:"fixed",top:T.top,left:T.left,width:T.width,height:T.height,zIndex:100,transition:R?Dnt:"none"},className:"cursor-zoom-out rounded-lg object-contain"}),document.body),y&&K&&nr.createPortal(c.jsx(wt.button,{type:"button","aria-label":"Close",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},onClick:B,style:{position:"fixed",top:K.top+8,left:K.left+K.width-48,zIndex:101},className:"flex size-[40px] items-center justify-center rounded-full bg-black/40 text-white backdrop-blur-md transition-colors hover:bg-black/60",children:c.jsx(z0e,{size:20,className:"text-white"})}),document.body)]})};function Xnt({id:t,sessionStatus:e}){const{useSessionAgentTraces:n,useSession:s}=fr(),r=aa(),[i,a]=w.useState([]),{data:o,isLoading:l,isError:u}=n(t),d=w.useRef(null),{getToken:f,orgId:p}=zt(),m=w.useEffectEvent(()=>f()),v=w.useRef(null),x=w.useRef([]),[y,S]=w.useState(!0),_=w.useRef(null),[E,T]=w.useState(null),[k,R]=w.useState(!0),I=VS(),{data:A}=s(t),L=(I==null?void 0:I.openActivityRequest)??null;w.useEffect(()=>{L&&(T(L.key),R(!0),requestAnimationFrame(()=>{var M;const O=(M=d.current)==null?void 0:M.querySelector(`[data-activity-key="${L.key}"]`);O==null||O.scrollIntoView({behavior:"smooth",block:"center"})}))},[L==null?void 0:L.nonce]);const j=(I==null?void 0:I.playingActivityKey)??null;w.useEffect(()=>{var M;if(!j||!k)return;const O=(M=d.current)==null?void 0:M.querySelector(`[data-activity-key="${j}"]`);O==null||O.scrollIntoView({behavior:"smooth",block:"center"})},[j,k]),w.useEffect(()=>{if(!E)return;const O=setTimeout(()=>{var U;const M=(U=d.current)==null?void 0:U.querySelector(`[data-activity-key="${E}"]`);M==null||M.scrollIntoView({behavior:"smooth",block:"center"})},460);return()=>clearTimeout(O)},[E]),w.useEffect(()=>{if(_.current!==null&&_.current!==t&&(_.current=null,x.current=[],a([])),_.current===t||l||u||!(o!=null&&o.events))return;_.current=t;const O=[...o.events].sort((M,U)=>new Date(M.timestamp).getTime()-new Date(U.timestamp).getTime());a(M=>M.length===0?O:SI(O,M))},[t,l,u,o]),w.useEffect(()=>e!==tT.LIVE||v.current&&v.current.readyState===WebSocket.OPEN?void 0:((async()=>{try{const M=await m();if(!M)return;v.current=new WebSocket(`wss://connect.steel.dev/v1/sessions/${t}/agent-traces?token=${M}`),v.current.onopen=()=>{console.debug("Agent traces WebSocket connected")},v.current.onmessage=U=>{const G=JSON.parse(U.data),$=G.map(q=>q0e(q)).filter(q=>q!==null),V=G.filter(q=>{if(!q||typeof q!="object")return!1;const z=q.type;return z==="CDPEvent"||z==="CDPCommand"||z==="CDPCommandResult"});let B=$;$.length>0&&(x.current=[]),$.length===0&&V.length>0&&(x.current=[...x.current,...V].slice(-500),B=Mnt(x.current)),B.length!==0&&(a(q=>SI(q,B)),r.setQueryData(Na.agentTraces(p??"",t),q=>{const z=SI((q==null?void 0:q.events)??[],B);return{events:z,total:z.length,hasMore:(q==null?void 0:q.hasMore)??!1}}))},v.current.onclose=U=>{console.debug("Agent traces WebSocket closed:",U.code,U.reason),v.current=null},v.current.onerror=U=>{console.error("Agent traces WebSocket error:",U),v.current=null}}catch(M){console.error("Failed to connect agent traces WebSocket:",M)}})(),()=>{v.current&&(v.current.close(),v.current=null)}),[e,t,p]),w.useEffect(()=>{const O=d.current;if(!O)return;const M=()=>{const{scrollTop:U,scrollHeight:G,clientHeight:$}=O,V=G-U-$<50;S(V)};return O.addEventListener("scroll",M),()=>O.removeEventListener("scroll",M)},[]),w.useEffect(()=>{y&&d.current&&(d.current.scrollTop=d.current.scrollHeight)},[i,y]);const F=w.useMemo(()=>{const O=A!=null&&A.createdAt?new Date(A.createdAt).toISOString():void 0,M=[];for(let U=0;U<i.length;U++){const G=i[U],$=i[U+1],V=`${G.timestamp}-${U}`,B=new Date(G.endTimestamp??G.timestamp).getTime(),q=$?new Date($.timestamp).getTime()-B:0,z=q>=Q0e,D=U===i.length-1||z,K=U===i.length-1&&e===tT.LIVE,Y=Vf(G);M.push(c.jsx(wt.div,{"data-activity-key":Y,initial:{opacity:0,y:6}
321,animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},children:c.jsx(Znt,{activity:G,sessionCreatedAt:O,isLast:D,isLatest:K,isExpanded:E===Y,onToggleExpand:()=>T(J=>J===Y?null:Y)})},V)),z&&$&&M.push(c.jsx(Knt,{deltaMs:q},`${V}-gap`))}return M},[i,A==null?void 0:A.createdAt,E]);return c.jsxs("div",{ref:d,onWheel:()=>R(!1),onTouchMove:()=>R(!1),className:"w-full h-full overflow-y-auto overflow-x-hidden font-mono text-xs flex flex-col pt-6 px-3 pb-24 [scrollbar-gutter:stable_both-edges] [scrollbar-color:var(--sand-6)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-[var(--sand-6)] [&::-webkit-scrollbar-track]:bg-transparent",children:[l&&c.jsxs("div",{className:"my-auto mx-auto flex flex-col items-center gap-3 font-sans",children:[c.jsx(Mh,{className:"h-6 w-6 text-[var(--sand-10)]"}),c.jsx("span",{className:"text-[14px] text-[var(--sand-10)]",children:"Loading agent traces"})]}),u&&c.jsx("p",{className:"my-auto mx-auto text-red-500",children:"Error loading agent traces"}),i.length===0&&!l&&!u&&c.jsxs("div",{className:"my-auto mx-auto flex flex-col items-center gap-2 font-sans text-[14px] text-[var(--sand-10)]",children:[c.jsx(Tnt,{size:20}),c.jsx("span",{children:e===tT.LIVE?"No agent traces yet...":"No agent traces recorded"})]}),i.length>0&&c.jsx("div",{className:"w-full flex flex-col gap-3",children:F})]})}function eve(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M13 3.5V7C13 8.10457 13.8954 9 15 9H18.5M9 13H12M9 17H15.5M7 3H12.1716C12.702 3 13.2107 3.21071 13.5858 3.58579L18.4142 8.41421C18.7893 8.78929 19 9.29799 19 9.82843V19C19 20.1046 18.1046 21 17 21H7C5.89543 21 5 20.1046 5 19V5C5 3.89543 5.89543 3 7 3Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Qnt=sQe,tve=w.forwardRef(({className:t,...e},n)=>c.jsx(rQe,{ref:n,className:He("border-b",t),...e}));tve.displayName="AccordionItem";const nve=w.forwardRef(({className:t,children:e,...n},s)=>c.jsx(iQe,{className:"flex",children:c.jsxs(nge,{ref:s,className:He("group flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left",t),...n,children:[e,c.jsxs("span",{className:"relative inline-flex size-5 shrink-0 items-center justify-center",children:[c.jsx(u1,{size:20,className:"absolute text-[var(--sand-10)] transition-[opacity,filter] duration-300 [filter:blur(0)] group-data-[state=open]:opacity-0 group-data-[state=open]:[filter:blur(4px)]"}),c.jsx(u1,{size:20,className:"absolute rotate-180 text-[var(--sand-12)] dark:text-white opacity-0 transition-[opacity,filter] duration-300 [filter:blur(4px)] group-data-[state=open]:opacity-100 group-data-[state=open]:[filter:blur(0)]"})]})]})}));nve.displayName=nge.displayName;const sve=w.forwardRef(({className:t,children:e,...n},s)=>c.jsx(sge,{ref:s,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:c.jsx("div",{className:He("pb-4 pt-0",t),children:e})}));sve.displayName=sge.displayName;const aJ=t=>t==="Console"?"cyan":t==="Request"?"pink":t==="Response"?"green":t==="Error"||t==="RequestFailed"?"red":t==="Navigation"?"blue":"sand",Jnt=(t,e)=>{var n;return t==="Console"?e.message?e.message.replace(/^\d{2}:\d{2}:\d{2}\.\d{3}\s+(INFO|WARN|ERROR|DEBUG)\s+/,"").replace(`
322`,"").replace("	",""):e.console.message?e.console.message:e.text||e.console.text:t==="Request"?`[${e.method||e.request.method}] ${e.url||e.request.url}`:t==="Response"?`[${e.status||e.response.status}] ${e.url||e.response.url}`:t==="Error"?e.message||e.error.message:t==="Navigation"?e.url||e.navigation.url||JSON.stringify(e):t==="RequestFailed"?`${e.errorText||e.error.message} @ ${e.url||e.error.url}`:e.message||((n=e.error)==null?void 0:n.message)||JSON.stringify(e)};function est({log:t,index:e}){const n=t.log?JSON.parse(t.log):t,s=Jnt(t.type,n),r={timestamp:t.timestamp,type:t.type,...n,pageId:void 0};return c.jsxs(tve,{value:t.id+e,className:"rounded-[8px] border-b-0 overflow-hidden animate-in fade-in-0 slide-in-from-bottom-1 duration-300",children:[c.jsx(nve,{className:"px-4 py-3 w-full bg-[var(--sand-2)] data-[state=open]:bg-[var(--sand-3)] transition-colors hover:bg-[var(--sand-3)] hover:no-underline",children:c.jsxs("div",{className:"flex flex-1 flex-col gap-1 overflow-hidden text-left",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"shrink-0 font-mono text-[14px] tabular-nums text-sand-400",children:new Date(t.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}),c.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-[3px] text-[12px] font-medium leading-none",style:{backgroundColor:`var(--${aJ(t.type)}-a3)`,color:`var(--${aJ(t.type)}-a11)`},children:t.type})]}),c.jsx("span",{className:"truncate text-[14px] font-sans text-[var(--sand-10)]",children:s})]})}),c.jsxs(sve,{className:"flex flex-col gap-3 bg-[var(--sand-2)] p-4",children:[c.jsx("pre",{className:"whitespace-pre-wrap break-all overflow-x-hidden font-mono text-[var(--sand-11)]",children:JSON.stringify(r,null,2)}),c.jsx("button",{type:"button",onClick:()=>Ja(JSON.stringify(r,null,2),"Log"),className:"flex h-[26px] w-fit cursor-pointer items-center self-start rounded-full bg-[var(--sand-7)] px-[10px] font-sans text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors hover:bg-[var(--sand-8)]",children:"Copy JSON"})]})]},t.id+e)}const x0=t=>t instanceof Date?t.getTime():new Date(t).getTime(),tst=(t,e)=>{let n=0,s=t.length;for(;n<s;){const r=Math.floor((n+s)/2);x0(t[r].timestamp)<=e?n=r+1:s=r}return n},EI=(t,e,n)=>{if(e.length===0)return t;const s=e;if(t.length===0)return s.sort((l,u)=>x0(l.timestamp)-x0(u.timestamp));const r=new Set(t.map(l=>l.id)),i=[];for(const l of s)r.has(l.id)||i.push({log:l,timestamp:x0(l.timestamp)});if(i.length===0)return t;if(i.length>t.length*.1)return[...t,...i.map(l=>l.log)].sort((l,u)=>x0(l.timestamp)-x0(u.timestamp));const a=[...t];i.sort((l,u)=>l.timestamp-u.timestamp);let o=0;for(const{log:l,timestamp:u}of i){const d=tst(a.slice(o),u)+o;a.splice(d,0,l),o=d}return a};function nst({id:t,sessionStatus:e}){const{useSessionLogs:n}=fr(),[s,r]=w.useState([]),{data:i,isLoading:a,isError:o}=n(t),l=w.useRef(null),{getToken:u}=zt(),d=w.useEffectEvent(()=>u()),f=w.useRef(null),[p,m]=w.useState(0),v=40;w.useEffect(()=>{!a&&!o&&(i!=null&&i.events)&&r(y=>EI(y,i.events))},[a,o,i]),w.useEffect(()=>e!=="live"||f.current&&f.current.readyState===WebSocket.OPEN?void 0:((async()=>{try{const S=await d();if(!S)return;
322f.current=new WebSocket(`wss://connect.steel.dev/v1/sessions/${t}/logs?token=${S}`),f.current.onopen=()=>{console.debug("WebSocket connected successfully")},f.current.onmessage=_=>{const k=JSON.parse(_.data).filter(R=>R.type!=="CDPEvent"&&R.type!=="CDPCommand"&&R.type!=="CDPCommandResult").map(R=>R.id&&R.log?R:{id:R.id||`${R.type}-${R.timestamp}-${Math.random().toString(36).substr(2,9)}`,type:R.type,timestamp:R.timestamp,log:JSON.stringify(R)});r(R=>EI(R,k))},f.current.onclose=_=>{console.debug("WebSocket closed:",_.code,_.reason),f.current=null},f.current.onerror=_=>{console.error("WebSocket error:",_),f.current=null}}catch(S){console.error("Failed to connect WebSocket:",S)}})(),()=>{f.current&&(f.current.close(),f.current=null)}),[e,t]),w.useEffect(()=>{const y=()=>{if(l.current&&l.current.scrollTop===0){const _=l.current.scrollHeight;m(E=>(requestAnimationFrame(()=>{if(l.current){const k=l.current.scrollHeight-_;l.current.scrollTop=k}}),E+v))}},S=l.current;return S&&S.addEventListener("scroll",y),()=>{S&&S.removeEventListener("scroll",y)}},[]),w.useEffect(()=>{if(!a&&!o&&i){const y=i.events.slice(0,p+v);r(S=>EI(S,y))}},[p,a,o,i]);const x=()=>{if(!l.current)return!1;const{scrollTop:y,scrollHeight:S,clientHeight:_}=l.current;return Math.abs(S-_-y)<1};return w.useEffect(()=>{l.current&&x()&&(l.current.scrollTop=l.current.scrollHeight)},[s]),c.jsxs("div",{ref:l,className:"w-full h-full overflow-y-auto overflow-x-hidden bg-[var(--sand-1)] font-mono text-xs flex flex-col px-3 pt-6 pb-24 [scrollbar-gutter:stable_both-edges] [scrollbar-color:var(--sand-6)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-[var(--sand-6)] [&::-webkit-scrollbar-track]:bg-transparent",children:[a&&c.jsx("p",{className:"my-auto mx-auto text-sand-400",children:"Loading logs..."}
322),o&&c.jsx("p",{className:"my-auto mx-auto text-red-500",children:"Error loading logs"}),s.length===0&&!a&&c.jsxs("div",{className:"my-auto mx-auto flex flex-col items-center gap-2 font-sans text-[14px] text-[var(--sand-10)]",children:[c.jsx(eve,{size:20}),c.jsx("span",{children:e===tT.LIVE?"No logs yet...":"No logs recorded"})]}),s&&s.length>0&&c.jsx(Qnt,{type:"single",collapsible:!0,className:"w-full flex flex-col gap-3",children:s.slice(-p-v).filter(y=>y.type!=="Recording"&&y.type!=="ScreencastFrame"&&y.type!=="CDPCommand"&&y.type!=="CDPCommandResult"&&y.type!=="CDPEvent").map((y,S)=>c.jsx(est,{log:y,index:S},y.id))})]})}function rve({id:t}){const{useSessionAgentTraces:e,useSession:n}=fr(),{data:s}=e(t),{data:r}=n(t),i=VS(),a=Z1(),o=(s==null?void 0:s.events)??[],[l,u]=w.useState(!1),[d,f]=w.useState(!1),[p,m]=w.useState("idle"),[v,x]=w.useState(null),y=p==="capturing"||p==="packaging",S=p==="copied"||p==="downloaded",_=async()=>{u(!1);const I=_I(o,CI(t,r));await navigator.clipboard.writeText(I),Ao({title:"Agent traces copied"}),a.capture("agent-traces-copied",{sessionId:t,activityCount:o.length,promptLength:I.length}),m("copied"),setTimeout(()=>m("idle"),1500)},E=()=>{u(!1);const I=[...o].sort((j,F)=>new Date(j.timestamp).getTime()-new Date(F.timestamp).getTime()),A={session:sst(t,r),activities:I},L=JSON.stringify(A,null,2);TI(`session-${t.slice(0,8)}-${new Date().toISOString().slice(0,10)}.json`,new Blob([L],{type:"application/json"})),a.capture("agent-traces-downloaded-json",{sessionId:t,activityCount:o.length,jsonSizeBytes:L.length}),m("downloaded"),setTimeout(()=>m("idle"),1500)},T=async()=>{u(!1);const I=performance.now();if(!(i!=null&&i.getThumbnail)){const G=_I(o,CI(t,r));TI(`session-${t.slice(0,8)}.md`,new Blob([G],{type:"text/markdown"})),a.capture("agent-traces-downloaded-zip",{sessionId:t,activityCount:o.length,screenshotCount:0,fallback:"text",durationMs:Math.round(performance.now()-I)}),m("downloaded"),setTimeout(()=>m("idle"),1500);return}m("capturing");const A=i.recordingStartedAt??(r!=null&&r.createdAt?new Date(r.createdAt).getTime():null),L=[],j=new Set;for(const G of o){if(G.type!=="navigate")continue;const $=G.navigation.url;if(j.has($))continue;j.add($);const V=new Date(G.timestamp).getTime();let B=null;const q=i.fragmentMappings??[];q.length?B=pF(V,q):A!==null&&(B=(V-A)/1e3),B!==null&&B>=0&&L.push({url:$,videoTime:B})}x({done:0,total:L.length});const F=new Map,O={};for(let G=0;G<L.length;G++){const{url:$,videoTime:V}=L[G];try{const B=await i.getThumbnail(V,1280);if(B){const q=await fetch(B).then(K=>K.blob()),z=new Uint8Array(await q.arrayBuffer()),D=`chapter-${String(G+1).padStart(2,"0")}.jpg`;O[`screenshots/${D}`]=z,F.set($,`screenshots/${D}`)}}catch{}x({done:G+1,total:L.length})}m("packaging");const M=_I(o,CI(t,r),{screenshotPaths:F});O["prompt.md"]=new TextEncoder().encode(M);const U=await new Promise((G,$)=>{xtt(O,(V,B)=>V?$(V):G(B))});TI(`session-${t.slice(0,8)}-${new Date().toISOString().slice(0,10)}.zip`,new Blob([U.buffer],{type:"application/zip"})),a.capture("agent-traces-downloaded-zip",{sessionId:t,activityCount:o.length,screenshotCount:Object.keys(O).filter(G=>G.startsWith("screenshots/")).length,zipSizeBytes:U.byteLength,durationMs:Math.round(performance.now()-I)}),m("downloaded"),x(null),setTimeout(()=>m("idle"),1500)},k=p==="capturing"&&v?`Capturing ${v.done}/${v.total}…`:p==="packaging"?"Packaging…":p==="copied"?"Copied":p==="downloaded"?"Downloaded":null,R="w-full text-left cursor-pointer flex items-center gap-2 h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] whitespace-nowrap text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-[var(--sand-11)]";return c.jsxs(c.Fragment,{children:[c.jsxs(HS,{open:l,onOpenChange:I=>!y&&u(I),children:[c.jsx(GS,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":k??"Session actions",className:"flex size-[36px] shrink-0 items-center justify-center rounded-full border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:S?c.jsx(cde,{className:"w-4 h-4"}):c.jsx(TFe,{className:`w-4 h-4 ${y?"animate-pulse":""}`})})}),c.jsxs(Q1,{align:"end",sideOffset:6,className:"w-max flex flex-col gap-[4px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu",children:[c.jsxs("button",{type:"button",onClick:_,disabled:o.length===0,className:R,children:[c.jsx(C7,{className:"w-4 h-4 shrink-0"}),c.jsx("span",{children:"Copy agent traces as prompt"})]}),c.jsxs("button",{type:"button",onClick:T,disabled:o.length===0,className:R,children:[c.jsx(T7,{className:"w-4 h-4 shrink-0"}),c.jsx("span",{children:"Download agent traces as zip"})]}),c.jsxs("button",{type:"button",onClick:E,disabled:o.length===0,className:R,children:[c.jsx(wFe,{className:"w-4 h-4 shrink-0"}),c.jsx("span",{children:"Download agent traces as JSON"})]}),c.jsxs("button",{type:"button",onClick:()=>{u(!1),f(!0)},className:R,children:[c.jsx(Mde,{fill:"currentColor",className:"w-4 h-4 shrink-0 text-[var(--red-9)]"}),c.jsx("span",{children:"Report a bug"})]})]})]}),c.jsx(_nt,{sessionId:t,open:d,onOpenChange:f})]})}function sst(t,e){return{id:t,createdAt:e!=null&&e.createdAt?new Date(e.createdAt).toISOString():void 0,viewport:e!=null&&e.dimensions?{width:e.dimensions.width,height:e.dimensions.height}
322:void 0,userAgent:e==null?void 0:e.userAgent,region:typeof(e==null?void 0:e.region)=="string"?e.region:void 0,headless:e==null?void 0:e.headless}}function CI(t,e){return{sessionId:t,createdAt:e!=null&&e.createdAt?new Date(e.createdAt).toISOString():void 0,viewport:e!=null&&e.dimensions?{width:e.dimensions.width,height:e.dimensions.height}:void 0,userAgent:e==null?void 0:e.userAgent,region:typeof(e==null?void 0:e.region)=="string"?e.region:void 0,isHeadful:(e==null?void 0:e.headless)===!1?!0:void 0}}function TI(t,e){const n=URL.createObjectURL(e),s=document.createElement("a");s.href=n,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(n),1e3)}const oJ="tab",ive=[{value:"agent-traces",label:"Agent Traces"},{value:"logs",label:"Logs"}];function ave(t="agent-traces"){const[e,n]=Po(),s=e.get(oJ);return{tab:s==="logs"||s==="agent-traces"?s:t,setTab:a=>{const o=new URLSearchParams(e);o.set(oJ,a),n(o,{replace:!0})}}}function ove({label:t,active:e,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:`relative flex h-[32px] cursor-pointer items-center rounded-full px-[12px] text-[14px] font-medium leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] ${e?"text-[var(--sand-12)]":"text-[var(--sand-11)] hover:text-[var(--sand-12)]"}`,children:[e&&c.jsx(wt.span,{layoutId:"console-tab-pill",transition:{type:"spring",bounce:.35,duration:.45},className:"absolute inset-0 z-0 rounded-full bg-[var(--sand-4)]"}),c.jsx("span",{className:"relative z-[1]",children:t})]})}function rst(){const{tab:t,setTab:e}=ave();return c.jsx("div",{className:"flex items-center gap-[4px] rounded-full bg-[var(--sand-2)] p-[4px]",children:ive.map(n=>c.jsx(ove,{label:n.label,active:t===n.value,onClick:()=>e(n.value)},n.value))})}function lve({id:t,sessionStatus:e,activeTab:n,onSelectTab:s}){return c.jsxs("div",{className:"ph-no-capture relative flex flex-col w-full h-full",children:[c.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[c.jsx("div",{className:`absolute inset-0 flex min-h-0 flex-col transition-[opacity,filter] duration-200 ${n==="logs"?"opacity-100":"pointer-events-none opacity-0 blur-[6px]"}`,children:c.jsx(nst,{id:t,sessionStatus:e})}),c.jsx("div",{className:`absolute inset-0 flex min-h-0 flex-col transition-[opacity,filter] duration-200 ${n==="agent-traces"?"opacity-100":"pointer-events-none opacity-0 blur-[6px]"}`,children:c.jsx(Xnt,{id:t,sessionStatus:e})})]}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t from-[var(--sand-1)] via-[var(--sand-1)] to-transparent"}),s&&c.jsxs("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center gap-2 px-3 pb-6 pt-2",children:[c.jsx("div",{className:"flex items-center gap-[4px] rounded-full bg-[var(--sand-2)] p-[4px]",children:ive.map(r=>c.jsx(ove,{label:r.label,active:n===r.value,onClick:()=>s(r.value)},r.value))}),c.jsx(rve,{id:t})]})]})}function ist({id:t,sessionStatus:e,defaultTab:n}){const{tab:s}=ave(n);return c.jsx(lve,{id:t,sessionStatus:e,activeTab:s})}function ast({id:t,sessionStatus:e,defaultTab:n}){const[s,r]=w.useState(n);return c.jsx(lve,{id:t,sessionStatus:e,activeTab:s,onSelectTab:r})}function cve({id:t,sessionStatus:e,defaultTab:n="agent-traces",externalTabs:s=!1}){const{useSessionLogs:r}=fr();return r(t),s?c.jsx(ist,{id:t,sessionStatus:e,defaultTab:n}):c.jsx(ast,{id:t,sessionStatus:e,defaultTab:n})}function ost({error:t,sessionId:e,errorCode:n}){const s=di(),r=n===404;return c.jsx("div",{className:"flex flex-col items-center justify-center flex-1 w-full h-full bg-[var(--sand-1)] p-8",children:c.jsxs("div",{className:"flex flex-col items-center justify-center max-w-md p-8 bg-[var(--sand-2)] rounded-lg border-[0.5px] border-[var(--sand-6)] shadow-lg animate-in fade-in slide-in-from-bottom-4 duration-500",children:[c.jsx("div",{className:"mb-6 animate-in zoom-in-50 duration-500 delay-200",children:r?c.jsx("div",{className:"w-24 h-24 rounded-full bg-[var(--amber-4)] flex items-center justify-center",children:c.jsx($Fe,{className:"w-12 h-12 text-[var(--amber-11)]"})}):c.jsx("div",{className:"w-24 h-24 rounded-full bg-[var(--tomato-4)] flex items-center justify-center",children:c.jsx(k7,{className:"w-12 h-12 text-[var(--tomato-11)]"})})}),c.jsx("h1",{className:"text-2xl font-semibold mb-2 text-[var(--sand-12)]",children:r?"Session Not Found":"Error Loading Session"}),c.jsx("p",{className:"text-center text-[var(--sand-11)] mb-6",children:r?`We couldn't find a session with ID: ${e||"unknown"}`:"There was a problem loading this session. This might be due to a network issue or the session may have expired."}),t&&!r&&c.jsx("div",{className:"bg-[var(--sand-3)] p-3 rounded-md mb-6 w-full overflow-auto",children:c.jsx("code",{className:"text-xs text-[var(--sand-12)] whitespace-pre-wrap",children:t.message||JSON.stringify(t,null,2)})}),c.jsxs("div",{className:"flex gap-4",children:[c.jsxs(Zt,{variant:"secondary",className:"flex items-center gap-2",onClick:()=>s("/sessions"),children:[c.jsx(ode,{className:"w-4 h-4"}),"Back to sessions"]}),!r&&c.jsx(Zt,{variant:"outline",onClick:()=>window.location.reload(),className:"text-[var(--sand-11)] border-[var(--sand-7)] hover:bg-[var(--sand-4)]",children:"Try again"})]})]})})}const lst=A7("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function uve({className:t,variant:e,...n}){return c.jsx("div",{className:He(lst({variant:e}),t),...n})}const cst={info:"bg-[var(--sand-a3)] text-[var(--sand-11)] border border-[var(--sand-6)]",success:"bg-[var(--green-a2)] text-[var(--green-a12)] border border-[var(--green-6)]",warning:"bg-[var(--amber-a2)] text-[var(--amber-a12)] border border-[var(--amber-7)]",danger:"bg-[var(--red-a2)] text-[var(--red-a12)] border border-[var(--red-7)]"};function ust({tag:t,size:e="sm",showAdminIndicator:n=!1,className:s}){const r=mD(t);if(!r)return null;const i=e==="sm"?"text-[11px] px-2 py-0.5":"text-xs px-2.5 py-1";return c.jsxs(uve,{title:r.description,variant:"secondary",className:He("rounded-full gap-1 font-medium inline-flex items-center max-w-fit",i,cst[r.severity],s),children:[r.label,n&&r.visibility==="admin"?c.jsx("span",{title:"Admin-only tag (not visible to customers)",className:"ml-1 text-[10px] uppercase tracking-wider opacity-70",children:"admin"}):null]})}const dst=["danger","warning","success","info"],fst={danger:"border-[var(--red-7)] bg-[var(--red-a2)] text-[var(--red-a12)]",warning:"border-[var(--amber-7)] bg-[var(--amber-a2)] text-[var(--amber-a12)]",success:"border-[var(--green-6)] bg-[var(--green-a2)] text-[var(--green-a12)]",info:"border-[var(--sand-6)] bg-[var(--sand-a2)] text-[var(--sand-12)]"},hst={danger:"Critical issues detected",warning:"Issues detected in this session",success:"Session highlights",info:"Session notes"};function lJ({tags:t,adminView:e=!1,className:n}){const s=(t??[]).filter(Let),r=e?s:s.filter(a=>{var o;return((o=mD(a))==null?void 0:o.visibility)==="public"});if(r.length===0)return null;const i=new Map;for(const a of r){const o=mD(a);if(!o)continue;const l=i.get(o.severity)??[];l.push(a),i.set(o.severity,l)}return c.jsx("div",{className:He("w-full flex flex-col gap-2 flex-shrink-0",n),children:dst.map(a=>{const o=i.get(a);return!o||o.length===0?null:c.jsxs("div",{className:He("flex flex-col gap-2 rounded-md border px-3 py-2",fst[a]),children:[c.jsx("div",{className:"flex items-center justify-between",children:c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:hst[a]})}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(l
322=>c.jsx(ust,{tag:l,showAdminIndicator:e},l))})]},a)})})}const vF=ZQe,Sb=XQe,wb=QQe,ov=w.forwardRef(({className:t,sideOffset:e=4,...n},s)=>c.jsx(JQe,{children:c.jsx(Ege,{ref:s,sideOffset:e,className:He("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));ov.displayName=Ege.displayName;function xF(){return N4("proxy-usage-views")??!1}const pst="flex min-w-0 flex-col gap-2 rounded-[8px] bg-[var(--sand-2)] px-3 py-2.5";function mst({value:t}){return t?c.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-[var(--green-9)]",children:c.jsx(j4,{size:16,className:"text-white"})}):c.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-[var(--sand-10)]",children:c.jsx(z0e,{size:14,className:"text-white"})})}function gst({onComplete:t,busy:e}){const[s,r]=w.useState(!1),i=w.useRef(null),a=()=>{i.current!=null&&(clearTimeout(i.current),i.current=null),r(!1)},o=()=>{e||(r(!0),i.current=window.setTimeout(()=>{r(!1),t()},3e3))};return w.useEffect(()=>()=>{i.current!=null&&clearTimeout(i.current)},[]),c.jsxs("button",{type:"button",disabled:e,onPointerDown:o,onPointerUp:a,onPointerLeave:a,onPointerCancel:a,className:"relative flex min-w-0 cursor-pointer select-none items-center justify-center overflow-hidden rounded-[8px] border-[0.5px] border-[var(--red-6)] bg-[var(--red-3)] px-3 py-2.5 text-[14px] font-medium text-danger disabled:cursor-not-allowed disabled:opacity-60",children:[c.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 bg-[var(--red-6)]",style:{width:s?"100%":"0%",transition:s?"width 3000ms linear":"width 150ms ease-out"}}),c.jsx("span",{className:"relative z-[1] flex flex-col items-center leading-tight",children:e?"Releasing…":c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"Hold to"}),c.jsx("span",{children:"Release session"})]})})]})}function vst({id:t}){const{useSession:e,useReleaseSessionMutation:n}=fr(),{data:s}=e(t),r=n(),i=xF(),a=w.useMemo(()=>{var o,l,u;return s?[{label:"ID",value:s.id,copyable:!0},{label:"Websocket URL",value:s.isSelenium?"N/A":`${s.websocketUrl.slice(0,30)}…`,copyValue:s.isSelenium?"N/A":s.websocketUrl,copyable:!0},{label:"isSelenium",value:((o=s.isSelenium)==null?void 0:o.toString())||"false"},{label:"Auto-captcha",value:((l=s.solveCaptcha)==null?void 0:l.toString())||"false"},{label:"Browser mode",value:s.browserMode==="stealth"?"Stealth":s.browserMode==="standard"?"Standard":"Unknown"},{label:"Proxy Enabled",value:s.proxySource?"true":"false"},{label:"Proxy Provider",value:s.proxySource?s.proxySource.charAt(0).toUpperCase()+s.proxySource.slice(1):"N/A"},{label:"Proxy Bandwidth Used",value:s.status==="live"?"Pending":Snt(s.proxyBytesUsed??0),href:i&&s.proxySource?`/settings/billing/usage/proxy?session=${t}`:void 0,hrefLabel:"View proxy usage"},{label:"Timestamp",value:((u=s.createdAt)==null?void 0:u.toLocaleString())||"N/A"},{label:"Duration",value:D0e(s.duration??0)},{label:"User Agent",value:s.userAgent||"N/A",copyable:!0},{label:"Cost",value:(bnt(s.duration??0)*.0016).toFixed(4)}]:[]},[t,i,s]);return s?c.jsx(vF,{delayDuration:0,children:c.jsxs("div",{className:"grid w-full shrink-0 gap-2 font-sans text-[14px] font-medium leading-[20px] [grid-template-columns:repeat(auto-fit,minmax(150px,1fr))]",children:[a.map(o=>{const l=o.value==="true"||o.value==="false",u=o.copyValue??o.value;return c.jsxs("div",{className:pst,children:[c.jsx("span",{className:"truncate text-[14px] text-[var(--sand-11)]",children:o.label}),l?c.jsx(mst,{value:o.value==="true"}):o.copyable?c.jsxs(Sb,{children:[c.jsx(wb,{asChild:!0,children:c.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(u),Ao({title:`${o.label} copied`})},className:"group flex min-w-0 cursor-pointer items-center gap-1 text-left text-[var(--sand-12)]",children:[c.jsx("span",{className:"truncate",children:o.value}),c.jsx(Pd,{size:18,className:"shrink-0 text-[var(--sand-10)] transition-colors group-hover:text-[var(--sand-12)]"})]})}),c.jsx(ov,{side:"top",className:"max-w-[320px] break-all border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] text-[12px] leading-[16
322px] text-[var(--sand-12)]",children:u})]}):o.href?c.jsxs(Sb,{children:[c.jsx(wb,{asChild:!0,children:c.jsxs(Hn,{to:o.href,"aria-label":o.hrefLabel??"Open details",className:"group flex min-w-0 cursor-pointer items-center gap-1 text-left text-[var(--sand-12)]",children:[c.jsx("span",{className:"truncate",children:o.value}),c.jsx(La,{size:18,className:"shrink-0 text-[var(--sand-10)] transition-colors group-hover:text-[var(--sand-12)]"})]})}),c.jsx(ov,{side:"top",className:"border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] text-[12px] leading-[16px] text-[var(--sand-12)]",children:o.hrefLabel??"Open details"})]}):c.jsxs(Sb,{children:[c.jsx(wb,{asChild:!0,children:c.jsx("span",{className:"truncate text-[var(--sand-12)]",children:o.value})}),c.jsx(ov,{side:"top",className:"max-w-[320px] break-all border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] text-[12px] leading-[16px] text-[var(--sand-12)]",children:o.value})]})]},o.label)}),s.status==="live"&&c.jsx(gst,{onComplete:()=>r.mutate(t),busy:r.isPending})]})}):null}function xst(t,e){const n=w.useRef(null);w.useEffect(()=>{let s,r;function i(){n.current&&clearTimeout(n.current),n.current=setTimeout(e,50)}function a(){if(!t.current){s=requestAnimationFrame(a);return}r=new ResizeObserver(i),r.observe(t.current)}return s=requestAnimationFrame(a),()=>{cancelAnimationFrame(s),n.current&&clearTimeout(n.current),r==null||r.disconnect()}},[t,e])}let ql=[],Lf=0;const aT=4,yst=globalThis.nanostoresGlobal||(globalThis.nanostoresGlobal={epoch:0});let bst=()=>{let t;for(Lf=0;Lf<ql.length;Lf+=aT)try{ql[Lf](ql[Lf+1].value,ql[Lf+2],ql[Lf+3])}catch(e){t=e}if(ql.length=0,t)throw t};const Hi=t=>{let e=[],n={eq:Object.is,get(){return n.lc||n.listen(()=>{})(),n.value},init:t,lc:0,listen(s){return n.lc=e.push(s),()=>{for(let i=Lf+aT;i<ql.length;)ql[i]===s?ql.splice(i,aT):i+=aT;let r=e.indexOf(s);~r&&(e.splice(r,1),--n.lc||n.off())}},notify(s,r){yst.epoch++;let i=!ql.length&&!0;for(let a of e)ql.push(a,n,s,r);i&&bst()},off(){},set(s){let r=n.value;n.eq(r,s)||(n.value=s,n.notify(r))},subscribe(s){let r=n.listen(s);return s(n.value),r},value:t};return n};function cJ(t,e){let n=Sst(e),s=t;for(let r of n){if(s==null)return;s=s[r]}return s}const uJ=/(.*)\[(\d+)\]/;function Sst(t){return t.split(".").flatMap(e=>dve(e))}function dve(t){if(uJ.test(t)){let[,e,n]=t.match(uJ);return[...dve(e),n]}return[t]}function wst(t,e,n){let s=new Set(e);return t.listen((r,i,a)=>{(a===void 0?e.some(o=>i===void 0||r[o]!==i[o]||cJ(r,o)!==cJ(i,o)):s.has(a)||s.has(a.split(/\.|\[/)[0]))&&n(r,i,a)})}let kI=(t,e)=>n=>{t.current!==n&&(t.current=n,e())};function mo(t,{keys:e,deps:n=[t,e],ssr:s}={}){let r=w.useRef();r.current=t.get();let i=w.useCallback(l=>(kI(r,l)(t.value),(e==null?void 0:e.length)>0?wst(t,e,kI(r,l)):t.listen(kI(r,l))),n),a=()=>r.current,o=a;return s&&"init"in t&&(o=s==="initial"?()=>t.init:s),w.useSyncExternalStore(i,a,o)}const el=Hi("paused"),yF=Hi("normal"),w2=Hi(0),yR=Hi(null),lv=Hi(!1),bR=Hi(null),$D=Hi(!1),$0=Hi(!0),cv=Hi(1),FD=Hi(1),uv=Hi({width:1024,height:576}),dJ=Hi({width:1024,height:576}),fve=Hi(null),hve=Hi(!1),pve=Hi(null),n5=Hi([]),dv=Hi([]);var bF=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t[t.Asset=7]="Asset",t))(bF||{}),UD=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(UD||{});function hy(t,e=2){let n=String(t);const s=Math.pow(10,e-1);if(t<s)for(;String(s).length>n.length;)n=`0${t}`;return n}const mve=1e3,BD=60*mve,fJ=60*BD;function s5(t,e=!1){const n=e?t*1e3:t;if(n<=0)return"00:00";const s=Math.floor(n/fJ);let r=n%fJ;const i=Math.floor(r/BD);r=r%BD;const a=Math.floor(r/mve);return s?`${hy(s)}:${hy(i)}:${hy(a)}`:`${hy(i)}:${hy(a)}`}function _st(t){return t.type!==bF.IncrementalSnapshot?!1:t.data.source>UD.Mutation&&t.data.source<=UD.Input}function Est(t,e){const n=[];let s=t[0].timestamp;for(const r of t)_st(r)&&(r.timestamp-s>e&&n.push([s,r.timestamp]),s=r.timestamp);return n}var r5={},Cst=Object.defineProperty,Tst=(t,e,n)=>e in t?Cst(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sn=(t,e,n)=>Tst(t,typeof e!="symbol"?e+"":e,n),hJ,kst=Object.defineProperty,Rst=(t,e,n)=>e in t?kst(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pJ=(t,e,n)=>Rst(t,typeof e!="symbol"?e+"":e,n),Tr=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(Tr||{});Date.now().toString();function Ast(t){return t.nodeType===t.ELEMENT_NODE}class gve{constructor(){pJ(this,"idNodeMap",new Map),pJ(this,"nodeMetaMap",new WeakMap)}getId(e){var n;return e?((n=this.getMeta(e))==null?void 0:n.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);
vendor: 5,228 bytes, lines 322-334
322this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function vve(){return new gve}function Nst(t){return t.toLowerCase()}function Ist(t,e){return!t||!e||t.type!==e.type?!1:t.type===Tr.Document?t.compatMode===e.compatMode:t.type===Tr.DocumentType?t.name===e.name&&t.publicId===e.publicId&&t.systemId===e.systemId:t.type===Tr.Comment||t.type===Tr.Text||t.type===Tr.CDATA?t.textContent===e.textContent:t.type===Tr.Element?t.tagName===e.tagName&&JSON.stringify(t.attributes)===JSON.stringify(e.attributes)&&t.isSVG===e.isSVG&&t.needBlock===e.needBlock:!1}function Lst(t,e){let n;try{n=new URL(t,e??window.location.href)}catch{return null}const s=/\.([0-9a-z]+)(?:$)/i,r=n.pathname.match(s);return(r==null?void 0:r[1])??null}const jst=/(max|min)-device-(width|height)/,mJ=new RegExp(jst.source,"g"),Pst={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(t){t.params.match(mJ)&&(t.params=t.params.replace(mJ,"$1-$2"))}}}},Mst={postcssPlugin:"postcss-hover-classes",prepare:function(){const t=[];return{Rule:function(e){t.indexOf(e)===-1&&(t.push(e),e.selectors.forEach(function(n){n.includes(":hover")&&(e.selector+=`,
323`+n.replace(/:hover/g,".\\:hover"))}))}}}};function Dst(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ost(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function s(){return this instanceof s?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(s){var r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:function(){return t[s]}})}),n}var vE={exports:{}},gJ;function $st(){if(gJ)return vE.exports;gJ=1;var t=String,e=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t}};return vE.exports=e(),vE.exports.createColors=e,vE.exports}const Fst={},Ust=Object.freeze(Object.defineProperty({__proto__:null,default:Fst},Symbol.toStringTag,{value:"Module"})),Xl=Ost(Ust);var RI,vJ;function SF(){if(vJ)return RI;vJ=1;let t=$st(),e=Xl;class n extends Error{constructor(r,i,a,o,l,u){super(r),this.name="CssSyntaxError",this.reason=r,l&&(this.file=l),o&&(this.source=o),u&&(this.plugin=u),typeof i<"u"&&typeof a<"u"&&(typeof i=="number"?(this.line=i,this.column=a):(this.line=i.line,this.column=i.column,this.endLine=a.line,this.endColumn=a.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let i=this.source;r==null&&(r=t.isColorSupported),e&&r&&(i=e(i));let a=i.split(/\r?\n/),o=Math.max(this.line-3,0),l=Math.min(this.line+2,a.length),u=String(l).length,d,f;if(r){let{bold:p,gray:m,red:v}=t.createColors(!0);d=x=>p(v(x)),f=x=>m(x)}else d=f=p=>p;return a.slice(o,l).map((p,m)=>{let v=o+1+m,x=" "+(" "+v).slice(-u)+" | ";if(v===this.line){let y=f(x.replace(/\d/g," "))+p.slice(0,this.column-1).replace(/[^\t]/g," ");return d(">")+f(x)+p+`
324 `+y+d("^")}return" "+f(x)+p}).join(`
325`)}toString(){let r=this.showSourceCode();return r&&(r=`
326
327`+r+`
328`),this.name+": "+this.message+r}}return RI=n,n.default=n,RI}var xE={},xJ;function wF(){return xJ||(xJ=1,xE.isClean=Symbol("isClean"),xE.my=Symbol("my")),xE}var AI,yJ;function xve(){if(yJ)return AI;yJ=1;const t={after:`
329`,beforeClose:`
330`,beforeComment:`
331`,beforeDecl:`
332`,beforeOpen:" ",beforeRule:`
333`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function e(s){return s[0].toUpperCase()+s.slice(1)}class n{constructor(r){this.builder=r}atrule(r,i){let a="@"+r.name,o=r.params?this.rawValue(r,"params"):"";if(typeof r.raws.afterName<"u"?a+=r.raws.afterName:o&&(a+=" "),r.nodes)this.block(r,a+o);else{let l=(r.raws.between||"")+(i?";":"");this.builder(a+o+l,r)}}beforeAfter(r,i){let a;r.type==="decl"?a=this.raw(r,null,"beforeDecl"):r.type==="comment"?a=this.raw(r,null,"beforeComment"):i==="before"?a=this.raw(r,null,"beforeRule"):a=this.raw(r,null,"beforeClose");let o=r.parent,l=0;for(;o&&o.type!=="root";)l+=1,o=o.parent;if(a.includes(`
334`)){let u=this.raw(r,null,"indent");if(u.length)for(let d=0;d<l;d++)a+=u}return a}block(r,i){let a=this.raw(r,"between","beforeOpen");this.builder(i+a+"{",r,"start");let o;r.nodes&&r.nodes.length?(this.body(r),o=this.raw(r,"after")):o=this.raw(r,"after","emptyBody"),o&&this.builder(o),this.builder("}",r,"end")}
vendor: 4,402 bytes, lines 334-339
334body(r){let i=r.nodes.length-1;for(;i>0&&r.nodes[i].type==="comment";)i-=1;let a=this.raw(r,"semicolon");for(let o=0;o<r.nodes.length;o++){let l=r.nodes[o],u=this.raw(l,"before");u&&this.builder(u),this.stringify(l,i!==o||a)}}comment(r){let i=this.raw(r,"left","commentLeft"),a=this.raw(r,"right","commentRight");this.builder("/*"+i+r.text+a+"*/",r)}decl(r,i){let a=this.raw(r,"between","colon"),o=r.prop+a+this.rawValue(r,"value");r.important&&(o+=r.raws.important||" !important"),i&&(o+=";"),this.builder(o,r)}document(r){this.body(r)}raw(r,i,a){let o;if(a||(a=i),i&&(o=r.raws[i],typeof o<"u"))return o;let l=r.parent;if(a==="before"&&(!l||l.type==="root"&&l.first===r||l&&l.type==="document"))return"";if(!l)return t[a];let u=r.root();if(u.rawCache||(u.rawCache={}),typeof u.rawCache[a]<"u")return u.rawCache[a];if(a==="before"||a==="after")return this.beforeAfter(r,a);{let d="raw"+e(a);this[d]?o=this[d](u,r):u.walk(f=>{if(o=f.raws[i],typeof o<"u")return!1})}return typeof o>"u"&&(o=t[a]),u.rawCache[a]=o,o}rawBeforeClose(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length>0&&typeof a.raws.after<"u")return i=a.raws.after,i.includes(`
335`)&&(i=i.replace(/[^\n]+$/,"")),!1}),i&&(i=i.replace(/\S/g,"")),i}rawBeforeComment(r,i){let a;return r.walkComments(o=>{if(typeof o.raws.before<"u")return a=o.raws.before,a.includes(`
336`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(i,null,"beforeDecl"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeDecl(r,i){let a;return r.walkDecls(o=>{if(typeof o.raws.before<"u")return a=o.raws.before,a.includes(`
337`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(i,null,"beforeRule"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeOpen(r){let i;return r.walk(a=>{if(a.type!=="decl"&&(i=a.raws.between,typeof i<"u"))return!1}),i}rawBeforeRule(r){let i;return r.walk(a=>{if(a.nodes&&(a.parent!==r||r.first!==a)&&typeof a.raws.before<"u")return i=a.raws.before,i.includes(`
338`)&&(i=i.replace(/[^\n]+$/,"")),!1}),i&&(i=i.replace(/\S/g,"")),i}rawColon(r){let i;return r.walkDecls(a=>{if(typeof a.raws.between<"u")return i=a.raws.between.replace(/[^\s:]/g,""),!1}),i}rawEmptyBody(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length===0&&(i=a.raws.after,typeof i<"u"))return!1}),i}rawIndent(r){if(r.raws.indent)return r.raws.indent;let i;return r.walk(a=>{let o=a.parent;if(o&&o!==r&&o.parent&&o.parent===r&&typeof a.raws.before<"u"){let l=a.raws.before.split(`
339`);return i=l[l.length-1],i=i.replace(/\S/g,""),!1}}),i}rawSemicolon(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length&&a.last.type==="decl"&&(i=a.raws.semicolon,typeof i<"u"))return!1}),i}rawValue(r,i){let a=r[i],o=r.raws[i];return o&&o.value===a?o.raw:a}root(r){this.body(r),r.raws.after&&this.builder(r.raws.after)}rule(r){this.block(r,this.rawValue(r,"selector")),r.raws.ownSemicolon&&this.builder(r.raws.ownSemicolon,r,"end")}stringify(r,i){if(!this[r.type])throw new Error("Unknown AST node type "+r.type+". Maybe you need to change PostCSS stringifier.");this[r.type](r,i)}}return AI=n,n.default=n,AI}var NI,bJ;function SR(){if(bJ)return NI;bJ=1;let t=xve();function e(n,s){new t(s).stringify(n)}return NI=e,e.default=e,NI}var II,SJ;function wR(){if(SJ)return II;SJ=1;let{isClean:t,my:e}=wF(),n=SF(),s=xve(),r=SR();function i(o,l){let u=new o.constructor;for(let d in o){if(!Object.prototype.hasOwnProperty.call(o,d)||d==="proxyCache")continue;let f=o[d],p=typeof f;d==="parent"&&p==="object"?l&&(u[d]=l):d==="source"?u[d]=f:Array.isArray(f)?u[d]=f.map(m=>i(m,u)):(p==="object"&&f!==null&&(f=i(f)),u[d]=f)}return u}class a{constructor(l={}){this.raws={},this[t]=!1,this[e]=!0;for(let u in l)if(u==="nodes"){this.nodes=[];for(let d of l[u])typeof d.clone=="function"?this.append(d.clone()):this.append(d)}else this[u]=l[u]}addToError(l){if(l.postcssNode=this,l.stack&&this.source&&/\n\s{4}at /.test(l.stack)){let u=this.source;l.stack=l.stack.replace(/\n\s{4}at /,`$&${u.input.from}:${u.start.line}:${u.start.column}$&`)}return l}after(l){return this.parent.insertAfter(this,l),this}assign(l={}){for(let u in l)this[u]=l[u];return this}before(l){return this.parent.insertBefore(this,l),this}cleanRaws(l){delete this.raws.before,delete this.raws.after,l||delete this.raws.between}clone(l={}){let u=i(this);for(let d in l)u[d]=l[d];return u}cloneAfter(l={}){let u=this.clone(l);return this.parent.insertAfter(this,u),u}cloneBefore(l={}){let u=this.clone(l);return this.parent.insertBefore(this,u),u}
vendor: 17,307 bytes, lines 339-345
339error(l,u={}){if(this.source){let{end:d,start:f}=this.rangeBy(u);return this.source.input.error(l,{column:f.column,line:f.line},{column:d.column,line:d.line},u)}return new n(l)}getProxyProcessor(){return{get(l,u){return u==="proxyOf"?l:u==="root"?()=>l.root().toProxy():l[u]},set(l,u,d){return l[u]===d||(l[u]=d,(u==="prop"||u==="value"||u==="name"||u==="params"||u==="important"||u==="text")&&l.markDirty()),!0}}}markDirty(){if(this[t]){this[t]=!1;let l=this;for(;l=l.parent;)l[t]=!1}}next(){if(!this.parent)return;let l=this.parent.index(this);return this.parent.nodes[l+1]}positionBy(l,u){let d=this.source.start;if(l.index)d=this.positionInside(l.index,u);else if(l.word){u=this.toString();let f=u.indexOf(l.word);f!==-1&&(d=this.positionInside(f,u))}return d}positionInside(l,u){let d=u||this.toString(),f=this.source.start.column,p=this.source.start.line;for(let m=0;m<l;m++)d[m]===`
340`?(f=1,p+=1):f+=1;return{column:f,line:p}}prev(){if(!this.parent)return;let l=this.parent.index(this);return this.parent.nodes[l-1]}rangeBy(l){let u={column:this.source.start.column,line:this.source.start.line},d=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:u.column+1,line:u.line};if(l.word){let f=this.toString(),p=f.indexOf(l.word);p!==-1&&(u=this.positionInside(p,f),d=this.positionInside(p+l.word.length,f))}else l.start?u={column:l.start.column,line:l.start.line}:l.index&&(u=this.positionInside(l.index)),l.end?d={column:l.end.column,line:l.end.line}:typeof l.endIndex=="number"?d=this.positionInside(l.endIndex):l.index&&(d=this.positionInside(l.index+1));return(d.line<u.line||d.line===u.line&&d.column<=u.column)&&(d={column:u.column+1,line:u.line}),{end:d,start:u}}raw(l,u){return new s().raw(this,l,u)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...l){if(this.parent){let u=this,d=!1;for(let f of l)f===this?d=!0:d?(this.parent.insertAfter(u,f),u=f):this.parent.insertBefore(u,f);d||this.remove()}return this}root(){let l=this;for(;l.parent&&l.parent.type!=="document";)l=l.parent;return l}toJSON(l,u){let d={},f=u==null;u=u||new Map;let p=0;for(let m in this){if(!Object.prototype.hasOwnProperty.call(this,m)||m==="parent"||m==="proxyCache")continue;let v=this[m];if(Array.isArray(v))d[m]=v.map(x=>typeof x=="object"&&x.toJSON?x.toJSON(null,u):x);else if(typeof v=="object"&&v.toJSON)d[m]=v.toJSON(null,u);else if(m==="source"){let x=u.get(v.input);x==null&&(x=p,u.set(v.input,p),p++),d[m]={end:v.end,inputId:x,start:v.start}}else d[m]=v}return f&&(d.inputs=[...u.keys()].map(m=>m.toJSON())),d}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(l=r){l.stringify&&(l=l.stringify);let u="";return l(this,d=>{u+=d}),u}warn(l,u,d){let f={node:this};for(let p in d)f[p]=d[p];return l.warn(u,f)}get proxyOf(){return this}}return II=a,a.default=a,II}var LI,wJ;function _R(){if(wJ)return LI;wJ=1;let t=wR();class e extends t{constructor(s){s&&typeof s.value<"u"&&typeof s.value!="string"&&(s={...s,value:String(s.value)}),super(s),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return LI=e,e.default=e,LI}var jI,_J;function Bst(){if(_J)return jI;_J=1;let t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return jI={nanoid:(s=21)=>{let r="",i=s;for(;i--;)r+=t[Math.random()*64|0];return r},customAlphabet:(s,r=21)=>(i=r)=>{let a="",o=i;for(;o--;)a+=s[Math.random()*s.length|0];return a}},jI}var PI,EJ;function yve(){if(EJ)return PI;EJ=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Xl,{existsSync:n,readFileSync:s}=Xl,{dirname:r,join:i}=Xl;function a(l){return Buffer?Buffer.from(l,"base64").toString():window.atob(l)}class o{constructor(u,d){if(d.map===!1)return;this.loadAnnotation(u),this.inline=this.startWith(this.annotation,"data:");let f=d.map?d.map.prev:void 0,p=this.loadMap(d.from,f);!this.mapFile&&d.from&&(this.mapFile=d.from),this.mapFile&&(this.root=r(this.mapFile)),p&&(this.text=p)}consumer(){return this.consumerCache||(this.consumerCache=new t(this.text)),this.consumerCache}decodeInline(u){let d=/^data:application\/json;charset=utf-?8;base64,/,f=/^data:application\/json;base64,/,p=/^data:application\/json;charset=utf-?8,/,m=/^data:application\/json,/;if(p.test(u)||m.test(u))return decodeURIComponent(u.substr(RegExp.lastMatch.length));if(d.test(u)||f.test(u))return a(u.substr(RegExp.lastMatch.length));let v=u.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+v)}getAnnotationURL(u){return u.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(u){return typeof u!="object"?!1:typeof u.mappings=="string"||typeof u._mappings=="string"||Array.isArray(u.sections)}loadAnnotation(u){let d=u.match(/\/\*\s*# sourceMappingURL=/gm);if(!d)return;let f=u.lastIndexOf(d.pop()),p=u.indexOf("*/",f);f>-1&&p>-1&&(this.annotation=this.getAnnotationURL(u.substring(f,p)))}loadFile(u){if(this.root=r(u),n(u))return this.mapFile=u,s(u,"utf-8").toString().trim()}loadMap(u,d){if(d===!1)return!1;if(d){if(typeof d=="string")return d;if(typeof d=="function"){let f=d(u);if(f){let p=this.loadFile(f);if(!p)throw new Error("Unable to load previous source map: "+f.toString());return p}}else{if(d instanceof t)return e.fromSourceMap(d).toString();if(d instanceof e)return d.toString();if(this.isMap(d))return JSON.stringify(d);throw new Error("Unsupported previous source map format: "+d.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let f=this.annotation;return u&&(f=i(r(u),f)),this.loadFile(f)}}}startWith(u,d){return u?u.substr(0,d.length)===d:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return PI=o,o.default=o,PI}var MI,CJ;function ER(){if(CJ)return MI;CJ=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Xl,{fileURLToPath:n,pathToFileURL:s}=Xl,{isAbsolute:r,resolve:i}=Xl,{nanoid:a}=Bst(),o=Xl,l=SF(),u=yve(),d=Symbol("fromOffsetCache"),f=!!(t&&e),p=!!(i&&r);class m{constructor(x,y={}){if(x===null||typeof x>"u"||typeof x=="object"&&!x.toString)throw new Error(`PostCSS received ${x} instead of CSS string`);if(this.css=x.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,y.from&&(!p||/^\w+:\/\//.test(y.from)||r(y.from)?this.file=y.from:this.file=i(y.from)),p&&f){let S=new u(this.css,y);if(S.text){this.map=S;let _=S.consumer().file;!this.file&&_&&(this.file=this.mapResolve(_))}}this.file||(this.id="<input css "+a(6)+">"),this.map&&(this.map.file=this.from)}error(x,y,S,_={}){let E,T,k;if(y&&typeof y=="object"){let I=y,A=S;if(typeof I.offset=="number"){let L=this.fromOffset(I.offset);y=L.line,S=L.col}else y=I.line,S=I.column;if(typeof A.offset=="number"){let L=this.fromOffset(A.offset);T=L.line,k=L.col}else T=A.line,k=A.column}else if(!S){let I=this.fromOffset(y);y=I.line,S=I.col}let R=this.origin(y,S,T,k);return R?E=new l(x,R.endLine===void 0?R.line:{column:R.column,line:R.line},R.endLine===void 0?R.column:{column:R.endColumn,line:R.endLine},R.source,R.file,_.plugin):E=new l(x,T===void 0?y:{column:S,line:y},T===void 0?S:{column:k,line:T},this.css,this.file,_.plugin),E.input={column:S,endColumn:k,endLine:T,line:y,source:this.css},this.file&&(s&&(E.input.url=s(this.file).toString()),E.input.file=this.file),E}fromOffset(x){let y,S;if(this[d])S=this[d];else{let E=this.css.split(`
341`);S=new Array(E.length);let T=0;for(let k=0,R=E.length;k<R;k++)S[k]=T,T+=E[k].length+1;this[d]=S}y=S[S.length-1];let _=0;if(x>=y)_=S.length-1;else{let E=S.length-2,T;for(;_<E;)if(T=_+(E-_>>1),x<S[T])E=T-1;else if(x>=S[T+1])_=T+1;else{_=T;break}}return{col:x-S[_]+1,line:_+1}}mapResolve(x){return/^\w+:\/\//.test(x)?x:i(this.map.consumer().sourceRoot||this.map.root||".",x)}origin(x,y,S,_){if(!this.map)return!1;let E=this.map.consumer(),T=E.originalPositionFor({column:y,line:x});if(!T.source)return!1;let k;typeof S=="number"&&(k=E.originalPositionFor({column:_,line:S}));let R;r(T.source)?R=s(T.source):R=new URL(T.source,this.map.consumer().sourceRoot||s(this.map.mapFile));let I={column:T.column,endColumn:k&&k.column,endLine:k&&k.line,line:T.line,url:R.toString()};if(R.protocol==="file:")if(n)I.file=n(R);else throw new Error("file: protocol is not available in this PostCSS build");let A=E.sourceContentFor(T.source);return A&&(I.source=A),I}toJSON(){let x={};for(let y of["hasBOM","css","file","id"])this[y]!=null&&(x[y]=this[y]);return this.map&&(x.map={...this.map},x.map.consumerCache&&(x.map.consumerCache=void 0)),x}get from(){return this.file||this.id}}return MI=m,m.default=m,o&&o.registerInput&&o.registerInput(m),MI}var DI,TJ;function bve(){if(TJ)return DI;TJ=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Xl,{dirname:n,relative:s,resolve:r,sep:i}=Xl,{pathToFileURL:a}=Xl,o=ER(),l=!!(t&&e),u=!!(n&&r&&s&&i);class d{constructor(p,m,v,x){this.stringify=p,this.mapOpts=v.map||{},this.root=m,this.opts=v,this.css=x,this.originalCSS=x,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let p;this.isInline()?p="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?p=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?p=this.mapOpts.annotation(this.opts.to,this.root):p=this.outputFile()+".map";let m=`
342`;this.css.includes(`\r
343`)&&(m=`\r
344`),this.css+=m+"/*# sourceMappingURL="+p+" */"}applyPrevMaps(){for(let p of this.previous()){let m=this.toUrl(this.path(p.file)),v=p.root||n(p.file),x;this.mapOpts.sourcesContent===!1?(x=new t(p.text),x.sourcesContent&&(x.sourcesContent=null)):x=p.consumer(),this.map.applySourceMap(x,m,this.toUrl(this.path(v)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let p;for(let m=this.root.nodes.length-1;m>=0;m--)p=this.root.nodes[m],p.type==="comment"&&p.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(m)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let p="";return this.stringify(this.root,m=>{p+=m}),[p]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let p=this.previous()[0].consumer();p.file=this.outputFile(),this.map=e.fromSourceMap(p,{ignoreInvalidMapping:!0})}else this.map=new e({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new e({file:this.outputFile(),ignoreInvalidMapping:!0});let p=1,m=1,v="<no source>",x={generated:{column:0,line:0},original:{column:0,line:0},source:""},y,S;this.stringify(this.root,(_,E,T)=>{if(this.css+=_,E&&T!=="end"&&(x.generated.line=p,x.generated.column=m-1,E.source&&E.source.start?(x.source=this.sourcePath(E),x.original.line=E.source.start.line,x.original.column=E.source.start.column-1,this.map.addMapping(x)):(x.source=v,x.original.line=1,x.original.column=0,this.map.addMapping(x))),y=_.match(/\n/g),y?(p+=y.length,S=_.lastIndexOf(`
345`),m=_.length-S):m+=_.length,E&&T!=="start"){let k=E.parent||{raws:{}};(!(E.type==="decl"||E.type==="atrule"&&!E.nodes)||E!==k.last||k.raws.semicolon)&&(E.source&&E.source.end?(x.source=this.sourcePath(E),x.original.line=E.source.end.line,x.original.column=E.source.end.column-1,x.generated.line=p,x.generated.column=m-2,this.map.addMapping(x)):(x.source=v,x.original.line=1,x.original.column=0,x.generated.line=p,x.generated.column=m-1,this.map.addMapping(x)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(p=>p.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let p=this.mapOpts.annotation;return typeof p<"u"&&p!==!0?!1:this.previous().length?this.previous().some(m=>m.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(p=>p.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(p){if(this.mapOpts.absolute||p.charCodeAt(0)===60||/^\w+:\/\//.test(p))return p;let m=this.memoizedPaths.get(p);if(m)return m;let v=this.opts.to?n(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(v=n(r(v,this.mapOpts.annotation)));let x=s(v,p);return this.memoizedPaths.set(p,x),x}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(p=>{if(p.source&&p.source.input.map){let m=p.source.input.map;this.previousMaps.includes(m)||this.previousMaps.push(m)}});else{let p=new o(this.originalCSS,this.opts);p.map&&this.previousMaps.push(p.map)}return this.previousMaps}setSourcesContent(){let p={};if(this.root)this.root.walk(m=>{if(m.source){let v=m.source.input.from;if(v&&!p[v]){p[v]=!0;let x=this.usesFileUrls?this.toFileUrl(v):this.toUrl(this.path(v));this.map.setSourceContent(x,m.source.input.css)}}});else if(this.css){let m=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(m,this.css)}}sourcePath(p){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(p.source.input.from):this.toUrl(this.path(p.source.input.from))}toBase64(p){return Buffer?Buffer.from(p).toString("base64"):window.btoa(unescape(encodeURIComponent(p)))}toFileUrl(p){let m=this.memoizedFileURLs.get(p);if(m)return m;if(a){let v=a(p).toString();return this.memoizedFileURLs.set(p,v),v}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(p){let m=this.memoizedURLs.get(p);if(m)return m;i==="\\"&&(p=p.replace(/\\/g,"/"));let v=encodeURI(p).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(p,v),v}}return DI=d,DI}var OI,kJ;function CR(){if(kJ)return OI;kJ=1;let t=wR();class e extends t{constructor(s){super(s),this.type="comment"}}return OI=e,e.default=e,OI}var $I,RJ;function ng(){if(RJ)return $I;RJ=1;let{isClean:t,my:e}=wF(),n=_R(),s=CR(),r=wR(),i,a,o,l;function u(p){return p.map(m=>(m.nodes&&(m.nodes=u(m.nodes)),delete m.source,m))}function d(p){if(p[t]=!1,p.proxyOf.nodes)for(let m of p.proxyOf.nodes)d(m)}class f extends r{append(...m){for(let v of m){let x=this.normalize(v,this.last);for(let y of x)this.proxyOf.nodes.push(y)}return this.markDirty(),this}cleanRaws(m){if(super.cleanRaws(m),this.nodes)for(let v of this.nodes)v.cleanRaws(m)}each(m){if(!this.proxyOf.nodes)return;let v=this.getIterator(),x,y;for(;this.indexes[v]<this.proxyOf.nodes.length&&(x=this.indexes[v],y=m(this.proxyOf.nodes[x],x),y!==!1);)this.indexes[v]+=1;return delete this.indexes[v],y}every(m){return this.nodes.every(m)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let m=this.lastEach;return this.indexes[m]=0,m}getProxyProcessor(){return{get(m,v){return v==="proxyOf"?m:m[v]?v==="each"||typeof v=="string"&&v.startsWith("walk")?(...x)=>m[v](...x.map(y=>typeof y=="function"?(S,_)=>y(S.toProxy(),_):y)):v==="every"||v==="some"?x=>m[v]((y,...S)=>x(y.toProxy(),...S)):v==="root"?()=>m.root().toProxy():v==="nodes"?m.nodes.map(x=>x.toProxy()):v==="first"||v==="last"?m[v].toProxy():m[v]:m[v]},set(m,v,x){return m[v]===x||(m[v]=x,(v==="name"||v==="params"||v==="selector")&&m.markDirty()),!0}}}index(m){return typeof m=="number"?m:(m.proxyOf&&(m=m.proxyOf),this.proxyOf.nodes.indexOf(m))}insertAfter(m,v){let x=this.index(m),y=this.normalize(v,this.proxyOf.nodes[x]).reverse();x=this.index(m);for(let _ of y)this.proxyOf.nodes.splice(x+1,0,_);let S;for(let _ in this.indexes)S=this.indexes[_],x<S&&(this.indexes[_]=S+y.length);return this.markDirty(),this}insertBefore(m,v){let x=this.index(m),y=x===0?"prepend":!1,S=this.normalize(v,this.proxyOf.nodes[x],y).reverse();x=this.index(m);for(let E of S)this.proxyOf.nodes.splice(x,0,E);let _;for(let E in this.indexes)_=this.indexes[E],x<=_&&(this.indexes[E]=_+S.length);return this.markDirty(),this}normalize(m,v){if(typeof m=="string")m=u(i(m).nodes);else if(typeof m>"u")m=[];else if(Array.isArray(m)){m=m.slice(0);for(let y of m)y.parent&&y.parent.removeChild(y,"ignore")}else if(m.type==="root"&&this.type!=="document"){m=m.nodes.slice(0);for(let y of m)y.parent&&y.parent.removeChild(y,"ignore")}else if(m.type)m=[m];else if(m.prop){if(typeof m.value>"u")throw new Error("Value field is missed in node creation");typeof m.value!="string"&&(m.value=String(m.value)),m=[new n(m)]}else if(m.selector)m=[new a(m)];else if(m.name)m=[new o(m)];else if(m.text)m=[new s(m)];else throw new Error("Unknown node type in node creation");return m.map(y=>(y[e]||f.rebuild(y),y=y.proxyOf,y.parent&&y.parent.removeChild(y),y[t]&&d(y),typeof y.raws.before>"u"&&v&&typeof v.raws.before<"u"&&(y.raws.before=v.raws.before.replace(/\S/g,"")),y.parent=this.proxyOf,y))}prepend(...m){m=m.reverse();
vendor: 4,268 bytes, line 345
345for(let v of m){let x=this.normalize(v,this.first,"prepend").reverse();for(let y of x)this.proxyOf.nodes.unshift(y);for(let y in this.indexes)this.indexes[y]=this.indexes[y]+x.length}return this.markDirty(),this}push(m){return m.parent=this,this.proxyOf.nodes.push(m),this}removeAll(){for(let m of this.proxyOf.nodes)m.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(m){m=this.index(m),this.proxyOf.nodes[m].parent=void 0,this.proxyOf.nodes.splice(m,1);let v;for(let x in this.indexes)v=this.indexes[x],v>=m&&(this.indexes[x]=v-1);return this.markDirty(),this}replaceValues(m,v,x){return x||(x=v,v={}),this.walkDecls(y=>{v.props&&!v.props.includes(y.prop)||v.fast&&!y.value.includes(v.fast)||(y.value=y.value.replace(m,x))}),this.markDirty(),this}some(m){return this.nodes.some(m)}walk(m){return this.each((v,x)=>{let y;try{y=m(v,x)}catch(S){throw v.addToError(S)}return y!==!1&&v.walk&&(y=v.walk(m)),y})}walkAtRules(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="atrule"&&m.test(x.name))return v(x,y)}):this.walk((x,y)=>{if(x.type==="atrule"&&x.name===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="atrule")return v(x,y)}))}walkComments(m){return this.walk((v,x)=>{if(v.type==="comment")return m(v,x)})}walkDecls(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="decl"&&m.test(x.prop))return v(x,y)}):this.walk((x,y)=>{if(x.type==="decl"&&x.prop===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="decl")return v(x,y)}))}walkRules(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="rule"&&m.test(x.selector))return v(x,y)}):this.walk((x,y)=>{if(x.type==="rule"&&x.selector===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="rule")return v(x,y)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return f.registerParse=p=>{i=p},f.registerRule=p=>{a=p},f.registerAtRule=p=>{o=p},f.registerRoot=p=>{l=p},$I=f,f.default=f,f.rebuild=p=>{p.type==="atrule"?Object.setPrototypeOf(p,o.prototype):p.type==="rule"?Object.setPrototypeOf(p,a.prototype):p.type==="decl"?Object.setPrototypeOf(p,n.prototype):p.type==="comment"?Object.setPrototypeOf(p,s.prototype):p.type==="root"&&Object.setPrototypeOf(p,l.prototype),p[e]=!0,p.nodes&&p.nodes.forEach(m=>{f.rebuild(m)})},$I}var FI,AJ;function _F(){if(AJ)return FI;AJ=1;let t=ng(),e,n;class s extends t{constructor(i){super({type:"document",...i}),this.nodes||(this.nodes=[])}toResult(i={}){return new e(new n,this,i).stringify()}}return s.registerLazyResult=r=>{e=r},s.registerProcessor=r=>{n=r},FI=s,s.default=s,FI}var UI,NJ;function Sve(){if(NJ)return UI;NJ=1;class t{constructor(n,s={}){if(this.type="warning",this.text=n,s.node&&s.node.source){let r=s.node.rangeBy(s);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in s)this[r]=s[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return UI=t,t.default=t,UI}var BI,IJ;function EF(){if(IJ)return BI;IJ=1;let t=Sve();class e{constructor(s,r,i){this.processor=s,this.messages=[],this.root=r,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(s,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let i=new t(s,r);return this.messages.push(i),i}warnings(){return this.messages.filter(s=>s.type==="warning")}get content(){return this.css}}return BI=e,e.default=e,BI}var zI,LJ;function zst(){if(LJ)return zI;LJ=1;const t=39,e=34,n=92,s=47,r=10,i=32,a=12,o=9,l=13,u=91,d=93,f=40,p=41,m=123,v=125,x=59,y=42,S=58,_=64,E=/[\t\n\f\r "#'()/;[\\\]{}]/g,T=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,k=/.[\r\n"'(/\\]/,R=/[\da-f]/i;return zI=function(A,L={}){let j=A.css.valueOf(),F=L.ignoreErrors,O,M,U,G,$,V,B,q,z,D,K=j.length,Y=0,J=[],ne=[];function Q(){return Y}function ee(je){throw A.error("Unclosed "+je,Y)}function te(){return ne.length===0&&Y>=K}function ue(je){if(ne.length)return ne.pop();if(Y>=K)return;let Re=je?je.ignoreUnclosed:!1;switch(O=j.charCodeAt(Y),O){case r:case i:case o:case l:case a:{M=Y;do M+=1,O=j.charCodeAt(M);
vendor: 11,824 bytes, lines 345-346
345while(O===i||O===r||O===o||O===l||O===a);D=["space",j.slice(Y,M)],Y=M-1;break}case u:case d:case m:case v:case S:case x:case p:{let me=String.fromCharCode(O);D=[me,me,Y];break}case f:{if(q=J.length?J.pop()[1]:"",z=j.charCodeAt(Y+1),q==="url"&&z!==t&&z!==e&&z!==i&&z!==r&&z!==o&&z!==a&&z!==l){M=Y;do{if(V=!1,M=j.indexOf(")",M+1),M===-1)if(F||Re){M=Y;break}else ee("bracket");for(B=M;j.charCodeAt(B-1)===n;)B-=1,V=!V}while(V);D=["brackets",j.slice(Y,M+1),Y,M],Y=M}else M=j.indexOf(")",Y+1),G=j.slice(Y,M+1),M===-1||k.test(G)?D=["(","(",Y]:(D=["brackets",G,Y,M],Y=M);break}case t:case e:{U=O===t?"'":'"',M=Y;do{if(V=!1,M=j.indexOf(U,M+1),M===-1)if(F||Re){M=Y+1;break}else ee("string");for(B=M;j.charCodeAt(B-1)===n;)B-=1,V=!V}while(V);D=["string",j.slice(Y,M+1),Y,M],Y=M;break}case _:{E.lastIndex=Y+1,E.test(j),E.lastIndex===0?M=j.length-1:M=E.lastIndex-2,D=["at-word",j.slice(Y,M+1),Y,M],Y=M;break}case n:{for(M=Y,$=!0;j.charCodeAt(M+1)===n;)M+=1,$=!$;if(O=j.charCodeAt(M+1),$&&O!==s&&O!==i&&O!==r&&O!==o&&O!==l&&O!==a&&(M+=1,R.test(j.charAt(M)))){for(;R.test(j.charAt(M+1));)M+=1;j.charCodeAt(M+1)===i&&(M+=1)}D=["word",j.slice(Y,M+1),Y,M],Y=M;break}default:{O===s&&j.charCodeAt(Y+1)===y?(M=j.indexOf("*/",Y+2)+1,M===0&&(F||Re?M=j.length:ee("comment")),D=["comment",j.slice(Y,M+1),Y,M],Y=M):(T.lastIndex=Y+1,T.test(j),T.lastIndex===0?M=j.length-1:M=T.lastIndex-2,D=["word",j.slice(Y,M+1),Y,M],J.push(D),Y=M);break}}return Y++,D}function ye(je){ne.push(je)}return{back:ye,endOfFile:te,nextToken:ue,position:Q}},zI}var VI,jJ;function CF(){if(jJ)return VI;jJ=1;let t=ng();class e extends t{constructor(s){super(s),this.type="atrule"}append(...s){return this.proxyOf.nodes||(this.nodes=[]),super.append(...s)}prepend(...s){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...s)}}return VI=e,e.default=e,t.registerAtRule(e),VI}var HI,PJ;function WS(){if(PJ)return HI;PJ=1;let t=ng(),e,n;class s extends t{constructor(i){super(i),this.type="root",this.nodes||(this.nodes=[])}normalize(i,a,o){let l=super.normalize(i);if(a){if(o==="prepend")this.nodes.length>1?a.raws.before=this.nodes[1].raws.before:delete a.raws.before;else if(this.first!==a)for(let u of l)u.raws.before=a.raws.before}return l}removeChild(i,a){let o=this.index(i);return!a&&o===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[o].raws.before),super.removeChild(i)}toResult(i={}){return new e(new n,this,i).stringify()}}return s.registerLazyResult=r=>{e=r},s.registerProcessor=r=>{n=r},HI=s,s.default=s,t.registerRoot(s),HI}var GI,MJ;function wve(){if(MJ)return GI;MJ=1;let t={comma(e){return t.split(e,[","],!0)},space(e){let n=[" ",`
346`,"	"];return t.split(e,n)},split(e,n,s){let r=[],i="",a=!1,o=0,l=!1,u="",d=!1;for(let f of e)d?d=!1:f==="\\"?d=!0:l?f===u&&(l=!1):f==='"'||f==="'"?(l=!0,u=f):f==="("?o+=1:f===")"?o>0&&(o-=1):o===0&&n.includes(f)&&(a=!0),a?(i!==""&&r.push(i.trim()),i="",a=!1):i+=f;return(s||i!=="")&&r.push(i.trim()),r}};return GI=t,t.default=t,GI}var WI,DJ;function TF(){if(DJ)return WI;DJ=1;let t=ng(),e=wve();class n extends t{constructor(r){super(r),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return e.comma(this.selector)}set selectors(r){let i=this.selector?this.selector.match(/,\s*/):null,a=i?i[0]:","+this.raw("between","beforeOpen");this.selector=r.join(a)}}return WI=n,n.default=n,t.registerRule(n),WI}var qI,OJ;function Vst(){if(OJ)return qI;OJ=1;let t=_R(),e=zst(),n=CR(),s=CF(),r=WS(),i=TF();const a={empty:!0,space:!0};function o(u){for(let d=u.length-1;d>=0;d--){let f=u[d],p=f[3]||f[2];if(p)return p}}class l{constructor(d){this.input=d,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:d,start:{column:1,line:1,offset:0}}}atrule(d){let f=new s;f.name=d[1].slice(1),f.name===""&&this.unnamedAtrule(f,d),this.init(f,d[2]);let p,m,v,x=!1,y=!1,S=[],_=[];for(;!this.tokenizer.endOfFile();){if(d=this.tokenizer.nextToken(),p=d[0],p==="("||p==="["?_.push(p==="("?")":"]"):p==="{"&&_.length>0?_.push("}"):p===_[_.length-1]&&_.pop(),_.length===0)if(p===";"){f.source.end=this.getPosition(d[2]),f.source.end.offset++,this.semicolon=!0;break}else if(p==="{"){y=!0;break}else if(p==="}"){if(S.length>0){for(v=S.length-1,m=S[v];m&&m[0]==="space";)m=S[--v];m&&(f.source.end=this.getPosition(m[3]||m[2]),f.source.end.offset++)}this.end(d);break}else S.push(d);else S.push(d);if(this.tokenizer.endOfFile()){x=!0;break}}f.raws.between=this.spacesAndCommentsFromEnd(S),S.length?(f.raws.afterName=this.spacesAndCommentsFromStart(S),this.raw(f,"params",S),x&&(d=S[S.length-1],f.source.end=this.getPosition(d[3]||d[2]),f.source.end.offset++,this.spaces=f.raws.between,f.raws.between="")):(f.raws.afterName="",f.params=""),y&&(f.nodes=[],this.current=f)}checkMissedSemicolon(d){let f=this.colon(d);if(f===!1)return;let p=0,m;for(let v=f-1;v>=0&&(m=d[v],!(m[0]!=="space"&&(p+=1,p===2)));v--);throw this.input.error("Missed semicolon",m[0]==="word"?m[3]+1:m[2])}colon(d){let f=0,p,m,v;for(let[x,y]of d.entries()){if(p=y,m=p[0],m==="("&&(f+=1),m===")"&&(f-=1),f===0&&m===":")if(!v)this.doubleColon(p);else{if(v[0]==="word"&&v[1]==="progid")continue;return x}v=p}return!1}comment(d){let f=new n;this.init(f,d[2]),f.source.end=this.getPosition(d[3]||d[2]),f.source.end.offset++;let p=d[1].slice(2,-2);if(/^\s*$/.test(p))f.text="",f.raws.left=p,f.raws.right="";else{let m=p.match(/^(\s*)([^]*\S)(\s*)$/);f.text=m[2],f.raws.left=m[1],f.raws.right=m[3]}}createTokenizer(){this.tokenizer=e(this.input)}decl(d,f){let p=new t;this.init(p,d[0][2]);let m=d[d.length-1];for(m[0]===";"&&(this.semicolon=!0,d.pop()),p.source.end=this.getPosition(m[3]||m[2]||o(d)),p.source.end.offset++;d[0][0]!=="word";)d.length===1&&this.unknownWord(d),p.raws.before+=d.shift()[1];for(p.source.start=this.getPosition(d[0][2]),p.prop="";d.length;){let _=d[0][0];if(_===":"||_==="space"||_==="comment")break;p.prop+=d.shift()[1]}p.raws.between="";let v;for(;d.length;)if(v=d.shift(),v[0]===":"){p.raws.between+=v[1];break}else v[0]==="word"&&/\w/.test(v[1])&&this.unknownWord([v]),p.raws.between+=v[1];(p.prop[0]==="_"||p.prop[0]==="*")&&(p.raws.before+=p.prop[0],p.prop=p.prop.slice(1));let x=[],y;for(;d.length&&(y=d[0][0],!(y!=="space"&&y!=="comment"));)x.push(d.shift());this.precheckMissedSemicolon(d);for(let _=d.length-1;_>=0;_--){if(v=d[_],v[1].toLowerCase()==="!important"){p.important=!0;let E=this.stringFrom(d,_);E=this.spacesFromEnd(d)+E,E!==" !important"&&(p.raws.important=E);break}else if(v[1].toLowerCase()==="important"){let E=d.slice(0),T="";for(let k=_;k>0;k--){let R=E[k][0];if(T.trim().indexOf("!")===0&&R!=="space")break;T=E.pop()[1]+T}T.trim().indexOf("!")===0&&(p.important=!0,p.raws.important=T,d=E)}if(v[0]!=="space"&&v[0]!=="comment")break}d.some(_=>_[0]!=="space"&&_[0]!=="comment")&&(p.raws.between+=x.map(_=>_[1]).join(""),x=[]),this.raw(p,"value",x.concat(d),f),p.value.includes(":")&&!f&&this.checkMissedSemicolon(d)}doubleColon(d){throw this.input.error("Double colon",{offset:d[2]},{offset:d[2]+d[1].length})}emptyRule(d){let f=new i;this.init(f,d[2]),f.selector="",f.raws.between="",this.current=f}end(d){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(d[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(d)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(d){if(this.spaces+=d[1],this.current.nodes){let f=this.current.nodes[this.current.nodes.length-1];f&&f.type==="rule"&&!f.raws.ownSemicolon&&(f.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(d){let f=this.input.fromOffset(d);return{column:f.col,line:f.line,offset:d}}init(d,f){this.current.push(d),d.source={input:this.input,start:this.getPosition(f)},d.raws.before=this.spaces,this.spaces="",d.type!=="comment"&&(this.semicolon=!1)}other(d){let f=!1,p=null,m=!1,v=null,x=[],y=d[1].startsWith("--"),S=[],_=d;for(;_;){if(p=_[0],S.push(_),p==="("||p==="[")v||(v=_),x.push(p==="("?")":"]");else if(y&&m&&p==="{")v||(v=_),x.push("}");else if(x.length===0)if(p===";")if(m){this.decl(S,y);return}else break;else if(p==="{"){this.rule(S);return}else if(p==="}"){this.tokenizer.back(S.pop()),f=!0;break}else p===":"&&(m=!0);else p===x[x.length-1]&&(x.pop(),x.length===0&&(v=null));_=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(f=!0),x.length>0&&this.unclosedBracket(v),f&&m){if(!y)for(;S.length&&(_=S[S.length-1][0],!(_!=="space"&&_!=="comment"));)this.tokenizer.back(S.pop());this.decl(S,y)}else this.unknownWord(S)}parse(){let d;for(;!this.tokenizer.endOfFile();)switch(d=this.tokenizer.nextToken(),d[0]){case"space":this.spaces+=d[1];break;case";":this.freeSemicolon(d);break;case"}":this.end(d);break;case"comment":this.comment(d);break;case"at-word":this.atrule(d);break;case"{":this.emptyRule(d);break;default:this.other(d);break}this.endFile()}precheckMissedSemicolon(){}raw(d,f,p,m){let v,x,y=p.length,S="",_=!0,E,T;for(let k=0;k<y;k+=1)v=p[k],x=v[0],x==="space"&&k===y-1&&!m?_=!1:x==="comment"?(T=p[k-1]?p[k-1][0]:"empty",E=p[k+1]?p[k+1][0]:"empty",!a[T]&&!a[E]?S.slice(-1)===","?_=!1:S+=v[1]:_=!1):S+=v[1];if(!_){let k=p.reduce((R,I)=>R+I[1],"");d.raws[f]={raw:k,value:S}}d[f]=S}rule(d){d.pop();let f=new i;this.init(f,d[0][2]),f.raws.between=this.spacesAndCommentsFromEnd(d),this.raw(f,"selector",d),this.current=f}spacesAndCommentsFromEnd(d){let f,p="";for(;d.length&&(f=d[d.length-1][0],!(f!=="space"&&f!=="comment"));)p=d.pop()[1]+p;return p}spacesAndCommentsFromStart(d){let f,p="";for(;d.length&&(f=d[0][0],!(f!=="space"&&f!=="comment"));)p+=d.shift()[1];return p}spacesFromEnd(d){let f,p="";for(;d.length&&(f=d[d.length-1][0],f==="space");)p=d.pop()[1]+p;return p}stringFrom(d,f){let p="";for(let m=f;m<d.length;m++)p+=d[m][1];return d.splice(f,d.length-f),p}unclosedBlock(){let d=this.current.source.start;throw this.input.error("Unclosed block",d.line,d.column)}unclosedBracket(d){throw this.input.error("Unclosed bracket",{offset:d[2]},{offset:d[2]+1})}unexpectedClose(d){throw this.input.error("Unexpected }",{offset:d[2]},{offset:d[2]+1})}unknownWord(d){throw this.input.error("Unknown word",{offset:d[0][2]},{offset:d[0][2]+d[0][1].length})}unnamedAtrule(d,f){throw this.input.error("At-rule without name",{offset:f[2]},{offset:f[2]+f[1].length})}}return qI=l,qI}var KI,$J;function kF(){if($J)return KI;$J=1;let t=ng(),e=Vst(),n=ER();function s(r,i){let a=new n(r,i),o=new e(a);try{o.parse()}catch(l){throw l}return o.root}return KI=s,s.default=s,t.registerParse(s),KI}var YI,FJ;function _ve(){if(FJ)return YI;FJ=1;let{isClean:t,my:e}=wF(),n=bve(),s=SR(),r=ng(),i=_F(),a=EF(),o=kF(),l=WS();const u={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},f={Once:!0,postcssPlugin:!0,prepare:!0},p=0;function m(E){return typeof E=="object"&&typeof E.then=="function"}function v(E){let T=!1,k=u[E.type];return E.type==="decl"?T=E.prop.toLowerCase():E.type==="atrule"&&(T=E.name.toLowerCase()),T&&E.append?[k,k+"-"+T,p,k+"Exit",k+"Exit-"+T]:T?[k,k+"-"+T,k+"Exit",k+"Exit-"+T]:E.append?[k,p,k+"Exit"]:[k,k+"Exit"]}function x(E){let T;return E.type==="document"?T=["Document",p,"DocumentExit"]:E.type==="root"?T=["Root",p,"RootExit"]:T=v(E),{eventIndex:0,events:T,iterator:0,node:E,visitorIndex:0,visitors:[]}}
vendor: 5,030 bytes, line 346
346function y(E){return E[t]=!1,E.nodes&&E.nodes.forEach(T=>y(T)),E}let S={};class _{constructor(T,k,R){this.stringified=!1,this.processed=!1;let I;if(typeof k=="object"&&k!==null&&(k.type==="root"||k.type==="document"))I=y(k);else if(k instanceof _||k instanceof a)I=y(k.root),k.map&&(typeof R.map>"u"&&(R.map={}),R.map.inline||(R.map.inline=!1),R.map.prev=k.map);else{let A=o;R.syntax&&(A=R.syntax.parse),R.parser&&(A=R.parser),A.parse&&(A=A.parse);try{I=A(k,R)}catch(L){this.processed=!0,this.error=L}I&&!I[e]&&r.rebuild(I)}this.result=new a(T,I,R),this.helpers={...S,postcss:S,result:this.result},this.plugins=this.processor.plugins.map(A=>typeof A=="object"&&A.prepare?{...A,...A.prepare(this.result)}:A)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(T){return this.async().catch(T)}finally(T){return this.async().then(T,T)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(T,k){let R=this.result.lastPlugin;try{k&&k.addToError(T),this.error=T,T.name==="CssSyntaxError"&&!T.plugin?(T.plugin=R.postcssPlugin,T.setMessage()):R.postcssVersion}catch(I){console&&console.error&&console.error(I)}return T}prepareVisitors(){this.listeners={};let T=(k,R,I)=>{this.listeners[R]||(this.listeners[R]=[]),this.listeners[R].push([k,I])};for(let k of this.plugins)if(typeof k=="object")for(let R in k){if(!d[R]&&/^[A-Z]/.test(R))throw new Error(`Unknown event ${R} in ${k.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!f[R])if(typeof k[R]=="object")for(let I in k[R])I==="*"?T(k,R,k[R][I]):T(k,R+"-"+I.toLowerCase(),k[R][I]);else typeof k[R]=="function"&&T(k,R,k[R])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let T=0;T<this.plugins.length;T++){let k=this.plugins[T],R=this.runOnRoot(k);if(m(R))try{await R}catch(I){throw this.handleError(I)}}if(this.prepareVisitors(),this.hasListener){let T=this.result.root;for(;!T[t];){T[t]=!0;let k=[x(T)];for(;k.length>0;){let R=this.visitTick(k);if(m(R))try{await R}catch(I){let A=k[k.length-1].node;throw this.handleError(I,A)}}}if(this.listeners.OnceExit)for(let[k,R]of this.listeners.OnceExit){this.result.lastPlugin=k;try{if(T.type==="document"){let I=T.nodes.map(A=>R(A,this.helpers));await Promise.all(I)}else await R(T,this.helpers)}catch(I){throw this.handleError(I)}}}return this.processed=!0,this.stringify()}runOnRoot(T){this.result.lastPlugin=T;try{if(typeof T=="object"&&T.Once){if(this.result.root.type==="document"){let k=this.result.root.nodes.map(R=>T.Once(R,this.helpers));return m(k[0])?Promise.all(k):k}return T.Once(this.result.root,this.helpers)}else if(typeof T=="function")return T(this.result.root,this.result)}catch(k){throw this.handleError(k)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let T=this.result.opts,k=s;T.syntax&&(k=T.syntax.stringify),T.stringifier&&(k=T.stringifier),k.stringify&&(k=k.stringify);let I=new n(k,this.result.root,this.result.opts).generate();return this.result.css=I[0],this.result.map=I[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let T of this.plugins){let k=this.runOnRoot(T);if(m(k))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let T=this.result.root;for(;!T[t];)T[t]=!0,this.walkSync(T);if(this.listeners.OnceExit)if(T.type==="document")for(let k of T.nodes)this.visitSync(this.listeners.OnceExit,k);else this.visitSync(this.listeners.OnceExit,T)}return this.result}then(T,k){return this.async().then(T,k)}toString(){return this.css}visitSync(T,k){for(let[R,I]of T){this.result.lastPlugin=R;let A;try{A=I(k,this.helpers)}catch(L){throw this.handleError(L,k.proxyOf)}if(k.type!=="root"&&k.type!=="document"&&!k.parent)return!0;if(m(A))throw this.getAsyncError()}}visitTick(T){let k=T[T.length-1],{node:R,visitors:I}=k;if(R.type!=="root"&&R.type!=="document"&&!R.parent){T.pop();return}if(I.length>0&&k.visitorIndex<I.length){let[L,j]=I[k.visitorIndex];k.visitorIndex+=1,k.visitorIndex===I.length&&(k.visitors=[],k.visitorIndex=0),this.result.lastPlugin=L;try{return j(R.toProxy(),this.helpers)}catch(F){throw this.handleError(F,R)}}if(k.iterator!==0){let L=k.iterator,j;for(;j=R.nodes[R.indexes[L]];)if(R.indexes[L]+=1,!j[t]){j[t]=!0,T.push(x(j));return}k.iterator=0,delete R.indexes[L]}let A=k.events;for(;k.eventIndex<A.length;){let L=A[k.eventIndex];if(k.eventIndex+=1,L===p){R.nodes&&R.nodes.length&&(R[t]=!0,k.iterator=R.getIterator());return}else if(this.listeners[L]){k.visitors=this.listeners[L];return}}T.pop()}walkSync(T){T[t]=!0;let k=v(T);for(let R of k)if(R===p)T.nodes&&T.each(I=>{I[t]||this.walkSync(I)});else{let I=this.listeners[R];if(I&&this.visitSync(I,T.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}
vendor: 4,582 bytes, lines 346-348
346get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return _.registerPostcss=E=>{S=E},YI=_,_.default=_,l.registerLazyResult(_),i.registerLazyResult(_),YI}var ZI,UJ;function Hst(){if(UJ)return ZI;UJ=1;let t=bve(),e=SR(),n=kF();const s=EF();class r{constructor(a,o,l){o=o.toString(),this.stringified=!1,this._processor=a,this._css=o,this._opts=l,this._map=void 0;let u,d=e;this.result=new s(this._processor,u,this._opts),this.result.css=o;let f=this;Object.defineProperty(this.result,"root",{get(){return f.root}});let p=new t(d,u,this._opts,o);if(p.isMap()){let[m,v]=p.generate();m&&(this.result.css=m),v&&(this.result.map=v)}else p.clearAnnotation(),this.result.css=p.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(a){return this.async().catch(a)}finally(a){return this.async().then(a,a)}sync(){if(this.error)throw this.error;return this.result}then(a,o){return this.async().then(a,o)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let a,o=n;try{a=o(this._css,this._opts)}catch(l){this.error=l}if(this.error)throw this.error;return this._root=a,a}get[Symbol.toStringTag](){return"NoWorkResult"}}return ZI=r,r.default=r,ZI}var XI,BJ;function Gst(){if(BJ)return XI;BJ=1;let t=Hst(),e=_ve(),n=_F(),s=WS();class r{constructor(a=[]){this.version="8.4.38",this.plugins=this.normalize(a)}normalize(a){let o=[];for(let l of a)if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),typeof l=="object"&&Array.isArray(l.plugins))o=o.concat(l.plugins);else if(typeof l=="object"&&l.postcssPlugin)o.push(l);else if(typeof l=="function")o.push(l);else if(!(typeof l=="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin");return o}process(a,o={}){return!this.plugins.length&&!o.parser&&!o.stringifier&&!o.syntax?new t(this,a,o):new e(this,a,o)}use(a){return this.plugins=this.plugins.concat(this.normalize([a])),this}}return XI=r,r.default=r,s.registerProcessor(r),n.registerProcessor(r),XI}var QI,zJ;function Wst(){if(zJ)return QI;zJ=1;let t=_R(),e=yve(),n=CR(),s=CF(),r=ER(),i=WS(),a=TF();function o(l,u){if(Array.isArray(l))return l.map(p=>o(p));let{inputs:d,...f}=l;if(d){u=[];for(let p of d){let m={...p,__proto__:r.prototype};m.map&&(m.map={...m.map,__proto__:e.prototype}),u.push(m)}}if(f.nodes&&(f.nodes=l.nodes.map(p=>o(p,u))),f.source){let{inputId:p,...m}=f.source;f.source=m,p!=null&&(f.source.input=u[p])}if(f.type==="root")return new i(f);if(f.type==="decl")return new t(f);if(f.type==="rule")return new a(f);if(f.type==="comment")return new n(f);if(f.type==="atrule")return new s(f);throw new Error("Unknown node type: "+l.type)}return QI=o,o.default=o,QI}var JI,VJ;function qst(){if(VJ)return JI;VJ=1;let t=SF(),e=_R(),n=_ve(),s=ng(),r=Gst(),i=SR(),a=Wst(),o=_F(),l=Sve(),u=CR(),d=CF(),f=EF(),p=ER(),m=kF(),v=wve(),x=TF(),y=WS(),S=wR();function _(...E){return E.length===1&&Array.isArray(E[0])&&(E=E[0]),new r(E)}return _.plugin=function(T,k){let R=!1;function I(...L){console&&console.warn&&!R&&(R=!0,console.warn(T+`: postcss.plugin was deprecated. Migration guide:
347https://evilmartians.com/chronicles/postcss-8-plugin-migration`),r5.LANG&&r5.LANG.startsWith("cn")&&console.warn(T+`: 里面 postcss.plugin 被弃用. 迁移指南:
348https://www.w3ctech.com/topic/2226`));let j=k(...L);return j.postcssPlugin=T,j.postcssVersion=new r().version,j}let A;return Object.defineProperty(I,"postcss",{get(){return A||(A=I()),A}}),I.process=function(L,j,F){return _([I(F)]).process(L,j)},I},_.stringify=i,_.parse=m,_.fromJSON=a,_.list=v,_.comment=E=>new u(E),_.atRule=E=>new d(E),_.decl=E=>new e(E),_.rule=E=>new x(E),_.root=E=>new y(E),_.document=E=>new o(E),_.CssSyntaxError=t,_.Declaration=e,_.Container=s,_.Processor=r,_.Document=o,_.Comment=u,_.Warning=l,_.AtRule=d,_.Result=f,_.Input=p,_.Rule=x,_.Root=y,_.Node=S,n.registerPostcss(_),JI=_,_.default=_,JI}var Kst=qst();const sr=Dst(Kst);sr.stringify;sr.fromJSON;sr.plugin;sr.parse;sr.list;sr.document;sr.comment;sr.atRule;sr.rule;sr.decl;sr.root;sr.CssSyntaxError;sr.Declaration;sr.Container;sr.Processor;sr.Document;sr.Comment;sr.Warning;sr.AtRule;sr.Result;sr.Input;sr.Rule;sr.Root;sr.Node;
vendor: 34,640 bytes, lines 348-370
348const HJ={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Yst(t){let e=HJ[t.tagName]?HJ[t.tagName]:t.tagName;return e==="link"&&t.attributes._cssText&&(e="style"),e}function TR(t,e){const n=e==null?void 0:e.stylesWithHoverClass.get(t);if(n)return n;let s=t;try{s=sr([Pst,Mst]).process(t).css}catch(r){console.warn("Failed to adapt css for replay",r)}return e==null||e.stylesWithHoverClass.set(t,s),s}function GJ(){return{stylesWithHoverClass:new Map}}const Zst="rrweb-snapshot.rebuild() cannot rebuild into an unprotected browser document. Use rebuildIntoSandboxedIframe() or set UNSAFE_allowUnprotectedRebuild: true only when you accept the script-execution risk.",WJ="rrweb-snapshot.createSandboxedIframe() requires root to be connected to a document before creating a sandboxed iframe.",Eve=new WeakSet;function Xst(t){if(!t||t.tagName!=="IFRAME"||!("sandbox"in t))return!1;const e=Array.from(t.sandbox);return e.length===1&&e[0]==="allow-same-origin"}function Qst(t){if(t.UNSAFE_allowUnprotectedRebuild)return;const e=t.doc.defaultView;if(e&&!(Eve.has(t.doc)&&Xst(e.frameElement)))throw new Error(Zst)}function Jst(t,e,n,s){const r=[];for(const l of t.childNodes)l.type===Tr.Text&&r.push(l);const i=e.split("/* rr_split */");for(;i.length>1&&i.length>r.length;)i.splice(-2,2,i.slice(-2).join(""));let a="";n&&(a=TR(i.join(""),s));let o=0;for(let l=0;l<r.length&&l!==i.length;l++){const u=r[l];if(!n)u.textContent=i[l];else if(l<i.length-1){let d=o,f=i[l+1].length;f=Math.min(f,30);let p=!1;for(;f>2;f--){const m=i[l+1].substring(0,f),v=a.substring(o).indexOf(m);if(p=v!==-1,p){d+=v;break}}p||(d+=i[l].length),u.textContent=a.substring(o,d),o=d}else u.textContent=a.substring(o)}}function ert(t,e,n,s){const{doc:r,hackCss:i,cache:a}=s;t.childNodes.length?Jst(t,n,i,a):(i&&(n=TR(n,a)),e.appendChild(r.createTextNode(n)))}function trt(t,e){var n;const{doc:s,hackCss:r,cache:i}=e;switch(t.type){case Tr.Document:return s.implementation.createDocument(null,"",null);case Tr.DocumentType:return s.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case Tr.Element:{const a=Yst(t);let o;t.isSVG?o=s.createElementNS("http://www.w3.org/2000/svg",a):(t.isCustom&&((n=s.defaultView)!=null&&n.customElements)&&!s.defaultView.customElements.get(t.tagName)&&s.defaultView.customElements.define(t.tagName,class extends s.defaultView.HTMLElement{}),o=s.createElement(a));const l={};for(const u in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,u))continue;let d=t.attributes[u];if(!(a==="option"&&u==="selected"&&d===!1)&&d!==null){if(d===!0&&(d=""),u.startsWith("rr_")){l[u]=d;continue}if(typeof d=="string"){if(a==="style"&&u==="_cssText"){ert(t,o,d,e);continue}else if(a==="textarea"&&u==="value"){o.appendChild(s.createTextNode(d)),t.childNodes=[];continue}}try{if(t.isSVG&&u==="xlink:href")o.setAttributeNS("http://www.w3.org/1999/xlink",u,d.toString());else if(u==="onload"||u==="onclick"||u.substring(0,7)==="onmouse")o.setAttribute("_"+u,d.toString());else if(a==="meta"&&t.attributes["http-equiv"]==="Content-Security-Policy"&&u==="content"){o.setAttribute("csp-content",d.toString());continue}else a==="link"&&(t.attributes.rel==="preload"&&t.attributes.as==="script"||t.attributes.rel==="modulepreload")||a==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&Lst(t.attributes.href)==="js"||(a==="img"&&t.attributes.srcset&&t.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",t.attributes.srcset):o.setAttribute(u,d.toString()))}catch{}}}for(const u in l){const d=l[u];if(a==="canvas"&&u==="rr_dataURL"){const f=s.createElement("img");f.onload=()=>{const p=o.getContext("2d");p&&p.drawImage(f,0,0,f.width,f.height)},f.src=d.toString(),o.RRNodeType&&(o.rr_dataURL=d.toString())}else if(a==="img"&&u==="rr_dataURL"){const f=o;f.currentSrc.startsWith("data:")||(f.setAttribute("rrweb-original-src",t.attributes.src),f.src=d.toString())}if(u==="rr_width")o.style.setProperty("width",d.toString());else if(u==="rr_height")o.style.setProperty("height",d.toString());else if(u==="rr_mediaCurrentTime"&&typeof d=="number")o.currentTime=d;else if(u==="rr_mediaState")switch(d){case"played":o.play().catch(f=>console.warn("media playback error",f));break;case"paused":o.pause();break}else u==="rr_mediaPlaybackRate"&&typeof d=="number"?o.playbackRate=d:u==="rr_mediaMuted"&&typeof d=="boolean"?o.muted=d:u==="rr_mediaLoop"&&typeof d=="boolean"?o.loop=d:u==="rr_mediaVolume"&&typeof d=="number"?o.volume=d:u==="rr_open_mode"&&o.setAttribute("rr_open_mode",d)}if(t.isShadowHost)if(!o.shadowRoot)o.attachShadow({mode:"open"});else for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);return o}case Tr.Text:return t.isStyle&&r?s.createTextNode(TR(t.textContent,i)):s.createTextNode(t.textContent);case Tr.CDATA:return s.createCDATASection(t.textContent);case Tr.Comment:return s.createComment(t.textContent);default:return null}}function _b(t,e){const{doc:n,mirror:s,skipChild:r=!1,hackCss:i=!0,afterAppend:a,cache:o}=e;if(s.has(t.id)){const u=s.getNode(t.id),d=s.getMeta(u);if(Ist(d,t))return s.getNode(t.id)}let l=trt(t,{doc:n,hackCss:i,cache:o});if(!l)return null;if(t.rootId&&s.getNode(t.rootId)!==n&&s.replace(t.rootId,n),t.type===Tr.Document&&(n.close(),n.open(),t.compatMode==="BackCompat"&&t.childNodes&&t.childNodes[0].type!==Tr.DocumentType&&(t.childNodes[0].type===Tr.Element&&"xmlns"in t.childNodes[0].attributes&&t.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=n),s.add(l,t),(t.type===Tr.Document||t.type===Tr.Element)&&!r)for(const u of t.childNodes){const d=_b(u,{doc:n,mirror:s,skipChild:!1,hackCss:i,afterAppend:a,cache:o});if(!d){console.warn("Failed to rebuild",u);continue}if(u.isShadow&&Ast(l)&&l.shadowRoot)l.shadowRoot.appendChild(d);else if(t.type===Tr.Document&&u.type==Tr.Element){const f=d;let p=null;f.childNodes.forEach(m=>{m.nodeName==="BODY"&&(p=m)}),p?(f.removeChild(p),l.appendChild(d),f.appendChild(p)):l.appendChild(d)}else l.appendChild(d);a&&a(d,u.id)}return l}function nrt(t,e){function n(s){e(s)}for(const s of t.getIds())t.has(s)&&n(t.getNode(s))}function srt(t,e){const n=e.getMeta(t);if((n==null?void 0:n.type)!==Tr.Element)return;const s=t;for(const r in n.attributes){if(!(Object.prototype.hasOwnProperty.call(n.attributes,r)&&r.startsWith("rr_")))continue;const i=n.attributes[r];r==="rr_scrollLeft"&&(s.scrollLeft=i),r==="rr_scrollTop"&&(s.scrollTop=i)}}function rrt(t,e){Qst(e);const{doc:n,onVisit:s,hackCss:r=!0,afterAppend:i,cache:a,mirror:o=new gve}=e,l=_b(t,{doc:n,mirror:o,skipChild:!1,hackCss:r,afterAppend:i,cache:a});return nrt(o,u=>{s&&s(u),srt(u,o)}),l}function irt(t){var e;if(!t.root.isConnected)throw new Error(WJ);const n=t.root.ownerDocument.createElement("iframe");for(const[r,i]of Object.entries(t.iframeAttributes||{}))r!=="sandbox"&&n.setAttribute(r,i);n.setAttribute("sandbox","allow-same-origin"),t.root.appendChild(n);const s=n.contentDocument;if(!s||!n.contentWindow)throw(e=n.parentNode)==null||e.removeChild(n),new Error(WJ);return Eve.add(s),n}var art=Object.defineProperty,ort=(t,e,n)=>e in t?art(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Et=(t,e,n)=>ort(t,typeof e!="symbol"?e+"":e,n),lrt=Object.defineProperty,crt=(t,e,n)=>e in t?lrt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qJ=(t,e,n)=>crt(t,typeof e!="symbol"?e+"":e,n);Date.now().toString();let urt=class{constructor(){qJ(this,"idNodeMap",new Map),qJ(this,"nodeMetaMap",new WeakMap)}getId(e){var n;return e?((n=this.getMeta(e))==null?void 0:n.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function drt(){return new urt}function frt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function hrt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function s(){return this instanceof s?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(s){var r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:function(){return t[s]}})}),n}var yE={exports:{}},KJ;function prt(){if(KJ)return yE.exports;KJ=1;var t=String,e=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t}};return yE.exports=e(),yE.exports.createColors=e,yE.exports}const mrt={},grt=Object.freeze(Object.defineProperty({__proto__:null,default:mrt},Symbol.toStringTag,{value:"Module"})),Ql=hrt(grt);var eL,YJ;function RF(){if(YJ)return eL;YJ=1;let t=prt(),e=Ql;class n extends Error{constructor(r,i,a,o,l,u){super(r),this.name="CssSyntaxError",this.reason=r,l&&(this.file=l),o&&(this.source=o),u&&(this.plugin=u),typeof i<"u"&&typeof a<"u"&&(typeof i=="number"?(this.line=i,this.column=a):(this.line=i.line,this.column=i.column,this.endLine=a.line,this.endColumn=a.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let i=this.source;r==null&&(r=t.isColorSupported),e&&r&&(i=e(i));let a=i.split(/\r?\n/),o=Math.max(this.line-3,0),l=Math.min(this.line+2,a.length),u=String(l).length,d,f;if(r){let{bold:p,gray:m,red:v}=t.createColors(!0);d=x=>p(v(x)),f=x=>m(x)}else d=f=p=>p;return a.slice(o,l).map((p,m)=>{let v=o+1+m,x=" "+(" "+v).slice(-u)+" | ";if(v===this.line){let y=f(x.replace(/\d/g," "))+p.slice(0,this.column-1).replace(/[^\t]/g," ");return d(">")+f(x)+p+`
349 `+y+d("^")}return" "+f(x)+p}).join(`
350`)}toString(){let r=this.showSourceCode();return r&&(r=`
351
352`+r+`
353`),this.name+": "+this.message+r}}return eL=n,n.default=n,eL}var bE={},ZJ;function AF(){return ZJ||(ZJ=1,bE.isClean=Symbol("isClean"),bE.my=Symbol("my")),bE}var tL,XJ;function Cve(){if(XJ)return tL;XJ=1;const t={after:`
354`,beforeClose:`
355`,beforeComment:`
356`,beforeDecl:`
357`,beforeOpen:" ",beforeRule:`
358`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function e(s){return s[0].toUpperCase()+s.slice(1)}class n{constructor(r){this.builder=r}atrule(r,i){let a="@"+r.name,o=r.params?this.rawValue(r,"params"):"";if(typeof r.raws.afterName<"u"?a+=r.raws.afterName:o&&(a+=" "),r.nodes)this.block(r,a+o);else{let l=(r.raws.between||"")+(i?";":"");this.builder(a+o+l,r)}}beforeAfter(r,i){let a;r.type==="decl"?a=this.raw(r,null,"beforeDecl"):r.type==="comment"?a=this.raw(r,null,"beforeComment"):i==="before"?a=this.raw(r,null,"beforeRule"):a=this.raw(r,null,"beforeClose");let o=r.parent,l=0;for(;o&&o.type!=="root";)l+=1,o=o.parent;if(a.includes(`
359`)){let u=this.raw(r,null,"indent");if(u.length)for(let d=0;d<l;d++)a+=u}return a}block(r,i){let a=this.raw(r,"between","beforeOpen");this.builder(i+a+"{",r,"start");let o;r.nodes&&r.nodes.length?(this.body(r),o=this.raw(r,"after")):o=this.raw(r,"after","emptyBody"),o&&this.builder(o),this.builder("}",r,"end")}body(r){let i=r.nodes.length-1;for(;i>0&&r.nodes[i].type==="comment";)i-=1;let a=this.raw(r,"semicolon");for(let o=0;o<r.nodes.length;o++){let l=r.nodes[o],u=this.raw(l,"before");u&&this.builder(u),this.stringify(l,i!==o||a)}}comment(r){let i=this.raw(r,"left","commentLeft"),a=this.raw(r,"right","commentRight");this.builder("/*"+i+r.text+a+"*/",r)}decl(r,i){let a=this.raw(r,"between","colon"),o=r.prop+a+this.rawValue(r,"value");r.important&&(o+=r.raws.important||" !important"),i&&(o+=";"),this.builder(o,r)}document(r){this.body(r)}raw(r,i,a){let o;if(a||(a=i),i&&(o=r.raws[i],typeof o<"u"))return o;let l=r.parent;if(a==="before"&&(!l||l.type==="root"&&l.first===r||l&&l.type==="document"))return"";if(!l)return t[a];let u=r.root();if(u.rawCache||(u.rawCache={}),typeof u.rawCache[a]<"u")return u.rawCache[a];if(a==="before"||a==="after")return this.beforeAfter(r,a);{let d="raw"+e(a);this[d]?o=this[d](u,r):u.walk(f=>{if(o=f.raws[i],typeof o<"u")return!1})}return typeof o>"u"&&(o=t[a]),u.rawCache[a]=o,o}rawBeforeClose(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length>0&&typeof a.raws.after<"u")return i=a.raws.after,i.includes(`
360`)&&(i=i.replace(/[^\n]+$/,"")),!1}),i&&(i=i.replace(/\S/g,"")),i}rawBeforeComment(r,i){let a;return r.walkComments(o=>{if(typeof o.raws.before<"u")return a=o.raws.before,a.includes(`
361`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(i,null,"beforeDecl"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeDecl(r,i){let a;return r.walkDecls(o=>{if(typeof o.raws.before<"u")return a=o.raws.before,a.includes(`
362`)&&(a=a.replace(/[^\n]+$/,"")),!1}),typeof a>"u"?a=this.raw(i,null,"beforeRule"):a&&(a=a.replace(/\S/g,"")),a}rawBeforeOpen(r){let i;return r.walk(a=>{if(a.type!=="decl"&&(i=a.raws.between,typeof i<"u"))return!1}),i}rawBeforeRule(r){let i;return r.walk(a=>{if(a.nodes&&(a.parent!==r||r.first!==a)&&typeof a.raws.before<"u")return i=a.raws.before,i.includes(`
363`)&&(i=i.replace(/[^\n]+$/,"")),!1}),i&&(i=i.replace(/\S/g,"")),i}rawColon(r){let i;return r.walkDecls(a=>{if(typeof a.raws.between<"u")return i=a.raws.between.replace(/[^\s:]/g,""),!1}),i}rawEmptyBody(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length===0&&(i=a.raws.after,typeof i<"u"))return!1}),i}rawIndent(r){if(r.raws.indent)return r.raws.indent;let i;return r.walk(a=>{let o=a.parent;if(o&&o!==r&&o.parent&&o.parent===r&&typeof a.raws.before<"u"){let l=a.raws.before.split(`
364`);return i=l[l.length-1],i=i.replace(/\S/g,""),!1}}),i}rawSemicolon(r){let i;return r.walk(a=>{if(a.nodes&&a.nodes.length&&a.last.type==="decl"&&(i=a.raws.semicolon,typeof i<"u"))return!1}),i}rawValue(r,i){let a=r[i],o=r.raws[i];return o&&o.value===a?o.raw:a}root(r){this.body(r),r.raws.after&&this.builder(r.raws.after)}rule(r){this.block(r,this.rawValue(r,"selector")),r.raws.ownSemicolon&&this.builder(r.raws.ownSemicolon,r,"end")}stringify(r,i){if(!this[r.type])throw new Error("Unknown AST node type "+r.type+". Maybe you need to change PostCSS stringifier.");this[r.type](r,i)}}return tL=n,n.default=n,tL}var nL,QJ;function kR(){if(QJ)return nL;QJ=1;let t=Cve();function e(n,s){new t(s).stringify(n)}return nL=e,e.default=e,nL}var sL,JJ;function RR(){if(JJ)return sL;JJ=1;let{isClean:t,my:e}=AF(),n=RF(),s=Cve(),r=kR();function i(o,l){let u=new o.constructor;for(let d in o){if(!Object.prototype.hasOwnProperty.call(o,d)||d==="proxyCache")continue;let f=o[d],p=typeof f;d==="parent"&&p==="object"?l&&(u[d]=l):d==="source"?u[d]=f:Array.isArray(f)?u[d]=f.map(m=>i(m,u)):(p==="object"&&f!==null&&(f=i(f)),u[d]=f)}return u}class a{constructor(l={}){this.raws={},this[t]=!1,this[e]=!0;for(let u in l)if(u==="nodes"){this.nodes=[];for(let d of l[u])typeof d.clone=="function"?this.append(d.clone()):this.append(d)}else this[u]=l[u]}addToError(l){if(l.postcssNode=this,l.stack&&this.source&&/\n\s{4}at /.test(l.stack)){let u=this.source;l.stack=l.stack.replace(/\n\s{4}at /,`$&${u.input.from}:${u.start.line}:${u.start.column}$&`)}return l}after(l){return this.parent.insertAfter(this,l),this}assign(l={}){for(let u in l)this[u]=l[u];return this}before(l){return this.parent.insertBefore(this,l),this}cleanRaws(l){delete this.raws.before,delete this.raws.after,l||delete this.raws.between}clone(l={}){let u=i(this);for(let d in l)u[d]=l[d];return u}cloneAfter(l={}){let u=this.clone(l);return this.parent.insertAfter(this,u),u}cloneBefore(l={}){let u=this.clone(l);return this.parent.insertBefore(this,u),u}error(l,u={}){if(this.source){let{end:d,start:f}=this.rangeBy(u);return this.source.input.error(l,{column:f.column,line:f.line},{column:d.column,line:d.line},u)}return new n(l)}getProxyProcessor(){return{get(l,u){return u==="proxyOf"?l:u==="root"?()=>l.root().toProxy():l[u]},set(l,u,d){return l[u]===d||(l[u]=d,(u==="prop"||u==="value"||u==="name"||u==="params"||u==="important"||u==="text")&&l.markDirty()),!0}}}markDirty(){if(this[t]){this[t]=!1;let l=this;for(;l=l.parent;)l[t]=!1}}next(){if(!this.parent)return;let l=this.parent.index(this);return this.parent.nodes[l+1]}positionBy(l,u){let d=this.source.start;if(l.index)d=this.positionInside(l.index,u);else if(l.word){u=this.toString();let f=u.indexOf(l.word);f!==-1&&(d=this.positionInside(f,u))}return d}positionInside(l,u){let d=u||this.toString(),f=this.source.start.column,p=this.source.start.line;for(let m=0;m<l;m++)d[m]===`
365`?(f=1,p+=1):f+=1;return{column:f,line:p}}prev(){if(!this.parent)return;let l=this.parent.index(this);return this.parent.nodes[l-1]}rangeBy(l){let u={column:this.source.start.column,line:this.source.start.line},d=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:u.column+1,line:u.line};if(l.word){let f=this.toString(),p=f.indexOf(l.word);p!==-1&&(u=this.positionInside(p,f),d=this.positionInside(p+l.word.length,f))}else l.start?u={column:l.start.column,line:l.start.line}:l.index&&(u=this.positionInside(l.index)),l.end?d={column:l.end.column,line:l.end.line}:typeof l.endIndex=="number"?d=this.positionInside(l.endIndex):l.index&&(d=this.positionInside(l.index+1));return(d.line<u.line||d.line===u.line&&d.column<=u.column)&&(d={column:u.column+1,line:u.line}),{end:d,start:u}}raw(l,u){return new s().raw(this,l,u)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...l){if(this.parent){let u=this,d=!1;for(let f of l)f===this?d=!0:d?(this.parent.insertAfter(u,f),u=f):this.parent.insertBefore(u,f);d||this.remove()}return this}root(){let l=this;for(;l.parent&&l.parent.type!=="document";)l=l.parent;return l}toJSON(l,u){let d={},f=u==null;u=u||new Map;let p=0;for(let m in this){if(!Object.prototype.hasOwnProperty.call(this,m)||m==="parent"||m==="proxyCache")continue;let v=this[m];if(Array.isArray(v))d[m]=v.map(x=>typeof x=="object"&&x.toJSON?x.toJSON(null,u):x);else if(typeof v=="object"&&v.toJSON)d[m]=v.toJSON(null,u);else if(m==="source"){let x=u.get(v.input);x==null&&(x=p,u.set(v.input,p),p++),d[m]={end:v.end,inputId:x,start:v.start}}else d[m]=v}return f&&(d.inputs=[...u.keys()].map(m=>m.toJSON())),d}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(l=r){l.stringify&&(l=l.stringify);let u="";return l(this,d=>{u+=d}),u}warn(l,u,d){let f={node:this};for(let p in d)f[p]=d[p];return l.warn(u,f)}get proxyOf(){return this}}return sL=a,a.default=a,sL}var rL,eee;function AR(){if(eee)return rL;eee=1;let t=RR();class e extends t{constructor(s){s&&typeof s.value<"u"&&typeof s.value!="string"&&(s={...s,value:String(s.value)}),super(s),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}}return rL=e,e.default=e,rL}var iL,tee;function vrt(){if(tee)return iL;tee=1;let t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return iL={nanoid:(s=21)=>{let r="",i=s;for(;i--;)r+=t[Math.random()*64|0];return r},customAlphabet:(s,r=21)=>(i=r)=>{let a="",o=i;for(;o--;)a+=s[Math.random()*s.length|0];return a}},iL}var aL,nee;function Tve(){if(nee)return aL;nee=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Ql,{existsSync:n,readFileSync:s}=Ql,{dirname:r,join:i}=Ql;function a(l){return Buffer?Buffer.from(l,"base64").toString():window.atob(l)}class o{constructor(u,d){if(d.map===!1)return;this.loadAnnotation(u),this.inline=this.startWith(this.annotation,"data:");let f=d.map?d.map.prev:void 0,p=this.loadMap(d.from,f);!this.mapFile&&d.from&&(this.mapFile=d.from),this.mapFile&&(this.root=r(this.mapFile)),p&&(this.text=p)}consumer(){return this.consumerCache||(this.consumerCache=new t(this.text)),this.consumerCache}decodeInline(u){let d=/^data:application\/json;charset=utf-?8;base64,/,f=/^data:application\/json;base64,/,p=/^data:application\/json;charset=utf-?8,/,m=/^data:application\/json,/;if(p.test(u)||m.test(u))return decodeURIComponent(u.substr(RegExp.lastMatch.length));if(d.test(u)||f.test(u))return a(u.substr(RegExp.lastMatch.length));let v=u.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+v)}getAnnotationURL(u){return u.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(u){return typeof u!="object"?!1:typeof u.mappings=="string"||typeof u._mappings=="string"||Array.isArray(u.sections)}loadAnnotation(u){let d=u.match(/\/\*\s*# sourceMappingURL=/gm);if(!d)return;let f=u.lastIndexOf(d.pop()),p=u.indexOf("*/",f);f>-1&&p>-1&&(this.annotation=this.getAnnotationURL(u.substring(f,p)))}loadFile(u){if(this.root=r(u),n(u))return this.mapFile=u,s(u,"utf-8").toString().trim()}loadMap(u,d){if(d===!1)return!1;if(d){if(typeof d=="string")return d;if(typeof d=="function"){let f=d(u);if(f){let p=this.loadFile(f);if(!p)throw new Error("Unable to load previous source map: "+f.toString());return p}}else{if(d instanceof t)return e.fromSourceMap(d).toString();if(d instanceof e)return d.toString();if(this.isMap(d))return JSON.stringify(d);throw new Error("Unsupported previous source map format: "+d.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let f=this.annotation;return u&&(f=i(r(u),f)),this.loadFile(f)}}}startWith(u,d){return u?u.substr(0,d.length)===d:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return aL=o,o.default=o,aL}var oL,see;function NR(){if(see)return oL;see=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Ql,{fileURLToPath:n,pathToFileURL:s}=Ql,{isAbsolute:r,resolve:i}=Ql,{nanoid:a}=vrt(),o=Ql,l=RF(),u=Tve(),d=Symbol("fromOffsetCache"),f=!!(t&&e),p=!!(i&&r);class m{constructor(x,y={}){if(x===null||typeof x>"u"||typeof x=="object"&&!x.toString)throw new Error(`PostCSS received ${x} instead of CSS string`);if(this.css=x.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,y.from&&(!p||/^\w+:\/\//.test(y.from)||r(y.from)?this.file=y.from:this.file=i(y.from)),p&&f){let S=new u(this.css,y);if(S.text){this.map=S;let _=S.consumer().file;!this.file&&_&&(this.file=this.mapResolve(_))}}this.file||(this.id="<input css "+a(6)+">"),this.map&&(this.map.file=this.from)}error(x,y,S,_={}){let E,T,k;if(y&&typeof y=="object"){let I=y,A=S;if(typeof I.offset=="number"){let L=this.fromOffset(I.offset);y=L.line,S=L.col}else y=I.line,S=I.column;if(typeof A.offset=="number"){let L=this.fromOffset(A.offset);T=L.line,k=L.col}else T=A.line,k=A.column}else if(!S){let I=this.fromOffset(y);y=I.line,S=I.col}let R=this.origin(y,S,T,k);return R?E=new l(x,R.endLine===void 0?R.line:{column:R.column,line:R.line},R.endLine===void 0?R.column:{column:R.endColumn,line:R.endLine},R.source,R.file,_.plugin):E=new l(x,T===void 0?y:{column:S,line:y},T===void 0?S:{column:k,line:T},this.css,this.file,_.plugin),E.input={column:S,endColumn:k,endLine:T,line:y,source:this.css},this.file&&(s&&(E.input.url=s(this.file).toString()),E.input.file=this.file),E}fromOffset(x){let y,S;if(this[d])S=this[d];else{let E=this.css.split(`
366`);S=new Array(E.length);let T=0;for(let k=0,R=E.length;k<R;k++)S[k]=T,T+=E[k].length+1;this[d]=S}y=S[S.length-1];let _=0;if(x>=y)_=S.length-1;else{let E=S.length-2,T;for(;_<E;)if(T=_+(E-_>>1),x<S[T])E=T-1;else if(x>=S[T+1])_=T+1;else{_=T;break}}return{col:x-S[_]+1,line:_+1}}mapResolve(x){return/^\w+:\/\//.test(x)?x:i(this.map.consumer().sourceRoot||this.map.root||".",x)}origin(x,y,S,_){if(!this.map)return!1;let E=this.map.consumer(),T=E.originalPositionFor({column:y,line:x});if(!T.source)return!1;let k;typeof S=="number"&&(k=E.originalPositionFor({column:_,line:S}));let R;r(T.source)?R=s(T.source):R=new URL(T.source,this.map.consumer().sourceRoot||s(this.map.mapFile));let I={column:T.column,endColumn:k&&k.column,endLine:k&&k.line,line:T.line,url:R.toString()};if(R.protocol==="file:")if(n)I.file=n(R);else throw new Error("file: protocol is not available in this PostCSS build");let A=E.sourceContentFor(T.source);return A&&(I.source=A),I}toJSON(){let x={};for(let y of["hasBOM","css","file","id"])this[y]!=null&&(x[y]=this[y]);return this.map&&(x.map={...this.map},x.map.consumerCache&&(x.map.consumerCache=void 0)),x}get from(){return this.file||this.id}}return oL=m,m.default=m,o&&o.registerInput&&o.registerInput(m),oL}var lL,ree;function kve(){if(ree)return lL;ree=1;let{SourceMapConsumer:t,SourceMapGenerator:e}=Ql,{dirname:n,relative:s,resolve:r,sep:i}=Ql,{pathToFileURL:a}=Ql,o=NR(),l=!!(t&&e),u=!!(n&&r&&s&&i);class d{constructor(p,m,v,x){this.stringify=p,this.mapOpts=v.map||{},this.root=m,this.opts=v,this.css=x,this.originalCSS=x,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let p;this.isInline()?p="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?p=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?p=this.mapOpts.annotation(this.opts.to,this.root):p=this.outputFile()+".map";let m=`
367`;this.css.includes(`\r
368`)&&(m=`\r
369`),this.css+=m+"/*# sourceMappingURL="+p+" */"}applyPrevMaps(){for(let p of this.previous()){let m=this.toUrl(this.path(p.file)),v=p.root||n(p.file),x;this.mapOpts.sourcesContent===!1?(x=new t(p.text),x.sourcesContent&&(x.sourcesContent=null)):x=p.consumer(),this.map.applySourceMap(x,m,this.toUrl(this.path(v)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let p;for(let m=this.root.nodes.length-1;m>=0;m--)p=this.root.nodes[m],p.type==="comment"&&p.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(m)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let p="";return this.stringify(this.root,m=>{p+=m}),[p]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let p=this.previous()[0].consumer();p.file=this.outputFile(),this.map=e.fromSourceMap(p,{ignoreInvalidMapping:!0})}else this.map=new e({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new e({file:this.outputFile(),ignoreInvalidMapping:!0});let p=1,m=1,v="<no source>",x={generated:{column:0,line:0},original:{column:0,line:0},source:""},y,S;this.stringify(this.root,(_,E,T)=>{if(this.css+=_,E&&T!=="end"&&(x.generated.line=p,x.generated.column=m-1,E.source&&E.source.start?(x.source=this.sourcePath(E),x.original.line=E.source.start.line,x.original.column=E.source.start.column-1,this.map.addMapping(x)):(x.source=v,x.original.line=1,x.original.column=0,this.map.addMapping(x))),y=_.match(/\n/g),y?(p+=y.length,S=_.lastIndexOf(`
370`),m=_.length-S):m+=_.length,E&&T!=="start"){let k=E.parent||{raws:{}};(!(E.type==="decl"||E.type==="atrule"&&!E.nodes)||E!==k.last||k.raws.semicolon)&&(E.source&&E.source.end?(x.source=this.sourcePath(E),x.original.line=E.source.end.line,x.original.column=E.source.end.column-1,x.generated.line=p,x.generated.column=m-2,this.map.addMapping(x)):(x.source=v,x.original.line=1,x.original.column=0,x.generated.line=p,x.generated.column=m-1,this.map.addMapping(x)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(p=>p.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let p=this.mapOpts.annotation;return typeof p<"u"&&p!==!0?!1:this.previous().length?this.previous().some(m=>m.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(p=>p.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(p){if(this.mapOpts.absolute||p.charCodeAt(0)===60||/^\w+:\/\//.test(p))return p;let m=this.memoizedPaths.get(p);if(m)return m;let v=this.opts.to?n(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(v=n(r(v,this.mapOpts.annotation)));let x=s(v,p);return this.memoizedPaths.set(p,x),x}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(p=>{if(p.source&&p.source.input.map){let m=p.source.input.map;this.previousMaps.includes(m)||this.previousMaps.push(m)}});else{let p=new o(this.originalCSS,this.opts);p.map&&this.previousMaps.push(p.map)}return this.previousMaps}setSourcesContent(){let p={};if(this.root)this.root.walk(m=>{if(m.source){let v=m.source.input.from;if(v&&!p[v]){p[v]=!0;let x=this.usesFileUrls?this.toFileUrl(v):this.toUrl(this.path(v));this.map.setSourceContent(x,m.source.input.css)}}});else if(this.css){let m=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(m,this.css)}}sourcePath(p){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(p.source.input.from):this.toUrl(this.path(p.source.input.from))}toBase64(p){return Buffer?Buffer.from(p).toString("base64"):window.btoa(unescape(encodeURIComponent(p)))}toFileUrl(p){let m=this.memoizedFileURLs.get(p);if(m)return m;if(a){let v=a(p).toString();return this.memoizedFileURLs.set(p,v),v}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(p){let m=this.memoizedURLs.get(p);if(m)return m;i==="\\"&&(p=p.replace(/\\/g,"/"));let v=encodeURI(p).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(p,v),v}}return lL=d,lL}var cL,iee;function IR(){if(iee)return cL;iee=1;let t=RR();class e extends t{constructor(s){super(s),this.type="comment"}}return cL=e,e.default=e,cL}var uL,aee;function sg(){if(aee)return uL;aee=1;let{isClean:t,my:e}=AF(),n=AR(),s=IR(),r=RR(),i,a,o,l;function u(p){return p.map(m=>(m.nodes&&(m.nodes=u(m.nodes)),delete m.source,m))}function d(p){if(p[t]=!1,p.proxyOf.nodes)for(let m of p.proxyOf.nodes)d(m)}class f extends r{append(...m){for(let v of m){let x=this.normalize(v,this.last);for(let y of x)this.proxyOf.nodes.push(y)}return this.markDirty(),this}cleanRaws(m){if(super.cleanRaws(m),this.nodes)for(let v of this.nodes)v.cleanRaws(m)}each(m){if(!this.proxyOf.nodes)return;let v=this.getIterator(),x,y;for(;this.indexes[v]<this.proxyOf.nodes.length&&(x=this.indexes[v],y=m(this.proxyOf.nodes[x],x),y!==!1);)this.indexes[v]+=1;return delete this.indexes[v],y}every(m){return this.nodes.every(m)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let m=this.lastEach;return this.indexes[m]=0,m}getProxyProcessor(){return{get(m,v){return v==="proxyOf"?m:m[v]?v==="each"||typeof v=="string"&&v.startsWith("walk")?(...x)=>m[v](...x.map(y=>typeof y=="function"?(S,_)=>y(S.toProxy(),_):y)):v==="every"||v==="some"?x=>m[v]((y,...S)=>x(y.toProxy(),...S)):v==="root"?()=>m.root().toProxy():v==="nodes"?m.nodes.map(x=>x.toProxy()):v==="first"||v==="last"?m[v].toProxy():m[v]:m[v]},set(m,v,x){return m[v]===x||(m[v]=x,(v==="name"||v==="params"||v==="selector")&&m.markDirty()),!0}}}index(m){return typeof m=="number"?m:(m.proxyOf&&(m=m.proxyOf),this.proxyOf.nodes.indexOf(m))}insertAfter(m,v){let x=this.index(m),y=this.normalize(v,this.proxyOf.nodes[x]).reverse();x=this.index(m);for(let _ of y)this.proxyOf.nodes.splice(x+1,0,_);let S;for(let _ in this.indexes)S=this.indexes[_],x<S&&(this.indexes[_]=S+y.length);return this.markDirty(),this}insertBefore(m,v){let x=this.index(m),y=x===0?"prepend":!1,S=this.normalize(v,this.proxyOf.nodes[x],y).reverse();x=this.index(m);for(let E of S)this.proxyOf.nodes.splice(x,0,E);let _;for(let E in this.indexes)_=this.indexes[E],x<=_&&(this.indexes[E]=_+S.length);return this.markDirty(),this}normalize(m,v){if(typeof m=="string")m=u(i(m).nodes);else if(typeof m>"u")m=[];else if(Array.isArray(m)){m=m.slice(0);for(let y of m)y.parent&&y.parent.removeChild(y,"ignore")}else if(m.type==="root"&&this.type!=="document"){m=m.nodes.slice(0);for(let y of m)y.parent&&y.parent.removeChild(y,"ignore")}else if(m.type)m=[m];else if(m.prop){if(typeof m.value>"u")throw new Error("Value field is missed in node creation");typeof m.value!="string"&&(m.value=String(m.value)),m=[new n(m)]}else if(m.selector)m=[new a(m)];else if(m.name)m=[new o(m)];else if(m.text)m=[new s(m)];else throw new Error("Unknown node type in node creation");return m.map(y=>(y[e]||f.rebuild(y),y=y.proxyOf,y.parent&&y.parent.removeChild(y),y[t]&&d(y),typeof y.raws.before>"u"&&v&&typeof v.raws.before<"u"&&(y.raws.before=v.raws.before.replace(/\S/g,"")),y.parent=this.proxyOf,y))}prepend(...m){m=m.reverse();
vendor: 4,280 bytes, line 370
370for(let v of m){let x=this.normalize(v,this.first,"prepend").reverse();for(let y of x)this.proxyOf.nodes.unshift(y);for(let y in this.indexes)this.indexes[y]=this.indexes[y]+x.length}return this.markDirty(),this}push(m){return m.parent=this,this.proxyOf.nodes.push(m),this}removeAll(){for(let m of this.proxyOf.nodes)m.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(m){m=this.index(m),this.proxyOf.nodes[m].parent=void 0,this.proxyOf.nodes.splice(m,1);let v;for(let x in this.indexes)v=this.indexes[x],v>=m&&(this.indexes[x]=v-1);return this.markDirty(),this}replaceValues(m,v,x){return x||(x=v,v={}),this.walkDecls(y=>{v.props&&!v.props.includes(y.prop)||v.fast&&!y.value.includes(v.fast)||(y.value=y.value.replace(m,x))}),this.markDirty(),this}some(m){return this.nodes.some(m)}walk(m){return this.each((v,x)=>{let y;try{y=m(v,x)}catch(S){throw v.addToError(S)}return y!==!1&&v.walk&&(y=v.walk(m)),y})}walkAtRules(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="atrule"&&m.test(x.name))return v(x,y)}):this.walk((x,y)=>{if(x.type==="atrule"&&x.name===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="atrule")return v(x,y)}))}walkComments(m){return this.walk((v,x)=>{if(v.type==="comment")return m(v,x)})}walkDecls(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="decl"&&m.test(x.prop))return v(x,y)}):this.walk((x,y)=>{if(x.type==="decl"&&x.prop===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="decl")return v(x,y)}))}walkRules(m,v){return v?m instanceof RegExp?this.walk((x,y)=>{if(x.type==="rule"&&m.test(x.selector))return v(x,y)}):this.walk((x,y)=>{if(x.type==="rule"&&x.selector===m)return v(x,y)}):(v=m,this.walk((x,y)=>{if(x.type==="rule")return v(x,y)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return f.registerParse=p=>{i=p},f.registerRule=p=>{a=p},f.registerAtRule=p=>{o=p},f.registerRoot=p=>{l=p},uL=f,f.default=f,f.rebuild=p=>{p.type==="atrule"?Object.setPrototypeOf(p,o.prototype):p.type==="rule"?Object.setPrototypeOf(p,a.prototype):p.type==="decl"?Object.setPrototypeOf(p,n.prototype):p.type==="comment"?Object.setPrototypeOf(p,s.prototype):p.type==="root"&&Object.setPrototypeOf(p,l.prototype),p[e]=!0,p.nodes&&p.nodes.forEach(m=>{f.rebuild(m)})},uL}var dL,oee;function NF(){if(oee)return dL;oee=1;let t=sg(),e,n;class s extends t{constructor(i){super({type:"document",...i}),this.nodes||(this.nodes=[])}toResult(i={}){return new e(new n,this,i).stringify()}}return s.registerLazyResult=r=>{e=r},s.registerProcessor=r=>{n=r},dL=s,s.default=s,dL}var fL,lee;function Rve(){if(lee)return fL;lee=1;class t{constructor(n,s={}){if(this.type="warning",this.text=n,s.node&&s.node.source){let r=s.node.rangeBy(s);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in s)this[r]=s[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return fL=t,t.default=t,fL}var hL,cee;function IF(){if(cee)return hL;cee=1;let t=Rve();class e{constructor(s,r,i){this.processor=s,this.messages=[],this.root=r,this.opts=i,this.css=void 0,this.map=void 0}toString(){return this.css}warn(s,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let i=new t(s,r);return this.messages.push(i),i}warnings(){return this.messages.filter(s=>s.type==="warning")}get content(){return this.css}}return hL=e,e.default=e,hL}var pL,uee;function xrt(){if(uee)return pL;uee=1;const t=39,e=34,n=92,s=47,r=10,i=32,a=12,o=9,l=13,u=91,d=93,f=40,p=41,m=123,v=125,x=59,y=42,S=58,_=64,E=/[\t\n\f\r "#'()/;[\\\]{}]/g,T=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,k=/.[\r\n"'(/\\]/,R=/[\da-f]/i;return pL=function(A,L={}){let j=A.css.valueOf(),F=L.ignoreErrors,O,M,U,G,$,V,B,q,z,D,K=j.length,Y=0,J=[],ne=[];function Q(){return Y}function ee(je){throw A.error("Unclosed "+je,Y)}function te(){return ne.length===0&&Y>=K}function ue(je){if(ne.length)return ne.pop();if(Y>=K)return;let Re=je?je.ignoreUnclosed:!1;switch(O=j.charCodeAt(Y),O){case r:case i:case o:case l:case a:{M=Y;do M+=1,O=j.charCodeAt(M);
vendor: 11,845 bytes, lines 370-371
370while(O===i||O===r||O===o||O===l||O===a);D=["space",j.slice(Y,M)],Y=M-1;break}case u:case d:case m:case v:case S:case x:case p:{let me=String.fromCharCode(O);D=[me,me,Y];break}case f:{if(q=J.length?J.pop()[1]:"",z=j.charCodeAt(Y+1),q==="url"&&z!==t&&z!==e&&z!==i&&z!==r&&z!==o&&z!==a&&z!==l){M=Y;do{if(V=!1,M=j.indexOf(")",M+1),M===-1)if(F||Re){M=Y;break}else ee("bracket");for(B=M;j.charCodeAt(B-1)===n;)B-=1,V=!V}while(V);D=["brackets",j.slice(Y,M+1),Y,M],Y=M}else M=j.indexOf(")",Y+1),G=j.slice(Y,M+1),M===-1||k.test(G)?D=["(","(",Y]:(D=["brackets",G,Y,M],Y=M);break}case t:case e:{U=O===t?"'":'"',M=Y;do{if(V=!1,M=j.indexOf(U,M+1),M===-1)if(F||Re){M=Y+1;break}else ee("string");for(B=M;j.charCodeAt(B-1)===n;)B-=1,V=!V}while(V);D=["string",j.slice(Y,M+1),Y,M],Y=M;break}case _:{E.lastIndex=Y+1,E.test(j),E.lastIndex===0?M=j.length-1:M=E.lastIndex-2,D=["at-word",j.slice(Y,M+1),Y,M],Y=M;break}case n:{for(M=Y,$=!0;j.charCodeAt(M+1)===n;)M+=1,$=!$;if(O=j.charCodeAt(M+1),$&&O!==s&&O!==i&&O!==r&&O!==o&&O!==l&&O!==a&&(M+=1,R.test(j.charAt(M)))){for(;R.test(j.charAt(M+1));)M+=1;j.charCodeAt(M+1)===i&&(M+=1)}D=["word",j.slice(Y,M+1),Y,M],Y=M;break}default:{O===s&&j.charCodeAt(Y+1)===y?(M=j.indexOf("*/",Y+2)+1,M===0&&(F||Re?M=j.length:ee("comment")),D=["comment",j.slice(Y,M+1),Y,M],Y=M):(T.lastIndex=Y+1,T.test(j),T.lastIndex===0?M=j.length-1:M=T.lastIndex-2,D=["word",j.slice(Y,M+1),Y,M],J.push(D),Y=M);break}}return Y++,D}function ye(je){ne.push(je)}return{back:ye,endOfFile:te,nextToken:ue,position:Q}},pL}var mL,dee;function LF(){if(dee)return mL;dee=1;let t=sg();class e extends t{constructor(s){super(s),this.type="atrule"}append(...s){return this.proxyOf.nodes||(this.nodes=[]),super.append(...s)}prepend(...s){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...s)}}return mL=e,e.default=e,t.registerAtRule(e),mL}var gL,fee;function qS(){if(fee)return gL;fee=1;let t=sg(),e,n;class s extends t{constructor(i){super(i),this.type="root",this.nodes||(this.nodes=[])}normalize(i,a,o){let l=super.normalize(i);if(a){if(o==="prepend")this.nodes.length>1?a.raws.before=this.nodes[1].raws.before:delete a.raws.before;else if(this.first!==a)for(let u of l)u.raws.before=a.raws.before}return l}removeChild(i,a){let o=this.index(i);return!a&&o===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[o].raws.before),super.removeChild(i)}toResult(i={}){return new e(new n,this,i).stringify()}}return s.registerLazyResult=r=>{e=r},s.registerProcessor=r=>{n=r},gL=s,s.default=s,t.registerRoot(s),gL}var vL,hee;function Ave(){if(hee)return vL;hee=1;let t={comma(e){return t.split(e,[","],!0)},space(e){let n=[" ",`
371`,"	"];return t.split(e,n)},split(e,n,s){let r=[],i="",a=!1,o=0,l=!1,u="",d=!1;for(let f of e)d?d=!1:f==="\\"?d=!0:l?f===u&&(l=!1):f==='"'||f==="'"?(l=!0,u=f):f==="("?o+=1:f===")"?o>0&&(o-=1):o===0&&n.includes(f)&&(a=!0),a?(i!==""&&r.push(i.trim()),i="",a=!1):i+=f;return(s||i!=="")&&r.push(i.trim()),r}};return vL=t,t.default=t,vL}var xL,pee;function jF(){if(pee)return xL;pee=1;let t=sg(),e=Ave();class n extends t{constructor(r){super(r),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return e.comma(this.selector)}set selectors(r){let i=this.selector?this.selector.match(/,\s*/):null,a=i?i[0]:","+this.raw("between","beforeOpen");this.selector=r.join(a)}}return xL=n,n.default=n,t.registerRule(n),xL}var yL,mee;function yrt(){if(mee)return yL;mee=1;let t=AR(),e=xrt(),n=IR(),s=LF(),r=qS(),i=jF();const a={empty:!0,space:!0};function o(u){for(let d=u.length-1;d>=0;d--){let f=u[d],p=f[3]||f[2];if(p)return p}}class l{constructor(d){this.input=d,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:d,start:{column:1,line:1,offset:0}}}atrule(d){let f=new s;f.name=d[1].slice(1),f.name===""&&this.unnamedAtrule(f,d),this.init(f,d[2]);let p,m,v,x=!1,y=!1,S=[],_=[];for(;!this.tokenizer.endOfFile();){if(d=this.tokenizer.nextToken(),p=d[0],p==="("||p==="["?_.push(p==="("?")":"]"):p==="{"&&_.length>0?_.push("}"):p===_[_.length-1]&&_.pop(),_.length===0)if(p===";"){f.source.end=this.getPosition(d[2]),f.source.end.offset++,this.semicolon=!0;break}else if(p==="{"){y=!0;break}else if(p==="}"){if(S.length>0){for(v=S.length-1,m=S[v];m&&m[0]==="space";)m=S[--v];m&&(f.source.end=this.getPosition(m[3]||m[2]),f.source.end.offset++)}this.end(d);break}else S.push(d);else S.push(d);if(this.tokenizer.endOfFile()){x=!0;break}}f.raws.between=this.spacesAndCommentsFromEnd(S),S.length?(f.raws.afterName=this.spacesAndCommentsFromStart(S),this.raw(f,"params",S),x&&(d=S[S.length-1],f.source.end=this.getPosition(d[3]||d[2]),f.source.end.offset++,this.spaces=f.raws.between,f.raws.between="")):(f.raws.afterName="",f.params=""),y&&(f.nodes=[],this.current=f)}checkMissedSemicolon(d){let f=this.colon(d);if(f===!1)return;let p=0,m;for(let v=f-1;v>=0&&(m=d[v],!(m[0]!=="space"&&(p+=1,p===2)));v--);throw this.input.error("Missed semicolon",m[0]==="word"?m[3]+1:m[2])}colon(d){let f=0,p,m,v;for(let[x,y]of d.entries()){if(p=y,m=p[0],m==="("&&(f+=1),m===")"&&(f-=1),f===0&&m===":")if(!v)this.doubleColon(p);else{if(v[0]==="word"&&v[1]==="progid")continue;return x}v=p}return!1}comment(d){let f=new n;this.init(f,d[2]),f.source.end=this.getPosition(d[3]||d[2]),f.source.end.offset++;let p=d[1].slice(2,-2);if(/^\s*$/.test(p))f.text="",f.raws.left=p,f.raws.right="";else{let m=p.match(/^(\s*)([^]*\S)(\s*)$/);f.text=m[2],f.raws.left=m[1],f.raws.right=m[3]}}createTokenizer(){this.tokenizer=e(this.input)}decl(d,f){let p=new t;this.init(p,d[0][2]);let m=d[d.length-1];for(m[0]===";"&&(this.semicolon=!0,d.pop()),p.source.end=this.getPosition(m[3]||m[2]||o(d)),p.source.end.offset++;d[0][0]!=="word";)d.length===1&&this.unknownWord(d),p.raws.before+=d.shift()[1];for(p.source.start=this.getPosition(d[0][2]),p.prop="";d.length;){let _=d[0][0];if(_===":"||_==="space"||_==="comment")break;p.prop+=d.shift()[1]}p.raws.between="";let v;for(;d.length;)if(v=d.shift(),v[0]===":"){p.raws.between+=v[1];break}else v[0]==="word"&&/\w/.test(v[1])&&this.unknownWord([v]),p.raws.between+=v[1];(p.prop[0]==="_"||p.prop[0]==="*")&&(p.raws.before+=p.prop[0],p.prop=p.prop.slice(1));let x=[],y;for(;d.length&&(y=d[0][0],!(y!=="space"&&y!=="comment"));)x.push(d.shift());this.precheckMissedSemicolon(d);for(let _=d.length-1;_>=0;_--){if(v=d[_],v[1].toLowerCase()==="!important"){p.important=!0;let E=this.stringFrom(d,_);E=this.spacesFromEnd(d)+E,E!==" !important"&&(p.raws.important=E);break}else if(v[1].toLowerCase()==="important"){let E=d.slice(0),T="";for(let k=_;k>0;k--){let R=E[k][0];if(T.trim().indexOf("!")===0&&R!=="space")break;T=E.pop()[1]+T}T.trim().indexOf("!")===0&&(p.important=!0,p.raws.important=T,d=E)}if(v[0]!=="space"&&v[0]!=="comment")break}d.some(_=>_[0]!=="space"&&_[0]!=="comment")&&(p.raws.between+=x.map(_=>_[1]).join(""),x=[]),this.raw(p,"value",x.concat(d),f),p.value.includes(":")&&!f&&this.checkMissedSemicolon(d)}doubleColon(d){throw this.input.error("Double colon",{offset:d[2]},{offset:d[2]+d[1].length})}emptyRule(d){let f=new i;this.init(f,d[2]),f.selector="",f.raws.between="",this.current=f}end(d){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(d[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(d)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(d){if(this.spaces+=d[1],this.current.nodes){let f=this.current.nodes[this.current.nodes.length-1];f&&f.type==="rule"&&!f.raws.ownSemicolon&&(f.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(d){let f=this.input.fromOffset(d);return{column:f.col,line:f.line,offset:d}}init(d,f){this.current.push(d),d.source={input:this.input,start:this.getPosition(f)},d.raws.before=this.spaces,this.spaces="",d.type!=="comment"&&(this.semicolon=!1)}other(d){let f=!1,p=null,m=!1,v=null,x=[],y=d[1].startsWith("--"),S=[],_=d;for(;_;){if(p=_[0],S.push(_),p==="("||p==="[")v||(v=_),x.push(p==="("?")":"]");else if(y&&m&&p==="{")v||(v=_),x.push("}");else if(x.length===0)if(p===";")if(m){this.decl(S,y);return}else break;else if(p==="{"){this.rule(S);return}else if(p==="}"){this.tokenizer.back(S.pop()),f=!0;break}else p===":"&&(m=!0);else p===x[x.length-1]&&(x.pop(),x.length===0&&(v=null));_=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(f=!0),x.length>0&&this.unclosedBracket(v),f&&m){if(!y)for(;S.length&&(_=S[S.length-1][0],!(_!=="space"&&_!=="comment"));)this.tokenizer.back(S.pop());this.decl(S,y)}else this.unknownWord(S)}parse(){let d;for(;!this.tokenizer.endOfFile();)switch(d=this.tokenizer.nextToken(),d[0]){case"space":this.spaces+=d[1];break;case";":this.freeSemicolon(d);break;case"}":this.end(d);break;case"comment":this.comment(d);break;case"at-word":this.atrule(d);break;case"{":this.emptyRule(d);break;default:this.other(d);break}this.endFile()}precheckMissedSemicolon(){}raw(d,f,p,m){let v,x,y=p.length,S="",_=!0,E,T;for(let k=0;k<y;k+=1)v=p[k],x=v[0],x==="space"&&k===y-1&&!m?_=!1:x==="comment"?(T=p[k-1]?p[k-1][0]:"empty",E=p[k+1]?p[k+1][0]:"empty",!a[T]&&!a[E]?S.slice(-1)===","?_=!1:S+=v[1]:_=!1):S+=v[1];if(!_){let k=p.reduce((R,I)=>R+I[1],"");d.raws[f]={raw:k,value:S}}d[f]=S}rule(d){d.pop();let f=new i;this.init(f,d[0][2]),f.raws.between=this.spacesAndCommentsFromEnd(d),this.raw(f,"selector",d),this.current=f}spacesAndCommentsFromEnd(d){let f,p="";for(;d.length&&(f=d[d.length-1][0],!(f!=="space"&&f!=="comment"));)p=d.pop()[1]+p;return p}spacesAndCommentsFromStart(d){let f,p="";for(;d.length&&(f=d[0][0],!(f!=="space"&&f!=="comment"));)p+=d.shift()[1];return p}spacesFromEnd(d){let f,p="";for(;d.length&&(f=d[d.length-1][0],f==="space");)p=d.pop()[1]+p;return p}stringFrom(d,f){let p="";for(let m=f;m<d.length;m++)p+=d[m][1];return d.splice(f,d.length-f),p}unclosedBlock(){let d=this.current.source.start;throw this.input.error("Unclosed block",d.line,d.column)}unclosedBracket(d){throw this.input.error("Unclosed bracket",{offset:d[2]},{offset:d[2]+1})}unexpectedClose(d){throw this.input.error("Unexpected }",{offset:d[2]},{offset:d[2]+1})}unknownWord(d){throw this.input.error("Unknown word",{offset:d[0][2]},{offset:d[0][2]+d[0][1].length})}unnamedAtrule(d,f){throw this.input.error("At-rule without name",{offset:f[2]},{offset:f[2]+f[1].length})}}return yL=l,yL}var bL,gee;function PF(){if(gee)return bL;gee=1;let t=sg(),e=yrt(),n=NR();function s(r,i){let a=new n(r,i),o=new e(a);try{o.parse()}catch(l){throw l}return o.root}return bL=s,s.default=s,t.registerParse(s),bL}var SL,vee;function Nve(){if(vee)return SL;vee=1;let{isClean:t,my:e}=AF(),n=kve(),s=kR(),r=sg(),i=NF(),a=IF(),o=PF(),l=qS();const u={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},f={Once:!0,postcssPlugin:!0,prepare:!0},p=0;function m(E){return typeof E=="object"&&typeof E.then=="function"}function v(E){let T=!1,k=u[E.type];return E.type==="decl"?T=E.prop.toLowerCase():E.type==="atrule"&&(T=E.name.toLowerCase()),T&&E.append?[k,k+"-"+T,p,k+"Exit",k+"Exit-"+T]:T?[k,k+"-"+T,k+"Exit",k+"Exit-"+T]:E.append?[k,p,k+"Exit"]:[k,k+"Exit"]}function x(E){let T;return E.type==="document"?T=["Document",p,"DocumentExit"]:E.type==="root"?T=["Root",p,"RootExit"]:T=v(E),{eventIndex:0,events:T,iterator:0,node:E,visitorIndex:0,visitors:[]}}
vendor: 5,030 bytes, line 371
371function y(E){return E[t]=!1,E.nodes&&E.nodes.forEach(T=>y(T)),E}let S={};class _{constructor(T,k,R){this.stringified=!1,this.processed=!1;let I;if(typeof k=="object"&&k!==null&&(k.type==="root"||k.type==="document"))I=y(k);else if(k instanceof _||k instanceof a)I=y(k.root),k.map&&(typeof R.map>"u"&&(R.map={}),R.map.inline||(R.map.inline=!1),R.map.prev=k.map);else{let A=o;R.syntax&&(A=R.syntax.parse),R.parser&&(A=R.parser),A.parse&&(A=A.parse);try{I=A(k,R)}catch(L){this.processed=!0,this.error=L}I&&!I[e]&&r.rebuild(I)}this.result=new a(T,I,R),this.helpers={...S,postcss:S,result:this.result},this.plugins=this.processor.plugins.map(A=>typeof A=="object"&&A.prepare?{...A,...A.prepare(this.result)}:A)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(T){return this.async().catch(T)}finally(T){return this.async().then(T,T)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(T,k){let R=this.result.lastPlugin;try{k&&k.addToError(T),this.error=T,T.name==="CssSyntaxError"&&!T.plugin?(T.plugin=R.postcssPlugin,T.setMessage()):R.postcssVersion}catch(I){console&&console.error&&console.error(I)}return T}prepareVisitors(){this.listeners={};let T=(k,R,I)=>{this.listeners[R]||(this.listeners[R]=[]),this.listeners[R].push([k,I])};for(let k of this.plugins)if(typeof k=="object")for(let R in k){if(!d[R]&&/^[A-Z]/.test(R))throw new Error(`Unknown event ${R} in ${k.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!f[R])if(typeof k[R]=="object")for(let I in k[R])I==="*"?T(k,R,k[R][I]):T(k,R+"-"+I.toLowerCase(),k[R][I]);else typeof k[R]=="function"&&T(k,R,k[R])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let T=0;T<this.plugins.length;T++){let k=this.plugins[T],R=this.runOnRoot(k);if(m(R))try{await R}catch(I){throw this.handleError(I)}}if(this.prepareVisitors(),this.hasListener){let T=this.result.root;for(;!T[t];){T[t]=!0;let k=[x(T)];for(;k.length>0;){let R=this.visitTick(k);if(m(R))try{await R}catch(I){let A=k[k.length-1].node;throw this.handleError(I,A)}}}if(this.listeners.OnceExit)for(let[k,R]of this.listeners.OnceExit){this.result.lastPlugin=k;try{if(T.type==="document"){let I=T.nodes.map(A=>R(A,this.helpers));await Promise.all(I)}else await R(T,this.helpers)}catch(I){throw this.handleError(I)}}}return this.processed=!0,this.stringify()}runOnRoot(T){this.result.lastPlugin=T;try{if(typeof T=="object"&&T.Once){if(this.result.root.type==="document"){let k=this.result.root.nodes.map(R=>T.Once(R,this.helpers));return m(k[0])?Promise.all(k):k}return T.Once(this.result.root,this.helpers)}else if(typeof T=="function")return T(this.result.root,this.result)}catch(k){throw this.handleError(k)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let T=this.result.opts,k=s;T.syntax&&(k=T.syntax.stringify),T.stringifier&&(k=T.stringifier),k.stringify&&(k=k.stringify);let I=new n(k,this.result.root,this.result.opts).generate();return this.result.css=I[0],this.result.map=I[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let T of this.plugins){let k=this.runOnRoot(T);if(m(k))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let T=this.result.root;for(;!T[t];)T[t]=!0,this.walkSync(T);if(this.listeners.OnceExit)if(T.type==="document")for(let k of T.nodes)this.visitSync(this.listeners.OnceExit,k);else this.visitSync(this.listeners.OnceExit,T)}return this.result}then(T,k){return this.async().then(T,k)}toString(){return this.css}visitSync(T,k){for(let[R,I]of T){this.result.lastPlugin=R;let A;try{A=I(k,this.helpers)}catch(L){throw this.handleError(L,k.proxyOf)}if(k.type!=="root"&&k.type!=="document"&&!k.parent)return!0;if(m(A))throw this.getAsyncError()}}visitTick(T){let k=T[T.length-1],{node:R,visitors:I}=k;if(R.type!=="root"&&R.type!=="document"&&!R.parent){T.pop();return}if(I.length>0&&k.visitorIndex<I.length){let[L,j]=I[k.visitorIndex];k.visitorIndex+=1,k.visitorIndex===I.length&&(k.visitors=[],k.visitorIndex=0),this.result.lastPlugin=L;try{return j(R.toProxy(),this.helpers)}catch(F){throw this.handleError(F,R)}}if(k.iterator!==0){let L=k.iterator,j;for(;j=R.nodes[R.indexes[L]];)if(R.indexes[L]+=1,!j[t]){j[t]=!0,T.push(x(j));return}k.iterator=0,delete R.indexes[L]}let A=k.events;for(;k.eventIndex<A.length;){let L=A[k.eventIndex];if(k.eventIndex+=1,L===p){R.nodes&&R.nodes.length&&(R[t]=!0,k.iterator=R.getIterator());return}else if(this.listeners[L]){k.visitors=this.listeners[L];return}}T.pop()}walkSync(T){T[t]=!0;let k=v(T);for(let R of k)if(R===p)T.nodes&&T.each(I=>{I[t]||this.walkSync(I)});else{let I=this.listeners[R];if(I&&this.visitSync(I,T.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}
vendor: 4,842 bytes, lines 371-373
371get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return _.registerPostcss=E=>{S=E},SL=_,_.default=_,l.registerLazyResult(_),i.registerLazyResult(_),SL}var wL,xee;function brt(){if(xee)return wL;xee=1;let t=kve(),e=kR(),n=PF();const s=IF();class r{constructor(a,o,l){o=o.toString(),this.stringified=!1,this._processor=a,this._css=o,this._opts=l,this._map=void 0;let u,d=e;this.result=new s(this._processor,u,this._opts),this.result.css=o;let f=this;Object.defineProperty(this.result,"root",{get(){return f.root}});let p=new t(d,u,this._opts,o);if(p.isMap()){let[m,v]=p.generate();m&&(this.result.css=m),v&&(this.result.map=v)}else p.clearAnnotation(),this.result.css=p.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(a){return this.async().catch(a)}finally(a){return this.async().then(a,a)}sync(){if(this.error)throw this.error;return this.result}then(a,o){return this.async().then(a,o)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let a,o=n;try{a=o(this._css,this._opts)}catch(l){this.error=l}if(this.error)throw this.error;return this._root=a,a}get[Symbol.toStringTag](){return"NoWorkResult"}}return wL=r,r.default=r,wL}var _L,yee;function Srt(){if(yee)return _L;yee=1;let t=brt(),e=Nve(),n=NF(),s=qS();class r{constructor(a=[]){this.version="8.4.38",this.plugins=this.normalize(a)}normalize(a){let o=[];for(let l of a)if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),typeof l=="object"&&Array.isArray(l.plugins))o=o.concat(l.plugins);else if(typeof l=="object"&&l.postcssPlugin)o.push(l);else if(typeof l=="function")o.push(l);else if(!(typeof l=="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin");return o}process(a,o={}){return!this.plugins.length&&!o.parser&&!o.stringifier&&!o.syntax?new t(this,a,o):new e(this,a,o)}use(a){return this.plugins=this.plugins.concat(this.normalize([a])),this}}return _L=r,r.default=r,s.registerProcessor(r),n.registerProcessor(r),_L}var EL,bee;function wrt(){if(bee)return EL;bee=1;let t=AR(),e=Tve(),n=IR(),s=LF(),r=NR(),i=qS(),a=jF();function o(l,u){if(Array.isArray(l))return l.map(p=>o(p));let{inputs:d,...f}=l;if(d){u=[];for(let p of d){let m={...p,__proto__:r.prototype};m.map&&(m.map={...m.map,__proto__:e.prototype}),u.push(m)}}if(f.nodes&&(f.nodes=l.nodes.map(p=>o(p,u))),f.source){let{inputId:p,...m}=f.source;f.source=m,p!=null&&(f.source.input=u[p])}if(f.type==="root")return new i(f);if(f.type==="decl")return new t(f);if(f.type==="rule")return new a(f);if(f.type==="comment")return new n(f);if(f.type==="atrule")return new s(f);throw new Error("Unknown node type: "+l.type)}return EL=o,o.default=o,EL}var CL,See;function _rt(){if(See)return CL;See=1;let t=RF(),e=AR(),n=Nve(),s=sg(),r=Srt(),i=kR(),a=wrt(),o=NF(),l=Rve(),u=IR(),d=LF(),f=IF(),p=NR(),m=PF(),v=Ave(),x=jF(),y=qS(),S=RR();function _(...E){return E.length===1&&Array.isArray(E[0])&&(E=E[0]),new r(E)}return _.plugin=function(T,k){let R=!1;function I(...L){console&&console.warn&&!R&&(R=!0,console.warn(T+`: postcss.plugin was deprecated. Migration guide:
372https://evilmartians.com/chronicles/postcss-8-plugin-migration`),r5.LANG&&r5.LANG.startsWith("cn")&&console.warn(T+`: 里面 postcss.plugin 被弃用. 迁移指南:
373https://www.w3ctech.com/topic/2226`));let j=k(...L);return j.postcssPlugin=T,j.postcssVersion=new r().version,j}let A;return Object.defineProperty(I,"postcss",{get(){return A||(A=I()),A}}),I.process=function(L,j,F){return _([I(F)]).process(L,j)},I},_.stringify=i,_.parse=m,_.fromJSON=a,_.list=v,_.comment=E=>new u(E),_.atRule=E=>new d(E),_.decl=E=>new e(E),_.rule=E=>new x(E),_.root=E=>new y(E),_.document=E=>new o(E),_.CssSyntaxError=t,_.Declaration=e,_.Container=s,_.Processor=r,_.Document=o,_.Comment=u,_.Warning=l,_.AtRule=d,_.Result=f,_.Input=p,_.Rule=x,_.Root=y,_.Node=S,n.registerPostcss(_),CL=_,_.default=_,CL}var Ert=_rt();const hr=frt(Ert);hr.stringify;hr.fromJSON;hr.plugin;hr.parse;hr.list;hr.document;hr.comment;hr.atRule;hr.rule;hr.decl;hr.root;hr.CssSyntaxError;hr.Declaration;hr.Container;hr.Processor;hr.Document;hr.Comment;hr.Warning;hr.AtRule;hr.Result;hr.Input;hr.Rule;hr.Root;hr.Node;var On=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(On||{});function Crt(t){const e={},n=/;(?![^(]*\))/g,s=/:(.+)/,r=/\/\*.*?\*\//g;
vendor: 22,829 bytes, line 373
373return t.replace(r,"").split(n).forEach(function(i){if(i){const a=i.split(s);a.length>1&&(e[zD(a[0].trim())]=a[1].trim())}}),e}function wee(t){const e=[];for(const n in t){const s=t[n];if(typeof s!="string")continue;const r=Art(n);e.push(`${r}: ${s};`)}return e.join(" ")}const Trt=/-([a-z])/g,krt=/^--[a-zA-Z0-9-]+$/,zD=t=>krt.test(t)?t:t.replace(Trt,(e,n)=>n?n.toUpperCase():""),Rrt=/\B([A-Z])/g,Art=t=>t.replace(Rrt,"-$1").toLowerCase();class cc{constructor(...e){Et(this,"parentElement",null),Et(this,"parentNode",null),Et(this,"ownerDocument"),Et(this,"firstChild",null),Et(this,"lastChild",null),Et(this,"previousSibling",null),Et(this,"nextSibling",null),Et(this,"ELEMENT_NODE",1),Et(this,"TEXT_NODE",3),Et(this,"nodeType"),Et(this,"nodeName"),Et(this,"RRNodeType")}get childNodes(){const e=[];let n=this.firstChild;for(;n;)e.push(n),n=n.nextSibling;return e}contains(e){if(e instanceof cc){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class MF extends cc{constructor(...e){super(e),Et(this,"nodeType",9),Et(this,"nodeName","#document"),Et(this,"compatMode","CSS1Compat"),Et(this,"RRNodeType",On.Document),Et(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===On.Element&&e.tagName==="HTML")||null}get body(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(n=>n.RRNodeType===On.Element&&n.tagName==="BODY"))||null}get head(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(n=>n.RRNodeType===On.Element&&n.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const n=e.RRNodeType;if((n===On.Element||n===On.DocumentType)&&this.childNodes.some(r=>r.RRNodeType===n))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===On.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const s=DF(this,e);return s.parentElement=null,s}insertBefore(e,n){const s=e.RRNodeType;if((s===On.Element||s===On.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${s===On.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=Mve(this,e,n);return r.parentElement=null,r}removeChild(e){return Dve(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let n;if(e==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?n="-//W3C//DTD XHTML 1.0 Transitional//EN":e==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(n="-//W3C//DTD HTML 4.0 Transitional//EN"),n){const s=this.createDocumentType("html",n,"");this.open(),this.appendChild(s)}}createDocument(e,n,s){return new MF}createDocumentType(e,n,s){const r=new Ive(e,n,s);return r.ownerDocument=this,r}createElement(e){const n=new LR(e);return n.ownerDocument=this,n}createElementNS(e,n){return this.createElement(n)}createTextNode(e){const n=new Lve(e);return n.ownerDocument=this,n}createComment(e){const n=new jve(e);return n.ownerDocument=this,n}createCDATASection(e){const n=new Pve(e);return n.ownerDocument=this,n}toString(){return"RRDocument"}}class Ive extends cc{constructor(e,n,s){super(),Et(this,"nodeType",10),Et(this,"RRNodeType",On.DocumentType),Et(this,"name"),Et(this,"publicId"),Et(this,"systemId"),Et(this,"textContent",null),this.name=e,this.publicId=n,this.systemId=s,this.nodeName=e}toString(){return"RRDocumentType"}}class LR extends cc{constructor(e){super(),Et(this,"nodeType",1),Et(this,"RRNodeType",On.Element),Et(this,"tagName"),Et(this,"attributes",{}),Et(this,"shadowRoot",null),Et(this,"scrollLeft"),Et(this,"scrollTop"),this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(n=>e+=n.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new Lrt(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?Crt(this.attributes.style):{},n=/\B([A-Z])/g;return e.setProperty=(s,r,i)=>{if(n.test(s))return;const a=zD(s);r?e[a]=r:delete e[a],i==="important"&&(e[a]+=" !important"),this.attributes.style=wee(e)},e.removeProperty=s=>{if(n.test(s))return"";const r=zD(s),i=e[r]||"";return delete e[r],this.attributes.style=wee(e),i},e}getAttribute(e){return this.attributes[e]===void 0?null:this.attributes[e]}setAttribute(e,n){this.attributes[e]=n}setAttributeNS(e,n,s){this.setAttribute(n,s)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return DF(this,e)}insertBefore(e,n){return Mve(this,e,n)}removeChild(e){return Dve(this,e)}attachShadow(e){const n=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=n,n}dispatchEvent(e){return!0}toString(){let e="";for(const n in this.attributes)e+=`${n}="${this.attributes[n]}" `;return`${this.tagName} ${e}`}}class Nrt extends LR{constructor(){super(...arguments),Et(this,"currentTime"),Et(this,"volume"),Et(this,"paused"),Et(this,"muted"),Et(this,"playbackRate"),Et(this,"loop")}attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class Irt extends LR{constructor(){super(...arguments),Et(this,"tagName","DIALOG"),Et(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}}class Lve extends cc{constructor(e){super(),Et(this,"nodeType",3),Et(this,"nodeName","#text"),Et(this,"RRNodeType",On.Text),Et(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class jve extends cc{constructor(e){super(),Et(this,"nodeType",8),Et(this,"nodeName","#comment"),Et(this,"RRNodeType",On.Comment),Et(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class Pve extends cc{constructor(e){super(),Et(this,"nodeName","#cdata-section"),Et(this,"nodeType",4),Et(this,"RRNodeType",On.CDATA),Et(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class Lrt{constructor(e,n){if(Et(this,"onChange"),Et(this,"classes",[]),Et(this,"add",(...s)=>{for(const r of s){const i=String(r);this.classes.indexOf(i)>=0||this.classes.push(i)}this.onChange&&this.onChange(this.classes.join(" "))}),Et(this,"remove",(...s)=>{this.classes=this.classes.filter(r=>s.indexOf(r)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),e){const s=e.trim().split(/\s+/);this.classes.push(...s)}this.onChange=n}}function DF(t,e){return e.parentNode&&e.parentNode.removeChild(e),t.lastChild?(t.lastChild.nextSibling=e,e.previousSibling=t.lastChild):(t.firstChild=e,e.previousSibling=null),t.lastChild=e,e.nextSibling=null,e.parentNode=t,e.parentElement=t,e.ownerDocument=t.ownerDocument,e}function Mve(t,e,n){if(!n)return DF(t,e);if(n.parentNode!==t)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===n||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=n.previousSibling,n.previousSibling=e,e.nextSibling=n,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,e.parentElement=t,e.parentNode=t,e.ownerDocument=t.ownerDocument),e}function Dve(t,e){if(e.parentNode!==t)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:t.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:t.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var Eo=(t=>(t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t))(Eo||{});const VD={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},jrt={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let Bc=null;function i5(t,e,n,s=e.mirror||e.ownerDocument.mirror){t=Prt(t,e,n,s),Ove(t,e,n,s),Mrt(t,e,n)}function Prt(t,e,n,s){var r;if(n.afterAppend&&!Bc&&(Bc=new WeakSet,setTimeout(()=>{Bc=null},0)),!OF(t,e)){const i=a5(e,n.mirror,s);(r=t.parentNode)==null||r.replaceChild(i,t),t=i}switch(e.RRNodeType){case On.Document:{if(!y0(t,e,n.mirror,s)){const i=s.getMeta(e);i&&(n.mirror.removeNodeFromMap(t),t.close(),t.open(),n.mirror.add(t,i),Bc==null||Bc.add(t))}break}case On.Element:{const i=t,a=e;switch(a.tagName){case"IFRAME":{const o=t.contentDocument;if(!o)break;i5(o,e.contentDocument,n,s);break}}a.shadowRoot&&(i.shadowRoot||i.attachShadow({mode:"open"}),Ove(i.shadowRoot,a.shadowRoot,n,s)),Drt(i,a,s);break}}return t}function Mrt(t,e,n){var s;switch(e.RRNodeType){case On.Document:{const r=e.scrollData;r&&n.applyScroll(r,!0);break}case On.Element:{const r=t,i=e;switch(i.scrollData&&n.applyScroll(i.scrollData,!0),i.inputData&&n.applyInput(i.inputData),i.tagName){case"AUDIO":case"VIDEO":{const a=t,o=i;o.paused!==void 0&&(o.paused?a.pause():a.play()),o.muted!==void 0&&(a.muted=o.muted),o.volume!==void 0&&(a.volume=o.volume),o.currentTime!==void 0&&(a.currentTime=o.currentTime),o.playbackRate!==void 0&&(a.playbackRate=o.playbackRate),o.loop!==void 0&&(a.loop=o.loop);break}case"CANVAS":{const a=e;if(a.rr_dataURL!==null){const o=document.createElement("img");o.onload=()=>{const l=r.getContext("2d");l&&l.drawImage(o,0,0,o.width,o.height)},o.src=a.rr_dataURL}a.canvasMutations.forEach(o=>n.applyCanvas(o.event,o.mutation,t));break}case"STYLE":{const a=r.sheet;a&&e.rules.forEach(o=>n.applyStyleSheetMutation(o,a));break}case"DIALOG":{const a=r,o=i,l=a.open,u=a.matches("dialog:modal"),d=o.open,f=o.isModal,p=u!==f,m=l!==d;if((p||l&&m)&&a.close(),d&&(m||p))try{f?a.showModal():a.show()}catch(v){console.warn(v)}break}}break}case On.Text:case On.Comment:case On.CDATA:{t.textContent!==e.data&&(t.textContent=e.data);break}}Bc!=null&&Bc.has(t)&&(Bc.delete(t),(s=n.afterAppend)==null||s.call(n,t,n.mirror.getId(t)))}function Drt(t,e,n){const s=t.attributes,r=e.attributes;for(const i in r){const a=r[i],o=n.getMeta(e);if(o!=null&&o.isSVG&&VD[i])t.setAttributeNS(VD[i],i,a);else if(e.tagName==="CANVAS"&&i==="rr_dataURL"){const l=document.createElement("img");l.src=a,l.onload=()=>{const u=t.getContext("2d");u&&u.drawImage(l,0,0,l.width,l.height)}}else{if(e.tagName==="IFRAME"&&i==="srcdoc")continue;try{t.setAttribute(i,a)}catch(l){console.warn(l)}}}for(const{name:i}of Array.from(s))i in r||t.removeAttribute(i);e.scrollLeft&&(t.scrollLeft=e.scrollLeft),e.scrollTop&&(t.scrollTop=e.scrollTop)}function Ove(t,e,n,s){const r=Array.from(t.childNodes),i=e.childNodes;if(r.length===0&&i.length===0)return;let a=0,o=r.length-1,l=0,u=i.length-1,d=r[a],f=r[o],p=i[l],m=i[u],v,x;for(;a<=o&&l<=u;)if(d===void 0)d=r[++a];else if(f===void 0)f=r[--o];else if(y0(d,p,n.mirror,s))d=r[++a],p=i[++l];else if(y0(f,m,n.mirror,s))f=r[--o],m=i[--u];else if(y0(d,m,n.mirror,s)){try{t.insertBefore(d,f.nextSibling)}catch(_){console.warn(_)}d=r[++a],m=i[--u]}else if(y0(f,p,n.mirror,s)){try{t.insertBefore(f,d)}catch(_){console.warn(_)}f=r[--o],p=i[++l]}else{if(!v){v={};for(let E=a;E<=o;E++){const T=r[E];T&&n.mirror.hasNode(T)&&(v[n.mirror.getId(T)]=E)}}x=v[s.getId(p)];const _=r[x];if(x!==void 0&&_&&y0(_,p,n.mirror,s)){try{t.insertBefore(_,d)}catch(E){console.warn(E)}r[x]=void 0}else{const E=a5(p,n.mirror,s);t.nodeName==="#document"&&d&&(E.nodeType===E.DOCUMENT_TYPE_NODE&&d.nodeType===d.DOCUMENT_TYPE_NODE||E.nodeType===E.ELEMENT_NODE&&d.nodeType===d.ELEMENT_NODE)&&(t.removeChild(d),n.mirror.removeNodeFromMap(d),d=r[++a]);try{t.insertBefore(E,d||null)}catch(T){console.warn(T)}}p=i[++l]}if(a>o){const _=i[u+1];let E=null;for(_&&(E=n.mirror.getNode(s.getId(_)));l<=u;++l){const T=a5(i[l],n.mirror,s);try{t.insertBefore(T,E)}catch(k){console.warn(k)}}}else if(l>u)for(;a<=o;a++){const _=r[a];if(!(!_||_.parentNode!==t))try{t.removeChild(_),n.mirror.removeNodeFromMap(_)}catch(E){console.warn(E)}}let y=t.firstChild,S=e.firstChild;for(;y!==null&&S!==null;)i5(y,S,n,s),y=y.nextSibling,S=S.nextSibling}function a5(t,e,n){const s=n.getId(t),r=n.getMeta(t);let i=null;if(s>-1&&(i=e.getNode(s)),i!==null&&OF(i,t))return i;switch(t.RRNodeType){case On.Document:i=new Document;break;case On.DocumentType:i=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case On.Element:{let a=t.tagName.toLowerCase();a=jrt[a]||a,r&&"isSVG"in r&&(r!=null&&r.isSVG)?i=document.createElementNS(VD.svg,a):i=document.createElement(t.tagName);break}case On.Text:i=document.createTextNode(t.data);break;case On.Comment:i=document.createComment(t.data);break;case On.CDATA:i=document.createCDATASection(t.data);break}r&&e.add(i,{...r});try{Bc==null||Bc.add(i)}catch{}return i}function OF(t,e){return t.nodeType!==e.nodeType?!1:t.nodeType!==t.ELEMENT_NODE||t.tagName.toUpperCase()===e.tagName}function y0(t,e,n,s){const r=n.getId(t),i=s.getId(e);return r===-1||r!==i?!1:OF(t,e)}class J1 extends MF{constructor(e){super(),Et(this,"UNSERIALIZED_STARTING_ID",-2),Et(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),Et(this,"mirror",Krt()),Et(this,"scrollData",null),e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,n,s){return new J1}createDocumentType(e,n,s){const r=new Ort(e,n,s);return r.ownerDocument=this,r}createElement(e){const n=e.toUpperCase();let s;switch(n){case"AUDIO":case"VIDEO":s=new $rt(n);break;case"IFRAME":s=new zrt(n,this.mirror);break;case"CANVAS":s=new Urt(n);break;case"STYLE":s=new Brt(n);break;case"DIALOG":s=new Frt(n);break;default:s=new jR(n);break}return s.ownerDocument=this,s}createComment(e){const n=new Hrt(e);return n.ownerDocument=this,n}createCDATASection(e){const n=new Grt(e);return n.ownerDocument=this,n}createTextNode(e){const n=new Vrt(e);return n.ownerDocument=this,n}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Ort=Ive;class jR extends LR{constructor(){super(...arguments),Et(this,"inputData",null),Et(this,"scrollData",null)}}class $rt extends Nrt{}class Frt extends Irt{}class Urt extends jR{constructor(){super(...arguments),Et(this,"rr_dataURL",null),Et(this,"canvasMutations",[])}getContext(){return null}}class Brt extends jR{constructor(){super(...arguments),Et(this,"rules",[])}}class zrt extends jR{constructor(e,n){super(e),Et(this,"contentDocument",new J1),this.contentDocument.mirror=n}}const Vrt=Lve,Hrt=jve,Grt=Pve;function Wrt(t){return t instanceof HTMLFormElement?"FORM":t.tagName.toUpperCase()}function $ve(t,e,n,s){let r;switch(t.nodeType){case Eo.DOCUMENT_NODE:s&&s.nodeName==="IFRAME"?r=s.contentDocument:(r=e,r.compatMode=t.compatMode);break;case Eo.DOCUMENT_TYPE_NODE:{const a=t;r=e.createDocumentType(a.name,a.publicId,a.systemId);break}case Eo.ELEMENT_NODE:{const a=t,o=Wrt(a);r=e.createElement(o);const l=r;for(const{name:u,value:d}of Array.from(a.attributes))l.attributes[u]=d;a.scrollLeft&&(l.scrollLeft=a.scrollLeft),a.scrollTop&&(l.scrollTop=a.scrollTop);break}case Eo.TEXT_NODE:r=e.createTextNode(t.textContent||"");break;case Eo.CDATA_SECTION_NODE:r=e.createCDATASection(t.data);break;case Eo.COMMENT_NODE:r=e.createComment(t.textContent||"");break;case Eo.DOCUMENT_FRAGMENT_NODE:r=s.attachShadow({mode:"open"});break;default:return null}let i=n.getMeta(t);return e instanceof J1&&(i||(i=Fve(r,e.unserializedId),n.add(t,i)),e.mirror.add(r,{...i})),r}function qrt(t,e=drt(),n=new J1){function s(r,i){const a=$ve(r,n,e,i);if(a!==null)if((i==null?void 0:i.nodeName)!=="IFRAME"&&r.nodeType!==Eo.DOCUMENT_FRAGMENT_NODE&&(i==null||i.appendChild(a),a.parentNode=i,a.parentElement=i),r.nodeName==="IFRAME"){const o=r.contentDocument;o&&s(o,a)}else(r.nodeType===Eo.DOCUMENT_NODE||r.nodeType===Eo.ELEMENT_NODE||r.nodeType===Eo.DOCUMENT_FRAGMENT_NODE)&&(r.nodeType===Eo.ELEMENT_NODE&&r.shadowRoot&&s(r.shadowRoot,a),r.childNodes.forEach(o=>s(o,a)))}return s(t,null),n}function Krt(){return new Yrt}class Yrt{constructor(){Et(this,"idNodeMap",new Map),Et(this,"nodeMetaMap",new WeakMap)}getId(e){var n;return e?((n=this.getMeta(e))==null?void 0:n.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Fve(t,e){switch(t.RRNodeType){case On.Document:return{id:e,type:t.RRNodeType,childNodes:[]};case On.DocumentType:{const n=t;return{id:e,type:t.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case On.Element:return{id:e,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case On.Text:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case On.Comment:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case On.CDATA:return{id:e,type:t.RRNodeType,textContent:""}}}const _ee={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Eee={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},SE={},Uve={},Zrt=()=>!!globalThis.Zone;function $F(t){if(SE[t])return SE[t];const e=globalThis[t],n=e.prototype,s=t in _ee?_ee[t]:void 0,r=!!(s&&s.every(o=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,o))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),i=t in Eee?Eee[t]:void 0,a=!!(i&&i.every(o=>{var l;return typeof n[o]=="function"&&((l=n[o])==null?void 0:l.toString().includes("[native code]"))}));if(r&&a&&!Zrt())return SE[t]=e.prototype,e.prototype;try{const o=document.createElement("iframe");o.style.display="none",document.body.appendChild(o);const l=o.contentWindow;if(!l)return e.prototype;const u=l[t].prototype;if(!u)return o.remove(),n;const d=navigator.userAgent;return d.includes("Safari")&&!d.includes("Chrome")?(o.classList.add("rr-block"),o.setAttribute("__rrwebUntaintedMutationObserver",""),Uve[t]=()=>o.remove()):o.remove(),SE[t]=u}catch{return n}}const TL={};function Fd(t,e,n){var s;const r=`${t}.${String(n)}`;if(TL[r])return TL[r].call(e);const i=$F(t),a=(s=Object.getOwnPropertyDescriptor(i,n))==null?void 0:s.get;return a?(TL[r]=a,a.call(e)):e[n]}const kL={};function Bve(t,e,n){const s=`${t}.${String(n)}`;if(kL[s])return kL[s].bind(e);const i=$F(t)[n];return typeof i!="function"?e[n]:(kL[s]=i,i.bind(e))}function Xrt(t){return Fd("Node",t,"ownerDocument")}function Qrt(t){return Fd("Node",t,"childNodes")}function Jrt(t){return Fd("Node",t,"parentNode")}function eit(t){return Fd("Node",t,"parentElement")}function tit(t){return Fd("Node",t,"textContent")}function nit(t,e){return Bve("Node",t,"contains")(e)}function sit(t){return Bve("Node",t,"getRootNode")()}function rit(t){return!t||!("host"in t)?null:Fd("ShadowRoot",t,"host")}function iit(t){return t.styleSheets}function ait(t){return!t||!("shadowRoot"in t)?null:Fd("Element",t,"shadowRoot")}function oit(t,e){return Fd("Element",t,"querySelector")(e)}function lit(t,e){return Fd("Element",t,"querySelectorAll")(e)}function cit(){return[$F("MutationObserver").constructor,Uve.MutationObserver??(()=>{})]}let zve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(zve=()=>new Date().getTime());function uit(t,e,n){try{if(!(e in t))return()=>{};const s=t[e],r=n(s);return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s}})),t[e]=r,()=>{t[e]=s}}catch{return()=>{}}}const dit={ownerDocument:Xrt,childNodes:Qrt,parentNode:Jrt,parentElement:eit,textContent:tit,contains:nit,getRootNode:sit,host:rit,styleSheets:iit,shadowRoot:ait,querySelector:oit,querySelectorAll:lit,nowTimestamp:zve,mutationObserverCtor:cit,patch:uit},b0=`Please stop import mirror directly. Instead of that,\r
374now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
375or you can use record.mirror to access the mirror instance during recording.`;let Cee={map:{},getId(){return console.error(b0),-1},getNode(){return console.error(b0),null},removeNodeFromMap(){console.error(b0)},has(){return console.error(b0),!1},reset(){console.error(b0)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Cee=new Proxy(Cee,{get(t,e,n){return e==="map"&&console.error(b0),Reflect.get(t,e,n)}}));function fit(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function hit(t){const e={},n=(r,i)=>{const a={value:r,parent:i,children:[]};return e[r.node.id]=a,a},s=[];for(const r of t){const{nextId:i,parentId:a}=r;if(i&&i in e){const o=e[i];if(o.parent){const l=o.parent.children.indexOf(o);o.parent.children.splice(l,0,n(r,o.parent))}else{const l=s.indexOf(o);s.splice(l,0,n(r,null))}continue}if(a in e){const o=e[a];o.children.push(n(r,o));continue}s.push(n(r,null))}return s}function Vve(t,e){e(t.value);for(let n=t.children.length-1;n>=0;n--)Vve(t.children[n],e)}function RL(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Hve(t,e){var n,s;const r=(s=(n=t.ownerDocument)==null?void 0:n.defaultView)==null?void 0:s.frameElement;if(!r||r===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const i=r.getBoundingClientRect(),a=Hve(r,e),o=i.height/r.clientHeight;return{x:i.x*a.relativeScale+a.x,y:i.y*a.relativeScale+a.y,relativeScale:o,absoluteScale:a.absoluteScale*o}}function wE(t){return t?t instanceof cc&&"shadowRoot"in t?!!t.shadowRoot:!!dit.shadowRoot(t):!1}function Uy(t,e){const n=t==null?void 0:t[e[0]];return n?e.length===1?n:Uy(n.cssRules,e.slice(1)):null}function Tee(t){const e=[...t],n=e.pop();return{positions:e,index:n}}function pit(t){const e=new Set,n=[];for(let s=t.length;s--;){const r=t[s];e.has(r.id)||(n.push(r),e.add(r.id))}return n}class mit{constructor(){sn(this,"id",1),sn(this,"styleIDMap",new WeakMap),sn(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let s;return n===void 0?s=this.id++:s=n,this.styleIDMap.set(e,s),this.idStyleMap.set(s,e),s}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var gr=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t[t.Asset=7]="Asset",t))(gr||{}),ls=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(ls||{}),ri=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(ri||{}),o5=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(o5||{}),HD=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(HD||{}),Zn=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t.Destroy="destroy",t))(Zn||{}),jf=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(jf||{}),kee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
375+/",By=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var _E=0;_E<kee.length;_E++)By[kee.charCodeAt(_E)]=_E;var git=function(t){var e=t.length*.75,n=t.length,s,r=0,i,a,o,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var u=new ArrayBuffer(e),d=new Uint8Array(u);for(s=0;s<n;s+=4)i=By[t.charCodeAt(s)],a=By[t.charCodeAt(s+1)],o=By[t.charCodeAt(s+2)],l=By[t.charCodeAt(s+3)],d[r++]=i<<2|a>>4,d[r++]=(a&15)<<4|o>>2,d[r++]=(o&3)<<6|l&63;return u};const vit=`(function() {
376  "use strict";
377  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
378  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
379  for (var i = 0; i < chars.length; i++) {
380    lookup[chars.charCodeAt(i)] = i;
381  }
382  var encode = function(arraybuffer) {
383    var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
384    for (i2 = 0; i2 < len; i2 += 3) {
385      base64 += chars[bytes[i2] >> 2];
386      base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
387      base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
388      base64 += chars[bytes[i2 + 2] & 63];
389    }
390    if (len % 3 === 2) {
391      base64 = base64.substring(0, base64.length - 1) + "=";
392    } else if (len % 3 === 1) {
393      base64 = base64.substring(0, base64.length - 2) + "==";
394    }
395    return base64;
396  };
397  const lastBlobMap = /* @__PURE__ */ new Map();
398  const transparentBlobMap = /* @__PURE__ */ new Map();
399  async function getTransparentBlobFor(width, height, dataURLOptions) {
400    const id = \`\${width}-\${height}\`;
401    if ("OffscreenCanvas" in globalThis) {
402      if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
403      const offscreen = new OffscreenCanvas(width, height);
404      offscreen.getContext("2d");
405      const blob = await offscreen.convertToBlob(dataURLOptions);
406      const arrayBuffer = await blob.arrayBuffer();
407      const base64 = encode(arrayBuffer);
408      transparentBlobMap.set(id, base64);
409      return base64;
410    } else {
411      return "";
412    }
413  }
414  const worker = self;
415  worker.onmessage = async function(e) {
416    if ("OffscreenCanvas" in globalThis) {
417      const { id, bitmap, width, height, dataURLOptions } = e.data;
418      const transparentBase64 = getTransparentBlobFor(
419        width,
420        height,
421        dataURLOptions
422      );
423      const offscreen = new OffscreenCanvas(width, height);
424      const ctx = offscreen.getContext("2d");
425      ctx.drawImage(bitmap, 0, 0);
426      bitmap.close();
427      const blob = await offscreen.convertToBlob(dataURLOptions);
428      const type = blob.type;
429      const arrayBuffer = await blob.arrayBuffer();
430      const base64 = encode(arrayBuffer);
431      if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
432        lastBlobMap.set(id, base64);
433        return worker.postMessage({ id });
434      }
435      if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
436      worker.postMessage({
437        id,
438        type,
439        base64,
440        width,
441        height
442      });
443      lastBlobMap.set(id, base64);
444    } else {
445      return worker.postMessage({ id: e.data.id });
446    }
447  };
448})();
449//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
450`;typeof self<"u"&&self.Blob&&new Blob([vit],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=((hJ=t.contentWindow)==null?void 0:hJ.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}vve();function xit(t){return{all:t=t||new Map,on:function(e,n){var s=t.get(e);s?s.push(n):t.set(e,[n])},off:function(e,n){var s=t.get(e);s&&(n?s.splice(s.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var s=t.get(e);s&&s.slice().map(function(r){r(n)}),(s=t.get("*"))&&s.slice().map(function(r){r(e,n)})}}}function yit(t=window,e=document){if("scrollBehavior"in e.documentElement.style&&t.__forceSmoothScrollPolyfill__!==!0)return;const n=t.HTMLElement||t.Element,s=468,r={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:n.prototype.scroll||l,scrollIntoView:n.prototype.scrollIntoView},i=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now;function a(S){const _=["MSIE ","Trident/","Edge/"];return new RegExp(_.join("|")).test(S)}const o=a(t.navigator.userAgent)?1:0;function l(S,_){this.scrollLeft=S,this.scrollTop=_}function u(S){return .5*(1-Math.cos(Math.PI*S))}
vendor: 6,355 bytes, lines 450-463
450function d(S){if(S===null||typeof S!="object"||S.behavior===void 0||S.behavior==="auto"||S.behavior==="instant")return!0;if(typeof S=="object"&&S.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+S.behavior+" is not a valid value for enumeration ScrollBehavior.")}function f(S,_){if(_==="Y")return S.clientHeight+o<S.scrollHeight;if(_==="X")return S.clientWidth+o<S.scrollWidth}function p(S,_){const E=t.getComputedStyle(S,null)["overflow"+_];return E==="auto"||E==="scroll"}function m(S){const _=f(S,"Y")&&p(S,"Y"),E=f(S,"X")&&p(S,"X");return _||E}function v(S){for(;S!==e.body&&m(S)===!1;)S=S.parentNode||S.host;return S}function x(S){const _=i();let E,T,k,R=(_-S.startTime)/s;R=R>1?1:R,E=u(R),T=S.startX+(S.x-S.startX)*E,k=S.startY+(S.y-S.startY)*E,S.method.call(S.scrollable,T,k),(T!==S.x||k!==S.y)&&t.requestAnimationFrame(x.bind(t,S))}function y(S,_,E){let T,k,R,I;const A=i();S===e.body?(T=t,k=t.scrollX||t.pageXOffset,R=t.scrollY||t.pageYOffset,I=r.scroll):(T=S,k=S.scrollLeft,R=S.scrollTop,I=l),x({scrollable:T,method:I,startTime:A,startX:k,startY:R,x:_,y:E})}t.scroll=t.scrollTo=function(){if(arguments[0]!==void 0){if(d(arguments[0])===!0){r.scroll.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:t.scrollY||t.pageYOffset);return}y.call(t,e.body,arguments[0].left!==void 0?~~arguments[0].left:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:t.scrollY||t.pageYOffset)}},t.scrollBy=function(){if(arguments[0]!==void 0){if(d(arguments[0])){r.scrollBy.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}y.call(t,e.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset))}},n.prototype.scroll=n.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(d(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");r.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const S=arguments[0].left,_=arguments[0].top;y.call(this,this,typeof S>"u"?this.scrollLeft:~~S,typeof _>"u"?this.scrollTop:~~_)},n.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(d(arguments[0])===!0){r.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},n.prototype.scrollIntoView=function(){if(d(arguments[0])===!0){r.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const S=v(this),_=S.getBoundingClientRect(),E=this.getBoundingClientRect();S!==e.body?(y.call(this,S,S.scrollLeft+E.left-_.left,S.scrollTop+E.top-_.top),t.getComputedStyle(S).position!=="fixed"&&t.scrollBy({left:_.left,top:_.top,behavior:"smooth"})):t.scrollBy({left:E.left,top:E.top,behavior:"smooth"})}}class bit{constructor(e=[],n){sn(this,"timeOffset",0),sn(this,"speed"),sn(this,"actions"),sn(this,"raf",null),sn(this,"lastTimestamp"),this.actions=e,this.speed=n.speed}addAction(e){const n=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const s=this.findActionIndex(e);this.actions.splice(s,0,e)}n&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}updateLiveTime(){this.raf===!0&&this.rafCheck()}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const n=this.actions[0];if(this.timeOffset>=n.delay)this.actions.shift(),n.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let n=0,s=this.actions.length-1;for(;n<=s;){const r=Math.floor((n+s)/2);if(this.actions[r].delay<e.delay)n=r+1;else if(this.actions[r].delay>e.delay)s=r-1;else return r+1}return n}}function Ree(t,e){if(t.type===gr.IncrementalSnapshot&&t.data.source===ls.MouseMove&&t.data.positions&&t.data.positions.length){const n=t.data.positions[0].timeOffset,s=t.timestamp+n;return t.delay=s-e,s-e}return t.delay=t.timestamp-e,t.delay}/*! *****************************************************************************
451Copyright (c) Microsoft Corporation.
452
453Permission to use, copy, modify, and/or distribute this software for any
454purpose with or without fee is hereby granted.
455
456THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
457REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
458AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
459INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
460LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
461OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
462PERFORMANCE OF THIS SOFTWARE.
463***************************************************************************** */function Aee(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s,r,i=n.call(t),a=[];try{for(;(e===void 0||e-- >0)&&!(s=i.next()).done;)a.push(s.value)}catch(o){r={error:o}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}var F0;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(F0||(F0={}));var Gve={type:"xstate.init"};function AL(t){return t===void 0?[]:[].concat(t)}function S0(t){return{type:"xstate.assign",assignment:t}}function Nee(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="str
463ing"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function l5(t){return function(e){return t===e}}function Wve(t){return typeof t=="string"?{type:t}:t}function Iee(t,e){return{value:t,context:e,actions:[],changed:!1,matches:l5(t)}}function Lee(t,e,n){var s=e,r=!1;return[t.filter(function(i){if(i.type==="xstate.assign"){r=!0;var a=Object.assign({},s);return typeof i.assignment=="function"?a=i.assignment(s,n):Object.keys(i.assignment).forEach(function(o){a[o]=typeof i.assignment[o]=="function"?i.assignment[o](s,n):i.assignment[o]}),s=a,!1}return!0}),s,r]}function qve(t,e){e===void 0&&(e={});var n=Aee(Lee(AL(t.states[t.initial].entry).map(function(a){return Nee(a,e.actions)}),t.context,Gve),2),s=n[0],r=n[1],i={config:t,_options:e,initialState:{value:t.initial,actions:s,context:r,matches:l5(t.initial)},transition:function(a,o){var l,u,d=typeof a=="string"?{value:a,context:t.context}:a,f=d.value,p=d.context,m=Wve(o),v=t.states[f];if(v.on){var x=AL(v.on[m.type]);try{for(var y=(function(V){var B=typeof Symbol=="function"&&Symbol.iterator,q=B&&V[B],z=0;if(q)return q.call(V);if(V&&typeof V.length=="number")return{next:function(){return V&&z>=V.length&&(V=void 0),{value:V&&V[z++],done:!V}}};throw new TypeError(B?"Object is not iterable.":"Symbol.iterator is not defined.")})(x),S=y.next();!S.done;S=y.next()){var _=S.value;if(_===void 0)return Iee(f,p);var E=typeof _=="string"?{target:_}:_,T=E.target,k=E.actions,R=k===void 0?[]:k,I=E.cond,A=I===void 0?function(){return!0}:I,L=T===void 0,j=T??f,F=t.states[j];if(A(p,m)){var O=Aee(Lee((L?AL(R):[].concat(v.exit,R,F.entry).filter(function(V){return V})).map(function(V){return Nee(V,i._options.actions)}),p,m),3),M=O[0],U=O[1],G=O[2],$=T??f;return{value:$,context:U,actions:M,changed:T!==f||M.length>0||G,matches:l5($)}}}}catch(V){l={error:V}}finally{try{S&&!S.done&&(u=y.return)&&u.call(y)}finally{if(l)throw l.error}}}return Iee(f,p)}};return i}var jee=function(t,e){return t.actions.forEach(function(n){var s=n.exec;return s&&s(t.context,e)})};function Kve(t){var e=t.initialState,n=F0.NotStarted,s=new Set,r={_machine:t,send:function(i){n===F0.Running&&(e=t.transition(e,i),jee(e,Wve(i)),s.forEach(function(a){return a(e)}))},subscribe:function(i){return s.add(i),i(e),{unsubscribe:function(){return s.delete(i)}}},start:function(i){if(i){var a=typeof i=="object"?i:{context:t.config.context,value:i};e={value:a.value,actions:[],context:a.context,matches:l5(a.value)}}return n=F0.Running,jee(e,Gve),r},stop:function(){return n=F0.Stopped,s.clear(),r},get state(){return e},get status(){return n}};return r}function Sit(t,e){for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.type===gr.Meta&&s.timestamp<=e)return t.slice(n)}return t}function wit(t,{getCastFn:e,applyEventsSynchronously:n,emitter:s}){const r=qve({id:"player",context:t,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:S0({lastPlayedEvent:(i,a)=>a.type==="CAST_EVENT"?a.payload.event:i.lastPlayedEvent}),recordTimeOffset:S0((i,a)=>{let o=i.timeOffset;return"payload"in a&&"timeOffset"in a.payload&&(o=a.payload.timeOffset),{...i,timeOffset:o,baselineTime:i.events[0].timestamp+o}}),play(i){var a;const{timer:o,events:l,baselineTime:u,lastPlayedEvent:d}=i;o.clear();for(const v of l)Ree(v,u);const f=Sit(l,u);let p=d==null?void 0:d.timestamp;(d==null?void 0:d.type)===gr.IncrementalSnapshot&&d.data.source===ls.MouseMove&&(p=d.timestamp+((a=d.data.positions[0])==null?void 0:a.timeOffset)),u<(p||0)&&s.emit(Zn.PlayBack);const m=new Array;for(const v of f)if(!(p&&p<u&&(v.timestamp<=p||v===d)))if(v.timestamp<u)m.push(v);else{const x=e(v,!1);o.addAction({doAction:()=>{x()},delay:v.delay})}n(m),s.emit(Zn.Flush),o.start()},pause(i){i.timer.clear()},resetLastPlayedEvent:S0(i=>({...i,lastPlayedEvent:null})),startLive:S0({baselineTime:(i,a)=>(i.timer.start(),a.type==="TO_LIVE"&&a.payload.baselineTime?a.payload.baselineTime:Date.now())}),addEvent:S0((i,a)=>{const{baselineTime:o,timer:l,events:u}=i;if(a.type==="ADD_EVENT"){const{event:d}=a.payload;Ree(d,o);let f=u.length-1;if(!u[f]||u[f].timestamp<=d.timestamp)u.push(d);else{let v=-1,x=0;for(;x<=f;){const y=Math.floor((x+f)/2);u[y].timestamp<=d.timestamp?x=y+1:f=y-1}v===-1&&(v=x),u.splice(v,0,d)}const p=d.timestamp<o,m=e(d,p);p?m():l.isActive()&&l.addAction({doAction:()=>{m()},delay:d.delay})}return{...i,events:u}})}});return Kve(r)}function _it(t){const e=qve({id:"speed",context:t,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(n,s)=>{"payload"in s&&n.timer.setSpeed(s.payload.speed)},recordSpeed:S0({normalSpeed:n=>
vendor: 10,625 bytes, line 463
463n.timer.speed}),restoreSpeed:n=>{n.timer.setSpeed(n.normalSpeed)}}});return Kve(e)}const Eit=t=>[`.${t} { background: currentColor }`,"noscript { display: none !important; }"],Pee=new Map;function Yve(t,e){let n=Pee.get(t);return n||(n=new Map,Pee.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function ch(t,e,n){return async s=>{if(s&&typeof s=="object"&&"rr_type"in s)if(n&&(n.isUnchanged=!1),s.rr_type==="ImageBitmap"&&"args"in s){const r=await ch(t,e,n)(s.args);return await createImageBitmap.apply(null,r)}else if("index"in s){if(n||e===null)return s;const{rr_type:r,index:i}=s;return Yve(e,r)[i]}else if("args"in s){const{rr_type:r,args:i}=s,a=window[r];return new a(...await Promise.all(i.map(ch(t,e,n))))}else{if("base64"in s)return git(s.base64);if("src"in s){const r=t.get(s.src);if(r)return r;{const i=new Image;return i.src=s.src,t.set(s.src,i),i}}else if("data"in s&&s.rr_type==="Blob"){const r=await Promise.all(s.data.map(ch(t,e,n)));return new Blob(r,{type:s.type})}}else if(Array.isArray(s))return await Promise.all(s.map(ch(t,e,n)));return s}}function Cit(t,e){try{return e===o5.WebGL?t.getContext("webgl")||t.getContext("experimental-webgl"):t.getContext("webgl2")}catch{return null}}const Tit=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function kit(t,e){if(!(e!=null&&e.constructor))return;const{name:n}=e.constructor;if(!Tit.includes(n))return;const s=Yve(t,n);s.includes(e)||s.push(e)}async function Rit({mutation:t,target:e,type:n,imageMap:s,errorHandler:r}){try{const i=Cit(e,n);if(!i)return;if(t.setter){i[t.property]=t.args[0];return}const a=i[t.property],o=await Promise.all(t.args.map(ch(s,i))),l=a.apply(i,o);kit(i,l);const u=!1}catch(i){r(t,i)}}async function Ait({event:t,mutations:e,target:n,imageMap:s,errorHandler:r}){const i=n.getContext("2d");if(!i){r(e[0],new Error("Canvas context is null"));return}const a=e.map(async l=>Promise.all(l.args.map(ch(s,i))));(await Promise.all(a)).forEach((l,u)=>{const d=e[u];try{if(d.setter){i[d.property]=d.args[0];return}const f=i[d.property];d.property==="drawImage"&&typeof d.args[0]=="string"?(s.get(t),f.apply(i,d.args)):f.apply(i,l)}catch(f){r(d,f)}})}async function Mee({event:t,mutation:e,target:n,imageMap:s,canvasEventMap:r,errorHandler:i}){try{const a=r.get(t)||e,o="commands"in a?a.commands:[a];if([o5.WebGL,o5.WebGL2].includes(e.type)){for(let l=0;l<o.length;l++){const u=o[l];await Rit({mutation:u,type:e.type,target:n,imageMap:s,errorHandler:i})}return}await Ait({event:t,mutations:o,target:n,imageMap:s,errorHandler:i})}catch(a){i(e,a)}}class Nit{constructor(e){sn(this,"mediaMap",new Map),sn(this,"warn"),sn(this,"service"),sn(this,"speedService"),sn(this,"emitter"),sn(this,"getCurrentTime"),sn(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(Zn.Start,this.start.bind(this)),this.emitter.on(Zn.SkipStart,this.start.bind(this)),this.emitter.on(Zn.Pause,this.pause.bind(this)),this.emitter.on(Zn.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((n,s)=>{this.syncTargetWithState(s),e.pause&&s.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:n,mediaState:s}){if(s.isPlaying){const i=(e-s.lastInteractionTimeOffset)/1e3*s.playbackRate,a="duration"in n&&n.duration;if(Number.isNaN(a)){this.waitForMetadata(n);return}let o=s.currentTimeAtLastInteraction+i;n.loop&&a!==!1&&(o=o%a),n.currentTime=o}else n.pause(),n.currentTime=s.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;const n=()=>{this.metadataCallbackMap.delete(e);const s=this.mediaMap.get(e);s&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:s})};this.metadataCallbackMap.set(e,n),e.addEventListener("loadedmetadata",n,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:n,mutation:s}){const r=this.mediaMap.get(e),{type:i,playbackRate:a,currentTime:o,muted:l,volume:u,loop:d}=s;return{isPlaying:i===HD.Play||i!==HD.Pause&&((r==null?void 0:r.isPlaying)||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:o??(r==null?void 0:r.currentTimeAtLastInteraction)??0,lastInteractionTimeOffset:n,playbackRate:a??(r==null?void 0:r.playbackRate)??1,volume:u??(r==null?void 0:r.volume)??1,muted:l??(r==null?void 0:r.muted)??e.getAttribute("muted")===null,loop:d??(r==null?void 0:r.loop)??e.getAttribute("loop")===null}}syncTargetWithState(e){const n=this.mediaMap.get(e);if(!n)return;const{muted:s,loop:r,volume:i,isPlaying:a}=n,o=this.service.state.matches("paused"),l=n.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:n}),e.volume!==i&&(e.volume=i),e.muted=s,e.loop=r,e.playbackRate!==l&&(e.playbackRate=l),a&&!o?e.play():e.pause()}catch(u){this.warn(`Failed to replay media interactions: ${u.message||u}`)}}addMediaElements(e,n,s){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;const r=e,i=s.getMeta(r);if(!i||!("attributes"in i))return;const a=this.service.state.matches("paused"),o=i.attributes;let l=!1;o.rr_mediaState?l=o.rr_mediaState==="played":l=r.getAttribute("autoplay")!==null,l&&a&&r.pause();let u=1;typeof o.rr_mediaPlaybackRate=="number"&&(u=o.rr_mediaPlaybackRate);let d=!1;typeof o.rr_mediaMuted=="boolean"?d=o.rr_mediaMuted:d=r.getAttribute("muted")!==null;let f=!1;typeof o.rr_mediaLoop=="boolean"?f=o.rr_mediaLoop:f=r.getAttribute("loop")!==null;let p=1;typeof o.rr_mediaVolume=="number"&&(p=o.rr_mediaVolume);let m=0;typeof o.rr_mediaCurrentTime=="number"&&(m=o.rr_mediaCurrentTime),this.mediaMap.set(r,{isPlaying:l,currentTimeAtLastInteraction:m,lastInteractionTimeOffset:n,playbackRate:u,volume:p,muted:d,loop:f}),this.syncTargetWithState(r)}mediaMutation({target:e,timeOffset:n,mutation:s}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:n,mutation:s})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}}function EE(t,e){if(t.nodeName!=="DIALOG"||t instanceof cc)return;const n=t,s=n.open,r=s&&n.matches("dialog:modal"),i=n.getAttribute("rr_open_mode"),a=typeof(e==null?void 0:e.attributes.open)=="string"||typeof n.getAttribute("open")=="string",o=i==="modal";if(!(s&&!(r&&i==="non-modal"||!r&&o))){if(!n.isConnected){console.warn("dialog is not attached to the dom",n);return}s&&n.close(),a&&(o?n.showModal():n.show())}}function Iit(t,e){if(t.nodeName!=="DIALOG"||t instanceof cc)return;const n=t;if(!n.isConnected){console.warn("dialog is not attached to the dom",n);return}e.attributes.open===null&&(n.removeAttribute("open"),n.removeAttribute("rr_open_mode"))}const Lit=5*1e3,jit=xit,Dee="[replayer]",NL={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Oee(t){return t.type==gr.IncrementalSnapshot&&(t.data.source==ls.TouchMove||t.data.source==ls.MouseInteraction&&t.data.type==ri.TouchStart)}class Pit{constructor(e,n){if(sn(this,"wrapper"),sn(this,"iframe"),sn(this,"UNSAFE_replayCanvas",!1),sn(this,"service"),sn(this,"speedService"),sn(this,"config"),sn(this,"usingVirtualDom",!1),sn(this,"virtualDom",new J1),sn(this,"mouse"),sn(this,"mouseTail",null),sn(this,"tailPositions",[]),sn(this,"emitter",jit()),sn(this,"nextUserInteractionEvent"),sn(this,"legacy_missingNodeRetryMap",{}),sn(this,"cache",GJ()),sn(this,"imageMap",new Map),sn(this,"canvasEventMap",new Map),sn(this,"mirror",vve()),sn(this,"styleMirror",new mit),sn(this,"mediaManager"),sn(this,"firstFullSnapshot",null),sn(this,"newDocumentQueue",[]),sn(this,"mousePos",null),sn(this,"touchActive",null),sn(this,"lastMouseDownEvent",null),sn(this,"lastHoveredRootNode"),sn(this,"lastSelectionData",null),sn(this,"constructedStyleMutations",[]),sn(this,"adoptedStyleSheets",[]),sn(this,"handleResize",o=>{this.iframe.style.display="inherit";for(const l of[this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(o.width)),l.setAttribute("height",String(o.height)))}),sn(this,"applyEventsSynchronously",o=>{for(const l of o){switch(l.type){case gr.DomContentLoaded:case gr.Load:case gr.Custom:continue;case gr.FullSnapshot:case gr.Meta:case gr.Plugin:case gr.IncrementalSnapshot:break}this.getCastFn(l,!0)()}}),sn(this,"getCastFn",(o,l=!1)=>{let u;switch(o.type){case gr.DomContentLoaded:case gr.Load:break;case gr.Custom:u=()=>{this.emitter.emit(Zn.CustomEvent,o)};break;case gr.Meta:u=()=>this.emitter.emit(Zn.Resize,{width:o.data.width,height:o.data.height});break;case gr.FullSnapshot:u=()=>{var f;if(this.firstFullSnapshot){if(this.firstFullSnapshot===o){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(o,l),(f=this.iframe.contentWindow)==null||f.scrollTo(o.data.initialOffset)};break;case gr.IncrementalSnapshot:u=()=>{if(this.applyIncremental(o,l),!l&&(o===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const f of this.service.state.context.events)if(!(f.timestamp<=o.timestamp)&&this.isUserInteraction(f)){f.delay-o.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=f);break}if(this.nextUserInteractionEvent){const f=this.nextUserInteractionEvent.delay-o.delay,p={speed:Math.min(Math.round(f/Lit),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:p}),this.emitter.emit(Zn.SkipStart,p)}}};break}return()=>{u&&u();for(const p of this.config.plugins||[])p.handler&&p.handler(o,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:o}});const f=this.service.state.context.events.length-1;if(!this.config.liveMode&&o===this.service.state.context.events[f]){const p=()=>{f<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(Zn.Finish))};let m=50;o.type===gr.IncrementalSnapshot&&o.data.source===ls.MouseMove&&o.data.positions.length&&(m+=Math.max(0,-o.data.positions[0].timeOffset)),setTimeout(p,m)}this.emitter.emit(Zn.EventCast,o)}}),!(n!=null&&n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const s={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr
463-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:NL,useVirtualDom:!0,logger:console};this.config=Object.assign({},s,n),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(Zn.Resize,this.handleResize),this.setupDom();for(const o of this.config.plugins||[])o.getMirror&&o.getMirror({nodeMirror:this.mirror});this.emitter.on(Zn.Flush,()=>{if(this.usingVirtualDom){const o={mirror:this.mirror,applyCanvas:(l,u,d)=>{Mee({event:l,mutation:u,target:d,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,u)=>{l.source===ls.StyleSheetRule?this.applyStyleSheetRule(l,u):l.source===ls.StyleDeclaration&&this.applyStyleDeclaration(l,u)},afterAppend:(l,u)=>{for(const d of this.config.plugins||[])d.onBuild&&d.onBuild(l,{id:u,replayer:this})}};if(this.iframe.contentDocument)try{i5(this.iframe.contentDocument,this.virtualDom,o,this.virtualDom.mirror)}catch(l){console.warn(l)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const l in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[l],d=a5(u.node,this.mirror,this.virtualDom.mirror);i5(d,u.node,o,this.virtualDom.mirror),u.node=d}catch(u){this.warn(u)}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[o,l]=this.lastMouseDownEvent;o.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(Zn.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});const r=new bit([],{speed:this.config.speed});this.service=wit({events:e.map(o=>n&&n.unpackFn?n.unpackFn(o):o).sort((o,l)=>o.timestamp-l.timestamp),timer:r,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(o=>{this.emitter.emit(Zn.StateChange,{player:o})}),this.speedService=_it({normalSpeed:-1,timer:r}),this.speedService.start(),this.speedService.subscribe(o=>{this.emitter.emit(Zn.StateChange,{speed:o})}),this.mediaManager=new Nit({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});const i=this.service.state.context.events.find(o=>o.type===gr.Meta),a=this.service.state.context.events.find(o=>o.type===gr.FullSnapshot);if(i){const{width:o,height:l}=i.data;setTimeout(()=>{this.emitter.emit(Zn.Resize,{width:o,height:l})},0)}a&&setTimeout(()=>{var o;this.firstFullSnapshot||(this.firstFullSnapshot=a,this.rebuildFullSnapshot(a),(o=this.iframe.contentWindow)==null||o.scrollTo(a.data.initialOffset))},1),this.service.state.context.events.find(Oee)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,n){return this.emitter.on(e,n),this}off(e,n){return this.emitter.off(e,n),this}setConfig(e){Object.keys(e).forEach(n=>{e[n],this.config[n]=e[n]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],n=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:n.timestamp,totalTime:n.timestamp-e.timestamp}}getCurrentTime(){return this.config.liveMode&&this.timer.updateLiveTime(),this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:n}=this.service.state.context;return e-n[0].timestamp}getMirror(){return this.mirror}play(e=0){var n,s;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(s=(n=this.iframe.contentDocument)==null?void 0:n.getElementsByTagName("html")[0])==null||s.classList.remove("rrweb-paused"),this.emitter.emit(Zn.Start)}pause(e){var n,s;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(s=(n=this.iframe.contentDocument)==null?void 0:n.getElementsByTagName("html")[0])==null||s.classList.add("rrweb-paused"),this.emitter.emit(Zn.Pause)}
vendor: 19,467 bytes, line 463
463resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(Zn.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(Zn.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const n=this.config.unpackFn?this.config.unpackFn(e):e;Oee(n)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:n}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=GJ()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.config.UNSAFE_replayCanvas?(this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin allow-scripts"),this.wrapper.appendChild(this.iframe),this.UNSAFE_replayCanvas=!0):(this.iframe=irt({root:this.wrapper}),this.UNSAFE_replayCanvas=!1),this.iframe.style.display="none",this.disableInteract(),this.iframe.contentWindow&&this.iframe.contentDocument&&(yit(this.iframe.contentWindow,this.iframe.contentDocument),fit(this.iframe.contentWindow))}rebuildFullSnapshot(e,n=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const s=[],r=new Set,i=(l,u)=>{if(l.nodeName==="DIALOG"&&r.add(l),this.collectIframeAndAttachDocument(s,l),this.mediaManager.isSupportedMediaElement(l)){const{events:d}=this.service.state.context;this.mediaManager.addMediaElements(l,e.timestamp-d[0].timestamp,this.mirror)}for(const d of this.config.plugins||[])d.onBuild&&d.onBuild(l,{id:u,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),rrt(e.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror,UNSAFE_allowUnprotectedRebuild:this.UNSAFE_replayCanvas}),i(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:l,builtNode:u}of s)this.attachDocumentToIframe(l,u),this.newDocumentQueue=this.newDocumentQueue.filter(d=>d!==l);const{documentElement:a,head:o}=this.iframe.contentDocument;this.insertStyleRules(a,o),r.forEach(l=>EE(l)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(Zn.FullsnapshotRebuilded,e),n||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,n){var s;const r=Eit(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&r.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!r.length)if(this.usingVirtualDom){const i=this.virtualDom.createElement("style");this.virtualDom.mirror.add(i,Fve(i,this.virtualDom.unserializedId)),e.insertBefore(i,n),i.rules.push({source:ls.StyleSheetRule,adds:r.map((a,o)=>({rule:a,index:o}))})}else{const i=document.createElement("style");e.insertBefore(i,n);for(let a=0;a<r.length;a++)(s=i.sheet)==null||s.insertRule(r[a],a)}}attachDocumentToIframe(e,n){const s=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,r=[],i=new Set,a=(o,l)=>{o.nodeName==="DIALOG"&&i.add(o),this.collectIframeAndAttachDocument(r,o);const u=s.getMeta(o);if((u==null?void 0:u.type)===jf.Element&&(u==null?void 0:u.tagName.toUpperCase())==="HTML"){const{documentElement:d,head:f}=n.contentDocument;this.insertStyleRules(d,f)}if(!this.usingVirtualDom)for(const d of this.config.plugins||[])d.onBuild&&d.onBuild(o,{id:l,replayer:this})};_b(e.node,{doc:n.contentDocument,mirror:s,hackCss:!0,skipChild:!1,afterAppend:a,cache:this.cache}),a(n.contentDocument,e.node.id);for(const{mutationInQueue:o,builtNode:l}of r)this.attachDocumentToIframe(o,l),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==o);i.forEach(o=>EE(o))}collectIframeAndAttachDocument(e,n){if(RL(n,this.mirror)){const s=this.newDocumentQueue.find(r=>r.parentId===this.mirror.getId(n));s&&e.push({mutationInQueue:s,builtNode:n})}}waitForStylesheetLoad(){var e;const n=(e=this.iframe.contentDocument)==null?void 0:e.head;if(n){const s=new Set;let r,i=this.service.state;const a=()=>{i=this.service.state};this.emitter.on(Zn.Start,a),this.emitter.on(Zn.Pause,a);const o=()=>{this.emitter.off(Zn.Start,a),this.emitter.off(Zn.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(s.add(l),l.addEventListener("load",()=>{s.delete(l),s.size===0&&r!==-1&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(Zn.LoadStylesheetEnd),r&&clearTimeout(r),o())}))}),s.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(Zn.LoadStylesheetStart),r=setTimeout(()=>{i.matches("playing")&&this.play(this.getCurrentTime()),r=-1,o()},this.config.loadTimeout))}}async preloadAllImages(){const e=[];for(const n of this.service.state.context.events)n.type===gr.IncrementalSnapshot&&n.data.source===ls.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(n.data,n)),("commands"in n.data?n.data.commands:[n.data]).forEach(r=>{this.preloadImages(r,n)}));return Promise.all(e)}preloadImages(e,n){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(n)){const s=document.createElement("canvas"),r=s.getContext("2d"),i=r==null?void 0:r.createImageData(s.width,s.height);r==null||r.putImageData(i,0,0)}}async deserializeAndPreloadCanvasEvents(e,n){if(!this.canvasEventMap.has(n)){const s={isUnchanged:!0};if("commands"in e){const r=await Promise.all(e.commands.map(async i=>{const a=await Promise.all(i.args.map(ch(this.imageMap,null,s)));return{...i,args:a}}));s.isUnchanged===!1&&this.canvasEventMap.set(n,{...e,commands:r})}else{const r=await Promise.all(e.args.map(ch(this.imageMap,null,s)));s.isUnchanged===!1&&this.canvasEventMap.set(n,{...e,args:r})}}}applyIncremental(e,n){var s,r,i;const{data:a}=e;switch(a.source){case ls.Mutation:{try{this.applyMutation(a,n)}catch(o){this.warn(`Exception in mutation ${o.message||o}`,a)}break}case ls.Drag:case ls.TouchMove:case ls.MouseMove:if(n){const o=a.positions[a.positions.length-1];this.mousePos={x:o.x,y:o.y,id:o.id,debugData:a}}else a.positions.forEach(o=>{const l={doAction:()=>{this.moveAndHover(o.x,o.y,o.id,n,a)},delay:o.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l)}),this.timer.addAction({doAction(){},delay:e.delay-((s=a.positions[0])==null?void 0:s.timeOffset)});break;case ls.MouseInteraction:{if(a.id===-1)break;const o=new Event(Nst(ri[a.type])),l=this.mirror.getNode(a.id);if(!l)return this.debugNodeNotFound(a,a.id);this.emitter.emit(Zn.MouseInteraction,{type:a.type,target:l});const{triggerFocus:u}=this.config;switch(a.type){case ri.Blur:"blur"in l&&l.blur();break;case ri.Focus:u&&l.focus&&l.focus({preventScroll:!0});break;case ri.Click:case ri.TouchStart:case ri.TouchEnd:case ri.MouseDown:case ri.MouseUp:n?(a.type===ri.TouchStart?this.touchActive=!0:a.type===ri.TouchEnd&&(this.touchActive=!1),a.type===ri.MouseDown?this.lastMouseDownEvent=[l,o]:a.type===ri.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:a.x||0,y:a.y||0,id:a.id,debugData:a}):(a.type===ri.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(a.x||0,a.y||0,a.id,n,a),a.type===ri.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):a.type===ri.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):a.type===ri.TouchEnd?this.mouse.classList.remove("touch-active"):l.dispatchEvent(o));break;case ri.TouchCancel:n?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(o)}break}case ls.Scroll:{if(a.id===-1)break;if(this.usingVirtualDom){const o=this.virtualDom.mirror.getNode(a.id);if(!o)return this.debugNodeNotFound(a,a.id);o.scrollData=a;break}this.applyScroll(a,n);break}case ls.ViewportResize:this.emitter.emit(Zn.Resize,{width:a.width,height:a.height});break;case ls.Input:{if(a.id===-1)break;if(this.usingVirtualDom){const o=this.virtualDom.mirror.getNode(a.id);if(!o)return this.debugNodeNotFound(a,a.id);o.inputData=a;break}this.applyInput(a);break}case ls.MediaInteraction:{const o=this.usingVirtualDom?this.virtualDom.mirror.getNode(a.id):this.mirror.getNode(a.id);if(!o)return this.debugNodeNotFound(a,a.id);const l=o,{events:u}=this.service.state.context;this.mediaManager.mediaMutation({target:l,timeOffset:e.timestamp-u[0].timestamp,mutation:a});break}case ls.StyleSheetRule:case ls.StyleDeclaration:{this.usingVirtualDom?a.styleId?this.constructedStyleMutations.push(a):a.id&&((r=this.virtualDom.mirror.getNode(a.id))==null||r.rules.push(a)):this.applyStyleSheetMutation(a);break}case ls.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const o=this.virtualDom.mirror.getNode(a.id);if(!o)return this.debugNodeNotFound(a,a.id);o.canvasMutations.push({event:e,mutation:a})}else{const o=this.mirror.getNode(a.id);if(!o)return this.debugNodeNotFound(a,a.id);Mee({event:e,mutation:a,target:o,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case ls.Font:{try{const o=new FontFace(a.family,a.buffer?new Uint8Array(JSON.parse(a.fontSource)):a.fontSource,a.descriptors);(i=this.iframe.contentDocument)==null||i.fonts.add(o)}catch(o){this.warn(o)}break}case ls.Selection:{if(n){this.lastSelectionData=a;break}this.applySelection(a);break}case ls.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(a):this.applyAdoptedStyleSheet(a);break}}}applyMutation(e,n){if(this.config.useVirtualDom&&!this.usingVirtualDom&&n&&(this.usingVirtualDom=!0,qrt(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const u in this.legacy_missingNodeRetryMap)try{const d=this.legacy_missingNodeRetryMap[u],f=$ve(d.node,this.virtualDom,this.mirror);f&&(d.node=f)}catch(d){this.warn(d)}const s=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(u=>s.getNode(u.id)?!0:(this.warnNodeNotFound(e,u.id),!1)),e.removes.forEach(u=>{var d;const f=s.getNode(u.id);if(!f)return;let p=s.getNode(u.parentId);if(!p)return this.warnNodeNotFound(e,u.parentId);if(u.isShadow&&wE(p)&&(p=p.shadowRoot),s.removeNodeFromMap(f),p)try{p.removeChild(f),this.usingVirtualDom&&f.nodeName==="#text"&&p.nodeName==="STYLE"&&((d=p.rules)==null?void 0:d.length)>0&&(p.rules=[])}catch(m){if(m instanceof DOMException)this.warn("parent could not remove child in mutation",p,f,e);else throw m}});const r={...this.legacy_missingNodeRetryMap},i=[],a=u=>{let d=null;return u.nextId&&(d=s.getNode(u.nextId)),u.nextId!==null&&u.nextId!==void 0&&u.nextId!==-1&&!d},o=u=>{var d,f;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let p=s.getNode(u.parentId);if(!p)return u.node.type===jf.Document?this.newDocumentQueue.push(u):i.push(u);u.node.isShadow&&(wE(p)||p.attachShadow({mode:"open"}),p=p.shadowRoot);let m=null,v=null;if(u.previousId&&(m=s.getNode(u.previousId)),u.nextId&&(v=s.getNode(u.nextId)),a(u))return i.push(u);if(u.node.rootId&&!s.getNode(u.node.rootId))return;const x=u.node.rootId?s.getNode(u.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(RL(p,s)){this.attachDocumentToIframe(u,p);return}const y=(E,T)=>{if(!this.usingVirtualDom){EE(E);for(const k of this.config.plugins||[])k.onBuild&&k.onBuild(E,{id:T,replayer:this})}},S=_b(u.node,{doc:x,mirror:s,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:y});if(u.previousId===-1||u.nextId===-1){r[u.node.id]={node:S,mutation:u};return}const _=s.getMeta(p);if(_&&_.type===jf.Element&&u.node.type===jf.Text){const E=Array.isArray(p.childNodes)?p.childNodes:Array.from(p.childNodes);if(_.tagName==="textarea")for(const T of E)T.nodeType===p.TEXT_NODE&&p.removeChild(T);else if(_.tagName==="style"&&E.length===1)for(const T of E)T.nodeType===p.TEXT_NODE&&!s.hasNode(T)&&(S.textContent=T.textContent,p.removeChild(T))}else if((_==null?void 0:_.type)===jf.Document){const E=p;u.node.type===jf.DocumentType&&((d=E.childNodes[0])==null?void 0:d.nodeType)===Node.DOCUMENT_TYPE_NODE&&E.removeChild(E.childNodes[0]),S.nodeName==="HTML"&&E.documentElement&&E.removeChild(E.documentElement)}if(m&&m.nextSibling&&m.nextSibling.parentNode?p.insertBefore(S,m.nextSibling):v&&v.parentNode?p.contains(v)?p.insertBefore(S,v):p.insertBefore(S,null):p.appendChild(S),y(S,u.node.id),this.usingVirtualDom&&S.nodeName==="#text"&&p.nodeName==="STYLE"&&((f=p.rules)==null?void 0:f.length)>0&&(p.rules=[]),RL(S,this.mirror)){const E=this.mirror.getId(S),T=this.newDocumentQueue.find(k=>k.parentId===E);T&&(this.attachDocumentToIframe(T,S),this.newDocumentQueue=this.newDocumentQueue.filter(k=>k!==T))}(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(r,p,S,u)};e.adds.forEach(u=>{o(u)});const l=Date.now();for(;i.length;){const u=hit(i);if(i.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",u);break}for(const d of u)s.getNode(d.value.parentId)?Vve(d,p=>{o(p)}):this.debug("Drop resolve tree since there is no parent for the root node.",d)}Object.keys(r).length&&Object.assign(this.legacy_missingNodeRetryMap,r),pit(e.texts).forEach(u=>{var d;const f=s.getNode(u.id);if(!f)return e.removes.find(m=>m.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);const p=f.parentElement;if(u.value&&p&&p.tagName==="STYLE"?f.textContent=TR(u.value,this.cache):f.textContent=u.value,this.usingVirtualDom){const m=f.parentNode;((d=m==null?void 0:m.rules)==null?void 0:d.length)>0&&(m.rules=[])}}),e.attributes.forEach(u=>{var d;const f=s.getNode(u.id);if(!f)return e.removes.find(p=>p.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);for(const p in u.attributes)if(typeof p=="string"){const m=u.attributes[p];if(m===null)f.removeAttribute(p),p==="open"&&Iit(f,u);else if(typeof m=="string")try{if(p==="_cssText"&&(f.nodeName==="LINK"||f.nodeName==="STYLE"))try{const v=s.getMeta(f),x=_b({...v,attributes:{...v.attributes,...u.attributes}},{doc:f.ownerDocument,mirror:s,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(v.attributes,u.attributes);const y=f.nextSibling,S=f.parentNode;if(x&&S){S.removeChild(f),S.insertBefore(x,y),s.replace(u.id,x);break}}catch{}if(p==="value"&&f.nodeName==="TEXTAREA"){const v=f;v.childNodes.forEach(y=>v.removeChild(y));const x=(d=f.ownerDocument)==null?void 0:d.createTextNode(m);x&&v.appendChild(x)}else f.setAttribute(p,m);p==="rr_open_mode"&&f.nodeName==="DIALOG"&&EE(f,u)}catch(v){this.warn("An error occurred may due to the checkout feature.",v)}else if(p==="style"){const v=m,x=f;for(const y in v)if(v[y]===!1)x.style.removeProperty(y);else if(v[y]instanceof Array){const S=v[y];x.style.setProperty(y,S[0],S[1])}else{const S=v[y];x.style.setProperty(y,S)}}}})}applyScroll(e,n){var s,r;const i=this.mirror.getNode(e.id);if(!i)return this.debugNodeNotFound(e,e.id);const a=this.mirror.getMeta(i);if(i===this.iframe.contentDocument)(s=this.iframe.contentWindow)==null||s.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else if((a==null?void 0:a.type)===jf.Document)(r=i.defaultView)==null||r.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else try{i.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"})}catch{}}applyInput(e){const n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);try{n.checked=e.isChecked,n.value=e.text}catch{}}applySelection(e){try{const n=new Set,s=e.ranges.map(({start:r,startOffset:i,end:a,endOffset:o})=>{const l=this.mirror.getNode(r),u=this.mirror.getNode(a);if(!l||!u)return;const d=new Range;d.setStart(l,i),d.setEnd(u,o);const f=l.ownerDocument,p=f==null?void 0:f.getSelection();return p&&n.add(p),{range:d,selection:p}});n.forEach(r=>r.removeAllRanges()),s.forEach(r=>{var i;return r&&((i=r.selection)==null?void 0:i.addRange(r.range))})}catch{}}applyStyleSheetMutation(e){var n;let s=null;e.styleId?s=this.styleMirror.getStyle(e.styleId):e.id&&(s=((n=this.mirror.getNode(e.id))==null?void 0:n.sheet)||null),s&&(e.source===ls.StyleSheetRule?this.applyStyleSheetRule(e,s):e.source===ls.StyleDeclaration&&this.applyStyleDeclaration(e,s))}applyStyleSheetRule(e,n){var s,r,i,a;if((s=e.adds)==null||s.forEach(({rule:o,index:l})=>{try{if(Array.isArray(l)){const{positions:u,index:d}=Tee(l),f=Uy(n.cssRules,u);f==null||f.insertRule(o,d)}else{const u=l===void 0?void 0:Math.min(l,n.cssRules.length);n==null||n.insertRule(o,u)}}catch{}}),(r=e.removes)==null||r.forEach(({index:o})=>{try{if(Array.isArray(o)){const{positions:l,index:u}=Tee(o),d=Uy(n.cssRules,l);d==null||d.deleteRule(u||0)}else n==null||n.deleteRule(o)}catch{}}),typeof e.replace=="string")try{(i=n.replace)==null||i.call(n,e.replace)}catch{}if(typeof e.replaceSync=="string")try{(a=n.replaceSync)==null||a.call(n,e.replaceSync)}catch{}}applyStyleDeclaration(e,n){if(e.set){const s=Uy(n.rules,e.index);s!=null&&s.style&&s.style.setProperty(e.set.property,e.set.value,e.set.priority)}if(e.remove){const s=Uy(n.rules,e.index);s!=null&&s.style&&s.style.removeProperty(e.remove.property)}}applyAdoptedStyleSheet(e){var n;const s=this.mirror.getNode(e.id);if(!s)return;(n=e.styles)==null||n.forEach(o=>{var l;let u=null,d=null;if(wE(s)?d=((l=s.ownerDocument)==null?void 0:l.defaultView)||null:s.nodeName==="#document"&&(d=s.defaultView),!!d)try{u=new d.CSSStyleSheet,this.styleMirror.add(u,o.styleId),this.applyStyleSheetRule({source:ls.StyleSheetRule,adds:o.rules},u)}catch{}});const r=10;let i=0;const a=(o,l)=>{const u=l.map(d=>this.styleMirror.getStyle(d)).filter(d=>d!==null);wE(o)?o.shadowRoot.adoptedStyleSheets=u:o.nodeName==="#document"&&(o.adoptedStyleSheets=u),u.length!==l.length&&i<r&&(setTimeout(()=>a(o,l),0+100*i),i++)};a(s,e.styleIds)}legacy_resolveMissingNode(e,n,s,r){const{previousId:i,nextId:a}=r,o=i&&e[i],l=a&&e[a];if(o){const{node:u,mutation:d}=o;n.insertBefore(u,s),delete e[d.node.id],delete this.legacy_missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.legacy_resolveMissingNode(e,n,u,d)}if(l){const{node:u,mutation:d}=l;n.insertBefore(u,s.nextSibling),delete e[d.node.id],delete this.legacy_missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.legacy_resolveMissingNode(e,n,u,d)}}moveAndHover(e,n,s,r,i){const a=this.mirror.getNode(s);if(!a)return this.debugNodeNotFound(i,s);const o=Hve(a,this.iframe),l=e*o.absoluteScale+o.x,u=n*o.absoluteScale+o.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${u}px`,r||this.drawMouseTail({x:l,y:u}),this.hoverElements(a)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:n,lineWidth:s,strokeStyle:r,duration:i}=this.config.mouseTail===!0?NL:Object.assign({},NL,this.config.mouseTail),a=()=>
463{if(!this.mouseTail)return;const o=this.mouseTail.getContext("2d");!o||!this.tailPositions.length||(o.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),o.beginPath(),o.lineWidth=s,o.lineCap=n,o.strokeStyle=r,o.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>o.lineTo(l.x,l.y)),o.stroke())};this.tailPositions.push(e),a(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(o=>o!==e),a()},i/this.speedService.state.context.timer.speed)}hoverElements(e){var n;(n=this.lastHoveredRootNode||this.iframe.contentDocument)==null||n.querySelectorAll(".\\:hover").forEach(r=>{r.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let s=e;for(;s;)s.classList&&s.classList.add(":hover"),s=s.parentElement}isUserInteraction(e){return e.type!==gr.IncrementalSnapshot?!1:e.data.source>ls.Mutation&&e.data.source<=ls.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(Zn.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,n){this.warn(`Node with id '${n}' not found. `,e)}warnCanvasMutationFailed(e,n){this.warn("Has error on canvas update",n,"canvas mutation:",e)}debugNodeNotFound(e,n){this.debug(`Node with id '${n}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(Dee,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(Dee,...e)}}let An=null,oT=null,uh=!1,c5=null,Zve={},GD="#00000023",gh=!0,WD=null,Xve=16;const $ee=80;function Qve(){oT&&(cancelAnimationFrame(oT),oT=null)}async function Jve(){if(!c5||!gh||!An)return!1;try{const t=await c5();return t&&t.length>0?(t.forEach(e=>An.addEvent(e)),t1e(Zve,GD),!0):(gh=!1,!1)}catch{return gh=!1,!1}}function e1e(){if(!An||!WD||!document.body.contains(WD)){Qve();return}const t=An.getCurrentTime(),e=An.getMetaData(),n=e.totalTime,s=el.get(),r=An.service.state.value;yR.set(e),w2.set(t);const i=5e3*cv.get();if(gh&&!uh&&n-t<i&&(uh=!0,Jve().finally(()=>{uh=!1})),t>=n&&uh)r==="playing"&&An.pause(),lv.set(!0);else if(t>=n&&!gh){const f=bR.get();f&&f>n&&w2.set(f),el.set("ended")}else lv.get()||(s==="playing"&&r!=="playing"?An.play(t):(s==="paused"||s==="ended")&&r==="playing"&&An.pause());const a=$0.get(),o=dv.get(),l=cv.get();let u=!1;if(a&&s==="playing"&&e.startTime)for(const f of o){const p=f.start-e.startTime,m=f.end-e.startTime;if(t>=p&&t<m){u=!0;break}}const d=u?Xve:l;An.config.speed!==d&&An.setConfig({speed:d}),yF.set(u?"skipping":"normal"),oT=requestAnimationFrame(e1e)}function Fee(t,e){const{width:n,height:s}
463=uv.get(),r=FD.get(),i=n/e.width,a=s/e.height,o=[i,a];r&&o.push(r),t.style.transform=`scale(${Math.min(...o)}) translate(-50%, -50%)`}function t1e(t,e){if(!An)return;const n=An.getMetaData(),s=An.service.state.context.events,{startTime:r}=n,i=n.endTime-r,a=Math.max(i,bR.get()??0);if(a===0){n5.set([]),dv.set([]);return}const o=u=>`${(u-r)/a*100}%`,l=s.filter(u=>u.type===bF.Custom).map(u=>({name:u.data.tag,background:t[u.data.tag]||"rgb(73, 80, 246)",position:o(u.timestamp)}));n5.set(l);try{const u=Est(s,An.config.inactivePeriodThreshold),d=(p,m)=>`${(m-p)/a*100}%`,f=u.map(p=>({name:"inactive period",background:e,position:o(p[0]),width:d(p[0],p[1]),start:p[0],end:p[1]}));dv.set(f)}catch(u){console.error("Failed to calculate inactive periods:",u),dv.set([])}}const Ea={init(t){const{containerEl:e,frameEl:n,playerEl:s,events:r,maxScale:i=1,autoPlay:a=!0,speed:o=1,skipInactive:l=!0,skipInactiveSpeed:u=16,showController:d=!0,tags:f={},inactiveColor:p=GD,onBufferEnd:m,approximateTotalTime:v,...x}=t;WD=s,Xve=u,Zve=f,GD=p,v&&bR.set(v),c5=m||null;const y=e.clientWidth,_=e.clientHeight-$ee;uv.set({width:y,height:_}),dJ.set({width:y,height:_}),FD.set(i),$0.set(l),cv.set(o),An=new Pit(r,{root:n,speed:o,skipInactive:!1,unpackFn:zge,UNSAFE_replayCanvas:!0,...x}),window.replayer=An,t1e(f,p),An.on("resize",E=>Fee(An.wrapper,E)),a&&this.play(),e1e()},updateDimensions(t,e){uv.set({width:t,height:e-$ee}),this.triggerResize()},destroy(){Qve(),An&&An.destroy(),An=null,uh=!1,el.set("paused"),lv.set(!1),yF.set("normal"),w2.set(0),yR.set(null),$0.set(!0),cv.set(1),FD.set(1),uv.set({width:1024,height:576}),dJ.set({width:1024,height:576}),fve.set(null),hve.set(!1),pve.set(null),n5.set([]),dv.set([])},getReplayer(){return An},play(t){if(!An)return;const e=t??An.getCurrentTime();An.play(e<0?void 0:e),el.set("playing")},pause(t){An&&(An.pause(t),el.set("paused"))},toggle(){const t=el.get();if(t==="playing")Ea.pause();else{const e=t==="ended";Ea.play(e?0:void 0)}},async goto(t,e){if(!An||uh)return;const n=An.getMetaData().totalTime;if(t>n&&!gh){this.pause(n),el.set("ended");return}if(!(t>n)){e??el.get()==="playing"?this.play(t):this.pause(t);return}if(!c5||!gh){this.play(n);return}for(uh=!0,lv.set(!0),An.pause(),w2.set(t);An.getMetaData().totalTime<t&&gh;)await Jve();uh=!1,lv.set(!1);const r=An.getMetaData().totalTime;t>r?(this.pause(r),el.set("ended")):e??el.get()==="playing"?this.play(t):this.pause(t)},setSpeed(t){cv.set(t)},toggleSkipInactive(){$0.set(!$0.get())},triggerResize(){An&&Fee(An.wrapper,{width:An.iframe.offsetWidth,height:An.iframe.offsetHeight})}};function n1e(){Ea.toggle()}function Mit(){el.get()==="ended"?FF(0,!0):Ea.play()}function Dit(){Ea.pause()}function FF(t,e){$D.set(!0),Ea.goto(t,e).finally(()=>{$D.set(!1)})}function s1e(t){Ea.setSpeed(t)}function r1e(){Ea.toggleSkipInactive()}function Oit(t,e,n=!1,s){fve.set(n?{start:t,end:e}:null),hve.set(e),pve.set(s||null),Ea.play(t)}function $it(t,e){Ea.updateDimensions(t,e)}const Fit=({disabled:t,checked:e,onChange:n,id:s,label:r})=>c.jsxs("div",{className:`rr-switch ${t?"disabled":""}`,children:[c.jsx("input",{type:"checkbox",id:s,checked:e,disabled:t,onChange:i=>n(i.target.checked)}),c.jsx("label",{htmlFor:s}),c.jsx("span",{className:"label",children:r})]});function Uit({speedOption:t}){const e=mo(w2),n=mo(yR),s=mo(el),r=mo(yF),i=mo(cv),a=mo($0),o=mo(n5),l=mo(dv),u=mo(bR),d=Math.max(u??0,(n==null?void 0:n.totalTime)??0),f=w.useRef(null),p=w.useMemo(()=>d?`${100*Math.min(1,e/d)}%`:"0%",[e,d]),m=v=>{if(r==="skipping"||!f.current)return;const x=f.current.getBoundingClientRect(),y=Math.max(0,Math.min(1,(v.clientX-x.left)/x.width));FF(d*y)};return c.jsxs("div",{className:"rr-controller",children:[c.jsxs("div",{className:"rr-timeline",children:[c.jsx("span",{className:"rr-timeline__time",children:s5(e)}),c.jsxs("div",{className:`rr-progress ${r==="skipping"?"disabled":""}`,ref:f,onClick:m,children:[c.jsx("div",{className:"rr-progress__step",style:{width:p}}),l.map((v,x)=>c.jsx("div",{title:v.name,style:{width:v.width,height:"100%",position:"absolute",background:v.background,left:v.position}},x)),o.map((v,x)=>
463c.jsx("div",{title:v.name,style:{width:"10px",height:"5px",position:"absolute",top:"2px",transform:"translate(-50%, -50%)",background:v.background,left:v.position}},x))]}),c.jsx("span",{className:"rr-timeline__time",children:s5(d||0)})]}),c.jsxs("div",{className:"rr-controller__btns",children:[c.jsx("button",{onClick:n1e,children:s==="playing"?c.jsx("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16",children:c.jsx("path",{d:"M682.7 128q53 0 90.5 37.5T810.7 256v512q0 53-37.5 90.5T682.7 896q-53 0-90.5-37.5T554.7 768V256q0-53 37.5-90.5T682.7 128zM341.3 128q53 0 90.5 37.5T469.3 256v512q0 53-37.5 90.5T341.3 896q-53 0-90.5-37.5T213.3 768V256q0-53 37.5-90.5T341.3 128z"})}):c.jsx("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16",children:c.jsx("path",{d:"M170.7 896V128l640 384zM644.7 512L256 278.6v466.7z"})})}),t.map(v=>c.jsxs("button",{className:v===i&&r!=="skipping"?"active":"",onClick:()=>s1e(v),disabled:r==="skipping",children:[v,"x"]},v)),c.jsx(Fit,{id:"skip",checked:a,onChange:r1e,disabled:r==="skipping",label:"skip inactive"})]})]})}const i1e=w.forwardRef((t,e)=>{const{showController:n=!0,speedOption:s=[1,2,4,8]}=t,r=w.useRef(null),i=w.useRef(null),a=mo(uv),o=mo(yR),l=mo(lv),u=mo($D),f={width:`${a.width}px`,height:`${a.height+(n?80:0)}px`},p={width:`${a.width}px`,height:`${a.height}px`};return w.useImperativeHandle(e,()=>{const m=()=>{const v=Ea.getReplayer();if(!v)throw new Error("Player is not initialized. Cannot access replayer instance.");return v};return{init:v=>{i.current&&r.current&&Ea.init({...t,containerEl:v,frameEl:i.current,playerEl:r.current,mouseTail:!1,skipInactive:!0})},destroy:()=>{Ea.destroy()},addEventListener:(v,x)=>{var y;(y=Ea.getReplayer())==null||y.on(v,x)},addEvent:v=>{m().addEvent(v)},getMetaData:()=>m().getMetaData(),getReplayer:()=>m(),getMirror:()=>m().getMirror(),toggle:n1e,setSpeed:s1e,toggleSkipInactive:r1e,play:Mit,pause:Dit,goto:FF,playRange:Oit,triggerResize:()=>Ea.triggerResize(),$set:v=>uv.set(v)}}),c.jsxs("div",{className:"rr-player",ref:r,style:f,children:[c.jsxs("div",{children:[c.jsx("div",{className:"rr-player__frame",ref:i,style:p}),(l||u)&&c.jsx("div",{className:"absolute inset-0 z-1 flex items-center justify-center bg-black/15 z-50",children:c.jsx("div",{className:"rr-overlay-spinner text-slate-50"})})]}),o&&n&&c.jsx(Uit,{speedOption:s})]})});i1e.displayName="Player";const Bit={hobby:24,starter:48,developer:168,pro:336,enterprise:336};function a1e(t,e){const n=Bit[t]*60*60*1e3;return Date.now()-new Date(e).getTime()>n}function zit({expired:t}){return c.jsxs("div",{className:"flex w-full aspect-video flex-col items-center justify-center gap-1 rounded-[12px] bg-[var(--sand-2)] px-6 text-center font-sans",children:[c.jsx("span",{className:"mb-2 text-[var(--sand-11)]",children:c.jsx(gF,{size:24})}),c.jsxs("p",{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:["This session has ",t?"expired.":"no events."]}),c.jsx("p",{className:"max-w-[420px] text-[14px] leading-[20px] text-[var(--sand-11)]",children:t?"It has reached the end of its retention period and is no longer available.":c.jsxs(c.Fragment,{children:["If you're using Playwright, make sure you're using the"," ",c.jsx("a",{href:"https://docs.steel.dev/overview/guides/connect-with-playwright-node#method-2-create-and-connect",target:"_blank",rel:"noreferrer",className:"underline",children:"existing context"})," ","to capture recordings."]})}),c.jsxs("p",{className:"mt-6 max-w-[420px] text-[14px] leading-[20px] text-[var(--sand-11)]",children:["If you think this is an error, message us on"," ",c.jsx("a",{href:"https://discord.gg/gPpvhNvc5R",target:"_blank",rel:"noreferrer",className:"underline",children:"Discord"}),"."]})]})}function Vit(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M15 9L9 15M15 15L9 9M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function o1e(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M4 10V6C4 4.89543 4.89543 4 6 4H19C20.1046 4 21 4.89543 21 6V13C21 14.1046 20.1046 15 19 15H15M14 11V8M14 11H17M14 11L17 8M9 21H5C3.89543 21 3 20.1046 3 19V16C3 14.8954 3.89543 14 5 14H9C10.1046 14 11 14.8954 11 16V19C11 20.1046 10.1046 21 9 21Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Uee(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M5 6C5 4.89543 5.89543 4 7 4C8.10457 4 9 4.89543 9 6V18C9 19.1046 8.10457 20 7 20C5.89543 20 5 19.1046 5 18V6Z",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M15 6C15 4.89543 15.8954 4 17 4C18.1046 4 19 4.89543 19 6V18C19 19.1046 18.1046 20 17 20C15.8954 20 15 19.1046 15 18V6Z",stroke:"currentColor",strokeWidth:"2"})]})}function Bee(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M20.245 10.2984L9.05099 3.38443C7.71854 2.56145 6 3.51992 6 5.08603V18.914C6 20.4801 7.71854 21.4385 9.05098 20.6156L20.245 13.7016C21.5104 12.9201 21.5104 11.0799 20.245 10.2984Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}const at=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)}
463,Hit=Number.isSafeInteger||function(t){return typeof t=="number"&&Math.abs(t)<=Git},Git=Number.MAX_SAFE_INTEGER||9007199254740991;let _t=(function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t})({}),pe=(function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",t.UNKNOWN="unknown",t})({}
vendor: 4,306 bytes, line 463
463),H=(function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t})({});function Wit(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var IL={exports:{}},zee;function qit(){return zee||(zee=1,(function(t,e){(function(n){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,d){if(d=d||{},l=l.trim(),u=u.trim(),!u){if(!d.alwaysNormalize)return l;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var p=o.parseURL(u);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return d.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):u;var m=o.parseURL(l);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var v=r.exec(m.path);m.netLoc=v[1],m.path=v[2]}m.netLoc&&!m.path&&(m.path="/");var x={scheme:m.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};
vendor: 61,345 bytes, lines 463-473
463if(!p.netLoc&&(x.netLoc=m.netLoc,p.path[0]!=="/"))if(!p.path)x.path=m.path,p.params||(x.params=m.params,p.query||(x.query=m.query));else{var y=m.path,S=y.substring(0,y.lastIndexOf("/")+1)+p.path;x.path=o.normalizePath(S)}return x.path===null&&(x.path=d.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(x)},parseURL:function(l){var u=s.exec(l);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(i,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};t.exports=o})()})(IL)),IL.exports}var UF=qit();class BF{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var hn={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack",MEDIA_FRAGMENT:"media-fragment",KEY:"key",STEERING_MANIFEST:"steering-manifest",SERVER_CERTIFICATE:"server-certificate",INTERSTITIAL_ASSET_LIST:"interstitial-asset-list"},vt={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},Is={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class l1e{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Yit(this,"stats")}setByteRange(e,n){const s=e.split("@",2);let r;s.length===1?r=(n==null?void 0:n.byteRangeEndOffset)||0:r=parseInt(s[1]),this._byteRange=[r,parseInt(s[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[Is.AUDIO]:null,[Is.VIDEO]:null,[Is.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new BF),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=UF.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Is.AUDIO]=null,e[Is.VIDEO]=null,e[Is.AUDIOVIDEO]=null,this.url=null}}function vr(t){return t.sn!=="initSegment"}function zy(t,e){return t.sn===(e==null?void 0:e.sn)&&t.level===e.level}function qD(t,e){return t.sn===(e==null?void 0:e.sn)&&t.level===e.level&&t.cc===e.cc}class CE extends l1e{constructor(e,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],n=this.byteRange[1];if(at(e)&&at(n))return n-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:n}=this;if(!n||n.NONE)return null;if(n.identity)this._decryptdata||(this._decryptdata=n.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const s=Object.keys(n);if(s.length===1){const r=this._decryptdata=n[s[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,n))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=at(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var n;const s=Object.keys(this.levelkeys),r=s.length;if(r>1||r===1&&(n=this.levelkeys[s[0]])!=null&&n.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!at(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return vr(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const n=this.levelkeys;if(n){var s;const r=n[e];r&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,n))}}abortRequests(){var e,n;(e=this.loader)==null||e.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(e,n,s,r,i,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:n,endPTS:s,startDTS:r,endDTS:i,partial:a};return}l.startPTS=Math.min(l.startPTS,n),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,i)}}class Kit extends l1e{constructor(e,n,s,r,i){super(s),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=n,this.index=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===vt.SUBTITLE&&this.stats.loaded)}}function c1e(t,e){const n=Object.getPrototypeOf(t);if(n){const s=Object.getOwnPropertyDescriptor(n,e);return s||c1e(n,e)}}function Yit(t,e){const n=c1e(t,e);n&&(n.enumerable=!0,Object.defineProperty(t,e,n))}function Zit(t,e,n){return(e=Jit(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ms(){return ms=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ms.apply(null,arguments)}function Vee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,s)}return n}function Rt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vee(Object(n),!0).forEach(function(s){Zit(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vee(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function PR(t,e){if(t==null)return{};var n,s,r=Xit(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Xit(t,e){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(e.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function Qit(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jit(t){var e=Qit(t,"string");return typeof e=="symbol"?e:e+""}function u5(t){switch(t.details){case pe.FRAG_LOAD_TIMEOUT:case pe.KEY_LOAD_TIMEOUT:case pe.LEVEL_LOAD_TIMEOUT:case pe.MANIFEST_LOAD_TIMEOUT:case pe.AUDIO_TRACK_LOAD_TIMEOUT:case pe.SUBTITLE_TRACK_LOAD_TIMEOUT:case pe.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function u1e(t){return t.details.startsWith("key")}function d1e(t){return u1e(t)&&!!t.frag&&!t.frag.decryptdata}function Hee(t,e){const n=u5(e);return t.default[`${n?"timeout":"error"}Retry`]}function zF(t,e){const n=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(n*t.retryDelayMs,t.maxRetryDelayMs)}function Gee(t){return Rt(Rt({},t),{errorRetry:null,timeoutRetry:null})}function _2(t,e,n,s){if(!t)return!1;const r=s==null?void 0:s.code,i=e<t.maxNumRetry&&(eat(r)||!!n);return t.shouldRetry?t.shouldRetry(t,e,n,s,i):i}function eat(t){return E2(t)||!!t&&(t<400||t>499)}function E2(t){return t===0&&navigator.onLine===!1}function f1e(t,e){return e>0&&t.loadError>0&&t.loadErrorTime!==0&&self.performance.now()-t.loadErrorTime>e}class Zg{constructor(e,n=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=n,this.totalWeight_=s}sample(e,n){const s=Math.pow(this.alpha_,e);this.estimate_=n*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class tat{constructor(e,n,s,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Zg(e),this.fast_=new Zg(n),this.defaultTTFB_=r,this.ttfb_=new Zg(e)}update(e,n){const{slow_:s,fast_:r,ttfb_:i}=this;s.halfLife!==e&&(this.slow_=new Zg(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==n&&(this.fast_=new Zg(n,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new Zg(e,i.getEstimate(),i.getTotalWeight()))}sample(e,n){if(n<=0)return;const s=Math.min(this.minDelayMs_,n/1e5),r=8*n,i=Math.max(e,s)/1e3,a=r/i;this.fast_.sample(i,a),this.slow_.sample(i,a)}sampleTTFB(e){const n=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}class Oo{constructor(e,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${e}]:`;this.trace=Hf,this.debug=n.debug.bind(null,s),this.log=n.log.bind(null,s),this.warn=n.warn.bind(null,s),this.info=n.info.bind(null,s),this.error=n.error.bind(null,s)}}const Hf=function(){},nat={trace:Hf,debug:Hf,log:Hf,warn:Hf,info:Hf,error:Hf};function KD(){return ms({},nat)}function sat(t,e){const n=self.console[t];return n?n.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):Hf}function Wee(t,e,n){return e[t]?e[t].bind(e):sat(t,n)}const YD=KD();function rat(t,e,n){const s=KD();if(typeof console=="object"&&t===!0||typeof t=="object"){const r=["debug","log","info","warn","error"];r.forEach(i=>{s[i]=Wee(i,t,n)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.7.1`)}catch{return KD()}r.forEach(i=>{YD[i]=Wee(i,t)})}else ms(YD,s);return s}const Gn=YD;function Uh(t=!0){return typeof self>"u"?void 0:(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function iat(t){return typeof self<"u"&&t===self.ManagedMediaSource}function h1e(t,e){const n=Object.keys(t),s=Object.keys(e),r=n.length,i=s.length;return!r||!i||r===i&&!n.some(a=>s.indexOf(a)===-1)}function aat(t){return btoa(String.fromCharCode(...t))}function MR(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}const oat="utf-16",LL="utf-16be",qee="utf-16le",lT="utf-8";function lat(t,e={}){let n;MR(t)?n=new DataView(t):n=new DataView(t.buffer,t.byteOffset,t.byteLength);let s=0,{encoding:r}=e;if(!r){const u=n.getUint8(0),d=n.getUint8(1);u==239&&d==187&&n.getUint8(2)==191?(r=lT,s=3):u==254&&d==255?(r=LL,s=2):u==255&&d==254?(r=qee,s=2):r=lT}if(typeof TextDecoder<"u")return new TextDecoder(r).decode(n);const{byteLength:i}=n,a=r!==LL;let o="",l;for(;s<i;){switch(r){case lT:if(l=n.getUint8(s),l<128)s++;else if(l>=194&&l<=223)if(s+1<i){const u=n.getUint8(s+1);u>=128&&u<=191?(l=(l&31)<<6|u&63,s+=2):s++}else s++;else if(l>=224&&l<=239)if(s+2<=i-1){const u=n.getUint8(s+1),d=n.getUint8(s+2);u>=128&&u<=191&&d>=128&&d<=191?(l=(l&15)<<12|(u&63)<<6|d&63,s+=3):s++}else s++;else if(l>=240&&l<=244)if(s+3<=i-1){const u=n.getUint8(s+1),d=n.getUint8(s+2),f=n.getUint8(s+3);u>=128&&u<=191&&d>=128&&d<=191&&f>=128&&f<=191?(l=(l&7)<<18|(u&63)<<12|(d&63)<<6|f&63,s+=4):s++}else s++;else s++;break;case LL:case oat:case qee:l=n.getUint16(s,a),s+=2;break}o+=String.fromCodePoint(l)}return o}function cat(t){const e=typeof t=="string"?new URL(t):t;return e.origin+e.pathname.substring(0,e.pathname.lastIndexOf("/")+1)}function p1e(t,e){if(t<0)return-p1e(-t,e);const n=Math.pow(10,e);if(Math.abs(t*n%1-.5)<Number.EPSILON){const s=Math.floor(t*n);return(s%2===0?s:s+1)/n}else return Math.round(t*n)/n}function uat(t,e){let n;try{n=new URL(t)}catch{return t}const s=new URL(e);if(n.origin!==s.origin)return t;const r=n.pathname.split("/").slice(1),i=s.pathname.split("/").slice(1,-1),a=Math.min(r.length,i.length);for(let o=0;o<a&&r[o]===i[o];o++)r.shift(),i.shift();for(;i.length;)i.shift(),r.unshift("..");return r.join("/")+n.search+n.hash}function m1e(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),n=e.toString();return URL.revokeObjectURL(e),n.slice(n.lastIndexOf("/")+1)}catch{let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const r=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(s=="x"?r:r&3|8).toString(16)})}}}function VF(t,e){return e+10<=t.length&&t[e]===73&&t[e+1]===68&&t[e+2]===51&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function DR(t,e){let n=0;return n=(t[e]&127)<<21,n|=(t[e+1]&127)<<14,n|=(t[e+2]&127)<<7,n|=t[e+3]&127,n}function dat(t,e){return VF(t,e)&&DR(t,e+6)+10<=t.length-e}function g1e(t,e){return e+10<=t.length&&t[e]===51&&t[e+1]===68&&t[e+2]===73&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function C2(t,e){const n=e;let s=0;for(;VF(t,e);){s+=10;const r=DR(t,e+6);s+=r,g1e(t,e+10)&&(s+=10),e+=s}if(s>0)return t.subarray(n,n+s)}function fat(t){return MR(t)?t:t.byteOffset==0&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function jL(t,e=0,n=1/0){return hat(t,e,n,Uint8Array)}function hat(t,e,n,s){const r=pat(t);let i=1;"BYTES_PER_ELEMENT"in s&&(i=s.BYTES_PER_ELEMENT);const a=mat(t)?t.byteOffset:0,o=(a+t.byteLength)/i,l=(a+e)/i,u=Math.floor(Math.max(0,Math.min(l,o)));return new s(r,u,Math.floor(Math.min(u+Math.max(n,0),o))-u)}function pat(t){return MR(t)?t:t.buffer}function mat(t){return t&&MR(t.buffer)&&t.byteLength!==void 0&&t.byteOffset!==void 0}function Lo(t,e=!1){const n=e?t.indexOf(0):t.length,s=lat(new DataView(t.buffer,t.byteOffset,n),{encoding:lT});return e?s:s.replace(/\0/g,"")}function gat(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(t.size<2)return;if(t.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const s=t.data.subarray(1).indexOf(0);if(s===-1)return;const r=Lo(jL(t.data,1,s)),i=t.data[2+s],a=t.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=Lo(jL(t.data,3+s,a));let l;return r==="-->"?l=Lo(jL(t.data,4+s+a)):l=fat(t.data.subarray(4+s+a)),e.mimeType=r,e.pictureType=i,e.description=o,e.data=l,e}function vat(t){if(t.size<2)return;const e=Lo(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}function xat(t){if(t.size<2)return;if(t.type==="TXXX"){let n=1;const{data:s}=t,r=Lo(s.subarray(n),!0);n+=r.length+1;const i=Lo(s.subarray(n));return{key:t.type,info:r,data:i}}const e=Lo(t.data.subarray(1));return{key:t.type,info:"",data:e}}function yat(t){if(t.type==="WXXX"){if(t.size<2)return;let n=1;const s=Lo(t.data.subarray(n),!0);n+=s.length+1;const r=Lo(t.data.subarray(n));return{key:t.type,info:s,data:r}}const e=Lo(t.data);return{key:t.type,info:"",data:e}}function bat(t){return t.type==="PRIV"?vat(t):t.type[0]==="W"?yat(t):t.type==="APIC"?gat(t):xat(t)}function Sat(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=DR(t,4),s=10;return{type:e,size:n,data:t.subarray(s,s+n)}}const TE=10,wat=10;function v1e(t){let e=0;const n=[];for(;VF(t,e);){const s=DR(t,e+6);t[e+5]>>6&1&&(e+=TE),e+=TE;const r=e+s;for(;e+wat<r;){const i=Sat(t.subarray(e)),a=bat(i);a&&n.push(a),e+=i.size+TE}g1e(t,e)&&(e+=TE)}return n}function x1e(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"}function _at(t){if(t.data.byteLength===8){const e=new Uint8Array(t.data),n=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,n&&(s+=4772185884e-2),Math.round(s)}}function HF(t){const e=v1e(t);for(const n of e)if(x1e(n))return _at(n)}function Zr(t){let e="";for(let n=0;n<t.length;n++){let s=t[n].toString(16);s.length<2&&(s="0"+s),e+=s}return e}function y1e(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function GF(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function ic(t){return String.fromCharCode.apply(null,t)}const Rc=Math.pow(2,32)-1,Gt={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},b1e={video:1,audio:2,id3:3,text:4};function S1e(t,e){const n=t[e]<<8|t[e+1];return n<0?65536+n:n}function pt(t,e){const n=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return n<0?4294967296+n:n}function Kee(t,e){let n=pt(t,e);return n*=Math.pow(2,32),n+=pt(t,e+4),n}function kE(t,e){let n="";for(let s=e;s<t.length;s++)if(n+=String.fromCharCode(t[s]),t[s]===0)return n;return null}function ZD(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Br(t,e,n){t[e]=n>>24,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=n&255}function Yee(t,e,n){const s=e.byteOffset-t.byteOffset-8,r=8+n,i=e.byteLength+8-r;i<8||(Br(t,s,r),Br(t,s+r,i),Br(t,s+r+4,Gt.free))}function XD(t,e){return[t.byteOffset-e-8,t.byteOffset-e+t.byteLength]}function w1e(t,e){e.sort((o,l)=>o[0]-l[0]);const n=e.reduce((o,[l,u])=>o+u-l,0),s=new Uint8Array(t.byteLength-n);let r=0,i=0;for(let o=0;o<e.length;o++){const[l,u]=e[o];s.set(t.subarray(r,l),i),i+=l-r,r=u}return s.set(t.subarray(r),i),{result:s,dropped:n,droppedBefore:o=>e.reduce((l,[u,d])=>d<=o?l+d-u:l,0)}}function Eat(t){const e=Yt(t,["moov"]);if(e.length!==1||Yt(t,["moof"]).length)return null;const n=t.byteOffset,s=[],r=[];let i=!1;const a=Yt(e[0],["trak"]);for(let m=0;m<a.length;m++){const v=a[m],x=Yt(v,["mdia","hdlr"])[0];if((x?ic(x.subarray(8,12)):"")==="vide"){i=!0;continue}const S=Yt(v,["tkhd"])[0];if(!S)return null;const _=S[0];r.push(pt(S,_===0?12:20)),s.push(XD(v,n))}if(!i||!s.length)return null;const o=Yt(e[0],["mvex"])[0];let l=0;if(o){const m=Yt(o,["trex"]);for(let v=0;v<m.length;v++){const x=m[v];r.indexOf(pt(x,4))!==-1&&(s.push(XD(x,n)),l+=x.byteLength+8)}}const{result:u,dropped:d,droppedBefore:f}=w1e(t,s),p=e[0].byteOffset-n-8;if(Br(u,p,e[0].byteLength+8-d),o&&l){const m=o.byteOffset-n-8;Br(u,m-f(m),o.byteLength+8-l)}return u}function Cat(t,e,n,s,r){if(n<1)return null;const i=Yt(t,["moof"]);if(i.length!==1)return null;const a=i[0],o=t.byteOffset,l=[],u=[],d=Yt(a,["traf"]);let f=!0;for(let x=0;x<d.length;x++){const y=d[x],S=Yt(y,["tfhd"])[0];if(!S)return null;pt(S,4)===e?(l.push(y),pt(S,0)&131072||(f=!1)):u.push(XD(y,o))}if(!l.length||u.length&&!f)return null;if(s!==void 0){let x=n;for(let S=0;S<l.length;S++){const _=l[S];let E=0;const T=Yt(_,["trun"]);for(let I=0;I<T.length;I++){const A=T[I],L=Math.min(x,pt(A,4));if(L){Br(t,A.byteOffset-o+4,L);const j=pt(A,0)&16777215,F=(j&256?4:0)+(j&512?4:0)+(j&1024?4:0)+(j&2048?4:0);Yee(t,A,8+(j&1?4:0)+(j&4?4:0)+L*F)}else Br(t,A.byteOffset-o-4,Gt.free);x-=L,E+=L}const k=Yt(_,["senc"])[0];k&&Br(t,k.byteOffset-o+4,E);const R=Yt(_,["saiz"])[0];if(R){const I=R[1]<<16|R[2]<<8|R[3];let A=4;I&1&&(A+=8);const L=R[A];A+=1,Br(t,R.byteOffset-o+A,E),Yee(t,R,A+4+(L===0?E:0))}}const y=Yt(t,["mdat"]);if(y.length===1){const S=y[0].byteOffset-o-8;Br(t,S,s-S)}}let p=t,m=0,v=()=>0;if(u.length){({result:p,dropped:m,droppedBefore:v}=w1e(t,u)),Br(p,a.byteOffset-o-8,a.byteLength+8-m);for(let x=0;x<l.length;x++){const y=l[x],S=v(y.byteOffset-o),_=Yt(y,["trun"]);for(let E=0;E<_.length;E++){const T=_[E];pt(T,0)&1&&Br(p,T.byteOffset-o-S+8,pt(T,8)-m)}if(S){const E=Yt(y,["saio"]);for(let T=0;T<E.length;T++){const k=E[T],R=k[0]===0?4:8;let I=pt(k,0)&1?12:4,A=pt(k,I);for(I+=4;A--;I+=R){const L=I+R-4;Br(p,k.byteOffset-o-S+L,pt(k,L)-S)}}}}}if(r){const{durationOffset:x,value:y}=r;Br(p,x-v(x),y)}return s!==void 0?p.subarray(0,s-m):p}function Tat(t,e){const n=t.byteLength;for(let s=0;s<n;){const r=pt(t,s);if(r>8&&pt(t,s+4)===Gt[e])return!0;s=r>1?s+r:n}return!1}function Yt(t,e){const n=[];return e.length&&_1e(t,e,0,0,t.byteLength,n),n}function _1e(t,e,n,s,r,i){const a=e[n];if((a==null?void 0:a.length)!==4)return;const o=a.charCodeAt(0),l=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=e.length-1;for(let p=s;p<r;){const m=p+8<=r,v=p+4<=r?t[p]*16777216+(t[p+1]<<16|t[p+2]<<8|t[p+3]):pt(t,p),x=v>1?p+v:r;if(m&&t[p+4]===o&&t[p+5]===l&&t[p+6]===u&&t[p+7]===d){const y=Math.min(x,r);n===f?i.push(t.subarray(p+8,y)):_1e(t,e,n+1,p+8,y,i)}p=x}}function kat(t){const e=[],n=t[0];let s=8;const r=pt(t,s);s+=4;let i=0,a=0;n===0?(i=pt(t,s),a=pt(t,s+4),s+=8):(i=Kee(t,s),a=Kee(t,s+8),s+=16),s+=2;let o=t.length+a;const l=S1e(t,s);s+=2;for(let u=0;u<l;u++){let d=s;const f=pt(t,d);d+=4;const p=f&2147483647;if((f&2147483648)>>>31===1)return Gn.warn("SIDX has hierarchical references (not supported)"),null;const v=pt(t,d);d+=4,e.push({referenceSize:p,subsegmentDuration:v,info:{duration:v/r,start:o,end:o+p-1}}),o+=p,d+=4,s=d}return{earliestPresentationTime:i,timescale:r,version:n,referencesCount:l,references:e}}function E1e(t){const e=[],n=Yt(t,["moov","trak"]);for(let r=0;r<n.length;r++){const i=n[r],a=Yt(i,["tkhd"])[0];if(a){let o=a[0];const l=pt(a,o===0?12:20),u=Yt(i,["mdia","mdhd"])[0];if(u){o=u[0];const d=pt(u,o===0?12:20),f=Yt(i,["mdia","hdlr"])[0];if(f){const p=ic(f.subarray(8,12)),m={soun:Is.AUDIO,vide:Is.VIDEO}[p],v=Yt(i,["mdia","minf","stbl","stsd"])[0],x=Rat(v);m?(e[l]={timescale:d,type:m,stsd:x},e[m]=Rt({timescale:d,id:l},x)):e[l]={timescale:d,type:p,stsd:x}}}}}return Yt(t,["moov","mvex","trex"]).forEach(r=>{const i=pt(r,4),a=e[i];a&&(a.default={duration:pt(r,12),sampleSize:pt(r,16),flags:pt(r,20)})}),e}function Rat(t){const e=t.subarray(8),n=e.subarray(86),s=ic(e.subarray(4,8));let r=s,i;const a=s==="enca"||s==="encv";if(a){const u=Yt(e,[s])[0].subarray(s==="enca"?28:78);Yt(u,["sinf"]).forEach(f=>{const p=Yt(f,["schm"])[0];if(p){const m=ic(p.subarray(4,8));if(m==="cbcs"||m==="cenc"){const v=Yt(f,["frma"])[0];v&&(r=ic(v))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const l=Yt(n,["avcC"])[0];l&&l.length>3&&(r+="."+AE(l[1])+AE(l[2])+AE(l[3]),i=RE(o==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const l=Yt(e,[s])[0],u=Yt(l.subarray(28),["esds"])[0];if(u&&u.length>7){let d=4;if(u[d++]!==3)break;d=PL(u,d),d+=2;const f=u[d++];if(f&128&&(d+=2),f&64&&(d+=u[d++]),u[d++]!==4)break;d=PL(u,d);const p=u[d++];if(p===64)r+="."+AE(p);else break;if(d+=12,u[d++]!==5)break;d=PL(u,d);const m=u[d++];let v=(m&248)>>3;v===31&&(v+=1+((m&7)<<3)+((u[d]&224)>>5)),r+="."+v}break}case"hvc1":case"hev1":{const l=Yt(n,["hvcC"])[0];if(l&&l.length>12){const u=l[1],d=["","A","B","C"][u>>6],f=u&31,p=pt(l,2),m=(u&32)>>5?"H":"L",v=l[12],x=l.subarray(6,12);r+="."+d+f,r+="."+Aat(p).toString(16).toUpperCase(),r+="."+m+v;let y="";for(let S=x.length;S--;){const _=x[S];(_||y)&&(y="."+_.toString(16).toUpperCase()+y)}r+=y}i=RE(o=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=RE(r,n)||r;break}case"vp09":{const l=Yt(n,["vpcC"])[0];if(l&&l.length>6){const u=l[4],d=l[5],f=l[6]>>4&15;r+="."+Ac(u)+"."+Ac(d)+"."+Ac(f)}break}case"av01":{const l=Yt(n,["av1C"])[0];if(l&&l.length>2){const u=l[1]>>>5,d=l[1]&31,f=l[2]>>>7?"H":"M",p=(l[2]&64)>>6,m=(l[2]&32)>>5,v=u===2&&p?m?12:10:p?10:8,x=(l[2]&16)>>4,y=(l[2]&8)>>3,S=(l[2]&4)>>2,_=l[2]&3;r+="."+u+"."+Ac(d)+f+"."+Ac(v)+"."+x+"."+y+S+_+"."+Ac(1)+"."+Ac(1)+"."+Ac(1)+"."+0,i=RE("dav1",n)}break}}return{codec:r,encrypted:a,supplemental:i}}function RE(t,e){const n=Yt(e,["dvvC"]),s=n.length?n[0]:Yt(e,["dvcC"])[0];if(s){const r=s[2]>>1&127,i=s[2]<<5&32|s[3]>>3&31;return t+"."+Ac(r)+"."+Ac(i)}}function Aat(t){let e=0;for(let n=0;n<32;n++)e|=(t>>n&1)<<31-n;return e>>>0}function PL(t,e){const n=e+5;for(;t[e++]&128&&e<n;);return e}function AE(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Ac(t){return(t<10?"0":"")+t}function Nat(t,e){if(!t||!e)return;const n=e.keyId;(n==null?void 0:n.byteLength)===16&&e.isCommonEncryption&&C1e(t,(s,r)=>{const i=s.subarray(8,24);i.some(a=>a!==0)||(Gn.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Zr(i)} -> ${Zr(n)}`),s.set(n,8))})}function Iat(t){const e=[];return C1e(t,n=>e.push(n.subarray(8,24))),e}function C1e(t,e){Yt(t,["moov","trak"]).forEach(s=>{const r=Yt(s,["mdia","minf","stbl","stsd"])[0];if(!r)return;const i=r.subarray(8);let a=Yt(i,["enca"]);const o=a.length>0;o||(a=Yt(i,["encv"])),a.forEach(l=>{const u=o?l.subarray(28):l.subarray(78);Yt(u,["sinf"]).forEach(f=>{const p=T1e(f);p&&e(p,o)})})})}function T1e(t){const e=Yt(t,["schm"])[0];if(e){const n=ic(e.subarray(4,8));if(n==="cbcs"||n==="cenc"){const s=Yt(t,["schi","tenc"])[0];if(s)return s}}}let Zee;function Lat(t){return typeof TextDecoder>"u"?Lo(t):(Zee||(Zee=new TextDecoder("utf-8"))).decode(t).replace(/\0/g,"")}function jat(t){const e=t.byteLength,n=[];for(let s=0;s<e;){const r=s+8<=e,i=s+4<=e?t[s]*16777216+(t[s+1]<<16|t[s+2]<<8|t[s+3]):pt(t,s),a=i>1?s+i:e;if(r&&t[s+4]===109&&t[s+5]===111&&t[s+6]===111&&t[s+7]===102){const o=Math.min(a,e);for(let l=s+8;l<o;){const u=l+8<=o,d=l+4<=o?t[l]*16777216+(t[l+1]<<16|t[l+2]<<8|t[l+3]):pt(t,l),f=d>1?l+d:o;if(u&&t[l+4]===116&&t[l+5]===114&&t[l+6]===97&&t[l+7]===102){const p=Math.min(f,o);let m,v;const x=[];for(let y=l+8;y<p;){const S=y+8<=p,_=y+4<=p?t[y]*16777216+(t[y+1]<<16|t[y+2]<<8|t[y+3]):pt(t,y),E=_>1?y+_:p;if(S&&t[y+4]===116){const T=Math.min(E,p);t[y+5]===102&&t[y+6]===104&&t[y+7]===100?v||(v=t.subarray(y+8,T)):t[y+5]===102&&t[y+6]===100&&t[y+7]===116?m||(m=t.subarray(y+8,T)):t[y+5]===114&&t[y+6]===117&&t[y+7]===110&&x.push(t.subarray(y+8,T))}y=E}n.push({moofOffset:t.byteOffset+s,tfdt:m,tfhd:v,truns:x})}l=f}}s=a}return n}function Pat(t,e,n,s,r=!0){return k1e(t,e,s,r)}function Mat(t,e,n,s,r=!1){const i=[],a=e.samples,o=k1e(a,n,s,r,{isHEVCFlavor:KS(e.codec),samples:i,timeOffset:t,timescale:e.timescale,trackId:e.id});return{samples:i,sampleData:{includeSampleDetails:r,tracks:o}}}function k1e(t,e,n,s,r){const i={};let a=!1;const o=jat(t),l=t.byteLength;for(let f=0;f<o.length;f++){const{moofOffset:p,tfdt:m,tfhd:v,truns:x}=o[f],y=pt(v,4),S=e[y];if(!S)continue;const _=i[y]||(i[y]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:S.timescale,type:S.type});let E;if(m){const V=m[0];E=pt(m,4),V===1&&(E===Rc?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(E*=Rc+1,E+=pt(m,8))),at(E)&&(!at(_.start)||E<_.start)&&(_.start=E),r&&at(E)&&(r.timeOffset=E/r.timescale)}const T=(r==null?void 0:r.trackId)===y&&S.type===Is.VIDEO,k=S.default,R=pt(v,0)&16777215;let I=(k==null?void 0:k.duration)||0,A,L=(k==null?void 0:k.sampleSize)||0,j=8;R&1&&(j+=8),R&2&&(j+=4),R&8&&(I=pt(v,j),A=v.byteOffset-t.byteOffset+j,j+=4),R&16&&(L=pt(v,j));let F=0;const O=(R&1)!==0,M=!O&&(R&131072)!==0;O?(F=pt(v,8),F*=Math.pow(2,32),F+=pt(v,12)):M&&(F=p);let U=E||0,G=0,$=I;for(let V=0;V<x.length;V++){const B=x[V],q=pt(B,4),z=_.sampleCount;_.sampleCount+=q;const D=B[3]&1;let K=0;const Y=B[3]&4,J=B[2]&1,ne=B[2]&2,Q=B[2]&4,ee=B[2]&8;let te=8;D&&(K=ZD(B,te),te+=4),Y&&(!(B[te+1]&1)&&_.keyFrameIndex===void 0&&(_.keyFrameIndex=z),te+=4);let ue=F+K;if(!s&&B[1]===0&&B[2]===6&&B[3]===1){var u,d;const me=U,Ce=ue,Xe=te;let he=-1,De=0,Ge=0,Je=(u=r==null?void 0:r.timeOffset)!=null?u:0;const Le=I/((d=r==null?void 0:r.timescale)!=null?d:1),qe=(r==null?void 0:r.isHEVCFlavor)===!0,et=qe?2:1;for(let Ke=0;Ke<q;Ke++){const dt=B[te]===0?B[te+1]<<16|B[te+2]<<8|B[te+3]:pt(B,te),Xt=he===-1&&_.keyFrameIndex===void 0&&(B[te+5]&1)===0;te+=8;const _n=ue+dt;if(T){if(dt>0){let Dt=ue;do{const nn=t[Dt]===0?t[Dt+1]<<16|t[Dt+2]<<8|t[Dt+3]:pt(t,Dt);Dt+=4;const fn=t[Dt],Tt=qe?fn>>1&63:fn&31;(qe?Tt===39||Tt===40:Tt===6)&&T2(t.subarray(Dt,Dt+nn),et,Je,r.samples),Dt+=nn}while(Dt<_n)}Je+=Le}ue=_n,Xt&&(he=Ke,De=ue)}if(ue<=l)Ge=q;else{let Ke=Ce,dt=Xe;for(let Xt=0;Xt<q;Xt++){const _n=B[dt]===0?B[dt+1]<<16|B[dt+2]<<8|B[dt+3]:pt(B,dt);if(Ke+=_n,Ke>l)break;Ge=Xt+1,dt+=8}}if(T&&(r.timeOffset=Je),he!==-1&&De<=l&&_.keyFrameIndex===void 0&&(_.keyFrameIndex=he,_.keyFrameStart=me+he*I),Ge){(!at(_.ptsMin)||me<_.ptsMin)&&(_.ptsMin=me);const Ke=me+Ge*I;(!at(_.ptsMax)||Ke>_.ptsMax)&&(_.ptsMax=Ke)}const Ct=I*q;U=me+Ct,G+=Ct;continue}let ye,je;s&&(ye=[],je={sampleOffset:ue,samples:ye,defaultSampleDurationOffset:A},ue<=l&&_.trun.push(je));let Re;for(let me=0;me<q;me++){let Ce;J?(s&&(Ce=B.byteOffset-t.byteOffset+te),$=pt(B,te),te+=4):$=I,ne?(Re=pt(B,te),te+=4):Re=L;let Xe,he;Q&&(he=B[te+1]&1?1:0,s&&(Xe={isNonSync:he,dependsOn:(B[te]&3)===1?1:2}),te+=4);let De=0;if(ee&&(De=B[0]===0?pt(B,te):ZD(B,te),te+=4),T){let Ge=ue,Je=0;for(;Je<Re;){const Le=pt(t,Ge);Ge+=4,R1e(r.isHEVCFlavor,t[Ge])&&T2(t.subarray(Ge,Ge+Le),r.isHEVCFlavor?2:1,r.timeOffset+De/r.timescale,r.samples),Ge+=Le,Je+=Le+4}r.timeOffset+=$/r.timescale}if(ue+=Re,ue<=l){je&&Ce!==void 0&&(je.lastSampleDurationOffset=Ce),he===0&&_.keyFrameIndex===void 0&&(_.keyFrameIndex=me,_.keyFrameStart=U);const Ge=U+De;(!at(_.ptsMin)||Ge<_.ptsMin)&&(_.ptsMin=Ge),(!at(_.ptsMax)||Ge+$>_.ptsMax)&&(_.ptsMax=Ge+$),ye&&(ye[me]={cts:De,duration:$,flags:Xe,size:Re})}U+=$,G+=$}!G&&I&&(G+=I*q)}_.duration+=G,_.duration&&(a=!0)}if(!a){let f=1/0,p=0;const m=Yt(t,["sidx"]);for(let v=0;v<m.length;v++){const x=kat(m[v]);if(x!=null&&x.references){f=Math.min(f,x.earliestPresentationTime/x.timescale);const y=x.references.reduce((S,_)=>S+_.info.duration||0,0);p=Math.max(p,y+x.earliestPresentationTime/x.timescale)}}p&&at(p)&&Object.keys(i).forEach(v=>{i[v].duration||(i[v].duration=p*i[v].timescale-i[v].start)})}return i}function Dat(t){const e={valid:null,remainder:null},n=Yt(t,["moof"]);if(n.length<2)return e.remainder=t,e;const s=n[n.length-1];return e.valid=t.slice(0,s.byteOffset-8),e.remainder=t.slice(s.byteOffset-8),e}function gl(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}function Oat(t,e){const n=[],s=e.samples,r=e.timescale,i=e.id;let a=!1;return Yt(s,["moof"]).map(l=>{const u=l.byteOffset-8;Yt(l,["traf"]).map(f=>{const p=Yt(f,["tfdt"]).map(m=>{const v=m[0];let x=pt(m,4);return v===1&&(x*=Math.pow(2,32),x+=pt(m,8)),x/r})[0];return p!==void 0&&(t=p),Yt(f,["tfhd"]).map(m=>{const v=pt(m,4),x=pt(m,0)&16777215,y=(x&1)!==0;let S=0;const _=(x&2)!==0,E=(x&8)!==0;let T=0;const k=(x&16)!==0;let R=0;const I=(x&32)!==0,A=!y&&(x&131072)!==0;let L=8;v===i&&(y?(S=pt(m,L),L+=4,S*=Math.pow(2,32),S+=pt(m,L),L+=4):A&&(S=u),_&&(L+=4),E&&(T=pt(m,L),L+=4),k&&(R=pt(m,L),L+=4),I&&(L+=4),e.type==="video"&&(a=KS(e.codec)),Yt(f,["trun"]).map(j=>{const F=j[0],O=pt(j,0)&16777215,M=(O&1)!==0;let U=0;const G=(O&4)!==0,$=(O&256)!==0;let V=0;const B=(O&512)!==0;let q=0;const z=(O&1024)!==0,D=(O&2048)!==0;let K=0;const Y=pt(j,4);let J=8;M&&(U=pt(j,J),J+=4),G&&(J+=4);let ne=S+U;for(let Q=0;Q<Y;Q++){if($?(V=pt(j,J),J+=4):V=T,B?(q=pt(j,J),J+=4):q=R,z&&(J+=4),D&&(F===0?K=pt(j,J):K=ZD(j,J),J+=4),e.type===Is.VIDEO){let ee=0;for(;ee<q;){const te=pt(s,ne);if(ne+=4,R1e(a,s[ne])){const ue=s.subarray(ne,ne+te);T2(ue,a?2:1,t+K/r,n)}ne+=te,ee+=te+4}}t+=V/r}}))})})}),n}function KS(t){if(!t)return!1;const e=t.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function R1e(t,e){if(t){const n=e>>1&63;return n===39||n===40}else return(e&31)===6}function T2(t,e,n,s){const r=A1e(t);let i=0;i+=e;let a=0,o=0,l=0;for(;i<r.length;){a=0;do{if(i>=r.length)break;l=r[i++],a+=l}while(l===255);o=0;do{if(i>=r.length)break;l=r[i++],o+=l}while(l===255);const u=r.length-i;let d=i;if(o<u)i+=o;else if(o>u){Gn.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(a===4){if(r[d++]===181){const p=S1e(r,d);if(d+=2,p===49){const m=pt(r,d);if(d+=4,m===1195456820){const v=r[d++];if(v===3){const x=r[d++],y=31&x,S=64&x,_=S?2+y*3:0,E=new Uint8Array(_);if(S){E[0]=x;for(let T=1;T<_;T++)E[T]=r[d++]}s.push({type:v,payloadType:a,pts:n,bytes:E})}}}}}else if(a===5&&o>16){const f=[];for(let v=0;v<16;v++){const x=r[d++].toString(16);f.push(x.length==1?"0"+x:x),(v===3||v===5||v===7||v===9)&&f.push("-")}const p=o-16,m=new Uint8Array(p);for(let v=0;v<p;v++)m[v]=r[d++];s.push({payloadType:a,pts:n,uuid:f.join(""),userData:Lat(m),userDataBytes:m})}}}function A1e(t){const e=t.byteLength;let n,s=t.indexOf(3,3);for(;s!==-1;)t[s-1]===0&&t[s-2]===0&&(n||(n=[])).push(s),s=t.indexOf(3,s+1);if(!n)return t;const r=e-n.length,i=new Uint8Array(r);let a=0,o=0;for(let l=0;l<r;o++,l++)o===n[a]&&(o++,a++),i[l]=t[o];return i}function $at(t){const e=t[0];let n="",s="",r=0,i=0,a,o=0,l=0,u=4;if(e===0){const f=kE(t,u),p=f!==null?kE(t,u+f.length):null;f!==null&&p!==null?(n=f,s=p,u+=f.length+p.length,r=pt(t,u),u+=4,i=pt(t,u),u+=4,o=pt(t,u),u+=4,l=pt(t,u),u+=4):(Gn.warn(`Unterminated ${f===null?"scheme_id_uri":"value"} in parsing emsg box: version 0 box ends inside a string, dropping all of its fields`),u=t.length)}else if(e===1){r=pt(t,u),u+=4;const f=pt(t,u);u+=4;const p=pt(t,u);u+=4,a=2**32*f+p,Hit(a)||(a=Number.MAX_SAFE_INTEGER,Gn.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=pt(t,u),u+=4,l=pt(t,u),u+=4;const m=kE(t,u),v=m!==null?kE(t,u+m.length):null;m!==null&&(n=m,u+=m.length),v!==null?(s=v,u+=v.length):(Gn.warn(`Unterminated ${m===null?"scheme_id_uri":"value"} in parsing emsg box: version 1 box ends inside a string, dropping its ${m===null?"strings and payload":"value and payload"}`),u=t.length)}const d=t.subarray(u,t.byteLength);return{schemeIdUri:n,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:i,eventDuration:o,id:l,payload:d}}function Fat(t,...e){const n=e.length;let s=8,r=n;for(;r--;)s+=e[r].byteLength;const i=new Uint8Array(s);for(i[0]=s>>24&255,i[1]=s>>16&255,i[2]=s>>8&255,i[3]=s&255,i.set(t,4),r=0,s=8;r<n;r++)i.set(e[r],s),s+=e[r].byteLength;return i}function Uat(t,e,n){if(t.byteLength!==16)throw new RangeError("Invalid system id");let s,r;s=0,r=new Uint8Array;let i;s>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const a=new Uint8Array(4);return n.byteLength>0&&new DataView(a.buffer).setUint32(0,n.byteLength,!1),Fat([112,115,115,104],new Uint8Array([s,0,0,0]),t,i,r,a,n)}function N1e(t){const e=[];if(t instanceof ArrayBuffer){const n=t.byteLength;let s=0;for(;s+32<n;){const r=new DataView(t,s),i=zat(r);e.push(i),s+=i.size}}return e}function Bat(t){const e=[];for(let n=0;n<t.length;){const s=t[n++],r=s&7;if(r===0){for(;t[n++]&128;);continue}if(r!==2){n+=r===1?8:4;continue}let i=0;for(let a=0,o=128;o&128;a+=7)i|=((o=t[n++])&127)<<a;if(s>>3===2)if(i===32){const a=new Uint8Array(16);for(let o=0;o<16;o++)a[o]=parseInt(String.fromCharCode(t[n+o*2],t[n+o*2+1]),16);e.push(a)}else i===16&&e.push(t.subarray(n,n+16));n+=i}return e}function zat(t){const e=t.getUint32(0),n=t.byteOffset,s=t.byteLength;if(s<e)return{offset:n,size:s};if(t.getUint32(4)!==1886614376)return{offset:n,size:e};const i=t.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:e};const a=t.buffer,o=Zr(new Uint8Array(a,n+12,16));let l=null,u=null,d=0;if(i===0)d=28;else{const p=t.getUint32(28);if(!p||s<32+p*16)return{offset:n,size:e};l=[];for(let m=0;m<p;m++)l.push(new Uint8Array(a,n+32+m*16,16));d=32+p*16}if(!d)return{offset:n,size:e};const f=t.getUint32(d);return e-32<f?{offset:n,size:e}:(u=new Uint8Array(a,n+d+4,f),i===0&&(l=Bat(u)),{version:i,systemId:o,kids:l,data:u,offset:n,size:e})}const ex=I1e("userAgent"),Vat=I1e("vendor");let ML,DL,OL;function I1e(t){try{return navigator[t]||""}catch{}return""}function Hat(){if(OL===void 0){const t=ex.match(/Safari\/(\d+)/i);OL=t?parseInt(t[1]):0}return OL}function Eb(){if(ML===void 0){const t=ex.match(/Chrome\/(\d+)/i);ML=t?parseInt(t[1]):0}return ML}function Gat(){if(DL===void 0){const t=ex.match(/Firefox\/(\d+)/i);DL=t?parseInt(t[1]):0}return DL}function L1e(){return/\(Windows.+Firefox\//i.test(ex)}function Wat(){return Vat.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(ex)}function qat(){return/Android/.test(ex)}const d1={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function WF(t,e){const n=d1[e];return!!n&&!!n[t.slice(0,4)]}function k2(t,e,n=!0){return!t.split(",").some(s=>!qF(s,e,n))}function qF(t,e,n=!0){var s;const r=Uh(n);return(s=r==null?void 0:r.isTypeSupported(R2(t,e)))!=null?s:!1}function R2(t,e){return`${e}/mp4;codecs=${t}`}function Xee(t){if(t){const e=t.substring(0,4);return d1.video[e]}return 2}function d5(t){const e=L1e();return t.split(",").reduce((n,s)=>{const i=e&&KS(s)?9:d1.video[s];return i?(i*2+n)/(n?3:2):(d1.audio[s]+n)/(n?2:1)},0)}const $L={};function Kat(t,e=!0){if($L[t])return $L[t];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let r=0;r<n.length;r++){var s;if(qF(n[r],"audio",e))return $L[t]=n[r],n[r];if(n[r]==="mp3"&&(s=Uh(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return t}const Yat=/flac|opus|mp4a\.40\.34/i;function f5(t,e=!0){return t.replace(Yat,n=>Kat(n.toLowerCase(),e))}function Zat(t,e){const n=[];if(t){const s=t.split(",");for(let r=0;r<s.length;r++)WF(s[r],"video")||n.push(s[r])}return e&&n.push(e),n.join(",")}function cT(t,e){if(t&&(t.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t)!==-1)&&(Qee(t,"audio")||Qee(t,"video")))return t;if(e){const n=e.split(",");if(n.length>1){if(t){for(let s=n.length;s--;)if(n[s].substring(0,4)===t.substring(0,4))return n[s]}return n[0]}}return e||t}function Qee(t,e){return WF(t,e)&&qF(t,e)}function Xat(t){const e=t.split(",");for(let n=0;n<e.length;n++){const s=e[n].split(".");s.length>2&&s[0]==="avc1"&&(e[n]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function Qat(t){if(t.startsWith("av01.")){const e=t.split("."),n=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=n[s-4];return e.join(".")}return t}function Jee(t){const e=Uh(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function QD(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Jat={supported:!0,powerEfficient:!0,smooth:!0},eot={supported:!1,smooth:!1,powerEfficient:!1},j1e={supported:!0,configurations:[],decodingInfoResults:[Jat]};function P1e(t,e){return{supported:!1,configurations:e,decodingInfoResults:[eot],error:t}}function tot(t,e,n,s,r,i){const a=t.videoCodec,o=t.audioCodec?t.audioGroups:null,l=i==null?void 0:i.audioCodec,u=i==null?void 0:i.channels,d=u?parseInt(u):l?1/0:2;let f=null;if(o!=null&&o.length)try{o.length===1&&o[0]?f=e.groups[o[0]].channels:f=o.reduce((p,m)=>{if(m){const v=e.groups[m];if(!v)throw new Error(`Audio track group ${m} not found`);Object.keys(v.channels).forEach(x=>{p[x]=(p[x]||0)+v.channels[x]})}return p},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(p=>KS(p))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(s,30)||t.videoRange!=="SDR"&&t.videoRange!==n||t.bitrate>Math.max(r,8e6))||!!f&&at(d)&&Object.keys(f).some(p=>parseInt(p)>d)}function M1e(t,e,n,s={}){const r=t.videoCodec;if(!r&&!t.audioCodec||!n)return Promise.resolve(j1e);const i=[],a=not(t),o=a.length,l=sot(t,e,o>0),u=l.length;for(let d=o||1*u||1;d--;){const f={type:"media-source"};if(o&&(f.video=a[d%o]),u){f.audio=l[d%u];const p=f.audio.bitrate;f.video&&p&&(f.video.bitrate-=p)}i.push(f)}if(r){const d=navigator.userAgent;if(r.split(",").some(f=>KS(f))&&L1e())return Promise.resolve(P1e(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${d})`),i))}return Promise.all(i.map(d=>{const f=rot(d);return s[f]||(s[f]=n.decodingInfo(d))})).then(d=>({supported:!d.some(f=>!f.supported),configurations:i,decodingInfoResults:d})).catch(d=>({supported:!1,configurations:i,decodingInfoResults:[],error:d}))}function not(t){var e;const n=(e=t.videoCodec)==null?void 0:e.split(","),s=O1e(t),r=t.width||640,i=t.height||480,a=t.frameRate||30,o=t.videoRange.toLowerCase();return n?n.map(l=>{const u={contentType:R2(Qat(l),"video"),width:r,height:i,bitrate:s,framerate:a};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function sot(t,e,n){var s;const r=(s=t.audioCodec)==null?void 0:s.split(","),i=O1e(t);return r&&t.audioGroups?t.audioGroups.reduce((a,o)=>{var l;const u=o?(l=e.groups[o])==null?void 0:l.tracks:null;return u?u.reduce((d,f)=>{if(f.groupId===o){const p=parseFloat(f.channels||"");r.forEach(m=>{const v={contentType:R2(m,"audio"),bitrate:n?D1e(m,i):i};p&&(v.channels=""+p),d.push(v)})}return d},a):a},[]):[]}function D1e(t,e){if(e<=1)return 1;let n=128e3;return t==="ec-3"?n=768e3:t==="ac-3"&&(n=64e4),Math.min(e/2,n)}function O1e(t){return Math.ceil(Math.max(t.bitrate*.9,t.averageBitrate)/1e3)*1e3||1}function rot(t){let e="";const{audio:n,video:s}=t;if(s){const r=QD(s.contentType);e+=`${r}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(n){const r=QD(n.contentType);e+=`${s?"_":""}${r}_c${n.channels}`}return e}function vh(t,e,n){const s=encodeURIComponent(e),r=`${s}=${encodeURIComponent(n)}`;let i=!1;const a=[];t.search.substring(1).split("&").forEach(o=>{o===s||o.startsWith(s+"=")?i||(a.push(r),i=!0):o&&a.push(o)}),i||a.push(r),t.search=a.join("&")}const JD=["NONE","TYPE-0","TYPE-1",null];function iot(t){return JD.indexOf(t)>-1}const h5=["SDR","PQ","HLG"];function aot(t){return!!t&&h5.indexOf(t)>-1}var uT={No:"",Yes:"YES",v2:"v2"};function ete(t){const{canSkipUntil:e,canSkipDateRanges:n,age:s}=t,r=s<e/2;return e&&r?n?uT.v2:uT.Yes:uT.No}class tte{constructor(e,n,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=n,this.skip=s}addDirectives(e){const n=new self.URL(e);return this.msn!==void 0&&vh(n,"_HLS_msn",this.msn.toString()),this.part!==void 0&&vh(n,"_HLS_part",this.part.toString()),this.skip&&vh(n,"_HLS_skip",this.skip),n.href}}class A2{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var n;this.supplemental=e.supplemental;const s=(n=e.supplemental)==null?void 0:n.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return nte(this._audioGroups,e)}hasSubtitleGroup(e){return nte(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,n){if(n){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(n)===-1&&s.push(n)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(n)===-1&&s.push(n)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function nte(t,e){return!e||!t?!1:t.indexOf(e)!==-1}function oot(){if(typeof matchMedia=="function"){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return t.matches===!0}return!1}function lot(t,e){let n=!1,s=[];if(t&&(n=t!=="SDR",s=[t]),e){s=e.allowedVideoRanges||h5.slice(0);const r=s.join("")!=="SDR"&&!e.videoCodec;n=e.preferHDR!==void 0?e.preferHDR:r&&oot(),n||(s=["SDR"])}return{preferHDR:n,allowedVideoRanges:s}}const cot=t=>{const e=new WeakSet;return(n,s)=>{if(t&&(s=t(n,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},Fs=(t,e)=>JSON.stringify(t,cot(e));function uot(t,e,n,s,r){const i=Object.keys(t),a=s==null?void 0:s.channels,o=s==null?void 0:s.audioCodec,l=r==null?void 0:r.videoCodec,u=a&&parseInt(a)===2;let d=!1,f=!1,p=1/0,m=1/0,v=1/0,x=1/0,y=0,S=[];const{preferHDR:_,allowedVideoRanges:E}=lot(e,r);for(let A=i.length;A--;){const L=t[i[A]];d||(d=L.channels[2]>0),p=Math.min(p,L.minHeight),m=Math.min(m,L.minFramerate),v=Math.min(v,L.minBitrate),E.filter(F=>L.videoRanges[F]>0).length>0&&(f=!0)}p=at(p)?p:0,m=at(m)?m:0;const T=Math.max(1080,p),k=Math.max(30,m);v=at(v)?v:n,n=Math.max(v,n),f||(e=void 0);const R=i.length>1;return{codecSet:i.reduce((A,L)=>{const j=t[L];if(L===A)return A;if(S=f?E.filter(F=>j.videoRanges[F]>0):[],R){if(j.minBitrate>n)return xc(L,`min bitrate of ${j.minBitrate} > current estimate of ${n}`),A;if(!j.hasDefaultAudio)return xc(L,"no renditions with default or auto-select sound found"),A;if(o&&L.indexOf(o.substring(0,4))%5!==0)return xc(L,`audio codec preference "${o}" not found`),A;if(a&&!u){if(!j.channels[a])return xc(L,`no renditions with ${a} channel sound found (channels options: ${Object.keys(j.channels)})`),A}else if((!o||u)&&d&&j.channels[2]===0)return xc(L,"no renditions with stereo sound found"),A;if(j.minHeight>T)return xc(L,`min resolution of ${j.minHeight} > maximum of ${T}`),A;if(j.minFramerate>k)return xc(L,`min framerate of ${j.minFramerate} > maximum of ${k}`),A;if(!S.some(F=>j.videoRanges[F]>0))return xc(L,`no variants with VIDEO-RANGE of ${Fs(S)} found`),A;if(l&&L.indexOf(l.substring(0,4))%5!==0)return xc(L,`video codec preference "${l}" not found`),A;if(j.maxScore<y)return xc(L,`max score of ${j.maxScore} < selected max of ${y}`),A}return A&&(d5(L)>=d5(A)||j.fragmentError>t[A].fragmentError)?A:(x=j.minIndex,y=j.maxScore,L)},void 0),videoRanges:S,preferHDR:_,minFramerate:m,minBitrate:v,minIndex:x}}function xc(t,e){Gn.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function $1e(t){return t.reduce((e,n)=>{let s=e.groups[n.groupId];s||(s=e.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(n);const r=n.channels||"2";return s.channels[r]=(s.channels[r]||0)+1,s.hasDefault=s.hasDefault||n.default,s.hasAutoSelect=s.hasAutoSelect||n.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function dot(t,e,n,s){return t.slice(n,s+1).reduce((r,i,a)=>{if(!i.codecSet)return r;const o=i.audioGroups;let l=r[i.codecSet];l||(r[i.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,i.bitrate);const u=Math.min(i.height,i.width);return l.minHeight=Math.min(l.minHeight,u),l.minFramerate=Math.min(l.minFramerate,i.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,i.score),l.fragmentError+=i.fragmentError,l.videoRanges[i.videoRange]=(l.videoRanges[i.videoRange]||0)+1,o&&o.forEach(d=>{if(!d)return;const f=e.groups[d];f&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(p=>{l.channels[p]=(l.channels[p]||0)+f.channels[p]}))}),r},{})}function ste(t){if(!t)return t;const{lang:e,assocLang:n,characteristics:s,channels:r,audioCodec:i}=t;return{lang:e,assocLang:n,characteristics:s,channels:r,audioCodec:i}}function Gc(t,e,n){if("attrs"in t){const s=e.indexOf(t);if(s!==-1)return s}for(let s=0;s<e.length;s++){const r=e[s];if(km(t,r,n))return s}return-1}function km(t,e,n){const{groupId:s,name:r,lang:i,assocLang:a,default:o}=t,l=t.forced;return(s===void 0||e.groupId===s)&&(r===void 0||e.name===r)&&(i===void 0||fot(i,e.lang))&&(i===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in t)||hot(t.characteristics||"",e.characteristics))&&(n===void 0||n(t,e))}function fot(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}function hot(t,e=""){const n=t.split(","),s=e.split(",");return n.length===s.length&&!n.some(r=>s.indexOf(r)===-1)}function Op(t,e){const{audioCodec:n,channels:s}=t;return(n===void 0||(e.audioCodec||"").substring(0,4)===n.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function pot(t,e,n,s,r){const i=e[s],o=e.reduce((p,m,v)=>{const x=m.uri;return(p[x]||(p[x]=[])).push(v),p},{})[i.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=i.videoRange,u=i.frameRate,d=i.codecSet.substring(0,4),f=rte(e,s,p=>{if(p.videoRange!==l||p.frameRate!==u||p.codecSet.substring(0,4)!==d)return!1;const m=p.audioGroups,v=n.filter(x=>N2(x.groupId,m));return Gc(t,v,r)>-1});return f>-1?f:rte(e,s,p=>{const m=p.audioGroups,v=n.filter(x=>N2(x.groupId,m));return Gc(t,v,r)>-1})}function rte(t,e,n){for(let s=e;s>-1;s--)if(n(t[s]))return s;for(let s=e+1;s<t.length;s++)if(n(t[s]))return s;return-1}function p5(t,e){var n;return!!t&&t!==((n=e.loadLevelObj)==null?void 0:n.uri)}function N2(t,e){return e?e.indexOf(t)!==-1:!0}function F1e(t,e){if(e||t){const n=ms({},e);return t&&(t.videoCodec&&(n.videoCodec=t.videoCodec),t.videoRange&&(n.allowedVideoRanges=[t.videoRange])),n}}class mot extends Oo{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var s;const{fragCurrent:r,partCurrent:i,hls:a}=this;if(!a)return;const{autoLevelEnabled:o,media:l}=a;if(!r||!l)return;const u=performance.now(),d=i?i.stats:r.stats,f=i?i.duration:r.duration,p=u-d.loading.start,m=a.minAutoLevel,v=r.level,x=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||v<=m){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const y=x>-1&&x!==v,S=!!n||y;if(!S&&(l.paused||!l.playbackRate||!l.readyState))return;const _=a.mainForwardBufferInfo;if(!S&&_===null)return;const E=this.bwEstimator.getEstimateTTFB(),T=Math.abs(l.playbackRate);if(p<=Math.max(E,1e3*(f/(T*2))))return;const k=_?_.len/T:0,R=d.loading.first?d.loading.first-d.loading.start:-1,I=d.loaded&&R>-1,A=this.getBwEstimate(),L=a.levels,j=L[v],F=Math.max(d.loaded,Math.round(f*(r.bitrate||j.averageBitrate)/8));let O=I?p-R:p;O<1&&I&&(O=Math.min(p,d.loaded*8/A));const M=I?d.loaded*1e3/O:0,U=E/1e3,G=M?(F-d.loaded)/M:F*8/A+U;if(G<=k)return;const $=M?M*8:A,V=((s=(n==null?void 0:n.details)||a.latestLevelDetails)==null?void 0:s.live)===!0,B=a.config.abrBandWidthUpFactor;let q=Number.POSITIVE_INFINITY,z;for(z=v-1;z>m;z--){const J=L[z].maxBitrate,ne=!L[z].details||V;if(q=this.getTimeToLoadFrag(U,$,f*J,ne),q<Math.min(k,f+U))break}if(q>=G||q>f*10)return;I?this.bwEstimator.sample(p-Math.min(E,R),d.loaded):this.bwEstimator.sampleTTFB(p);const D=L[z].maxBitrate;this.getBwEstimate()*B>D&&(this.firstAutoFloor=Math.min(z,a.firstLevel),this.resetEstimator(D));const K=this.findBestLevel(D,m,z,0,k,1,1);K>-1&&(z=K),this.warn(`Fragment ${r.sn}${i?" part "+i.index:""} of level ${v} is loading too slowly;
464      Fragment duration: ${r.duration.toFixed(3)}
465      Time to underbuffer: ${k.toFixed(3)} s
466      Estimated load time for current fragment: ${G.toFixed(3)} s
467      Estimated load time for down switch fragment: ${q.toFixed(3)} s
468      TTFB estimate: ${R|0} ms
469      Current BW estimate: ${at(A)?A|0:"Unknown"} bps
470      New BW estimate: ${this.getBwEstimate()|0} bps
471      Switching to level ${z} @ ${D|0} bps`),a.nextLoadLevel=a.nextAutoLevel=z,this.clearTimer();const Y=()=>{this.clearTimer();const J=this.hls;if(this.fragCurrent===r&&J.loadLevel===z&&z>0){const ne=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${z>0?"and switching down":""}
472      Fragment duration: ${r.duration.toFixed(3)} s
473      Time to underbuffer: ${ne.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,z>m){let Q=this.findBestLevel(J.levels[m].bitrate,m,z,0,ne,1,1);Q===-1&&(Q=m),J.nextLoadLevel=J.nextAutoLevel=Q,this.firstAutoFloor=Math.min(Q,J.firstLevel),this.resetEstimator(J.levels[Q].bitrate)}}};y||G>q*2?Y():this.timer=self.setInterval(Y,q*1e3),a.trigger(H.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:i,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){this.hls&&(e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator())}initEstimator(){const e=this.hls.config;return new tat(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const e=this.hls;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.FRAG_LOADING,this.onFragLoading,this),e.on(H.FRAG_LOADED,this.onFragLoaded,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this),e.on(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(H.LEVEL_LOADED,this.onLevelLoaded,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(H.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.FRAG_LOADING,this.onFragLoading,this),e.off(H.FRAG_LOADED,this.onFragLoaded,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this),e.off(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(H.LEVEL_LOADED,this.onLevelLoaded,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(H.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(H.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.audioTracksByGroup=this.codecTiers=this.fragCurrent=this.partCurrent=null}onManifestLoading(e,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,n){const s=n.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=n.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,n){this.clearTimer()}onError(e,n){if(!n.fatal)switch(n.details){case pe.BUFFER_ADD_CODEC_ERROR:case pe.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case pe.FRAG_LOAD_TIMEOUT:{const s=n.frag,{fragCurrent:r,partCurrent:i}=this;if(s&&qD(s,r)){const a=performance.now(),o=i?i.stats:s.stats,l=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,n,s,r){const i=e+s/n,a=r?e+this.lastLevelLoadSec:0;return i+a}onLevelLoaded(e,n){const s=this.hls.config,{loading:r}=n.stats,i=r.end-r.first;at(i)&&(this.lastLevelLoadSec=i/1e3),n.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(e,n){var s;const{frag:r,part:i}=n,a=i?i.stats:r.stats;if(r.type===vt.MAIN&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,(s=this.hls)!=null&&s.config.abrMaxWithRealBitrate){const o=i?i.duration:r.duration,l=this.hls.levels[r.level],u=(l.loaded?l.loaded.bytes:0)+a.loaded,d=(l.loaded?l.loaded.duration:0)+o;l.loaded={bytes:u,duration:d},l.realBitrate=Math.round(8*u/d)}if(r.bitrateTest){const o={stats:a,frag:r,part:i,id:r.type};this.onFragBuffered(H.FRAG_BUFFERED,o),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}onFragBuffered(e,n){const{frag:s,part:r}=n,i=r!=null&&r.stats.loaded?r.stats:s.stats;if(i.aborted||this.ignoreFragment(s))return;const o=((s.bitrate||0)>=1e5?i.parsing.end:i.loading.end)-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=o/1e3:(this.bitrateTestDelay=0,this.firstAutoFloor>-1&&this.bwEstimator.canEstimate()&&(this.firstAutoFloor=-1))}ignoreFragment(e){return e.type!==vt.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{hls:e}=this;if(!e)return 0;const{maxAutoLevel:n,minAutoLevel:s}=e,r=this.getBwEstimate(),i=this.getStarvationDelay(),a=e.config.maxStarvationDelay,o=this.findBestLevel(r,s,n,i/2,a,1,1);if(o>-1)return o;const l=e.firstLevel,u=this.firstAutoFloor===-1?1/0:this.firstAutoFloor,d=Math.min(Math.max(l,s),n,u);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${l} clamped to ${d}`),d}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){if(!this.hls)return-1;const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=s&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}
473_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:n,hls:s}=this;if(!s)return-1;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:r,config:i,minAutoLevel:a}=s,o=n?n.duration:e?e.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay();let d=i.abrBandWidthFactor,f=i.abrBandWidthUpFactor;if(u){const y=this.findBestLevel(l,a,r,u,0,d,f);if(y>=0)return this.rebufferNotice=-1,y}let p=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay;if(!u){const y=this.bitrateTestDelay;y&&(p=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-y,this.info(`bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*p)} ms`),d=f=1)}const m=this.findBestLevel(l,a,r,u,p,d,f);if(this.rebufferNotice!==m&&(this.rebufferNotice=m,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${m}`)),m>-1)return m;const v=s.levels[a],x=s.loadLevelObj;return x&&(v==null?void 0:v.bitrate)<x.bitrate?a:s.loadLevel}getStarvationDelay(){const e=this.hls,n=e==null?void 0:e.media;if(!n)return 1/0;const s=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/s}getBwEstimate(){return this.bwEstimator.getEstimate()}findBestLevel(e,n,s,r,i,a,o){const{hls:l,lastLoadedFragLevel:u,fragCurrent:d,partCurrent:f}=this;if(!l)return-1;const p=r+i,m=u===-1?l.firstLevel:u,{levels:v,allAudioTracks:x,loadLevel:y,latestLevelDetails:S,config:_}=l;if(v.length===1)return 0;const E=v[m],T=!!(S!=null&&S.live),k=y===-1||u===-1;let R,I="SDR",A=(E==null?void 0:E.frameRate)||0;const{audioPreference:L,videoPreference:j}=_,F=this.audioTracksByGroup||(this.audioTracksByGroup=$1e(x));let O=-1;if(k){if(this.firstSelection!==-1)return this.firstSelection;const V=this.codecTiers||(this.codecTiers=dot(v,F,n,s)),B=uot(V,I,e,L,j),{codecSet:q,videoRanges:z,minFramerate:D,minBitrate:K,minIndex:Y,preferHDR:J}=B;O=Y,R=q,I=J?z[z.length-1]:z[0],A=D,e=Math.max(e,K),this.log(`picked start tier ${Fs(B)}`)}else R=E==null?void 0:E.codecSet,I=E==null?void 0:E.videoRange;const M=f?f.duration:d?d.duration:0,U=this.bwEstimator.getEstimateTTFB()/1e3,G=[];for(let V=s;V>=n;V--){var $;const B=v[V],q=V>m;if(!B)continue;if(_.useMediaCapabilities&&!B.supportedResult&&!B.supportedPromise){const Q=navigator.mediaCapabilities;typeof(Q==null?void 0:Q.decodingInfo)=="function"&&tot(B,F,I,A,e,L)?(B.supportedPromise=M1e(B,F,Q,this.supportedCache),B.supportedPromise.then(ee=>{if(!this.hls)return;B.supportedResult=ee;const te=this.hls.levels,ue=te.indexOf(B);ee.error?this.warn(`MediaCapabilities decodingInfo error: "${ee.error}" for level ${ue} ${Fs(ee)}`):ee.supported?ee.decodingInfoResults.some(ye=>ye.smooth===!1||ye.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ue} not smooth or powerEfficient: ${Fs(ee)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ue} ${Fs(ee)}`),ue>-1&&te.length>1&&(this.log(`Removing unsupported level ${ue}`),this.hls.removeLevel(ue),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(ee=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${ee}`)})):B.supportedResult=j1e}if((R&&B.codecSet!==R||I&&B.videoRange!==I||q&&A>B.frameRate||!q&&A>0&&A<B.frameRate||($=B.supportedResult)!=null&&($=$.decodingInfoResults)!=null&&$.some(Q=>Q.smooth===!1))&&(!k||V!==O)){G.push(V);continue}const z=B.details,D=(f?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||M||1;let K;q?K=o*e:K=a*e;const Y=M&&r>=M*2&&i===0?B.averageBitrate:B.maxBitrate,J=this.getTimeToLoadFrag(U,K,Y*D,!z||z.live);if(K>=Y&&(V===u||B.loadError===0&&B.fragmentError===0||f1e(B,_.errorPenaltyExpireMs))&&(J<=U||!at(J)||T&&!this.bitrateTestDelay||J<p)){const Q=this.forcedAutoLevel;return V!==y&&(Q===-1||Q!==y)&&(G.length&&this.trace(`Skipped level(s) ${G.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${v[G[0]].codecs}" ${v[G[0]].videoRange}; not compatible with "${R}" ${I}`),this.info(`switch candidate:${m}->${V} adjustedbw(${Math.round(K)})-bitrate=${Math.round(K-Y)} ttfb:${U.toFixed(1)} avgDuration:${D.toFixed(1)} maxFetchDuration:${p.toFixed(1)} fetchDuration:${J.toFixed(1)}
473 firstSelection:${k} codecSet:${B.codecSet} videoRange:${B.videoRange} hls.loadLevel:${y}`)),k&&(this.firstSelection=V),V}}return-1}set nextAutoLevel(e){const n=this.deriveNextAutoLevel(e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(e){if(!this.hls)return-1;const{maxAutoLevel:n,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),n)}}const U1e={search:function(t,e){let n=0,s=t.length-1,r=null,i=null;for(;n<=s;){r=(n+s)/2|0,i=t[r];const a=e(i);if(a>0)n=r+1;else if(a<0)s=r-1;else return i}return null}};function got(t,e,n){if(e===null||!Array.isArray(t)||!t.length||!at(e))return null;const s=t[0].programDateTime;if(e<(s||0))return null;const r=t[t.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let i=0;i<t.length;++i){const a=t[i];if(xot(e,n,a))return a}return null}function f1(t,e,n=0,s=0,r=.005){let i=null;if(t){i=e[1+t.sn-e[0].sn]||null;const o=t.endDTS-n;o>0&&o<15e-7&&(n+=15e-7),i&&t.level!==i.level&&i.end<=t.end&&(i=e[2+t.sn-e[0].sn]||null)}else n===0&&e[0].start===0&&(i=e[0]);if(i&&((!t||t.level===i.level)&&ite(n,s,i)===0||vot(i,t,Math.min(r,s))))return i;const a=U1e.search(e,ite.bind(null,n,s));return a&&(a!==t||!i)?a:i}function vot(t,e,n){if((e==null?void 0:e.start)===0&&e.level<t.level&&(e.endPTS||0)>0){const s=e.tagList.reduce((r,i)=>(i[0]==="INF"&&(r+=parseFloat(i[1])),r),n);return t.start<=s}return!1}function ite(t=0,e=0,n){if(n.start<=t&&n.start+n.duration>t)return 0;const s=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-s<=t?1:n.start-s>t&&n.start?-1:0}function xot(t,e,n){const s=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-s>t}function B1e(t,e,n){if(t&&t.startCC<=e&&t.endCC>=e){let s=t.fragments;const{fragmentHint:r}=t;r&&(s=s.concat(r));let i;return U1e.search(s,a=>a.cc<e?1:a.cc>e?-1:(i=a,a.end<=n?1:a.start>n?-1:0)),i||null}return null}function z1e(t,e){return e===t.endSN&&t.fragmentHint?t.fragmentHint:t.fragments[1+e-t.startSN]||null}var Oi={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},pi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8,ResetMediaSource:16};class yot extends Oo{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(H.ERROR,this.onError,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(H.ERROR,this.onError,this),e.off(H.ERROR,this.onErrorOut,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===vt.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const n=this.hls,s=n.currentLevel;return(e=n.loadLevelObj)!=null&&e.details||s===-1?n.loadLevel:s}variantHasKey(e,n){if(e){var s;if((s=e.details)!=null&&s.hasKey(n))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(n)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,n){var s;if(n.fatal)return;const r=this.hls,i=n.context;switch(n.details){case pe.FRAG_LOAD_ERROR:case pe.FRAG_LOAD_TIMEOUT:case pe.KEY_LOAD_ERROR:case pe.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case pe.FRAG_PARSING_ERROR:if((s=n.frag)!=null&&s.gap){n.errorAction=Cb();return}case pe.FRAG_GAP:case pe.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=Oi.SendAlternateToPenaltyBox;return}case pe.PLAYLIST_UNCHANGED_ERROR:case pe.LEVEL_EMPTY_ERROR:case pe.LEVEL_PARSING_ERROR:{var a;const o=n.parent===vt.MAIN?n.level:r.loadLevel;n.details===pe.LEVEL_EMPTY_ERROR&&((a=n.context)!=null&&(a=a.levelDetails)!=null&&a.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,o):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,o))}return;case pe.LEVEL_LOAD_ERROR:case pe.LEVEL_LOAD_TIMEOUT:typeof(i==null?void 0:i.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,i.level));return;case pe.AUDIO_TRACK_LOAD_ERROR:case pe.AUDIO_TRACK_LOAD_TIMEOUT:case pe.SUBTITLE_LOAD_ERROR:case pe.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const o=r.loadLevelObj;if(o&&(i.type===hn.AUDIO_TRACK&&o.hasAudioGroup(i.groupId)||i.type===hn.SUBTITLE_TRACK&&o.hasSubtitleGroup(i.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,r.loadLevel),n.errorAction.action=Oi.SendAlternateToPenaltyBox,n.errorAction.flags=pi.MoveAllAlternatesMatchingHost;return}}return;case pe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:n.errorAction={action:Oi.SendAlternateToPenaltyBox,flags:pi.MoveAllAlternatesMatchingHDCP};return;case pe.KEY_SYSTEM_SESSION_UPDATE_FAILED:case pe.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case pe.KEY_SYSTEM_NO_SESSION:n.errorAction={action:Oi.SendAlternateToPenaltyBox,flags:pi.MoveAllAlternatesMatchingKey};return;
vendor: 37,880 bytes, line 473
473case pe.BUFFER_ADD_CODEC_ERROR:case pe.REMUX_ALLOC_ERROR:case pe.BUFFER_APPEND_ERROR:n.errorAction||(n.errorAction=this.getLevelSwitchAction(n,n.level));return;case pe.MEDIA_SOURCE_REQUIRES_RESET:n.errorAction||(n.errorAction=this.getLevelSwitchAction(n,n.level)),n.errorAction.flags|=pi.ResetMediaSource|pi.SwitchToSDR;return;case pe.INTERNAL_EXCEPTION:case pe.BUFFER_APPENDING_ERROR:case pe.BUFFER_APPEND_NO_PROGRESS:case pe.BUFFER_FULL_ERROR:case pe.LEVEL_SWITCH_ERROR:case pe.BUFFER_STALLED_ERROR:case pe.BUFFER_SEEK_OVER_HOLE:case pe.BUFFER_NUDGE_ON_STALL:n.errorAction=Cb();return}n.type===_t.KEY_SYSTEM_ERROR&&(n.levelRetry=!1,n.errorAction=Cb())}getPlaylistRetryOrSwitchAction(e,n){const s=this.hls,r=Hee(s.config.playlistLoadPolicy,e),i=this.playlistError++;if(_2(r,i,u5(e),e.response))return{action:Oi.RetryRequest,flags:pi.None,retryConfig:r,retryCount:i};const o=this.getLevelSwitchAction(e,n);return r&&(o.retryConfig=r,o.retryCount=i),o}getFragRetryOrSwitchAction(e){const n=this.hls,s=this.getVariantLevelIndex(e.frag),r=n.levels[s],{fragLoadPolicy:i,keyLoadPolicy:a}=n.config,o=Hee(u1e(e)?a:i,e),l=n.levels.reduce((d,f)=>d+f.fragmentError,0);if(r&&(e.details!==pe.FRAG_GAP&&r.fragmentError++,!d1e(e)&&_2(o,l,u5(e),e.response)))return{action:Oi.RetryRequest,flags:pi.None,retryConfig:o,retryCount:l};const u=this.getLevelSwitchAction(e,s);return o&&(u.retryConfig=o,u.retryCount=l),u}getLevelSwitchAction(e,n){const s=this.hls;n==null&&(n=s.loadLevel);const r=this.hls.levels[n];if(r){var i,a;const u=e.details;r.loadError++,r.loadErrorTime=self.performance.now(),u===pe.BUFFER_APPEND_ERROR&&r.fragmentError++;let d=-1;const{levels:f,loadLevel:p,minAutoLevel:m,maxAutoLevel:v}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const x=(i=e.frag)==null?void 0:i.type,S=(x===vt.AUDIO&&u===pe.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&ate(e))&&f.some(({audioCodec:R})=>r.audioCodec!==R),E=e.sourceBufferName==="video"&&ate(e)&&f.some(({codecSet:R,audioCodec:I})=>r.codecSet!==R&&r.audioCodec===I),{type:T,groupId:k}=(a=e.context)!=null?a:{};for(let R=f.length;R--;){const I=(R+p)%f.length;if(I!==p&&I>=m&&I<=v&&(f[I].loadError===0||f1e(f[I],s.config.errorPenaltyExpireMs))){var o,l;const A=f[I];if(u===pe.FRAG_GAP&&x===vt.MAIN&&e.frag){const L=f[I].details;if(L){const j=f1(e.frag,L.fragments,e.frag.start);if(j!=null&&j.gap)continue}}else{if(T===hn.AUDIO_TRACK&&A.hasAudioGroup(k)||T===hn.SUBTITLE_TRACK&&A.hasSubtitleGroup(k))continue;if(x===vt.AUDIO&&(o=r.audioGroups)!=null&&o.some(L=>A.hasAudioGroup(L))||x===vt.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(L=>A.hasSubtitleGroup(L))||S&&r.audioCodec===A.audioCodec||E&&r.codecSet===A.codecSet||!S&&r.audioCodec!==A.audioCodec)continue}d=I;break}}if(d>-1&&s.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:Oi.SendAlternateToPenaltyBox,flags:pi.None,nextAutoLevel:d}}return{action:Oi.SendAlternateToPenaltyBox,flags:pi.MoveAllAlternatesMatchingHost}}onErrorOut(e,n){var s,r;switch((s=n.errorAction)==null?void 0:s.action){case Oi.DoNothing:break;case Oi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==pe.FRAG_GAP&&n.details!==pe.PLAYLIST_UNCHANGED_ERROR&&!V1e(n)&&(n.fatal=!0);break}if((((r=n.errorAction)==null?void 0:r.flags)||0)&pi.ResetMediaSource&&this.hls.recoverMediaError(),n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const n=this.hls,s=e.errorAction;if(!s)return;let r=s.nextAutoLevel;if(s.flags===pi.None)this.switchLevel(e,r);else if(s.flags&pi.SwitchToSDR){const o=this.hls.levels,l=o.length;for(let u=l;u--;)o[u].videoRange!=="SDR"?(o[u].fragmentError++,o[u].loadError++):r===void 0&&(r=u)}else if(s.flags&pi.MoveAllAlternatesMatchingHDCP){const o=this.getVariantLevelIndex(e.frag),l=n.levels[o],u=l==null?void 0:l.attrs["HDCP-LEVEL"];s.hdcpLevel=u;const d=u==="NONE";u&&!d?(n.maxHdcpLevel=JD[JD.indexOf(u)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`)):(d&&this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE"),s.flags|=pi.MoveAllAlternatesMatchingKey)}if(s.flags&pi.MoveAllAlternatesMatchingKey){const o=e.decryptdata;if(o){const l=this.hls.levels,u=l.length;for(let f=u;f--;)if(this.variantHasKey(l[f],o)){var i,a;this.log(`Banned key found in level ${f} (${l[f].bitrate}bps) or audio group "${(i=l[f].audioGroups)==null?void 0:i.join(",")}" (${(a=e.frag)==null?void 0:a.type} fragment) ${Zr(o.keyId||[])}`),l[f].fragmentError++,l[f].loadError++,this.log(`Removing level ${f} with key error (${e.error})`),this.hls.removeLevel(f)}const d=e.frag;if(this.hls.levels.length<u)s.resolved=!0;else if(d&&d.type!==vt.MAIN){const f=d.decryptdata;f&&!o.matches(f)&&(s.resolved=!0)}}}s.resolved||this.switchLevel(e,r)}switchLevel(e,n){if(n!==void 0&&e.errorAction&&(this.warn(`switching to level ${n} after ${e.details}`),this.hls.nextAutoLevel=n,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===pe.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const s=QD(e.mimeType),r=this.hls.levels;for(let i=r.length;i--;)r[i][`${e.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${i} for ${e.details} ("${s}" not supported)`),this.hls.removeLevel(i))}}}function ate(t){const e=t.details;return e===pe.BUFFER_ADD_CODEC_ERROR||e===pe.MEDIA_SOURCE_REQUIRES_RESET||e===pe.BUFFER_APPEND_ERROR&&!V1e(t)}function V1e(t){return t.details===pe.BUFFER_APPEND_ERROR&&(t.error.name==="QuotaExceededError"||t.error.name==="InvalidStateError")}function Cb(t){const e={action:Oi.DoNothing,flags:pi.None};return t&&(e.resolved=!0),e}var ur={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class bot{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.BUFFER_APPENDED,this.onBufferAppended,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this),e.on(H.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.BUFFER_APPENDED,this.onBufferAppended,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this),e.off(H.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,n){const s=this.activePartLists[n];if(s)for(let r=s.length;r--;){const i=s[r];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,n)}getBufferedFrag(e,n){return this.getFragAtPos(e,n,!0)}getFragAtPos(e,n,s){const{fragments:r}=this,i=Object.keys(r);for(let a=i.length;a--;){const o=r[i[a]];if((o==null?void 0:o.body.type)===n&&(!s||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,n,s,r,i,a){this.timeRanges&&(this.timeRanges[e]=n);const o=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(l=>{const u=this.fragments[l];if(!u||!this.hls)return;const d=u.body;if(o>=d.sn)return;if(!u.buffered&&(!u.loaded||a)){d.type===s&&this.removeFragment(d);return}const f=u.range[e];if(f){if(f.time.length===0){this.removeFragment(d);return}if(f.time.some(p=>{const m=!this.isTimeBuffered(p.startPTS,p.endPTS,n);return m&&this.removeFragment(d),m}),r&&r!==d&&Eb()){const p=r.endPTS,m=d.startPTS;if(p&&m&&u.range.video){const v=m-p;v<0&&v>-.1&&(this.removeFragment(d),this.hls.trigger(H.BUFFER_FLUSHING,{startOffset:p+.004,endOffset:1/0,type:"video"}))}}}})}detectPartialFragments(e){const n=this.timeRanges,{frag:s,part:r,id:i}=e;if(!n||!vr(s))return;const a=Xg(s),o=this.fragments[a];if(!o||o.buffered&&s.gap)return;const l=!s.relurl;Object.keys(n).forEach(d=>{const f=s.elementaryStreams[d];if(!f)return;const p=n[d],m=l||f.partial===!0;o.range[d]=this.getBufferedTimes(s,r,m,p),this.detectEvictedFragments(d,p,i,s,r)}),o.loaded=null;const u=Object.keys(o.range);if(u.length){if(this.bufferedEnd(o,s),NE(o)||this.removeParts(s.sn-1,s.type),!r){const d=Math.min(.004,s.duration);u.some(f=>{var p;const m=(p=o.range[f])==null?void 0:p.time,v=m.length===0||m.length===1&&m[0].endPTS-m[0].startPTS<d;return v&&this.addAsGap(s),v})}}else this.removeFragment(s)}addAsGap(e){e.gap=!0,this.removeFragment(e),this.fragBuffered(e,!0)}bufferedEnd(e,n){e.buffered=!0,(e.body.endList=n.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,n){const s=this.activePartLists[n];s&&(this.activePartLists[n]=ote(s,r=>r.fragment.sn>=e))}fragBuffered(e,n){const s=Xg(e);let r=this.fragments[s];return!r&&n&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e)),r}getBufferedTimes(e,n,s,r){const i={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,u=e.maxStartPTS||a;for(let d=0;d<r.length;d++){const f=r.start(d)-this.bufferPadding,p=r.end(d)+this.bufferPadding;if(u>=f&&l<=p){i.time.push({startPTS:Math.max(a,r.start(d)),endPTS:Math.min(o,r.end(d))});break}else if(a<p&&o>f){const m=Math.max(a,r.start(d)),v=Math.min(o,r.end(d));v>m&&(i.partial=!0,i.time.push({startPTS:m,endPTS:v}))}else if(o<=f)break}return i}getPartialFragment(e){let n=null,s,r,i,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(u=>{const d=l[u];d&&NE(d)&&(r=d.body.start-o,i=d.body.end+o,e>=r&&e<=i&&(s=Math.min(e-r,i-e),a<=s&&(n=d.body,a=s)))}),n}isEndListAppended(e){const n=this.endListFragments[e];return n!==void 0&&(n.buffered||NE(n))}getState(e){const n=Xg(e),s=this.fragments[n];return s?s.buffered?NE(s)?ur.PARTIAL:ur.OK:ur.APPENDING:ur.NOT_LOADED}isTimeBuffered(e,n,s){let r,i;for(let a=0;a<s.length;a++){if(r=s.start(a)-this.bufferPadding,i=s.end(a)+this.bufferPadding,e>=r&&n<=i)return!0;if(n<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,n){if(!vr(n.frag)||n.frag.bitrateTest)return;const s=n.frag,r=n.part?null:n,i=Xg(s);this.fragments[i]={body:s,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,n){const{frag:s,part:r,timeRanges:i}=n;if(!vr(s))return;const a=s.type;if(r){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(r)}this.timeRanges=i}onFragBuffered(e,n){this.detectPartialFragments(n)}hasFragment(e){const n=Xg(e);return!!this.fragments[n]}hasFragments(e){const{fragments:n}=this,s=Object.keys(n);if(!e)return s.length>0;for(let r=s.length;r--;){const i=n[s[r]];if((i==null?void 0:i.body.type)===e)return!0}return!1}hasParts(e){var n;return!!((n=this.activePartLists[e])!=null&&n.length)}getBackBufferEvictionEnd(e,n,s){const{fragments:r}=this;let i=0,a=0;const o=Object.keys(r);for(let l=0;l<o.length;l++){const u=r[o[l]];if(!u||!u.buffered||u.body.type!==n)continue;const d=u.body;if(d.gap)return 0;const f=d.hasStats&&d.stats.loaded||d.byteLength||d.bitrate&&d.bitrate*8*d.duration;if(d.end<=e&&f&&(i+=f,a=Math.max(a,d.end),i>=s))return a}return a>0?a:0}removeFragmentsInRange(e,n,s,r,i){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.start<n&&l.end>e&&(o.buffered||i)&&this.removeFragment(l)})}removeFragment(e){const n=Xg(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=ote(s,i=>i.fragment.sn!==r)}delete this.fragments[n],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;n&&n.forEach(s=>s.clearElementaryStreamInfo())}}function NE(t){var e,n,s,r;return t.buffered&&!!(t.body.gap||(e=t.range.video)!=null&&e.partial||(n=t.range.audio)!=null&&n.partial||(s=t.range.audiovideo)!=null&&s.partial||(r=t.range.subs)!=null&&r.partial)}function Xg(t){return`${t.type}_${t.level}_${t.sn}`}function ote(t,e){return t.filter(n=>{const s=e(n);return s||n.clearElementaryStreamInfo(),s})}var Bh={cbc:0,ctr:1};class Sot{constructor(e,n,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=n,this.aesMode=s}decrypt(e,n){switch(this.aesMode){case Bh.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,e);case Bh.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function wot(t){const e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?t.slice(0,e-n):t}class _ot{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const n=new DataView(e),s=new Uint32Array(4);for(let r=0;r<4;r++)s[r]=n.getUint32(r*4);return s}initTable(){const e=this.sBox,n=this.invSBox,s=this.subMix,r=s[0],i=s[1],a=s[2],o=s[3],l=this.invSubMix,u=l[0],d=l[1],f=l[2],p=l[3],m=new Uint32Array(256);let v=0,x=0,y=0;for(y=0;y<256;y++)y<128?m[y]=y<<1:m[y]=y<<1^283;for(y=0;y<256;y++){let S=x^x<<1^x<<2^x<<3^x<<4;S=S>>>8^S&255^99,e[v]=S,n[S]=v;const _=m[v],E=m[_],T=m[E];let k=m[S]*257^S*16843008;r[v]=k<<24|k>>>8,i[v]=k<<16|k>>>16,a[v]=k<<8|k>>>24,o[v]=k,k=T*16843009^E*65537^_*257^v*16843008,u[S]=k<<24|k>>>8,d[S]=k<<16|k>>>16,f[S]=k<<8|k>>>24,p[S]=k,v?(v=_^m[m[m[T^_]]],x^=m[m[x]]):v=x=1}}expandKey(e){const n=this.uint8ArrayToUint32Array_(e);let s=!0,r=0;for(;r<n.length&&s;)s=n[r]===this.key[r],r++;if(s)return;this.key=n;const i=this.keySize=n.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const a=this.ksRows=(i+6+1)*4;let o,l;const u=this.keySchedule=new Uint32Array(a),d=this.invKeySchedule=new Uint32Array(a),f=this.sBox,p=this.rcon,m=this.invSubMix,v=m[0],x=m[1],y=m[2],S=m[3];let _,E;for(o=0;o<a;o++){if(o<i){_=u[o]=n[o];continue}E=_,o%i===0?(E=E<<8|E>>>24,E=f[E>>>24]<<24|f[E>>>16&255]<<16|f[E>>>8&255]<<8|f[E&255],E^=p[o/i|0]<<24):i>6&&o%i===4&&(E=f[E>>>24]<<24|f[E>>>16&255]<<16|f[E>>>8&255]<<8|f[E&255]),u[o]=_=(u[o-i]^E)>>>0}for(l=0;l<a;l++)o=a-l,l&3?E=u[o]:E=u[o-4],l<4||o<=4?d[l]=E:d[l]=v[f[E>>>24]]^x[f[E>>>16&255]]^y[f[E>>>8&255]]^S[f[E&255]],d[l]=d[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,n,s){const r=this.keySize+6,i=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],u=o[1],d=o[2],f=o[3],p=this.uint8ArrayToUint32Array_(s);let m=p[0],v=p[1],x=p[2],y=p[3];const S=new Int32Array(e),_=new Int32Array(S.length);let E,T,k,R,I,A,L,j,F,O,M,U,G,$;const V=this.networkToHostOrderSwap;for(;n<S.length;){for(F=V(S[n]),O=V(S[n+1]),M=V(S[n+2]),U=V(S[n+3]),I=F^i[0],A=U^i[1],L=M^i[2],j=O^i[3],G=4,$=1;$<r;$++)E=l[I>>>24]^u[A>>16&255]^d[L>>8&255]^f[j&255]^i[G],T=l[A>>>24]^u[L>>16&255]^d[j>>8&255]^f[I&255]^i[G+1],k=l[L>>>24]^u[j>>16&255]^d[I>>8&255]^f[A&255]^i[G+2],R=l[j>>>24]^u[I>>16&255]^d[A>>8&255]^f[L&255]^i[G+3],I=E,A=T,L=k,j=R,G=G+4;E=a[I>>>24]<<24^a[A>>16&255]<<16^a[L>>8&255]<<8^a[j&255]^i[G],T=a[A>>>24]<<24^a[L>>16&255]<<16^a[j>>8&255]<<8^a[I&255]^i[G+1],k=a[L>>>24]<<24^a[j>>16&255]<<16^a[I>>8&255]<<8^a[A&255]^i[G+2],R=a[j>>>24]<<24^a[I>>16&255]<<16^a[A>>8&255]<<8^a[L&255]^i[G+3],_[n]=V(E^m),_[n+1]=V(R^v),_[n+2]=V(k^x),_[n+3]=V(T^y),m=F,v=O,x=M,y=U,n=n+4}return _.buffer}}class Eot{constructor(e,n,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=n,this.aesMode=s}expandKey(){const e=Cot(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Cot(t){switch(t){case Bh.cbc:return"AES-CBC";case Bh.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}const Tot=16;class KF{constructor(e,n){if(this.logEnabled=!0,this.decryptRange=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,n!==!0)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:n}=this;if(!e||n)return this.reset(),null;const s=new Uint8Array(e);this.reset();const r=this.decryptRange;return r?r.start===0&&r.end>=s.length?s:s.slice(r.start,r.end):wot(s)}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,n,s,r,i){return this.decryptRange=i,this.useSoftware||i?new Promise((a,o)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,n,s,r);const u=this.flush();u?a(u.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),n,s,r)}softwareDecrypt(e,n,s,r){const{currentIV:i,currentResult:a,remainderData:o}=this;if(r!==Bh.cbc||n.byteLength!==16)return Gn.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=gl(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;i&&(s=i);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new _ot),u.expandKey(n);const d=a;return this.currentResult=u.decrypt(l.buffer,0,s),this.currentIV=l.slice(-16).buffer,d||null}webCryptoDecrypt(e,n,s,r){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,n,s,r));this.key=n,this.fastAesKey=new Eot(this.subtle,n,r)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Sot(this.subtle,new Uint8Array(s),r).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(Gn.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,n,s,r)))}onWebCryptoError(e,n,s,r){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,s,r);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let n=e;const s=e.length-e.length%Tot;return s!==e.length&&(n=e.slice(0,s),this.remainderData=e.slice(s)),n}logOnce(e){this.logEnabled&&(Gn.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const lte=Math.pow(2,17);class cte{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,n,s,r){const i=e.url;if(!i)return Promise.reject(new Ic({type:_t.NETWORK_ERROR,details:pe.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const a=this.config,o=a.fLoader,l=a.loader;return new Promise((u,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(y=>y[0]==="GAP")){d(dte(e));return}else e.gap=!1;const f=this.loader=o?new o(a):new l(a),p=ute(e,null,n);e.loader=f;const m=Gee(a.fragLoadPolicy.default),v={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:lte};f.stats.retry=e.stats.retry,e.stats=f.stats;const x={onSuccess:(y,S,_,E)=>{this.resetLoader(e,f);let T=y.data;_.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),u({frag:e,part:null,payload:T,networkDetails:E})},onError:(y,S,_,E)=>{this.resetLoader(e,f),d(new Ic({type:_t.NETWORK_ERROR,details:pe.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Rt({url:i,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:_,stats:E}))},onAbort:(y,S,_)=>{this.resetLoader(e,f),d(new Ic({type:_t.NETWORK_ERROR,details:pe.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:_,stats:y}))},onTimeout:(y,S,_)=>{this.resetLoader(e,f),d(new Ic({type:_t.NETWORK_ERROR,details:pe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${v.timeout}ms`),networkDetails:_,stats:y}))}};if(s){const y=this.gateProgress(s,r);x.onProgress=(S,_,E,T)=>y({frag:e,part:null,payload:E,networkDetails:T})}f.load(p,v,x)})}gateProgress(e,n){let s=e;if(n){const r=[];let i=!1;n.then(()=>{i=!0,r.forEach(a=>e(a)),r.length=0}).catch(()=>{}),s=a=>{i?e(a):r.push(a)}}return s}loadPart(e,n,s){this.abort();const r=this.config,i=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||n.gap){l(dte(e,n));return}const u=this.loader=i?new i(r):new a(r),d=ute(e,n);e.loader=u;const f=Gee(r.fragLoadPolicy.default),p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:lte};n.stats=u.stats,u.load(d,p,{onSuccess:(m,v,x,y)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,n);const S={frag:e,part:n,payload:m.data,networkDetails:y};s(S),o(S)},onError:(m,v,x,y)=>{this.resetLoader(e,u),l(new Ic({type:_t.NETWORK_ERROR,details:pe.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:n,response:Rt({url:d.url,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:x,stats:y}))},onAbort:(m,v,x)=>{e.stats.aborted=n.stats.aborted,this.resetLoader(e,u),l(new Ic({type:_t.NETWORK_ERROR,details:pe.INTERNAL_ABORTED,fatal:!1,frag:e,part:n,error:new Error("Aborted"),networkDetails:x,stats:m}))},onTimeout:(m,v,x)=>{this.resetLoader(e,u),l(new Ic({type:_t.NETWORK_ERROR,details:pe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:n,error:new Error(`Timeout after ${p.timeout}ms`),networkDetails:x,stats:m}))}})})}updateStatsFromPart(e,n){const s=e.stats,r=n.stats,i=r.total;if(s.loaded+=r.loaded,i){const l=Math.round(e.duration/n.duration),u=Math.min(Math.round(s.loaded/i),l),f=(l-u)*Math.round(s.loaded/u);s.total=s.loaded+f}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,n){e.loader=null,e.url=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}}function ute(t,e=null,n){const s=e||t,r={type:hn.MEDIA_FRAGMENT,frag:t,part:e,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},i=m5(t,e,n);return i.resetIV&&(r.resetIV=!0),i.byteRange&&(r.rangeStart=i.byteRange.start,r.rangeEnd=i.byteRange.end),r}function m5(t,e=null,n){const s={},r=e||t,i=r.byteRangeStartOffset,a=r.byteRangeEndOffset;if(at(i)&&at(a)){var o;if((t.sn==="initSegment"||n)&&kot((o=t.decryptdata)==null?void 0:o.method)){let l=Math.floor(i/16)*16;const u=Math.ceil(a/16)*16;s.decryptRange={start:i-l,end:a-l},l>=16&&(s.resetIV=!0,l=l-16),s.byteRange={start:l,end:u}}else s.byteRange={start:i,end:a}}return s}function dte(t,e){const n=new Error(`GAP ${t.gap?"tag":"attribute"} found`),s={type:_t.MEDIA_ERROR,details:pe.FRAG_GAP,fatal:!1,frag:t,error:n,networkDetails:null};return e&&(s.part=e),(e||t).stats.aborted=!0,new Ic(s)}function kot(t){return t==="AES-128"||t==="AES-256"}class Ic extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class H1e extends Oo{constructor(e,n){super(e,n),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1?(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0):(this.log(`possible exception thrown in task-loop (${this.constructor.name}.doTick)`),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class YF{constructor(e,n,s,r=0,i=-1,a=!1,o,l,u){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.iframe=void 0,this.duration=void 0,this.decryptRange=void 0,this.transmuxing=IE(),this.buffering={audio:IE(),video:IE(),audiovideo:IE()},this.level=e,this.sn=n,this.id=s,this.size=r,this.part=i,this.partial=a,this.duration=o||0,this.decryptRange=u,this.iframe=l||!1}}function IE(){return{start:0,executeStart:0,executeEnd:0,end:0}}const fte={length:0,start:()=>0,end:()=>0};class Bt{static isBuffered(e,n){if(e){const s=Bt.getBuffered(e);for(let r=s.length;r--;)if(n>=s.start(r)&&n<=s.end(r))return!0}return!1}static bufferedRanges(e){if(e){const n=Bt.getBuffered(e);return Bt.timeRangesToArray(n)}return[]}static timeRangesToArray(e){const n=[];for(let s=0;s<e.length;s++)n.push({start:e.start(s),end:e.end(s)});return n}static bufferInfo(e,n,s){if(e){const r=Bt.bufferedRanges(e);if(r.length)return Bt.bufferedInfo(r,n,s)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,n,s){n=Math.max(0,n),e.length>1&&e.sort((d,f)=>d.start-f.start||f.end-d.end);let r=-1,i=[];if(s)for(let d=0;d<e.length;d++){n>=e[d].start&&n<=e[d].end&&(r=d);const f=i.length;if(f){const p=i[f-1].end;e[d].start-p<s?e[d].end>p&&(i[f-1].end=e[d].end):i.push(e[d])}else i.push(e[d])}else i=e;let a=0,o,l=n,u=n;for(let d=0;d<i.length;d++){const f=i[d].start,p=i[d].end;if(r===-1&&n>=f&&n<=p&&(r=d),n+s>=f&&n<p)l=f,u=p,a=u-n;else if(n+s<f){o=f;break}}return{len:a,start:l||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||fte}catch(n){return Gn.log("failed to get media.buffered",n),fte}}}const G1e=/\{\$([a-zA-Z0-9-_]+)\}/g;function hte(t){return G1e.test(t)}function ZF(t,e){if(t.variableList!==null||t.hasVariableRefs){const n=t.variableList;return e.replace(G1e,s=>{const r=s.substring(2,s.length-1),i=n==null?void 0:n[r];return i===void 0?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):i})}return e}function pte(t,e,n){let s=t.variableList;s||(t.variableList=s={});let r,i;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(n).searchParams;if(a.has(r))i=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${n}"`)}catch(a){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,i=e.VALUE;r in s?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=i||""}function Rot(t,e,n){const s=e.IMPORT;if(n&&s in n){let r=t.variableList;r||(t.variableList=r={}),r[s]=n[s]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const Aot=/^(\d+)x(\d+)$/,mte=/(.+?)=(".*?"|.*?)(?:,|$)/g;class lr{constructor(e,n){typeof e=="string"&&(e=lr.parseAttrList(e,n)),ms(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const n=parseInt(this[e],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(e){if(this[e]){let n=(this[e]||"0x").slice(2);n=(n.length&1?"0":"")+n;const s=new Uint8Array(n.length/2);for(let r=0;r<n.length/2;r++)s[r]=parseInt(n.slice(r*2,r*2+2),16);return s}return null}hexadecimalIntegerAsNumber(e){const n=parseInt(this[e],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,n){const s=this[e];return s?parseFloat(s):n}enumeratedString(e){return this[e]}enumeratedStringList(e,n){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((r,i)=>(r[i.toLowerCase()]=!0,r),n)}bool(e){return this[e]==="YES"}decimalResolution(e){const n=Aot.exec(this[e]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(e,n){let s;const r={};for(mte.lastIndex=0;(s=mte.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let u=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(n&&(l||u))o=ZF(n,o);else if(!u&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Gn.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=o}return r}}const Not="com.apple.hls.interstitial";function Iot(t){return t!=="ID"&&t!=="CLASS"&&t!=="CUE"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}function Lot(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"||t==="SCTE35-CMD"}class W1e{constructor(e,n,s=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(r=n==null?void 0:n.tagOrder)!=null?r:s,n){const i=n.attr;for(const a in i)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==i[a]){Gn.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=ms(new lr({}),i,e)}if(this.attr=e,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in e){const i=(n==null?void 0:n.endDate)||new Date(e["END-DATE"]);at(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Gn.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(at(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Not}get isValid(){return!!this.id&&!this._badValueForSameId&&at(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}get invalidReason(){return this.id?this._badValueForSameId?`Date range ${this._badValueForSameId} mismatch`:at(this.startDate.getTime())?this.isInterstitial&&!("X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)?"Interstitial Date range missing X-ASSET-(LIST|URI)":this.isValid?null:"Unknown (check DURATION(|END|NEXT), CLASS, and CUE)":"Date range invalid start date":"Missing ID"}}const q1e=10;class jot{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.iframesOnly=!1,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!n||!this.live,this.advanced=this.endSN>e.endSN||n>0||n===0&&s>0,this.updated||this.advanced?this.misses=0:this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(n=>{let s=n.decryptdata;return s||(n.setKeyFormat(e.keyFormat),s=n.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?at(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||q1e}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const n=this.lastPartIndex;if(n!==-1){for(let s=e.length;s--;)if(e[s].index>n)return e[s].index;return n}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function g5(t,e){return t.length===e.length?!t.some((n,s)=>n!==e[s]):!1}function gte(t,e){return!t&&!e?!0:!t||!e?!1:g5(t,e)}function fv(t){return t==="AES-128"||t==="AES-256"||t==="AES-256-CTR"}function XF(t){switch(t){case"AES-128":case"AES-256":return Bh.cbc;case"AES-256-CTR":return Bh.ctr;default:throw new Error(`invalid full segment method ${t}`)}}function e9(t){return Uint8Array.from(unescape(encodeURIComponent(t)),e=>e.charCodeAt(0))}function Pot(t){const e=e9(t).subarray(0,16),n=new Uint8Array(16);return n.set(e,16-e.length),n}function K1e(t){const e=function(s,r,i){const a=s[r];s[r]=s[i],s[i]=a};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function Y1e(t){const e=t.split(":");let n=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),r=s[s.length-1].split(",");if(r.length===2){const i=r[0]==="base64",a=r[1];i?(s.splice(-1,1),n=GF(a)):n=Pot(a)}}return n}const v5=typeof self<"u"?self:void 0;var Qs={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Fi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function LE(t){switch(t){case Fi.FAIRPLAY:return Qs.FAIRPLAY;case Fi.PLAYREADY:return Qs.PLAYREADY;case Fi.WIDEVINE:return Qs.WIDEVINE;case Fi.CLEARKEY:return Qs.CLEARKEY}}var Z1e={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function FL(t){switch(t){case Qs.FAIRPLAY:return Fi.FAIRPLAY;case Qs.PLAYREADY:return Fi.PLAYREADY;case Qs.WIDEVINE:return Fi.WIDEVINE;case Qs.CLEARKEY:return Fi.CLEARKEY}}function py(t){const{drmSystems:e,widevineLicenseUrl:n}=t,s=e?[Qs.FAIRPLAY,Qs.WIDEVINE,Qs.PLAYREADY,Qs.CLEARKEY].filter(r=>!!e[r]):[];return!s[Qs.WIDEVINE]&&n&&s.push(Qs.WIDEVINE),s}const X1e=(function(t){return v5!=null&&(t=v5.navigator)!=null&&t.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function Mot(t,e,n,s){let r;switch(t){case Qs.FAIRPLAY:r=["cenc","sinf"];break;case Qs.WIDEVINE:case Qs.PLAYREADY:r=["cenc"];break;case Qs.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return Dot(r,e,n,s)}function Dot(t,e,n,s){return[{initDataTypes:t,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}
473`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:n.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function Oot(t){var e;return!!t&&(t.sessionType==="persistent-license"||!!((e=t.sessionTypes)!=null&&e.some(n=>n==="persistent-license")))}function QF(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=ic(e),s=n.substring(n.indexOf("<"),n.length),a=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=GF(o).subarray(0,16);return K1e(l),l}}return null}let Qg={};class wd{static clearKeyUriToKeyIdMap(){Qg={}}static setKeyIdForUri(e,n){Qg[e]=n}static addKeyIdForUri(e){const n=Object.keys(Qg).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,n),Qg[e]=s,s}constructor(e,n,s,r=[1],i=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.scheme=void 0,this.method=e,this.uri=n,this.keyFormat=s,this.keyFormatVersions=r,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!fv(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(y1e(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&g5(e.keyFormatVersions,this.keyFormatVersions)&&gte(e.iv,this.iv)&&gte(e.keyId,this.keyId)}isSupported(){if(this.method){if(fv(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Fi.FAIRPLAY:case Fi.WIDEVINE:case Fi.PLAYREADY:case Fi.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,n){var s;if(!this.encrypted||!this.uri)return null;if(fv(this.method)){let a=this.iv;return a||(typeof e!="number"&&(Gn.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),a=Fot(e)),new wd(this.method,this.uri,"identity",this.keyFormatVersions,a)}if(this.keyId){const a=Qg[this.uri];if(a&&!g5(this.keyId,a)&&wd.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const r=Y1e(this.uri);if(r)switch(this.keyFormat){case Fi.WIDEVINE:if(this.pssh=r,!this.keyId){const a=N1e(r.buffer).filter(o=>o.systemId===Z1e.WIDEVINE);if(a.length){var i;const o=a[0];this.keyId=(i=o.kids)!=null&&i.length?o.kids[0]:null}}this.keyId||(this.keyId=vte(n));break;case Fi.PLAYREADY:{const a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Uat(a,null,r),this.keyId=QF(r);break}default:{let a=r.subarray(0,16);if(a.length!==16){const o=new Uint8Array(16);o.set(a,16-a.length),a=o}this.keyId=a;break}}if(((s=this.keyId)==null?void 0:s.byteLength)!==16){let a;a=$ot(n),a||(a=vte(n),a||(a=Qg[this.uri])),a&&(this.keyId=a,wd.setKeyIdForUri(this.uri,a))}return this}}function $ot(t){const e=t==null?void 0:t[Fi.WIDEVINE];return e?e.keyId:null}function vte(t){const e=t==null?void 0:t[Fi.PLAYREADY];if(e){const n=Y1e(e.uri);if(n)return QF(n)}return null}function Fot(t){const e=new Uint8Array(16);for(let n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}const xte=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(I-FRAME-STREAM-INF|SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)(?:[\r\n]+|$)/g,yte=/#EXT-X-MEDIA:(.*)/g,Uot=/^#EXT(?:INF|-X-TARGETDURATION):/m,UL=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Bot=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS|I-FRAMES-ONLY)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Wc{static findGroup(e,n){for(let s=0;s<e.length;s++){const r=e[s];if(r.id===n)return r}}static resolve(e,n){return UF.buildAbsoluteURL(n,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Uot.test(e)}static parseMasterPlaylist(e,n){const s=hte(e),r={contentSteering:null,levels:[],iframeVariants:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},i=[];if(xte.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let a;for(;(a=xte.exec(e))!=null;)if(a[1]){const l=new lr(a[1],r),u=bte(l,a[2],n,r,i);u&&r.levels.push(u)}else if(a[3]){const l=a[3],u=a[4];switch(l){case"I-FRAME-STREAM-INF":{const d=new lr(u,r),f=bte(d,d.URI,n,r,i,!0);f&&r.iframeVariants.push(f)}break;case"SESSION-DATA":{const d=new lr(u,r),f=d["DATA-ID"];f&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[f]=d);break}case"SESSION-KEY":{const d=Ste(u,n,r);d.encrypted&&d.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(d)):Gn.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const d=new lr(u,r);pte(r,d,n)}break}case"CONTENT-STEERING":{const d=new lr(u,r);r.contentSteering={uri:Wc.resolve(d["SERVER-URI"],n),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=wte(u);break}}}const o=i.length>0&&i.length<r.levels.length;return r.levels=o?i:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,n,s){let r;const i={},a=s.levels,o={AUDIO:a.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:a.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(yte.lastIndex=0;(r=yte.exec(e))!==null;){const u=new lr(r[1],s),d=u.TYPE;if(d){const f=o[d],p=i[d]||[];i[d]=p;const m=u.LANGUAGE,v=u["ASSOC-LANGUAGE"],x=u.CHANNELS,y=u.CHARACTERISTICS,S=u["INSTREAM-ID"],_={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||m||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:m,url:u.URI?Wc.resolve(u.URI,n):""};if(v&&(_.assocLang=v),x&&(_.channels=x),y&&(_.characteristics=y),S&&(_.instreamId=S),f!=null&&f.length){const E=Wc.findGroup(f,_.groupId)||f[0];Ete(_,E,"audioCodec"),Ete(_,E,"textCodec")}p.push(_)}}return i}static parseLevelPlaylist(e,n,s,r,i,a){var o;const l={url:n},u=new jot(n),d=u.fragments,f=[];let p=null,m=0,v=0,x=0,y=0,S=0,_=null,E=new CE(r,l),T,k,R,I=-1,A=!1,L=null,j;if(UL.lastIndex=0,u.m3u8=e,u.hasVariableRefs=hte(e),((o=UL.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(T=UL.exec(e))!==null;){A&&(A=!1,E=new CE(r,l),E.playlistOffset=x,E.setStart(x),E.sn=m,E.cc=y,S&&(E.bitrate=S),E.level=s,p&&(E.initSegment=p,p.rawProgramDateTime&&(E.rawProgramDateTime=p.rawProgramDateTime,p.rawProgramDateTime=null),L&&(E.setByteRange(L),L=null)));const G=T[1];if(G){E.duration=parseFloat(G);const $=(" "+T[2]).slice(1);E.title=$||null,E.tagList.push($?["INF",G,$]:["INF",G])}else if(T[3]){if(at(E.duration)){var F;E.playlistOffset=x,E.setStart(x),R&&Tte(E,R,u),E.sn=m,E.level=s,E.cc=y;const $=(" "+T[3]).slice(1);E.relurl=ZF(u,$),t9(E,_,f),_=E,x+=E.duration,m++,v=0;const V=E.byteRange;if(V.length===2&&(E.bitrate=(V[1]-V[0])*8/E.duration|0),u.iframesOnly&&V[0]&&((F=p)==null?void 0:F.cc)!==y){const B=new CE(r,l);B.relurl=E.relurl,B.setByteRange(`${Math.min(V[0],1316)}@0`),B.level=s,B.sn="initSegment",R&&(B.levelkeys=R,R.identity&&(B._decryptdata=R.identity.getDecryptData(0))),p=B,E.initSegment=p}d.push(E),A=!0}}
vendor: 4,865 bytes, line 473
473else{if(T=T[0].match(Bot),!T){Gn.warn("No matches on slow regex match for level playlist!");continue}for(k=1;k<T.length&&T[k]===void 0;k++);const $=(" "+T[k]).slice(1),V=(" "+T[k+1]).slice(1),B=T[k+2]?(" "+T[k+2]).slice(1):null;switch($){case"BYTERANGE":_?E.setByteRange(V,_):E.setByteRange(V);break;case"PROGRAM-DATE-TIME":E.rawProgramDateTime=V,E.tagList.push(["PROGRAM-DATE-TIME",V]),I===-1&&(I=d.length);break;case"PLAYLIST-TYPE":u.type&&$u(u,$,T),u.type=V.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?$u(u,$,T):_!==null&&Hot(u,$,T),u.startSN=parseInt(V),m=u.startSN+u.skippedSegments;break;case"SKIP":{u.skippedSegments&&$u(u,$,T);const q=new lr(V,u),z=q.decimalInteger("SKIPPED-SEGMENTS");if(at(z)){u.skippedSegments+=z;for(let K=z;K--;)d.push(null);m+=z}const D=q.enumeratedString("RECENTLY-REMOVED-DATERANGES");D&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(D.split("	")));break}case"TARGETDURATION":u.targetduration!==0&&$u(u,$,T),u.targetduration=Math.max(parseInt(V),1);break;case"VERSION":u.version!==null&&$u(u,$,T),u.version=parseInt(V);break;case"INDEPENDENT-SEGMENTS":break;case"I-FRAMES-ONLY":u.iframesOnly=!0;break;case"ENDLIST":u.live||$u(u,$,T),u.live=!1;break;case"#":(V||B)&&E.tagList.push(B?[V,B]:[V]);break;case"DISCONTINUITY":y++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([$]);break;case"BITRATE":E.tagList.push([$,V]),S=parseInt(V)*1e3,at(S)?E.bitrate=S:S=0;break;case"DATERANGE":{const q=new lr(V,u),z=new W1e(q,u.dateRanges[q.ID],u.dateRangeTagCount);u.dateRangeTagCount++,z.isValid||u.skippedSegments?u.dateRanges[z.id]=z:Gn.log(`Ignoring invalid DATERANGE tag: ${z.invalidReason}: ${V}`),E.tagList.push(["EXT-X-DATERANGE",V]);break}case"DEFINE":{{const q=new lr(V,u);"IMPORT"in q?Rot(u,q,a):pte(u,q,n)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0&&$u(u,$,T),u.startCC=y=parseInt(V),d.forEach(q=>q&&(q.cc=y));break;case"KEY":{const q=Ste(V,n,u);if(q.isSupported()){if(q.method==="NONE"){R=void 0;break}R||(R={});const z=R[q.keyFormat];z!=null&&z.matches(q)||(z&&(R=ms({},R)),R[q.keyFormat]=q)}else Gn.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${V}"`);break}case"START":u.startTimeOffset=wte(V);break;case"MAP":{const q=new lr(V,u);if(E.duration){const z=new CE(r,l);Cte(z,q,s,R),p=z,E.initSegment=p,p.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=p.rawProgramDateTime)}else{const z=E.byteRangeEndOffset;if(z){const D=E.byteRangeStartOffset;L=`${z-D}@${D}`}else L=null;Cte(E,q,s,R),p=E,A=!0}p.cc=y;break}case"SERVER-CONTROL":{j&&$u(u,$,T),j=new lr(V),u.canBlockReload=j.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=j.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&j.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=j.optionalFloat("PART-HOLD-BACK",0),u.holdBack=j.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&$u(u,$,T);const q=new lr(V);u.partTarget=q.decimalFloatingPoint("PART-TARGET");break}case"PART":{let q=u.partList;q||(q=u.partList=[]);const z=v>0?q[q.length-1]:void 0,D=v++,K=new lr(V,u),Y=new Kit(K,E,l,D,z);q.push(Y),E.duration+=Y.duration;break}case"PRELOAD-HINT":{const q=new lr(V,u);u.preloadHint=q;break}case"RENDITION-REPORT":{const q=new lr(V,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(q);break}default:Gn.warn(`line parsed but not handled: ${T}`);break}}}_&&!_.relurl?(d.pop(),x-=_.duration,u.partList&&(u.fragmentHint=_)):u.partList&&(t9(E,_,f),E.cc=y,u.fragmentHint=E,R&&Tte(E,R,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const O=d.length,M=d[0],U=d[O-1];if(x+=u.skippedSegments*u.targetduration,x>0&&O&&U){u.averagetargetduration=x/O;const G=U.sn;u.endSN=G!=="initSegment"?G:0,u.live||(U.endList=!0),I>0&&(Vot(d,I,I>O-1?E:null),M&&f.unshift(M))}return u.fragmentHint&&(x+=u.fragmentHint.duration),u.totalduration=x,f.length&&u.dateRangeTagCount&&M&&Q1e(f,u),u.endCC=y,u}}function bte(t,e,n,s,r,i){var a;if(e===void 0)return null;const o=ZF(s,e),l={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:Wc.resolve(o,n)},u=t.decimalResolution("RESOLUTION");u&&(l.width=u.width,l.height=u.height),_te(t.CODECS,l);const d=t["SUPPLEMENTAL-CODECS"];return d&&(l.supplemental={},_te(d,l.supplemental)),(a=l.unknownCodecs)!=null&&a.length||r.push(l),i&&(l.iframes=!0),l}function Q1e(t,e){let n=t.length;if(!n)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];t.push(o),n++}else return;const s=t[n-1],r=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let o=i.length;o--;){const l=e.dateRanges[i[o]],u=l.startDate.getTime();l.tagAnchor=s.ref;for(let d=n;d--;){var a;if(((a=t[d])==null?void 0:a.sn)<e.startSN)break;const f=zot(e,u,t,d,r);if(f){l.tagAnchor=f.ref;break}}}}function zot(t,e,n,s,r){const i=n[s];if(i){const o=i.programDateTime;if(e>=o||s===0){var a;
vendor: 4,173 bytes, line 473
473const l=(((a=n[s+1])==null?void 0:a.start)||r)-i.start;if(e<=o+l*1e3){const u=i.sn-t.startSN,d=t.fragments;if(u>=0&&u<d.length){if(d.length>n.length){const f=n[s+1]||d[d.length-1],p=Math.min(f.sn-t.startSN,d.length-1);for(let m=p;m>u;m--){const v=d[m].programDateTime;if(e>=v&&e<v+d[m].duration*1e3)return d[m]}}return d[u]}}}}return null}function Ste(t,e,n){var s,r;const i=new lr(t,n),a=(s=i.METHOD)!=null?s:"",o=i.URI,l=i.hexadecimalInteger("IV"),u=i.KEYFORMATVERSIONS,d=(r=i.KEYFORMAT)!=null?r:"identity";o&&i.IV&&!l&&Gn.error(`Invalid IV: ${i.IV}`);const f=o?Wc.resolve(o,e):"",p=(u||"1").split("/").map(Number).filter(Number.isFinite);return new wd(a,f,d,p,l,i.KEYID)}function wte(t){const n=new lr(t).decimalFloatingPoint("TIME-OFFSET");return at(n)?n:null}function _te(t,e){let n=(t||"").split(/[ ,]+/).filter(s=>s);["video","audio","text","image"].forEach(s=>{const r=n.filter(i=>WF(i,s));r.length&&(e[`${s}Codec`]=r.map(i=>i.split("/")[0]).join(","),n=n.filter(i=>r.indexOf(i)===-1))}),e.unknownCodecs=n}function Ete(t,e,n){const s=e[n];s&&(t[n]=s)}function Vot(t,e,n){if(n||(n=t[e]),!!n)for(let s=e;s--;){const r=t[s];if(!r)return;r.programDateTime=n.programDateTime-r.duration*1e3,n=r}}function t9(t,e,n){t.rawProgramDateTime?n.push(t):e!=null&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function Cte(t,e,n,s){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=n,t.sn="initSegment",s&&(t.levelkeys=s),t.initSegment=null}function Tte(t,e,n){t.levelkeys=e;const{encryptedFragments:s}=n;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&s.push(t)}function $u(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${n[0]})`)}function Hot(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${n[0]})`)}function BL(t,e){const n=e.startPTS;if(at(n)){let s=0,r;e.sn>t.sn?(s=n-t.start,r=t):(s=t.start-n,r=e),r.duration!==s&&r.setDuration(s)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}function J1e(t,e,n,s,r,i,a,o){s-n<=0&&(o.warn("Fragment should have a positive duration",e),s=n+e.duration,i=r+e.duration);let u=n,d=s;const f=e.startPTS,p=e.endPTS;if(at(f)){const _=Math.abs(f-n);t&&_>t.totalduration?o.warn(`media timestamps and playlist times differ by ${_}s for level ${e.level} ${t.url}`):at(e.deltaPTS)?e.deltaPTS=Math.max(_,e.deltaPTS):e.deltaPTS=_,u=Math.max(n,f),n=Math.min(n,f),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,d=Math.min(s,p),s=Math.max(s,p),i=e.endDTS!==void 0?Math.max(i,e.endDTS):i}const m=n-e.start;e.start!==0&&e.setStart(n),e.setDuration(s-e.start),e.startPTS=n,e.maxStartPTS=u,e.startDTS=r,e.endPTS=s,e.minEndPTS=d,e.endDTS=i;const v=e.sn;if(!t||v<t.startSN||v>t.endSN)return 0;let x;const y=v-t.startSN,S=t.fragments;for(S[y]=e,x=y;x>0;x--)BL(S[x],S[x-1]);for(x=y;x<S.length-1;x++)BL(S[x],S[x+1]);return t.fragmentHint&&BL(S[S.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,m}function Got(t,e,n){if(t===e)return;let s=null;const r=t.fragments;for(let d=r.length-1;d>=0;d--){const f=r[d].initSegment;if(f){s=f;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let i;Kot(t,e,(d,f,p,m)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==d.cc){const v=d.cc-f.cc;for(let x=p;x<m.length;x++)m[x].cc+=v;e.endCC=m[m.length-1].cc}at(d.startPTS)&&at(d.endPTS)&&(f.setStart(f.startPTS=d.startPTS),f.startDTS=d.startDTS,f.maxStartPTS=d.maxStartPTS,f.endPTS=d.endPTS,f.endDTS=d.endDTS,f.minEndPTS=d.minEndPTS,f.setDuration(d.endPTS-d.startPTS),f.duration&&(i=f),e.PTSKnown=e.alignedSliding=!0),d.hasStreams&&(f.elementaryStreams=d.elementaryStreams),f.loader=d.loader,d.hasStats&&(f.stats=d.stats),d.initSegment&&(f.initSegment=d.initSegment,s=d.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(s&&o.forEach(d=>{var f;d&&(!d.initSegment||d.initSegment.relurl===((f=s)==null?void 0:f.relurl))&&(d.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(d=>!d),e.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments ski
473pped in delta playlist");for(let d=e.skippedSegments;d--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Wot(t.dateRanges,e,n));const d=t.fragments.filter(f=>f.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<o.length;f++)o[f].programDateTime===null&&t9(o[f],o[f-1],d);Q1e(d,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const d=nxe(t,e.startSN-1);e.startCC=(l=d==null?void 0:d.cc)!=null?l:a[0].cc}if(qot(t.partList,e.partList,(d,f)=>{f.elementaryStreams=d.elementaryStreams,f.stats=d.stats,f.gap=d.gap||f.gap}),i){const d=e.iframesOnly&&i.type===vt.MAIN;J1e(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,d,n)}else exe(t,e);a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const d=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=d),e.driftEndTime=u,e.driftEnd=d}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=t.requestScheduled)}function Wot(t,e,n){const{dateRanges:s,recentlyRemovedDateranges:r}=e,i=ms({},t);r&&r.forEach(l=>{delete i[l]});const o=Object.keys(i).length;return o?(Object.keys(s).forEach(l=>{const u=i[l],d=new W1e(s[l].attr,u);d.isValid?(i[l]=d,u||(d.tagOrder+=o)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Fs(s[l].attr)}"`)}),i):s}function qot(t,e,n){if(t&&e){let s=0;for(let r=0,i=t.length;r<i;r++){const a=t[r],o=e[r+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?n(a,o):s--}}}function Kot(t,e,n){var s;const r=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,a=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,o=e.startSN-t.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=(s=t.fragmentHint)!=null&&s.duration?t.fragments.concat(t.fragmentHint):t.fragments;for(let d=i;d<=a;d++){const f=u[o+d];let p=l[d];if(r&&!p&&f&&(p=e.fragments[d]=f),f&&p){n(f,p,d,l);const m=f.relurl,v=p.relurl;if(m&&Zot(m,v)){e.playlistParsingError=kte(`media sequence mismatch ${p.sn}:`,t,e,f,p);return}else if(f.cc!==p.cc){e.playlistParsingError=kte(`discontinuity sequence mismatch (${f.cc}!=${p.cc})`,t,e,f,p);return}}}}function kte(t,e,n,s,r){return new Error(`${t} ${r.url}
474Playlist starting @${e.startSN}
475${e.m3u8}
476
477Playlist starting @${n.startSN}
478${n.m3u8}`)}function exe(t,e,n=!0,s){const r=e.startSN+e.skippedSegments-t.startSN,i=t.fragments,a=r>=0;let o=0;if(a&&r<i.length)o=i[r].start,s==null||s.log(`Aligning playlists based on SN ${e.startSN} (diff: ${o})`);else if(a&&e.startSN===t.endSN+1)o=t.fragmentEnd,s==null||s.log(`Aligning playlists based on first/last SN ${e.startSN} (diff: ${o})`);else if(a&&n)o=t.fragmentStart+r*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=t.fragmentStart,s==null||s.log(`Aligning playlists based on first SN ${e.startSN} (diff: ${o})`);else return o;return Yot(e,o),o}function Yot(t,e){if(e){const n=t.fragments;for(let s=t.skippedSegments;s<n.length;s++)n[s].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function txe(t,e=1/0){let n=1e3*t.targetduration;if(t.updated){const s=t.fragments;if(s.length&&n*4>e){const i=s[s.length-1].duration*1e3;i<n&&(n=i)}}else n/=2;return Math.round(n)}function nxe(t,e,n){var s;if(!t)return null;let r=t.fragments[e-t.startSN];return r||(r=t.fragmentHint,((s=r)==null?void 0:s.sn)===e)?r:n&&e<t.startSN&&n.sn===e?n:null}function Rte(t,e,n){return t?sxe(t.partList,e,n):null}function sxe(t,e,n){if(t)for(let s=t.length;s--;){const r=t[s];if(r.index===n&&r.fragment.sn===e)return r}return null}function rxe(t){t.forEach((e,n)=>{var s;(s=e.details)==null||s.fragments.forEach(r=>{r.level=n,r.initSegment&&(r.initSegment.level=n)})})}function Zot(t,e){return t!==e&&e?Ate(t)!==Ate(e):!1}function Ate(t){return t.replace(/\?[^?]*$/,"")}function Tb(t,e){for(let s=0,r=t.length;s<r;s++){var n;if(((n=t[s])==null?void 0:n.cc)===e)return t[s]}return null}function Xot(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}function Nte(t,e){const n=t.start+e;t.setStart(n)}function ixe(t,e){const n=e.fragments;for(let s=0,r=n.length;s<r;s++)Nte(n[s],t);e.fragmentHint&&Nte(e.fragmentHint,t),e.alignedSliding=!0}function x5(t,e,n){t&&(Qot(e,t,n),e.alignedSliding||Jot(e,t,n),!e.alignedSliding&&!e.skippedSegments&&exe(t,e,!1,n))}function Qot(t,e,n){if(!Xot(e,t))return;const s=Math.min(e.endCC,t.endCC),r=Tb(e.fragments,s),i=Tb(t.fragments,s);if(!r||!i)return;const a=r.start-i.start;n.log(`Aligning playlists using dicontinuity sequence ${s} (diff: ${a})`),ixe(a,t)}function Jot(t,e,n){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const s=t.fragments,r=e.fragments;if(!s.length||!r.length)return;let i,a;const o=Math.min(e.endCC,t.endCC);e.startCC<o&&t.startCC<o&&(i=Tb(r,o),a=Tb(s,o)),(!i||!a)&&(i=r[Math.floor(r.length/2)]||r.filter(p=>!!p)[0],a=Tb(s,i.cc)||s[Math.floor(s.length/2)]);const l=i.programDateTime,u=a.programDateTime;if(!l||!u)return;const d=(u-l)/1e3;if(Math.abs(d)>Math.max(60,t.totalduration)){n.log(`Cannot align playlists using PDT without overlap (${Math.abs(d)} > ${t.totalduration})`);return}const f=d-(a.start-i.start);n.log(`Aligning playlists using PDT (diff: ${f})`),ixe(f,t)}function ns(t,e,n){Xn(t,e,n),t.addEventListener(e,n)}function Xn(t,e,n){t.removeEventListener(e,n)}function y5(t){let e="";const n=t.length;for(let s=0;s<n;s++)e+=`[${t.start(s).toFixed(3)}-${t.end(s).toFixed(3)}]`;return e}const Ne={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class JF extends H1e{constructor(e,n,s,r,i){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragPlaying=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ne.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=-1,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.initFragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:u,state:d}=this,f=l?l.currentTime:0,p=Bt.bufferInfo(u||l,f,a.maxBufferHole),m=p.len;if(this.log(`Media seeking to ${f}, state: ${d}, ${m?"in":"out of"} buffer`),this.state===Ne.ENDED)this.resetLoadingState();else if(o){const x=a.maxFragLookUpTolerance,y=o.start-x,S=o.start+o.duration+x;if(!m||S<p.start||y>p.end){const _=f<y,E=f>S;
vendor: 117,564 bytes, lines 478-484
478(_||E)&&(o.loader&&(E||!this.isFragmentNearlyDownloaded(o))?(this.log(`Cancelling fragment load for seek (sn: ${o.sn}) - ${_?"backward":"forward"} seek`),o.abortRequests(),this.resetLoadingState()):this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const x=this.lastCurrentTime;if(f>x&&(this.lastCurrentTime=f),!this.loadingParts){const y=Math.max(p.end,f),S=this.shouldLoadParts(this.getLevelDetails(),y);S&&(this.log(`LL-Part loading ON after seeking to ${f} with buffer @${y}`),this.loadingParts=S)}}const v=!Bt.isBuffered(l,f);(!this.hls.hasEnoughToStart||v)&&(this.log(`Setting ${v?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,v&&(this.startPosition=f)),m<1&&this.state===Ne.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new cte(e.config),this.initFragmentLoader=new cte(e.config),this.keyLoader=s,this.fragmentTracker=n,this.config=e.config,this.decrypter=new KF(e.config)}registerListeners(){const{hls:e}=this;e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Ne.STOPPED)return;this.fragmentLoader.abort(),this.initFragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Ne.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:n}=this;if(n===-1&&e){const s=this.getLevelDetails();return s!=null&&s.live?(this.hls.liveSyncPosition||s.fragmentStart)+this.timelineOffset:e}return n}get bufferingEnabled(){return this.buffering}get backtrackFragment(){}set backtrackFragment(e){}get couldBacktrack(){return!1}set couldBacktrack(e){}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,n){if(n.live||!this.media)return!1;const s=e.end||0,r=this.config.timelineOffset||0;if(s<=r)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=Bt.bufferedInfo(i,e.start,0));const a=e.nextStart;if(a&&a>r&&a<n.edge||this.media.currentTime<e.start)return!1;const l=n.partList;if(l!=null&&l.length){const d=l[l.length-1];return Bt.isBuffered(this.media,d.start+d.duration/2)}const u=n.fragments[n.fragments.length-1];return this.fragmentTracker.isEndListAppended(u.type)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||e}return 0}onMediaAttached(e,n){const s=this.media=this.mediaBuffer=n.media;ns(s,"seeking",this.onMediaSeeking),ns(s,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===Ne.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,n){this.fragPlaying=null;const s=!!n.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Xn(r,"seeking",this.onMediaSeeking),Xn(r,"ended",this.onMediaEnded),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.fragPlaying=this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=0,this.startPosition=-1,this.startFragRequested=!1}onError(e,n){}onManifestLoaded(e,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Ne.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.initFragmentLoader&&this.initFragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.decrypter=this.keyLoader=null,this.fragmentLoader=this.initFragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,n,s){this.startFragRequested=!0,this._loadFragForPlayback(e,n,s)}_loadFragForPlayback(e,n,s){const r=i=>{const a=i.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(a,!1,i.part)} was dropped during download.`),this.fragmentTracker.removeFragment(a);return}const o=++a.stats.chunkCount;this.log(`load progress ${a.type} sn: ${a.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(a,!1,i.part)} chunk: ${o}`),this._handleFragmentLoadProgress(i)};this._doFragLoad(e,n,s,r).then(i=>{if(!i)return;const a=this.state,o=i.frag;if(this.fragContextChanged(o)){(a===Ne.FRAG_LOADING||!this.fragCurrent&&a===Ne.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Ne.IDLE);return}"payload"in i&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level} (bytes ${o.stats.loaded})`),this.hls.trigger(H.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===Ne.STOPPED||this.state===Ne.ERROR||(this.log(`Frag error ${e.type} sn:${e.sn} cc:${e.cc}: ${(i==null?void 0:i.message)||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var n;const{fragmentTracker:s}=this;if(s.getState(e)===ur.APPENDING){const i=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,i),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===ur.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const n=this.fragmentTracker,s=e.fragments[e.fragments.length-1];if(s.endList&&!n.isEndListAppended(this.playlistType)){const r=n.getPartialFragment(s.end);r&&(n.removeFragment(r),n.fragBuffered(s,!0))}n.detectPartialFragments({frag:s,part:null,stats:s.stats,id:s.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const n=e.details;return(n==null?void 0:n.live)&&n.type!=="EVENT"&&(this.levelLastLoaded!==e||n.expired)}flushMainBuffer(e,n,s=null){if(!(e-n))return;const r={startOffset:e,endOffset:n,type:s};this.hls.trigger(H.BUFFER_FLUSHING,r)}_loadInitSegment(e){const{hls:n}=this;return this.initFragmentLoader.abort(),n.trigger(H.FRAG_LOADING,{frag:e,targetBufferTime:0}),this.initFragmentLoader.load(e).then(s=>{var r;const i=s.frag;if(!this.levels||!qD(i,(r=this.fragCurrent)==null?void 0:r.initSegment))throw new Ic({type:_t.NETWORK_ERROR,details:pe.INTERNAL_ABORTED,error:new Error("init load aborted"),fatal:!1,frag:i,networkDetails:null});return s}).then(s=>{const{frag:r,payload:i}=s,a=r.decryptdata;if(i&&i.byteLength>0&&a!=null&&a.key&&a.iv&&fv(a.method)){const o=self.performance.now(),{decryptRange:l}=m5(r,null,this.iframesOnly);return this.decrypter.decrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer,XF(a.method),l).catch(u=>{throw n.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:r}),this.fragmentLoader.abort(),u}).then(u=>{const d=self.performance.now();return n.trigger(H.FRAG_DECRYPTED,{frag:r,part:null,payload:u,stats:{tstart:o,tdecrypt:d}}),s.payload=u,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)})}completeInitSegmentLoad(e){const n=e.frag.stats;e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now()}loadInitSegmentIfNeeded(e){const{initSegment:n}=e;if(!this.bitrateTest&&vr(e)&&n&&!n.data){var s;return(n.encrypted&&!((s=n.decryptdata)!=null&&s.key)?this.keyLoader.load(n).then(()=>this._loadInitSegment(n)):this._loadInitSegment(n)).catch(i=>{throw this.state===Ne.STOPPED||this.state===Ne.ERROR||("data"in i&&(i.data.frag=e,this.fragmentLoader.abort(),this.handleFragLoadError(i)),this.resetFragmentLoading(e)),i})}}unhandledEncryptionError(e,n){var s,r;const i=e.tracks;if(i&&!n.encrypted&&((s=i.audio)!=null&&s.encrypted||(r=i.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(n)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(H.ERROR,{type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:n}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:n}=this;return!e||!qD(e,n)}fragBufferedComplete(e,n){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)} > buffer:${s?y5(Bt.getBuffered(s)):"(detached)"})`),vr(e)){var r;if(e.type!==vt.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=Ne.IDLE;return}}const i=(r=this.levels)==null?void 0:r[e.level];i!=null&&i.fragmentError&&(n||this.fragmentTracker.getState(e)!==ur.PARTIAL)&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0,e.stats.retry=0)}this.state=Ne.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:n}=this;if(!n)return;const s=e.frag,{part:r,partsLoaded:i}=e,a=!i||i.length===0||i.some(u=>!u),{decryptRange:o}=m5(s,r),l=new YF(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a,s.duration,this.iframesOnly,o);this.log(`load complete ${s.type} sn: ${s.sn}${r?" part: "+r.index:""} of ${this.fragInfo(s,!1,r)}`),n.flush(l)}_handleFragmentLoadProgress(e){}loadKeyFor(e,n,s){var r;let i=null;return e.encrypted&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Ne.KEY_LOADING,i=this.keyLoader.load(e,s).then(a=>{if(!this.fragContextChanged(a.frag))return this.hls.trigger(H.KEY_LOADED,a),this.state===Ne.KEY_LOADING&&(this.state=Ne.IDLE),a}),this.hls.trigger(H.KEY_LOADING,{frag:e})):e.encrypted||(i=this.keyLoader.loadClear(e,n.encryptedFragments,this.startFragRequested),i&&this.log(`[eme] blocking frag sn: ${e.sn} load until media-keys acquired`)),i}_doFragLoad(e,n,s=null,r){this.fragCurrent=e;const i=n.details;if(!this.levels||!i)throw new Error(`frag load aborted, missing level${i?"":" detail"}s`);const a=this.fragPrevious;if(!zy(e,a)){const m=this.shouldLoadParts(n.details,e.end);m!==this.loadingParts&&(this.log(`LL-Part loading ${m?"ON":"OFF"} loading sn ${a==null?void 0:a.sn}->${e.sn}`),this.loadingParts=m)}if(s=Math.max(e.start,s||0),this.loadingParts){const m=i.partList;if(m&&r){s>i.fragmentEnd&&i.fragmentHint&&(e=i.fragmentHint);const v=this.getNextPart(m,e,s);if(v>-1){const x=m[v];if(e=this.fragCurrent=x.fragment,!zy(e,a)&&!this.shouldLoadParts(n.details,e.end))return this.log(`LL-Part loading OFF @${this.playhead} next part: ${this.fragInfo(e,!1,x)}`),this.loadingParts=!1,Promise.resolve(null);if(!this.filterReplacedPrimary(x,n.details))return Promise.resolve(null);const y=this.loadKeyFor(e,i);if(this.fragContextChanged(e))return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} part: ${x.index} (${v}/${m.length-1}) of ${this.fragInfo(e,!1,x)} cc: ${e.cc} [${i.startSN}-${i.endSN}], target: ${s}${x.byteRange.length?` range:${x.byteRange.join("-")}`:""}`),this.nextLoadPosition=x.start+x.duration,this.state=Ne.FRAG_LOADING;let S;const _=this.loadInitSegmentIfNeeded(e);if(y||_){const E=!!y;S=Promise.all([y,_]).then(([T])=>E&&(!T||this.fragContextChanged(T.frag))?null:this.doFragPartsLoad(e,x,n,r)).catch(T=>this.handleFragLoadError(T))}else S=this.doFragPartsLoad(e,x,n,r).catch(E=>this.handleFragLoadError(E));return this.hls.trigger(H.FRAG_LOADING,{frag:e,part:x,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):S}else if(!e.url||this.loadedEndOfParts(m,s))return Promise.resolve(null)}}if(this.loadingParts){var o;this.log(`LL-Part loading OFF after next part miss @${s} Check buffer at sn: ${e.sn} loaded parts: ${(o=i.partList)==null?void 0:o.filter(m=>m.loaded).map(m=>`[${m.start}-${m.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);if(!this.filterReplacedPrimary(e,n.details))return Promise.resolve(null);const l=this.loadInitSegmentIfNeeded(e),u=this.loadKeyFor(e,i,l);if(this.fragContextChanged(e)){var d;return this.log(`Context changed in KEY_LOADING sn: ${e.sn} ${e.relurl} > ${(d=this.fragCurrent)==null?void 0:d.relurl}`),l==null||l.catch(()=>null),u==null||u.catch(()=>null),Promise.resolve(null)}this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)} cc: ${e.cc} ${"["+i.startSN+"-"+i.endSN+"]"}, target: ${s}${e.byteRange.length?` range:${e.byteRange.join("-")}`:""}`),at(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ne.FRAG_LOADING;const f=this.config.progressive&&e.type!==vt.SUBTITLE;let p;return f&&u?p=u.then(m=>!m||this.fragContextChanged(m.frag)?null:this.fragmentLoader.load(e,this.iframesOnly,r,l)).catch(m=>this.handleFragLoadError(m)):p=Promise.all([this.fragmentLoader.load(e,this.iframesOnly,f?r:void 0,f?l:void 0),u,l]).then(([m])=>(!f&&r&&r(m),m)).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(H.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):Promise.all([p,l]).then(([m])=>m)}doFragPartsLoad(e,n,s,r){return new Promise((i,a)=>{var o;const l=[],u=(o=s.details)==null?void 0:o.partList,d=f=>{this.fragmentLoader.loadPart(e,f,r).then(p=>{l[f.index]=p;const m=p.part;this.hls.trigger(H.FRAG_LOADED,p);const v=Rte(s.details,e.sn,f.index+1)||sxe(u,e.sn,f.index+1);if(v)d(v);else return i({frag:e,part:m,partsLoaded:l})}).catch(a)};d(n)})}handleFragLoadError(e){if("data"in e){const n=e.data;n.frag&&n.details===pe.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):n.frag&&n.type===_t.KEY_SYSTEM_ERROR&&!n.fatal&&(n.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(n.frag)),this.hls.trigger(H.ERROR,n)}else this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const n=this.getCurrentContext(e);if(!n||this.state!==Ne.PARSING){!this.fragCurrent&&this.state!==Ne.STOPPED&&this.state!==Ne.ERROR&&(this.state=Ne.IDLE);return}const{frag:s,part:r,level:i}=n,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const o=this.getLevelDetails(),u=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${s.end}`),this.loadingParts=u),this.updateLevelTiming(s,r,i,e)}shouldLoadParts(e,n){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList&&!this.iframesOnly){var s;const r=e.partList[0],i=r.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(n>=i&&this.playhead>r.start-r.fragment.duration)return!0}}return!1}getCurrentContext(e){const{levels:n,fragCurrent:s}=this,{level:r,sn:i,part:a}=e;if(!(n!=null&&n[r]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const o=n[r],l=o.details,u=a>-1?Rte(l,i,a):null,d=u?u.fragment:nxe(l,i,s);return d?(s&&s!==d&&(d.stats=s.stats),{frag:d,part:u,level:o}):null}bufferFragmentData(e,n,s,r,i){if(this.state!==Ne.PARSING)return;vr(n)&&!this.fragContextChanged(n)&&(this.fragPrevious=n);const{data1:a,data2:o}=e;let l=a;if(o&&(l=gl(a,o)),!l.length)return;const u=this.initPTS[n.cc],d=u?-u.baseTime/u.timescale:void 0,f={type:e.type,frag:n,part:s,chunkMeta:r,offset:d,parent:n.type,data:l};if(this.hls.trigger(H.BUFFER_APPENDING,f),e.dropped&&e.independent&&!s){if(i)return;this.flushBufferGap(n)}}flushBufferGap(e){const n=this.media;if(!n)return;if(!Bt.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,e.start);return}const s=n.currentTime,r=Bt.bufferInfo(n,s,0),i=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),o=Math.max(Math.min(e.start-a,r.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,n){var s;const r=this.playhead,a=this.lastCurrentTime>r||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,n,a)}getFwdBufferInfoAtPos(e,n,s,r){const i=Bt.bufferInfo(e,n,r);if(i.len===0&&i.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(n,s);if(a&&(i.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(i.nextStart,a.end)-n,r);return Bt.bufferInfo(e,n,o)}}return i}getMaxBufferLength(e){const{config:n}=this;let s;return e?s=Math.max(8*n.maxBufferSize/e,n.maxBufferLength):s=n.maxBufferLength,Math.min(s,n.maxMaxBufferLength)}exceedsMaxBuffer(e,n,s){const r=e.nextStart;if(r&&s.start>r){const i=e.buffered;if(i){let a=e.len;const o=e.bufferedIndex;for(let l=i.length-1;l>o;l--)i[l].start<s.start&&(a+=i[l].end-i[l].start);return a>=n}}return!1}reduceMaxBufferLength(e,n){const s=this.config,r=Math.max(Math.min(e-n,s.maxBufferLength),n/2),i=Math.max(e-n*3,s.maxMaxBufferLength/2,r);return i>=r?(s.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,this.playlistType):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,n){const s=n.fragments,r=s.length;if(!r)return null;const{config:i}=this,a=n.fragmentStart,o=i.lowLatencyMode&&!!n.partList;let l=null;if(n.live){const f=i.initialLiveManifestSize;if(r<f)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${f})`),null;if(!this.startFragRequested&&o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var u;l=this.getInitialLiveFragment(n);const p=this.config.startPosition,m=this.hls.startPosition,v=this.hls.liveSyncPosition,x=((u=l)==null?void 0:u.start)||0;let y,S;if(m!==-1&&m>=a?(y=m,S=m===p?"config":"next load start"):v?(y=v,S="live edge"):(y=e,S="buffer pos"),y<x&&(y=x,S="live frag start"),y<a&&(y=a,S="playlist start"),this.startPosition!=y||this.nextLoadPosition!=y){const E=n.live&&!this.filterReplacedPrimary(l,n)?-1:y;this.log(`Setting startPosition to ${E} next load ${y} ${m===-1?"":`(from ${p}) `}based on ${S}. live edge: ${v} live frag start: ${x} playlist start: ${a} buffer pos: ${e}`),this.startPosition=E,this.nextLoadPosition=y}}}else e<=a&&(l=s[0]);if(!l){const f=this.loadingParts?n.partEnd:n.fragmentEnd;l=this.getFragmentAtPosition(e,f,n)}let d=this.filterReplacedPrimary(l,n);return!d&&l&&(d=z1e(n,l.sn),d&&(this.nextLoadPosition=d.start)),d}isLoopLoading(e,n){if(this.nextLoadPosition<=n)return!1;const s=this.fragmentTracker.getState(e);return!!(s===ur.OK||s===ur.PARTIAL&&(e.gap||e.stats.retry>1))}getNextFragmentLoopLoading(e,n,s,r,i){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,n),a&&!a.gap&&s.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,r,0);if(o!==null&&s.len+o.len>=i){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(b5(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,n){if(!e)return e;if(b5(this.config)&&("type"in e?e:e.fragment).type!==vt.SUBTITLE){const s=this.hls.interstitialsManager,r=s==null?void 0:s.bufferingItem;if(r){const i=r.event;if(i){if(!i.appendInPlace&&(Math.abs(e.start-r.start)>1||r.start===0))return null}else if(e.end<=r.start&&(n==null?void 0:n.live)===!1||e.start>=r.end&&r.nextEvent&&(r.nextEvent.appendInPlace&&!r.nextEvent.hasPlayed||e.start-r.end>1))return null}if(axe(e,s==null?void 0:s.playerQueue,this.playhead))return null}return e}getNextPart(e,n,s){let r=-1,i=!1,a=!0;for(let l=0,u=e.length;l<u;l++){const d=e[l];if(a=a&&!d.independent,r>-1&&s<d.start)break;const f=d.loaded||d.gap;f?r=-1:(i||(d.independent||a)&&d.fragment===n)&&(r=l),i=f&&!d.gap}const o=e[r];return o&&o.fragment!==n&&this.log(`Need buffer at ${s} but next unloaded part starts at ${o.start} (sn: ${n.sn} -> ${o.fragment.sn})`),r}loadedEndOfParts(e,n){let s;for(let r=e.length;r--;){if(s=e[r],!s.loaded)return!1;if(n>s.start)return!0}return!1}getInitialLiveFragment(e){const n=e.fragments,s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(r=got(n,s.endProgramDateTime,this.config.maxFragLookUpTolerance),r&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`)),!r){const i=s.sn+1;if(i>=e.startSN&&i<=e.endSN){const a=n[i-e.startSN];s.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=B1e(e,s.cc,s.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(r=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,n,s){const{config:r}=this;let{fragPrevious:i}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:u}=r,d=s.partList,f=!!(this.loadingParts&&d!=null&&d.length&&l);f&&!this.bitrateTest&&d[d.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn),i&&this.fragmentTracker.getState(i)===ur.NOT_LOADED&&(i=null);let p;if(e<n){var m;const x=e<this.lastCurrentTime||e>n-u||(m=this.media)!=null&&m.paused||!this.startFragRequested?0:u;p=f1(i,a,e,x)}else p=a[a.length-1];if(p){const v=p.sn-s.startSN,x=this.fragmentTracker.getState(p);if((x===ur.OK||x===ur.PARTIAL&&p.gap)&&(i=p),zy(p,i)&&(!f||d[0].fragment.sn>p.sn||!s.live)){const y=a[v+1];p.sn<o&&this.fragmentTracker.getState(y)!==ur.OK?p=y:p=null}}return p}alignPlaylists(e,n,s){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,a=!n,o=e.alignedSliding&&at(i);if(a||!o&&!i){x5(s,e,this);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l} start-sn: ${n?n.startSN:"na"}->${e.startSN} fragments: ${r}`),l}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,n){let s=this.startPosition;s<n&&(s=-1);const r=this.timelineOffset;if(s===-1){const i=this.startTimeOffset!==null,a=i?this.startTimeOffset:e.startTimeOffset;if(a!==null&&at(a))s=n+a,a<0&&(s+=e.edge),s=Math.min(Math.max(n,s),n+e.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${a} found in ${i?"multivariant":"media"} playlist`),this.startPosition=s;else if(e.live){const o=this.hls.liveSyncPosition;s=o||n,this.log(`Setting startPosition to -1 to start at ${o?"live edge":"playlist start"} ${s}`),this.startPosition=-1}else this.log("setting startPosition to 0 by default"),this.startPosition=s=0;this.lastCurrentTime=s+r}this.nextLoadPosition=s+r}getLoadPosition(){var e;const{media:n}=this;let s=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&n&&!this.iframesOnly?s=n.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}get playhead(){var e;if((e=this.hls)!=null&&e.hasEnoughToStart){var n;const s=(n=this.media)==null?void 0:n.currentTime;return at(s)?s:this.lastCurrentTime}return this.getLoadPosition()}get iframesOnly(){var e;if(this.playlistType!==vt.MAIN)return!1;const n=this.getLevelDetails();return n?n.iframesOnly:(e=this.levelLastLoaded)==null?void 0:e.iframes}handleFragLoadAborted(e,n){this.transmuxer&&e.type===this.playlistType&&vr(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Ne.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ne.IDLE)}onFragmentOrKeyLoadError(e,n){if(n.chunkMeta&&!n.frag){const _=this.getCurrentContext(n.chunkMeta);_&&(n.frag=_.frag)}const{frag:s,part:r}=n;if(!s||!this.levels||s.type!==e)return;if(this.fragContextChanged(s)){var i;this.warn(`Frag load error must match current frag to retry ${s.relurl} > ${(i=this.fragCurrent)==null?void 0:i.relurl}`);return}const a=n.details===pe.FRAG_GAP;a&&this.fragmentTracker.addAsGap(s);const o=n.errorAction;if(!o){this.state=Ne.ERROR;return}const{action:l,flags:u,retryCount:d=0,retryConfig:f}=o,p=!!f,m=p&&l===Oi.RetryRequest,v=p&&!o.resolved&&u&pi.MoveAllAlternatesMatchingHost,x=this.hls.latestLevelDetails,y=x==null?void 0:x.live;if(!m&&v&&vr(s)&&y&&s.sn<x.endSN&&!d1e(n))this.resetFragmentErrors(e),r?r.gap=!0:this.treatAsGap(s),o.resolved=!0;else if((m||v)&&d<f.maxNumRetry){var S;const _=E2((S=n.response)==null?void 0:S.code),E=zF(f,d);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+E,this.state=Ne.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,_){this.log("Waiting for connection (offline)"),this.retryDate=1/0,n.reason="offline";return}this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${n.details}, retrying loading ${d+1}/${f.maxNumRetry} in ${E}ms`)}else if(f)if(this.resetFragmentErrors(e),d<f.maxNumRetry)!a&&l!==Oi.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${d})`);return}else l===Oi.SendAlternateToPenaltyBox?this.state=Ne.WAITING_LEVEL:this.state=Ne.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),n=this.retryDate,s=n===1/0;(!n||e>=n||s&&!E2(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Ne.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Ne.PARSING||this.state===Ne.PARSED){const n=e.frag,s=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,s),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len,(n==null?void 0:n.duration)||10);const a=!i;return a?this.warn(`Buffer full error while media.currentTime (${this.playhead}) is not buffered, flush ${s} buffer`):r.nextStart&&n&&r.nextStart>n.start&&this.flushMainBuffer(r.nextStart,Number.POSITIVE_INFINITY,s===vt.AUDIO?s:void 0),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===vt.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ne.STOPPED&&(this.state=Ne.IDLE)}afterBufferFlushed(e,n){if(!e)return;const s=Bt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(n,s,this.playlistType),this.state===Ne.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ne.STOPPED&&(this.state=Ne.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.getLevelDetails();e!=null&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,n,s,r){const i=s.details;if(!i){this.warn("level.details undefined");return}if(this.log(`update level timing ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)}`),!Object.keys(e.elementaryStreams).reduce((f,p)=>{const m=e.elementaryStreams[p];if(m){const v=m.endPTS-m.startPTS;if(v<=0)return this.warn(`Could not parse fragment ${e.sn} ${p} duration reliably (${v})`),f||!1;const x=r.partial?0:J1e(i,e,m.startPTS,m.endPTS,m.startDTS,m.endDTS,this.iframesOnly,this);return this.hls.trigger(H.LEVEL_PTS_UPDATED,{details:i,level:s,drift:x,type:p,frag:e,start:m.startPTS,end:m.endPTS}),!0}return f},!1)){var o,l,u,d;const f=((o=this.transmuxer)==null?void 0:o.error)===null,p=((l=this.transmuxer)==null?void 0:l.error)!=null,m=((u=(d=this.levels)==null?void 0:d.length)!=null?u:0)>1;if((s.fragmentError===0||f&&(s.fragmentError<2||e.endList)||p&&m)&&this.treatAsGap(e,s),f){const v=new Error(`Found no media in ${this.playlistLabel()} ${e.level} ${n?`part: ${n.index} of `:""}sn: ${e.sn} at playlist time: ${e.start}. Resetting transmuxer to fallback to playlist timing`);if(this.warn(v.message),this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,fatal:!1,error:v,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ne.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)}`),this.hls.trigger(H.FRAG_PARSED,{frag:e,part:n,chunkMeta:r})}playlistLabel(){return`${this.playlistType} playlist`}fragInfo(e,n=!0,s){var r,i;return`${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${(r=n&&!s?e.startPTS:(s||e).start)!=null?r:NaN}-${(i=n&&!s?e.endPTS:(s||e).end)!=null?i:NaN}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""})`}treatAsGap(e,n){n&&n.fragmentError++,this.fragmentTracker.addAsGap(e)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}isFragmentNearlyDownloaded(e){var n;const s=(n=e.loader)==null?void 0:n.stats;if(!s)return!1;const r=s.loading.first>0,a=(s.total-s.loaded)/(this.hls.bandwidthEstimate||this.hls.config.abrEwmaDefaultEstimate);return r&&a<=.15}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const n=this._state;n!==e&&(this._state=e,this.log(`${n}->${e}`))}get state(){return this._state}calculateOptimalSwitchPoint(e,n){let s=0;const{hls:r,media:i,config:a,levels:o,playlistType:l}=this,u=this.getLevelDetails();if(i&&!i.paused&&o){var d;const m=l===vt.AUDIO?D1e(e.audioCodec,128e3):e.maxBitrate,v=1+r.ttfbEstimate/1e3,x=r.bandwidthEstimate*a.abrBandWidthUpFactor,y=u&&(this.loadingParts?u.partTarget:u.averagetargetduration)||((d=this.fragCurrent)==null?void 0:d.duration)||6;s=v+m*y/x,e.details||(s+=v)}const f=this.playhead,p=!(u!=null&&u.live)||n.end-f>s*1.5;return{fetchdelay:s,okToFlushForwardBuffer:p}}scheduleTrackSwitch(e,n,s){const{media:r,playlistType:i}=this;if(!r||!e)return;const a=s?this.getBufferedFrag(this.playhead+n):null;if(a){const l=this.followingBufferedFrag(a);if(l){var o;this.abortCurrentFrag();const u=l.maxStartPTS?l.maxStartPTS:l.start,d=l.duration,f=Math.max(a.end,u+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));if((((o=this.getLevelDetails())==null?void 0:o.fragmentStart)||0)>f)return;const m=i===vt.MAIN?null:"audio";this.flushMainBuffer(f,Number.POSITIVE_INFINITY,m),this.cleanupBackBuffer()}}}cleanupBackBuffer(){const{media:e,playlistType:n}=this;if(!e)return;const s=this.getAppendedFrag(this.playhead);if(s&&s.start>1){const r=n===vt.AUDIO;this.flushMainBuffer(0,s.start-(r?0:1),r?"audio":null)}}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,this.playlistType)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Ne.KEY_LOADING:case Ne.FRAG_LOADING:case Ne.FRAG_LOADING_WAITING_RETRY:case Ne.PARSING:case Ne.PARSED:this.state=Ne.IDLE;break}this.nextLoadPosition=this.playhead}checkFragPlaying(){const e=this.media;let n=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(Bt.isBuffered(e,s)?n=this.getAppendedFrag(s):Bt.isBuffered(e,s+.1)&&(n=this.getAppendedFrag(s+.1)),n&&(this.backtrackFragment=void 0,!zy(n,this.fragPlaying)))return this.fragPlaying=n,!0}return!1}getBufferOutput(){return null}nextLevelSwitch(){const{levels:e,media:n,hls:s,config:r,playlistType:i}=this;if(n!=null&&n.readyState&&e&&s&&r){const a=this.getBufferOutput(),o=this.getFwdBufferInfo(a,i);if(!o)return;const l=i===vt.AUDIO?s.nextAudioTrack:s.nextLoadLevel,u=e[l],{fetchdelay:d,okToFlushForwardBuffer:f}=this.calculateOptimalSwitchPoint(u,o);this.scheduleTrackSwitch(o,d,f)}this.tickImmediate()}}function axe(t,e,n){if(e)for(let s=e.length;s--;){const r=e[s].interstitial,i=r.startTime,a=Math.min(i+r.duration,r.resumeTime);if(r.appendInPlace&&(t.start>=i&&t.end<=a||n>t.start&&t.end>i&&t.start<a))return!0}return!1}function b5(t){return!!t.interstitialsController&&t.enableInterstitialPlayback!==!1}class oxe{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:n}=this;let s;if(e.length)e.length===1?s=e[0]:s=elt(e,n);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function elt(t,e){const n=new Uint8Array(e);let s=0;for(let r=0;r<t.length;r++){const i=t[r];n.set(i,s),s+=i.length}return n}var zL={exports:{}},Ite;function tlt(){return Ite||(Ite=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function r(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function i(l,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new r(d,f||l,p),v=n?n+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],m]:l._events[v].push(m):(l._events[v]=m,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,m=f.length,v=new Array(m);p<m;p++)v[p]=f[p].fn;return v},o.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,d,f,p,m,v){var x=n?n+u:u;if(!this._events[x])return!1;var y=this._events[x],S=arguments.length,_,E;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),S){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,f),!0;case 4:return y.fn.call(y.context,d,f,p),!0;case 5:return y.fn.call(y.context,d,f,p,m),!0;case 6:return y.fn.call(y.context,d,f,p,m,v),!0}for(E=1,_=new Array(S-1);E<S;E++)_[E-1]=arguments[E];y.fn.apply(y.context,_)}else{var T=y.length,k;for(E=0;E<T;E++)switch(y[E].once&&this.removeListener(u,y[E].fn,void 0,!0),S){case 1:y[E].fn.call(y[E].context);break;case 2:y[E].fn.call(y[E].context,d);break;case 3:y[E].fn.call(y[E].context,d,f);break;case 4:y[E].fn.call(y[E].context,d,f,p);break;default:if(!_)for(k=1,_=new Array(S-1);k<S;k++)_[k-1]=arguments[k];y[E].fn.apply(y[E].context,_)}}return!0},o.prototype.on=function(u,d,f){return i(this,u,d,f,!1)},o.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},o.prototype.removeListener=function(u,d,f,p){var m=n?n+u:u;if(!this._events[m])return this;if(!d)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===d&&(!p||v.once)&&(!f||v.context===f)&&a(this,m);else{for(var x=0,y=[],S=v.length;x<S;x++)(v[x].fn!==d||p&&!v[x].once||f&&v[x].context!==f)&&y.push(v[x]);y.length?this._events[m]=y.length===1?y[0]:y:a(this,m)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o})(zL)),zL.exports}var nlt=tlt(),eU=Wit(nlt);const I2="1.7.1",h1={};function slt(){return typeof __HLS_WORKER_BUNDLE__=="function"}function rlt(){const t=h1[I2];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(e),r={worker:new self.Worker(n),objectURL:n,clientCount:1};return h1[I2]=r,r}function ilt(t){const e=h1[t];if(e)return e.clientCount++,e;const n=new self.URL(t,self.location.href).href,r={worker:new self.Worker(n),scriptURL:n,clientCount:1};return h1[t]=r,r}function alt(t){const e=h1[t||I2];if(e&&e.clientCount--===1){const{worker:s,objectURL:r}=e;delete h1[t||I2],r&&self.URL.revokeObjectURL(r),s.terminate()}}function olt(t,e,n,s){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[n+2],a=i>>2&15;if(a>12){const y=new Error(`invalid ADTS sampling index:${a}`);t.emit(H.ERROR,H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,fatal:!0,error:y,reason:y.message});return}const o=(i>>6&3)+1,l=e[n+3]>>6&3|(i&1)<<2,u=r[a];let d=a;(o===5||o===29)&&(d-=3);let f;const p=(d&14)>>1,m=(d&1)<<7|l<<3;let v=0;if(o===1&&a>=6){v=5;const y=a-3;f=[v<<3|p,m|(y&14)>>1,(y&1)<<7|8,0]}else f=[o<<3|p,m];const x="mp4a.40."+(v||o);return Gn.log(`manifest codec:${s}, parsed codec:${x}, channels:${l}, rate:${u} (ADTS object type:${o} sampling index:${a} esds config:[${f.join(",")}])`),{config:f,samplerate:u,channelCount:l,codec:x,parsedCodec:x,manifestCodec:s}}function lxe(t,e){return t[e]===255&&(t[e+1]&246)===240}function cxe(t,e){return t[e+1]&1?7:9}function tU(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}function llt(t,e){return e+5<t.length}function S5(t,e){return e+1<t.length&&lxe(t,e)}function clt(t,e){return llt(t,e)&&lxe(t,e)&&tU(t,e)<=t.length-e}function ult(t,e){if(S5(t,e)){const n=cxe(t,e);if(e+n>=t.length)return!1;const s=tU(t,e);if(s<=n)return!1;const r=e+s;return r===t.length||S5(t,r)}return!1}function uxe(t,e,n,s,r){if(!t.samplerate){const i=olt(e,n,s,r);if(!i)return;ms(t,i)}}function dxe(t){return 1024*9e4/t}function dlt(t,e){const n=cxe(t,e);if(e+n<=t.length){const s=tU(t,e)-n;if(s>0)return{headerLength:n,frameLength:s}}}function fxe(t,e,n,s,r){const i=dxe(t.samplerate),a=s+r*i,o=dlt(e,n);let l;if(o){const{frameLength:f,headerLength:p}=o,m=p+f,v=Math.max(0,n+m-e.length);v?(l=new Uint8Array(m-p),l.set(e.subarray(n+p,e.length),0)):l=e.subarray(n+p,n+m);const x={unit:l,pts:a};return v||t.samples.push(x),{sample:x,length:m,missing:v}}const u=e.length-n;return l=new Uint8Array(u),l.set(e.subarray(n,e.length),0),{sample:{unit:l,pts:a},length:u,missing:-1}}let ba=(function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t})({});function $c(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class nU{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,n,s,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,n){return!1}appendFrame(e,n,s){}demux(e,n){this.cachedData&&(e=gl(this.cachedData,e),this.cachedData=null);let s=C2(e,0),r=s?s.length:0,i;const a=this._audioTrack,o=this._id3Track,l=s?HF(s):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&at(l))&&(this.basePTS=flt(l,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ba.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){const d=this.appendFrame(a,e,r);d?(this.frameIndex++,this.lastPTS=d.sample.pts,r+=d.length,i=r):r=u}else dat(e,r)?(s=C2(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ba.audioId3,duration:Number.POSITIVE_INFINITY}),r+=s.length,i=r):r++;if(r===u&&i!==u){const d=e.slice(i);this.cachedData?this.cachedData=gl(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:$c(),id3Track:o,textTrack:$c()}}demuxSampleAes(e,n,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:$c(),id3Track:this._id3Track,textTrack:$c()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const flt=(t,e,n)=>{if(at(t))return t*90;const s=n?n.baseTime*9e4/n.timescale:0;return e*9e4+s},hlt=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],plt=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mlt=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],glt=[0,1,1,4];function hxe(t,e,n,s,r){if(n+24>e.length)return;const i=pxe(e,n);if(i&&n+i.frameLength<=e.length){const a=i.samplesPerFrame*9e4/i.sampleRate,o=s+r*a,l={unit:e.subarray(n,n+i.frameLength),pts:o,dts:o};return t.config=[],t.channelCount=i.channelCount,t.samplerate=i.sampleRate,t.samples.push(l),{sample:l,length:i.frameLength,missing:0}}}function pxe(t,e){const n=t[e+1]>>3&3,s=t[e+1]>>1&3,r=t[e+2]>>4&15,i=t[e+2]>>2&3;if(n!==1&&r!==0&&r!==15&&i!==3){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=n===3?3-s:s===3?3:4,u=hlt[l*14+r-1]*1e3,f=plt[(n===3?0:n===2?1:2)*3+i],p=o===3?1:2,m=mlt[n][s],v=glt[s],x=m*8*v,y=Math.floor(m*u/f+a)*v,S=Eb();return!!S&&S<=87&&s===2&&u>=224e3&&o===0&&(t[e+3]=t[e+3]|128),{sampleRate:f,channelCount:p,frameLength:y,samplesPerFrame:x}}}function sU(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}function mxe(t,e){return e+1<t.length&&sU(t,e)}function vlt(t,e){return sU(t,e)&&4<=t.length-e}function gxe(t,e){if(e+1<t.length&&sU(t,e)){const s=pxe(t,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const i=e+r;return i===t.length||mxe(t,i)}return!1}class vxe{constructor(e,n,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new KF(n,!0)}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Bh.cbc,{start:0,end:e.byteLength})}decryptAacSample(e,n,s){const r=e[n].unit;if(r.length<=16)return;const i=r.subarray(16,r.length-r.length%16),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,n+1,s)}).catch(s)}decryptAacSamples(e,n,s){for(;;n++){if(n>=e.length){s();return}if(!(e[n].unit.length<32)&&(this.decryptAacSample(e,n,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const n=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(n);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)s.set(e.subarray(i,i+16),r);return s}getAvcDecryptedUnit(e,n){const s=new Uint8Array(n);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)e.set(s.subarray(r,r+16),i);return e}decryptAvcSample(e,n,s,r,i){const a=A1e(i.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{i.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,n,s+1,r)}).catch(r)}decryptAvcSamples(e,n,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,s=0){if(n>=e.length){r();return}const i=e[n].units;for(;!(s>=i.length);s++){const a=i[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,n,s,r,a),!this.decrypter.isSync()))return}}}}class xlt extends nU{constructor(e,n){super(),this.observer=void 0,this.config=void 0,this.sampleAes=null,this.observer=e,this.config=n}resetInitSegment(e,n,s,r){super.resetInitSegment(e,n,s,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,n){if(!e)return!1;const s=C2(e,0);let r=(s==null?void 0:s.length)||0;if(gxe(e,r))return!1;for(let i=e.length;r<i;r++)if(ult(e,r))return n.log("ADTS sync word found !"),!0;return!1}canParse(e,n){return clt(e,n)}appendFrame(e,n,s){uxe(e,this.observer,n,s,e.manifestCodec);const r=fxe(e,n,s,this.basePTS,this.frameIndex);if((r==null?void 0:r.missing)===0)return r}demuxSampleAes(e,n,s){const r=this.demux(e,s),i=this.sampleAes=new vxe(this.observer,this.config,n);return new Promise(a=>{i.decryptAacSamples(r.audioTrack.samples,0,()=>{a(r)})})}}const xxe=(t,e)=>{let n=0,s=5;e+=s;const r=new Uint32Array(1),i=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=t[e];const o=Math.min(s,8),l=8-o;i[0]=4278190080>>>24+l<<l,r[0]=(a[0]&i[0])>>l,n=n?n<<o|r[0]:r[0],e+=1,s-=o}return n};class ylt extends nU{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,n,s,r){super.resetInitSegment(e,n,s,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,n){return n+64<e.length}appendFrame(e,n,s){const r=yxe(e,n,s,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const n=C2(e,0);if(!n)return!1;const s=n.length;if(e[s]===11&&e[s+1]===119&&HF(n)!==void 0){if(xxe(e,s)<16)return!0;throw new Error("Containerless ec-3 is not supported")}return!1}}function yxe(t,e,n,s,r){if(n+8>e.length||e[n]!==11||e[n+1]!==119)return-1;const i=e[n+4]>>6;if(i>=3)return-1;const o=[48e3,44100,32e3][i],l=e[n+4]&63,d=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+i]*2;if(n+d>e.length)return-1;const f=e[n+6]>>5;let p=0;f===2?p+=2:(f&1&&f!==1&&(p+=2),f&4&&(p+=2));const m=(e[n+6]<<8|e[n+7])>>12-p&1,x=[2,1,2,3,3,4,4,5][f]+m,y=e[n+5]>>3,S=e[n+5]&7,_=new Uint8Array([i<<6|y<<1|S>>2,(S&3)<<6|f<<3|m<<2|l>>4,l<<4&224]),E=1536/o*9e4,T=s+r*E,k=e.subarray(n,n+d);return t.config=_,t.channelCount=x,t.samplerate=o,t.samples.push({unit:k,pts:T}),d}class blt extends nU{resetInitSegment(e,n,s,r){super.resetInitSegment(e,n,s,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const n=C2(e,0);let s=(n==null?void 0:n.length)||0;if(n&&e[s]===11&&e[s+1]===119&&HF(n)!==void 0&&xxe(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(gxe(e,s))return Gn.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,n){return vlt(e,n)}appendFrame(e,n,s){if(this.basePTS!==null)return hxe(e,n,s,this.basePTS,this.frameIndex)}}const Slt=/\/emsg[-/]ID3/i;class wlt{constructor(e,n,s,r=Gn){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.initData=void 0,this.logger=void 0,this.config=n,this.logger=r}resetTimeStamp(){}resetInitSegment(e,n,s,r){const i=this.videoTrack=$c("video",1),a=this.audioTrack=$c("audio",1),o=this.txtTrack=$c("text",1);if(this.id3Track=$c("id3",1),this.initData=void 0,this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=this.initData=E1e(e);if(l.video){const{id:u,timescale:d,codec:f,supplemental:p}=l.video;i.id=u,i.timescale=o.timescale=d,i.codec=f,i.supplemental=p}if(l.audio){const{id:u,timescale:d,codec:f}=l.audio;a.id=u,a.timescale=d,a.codec=f}o.id=b1e.text,i.sampleDuration=0,i.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return Tat(e,"moof")}demux(e,n,s){this.timeOffset=n;let r=e;const i=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=gl(this.remainderData,e));const u=Dat(r);this.remainderData=u.remainder,i.samples=u.valid||new Uint8Array}else i.samples=r;const o=this.extractID3Track(i,n),l=this.parseFragment(i,a,n,s);return{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack,initData:this.initData,sampleData:l}}flush(e,n){const s=this.timeOffset,r=this.videoTrack,i=this.txtTrack;r.samples=this.remainderData||new Uint8Array,this.remainderData=null;const a=this.extractID3Track(r,this.timeOffset),o=this.parseFragment(r,i,s,n);return{videoTrack:r,audioTrack:$c(),id3Track:a,textTrack:$c(),initData:this.initData,sampleData:o}}parseFragment(e,n,s,r){const i=this.initData;if(i&&r){const{samples:a,sampleData:o}=Mat(s,e,i,this.logger,r.iframe);return n.samples=a,o}n.samples=Oat(s,e)}extractID3Track(e,n){const s=this.id3Track;if(e.samples.length){const r=Yt(e.samples,["emsg"]);r&&r.forEach(i=>{const a=$at(i);if(Slt.test(a.schemeIdUri)){const o=Lte(a,n);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const u=a.payload;s.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:ba.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata){const o=this.config.emsgKLVSchemaUri||ba.misbklv;if(a.schemeIdUri.startsWith(o)){const l=Lte(a,n);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:l,pts:l,type:ba.misbklv,duration:Number.POSITIVE_INFINITY})}}})}return s}demuxSampleAes(e,n,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0,this.initData=void 0}}function Lte(t,e){return at(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}const _lt=1,Elt=2,my=-1;class bxe{constructor(){this.VideoSample=null}createVideoSample(e,n,s){return{key:e,frame:!1,pts:n,dts:s,units:[],length:0}}getLastNalUnit(e){var n;let s=this.VideoSample,r;if((!s||s.units.length===0)&&(s=e[e.length-1]),(n=s)!=null&&n.units){const i=s.units;r=i[i.length-1]}return r}pushAccessUnit(e,n){if(e.units.length&&e.frame){if(e.pts===void 0){const s=n.samples,r=s.length;if(r){const i=s[r-1];e.pts=i.pts,e.dts=i.dts}else{n.dropped++;return}}n.samples.push(e)}}parseNALu(e,n,s){const r=n.byteLength;if(r===0)return[];const i=e.naluState||0,a=i===my?0:i,o=[];let l=0,u=0,d=-1,f=0;for(i===my&&(d=0,f=this.getNALuType(n,0),u=1);u<r;){const p=n.indexOf(_lt,u);if(p===-1)break;u=p+1;let m=p;for(;m>0&&n[m-1]===0;)m--;if(!(p-m+(m===0?a:0)<Elt)){if(d>=0)o.push({data:n.subarray(d,m),type:f});else{const x=this.getLastNalUnit(e.samples);x&&(m>0?x.data=gl(x.data,n.subarray(0,m)):a>0&&(x.data=x.data.subarray(0,x.data.byteLength-a)),x.state=0)}if(u<r)d=u,f=this.getNALuType(n,u);else{l=my,d=-1;break}}}if(l!==my){let p=r;for(;p>0&&n[p-1]===0;)p--;l=r-p+(p===0?a:0)}if(d>=0)o.push({data:n.subarray(d),type:f,state:l});else if(o.length===0&&l!==my){const p=this.getLastNalUnit(e.samples);p&&(p.data=gl(p.data,n),p.state=l)}return e.naluState=l,o}}class kb{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,n=this.bytesAvailable,s=e.byteLength-n,r=new Uint8Array(4),i=Math.min(4,n);if(i===0)throw new Error("no bytes available");r.set(e.subarray(s,s+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let n;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,n=e>>3,e-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let n=Math.min(this.bitsAvailable,e);const s=this.word>>>32-n;if(e>32&&Gn.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=e-n,n>0&&this.bitsAvailable?s<<n|this.readBits(n):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}}class Clt extends bxe{parsePES(e,n,s,r,i){const a=i.iframe,o=this.parseNALu(e,s.data,r);let l=this.VideoSample,u,d=!1;s.data=null,l&&o.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),o.forEach(f=>{var p,m;switch(f.type){case 1:{if(a)break;let S=!1;u=!0;const _=f.data;if(d&&_.length>4){const E=this.readSliceType(_);(E===2||E===4||E===7||E===9)&&(S=!0)}if(S){var v;(v=l)!=null&&v.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null)}l||(l=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),l.frame=!0,l.key=S;break}case 5:u=!0,(p=l)!=null&&p.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),l.key=!0,l.frame=!0;break;case 6:{if(a)break;u=!0,T2(f.data,1,s.pts,n.samples);break}case 7:{var x,y;u=!0,d=!0;const S=f.data,_=this.readSPS(S);if(!e.sps||e.width!==_.width||e.height!==_.height||((x=e.pixelRatio)==null?void 0:x[0])!==_.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==_.pixelRatio[1]){e.width=_.width,e.height=_.height,e.pixelRatio=_.pixelRatio,e.sps=[S];const E=S.subarray(1,4);let T="avc1.";for(let k=0;k<3;k++){let R=E[k].toString(16);R.length<2&&(R="0"+R),T+=R}e.codec=T}break}case 8:u=!0,e.pps=[f.data];break;case 9:u=!0,e.audFound=!0,(m=l)!=null&&m.frame&&(this.pushAccessUnit(l,e),l=null),l||(l=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:u=!0;break;default:u=!1;break}l&&u&&l.units.push(f)}),r&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}getNALuType(e,n){return e[n]&31}readSliceType(e){const n=new kb(e);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(e,n){let s=8,r=8,i;for(let a=0;a<e;a++)r!==0&&(i=n.readEG(),r=(s+i+256)%256),s=r===0?s:r}readSPS(e){const n=new kb(e);let s=0,r=0,i=0,a=0,o,l,u;const d=n.readUByte.bind(n),f=n.readBits.bind(n),p=n.readUEG.bind(n),m=n.readBoolean.bind(n),v=n.skipBits.bind(n),x=n.skipEG.bind(n),y=n.skipUEG.bind(n),S=this.skipScalingList.bind(this);d();const _=d();if(f(5),v(3),d(),y(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){const A=p();if(A===3&&v(1),y(),y(),v(1),m())for(l=A!==3?8:12,u=0;u<l;u++)m()&&(u<6?S(16,n):S(64,n))}y();const E=p();if(E===0)p();else if(E===1)for(v(1),x(),x(),o=p(),u=0;u<o;u++)x();y(),v(1);const T=p(),k=p(),R=f(1);R===0&&v(1),v(1),m()&&(s=p(),r=p(),i=p(),a=p());let I=[1,1];if(m()&&m())switch(d()){case 1:I=[1,1];break;case 2:I=[12,11];break;case 3:I=[10,11];break;case 4:I=[16,11];break;case 5:I=[40,33];break;case 6:I=[24,11];break;case 7:I=[20,11];break;case 8:I=[32,11];break;case 9:I=[80,33];break;case 10:I=[18,11];break;case 11:I=[15,11];break;case 12:I=[64,33];break;case 13:I=[160,99];break;case 14:I=[4,3];break;case 15:I=[3,2];break;case 16:I=[2,1];break;case 255:{I=[d()<<8|d(),d()<<8|d()];break}}return{width:Math.ceil((T+1)*16-s*2-r*2),height:(2-R)*(k+1)*16-(R?2:4)*(i+a),pixelRatio:I}}}class Tlt extends bxe{constructor(...e){super(...e),this.initVPS=null}parsePES(e,n,s,r){const i=this.parseNALu(e,s.data,r);let a=this.VideoSample,o,l=!1;s.data=null;const u=d=>(a=this.VideoSample=this.createVideoSample(d,s.pts,s.dts),a);i.forEach((d,f)=>{var p,m;if(this.startsNewAccessUnit(a,e,d,f)){this.pushAccessUnit(a,e);const x=d.type>=16&&d.type<=23;a=u(x),l=!1}switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=u(!1)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:case 22:case 23:if(o=!0,l){var v;(v=a)!=null&&v.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=u(!0)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(p=a)!=null&&p.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=u(!0)),a.key=!0,a.frame=!0;break;case 39:o=!0,T2(d.data,2,s.pts,n.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ms(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const x=this.readSPS(d.data);e.width=x.width,e.height=x.height,e.pixelRatio=x.pixelRatio,e.codec=x.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const y in x.params)e.params[y]=x.params[y]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=u(!1));break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const x=this.readPPS(d.data);for(const y in x)e.params[y]=x[y]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(m=a)!=null&&m.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=u(!1));break;default:o=!1;break}a&&o&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,n,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(n)}startsNewAccessUnit(e,n,s,r){if(!e)return!1;if(!n.audFound&&r===0)return!0;if(!e.frame)return!1;const{type:i,data:a}=s;return i>=32&&i<=35||i===39||i>=41&&i<=44||i>=48&&i<=55?!0:i<=31&&a.length>2&&(a[2]&128)!==0}getNALuType(e,n){return(e[n]&126)>>>1}ebsp2rbsp(e){const n=new Uint8Array(e.byteLength);let s=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(n[s]=e[r],s++);return new Uint8Array(n.buffer,0,s)}pushAccessUnit(e,n){super.pushAccessUnit(e,n),this.initVPS&&(this.initVPS=null)}readVPS(e){const n=new kb(e);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const s=n.readBits(3),r=n.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:r}}readSPS(e){const n=new kb(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.readBits(4);const s=n.readBits(3);n.readBoolean();const r=n.readBits(2),i=n.readBoolean(),a=n.readBits(5),o=n.readUByte(),l=n.readUByte(),u=n.readUByte(),d=n.readUByte(),f=n.readUByte(),p=n.readUByte(),m=n.readUByte(),v=n.readUByte(),x=n.readUByte(),y=n.readUByte(),S=n.readUByte(),_=[],E=[];for(let he=0;he<s;he++)_.push(n.readBoolean()),E.push(n.readBoolean());if(s>0)for(let he=s;he<8;he++)n.readBits(2);for(let he=0;he<s;he++)_[he]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),E[he]&&n.readUByte();n.readUEG();const T=n.readUEG();T==3&&n.skipBits(1);const k=n.readUEG(),R=n.readUEG(),I=n.readBoolean();let A=0,L=0,j=0,F=0;I&&(A+=n.readUEG(),L+=n.readUEG(),j+=n.readUEG(),F+=n.readUEG());const O=n.readUEG(),M=n.readUEG(),U=n.readUEG(),G=n.readBoolean();for(let he=G?0:s;he<=s;he++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let De=0;De<4;De++)for(let Ge=0;Ge<(De===3?2:6);Ge++)if(!n.readBoolean())n.readUEG();else{const Le=Math.min(64,1<<4+(De<<1));De>1&&n.readEG();for(let qe=0;qe<Le;qe++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const B=n.readUEG();let q=0;for(let he=0;he<B;he++){let De=!1;if(he!==0&&(De=n.readBoolean()),De){he===B&&n.readUEG(),n.readBoolean(),n.readUEG();let Ge=0;for(let Je=0;Je<=q;Je++){const Le=n.readBoolean();let qe=!1;Le||(qe=n.readBoolean()),(Le||qe)&&Ge++}q=Ge}else{const Ge=n.readUEG(),Je=n.readUEG();q=Ge+Je;for(let Le=0;Le<Ge;Le++)n.readUEG(),n.readBoolean();for(let Le=0;Le<Je;Le++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const he=n.readUEG();for(let De=0;De<he;De++){for(let Ge=0;Ge<U+4;Ge++)n.readBits(1);n.readBits(1)}}let D=0,K=1,Y=1,J=!0,ne=1,Q=0;n.readBoolean(),n.readBoolean();let ee=!1;if(n.readBoolean()){if(n.readBoolean()){const et=n.readUByte(),Ct=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Ke=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];et>0&&et<16?(K=Ct[et-1],Y=Ke[et-1]):et===255&&(K=n.readBits(16),Y=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),ee=n.readBoolean(),ee&&(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG()),n.readBoolean()&&(ne=n.readBits(32),Q=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Ke=n.readBoolean(),dt=n.readBoolean();let Xt=!1;(Ke||dt)&&(Xt=n.readBoolean(),Xt&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Xt&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let _n=0;_n<=s;_n++){J=n.readBoolean();const Dt=J||n.readBoolean();let nn=!1;Dt?n.readEG():nn=n.readBoolean();const fn=nn?1:n.readUEG()+1;if(Ke)for(let Tt=0;Tt<fn;Tt++)n.readUEG(),n.readUEG(),Xt&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(dt)for(let Tt=0;Tt<fn;Tt++)n.readUEG(),n.readUEG(),Xt&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),D=n.readUEG())}let ue=k,ye=R;if(I){let he=1,De=1;T===1?he=De=2:T==2&&(he=2),ue=k-he*L-he*A,ye=R-De*F-De*j}const je=r?["A","B","C"][r]:"",Re=o<<24|l<<16|u<<8|d;let me=0;for(let he=0;he<32;he++)me=(me|(Re>>he&1)<<31-he)>>>0;let Ce=me.toString(16);return a===1&&Ce==="2"&&(Ce="6"),{codecString:`hvc1.${je}${a}.${Ce}.${i?"H":"L"}${S}.B0`,params:{general_tier_flag:i,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[o,l,u,d],general_constraint_indicator_flags:[f,p,m,v,x,y],general_level_idc:S,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:M,min_spatial_segmentation_idc:D,chroma_format_idc:T,frame_rate:{fixed:J,fps:Q/ne}},width:ue,height:ye,pixelRatio:[K,Y]}}readPPS(e){const n=new kb(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const r=n.readBoolean(),i=n.readBoolean();let a=1;return i&&r?a=0:i?a=3:r&&(a=2),{parallelismType:a}}matchSPS(e,n){return ic(e).substring(3)===ic(n).substring(3)}}const Kr=188;class nd{constructor(e,n,s,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this._klvPid=-1,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.videoIntegrityChecker=null,this.observer=e,this.config=n,this.typeSupported=s,this.logger=r,this.videoParser=null}static probe(e,n){const s=nd.syncOffset(e);return s>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const n=e.length;let s=Math.min(Kr*5,n-Kr)+1,r=0;for(;r<s;){let i=!1,a=-1,o=0;for(let l=r;l<n;l+=Kr)if(e[l]===71&&(n-l===Kr||e[l+Kr]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+Kr*99,e.length-Kr)+1)),i||(i=w5(e,l)===0),i&&o>1&&(a===0&&o>2||l+Kr>s))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,n){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:b1e[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?n:void 0}}resetInitSegment(e,n,s,r,i,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=nd.createTrack("video"),this._videoTrack.duration=r,this.videoIntegrityChecker=this.config.handleMpegTsVideoIntegrityErrors==="skip"?new Alt(this.logger):null,this._audioTrack=nd.createTrack("audio",r),this._id3Track=nd.createTrack("id3"),this._txtTrack=nd.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=s,e&&this.demux(e,0,a,(i==null?void 0:i.method)==="SAMPLE-AES")}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:n,_id3Track:s}=this;e&&(e.pesData=null),n&&(n.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,n,s,r=!1,i=!1){r||(this.sampleAes=null);let a;const o=this._videoTrack,l=this.videoIntegrityChecker,u=this._audioTrack,d=this._id3Track,f=this._txtTrack,p=s.iframe;let m=o.pid,v=o.pesData,x=u.pid,y=d.pid,S=this._klvPid,_=u.pesData,E=d.pesData,T=null,k=null,R=this.pmtParsed,I=this._pmtId,A=e.length;if(this.remainderData&&(e=gl(this.remainderData,e),A=e.length,this.remainderData=null),A<Kr&&!i)return this.remainderData=e,{audioTrack:u,videoTrack:o,id3Track:d,textTrack:f};const L=Math.max(0,nd.syncOffset(e));A-=(A-L)%Kr,A<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,A,e.buffer.byteLength-A));let j=0;for(let O=L;O<A;O+=Kr)if(e[O]===71){const M=!!(e[O+1]&64),U=w5(e,O),G=(e[O+3]&48)>>4;let $;if(G>1){if($=O+5+e[O+4],$===O+Kr)continue}else $=O+4;switch(U){case m:M&&(v&&!(l!=null&&l.isCorrupted)&&(a=_p(v,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,f,a,!1,s)),v={data:[],size:0},l==null||l.reset(m)),l==null||l.handlePacket(e.subarray(O)),v&&(v.data.push(e.subarray($,O+Kr)),v.size+=O+Kr-$);break;case x:if(p)break;if(M){if(_&&(a=_p(_,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,a,s);break;case"mp3":this.parseMPEGPES(u,a);break;case"ac3":this.parseAC3PES(u,a);break}_={data:[],size:0}}_&&(_.data.push(e.subarray($,O+Kr)),_.size+=O+Kr-$);break;case y:if(p)break;M&&(E&&(a=_p(E,this.logger))&&this.parseID3PES(d,a),E={data:[],size:0}),E&&(E.data.push(e.subarray($,O+Kr)),E.size+=O+Kr-$);break;case S:if(p)break;M&&(T&&(a=_p(T,this.logger))&&this.parseKlvPES(d,a),T={data:[],size:0}),T&&(T.data.push(e.subarray($,O+Kr)),T.size+=O+Kr-$);break;case 0:M&&($+=e[$]+1),I=this._pmtId=klt(e,$);break;case I:{M&&($+=e[$]+1);const V=Rlt(e,$,this.typeSupported,r,this.observer,this.logger,this.config,s);m=V.videoPid,m>0&&(o.pid=m,o.segmentCodec=V.segmentVideoCodec),x=V.audioPid,x>0&&(u.pid=x,u.segmentCodec=V.segmentAudioCodec),y=V.id3Pid,y>0&&(d.pid=y),S=V.klvPid,S>0&&(this._klvPid=S),k!==null&&!R&&(this.logger.warn(`MPEG-TS PMT found at ${O} after unknown PID '${k}'. Backtracking to sync byte @${L} to parse all TS packets.`),k=null,O=L-188),R=this.pmtParsed=!0;break}case 17:case 8191:break;default:k=U;break}}else j++;j>0&&n9(this.observer,new Error(`Found ${j} TS packet/s that do not start with 0x47`),s,void 0,this.logger),o.pesData=v,u.pesData=_,d.pesData=E;const F={audioTrack:u,videoTrack:o,id3Track:d,textTrack:f};return i&&this.extractRemainingSamples(F,s),F}flush(e,n){const{remainderData:s}=this;this.remainderData=null;let r;return s?r=this.demux(s,0,n,!1,!0):r={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(r,n),this.sampleAes?this.decrypt(r,this.sampleAes):r}extractRemainingSamples(e,n){const{audioTrack:s,videoTrack:r,id3Track:i,textTrack:a}=e,o=r.pesData,l=s.pesData,u=i.pesData,d=this.videoIntegrityChecker;let f;if(o&&!(d!=null&&d.isCorrupted)&&(f=_p(o,this.logger))?(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(r,a,f,!0,n),r.pesData=null)):r.pesData=o,l&&(f=_p(l,this.logger))){switch(s.segmentCodec){case"aac":this.parseAACPES(s,f,n);break;case"mp3":this.parseMPEGPES(s,f);break;case"ac3":this.parseAC3PES(s,f);break}s.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),s.pesData=l;u&&(f=_p(u,this.logger))?(this.parseID3PES(i,f),i.pesData=null):i.pesData=u}demuxSampleAes(e,n,s,r){const i=this.demux(e,s,r,!0,!this.config.progressive),a=this.sampleAes=new vxe(this.observer,this.config,n);return this.decrypt(i,a)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Clt:e==="hevc"&&(this.videoParser=new Tlt))}decrypt(e,n){return new Promise(s=>{const{audioTrack:r,videoTrack:i}=e;r.samples&&r.segmentCodec==="aac"?n.decryptAacSamples(r.samples,0,()=>{i.samples?n.decryptAvcSamples(i.samples,0,0,()=>{s(e)}):s(e)}):i.samples&&n.decryptAvcSamples(i.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0,this.videoIntegrityChecker=null}parseAACPES(e,n,s){let r=0;const i=this.aacOverFlow;let a=n.data;if(i){this.aacOverFlow=null;const p=i.missing,m=i.sample.unit.byteLength;if(p===-1)a=gl(i.sample.unit,a);else{const v=m-p;i.sample.unit.set(a.subarray(0,p),v),e.samples.push(i.sample),r=i.missing}}let o,l;for(o=r,l=a.length;o<l-1&&!S5(a,o);o++);if(o!==r){let p;const m=o<l-1;if(m?p=`AAC PES did not start with ADTS header,offset:${o}`:p="No ADTS header found in AAC PES",n9(this.observer,new Error(p),s,m,this.logger),!m)return}uxe(e,this.observer,a,o,this.audioCodec);let u;if(n.pts!==void 0)u=n.pts;else if(i){const p=dxe(e.samplerate);u=i.sample.pts+p}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,f;for(;o<l;)if(f=fxe(e,a,o,u,d),o+=f.length,f.missing){this.aacOverFlow=f;break}else for(d++;o<l-1&&!S5(a,o);o++);}parseMPEGPES(e,n){const s=n.data,r=s.length;let i=0,a=0;const o=n.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(mxe(s,a)){const l=hxe(e,s,a,o,i);if(l)a+=l.length,i++;else break}else a++}parseAC3PES(e,n){{const s=n.data,r=n.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=s.length;let a=0,o=0,l;for(;o<i&&(l=yxe(e,s,o,r,a++))>0;)o+=l}}parseID3PES(e,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=ms({},n,{type:this._videoTrack?ba.emsg:ba.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}parseKlvPES(e,n){var s;const r=(s=n.pts)!=null?s:n.dts;if(r===void 0){this.logger.warn("[tsdemuxer]: KLV PES unknown PTS and DTS");return}const i=n.data;if(i.length<16){this.logger.warn("[tsdemuxer]: KLV PES payload too short");return}let a=0;for(;a<i.length;){var o;if(a+16>i.length)break;const l=a;if(a+=16,a>=i.length)break;const u=i[a];a+=1;let d=0;if(u&128){const v=u&127;if(v===0||v>4||a+v>i.length){this.logger.warn("[tsdemuxer]: Invalid KLV length encoding");break}for(let x=0;x<v;x++)d=d<<8|i[a+x];a+=v}else d=u;if(a+d>i.length){this.logger.warn("[tsdemuxer]: KLV value extends beyond PES payload");break}const f=a+d,p=i.subarray(l,f),m={data:p,len:p.byteLength,pts:r,dts:(o=n.dts)!=null?o:r,type:ba.misbklv,duration:Number.POSITIVE_INFINITY};e.samples.push(m),a=f}}}function w5(t,e){return((t[e+1]&31)<<8)+t[e+2]}function klt(t,e){return(t[e+10]&31)<<8|t[e+11]}function Rlt(t,e,n,s,r,i,a,o){const l={audioPid:-1,videoPid:-1,id3Pid:-1,klvPid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(t[e+1]&15)<<8|t[e+2],d=e+3+u-4,f=(t[e+10]&15)<<8|t[e+11];for(e+=12+f;e<d;){const p=w5(t,e),m=(t[e+3]&15)<<8|t[e+4];switch(t[e]){case 207:if(!s){VL("ADTS AAC",i);break}case 15:l.audioPid===-1&&(l.audioPid=p);break;case 21:l.id3Pid===-1&&(l.id3Pid=p);break;case 219:if(!s){VL("H.264",i);break}case 27:l.videoPid===-1&&(l.videoPid=p);break;case 3:case 4:!n.mpeg&&!n.mp3?i.log("MPEG audio found, not supported in this browser"):l.audioPid===-1&&(l.audioPid=p,l.segmentAudioCodec="mp3");break;case 193:if(!s){VL("AC-3",i);break}case 129:n.ac3?l.audioPid===-1&&(l.audioPid=p,l.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(m>0){let v=e+5,x=m;for(;x>2;){switch(t[v]){case 106:l.audioPid===-1&&(n.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(l.audioPid=p,l.segmentAudioCodec="ac3"));break;case 5:l.klvPid===-1&&a.enableEmsgKLVMetadata&&(l.klvPid=p,i.log(`KLV metadata PID found: ${p}`));break}const S=t[v+1]+2;v+=S,x-=S}}break;case 194:case 135:return n9(r,new Error("Unsupported EC-3 in M2TS found"),o,void 0,i),l;case 36:l.videoPid===-1&&(l.videoPid=p,l.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=m+5}return l}function n9(t,e,n,s,r){r.warn(`parsing error: ${e.message}`),t.emit(H.ERROR,H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,fatal:!1,levelRetry:s,chunkMeta:n,error:e,reason:e.message})}function VL(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function _p(t,e){let n=0,s,r,i,a,o;const l=t.data;if(!t||t.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=gl(l[0],l[1]),l.splice(1,1);if(s=l[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(r=(s[4]<<8)+s[5],r&&r>t.size-6)return null;const d=s[7];d&192&&(a=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,d&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),i=s[8];let f=i+9;if(t.size<=f)return null;t.size-=f;const p=new Uint8Array(t.size);for(let m=0,v=l.length;m<v;m++){s=l[m];let x=s.byteLength;if(f)if(f>x){f-=x;continue}else s=s.subarray(f),x-=f,f=0;p.set(s,n),n+=x}return r&&(r-=i+3),{data:p,pts:a,dts:o,len:r}}return null}class Alt{constructor(e){this.logger=void 0,this.pid=0,this.lastContinuityCounter=-1,this.integrityState="ok",this.logger=e}get isCorrupted(){return this.integrityState!=="ok"}reset(e){this.pid=e,this.lastContinuityCounter=-1,this.integrityState="ok"}handlePacket(e){if(e.byteLength<4)return;const n=w5(e,0);if(n!==this.pid){this.logger.debug(`Packet PID mismatch, expected ${this.pid} got ${n}`);return}const s=(e[3]&48)>>4;if(s===0)return;const r=e[3]&15,i=this.lastContinuityCounter;this.lastContinuityCounter=r;const a=(s&1)!=0;if((s&2)!=0&&e[4]!=0&&(e[5]&128)!=0||i<0)return;const u=a?i+1&15:i;if(r!==u){this.logger.warn(`MPEG-TS Continuity Counter check failed for PID='${n}', CC=${r}, Expected-CC=${u} Last-CC=${i}`),this.integrityState="cc-failed";return}if((e[1]&128)!==0){this.logger.warn(`MPEG-TS Packet had TEI flag set for PID='${n}'`),this.integrityState="tei-bit";return}}}class Nlt{static getSilentFrame(e,n){switch(e){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(n===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(n===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}var _5;const Ilt={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])},HL=new Uint8Array([0,0,0,0,0,0,0,0]),Llt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),jlt=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Plt=new Uint8Array([0,0,0,0,0,0,0,0]),gy=new Uint8Array([0,0,0,0,0,0,0,1]),jte=new Uint8Array([105,115,111,109]),Mlt=new Uint8Array([97,118,99,49]),Dlt=new Uint8Array([0,0,0,1]);class lt{static box(e,...n){let s=8,r=n.length;const i=r;for(;r--;)s+=n[r].byteLength;const a=new Uint8Array(s);for(Br(a,0,s),Br(a,4,e),r=0,s=8;r<i;r++)a.set(n[r],s),s+=n[r].byteLength;return a}static hdlr(e){return lt.box(Gt.hdlr,Ilt[e])}static mdat(e){return lt.box(Gt.mdat,e)}static mdhd(e,n){n*=e;const s=Math.floor(n/(Rc+1)),r=Math.floor(n%(Rc+1));return lt.box(Gt.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return lt.box(Gt.mdia,lt.mdhd(e.timescale||0,e.duration||0),lt.hdlr(e.type),lt.minf(e))}static mfhd(e){return lt.box(Gt.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?lt.box(Gt.minf,lt.box(Gt.smhd,Plt),lt.DINF,lt.stbl(e)):lt.box(Gt.minf,lt.box(Gt.vmhd,jlt),lt.DINF,lt.stbl(e))}static moof(e,n,s){return lt.box(Gt.moof,lt.mfhd(e),lt.traf(s,n))}static moov(e){let n=e.length;const s=[];for(;n--;)s[n]=lt.trak(e[n]);return lt.box.apply(null,[Gt.moov,lt.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(lt.mvex(e)))}static mvex(e){let n=e.length;const s=[];for(;n--;)s[n]=lt.trex(e[n]);return lt.box.apply(null,[Gt.mvex,...s])}static mvhd(e,n){n*=e;const s=Math.floor(n/(Rc+1)),r=Math.floor(n%(Rc+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return lt.box(Gt.mvhd,i)}static sdtp(e){const n=e.samples||[],s=new Uint8Array(4+n.length);let r,i;for(r=0;r<n.length;r++)i=n[r].flags,s[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return lt.box(Gt.sdtp,s)}static stbl(e){return lt.box(Gt.stbl,lt.stsd(e),lt.box(Gt.stts,HL),lt.box(Gt.stsc,HL),lt.box(Gt.stsz,Llt),lt.box(Gt.stco,HL))}static avc1(e){let n=[],s=[],r,i,a;for(r=0;r<e.sps.length;r++)i=e.sps[r],a=i.byteLength,n.push(a>>>8&255),n.push(a&255),n=n.concat(Array.prototype.slice.call(i));for(r=0;r<e.pps.length;r++)i=e.pps[r],a=i.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(i));const o=lt.box(Gt.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(s))),l=e.width,u=e.height,d=e.pixelRatio[0],f=e.pixelRatio[1];return lt.box(Gt.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,lt.box(Gt.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),lt.box(Gt.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const n=e.config,s=n.length;return new Uint8Array([0,0,0,0,3,23+s,0,1,0,4,15+s,64,21,0,0,0,0,0,0,0,0,0,0,0,5,s,...n,6,1,2])}static audioStsd(e){const n=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(e){return lt.box(Gt.mp4a,lt.audioStsd(e),lt.box(Gt.esds,lt.esds(e)))}static mp3(e){return lt.box(Gt[".mp3"],lt.audioStsd(e))}static ac3(e){return lt.box(Gt["ac-3"],lt.audioStsd(e),lt.box(Gt.dac3,e.config))}static stsd(e){const{segmentCodec:n}=e;if(e.type==="audio"){if(n==="aac")return lt.box(Gt.stsd,gy,lt.mp4a(e));if(n==="ac3"&&e.config)return lt.box(Gt.stsd,gy,lt.ac3(e));if(n==="mp3"&&e.codec==="mp3")return lt.box(Gt.stsd,gy,lt.mp3(e))}else if(e.pps&&e.sps){if(n==="avc")return lt.box(Gt.stsd,gy,lt.avc1(e));if(n==="hevc"&&e.vps)return lt.box(Gt.stsd,gy,lt.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${n}/${e.codec})`)}static tkhd(e){const n=e.id,s=(e.duration||0)*(e.timescale||0),r=e.width||0,i=e.height||0,a=Math.floor(s/(Rc+1)),o=Math.floor(s%(Rc+1));return lt.box(Gt.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,n){const s=lt.sdtp(e),r=e.id,i=Math.floor(n/(Rc+1)),a=Math.floor(n%(Rc+1));return lt.box(Gt.traf,lt.box(Gt.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),lt.box(Gt.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,a>>24,a>>16&255,a>>8&255,a&255])),lt.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,lt.box(Gt.trak,lt.tkhd(e),lt.mdia(e))}static trex(e){const n=e.id;return lt.box(Gt.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,n){const s=e.samples||[],r=s.length,i=12+16*r,a=new Uint8Array(i);let o,l,u,d,f,p;for(n+=8+i,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),o=0;o<r;o++)l=s[o],u=l.duration,d=l.size,f=l.flags,p=l.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,p>>>24&255,p>>>16&255,p>>>8&255,p&255],12+16*o);return lt.box(Gt.trun,a)}static initSegment(e){const n=lt.moov(e);return gl(lt.FTYP,n)}static hvc1(e){const n=e.params,s=[e.vps,e.sps,e.pps],r=4,i=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),r-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),s.length]);let a=i.length;for(let v=0;v<s.length;v+=1){a+=3;for(let x=0;x<s[v].length;x+=1)a+=2+s[v][x].length}const o=new Uint8Array(a);o.set(i,0),a=i.length;const l=s.length-1;for(let v=0;v<s.length;v+=1){o.set(new Uint8Array([32+v|(v===l?128:0),0,s[v].length]),a),a+=3;for(let x=0;x<s[v].length;x+=1)o.set(new Uint8Array([s[v][x].length>>8,s[v][x].length&255]),a),a+=2,o.set(s[v][x],a),a+=s[v][x].length}const u=lt.box(Gt.hvcC,o),d=e.width,f=e.height,p=e.pixelRatio[0],m=e.pixelRatio[1];return lt.box(Gt.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,d&255,f>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,lt.box(Gt.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),lt.box(Gt.pasp,new Uint8Array([p>>24,p>>16&255,p>>8&255,p&255,m>>24,m>>16&255,m>>8&255,m&255])))}}_5=lt;lt.FTYP=_5.box(Gt.ftyp,jte,Dlt,jte,Mlt);lt.DINF=_5.box(Gt.dinf,_5.box(Gt.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])));const Sxe=9e4;function rU(t,e,n=1,s=!1){const r=t*e*n;return s?Math.round(r):r}function Olt(t,e,n=1,s=!1){return rU(t,e,1/n,s)}function vy(t,e=!1){return rU(t,1e3,1/Sxe,e)}function $lt(t,e=1){return rU(t,Sxe,1/e)}function Pte(t){const{baseTime:e,timescale:n,trackId:s}=t;return`${e/n} (${e}/${n}) trackId: ${s}`}const Flt=10*1e3,Ult=1024,Blt=1152,zlt=1536,s9=8589934592;function Mte(t,e,n,s){return{duration:e,size:n,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1,paddingValue:0}}}class dT extends Oo{constructor(e,n,s,r){super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=n,this.typeSupported=s,this.ISGenerated=!1}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const n=this._initPTS;(!n||!e||e.trackId!==n.trackId||e.baseTime!==n.baseTime||e.timescale!==n.timescale)&&this.log(`Reset initPTS: ${n&&Pte(n)} > ${e&&Pte(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let n=!1;const s=e[0].pts,r=e.reduce((i,a)=>{let o=a.pts,l=o-i;return l<-4294967296&&(n=!0,o=go(o,s),l=o-i),l>0?i:o},s);return n&&this.debug("PTS rollover detected"),r}remux(e,n,s,r,i,a,o,l,u){let d,f,p,m,v,x,y=i,S=i;const E=!u.iframe&&e.pid>-1,T=n.pid>-1,k=n.samples.length,R=e.samples.length>0,I=o&&k>0||k>1;if((!E||R)&&(!T||I)||this.ISGenerated||o){if(this.ISGenerated){var L,j,F,O;const $=this.videoTrackConfig;($&&(n.width!==$.width||n.height!==$.height||((L=n.pixelRatio)==null?void 0:L[0])!==((j=$.pixelRatio)==null?void 0:j[0])||((F=n.pixelRatio)==null?void 0:F[1])!==((O=$.pixelRatio)==null?void 0:O[1]))||!$&&I||this.nextAudioTs===null&&R)&&this.resetInitSegment()}this.ISGenerated||(p=this.generateIS(e,n,i,a));const M=this.isVideoContiguous;let U=-1,G;if(I&&(U=Vlt(n.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(x=!0,U>0){this.warn(`Dropped ${U} out of ${k} video samples due to a missing keyframe`);const $=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(U),n.dropped+=U,S+=(n.samples[0].pts-$)/n.inputTimeScale,G=S}else U===-1&&(this.warn(`No keyframe found out of ${k} video samples`),x=!1);if(this.ISGenerated){if(R&&I&&i){const $=this.getVideoStartPts(n.samples),B=(go(e.samples[0].pts,$)-$)/n.inputTimeScale;y+=Math.max(0,B),S+=Math.max(0,-B)}if(R){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),p=this.generateIS(e,n,i,a)),f=this.remuxAudio(e,y,this.isAudioContiguous,a,T||I||l===vt.AUDIO?S:void 0,u),I){const $=f?f.endPTS-f.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),p=this.generateIS(e,n,i,a)),d=this.remuxVideo(n,S,M,$,u)}}else I&&(d=this.remuxVideo(n,S,M,0,u));d&&(d.firstKeyFrame=U,d.independent=U!==-1,d.firstKeyFramePTS=G)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(v=wxe(s,i,this._initPTS,this._initDTS)),r.samples.length&&(m=_xe(r,i,this._initPTS))),{audio:f,video:d,initSegment:p,independent:x,text:m,id3:v}}computeInitPts(e,n,s,r){const i=Math.round(s*n);let a=go(e,i);if(a<i)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-a)/n} ${r}`);a<i;)a+=s9;return a-i}generateIS(e,n,s,r){const i=e.samples,a=n.samples,o=this.typeSupported,l={},u=this._initPTS,d=!u||r;let f="audio/mp4",p,m,v,x=-1;if(d&&(p=m=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}if(l.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):lt.initSegment([e]),metadata:{channelCount:e.channelCount}},d){x=e.id,v=e.inputTimeScale;const y=this.computeInitPts(i[0].pts,v,s,"audio");(!u||v!==u.timescale||s===0&&y<u.baseTime)&&(p=m=y)}}if(n.sps&&n.pps&&a.length){if(n.timescale=n.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:lt.initSegment([n]),metadata:{width:n.width,height:n.height}},d){x=n.id,v=n.inputTimeScale;const y=this.getVideoStartPts(a),S=go(a[0].dts,y),_=this.computeInitPts(S,v,s,"video"),E=this.computeInitPts(y,v,s,"video");(!u||v!==u.timescale||at(p)||s===0&&E<u.baseTime)&&(m=Math.min(m,_),p=Math.min(p,_))}this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,d&&at(p)?(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${p/v} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${p/v} (${p}/${v}) trackId: ${x}`),this._initPTS={baseTime:p,timescale:v,trackId:x},this._initDTS={baseTime:m,timescale:v,trackId:x}):p=v=void 0,{tracks:l,initPTS:p,timescale:v,trackId:x}}remuxVideo(e,n,s,r,i){const a=e.inputTimeScale,o=e.samples,l=[],u=o.length,d=this._initPTS,f=d.baseTime*a/d.timescale;let p=this.nextVideoTs,m=8,v=this.videoSampleDuration,x,y,S=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,E=!1;if(!s||p===null){const D=f+n*a,K=o[0].pts-go(o[0].dts,o[0].pts);Eb()&&p!==null&&Math.abs(D-K-(p+f))<15e3?s=!0:p=D-K-f}const T=p+f;for(let D=0;D<u;D++){const K=o[D];K.pts=go(K.pts,T),K.dts=go(K.dts,T),K.dts<o[D>0?D-1:D].dts&&(E=!0)}E&&o.sort(function(D,K){const Y=D.dts-K.dts,J=D.pts-K.pts;return Y||J}),x=o[0].dts,y=o[o.length-1].dts;const k=y-x,R=k?Math.round(k/(u-1)):v||e.inputTimeScale/30;if(s){const D=x-T,K=D>R,Y=D<-1;if((K||Y)&&(K?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${vy(D,!0)} ms (${D}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${vy(-D,!0)} ms (${D}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!Y||T>=o[0].pts||Eb())){x=T;const J=o[0].pts-D;if(K)o[0].dts=x,o[0].pts=J;else{let ne=!0;for(let Q=0;Q<o.length&&!(o[Q].dts>J&&ne);Q++){const ee=o[Q].pts;if(o[Q].dts-=D,o[Q].pts-=D,Q<o.length-1){const te=o[Q+1].pts,ue=o[Q].pts,ye=te<=ue,je=te<=ee;ne=ye==je}}}this.log(`Video: Initial PTS/DTS adjusted: ${vy(J,!0)}/${vy(x,!0)}, delta: ${vy(D,!0)} ms`)}}x=Math.max(0,x);let I=0,A=0,L=x;for(let D=0;D<u;D++){const K=o[D],Y=K.units,J=Y.length;let ne=0;for(let Q=0;Q<J;Q++)ne+=Y[Q].data.length;A+=ne,I+=J,K.length=ne,K.dts<L?(K.dts=L,L+=R/4|0||1):L=K.dts,S=Math.min(K.pts,S),_=Math.max(K.pts,_)}y=o[u-1].dts;const j=A+4*I+8;let F;try{F=new Uint8Array(j)}catch(D){this.observer.emit(H.ERROR,H.ERROR,{type:_t.MUX_ERROR,details:pe.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:i,error:D,bytes:j,reason:`fail allocating video mdat ${j}`});return}Br(F,0,j),Br(F,4,Gt.mdat);let O=!1,M=Number.POSITIVE_INFINITY,U=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY,$=Number.NEGATIVE_INFINITY;for(let D=0;D<u;D++){const K=o[D],Y=K.units;let J=0;for(let ee=0,te=Y.length;ee<te;ee++){const ue=Y[ee],ye=ue.data,je=ue.data.byteLength;Br(F,m,je),m+=4,F.set(ye,m),m+=je,J+=4+je}let ne;if(D<u-1)v=o[D+1].dts-K.dts,ne=o[D+1].pts-K.pts;else{const ee=this.config,te=D>0?K.dts-o[D-1].dts:R;if(ne=D>0?K.pts-o[D-1].pts:R,ee.stretchShortVideoTrack&&this.nextAudioTs!==null){const ue=Math.floor(ee.maxBufferHole*a),ye=(r?S+r*a:this.nextAudioTs+f)-K.pts;ye>ue?(v=ye-te,v<0?v=te:O=!0,this.log(`It is approximately ${ye/90} ms to the next segment; using duration ${v/90} ms for the last video frame.`)):v=te}else v=te}let Q=Math.round(K.pts-K.dts);if(M=Math.min(M,v),G=Math.max(G,v),U=Math.min(U,ne),$=Math.max($,ne),!s&&D===0&&Q>v){const ee=Math.round(Q/R)*R;ee-Q===1&&(this.log(`pad first CTS ${Q} -> ${ee} of sn: ${i.sn}`),Q=ee)}l.push(Mte(K.key,v,J,Q))}if(l.length){const D=Eb();if(D){if(D<70){const K=l[0].flags;K.dependsOn=2,K.isNonSync=0}}else if(Hat()&&$-U<G-M&&R/G<.025&&l[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let K=x;for(let Y=0,J=l.length;Y<J;Y++){const ne=K+l[Y].duration,Q=K+l[Y].cts;if(Y<J-1){const ee=ne+l[Y+1].cts;l[Y].duration=ee-Q}else l[Y].duration=Y?l[Y-1].duration:R;l[Y].cts=0,K=ne}}}v=O||!v?R:v;const V=y+v;this.nextVideoTs=p=V-f,this.videoSampleDuration=v,this.isVideoContiguous=!0,i.iframe&&(l.length===1?(l[0].duration=v=i.duration*a,this.nextVideoTs=p=x+v-f):this.warn(`Not adjusting IFrame duration (sample count ${l.length})`));const z={data1:lt.moof(i.sn,x,ms(e,{samples:l})),data2:F,startPTS:(S-f)/a,endPTS:(_+v-f)/a,startDTS:(x-f)/a,endDTS:p/a,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,z}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Blt;case"ac3":return zlt;default:return Ult}}remuxAudio(e,n,s,r,i,a){const o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,u=o/l,d=this.getSamplesPerFrame(e),f=d*u,p=this._initPTS,m=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],x=i!==void 0;let y=e.samples,S=m?0:8,_=this.nextAudioTs||-1;const E=p.baseTime*o/p.timescale,T=E+n*o;if(this.isAudioContiguous=s=s||y.length&&_>0&&(r&&Math.abs(T-(_+E))<9e3||Math.abs(go(y[0].pts,T)-(_+E))<20*f),y.forEach(function(V){V.pts=go(V.pts,T)}),!s||_<0){const V=y.length;if(y=y.filter(B=>B.pts>=0),V!==y.length&&this.warn(`Removed ${y.length-V} of ${V} samples (initPTS ${E} / ${o})`),!y.length)return;i===0?_=0:r&&!x?_=Math.max(0,T-E):_=y[0].pts-E}if(e.segmentCodec==="aac"){const V=this.config.maxAudioFramesDrift;for(let B=0,q=_+E;B<y.length;B++){const z=y[B],D=z.pts,K=D-q,Y=Math.abs(1e3*K/o);if(K<=-V*f&&x)B===0&&(this.warn(`Audio frame @ ${(D/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*K/o)} ms.`),this.nextAudioTs=_=D-E,q=D);else if(K>=V*f&&Y<Flt&&x){let J=Math.round(K/f);for(q=D-J*f;q<0&&J&&f;)J--,q+=f;B===0&&(this.nextAudioTs=_=q-E),this.warn(`Injecting ${J} audio frames @ ${((q-E)/o).toFixed(3)}s due to ${Math.round(1e3*K/o)} ms gap.`);for(let ne=0;ne<J;ne++){let Q=Nlt.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Q||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Q=z.unit.subarray()),y.splice(B,0,{unit:Q,pts:q}),q+=f,B++}}z.pts=q,q+=f}}let k=null,R=null,I,A=0,L=y.length;for(;L--;)A+=y[L].unit.byteLength;for(let V=0,B=y.length;V<B;V++){const q=y[V],z=q.unit;let D=q.pts;if(R!==null){const Y=v[V-1];Y.duration=Math.round((D-R)/u)}else if(s&&e.segmentCodec==="aac"&&(D=_+E),k=D,A>0){A+=S;try{I=new Uint8Array(A)}catch(Y){this.observer.emit(H.ERROR,H.ERROR,{type:_t.MUX_ERROR,details:pe.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:a,error:Y,bytes:A,reason:`fail allocating audio mdat ${A}`});return}m||(Br(I,0,A),Br(I,4,Gt.mdat))}else return;I&&I.set(z,S);const K=z.byteLength;S+=K,v.push(Mte(!0,d,K,0)),R=D}const j=v.length;if(!j)return;const F=v[v.length-1];_=R-E,this.nextAudioTs=_+u*F.duration;const O=m?new Uint8Array(0):lt.moof(e.sequenceNumber++,k/u,ms({},e,{samples:v}));e.samples=[];const M=(k-E)/o,U=this.nextAudioTs/o,$={data1:O,data2:I,startPTS:M,endPTS:U,startDTS:M,endDTS:U,type:"audio",hasAudio:!0,hasVideo:!1,nb:j};return this.isAudioContiguous=!0,$}}function go(t,e){let n;if(e===null)return t;for(e<t?n=-s9:n=s9;Math.abs(t-e)>4294967296;)t+=n;return t}function Vlt(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}function wxe(t,e,n,s){const r=t.samples.length;if(!r)return;const i=t.inputTimeScale;for(let o=0;o<r;o++){const l=t.samples[o];l.pts=go(l.pts-n.baseTime*i/n.timescale,e*i)/i,l.dts=go(l.dts-s.baseTime*i/s.timescale,e*i)/i}const a=t.samples;return t.samples=[],{samples:a}}function _xe(t,e,n){const s=t.samples.length;if(!s)return;const r=t.inputTimeScale;for(let a=0;a<s;a++){const o=t.samples[a];o.pts=go(o.pts-n.baseTime*r/n.timescale,e*r)/r}t.samples.sort((a,o)=>a.pts-o.pts);const i=t.samples;return t.samples=[],{samples:i}}class Hlt extends Oo{constructor(e,n,s,r){super("passthrough-remuxer",r),this.observer=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1,this.videoOnlyRemux=!1,this.decryptdata=null,this.pendingInitSegment=void 0,this.observer=e}destroy(){this.observer&&this.observer.removeAllListeners(),this.observer=null}resetTimeStamp(e){this.lastEndTime=null;const n=this.initPTS;n&&e&&n.baseTime===e.baseTime&&n.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,n,s,r){this.audioCodec=n,this.videoCodec=s,this.decryptdata=r,this.pendingInitSegment=e,this.videoOnlyRemux=!1,this.initTracks=void 0,this.initData=void 0,this.emitInitSegment=!0}generateInitSegment(e,n,s){this.videoOnlyRemux=!1;let{audioCodec:r,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:a,video:o}=this.initData=s||E1e(e);if(n)Nat(e,n);else{const u=a||o;u!=null&&u.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${u.codec}")!`)}a&&(r=Dte(a,Is.AUDIO,this)),o&&(i=Dte(o,Is.VIDEO,this));const l={};a&&o?l.audiovideo={container:"video/mp4",codec:r+","+i,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:a?l.audio={container:"audio/mp4",codec:r,encrypted:a.encrypted,initSegment:e,id:"audio"}:o?l.video={container:"video/mp4",codec:i,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=l}remux(e,n,s,r,i,a,o,l,u,d,f){var p,m;let{initPTS:v,lastEndTime:x}=this;const y={audio:void 0,video:void 0,text:void 0,id3:s,initSegment:void 0};at(x)||(x=this.lastEndTime=i||0);const S=n.samples;if(!S.length)return y;const _=this.pendingInitSegment;_&&(this.pendingInitSegment=void 0,this.generateInitSegment(_,this.decryptdata,d));const E={initPTS:void 0,timescale:void 0,trackId:void 0};let T=this.initData;if((p=T)!=null&&p.length||(this.generateInitSegment(S),T=this.initData),!((m=T)!=null&&m.length))return this.warn("Failed to generate initSegment."),y;if(u.iframe&&T.audio&&T.video){var k;const he=(k=this.initTracks)==null||(k=k.audiovideo)==null?void 0:k.initSegment,De=he?Eat(he):null;if(De){var R;this.log("Converted muxed init segment to video-only for I-Frame playback"),this.generateInitSegment(De,this.decryptdata),(R=this.initData)!=null&&R.length&&(T=this.initData,this.emitInitSegment=!0,this.videoOnlyRemux=!0)}}this.emitInitSegment&&(E.tracks=this.initTracks,y.initSegment=E,this.emitInitSegment=!1);const I=u.iframe,A=f&&(!I||f.includeSampleDetails)?f.tracks:Pat(S,T,u,this,I),L=T.audio?A[T.audio.id]:null,j=T.video?A[T.video.id]:null,F=!!T.audio,O=!!T.video;let M="";F&&(M+="audio"),O&&(M+="video");const U=jE(j,1/0),G=jE(L,1/0),$=jE(j,0,!0),V=jE(L,0,!0);let B=i,q=0;j&&L&&T.audio&&(G>$||U>V)&&this.warn(`audio and video track sample timestamps do not overlap. v: ${U}-${$} a: ${G}-${V}}`,j,L);const z=!!L&&(!j||!v&&G<U||!!v&&v.trackId===T.audio.id),D=z?L:j;if(!D)return this.log(`No media samples found in ${l} ${u.level} ${u.part===-1?"":`part: ${u.part} of`} sn: ${u.sn} at playlist time: ${i}`),y;let K=S,Y,J;if(j&&j.sampleCount>=1&&T.video&&u.iframe){const{trun:he,start:De}=j,Ge=he.length===1,Je=he.length?Ge?he[0].samples:he[0].samples.concat(...he.slice(1).map(Le=>Le.samples)):[];if(Je.length){const Le=he[0];let qe=Le;for(let _n=he.length;_n--;)if(he[_n].samples.length){qe=he[_n];break}const et=qe.lastSampleDurationOffset,{defaultSampleDurationOffset:Ct}=Le,Ke=Math.abs(u.duration-($-U))>.05,dt=Je.length<j.sampleCount;if(!(Ke||dt||this.videoOnlyRemux||!Ge))q=$-U;else{const _n=dt?qe.sampleOffset+qe.samples.reduce((Tt,Ie)=>Tt+Ie.size,0):void 0,Dt=Ke?u.duration:$-U,nn=Wlt(Je,Dt*T.video.timescale,et,Ct),fn=Cat(S,T.video.id,Je.length,_n,nn);fn?(K=fn,J=Glt(De,Je)):this.warn(`IFrame remux skipped (sn ${u.sn}); using native sample duration`),q=fn&&nn?Dt:$-U}}else this.warn(`Could not remux IFrame track fragment (no samples in range, trun count ${he.length})`),q=$-U}else q=z?V-G:$-U;if(this.videoOnlyRemux&&K===S)return this.warn(`Dropping muxed I-Frame fragment that could not be remuxed to video-only (sn: ${u.sn})`),y;const ne=D.timescale,Q=D.start-i*ne,ee=z?T.audio.id:T.video.id;if(B=D.start/ne,(a||!v)&&(qlt(v,B,i,q)||ne!==v.timescale)){let he=!1;const De=z?"audio":"video";if(v){const Ge=i!==0?B/i:1+B/1;he=B>=0&&Math.abs(1-Ge)<.001,this.log(`${De} timestamps in track ${ee} at playlist time: ${a?"":"~"}${i} maps to ${B} with initPTS: ${v.baseTime/v.timescale} (${Q/ne-v.baseTime/v.timescale}s diff) (${M}) drift estimate: ${Ge} ${he?"(ignoring drift)":"remapping timestamps (initPTS)"}`)}he||(this.log(`Found initPTS in ${De} track ${ee} at playlist time: ${i} offset: ${B-i} (${Q}/${ne})`),v=null,E.initPTS=Q,E.timescale=ne,E.trackId=ee)}v?(E.initPTS=v.baseTime,E.timescale=v.timescale,E.trackId=v.trackId):((!E.timescale||E.trackId===void 0||E.initPTS===void 0)&&(this.warn("Could not set initPTS"),E.initPTS=B,E.timescale=1,E.trackId=-1),this.initPTS=v={baseTime:E.initPTS,timescale:E.timescale,trackId:E.trackId});const te=B-v.baseTime/v.timescale,ue=te+q,ye=O&&(D==null?void 0:D.ptsMin)!==void 0?D.ptsMin/D.timescale-v.baseTime/v.timescale:te,je=J!==void 0&&j?J/j.timescale-v.baseTime/v.timescale:O&&D!=null&&D.ptsMax?D.ptsMax/D.timescale-v.baseTime/v.timescale:ue;q>0?this.lastEndTime=ue:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Re=(T.audio?T.audio.encrypted:!1)||(T.video?T.video.encrypted:!1),me={data1:K,data2:Y,startPTS:ye,startDTS:te,endPTS:je,endDTS:ue,type:M,hasAudio:F,hasVideo:O,nb:1,dropped:0,encrypted:Re};y.audio=F&&!O?me:void 0,y.video=O?me:void 0;const Ce=this.isVideoContiguous,Xe=j==null?void 0:j.sampleCount;if(Xe){const he=j.keyFrameIndex,De=he!==-1;me.nb=Xe,me.dropped=he===0||Ce?0:De?he:Xe,me.independent=De,me.firstKeyFrame=he,De&&j.keyFrameStart&&(me.firstKeyFramePTS=(j.keyFrameStart-v.baseTime)/v.timescale),Ce||(y.independent=De),this.isVideoContiguous||(this.isVideoContiguous=De),me.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${he}/${Xe} dropped: ${me.dropped} start: ${me.firstKeyFramePTS||"NA"}`)}return y.initSegment=E,y.id3=wxe(s,i,v,v),r.samples.length&&(y.text=_xe(r,i,v)),y}}function jE(t,e,n=!1){return(t==null?void 0:t.start)!==void 0?(t.start+(n?t.duration:0))/t.timescale:e}function Glt(t,e){let n=t,s=t;for(let r=0;r<e.length;r++){const{cts:i,duration:a}=e[r];s=Math.max(s,n+(i||0)+a),n+=a}return s}function Wlt(t,e,n,s){if(n!==void 0){const i=t[t.length-1];let a=e;for(let o=0;o<t.length-1;o++)a-=t[o].duration;return a<=0&&(a=i.duration),i.duration=a,{durationOffset:n,value:a}}if(s===void 0)return;const r=Math.round(e/t.length);for(let i=0;i<t.length;i++)t[i].duration=r;return{durationOffset:s,value:r}}function qlt(t,e,n,s){if(t===null)return!0;const r=Math.max(s,1),i=e-t.baseTime/t.timescale;return Math.abs(i-n)>=r}function Dte(t,e,n){const s=t.codec;return s&&s.length>4?s:e===Is.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?f5(s,!1):(n.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):s==="mjpg"?s:(n.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let Gf;try{Gf=self.performance.now.bind(self.performance)}catch{Gf=Date.now}const fT=[{demux:wlt,remux:Hlt},{demux:nd,remux:dT},{demux:xlt,remux:dT},{demux:blt,remux:dT}];fT.splice(2,0,{demux:ylt,remux:dT});class Ote{constructor(e,n,s,r,i,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=n,this.config=s,this.id=i,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,n,s,r){if(!this.observer)return PE(s);const i=s.transmuxing;i.executeStart=Gf();const a=new Uint8Array(e),{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:p,timeOffset:m,initSegmentChange:v}=r||o,{audioCodec:x,videoCodec:y,defaultInitPts:S,duration:_,initSegmentData:E}=l,T=Klt(a,n);if(T&&fv(T.method)){const A=this.getDecrypter(),L=XF(T.method);return this.asyncResult=!0,this.decryptionPromise=A.decrypt(a,T.key.buffer,T.iv.buffer,L,s.decryptRange).then(j=>{const F=this.push(j,null,s);return this.decryptionPromise=null,F}),this.decryptionPromise}const k=this.needsProbing(d,f);if(k){const A=s.iframe&&E&&nd.probe(E,this.logger)?E:a,L=this.configureTransmuxer(A);if(L)return this.logger.warn(`[transmuxer] ${L.message}`),this.observer.emit(H.ERROR,H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,fatal:!1,error:L,reason:L.message}),i.executeEnd=Gf(),PE(s)}(d||f||v||k)&&this.resetInitSegment(E,x,y,_,n,s),(d||v||k)&&this.resetInitialTimestamp(S),u||this.resetContiguity();const R=this.transmux(a,T,m,p,s);this.asyncResult=L2(R);const I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,i.executeEnd=Gf(),R}flush(e){const n=e.transmuxing;n.executeStart=Gf();const{decrypter:s,currentTransmuxState:r,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(s){const f=s.flush();f&&a.push(this.push(f.buffer,null,e))}const{demuxer:l,remuxer:u}=this;if(!l||!u){n.executeEnd=Gf();const f=[PE(e)];return this.asyncResult?Promise.resolve(f):f}const d=l.flush(o,e);return L2(d)?(this.asyncResult=!0,d.then(f=>(this.flushRemux(a,f,e),a))):(this.flushRemux(a,d,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,n,s){if(!this.remuxer)return;const{audioTrack:r,videoTrack:i,id3Track:a,textTrack:o}=n,{accurateTimeOffset:l,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id} playlist ${s.level}`);const d=this.remuxer.remux(r,i,a,o,u,l,!0,this.id,s,n.initData,n.sampleData);e.push({remuxResult:d,chunkMeta:s}),s.transmuxing.executeEnd=Gf()}resetInitialTimestamp(e){const{demuxer:n,remuxer:s}=this;!n||!s||(n.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:n}=this;!e||!n||(e.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(e,n,s,r,i,a){const{demuxer:o,remuxer:l}=this;!o||!l||(o.resetInitSegment(e,n,s,r,i,a),l.resetInitSegment(e,n,s,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0),this.observer&&this.observer.removeAllListeners(),this.decryptionPromise=null,this.decrypter=this.observer=void 0,this.logger=this.config=this.probe=void 0}transmux(e,n,s,r,i){let a;return(n==null?void 0:n.method)==="SAMPLE-AES"?a=this.transmuxSampleAes(e,n,s,r,i):a=this.transmuxUnencrypted(e,s,r,i),a}transmuxUnencrypted(e,n,s,r){const{demuxer:i,remuxer:a}=this;if(!i||!a)return PE(r);const o=i.demux(e,n,r,!1,!this.config.progressive),{audioTrack:l,videoTrack:u,id3Track:d,textTrack:f}=o;return{remuxResult:a.remux(l,u,d,f,n,s,!1,this.id,r,o.initData,o.sampleData),chunkMeta:r}}transmuxSampleAes(e,n,s,r,i){return this.demuxer?this.demuxer.demuxSampleAes(e,n,s,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,r,!1,this.id,i,a.initData,a.sampleData),chunkMeta:i})):Promise.reject(new Error("no demuxer"))}configureTransmuxer(e){const{config:n,observer:s,typeSupported:r}=this;if(!s)return;let i;try{for(let f=0,p=fT.length;f<p;f++){var a;if((a=fT[f].demux)!=null&&a.probe(e,this.logger)){i=fT[f];break}}}catch(f){return f}if(!i)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,u=i.demux,d=i.remux;(!o||!(o instanceof u))&&(this.logger.log(`Using ${u.name}`),this.demuxer=new u(s,n,r,this.logger),this.probe=u.probe),(!l||!(l instanceof d))&&(this.logger.log(`Using ${d.name}`),this.remuxer=new d(s,n,r,this.logger))}needsProbing(e,n){return!this.demuxer||!this.remuxer||e||n}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new KF(this.config)),e}}function Klt(t,e){let n=null;return t.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(n=e),n}const PE=t=>({remuxResult:{},chunkMeta:t});function L2(t){return"then"in t&&t.then instanceof Function}class Ylt{constructor(e,n,s,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=n,this.initSegmentData=s,this.duration=r,this.defaultInitPts=i||null}}class Zlt{constructor(e,n,s,r,i,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=n,this.accurateTimeOffset=s,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=a}}let $te=0;class Exe{constructor(e,n,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=$te++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const u=l.data,d=this.hls;if(!(!d||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const p=(f=this.workerContext)==null?void 0:f.objectURL;p&&self.URL.revokeObjectURL(p);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{d.logger[u.data.logType]&&d.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,d.trigger(u.event,u.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const u=new Error(`${l.message}  (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const i=e.config;this.hls=e,this.id=n,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=s,this.onFlush=r;const a=(l,u)=>{u=u||{},u.frag=this.frag||void 0,l===H.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(l,u)};this.observer=new eU,this.observer.on(H.FRAG_DECRYPTED,a),this.observer.on(H.ERROR,a);const o=Jee(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(i.workerPath||slt()){try{i.workerPath?(l.log(`loading Web Worker ${i.workerPath} for "${n}"`),this.workerContext=ilt(i.workerPath)):(l.log(`injecting Web Worker for "${n}"`),this.workerContext=rlt());const{worker:d}=this.workerContext;d.addEventListener("message",this.onWorkerMessage),d.addEventListener("error",this.onWorkerError),d.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:n,config:Fs(i)})}catch(d){l.warn(`Error setting up "${n}" Web Worker, fallback to inline`,d),this.terminateWorker(),this.error=null,this.transmuxer=new Ote(this.observer,o,i,"",n,e.logger)}return}}this.transmuxer=new Ote(this.observer,o,i,"",n,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=$te++;const n=this.hls.config,s=Jee(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:Fs(n)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),alt(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,n,s,r,i,a,o,l,u,d){var f,p;u.transmuxing.start=self.performance.now();const{instanceNo:m,transmuxer:v}=this,x=a?a.start:i.start,y=i.decryptdata,S=this.frag,_=S?i.cc!==S.cc:!0,E=S?u.level!==S.level:!0,T=S?u.sn-S.sn:-1,k=this.part?u.part-this.part.index:-1,R=T===0&&u.id>1&&u.id===(S==null?void 0:S.stats.chunkCount),I=!E&&(T===1||T===0&&(k===1||R&&k<=0)),A=self.performance.now();(E||T||i.stats.parsing.start===0)&&(i.stats.parsing.start=A),a&&(k||!I)&&(a.stats.parsing.start=A);const L=!(S&&((f=i.initSegment)==null?void 0:f.url)===((p=S.initSegment)==null?void 0:p.url)),j=new Zlt(_,I,l,E,x,L);if(!I||_||L){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id} playlist: ${u.level} id: ${u.id}
479        discontinuity: ${_}
480        trackSwitch: ${E}
481        contiguous: ${I}
482        accurateTimeOffset: ${l}
483        timeOffset: ${x}
484        initSegmentChange: ${L}`);const F=new Ylt(s,r,n,o,d);this.configureTransmuxer(F)}if(this.frag=i,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:m,cmd:"demux",data:e,decryptdata:y,chunkMeta:u,state:j},e instanceof ArrayBuffer?[e]:[]);else if(v){const F=v.push(e,y,u,j);L2(F)?F.then(O=>{this.handleTransmuxComplete(O)}).catch(O=>{this.transmuxerError(O,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(F)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:e});else if(s){const r=s.flush(e);L2(r)?r.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,n,s){this.hls&&(this.error=e,this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,n){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(n)}configureTransmuxer(e){const{instanceNo:n,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Fte=100;class Xlt extends JF{constructor(e,n,s){super(e,n,s,"audio-stream-controller",vt.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.nextTrackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(H.LEVEL_LOADED,this.onLevelLoaded,this),e.on(H.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(H.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(H.BUFFER_RESET,this.onBufferReset,this),e.on(H.BUFFER_CREATED,this.onBufferCreated,this),e.on(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(H.FRAG_LOADING,this.onFragLoading,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(H.LEVEL_LOADED,this.onLevelLoaded,this),e.off(H.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(H.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(H.BUFFER_RESET,this.onBufferReset,this),e.off(H.BUFFER_CREATED,this.onBufferCreated,this),e.off(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(H.FRAG_LOADING,this.onFragLoading,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,n){const{frag:s,id:r,initPTS:i,timescale:a,trackId:o,timestampOffsets:l}=n;if(r===vt.MAIN){const u=s.cc,d=this.fragCurrent;if(this.initPTS=l,this.log(`InitPTS for cc: ${u}
484 found from main: ${i/a} (${i}/${a}) trackId: ${o}`),this.mainAnchor=s,this.state===Ne.WAITING_INIT_PTS){const f=this.waitingData;(!f&&!this.loadingParts||f&&f.frag.cc!==u)&&this.syncWithAnchor(s,f==null?void 0:f.frag)}else!this.hls.hasEnoughToStart&&d&&d.cc!==u?(d.abortRequests(),this.syncWithAnchor(s,d)):this.state===Ne.IDLE&&this.tick()}}getLoadPosition(){var e;return!this.startFragRequested&&this.nextLoadPosition>=0&&((e=this.switchingTrack)==null?void 0:e.flushImmediate)!==!1?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,n){var s;const r=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(n&&(r==null?void 0:r.cc)===n.cc)return;const i=(r||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=B1e(a,i,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===Ne.IDLE&&this.doTickIdle())}startLoad(e,n){if(!this.levels){this.startPosition=e,this.state=Ne.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Fte),s>0&&e===-1&&!n&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=Ne.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,!n&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this.startFragRequested=!1),this.tick()}doTick(){switch(this.state){case Ne.IDLE:this.doTickIdle();break;case Ne.WAITING_TRACK:{const{levels:e,trackId:n}=this,s=e==null?void 0:e[n],r=s==null?void 0:s.details;if(r&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(r))break;this.state=Ne.WAITING_INIT_PTS}break}case Ne.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Ne.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:n,part:s,cache:r,complete:i}=e,a=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=Ne.FRAG_LOADING;const o=r.flush().buffer,l={frag:n,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),i&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=Ne.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime,this.checkFragmentChanged())}doTickIdle(){var e;const{hls:n,levels:s,media:r,trackId:i}=this,a=n.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[i]))return;const o=s[i],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=Ne.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.getBufferOutput();this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,Is.AUDIO));const d=this.getFwdBufferInfo();if(d===null)return;if(!this.switchingTrack&&this._streamEnded(d,l)){n.trigger(H.BUFFER_EOS,{type:"audio"}),this.state=Ne.ENDED;return}const f=d.len,p=n.maxBufferLength,m=l.fragments,v=m[0].start,x=this.getLoadPosition(),y=this.flushing||this.switchingTrack&&!this.switchingTrack.flushImmediate?x:d.end;if(this.switchingTrack&&r){const E=x;l.PTSKnown&&E<v&&E>=this.timelineOffset&&(d.end>v||d.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track ${E} -> ${v} + 0.05`),r.currentTime=v+.05)}if(f>=p&&!this.switchingTrack&&y<m[m.length-1].start)return;let S=this.getNextFragment(y,l);if(S&&this.isLoopLoading(S,y)&&(S=this.getNextFragmentLoopLoading(S,l,d,vt.MAIN,p)),!S){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(d,p,S))return;let _=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_&&vr(S)&&!S.endList&&(!l.live||!this.loadingParts&&y<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_)===ur.OK&&(this.mainFragLoading=_=null),_&&vr(_))){if(S.start>_.end){const T=this.fragmentTracker.getFragAtPos(y,vt.MAIN);T&&T.end>_.end&&(_=T,this.mainFragLoading={frag:T,targetBufferTime:null})}if(S.start>_.end)return}this.loadFragment(S,o,y)}onMediaDetaching(e,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,n)}onAudioTracksUpdated(e,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(s=>new A2(s))}onAudioTrackSwitching(e,n){const s=!!n.url;this.trackId=n.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?(this.switchingTrack=n,n.flushImmediate||(this.nextTrackId=n.id,this.nextLevelSwitch()),this.flushAudioIfNeeded(n),this.state!==Ne.STOPPED&&(this.setInterval(Fte),this.state=Ne.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,n){this.mainDetails=n.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(H.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,n){var s;const{levels:r}=this,{details:i,id:a,groupId:o,track:l}=n;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||i.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=n,this.state!==Ne.STOPPED&&(this.state=Ne.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const d=r[a];let f=0;if(i.live||(s=d.details)!=null&&s.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(d.details){var p;f=this.alignPlaylists(i,d.details,(p=this.levelLastLoaded)==null?void 0:p.details)}i.alignedSliding||(x5(u,i,this),f=i.fragmentStart)}d.details=i,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(H.AUDIO_TRACK_UPDATED,{details:i,id:a,groupId:n.groupId}),this.state===Ne.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=Ne.IDLE),this.tick()}_handleFragmentLoadProgress(e){var n;const s=e.frag,{part:r,payload:i}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const d=u.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const f=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let p=this.transmuxer;p||(p=this.transmuxer=new Exe(this.hls,vt.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const m=this.initPTS[s.cc],v=(n=s.initSegment)==null?void 0:n.data;if(m!==void 0){const y=r?r.index:-1,S=y!==-1,_=new YF(s.level,s.sn,s.stats.chunkCount,i.byteLength,y,S,s.duration);p.push(i,v,f,"",s,r,d.totalduration,!1,_,m)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:x}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new oxe,complete:!1};x.push(new Uint8Array(i)),this.state!==Ne.STOPPED&&(this.state=Ne.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,n){this.bufferFlushed=this.flushing=!1;const s=n.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,n){!this.audioOnly&&n.frag.type===vt.MAIN&&vr(n.frag)&&(this.mainFragLoading=n,this.state===Ne.IDLE&&this.tick())}onFragBuffered(e,n){const{frag:s,part:r}=n;if(s.type!==vt.AUDIO){!this.audioOnly&&s.type===vt.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(vr(s)){const i=this.switchingTrack;i&&(this.bufferedTrack=i)}this.fragBufferedComplete(s,r),this.media&&this.tick()}getFwdBufferInfo(){const e=this.getBufferOutput();return super.getFwdBufferInfo(e,vt.AUDIO)}getBufferOutput(){return this.mediaBuffer?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const s=this.fragPlaying,r=e==null?void 0:e.level;return(!s||s.level!==r)&&(e&&this.cleanupBackBuffer(),this.switchingTrack&&this.completeAudioSwitch(this.switchingTrack)),!0}onError(e,n){var s;if(n.fatal){this.state=Ne.ERROR;return}switch(n.details){case pe.FRAG_GAP:case pe.FRAG_PARSING_ERROR:case pe.FRAG_DECRYPT_ERROR:case pe.FRAG_LOAD_ERROR:case pe.FRAG_LOAD_TIMEOUT:case pe.KEY_LOAD_ERROR:case pe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(vt.AUDIO,n);break;case pe.AUDIO_TRACK_LOAD_ERROR:case pe.AUDIO_TRACK_LOAD_TIMEOUT:case pe.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Ne.WAITING_TRACK&&((s=n.context)==null?void 0:s.type)===hn.AUDIO_TRACK&&(this.state=Ne.IDLE);break;case pe.BUFFER_APPEND_NO_PROGRESS:if(n.parent!=="audio")return;n.frag&&(n.appendsWithoutProgress||0)>
vendor: 17,822 bytes, lines 484-487
484=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${n.frag.sn} of track ${n.frag.level} as a gap after ${n.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(n.frag));break;case pe.BUFFER_ADD_CODEC_ERROR:case pe.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case pe.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case pe.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(e,{type:n}){n!==Is.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:n}){if(n!==Is.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ne.ENDED&&(this.state=Ne.IDLE);const s=this.getBufferOutput();s&&(this.afterBufferFlushed(s,n),this.tick())}}_handleTransmuxComplete(e){var n;const s="audio",{hls:r}=this,{remuxResult:i,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:d}=o,{details:f}=d,{audio:p,text:m,id3:v,initSegment:x}=i;if(this.fragContextChanged(l)||!f){this.fragmentTracker.removeFragment(l),x!=null&&x.tracks&&this.resetTransmuxer();return}if(this.state=Ne.PARSING,p&&this.switchingTrack&&!this.switchingTrack.flushImmediate){const{config:y}=this,S=y.nextAudioTrackBufferFlushForwardOffset,_=Math.max(this.getLoadPosition()+S,l.start);super.flushMainBuffer(_,Number.POSITIVE_INFINITY,vt.AUDIO)}if(x!=null&&x.tracks){const y=l.initSegment||l;if(this.unhandledEncryptionError(x,l))return;this._bufferInitSegment(d,x.tracks,y,a),r.trigger(H.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:s,tracks:x.tracks})}if(p){const{startPTS:y,endPTS:S,startDTS:_,endDTS:E}=p;u&&(u.elementaryStreams[Is.AUDIO]={startPTS:y,endPTS:S,startDTS:_,endDTS:E}),l.setElementaryStreamInfo(Is.AUDIO,y,S,_,E),this.bufferFragmentData(p,l,u,a)}if(v!=null&&(n=v.samples)!=null&&n.length){const y=ms({id:s,frag:l,details:f},v);r.trigger(H.FRAG_PARSING_METADATA,y)}if(m){const y=ms({id:s,frag:l,details:f},m);r.trigger(H.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,n,s,r){if(this.state!==Ne.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const i=n.audio;i.id=vt.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${a}/${i.codec}]`),(a==null?void 0:a.split(",").length)===1&&(i.levelCodec=a),this.hls.trigger(H.BUFFER_CODECS,n);const o=i.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:r,parent:s.type,data:o};this.hls.trigger(H.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,n,s){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===ur.NOT_LOADED||r===ur.PARTIAL){var i;if((i=n.details)!=null&&i.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Ne.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==n.details.fragmentStart&&x5(a,n.details,this)}else super.loadFragment(e,n,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack&&e.flushImmediate){const{name:n,lang:s,assocLang:r,characteristics:i,audioCodec:a,channels:o}=this.bufferedTrack;km({name:n,lang:s,assocLang:r,characteristics:i,audioCodec:a,channels:o},e,Op)||(p5(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:n}=this;this.bufferedTrack=e,this.switchingTrack=null,n.trigger(H.AUDIO_TRACK_SWITCHED,Rt({},e))}get nextAudioTrack(){return this.nextTrackId}}class iU extends Oo{constructor(e,n){super(n,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,n,s){const r=n==null?void 0:n.renditionReports;if(r){let i=-1;for(let a=0;a<r.length;a++){const o=r[a];let l;try{l=new self.URL(o.URI,n.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),l=o.URI||""}if(l===e){i=a;break}else l===e.substring(0,l.length)&&(i=a)}if(i!==-1){const a=r[i],o=parseInt(a["LAST-MSN"])||n.lastPartSn;let l=parseInt(a["LAST-PART"])||n.lastPartIndex;if(this.hls.config.lowLatencyMode){const d=Math.min(n.age-n.partTarget,n.targetduration);l>=0&&d>n.partTarget&&(l+=1)}const u=s&&ete(s);return new tte(o,l>=0?l:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,n){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,n){if(n)try{return n.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,n,s){const{details:r,stats:i}=n,a=r.fragments,o=self.performance.now(),l=i.loading.first?Math.max(0,Math.floor(o-i.loading.first)):0;r.advancedDateTime=Date.now()-l;const u=this.hls.config.timelineOffset;if(u!==r.appliedTimelineOffset){const f=Math.max(u||0,0);r.appliedTimelineOffset=f,a.forEach(p=>{p==null||p.setStart(p.playlistOffset+f)})}if(r.live||s!=null&&s.live){var d;const f="levelInfo"in n?n.levelInfo:n.track;r.reloaded(s);const p=(d=a[a.length-1])==null?void 0:d.type;if(r.misses>=this.hls.config.liveMaxUnchangedPlaylistRefresh){const k=new Error(`${p} playlist ${f.id} hit max allowed unchanged reloads.`);this.warn(k);const{networkDetails:R,context:I}=n;this.hls.trigger(H.ERROR,{type:_t.NETWORK_ERROR,details:pe.PLAYLIST_UNCHANGED_ERROR,fatal:!1,url:r.url,error:k,reason:k.message,level:n.level,parent:p,context:I,networkDetails:R,stats:i});return}if(s){Got(s,r,this);const k=r.playlistParsingError;if(k){this.warn(k);const R=this.hls;if(!R.config.ignorePlaylistParsingErrors){const{networkDetails:I}=n;R.trigger(H.ERROR,{type:_t.NETWORK_ERROR,details:pe.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:k,reason:k.message,level:n.level,parent:p,networkDetails:I,stats:i});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=i.loading.start);const m=this.hls.mainForwardBufferInfo,v=m?m.end-m.len:0,x=(r.edge-v)*1e3,y=txe(r,x);r.requestScheduled+y<o?r.requestScheduled=o:r.requestScheduled<=o&&(r.requestScheduled+=y);const S=n.deliveryDirectives;if(this.log(`live playlist ${e} ${r.advanced?`REFRESHED ${r.lastPartSn} - ${r.lastPartIndex}`:r.updated?"UPDATED":`MISSED (received ${r.lastPartSn} - ${r.lastPartIndex}${S?` | requested ${S.msn} - ${S.part}`:""})`}`),!this.canLoad||!r.live)return;let _,E,T;if(r.canBlockReload&&r.endSN&&r.advanced){const k=this.hls.config.lowLatencyMode,R=r.lastPartSn,I=r.endSN,A=r.lastPartIndex,L=A!==-1,j=R===I;L?j?(E=I+1,T=k?0:A):(E=R,T=k?A+1:r.maxPartIndex):E=I+1;const F=r.age,O=F+r.ageHeader;let M=Math.min(O-r.partTarget,r.targetduration*1.5);if(M>0){if(O>r.targetduration*3)this.log(`Playlist last advanced ${F.toFixed(2)}s ago. Omitting segment and part directives.`),E=void 0,T=void 0;else if(s!=null&&s.tuneInGoal&&O-r.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${M} with playlist age: ${r.age}`),M=0;else{const U=Math.floor(M/r.targetduration);if(E+=U,T!==void 0){const G=Math.round(M%r.targetduration/r.partTarget);T+=G}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${F.toFixed(2)}s goal: ${M} skip sn ${U} to part ${T}`)}r.tuneInGoal=M}if(_=this.getDeliveryDirectives(r,n.deliveryDirectives,E,T),k||!j){r.requestScheduled=o,this.loadingPlaylist(f,_);return}}else(r.canBlockReload||r.canSkipUntil)&&(_=this.getDeliveryDirectives(r,n.deliveryDirectives,E,T));_&&E!==void 0&&r.canBlockReload&&(r.requestScheduled=i.loading.first+Math.max(y-l*2,y/2)),this.scheduleLoading(f,_,r)}else this.clearTimer()}scheduleLoading(e,n,s){const r=s||e.details;if(!r){this.loadingPlaylist(e,n);return}const i=self.performance.now(),a=r.requestScheduled;if(i>=a){this.loadingPlaylist(e,n);return}const o=a-i;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,n),o)}getDeliveryDirectives(e,n,s,r){let i=ete(e);return n!=null&&n.skip&&e.deltaUpdateFailed&&(s=n.msn,r=n.part,i=uT.No),new tte(s,r,i)}checkRetry(e){const n=e.details,s=u5(e),r=e.errorAction,{action:i,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(i===Oi.RetryRequest||!r.resolved&&i===Oi.SendAlternateToPenaltyBox);if(l){var u;if(a>=o.maxNumRetry)return!1;if(s&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{var d;const f=E2((d=e.response)==null?void 0:d.code);if(this.clearTimer(),f)this.log("Waiting for connection (offline)"),e.reason="offline",this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3);else{const p=zF(o,a);this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${n}" in ${p}ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(),p)}}e.levelRetry=!0,r.resolved=!0}return l}checkOfflineStatus(){this.clearTimer(),E2(0)?this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3):(this.log("Connection restored (online)"),this.loadPlaylist())}}function Cxe(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!j2(t[n].attrs,e[n].attrs))return!1;return!0}function j2(t,e,n){const s=t["STABLE-RENDITION-ID"];return s&&!n?s===e["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>t[r]!==e[r])}class Qlt extends iU{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.LEVEL_LOADING,this.onLevelLoading,this),e.on(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(H.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.LEVEL_LOADING,this.onLevelLoading,this),e.off(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(H.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(H.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(e,n){const{id:s,groupId:r,details:i}=n,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Audio track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=n.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,o)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const s=n.audioGroups||null,r=this.groupIds;let i=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(p=>N2(p.groupId,s));if(o.length)this.selectDefaultTrack&&!o.some(p=>p.default)&&(this.selectDefaultTrack=!1),o.forEach((p,m)=>{p.id=m});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!i&&l){const p=Gc(l,o,Op);if(p>-1)i=o[p];else{const m=Gc(l,this.tracks);i=this.tracks[m]}}let u=this.findTrackId(i);u===-1&&i&&(u=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(H.AUDIO_TRACKS_UPDATED,d);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var a;const p=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(p.message),this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:p})}}}onError(e,n){n.fatal||!n.context||n.context.type===hn.AUDIO_TRACK&&n.context.id===this.trackId&&N2(n.context.groupId,this.groupIds)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}get nextAudioTrack(){return this.trackId}set nextAudioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e,!1)}setAudioOption(e){const n=this.hls;if(n.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const r=this.currentTrack;if(r&&km(e,r,Op))return r;const i=Gc(e,this.tracksInGroup,Op);if(i>-1){const a=this.tracksInGroup[i];return this.setAudioTrack(i,"flushImmediate"in e&&e.flushImmediate),a}else if(r){let a=n.loadLevel;a===-1&&(a=n.firstAutoLevel);const o=pot(e,n.levels,s,a,Op);if(o===-1)return null;n.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Gc(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e,n=!0){const s=this.tracksInGroup;if(e<0||e>=s.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const r=this.currentTrack,i=s[e],a=i.details&&!i.details.live;if(e===this.trackId&&i===r&&a||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(H.AUDIO_TRACK_SWITCHING,Rt(Rt({},i),{},{flushImmediate:n})),a))return;const o=this.switchParams(i.url,r==null?void 0:r.details,i.details);this.loadPlaylist(o)}findTrackId(e){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const r=n[s];if(!(this.selectDefaultTrack&&!r.default)&&(!e||km(e,r,Op)))return s}if(e){const{name:s,lang:r,assocLang:i,characteristics:a,audioCodec:o,channels:l}=e;for(let u=0;u<n.length;u++){const d=n[u];if(km({name:s,lang:r,assocLang:i,characteristics:a,audioCodec:o,channels:l},d,Op))return u}for(let u=0;u<n.length;u++){const d=n[u];if(j2(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<n.length;u++){const d=n[u];if(j2(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&p5(n.url,this.hls)&&this.scheduleLoading(n,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const s=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,n),a=e.details,o=a==null?void 0:a.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${r}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger(H.AUDIO_TRACK_LOADING,{url:i,id:s,groupId:r,deliveryDirectives:n||null,track:e})}}class Jlt{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,n,s){if(this.queues===null||this.tracks===null)return;const r=this.queues[n];r.push(e),r.length===1&&!s&&this.executeNext(n)}appendBlocker(e){return new Promise(n=>{const s={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(n=>{if(this.queues){const s={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var n;const s=(n=e[0])==null?void 0:n.label;s==="async-blocker"||s==="async-blocker-prepend"?(e[0].execute(),e.splice(0,1)):s==="block-audio"&&e.splice(0,1)})}insertNext(e,n){this.queues!==null&&this.queues[n].splice(1,0,...e)}unblockAudio(){var e;this.queues!==null&&((e=this.current("audio"))==null?void 0:e.label)==="block-audio"&&this.shiftAndExecuteNext("audio")}audioBlocking(){return this.queues===null?!1:this.queues.audio.some(e=>e.label==="block-audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const n=this.queues[e];if(n.length){const r=n[0];try{r.execute()}catch(i){var s;if(r.onError(i),this.queues===null||this.tracks===null)return;const a=(s=this.tracks[e])==null?void 0:s.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var n;return((n=this.queues)==null?void 0:n[e][0])||null}toString(){const{queues:e,tracks:n}=this;return e===null||n===null?"<destroyed>":`
485${this.list("video")}
486${this.list("audio")}
487${this.list("audiovideo")}}`}list(e){var n,s;return(n=this.queues)!=null&&n[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var n;const s=(n=this.tracks)==null?void 0:n[e],r=s==null?void 0:s.buffer;return r?`SourceBuffer${r.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var n;return((n=this.queues)==null?void 0:n[e].map(s=>s.label).join(", "))||""}}const Ute=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Txe="HlsJsTrackRemovedError",ect=.25,tct=.001;
vendor: 4,469 bytes, line 487
487class nct extends Error{constructor(e){super(e),this.name=Txe}}class sct extends Oo{constructor(e,n){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null),this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0,this._quotaEvictionPending={},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&(!this.media||this.media.seeking||this.hls.pauseBuffering())},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:r,mediaSource:i}=this;s&&this.log("Media source opened"),!(!r||!i)&&(Xn(i,"sourceopen",this._onMediaSourceOpen),Xn(r,"emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(H.MEDIA_ATTACHED,{media:r,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{if(this.log("Media source closed"),this.media){const s=this.media.error,{appendError:r,appendErrors:i}=this;let a=!1;!r&&s&&(a=Math.max(++i.audio,++i.video,++i.audiovideo)>=this.hls.config.appendErrorMaxRetry);const o=new Error(`MediaSource closed while media attached${zte(a,s)}`);this.warn(o),this.hls.trigger(H.ERROR,ms({fatal:a},r,{type:_t.MEDIA_ERROR,details:pe.MEDIA_SOURCE_REQUIRES_RESET,error:o}))}},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:r}=this;s!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${s})`)},this._onMediaError=()=>{const{media:s}=this;if(s){var r,i;this.log(`Media error (code: ${(r=s.error)==null?void 0:r.code}): ${(i=s.error)==null?void 0:i.message}`)}},this.hls=e,this.fragmentTracker=n,this.appendSource=iat(Uh(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null,this._onMediaEmptied=this._onMediaError=null}registerListeners(){const{hls:e}=this;e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.BUFFER_RESET,this.onBufferReset,this),e.on(H.BUFFER_APPENDING,this.onBufferAppending,this),e.on(H.BUFFER_CODECS,this.onBufferCodecs,this),e.on(H.BUFFER_EOS,this.onBufferEos,this),e.on(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(H.FRAG_PARSED,this.onFragParsed,this),e.on(H.FRAG_CHANGED,this.onFragChanged,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.BUFFER_RESET,this.onBufferReset,this),e.off(H.BUFFER_APPENDING,this.onBufferAppending,this),e.off(H.BUFFER_CODECS,this.onBufferCodecs,this),e.off(H.BUFFER_EOS,this.onBufferEos,this),e.off(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(H.FRAG_PARSED,this.onFragParsed,this),e.off(H.FRAG_CHANGED,this.onFragChanged,this),e.off(H.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:n}=this;if(!e)return null;const s={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const a=this.isQueued();(i||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return r&&!this.sourceBufferCount&&r.mediaSource===n?ms(s,r.tracks):this.sourceBuffers.forEac
vendor: 25,695 bytes, lines 487-489
487h(i=>{const[a]=i;a&&(s[a]=ms({},this.tracks[a]),this.removeBuffer(a)),i[0]=i[1]=null}),{media:e,mediaSource:n,tracks:s}}initTracks(){const e={};this.resetAppendProgress(),this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null,this.resetAppendErrors(),this.resetAppendProgress()}onManifestParsed(e,n){var s;let r=2;(n.audio&&!n.video||!n.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,n){const s=this.media=n.media;this.transferData=this.overrides=void 0;const r=Uh(this.appendSource);if(r){const i=!!n.mediaSource;(i||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const a=this.mediaSource=n.mediaSource||new r;if(this.assignMediaSource(a),i)this._objectUrl=s.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Bte(s),rct(s,o),s.load()}catch{s.src=o}else s.src=o}ns(s,"emptied",this._onMediaEmptied),ns(s,"error",this._onMediaError),this.appendSource&&ns(s,"seeking",this._onStartStreaming)}}assignMediaSource(e){var n,s;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),ns(e,"sourceopen",this._onMediaSourceOpen),ns(e,"sourceended",this._onMediaSourceEnded),ns(e,"sourceclose",this._onMediaSourceClose),this.appendSource&&(ns(e,"startstreaming",this._onStartStreaming),ns(e,"endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,n=this.transferData;if(!n||!e)return;const s=this.tracks,r=n.tracks,i=r?Object.keys(r):null,a=i?i.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&i&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
488required tracks: ${Fs(s,(l,u)=>l==="initSegment"?void 0:u)};
489transfer tracks: ${Fs(r,(l,u)=>l==="initSegment"?void 0:u)}}`),!h1e(r,s)){n.mediaSource=null,n.tracks=void 0;const l=e.currentTime,u=this.details,d=Math.max(l,(u==null?void 0:u.fragments[0].start)||0);if(d-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${d}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(s)}") start time: ${d} currentTime: ${l}`),this.onMediaDetaching(H.MEDIA_DETACHING,{}),this.onMediaAttaching(H.MEDIA_ATTACHING,n),e.currentTime=d;return}this.transferData=void 0,i.forEach(l=>{const u=l,d=r[u];if(d){const f=d.buffer;if(f){const p=this.fragmentTracker,m=d.id;if(p.hasFragments(m)||p.hasParts(m)){const y=Bt.getBuffered(f);p.detectEvictedFragments(u,y,m,null,null,!0)}const v=GL(u),x=[u,f];this.sourceBuffers[v]=x,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,d)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const n=(e=this.mediaSource)==null?void 0:e.readyState;return n==="open"||n==="ended"}onMediaDetaching(e,n){const s=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:i,_objectUrl:a}=this;if(i){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=i.readyState==="open";try{const l=i.sourceBuffers;for(let u=l.length;u--;)o&&l[u].abort(),i.removeSourceBuffer(l[u]);o&&i.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}Xn(i,"sourceopen",this._onMediaSourceOpen),Xn(i,"sourceended",this._onMediaSourceEnded),Xn(i,"sourceclose",this._onMediaSourceClose),this.appendSource&&(Xn(i,"startstreaming",this._onStartStreaming),Xn(i,"endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(Xn(r,"emptied",this._onMediaEmptied),Xn(r,"error",this._onMediaError),Xn(r,"seeking",this._onStartStreaming),s||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&Bte(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var n;const s=(n=this.tracks[e])==null?void 0:n.buffer;if(this.removeBuffer(e),s)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(i){this.warn(`onBufferReset ${e}`,i)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[GL(e)]=[null,null];const n=this.tracks[e];n&&(this.clearBufferAppendTimeoutId(n),n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Jlt(this.tracks)}onBufferCodecs(e,n){var s;const r=this.tracks,i=Object.keys(n);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in n&&(r.audio||r.video)||r.audiovideo&&("audio"in n||"video"in n),o=!a&&this.sourceBufferCount&&this.media&&i.some(l=>!r[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${i}" SourceBuffers`);return}i.forEach(l=>{var u,d;const f=n[l],{id:p,codec:m,levelCodec:v,container:x,metadata:y,supplemental:S}=f;let _=r[l];const E=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[l],T=E!=null&&E.buffer?E:_,k=(T==null?void 0:T.pendingCodec)||(T==null?void 0:T.codec),R=T==null?void 0:T.levelCodec;_||(_=r[l]={buffer:void 0,listeners:[],codec:m,supplemental:S,container:x,levelCodec:v,metadata:y,id:p});const I=cT(k,R),A=I==null?void 0:I.replace(Ute,"$1");let L=cT(m,v);const j=(d=L)==null?void 0:d.replace(Ute,"$1");L&&I&&A!==j&&(l.slice(0,5)==="audio"&&(L=f5(L,this.appendSource)),this.log(`switching codec ${k} to ${L}`),L!==(_.pendingCodec||_.codec)&&(_.pendingCodec=L),_.container=x,this.appendChangeType(l,x,L))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!n.video&&((s=n.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,n)=>{const s=this.tracks[n];return e[n]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,n,s){const r=`${n};codecs=${s}`,i={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),a.codec=s,a.container=n)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var n;const s=e.start,r=s+e.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(s,vt.MAIN))==null?void 0:n.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o,l;(this.lastVideoAppendEnd>r||Bt.isBuffered((o=this.tracks.video)==null?void 0:o.buffer,r)||((l=this.fragmentTracker.getAppendedFrag(r,vt.MAIN))==null?void 0:l.gap)===!0)&&this.unblockAudio()},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.append(a,"audio",!0)}unblockAudio(){this.operationQueue&&this.operationQueue.unblockAudio()}onBufferAppending(e,n){const{tracks:s}=this,{data:r,type:i,parent:a,frag:o,part:l,chunkMeta:u,offset:d}=n,f=u.buffering[i],p=vr(o)&&!l&&!o.gap&&!u.partial&&!u.iframe;let m=null,v=!1;const{sn:x,cc:y}=o,S=self.performance.now();f.start=S;const _=o.stats.buffering,E=l?l.stats.buffering:null;_.start===0&&(_.start=S),(E==null?void 0:E.start)===0&&(E.start=S);const T=s.audio;let k=!1;i==="audio"&&(T==null?void 0:T.container)==="audio/mpeg"&&(k=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const R=s.video,I=R==null?void 0:R.buffer;if(I&&x!=="initSegment"&&d!==void 0){const j=T==null?void 0:T.buffer,F=l||o;if(i==="audio"&&a!=="main"&&!(R.ending||R.ended)&&j&&Bt.getBuffered(j).length){const M=F.start+F.duration*.05,U=Bt.getBuffered(I),G=this.currentOp("video");!U.length&&!G?this.blockAudio(F):!Bt.isBuffered(I,M)&&this.lastVideoAppendEnd<M&&this.blockAudio(F)}else if(i==="video"){const O=F.end,M=this.lastVideoAppendEnd-O;this.lastVideoAppendEnd=O,M<0||M>F.duration?this.unblockAudio():this.isAudioBlocked()&&this.executeNext("audio")}}const A=(l||o).start,L={label:`append-${i}`,execute:()=>{var j;f.executeStart=self.performance.now();const F=(j=this.tracks[i])==null?void 0:j.buffer;F&&(p&&(m=Bt.timeRangesToArray(Bt.getBuffered(F)),v=Hte(WL(m,o),o)),k?this.updateTimestampOffset(F,A,.1,i,x,y):d!==void 0&&at(d)&&this.updateTimestampOffset(F,d,1e-6,i,x,y)),this.appendExecutor(r,i)},onStart:()=>{},onComplete:()=>{this.clearBufferAppendTimeoutId(this.tracks[i]);const j=self.performance.now();f.executeEnd=f.end=j,_.first===0&&(_.first=j),(E==null?void 0:E.first)===0&&(E.first=j);const F={};if(this.sourceBuffers.forEach(([O,M])=>{O&&(F[O]=Bt.getBuffered(M))}),p){const O=this.getFragmentAppendProgress(o),M=F[i];if(M&&m){const U=Bt.timeRangesToArray(M),G=WL(U,o);O.progressed||(O.progressed=G-WL(m,o)>tct);const $=v&&Hte(G,o);O.fullyBuffered[i]=(O.fullyBuffered[i]===void 0||O.fullyBuffered[i])&&$}}this.hls.trigger(H.BUFFER_APPENDED,{type:i,frag:o,part:l,chunkMeta:u,parent:a,timeRanges:F})},onError:j=>{var F;this.clearBufferAppendTimeoutId(this.tracks[i]);const O=j.code===DOMException.QUOTA_EXCEEDED_ERR||j.name=="QuotaExceededError"||"quota"in j;if(O&&!this._quotaEvictionPending[i]){const $=this.getBackBufferEvictionTarget(i,r.byteLength,o.type);if($>0){this._quotaEvictionPending[i]=!0,this.log(`QuotaExceededError on "${i}" append sn: ${x} - evicting back buffer to ${$.toFixed(3)}s and retrying`);const V=this.getFlushOp(i,0,$),B=this.getClearEvictionPendingOp(i);this.insertNext([V,L,B],i);return}this.warn(`QuotaExceededError on "${i}" sn: ${x} - no back buffer available to evict`)}p&&(this.getFragmentAppendProgress(o).errored=!0);const M={type:_t.MEDIA_ERROR,parent:a,details:pe.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:o,part:l,chunkMeta:u,error:j,err:j,fatal:!1},U=(F=this.media)==null?void 0:F.error;if(j.name===Txe&&this.sourceBufferCount===0&&(!this.media||this.pendingTrackCount===0))M.errorAction=Cb(!0);else{var G;O&&(M.details=pe.BUFFER_FULL_ERROR);const $=++this.appendErrors[i],V=this.hls.config.appendErrorMaxRetry;this.warn(`Failed ${$}/${V+1} times to append segment in "${i}" sourceBuffer with error: ${j.message}`),$>=V&&(M.fatal=!O);const B=(G=this.mediaSource)==null?void 0:G.readyState;(B==="ended"||B==="closed"||U)&&(this.warn(`MediaSource readyState "${B}" during SourceBuffer${zte(M.fatal,U)}`),M.details=pe.MEDIA_SOURCE_REQUIRES_RESET)}this.appendError=M,this.hls.trigger(H.ERROR,M),O&&this.hls&&this.trimBuffers(o.start,1)}};this.log(`queuing "${i}" append sn: ${x}${l?" p: "+l.index:""} of ${a} playlist ${o.level} cc: ${y} offset: ${d} bytes: ${r.byteLength}`),this.append(L,i,this.isPending(this.tracks[i]))}getClearEvictionPendingOp(e){return{label:"clear",execute:()=>{this._quotaEvictionPending[e]=!1,this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:()=>{}}}getFlushOp(e,n,s){return this.log(`queuing "${e}" remove ${n}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,n,s)},onStart:()=>{},onComplete:()=>{var r;const i=(r=this.tracks[e])==null?void 0:r.buffer;this.log(`Remove request ${n}-${s} from ${e} Source Buffer complete > buffer: ${i?y5(Bt.getBuffered(i)):"(detached)"}`),this.hls.trigger(H.BUFFER_FLUSHED,{type:e,start:n,end:s})},onError:r=>{this.warn(`Failed to remove ${n}-${s} from "${e}" SourceBuffer`,r),this.hls.trigger(H.BUFFER_FLUSHED,{type:e,start:0,end:0,error:r})}}}onBufferFlushing(e,n){const{type:s,startOffset:r,endOffset:i}=n;(!s||s==="audio")&&this.unblockAudio(),s?this.append(this.getFlushOp(s,r,i),s):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,i),a)})}onFragParsed(e,n){const{frag:s,part:r,chunkMeta:i}=n,a=[],o=r?r.elementaryStreams:s.elementaryStreams;o[Is.AUDIOVIDEO]?a.push("audiovideo"):(o[Is.AUDIO]&&a.push("audio"),o[Is.VIDEO]&&a.push("video"));const l=()=>{const u=self.performance.now();s.stats.buffering.end=u,r&&(r.stats.buffering.end=u);const d=r?r.stats:s.stats;this.checkAppendProgress(s,r,i,a),this.hls&&(this.hls.trigger(H.FRAG_BUFFERED,{frag:s,part:r,stats:d,id:s.type,chunkMeta:i}),!r&&s.gap&&d.retry&&this.log(`Nothing buffered for ${s.type} level: ${s.level} sn: ${s.sn} retries ${d.retry}`))};a.length===0&&this.log(`Fragments must have at least one ElementaryStreamType set. ${s.type} ${s.level} ${r?`part: ${r.index} of `:""}sn: ${s.sn}`),this.blockBuffers(l,a).catch(u=>{this.warn(`Fragment buffered callback ${u.message}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,n){var s,r;const i=(s=this.hls)==null?void 0:s.config;if(!i)return;const{backBufferLength:a,frontBufferFlushThreshold:o}=i;this.trimBuffers(o,a,n.frag,n.previousFrag);const l=n.frag.elementaryStreams,{appendErrors:u}=this,d=(r=this.appendError)==null?void 0:r.sourceBufferName;Object.keys(l).forEach(f=>{l[f]&&(u[f]=0,f===d&&(this.appendError=void 0),f==="audio"||f==="video"?(u.audiovideo=0,d==="audiovideo"&&(this.appendError=void 0)):(u.audio=0,u.video=0,d!=="audiovideo"&&(this.appendError=void 0)))})}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const n=this.tracks[e];if(n)return!n.ended||n.ending}return!1})}onBufferEos(e,n){var s;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!n.type||n.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?(this.unblockAudio(),r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if((a==null?void 0:a.readyState)!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(H.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(H.BUFFERED_TO_END,void 0))):n.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const n=this.tracks[e];n&&(n.ending=!1)}})}onLevelUpdated(e,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,n){if(n.details===pe.BUFFER_APPEND_ERROR&&n.frag){var s;const r=(s=n.errorAction)==null?void 0:s.nextAutoLevel;at(r)&&r!==n.frag.level&&this.resetAppendErrors()}}getBackBufferEvictionTarget(e,n,s){const{media:r}=this;return r?this.fragmentTracker.getBackBufferEvictionEnd(r.currentTime,s,n):0}getFragmentAppendProgress(e){var n;const s=Vte(e);let r=this.fragmentAppendProgress[s];return((n=r)==null?void 0:n.stats)!==e.stats&&(r={stats:e.stats,progressed:!1,errored:!1,fullyBuffered:Object.create(null)},this.fragmentAppendProgress[s]=r),r}checkAppendProgress(e,n,s,r){if(n||!vr(e)||e.gap||s.iframe||s.partial)return;const i=Vte(e),a=this.fragmentAppendProgress[i];delete this.fragmentAppendProgress[i];const o=e.stats.buffering;if(o.start&&!o.first)return;const l=(a==null?void 0:a.stats)===e.stats?a:void 0;if(l!=null&&l.errored)return;const u=r.length>0&&r.every(m=>(l==null?void 0:l.fullyBuffered[m])===!0);if(l!=null&&l.progressed||u){delete this.appendsWithoutProgress[i];return}if(!l&&r.length===0)return;const d=(this.appendsWithoutProgress[i]||0)+1,f=this.hls;d>=f.config.appendErrorMaxRetry?delete this.appendsWithoutProgress[i]:this.appendsWithoutProgress[i]=d,this.warn(`Fragment ${e.sn} of ${e.type} playlist ${e.level} appended ${d} time${d>1?"s":""} without buffered range growth`),f.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_APPEND_NO_PROGRESS,fatal:!1,frag:e,chunkMeta:s,parent:e.type,appendsWithoutProgress:d,error:new Error(`Fragment append did not increase buffered coverage (${d})`)})}resetAppendProgress(){this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null)}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0}trimBuffers(e,n,s,r){const{hls:i,details:a,media:o}=this;if(!o||a===null||!this.sourceBufferCount)return;const l=i.config,u=o.currentTime,d=a.levelTargetDuration;n=a.live&&l.liveBackBufferLength!==null?l.liveBackBufferLength:n;let f=-1/0;if(at(n)&&n>=0){const p=Math.max(n,d);f=Math.floor(u/d)*d-p}if(s){const p=this.getLoopBackBufferFlushEnd(s,r??null);p>0&&(f=Math.max(f,p))}if(f>0&&this.flushBackBuffer(u,d,f),at(e)&&e>0){const p=Math.max(l.maxBufferLength,e),m=Math.max(p,d),v=Math.floor(u/d)*d+m;this.flushFrontBuffer(u,d,v)}}getLoopBackBufferFlushEnd(e,n){var s;const{media:r}=this;if(((s=this.hls)==null?void 0:s.config.loopBackBufferFlush)===!1||!(r!=null&&r.loop)||!n||e.level<=n.level)return 0;const{video:i,audiovideo:a}=e.elementaryStreams;if(i!=null&&i.partial||a!=null&&a.partial)return 0;const o=this.getEarliestElementaryStreamStart(e)-ect;return o<=0?0:(this.log(`Flushing lower quality back buffer for loop: level ${e.level}, range [0-${o.toFixed(3)}]`),o)}getEarliestElementaryStreamStart(e){const{audio:n,video:s,audiovideo:r}=e.elementaryStreams;let i=e.start;return r?i=Math.min(i,r.startDTS):(n&&(i=Math.min(i,n.startDTS)),s&&(i=Math.min(i,s.startDTS))),i}flushBackBuffer(e,n,s){this.sourceBuffers.forEach(([r,i])=>{if(i){const u=Bt.getBuffered(i);if(u.length>0&&s>u.start(0)){var a,o,l;this.hls.trigger(H.BACK_BUFFER_REACHED,{bufferEnd:s});const d=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(H.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(d!=null&&d.ended&&!((o=this.media)!=null&&o.loop&&((l=this.hls)==null?void 0:l.config.loopBackBufferFlush)!==!1)){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(H.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:r})}}})}flushFrontBuffer(e,n,s){this.sourceBuffers.forEach(([r,i])=>{if(i){const a=Bt.getBuffered(i),o=a.length;if(o<2)return;const l=a.start(o-1),u=a.end(o-1);if(s>l||e>=l&&e<=u)return;this.hls.trigger(H.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:n,mediaSource:s}=this;if(!n||!this.media||(s==null?void 0:s.readyState)!=="open")return null;const r=n.edge;if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&s.setLiveSeekableRange){const u=Math.max(0,n.fragmentStart),d=Math.max(u,r);return{duration:1/0,start:u,end:d}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return at(i)?{duration:i}:null;const a=this.media.duration,o=at(s.duration)?s.duration:0;return r>o&&r>a||!at(a)?{duration:r}:null}updateMediaSource({duration:e,start:n,end:s}){const r=this.mediaSource;!r||!this.media||r.readyState!=="open"||(r.duration!==e&&(at(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),n!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${n}-${s}.`),r.setLiveSeekableRange(n,s)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:n,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${e}) ${Fs(s)}`),this.tracksReady){var r;const i=(r=this.transferData)==null?void 0:r.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([n,s])=>{if(n){const r=this.tracks[n];e[n]={buffer:s,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(H.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:n,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const a=i,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),u=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${u})${this.currentOp(a)?" Queued":""} ${Fs(o)}`);try{const d=s.addSourceBuffer(u),f=GL(a),p=[a,d];n[f]=p,o.buffer=d}catch(d){var r;this.error(`error while trying to add sourceBuffer: ${d.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,sourceBufferName:a,mimeType:u,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}clearBufferAppendTimeoutId(e){e&&(self.clearTimeout(e.bufferAppendTimeoutId),e.bufferAppendTimeoutId=void 0)}getTrackCodec(e,n){const s=e.supplemental;let r=e.codec;s&&(n==="video"||n==="audiovideo")&&k2(s,"video")&&(r=Zat(r,s));const i=cT(r,e.levelCodec);return i?n.slice(0,5)==="audio"?f5(i,this.appendSource):i:""}trackSourceBuffer(e,n){const s=n.buffer;if(!s)return;const r=this.getTrackCodec(n,e);this.tracks[e]={buffer:s,codec:r,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(i,a)=>{const o=a.removedRanges;o!=null&&o.length&&(this.log(`${i} buffer removed ${y5(o)}`),this.hls.trigger(H.BUFFER_FLUSHED,{type:i,start:o.start(0),end:o.end(o.length-1)}))})}get mediaSrc(){var e,n;const s=((e=this.media)==null||(n=e.querySelector)==null?void 0:n.call(e,"source"))||this.media;return s==null?void 0:s.src}onSBUpdateStart(e){const n=this.currentOp(e);n&&n.onStart()}onSBUpdateEnd(e){var n,s;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(e);return}const r=this.currentOp(e);if(!r)return;if(r.onComplete(),(s=this.tracks[e])==null||(s=s.buffer)==null?void 0:s.updating){this.log(`${e} SourceBuffer updating on "updateend"`),this.blockUntilOpen(()=>{this.shiftAndExecuteNext(e)});return}this.shiftAndExecuteNext(e)}onSBUpdateError(e,n){var s;const r=(s=this.mediaSource)==null?void 0:s.readyState,i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${r}`);this.error(`${i.message}`,n),this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const a=this.currentOp(e);a&&a.onError(i)}updateTimestampOffset(e,n,s,r,i,a){const o=n-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${n} (sn: ${i} cc: ${a})`),e.timestampOffset=n)}removeExecutor(e,n,s){const{media:r,mediaSource:i}=this,a=this.tracks[e],o=a==null?void 0:a.buffer;if(!r||!i||!o)throw new Error(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`);const l=at(r.duration)?r.duration:1/0,u=at(i.duration)?i.duration:1/0,d=Math.max(0,n);if(d>=u){var f;(f=this.currentOp(e))==null||f.onComplete(),this.shiftAndExecuteNext(e);return}const p=Math.min(s,l,u);if(p>d&&(!a.ending||a.ended))a.ended=!1,this.log(`Removing [${d},${p}] from the ${e} SourceBuffer`),o.remove(d,p);else throw new Error(`Cannot remove ${p<=d?`invalid range (${d} >= ${p}) `:""}from the ${e} SourceBuffer${a.ending?" while track ending":""}`)}appendExecutor(e,n){const s=this.tracks[n],r=s==null?void 0:s.buffer;if(!r)throw new nct(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);if(s.ending=!1,s.ended=!1,this.hls.config.appendTimeout!==1/0){const i=this.calculateAppendTimeoutTime(r);s.bufferAppendTimeoutId=self.setTimeout(()=>this.appendTimeoutHandler(n,r,i),i)}r.appendBuffer(e)}appendTimeoutHandler(e,n,s){this.log(`Received timeout after ${s}ms for append on ${e} source buffer. Aborting and triggering error.`);try{n.abort()}catch{this.log(`Failed to abort append on ${e} source buffer after timeout.`)}const r=this.currentOp(e);r&&r.onError(new Error(`${e}-append-timeout`))}calculateAppendTimeoutTime(e){let n=q1e;this.details&&(n=this.details.levelTargetDuration);let s=2*n*1e3;if(this.media===null)return s;const r=Bt.bufferInfo(e,this.media.currentTime,0);return r.len?(s=Math.max(r.len*1e3,s),Math.max(this.hls.config.appendTimeout,s)):s}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}
489`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([e,n])=>e&&n.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}isAudioBlocked(){var e;return((e=this.currentOp("audio"))==null?void 0:e.label)==="block-audio"}isAudioBlocking(){return this.operationQueue?this.operationQueue.audioBlocking():!1}blockBuffers(e,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,i=n.length===2&&this.isAudioBlocking()?[this.appendBlocker("video")]:n.map(a=>this.appendBlocker(a));return Promise.all(i).then(a=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(n=>{var s;const r=(s=this.tracks[n])==null?void 0:s.buffer;!r||r.updating||n==="audio"&&this.isAudioBlocked()||this.shiftAndExecuteNext(n)})}append(e,n,s){this.operationQueue&&this.operationQueue.append(e,n,s)}insertNext(e,n){this.operationQueue&&this.operationQueue.insertNext(e,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,n)=>e+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[n])=>e+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,n,s){const r=this.tracks[e];if(!r)return;const i=r.buffer;if(!i)return;const a=s.bind(this,e);r.listeners.push({event:n,listener:a}),ns(i,n,a)}removeBufferListeners(e){const n=this.tracks[e];if(!n)return;const s=n.buffer;s&&(n.listeners.forEach(r=>{Xn(s,r.event,r.listener)}),n.listeners.length=0)}}function Bte(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(n=>{t.removeChild(n)})}function rct(t,e){const n=self.document.createElement("source");n.type="video/mp4",n.src=e,t.appendChild(n)}function GL(t){return t==="audio"?1:0}function zte(t,e){return`${t?"":" - triggering recovery"}${e?" with HTMLMediaElement Error: "+e.message:""}`}function Vte(t){return`${t.type}_${t.sn}_${t.level}`}function WL(t,e){const{start:n,end:s}=e;let r=0;for(let i=0;i<t.length;i++){const a=t[i];if(a.start>=s)break;const o=Math.max(n,a.start),l=Math.min(s,a.end);l>o&&(r+=l-o)}return r}function Hte(t,e){return e.duration-t<=.05}class aU{constructor(e){this.hls=null,this.autoLevelCapping=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.observer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.media=null,this.restrictedLevels=[],this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),(this.timer||this.observer)&&this.stopCapping(),this.media=this.clientRect=this.hls=null,this.streamController=void 0}registerListeners(){const{hls:e}=this;e&&(e.on(H.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(H.BUFFER_CODECS,this.onBufferCodecs,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this))}unregisterListener(){const{hls:e}=this;e&&(e.off(H.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(H.BUFFER_CODECS,this.onBufferCodecs,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this))}onFpsDropLevelCapping(e,n){if(!this.hls)return;const s=this.hls.levels[n.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,n){const s=n.media;this.clientRect=null,this.hls&&(s instanceof HTMLVideoElement?(this.media=s,this.hls.config.capLevelToPlayerSize&&this.observe()):this.media=null,(this.timer||this.observer)&&this.hls.levels.length>1&&this.detectPlayerSize())}onManifestParsed(e,n){this.restrictedLevels=[],n.video&&this.startCapping()}onLevelsUpdated(e,{levels:n}){(this.timer||this.observer)&&at(this.autoLevelCapping)?this.detectPlayerSize():this.observer===void 0&&this.timer===void 0&&n.length>1&&n.some(s=>!!s.videoCodec)&&this.startCapping()}
vendor: 7,952 bytes, line 489
489onBufferCodecs(e,n){n.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0||!this.hls){this.clientRect=null;return}const e=this.hls.levels;if(e.length>1){const n=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=s,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}else e.length===1&&this.stopCapping()}}getMaxLevel(e){if(!this.hls)return-1;const n=this.hls.levels;if(!n.length)return-1;const s=n.filter((r,i)=>this.isLevelAllowed(r)&&i<=e);return this.observer||(this.clientRect=null),aU.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}observe(){const e=self.ResizeObserver;e&&(this.observer=new e(n=>{var s;const r=(s=n[0])==null?void 0:s.contentRect;r&&(this.clientRect=r,this.detectPlayerSize())})),this.observer&&this.media&&this.observer.observe(this.media)}startCapping(){var e;this.timer||this.observer||!((e=this.hls)!=null&&e.config.capLevelToPlayerSize)||(self.clearInterval(this.timer),this.timer=void 0,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.observe(),this.observer||(this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3)),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,n={width:0,height:0};if(e){const s=e.getBoundingClientRect();n.width=s.width,n.height=s.height,!n.width&&!n.height&&(n.width=s.right-s.left||e.width||0,n.height=s.bottom-s.top||e.height||0)}return this.clientRect=n,n}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls)return e;const{ignoreDevicePixelRatio:n,maxDevicePixelRatio:s}=this.hls.config;if(!n)try{e=self.devicePixelRatio}catch{}return Math.min(e,s)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,n,s){if(!(e!=null&&e.length))return-1;const r=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let i=e.length-1;const a=Math.max(n,s);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&r(l,e[o+1])){i=o;break}}return i}}var eo=class r9{constructor(e,n){Array.isArray(e)&&(e=e.map(s=>s instanceof r9?s:new r9(s))),this.value=e,this.params=n}};const ict="Dict";function act(t){return Array.isArray(t)?JSON.stringify(t):t instanceof Map?"Map{}":t instanceof Set?"Set{}":typeof t=="object"?JSON.stringify(t):String(t)}function oct(t,e,n,s){return new Error(`failed to ${t} "${act(e)}" as ${n}`,{cause:s})}const Gte="Bare Item",lct="Boolean",cct="Byte Sequence",uct="Decimal",dct="Integer";function fct(t){return t<-999999999999999||999999999999999<t}const hct="String",pct=/[\x00-\x1f\x7f]+/;var kxe=class{constructor(t){this.description=t}};const mct="Token",gct="Key";function uu(t,e,n){return oct("serialize",t,e,n)}function vct(t){if(typeof t!="boolean")throw uu(t,lct);return t?"?1":"?0"}function xct(t){if(ArrayBuffer.isView(t)===!1)throw uu(t,cct);return`:${aat(t)}:`}function Rxe(t){if(fct(t))throw uu(t,dct);return t.toString()}function yct(t){return`@${Rxe(t.getTime()/1e3)}`}function bct(t){const e=p1e(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw uu(t,uct);const n=e.toString();return n.includes(".")?n:`${n}.0`}function Sct(t){if(pct.test(t))throw uu(t,hct);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function wct(t){return t.description||t.toString().slice(7,-1)}function Wte(t){const e=wct(t);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw uu(e,mct);return e}function i9(t){switch(typeof t){case"number":if(!at(t))throw uu(t,Gte);return Number.isInteger(t)?Rxe(t):bct(t);case"string":return Sct(t);case"symbol":return Wte(t);case"boolean":return vct(t);case"object":if(t instanceof Date)return yct(t);if(t instanceof Uint8Array)return xct(t);if(t instanceof kxe)return Wte(t);default:throw uu(t,Gte)}}function a9(t){if(/^[a-z*][a-z0-9\-_.*]*$/.test(t)===!1)throw uu(t,gct);return t}function oU(t){return t==null?"":Object.entries(t).map(([e,n])=>n===!0?`;${a9(e)}`:`;${a9(e)}=${i9(n)}`).join("")}function Axe(t){return t instanceof eo?`${i9(t.value)}${oU(t.params)}`:i9(t)}function _ct(t){return`(${t.value.map(Axe).join(" ")})${oU(t.params)}`}function Ect(t,e={whitespace:!0}){if(typeof t!="object"||t==null)throw uu(t,ict);const n=t instanceof Map?t.entries():Object.entries(t),s=e!=null&&e.whitespace?" ":"";return Array.from(n).map(([r,i])=>{i instanceof eo||(i=new eo(i));let a=a9(r);return i.value===!0?a+=oU(i.params):(a+="=",Array.isArray(i.value)?a+=_ct(i):a+=Axe(i)),a}).join(`,${s}`)}function Nxe(t,e){return Ect(t,e)}const Cct=["url"],Tct=["version","eventTargets","sid","transmissionMode"],kct=["customData","headers"],qte=t=>t instanceof eo?new eo(Math.round(t.value),t.params):Math.round(t),qL=t=>Array.isArray(t)?t.map(qte):qte(t),o9=(t,e)=>Array.isArray(t)?t.map(n=>o9(n,e)):t instanceof eo&&typeof t.value=="string"?new eo(o9(t.value,e),t.params):(e.baseUrl&&(t=uat(t,cat(e.baseUrl))),e.version===1?encodeURIComponent(t):t),Kte=t=>t instanceof eo?new eo(Math.round(t.value/100)*100,t.params):Math.round(t/100)*100,ME=t=>Array.isArray(t)?t.map(Kte):Kte(t),Rct=(t,e)=>{let n=t;return e.version>=2&&(t instanceof eo&&typeof t.value=="string"?n=new eo([t]):typeof t=="string"&&(n=[t])),o9(n,e)},Act={br:qL,d:qL,bl:ME,dl:ME,mtp:ME,nor:Rct,rtp:ME,tb:qL},P2=2,Ixe="bc",Nct="ps",Lxe="pr",Ict="e",Yte="t",Lct="c",jxe="b",lU="rr",Pxe="ce",DE={BITRATE_CHANGE:Ixe,ERROR:Ict,RESPONSE_RECEIVED:lU,CUSTOM_EVENT:Pxe},Mxe=new Map([[Nct,"sta"],[Lxe,"pr"],[Lct,"cid"],[jxe,"bg"],[Ixe,"br"]]),cU="event",uU="request",Dxe=["cen","e","h","ts"],Oxe=["ab","bg","bl","br","bs","bsa","bsd","bsda","cdn","cid","cs","d","dfa","dl","ec","lab","lb","ltc","msd","mtp","nor","nr","ot","pb","pr","pt","rtp","sf","sid","sn","st","sta","su","tab","tb","tbl","tpb","v"],jct=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function dU(t){return jct.test(t)}const Pct=new Set(Oxe);function $xe(t){return Pct.has(t)||dU(t)}const Fxe=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],Mct=new Set(Fxe);function Uxe(t){return Mct.has(t)}const Dct=new Set(Dxe);function Oct(t){return $xe(t)||Uxe(t)||Dct.has(t)}const $ct=new Set(["ab","bl","br","bsa","bsd","bsda","lab","lb","mtp","pb","tab","tb","tbl","tpb"]),OR=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"],Fct=new Set(OR);function Uct(t){return Fct.has(t)||dU(t)}const Bct=new Set(["ot","sf","st","e","sta"]);function zct(t){return Bct.has(t)}function Vct(t){return typeof t=="number"?at(t):t!=null&&t!==""&&t!==!1}const Hct={[cU]:Oct,[uU]:$xe};function Bxe(t,e){if(Array.isArray(t)){let n;return e&&(n=t.find(s=>{var r;return((r=s.params)==null?void 0:r.ot)===e})),n||(n=t[0]),Bxe(n)}return t instanceof eo?t.value:t}function Gct(t){const e={};for(const[s,r]of Object.entries(t)){if(r==null){e[s]=r;continue}if(s==="nor"){const i=(Array.isArray(r)?r:[r])[0];if(i instanceof eo){var n;e.nor=i.value,(n=i.params)!=null&&n.r&&(e.nrr=i.params.r)}else e.nor=i}else $ct.has(s)?e[s]=Bxe(r,t.ot):e[s]=r}return e}function zxe(t,e={}){const n={};if(t==null||typeof t!="object")return n;const s=e.version||t.v||P2,r=e.reportingMode||uU,i=s===1?Gct(t):t,a=s===1?Uct:Hct[r];let o=Object.keys(i).filter(a);i.e&&i.e!==lU&&(o=o.filter(m=>!Uxe(m)));const l=e.filter;typeof l=="function"&&(o=o.filter(l));const u=r===cU;if(u){const m=i.e;
489!o.includes("e")&&m!=null&&o.push("e"),o.includes("ts")||o.push("ts"),!o.includes("cen")&&i.cen!=null&&m===Pxe&&o.push("cen");const v=m?Mxe.get(m):void 0;v&&i[v]!=null&&!o.includes(v)&&o.push(v)}if(o.length===0)return n;s>1&&!o.includes("v")&&o.push("v");const d={version:s,reportingMode:r,baseUrl:e.baseUrl};o.sort();for(const m of o){var f,p;let v=i[m];const x=(f=(p=e.formatters)==null?void 0:p[m])!=null?f:Act[m];if(typeof x=="function"&&(v=x(v,d)),m==="v"){if(s===1)continue;v=s}if(m==="pr"&&v===1&&!(u&&i.e===Lxe))continue;u&&m==="ts"&&!at(v)&&(v=Date.now());const y=u&&v===!1&&m==="bg"&&i.e===jxe;!Vct(v)&&!y||(zct(m)&&typeof v=="string"&&(v=new kxe(v)),n[m]=v)}return n}const Fu="CMCD-Object",Va="CMCD-Request",Jg="CMCD-Session",kl="CMCD-Status",Wct={REQUEST:Va},qct={ab:Fu,br:Fu,d:Fu,lab:Fu,lb:Fu,ot:Fu,tab:Fu,tb:Fu,tpb:Fu,bl:Va,cs:Va,dfa:Va,dl:Va,ltc:Va,mtp:Va,nor:Va,nrr:Va,pb:Va,sn:Va,sta:Va,su:Va,tbl:Va,cid:Jg,msd:Jg,sf:Jg,sid:Jg,st:Jg,v:Jg,bg:kl,bs:kl,bsa:kl,bsd:kl,bsda:kl,cdn:kl,ec:kl,nr:kl,pr:kl,pt:kl,rtp:kl};function Kct(t){return Object.keys(t).reduce((e,n)=>{var s;return(s=t[n])==null||s.forEach(r=>e[r]=n),e},{})}function Yct(t,e){const n={};if(!t)return n;const s=Object.keys(t),r=e?Kct(e):{};for(const a of s){var i;const o=qct[a]||r[a]||Wct.REQUEST,l=(i=n[o])!=null?i:n[o]={};l[a]=t[a]}return n}function Zct(t,e){const n={},s=Yct(t,e);for(const[r,i]of Object.entries(s)){const a=Nxe(i,{whitespace:!1});a&&(n[r]=a)}return n}const Zte="CMCD";function Vxe(t){return Nxe(t,{whitespace:!1})}function Xct(t,e={}){return t?Vxe(zxe(t,e)):""}const Qct=30,l9=[...OR,...Oxe,...Fxe,...Dxe].filter((t,e,n)=>n.indexOf(t)===e),Jct="application/cmcd",eut=1,Li={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",
489KEY:"k",OTHER:"o"},Rl={STARTING:"s",PLAYING:"p",SEEKING:"k",REBUFFERING:"r",PAUSED:"a",ENDED:"e",FATAL_ERROR:"f",PRELOADING:"d"},fU="query",Hxe="headers";function Xte(t,e,n){var s;const r=new Set((s=e.enabledKeys)!=null?s:[]);return{version:e.version||P2,reportingMode:t,filter:i=>r.has(i),baseUrl:n}}function tut(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){const s=t[n],r=e[n];if(s===r)continue;if(typeof s=="number"||typeof r=="number"||s.value!==r.value)return!1;const i=s.params,a=r.params,o=i&&Object.keys(i)[0],l=a&&Object.keys(a)[0];if(o!==l||o!==void 0&&l!==void 0&&i&&a&&i[o]!==a[l])return!1}return!0}const nut=Object.is,sut=t=>t,Gxe=Array.from(Mxe,([t,e])=>e==="br"?{event:t,field:e,equal:(n,s)=>n===void 0||s===void 0?n===s:tut(n,s),snapshot:n=>n.slice()}:{event:t,field:e,equal:nut,snapshot:sut}),rut=new Map(Gxe.map(t=>[t.event,t]));function iut(t){const{url:e}=t,n=PR(t,Cct);return fetch(e,n)}function aut(t){const{version:e=P2,eventTargets:n=[],sid:s=m1e(),transmissionMode:r=fU}=t,i=PR(t,Tct);return Rt(Rt({},i),{},{version:e,transmissionMode:r,sid:s,eventTargets:n.reduce((a,o)=>{var l,u,d;return o!=null&&o.url&&(l=o.events)!=null&&l.length&&a.push({version:o.version||P2,enabledKeys:((u=o.enabledKeys)==null?void 0:u.slice())||[],url:o.url,events:o.events.slice(),interval:(d=o.interval)!=null?d:Qct,batchSize:o.batchSize||1}),a},[])})}var out=class{constructor(t,e=iut){var n;this.timeOrigin=performance.timeOrigin||((n=performance.timing)==null?void 0:n.fetchStart)||Date.now()-performance.now(),this.data={},this.msd=NaN,this.eventTargets=new Map,this.lastEmitted={},this.requestTarget={sn:0,msdSent:!1},this.config=aut(t),this.data={cid:this.config.cid,sid:this.config.sid,v:this.config.version},this.requester=e;for(const s of this.config.eventTargets)this.eventTargets.set(s,{intervalId:void 0,sn:0,msdSent:!1,queue:[]})}start(){this.eventTargets.forEach((t,e)=>{if(this.disarmInterval(t),e.interval===0||!e.events.includes(Yte))return;const n=()=>{this.recordTargetEvent(t,e,Yte),this.processEventTargets()};t.intervalId=setInterval(n,e.interval*1e3),n()})}stop(t=!1){t&&this.flush(),this.eventTargets.forEach(e=>{this.disarmInterval(e)})}flush(){this.processEventTargets(!0)}update(t){t.sid&&t.sid!==this.data.sid&&this.resetSession(),t.msd&&!isNaN(t.msd)&&(this.msd=t.msd),this.data=Rt(Rt(Rt({},this.data),t),{},{msd:void 0});for(const e of Gxe)e.field in t&&!e.equal(this.data[e.field],this.lastEmitted[e.field])&&this.recordEvent(e.event)}recordEvent(t,e={}){const n=rut.get(t);if(n){const s=n.field,r=e[s];r!==void 0&&ms(this.data,{[s]:r});const i=this.data[s];if(i===void 0||n.equal(i,this.lastEmitted[s]))return;ms(this.lastEmitted,{[s]:n.snapshot(i)})}this.eventTargets.forEach((s,r)=>{this.recordTargetEvent(s,r,t,e)}),this.processEventTargets()}recordTargetEvent(t,e,n,s={}){var r;if(!e.events.includes(n))return;const i=Rt(Rt(Rt({},this.data),s),{},{e:n,ts:(r=s.ts)!=null?r:Date.now(),sn:t.sn++});!isNaN(this.msd)&&!t.msdSent&&(i.msd=this.msd,t.msdSent=!0),t.queue.push(i)}recordResponseReceived(t,e={}){var n,s,r;const{request:i}=t,a=(n=e.url)!=null?n:i==null?void 0:i.url;if(!a)return;const o=new URL(a);o.searchParams.delete(Zte);const l={url:o.toString(),rc:t.status},u=t.resourceTiming;u&&(u.startTime!=null&&(l.ts=Math.round(this.timeOrigin+u.startTime),u.responseStart!=null&&(l.ttfb=Math.round(u.responseStart-u.startTime))),u.duration!=null&&(l.ttlb=Math.round(u.duration)));const d=(s=(r=i.customData)==null?void 0:r.cmcd)!=null?s:{};this.recordEvent(lU,Rt(Rt(Rt({},d),l),e))}applyRequestReport(t){var e;return(e=this.createRequestReport(t))!=null?e:t}isRequestReportingEnabled(){var t;return!!((t=this.config.enabledKeys)!=null&&t.length)}createRequestReport(t,e){var n;const{customData:s={},headers:r={}}=t,i=PR(t,kct),a=Rt(Rt({},i),{},{headers:Rt({},r),customData:Rt(Rt({},s),{},{cmcd:{}})});if(!((n=this.config.enabledKeys)!=null&&n.length)||!a.url)return a;const o=new URL(a.url),l=Rt(Rt(Rt({},this.data),e),{},{sn:this.requestTarget.sn++}),u=Xte(uU,this.config,a.url);!isNaN(this.msd)&&!this.requestTarget.msdSent&&(l.msd=this.msd,this.requestTarget.msdSent=!0);const d=a.customData.cmcd=zxe(l,u);switch(this.config.transmissionMode){case fU:const f=Vxe(d);f&&(o.searchParams.set(Zte,f),a.url=o.toString());break;
489case Hxe:ms(a.headers,Zct(d,u.customHeaderMap));break}return a}processEventTargets(t=!1){let e=!1;this.eventTargets.forEach((n,s)=>{const{queue:r}=n;if(!r.length||r.length<s.batchSize&&!t)return;const i=t?r.length:s.batchSize,a=r.splice(0,i);this.sendEventReport(s,a).catch(()=>{n.queue.unshift(...a)}),e||(e=r.length>0)}),e&&this.processEventTargets()}async sendEventReport(t,e){const n=Xte(cU,t),{status:s}=await this.requester({url:t.url,method:"POST",headers:{"Content-Type":Jct},body:e.map(r=>Xct(r,n)).join(`
490`)+`
491`});if(s===410)this.disposeEventTarget(t);else if(s===429||s>499&&s<600)throw new Error(`Event report failed with status ${s}`)}disarmInterval(t){clearInterval(t.intervalId),t.intervalId=void 0}disposeEventTarget(t){const e=this.eventTargets.get(t);e&&(this.disarmInterval(e),this.eventTargets.delete(t))}resetSession(){this.eventTargets.forEach(t=>t.sn=0),this.requestTarget.sn=0,this.lastEmitted={}}};const lut={HLS:"h"},KL={VOD:"v",LIVE:"l",LOW_LATENCY:"ll"};function cut(t,e){return new eo(t,e)}new Set(OR);new Set(l9);const uut=["includeKeys"];function Qte(t){return Object.keys(t).every(dU)}class dut{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.playerState=void 0,this.reporter=void 0,this.playheadLevel=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0,this.setPlayerState(Rl.REBUFFERING)),this.buffering=!0},this.onPlay=()=>{this.initialized||this.setPlayerState(Rl.STARTING)},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1,this.setPlayerState(Rl.PLAYING)},this.onPause=()=>{this.media&&!this.media.ended&&this.setPlayerState(Rl.PAUSED)},this.onSeeking=()=>{this.initialized&&this.setPlayerState(Rl.SEEKING)},this.onSeeked=()=>{var r;this.initialized&&(r=this.media)!=null&&r.paused&&this.setPlayerState(Rl.PAUSED)},this.onRateChange=()=>{this.reporter&&this.media&&this.reporter.update({pr:this.media.playbackRate})},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Li.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=r=>{try{const{frag:o,part:l}=r,u=this.hls.levels[o.level],d=this.getObjectType(o,u),f={d:(l||o).duration*1e3,ot:d};if(d===Li.VIDEO||d===Li.AUDIO||d===Li.MUXED||d==null&&(o.type==="main"||o.type==="audio")){var i;const m=u.bitrate/1e3;f.br=[m];const{cmcd:v}=this.config,x=(i=v==null?void 0:v.rtpSafetyFactor)!=null?i:5;if(f.rtp=Math.round(m*x/100)*100,d===Li.MUXED||d==null&&o.type==="main"){const _=this.getTopBandwidth()/1e3;at(_)&&(f.tb=[_]);const E=this.getLowestBandwidth()/1e3;at(E)&&(f.lb=[E])}const y=this.getBufferLength(o);if(at(y)){var a;f.bl=[y];const _=((a=this.media)==null?void 0:a.playbackRate)||1;f.dl=Math.round(y/_/100)*100}this.playheadLevel&&(f.pb=[this.playheadLevel.bitrate/1e3]);const S=this.hls.maxAutoLevel;if(S>=0){const _=this.hls.levels[S];_&&(f.tpb=[_.bitrate/1e3])}}const p=l?this.getNextPart(l):this.getNextFrag(o);p!=null&&p.url&&p.url!==o.url&&(p.byteRange.length>0?f.nor=[cut(p.url,{r:`${p.byteRange[0]}-${p.byteRange[1]}`})]:f.nor=[p.url]),this.apply(r,f)}catch(o){this.hls.logger.warn("Could not generate segment CMCD data.",o)}},this.recordFragmentResponse=(r,i,a)=>{var o;const{cmcd:l}=this.config,u=l==null||(o=l.eventTargets)==null?void 0:o.some(d=>{var f;return(f=d.events)==null?void 0:f.includes(DE.RESPONSE_RECEIVED)});if(!(!this.reporter||!(a.loading.first>0)||!u))try{this.reporter.recordResponseReceived({request:{url:r},status:i.code,resourceTiming:{startTime:a.loading.start,responseStart:a.loading.first,duration:a.loading.end-a.loading.start,encodedBodySize:a.total}})}catch(d){this.hls.logger.warn("Could not record fragment response CMCD data.",d)}},this.hls=e;const n=this.config=e.config,{cmcd:s}=n;s!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.registerListeners())}createReporter(){var e,n;const{cmcd:s}=this.config;if(s==null)return;const r=s.version||eut;if(this.reporter=new out({sid:s.sessionId||this.hls.sessionId,cid:s.contentId,version:r,transmissionMode:s.useHeaders===!0?Hxe:fU,enabledKeys:(e=s.includeKeys)!=null?e:[...r>=P2?l9:OR],eventTargets:((n=s.eventTargets)!=null?n:[]).map(i=>{let{includeKeys:a}=i,o=PR(i,uut);return Rt(Rt({},o),{},{enabledKeys:a??l9})})},s.loader),this.reporter.update({sf:lut.HLS,sta:this.playerState}),s.reporterCallback){const i=this.reporter,a={updateCustomData:o=>{Qte(o)&&i.update(o)}
491,recordCustomEvent:(o,l={})=>{Qte(l)&&i.recordEvent(DE.CUSTOM_EVENT,Rt({cen:o},l))}};s.reporterCallback(a)}this.reporter.start()}registerListeners(){const e=this.hls;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MEDIA_DETACHED,this.onMediaDetached,this),e.on(H.MEDIA_ENDED,this.onMediaEnded,this),e.on(H.ERROR,this.onError,this),e.on(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(H.LEVEL_SWITCHED,this.onLevelSwitched,this),e.on(H.BUFFER_APPENDED,this.onBufferInfoChange,this),e.on(H.BUFFER_FLUSHED,this.onBufferInfoChange,this)}unregisterListeners(){const e=this.hls;e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MEDIA_DETACHED,this.onMediaDetached,this),e.off(H.MEDIA_ENDED,this.onMediaEnded,this),e.off(H.ERROR,this.onError,this),e.off(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(H.LEVEL_SWITCHED,this.onLevelSwitched,this),e.off(H.BUFFER_APPENDED,this.onBufferInfoChange,this),e.off(H.BUFFER_FLUSHED,this.onBufferInfoChange,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.hls=this.config=null,this.onWaiting=this.onPlay=this.onPlaying=this.onPause=null,this.onSeeking=this.onSeeked=this.onRateChange=this.media=null}onMediaAttaching(e,n){const s=this.media=n.media;this.setPlayerState(this.media.autoplay?Rl.STARTING:Rl.PRELOADING),ns(s,"waiting",this.onWaiting),ns(s,"play",this.onPlay),ns(s,"playing",this.onPlaying),ns(s,"pause",this.onPause),ns(s,"seeking",this.onSeeking),ns(s,"seeked",this.onSeeked),ns(s,"ratechange",this.onRateChange)}onMediaDetached(){const e=this.media;e&&(Xn(e,"waiting",this.onWaiting),Xn(e,"play",this.onPlay),Xn(e,"playing",this.onPlaying),Xn(e,"pause",this.onPause),Xn(e,"seeking",this.onSeeking),Xn(e,"seeked",this.onSeeked),Xn(e,"ratechange",this.onRateChange),this.media=null)}onMediaEnded(e,n){this.setPlayerState(Rl.ENDED)}onManifestLoading(e,n){this.initialized=!1,this.starved=!1,this.buffering=!0,this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.createReporter(),this.media||this.setPlayerState(Rl.PRELOADING)}onError(e,n){n.fatal&&(this.setPlayerState(Rl.FATAL_ERROR),this.reporter&&this.reporter.recordEvent(DE.ERROR,{ec:[n.details]}))}onLevelSwitching(e,n){var s;if(!this.reporter)return;const r={br:[n.bitrate/1e3]},i=(s=n.details)==null?void 0:s.fragments[0];i&&(r.ot=this.getObjectType(i,n)),this.reporter.recordEvent(DE.BITRATE_CHANGE,r)}onLevelSwitched(e,n){const s=this.hls.levels[n.level];s&&(this.playheadLevel=s)}setPlayerState(e){this.playerState=e,this.reporter&&this.reporter.update({sta:e})}getStreamType(){const e=this.hls.latestLevelDetails;if(e)return e.live?e.partList&&e.canBlockReload?KL.LOW_LATENCY:KL.LIVE:KL.VOD}apply(e,n={}){var s;if(!this.reporter)return;this.reporter.update({mtp:[this.hls.bandwidthEstimate/1e3],pr:(s=this.media)==null?void 0:s.playbackRate,st:this.getStreamType()});const r=n.ot===Li.INIT||n.ot===Li.VIDEO||n.ot===Li.MUXED;this.starved&&r&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const i=this.reporter.createRequestReport({url:e.url,headers:e.headers},n);e.url=i.url,e.headers=i.headers}getNextFrag(e){var n;const s=(n=this.hls.levels[e.level])==null?void 0:n.details;if(s){const r=e.sn-s.startSN;return s.fragments[r+1]}}getNextPart(e){var n;const{index:s,fragment:r}=e,i=(n=this.hls.levels[r.level])==null||(n=n.details)==null?void 0:n.partList;if(i){const{sn:a}=r;for(let o=i.length-1;o>=0;o--){const l=i[o];if(l.index===s&&l.fragment.sn===a)return i[o+1]}}}getObjectType(e,n){const{type:s}=e;if(s==="subtitle")return Li.TIMED_TEXT;if(e.sn==="initSegment")return Li.INIT;if(s==="audio")return Li.AUDIO;if(s==="main"){if(e.hasStreams){const r=e.elementaryStreams;if(r.audiovideo)return Li.MUXED;if(r.video)return Li.VIDEO;if(r.audio)return Li.AUDIO}if(n){const{audioCodec:r,videoCodec:i}=n;if(!this.hls.audioTracks.length){if(r&&i)return Li.MUXED;if(r)return Li.AUDIO}if(i)return Li.VIDEO}}}getTopBandwidth(){let e=0;const n=this.hls,s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;return n.levels.slice(0,r).forEach(a=>{a.bitrate>e&&(e=a.bitrate)}),e>0?e:NaN}getLowestBandwidth(){let e=1/0;const n=this.hls,s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;return n.levels.slice(0,r).forEach(a=>{a.bitrate<e&&(e=a.bitrate)}),at(e)?e:NaN}getBufferLength(e){if(!this.media)return NaN;const n=e.type==="audio"?this.hls.audioForwardBufferInfo:this.hls.mainForwardBufferInfo;return n?n.len*1e3:NaN}getEventBufferLength(){if(!this.media)return NaN;const e=this.hls.mainForwardBufferInfo,n=this.hls.audioForwardBufferInfo;if(e&&n)return Math.min(e.len,n.len)*1e3;const s=e||n;return s?s.len*1e3:NaN}onBufferInfoChange(e,n){if(!this.reporter)return;const s=this.getEventBufferLength();at(s)&&this.reporter.update({bl:[s]})}createPlaylistLoader(){const{pLoader:e}=this.config,n=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new s(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,a,o){n(i),this.loader.load(i,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,n=this.applyFragmentData,s=this.recordFragmentResponse,r=e||this.config.loader;return class{constructor(a){this.loader=void 0,this.loader=new r(a)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(a,o,l){n(a);const{onSuccess:u}=l;this.loader.load(a,o,Rt(Rt({},l),{},{onSuccess:(d,f,p,m)=>
vendor: 4,342 bytes, line 491
491{u(d,f,p,m),s(a.url,d,f)}}))}}}}const fut=3e5;class hut extends Oo{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,n)=>(e.indexOf(n.pathwayId)===-1&&e.push(n.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const n=this.levels;n&&(this.levels=n.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,n){const{contentSteering:s}=n;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(e,n){const{errorAction:s}=n;if((s==null?void 0:s.action)===Oi.SendAlternateToPenaltyBox&&s.flags&pi.MoveAllAlternatesMatchingHost){const r=this.levels;let i=this._pathwayPriority,a=this.pathwayId;if(n.context){const{groupId:o,pathwayId:l,type:u}=n.context;o&&r?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!i&&r&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),s.resolved=this.pathwayId!==a,!s.resolved&&(n.details!==pe.BUFFER_APPEND_ERROR||n.fatal)&&this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${Fs(i)} penalized: ${Fs(this.penalizedPathways)}`))}}filterParsedLevels(e){this.levels=e;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),n=this.getLevelsForPathway(s),this.pathwayId=s}return n.length!==e.length&&this.log(`Found ${n.length}/${e.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(n=>e===n.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let n;const s=this.penalizedPathways,r=performance.now();Object.keys(s).forEach(i=>{r-s[i]>fut&&delete s[i]});for(let i=0;i<e.length;i++){const a=e[i];if(a in s)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(n=this.getLevelsForPathway(a),n.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,rxe(n),this.hls.trigger(H.LEVELS_UPDATED,{levels:n});const u=this.hls.levels[o];l&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,n,s){const r=this.getLevelsForPathway(s).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(n===hn.AUDIO_TRACK&&r[i].hasAudioGroup(e)||n===hn.SUBTITLE_TRACK&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return s}clonePathways(e){const n=this.levels;if(!n)return;const s={},r={};e.forEach(i=>
491{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=i;if(n.some(d=>d.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(d=>{const f=new lr(d.attrs);f["PATHWAY-ID"]=a;const p=f.AUDIO&&`${f.AUDIO}_clone_${a}`,m=f.SUBTITLES&&`${f.SUBTITLES}_clone_${a}`;p&&(s[f.AUDIO]=p,f.AUDIO=p),m&&(r[f.SUBTITLES]=m,f.SUBTITLES=m);const v=Wxe(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),x=new A2({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:v,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let y=1;y<d.audioGroups.length;y++)x.addGroupId("audio",`${d.audioGroups[y]}_clone_${a}`);if(d.subtitleGroups)for(let y=1;y<d.subtitleGroups.length;y++)x.addGroupId("text",`${d.subtitleGroups[y]}_clone_${a}`);return x});n.push(...u),Jte(this.audioTracks,s,l,a),Jte(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const n=this.hls.config,s=n.loader;this.loader&&this.loader.destroy(),this.loader=new s(n);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;vh(r,"_HLS_pathway",this.pathwayId),vh(r,"_HLS_throughput",""+d)}const i={type:hn.STEERING_MANIFEST,responseType:"json",url:r.href},a=n.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(d,f,p,m)=>{this.log(`Loaded steering manifest: "${r}"`);const v=d.data;if((v==null?void 0:v.VERSION)!==1){this.log(`Steering VERSION ${v.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=v.TTL;const{"RELOAD-URI":x,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":S}=v;if(x)try{this.uri=new self.URL(x,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${x}`);return}this.scheduleRefresh(this.uri||p.url),y&&this.clonePathways(y);const _={steeringManifest:v,url:r.toString()};this.hls.trigger(H.STEERING_MANIFEST_LOADED,_),S&&this.updatePathwayPriority(S)},onError:(d,f,p,m)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${f.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let v=this.timeToLoad*1e3;if(d.code===429){const x=this.loader;if(typeof(x==null?void 0:x.getResponseHeader)=="function"){const y=x.getResponseHeader("Retry-After");y&&(v=parseFloat(y)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,v)},onTimeout:(d,f,p)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,l,u)}scheduleRefresh(e,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const r=(s=this.hls)==null?void 0:s.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},n)}}function Jte(t,e,n,s){t&&Object.keys(e).forEach(r=>{const i=t.filter(a=>a.groupId===r).map(a=>{const o=ms({},a);return o.details=void 0,o.attrs=new lr(o.attrs),o.url=o.attrs.URI=Wxe(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=s,o});t.push(...i)})}function Wxe(t,e,n,s){if(e){const{[n]:o}=s;if(o){const l=o[e];if(l)return l}}const{HOST:r,PARAMS:i}=s,a=new self.URL(t);return r&&(a.hostname=r),i&&Object.keys(i).sort().forEach(o=>{o&&vh(a,o,i[o])}),a.href}class Ll extends Error{constructor(e,n){super(n),this.data=void 0,e.error||(e.error=new Error(n)),this.data=e,e.err=e.error}}class hv extends Oo{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this.sessionSetupByUri={},this.mediaKeySessions=[],this.activeKeys={},this.mediaKeys=null,this.setMediaKeysQueue=hv.CDMCleanupPromise?[hv.CDMCleanupPromise]:[],this.onMediaEncrypted=n=>{const{initDataType:s,initData:r}=n,i=`"${n.type}" event: init data type: "${s}"`;if(this.log(i),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=py(this.config));const o=a.map(FL).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{let o;const l=LE(a),u=this.activeLevelKeys();if(l===Qs.FAIRPLAY&&s==="sinf")try{const v=ic(new Uint8Array(r)),x=GF(JSON.parse(v).sinf),y=T1e(x);if(!y)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=new Uint8Array(y.subarray(8,24))}catch(v){this.warn(`${i} Failed to parse sinf: ${v}`);return}else if(l===Qs.PLAYREADY)o=QF(new Uint8Array(r));else if(l===Qs.WIDEVINE){const v=N1e(r).filter(x=>x.systemId===Z1e.WIDEVINE);if(v.length){var d;const x=v[0];o=(d=x.kids)!=null&&d.length?x.kids[0]:null}}let f;if(o){const v=Zr(o);for(let x=0;x<u.length;x++){const y=u[x];if(y.keyId&&(g5(o,y.keyId)||y.uri.replace(/-/g,"").indexOf(v)!==-1)){y.pssh||(y.scheme=s,y.pssh=new Uint8Array(r),y.keyId=o,wd.setKeyIdForUri(y.uri,o)),f=this.getSessionForKey(y,"encrypted-event-key-match");break}}}if(!f){if(u.length){var p,m;return(p=u[0]).scheme||(p.scheme=s),(m=u[0]).pssh||(m.pssh=new Uint8Array(r)),this.get
491SessionForKey(u[0],"encrypted-event-no-match")}if(o)throw new Error(`Key ID ${Zr(o)} not encountered in playlist`);this.log(`Ignoring "${n.type}" event - could not determine keyId`)}return f}).catch(a=>this.handleError(a))}},this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){const{hls:e}=this;e&&(e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHED,this.onMediaDetached,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.DESTROYING,this.onDestroying,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHED,this.onMediaDetached,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.DESTROYING,this.onDestroying,this))}attemptKeySystemAccess(e){if(!this.hls)return Promise.reject(new Error("destroyed"));const n=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,r=n.map(a=>a.audioCodec).filter(s),i=n.map(a=>a.videoCodec).filter(s);return r.length+i.length===0&&i.push("avc1.42e01e"),new Promise((a,o)=>{const l=u=>{const d=u.shift();this.getMediaKeysPromise(d,r,i).then(f=>a({keySystem:d,mediaKeys:f})).catch(f=>{u.length?l(u):f instanceof Ll?o(f):o(new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};l(e)})}requestMediaKeySystemAccess(e,n){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${s}`;return X1e===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return s(e,n)}getMediaKeysPromise(e,n,s){var r;const i=Mot(e,n,s,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(r=a)==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Fs(i)}`),o=this.requestMediaKeySystemAccess(e,i);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.throwIfDestroyed(),this.log(`Access for key-system "${u.keySystem}" obtained`);const d=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const f=l.mediaKeys=u.createMediaKeys().then(p=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,d.then(m=>m?this.setMediaKeysServerCertificate(p,e,m):p)));return f.catch(p=>{this.error(`Failed to create media-keys for "${e}"}: ${p}`)}),f})}return o.then(()=>a.mediaKeys)}getMediaKeySessionContext(e,n,s,r){const{mediaKeySessions:i}=this,a=` key-session "${e}" keyId: ${Zr(s.keyId||[])} keyUri: ${s.uri} for "${r}"`;for(let u=0;u<i.length;u++){const d=i[u];if(!d.initialized&&d.createdFor.levelKey.uri===s.uri)return this.log(`Reusing${a}`),d}this.log(`Creating${a}`);const o=n.createSession(),l={keySystem:e,mediaKeys:n,mediaKeysSession:o,keyRequests:{},keyStatuses:{},createdFor:{levelKey:s,reason:r},initialized:!1};return i.push(l),l}resetMediaKeys(){var e;const n=(e=this.mediaKeySessions[0])==null?void 0:e.keySystem,s=this.keySystemAccessPromises[n];s&&(this.log("reset mediaKeys"),this.mediaKeys=null,s.hasMediaKeys=!1,delete s.mediaKeys,delete this.keySystemAccessPromises[n])}updateKeySession(e,n,s){const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyId ${Zr(n.keyId||[])}
492      } (data length: ${s.byteLength})`),r.update(s)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>FL(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n,mediaKeys:s})=>this.attemptSetMediaKeys(n,s))}selectKeySystem(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const s=FL(n);if(!s)throw new Error(`Unable to find format for key-system "${n}"`);return s})}selectKeySystemFormat(e){const n=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(e){const n=py(this.config),s=e.map(LE).filter(r=>!!r&&n.indexOf(r)!==-1);return this.selectKeySystem(s)}loadClear(e,n,s){if(this.config.emeEnabled&&!this.getSelectedKeySystemFormats().length){if(n.length)for(let r=0,i=n.length;r<i;r++){const a=n[r];if(e.cc<=a.cc&&(!vr(e)||!vr(a)||e.sn<a.sn)||!s&&r==i-1)return this.selectKeySystemFormat(a).then(o=>{if(!this.hls)return;a.setKeyFormat(o);const l=LE(o);if(l)return this.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=py(this.config);if(r.length)return this.getKeySystemAccess(r)}}return null}getKeyStatus(e){const{mediaKeySessions:n}=this;for(let s=0;s<n.length;s++){const r=YL(e,n[s]);if(r)return r}}loadKey(e){const n=e.decryptdata,s=this.getKeyStatus(n);if(s==="internal-error"){const o=ene(s,n);return o.data.frag=e,this.error(`${o.message} (${Zr(n.keyId||[])})`),Promise.reject(o)}const r=e.type,i=this.activeKeys,a=i[r];a&&!n.matches(a.decryptdata)&&(i.previous||(i.previous=[]),i.previous.push(a),delete i[r]),i[r]||(i[r]=e);for(let o=this.mediaKeySessions.length;o--;){const l=this.mediaKeySessions[o];if(n.keyId&&l.keyStatuses[Zr(n.keyId)]==="expired")return this.renewKeySession(n,l)}return this.updateUsablePromise(n,"playlist-key",e)}renewKeySession(e,n){return this.resetMediaKeys(),this.removeSession(n).then(()=>(this.throwIfDestroyed(),this.updateUsablePromise(e,"expired")))}updateUsablePromise(e,n,s){const r=this.getSessionForKey(e,n);return r.catch(i=>this.handleError(i,s)),r.then(i=>e)}getSessionForKey(e,n){const s=this.findContextForKey(e);if(s!==void 0)return Promise.resolve(s);const r=e.uri,i=this.sessionSetupByUri[r];let a;i===void 0?a=this.resolveSessionForKey(e,n):a=i.catch(()=>{}).then(()=>(this.throwIfDestroyed(),this.resolveSessionForKey(e,n))),this.sessionSetupByUri[r]=a;const o=()=>{this.sessionSetupByUri[r]===a&&delete this.sessionSetupByUri[r]};return a.then(o,o),a}findContextForKey(e){const{mediaKeySessions:n}=this;for(let s=n.length;s--;){const r=n[s];if(YL(e,r))return r}}resolveSessionForKey(e,n){return this.getKeySystemForKeyPromise(e).then(({keySystem:s,mediaKeys:r})=>{this.throwIfDestroyed();for(let i=this.mediaKeySessions.length;i--;){const a=this.mediaKeySessions[i];if(YL(e,a))return a;const o=this.getUsableKeyPromise(a,e,n);if(o)return o}return this.attemptSetMediaKeys(s,r).then(()=>(this.throwIfDestroyed(),this.getMediaKeySessionContext(s,r,e,n))).then(i=>{this.throwIfDestroyed();const a=e.scheme||"cenc",o=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(i,e,a,o,n)})})}getUsableKeyPromise(e,n,s){const r=e.keyRequests[n.uri];if(r)return this.log(`Waiting for usable key (${s} keyId: ${gut(n)} format: "${n.keyFormat}" URI: ${n.uri})`),tne(r).then(()=>e)}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,n){if(this.hls)if(e instanceof Ll){n&&(e.data.frag=n);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${Zr(s.keyId||[])})`:""}`),this.hls.trigger(H.ERROR,e.data)}else this.error(e.message),this.hls.trigger(H.ERROR,{type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
vendor: 142,365 bytes, lines 492-503
492getKeySystemForKeyPromise(e){const n=LE(e.keyFormat),s=n?[n]:py(this.config);return this.attemptKeySystemAccess(s)}getKeySystemSelectionPromise(e){if(e.length||(e=py(this.config)),e.length===0)throw new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Fs({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}activeLevelKeys(){const e=this.activeKeys,n=(e.previous||[]).map(s=>s.decryptdata);return e.audio&&n.unshift(e.audio.decryptdata),e.main&&n.unshift(e.main.decryptdata),n}attemptSetMediaKeys(e,n){if(this.mediaResolved=void 0,this.mediaKeys===n)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(n):new Promise((i,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=n,this.media.setMediaKeys(n).then(i).catch(a)}}));return this.mediaKeys=n,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>s.indexOf(i)===-1)})}filterInitData(e,n,s,r,i){var a;const o=(a=this.config.drmSystems)==null||(a=a[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const u=o.call(this.hls,s,r,ms({},e,{decryptdata:n,reason:i}),i);if(!u)throw new Error("Invalid response from configured generateRequest filter");n.scheme=u.initDataType?u.initDataType:"cenc";const d=u.initData?u.initData:null;return n.pssh=d?new Uint8Array(d):null,u}catch(u){var l;if(this.warn(u.message),(l=this.hls)!=null&&l.config.debug)throw u}return{initDataType:s,initData:r}}generateRequestWithPreferredKeySession(e,n,s,r,i){const a=this.getUsableKeyPromise(e,n,i);if(a)return a;const o=this.filterInitData(e,n,s,r,i);if(o&&(r=o.initData?o.initData:null,s=o.initDataType),r===null)return i.startsWith("encrypted-event")?Promise.reject(new Error(`missing initialization data for "${i}"`)):(this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e));const l=n.uri,u=new eU;u.status="initialized",u.requestErrors=[],e.keyRequests[l]=u;const d=p=>{const m=e.mediaKeysSession;if(!m){const y=new Error("invalid state");u.errored=y,u.emit("error",y);return}const{messageType:v,message:x}=p;u.status=v,this.log(`"${v}" message event for session "${m.sessionId}" message size: ${x.byteLength}`),v==="license-request"||v==="license-renewal"?this.renewLicense(e,n,x).catch(y=>{u.errored=y,u.eventNames().length?u.emit("error",y):this.handleError(y),this.removeSession(e)}):v==="license-release"?e.keySystem===Qs.FAIRPLAY&&this.updateKeySession(e,n,e9("acknowledged")).then(()=>this.removeSession(e)).catch(y=>this.handleError(y)):this.warn(`unhandled media key message type "${v}"`)};return u.onmessage=d,ns(e.mediaKeysSession,"message",d),this.generateRequest(e,n,s,r,i,!1)}generateRequest(e,n,s,r,i,a){if(a){const m=this.filterInitData(e,n,s,r,i);m&&(r=m.initData?m.initData:r,s=m.initDataType)}const o=n.uri,l=e.keyRequests[o],u=Zr(n.keyId||[]),d=m=>{let v;m.startsWith("usable")?(l.resolved=!0,l.emit("resolved")):m==="internal-error"||m==="output-restricted"||m==="output-downscaled"?v=ene(m,n):m==="expired"?v=new Error(`key expired (keyId: ${u})`):m==="released"?v=new Error("key released"):m==="status-pending"||this.warn(`unhandled key status change "${m}" (keyId: ${u})`),v&&(l.errored=v,l.eventNames().length?l.emit("error",v):this.handleError(v))},f=m=>{if(!e.mediaKeysSession){const k=new Error("invalid state");l.errored=k,l.emit("error",k);return}const x=e.keyStatuses=this.getKeyStatuses(e);if(!Object.keys(x).some(k=>x[k]!=="status-pending"))return;const S=this.activeLevelKeys();for(let k=0;k<S.length;k++){const R=Zr(S[k].keyId||[]);if(x[R]==="expired"){var _;this.log(`Expired key ${Fs(x)} in key-session "${(_=e.mediaKeysSession)==null?void 0:_.sessionId}"`),this.renewKeySession(n,e).catch(I=>this.handleError(I));break}}let E=x[u];if(E)d(E);else{var T;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(T=e.keyStatusTimeouts)[u]||(T[u]=self.setTimeout(()=>{var R;if(!e.mediaKeysSession)return;const I=this.getKeyStatus(n);if(I&&I!=="status-pending"){var A;return this.log(`No status for keyId ${u} in key-session "${(A=e.mediaKeysSession)==null?void 0:A.sessionId}". Using session key-status ${I} from other session.`),d(I)}this.log(`key status for ${u} in key-session "${(R=e.mediaKeysSession)==null?void 0:R.sessionId}" timed out after 1000ms`),E="internal-error",d(E)},1e3)),this.log(`No status for keyId ${u} (${Fs(x)}).`)}};l.onkeystatuseschange=f,ns(e.mediaKeysSession,"keystatuseschange",f);const p=tne(l);return this.log(`Generating key-session request for "${i}" keyId: ${u} URI: ${o} (init data type: ${s} length: ${r.byteLength})`),l.status="started",e.initialized=!0,e.mediaKeysSession.generateRequest(s,r).then(()=>{var m;l.status="generated",this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${u} URI: ${o}`)}).catch(m=>{throw this.log(`mediaKeysSession.generateRequest failed: ${m}`),new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_NO_SESSION,error:m,decryptdata:n,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>p).catch(m=>{var v;this.log(`mediaKeysSession.generateRequest failed: ${m}`);const x=(v=m.data)==null?void 0:v.details;return(x===pe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED||x===pe.KEY_SYSTEM_STATUS_INTERNAL_ERROR)&&Object.keys(e.keyStatuses).some(y=>e.keyStatuses[y]==="usable")?(this.handleError(m),e):(l.removeAllListeners(),this.removeSession(e).then(()=>{throw m}))}).then(()=>e)}getKeyStatuses(e){const n={},s=e.mediaKeysSession.sessionId;return e.mediaKeysSession.keyStatuses.forEach((r,i)=>{if(typeof i=="string"&&typeof r=="object"){const l=i;i=r,r=l}const a="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===Qs.PLAYREADY&&a.length===16){const l=Zr(a);n[l]=r,K1e(a)}const o=Zr(a);this.log(`key status change "${r}" for keyStatuses keyId: ${o} key-session "${s}"`),n[o]=r}),n}fetchServerCertificate(e){const n=this.config,s=n.loader,r=new s(n),i=mut(e,n);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={type:hn.SERVER_CERTIFICATE,responseType:"arraybuffer",url:i},u=n.certLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(p,m,v,x)=>{a(p.data)},onError:(p,m,v,x)=>{o(new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:v,response:Rt({url:l.url,data:void 0},p)},`"${e}" certificate request failed (${i}). Status: ${p.code} (${p.text})`))},onTimeout:(p,m,v)=>{o(new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:v,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(p,m,v)=>{o(new Error("aborted"))}};r.load(l,d,f)})):(this.log(`No Server Certificate in config.drmSystems["${e}"]`),Promise.resolve())}setMediaKeysServerCertificate(e,n,s){return new Promise((r,i)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s.byteLength}) on "${n}"`),r(e)}).catch(a=>{i(new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,n,s){return this.requestLicense(e,n,new Uint8Array(s)).then(r=>this.updateKeySession(e,n,new Uint8Array(r)).catch(i=>{throw new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:n,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,n){const s=ic(new Uint16Array(n.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const r=new DOMParser().parseFromString(s,"application/xml"),i=r.querySelectorAll("HttpHeader");if(i.length>0){let d;for(let f=0,p=i.length;f<p;f++){var a,o;d=i[f];const m=(a=d.querySelector("name"))==null?void 0:a.textContent,v=(o=d.querySelector("value"))==null?void 0:o.textContent;m&&v&&e.setRequestHeader(m,v)}}const l=r.querySelector("Challenge"),u=l==null?void 0:l.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return e9(atob(u))}setupLicenseXHR(e,n,s,r,i){const a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>(this.throwIfDestroyed(),a.call(this.hls,e,n,Rt(Rt({},s),{},{decryptdata:r}),i))).catch(o=>{if(!s.mediaKeysSession)throw o;return e.open("POST",n,!0),a.call(this.hls,e,n,Rt(Rt({},s),{},{decryptdata:r}),i)}).then(o=>(e.readyState||e.open("POST",n,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",n,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,n,s){return new Promise((r,i)=>{const a=put(e.keySystem,this.config);if(!a)return i(new Error(`no license server URL configured for key-system "${e.keySystem}"`));const o=e.keyRequests[n.uri];if(!o)return i(new Error("License emitter removed"));this.log(`Sending license request to URL: ${a}`);const l=this.config.keyLoadPolicy.default,u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(u.readyState===4)if(u.status===200){o.requestErrors=[];let d=u.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const f=this.config.licenseResponseCallback;if(f)try{d=f.call(this.hls,u,a,Rt(Rt({},e),{},{decryptdata:n}))}catch(p){this.error(p)}r(d)}else{const d=l.errorRetry,f=d?d.maxNumRetry:0;if(o.requestErrors.push({status:u.status,message:u.statusText}),o.requestErrors.length>f||u.status>=400&&u.status<500)i(new Ll({type:_t.KEY_SYSTEM_ERROR,details:pe.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:n,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const p=f-o.requestErrors.length;this.warn(`Retrying license request, ${p} attempts left`),this.requestLicense(e,n,s).then(r,i)}}},o.licenseXhr&&o.licenseXhr.readyState!==XMLHttpRequest.DONE&&o.licenseXhr.abort(),o.licenseXhr=u,this.setupLicenseXHR(u,a,e,n,s).then(({xhr:d,licenseChallenge:f})=>{e.keySystem==Qs.PLAYREADY&&(f=this.unpackPlayReadyKeyMessage(d,f)),d.send(f)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,n){if(!this.config.emeEnabled)return;const s=n.media;this.media=s,ns(s,"encrypted",this.onMediaEncrypted),ns(s,"waitingforkey",this.onWaitingForKey);const r=this.mediaResolved;r?r():this.mediaKeys=s.mediaKeys}onMediaDetached(){const e=this.media;e&&(Xn(e,"encrypted",this.onMediaEncrypted),Xn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this.keyFormatPromise=null,this.keySystemAccessPromises={},this.activeKeys={},this.sessionSetupByUri={};const n=this.mediaResolved;if(n&&n(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,wd.clearKeyUriToKeyIdMap();const i=r.length;hv.CDMCleanupPromise=Promise.all(r.map(a=>this.removeSession(a)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{i&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear(),this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=n.reduce((r,i)=>(r.indexOf(i.keyFormat)===-1&&r.push(i.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s),this.keyFormatPromise.catch(()=>{})}}removeSession(e){const{mediaKeysSession:n}=e;if(n){this.log(`Remove licenses and keys and close session "${n.sessionId}"`),Object.keys(e.keyRequests).forEach(o=>{const l=e.keyRequests[o];l.onmessage&&(n.removeEventListener("message",l.onmessage),l.onmessage=void 0),l.onkeystatuseschange&&(n.removeEventListener("keystatuseschange",l.onkeystatuseschange),l.onkeystatuseschange=void 0);const u=l.licenseXhr;u&&(u.readyState!==XMLHttpRequest.DONE&&u.abort(),l.licenseXhr=void 0),e.keyRequests[o]=void 0}),e.mediaKeysSession=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{keyStatusTimeouts:r}=e;r&&Object.keys(r).forEach(o=>self.clearTimeout(r[o]));const{drmSystemOptions:i}=this.config;return(Oot(i)?new Promise((o,l)=>{self.setTimeout(()=>l(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(o).catch(l)}):Promise.resolve()).catch(o=>{this.log(`Could not remove session: ${o}`),this.hls&&this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>n.close()).then(()=>n.closed).catch(o=>{this.log(`Could not close session: ${o}`),this.hls&&this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}return Promise.resolve()}}hv.CDMCleanupPromise=void 0;function put(t,e){const{drmSystems:n,widevineLicenseUrl:s}=e,r=n==null?void 0:n[t];if(r)return r.licenseUrl;if(t===Qs.WIDEVINE&&s)return s}function mut(t,e){const{drmSystems:n}=e,s=n==null?void 0:n[t];if(s)return s.serverCertificateUrl}function gut(t){if(t.keyFormat===Fi.FAIRPLAY)return t.uri;if(t.keyId===null)throw new Error("keyId is null");return Zr(t.keyId)}function YL(t,e){const n=t.keyId,s=e.mediaKeysSession;if(n&&s){const r=e.mediaKeysSession.keyStatuses;if(r.size)return r.has(n)?r.get(n):e.keyStatuses[Zr(n)]}}function ene(t,e){const n=t==="output-restricted",s=n?pe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:pe.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ll({type:_t.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},n?"HDCP level output restricted":`key status changed to "${t}"`)}function tne(t){return new Promise((e,n)=>{if(t.resolved)return e();if(t.errored)return n(t.errored);t.on("error",n),t.on("resolved",e)})}class vut{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(H.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(H.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,n){const s=this.hls.config;if(s.capLevelOnFPSDrop){const r=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,n,s){const r=performance.now();if(n){if(this.lastTime){const i=r-this.lastTime,a=s-this.lastDroppedFrames,o=n-this.lastDecodedFrames,l=1e3*a/i,u=this.hls;if(u.trigger(H.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>u.config.fpsDroppedMonitoringThreshold*o){let d=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=d)&&(d=d-1,u.trigger(H.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:u.currentLevel}),u.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=s,this.lastDecodedFrames=n}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const n=e.getVideoPlaybackQuality();this.checkFPS(e,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}var hU=(function(){if(v5!=null&&v5.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function n(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const u=l.toLowerCase();return~o.indexOf(u)?u:!1}function s(o){return n(t,o)}function r(o){return n(e,o)}function i(o,...l){let u=1;for(;u<arguments.length;u++){const d=arguments[u];for(const f in d)o[f]=d[f]}return o}function a(o,l,u){const d=this,f={enumerable:!0};d.hasBeenReset=!1;let p="",m=!1,v=o,x=l,y=u,S=null,_="",E=!0,T="auto",k="start",R=50,I="middle",A=50,L="middle";Object.defineProperty(d,"id",i({},f,{get:function(){return p},set:function(j){p=""+j}})),Object.defineProperty(d,"pauseOnExit",i({},f,{get:function(){return m},set:function(j){m=!!j}})),Object.defineProperty(d,"startTime",i({},f,{get:function(){return v},set:function(j){if(typeof j!="number")throw new TypeError("Start time must be set to a number.");v=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",i({},f,{get:function(){return x},set:function(j){if(typeof j!="number")throw new TypeError("End time must be set to a number.");x=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",i({},f,{get:function(){return y},set:function(j){y=""+j,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",i({},f,{get:function(){return S},set:function(j){S=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",i({},f,{get:function(){return _},set:function(j){const F=s(j);if(F===!1)throw new SyntaxError("An invalid or illegal string was specified.");_=F,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",i({},f,{get:function(){return E},set:function(j){E=!!j,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",i({},f,{get:function(){return T},set:function(j){if(typeof j!="number"&&j!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");T=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",i({},f,{get:function(){return k},set:function(j){const F=r(j);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");k=F,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",i({},f,{get:function(){return R},set:function(j){if(j<0||j>100)throw new Error("Position must be between 0 and 100.");R=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",i({},f,{get:function(){return I},set:function(j){const F=r(j);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");I=F,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",i({},f,{get:function(){return A},set:function(j){if(j<0||j>100)throw new Error("Size must be between 0 and 100.");A=j,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",i({},f,{get:function(){return L},set:function(j){const F=r(j);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");L=F,this.hasBeenReset=!0}})),d.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class xut{decode(e,n){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function qxe(t){function e(s,r,i,a){return(s|0)*3600+(r|0)*60+(i|0)+parseFloat(a||0)}const n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}class yut{constructor(){this.values=Object.create(null)}set(e,n){!this.get(e)&&n!==""&&(this.values[e]=n)}get(e,n,s){return s?this.has(e)?this.values[e]:n[s]:this.has(e)?this.values[e]:n}has(e){return e in this.values}alt(e,n,s){for(let r=0;r<s.length;++r)if(n===s[r]){this.set(e,n);break}}integer(e,n){/^-?\d+$/.test(n)&&this.set(e,parseInt(n,10))}percent(e,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const s=parseFloat(n);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function Kxe(t,e,n,s){const r=s?t.split(s):[t];for(const i in r){if(typeof r[i]!="string")continue;const a=r[i].split(n);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const c9=new hU(0,0,""),OE=c9.align==="middle"?"middle":"center";function but(t,e,n){const s=t;function r(){const o=qxe(t);if(o===null)throw new Error("Malformed timestamp: "+s);return t=t.replace(/^[^\sa-zA-Z-]+/,""),o}function i(o,l){const u=new yut;Kxe(o,function(p,m){let v;switch(p){case"region":for(let x=n.length-1;x>=0;x--)if(n[x].id===m){u.set(p,n[x].region);break}break;case"vertical":u.alt(p,m,["rl","lr"]);break;case"line":v=m.split(","),u.integer(p,v[0]),u.percent(p,v[0])&&u.set("snapToLines",!1),u.alt(p,v[0],["auto"]),v.length===2&&u.alt("lineAlign",v[1],["start",OE,"end"]);break;case"position":v=m.split(","),u.percent(p,v[0]),v.length===2&&u.alt("positionAlign",v[1],["start",OE,"end","line-left","line-right","auto"]);break;case"size":u.percent(p,m);break;case"align":u.alt(p,m,["start",OE,"end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");let d=u.get("line","auto");d==="auto"&&c9.line===-1&&(d=-1),l.line=d,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",OE);let f=u.get("position","auto");f==="auto"&&c9.position===50&&(f=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=f}function a(){t=t.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),t.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);t=t.slice(3),a(),e.endTime=r(),a(),i(t,e)}function Yxe(t){return t.replace(/<br(?: \/)?>/gi,`
493`)}class Sut{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new xut,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const n=this;e&&(n.buffer+=n.decoder.decode(e,{stream:!0}));function s(){let i=n.buffer,a=0;for(i=Yxe(i);a<i.length&&i[a]!=="\r"&&i[a]!==`
494`;)++a;const o=i.slice(0,a);return i[a]==="\r"&&++a,i[a]===`
495`&&++a,n.buffer=i.slice(a),o}function r(i){Kxe(i,function(a,o){},/:/)}try{let i="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;i=s();const o=i.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let a=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(a?a=!1:i=s(),n.state){case"HEADER":/:/.test(i)?r(i):i||(n.state="ID");continue;case"NOTE":i||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){n.state="NOTE";break}if(!i)continue;if(n.cue=new hU(0,0,""),n.state="CUE",i.indexOf("-->")===-1){n.cue.id=i;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{but(i,n.cue,n.regionList)}catch{n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const o=i.indexOf("-->")!==-1;if(!i||o&&(a=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
496`),n.cue.text+=i}continue;case"BADCUE":i||(n.state="ID")}}}catch{n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
497
498`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){e.onparsingerror&&e.onparsingerror(n)}return e.onflush&&e.onflush(),this}}function Rb(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0).toString()}const wut=/\r\n|\n\r|\n|\r/g,nne="Missing initPTS for VTT ",_ut=function(e){let n=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!at(n)||!at(s)||!at(r)||!at(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return n+=1e3*s,n+=60*1e3*r,n+=3600*1e3*i,n};function pU(t,e,n){return Rb(t.toString())+Rb(e.toString())+Rb(n)}function Eut(t,e,n,s,r,i,a){const o=new Sut,l=Lo(new Uint8Array(t)).trim().replace(wut,`
499`).split(`
500`),u=[],d=e?$lt(e.baseTime,e.timescale):0;let f="00:00.000",p=0,m=0,v=!1,x,y=!0;o.oncue=function(S){const _=n[s];let E=n.ccOffset;const T=(p-d)/9e4;if(v){if(_!=null&&_.new&&(E=n.ccOffset=_.start),T){if(!e){x=new Error(nne+"MPEGTS");return}E=T-n.presentationOffset}}else if(e)E=-e.baseTime/e.timescale;else{x=new Error(nne+"without X-TIMESTAMP-MAP");return}const k=S.endTime-S.startTime,R=go((S.startTime+E-m)*9e4,r*9e4)/9e4;S.startTime=Math.max(R,0),S.endTime=Math.max(R+k,0);const I=S.text.trim();S.text=decodeURIComponent(encodeURIComponent(I)),S.id?s&&(S.id=`hlsjscc${s}_${S.id}`):S.id=pU(S.startTime,S.endTime,I),S.endTime>0&&u.push(S)},o.onparsingerror=function(S){x=S},o.onflush=function(){if(x){a(x);return}i(u)},l.forEach(S=>{if(y)if(S.startsWith("X-TIMESTAMP-MAP=")){y=!1,v=!0,S.slice(16).split(",").forEach(_=>{_.startsWith("LOCAL:")?f=_.slice(6):_.startsWith("MPEGTS:")&&(p=parseInt(_.slice(7)))});try{m=_ut(f)/1e3}catch(_){x=_}return}else S===""&&(y=!1);o.parse(S+`
501`)}),o.flush()}const u9="stpp.ttml.im1t",Zxe=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Xxe=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Cut={left:"start",center:"center",right:"end",start:"start",end:"end"};function sne(t,e,n,s){const r=Yt(new Uint8Array(t),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const i=r.map(o=>Lo(o)),a=Olt(e.baseTime,1,e.timescale);try{i.forEach(o=>n(Tut(o,a)))}catch(o){s(o)}}function Tut(t,e){const r=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(i).reduce((f,p)=>(f[p]=r.getAttribute(`ttp:${p}`)||i[p],f),{}),o=r.getAttribute("xml:space")!=="preserve",l=rne(ZL(r,"styling","style")),u=rne(ZL(r,"layout","region")),d=ZL(r,"body","[begin]");return[].map.call(d,f=>{const p=Qxe(f,o);if(!p||!f.hasAttribute("begin"))return null;const m=QL(f.getAttribute("begin"),a),v=QL(f.getAttribute("dur"),a);let x=QL(f.getAttribute("end"),a);if(m===null)throw ine(f);if(x===null){if(v===null)throw ine(f);x=m+v}const y=new hU(m-e,x-e,p);y.id=pU(y.startTime,y.endTime,y.text);const S=u[f.getAttribute("region")],_=l[f.getAttribute("style")],E=kut(S,_,l),{textAlign:T}=E;if(T){const k=Cut[T];k&&(y.lineAlign=k),y.align=T}return ms(y,E),y}).filter(f=>f!==null)}function ZL(t,e,n){const s=t.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(n)):[]}function rne(t){return t.reduce((e,n)=>{const s=n.getAttribute("xml:id");return s&&(e[s]=n),e},{})}function Qxe(t,e){return[].slice.call(t.childNodes).reduce((n,s,r)=>{var i;return s.nodeName==="br"&&r?n+`
502`:(i=s.childNodes)!=null&&i.length?Qxe(s,e):e?n+s.textContent.trim().replace(/\s+/g," "):n+s.textContent},"")}function kut(t,e,n){const s="http://www.w3.org/ns/ttml#styling";let r=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return a&&n.hasOwnProperty(a)&&(r=n[a]),i.reduce((o,l)=>{const u=XL(e,s,l)||XL(t,s,l)||XL(r,s,l);return u&&(o[l]=u),o},{})}function XL(t,e,n){return t&&t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function ine(t){return new Error(`Could not parse ttml timestamp ${t}`)}function QL(t,e){if(!t)return null;let n=qxe(t);return n===null&&(Zxe.test(t)?n=Rut(t,e):Xxe.test(t)&&(n=Aut(t,e))),n}function Rut(t,e){const n=Zxe.exec(t),s=(n[4]|0)+(n[5]|0)/e.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+s/e.frameRate}function Aut(t,e){const n=Xxe.exec(t),s=Number(n[1]);switch(n[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}function mU(t,e,n,s="",r="disabled"){const i=t.ownerDocument.createElement("track");return i.kind=e,i.label=n,s&&(i.srclang=s),i.src="data:,WEBVTT",i.track.mode=r,t.appendChild(i),i}function Nut(t){return t.forced&&Wat()?"forced":t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function d9(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){Gn.debug(`[texttrack-utils]: ${s}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,t.addCue(r)}catch(r){Gn.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}n==="disabled"&&(t.mode=n)}function f9(t,e,n,s){const r=t.mode;if(r==="disabled"&&(t.mode="hidden"),t.cues&&t.cues.length>0){const i=Lut(t.cues,e,n);for(let a=0;a<i.length;a++)(!s||s(i[a]))&&t.removeCue(i[a])}r==="disabled"&&(t.mode=r)}function Iut(t,e){if(e<=t[0].startTime)return 0;const n=t.length-1;if(e>t[n].endTime)return-1;let s=0,r=n,i;for(;s<=r;)if(i=Math.floor((r+s)/2),e<t[i].startTime)r=i-1;else if(e>t[i].startTime&&s<n)s=i+1;else return i;return t[s].startTime-e<e-t[r].startTime?s:r}function Lut(t,e,n){const s=[],r=Iut(t,e);if(r>-1)for(let i=r,a=t.length;i<a;i++){const o=t[i];if(o.startTime>=e&&o.endTime<=n)s.push(o);else if(o.startTime>n)return s}return s}class jut extends iU{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let n=-1,s=!1;if(this.currentTrack){var r;const o=(r=this.currentTrack.trackNode)==null?void 0:r.track.mode;o==="showing"?(n=this.trackId,s=!0):o==="hidden"&&(n=this.trackId)}if(!s)for(let o=0;o<this.tracksInGroup.length;o++){var i;const l=(i=this.tracksInGroup[o].trackNode)==null?void 0:i.track.mode;if(l==="showing"){n=o;break}else n<0&&l==="hidden"&&(n=o)}if(n>-1){var a;this._subtitleDisplay=((a=this.tracksInGroup[n].trackNode)==null?void 0:a.track.mode)==="showing"}this.setSubtitleTrack(n,!0)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.LEVEL_LOADING,this.onLevelLoading,this),e.on(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(H.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(H.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.LEVEL_LOADING,this.onLevelLoading,this),e.off(H.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(H.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(H.ERROR,this.onError,this)}createTracksInGroup(){var e;if(!this.media||!this.hls.config.renderTextTracksNatively)return;this.tracksInGroup.forEach(s=>{s.trackNode||(s.trackNode=mU(this.media,Nut(s),s.name,s.lang))});const n=(e=this.currentTrack)==null||(e=e.trackNode)==null?void 0:e.track;(n==null?void 0:n.mode)==="disabled"&&(n.mode=this._subtitleDisplay?"showing":"hidden")}onMediaAttached(e,n){const s=n.media;this.media=s;let r=this.trackId;this.queuedDefaultTrack>-1&&(r=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.setSubtitleTrack(r),this.createTracksInGroup(),this.useTextTrackPolling=!(s.textTracks&&"onchange"in s.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):s.textTracks.addEventListener("change",this.asyncPollTrackChange)}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,n){const s=this.media;if(!s)return;const r=!!n.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId,this.setSubtitleTrack(-1)),this.media=null,!r&&this.hls.config.renderTextTracksNatively&&this.tracksInGroup.forEach(i=>{const a=i.trackNode;a&&(a.track.mode="hidden",a.remove(),i.trackNode=void 0)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(e,n){const{id:s,groupId:r,details:i}=n,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=n.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,o)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const s=n.subtitleGroups||null,r=this.groupIds;let i=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=s;const a=[];if(this.tracks.forEach(d=>{(d.textCodec===u9?this.hls.config.enableIMSC1:this.hls.config.enableWebVTT)&&(!s||s.indexOf(d.groupId)>-1?(d.id=a.length,a.push(d)):d.trackNode&&(d.trackNode.remove(),d.trackNode=void 0))}),a.length===this.tracksInGroup.length){let d=!1;for(let f=0;f<a.length;f++)if(a[f]!==this.tracksInGroup[f]){d=!0;break}if(!d)return}a.length&&this.selectDefaultTrack&&!a.some(d=>d.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=a,this.trackId=-1,this.currentTrack=null;const o=this.hls.config.subtitlePreference;if(!i&&o){this.selectDefaultTrack=!1;const d=Gc(o,a);if(d>-1)i=a[d];else{const f=Gc(o,this.tracks);i=this.tracks[f]}}let l=this.findTrackId(i);l===-1&&i&&(l=this.findTrackId(null));const u={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(H.SUBTITLE_TRACKS_UPDATED,u),this.setSubtitleTrack(l),this.createTracksInGroup()}}findTrackId(e){const n=this.tracksInGroup,s=this.selectDefaultTrack;for(let r=0;r<n.length;r++){const i=n[r];if(!(s&&!i.default||!s&&!e)&&(!e||km(i,e)))return r}if(e){for(let r=0;r<n.length;r++){const i=n[r];if(j2(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<n.length;r++){const i=n[r];if(j2(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}onError(e,n){n.fatal||!n.context||n.context.type===hn.SUBTITLE_TRACK&&n.context.id===this.trackId&&N2(n.context.groupId,this.groupIds)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e,!0)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1,!0),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const s=this.currentTrack;if(s&&km(e,s))return s;const r=Gc(e,this.tracksInGroup);if(r>-1){const i=this.tracksInGroup[r];return this.setSubtitleTrack(r,!0),i}else{if(s)return null;{const i=Gc(e,n);if(i>-1)return n[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const s=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,n),a=e.details,o=a==null?void 0:a.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${r}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger(H.SUBTITLE_TRACK_LOADING,{url:i,id:s,groupId:r,deliveryDirectives:n||null,track:e})}toggleTrackModes(){if(!this.media||!this.hls.config.renderTextTracksNatively)return;const e=this.currentTrack;this.tracksInGroup.forEach(n=>{if(n.trackNode){const s=n===e?this._subtitleDisplay?"showing":"hidden":"disabled",r=n.trackNode.track;r.mode!==s&&(r.mode=s)}})}setSubtitleTrack(e,n=!1){const s=this.tracksInGroup;if(this.media||(this.queuedDefaultTrack=e),e<-1||e>=s.length||!at(e)){this.warn(`Invalid subtitle track id: ${e}`);return}const r=this.currentTrack,i=s[e]||null;if(this.trackId=e,this.currentTrack=i,n&&this.toggleTrackModes(),!i){r&&this.hls.trigger(H.SUBTITLE_TRACK_SWITCH,{id:e});return}const a=!!i.details&&!i.details.live;if(i===r&&a)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:l="",name:u,type:d,url:f}=i;this.hls.trigger(H.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:u,type:d,url:f});const p=this.switchParams(i.url,r==null?void 0:r.details,i.details);this.loadPlaylist(p)}}const hT=2,Put=100;class Mut extends H1e{constructor(e,n){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.skipRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=void 0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(H.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=n,this.lastCurrentTime=this.getCurrentTime(),this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,n){this.setInterval(Put),this.mediaSource=n.mediaSource;const s=this.media=n.media;ns(s,"playing",this.onMediaPlaying),ns(s,"waiting",this.onMediaWaiting),ns(s,"ended",this.onMediaEnded)}onMediaDetaching(e,n){this.clearInterval();const{media:s}=this;s&&(Xn(s,"playing",this.onMediaPlaying),Xn(s,"waiting",this.onMediaWaiting),Xn(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}getCurrentTime(){var e;const n=((e=this.hls)==null?void 0:e.config.timelineOffset)||0;return this.media?Math.max(this.media.currentTime,n):n}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const n=this.getCurrentTime();this.media.currentTime<n||(this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n)}poll(e,n){var s,r;const i=(s=this.hls)==null?void 0:s.config;if(!i)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,u=!this.seeking&&o,d=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==n){n&&(this.ended=0),this.moved=!0,o||(this.skipRetry=this.nudgeRetry=0,i.nudgeOnVideoHole&&!d&&e>n&&this.nudgeOnVideoHole(e,n)),this.waiting===0&&this.stallResolved(e);return}if(u||l){l&&this.stallResolved(e);return}if(d){this.skipRetry=this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(H.MEDIA_ENDED,{stalled:!1}));return}if(!Bt.getBuffered(a).length){this.skipRetry=this.nudgeRetry=0;return}const f=Bt.bufferInfo(a,e,0),p=this.fragmentTracker;p&&this.hls&&lne(f,e,p,this.hls);const m=f.nextStart||0;if(o&&p&&this.hls){const R=ane(this.hls.inFlightFragments,e),I=f.len>hT,A=!m||R||m-e>hT&&!p.getPartialFragment(e);if(I||A)return;this.moved=!1}const v=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&p){if(!(f.len>0)&&!m)return;const I=Math.max(m,f.start||0)-e,L=!!(v!=null&&v.live)?v.targetduration*2:hT,j=Vy(e,p);if(I>0&&(I<=L||j)){a.paused||this._trySkipBufferHole(j);return}}const x=i.detectStallWithCurrentTimeMs,y=self.performance.now(),S=this.waiting;let _=this.stalled;if(_===null)if(S>0&&y-S<x)_=this.stalled=S;else{this.stalled=y;return}const E=y-_;if(!o&&(E>=x||S&&this.moved)&&this.hls){var T;if(((T=this.mediaSource)==null?void 0:T.readyState)==="ended"&&!(v!=null&&v.live)&&Math.abs(e-((v==null?void 0:v.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(H.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return;if(a.currentTime!==e){const R=e;e=a.currentTime,this.moved=!0,this.log(`currentTime changed ${R} > ${e}`);return}}const k=Bt.bufferInfo(a,e,i.maxBufferHole);this._tryFixBufferStall(k,E,e)}stallResolved(e){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-n;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(H.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,n){var s;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&r&&r.length>1&&e>r.end(0)){const i=Bt.bufferedInfo(Bt.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&n>=i.start){const a=Bt.timeRangesToArray(r),o=Bt.bufferedInfo(a,n,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=Bt.bufferedInfo(a,e,0).bufferedIndex,u=a[o].end,d=a[o+1].start;if((l===-1||l>o)&&d-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${d} buffered index: ${l}`);this.warn(f.message),this.media.currentTime+=1e-6;let p=Vy(e,this.fragmentTracker);p&&"fragment"in p?p=p.fragment:p||(p=void 0);const m=Bt.bufferInfo(this.media,e,0);this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:p,buffer:m.len,bufferInfo:m})}}}}}_tryFixBufferStall(e,n,s){var r,i;const{fragmentTracker:a,media:o}=this,l=(r=this.hls)==null?void 0:r.config;if(!o||!a||!l)return;const u=(i=this.hls)==null?void 0:i.latestLevelDetails,d=Vy(s,a);if((d||u!=null&&u.live&&s<u.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;const f=e.buffered,p=this.adjacentTraversal(e,s);(f&&f.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-s<l.maxBufferHole||p))&&(n>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,n){const s=this.fragmentTracker,r=e.nextStart;if(s&&r){const i=s.getFragAtPos(n,vt.MAIN),a=s.getFragAtPos(r,vt.MAIN);if(i&&a)return a.sn-i.sn<2}return!1}_reportStall(e){const{hls:n,media:s,stallReported:r,stalled:i}=this;if(!r&&i!==null&&s&&n){this.stallReported=!0;const a=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Fs(e)})`);this.warn(a.message),n.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){const{fragmentTracker:n,media:s,hls:r}=this,i=r==null?void 0:r.config;if(!s||!n||!i)return 0;const a=s.currentTime,o=Bt.bufferInfo(s,a,0);lne(o,a,n,r);const l=a<o.start?o.start:o.nextStart;if(l){const d=o.len<=i.maxBufferHole,f=o.len>0&&o.len<1&&s.readyState<3,p=l-a;if(p>0&&(d||f)){if(p>i.maxBufferHole){let S=!1;if(a===0){const _=n.getAppendedFrag(0,vt.MAIN);_&&l<_.end&&(S=!0)}if(!S&&e){var u;if(!((u=r.loadLevelObj)!=null&&u.details)||ane(r.inFlightFragments,l))return 0;let E=!1,T=e.end;for(;T<l;){const k=Vy(T,n),R=k?k.duration:0;if(R>0)T+=R;else{E=!0;break}}if(E)return 0}}const{nudgeMaxRetry:m,skipBufferHolePadding:v}=i,x=++this.skipRetry>m,y=Math.max(l,a)+v;if(x||(this.warn(`skipping hole, adjusting currentTime from ${a} to ${y}`),this.moved=!0,s.currentTime=y),!(e!=null&&e.gap)||x){const S=new Error(x?`Playhead still not moving after seeking over buffer hole from ${a} to ${y} after ${i.nudgeMaxRetry} attempts.`:`fragment loaded with buffer holes, seeking from ${a} to ${y}`),_={type:_t.MEDIA_ERROR,details:pe.BUFFER_SEEK_OVER_HOLE,fatal:x,error:S,reason:S.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?_.part=e:_.frag=e),r.trigger(H.ERROR,_)}return y}}return 0}_tryNudgeBuffer(e){const{hls:n,media:s,nudgeRetry:r}=this,i=n==null?void 0:n.config;if(!s||!i)return 0;const a=s.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){const o=a+(r+1)*i.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),s.currentTime=o,n.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${i.nudgeMaxRetry} nudges`);this.error(o.message),n.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function ane(t,e){const n=one(t.main);if(n&&n.start<=e)return n;const s=one(t.audio);return s&&s.start<=e?s:null}function one(t){if(!t)return null;switch(t.state){case Ne.IDLE:case Ne.STOPPED:case Ne.ENDED:case Ne.ERROR:return null}return t.frag}function Vy(t,e){return e.getAppendedFrag(t,vt.MAIN)||e.getPartialFragment(t)}function lne(t,e,n,s){const r=s.latestLevelDetails,i=Vy(e,n);if(b5(s.config)&&!t.nextStart&&r&&i&&s.interstitialsManager){const a="type"in i?i:i.fragment,o=z1e(r,a.sn);(o==null?void 0:o.level)===a.level&&axe(o,s.interstitialsManager.playerQueue,e)&&(t.nextStart=o.start)}}const Dut=.25;function h9(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function JL(t,e,n,s,r){let i=new t(e,n,"");try{i.value=s,r&&(i.type=r)}catch{i=new t(e,n,Fs(r?Rt({type:r},s):s))}return i}const $E=(()=>{const t=h9();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Out{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(H.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(H.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(H.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(H.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,n){this.media=n.media}onMediaAttached(){var e;const n=(e=this.hls)==null?void 0:e.latestLevelDetails;n&&this.updateDateRangeCues(n)}onMediaDetaching(e,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.id3Track.remove(),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){return mU(e,"metadata","id3","","hidden")}onFragParsingMetadata(e,n){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:s,enableID3MetadataCues:r}=this.hls.config;if(!s&&!r)return;const{samples:i}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=h9();if(a)for(let o=0;o<i.length;o++){const l=i[o].type;if(l===ba.emsg&&!s||!r)continue;const u=v1e(i[o].data),d=i[o].pts;let f=d+i[o].duration;f>$E&&(f=$E),f-d<=0&&(f=d+Dut);for(let m=0;m<u.length;m++){const v=u[m];if(!x1e(v)){this.updateId3CueEnds(d,l);const x=JL(a,d,f,v,l);x&&this.id3Track.track.addCue(x)}}}}updateId3CueEnds(e,n){var s;const r=(s=this.id3Track)==null?void 0:s.track.cues;if(r)for(let i=r.length;i--;){const a=r[i];a.type===n&&a.startTime<e&&a.endTime===$E&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:n,endOffset:s,type:r}){const{id3Track:i,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(i&&(o||l)){let u;r==="audio"?u=d=>d.type===ba.audioId3&&l:r==="video"?u=d=>d.type===ba.emsg&&o:u=d=>d.type===ba.audioId3&&l||d.type===ba.emsg&&o,f9(i.track,n,s,u)}}onLevelUpdated(e,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(e,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(e,n){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:r,enableDateRangeMetadataCues:i,interstitialsController:a}=this.hls.config;if(!i)return;const o=h9();if(s&&r&&!a){const{fragmentStart:x,fragmentEnd:y}=e;let S=this.assetCue;S?(S.startTime=x,S.endTime=y):o&&(S=this.assetCue=JL(o,x,y,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),S&&(S.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.track.addCue(S),S.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:u}=e,d=Object.keys(u);let f=this.dateRangeCuesAppended;if(l&&n){var p;if((p=l.track.cues)!=null&&p.length){const x=Object.keys(f).filter(y=>d.indexOf(y)===-1);for(let y=x.length;y--;){var m;const S=x[y],_=(m=f[S])==null?void 0:m.cues;delete f[S],_&&Object.keys(_).forEach(E=>{const T=_[E];if(T){T.removeEventListener("enter",this.onEventCueEnter);try{l.track.removeCue(T)}catch{}}})}}else f=this.dateRangeCuesAppended={}}const v=e.fragments[e.fragments.length-1];if(!(d.length===0||!at(v==null?void 0:v.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let x=0;x<d.length;x++){const y=d[x],S=u[y],_=S.startTime,E=f[y],T=(E==null?void 0:E.cues)||{};let k=(E==null?void 0:E.durationKnown)||!1,R=$E;const{duration:I,endDate:A}=S;if(A&&I!==null)R=_+I,k=!0;else if(S.endOnNext&&!k){const j=d.reduce((F,O)=>{if(O!==S.id){const M=u[O];if(M.class===S.class&&M.startDate>S.startDate&&(!F||S.startDate<F.startDate))return M}return F},null);j&&(R=j.startTime,k=!0)}const L=Object.keys(S.attr);for(let j=0;j<L.length;j++){const F=L[j];if(!Iot(F))continue;const O=T[F];if(O)k&&!(E!=null&&E.durationKnown)?O.endTime=R:Math.abs(O.startTime-_)>.01&&(O.startTime=_,O.endTime=R);else if(o){let M=S.attr[F];Lot(F)&&(M=y1e(M));const G=JL(o,_,R,{key:F,data:M},ba.dateRange);G&&(G.id=y,this.id3Track.track.addCue(G),T[F]=G,a&&(F==="X-ASSET-LIST"||F==="X-ASSET-URL")&&G.addEventListener("enter",this.onEventCueEnter))}}f[y]={cues:T,dateRange:S,durationKnown:k}}}}}function Jxe(){return self.SourceBuffer||self.WebKitSourceBuffer}function eye(){if(!Uh())return!1;const e=Jxe();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function $ut(){if(!eye())return!1;const t=Uh();return typeof(t==null?void 0:t.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(R2(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(R2(e,"audio"))))}function Fut(){var t;const e=Jxe();return typeof(e==null||(t=e.prototype)==null?void 0:t.changeType)=="function"}var yc={DISABLED:0,SWITCHING:1,SWITCHED:2};const Uut=100;class tye extends JF{constructor(e,n,s){super(e,n,s,"stream-controller",vt.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=yc.DISABLED,this.audioOnly=!1,this._couldBacktrack=!1,this._backtrackFragment=void 0,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,i=r?r.currentTime:null;if(i===null||!at(i)||(this.log(`Media seeked to ${i}`),!this.getBufferedFrag(i)))return;const a=this.getFwdBufferInfoAtPos(r,i,vt.MAIN,0);if(!a||a.len===0){this.log(`Main buffer empty at ${i} on "seeked" event: ${a&&a.len}`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(H.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.LEVEL_LOADING,this.onLevelLoading,this),e.on(H.LEVEL_LOADED,this.onLevelLoaded,this),e.on(H.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(H.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(H.BUFFER_CREATED,this.onBufferCreated,this),e.on(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(H.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.LEVEL_LOADED,this.onLevelLoaded,this),e.off(H.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(H.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(H.BUFFER_CREATED,this.onBufferCreated,this),e.off(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,n){if(this.levels){const{lastCurrentTime:s,hls:r}=this;if(this.stopLoad(),this.setInterval(Uut),this.level=-1,!this.startFragRequested){let i=r.startLevel;i===-1&&(r.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=r.firstAutoLevel),r.nextLoadLevel=i,this.level=r.loadLevel,this._hasEnoughToStart=!!n}s>0&&e===-1&&!n&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${s}`),e=s),this.state=Ne.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,!n&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this._hasEnoughToStart=this.startFragRequested=!1),this.tick()}else this._forceStartLoad=!0,this.state=Ne.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ne.WAITING_LEVEL:{const{levels:e,level:n}=this,s=e==null?void 0:e[n],r=s==null?void 0:s.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=Ne.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ne.IDLE;break}break}case Ne.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Ne.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:n,levels:s,media:r}=this;if(n===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[i]))return;const a=s[i],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const x={type:this.targetBufferType()};this.hls.trigger(H.BUFFER_EOS,x),this.state=Ne.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const u=a.details;if(!u||this.state===Ne.WAITING_LEVEL||this.waitForLive(a)){this.level=i,this.state=Ne.WAITING_LEVEL,this.startFragRequested=!1;return}const d=o.len,f=this.getMaxBufferLength(a.maxBitrate);if(d>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=void 0);const p=this.backtrackFragment?this.backtrackFragment.start:o.end;let m=this.getNextFragment(p,u);if(this.couldBacktrack&&!this.fragPrevious&&m&&vr(m)&&this.fragmentTracker.getState(m)!==ur.OK){var v;const y=((v=this.backtrackFragment)!=null?v:m).sn-u.startSN,S=u.fragments[y-1];S&&m.cc===S.cc&&(m=S,this.fragmentTracker.removeFragment(S))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=void 0);if(m&&this.isLoopLoading(m,p)){if(!m.gap){const y=this.audioOnly&&!this.altAudio?Is.AUDIO:Is.VIDEO,S=(y===Is.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;S&&this.afterBufferFlushed(S,y)}m=this.getNextFragmentLoopLoading(m,u,o,vt.MAIN,f)}m&&(this.exceedsMaxBuffer(o,f,m)||this.loadFragment(m,a,p))}loadFragment(e,n,s){const r=this.fragmentTracker.getState(e);r===ur.NOT_LOADED||r===ur.PARTIAL?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,n)):super.loadFragment(e,n,s):this.clearTrackerIfNeeded(e)}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==yc.DISABLED){var e;(((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")}}getBufferOutput(){return this.mediaBuffer&&this.altAudio===yc.SWITCHED?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const s=this.fragPlaying;if(s){const r=s.level;this.hls.trigger(H.FRAG_CHANGED,{frag:s,previousFrag:e}),(e==null?void 0:e.level)!==r&&this.hls.trigger(H.LEVEL_SWITCHED,{level:r})}return!0}get backtrackFragment(){return this._backtrackFragment}set backtrackFragment(e){this._backtrackFragment=e}get couldBacktrack(){return this._couldBacktrack}set couldBacktrack(e){this._couldBacktrack=e}abortCurrentFrag(){this.backtrackFragment=void 0,super.abortCurrentFrag()}flushMainBuffer(e,n){super.flushMainBuffer(e,n,this.targetBufferType())}targetBufferType(){return this.altAudio===yc.SWITCHED&&!this.audioOnly?"video":null}onMediaAttached(e,n){super.onMediaAttached(e,n);const s=n.media;ns(s,"playing",this.onMediaPlaying),ns(s,"seeked",this.onMediaSeeked)}onMediaDetaching(e,n){const{media:s}=this;s&&(Xn(s,"playing",this.onMediaPlaying),Xn(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,super.onMediaDetaching(e,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.backtrackFragment=void 0,this.altAudio=yc.DISABLED,this.audioOnly=!1}onManifestParsed(e,n){let s=!1,r=!1;for(let i=0;i<n.levels.length;i++){const a=n.levels[i].audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=s&&r&&!Fut(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(e,n){const{levels:s}=this;if(!s||this.state!==Ne.IDLE)return;const r=n.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Ne.WAITING_LEVEL)}onLevelLoaded(e,n){var s;const{levels:r,startFragRequested:i}=this,a=n.level,o=n.details,l=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const u=n.levelInfo,d=this.fragCurrent;d&&(this.state===Ne.FRAG_LOADING||this.state===Ne.FRAG_LOADING_WAITING_RETRY)&&d.level!==n.level&&d.loader&&this.abortCurrentFrag();let f=0;if(o.live||(s=u.details)!=null&&s.live){var p;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(p=this.levelLastLoaded)==null?void 0:p.details)}if(u.details=o,this.levelLastLoaded=u,i||this.setStartPosition(o,f),this.hls.trigger(H.LEVEL_UPDATED,{details:o,level:a}),this.state===Ne.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Ne.IDLE}i&&o.live&&this.synchronizeToLiveEdge(o),this.initPTS.some((m,v)=>{if(v>=o.startCC)return!0;delete this.initPTS[v]}),this.tick()}synchronizeToLiveEdge(e){const{config:n,media:s}=this;if(!s)return;const r=this.hls.liveSyncPosition,i=this.playhead,a=e.fragmentStart,o=e.edge,l=i>=a-n.maxFragLookUpTolerance&&i<=o;if(r!==null&&s.duration>r&&(i<r||!l)){const d=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*e.targetduration;if((!l&&s.readyState<4||i<o-d)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),s.readyState))if(this.warn(`Playback: ${i} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r}`),this.config.liveSyncMode==="buffered"){var u;const f=Bt.bufferInfo(s,r,0);if(!((u=f.buffered)!=null&&u.length)){s.currentTime=r;return}if(f.start<=i){s.currentTime=r;return}const{nextStart:m}=Bt.bufferedInfo(f.buffered,i,0);m&&(s.currentTime=m)}else s.currentTime=r}}_handleFragmentLoadProgress(e){var n;const s=e.frag,{part:r,payload:i}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=a[s.level];if(!o){this.warn(`Level ${s.level} not found on progress`);return}const l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const u=o.videoCodec,d=l.PTSKnown||!l.live,f=(n=s.initSegment)==null?void 0:n.data,p=this._getAudioCodec(o),m=this.transmuxer=this.transmuxer||new Exe(this.hls,vt.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=r?r.index:-1,x=v!==-1,{decryptRange:y,byteRange:S}=m5(s,r,this.iframesOnly),_=new YF(s.level,s.sn,s.stats.chunkCount,S?S.end-S.start:i.byteLength,v,x,s.duration,this.iframesOnly,y),E=this.initPTS[s.cc];m.push(i,f,p,u,s,r,l.totalduration,d,_,E)}onAudioTrackSwitching(e,n){const s=this.hls,r=this.altAudio!==yc.DISABLED;if(p5(n.url,s))this.altAudio=yc.SWITCHING;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=yc.DISABLED,this.fragmentTracker.removeAllFragments(),s.once(H.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(H.AUDIO_TRACK_SWITCHED,n)}),s.trigger(H.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(H.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(e,n){const s=p5(n.url,this.hls);if(s){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=s?yc.SWITCHED:yc.DISABLED,this.tick()}onBufferCreated(e,n){const s=n.tracks;let r,i,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(i=o,r=l,o==="video"){const u=s[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,n){const{frag:s,part:r}=n,i=s.type===vt.MAIN;if(i){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Ne.PARSED&&(this.state=Ne.IDLE);return}let l=!1;if(vr(s)&&(l=!!s.gap&&!s.tagList.some(u=>u[0]==="GAP")),this.fragBufferedComplete(s,r),l){var a;s.stats.retry++;const u=(a=this.levels)==null?void 0:a[s.level];u&&u.fragmentError++}}const o=this.media;o&&(!this._hasEnoughToStart&&Bt.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,n){var s;if(n.fatal){this.state=Ne.ERROR;return}switch(n.details){case pe.FRAG_GAP:case pe.FRAG_PARSING_ERROR:case pe.FRAG_DECRYPT_ERROR:case pe.FRAG_LOAD_ERROR:case pe.FRAG_LOAD_TIMEOUT:case pe.KEY_LOAD_ERROR:case pe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(vt.MAIN,n);break;case pe.LEVEL_LOAD_ERROR:case pe.LEVEL_LOAD_TIMEOUT:case pe.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Ne.WAITING_LEVEL&&((s=n.context)==null?void 0:s.type)===hn.LEVEL&&(this.state=Ne.IDLE);break;case pe.BUFFER_APPEND_NO_PROGRESS:if(n.parent!=="main")return;n.frag&&(n.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${n.frag.sn} of level ${n.frag.level} as a gap after ${n.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(n.frag));break;case pe.BUFFER_ADD_CODEC_ERROR:case pe.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case pe.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case pe.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=Ne.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:n}){if(n!==Is.AUDIO||!this.altAudio){const s=(n===Is.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,n),this.tick())}}onLevelsUpdated(e,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const n=e.currentTime;let s=this.startPosition;if(s>=0&&n<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${n}`);return}const r=this.timelineOffset;r&&s&&(s+=r);const i=this.getLevelDetails(),a=Bt.getBuffered(e),o=a.length?a.start(0):0,l=o-s,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<u||this.loadingParts&&l<2*((i==null?void 0:i.partTarget)||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),s+=l,this.startPosition=s),n<s&&(this.log(`seek to target start position ${s} from current time ${n} buffer start ${o}`),e.currentTime=s)}}_getAudioCodec(e){let n=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(e,n){e.bitrateTest=!0,this._doFragLoad(e,n).then(s=>{const{hls:r}=this,i=s==null?void 0:s.frag;if(!i||this.fragContextChanged(i))return;n.fragmentError=0,this.state=Ne.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=i.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(H.FRAG_LOADED,s),i.bitrateTest=!1}).catch(s=>{this.state===Ne.STOPPED||this.state===Ne.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const n=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:i}=e,a=this.getCurrentContext(i);if(!a){this.resetWhenMissingContext(i);return}const{frag:o,part:l,level:u}=a,{video:d,text:f,id3:p,initSegment:m}=r,{details:v}=u,x=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Ne.PARSING,m){const y=m.tracks;if(y){const T=o.initSegment||o;if(this.unhandledEncryptionError(m,o))return;this._bufferInitSegment(u,y,T,i),s.trigger(H.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:n,tracks:y})}const S=m.initPTS,_=m.timescale,E=this.initPTS[o.cc];if(at(S)&&(!E||E.baseTime!==S||E.timescale!==_)){const T=m.trackId;this.initPTS[o.cc]={baseTime:S,timescale:_,trackId:T};const k=this.initPTS.slice(0);s.trigger(H.INIT_PTS_FOUND,{timestampOffsets:k,frag:o,id:n,initPTS:S,timescale:_,trackId:T})}}if(d&&v){x&&d.type==="audiovideo"&&this.logMuxedErr(o);const y=v.fragments[o.sn-1-v.startSN],S=o.sn===v.startSN,_=!y||o.cc>y.cc;if(r.independent!==!1){const{startPTS:E,endPTS:T,startDTS:k,endDTS:R}=d;if(l)l.elementaryStreams[d.type]={startPTS:E,endPTS:T,startDTS:k,endDTS:R};else if(d.firstKeyFrame&&d.independent&&i.id===1&&!_&&(this.couldBacktrack=!0),d.dropped&&d.independent){const I=this.getMainFwdBufferInfo(),A=(I?I.end:this.getLoadPosition())+this.config.maxBufferHole,L=d.firstKeyFramePTS?d.firstKeyFramePTS:E;if(!S&&A<L-this.config.maxBufferHole&&!_){this.backtrack(o);return}else _&&(o.gap=!0);o.setElementaryStreamInfo(d.type,o.start,T,o.start,R,!0)}else S&&E-(v.appliedTimelineOffset||0)>hT&&(o.gap=!0);o.setElementaryStreamInfo(d.type,E,T,k,R),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(d,o,l,i,S||_)}else if(S||_)o.gap=!0;else{this.backtrack(o);return}}if(x){const{startPTS:y,endPTS:S,startDTS:_,endDTS:E}=x;l&&(l.elementaryStreams[Is.AUDIO]={startPTS:y,endPTS:S,startDTS:_,endDTS:E}),o.setElementaryStreamInfo(Is.AUDIO,y,S,_,E),this.bufferFragmentData(x,o,l,i)}if(v&&p!=null&&p.samples.length){const y={id:n,frag:o,details:v,samples:p.samples};s.trigger(H.FRAG_PARSING_METADATA,y)}if(v&&f){const y={id:n,frag:o,details:v,samples:f.samples};s.trigger(H.FRAG_PARSING_USERDATA,y)}}logMuxedErr(e){this.warn(`${vr(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,n,s,r){if(this.state!==Ne.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(s));const{audio:i,video:a,audiovideo:o}=n;if(i){const u=e.audioCodec;let d=cT(i.codec,u);if(d==="mp4a"&&(d="mp4a.40.5"),this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const f=i.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&!Gat()&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&qat()&&i.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),u&&u!==d&&this.log(`Swapping manifest audio codec "${u}" for "${d}"`),i.levelCodec=d,i.id=vt.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${d||""}/${u||""}/${i.codec}]`),delete n.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=vt.MAIN;const u=a.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${a.codec!==u?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete n.audiovideo}o&&(this.iframesOnly&&this.logMuxedErr(s),this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete n.video,delete n.audio);const l=Object.keys(n);if(l.length){if(this.hls.trigger(H.BUFFER_CODECS,n),!this.hls)return;l.forEach(u=>{const f=n[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(H.BUFFER_APPENDING,{type:u,data:f,frag:s,part:null,chunkMeta:r,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.getBufferOutput();return this.getFwdBufferInfo(e,vt.MAIN)}get maxBufferLength(){const{levels:e,level:n}=this,s=e==null?void 0:e[n];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Ne.IDLE}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return at(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var e;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(at(n)){const s=this.getLevelDetails(),r=this.currentFrag||(s?f1(null,s.fragments,n):null);if(r){const i=r.programDateTime;if(i!==null){const a=i+(n-r.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class nye extends tye{constructor(...e){super(...e),this.currentOp=void 0,this.nextOp=void 0,this.cached=[],this.cachedSize=0,this.cacheFragmentData=!0,this.initDetails=void 0,this.onBufferedToEnd=()=>{const n=this.media;n!=null&&n.seeking&&(n.currentTime=n.currentTime)},this.onMediaSeeking=()=>{}}setInitPts(e){this.initPTS=e.slice()}loadMediaAt(e,n){if(!this.hls)return;const{seekOnAppend:s}=n,r=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=r,this.startPosition=e,this.state){case Ne.STOPPED:case Ne.ENDED:case Ne.ERROR:this.state=Ne.IDLE}this.state===Ne.IDLE?(this.hls.resumeBuffering(),this.tick(),this.currentOp=[r,n]):this.nextOp=[r,n],this.hls.off(H.BUFFERED_TO_END,this.onBufferedToEnd);const i=this.media;s&&i&&this.seekTo(r)&&(this.currentOp=[r,n],this.nextOp=void 0,this.flushPipeline(r,!0))}seekTo(e){const n=this.media;if(n){var s;const r=(s=this.getLevelDetails())==null?void 0:s.edge,i=r!==void 0?r:n.duration;if(e>=i&&(e=i-.01),Bt.bufferInfo(n,e,0).len>0&&this.getBufferedAt(e))return n.currentTime=e,!0}return!1}getBufferedAt(e){return this.fragmentTracker.getBufferedFrag(e,vt.MAIN)}cacheSet(e,n){if(!this.hls)return;e.data=n;const s=this.cached;s.push(e),this.cachedSize+=n.buffer.byteLength;const r=this.hls.config.iframeCacheLimit;for(;this.cachedSize>r&&s.length>1;){const i=s.shift();if(i.data)this.cachedSize-=i.data.byteLength,i.data=void 0;else{this.cached=s.filter(a=>!!a.data),this.cachedSize=s.reduce((a,{data:o})=>o?o.buffer.byteLength:0,0);break}}}onHandlerDestroying(){this.cached.length=0,this.cachedSize=0,super.onHandlerDestroying()}_handleFragmentLoadProgress(e){const n=e.frag,{part:s,payload:r}=e;this.cacheFragmentData&&!s&&r!=null&&r.byteLength&&!n.data&&vr(n)&&this.cacheSet(n,new Uint8Array(r.slice(0))),super._handleFragmentLoadProgress(e)}loadFragment(e,n,s){const r=this.fragmentTracker.getState(e);if((r===ur.NOT_LOADED||r===ur.PARTIAL)&&this.canReplayCached(e)){this.replayCachedFragment(e);return}super.loadFragment(e,n,s)}canReplayCached(e){var n;if(!this.cacheFragmentData||!((n=e.data)!=null&&n.byteLength))return!1;const s=e.decryptdata;return(s==null?void 0:s.keyFormat)!=="identity"||!!s.key}replayCachedFragment(e){const n=e.data.slice().buffer;this.log(`Buffering cached ${e.type} sn: ${e.sn} of level ${e.level} (${n.byteLength} bytes)`),this.fragCurrent=e,this.startFragRequested=!0;const s=e.stats=new BF;s.loading.start=s.loading.first=s.loading.end=self.performance.now(),s.loaded=s.total=n.byteLength,s.chunkCount=1,this.state=Ne.FRAG_LOADING;const r={frag:e,part:null,payload:n,networkDetails:null};this._handleFragmentLoadProgress(r),this.hls.trigger(H.FRAG_LOADED,r),this._handleFragmentLoadComplete(r)}fragBufferedComplete(e,n){super.fragBufferedComplete(e,n);const{currentOp:s,nextOp:r}=this;this.currentOp=this.nextOp=void 0,this.state=Ne.STOPPED,s!=null&&s[1].seekOnAppend&&(this.flushPipeline(s[0],!r),this.seekTo(s[0])||this.log(`Could not seek to ${s[0]} after fragment buffered (superseded or flushed) buffer: ${this.media?y5(Bt.getBuffered(this.media)):"none"}`)),r&&this.loadMediaAt.apply(this,r)}flushPipeline(e,n){if(n){const s=this.media;if(s){const r=Bt.bufferInfo(s,e,0),i=r.len?r.nextStart:0;i&&(this.fragmentTracker.removeFragmentsInRange(i,1/0,vt.MAIN),this.flushMainBuffer(i,1/0))}this.hls.once(H.BUFFERED_TO_END,this.onBufferedToEnd)}this.hls.trigger(H.BUFFER_EOS,{type:"video"})}get playhead(){return this.nextLoadPosition}startLoad(){if(!this.startFragRequested){const e=this.hls;e.nextLoadLevel=e.startLevel===-1?0:e.firstAutoLevel}}seekToStartPos(){}setStartPosition(){}alignPlaylists(e,n,s){const r=this.initDetails;return this.initDetails=null,super.alignPlaylists(e,n,s||r||void 0)}getMainFwdBufferInfo(){const e=this.playhead,n=this.getBufferedAt(e);if(n){const s=n.duration;return{len:s,start:e,end:e+s,bufferedIndex:-1}}return{len:0,start:e,end:e,bufferedIndex:-1}}_streamEnded(){const e=this.playhead,n=this.fragmentTracker.getBufferedFrag(e,vt.MAIN);return!!(n!=null&&n.endList)}}class But extends nye{constructor(...e){super(...e),this._img=void 0,this.queued=void 0,this.cacheFragmentData=!1}get image(){return this._img}set image(e){var n;const s=(n=this._img)==null?void 0:n.src;s&&self.URL.revokeObjectURL(s),this._img=e}loadMediaAt(e){if(!this.hls)return;const n=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=n,this.startPosition=e,this.state){case Ne.STOPPED:case Ne.ENDED:case Ne.ERROR:this.state=Ne.IDLE}if(this.state===Ne.IDLE){if(this.hls.resumeBuffering(),this.media||(this.media={}),this.tick(),this.state===Ne.IDLE){const s=this.getBufferedAt(e);s&&(this.fragCurrent=s,this.updateImage(s,null))}}else{const s=this.fragCurrent;(!s||e>=s.start&&e<s.end)&&(this.queued=[n])}}updateImage(e,n,s){const r=e.data;r||this.fragmentTracker.removeFragment(e);const i=this._img;if(i&&r){const a=self.performance.now(),o=n?n.stats:e.stats;o.buffering.start=e.stats.buffering.start=a,i.onload=()=>{if(!this.hls)return;const d=this.hls.levels[e.level];d!=null&&d.fragmentError&&(d.fragmentError=0,e.stats.retry=0);const f=self.performance.now(),p=n?n.stats:e.stats;p.buffering.end=e.stats.buffering.end=f,this.hls.trigger(H.FRAG_BUFFERED,{frag:e,part:n,stats:p,id:e.type,chunkMeta:s})},i.onerror=()=>{this.handleError("Image decode error",e,n,s)};const l=i.src;l&&self.URL.revokeObjectURL(l);const u=new Blob([r],{type:"image/jpeg"});i.src=self.URL.createObjectURL(u)}else this.state=Ne.STOPPED,this.processQueued()}processQueued(){const e=this.queued;this.queued=void 0,e&&this.loadMediaAt.apply(this,e)}handleError(e,n,s,r){if(!this.hls)return;const i=new Error(e);this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_PARSING_ERROR,chunkMeta:r,frag:n,part:s,fatal:!1,error:i,err:i})}_bufferInitSegment(){}bufferFragmentData(e,n,s,r){super.bufferFragmentData(e,n,s,r,!0);const i=Yt(new Uint8Array(e.data1),["mdat"]);if(i.length===0){this.handleError("Could not find I-Frame mdat",n,s,r);return}const a=n;this.cacheSet(a,i[0]),this.updateImage(a,s,r)}fragBufferedComplete(e,n){this.fragmentTracker.fragBuffered(e,!0),super.fragBufferedComplete(e,n),this.processQueued()}checkFragPlaying(){var e;const n=(e=this.fragPrevious)==null?void 0:e.start;if(n!==void 0){const s=this.getAppendedFrag(n);if(s&&!zy(s,this.fragPlaying))return this.fragPlaying=s,!0}return!1}getMainFwdBufferInfo(){return{len:0,start:this.playhead,end:this.playhead,bufferedIndex:-1}}}const zut=10,Vut="Image I-Frame player does not accept HTMLMediaElements",cne={seekOnAppend:!0};let FE,e8;class Hut extends Oo{constructor(e,n){super("iframes",e.logger),this.hls=void 0,this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances=void 0,this.instanceCounter=0,FE||(FE=Gut(n)),e8||(e8=Wut(FE)),this.hls=e,this.iframeInstances=[],this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(H.MANIFEST_LOADING,this.clearAsset,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this),e.on(H.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(H.MANIFEST_LOADING,this.clearAsset,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this),e.off(H.DESTROYING,this.onDestroying,this))}clearAsset(){this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances.forEach(e=>e.destroy()),this.iframeInstances.length=0}onDestroying(){this.unregisterListeners(),this.clearAsset(),this.hls=void 0}onManifestLoaded(e,n){this.stats=n.stats,this.variableList=n.variableList}onLevelsUpdated(e,{levels:n}){var s;const r=(s=this.hls)==null?void 0:s.pathwayPriority;n.length&&r&&this.iframeInstances.forEach(i=>{i.pathwayPriority=r})}onInitPtsFound(e,{id:n,timestampOffsets:s}){n===vt.MAIN&&(this.initPTS=s)}onFragBuffered(e,n){var s;const r=this.hls;r&&r.hasEnoughToStart&&(((s=r.mainForwardBufferInfo)==null?void 0:s.len)||0)>zut&&this.iframeInstances.forEach(i=>{if(!i.loadingEnabled){var a;i.startLoad(((a=this.hls)==null||(a=a.media)==null?void 0:a.currentTime)||0)}})}createIFramePlayer(e){var n;return this.createInstance(FE,(n=this.hls)==null?void 0:n.iframeVariants,e)}createImageIFramePlayer(e){var n;const s=(n=this.hls)==null?void 0:n.iframeVariants.filter(r=>r.imageCodec);return this.createInstance(e8,s,e,"image-")}createInstance(e,n,s,r){const{hls:i}=this;if(!i)return null;const{url:a,userConfig:o,latestLevelDetails:l,loadLevelObj:u,loadLevel:d,bandwidthEstimate:f,sessionId:p}=i,{stats:m,variableList:v}=this;if(!(n!=null&&n.length)||!m||!a)return null;const x=`${r||""}iframe-player-${this.instanceCounter++}`,y=i.levels,S=u||y[d],_=F1e(S,o.videoPreference),E=(S==null?void 0:S.pathwayId)||".",T=Rt(Rt({},o),{},{loggerId:x,primarySessionId:p,videoPreference:_,abrEwmaDefaultEstimate:f,streamController:void 0,audioStreamController:void 0,audioTrackController:void 0,subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,id3TrackController:void 0,fpsController:void 0,gapController:void 0,iframeController:void 0,cmcd:void 0,interstitialsController:void 0,backBufferLength:1/0,maxMaxBufferLength:1,capLevelToPlayerSize:!0,enableWorker:!1,autoStartLoad:!1,startFragPrefetch:!1,testBandwidth:!1,progressive:!1},s),k=new e(T,a,this.initPTS,l);return this.iframeInstances=this.iframeInstances.filter(R=>!R.url),this.iframeInstances.push(k),k.trigger(H.MANIFEST_LOADED,{levels:n,contentSteering:{uri:"",pathwayId:E},sessionKeys:null,audioTracks:[],iframeVariants:[],sessionData:null,startTimeOffset:null,stats:m,networkDetails:null,url:a,variableList:v}),k}}function Gut(t){return class extends t{constructor(n,s,r,i){n.streamController||(n.streamController=nye),super(n),this._url=s,this.streamController.setInitPts(r),this.streamController.initDetails=i}loadSource(){}loadMediaAt(n,s=cne){if(n<0)return;const r=Rt(Rt({},cne),s);this.loadingEnabled||this.startLoad(n),this.streamController.loadMediaAt(n,r)}}}function Wut(t){return class extends t{constructor(n,s,r,i){n.cmcdController=void 0,n.emeController=void 0,n.streamController||(n.streamController=But),n.capLevelController=void 0,n.bufferController=void 0,super(n,s,r,i)}attachImage(n){this.streamController.image=n}detachImage(){this.streamController.image=void 0}loadSource(){}attachMedia(){throw new Error(Vut)}detachMedia(){}recoverMediaError(){}transferMedia(){return null}loadMediaAt(n){if(n<0)return null;this.loadingEnabled||this.startLoad(n),this.streamController.loadMediaAt(n)}}}const xh=.025;let E5=(function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t})({});function qut(t,e,n){return`${t.identifier}-${n+1}-${Rb(e)}`}class Kut{constructor(e,n){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=n,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var n;if(e>0&&e>=this.assetList.length)return!0;const s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((n=this.assetList[e])==null?void 0:n.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return une(n,e)?pT(e,n):e}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const n=this.dateRange.startTime,s=pT(n,e);return n-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,n=at(e)?e:this.duration;return this.cumulativeDuration+n}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return une(n,e)?pT(e,n):e}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<xh))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(e)&&e<n&&(n=e),n}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?E5.Range:E5.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Yut(this)}}function pT(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<xh)?e.start:e.start+e.duration}function une(t,e){return e>t.start-xh&&e<t.start+t.duration+xh}function sye(t,e,n){const s=new self.URL(t,n);return s.protocol!=="data:"&&vh(s,"_HLS_primary_id",e),s}function t8(t,e){for(;(n=t.assetList[++e])!=null&&n.error;)var n;return e}function Yut(t){return`["${t.identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`}function w0(t){const e=t.timelineStart,n=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+n).toFixed(2)}]`}class Zut{constructor(e,n,s,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(H.PLAYOUT_LIMIT_REACHED,{})};const i=this.hls=new e(n);this.interstitial=s,this.assetItem=r;const a=()=>{this.hasDetails=!0};i.once(H.LEVEL_LOADED,a),i.once(H.AUDIO_TRACK_LOADED,a),i.once(H.SUBTITLE_TRACK_LOADED,a),i.on(H.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(H.BUFFER_APPENDED,()=>{const d=this.bufferedEnd;this.reachedPlayout(d)&&(this._bufferedEosTime=d,i.trigger(H.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let n=this.assetItem.uri;try{n=sye(n,e.config.primarySessionId||"").href}catch{}e.loadSource(n)}}bufferedInPlaceToEnd(e,n){var s;if(!this.appendInPlace)return!1;if((s=this.hls)!=null&&s.bufferedToEnd)return!0;if(!e)return!1;const r=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset+(n||0),a=Bt.bufferInfo(e,i,.02);return this.getAssetTime(a.end)>=r-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=Bt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const n=this.interstitial.playoutLimit;if(n){const s=n-this.startOffset;if(s>0&&s<e)return s}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const n=this.timelineOffset;if(e!==n){const s=e-n;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const n=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-n),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var n;this.loadSource(),(n=this.hls)==null||n.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const n=s=>delete s.details;e.levels.forEach(n),e.allAudioTracks.forEach(n),e.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(e,n,s){var r;(r=this.hls)==null||r.on(e,n)}once(e,n,s){var r;(r=this.hls)==null||r.once(e,n)}off(e,n,s){var r;(r=this.hls)==null||r.off(e,n)}toString(){var e;return`HlsAssetPlayer: ${w0(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const n8=.033;class Xut extends Oo{constructor(e,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,n){return this.events?this.events.reduce((s,r)=>e<=r.startOffset&&n>r.startOffset?(delete r.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,n){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[s]||(n===void 0&&(n=e.start),s=this.findItemIndexAtTime(n));s>=0&&(i=r[s])!=null&&i.event;){var i;s--}return s}findItemIndexAtTime(e,n){const s=this.items;if(s)for(let r=0;r<s.length;r++){let i=s[r];n&&n!=="primary"&&(i=i[n]);const a=i.start,o=s[r].event,l=o!=null&&o.cue.pre?o.duration:i.end;if(e===a||e>a&&e<l)return r}return-1}findJumpRestrictedIndex(e,n){const s=this.items;if(s)for(let r=e;r<=n&&s[r];r++){const i=s[r].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return r}return-1}findEventIndex(e){const n=this.items;if(n)for(let r=n.length;r--;){var s;if(((s=n[r].event)==null?void 0:s.identifier)===e)return r}return-1}findAssetIndex(e,n){const s=e.assetList,r=s.length;if(r>1)for(let i=0;i<r;i++){const a=s[i];if(!a.error){const o=a.timelineStart;if(n===o||n>o&&(n<o+(a.duration||0)||i===r-1))return i}}return 0}get assetIdAtEnd(){var e;const n=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(n){const s=n.assetList,r=s[s.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,n,s=0){const r=e.main.details,{dateRanges:i}=r,a=this.events,o=this.parseDateRanges(i,{url:r.url},n),l=Object.keys(i),u=a?a.filter(d=>l.indexOf(d.identifier)===-1):[];o.length&&o.sort((d,f)=>{const p=d.cue.pre,m=d.cue.post,v=f.cue.pre,x=f.cue.post;if(p&&!v)return-1;if(v&&!p||m&&!x)return 1;if(x&&!m)return-1;if(!p&&!v&&!m&&!x){const y=d.startTime,S=f.startTime;if(y!==S)return y-S}return d.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=o,u.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,u,s)}updateSchedule(e,n=[],s=0,r=!1){const i=this.events||[];if(i.length||n.length||this.length<2){const a=this.items,o=this.parseSchedule(i,e,s);(r||n.length||(a==null?void 0:a.length)!==o.length||o.some((u,d)=>Math.abs(u.playout.start-a[d].playout.start)>.005||Math.abs(u.playout.end-a[d].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(n,a))}}parseDateRanges(e,n,s){const r=[],i=Object.keys(e);for(let a=0;a<i.length;a++){const o=i[a],l=e[o];if(l.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(l):(u=new Kut(l,n),this.eventMap[o]=u,s===!1&&(u.appendInPlace=s)),r.push(u)}}return r}parseSchedule(e,n,s=0){const r=[],i=n.main.details,a=i.live?1/0:i.edge;let o=0;if(e=e.filter(u=>!u.error&&!(u.cue.once&&u.hasPlayed)),e.length){this.resolveOffsets(e,n);let u=0,d=0;if(e.forEach((f,p)=>{const m=f.cue.pre,v=f.cue.post,x=e[p-1]||null,y=f.appendInPlace,S=v?a:f.startOffset,_=f.duration,E=f.timelineOccupancy===E5.Range?_:0,T=m&&i.live?s+(f.resumeOffset||0):0,k=T||f.resumptionOffset,R=(x==null?void 0:x.startTime)===S,I=S+f.cumulativeDuration;let A=y?I+_:S+k;if(m||!v&&S<=0){const j=d;d+=E,f.timelineStart=I;const F=o;o+=_,r.push({event:f,start:I,end:A,playout:{start:F,end:o},integrated:{start:j,end:d}})}else if(S<=a){if(!R){const O=S-u;if(O>n8){const M=u,U=d;d+=O;const G=o;o+=O;const $={previousEvent:e[p-1]||null,nextEvent:f,start:M,end:M+O,playout:{start:G,end:o},integrated:{start:U,end:d}};r.push($)}else O>0&&x&&(x.cumulativeDuration+=O,r[r.length-1].end=S)}v&&(A=I),f.timelineStart=I;const j=d;d+=E;const F=o;o+=_,r.push({event:f,start:I,end:A,playout:{start:F,end:o},integrated:{start:j,end:d}})}else return;const L=T||f.resumeTime;v||L>a?u=a:!m&&A&&f.appendInPlaceStarted&&L-A>n8?u=A:u=L}),u<a){var l;const f=u,p=d,m=a-u;d+=m;const v=o;o+=m,r.push({previousEvent:((l=r[r.length-1])==null?void 0:l.event)||null,nextEvent:null,start:u,end:f+m,playout:{start:v,end:o},integrated:{start:p,end:d}})}this.setDurations(a,o,d)}else r.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return r}setDurations(e,n,s){this.durations={primary:e,playout:n,integrated:s}}resolveOffsets(e,n){const s=n.main.details,r=s.live?1/0:s.edge;let i=0,a=-1;e.forEach((o,l)=>{const u=o.cue.pre,d=o.cue.post,f=u?0:d?r:o.startTime;this.updateAssetDurations(o),a===f?o.cumulativeDuration=i:(i=0,a=f),!d&&o.snapOptions.in&&(o.resumeAnchor=f1(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,n)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<n8&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const m=at(o.resumeOffset)?o.resumeOffset:o.duration;i+=m})}primaryCanResumeInPlaceAt(e,n){const s=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(s-r)>xh?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${r}`),!1):!Object.keys(n).some(a=>{const o=n[a].details,l=o.edge;if(s>=l)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${l}`),!1;const u=f1(null,o.fragments,s);if(!u)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const d=a==="audio"?.175:0;return Math.abs(u.start-s)<xh+d||Math.abs(u.end-s)<xh+d?!1:(this.log(`"${e.identifier}" resumption ${s} not aligned with ${a} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const n=e.timelineStart;let s=0,r=!1,i=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=n+s;o.startOffset=s,o.timelineStart=l,r||(r=o.duration===null),i||(i=!!o.error);const u=o.error?0:o.duration||0;s+=u}r&&!i?e.duration=Math.max(s,e.duration):e.duration=s}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ho(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}class Qut{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,n){const s=e.assetListUrl;let r;try{r=sye(s,this.hls.sessionId,e.baseUrl)}catch(p){const m=this.assignAssetListError(e,pe.ASSET_LIST_LOAD_ERROR,p,s);this.hls.trigger(H.ERROR,m);return}n&&r.protocol!=="data:"&&vh(r,"_HLS_start_offset",""+n);const i=this.hls.config,a=i.loader,o=new a(i),l={type:hn.INTERSTITIAL_ASSET_LIST,responseType:"json",url:r.href},u=i.interstitialAssetListLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(p,m,v,x)=>{const y=p.data,S=y==null?void 0:y.ASSETS;if(!Array.isArray(S)){const _=this.assignAssetListError(e,pe.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),v.url,m,x);this.hls.trigger(H.ERROR,_);return}e.assetListResponse=y,this.hls.trigger(H.ASSET_LIST_LOADED,{event:e,assetListResponse:y,networkDetails:x})},onError:(p,m,v,x)=>{const y=this.assignAssetListError(e,pe.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${p.code} ${p.text} (${m.url})`),m.url,x,v);this.hls.trigger(H.ERROR,y)},onTimeout:(p,m,v)=>{const x=this.assignAssetListError(e,pe.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${m.url})`),m.url,p,v);this.hls.trigger(H.ERROR,x)}};return o.load(l,d,f),this.hls.trigger(H.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,n,s,r,i,a){return e.error=s,{type:_t.NETWORK_ERROR,details:n,fatal:!1,interstitial:e,url:r,error:s,networkDetails:a,stats:i}}}function dne(t){var e;t==null||(e=t.play())==null||e.catch(()=>{})}function Ep(t,e){return`[${t}] Advancing timeline position to ${e}`}class Jut extends Oo{constructor(e,n){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.bufferPastEdge=!1,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const r=s-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&s<o.start||s>=o.end){var l;const m=this.findItemIndex(o);let v=this.schedule.findItemIndexAtTime(s);if(v===-1&&(v=m+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${s} (resolving from ${m} to ${v})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&v>m){const x=this.schedule.findJumpRestrictedIndex(m+1,v);if(x>m){this.setSchedulePosition(x);return}}this.setSchedulePosition(v);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const m=o.event.assetList[0];m&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,m))}return}const d=u.timelineStart,f=u.duration||0;if(a&&s<d||s>=d+f){var p;(p=o.event)!=null&&p.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,u)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(s>=r.end){this.timelinePos=r.end;const o=this.findItemIndex(r);this.setSchedulePosition(o+1)}const i=this.playingAsset;if(!i)return;const a=i.timelineStart+(i.duration||0);s>=a&&this.setScheduleToAssetAtTime(s,i)},this.onScheduleUpdate=(s,r)=>{const i=this.schedule;if(!i)return;const a=this.playingItem,o=i.events||[],l=i.items||[],u=i.durations,d=s.map(x=>x.identifier),f=!!(o.length||d.length);(f||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
503Schedule: ${l.map(x=>ho(x))} pos: ${this.timelinePos}`),d.length&&this.log(`Removed events ${d}`);let p=null,m=null;a&&(p=this.updateItem(a,this.timelinePos),this.itemsMatch(a,p)?this.playingItem=p:this.waitingItem=null),this.waitingItem=this.updateItem(this.waitingItem);const v=this.bufferingItem;if(v&&(m=this.updateItem(v,this.bufferedPos),this.itemsMatch(v,m)?this.bufferingItem=m:v.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(v.event,null))),s.forEach(x=>{x.assetList.forEach(y=>{this.clearAssetPlayer(y.identifier,null)})}),this.playerQueue.forEach(x=>{if(x.interstitial.appendInPlace){const y=x.assetItem.timelineStart,S=x.timelineOffset-y;if(S)try{x.timelineOffset=y}catch(_){Math.abs(S)>xh&&this.warn(`${_} ("${x.assetId}" ${x.timelineOffset}->${y})`)}}}),f||r){if(this.hls.trigger(H.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:u,removedIds:d}),this.isInterstitial(a)&&d.indexOf(a.event.identifier)>-1){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(p,a),v&&m!==p&&this.trimInPlace(m,v),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=n,this.assetListLoader=new Qut(e),this.schedule=new Xut(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(H.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(H.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(H.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(H.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(H.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(H.BUFFER_APPENDED,this.onBufferAppended,this),e.on(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(H.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(H.MEDIA_ENDED,this.onMediaEnded,this),e.on(H.ERROR,this.onError,this),e.on(H.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(H.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(H.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(H.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(H.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(H.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(H.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(H.BUFFER_CODECS,this.onBufferCodecs,this),e.off(H.BUFFER_APPENDED,this.onBufferAppended,this),e.off(H.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(H.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(H.MEDIA_ENDED,this.onMediaEnded,this),e.off(H.ERROR,this.onError,this),e.off(H.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Xn(e,"play",this.onPlay),Xn(e,"pause",this.onPause),Xn(e,"seeking",this.onSeeking),Xn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,n){const s=this.media=n.media;ns(s,"seeking",this.onSeeking),ns(s,"timeupdate",this.onTimeupdate),ns(s,"play",this.onPlay),ns(s,"pause",this.onPause)}onMediaAttached(e,n){const s=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!r){this.clearScheduleState();const i=this.findItemIndex(s);this.setSchedulePosition(i)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,n){const s=!!n.transferMedia,r=this.media;if(this.media=null,!s&&(r&&this.removeMediaListeners(r),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.log(`Removing schedule state for detachedData and ${i}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,n=()=>e.bufferingItem||e.waitingItem,s=f=>f&&e.getAssetPlayer(f.identifier),r=(f,p,m,v,x)=>{if(f){let y=f[p].start;const S=f.event;if(S){if(p==="playout"||S.timelineOccupancy!==E5.Point){const _=s(m);(_==null?void 0:_.interstitial)===S&&(y+=_.assetItem.startOffset+_[x])}}else{const _=v==="bufferedPos"?a():e[v];y+=_-f.start}return y}return 0},i=(f,p)=>{var m;if(f!==0&&p!=="primary"&&(m=e.schedule)!=null&&m.length){var v;const x=e.schedule.findItemIndexAtTime(f),y=(v=e.schedule.items)==null?void 0:v[x];if(y){const S=y[p].start-y.start;return f+S}}return f},a=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var p,m;return(p=e.primaryDetails)!=null&&p.live?e.primaryDetails.edge:((m=e.schedule)==null?void 0:m.durations[f])||0},l=(f,p)=>{var m,v;const x=e.effectivePlayingItem;if(x!=null&&(m=x.event)!=null&&m.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${p}"`);const y=e.effectivePlayingItem,S=e.schedule.findItemIndexAtTime(f,p),_=(v=e.schedule.items)==null?void 0:v[S],E=e.getBufferingPlayer(),T=E==null?void 0:E.interstitial,k=T==null?void 0:T.appendInPlace,R=y&&e.itemsMatch(y,_);if(y&&(k||R)){const I=s(e.playingAsset),A=(I==null?void 0:I.media)||e.primaryMedia;if(A){const L=p==="primary"?A.currentTime:r(y,p,e.playingAsset,"timelinePos","currentTime"),j=f-L,F=(k?L:A.currentTime)+j;if(F>=0&&(!I||k||F<=I.duration)){A.currentTime=F;return}}}if(_){let I=f;if(p!=="primary"){const L=_[p].start,j=f-L;I=_.start+j}const A=!e.isInterstitial(_);if((!e.isInterstitial(y)||y.event.appendInPlace)&&(A||_.event.appendInPlace)){const L=e.media||(k?E==null?void 0:E.media:null);L&&(L.currentTime=I)}else if(y){const L=e.findItemIndex(y);if(S>L){const F=e.schedule.findJumpRestrictedIndex(L+1,S);if(F>L){e.setSchedulePosition(F);return}}let j=0;if(A)e.timelinePos=I,e.checkBuffer();else{const F=_.event.assetList,O=f-(_[p]||_).start;for(let M=F.length;M--;){const U=F[M];if(U.duration&&O>=U.startOffset&&O<U.startOffset+U.duration){j=M;break}}}e.setSchedulePosition(S,j)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const p=n();return e.isInterstitial(p)?p:null},d={get bufferedEnd(){const f=n(),p=e.bufferingItem;if(p&&p===f){var m;return r(p,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-p.playout.start||((m=e.bufferingAsset)==null?void 0:m.startOffset)||0}return 0},get currentTime(){const f=u(),p=e.effectivePlayingItem;return p&&p===f?r(p,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-p.playout.start:0},set currentTime(f){const p=u(),m=e.effectivePlayingItem;m&&m===p&&l(f+m.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const p=(f=u())==null?void 0:f.event.assetList;return p?p.map(m=>e.getAssetPlayer(m.identifier)):[]},get playingIndex(){var f;const p=(f=u())==null?void 0:f.event;return p&&e.effectivePlayingAsset?p.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var f;return((f=e.schedule)==null||(f=f.events)==null?void 0:f.slice(0))||[]},get schedule(){var f;return((f=e.schedule)==null||(f=f.items)==null?void 0:f.slice(0))||[]},get interstitialPlayer(){return u()?d:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const f=n();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return a()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){l(f,"primary")},get duration(){return o("primary")},get seekableStart(){return e.seekableStart}},integrated:{get bufferedEnd(){return r(n(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){l(f,"integrated")},get duration(){return o("integrated")},get seekableStart(){return i(e.seekableStart,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,p=f==null?void 0:f.event;if(p&&!p.restrictions.skip){const m=e.findItemIndex(f);if(p.appendInPlace){const v=f.playout.start+f.event.duration;l(v+.001,"playout")}else e.advanceAfterAssetEnded(p,m,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const n=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!n||!s?!1:this.findItemIndex(n)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,n;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const i=(n=r)==null?void 0:n.currentTime;if(!(i===void 0||!at(i)))return i}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,n){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,n)}transferMediaFromPlayer(e,n){const s=e.interstitial.appendInPlace,r=e.media;if(s&&r===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&r){this.detachedData={media:r};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Fs(i)}`),this.detachedData=i}else n&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,n){var s,r;if(e.media===n)return;let i=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,u=(s=this.detachedData)==null?void 0:s.mediaSource;let d;if(a.media)l&&(i=a.transferMedia(),this.detachedData=i),d="Primary";else{const v=this.getBufferingPlayer();v?(i=v.transferMedia(),this.detachedData=i,d=`${v}`):u?d="detached MediaSource":d="detached media"}if(!i){if(u)i=this.detachedData,this.log(`using detachedData: MediaSource ${Fs(i)}`);else if(!this.detachedData||a.media===n){const v=this.playerQueue;v.length>1&&v.forEach(x=>{if(o&&x.interstitial.appendInPlace!==l){const y=x.interstitial;this.clearInterstitial(x.interstitial,null),y.appendInPlace=!1,y.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${y}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const f=i&&"mediaSource"in i&&((r=i.mediaSource)==null?void 0:r.readyState)!=="closed";if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${d} (media.currentTime: ${n.currentTime})`),!f&&!o){e.attachMedia(n);return}const p=f&&i?Rt({},i):{media:n},m=this.schedule;if(m&&o){const v=e.assetId===m.assetIdAtEnd;p.overrides={duration:m.duration,endOfStream:v||e.appendInPlace===!1}}if(!f&&l){const v=e,x=v.assetItem.timelineStart;if(x){const y=v.hls,S=Math.max(this.timelinePos-x,Number.EPSILON);y.startPosition!==S&&(this.log(`Set ${v} startPosition: ${S}`),y.config.startPosition=S,y.loadingEnabled&&y.startLoad(S))}}e.attachMedia(p)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,n=e==null?void 0:e.events,s=this.hls;if(!n||this.playbackDisabled||!this.media||!s)return;this.bufferedPos===-1&&(this.bufferedPos=0);const r=this.timelinePos,i=this.effectivePlayingItem;if(r===-1){if(!s.loadingEnabled){this.log("waiting for startLoad( <startPosition> )");return}const a=s.startPosition;if(this.timelinePos=a,n.length===0)this.setSchedulePosition(0);else if(n[0].cue.pre){this.log(Ep("checkStart (preroll)",a));const o=e.findEventIndex(n[0].identifier);this.setSchedulePosition(o)}else if(a>=0||!this.primaryLive){this.log(Ep("checkStart",a));const o=this.timelinePos=a>0?a:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}else s.liveSyncPosition===0?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(i&&!this.playingItem){this.log(Ep("checkStart (playing item)",i.start));const a=e.findItemIndex(i);this.setSchedulePosition(a)}}advanceAssetBuffering(e,n){const s=e.event,r=s.findAssetIndex(n),i=t8(s,r);if(!s.isAssetPastPlayoutLimit(i))this.bufferedToEvent(e,i);else if(this.schedule){var a;const o=this.getNextItemIndex(e,!0),l=(a=this.schedule.items)==null?void 0:a[o];l&&this.bufferedToItem(l)}}livePrerollResumption(e,n){if(e.cue.pre&&this.primaryLive&&!at(e.resumeOffset)&&this.hls){const s=this.getLiveStartPos();if(n){const r=this.getBufferingPlayer(),i=r!=null&&r.interstitial.cue.pre?r.remaining:0;return s+i}return s}}getNextItemIndex(e,n){if(this.schedule){const s=this.livePrerollResumption(e.event,n);if(s!==void 0)return this.log(`find next item index @${s}`),this.schedule.findItemIndexAtTime(s)}return this.findItemIndex(e)+1}advanceAfterAssetEnded(e,n,s){const r=t8(e,s);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const i=this.schedule.items;if(i){const a=i[n],o=a.event?this.getNextItemIndex(a):n+1,l=i.length;if(o>=l){this.setSchedulePosition(-1);return}const u=e.resumeTime;this.timelinePos<u&&(this.log(Ep("advanceAfterAssetEnded",u)),this.timelinePos=u,e.appendInPlace&&!i[o].event&&this.hls.startLoad(u+.01),this.checkBuffer(this.bufferedPos<u)),this.setSchedulePosition(o)}}}else{if(e.appendInPlace){const i=e.assetList[r];i&&this.advanceInPlace(i.timelineStart)}this.setSchedulePosition(n,r)}}setScheduleToAssetAtTime(e,n){const s=this.schedule;if(!s)return;const r=n.parentIdentifier,i=s.getEvent(r);if(i){const a=s.findEventIndex(r),o=s.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,a,o-1)}}setSchedulePosition(e,n){var s;const r=(s=this.schedule)==null?void 0:s.items;if(!r||this.playbackDisabled)return;const i=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${n} (${i&&ho(i)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const f=a.event,p=this.playingAsset,m=p==null?void 0:p.identifier,v=m?this.getAssetPlayer(m):null;if(v&&m&&(!this.eventItemsMatch(a,i)||n!==void 0&&m!==f.assetList[n].identifier)){var l;const x=f.findAssetIndex(p);if(this.log(`INTERSTITIAL_ASSET_ENDED ${x+1}/${f.assetList.length} ${w0(p)}`),this.endedAsset=p,this.playingAsset=null,this.hls.trigger(H.INTERSTITIAL_ASSET_ENDED,{asset:p,assetListIndex:x,event:f,schedule:r.slice(0),scheduleIndex:e,player:v}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),x);return}this.retreiveMediaSource(m,i),v.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&v.detachMedia()}if(!this.eventItemsMatch(a,i)&&(this.endedItem=a,this.playingItem=this.waitingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${ho(a)}`),f.hasPlayed=!0,this.hls.trigger(H.INTERSTITIAL_ENDED,{event:f,schedule:r.slice(0),scheduleIndex:e}),f.cue.once&&this.hls)){var u;this.updateSchedule();const x=(u=this.schedule)==null?void 0:u.items;if(i&&x){const y=this.findItemIndex(i),S=this.livePrerollResumption(f);if(S!==void 0){let _=S;const E=this.getNextItemIndex(a);if(!this.isInterstitial(r[E])){var d;const T=(d=this.primaryDetails)==null?void 0:d.fragments;if(f.snapOptions.in&&T){const k=f1(null,T,S);k&&(_=Math.min(Math.max(r[E].start,pT(_,k)),r[E].end))}}if(this.log(Ep("live join (preroll)",_)),this.timelinePos=_,E!==y&&(E||E===0)){this.advanceSchedule(E,x,void 0,a,o);return}}this.advanceSchedule(y,x,n,a,o)}return}}this.advanceSchedule(e,r,n,a,o)}advanceSchedule(e,n,s,r,i){const a=this.schedule;if(!a)return;const o=n[e]||null,l=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(d=>{const f=d.interstitial,p=a.findEventIndex(f.identifier);(p<e||p>e+1)&&this.clearInterstitial(f,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const d=o.event;if(s===void 0){s=d.cue.pre?0:a.findAssetIndex(d,this.timelinePos);const v=t8(d,s-1);if(d.isAssetPastPlayoutLimit(v)||d.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(d,e,s);return}s=v}const f=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let p=this.preloadAssets(d,s);if(this.eventItemsMatch(o,f||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${ho(o)} ${d.appendInPlace?"append in place":""}`),d.hasPlayed=!1,this.hls.trigger(H.INTERSTITIAL_STARTED,{event:d,schedule:n.slice(0),scheduleIndex:e})),!d.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${d}`);return}if(d.assetListLoader&&(d.assetListLoader.destroy(),d.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${d}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const m=d.assetList[s];if(!m){this.advanceAfterAssetEnded(d,e,s||0);return}if(p||(p=this.getAssetPlayer(m.identifier)),p===null||p.destroyed){const v=d.assetList.length;this.warn(`asset ${s+1}/${v} player destroyed ${d}`),p=this.createAssetPlayer(d,m,s),p.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&d.appendInPlace&&this.isAssetBuffered(m))return;this.startAssetPlayer(p,s,n,e,l),this.shouldPlay&&dne(p.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&dne(this.hls.media)):i&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,n,s){var r,i;this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.endedItem=null,this.log(`resuming ${ho(e)}`);let a=this.timelinePos;if((r=this.detachedData)!=null&&r.mediaSource?this.primaryLive&&this.startLoadingPrimaryAt(a):((a<e.start||a>=e.end||a<this.seekableStart)&&(a=this.getPrimaryResumption(e,n),this.log(Ep("resumePrimary",a)),this.timelinePos=a),this.attachPrimary(a,e)),!s)return;const o=(i=this.schedule)==null?void 0:i.items;o&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ho(e)}`),this.hls.trigger(H.INTERSTITIALS_PRIMARY_RESUMED,{schedule:o.slice(0),scheduleIndex:n}),this.checkBuffer())}get seekableStart(){var e;return this.primaryLive&&((e=this.primaryDetails)==null?void 0:e.fragmentStart)||0}getPrimaryResumption(e,n,s){const r=e.start;if(this.primaryLive){if(n===0)return this.hls.startPosition;const i=this.endedItem||this.playingItem,a=i!=null&&i.event?this.livePrerollResumption(i.event,s):void 0;if(a!==void 0)return a;const o=this.primaryDetails;if(o){const{fragmentStart:l,edge:u}=o;if(r<l||r>u&&!s){const d=this.hls.liveSyncPosition;return this.log(`primary resumption out of bounds (${r} [${l}-${u}]) snapping to liveSync ${d}`),d||l}}}return this.log(`primary resumption itemStart: ${r}`),r}getLiveStartPos(){var e;const n=this.hls.startPosition,s=this.hls.liveSyncPosition||0,r=(((e=this.primaryDetails)==null?void 0:e.targetduration)||10)*3;return n===-1||s&&s-n<r?s||0:n}isAssetBuffered(e){const n=this.getAssetPlayer(e.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:Bt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,n,s){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,r),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(Ep("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(e,n){const s=this.hls,{loadingEnabled:r,bufferingEnabled:i,startPosition:a}=s,o=s.hasEnoughToStart;if(this.log(`Start loading primary @${e} bufferedPos: ${this.bufferedPos} startPosition: ${a} skip seek: ${n} has enough ${o} loadingEnabled: ${r} bufferingEnabled: ${i}`),!n&&o||!r||Math.abs(a-e)>.1){const l=this.primaryDetails;if(l!=null&&l.live&&e+.5>=l.edge){const u=this.bufferingItem;this.log(`Resume primary loading when live passes ${e} buffering item: ${u?ho(u):null}`),s.pauseBuffering(),this.bufferPastEdge=!0;return}s.startLoad(e,n)}else i||s.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(H.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(H.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,n){if(n.level===-1||!this.schedule)return;const s=this.hls.levels[n.level];if(!s.details)return;const r=Rt(Rt({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=r;const i=this.hls.startPosition;if(this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace,i===-1?0:i),!!this.schedule.items){if(!this.effectivePlayingItem)this.checkStart();else if(this.bufferPastEdge){const o=this.primaryDetails,l=this.bufferedPos;if(o!=null&&o.live&&l+.5<o.edge){this.bufferPastEdge=!1;const u=this.bufferingItem;if(this.log(`Live edge ${o.edge} passed buffer: ${l} buffering item: ${u?ho(u):null}`),(u==null?void 0:u.end)===1/0){const f=this.playingItem,p=this.isInterstitial(f)&&f.event.appendInPlace;this.hls.startLoad(Math.max(l,u.start),p)}else{const f=this.getBufferingPlayer();f&&f.bufferedInPlaceToEnd(this.primaryMedia,f.currentTime)&&f.hls&&f.hls.trigger(H.BUFFERED_TO_END,void 0)}}}}}onAudioTrackUpdated(e,n){const s=this.hls.audioTracks[n.id],r=this.mediaSelection;if(!r){this.altSelection=Rt(Rt({},this.altSelection),{},{audio:s});return}const i=Rt(Rt({},r),{},{audio:s});this.mediaSelection=i}onSubtitleTrackUpdated(e,n){const s=this.hls.subtitleTracks[n.id],r=this.mediaSelection;if(!r){this.altSelection=Rt(Rt({},this.altSelection),{},{subtitles:s});return}const i=Rt(Rt({},r),{},{subtitles:s});this.mediaSelection=i}onAudioTrackSwitching(e,n){const s=ste(n);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(n)||r.setAudioOption(s)))}onSubtitleTrackSwitch(e,n){const s=ste(n);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(n)||n.id!==-1&&r.setSubtitleOption(s)))}onBufferCodecs(e,n){const s=n.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,n){this.checkBuffer()}onBufferFlushed(e,n){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let s=0;s<n.length;s++){const r=n[s];if(r.cue.post){const i=this.getEventItem(r.identifier);i&&this.eventItemsMatch(i,this.bufferingItem)&&this.bufferedToItem(i,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const n=this.playingItem;if(!this.playingLastItem&&n){const s=this.findItemIndex(n);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(e,n){var s;const r=(s=this.schedule)==null?void 0:s.items;if(e&&r){const i=this.findItemIndex(e,n);return r[i]||null}return null}trimInPlace(e,n){if(this.isInterstitial(e)&&e.event.appendInPlace&&n.end-e.end>.25){e.event.assetList.forEach((i,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(i.identifier,null)});const s=e.end+.25,r=Bt.bufferInfo(this.primaryMedia,s,0);(r.end>s||(r.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${ho(e)} (was ${ho(n)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,n){return!!n&&(e===n||e.event&&n.event&&this.eventItemsMatch(e,n)||!e.event&&!n.event&&this.findItemIndex(e)===this.findItemIndex(n))}eventItemsMatch(e,n){var s;return!!n&&(e===n||e.event.identifier===((s=n.event)==null?void 0:s.identifier))}findEventIndex(e){return this.schedule?this.schedule.findEventIndex(e):-1}getEventItem(e){if(this.schedule){var n;const s=(n=this.schedule.items)==null?void 0:n[this.findEventIndex(e)];if(this.isInterstitial(s)&&s.event.identifier===e)return s}}findItemIndex(e,n){return e&&this.schedule?this.schedule.findItemIndex(e,n):-1}updateSchedule(e=!1){var n,s;const r=this.mediaSelection;if(!r)return;const i=((n=this.hls)==null?void 0:n.liveSyncPosition)||0;(s=this.schedule)==null||s.updateSchedule(r,[],i,e)}checkBuffer(e){var n;const s=(n=this.schedule)==null?void 0:n.items;if(!s)return;const r=Bt.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,s,e)}updateBufferedPos(e,n,s){const r=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(n.length===1&&this.itemsMatch(n[0],i)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const d=this.findItemIndex(i),f=Math.min(d+1,n.length-1),p=n[f];if((l===-1&&i&&e>=i.end||(u=p.event)!=null&&u.appendInPlace&&e+.01>=p.start)&&(l=f),this.isInterstitial(i)){const m=i.event;if(f-o>1&&m.appendInPlace===!1||m.assetList.length===0&&m.assetListLoader)return}if(this.bufferedPos=e,l>d&&l>o)this.bufferedToItem(p);else{const m=this.primaryDetails;this.primaryLive&&m&&e>m.edge-m.targetduration&&p.start<m.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(p)&&this.preloadAssets(p.event,0)}}else s&&a&&!this.itemsMatch(a,i)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(n[l]))}assetsBuffered(e,n){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const i=this.getAssetPlayer(r.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(n))})}setBufferingItem(e){const n=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,n)&&s){const{items:r,events:i}=s;if(!r||!i)return n;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:n?n.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ho(e)}`+(n?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const u=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((d,f)=>{const p=this.getAssetPlayer(d.identifier);p&&(f===u&&p.loadSource(),p.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(H.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return n}bufferedToItem(e,n=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,n);else if(s!==null){this.bufferingAsset=null;const r=this.getPrimaryResumption(e,this.findItemIndex(e),!0),i=this.bufferedPos=Math.max(r,Math.min(this.bufferedPos,e.end),this.timelinePos,e.start),a=this.detachedData;if(a)a.mediaSource?this.attachPrimary(i,e,!0):this.startLoadingPrimaryAt(i);else{const o=this.playingItem,l=this.isInterstitial(o)&&o.event.appendInPlace;this.startLoadingPrimaryAt(i,l)}}}}bufferedToEvent(e,n){const s=e.event,r=s.assetList.length===0&&!s.assetListLoader,i=s.cue.once;if(r||!i){const a=this.preloadAssets(s,n);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,n){const s=e.assetUrl,r=e.assetList.length,i=r===0&&!e.assetListLoader,a=e.cue.once;if(i){const l=e.timelineStart,u=this.playingItem,d=this.getBufferingPlayer();if(e.appendInPlace){var o;!this.isInterstitial(u)&&(u==null||(o=u.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let f,p=0;if((!d||d.interstitial.cue.pre)&&this.primaryLive&&(p=this.getLiveStartPos(),d&&(p+=d.remaining)),p&&!(e.cue.pre||e.cue.post)){const v=p-l;v>0&&(f=Math.round(v*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${s?1:r} ${e}${p?` live-start: ${p} start-offset: ${f} (timeline-start: ${l})`:""}`),s)return this.createAsset(e,0,0,l,e.duration,s);const m=this.assetListLoader.loadAssetList(e,f);m&&(e.assetListLoader=m)}else if(!a&&r){for(let u=n;u<r;u++){const d=e.assetList[u],f=this.getAssetPlayerQueueIndex(d.identifier);(f===-1||this.playerQueue[f].destroyed)&&!d.error&&this.createAssetPlayer(e,d,u)}const l=e.assetList[n];if(l){const u=this.getAssetPlayer(l.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const n=this.requiredTracks;if(!n)return;const s=this.primaryDetails;if(s&&e>=s.edge)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(n).forEach(i=>{this.hls.trigger(H.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const n=this.playerQueue;for(let s=0;s<n.length;s++)if(e===n[s].assetId)return s;return-1}getAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:n}=this;if(n){for(let s=0;s<e.length;s++)if(e[s].media===n)return e[s]}return null}createAsset(e,n,s,r,i,a){const o={parentIdentifier:e.identifier,identifier:qut(e,a,n),duration:i,startOffset:s,timelineStart:r,uri:a};return this.createAssetPlayer(e,o,n)}createAssetPlayer(e,n,s){const r=this.hls,i=r.userConfig,a=r.loadLevelObj||r.levels[r.currentLevel],o=F1e(a,i.videoPreference),l=r.audioTracks[r.audioTrack],u=r.subtitleTracks[r.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const T=this.timelinePos-n.timelineStart;if(T>=0){const k=n.duration;k&&T<k&&(d=T)}}const f=n.identifier,p=Rt(Rt({},i),{},{maxMaxBufferLength:Math.min(15,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:l||i.audioPreference,subtitlePreference:u||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,n.timelineStart&&(p.timelineOffset=n.timelineStart));const m=p.cmcd;m!=null&&m.sessionId&&m.contentId&&(p.cmcd=ms({},m,{contentId:Rb(n.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const v=new Zut(this.HlsPlayerClass,p,e,n);this.playerQueue.push(v),e.assetList[s]=n;let x=!0;const y=T=>{if(T.live){const I=new Error(`Interstitials MUST be VOD assets ${e}`),A={fatal:!0,type:_t.OTHER_ERROR,details:pe.INTERSTITIAL_ASSET_ITEM_ERROR,error:I},L=this.findEventIndex(e.identifier);this.handleAssetItemError(A,e,L,s,I.message);return}const k=T.edge-T.fragmentStart,R=n.duration;(x||R===null||k>R)&&(x=!1,this.log(`Interstitial asset "${f}" duration change ${R} > ${k}`),n.duration=k,this.updateSchedule())};v.on(H.LEVEL_UPDATED,(T,{details:k})=>y(k)),v.on(H.LEVEL_PTS_UPDATED,(T,{details:k})=>y(k)),v.on(H.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const S=(T,k)=>{const R=this.getAssetPlayer(f);if(R&&k.tracks){R.off(H.BUFFER_CODECS,S),R.tracks=k.tracks;const I=this.primaryMedia;this.bufferingAsset===R.assetItem&&I&&!R.media&&this.bufferAssetPlayer(R,I)}};v.on(H.BUFFER_CODECS,S);const _=()=>{const T=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${T}`),!T||!this.schedule)return;const k=this.getEventItem(e.identifier);k&&this.advanceAssetBuffering(k,T.assetItem)};v.on(H.BUFFERED_TO_END,_);const E=T=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const R=this.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,R,T)};return v.once(H.MEDIA_ENDED,E(s)),v.once(H.PLAYOUT_LIMIT_REACHED,E(1/0)),v.on(H.ERROR,(T,k)=>{if(!this.schedule)return;const R=this.getAssetPlayer(f);if(k.details===pe.BUFFER_STALLED_ERROR){if(R!=null&&R.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}else if(k.details===pe.BUFFER_SEEK_OVER_HOLE)return;this.handleAssetItemError(k,e,this.findEventIndex(e.identifier),s,`Asset player error ${k.error} ${e}`)}),v.on(H.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const k=new Error(`Asset player destroyed unexpectedly ${f}`),R={fatal:!0,type:_t.OTHER_ERROR,details:pe.INTERSTITIAL_ASSET_ITEM_ERROR,error:k};this.handleAssetItemError(R,e,this.findEventIndex(e.identifier),s,k.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${w0(n)}`),this.hls.trigger(H.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:s,event:e,player:v}),v}clearInterstitial(e,n){this.clearAssetPlayers(e,n),e.reset()}clearAssetPlayers(e,n){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,n)})}resetAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[n];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,n){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const r=this.playerQueue[s];this.log(`clear ${r} toSegment: ${n&&ho(n)}`),this.transferMediaFromPlayer(r,n),this.playerQueue.splice(s,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,n,s,r,i){const{interstitial:a,assetItem:o,assetId:l}=e,u=a.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(d==null?void 0:d.identifier)!==l&&(d&&(this.clearAssetPlayer(d.identifier,s[r]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${u} ${w0(o)}`),this.hls.trigger(H.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:n,event:a,schedule:s.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,n){var s;if(!this.schedule)return;const{interstitial:r,assetItem:i}=e,a=this.getEventItem(r.identifier);if(!a)return;if(e.loadSource(),this.setBufferingItem(a),this.bufferingAsset=i,e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime)){this.advanceAssetBuffering(a,i);return}const o=this.getBufferingPlayer();if(o===e)return;const l=r.appendInPlace;if(l&&(o==null?void 0:o.interstitial.appendInPlace)===!1)return;const u=(o==null?void 0:o.tracks)||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(l&&i!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(u&&!h1e(u,e.tracks)){const d=new Error(`Asset ${w0(i)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`),f={fatal:!0,type:_t.OTHER_ERROR,details:pe.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},p=r.findAssetIndex(i);this.handleAssetItemError(f,r,this.findEventIndex(r.identifier),p,d.message);return}}this.transferMediaTo(e,n)}handleInPlaceStall(e){const n=this.schedule,s=this.primaryMedia;if(!n||!s)return;const r=s.currentTime,i=n.findAssetIndex(e,r),a=e.assetList[i];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||r-a.timelineStart,u=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+u} in ${o} ${e} (media.currentTime: ${r})`),l&&(u/s.playbackRate<.5||o.bufferedInPlaceToEnd(s,o.currentTime))&&o.hls){const d=n.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,d,i)}}}}advanceInPlace(e){const n=this.primaryMedia;if(n&&n.currentTime<e){const s=`advance currentTime to ${e}, duration: ${n.duration}`;n.duration>e?(this.log(s),n.currentTime=e):this.log(`Cannot ${s}`)}}handleAssetItemError(e,n,s,r,i){if(e.details===pe.BUFFER_STALLED_ERROR)return;const a=n.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&w0(a)} ${e.error}`),!this.schedule)return;const o=(a==null?void 0:a.identifier)||"",l=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[l]||null,d=this.schedule.items,f=ms({},e,{fatal:!1,errorAction:Cb(!0),asset:a,assetListIndex:r,event:n,schedule:d,scheduleIndex:s,player:u});if(this.hls.trigger(H.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const p=this.playingAsset,m=this.bufferingAsset,v=new Error(i);if(a&&(this.clearAssetPlayer(o,null),a.error=v),!n.assetList.some(x=>!x.error))n.error=v;else for(let x=r;x<n.assetList.length;x++)this.resetAssetPlayer(n.assetList[x].identifier);this.updateSchedule(!0),n.error?this.primaryFallback(n):(p==null?void 0:p.identifier)===o?this.advanceAfterAssetEnded(n,s,r):(m==null?void 0:m.identifier)===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,m)}primaryFallback(e){const n=e.timelineStart,s=this.effectivePlayingItem,r=this.playingItem,i=this.seekableStart,a=this.hls.startPosition;let o=this.timelinePos;if(this.isInterstitial(s)){this.log(`Fallback to primary from event "${e.identifier}" start: ${n} pos: ${o} playing: ${ho(s)} startPosition: ${a} seekableStart: ${i} error: ${e.error}`),o===-1&&(o=a),o=Math.max(o,i);const u=this.updateItem(s,o);this.itemsMatch(s,u)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n))}else if(o===-1){this.checkStart();return}if(!this.schedule||!this.isInterstitial(r))return;const l=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(l)}onAssetListLoaded(e,n){var s,r;const i=n.event,a=i.identifier,o=n.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(a)))return;const l=i.timelineStart,u=i.duration;let d=0;o.forEach((v,x)=>{const y=parseFloat(v.DURATION);this.createAsset(i,x,d,l+d,y,v.URI),d+=y}),i.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${u}) ${i}`);
503const f=this.waitingItem,p=(f==null?void 0:f.event.identifier)===a;this.updateSchedule();const m=(r=this.bufferingItem)==null?void 0:r.event;if(p){const v=this.findEventIndex(a),x=this.getEventItem(a);if(x){if(!this.playingItem&&this.timelinePos>x.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==v){i.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${i}`),this.log(i.error.message),this.updateSchedule(!0),this.primaryFallback(i);return}this.setBufferingItem(x)}this.setSchedulePosition(v)}else if((m==null?void 0:m.identifier)===a){const v=i.assetList[0];if(v){const x=this.getAssetPlayer(v.identifier);if(m.appendInPlace){const y=this.primaryMedia;x&&y&&this.bufferAssetPlayer(x,y)}else x&&x.loadSource()}}}onError(e,n){if(this.schedule)switch(n.details){case pe.ASSET_LIST_PARSING_ERROR:case pe.ASSET_LIST_LOAD_ERROR:case pe.ASSET_LIST_LOAD_TIMEOUT:{const s=n.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case pe.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}const r=this.primaryMedia;this.log(`Primary player stall @${this.timelinePos} currentTime: ${r==null?void 0:r.currentTime} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}class edt{constructor(e){this.hls=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{var n;const{media:s}=this,r=this.levelDetails;if(!s||!r||!this.hls)return;this.currentTime=s.currentTime;const i=this.hls.config,a=this.computeLatency();if(a===null)return;this._latency=a;const{lowLatencyMode:o,maxLiveSyncPlaybackRate:l}=i;if(!o||l===1||!r.live)return;const u=this.targetLatency;if(u===null)return;const d=a-u,f=Math.min(this.maxLatency,u+r.targetduration),p=d<f,m=b5(i)&&!!((n=this.hls.interstitialsManager)!=null&&(n=n.playingItem)!=null&&n.event);if(p&&d>.05&&this.forwardBufferLength>1&&!m){const v=Math.min(2,Math.max(1,l)),x=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20,y=Math.min(v,Math.max(1,x));this.changeMediaPlaybackRate(s,y)}else s.playbackRate!==1&&s.playbackRate!==0&&this.changeMediaPlaybackRate(s,1)},this.hls=e,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){var e;const n=(e=this.hls)==null?void 0:e.config;if(!n)return 0;if(n.liveMaxLatencyDuration!==void 0)return n.liveMaxLatencyDuration;const s=this.levelDetails;return s?n.liveMaxLatencyDurationCount*s.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||!this.hls)return null;const n=this.hls.config,{holdBack:s,partHoldBack:r,targetduration:i}=e,{liveSyncDuration:a,liveSyncDurationCount:o,lowLatencyMode:l}=n,u=this.hls.userConfig;let d=l&&r||s;(this._targetLatencyUpdated||u.liveSyncDuration||u.liveSyncDurationCount||d===0)&&(d=a!==void 0?a:o*i);const f=i;return d+Math.min(this.stallCount*n.liveSyncOnStallIncrease,f)}set targetLatency(e){this.hls&&(this.stallCount=0,this.hls.config.liveSyncDuration=e,this._targetLatencyUpdated=!0)}get liveSyncPosition(){const e=this.estimateLiveEdge(),n=this.targetLatency;if(e===null||n===null||!this.hls)return null;const s=this.levelDetails;if(s===null)return null;const r=s.edge,i=e-n-this.edgeStalled,a=r-s.totalduration,o=r-(this.hls.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,i),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null||!this.hls)return 0;const n=(this.hls.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-n,0)}get forwardBufferLength(){const{media:e}=this,n=this.levelDetails;if(!e||!n)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;
vendor: 42,554 bytes, lines 503-504
503e&&(e.on(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(H.ERROR,this.onError,this),e.on(H.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(H.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(H.ERROR,this.onError,this),e.off(H.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}onMediaAttached(e,n){this.media=n.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onAssetStarted(e,n){var s;const r=this.hls,i=this.media||n.event.appendInPlace&&(r==null||(s=r.interstitialsManager)==null?void 0:s.playerQueue.reduce((a,o)=>a||o.media,null));r&&i&&i.playbackRate>1&&i.playbackRate<=r.config.maxLiveSyncPlaybackRate&&this.changeMediaPlaybackRate(i,1)}onError(e,n){var s;n.details===pe.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,n){var s,r;e.playbackRate!==n&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${n}`),e.playbackRate=n)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const fne=500;class tdt extends JF{constructor(e,n,s){super(e,n,s,"subtitle-stream-controller",vt.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(H.LEVEL_LOADED,this.onLevelLoaded,this),e.on(H.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(H.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(H.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(H.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(H.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(H.LEVEL_LOADED,this.onLevelLoaded,this),e.off(H.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(H.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(H.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(H.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(H.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,n){this.stopLoad(),this.state=Ne.IDLE,this.setInterval(fne),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,n){this.tracksBuffered=[],super.onMediaDetaching(e,n)}onLevelLoaded(e,n){this.mainDetails=n.details}onSubtitleFragProcessed(e,n){const{frag:s,part:r,success:i}=n;if(!i)return;const a=this.tracksBuffered[this.currentTrackId];if(!a)return;let o;const l=(r||s).start;for(let d=0;d<a.length;d++)if(l>=a[d].start&&l<=a[d].end){o=a[d];break}const u=l+(r||s).duration;if(o?o.end=u:(o={start:l,end:u},a.push(o)),!r||u>=s.end){const d=this.fragmentTracker.fragBuffered(s);r&&d&&(d.range.subs={time:[{startPTS:s.start,endPTS:u}],partial:!0}),vr(s)&&!this.fragContextChanged(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r),this.media&&this.tickImmediate()}}onBufferFlushing(e,n){const{startOffset:s,endOffset:r}=n;if(s===0&&r!==Number.POSITIVE_INFINITY){const i=r-1;if(i<=0)return;n.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(a=>{if(a)for(let o=0;o<a.length;){if(a[o].end<=i){a.shift();continue}else if(a[o].start<i)a[o].start=i;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,i,vt.SUBTITLE)}}onError(e,n){const s=n.frag;(s==null?void 0:s.type)===vt.SUBTITLE&&(n.details===pe.FRAG_GAP&&this.fragmentTracker.addAsGap(s),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ne.STOPPED&&(this.state=Ne.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:n}){if(this.levels&&Cxe(this.levels,n)){this.levels=n.map(s=>new A2(s));return}this.tracksBuffered=[],this.levels=n.map(s=>{const r=new A2(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,vt.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,n){var s;if(this.currentTrackId=n.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];if(!(r!=null&&r.details)){this.mediaBuffer=null;return}this.mediaBuffer=this.mediaBufferTimeRanges,this.state!==Ne.STOPPED&&this.setInterval(fne)}onSubtitleTrackLoaded(e,n){var s;const{currentTrackId:r,levels:i}=this,{details:a,id:o}=n;if(!i){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=i[o];if(o>=i.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;const u=this.mainDetails;let d=0;if(a.live||(s=l.details)!=null&&s.live){if(a.deltaUpdateFailed)return;if(!u){this.startFragRequested=!1;return}if(l.details){var f;d=this.alignPlaylists(a,l.details,(f=this.levelLastLoaded)==null?void 0:f.details)}a.alignedSliding||(x5(u,a,this),d=a.fragmentStart)}l.details=a,this.levelLastLoaded=l,u&&!this.startFragRequested&&this.setStartPosition(u,d),o===r&&(this.hls.trigger(H.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:n.groupId}),this.tickImmediate())}_handleFragmentLoadProgress(e){const{frag:n,part:s,payload:r}=e;!s||!(r!=null&&r.byteLength)||!this.shouldDecrypt(n)||this.decryptPayload(r,n,s)}_handleFragmentLoadComplete(e){const{frag:n,payload:s}=e;this.fragContextChanged(n)||!(s!=null&&s.byteLength)||!this.shouldDecrypt(n)||this.decryptPayload(s,n,null)}shouldDecrypt(e){const n=e.decryptdata;return!!(n!=null&&n.key&&n.iv&&fv(n.method))}decryptPayload(e,n,s){const r=n.decryptdata,i=performance.now();this.decrypter.decrypt(new Uint8Array(e),r.key.buffer,r.iv.buffer,XF(r.method)).then(a=>{this.fragContextChanged(n)||this.hls.trigger(H.FRAG_DECRYPTED,{frag:n,part:s,payload:a,stats:{tstart:i,tdecrypt:performance.now()}})}).catch(a=>{this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:n,part:s}),s||(this.warn(`${a.name}: ${a.message}`),this.state=Ne.IDLE)})}doTick(){if(this.state===Ne.IDLE&&this.levels){var e;if(!this.media&&!this.primaryPrefetch&&(this.startFragRequested||!this.config.startFragPrefetch))return;const{currentTrackId:s,levels:r}=this,i=r[s],a=i==null?void 0:i.details;if(!a||this.waitForLive(i)||this.waitForCdnTuneIn(a)){this.startFragRequested=!1;return}const{config:o}=this,l=this.playhead,u=Bt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],l,o.maxBufferHole),{end:d,len:f}=u,p=Math.max(this.hls.maxBufferLength+a.levelTargetDuration,((e=this.hls.mainForwardBufferInfo)==null?void 0:e.len)||0);if(f>p||f&&!this.buffering)return;let m=this.getNextFragment(d,a);if(!m)return;if(vr(m)){var n;const v=m.sn-a.startSN,x=a.fragments[v-1];m.cc===(x==null?void 0:x.cc)&&!((n=a.partList)!=null&&n.length)&&this.fragmentTracker.getState(x)===ur.NOT_LOADED&&(m=x)}this.loadFragment(m,i,d)}}loadFragment(e,n,s){const r=this.fragmentTracker.getState(e);(r===ur.NOT_LOADED||r===ur.PARTIAL)&&super.loadFragment(e,n,s)}get mediaBufferTimeRanges(){return new ndt(this.tracksBuffered[this.currentTrackId]||[])}}class ndt{constructor(e){this.buffered=void 0;const n=(s,r,i)=>{if(r=r>>>0,r>i-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return e[r][s]};this.buffered={get length(){return e.length},end(s){return n("end",s,e.length)},start(s){return n("start",s,e.length)}}}}const sdt={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},rye=t=>String.fromCharCode(sdt[t]||t),$l=15,jl=42,rdt={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},idt={17:2,18:4,21:6,22:8,23:10,19:13,20:15},adt={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},odt={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ldt=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class cdt{constructor(){this.time=null,this.verboseLevel=0}log(e,n){if(this.verboseLevel>=e){const s=typeof n=="function"?n():n;Gn.log(`${this.time} [${e}] ${s}`)}}}const Cp=function(e){const n=[];for(let s=0;s<e.length;s++)n.push(e[s].toString(16));return n},p9=Object.freeze({foreground:"white",underline:!1,italics:!1,background:"black",flash:!1});class iye{constructor(){this.styles=p9}get foreground(){return this.styles.foreground}set foreground(e){const n=this.styles;this.styles={foreground:e,underline:n.underline,italics:n.italics,background:n.background,flash:n.flash}}get underline(){return this.styles.underline}set underline(e){const n=this.styles;this.styles={foreground:n.foreground,underline:e,italics:n.italics,background:n.background,flash:n.flash}}get italics(){return this.styles.italics}set italics(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:e,background:n.background,flash:n.flash}}get background(){return this.styles.background}set background(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:n.italics,background:e,flash:n.flash}}get flash(){return this.styles.flash}set flash(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:n.italics,background:n.background,flash:e}}reset(){this.styles=p9}setStyles(e){const n=this.styles,s=Object.prototype.hasOwnProperty;this.styles={foreground:s.call(e,"foreground")?e.foreground:n.foreground,underline:s.call(e,"underline")?e.underline:n.underline,italics:s.call(e,"italics")?e.italics:n.italics,background:s.call(e,"background")?e.background:n.background,flash:s.call(e,"flash")?e.flash:n.flash}}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class udt{constructor(){this.uchar=" ",this.penState=new iye}reset(){this.uchar=" ",this.penState.reset()}setChar(e,n){this.uchar=e,this.penState.styles=n.styles}setPenState(e){this.penState.styles=e.styles}copy(e){this.uchar=e.uchar,this.penState.styles=e.penState.styles}}let ddt=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new iye,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<jl;n++)this.chars.push(new udt);this.logger=e}equals(e){const n=this.chars,s=e.chars;for(let r=0;r<jl;r++){const i=n[r],a=s[r];if(i.uchar!==a.uchar)return!1;const o=i.penState.styles,l=a.penState.styles;if(o!==l&&(o.foreground!==l.foreground||o.underline!==l.underline||o.italics!==l.italics||o.background!==l.background||o.flash!==l.flash))return!1}return!0}copy(e){for(let n=0;n<jl;n++)this.chars[n].copy(e.chars[n])}isEmpty(){const e=this.chars;for(let n=0;n<jl;n++){const s=e[n];if(s.uchar!==" ")return!1;const r=s.penState.styles;if(r!==p9&&(r.foreground!=="white"||r.underline||r.italics||r.background!=="black"||r.flash))return!1}return!0}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>=jl&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=jl-1)}moveCursor(e){const n=Math.min(this.pos+e,jl);if(e>1)for(let s=this.pos+1;s<n;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const n=rye(e);if(this.pos>=jl){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(e){let n;for(n=e;n<jl;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let n=!0;for(let s=0;s<jl;s++){const r=this.chars[s].uchar;r!==" "&&(n=!1),e.push(r)}return n?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};class s8{constructor(e){this.rows=[],this.currRow=$l-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<$l;n++)this.rows.push(new ddt(e));this.logger=e}reset(){for(let e=0;e<$l;e++)this.rows[e].clear();this.currRow=$l-1}equals(e){let n=!0;for(let s=0;s<$l;s++)if(!this.rows[s].equals(e.rows[s])){n=!1;break}return n}copy(e){for(let n=0;n<$l;n++){const s=this.rows[n].chars,r=e.rows[n].chars;for(let i=0;i<jl;i++){const a=s[i],o=r[i];a.uchar=o.uchar,a.penState.styles=o.penState.styles}}}isEmpty(){let e=!0;for(let n=0;n<$l;n++)if(!this.rows[n].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Fs(e));let n=e.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let o=0;o<$l;o++)this.rows[o].clear();const i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[i].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let u=0;u<this.nrRollUpRows;u++)this.rows[n-this.nrRollUpRows+u+1].copy(a.rows[i+u])}}this.currRow=n;const s=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,a=Math.max(i-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Fs(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,n=this.rows.splice(e,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const n=[];let s="",r=-1;for(let i=0;i<$l;i++){const a=this.rows[i].getTextString();a&&(r=i+1,e?n.push("Row "+r+": '"+a+"'"):n.push(a.trim()))}return n.length>0&&(e?s="["+n.join(" | ")+"]":s=n.join(`
504`)),s}getTextAndFormat(){return this.rows}}class fdt{constructor(e,n,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new s8(s),this.nonDisplayedMemory=new s8(s),this.lastOutputScreen=new s8(s),this.currRollUpRow=this.displayedMemory.rows[$l-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[$l-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const n={flash:!1};if(n.underline=e%2===1,n.italics=e>=46,n.italics)n.foreground="white";else{const s=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=r[s]}this.logger.log(2,"MIDROW: "+Fs(n)),this.writeScreen.setPen(n)}outputDataUpdate(e=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class hne{constructor(e,n,s){this.channels=[null,null,null],this.currentChannel=0,this.cmdHistory=pdt(),this.logger=void 0,this.field=void 0,this.outputFilters=void 0,this.logger=new cdt,this.field=e,this.outputFilters=[null,n,s]}getHandler(e){return this.outputFilters[e]}setHandler(e,n){var s;this.outputFilters[e]=n,(s=this.channels[e])==null||s.setHandler(n)}getChannel(e){let n=this.channels[e];return n||(n=this.channels[e]=new fdt(this.field+e-1,this.outputFilters[e],this.logger)),n}addData(e,n){this.logger.time=e;for(let s=0;s<n.length;s+=2){const r=n[s]&127,i=n[s+1]&127;let a=!1,o=null;if(r===0&&i===0)continue;this.logger.log(3,()=>"["+Cp([n[s],n[s+1]])+"] -> ("+Cp([r,i])+")");const l=this.cmdHistory;if(r>=16&&r<=31){if(hdt(r,i,l)){UE(null,null,l),this.logger.log(3,()=>"Repeated command ("+Cp([r,i])+") is dropped");continue}UE(r,i,this.cmdHistory),a=this.parseCmd(r,i),a||(a=this.parseMidrow(r,i)),a||(a=this.parsePAC(r,i)),a||(a=this.parseBackgroundAttributes(r,i))}else UE(null,null,l);if(!a&&(o=this.parseChars(r,i),o)){const d=this.currentChannel;d&&d>0?this.getChannel(d).insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Cp([r,i])+" orig: "+Cp([n[s],n[s+1]]))}}parseCmd(e,n){const s=(e===20||e===28||e===21||e===29)&&n>=32&&n<=47,r=(e===23||e===31)&&n>=33&&n<=35;if(!(s||r))return!1;const i=e===20||e===21||e===23?1:2,a=this.getChannel(i);return e===20||e===21||e===28||e===29?n===32?a.ccRCL():n===33?a.ccBS():n===34?a.ccAOF():n===35?a.ccAON():n===36?a.ccDER():n===37?a.ccRU(2):n===38?a.ccRU(3):n===39?a.ccRU(4):n===40?a.ccFON():n===41?a.ccRDC():n===42?a.ccTR():n===43?a.ccRTD():n===44?a.ccEDM():n===45?a.ccCR():n===46?a.ccENM():n===47&&a.ccEOC():a.ccTO(n-32),this.currentChannel=i,!0}parseMidrow(e,n){let s=0;if((e===17||e===25)&&n>=32&&n<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[s];return r?(r.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+Cp([e,n])+")"),!0):!1}return!1}parsePAC(e,n){let s;const r=(e>=17&&e<=23||e>=25&&e<=31)&&n>=64&&n<=127,i=(e===16||e===24)&&n>=64&&n<=95;if(!(r||i))return!1;const a=e<=23?1:2;return n>=64&&n<=95?s=a===1?rdt[e]:adt[e]:s=a===1?idt[e]:odt[e],this.getChannel(a).setPAC(this.interpretPAC(s,n)),this.currentChannel=a,!0}interpretPAC(e,n){let s;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return n>95?s=n-96:s=n-64,r.underline=(s&1)===1,s<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((s-16)/2)*4,r}parseChars(e,n){let s,r=null,i=null;if(e>=25?(s=2,i=e-8):(s=1,i=e),i>=17&&i<=19){let a;i===17?a=n+80:i===18?a=n+112:a=n+144,this.logger.log(2,()=>"Special char '"+rye(a)+"' in channel "+s),r=[a]}else e>=32&&e<=127&&(r=n===0?[e]:[e,n]);return r&&this.logger.log(3,()=>"Char codes =  "+Cp(r).join(",")),r}parseBackgroundAttributes(e,n){const s=(e===16||e===24)&&n>=32&&n<=47,r=(e===23||e===31)&&n>=45&&n<=47;if(!(s||r))return!1;let i;const a={};e===16||e===24?(i=Math.floor((n-32)/2),a.background=ldt[i],n%2===1&&(a.background=a.background+"_semi")):n===45?a.background="transparent":(a.foreground="black",n===47&&(a.underline=!0));const o=e<=23?1:2;return this.getChannel(o).setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const n=this.channels[e];n&&n.reset()}UE(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let n=0;n<this.channels.length;n++){const s=this.channels[n];s&&s.cueSplitAtTime(e)}}}function UE(t,e,n){n.a=t,n.b=e}function hdt(t,e,n){return n.a===t&&n.b===e}function pdt(){return{a:null,b:null}}class BE{constructor(e,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,n,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=n,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class mdt{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.cueCache={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=pne(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.cueCache={},this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(H.FRAG_LOADING,this.onFragLoading,this),e.on(H.FRAG_LOADED,this.onFragLoaded,this),e.on(H.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(H.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(H.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(H.BUFFER_APPENDED,this.onBufferAppended,this),e.on(H.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(H.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(H.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(H.FRAG_LOADING,this.onFragLoading,this),e.off(H.FRAG_LOADED,this.onFragLoaded,this),e.off(H.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(H.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(H.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(H.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(H.BUFFER_APPENDED,this.onBufferAppended,this),e.off(H.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new BE(this,"textTrack1"),n=new BE(this,"textTrack2"),s=new BE(this,"textTrack3"),r=new BE(this,"textTrack4");this.cea608Parser1=new hne(1,e,n),this.cea608Parser2=new hne(3,s,r)}addCues(e,n,s,r,i){let a=!1;for(let l=i.length;l--;){const u=i[l],d=gdt(u[0],u[1],n,s);if(d>=0&&(u[0]=Math.min(u[0],n),u[1]=Math.max(u[1],s),a=!0,d/(s-n)>.5))return}if(a||i.push([n,s]),this.config.renderTextTracksNatively){const l=this.cueCache[e];if(l){const u=this.Cues.newCue(null,n,s,r);u.length&&l.push.apply(l,u)}else{const u=this.captionsTracks[e].track;this.Cues.newCue(u,n,s,r)}}else{var o;const l=this.Cues.newCue(null,n,s,r),u=(o=this.captionsProperties[e])==null?void 0:o.media;this.hls.trigger(H.CUES_PARSED,{type:"captions",cues:l,track:e,closedCaptions:u})}}onInitPtsFound(e,{id:n,timestampOffsets:s}){const{unparsedVttFrags:r}=this;n===vt.MAIN&&(this.initPTS=s),r.length&&(this.unparsedVttFrags=[],r.forEach(i=>{this.initPTS[i.frag.cc]?this.onFragLoaded(H.FRAG_LOADED,i):this.hls.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i.frag,part:null,error:new Error("Subtitle discontinuity domain does not match main")})}))}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:n,captionsTracks:s,cueCache:r,media:i}=this,{label:a,languageCode:o}=n[e];i&&(r[e]=[],s[e]=mU(i,"captions",a,o,"hidden"))}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const n=this.captionsProperties[e];if(!n)return;const s=n.label,r={_id:e,label:s,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(H.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}onMediaAttaching(e,n){this.media=n.media}onMediaDetaching(e,n){const s=!!n.transferMedia;if(this.media=null,!s){if(this.config.renderTextTracksNatively){const{captionsTracks:r,cueCache:i}=this;for(const a in r)r[a].remove(),delete i[a]}this.cueCache={},this.captionsTracks={},this.nonNativeCaptionsTracks={}}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=pne(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}onSubtitleTracksUpdated(e,n){const s=n.subtitleTracks||[];if(s.length&&!this.config.renderTextTracksNatively&&!Cxe(this.tracks,s)){const r=s.map(i=>({label:i.name,kind:i.type.toLowerCase(),default:i.default,subtitleTrack:i}));this.hls.trigger(H.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}this.tracks=s}onManifestLoaded(e,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(s=>{const r=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!r)return;const i=`textTrack${r[1]}`,a=this.captionsProperties[i];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){const n=this.hls.levels[e.level];return n==null?void 0:n.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,n){if(this.enabled&&n.frag.type===vt.MAIN){var s,r;const{cea608Parser1:i,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:u}=n.frag,d=(s=(r=n.part)==null?void 0:r.index)!=null?s:-1;i&&a&&(u!==o+1||u===o&&d!==this.lastPartIndex+1||l!==this.lastCc)&&(i.reset(),a.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=d}}onFragLoaded(e,n){const{frag:s,payload:r}=n;if(s.level<this.tracks.length&&s.type===vt.SUBTITLE)if(r.byteLength){const i=s.decryptdata,a="stats"in n;if(i==null||!i.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),(o==null?void 0:o.textCodec)===u9?this._parseIMSC1(n):this._parseVTTs(n)}}else{const i="part"in n?n.part:null;this.hls.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,part:i,error:new Error("Empty subtitle payload")})}}_parseIMSC1(e){const{frag:n,payload:s}=e,r="part"in e?e.part:null,i=this.hls;sne(s,this.initPTS[n.cc],a=>{this._appendCues(a,n.level),i.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n,part:r})},a=>{i.logger.log(`Cannot parse IMSC1 (sn: ${n.sn} @${n.start}): ${a}`),i.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,part:r,error:a})})}_parseVTTs(e){var n;const{frag:s,payload:r}=e,i="part"in e?e.part:null,{initPTS:a,unparsedVttFrags:o}=this,l=a.length-1;if(!a[s.cc]&&l===-1){o.push(e);return}const u=this.hls,d=(n=s.initSegment)==null?void 0:n.data,f=d?gl(d,new Uint8Array(r)).buffer:r;Eut(f,this.initPTS[s.cc],this.vttCCs,s.cc,(i&&!d?i:s).start,p=>{this._appendCues(p,s.level),u.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s,part:i})},p=>{const m=p.message.startsWith("Missing initPTS");if(u.logger.log(`${m?"Deferred parsing of":"Cannot parse"} VTT cue (sn: ${s.sn} @${s.start}): ${p}`),m){o.push(e);return}else this.config.enableIMSC1&&this._fallbackToIMSC1(e);u.trigger(H.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,part:i,error:p})})}_fallbackToIMSC1(e){const{frag:n,payload:s}=e,r=this.tracks[n.level];r.textCodec||sne(s,this.initPTS[n.cc],()=>{r.textCodec=u9,this._parseIMSC1(e)},()=>{r.textCodec="wvtt"})}_appendCues(e,n){const s=this.hls;if(this.config.renderTextTracksNatively){var r;const i=(r=this.tracks[n].trackNode)==null?void 0:r.track;if(!i||i.mode==="disabled")return;e.forEach(a=>d9(i,a))}else{const i=this.tracks[n];if(!i)return;const a=i.default?"default":"subtitles"+n;s.trigger(H.CUES_PARSED,{type:"subtitles",cues:e,track:a,subtitleTrack:i})}}onFragDecrypted(e,n){const{frag:s}=n;s.type===vt.SUBTITLE&&this.onFragLoaded(H.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:r}=n;if(!(s.type===vt.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let i=0;i<r.length;i++){const a=r[i].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(r[i].pts,o[0]),this.cea608Parser2.addData(r[i].pts,o[1])}}}onBufferAppended(e,n){if(this.config.renderTextTracksNatively){var s;const{type:r,timeRanges:i}=n;if(r==="video"&&(s=i[r])!=null&&s.length){const{captionsTracks:a,cueCache:o}=this;Object.keys(o).forEach(l=>{var u;const d=(u=a[l])==null?void 0:u.track;if(d){const f=o[l];for(let p=0;p<f.length;p++)d9(d,f[p])}delete o[l]})}}}onBufferFlushing(e,n){const{startOffset:s,endOffset:r,endOffsetSubtitles:i,type:a}=n,{media:o}=this;if(!(!o||o.currentTime<r)){if(!a||a==="video"){const{captionsTracks:l,cueCache:u}=this;Object.keys(l).forEach(d=>f9(l[d].track,s,r)),Object.keys(u).forEach(d=>{const f=u[d];for(let p=f.length;p--;){const m=f[p];m.startTime>=s&&m.endTime<=r&&f.splice(p,1)}})}this.config.renderTextTracksNatively&&s===0&&i!==void 0&&this.tracks.forEach(l=>{var u;const d=(u=l.trackNode)==null?void 0:u.track;d&&f9(d,s,i)})}}extractCea608Data(e){const n=[[],[]],s=e[0]&31;let r=2;for(let i=0;i<s;i++){const a=e[r++],o=127&e[r++],l=127&e[r++];if(o===0&&l===0)continue;if((4&a)!==0){const d=3&a;(d===0||d===1)&&(n[d].push(o),n[d].push(l))}}return n}}function gdt(t,e,n,s){return Math.min(e,s)-Math.max(t,n)}function pne(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const vdt=/\s/,xdt={newCue(t,e,n,s){const r=[];let i,a,o,l,u;const d=self.VTTCue||self.TextTrackCue;for(let p=0;p<s.rows.length;p++)if(i=s.rows[p],o=!0,l=0,u="",!i.isEmpty()){var f;for(let x=0;x<i.chars.length;x++)vdt.test(i.chars[x].uchar)&&o?l++:(u+=i.chars[x].uchar,o=!1);i.cueStartTime=e,e===n&&(n+=1e-4),l>=16?l--:l++;const m=Yxe(u.trim()),v=pU(e,n,m);t!=null&&(f=t.cues)!=null&&f.getCueById(v)||(a=new d(e,n,m),a.id=v,a.line=p+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return t&&r.length&&(r.sort((p,m)=>p.line==="auto"||m.line==="auto"?0:p.line>8&&m.line>8?m.line-p.line:p.line-m.line),r.forEach(p=>d9(t,p))),r}};class aye{constructor(){this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=0,this.config=null,this.callbacks=null,this.context=null,this.stats=new BF}destroy(){this.callbacks=this.context=this.config=null,this.abortInternal(),this.stats=null}load(e,n,s){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now(),this.context=e,this.config=n,this.callbacks=s,this.loadInternal()}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.getNetworkDetails())}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(_2(e,n,!0))this.retry(e);else{var s;Gn.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.getNetworkDetails()))}}retry(e){const{context:n,stats:s}=this;this.retryDelay=zF(e,s.retry),s.retry++,Gn.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n==null?void 0:n.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.resetInternalLoader(),self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(()=>this.loadInternal(),this.retryDelay)}}function ydt(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const bdt=/(\d+)-(\d+)\/(\d+)/;class mne extends aye{constructor(e){super(),this.fetchSetup=void 0,this.request=null,this.response=null,this.controller=null,this.fetchSetup=e.fetchSetup||Edt}destroy(){this.request=null,super.destroy(),this.response=null,this.controller=null,this.fetchSetup=null}abortInternal(){self.clearTimeout(this.retryTimeout),this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}getNetworkDetails(){return this.response}resetInternalLoader(){this.response=null}loadInternal(){const{config:e,context:n,stats:s}=this;if(!e||!n)return;s.loading.first=0,s.loaded=0,s.aborted=!1,this.controller=new self.AbortController;const r=Sdt(n,this.controller.signal),i=n.responseType==="arraybuffer",a=i?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:l}=e.loadPolicy;this.request=this.fetchSetup(n,r),self.clearTimeout(this.requestTimeout),e.timeout=o&&at(o)?o:l,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},e.timeout),(L2(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var f;this.response=d;const p=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},l-(p-s.loading.start)),!d.ok){const{status:v,statusText:x}=d;throw new Cdt(x||"fetch, bad network response",v,d)}s.loading.first=p,s.total=_dt(d.headers)||s.total;const m=(f=this.callbacks)==null?void 0:f.onProgress;return m&&at(e.highWaterMark)?this.loadProgressively(d,s,n,e.highWaterMark,m):i?d.arrayBuffer():n.responseType==="json"?d.json():d.text()}).then(d=>{var f,p;const m=this.response;if(!m)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const v=d[a];v&&(s.loaded=s.total=v);const x={url:m.url,data:d,code:m.status},y=(f=this.callbacks)==null?void 0:f.onProgress;y&&!at(e.highWaterMark)&&y(s,n,d,m),(p=this.callbacks)==null||p.onSuccess(x,s,n,m)}).catch(d=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const f=d&&d.code||0,p=d?d.message:null,m=e.loadPolicy.errorRetry,v=s.retry,x={url:n.url,data:void 0,code:f};if(_2(m,v,!1,x))this.retry(m);else{var y;Gn.error(`${f} while loading ${n.url}`),(y=this.callbacks)==null||y.onError({code:f,text:p},n,d?d.details:null,s)}})}getCacheAge(){let e=null;if(this.response){const n=this.response.headers.get("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,n,s,r=0,i){const a=new oxe,o=e.body.getReader(),l=()=>o.read().then(u=>{if(u.done)return a.dataLength&&i(n,s,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const d=u.value,f=d.length;return n.loaded+=f,f<r||a.dataLength?(a.push(d),a.dataLength>=r&&i(n,s,a.flush().buffer,e)):i(n,s,d.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function Sdt(t,e){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ms({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}function wdt(t){const e=bdt.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}function _dt(t){const e=t.get("Content-Range");if(e){const s=wdt(e);if(at(s))return s}const n=t.get("Content-Length");if(n)return parseInt(n)}function Edt(t,e){return new self.Request(t.url,e)}class Cdt extends Error{constructor(e,n,s){super(e),this.code=void 0,this.details=void 0,this.code=n,this.details=s}}const Tdt=(t,e,n)=>Math.max(e,Math.min(t,n)),kdt=/^age:\s*[\d.]+\s*$/im;class oye extends aye{constructor(e){super(),this.xhrSetup=void 0,this.loader=null,this.xhrSetup=e.xhrSetup||null}destroy(){super.destroy(),this.loader=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}getNetworkDetails(){return this.loader}resetInternalLoader(){this.loader=null}loadInternal(){const{config:e,context:n}=this;if(!e||!n)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return i.call(this,s,n.url,n)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",n.url,!0),i.call(this,s,n.url,n)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,n,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},n,s,r)}):this.openAndSendXhr(s,n,e)}openAndSendXhr(e,n,s){e.readyState||e.open("GET",n.url,!0);const r=n.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);n.rangeEnd&&e.setRequestHeader("Range",`bytes=${n.rangeStart}-${n.rangeEnd-1}`),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=n.responseType,self.clearTimeout(this.requestTimeout),s.timeout=i&&at(i)?i:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:n,stats:s}=this;if(!e||!n)return;const r=n.readyState,i=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const u=n.status,d=n.responseType==="text"?n.responseText:null;if(u>=200&&u<300){const v=d??n.response;if(v!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const x=n.responseType==="arraybuffer"?v.byteLength:v.length;s.loaded=s.total=x,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const y=(a=this.callbacks)==null?void 0:a.onProgress;y&&y(s,e,v,n);const S={url:n.responseURL,data:v,code:u};e.rangeEnd&&x!==e.rangeEnd-e.rangeStart&&Gn.warn(`Payload length ${x}
504 does not match requested Range: bytes=${e.rangeStart}-${e.rangeEnd-1}`),(o=this.callbacks)==null||o.onSuccess(S,s,e,n);return}}const f=i.loadPolicy.errorRetry,p=s.retry,m={url:e.url,data:void 0,code:u};if(_2(f,p,!1,m))this.retry(f);else{var l;Gn.error(`${u} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:u,text:n.statusText},e,n,s)}}}loadprogress(e){const n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total)}getCacheAge(){let e=null;if(this.loader&&kdt.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Rdt={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Adt=Rt(Rt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,loopBackBufferFlush:void 0,startOnSegmentBoundary:!1,nextAudioTrackBufferFlushForwardOffset:.25,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,skipBufferHolePadding:.1,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveMaxUnchangedPlaylistRefresh:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,appendTimeout:1/0,ignorePlaylistParsingErrors:!1,loader:oye,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,handleMpegTsVideoIntegrityErrors:"process",abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,abrSwitchInterval:0,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:X1e,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,emsgKLVSchemaUri:void 0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,iframeCacheLimit:2*1024*1024,useMediaCapabilities:!0,preserveManualLevelOnError:!1,errorPenaltyExpireMs:0,certLoadPolicy:{default:Rdt},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,streamController:tye,abrController:mot,bufferController:sct,capLevelController:aU,errorController:yot,fpsController:vut,id3TrackController:Out,gapController:Mut,latencyController:edt},Ndt()),{},{subtitleStreamController:tdt,subtitleTrackController:jut,timelineController:mdt,audioStreamController:Xlt,audioTrackController:Qlt,emeController:hv,cmcdController:dut,contentSteeringController:hut,iframeController:Hut,interstitialsController:Jut});function Ndt(){return{cueHandler:xdt,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Idt(t,e,n){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');
vendor: 38,496 bytes, line 504
504if(e.liveMaxUnchangedPlaylistRefresh!==void 0){const a=e.liveMaxUnchangedPlaylistRefresh,o=Tdt(a,2,1/0);o!==a&&n.warn(`hls.js config: "liveMaxUnchangedPlaylistRefresh" clamped from ${a} to ${o}.`),e.liveMaxUnchangedPlaylistRefresh=o}const s=m9(t),r=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,u=[];i.forEach(d=>{const f=`${a}Loading${d}`,p=e[f];if(p!==void 0&&l){u.push(f);const m=s[o].default;switch(e[o]={default:m},d){case"TimeOut":m.maxLoadTimeMs=p,m.maxTimeToFirstByteMs=p;break;case"MaxRetry":m.errorRetry.maxNumRetry=p,m.timeoutRetry.maxNumRetry=p;break;case"RetryDelay":m.errorRetry.retryDelayMs=p,m.timeoutRetry.retryDelayMs=p;break;case"MaxRetryTimeout":m.errorRetry.maxRetryDelayMs=p,m.timeoutRetry.maxRetryDelayMs=p;break}}}),u.length&&n.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Fs(e[o])}`)}),Rt(Rt({},s),e)}function m9(t){return t&&typeof t=="object"?Array.isArray(t)?t.map(m9):Object.keys(t).reduce((e,n)=>(e[n]=m9(t[n]),e),{}):t}function Ldt(t,e){const n=t.loader;n!==mne&&n!==oye?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):ydt()&&(t.loader=mne,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}class jdt extends iU{constructor(e,n){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.lastABRSwitchTime=-1,this._iframeVariants=[],this.onParsedComplete=void 0,this.steering=n,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(H.LEVEL_LOADED,this.onLevelLoaded,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(H.FRAG_BUFFERED,this.onFragBuffered,this),e.on(H.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(H.LEVEL_LOADED,this.onLevelLoaded,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(H.FRAG_BUFFERED,this.onFragBuffered,this),e.off(H.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1,this._iframeVariants=[]}onManifestLoading(e,n){this.resetLevels()}onManifestLoaded(e,n){const s=this.hls.config.preferManagedMediaSource,r=[],i={},a={};let o=!1,l=!1,u=!1,d=!1;n.levels.forEach(f=>{const p=f.attrs,m=gne(f,s),{audioCodec:v,videoCodec:x,imageCodec:y,width:S,height:_}=f;if(!m){this.log(`Some or all CODECS not supported "${p.CODECS}"`);return}o||(o=!!(S&&_)),l||(l=!!x),u||(u=!!v),d||(d=!!y);const{CODECS:E,"FRAME-RATE":T,"HDCP-LEVEL":k,"PATHWAY-ID":R,RESOLUTION:I,"VIDEO-RANGE":A}=p,j=`${`${R||"."}-`}${f.bitrate}-${I}-${T}-${E}-${A}-${k}`;if(i[j])if(i[j].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const F=a[j]+=1;f.attrs["PATHWAY-ID"]=new Array(F+1).join(".");const O=this.createLevel(f);i[j]=O,r.push(O)}else f.iframes||(i[j].addGroupId("audio",p.AUDIO),i[j].addGroupId("text",p.SUBTITLES));else{const F=this.createLevel(f);i[j]=F,a[j]=1,r.push(F)}}),this.filterAndSortMediaOptions(r,n,o,l,u,d)}createLevel(e){const n=new A2(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!cye(s.videoCodec,this.hls.config.preferManagedMediaSource)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(r.message),n.supportedResult=P1e(r,[])}return n}filterAndSortMediaOptions(e,n,s,r,i,a){var o;let l=[],u=[],d=e;const f=((o=n.stats)==null?void 0:o.parsing)||{},p=this.hls.config.preferManagedMediaSource;if((s||r)&&i&&(d=d.filter(({videoCodec:k,videoRange:R,width:I,height:A})=>(!!k||!!(I&&A))&&aot(R))),r&&a&&(d=d.filter(k=>!k.imageCodec)),d.length===0){Promise.resolve().then(()=>{if(this.hls){let k="no level with compatible codecs found in manifest",R=k;n.levels.length&&(R=`one or more CODECS in variant not supported: ${Fs(n.levels.map(A=>A.attrs.CODECS).filter((A,L,j)=>j.indexOf(A)===L))}`,this.warn(R),k+=` (${R})`);const I=new Error(k);this.hls.trigger(H.ERROR,{type:_t.MEDIA_ERROR,details:pe.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:I,reason:R})}}),f.end=performance.now();return}n.audioTracks&&(l=n.audioTracks.filter(k=>!k.audioCodec||lye(k.audioCodec,p)),vne(l)),n.subtitles&&(u=n.subtitles,vne(u));const m=d.slice(0);d.sort((k,R)=>{if(k.attrs["HDCP-LEVEL"]!==R.attrs["HDCP-LEVEL"])return(k.attrs["HDCP-LEVEL"]||"")>(R.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&k.height!==R.height)return k.height-R.height;if(k.frameRate!==R.frameRate)return k.frameRate-R.frameRate;if(k.videoRange!==R.videoRange)return h5.indexOf(k.videoRange)-h5.indexOf(R.videoRange);if(k.videoCodec!==R.videoCodec){const I=Xee(k.videoCodec),A=Xee(R.videoCodec);if(I!==A)return A-I}if(k.uri===R.uri&&k.codecSet!==R.codecSet){const I=d5(k.codecSet),A=d5(R.codecSet);if(I!==A)return A-I}return k.averageBitrate!==R.averageBitrate?k.averageBitrate-R.averageBitrate:0});let v=m[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==m.length)){for(let k=0;k<m.length;k++)if(m[k].pathwayId===d[0].pathwayId){v=m[k];break}}this._levels=d;for(let k=0;k<d.length;k++)if(d[k]===v){var x;this._firstLevel=k;const R=v.bitrate,I=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${R}`),((x=this.hls.userConfig)==null?void 0:x.abrEwmaDefaultEstimate)===void 0){const A=Math.min(R,this.hls.config.abrEwmaDefaultEstimateMax);A>I&&I===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const y=n.iframeVariants.filter(k=>gne(k,p));this._iframeVariants=y;const S=i&&!r,_=this.hls.config,E=!!(_.audioStreamController&&_.audioTrackController),T={levels:d,audioTracks:l,subtitleTracks:u,iframeVariants:y,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:i,video:r,altAudio:E&&!S&&l.some(k=>!!k.url)};f.end=performance.now(),this.hls.trigger(H.MANIFEST_PARSED,T)}get iframeVariants(){return this._iframeVariants.length===0?null:this._iframeVariants}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const n=this._levels;if(n.length===0)return;if(e<0||e>=n.length){const d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,n.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs["PATHWAY-ID"]:void 0,a=n[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&r&&i===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${i?" with Pathway "+i:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(H.LEVEL_SWITCHING,l);const u=a.details;if(!u||u.live){const d=this.switchParams(a.uri,r==null?void 0:r.details,u);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const n=this.steering.pathways(),s=e.filter(r=>n.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=s}}onError(e,n){n.fatal||!n.context||n.context.type===hn.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(e,{frag:n}){if(n.type===vt.MAIN){const s=n.elementaryStreams;if(!Object.keys(s).some(i=>!!s[i]))return;const r=this._levels[n.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,n){var s;const{level:r,details:i}=n,a=n.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=n.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0);return}if(a===this.currentLevel||n.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===n.details&&l.advanced&&(l=void 0),this.playlistLoaded(r,n,l)}else(s=n.deliveryDirectives)!=null&&s.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const s=this.getUrlWithDirectives(e.uri,n),r=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],a=e.details,o=a==null?void 0:a.age;this.log(`Loading level index ${r}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${i?" Pathway "+i:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(H.LEVEL_LOADING,{url:s,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){const n=this.currentLevelIndex;if(this.manualLevelIndex===-1&&e!==n&&e!==-1){const r=this.hls.config.abrSwitchInterval;if(r>0){const i=performance.now(),a=i-this.lastABRSwitchTime,o=r*1e3;if(this.lastABRSwitchTime>-1&&a<o){this.warn(`Preventing ABR level switch: ${n} -> ${e} (${Math.round(a)}ms < ${o}ms / ${r}s)`);return}this.lastABRSwitchTime=i,this.log(`Allowing ABR level switch: ${n} -> ${e} (${Math.round(a)}ms >= ${o}ms / ${r}s)`)}}this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var n;if(this._levels.length===1)return;const s=this._levels.filter((i,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));rxe(s),this._levels=s,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=s.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(H.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:n,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(H.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function lye(t,e){return k2(t,"audio",e)}function cye(t,e){return k2(t,"video",e)}function gne(t,e){let{audioCodec:n,videoCodec:s}=t;n&&(t.audioCodec=n=f5(n,e)||void 0),s&&(s=t.videoCodec=Xat(s));const{unknownCodecs:r}=t;return!((r==null?void 0:r.length)||0||n&&!lye(n,e)||s&&!cye(s,e))}function vne(t){const e={};t.forEach(n=>{const s=n.groupId||"";n.id=e[s]=e[s]||0,e[s]++})}class Pdt extends Oo{constructor(e,n){super("key-loader",n),this.config=void 0,this.keyLoaderInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyLoaderInfo){const r=this.keyLoaderInfo[s].loader;if(r){var n;if(e&&e!==((n=r.context)==null?void 0:n.frag.type))return;r.abort()}}}destroy(){for(const e in this.keyLoaderInfo){const n=this.keyLoaderInfo[e].loader;n&&n.destroy()}this.emeController=null,this.keyLoaderInfo={}}loadClear(e,n,s){return this.emeController?this.emeController.loadClear(e,n,s):null}load(e,n){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(s=>this.loadInternal(e,n,s)):this.loadInternal(e,n)}loadInternal(e,n,s){s&&e.setKeyFormat(s);const r=e.decryptdata;if(!r){const a=new Error(s?`Expected frag.decryptdata to be defined after setting format ${s}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(yf(e,pe.KEY_LOAD_ERROR,a))}const i=e;switch(r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(i):n?n.then(()=>this.loadKeyEME(i)):this.loadKeyEME(i);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(i);default:return Promise.reject(yf(e,pe.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e){if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&(n=e.initSegment)!=null&&n.data){const s=Iat(e.initSegment.data);if(s.length){let r=s[0];const i=e.decryptdata.uri;if(r.some(a=>a!==0))this.log(`Using keyId found in init segment ${Zr(r)} keyUri: ${i}`),wd.setKeyIdForUri(i,r);else{const a=wd.addKeyIdForUri(i);this.log(`Patching empty keyId with ${Zr(a)} keyUri: ${i}`),r=a}e.decryptdata.keyId=r}}return this.emeController.loadKey(e).then(()=>({frag:e,keyInfo:{decryptdata:e.decryptdata}}))}return Promise.reject(yf(e,pe.KEY_LOAD_ERROR,new Error(`emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`)))}loadKeyHTTP(e){const n=e.decryptdata,s=n.uri;if(!s)return Promise.reject(yf(e,pe.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const r=this.keyLoaderInfo[s];if(r){if(r.decryptdata.key)return n.key=r.decryptdata.key,r.keyLoadPromise=null,Promise.resolve({frag:e,keyInfo:r});if(r.keyLoadPromise)return r.keyLoadPromise.then(u=>(n.key=r.decryptdata.key,Rt(Rt({},u),{},{frag:e})))}this.log(`Loading${n.keyId?" keyId: "+Zr(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`);const i=this.config,a=i.loader,o=new a(i);e.keyLoader=o;const l=this.keyLoaderInfo[s]={decryptdata:n,keyLoadPromise:null,loader:o};return l.keyLoadPromise=new Promise((u,d)=>{const f={type:hn.KEY,keyInfo:l,frag:e,responseType:"arraybuffer",url:s},p=i.keyLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},v={onSuccess:(x,y,S,_)=>{const{frag:E,keyInfo:T,url:k}=S;if(!E.decryptdata||T!==this.keyLoaderInfo[k])return d(yf(E,pe.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),_));T.decryptdata.key=E.decryptdata.key=new Uint8Array(x.data),E.keyLoader=T.loader=T.keyLoadPromise=null,u({frag:E,keyInfo:T})},onError:(x,y,S,_)=>{this.resetLoader(y),d(yf(e,pe.KEY_LOAD_ERROR,new Error(`HTTP Error ${x.code} loading key ${x.text}`),S,Rt({url:s,data:void 0},x)))},onTimeout:(x,y,S)=>{this.resetLoader(y),d(yf(e,pe.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),S))},onAbort:(x,y,S)=>{this.resetLoader(y),d(yf(e,pe.INTERNAL_ABORTED,new Error("key loading aborted"),S))}};o.load(f,m,v)})}resetLoader(e){const{frag:n,keyInfo:s,url:r}=e,i=s.loader;n.keyLoader===i&&(n.keyLoader=s.loader=s.keyLoadPromise=null),delete this.keyLoaderInfo[r],i&&i.destroy()}}function yf(t,e=pe.KEY_LOAD_ERROR,n,s,r){return new Ic({type:_t.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:r,error:n,networkDetails:s||null})}function xne(t){const{type:e}=t;switch(e){case hn.AUDIO_TRACK:return vt.AUDIO;case hn.SUBTITLE_TRACK:return vt.SUBTITLE;default:return vt.MAIN}}function r8(t,e){let n=t.url;return(n===void 0||n.indexOf("data:")===0)&&(n=e.url),n}class Mdt{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(H.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.LEVEL_LOADING,this.onLevelLoading,this),e.on(H.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(H.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(H.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(H.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.LEVEL_LOADING,this.onLevelLoading,this),e.off(H.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(H.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(H.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const n=this.hls.config,s=n.pLoader,r=n.loader,i=s||r,a=new i(n);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const n=this.loaders[e];n&&n.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,n){const{url:s}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:hn.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,n){const{id:s,level:r,pathwayId:i,url:a,deliveryDirectives:o,levelInfo:l}=n;this.load({id:s,level:r,pathwayId:i,responseType:"text",type:hn.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,n){const{id:s,groupId:r,url:i,deliveryDirectives:a,track:o}=n;this.load({id:s,groupId:r,level:null,responseType:"text",type:hn.AUDIO_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,n){const{id:s,groupId:r,url:i,deliveryDirectives:a,track:o}=n;this.load({id:s,groupId:r,level:null,responseType:"text",type:hn.SUBTITLE_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,n){const s=this.loaders[hn.LEVEL];if(s){const r=s.context;r&&!n.levels.some(i=>i===r.levelOrTrack)&&(s.abort(),delete this.loaders[hn.LEVEL])}}load(e){var n;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const u=this.hls.logger,d=r.context;if((d==null?void 0:d.levelOrTrack)===e.levelOrTrack&&(d.url===e.url||d.deliveryDirectives&&!e.deliveryDirectives)){d.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${d.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let i;if(e.type===hn.MANIFEST?i=s.manifestLoadPolicy.default:i=ms({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),at((n=e.deliveryDirectives)==null?void 0:n.part)){let u;if(e.type===hn.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===hn.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===hn.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const d=u.partTarget,f=u.targetduration;if(d&&f){const p=Math.max(d*3,f*.8)*1e3;i=ms({},i,{maxTimeToFirstByteMs:Math.min(p,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(p,i.maxTimeToFirstByteMs)})}}}const a=i.errorRetry||i.timeoutRetry||{},o={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(u,d,f,p)=>{const m=this.getInternalLoader(f);this.resetInternalLoader(f.type);const v=u.data;d.parsing.start=performance.now(),Wc.isMediaPlaylist(v)||f.type!==hn.MANIFEST?this.handleTrackOrLevelPlaylist(u,d,f,p||null,m):this.handleMasterPlaylist(u,d,f,p)},onError:(u,d,f,p)=>{this.handleNetworkError(d,f,!1,u,p)},onTimeout:(u,d,f)=>{this.handleNetworkError(d,f,!0,void 0,u)}};r.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:n},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(e,n,s,r){const i=this.hls,a=e.data,o=r8(e,s),l=Wc.parseMasterPlaylist(a,o);if(l.playlistParsingError){n.parsing.end=performance.now(),this.handleManifestParsingError(e,s,l.playlistParsingError,r,n);return}const{contentSteering:u,levels:d,iframeVariants:f,sessionData:p,sessionKeys:m,startTimeOffset:v,variableList:x}=l;this.variableList=x,d.forEach(E=>{const{unknownCodecs:T}=E;if(T){const{preferManagedMediaSource:k}=this.hls.config;let{audioCodec:R,videoCodec:I}=E;for(let A=T.length;A--;){const L=T[A];k2(L,"audio",k)?(E.audioCodec=R=R?`${R},${L}`:L,d1.audio[R.substring(0,4)]=2,T.splice(A,1)):k2(L,"video",k)&&(E.videoCodec=I=I?`${I},${L}`:L,d1.video[I.substring(0,4)]=2,T.splice(A,1))}}});const{AUDIO:y=[],SUBTITLES:S,"CLOSED-CAPTIONS":_}=Wc.parseMasterPlaylistMedia(a,o,l);y.length&&!y.some(T=>!T.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new lr({}),bitrate:0,url:""})),i.trigger(H.MANIFEST_LOADED,{levels:d,audioTracks:y,subtitles:S,iframeVariants:f,captions:_,contentSteering:u,url:o,stats:n,networkDetails:r,sessionData:p,sessionKeys:m,startTimeOffset:v,variableList:x})}handleTrackOrLevelPlaylist(e,n,s,r,i){const a=this.hls,{id:o,level:l,type:u}=s,d=r8(e,s),f=at(l)?l:at(o)?o:0,p=xne(s),m=Wc.parseLevelPlaylist(e.data,d,f,p,0,this.variableList);if(u===hn.MANIFEST){const v={attrs:new lr({}),bitrate:0,details:m,name:"",url:d};m.requestScheduled=n.loading.start+txe(m,0),a.trigger(H.MANIFEST_LOADED,{levels:[v],audioTracks:[],iframeVariants:[],url:d,stats:n,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),s.levelDetails=m,this.handlePlaylistLoaded(m,e,n,s,r,i)}handleManifestParsingError(e,n,s,r,i){this.hls.trigger(H.ERROR,{type:_t.NETWORK_ERROR,details:pe.MANIFEST_PARSING_ERROR,fatal:n.type===hn.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:n,networkDetails:r,stats:i})}handleNetworkError(e,n,s=!1,r,i){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===hn.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===hn.AUDIO_TRACK||e.type===hn.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=pe.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case hn.MANIFEST:l=s?pe.MANIFEST_LOAD_TIMEOUT:pe.MANIFEST_LOAD_ERROR,u=!0;break;case hn.LEVEL:l=s?pe.LEVEL_LOAD_TIMEOUT:pe.LEVEL_LOAD_ERROR,u=!1;break;case hn.AUDIO_TRACK:l=s?pe.AUDIO_TRACK_LOAD_TIMEOUT:pe.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case hn.SUBTITLE_TRACK:l=s?pe.SUBTITLE_TRACK_LOAD_TIMEOUT:pe.SUBTITLE_LOAD_ERROR,u=!1;break}d&&this.resetInternalLoader(e.type);const f={type:_t.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:d,context:e,error:o,networkDetails:n,stats:i};if(r){let p=e.url;n&&"url"in n&&(p=n.url),f.response=Rt({url:p,data:void 0},r)}this.hls.trigger(H.ERROR,f)}handlePlaylistLoaded(e,n,s,r,i,a){const o=this.hls,{type:l,level:u,levelOrTrack:d,id:f,groupId:p,deliveryDirectives:m}=r,v=r8(n,r),x=xne(r);let y=typeof r.level=="number"&&x===vt.MAIN?u:void 0;d&&"iframes"in d&&d.iframes&&!e.iframesOnly&&(e.playlistParsingError=new Error("EXT-X-I-FRAME-STREAM-INF media playlist MUST contain an EXT-X-I-FRAMES-ONLY tag"),e.iframesOnly=!0);const S=e.playlistParsingError;if(S){if(this.hls.logger.warn(`${S} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(H.ERROR,{type:_t.NETWORK_ERROR,details:pe.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:S,reason:S.message,response:n,context:r,level:y,parent:x,networkDetails:i,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const _=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(H.ERROR,{type:_t.NETWORK_ERROR,details:pe.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:_,reason:_.message,response:n,context:r,level:y,parent:x,networkDetails:i,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case hn.MANIFEST:case hn.LEVEL:if(y){if(!d)y=0;else if(d!==o.levels[y]){const _=o.levels.indexOf(d);_>-1&&(y=_)}}o.trigger(H.LEVEL_LOADED,{details:e,levelInfo:d||o.levels[0],level:y||0,id:f||0,stats:s,networkDetails:i,deliveryDirectives:m,withoutMultiVariant:l===hn.MANIFEST,context:r});break;case hn.AUDIO_TRACK:o.trigger(H.AUDIO_TRACK_LOADED,{details:e,track:d,id:f||0,groupId:p||"",stats:s,networkDetails:i,deliveryDirectives:m,context:r});break;case hn.SUBTITLE_TRACK:o.trigger(H.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:f||0,groupId:p||"",stats:s,networkDetails:i,deliveryDirectives:m,context:r});break}}}class vi{static get version(){return I2}static isMSESupported(){return eye()}static isSupported(){return $ut()}static getMediaSource(){return Uh()}static get Events(){return H}static get MetadataSchema(){return ba}static get ErrorTypes(){return _t}static get ErrorDetails(){return pe}static get DefaultConfig(){return vi.defaultConfig?vi.defaultConfig:Adt}static set DefaultConfig(e){vi.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this._url=null,this.streamController=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new eU,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.iframeController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const n=this.logger=rat(e.debug||!1,"Hls instance",e.loggerId||e.assetPlayerId),s=this.config=Idt(vi.DefaultConfig,e,n);this.userConfig=e,s.progressive&&Ldt(s,n);const{streamController:r,abrController:i,bufferController:a,capLevelController:o,errorController:l,fpsController:u,id3TrackController:d,iframeController:f,gapController:p}=s,m=new l(this),v=this.abrController=new i(this),x=new bot(this),y=s.interstitialsController,S=y?this.interstitialsController=new y(this,vi):null,_=a?this.bufferController=new a(this,x):null,E=o?this.capLevelController=new o(this):null,T=u?new u(this):null,k=s.cmcdController,R=k?this.cmcdController=new k(this):null,I=new Mdt(this),A=s.contentSteeringController,L=A?new A(this):null,j=this.levelController=new jdt(this,L),F=d?new d(this):void 0,O=new Pdt(this.config,this.logger),M=this.streamController=new r(this,x,O),U=this.gapController=p?new p(this,x):void 0;E&&E.setStreamController(M);const G=[I,j,M];S&&G.splice(1,0,S),L&&G.splice(1,0,L),this.networkControllers=G;const $=[v];_&&$.push(_),U&&$.push(U),E&&$.push(E),T&&(T.setStreamController(M),$.push(T)),F&&$.push(F),$.push(x),this.audioTrackController=this.createController(s.audioTrackController,G);const V=s.audioStreamController;V&&G.push(this.audioStreamController=new V(this,x,O)),this.subtitleTrackController=this.createController(s.subtitleTrackController,G);const B=s.subtitleStreamController;B&&G.push(this.subtititleStreamController=new B(this,x,O)),this.createController(s.timelineController,$),O.emeController=this.emeController=this.createController(s.emeController,$),R&&$.push(R),this.latencyController=this.createController(s.latencyController,$),this.coreComponents=$,this.iframeController=f?new f(this,vi):void 0,G.push(m);const q=m.onErrorOut;typeof q=="function"&&this.on(H.ERROR,q,m),this.on(H.MANIFEST_LOADED,I.onManifestLoaded,I)}createController(e,n){if(e){const s=new e(this);return n&&n.push(s),s}return null}on(e,n,s=this){this._emitter.on(e,n,s)}once(e,n,s=this){this._emitter.once(e,n,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,n,s=this,r){this._emitter.off(e,n,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,n,s){return this._emitter.emit(e,n,s)}trigger(e,n){if(this.config.debug)return this.emit(e,e,n);try{return this.emit(e,e,n)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===H.ERROR;this.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(H.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0,this.iframeController=void 0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(H.ERROR,{type:_t.OTHER_ERROR,details:pe.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in e,s=n?e.media:e,r=n?e:{media:s};this._media=s,this.trigger(H.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia");const e={};this.trigger(H.MEDIA_DETACHING,e),this._media=null,this.trigger(H.MEDIA_DETACHED,e)}transferMedia(){var e;this._media=null;const n=((e=this.bufferController)==null?void 0:e.transferMedia())||null,s={transferMedia:n};return this.trigger(H.MEDIA_DETACHING,s),this.trigger(H.MEDIA_DETACHED,s),n}loadSource(e){var n;this.stopLoad();const s=this.media,r=this._url,i=this._url=UF.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),s&&r&&(r!==i||(n=this.bufferController)!=null&&n.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(s)),this.trigger(H.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,n){this.logger.log(`startLoad(${e+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(e,n),!(!this.started||!this.networkControllers));s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started&&this.streamController.state!==Ne.STOPPED}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[vt.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[vt.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[vt.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,n=this.started,s=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),n&&(s?this.startLoad(s):this.config.autoStartLoad||this.startLoad()))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=m1e()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const n=this.capLevelController,s=!!e;n&&s!==this.config.capLevelToPlayerSize&&(s?n.startCapping():(n.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=s)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){iot(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:n}}=this;if(!e)return 0;const s=e.length;for(let r=0;r<s;r++)if(e[r].maxBitrate>=n)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:n,maxHdcpLevel:s}=this;let r;if(n===-1&&e!=null&&e.length?r=e.length-1:r=n,s)for(let i=r;i--;){const a=e[i].attrs["HDCP-LEVEL"];if(a&&a<=s)return i}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get audioForwardBufferInfo(){var e;return((e=this.audioStreamController)==null?void 0:e.getFwdBufferInfo())||null}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(e))||null}setSubtitleOption(e){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const n=this.audioTrackController;n&&(n.audioTrack=e)}get nextAudioTrack(){var e,n;return(e=(n=this.audioStreamController)==null?void 0:n.nextAudioTrack)!=null?e:-1}set nextAudioTrack(e){const{audioTrackController:n}=this;n&&(n.nextAudioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const n=this.subtitleTrackController;n&&(n.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const n=this.subtitleTrackController;n&&(n.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){var e,n;return(e=(n=this.latencyController)==null?void 0:n.liveSyncPosition)!=null?e:null}get latency(){var e;return((e=this.latencyController)==null?void 0:e.latency)||0}get maxLatency(){var e;return((e=this.latencyController)==null?void 0:e.maxLatency)||0}get targetLatency(){var e;return((e=this.latencyController)==null?void 0:e.targetLatency)||null}set targetLatency(e){this.latencyController&&(this.latencyController.targetLatency=e)}get drift(){var e;return((e=this.latencyController)==null?void 0:e.drift)||null}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?this.interstitialsController.interstitialsManager:null}get iframeVariants(){const e=this.levelController.iframeVariants;return e||[]}
504createIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createIFramePlayer(e):null}createImageIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createImageIFramePlayer(e):null}getMediaDecodingInfo(e,n=this.allAudioTracks){const s=$1e(n);return M1e(e,s,navigator.mediaCapabilities)}}vi.defaultConfig=void 0;const Ddt={navigate:"Navigate",click:"Click",doubleClick:"Double Click",keyPress:"Key Press",input:"Input",change:"Change",submit:"Submit",scroll:"Scroll",drag:"Drag",error:"Error"},Odt=18;function uye(t){var s,r,i,a,o,l,u;if(t.type==="navigate")return t.navigation.url;if(t.type==="scroll"){const d=((s=t.delta)==null?void 0:s.x)??0,f=((r=t.delta)==null?void 0:r.y)??0;return`Δ (${d}, ${f})`}const e="target"in t?t.target:void 0,n=(e==null?void 0:e.accessibleName)||((i=e==null?void 0:e.attributes)==null?void 0:i.ariaLabel)||((a=e==null?void 0:e.attributes)==null?void 0:a.placeholder)||(e==null?void 0:e.text)||(e==null?void 0:e.tagName)||null;if(t.type==="keyPress"){const d=((o=t.keyboard)==null?void 0:o.key)||((l=t.keyboard)==null?void 0:l.text)||"";return d&&n?`"${d}" → ${n}`:d?`"${d}"`:n}if(t.type==="input"){const d=(u=t.value)==null?void 0:u.valueLength;return n&&d?`${n} (${d} chars)`:n||(d?`${d} chars`:null)}if(t.type==="drag"){const{startX:d,startY:f,endX:p,endY:m}=t.pointer??{};return typeof d=="number"&&typeof f=="number"&&typeof p=="number"&&typeof m=="number"?`${n?`${n}: `:""}(${d}, ${f}) → (${p}, ${m})`:n}return t.type==="error"?t.error.message:n}function dye(t){const e=uye(t),n=Ddt[t.type]??t.type;return e?`${n}: ${e}`:n}function $dt(t){const e=Math.floor(Math.max(0,t)),n=Math.floor(e/60),s=e%60;return`${n}:${s.toString().padStart(2,"0")}`}const Fdt=120,fye={navigate:gF,click:bb,doubleClick:bb,submit:bb,keyPress:H0e,input:DD,change:DD,scroll:G0e,drag:V0e,error:W0e},Udt=new Set(["scroll","drag"]),yne=.6,Bdt=20,hye=2,bne=20,Sne=5;function zdt(t,e,n){return Math.max(e,Math.min(t,n-e))}function Vdt({hover:t,marker:e,buffering:n}){const s=PD(Math.round(t.time),240),r=e?fye[e.activity.type]:null,i=e?uye(e.activity)??dye(e.activity):null;return c.jsxs("div",{className:"hls-preview-bg absolute bottom-full mb-2 flex w-[220px] flex-col gap-1.5 rounded-lg p-2 backdrop-blur-md pointer-events-none z-[4]",style:{left:zdt(t.x,110,t.width),transform:"translateX(-50%)"},children:[c.jsx("div",{className:"flex aspect-video w-full items-center justify-center overflow-hidden rounded bg-black/40",children:n?c.jsx(Mh,{className:"h-6 w-6 text-white/70"}):s?c.jsx("img",{src:s,alt:"",className:"h-full w-full object-cover"}):c.jsx("div",{className:"h-full w-full animate-pulse"})}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[e&&r&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"flex shrink-0 text-[var(--sand-12)] dark:text-white",children:c.jsx(r,{size:16})}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-[var(--sand-12)] dark:text-white",children:i})]}),c.jsx("span",{className:"ml-auto shrink-0 text-[12px] font-medium tabular-nums text-[var(--sand-12)] dark:text-white",children:$dt(t.time)})]})]})}const wne=600,Hdt=.35;function Gdt({clusters:t,videoRef:e,duration:n,reduce:s,flashSignal:r}){const[i,a]=w.useState([]),o=w.useRef(0),l=w.useRef(0),u=w.useRef(new Map);return w.useEffect(()=>{r&&u.current.set(r.key,performance.now()+wne)},[r]),w.useEffect(()=>{let d=0;const f=()=>{const p=e.current;if(p){const m=p.currentTime,v=o.current,x=performance.now(),y=(x-l.current)/1e3*(p.playbackRate||1),S=m<v-.1||m>v+y+Hdt,_=u.current,E=[];for(const T of t){const k=T.markers[0],R=T.markers[T.markers.length-1],I=k.activity.type,A=k.videoTime,L=T.markers.length>=hye,j=`cluster#${T.startIndex}`,F=L?(k.percent+R.percent)/2:k.percent,M=Udt.has(I)?R.endVideoTime:R.videoTime+yne;let U=Math.max(M,A+yne);n&&(U=Math.min(U,n));const G=m>=A&&m<=U,$=!S&&v<A&&m>=A;(G&&!p.paused||$||S&&G)&&_.set(j,x+wne);const V=_.get(j);V!=null&&(x<V?E.push({key:j,type:I,percent:F,isBlob:L}):_.delete(j))}o.current=m,l.current=x,a(T=>T.length===E.length&&T.every((k,R)=>k.key===E[R].key&&k.percent===E[R].percent)?T:E)}d=requestAnimationFrame(f)};return d=requestAnimationFrame(f),()=>cancelAnimationFrame(d)},[t,e,n]),c.jsx(xr,{children:i.map(({key:d,type:f,percent:p,isBlob:m})=>{const v=fye[f],x=B0e(f);return c.jsx(wt.span,{className:`pointer-events-none absolute bottom-full z-[5] flex ${x} ${m?"mb-3":"mb-2"}`,style:{left:`${p}%`},initial:s?{opacity:0,x:"-50%"}:{opacity:0,x:"-50%",y:8},animate:s?{opacity:1,x:"-50%"}:{opacity:1,x:"-50%",y:-2},exit:s?{opacity:0,x:"-50%"}:{opacity:0,x:"-50%",y:-14},transition:{duration:s?.15:.35,ease:"easeOut"},children:c.jsx(v,{size:24})},d)})})}function Wdt({id:t}){var Vt;const{useSessionHlsPlaylist:e,useSessionAgentTraces:n,useSession:s}=fr(),{data:r,isLoading:i,isError:a}=e(t),{data:o}=s(t),{data:l}=n(t),u=VS(),d=Hh()??!1,[f,p]=w.useState(null),[m,v]=w.useState(0),x=w.useRef(null),y=w.useRef(null),S=w.useRef(new Map),_=w.useRef(Promise.resolve()),E=w.useRef(null),T=w.useRef(null),k=w.useRef(null),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),L=w.useRef(null),j=w.useRef(null),F=w.useRef(null),O=w.useRef(null),M=w.useRef(null);j.current=(u==null?void 0:u.registerSeek)??null,F.current=(u==null?void 0:u.setRecordingStartedAt)??null,O.current=(u==null?void 0:u.setFragmentMappings)??null,M.current=(u==null?void 0:u.registerGetThumbnail)??null,w.useEffect(()=>{const ce=j.current;return ce?(ce(Fe=>{const tt=x.current;tt&&(ue(!0),ye.current&&window.clearTimeout(ye.current),ye.current=window.setTimeout(()=>ue(!1),550),tt.currentTime=Fe,tt.pause(),Re(st=>st+1))}),()=>ce(null)):void 0},[]);const[U,G]=w.useState(!1),[$,V]=w.useState(0),[B,q]=w.useState(0),[z,D]=w.useState(null),[K,Y]=w.useState(!1),J=w.useRef(!1),[ne,Q]=w.useState(null),ee=w.useRef(0),[te,ue]=w.useState(!1),ye=w.useRef(null),[je,Re]=w.useState(0),[me,Ce]=w.useState(!1),[Xe,he]=w.useState(!1),[De,Ge]=w.useState(!1),[Je,Le]=w.useState(null),[qe,et]=w.useState(0),[Ct,Ke]=w.useState(0),[dt,Xt]=w.useState(1),[_n,Dt]=w.useState([]),[nn,fn]=w.useState(!1),[Tt,Ie]=w.useState(!1),[Z,ie]=w.useState(null),[le,Ee]=w.useState(null),[ke,Ae]=w.useState(null),Ye=[1,2,3,4];w.useEffect(()=>{if(!U||!x.current||!E.current||!B){L.current&&(cancelAnimationFrame(L.current),L.current=null);return}
504function ce(){if(!x.current||!E.current||!B)return;const Fe=`${(100*Math.min(1,x.current.currentTime/B)).toFixed(2)}%`;E.current.style.setProperty("--progress-percentage",Fe),U&&(L.current=requestAnimationFrame(ce))}return L.current=requestAnimationFrame(ce),()=>{L.current&&(cancelAnimationFrame(L.current),L.current=null)}},[U,B]),w.useEffect(()=>{if(!r||!x.current)return;const ce=x.current;if(vi.isSupported()){const be=new vi({maxBufferLength:120,maxMaxBufferLength:120,maxBufferSize:314572800,maxBufferHole:.5,backBufferLength:60,startFragPrefetch:!0,enableWorker:!0,lowLatencyMode:!1}),Fe=new Blob([r],{type:"application/vnd.apple.mpegurl"}),tt=URL.createObjectURL(Fe);be.loadSource(tt),be.attachMedia(ce);const st=()=>{const Ht=ce.buffered;if(Ht.length>0){const as=Ht.end(Ht.length-1)-ce.currentTime;console.log("[HLS] Fragment buffered. Buffer ahead:",as.toFixed(2),"s","Current time:",ce.currentTime.toFixed(2),"s")}},bt=(Ht,Pt)=>{console.error("[HLS] Error:",Pt)},yt=(Ht,Pt)=>{var gs,pn;const as=[];for(const vs of Pt.details.fragments)typeof vs.programDateTime=="number"&&Number.isFinite(vs.programDateTime)&&as.push({videoStart:vs.start,duration:vs.duration,wallClockMs:vs.programDateTime});as.length&&((gs=O.current)==null||gs.call(O,as),(pn=F.current)==null||pn.call(F,as[0].wallClockMs))};return be.on(vi.Events.FRAG_BUFFERED,st),be.on(vi.Events.ERROR,bt),be.on(vi.Events.LEVEL_LOADED,yt),()=>{be.off(vi.Events.FRAG_BUFFERED,st),be.off(vi.Events.ERROR,bt),be.off(vi.Events.LEVEL_LOADED,yt),be.destroy(),URL.revokeObjectURL(tt)}}else if(ce.canPlayType("application/vnd.apple.mpegurl")){const be=new Blob([r],{type:"application/vnd.apple.mpegurl"}),Fe=URL.createObjectURL(be);return ce.src=Fe,()=>URL.revokeObjectURL(Fe)}},[r]),w.useEffect(()=>{var st;if(!r||!y.current)return;const ce=y.current;let be=null,Fe=null;if(vi.isSupported()){be=new vi({enableWorker:!0,lowLatencyMode:!1});const bt=new Blob([r],{type:"application/vnd.apple.mpegurl"});Fe=URL.createObjectURL(bt),be.loadSource(Fe),be.attachMedia(ce)}else if(ce.canPlayType("application/vnd.apple.mpegurl")){const bt=new Blob([r],{type:"application/vnd.apple.mpegurl"});Fe=URL.createObjectURL(bt),ce.src=Fe}const tt=async(bt,yt=256)=>{const Ht=Math.max(0,Math.round(bt)),Pt=`${Ht}_${yt}`,as=S.current.get(Pt);if(as)return as;const gs=_.current.then(async()=>{const pn=y.current;if(!pn)return null;const vs=S.current.get(Pt);if(vs)return vs;if(pn.currentTime=Ht,await new Promise((qt,qn)=>{const ni=()=>{pn.removeEventListener("seeked",ni),pn.removeEventListener("error",ua),qt()},ua=()=>{pn.removeEventListener("seeked",ni),pn.removeEventListener("error",ua),qn(new Error("seek failed"))};pn.addEventListener("seeked",ni),pn.addEventListener("error",ua)}),!pn.videoWidth||!pn.videoHeight)return null;const fi=pn.videoHeight/pn.videoWidth,Ma=Math.min(window.devicePixelRatio||1,2),pr=document.createElement("canvas");pr.width=Math.round(yt*Ma),pr.height=Math.round(yt*fi*Ma);const rr=pr.getContext("2d");if(!rr)return null;rr.imageSmoothingEnabled=!0,rr.imageSmoothingQuality="high",rr.drawImage(pn,0,0,pr.width,pr.height);const ki=await new Promise(qt=>pr.toBlob(qt,"image/jpeg",.9));if(!ki)return null;const ca=URL.createObjectURL(ki);return S.current.set(Pt,ca),ca}).catch(()=>null);return _.current=gs,gs};return(st=M.current)==null||st.call(M,tt),()=>{var bt;(bt=M.current)==null||bt.call(M,null),be&&be.destroy(),Fe&&URL.revokeObjectURL(Fe),S.current.forEach(yt=>URL.revokeObjectURL(yt)),S.current.clear()}},[r]),w.useEffect(()=>{const ce=x.current;if(!ce)return;ce.playbackRate=1;const be=()=>{if(!ce.buffered||!B)return;const rr=[];for(let ki=0;ki<ce.buffered.length;ki++){const ca=ce.buffered.start(ki),qt=ce.buffered.end(ki),qn=ca/B*100,ni=qt/B*100;rr.push({start:ca,end:qt,left:`${qn}%`,width:`${ni-qn}%`})}Dt(rr)},Fe=()=>{V(ce.currentTime),be()},tt=()=>{const rr=ce.duration;!isNaN(rr)&&isFinite(rr)&&q(rr)},st=()=>{ce.videoWidth&&ce.videoHeight&&D(ce.videoWidth/ce.videoHeight)},bt=()=>{const rr=ce.duration;!isNaN(rr)&&isFinite(rr)&&q(rr),st()},yt=()=>be(),Ht=()=>G(!0),Pt=()=>G(!1),as=()=>Xt(ce.playbackRate),gs=()=>fn(!0),pn=()=>fn(!0),vs=()=>fn(!1),fi=()=>fn(!1),Ma=()=>{fn(!1),V(ce.currentTime)},pr=()=>fn(!1);return ce.addEventListener("timeupdate",Fe),ce.addEventListener("durationchange",tt),ce.addEventListener("loadedmetadata",bt),ce.addEventListener("loadeddata",st),ce.addEventListener("resize",st),ce.addEventListener("progress",yt),ce.addEventListener("play",Ht),ce.addEventListener("pause",Pt),ce.addEventListener("ratechange",as),ce.addEventListener("waiting",gs),ce.addEventListener("stalled",pn),ce.addEventListener("playing",vs),ce.addEventListener("canplay",fi),ce.addEventListener("seeked",Ma),ce.addEventListener("ended",pr),()=>{ce.removeEventListener("timeupdate",Fe),ce.removeEventListener("durationchange",tt),ce.removeEventListener("loadedmetadata",bt),ce.removeEventListener("loadeddata",st),ce.removeEventListener("resize",st),ce.removeEventListener("progress",yt),ce.removeEventListener("play",Ht),ce.removeEventListener("pause",Pt),ce.removeEventListener("ratechange",as),ce.removeEventListener("waiting",gs),ce.removeEventListener("stalled",pn),ce.removeEventListener("playing",vs),ce.removeEventListener("canplay",fi),ce.removeEventListener("seeked",Ma),ce.removeEventListener("ended",pr)}},[r]),w.useEffect(()=>{const ce=document.createElement("canvas");ce.width=24,ce.height=8;const be=ce.getContext("2d",{willReadFrequently:!0});if(!be)return;const Fe=()=>{const st=x.current;if(!(!st||!st.videoWidth||!st.videoHeight))try{const bt=Math.max(1,Math.round(st.videoHeight*.28));be.drawImage(st,0,st.videoHeight-bt,st.videoWidth,bt,0,0,24,8);const{data:yt}=be.getImageData(0,0,24,8);let Ht=0;for(let pn=0;pn<yt.length;pn+=4)Ht+=.299*yt[pn]+.587*yt[pn+1]+.114*yt[pn+2];const Pt=Ht/(yt.length/4),as=J.current,gs=as?Pt>120:Pt>150;gs!==as&&(J.current=gs,Y(gs))}catch{}},tt=window.setInterval(Fe,500);return Fe(),()=>window.clearInterval(tt)},[]);const Qe=()=>{const ce=x.current;if(!ce)return;const be=ce.paused;be?ce.play():ce.pause(),ee.current+=1,Q({type:be?"play":"pause",seq:ee.current})},ft=w.useRef(Qe);ft.current=Qe,w.useEffect(()=>{const ce=be=>{const Fe=document.activeElement,tt=Fe==null?void 0:Fe.tagName;if(!(tt==="INPUT"||tt==="TEXTAREA"||tt==="SELECT"||Fe!=null&&Fe.isContentEditable)){if(be.code==="Space"||be.key===" "){if(tt==="BUTTON"||tt==="A"||(Fe==null?void 0:Fe.getAttribute("role"))==="button")return;be.preventDefault(),ft.current();return}if(be.key==="ArrowLeft"||be.key==="ArrowRight"){const st=x.current;if(!st)return;be.preventDefault();const bt=st.currentTime+(be.key==="ArrowLeft"?-Sne:Sne);st.currentTime=Math.max(0,Number.isFinite(st.duration)?Math.min(st.duration,bt):bt)}}};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[]);const Me=ce=>{if(!E.current||!x.current||!B)return;const be=E.current.getBoundingClientRect(),Fe=Math.max(0,Math.min(1,(ce-be.left)/be.width));x.current.currentTime=B*Fe},Ut=ce=>{Ie(!0),ce.currentTarget.setPointerCapture(ce.pointerId),Me(ce.clientX)},Nn=ce=>{Tt&&Me(ce.clientX)},Cs=ce=>{Tt&&(Ie(!1),ce.currentTarget.releasePointerCapture(ce.pointerId))},$o=(ce,be)=>{var yt,Ht;const Fe=Fdt,tt=8,st=((yt=T.current)==null?void 0:yt.offsetWidth)??0,bt=((Ht=k.current)==null?void 0:Ht.offsetWidth)??0;return{fadeLeft:ce-Fe<st+tt,fadeRight:ce+Fe>be-bt-tt}},gu=ce=>{if(!E.current||!B)return;const be=E.current.getBoundingClientRect(),Fe=ce.clientX-be.left,tt=Math.max(0,Math.min(1,Fe/be.width)),st=ve(Fe,be.width);ie({time:B*tt,x:Fe,width:be.width,...$o(Fe,be.width)}),Ee(st),u==null||u.setHoveredActivityKey(st!==null?Vf(Dr[st].activity):null)},Ti=()=>{ie(null),Ee(null),u==null||u.setHoveredActivityKey(null)},Pa=ce=>{x.current&&(x.current.playbackRate=ce,Xt(ce))};w.useEffect(()=>{if(E.current&&B){const ce=Math.min(1,$/B);E.current.style.setProperty("--progress-percentage",`${(100*ce).toFixed(2)}%`)}},[$,B]);const bl=w.useMemo(()=>u!=null&&u.recordingStartedAt?u.recordingStartedAt:o!=null&&o.createdAt?new Date(o.createdAt).getTime():null,[u==null?void 0:u.recordingStartedAt,o==null?void 0:o.createdAt]),Dr=w.useMemo(()=>{var Fe;if(!((Fe=l==null?void 0:l.events)!=null&&Fe.length)||!B)return[];const ce=(u==null?void 0:u.fragmentMappings)??[],be=tt=>ce.length?pF(tt,ce):bl?(tt-bl)/1e3:null;return l.events.map(tt=>{const st=be(new Date(tt.timestamp).getTime());if(st===null||st<0||st>B)return null;const bt=new Date(tt.endTimestamp??tt.timestamp).getTime(),yt=be(bt);return{activity:tt,videoTime:st,endVideoTime:yt!=null&&yt>st?yt:st,percent:st/B*100}}).filter(tt=>tt!==null).sort((tt,st)=>tt.videoTime-st.videoTime)}
504,[l,u==null?void 0:u.fragmentMappings,bl,B]);w.useEffect(()=>{const ce=E.current;if(!ce)return;const be=()=>v(ce.clientWidth);be();const Fe=new ResizeObserver(be);return Fe.observe(ce),()=>Fe.disconnect()},[]);const Zh=w.useMemo(()=>{const ce=[],be=m/100;for(let Fe=0;Fe<Dr.length;Fe++){const tt=Dr[Fe],st=ce[ce.length-1],bt=st?st.markers[st.markers.length-1]:null,yt=bt!=null&&m>0&&bt.activity.type===tt.activity.type&&(tt.percent-bt.percent)*be<=Bdt;st&&yt?st.markers.push(tt):ce.push({markers:[tt],startIndex:Fe})}return ce},[Dr,m]),ae=w.useRef(u==null?void 0:u.setPlayingActivityKey);ae.current=u==null?void 0:u.setPlayingActivityKey;const de=w.useRef(null);w.useEffect(()=>{var be;let ce=null;for(let Fe=Dr.length-1;Fe>=0;Fe--)if(Dr[Fe].videoTime<=$){ce=Vf(Dr[Fe].activity);break}ce!==de.current&&(de.current=ce,(be=ae.current)==null||be.call(ae,ce))},[$,Dr]);const ve=(ce,be)=>{if(Dr.length===0||be<=0)return null;const Fe=Math.max(0,Math.min(be,ce))/be*100;let tt=0,st=Dr.length-1;for(;tt<=st;){const Pt=tt+st>>1;Dr[Pt].percent<Fe?tt=Pt+1:st=Pt-1}const bt=[tt-1,tt].filter(Pt=>Pt>=0&&Pt<Dr.length);let yt=null,Ht=Number.POSITIVE_INFINITY;for(const Pt of bt){const as=Dr[Pt].percent/100*be,gs=Math.abs(as-ce);gs<Ht&&(Ht=gs,yt=Pt)}return Ht<=Odt?yt:null},ze=ce=>{var st;const be=(st=E.current)==null?void 0:st.getBoundingClientRect();if(!be)return;const Fe=Dr[ce],tt=Fe.percent/100*be.width;ie({time:Fe.videoTime,x:tt,width:be.width,...$o(tt,be.width)}),Ee(ce),u==null||u.setHoveredActivityKey(Vf(Fe.activity))},We=(ce,be,Fe)=>{ce.stopPropagation(),x.current&&(x.current.currentTime=be.videoTime,x.current.pause()),p(tt=>({key:`cluster#${Fe}`,nonce:((tt==null?void 0:tt.nonce)??0)+1})),u==null||u.openActivity(Vf(be.activity))},xt=()=>{const ce=window.innerWidth,be=window.innerHeight,Fe=z??16/9,tt=qe;let st=ce*.85,bt=st/Fe;bt+tt>be&&(bt=Math.max(0,be-tt),st=bt*Fe);const yt=bt+tt;return{top:(be-yt)/2,left:(ce-st)/2,width:st,height:yt}},ut=()=>{var be;const ce=(be=R.current)==null?void 0:be.getBoundingClientRect();ce&&(A.current&&(clearTimeout(A.current),A.current=null),Ge(!1),Le({top:ce.top,left:ce.left,width:ce.width,height:ce.height}),he(!0),Ce(!0),requestAnimationFrame(()=>{Ge(!0),Le(xt())}))},It=()=>{var be;const ce=(be=R.current)==null?void 0:be.getBoundingClientRect();if(Ce(!1),!ce){he(!1),Le(null);return}Ge(!0),Le({top:ce.top,left:ce.left,width:ce.width,height:ce.height}),A.current=window.setTimeout(()=>{he(!1),Le(null),A.current=null},460)};w.useEffect(()=>{if(!me)return;const ce=Fe=>{Fe.key==="Escape"&&It()},be=()=>Le(xt());return window.addEventListener("keydown",ce),window.addEventListener("resize",be),()=>{window.removeEventListener("keydown",ce),window.removeEventListener("resize",be)}},[me]),w.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]),w.useEffect(()=>{const ce=R.current,be=I.current;if(!ce)return;const Fe=new ResizeObserver(()=>{Ke(ce.clientWidth),be&&et(be.offsetHeight)});return Fe.observe(ce),be&&Fe.observe(be),Ke(ce.clientWidth),be&&et(be.offsetHeight),()=>Fe.disconnect()},[z]);const ct="top 0.45s cubic-bezier(0.22,1,0.36,1), left 0.45s cubic-bezier(0.22,1,0.36,1), width 0.45s cubic-bezier(0.22,1,0.36,1), height 0.45s cubic-bezier(0.22,1,0.36,1)",Lt=u!=null&&u.hoveredActivityKey&&!Z?(Vt=Dr.find(ce=>Vf(ce.activity)===u.hoveredActivityKey))==null?void 0:Vt.percent:void 0;return c.jsxs(c.Fragment,{children:[nr.createPortal(c.jsx(xr,{children:me&&c.jsx(wt.div,{initial:{opacity:0}
504,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},onClick:It,className:"fixed inset-0 z-[95] bg-black/30 dark:bg-black/70 backdrop-blur-sm"},"hls-fullscreen-backdrop")}),document.body),c.jsx("div",{ref:R,style:z&&Ct?{position:"relative",width:"100%",height:Ct/z+qe}:{position:"relative",width:"100%",aspectRatio:z?String(z):"16/9"},children:c.jsxs("div",{className:`hls-player${K?" hls-player--on-light":""}`,style:Xe&&Je?{position:"fixed",zIndex:100,top:Je.top,left:Je.left,width:Je.width,height:Je.height,transition:De?ct:"none"}:{position:"absolute",inset:0},children:[c.jsxs("div",{onClick:Qe,style:{width:"100%",flex:1,minHeight:0,backgroundColor:"#000",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"12px 12px 0 0",borderTop:me?"none":"0.5px solid var(--sand-6)",borderLeft:me?"none":"0.5px solid var(--sand-6)",borderRight:me?"none":"0.5px solid var(--sand-6)",overflow:"hidden",cursor:"pointer"},children:[c.jsx("video",{ref:x,style:{width:"100%",height:"100%",objectFit:"contain",backgroundColor:"#000"},playsInline:!0,controls:!1,autoPlay:!0,preload:"auto"}),c.jsx("video",{ref:y,style:{display:"none"},muted:!0,playsInline:!0,preload:"auto","aria-hidden":"true"}),(i||!r||nn)&&!a&&c.jsx("div",{className:"absolute inset-0 z-1 flex items-center justify-center bg-black/15 z-50",children:c.jsx(Mh,{className:"w-10 h-10 text-slate-50"})}),a&&c.jsx("div",{className:"absolute inset-0 z-1 flex items-center justify-center bg-black/80 z-50",children:c.jsxs("div",{className:"text-center text-slate-50",children:[c.jsx("div",{className:"mb-2 flex justify-center",children:c.jsx(Vit,{size:48})}),c.jsx("div",{className:"text-lg font-medium",children:"This session has no recording"}),c.jsx("div",{className:"text-sm text-slate-300 mt-1",children:"Recordings may have been disabled when this session was created."})]})}),ne&&c.jsx(wt.div,{initial:{opacity:.9,scale:.7},animate:{opacity:0,scale:1.2},transition:{duration:.5,ease:"easeOut"},onAnimationComplete:()=>Q(ce=>ce&&ce.seq===ne.seq?null:ce),className:"pointer-events-none absolute inset-0 z-[13] flex items-center justify-center",children:c.jsx("div",{className:"flex size-[64px] items-center justify-center rounded-full bg-black/40 backdrop-blur-md [&_svg_path]:fill-white",children:ne.type==="play"?c.jsx(Bee,{size:28,className:"text-white"}):c.jsx(Uee,{size:28,className:"text-white"})})},ne.seq),je>0&&c.jsx(wt.div,{initial:{opacity:.4},animate:{opacity:0},transition:{duration:.4,ease:"easeOut"},className:"pointer-events-none absolute inset-0 z-[12] bg-black"},je)]}),c.jsxs("div",{ref:I,className:"rr-controller",children:[c.jsxs("div",{className:"hls-bar",children:[c.jsxs("div",{ref:T,className:`hls-bar__group${Z!=null&&Z.fadeLeft?" hls-bar__group--faded":""}`,children:[c.jsx("button",{type:"button",className:"hls-blob hls-blob--icon",onClick:Qe,"aria-label":U?"Pause":"Play",children:c.jsx(wt.span,{initial:{scale:.55},animate:{scale:1},transition:{type:"spring",bounce:.5,duration:.3},className:"flex items-center justify-center",children:U?c.jsx(Uee,{size:16,className:"text-[var(--sand-12)] dark:text-white"}):c.jsx(Bee,{size:16,className:"text-[var(--sand-12)] dark:text-white"})},U?"pause":"play")}),c.jsxs("div",{className:"hls-blob hls-time",children:[c.jsx("span",{children:s5($,!0)}),c.jsxs("span",{className:"hls-time__total",children:[" / ",s5(B||0,!0)]})]})]}),c.jsxs("div",{ref:k,className:`hls-bar__group${Z!=null&&Z.fadeRight?" hls-bar__group--faded":""}`,children:[c.jsx("button",{type:"button",className:"hls-blob hls-time cursor-pointer","aria-label":`Playback speed ${dt}x, click to change`,onClick:()=>{const ce=Ye.indexOf(dt);Pa(Ye[(ce+1)%Ye.length])},children:c.jsxs(wt.span,{initial:{scale:.55},animate:{scale:1},transition:{type:"spring",bounce:.6,duration:.4},children:[dt,"x"]},dt)}),c.jsx("button",{type:"button",onClick:()=>me?It():ut(),"aria-label":me?"Exit full screen":"Full screen",className:"hls-blob size-[32px] cursor-pointer p-0",children:me?c.jsx(o1e,{size:16,className:"text-[var(--sand-12)] dark:text-white"}):c.jsx(mF,{size:16,className:"text-[var(--sand-12)] dark:text-white"})})]})]}),c.jsxs("div",{className:"rr-timeline",children:[c.jsxs("div",{className:`rr-progress${Tt?" rr-progress--dragging":""}`,ref:E,onPointerDown:Ut,onPointerMove:Nn,onPointerUp:Cs,onPointerCancel:Cs,onMouseMove:gu,onMouseLeave:Ti,children:[_n.map((ce,be)=>c.jsx("div",{className:"bg-black/15 dark:bg-white/30",style:{width:ce.width,height:"100%",position:"absolute",left:ce.left,zIndex:1,borderRadius:"999px"}},be)),Z&&c.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 rounded-full bg-black/10 dark:bg-white/25",style:{width:Z.x,zIndex:1}}),Lt!=null&&c.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 rounded-full bg-black/10 dark:bg-white/25 transition-[width] duration-150",style:{width:`${Lt}%`,zIndex:1}}),c.jsx("div",{className:"rr-progress__step",style:{width:"var(--progress-percentage, 0%)",zIndex:2,position:"relative",transition:te?"width 0.5s cubic-bezier(0.22, 1, 0.36, 1)":void 0}}),Zh.map(ce=>{if(ce.markers.length<hye)return ce.markers.map((Ht,Pt)=>{const as=ce.startIndex+Pt,gs=Math.abs(Ht.videoTime-$)<1,pn=Vf(Ht.activity),vs=(u==null?void 0:u.hoveredActivityKey)===pn,Ma=JQ(Ht.activity.type)??"var(--blue-9)",pr=["timeline-marker",gs&&"timeline-marker--active",vs&&"timeline-marker--hover"].filter(
504Boolean).join(" ");return c.jsx("button",{type:"button",className:pr,style:{left:`${Ht.percent}%`,"--marker-color":Ma},"aria-label":dye(Ht.activity),onFocus:()=>ze(as),onBlur:Ti,onClick:rr=>We(rr,Ht,as)},as)});const be=ce.markers[0],Fe=ce.markers[ce.markers.length-1],tt=(be.percent+Fe.percent)/2,st=JQ(be.activity.type)??"var(--blue-9)",bt=st.includes("yellow")?"#1c1917":"#fff",yt=ke===ce.startIndex?bne+2:bne;return c.jsx("button",{type:"button",className:"absolute z-[4] flex items-center justify-center rounded-full font-semibold leading-none",style:{left:`${tt}%`,top:"50%",width:yt,height:yt,transform:"translate(-50%, -50%)",background:st,color:bt,fontSize:11,boxShadow:"0 0 0 4px var(--sand-2)",transition:d?void 0:"width 120ms ease-out, height 120ms ease-out"},"aria-label":`${ce.markers.length} ${be.activity.type} actions`,onMouseEnter:()=>Ae(ce.startIndex),onMouseLeave:()=>Ae(null),onClick:Ht=>We(Ht,be,ce.startIndex),children:ce.markers.length},`cluster-${ce.startIndex}`)}),c.jsx(Gdt,{clusters:Zh,videoRef:x,duration:B,reduce:d,flashSignal:f})]}),Z&&c.jsx(Vdt,{hover:Z,marker:le!==null?Dr[le]??null:null,buffering:nn})]})]})]})})]})}function qdt(){return c.jsxs("svg",{width:"270",height:"270",viewBox:"0 0 324 324",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M229.194 198.798C228.609 191.27 227.388 183.614 225.608 175.832C225.532 175.425 225.43 175.043 225.328 174.662C224.413 170.771 223.344 166.879 222.124 162.937C218.461 151.085 213.832 139.59 208.263 128.501C206.406 124.813 204.448 121.151 202.388 117.565H202.362C202.159 117.158 201.93 116.776 201.701 116.369C194.224 103.475 185.602 91.4445 175.835 80.3303C174.36 78.6771 172.885 77.0497 171.385 75.4219C170.215 74.1757 169.045 72.9549 167.875 71.7596C161.974 65.7574 155.87 60.3656 149.588 55.5841C144.578 51.7692 139.441 48.3357 134.151 45.2837C131.124 43.5543 128.148 41.9772 125.224 40.5784C115.966 36.2039 107.141 33.5339 98.7223 32.6183C98.1119 32.5166 97.5015 32.4655 96.8911 32.4146C86.9977 31.6262 78.2233 32.9233 70.5425 36.3567L66.5749 38.3408C57.9785 43.2494 51.1625 50.9045 46.1522 61.3575C41.1419 71.785 38.6494 84.5778 38.6494 99.736C38.6494 114.894 41.1419 130.586 46.1522 146.813C51.1625 163.064 57.9785 178.578 66.5749 193.406C75.1713 208.233 85.2682 221.866 96.8911 234.328C108.514 246.79 120.925 256.837 134.151 264.466C137.33 266.298 140.509 267.925 143.688 269.299C146.867 270.672 150.072 272.096 153.251 273.572V251.114C150.072 249.638 146.867 248.214 143.688 246.841C140.509 245.442 137.33 243.84 134.151 242.009C130.005 233.031 126.419 224.078 123.392 215.126C120.366 206.148 117.899 197.195 115.991 188.243L143.357 204.062L143.688 204.24V182.317L116.78 166.778L111.693 163.853C111.363 161.157 111.083 158.486 110.905 155.841C110.778 154.646 110.701 153.451 110.625 152.255C110.396 148.466 110.269 144.752 110.269 141.09C110.269 137.428 110.396 133.867 110.625 130.332C110.854 126.822 111.21 123.389 111.693 120.006L152.386 143.506L156.583 145.922C157.066 149.839 157.422 153.705 157.651 157.494C157.905 161.284 158.007 165.023 158.007 168.66C158.007 170.872 157.981 173.06 157.88 175.221C157.829 176.62 157.752 178.019 157.651 179.418C157.473 182.343 157.193 185.217 156.786 188.065C156.735 188.625 156.659 189.21 156.583 189.769L157.524 190.328L164.034 194.067L175.683 200.782C175.937 199.052 176.141 197.323 176.319 195.568C176.497 193.889 176.649 192.185 176.751 190.456C176.827 189.515 176.878 188.574 176.904 187.633C177.056 185.013 177.107 182.368 177.107 179.698C177.107 176.035 177.005 172.322 176.751 168.532C176.7 167.642 176.649 166.778 176.548 165.887C176.344 162.937 176.064 159.961 175.683 156.96L184.381 161.971L194.554 167.846L208.161 175.704C208.695 178.476 209.153 181.198 209.483 183.869C209.661 185.166 209.814 186.437 209.941 187.684C210.348 191.575 210.552 195.339 210.552 199.001C210.552 199.891 210.552 200.807 210.501 201.697C210.45 204.393 210.246 207.013 209.941 209.607C209.56 213.04 208.949 216.347 208.161 219.526L223.217 228.224L227.744 230.843C228.38 227.537 228.838 224.18 229.169 220.696C229.499 217.237 229.652 213.676 229.652 210.014C229.652 206.352 229.499 202.562 229.194 198.798ZM60.1404 134.071C59.3265 129.95 58.7415 125.957 58.3346 122.066C57.9277 118.2 57.7497 114.411 57.7497 110.774C57.7497 107.137 57.9277 103.576 58.3346 100.168C58.7415 96.7348 59.3265 93.4286 60.1404 90.224L92.593 108.968C92.1606 112.02 91.83 115.148 91.6011 118.328L91.5248 119.319C91.2959 122.829 91.1687 12
5046.415 91.1687 130.078C91.1687 133.74 91.2959 137.453 91.5248 141.243C91.7537 145.032 92.1097 148.872 92.593 152.815L60.1404 134.071ZM85.6752 194.703C78.6811 183.996 72.8569 172.653 68.2535 160.674L96.4079 176.925C97.8576 184.53 99.6379 192.185 101.8 199.891C103.936 207.623 106.454 215.431 109.302 223.29C100.554 214.948 92.6693 205.41 85.6752 194.703ZM101.8 72.4971C99.6379 77.7363 97.8576 83.3316 96.4079 89.2575L89.9734 85.5443L68.2535 73.0055C72.8569 66.3421 78.6811 61.7135 85.6752 59.0939C87.3029 58.4835 88.956 58.0003 90.6855 57.6188C93.8646 56.9321 97.1963 56.6526 100.706 56.7798C103.478 56.8561 106.352 57.1864 109.302 57.7968C106.454 62.3493 103.936 67.2579 101.8 72.4971ZM142.391 115.81L115.991 100.575C117.899 93.81 120.366 87.7059 123.392 82.2377C124.868 79.5673 126.47 77.0751 128.199 74.7098C130.03 72.2174 132.014 69.903 134.151 67.7666C136.262 72.37 138.245 76.9736 140.051 81.577C140.839 83.5099 141.577 85.4426 142.315 87.4009C142.493 87.8587 142.645 88.3165 142.823 88.7743C143.535 90.7326 144.222 92.691 144.883 94.6493C147.91 103.602 150.377 112.554 152.284 121.532L142.391 115.81ZM171.868 132.824C170.444 125.245 168.638 117.59 166.501 109.859C165.23 105.357 163.882 100.83 162.356 96.2771C161.313 93.0216 160.169 89.7662 158.973 86.4853C163.221 90.5546 167.29 94.8782 171.13 99.5071C175.174 104.365 179.015 109.553 182.601 115.047C184.635 118.15 186.568 121.329 188.399 124.559C192.901 132.417 196.767 140.607 200.048 149.102L171.868 132.824Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M109.302 223.29C100.553 214.948 92.6687 205.411 85.6746 194.703C78.6805 183.996 72.8563 172.653 68.2529 160.674L96.4076 176.926C97.8573 184.53 99.6373 192.185 101.799 199.891C103.936 207.623 106.453 215.431 109.302 223.29Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M152.285 121.533L142.392 115.81L115.992 100.576L142.315 87.4014C142.493 87.8592 142.646 88.3172 142.824 88.775C143.536 90.7334 144.223 92.6914 144.884 94.6498C147.911 103.602 150.378 112.555 152.285 121.533Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M142.315 87.4009L115.992 100.575C117.9 93.8101 120.367 87.7061 123.393 82.238C124.868 79.5675 126.471 77.0751 128.2 74.7098C130.031 72.2174 132.015 69.903 134.151 67.7666C136.262 72.37 138.246 76.9736 140.052 81.577C140.84 83.5099 141.578 85.4426 142.315 87.4009Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M200.048 149.102L171.868 132.825L188.4 124.56C192.901 132.418 196.767 140.608 200.048 149.102Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M188.399 124.559L171.867 132.824C170.443 125.245 168.637 117.59 166.501 109.858C165.229 105.357 163.881 100.83 162.355 96.2771C161.312 93.0217 160.168 89.7662 158.973 86.4854C163.22 90.5546 167.289 94.8783 171.13 99.5071C175.174 104.365 179.014 109.553 182.6 115.047C184.635 118.15 186.568 121.329 188.399 124.559Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M184.229 214.845L172.352 220.771V222.908L166.095 226.036L134.151 242.008C130.006 233.03 126.42 224.077 123.393 215.125C120.367 206.147 117.9 197.195 115.992 188.242L143.358 204.062L143.689 204.24L158.923 196.635L159.61 196.279L164.035 194.067L175.684 200.781L177.871 199.687C179.804 204.723 181.94 209.784 184.229 214.845Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M209.483 183.868L177.87 199.688L175.683 200.781C175.937 199.052 176.14 197.323 176.318 195.568C176.496 193.889 176.649 192.185 176.751 190.456C176.827 189.515 176.878 188.574 176.903 187.632C177.056 185.013 177.107 182.368 177.107 179.697C177.107 176.035 177.005 172.322 176.751 168.532C176.7 167.642 176.649 166.777 176.547 165.887C176.344 162.937 176.064 159.961 175.683 156.96L184.381 161.971L194.554 167.846L208.161 175.704C208.695 178.476 209.153 181.198 209.483 183.868Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M164.034 194.067L159.609 196.28L158.922 196.636L143.688 204.24V182.317L145.341 181.503L153.505 177.408L157.879 175.221C157.828 176.62 157.752 178.019 
504157.65 179.417C157.472 182.342 157.192 185.216 156.786 188.065C156.735 188.624 156.658 189.209 156.582 189.768L157.523 190.328L164.034 194.067Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M158.006 168.659C158.006 170.872 157.981 173.059 157.879 175.221L153.504 177.408L145.34 181.503L143.687 182.317L116.779 166.777L111.692 163.852L114.388 162.504L128.402 155.51L142.237 148.592L152.385 143.506L156.582 145.922C157.065 149.839 157.421 153.705 157.65 157.494C157.904 161.284 158.006 165.022 158.006 168.659Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M152.387 143.506L142.239 148.593L128.403 155.51L114.39 162.504L111.694 163.852C111.363 161.157 111.083 158.486 110.905 155.841C110.778 154.645 110.702 153.45 110.626 152.255C110.397 148.465 110.27 144.752 110.27 141.09C110.27 137.427 110.397 133.867 110.626 130.331C110.854 126.822 111.211 123.388 111.694 120.006L152.387 143.506Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M100.706 56.7788L90.1254 62.0689L68.2529 73.0049C72.8563 66.3414 78.6805 61.7126 85.6746 59.093C87.3023 58.4826 88.9557 57.9996 90.6851 57.6181C93.8643 56.9314 97.1958 56.6517 100.706 56.7788Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M109.302 57.7964C106.453 62.3489 103.936 67.2575 101.799 72.4967C99.6373 77.7359 97.8573 83.3312 96.4076 89.2571L89.9728 85.5438L68.2529 73.0053L90.1254 62.0694L100.706 56.7793C103.478 56.8556 106.352 57.186 109.302 57.7964Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M92.5932 152.814L60.1406 134.07L91.6013 118.353L91.525 119.319C91.2961 122.829 91.169 126.415 91.169 130.077C91.169 133.74 91.2961 137.453 91.525 141.242C91.7539 145.032 92.11 148.872 92.5932 152.814Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M92.5924 108.968C92.16 112.02 91.8294 115.148 91.6005 118.327L60.1398 134.07C59.3259 129.95 58.7409 125.957 58.334 122.066C57.9271 118.2 57.749 114.411 57.749 110.774C57.749 107.137 57.9271 103.576 58.334 100.168C58.7409 96.7345 59.3259 93.4282 60.1398 90.2236L92.5924 108.968Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M172.351 222.907V241.575L153.251 251.113C150.071 249.637 146.867 248.213 143.688 246.84C140.509 245.441 137.33 243.839 134.15 242.007L166.094 226.036L172.351 222.907Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M283.848 284.61L270.471 292.494L219.604 317.927L232.982 310.043L269.937 291.579L283.848 284.61Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M277.159 226.494V248.417L266.07 253.962L252.184 260.904L242.316 265.838L240.052 266.982L226.293 273.849V251.927L242.316 243.916L256.228 236.973L256.813 236.667L277.159 226.494Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M232.982 310.04L219.604 317.925L202.411 288.244L191.45 269.322V293.712L172.35 282.7V220.771L174.333 221.916L191.653 231.911L204.116 239.108L223.216 250.146L226.293 251.927V273.849L204.802 261.438L216.298 281.275L232.982 310.04Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M283.85 284.607L269.938 291.576L232.984 310.04L216.299 281.275L204.804 261.438L226.295 273.849L240.054 266.982L242.317 265.837L252.186 260.903L266.072 253.961L283.85 284.607Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M202.414 288.244L191.452 293.712V269.322L202.414 288.244Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M172.35 241.576V264.034L153.25 273.572V251.114L172.35 241.576Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M277.161 226.494L256.815 236.667L256.23 236.972L242.318 243.916L226.295 251.927L223.218 250.147L204.117 239.109L191.655 231.911L174.335 221.916L172.352 220.772L184.229 214.845L210.501 201.697C210.45 204.393 210.247 207.012 209.942 209.606C209.56 213.04 208.95 216.346 208.161 219.525L223.218 228.223L227.745 230.843L258.264 215.583L277.161 226.494Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M280.518 184.581C280.518 188.243 280.366 191.804 280.035 195.263C279.705 198.747 279.247 202.104 278.611 205.411L227.745 230.844C228.381 227.537 228.838 224.18 229.169 220.696C229.5 217.237 229.652 213.676 229.652 210.014C229.652 206.352 229.5 202.562 229.194 198.798C228.61 191.27 227.389 183.615 225.608 175.832C225.532 175.425 225.43 175.044 225.329 174.662C224.413 170.771 223.345 166.88 222.124 162.937C218.462 151.086 213.833 139.59 208.263 128.501C206.406 124.813 204.448 121.151 202.388 117.565H202.363C202.159 117.158 201.93 116.776 201.701 116.369C194.224 103.475 185.602 91.4448 175.836 80.3306C174.361 78.6774 172.886 77.05 171.385 75.4222C170.215 74.176 169.045 72.955 167.875 71.7596C161.975 65.7574 155.871 60.3656 149.589 55.5842C144.579 51.7692 139.441 48.336 134.151 45.2841C131.125 43.5546 128.149 41.9775 125.224 40.5787C115.966 36.2042 107.141 33.534 98.7228 32.6184C98.1124 32.5167 97.502 32.4658 96.8916 32.4149C86.9982 31.6265 78.2238 32.9236 70.543 36.3571L117.442 12.9079C126.038 7.99929 136.135 6.04074 147.758 6.98176C159.381 7.94822 171.792 12.2211 185.017 19.851C198.217 27.4809 210.628 37.527 222.251 49.9892C233.874 62.4514 243.971 76.1089 252.567 90.9364C261.164 105.738 267.98 121.278 272.99 137.504C278.001 153.731 280.518 169.423 280.518 184.581Z",stroke:"var(--sand-12)",strokeWidth:"0.755906",strokeLinecap:"round",strokeLinejoin:"round"})]})}
504function Kdt({session:t}){return c.jsx("div",{className:"flex flex-col w-full flex-1 px-24 pt-10 bg-[url('/grid.svg')] bg-no-repeat bg-center border-[var(--sand-6)] bg-cover items-center",children:c.jsxs("div",{className:"flex flex-col gap-4 max-w-[396px] mx-auto",children:[c.jsxs("div",{className:"flex flex-col gap-4 mx-auto",children:[c.jsx("h1",{className:"text-[var(--sand-12)] text-2xl  font-medium text-center",children:"Your session is live!"}),c.jsx("p",{className:"text-[var(--sand-11)] text-lg text-center max-w-[280px]",children:"You'll be able to view and monitor it from here."})]}),c.jsx("div",{className:"flex justify-center items-center w-full",children:c.jsx(qdt,{})}),c.jsxs("div",{className:"flex flex-col gap-2 justify-center items-center",children:[c.jsx("p",{className:"text-[var(--sand-11)] text-lg text-center max-w-[280px]",children:"Connect via this websocket URL"}),c.jsxs(uve,{variant:"secondary",className:"text-[var(--sand-12)] bg-[var(--sand-3)] py-2 px-3 flex items-center justify-between min-w-[400px] max-w-[700px] hover:bg-[var(--sand-4)] ml-auto",children:[c.jsxs("span",{className:"text-xs text-[var(--sand-11)] font-regular",children:[t==null?void 0:t.websocketUrl.substring(0,50),"..."]}),c.jsx("div",{className:"flex items-center ml-auto hover:cursor-pointer",onClick:()=>Ja((t==null?void 0:t.websocketUrl)||"","Websocket URL"),children:c.jsx(C7,{className:"w-4 h-4"})})]})]})]})})}const Ydt="top 0.45s cubic-bezier(0.22,1,0.36,1), left 0.45s cubic-bezier(0.22,1,0.36,1), width 0.45s cubic-bezier(0.22,1,0.36,1), height 0.45s cubic-bezier(0.22,1,0.36,1)";function Zdt({session:t,isHeadful:e}){var y;const n=w.useRef(null),s=w.useRef(null),[r,i]=w.useState(!1),[a,o]=w.useState(!1),[l,u]=w.useState(!1),[d,f]=w.useState(null),p=((y=t.deviceConfig)==null?void 0:y.device)===rD.MOBILE&&!e?7/16:16/9,m=()=>{const S=window.innerWidth,_=window.innerHeight,E=S*.85,T=_*.9;let k=E,R=k/p;return R>T&&(R=T,k=R*p),{top:(_-R)/2,left:(S-k)/2,width:k,height:R}},v=()=>{var _;const S=(_=n.current)==null?void 0:_.getBoundingClientRect();S&&(s.current&&(clearTimeout(s.current),s.current=null),u(!1),f({top:S.top,left
504:S.left,width:S.width,height:S.height}),o(!0),i(!0),requestAnimationFrame(()=>{u(!0),f(m())}))},x=()=>{var _;const S=(_=n.current)==null?void 0:_.getBoundingClientRect();if(i(!1),!S){o(!1),f(null);return}u(!0),f({top:S.top,left:S.left,width:S.width,height:S.height}),s.current=window.setTimeout(()=>{o(!1),f(null),s.current=null},460)};return w.useEffect(()=>{if(!r)return;const S=E=>{E.key==="Escape"&&x()},_=()=>f(m());return window.addEventListener("keydown",S),window.addEventListener("resize",_),()=>{window.removeEventListener("keydown",S),window.removeEventListener("resize",_)}},[r,p]),w.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),c.jsxs(c.Fragment,{children:[nr.createPortal(c.jsx(xr,{children:r&&c.jsx(wt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},onClick:x,className:"fixed inset-0 z-[95] bg-black/30 dark:bg-black/70 backdrop-blur-sm"},"live-fullscreen-backdrop")}),document.body),c.jsx("div",{ref:n,className:"relative w-full max-h-full",style:{aspectRatio:String(p)},children:c.jsxs("div",{className:"overflow-hidden rounded-[12px] bg-black",style:a&&d?{position:"fixed",zIndex:100,top:d.top,left:d.left,width:d.width,height:d.height,transition:l?Ydt:"none",border:"none"}:{position:"absolute",inset:0,border:"0.5px solid var(--sand-6)"},children:[c.jsx("iframe",{src:t.debugUrl,sandbox:"allow-same-origin allow-scripts",className:"h-full w-full border-0 live-viewer",allow:"clipboard-read; clipboard-write",title:"Live session viewer"}),c.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),r?x():v()},"aria-label":r?"Exit full screen":"Full screen",className:"absolute bottom-3 right-3 z-10 flex size-[32px] cursor-pointer items-center justify-center rounded-full bg-black/50 p-0 text-white backdrop-blur-md transition-colors hover:bg-black/70",children:r?c.jsx(o1e,{size:16,className:"text-white"}):c.jsx(mF,{size:16,className:"text-white"})})]})})]})}function Xdt(t,e,n){const{useRRWebEvents:s}=fr(),r=s(t,{enabled:!n}),i=w.useRef(void 0);if(n)return{...r,fetchNextPage:async()=>{},hasNextPage:!1,isFetchingNextPage:!1,isLoading:!1,isError:!1,initialEvents:[]};const a=r.isError||!r.data||r.data.events.length===0;if(i.current===void 0){let l;if(!a&&r.data&&(l=r.data.events),l&&l.length>0){const u=l[0],d=e&&u?[{type:3,data:{source:2,type:1,id:1,x:0,y:1},timestamp:u.timestamp+e}]:[];i.current=[...l,...d]}}return{...{...r,fetchNextPage:async()=>{},hasNextPage:!1,isFetchingNextPage:!1},initialEvents:i.current??[]}}function _ne({id:t}){var R;const{useSession:e,useOrgDetails:n}=fr(),{data:s,isLoading:r,isError:i}=e(t),a=typeof(s==null?void 0:s.headless)=="boolean"&&!s.headless,{initialEvents:o,fetchNextPage:l,hasNextPage:u,isLoading:d,isError:f,isFetchingNextPage:p}=Xdt(t,s==null?void 0:s.duration,a),v=((R=n().data)==null?void 0:R.plan)??"hobby",x=w.useRef(null),y=w.useRef(null),S=w.useRef({fetchNextPage:l,hasNextPage:u,isFetchingNextPage:p});w.useEffect(()=>(S.current={fetchNextPage:l,hasNextPage:u,isFetchingNextPage:p},()=>{S.current=void 0}));const _=w.useMemo(()=>o.length>1,[o]),E=w.useCallback(async()=>{var j,F;if(!S.current)return;const{fetchNextPage:I,hasNextPage:A,isFetchingNextPage:L}=S.current;if(A&&!L){const O=await I();return S.current.isFetchingNextPage=!1,(F=(j=O.data)==null?void 0:j.pages.at(-1))==null?void 0:F.data}},[]);w.useEffect(()=>(_&&y.current&&x.current&&x.current.init(y.current),()=>{var I;(I=x.current)==null||I.destroy()}),[_]),xst(y,()=>{y.current&&$it(y.current.clientWidth,y.current.clientHeight)});const T=(s==null?void 0:s.status)==="live";if(r||d&&!o.length)return c.jsx("div",{className:"flex flex-col items-center justify-center flex-1 w-full border-t-[0.5px] border-[var(--sand-6)]",children:c.jsx(Mh,{className:"w-16 h-16 text-[var(--3)]"})});if(i||f&&!a)return c.jsx("div",{className:"flex flex-col w-full flex-1 border-t-[0.5px] border-[var(--sand-6)]",children:c.jsx("h1",{className:"text-[var(--tomato-5)]",children:"Error loading session"})});const k=a1e(v,(s==null?void 0:s.createdAt)??new Date);return c.jsxs("div",{className:"flex flex-col w-full max-w-[1200px] mx-auto min-h-full flex-1 gap-6",children:[c.jsxs("div",{ref:y,className:`ph-no-capture flex flex-col w-full overflow-hidden min-h-0 ${T||!T&&!a?"flex-1":""}`,children:[T&&!(s!=null&&s.debugUrl)&&c.jsx(Kdt,{session:s}),T&&(s==null?void 0:s.debugUrl)&&c.jsx(Zdt,{session:s,isHeadful:a}
504),!T&&a&&c.jsx(Wdt,{id:t}),!T&&!a&&_&&c.jsx(i1e,{ref:x,events:o,onBufferEnd:E,approximateTotalTime:s==null?void 0:s.duration}),!T&&!a&&!d&&!_&&c.jsx(zit,{expired:k})]}),c.jsx(vst,{id:t})]})}function Qdt(){return N4("session-tags")??!1}function Jdt(){var x,y;const{id:t}=M5(),e=Z1(),{useSession:n,useSessionTags:s}=fr(),{data:r,isLoading:i,isError:a,error:o}=n(t),l=Qdt(),{data:u}=s(t,{enabled:l}),[d,f]=w.useState(!0),p=L4(),m=r==null?void 0:r.id,v=w.useEffectEvent(()=>{e.capture("session-viewed",{session_id:t,session_status:r==null?void 0:r.status})});return w.useEffect(()=>{m&&v()},[m]),i?c.jsx("div",{className:"flex flex-col items-center justify-center flex-1 w-full",children:c.jsx(Mh,{className:"w-16 h-16 text-[var(--sand-6)]"})}):a||!r||!t?c.jsx(ost,{error:o||void 0,sessionId:t,errorCode:(o==null?void 0:o.status)||500}):p?c.jsx("div",{className:"flex flex-col overflow-hidden h-full w-full",children:c.jsxs("div",{className:"flex flex-col overflow-hidden h-full w-full gap-3 bg-[var(--sand-1)]",children:[l&&c.jsx(lJ,{tags:u??[]}),c.jsx("div",{className:"flex items-center overflow-hidden justify-center h-full w-full gap-3 relative",children:c.jsx("div",{className:`flex min-h-0 w-full flex-col items-center justify-start h-full flex-1 relative gap-3 overflow-y-auto p-6 ${r.headless===!0&&((x=r==null?void 0:r.deviceConfig)==null?void 0:x.device)===rD.MOBILE?"max-w-[420px]":""}`,children:c.jsx(u6,{sessionId:t,context:"viewer",children:c.jsx(_ne,{id:t})})})})]})}):c.jsx($0e,{children:c.jsx("div",{className:"flex flex-col overflow-hidden h-full w-full",children:c.jsxs("div",{className:"flex flex-col overflow-hidden h-full w-full gap-3 bg-[var(--sand-1)]",children:[l&&c.jsx(lJ,{tags:u??[]}),c.jsxs("div",{className:"flex items-center overflow-hidden justify-center h-full w-full gap-3 relative",children:[c.jsx(Zt,{variant:"secondary",onClick:()=>f(!d),className:"text-primary bg-[var(--sand-3)] rounded-lg absolute top-2 right-2 z-20 md:hidden",children:d?c.jsx(ode,{className:"w-4 h-4"}):c.jsx(uFe,{className:"w-4 h-4"})}),d&&c.jsx("div",{className:"flex flex-col items-center overflow-hidden w-full md:w-[400px] md:shrink-0 justify-center h-full text-[var(--sand-12)] gap-2",children:c.jsx("div",{className:"flex flex-col items-center overflow-hidden justify-center w-full h-full border-r-[0.5px] border-b-[0.5px] border-[var(--sand-6)]",children:c.jsx(u6,{sessionId:t,context:"console",children:r&&c.jsx(cve,{id:t,sessionStatus:r.status})})})}),c.jsx("div",{className:`flex min-h-0 flex-col items-center justify-start h-full flex-1 relative gap-3 overflow-y-auto p-6 ${d?"hidden md:flex md:w-2/3":"w-full"} ${r.headless===!0&&((y=r==null?void 0:r.deviceConfig)==null?void 0:y.device)===rD.MOBILE?"max-w-[420px]":""}`,children:c.jsx(u6,{sessionId:t,context:"viewer",children:c.jsx(_ne,{id:t})})})]})]})})})}function pv({checked:t,onCheckedChange:e,disabled:n=!1,"aria-label":s}){const r=Hh()??!1,i=S$e(),a=w.useRef(!0);return w.useEffect(()=>{const o=t?21:3;if(a.current){a.current=!1;return}i.start({x:o,transition:r?{duration:.15}:{type:"spring",bounce:.3,duration:.5}})},[t,r,i]),c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":s,disabled:n,onClick:()=>e(!t),className:`relative inline-flex h-[22px] w-[40px] shrink-0 items-center rounded-full transition-colors duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer disabled:cursor-not-allowed disabled:opacity-60 ${t?"bg-[#34d399]":"bg-[var(--sand-7)] dark:bg-[#343434]"}`,children:c.jsx(wt.span,{initial:{x:t?21:3},animate:i,className:"inline-block size-[16px] rounded-full bg-white shadow-[0_1px_2px_rgba(0,0,0,0.25)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.4)]"})})}const Ene="none";function eft(t){const e=[t.city,t.state,t.country].filter(Boolean).join(", "),n=t.ipAddress??t.identifier;return e?`${n} (${e})`:n}const tft=({form:t})=>{var o;const{orgId:e,isLoaded:n}=zt(),s=rs({queryKey:["session-create-proxy-ips",e??"no-org"],queryFn:async()=>{const l=await Gme({});if(l.error)throw l.error;if(!l.data)throw new Error("No dedicated IP lease data returned from API");return l.data},enabled:n&&!!e,staleTime:3e4}),r=((o=s.data)==null?void 0:o.proxyIps.filter(l=>l.status==="active"&&l.identifier))??[],i=!n||s.isLoading,a=i?"Loa
504ding Dedicated IPs...":r.length===0?"No active Dedicated IPs":"No Dedicated IP";return c.jsxs("div",{className:"space-y-5",children:[c.jsx(Oc,{control:t.control,name:"userAgent",render:({field:l})=>c.jsxs(Hl,{className:"space-y-[8px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Custom user agent (optional)"}),c.jsx(Wl,{children:c.jsx(Ah,{className:"h-[44px] w-full rounded-[8px] border-0 bg-[var(--sand-3)] px-[12px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-visible:ring-0 focus:bg-[var(--sand-4)]",placeholder:"e.g., Mozilla/5.0...",...l})}),c.jsx(O0,{className:"text-[12px] leading-[20px] text-[var(--sand-10)]",children:"Specify a custom User-Agent string."}),c.jsx(Tm,{})]})}),c.jsx(Oc,{control:t.control,name:"useProxy",render:({field:l})=>c.jsxs(Hl,{className:"flex flex-row items-center justify-between gap-[16px] space-y-0 rounded-[12px] bg-[var(--sand-3)] p-[16px]",children:[c.jsxs("div",{className:"flex min-w-px flex-col gap-[4px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Use Steel proxy"}),c.jsx(O0,{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Route session traffic through Steel-managed proxy egress."})]}),c.jsx(Wl,{children:c.jsx(pv,{checked:!!l.value,onCheckedChange:u=>{l.onChange(u),u&&t.setValue("dedicatedIpIdentifier",void 0)},"aria-label":"Use Steel proxy"})})]})}),c.jsx(Oc,{control:t.control,name:"dedicatedIpIdentifier",render:({field:l})=>c.jsxs(Hl,{className:"space-y-[8px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Dedicated IP"}),c.jsxs(PS,{value:l.value,onValueChange:u=>{if(u===Ene){l.onChange(void 0);return}l.onChange(u),t.setValue("useProxy",!1),t.setValue("proxyUrl",void 0)},disabled:i||r.length===0,children:[c.jsx(Wl,{children:c.jsx(DS,{className:"h-[44px] w-full rounded-[8px] border-0 bg-[var(--sand-3)] px-[12px] text-[14px] font-medium text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-[var(--sand-4)]",children:c.jsx(MS,{placeholder:a})})}),c.jsxs(W1,{className:"rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[4px] text-[var(--sand-12)] shadow-menu",children:[c.jsx(hd,{value:Ene,className:"rounded-[6px] text-[14px] text-[var(--sand-11)] focus:bg-[var(--sand-4)] focus:text-[var(--sand-12)] data-[highlighted]:bg-[var(--sand-4)] data-[highlighted]:text-[var(--sand-12)]",children:"No Dedicated IP"}),r.map(u=>c.jsx(hd,{value:u.identifier,className:"rounded-[6px] text-[14px] text-[var(--sand-11)] focus:bg-[var(--sand-4)] focus:text-[var(--sand-12)] data-[highlighted]:bg-[var(--sand-4)] data-[highlighted]:text-[var(--sand-12)]",children:eft(u)},u.identifier))]})]}),c.jsx(O0,{className:"text-[12px] leading-[20px] text-[var(--sand-10)]",children:"Select a leased Dedicated IP to route this session through a fixed Steel-managed egress IP."}),s.isError&&c.jsx("p",{className:"text-[12px] text-danger",children:"Could not load Dedicated IP leases."}),c.jsx(Tm,{})]})}),c.jsx(Oc,{control:t.control,name:"proxyUrl",render:({field:l})=>c.jsxs(Hl,{className:"space-y-[8px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Custom proxy URL"}),c.jsx(Wl,{children:c.jsx(Ah,{className:"h-[44px] w-full rounded-[8px] border-0 bg-[var(--sand-3)] px-[12px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-visible:ring-0 focus:bg-[var(--sand-4)]",placeholder:"e.g., https://user:pass@host:port",...l,onChange:u=>{l.onChange(u),u.target.value&&(t.setValue("dedicatedIpIdentifier",void 0),t.setValue("useProxy",!1))}})}),c.jsx(O0,{className:"text-[12px] leading-[20px] text-[var(--sand-10)]",children:"The full URL of your own proxy server."}),c.jsx(Tm,{})]})}),c.jsxs("div",{className:"flex flex-col gap-[16px] rounded-[12px] bg-[var(--sand-3)] p-[16px]",children:[c.jsx("p",{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Other session options"}
504),c.jsx(Oc,{control:t.control,name:"solveCaptcha",render:({field:l})=>c.jsxs(Hl,{className:"flex flex-row items-center justify-between gap-[16px] space-y-0",children:[c.jsx(Gl,{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Enable automatic captcha solving"}),c.jsx(Wl,{children:c.jsx(pv,{checked:!!l.value,onCheckedChange:l.onChange,"aria-label":"Enable automatic captcha solving"})})]})}),c.jsx(Oc,{control:t.control,name:"isSelenium",render:({field:l})=>c.jsxs(Hl,{className:"flex flex-row items-center justify-between gap-[16px] space-y-0",children:[c.jsx(Gl,{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Enable Selenium mode"}),c.jsx(Wl,{children:c.jsx(pv,{checked:!!l.value,onCheckedChange:l.onChange,"aria-label":"Enable Selenium mode"})})]})})]})]})};function M2({color:t="#0091FF",height:e=20,width:n=21}){return c.jsxs("svg",{width:n,height:e,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("mask",{id:"mask0_598_49447",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"21",height:"20",children:c.jsx("path",{d:"M20.3334 0H0.333374V20H20.3334V0Z",fill:"white"})}),c.jsx("g",{mask:"url(#mask0_598_49447)",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.333374 0H5.33337V5H0.333374V0ZM10.3334 5H5.33337V10H0.333374V15H5.33337V20H10.3334V15H15.3334V20H20.3334V15H15.3334V10H20.3334V5H15.3334V0H10.3334V5ZM10.3334 10H15.3334V5H10.3334V10ZM10.3334 10V15H5.33337V10H10.3334Z",fill:t})})]})}function Bm({color:t="#30A46C",height:e=20,width:n=18}){return c.jsx("svg",{width:n,height:e,viewBox:"0 0 18 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0283 4.70671C12.203 4.29611 12.3 3.84302 12.3 3.36683C12.3 1.50738 10.8225 0 8.99995 0C7.17744 0 5.69998 1.50738 5.69998 3.36683C5.69998 3.84302 5.79687 4.29611 5.97165 4.70671C5.37183 3.86431 4.3986 3.31658 3.29999 3.31658C1.47745 3.31658 0 4.82397 0 6.68342C0 8.34412 1.1785 9.724 2.7288 10C1.1785 10.276 0 11.6559 0 13.3166C0 15.176 1.47745 16.6834 3.29999 16.6834C4.3986 16.6834 5.37183 16.1357 5.97165 15.2933C5.79687 15.7039 5.69998 16.157 5.69998 16.6332C5.69998 18.4926 7.17744 20 8.99995 20C10.8225 20 12.3 18.4926 12.3 16.6332C12.3 16.157 12.203 15.7039 12.0283 15.2933C12.6281 16.1357 13.6013 16.6834 14.7 16.6834C16.5225 16.6834 18 15.176 18 13.3166C18 11.6559 16.8214 10.276 15.2711 10C16.8214 9.724 18 8.34412 18 6.68342C18 4.82397 16.5225 3.31658 14.7 3.31658C13.6013 3.31658 12.6281 3.86431 12.0283 4.70671ZM11.6716 14.6565C11.4969 14.2459 11.4 13.7928 11.4 13.3166C11.4 11.6559 12.5785 10.276 14.1288 10C12.5785 9.724 11.4 8.34412 11.4 6.68342C11.4 6.20723 11.4969 5.75414 11.6716 5.34354C11.0718 6.18594 10.0986 6.73367 8.99995 6.73367C7.90136 6.73367 6.92814 6.18594 6.32832 5.34354C6.50309 5.75414 6.59999 6.20723 6.59999 6.68342C6.59999 8.34412 5.42148 9.724 3.87119 10C5.42148 10.276 6.59999 11.6559 6.59999 13.3166C6.59999 13.7928 6.50309 14.2459 6.32832 14.6565C6.92814 13.8141 7.90136 13.2663 8.99995 13.2663C10.0986 13.2663 11.0718 13.8141 11.6716 14.6565Z",fill:t})})}function D2({color:t="#F5D90A",height:e=20,width:n=21}){return c.jsxs("svg",{width:n,height:e,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("mask",{id:"mask0_598_49458",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"21",height:"20",children:c.jsx("path",{d:"M20.6666 0H0.666626V20H20.6666V0Z",fill:"white"})}),c.jsx("g",{mask:"url(#mask0_598_49458)",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.6666 10.0671L10.6666 0L0.666626 10.0671H10.5333L0.666626 20H20.6666L10.7999 10.0671H20.6666Z",fill:t})})]})}const C5={hobby:{name:"Hobby",price:0,credits:10,icon:M2,features:[{amount:290,label:"Browser Hours"},{amount:2.9,label:"GB Proxy Bandwidth"},{amount:100,label:"Captcha Solves"},{amount:1,label:"Basic support"}],accentColor:"var(--sand-12)",accentTextColor:"var(--sand-12)",buttonTextColor:"white"},starter:{name:"Starter",price:29,credits:29,icon:Bm,features:[{amount:290,label:"Browser Hours"},{amount:2.9,label:"GB Proxy Bandwidth"},{amount:7200,label:"Captcha Solves"},{amount:1,label:"Email support"}],accentColor:"var(--green-9)",accentTextColor:"var(--plan-accent-starter)",buttonTextColor:"white"},developer:{name:"Developer",price:99,credits:99,icon:M2,features:[{amount:1238,label:"Browser Hours"},{amount:12,label:"GB Proxy Bandwidth"},{amount:28e3,label:"Captcha Solves"},{amount:1,label:"Priority support"}],accentColor:"var(--blue-9)",accentTextColor:"var(--plan-accent-developer)",buttonTextColor:"white"},pro:{name:"Startups",price:499,credits:499,icon:D2,features:[{amount:9980,label:"Browser Hours"},{amount:166,label:"GB Proxy Bandwidth"},{amount:166e3,label:"Captcha Solves"},{amount:1,label:"Priority support"},{amount:1,label:"Dedicated Slack Channel"}],accentColor:"var(--yellow-9)",accentTextColor:"var(--plan-accent-pro)",buttonTextColor:"black"},enterprise:{name:"Enterprise",price:3e5,credits:3e5,icon:D2,features:[{amount:1e6,label:"Browser Hours"}],accentColor:"var(--gold-9)",accentTextColor:"var(--plan-accent-enterprise)",buttonTextColor:"black"}};function nft(t){if(!t||Object.keys(t).length===0)return C5;const e={};for(const[n,s]of Object.entries(C5)){const r=t[n];e[n]={...s,...(r==null?void 0:r.price)!==void 0?{price:r.price}:{},...(r==null?void 0:r.credits)!==void 0?{credits:r.credits}:{}}}return e}const ei={invoices:"/settings/billing/invoices",wallet:"/settings/billing/wallet",usage:"/settings/billing/usage",usageProxy:"/settings/billing/usage/proxy",limits:"/settings/billing/limits",plans:"/settings/billing/plans"},pye="https://docs.steel.dev/overview/pricinglimits";function sft(t){return t==="captcha"||t==="steel_proxy"}const i8=["hobby","starter","developer","pro","enterprise"];function rft(t){return t==="enterprise"?null:t==="hobby"?"launch":t}function ift(t,e){const n=i8.indexOf(t);return n===-1?"starter":n>=i8.length-1?"enterprise":i8[n+1]}function aft(t){switch(t){case"concurrency":return{title:"Concurrent session limit reached",description:"You've hit the maximum number of concurrent sessions for your current plan. Upgrade to run more sessions in parallel."};case"captcha":return{title:"Captcha solving requires a deposit",description:"Launch requires a $10 deposit to use CAPTCHA solving, or you can upgrade to Scale."};case"steel_proxy":return{title:"Steel proxies require a deposit",description:"Launch requires a $10 deposit to use Steel proxies. You can also bring your own proxy or upgrade to Scale."};case"session_timeout":return{title:"Session timeout exceeds your plan limit",description:"The timeout you selected is longer than your plan allows. Upgrade to run sessions for longer."};default:return{title:"Upgrade required",description:"This feature requires a higher plan."}}}function oft({reason:t,currentPlan:e,onClose:n}){const{createCheckoutSession:s}=fr(),[r,i]=w.useState(!1),a=t!==null;if(sft(t))return c.jsx(lft,{reason:t,currentPlan:e,open:a,onClose:n});const o=ift(e),l=C5[o],{title:u,description:d}=aft(t),f=o==="enterprise";async function p(){if(f){window.open("https://cal.com/hussien-hussien-fjxt3x/intro-chat-w-steel-founders","_blank");return}const m=rft(o);if(m){i(!0);try{const v=await s({plan:m});if(v.url){window.location.href=v.url;return}}catch{}finally{i(!1)}}}return c.jsx(Um,{open:a,onOpenChange:m=>{m||(i(!1),n())},children:c.jsxs($h,{className:"max-w-md bg-[var(--sand-1)] border-[var(--sand-6)] text-[var(--sand-12)]",children:[c.jsxs(Fh,{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-[var(--indigo-a3)] border border-[var(--indigo-a6)]",children:c.jsx(Dde,{className:"w-4 h-4 text-[var(--indigo-11)]"})}),c.jsx(Ld,{className:"text-[var(--sand-12)] text-base",children:u})]}),c.jsx(jd,{className:"text-[var(--sand-11)] text-sm leading-relaxed",children:d})]}),f?c.jsxs("div",{className:"rounded-md border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-a2)] p-4 flex flex-col gap-2",children:[c.jsx("p",{className:"text-sm text-[var(--sand-12)] font-medium",children:"Talk to our team"}),c.jsx("p",{className:"text-xs text-[var(--sand-11)] leading-relaxed",children:"Enterprise plans offer more customization and even further cost efficiency with an annual commitment. Reach out to us for more details ([email protected])"})]}):l&&c.jsxs("div",{className:"rounded-md border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-a2)] p-4 flex flex-col gap-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(l.icon,{color:l.accentTextColor}),c.jsx("span",{className:"text-sm font-medium",style:{color:l.accentTextColor},children:l.name})]}),c.jsxs("span",{className:"text-xs text-[var(--sand-11)]",children:[c.jsxs("span",{className:"text-[var(--sand-12)] text-base font-medium",children:["$",l.price]}),"/mo"]})]}),c.jsx("ul",{className:"flex flex-col gap-1",children:l.features.slice(0,3).map((m,v)=>c.jsxs("li",{className:"text-xs text-[var(--sand-11)] flex items-center gap-1.5",children:[c.jsx("span",{className:"text-[var(--green-11)]",children:"✓"}),m.amount>1?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:m.amount>1e3?`${Math.round(m.amount/1e3*100)/100}k`:m.amount})," ",m.label]}):m.label]},v))})]}),!f&&c.jsxs("a",{href:pye,target:"_blank",rel:"noreferrer",className:"text-xs text-[var(--indigo-11)] hover:text-[var(--indigo-12)] inline-flex items-center gap-1 self-start",children:["See pricing & limits",c.jsx(Pde,{className:"w-3 h-3"})]}),c.jsxs(X1,{className:"gap-2 sm:gap-2",children:[c.jsx(Zt,{type:"button",variant:"outline",onClick:n,disabled:r,className:"text-[var(--sand-12)] border-[var(--sand-6)] hover:bg-[var(--sand-3)]",children:"Not now"}),c.jsx(Zt,{type:"button",onClick:p,disabled:r,className:"bg-[var(--indigo-9)] text-white dark:text-[var(--sand-12)] hover:bg-[var(--indigo-10)] gap-2",children:r?"Redirecting…":f?c.jsxs(c.Fragment,{children:["Contact sales",c.jsx(YP,{className:"w-4 h-4"})]}):c.jsxs(c.Fragment,{children:["Upgrade to ",(l==null?void 0:l.name)??"next plan",c.jsx(YP,{className:"w-4 h-4"})]})})]})]})})}function lft({reason:t,currentPlan:e,open:n,onClose:s}){const r=di(),i=(e==null?void 0:e.trim().toLowerCase())==="launch",a=t==="captcha"?"CAPTCHA solving":"Steel proxies",o=i?"A $10 deposit is required":t==="captcha"?"Captcha solving requires a deposit":"Steel proxies require a deposit",l=i?`Add a refundable $10 deposit to unlock ${a}. You can also bring your own proxy via 'proxyUrl' or upgrade to Scale.`:`Switch to Launch and add a refundable $10 deposit to use ${a}. You can also bring your own proxy via 'proxyUrl' or upgrade to Scale.`,u=d=>{s(),r(d)};return c.jsx(Um,{open:n,onOpenChange:d=>{d||s()},children:c.jsxs($h,{className:"max-w-md bg-[var(--sand-1)] border-[var(--sand-6)] text-[var(--sand-12)]",children:[c.jsxs(Fh,{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-[var(--indigo-a3)] border border-[var(--indigo-a6)]",children:c.jsx(Dde,{className:"w-4 h-4 text-[var(--indigo-11)]"})}),c.jsx(Ld,{className:"text-[var(--sand-12)] text-base",children:o})]}),c.jsx(jd,{className:"text-[var(--sand-11)] text-sm leading-relaxed",children:l})]}),i?c.jsxs("div",{className:"rounded-md border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-a2)] p-4 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Bm,{color:"var(--plan-launch)",width:20,height:22}),c.jsx("span",{className:"text-sm font-medium text-[var(--sand-12)] dark:text-[#fffad1]",children:"Launch"})]}),c.jsxs("span",{className:"text-xs text-[var(--sand-11)]",children:[c.jsx("span",{className:"text-[var(--sand-12)] text-base font-medium",children:"$10"})," refundable deposit"]})]}):c.jsxs("div",{className:"rounded-md border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-a2)] p-4 flex flex-col gap-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Bm,{color:"var(--plan-launch)",width:20,height:22}),c.jsx("span",{className:"text-sm font-medium text-[var(--sand-12)] dark:text-[#fffad1]",children:"Launch"})]}),c.jsxs("span",{className:"text-xs text-[var(--sand-11)]",children:[c.jsx("span",{className:"text-[var(--sand-12)] text-base font-medium",children:"$0"})," + usage"]})]}),c.jsx("p",{className:"text-xs text-[var(--sand-11)] leading-relaxed",children:"Add a refundable $10 deposit to unlock CAPTCHA solving & Steel proxies."})]}),c.jsxs("a",{href:pye,target:"_blank",rel:"noreferrer",className:"text-xs text-[var(--indigo-11)] hover:text-[var(--indigo-12)] inline-flex items-center gap-1 self-start",children:["See pricing & limits",c.jsx(Pde,{className:"w-3 h-3"})]}),c.jsxs(X1,{className:"gap-2 sm:gap-2",children:[c.jsx(Zt,{type:"button",variant:"outline",onClick:s,className:"text-[var(--sand-12)] border-[var(--sand-6)] hover:bg-[var(--sand-3)]",children:"Not now"}),c.jsxs(Zt,{type:"button",onClick:()=>u(i?ei.wallet:ei.plans),className:"bg-[var(--indigo-9)] text-white dark:text-[var(--sand-12)] hover:bg-[var(--indigo-10)] gap-2",children:[i?"Add $10 deposit":"Switch to Launch",c.jsx(YP,{className:"w-4 h-4"})]})]})]})})}const cft=jD({sessionId:D0().uuid().optional().describe("Optional custom uuid for session"),userAgent:D0().optional().describe("Custom user agent string for the browser session"),useProxy:fy().optional().default(!1).describe("Flag to enable proxy usage for the browser session"),proxyUrl:D0().url().optional().describe("Custom proxy url to use for the browser session"),dedicatedIpIdentifier:D0().optional().describe("Dedicated IP identifier to use for the browser session"),solve
504Captcha:fy().optional().default(!1).describe("Flag to enable automatic captcha solving"),sessionContext:jD({cookies:ZQ(XQ(YQ())).optional(),localStorage:ZQ(XQ(YQ())).optional()}).optional().describe("Custom session context data to be used in the created session"),timeout:KQ().int().positive().default(3e5).describe("How long after starting should the session timeout (in milliseconds)"),concurrency:KQ().int().optional().describe("Number of sessions to create concurrently (max: 50)"),isSelenium:fy().optional().default(!1).describe("Flag to enable selenium mode for the browser session (default: false)"),useStealthBrowser:fy().optional().default(!1).describe("Use Steel's stealth browser instead of Chrome. May delay initial session creation."),headless:fy().optional().default(!0).describe("Flag to enable or disable headless browser mode for the session (default: true)")}),uft=({children:t})=>{const[e,n]=w.useState(!1),[s,r]=w.useState(!1),[i,a]=w.useState(null),[o,l]=w.useState(void 0),{useCreateSessionMutation:u,useOrgDetails:d}=fr(),{data:f}=d(),p=(f==null?void 0:f.plan)??"hobby",m=C0e({resolver:k0e(cft),defaultValues:{timeout:3e5,useProxy:!1,solveCaptcha:!1,isSelenium:!1,useStealthBrowser:!1,userAgent:"",proxyUrl:void 0,dedicatedIpIdentifier:void 0,headless:!1}}),{mutate:v,isPending:x,isSuccess:y,error:S}=u();w.useEffect(()=>{if(!S)return;const E=Wge(S);E&&(l(S.message),a(E),n(!1))},[S]),w.useEffect(()=>{y&&(m.reset(),n(!1))},[y,m]);function _({headless:E,useStealthBrowser:T,dedicatedIpIdentifier:k,...R}){try{const I={...R,useProxy:k?{type:"fixed",id:k}:R.useProxy,proxyUrl:k?void 0:R.proxyUrl||void 0,userAgent:R.userAgent||void 0,sessionContext:void 0,timeout:typeof R.timeout=="number"?R.timeout:3e5,headless:typeof E=="boolean"&&E,experimentalFeatures:T?["useStealthBrowser"]:void 0};v(I)}catch(I){console.error("An unexpected error occurred while submitting the form: ",I)}}return c.jsxs(c.Fragment,{children:[c.jsxs(Um,{open:e,onOpenChange:n,children:[c.jsx(hF,{asChild:!0,children:t}),c.jsx($h,{hideClose:!0,className:"flex flex-col w-[620px] max-w-[calc(100vw-32px)] max-h-[85vh] overflow-hidden rounded-[20px] sm:rounded-[20px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-0 text-[var(--sand-12)] shadow-modal",children:c.jsx(L0e,{...m,children:c.jsxs("form",{onSubmit:m.handleSubmit(_),className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs(Fh,{className:"flex flex-col gap-[6px] rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px] text-left",children:[c.jsx(Ld,{className:"text-[16px] font-medium leading-[24px] text-[var(--sand-12)]",children:"Start a new session"}),c.jsx(jd,{className:"text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Configure options and start a new session."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"min-h-0 flex-1 space-y-[20px] overflow-y-auto [scrollbar-gutter:stable] p-[16px]",children:[c.jsx(Oc,{control:m.control,name:"timeout",render:({field:E})=>c.jsxs(Hl,{className:"space-y-[8px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Session timeout (ms)"}),c.jsx(Wl,{children:c.jsx(Ah,{type:"number",className:"h-[44px] w-full rounded-[8px] border-0 bg-[var(--sand-3)] px-[12px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-visible:ring-0 focus:bg-[var(--sand-4)] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"300000",...E,onChange:T=>E.onChange(T.target.value===""?3e5:Number(T.target.value)),value:E.value??3e5})}),c.jsx(O0,{className:"text-[12px] leading-[20px] text-[var(--sand-10)]",children:"Session closes automatically after this time (default: 5 minutes)."}),c.jsx(Tm,{})]})}),c.jsx(Oc,{control:m.control,name:"headless",render:({field:E})=>c.jsxs(Hl,{className:"flex flex-row items-center justify-between gap-[16px] space-y-0 rounded-[12px] bg-[var(--sand-3)] p-[16px]",children:[c.jsx(Gl,{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:"Headless"}),c.jsx(Wl,{children:c.jsx(pv,{checked:!!E.value,onCheckedChange:E.onChange,"aria-label":"Headless"})})]})}),c.jsxs("button",{type:"button",className:"flex items-center gap-[6px] self-start h-[24px] text-[14px] font-medium leading-[20px] text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)] cursor-pointer",onClick:()=>r(!s),children:[c.jsx("span",{children:"Advanced settings"}),s?c.jsx(iBe,{size:16,className:"text-[var(--sand-9)]"}):c.jsx(rBe,{size:16,className:"text-[var(--sand-9)]"})]}),c.jsx(xr,{initial:!1,children:s&&c.jsx(wt.div,{initial:{height:0,opacity:0}
504,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.32,ease:[.4,0,.2,1]},className:"overflow-hidden",children:c.jsx(tft,{form:m})},"advanced")})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs(X1,{className:"flex flex-row justify-between gap-[12px] p-[12px] sm:justify-between sm:space-x-0",children:[c.jsx("button",{type:"button",disabled:x,onClick:()=>{m.reset(),n(!1)},className:"cursor-pointer flex h-[40px] items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)] active:scale-[0.97] disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:bg-[var(--sand-4)] disabled:active:scale-100",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:x,className:"cursor-pointer flex h-[40px] items-center justify-center rounded-[8px] bg-[var(--sand-12)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-1)] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-95 active:scale-[0.97] disabled:opacity-60 disabled:cursor-not-allowed",children:x?"Starting session...":"Start session"})]})]})})})]}),c.jsx(oft,{reason:i,errorMessage:o,currentPlan:p,onClose:()=>{a(null),l(void 0)}})]})},mye=({children:t,sessionId:e})=>{const[n,s]=w.useState(!1),{useReleaseSessionMutation:r,useReleaseAllSessionsMutation:i}=fr(),a=e!==void 0,o=r(),l=i(),u=a?o.isPending:l.isPending,d=a?o.isSuccess:l.isSuccess;w.useEffect(()=>{d&&s(!1)},[d]);const f=()=>{a?o.mutate(e):l.mutate()},p=a?"Release Session":"Release All Sessions",m=a?"This action cannot be undone. This will release your session and delete some of your session data.":"This action cannot be undone. This will release all live sessions and delete some of their associated session data.",v=a?"Release Session":"Release All Sessions",x=a?"Releasing Session...":"Releasing Sessions...";return c.jsxs(Um,{open:n,onOpenChange:s,children:[c.jsx(hF,{asChild:!0,children:t}),c.jsxs($h,{hideClose:!0,className:"w-[620px] max-w-[calc(100vw-32px)] gap-[24px] rounded-[20px] sm:rounded-[20px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[32px] text-[var(--sand-12)] shadow-modal",children:[c.jsxs(Fh,{className:"space-y-[8px] text-left",children:[c.jsx(Ld,{className:"text-[20px] font-medium leading-[24px] text-[var(--sand-12)]",children:p}),c.jsx(jd,{className:"text-[14px] leading-[20px] text-[var(--sand-11)]",children:m})]}),c.jsxs(X1,{className:"flex flex-row gap-[12px] sm:justify-stretch sm:space-x-0",children:[c.jsx("button",{type:"button",disabled:u,onClick:()=>s(!1),className:"flex-1 cursor-pointer flex h-[40px] items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[12px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)] active:scale-[0.97] disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:bg-[var(--sand-4)] disabled:active:scale-100",children:"Cancel"}),c.jsx("button",{type:"button",disabled:u,onClick:f,className:"flex-1 cursor-pointer flex h-[40px] items-center justify-center rounded-[8px] bg-[#ef4444] px-[12px] text-[14px] font-medium leading-[20px] text-white dark:text-[var(--sand-12)] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-95 active:scale-[0.97] disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:active:scale-100",children:u?x:v})]})]})]})};function dft({message:t,onRetry:e}){return c.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:c.jsxs(TS,{className:"w-full max-w-xl",children:[c.jsxs(T4,{className:"text-center space-y-3",children:[c.jsx("div",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-destructive/10",children:c.jsx(k7,{className:"h-7 w-7 text-destructive"})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(k4,{children:"Unable to load sessions"}),c.jsx(R4,{children:"Check your connection and try again."})]})]}),c.jsxs(A4,{className:"space-y-4",children:[t&&c.jsx("code",{className:"block rounded-md bg-muted px-3 py-2 text-sm text-muted-foreground break-all",children:t}),c.jsxs("div",{className:"flex justify-center gap-2",children:[c.jsxs(Zt,{onClick:e,className:"flex items-center gap-2",children:[c.jsx(HP,{className:"h-4 w-4"}),"Try again"]}),c.jsxs(Zt,{variant:"outline",className:"flex items-center gap-2",onClick:()=>window.location.reload(),children:[c.jsx(HP,{className:"h-4 w-4"}),"Reload page"]})]})]})]})})}function gye(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M21.4974 11.0946C16.66 2.96839 7.33998 2.96848 2.50257 11.0947C2.17069 11.6523 2.17069 12.3479 2.50257 12.9054C7.33998 21.0316 16.66 21.0315 21.4974 12.9053C21.8293 12.3477 21.8293 11.6521 21.4974 11.0946Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}var Hy={exports:{}},fft=Hy.exports,Cne;function hft(){return Cne||(Cne=1,(function(t,e){(function(n,s){var r="1.0.41",i="",a="?",o="function",l="undefined",u="object",d="str
504ing",f="major",p="model",m="name",v="type",x="vendor",y="version",S="architecture",_="console",E="mobile",T="tablet",k="smarttv",R="wearable",I="embedded",A=500,L="Amazon",j="Apple",F="ASUS",O="BlackBerry",M="Browser",U="Chrome",G="Edge",$="Firefox",V="Google",B="Honor",q="Huawei",z="Lenovo",D="LG",K="Microsoft",Y="Motorola",J="Nvidia",ne="OnePlus",Q="Opera",ee="OPPO",te="Samsung",ue="Sharp",ye="Sony",je="Xiaomi",Re="Zebra",me="Facebook",Ce="Chromium OS",Xe="Mac OS",he=" Browser",De=function(Tt,Ie){var Z={};for(var ie in Tt)Ie[ie]&&Ie[ie].length%2===0?Z[ie]=Ie[ie].concat(Tt[ie]):Z[ie]=Tt[ie];return Z},Ge=function(Tt){for(var Ie={},Z=0;Z<Tt.length;Z++)Ie[Tt[Z].toUpperCase()]=Tt[Z];return Ie},Je=function(Tt,Ie){return typeof Tt===d?Le(Ie).indexOf(Le(Tt))!==-1:!1},Le=function(Tt){return Tt.toLowerCase()},qe=function(Tt){return typeof Tt===d?Tt.replace(/[^\d\.]/g,i).split(".")[0]:s},et=function(Tt,Ie){if(typeof Tt===d)return Tt=Tt.replace(/^\s\s*/,i),typeof Ie===l?Tt:Tt.substring(0,A)},Ct=function(Tt,Ie){for(var Z=0,ie,le,Ee,ke,Ae,Ye;Z<Ie.length&&!Ae;){var Qe=Ie[Z],ft=Ie[Z+1];for(ie=le=0;ie<Qe.length&&!Ae&&Qe[ie];)if(Ae=Qe[ie++].exec(Tt),Ae)for(Ee=0;Ee<ft.length;Ee++)Ye=Ae[++le],ke=ft[Ee],typeof ke===u&&ke.length>0?ke.length===2?typeof ke[1]==o?this[ke[0]]=ke[1].call(this,Ye):this[ke[0]]=ke[1]:ke.length===3?typeof ke[1]===o&&!(ke[1].exec&&ke[1].test)?this[ke[0]]=Ye?ke[1].call(this,Ye,ke[2]):s:this[ke[0]]=Ye?Ye.replace(ke[1],ke[2]):s:ke.length===4&&(this[ke[0]]=Ye?ke[3].call(this,Ye.replace(ke[1],ke[2])):s):this[ke]=Ye||s;Z+=2}},Ke=function(Tt,Ie){for(var Z in Ie)if(typeof Ie[Z]===u&&Ie[Z].length>0){for(var ie=0;ie<Ie[Z].length;ie++)if(Je(Ie[Z][ie],Tt))return Z===a?s:Z}else if(Je(Ie[Z],Tt))return Z===a?s:Z;return Ie.hasOwnProperty("*")?Ie["*"]:Tt},dt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Xt={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},_n={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[y,[m,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[y,[m,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[m,y],[/opios[\/ ]+([\w\.]+)/i],[y,[m,Q+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[y,[m,Q+" GX"]],[/\bopr\/([\w\.]+)/i],[y,[m,Q]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[y,[m,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[y,[m,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[m,y],[/quark(?:pc)?\/([-\w\.]+)/i],[y,[m,"Quark"]],[/\bddg\/([\w\.]+)/i],[y,[m,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[y,[m,"UC"+M]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[y,[m,"WeChat"]],[/konqueror\/([\w\.]+)/i],[y,[m,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[y,[m,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[y,[m,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[y,[m,"Smart Lenovo "+M]],[/(avast|avg)\/([\w\.]+)/i],[[m,/(.+
vendor: 5,518 bytes, line 504
504)/,"$1 Secure "+M],y],[/\bfocus\/([\w\.]+)/i],[y,[m,$+" Focus"]],[/\bopt\/([\w\.]+)/i],[y,[m,Q+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[y,[m,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[y,[m,"Dolphin"]],[/coast\/([\w\.]+)/i],[y,[m,Q+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[y,[m,"MIUI"+he]],[/fxios\/([\w\.-]+)/i],[y,[m,$]],[/\bqihoobrowser\/?([\w\.]*)/i],[y,[m,"360"]],[/\b(qq)\/([\w\.]+)/i],[[m,/(.+)/,"$1Browser"],y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[m,/(.+)/,"$1"+he],y],[/samsungbrowser\/([\w\.]+)/i],[y,[m,te+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[y,[m,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[m,"Sogou Mobile"],y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[m,y],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[m],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[y,m],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[m,me],y],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[m,y],[/\bgsa\/([\w\.]+) .*safari\//i],[y,[m,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[y,[m,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[y,[m,U+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[m,U+" WebView"],y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[y,[m,"Android "+M]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[m,y],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[y,[m,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[y,m],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[m,[y,Ke,dt]],[/(webkit|khtml)\/([\w\.]+)/i],[m,y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[m,"Netscape"],y],[/(wolvic|librewolf)\/([\w\.]+)/i],[m,y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[y,[m,$+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[m,[y,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[m,[y,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[S,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[S,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[S,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[S,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[S,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[S,/ower/,i,Le]],[/ sun4\w[;\)]/i],[[S,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[S,Le]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[p,[x,te],[v,T]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[p,[x,te],[v,E]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[p,[x,j],[v,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[p,[x,j],[v,T]],[/(macintosh);/i],[p,[x,j]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[p,[x,ue],[v,E]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[p,[x,B],[v,T]],[/honor([-\w ]+)[;\)]/i],[p,[x,B],[v,E]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[p,[x,q],[v,T]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[p,[x,q],[v,E]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[p,/_/g," "],[x,je],[v,T]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[p,/_/g," "],[x,je],[v,E]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[p,[x,ee],[v,E]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[p,[x,Ke,{OnePlus:["304","403","203"],"*":ee}],[v,T]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[p,[x,"Vivo"],[v,E]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[p,[x,"Realme"],[v,E]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[p,[x,Y],[v,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[p,[x,Y],[v,T]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[p,[x,D],[v,T]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[p,[x,D],[v,E]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}
504(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[p,[x,z],[v,T]],[/(nokia) (t[12][01])/i],[x,p,[v,T]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[p,/_/g," "],[v,E],[x,"Nokia"]],[/(pixel (c|tablet))\b/i],[p,[x,V],[v,T]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[p,[x,V],[v,E]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[p,[x,ye],[v,E]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[p,"Xperia Tablet"],[x,ye],[v,T]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[p,[x,ne],[v,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[p,[x,L],[v,T]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[p,/(.+)/g,"Fire Phone $1"],[x,L],[v,E]],[/(playbook);[-\w\),; ]+(rim)/i],[p,x,[v,T]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[p,[x,O],[v,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[p,[x,F],[v,T]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[p,[x,F],[v,E]],[/(nexus 9)/i],[p,[x,"HTC"],[v,T]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[x,[p,/_/g," "],[v,E]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[p,[x,"TCL"],[v,T]],[/(itel) ((\w+))/i],[[x,Le],p,[v,Ke,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[p,[x,"Acer"],[v,T]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[p,[x,"Meizu"],[v,E]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[p,[x,"Ulefone"],[v,E]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[p,[x,"Energizer"],[v,E]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[p,[x,"Cat"],[v,E]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[p,[x,"Smartfren"],[v,E]],[/droid.+; (a(?:015|06[35]|142p?))/i],[p,[x,"Nothing"],[v,E]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[p,[x,"Archos"],[v,T]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[p,[x,"Archos"],[v,E]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[x,p,[v,T]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[x,p,[v,E]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[x,p,[v,T]],[/(surface duo)/i],[p,[x,K],[v,T]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[p,[x,"Fairphone"],[v,E]],[/(u304aa)/i],[p,[x,"AT&T"],[v,E]],[/\bsie-(\w*)/i],[p,[x,"Siemens"],[v,E]],[/\b(rct\w+) b/i],[p,[x,"RCA"],[v,T]],[/\b(venue[\d ]{2,7}) b/i],[p,[x,"Dell"],[v,T]],[/\b(q(?:mv|ta)\w+) b/i],[p,[x,"Verizon"],[v,T]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[p,[x,"Barnes & Noble"],[v,T]],[/\b(tm\d{3}\w+) b/i],[p,[x,"NuVision"],[v,T]],[/\b(k88) b/i],[p,[x,"ZTE"],[v,T]],[/\b(nx\d{3}j) b/i],[p,[x,"ZTE"],[v,E]],[/\b(gen\d{3}) b.+49h/i],[p,[x,"Swiss"],[v,E]],[/\b(zur\d{3}) b/i],[p,[x,"Swiss"],[v,T]],[/\b((zeki)?tb.*\b) b/i],[p,[x,"Zeki"],[v,T]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[x,"Dragon Touch"],p,[v,T]],[/\b(ns-?\w{0,9}) b/i],[p,[x,"Insignia"],[v,T]],[/\b((nxa|next)-?\w{0,9}) b/i],[p,[x,"NextBook"],[v,T]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[x,"Voice"],p,[v,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[x,"LvTel"],p,[v,E]],[/\b(ph-1) /i],[p,[x,"Essential"],[v,E]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[p,[x,"Envizen"],[v,T]],[/\b(trio[-\w\. ]+) b/i],[p,[x,"MachSpeed"],[v,T]],[/\btu_(1491) b/i],[p,[x,"Rotor"],[v,T]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[p,[x,J],[v,T]],[/(sprint) (\w+)/i],[x,p,[v,E]],[/(kin\.[onetw]{3}
vendor: 3,237 bytes, line 504
504)/i],[[p,/\./g," "],[x,K],[v,E]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[p,[x,Re],[v,T]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[p,[x,Re],[v,E]],[/smart-tv.+(samsung)/i],[x,[v,k]],[/hbbtv.+maple;(\d+)/i],[[p,/^/,"SmartTV"],[x,te],[v,k]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[x,D],[v,k]],[/(apple) ?tv/i],[x,[p,j+" TV"],[v,k]],[/crkey/i],[[p,U+"cast"],[x,V],[v,k]],[/droid.+aft(\w+)( bui|\))/i],[p,[x,L],[v,k]],[/(shield \w+ tv)/i],[p,[x,J],[v,k]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[p,[x,ue],[v,k]],[/(bravia[\w ]+)( bui|\))/i],[p,[x,ye],[v,k]],[/(mi(tv|box)-?\w+) bui/i],[p,[x,je],[v,k]],[/Hbbtv.*(technisat) (.*);/i],[x,p,[v,k]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[x,et],[p,et],[v,k]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[p,[v,k]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[v,k]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[x,p,[v,_]],[/droid.+; (shield)( bui|\))/i],[p,[x,J],[v,_]],[/(playstation \w+)/i],[p,[x,ye],[v,_]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[p,[x,K],[v,_]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[p,[x,te],[v,R]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[x,p,[v,R]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[p,[x,ee],[v,R]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[p,[x,j],[v,R]],[/(opwwe\d{3})/i],[p,[x,ne],[v,R]],[/(moto 360)/i],[p,[x,Y],[v,R]],[/(smartwatch 3)/i],[p,[x,ye],[v,R]],[/(g watch r)/i],[p,[x,D],[v,R]],[/droid.+; (wt63?0{2,3})\)/i],[p,[x,Re],[v,R]],[/droid.+; (glass) \d/i],[p,[x,V],[v,R]],[/(pico) (4|neo3(?: link|pro)?)/i],[x,p,[v,R]],[/; (quest( \d| pro)?)/i],[p,[x,me],[v,R]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[x,[v,I]],[/(aeobc)\b/i],[p,[x,L],[v,I]],[/(homepod).+mac os/i],[p,[x,j],[v,I]],[/windows iot/i],[[v,I]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[p,[v,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[p,[v,T]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[v,T]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[v,E]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[p,[x,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[y,[m,G+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[m,y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[y,[m,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[m,y],[/ladybird\//i],[[m,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[y,m]],os:[[/microsoft (windows) (vista|xp)/i],[m,y],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[m,[y,Ke,Xt]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[y,Ke,Xt],[m,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[y,/_/g,"."],[m,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[m,Xe],[y,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[y,m],[/(ubuntu) ([\w\.]+) like android/i],[[m,/(.+
504)/,"$1 Touch"],y],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[m,y],[/\(bb(10);/i],[y,[m,O]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[y,[m,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[y,[m,$+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[y,[m,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[y,[m,"watchOS"]],[/crkey\/([\d\.]+)/i],[y,[m,U+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[m,Ce],y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[m,y],[/(sunos) ?([\w\.\d]*)/i],[[m,"Solaris"],y],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[m,y]]},Dt=function(Tt,Ie){if(typeof Tt===u&&(Ie=Tt,Tt=s),!(this instanceof Dt))return new Dt(Tt,Ie).getResult();var Z=typeof n!==l&&n.navigator?n.navigator:s,ie=Tt||(Z&&Z.userAgent?Z.userAgent:i),le=Z&&Z.userAgentData?Z.userAgentData:s,Ee=Ie?De(_n,Ie):_n,ke=Z&&Z.userAgent==ie;return this.getBrowser=function(){var Ae={};return Ae[m]=s,Ae[y]=s,Ct.call(Ae,ie,Ee.browser),Ae[f]=qe(Ae[y]),ke&&Z&&Z.brave&&typeof Z.brave.isBrave==o&&(Ae[m]="Brave"),Ae},this.getCPU=function(){var Ae={};return Ae[S]=s,Ct.call(Ae,ie,Ee.cpu),Ae},this.getDevice=function(){var Ae={};return Ae[x]=s,Ae[p]=s,Ae[v]=s,Ct.call(Ae,ie,Ee.device),ke&&!Ae[v]&&le&&le.mobile&&(Ae[v]=E),ke&&Ae[p]=="Macintosh"&&Z&&typeof Z.standalone!==l&&Z.maxTouchPoints&&Z.maxTouchPoints>2&&(Ae[p]="iPad",Ae[v]=T),Ae},this.getEngine=function(){var Ae={};return Ae[m]=s,Ae[y]=s,Ct.call(Ae,ie,Ee.engine),Ae},this.getOS=function(){var Ae={};return Ae[m]=s,Ae[y]=s,Ct.call(Ae,ie,Ee.os),ke&&!Ae[m]&&le&&le.platform&&le.platform!="Unknown"&&(Ae[m]=le.platform.replace(/chrome os/i,Ce).replace(/macos/i,Xe)),Ae},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ie},this.setUA=function(Ae){return ie=typeof Ae===d&&Ae.length>A?et(Ae,A):Ae,this},this.setUA(ie),this};Dt.VERSION=r,Dt.BROWSER=Ge([m,y,f]),Dt.CPU=Ge([S]),Dt.DEVICE=Ge([p,x,v,_,E,k,T,R,I]),Dt.ENGINE=Dt.OS=Ge([m,y]),t.exports&&(e=t.exports=Dt),e.UAParser=Dt;var nn=typeof n!==l&&(n.jQuery||n.Zepto);if(nn&&!nn.ua){var fn=new Dt;nn.ua=fn.getResult(),nn.ua.get=function(){return fn.getUA()},nn.ua.set=function(Tt){fn.setUA(Tt);var Ie=fn.getResult();for(var Z in Ie)nn.ua[Z]=Ie[Z]}}})(typeof window=="object"?window:fft)})(Hy,Hy.exports)),Hy.exports}var pft=hft();const mft=Y2(pft);function gft(t=!0,e=1e3){const[n,s]=w.useState(()=>Date.now());return w.useEffect(()=>{if(!t)return;s(Date.now());const r=window.setInterval(()=>s(Date.now()),e);return()=>window.clearInterval(r)},[t,e]),n}function Tne(t){return t?new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short",hour12:!0}).format(new Date(t)):"-"}function zm(t){if(!t)return"—";const e=new Date(t);if(Number.isNaN(e.getTime()))return"—";const n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),r=e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short"});return`${n}/${s} @ ${r}`}function kne(t){if(!t)return"—";const e=new Date(t);if(Number.isNaN(e.getTime()))return"—";const n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${n}/${s}/${e.getFullYear()}`}const e0="flex items-center min-w-px h-[44px] px-[16px] bg-[var(--sand-3)] text-[var(--sand-12)] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",tl="flex items-center min-w-px min-h-0 h-[44px] max-h-[44px] overflow-hidden px-[16px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px]",gU="flex-none w-[170px]",vU="flex-1",xU="flex-none w-[130px]",yU="flex-1",bU="flex-none w-[140px]",SU="flex-none w-[96px] justify-end gap-[6px]",Rne=t=>`flex h-[36px] items-center gap-[6px] px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] ${t?"cursor-not-allowed bg-[var(--sand-3)] text-[var(--sand-8)]":"cursor-pointer active:scale-[0.97] bg-[var(--sand-3)] text-[var(--sand-12)] hover:bg-[var(--sand-4)]"}`;function vft(t){if(!t)return"Unknown";
504const e=new mft(t),n=e.getDevice().type||"desktop",s=n.charAt(0).toUpperCase()+n.slice(1),r=e.getBrowser(),i=r.name?`${r.name}${r.version?` ${r.version.split(".")[0]}`:""}`:"Unknown browser";return`${s} · ${i}`}function xft({size:t=20,className:e}){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:e,"aria-hidden":"true",children:c.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"4"})})}function Ane({size:t=20,className:e}){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:e,"aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z"})})}function yft({size:t=20,className:e}){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:e,"aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z"})})}function bft({sessions:t,isLoading:e,isFetching:n,statusFilter:s,plan:r,pageIndex:i,pageSize:a,hasNextPage:o,hasPreviousPage:l,onPageChange:u,totalCount:d,renderLiveSessionAction:f}){const p=!e&&t.length===0;return c.jsxs("div",{className:"flex flex-col gap-[12px] w-full",children:[c.jsxs("div",{className:`overflow-hidden flex flex-col w-full ${p?"":"[&>div:last-child>div]:border-b-0 border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px]"}`,children:[(e||t.length>0)&&c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${e0} ${gU}`,children:"Session ID"}),c.jsx("div",{className:`${e0} ${vU} border-l-[0.5px]`,children:"Started"}),c.jsx("div",{className:`${e0} ${xU} border-l-[0.5px]`,children:"Duration"}),c.jsx("div",{className:`${e0} ${yU} border-l-[0.5px]`,children:"Browser details"}),c.jsx("div",{className:`${e0} ${bU} border-l-[0.5px]`,children:"Status"}),c.jsx("div",{className:`${e0} ${SU} border-l-[0.5px]`})]}),e?Array.from({length:Math.min(a,10)}).map((m,v)=>c.jsx(_ft,{},v)):t.length?t.map(m=>c.jsx(Sft,{session:m,plan:r,renderLiveSessionAction:f},m.id)):c.jsx("div",{className:"flex w-full",children:c.jsxs("div",{className:"flex flex-col items-center justify-center gap-[24px] w-full bg-[var(--sand-2)] rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] text-center",children:[c.jsx(Nh,{size:20,className:"size-[20px] text-[var(--sand-12)]"}),c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-9)]",children:[s==="live"?"No live sessions found.":"No sessions found.",c.jsx("br",{}),"Start a session and it will appear here."]})]})})]}),!p&&c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsx("span",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px] whitespace-nowrap",children:t.length>0&&(()=>{const m=i*a+1,v=i*a+t.length,x=m===v?m.toLocaleString():`${m.toLocaleString()}–${v.toLocaleString()}`;return d!=null?`Showing ${x} out of ${d.toLocaleString()} sessions`:`Showing ${x} sessions`})()}),c.jsxs("div",{className:"flex items-center gap-[8px] shrink-0",children:[c.jsx("button",{type:"button",onClick:()=>u(i-1),disabled:!l||n,className:Rne(!l||n),children:"Previous"}),c.jsx("button",{type:"button",onClick:()=>u(i+1),disabled:!o||n,className:Rne(!o||n),children:"Next"})]})]})]})}const Sft=w.memo(function({session:e,plan:n,renderLiveSessionAction:s}){const r=di(),i=e.status==="live",a=a1e(n,e.createdAt),o=e.id.slice(-8),l=e.userAgent||"",[u,d]=w.useState(0),[f,p]=w.useState(0);return c.jsxs("div",{className:`flex w-full h-[44px] min-h-0 shrink-0 items-stretch transition-opacity ${a?"opacity-50":""}`,children:[c.jsxs("div",{className:`${tl} ${gU} group gap-[8px] text-[var(--sand-12)] overflow-hidden`,children:[c.jsx("button",{type:"button",onClick:()=>!a&&r(`/sessions/${e.id}`),disabled:a,className:"font-mono truncate min-w-px text-left cursor-pointer disabled:cursor-not-allowed",children:c.jsx("span",{title:e.id,className:u>0?"copy-flash-text":void 0,children:o},u)}),c.jsx("button",{type:"button",onClick:()=>{Ja(e.id,"Session ID"),d(m=>m+1)},"aria-label":"Copy session ID",className:"shrink-0 cursor-pointer text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",children:c.jsx(Pd,{size:16})})]}),c.jsx("div",{className:`${tl} ${vU} border-l-[0.5px] text-[var(--sand-12)] whitespace-nowrap`,children:zm(e.createdAt)}),c.jsx("div",{className:`${tl} ${xU} border-l-[0.5px] text-[var(--sand-11)] tabular-nums`,children:i?c.jsx(wft,{since:e.createdAt}):M0e(e.duration)}),c.jsxs("div",{className:`${tl} ${yU} border-l-[0.5px] group gap-[8px] text-[var(--sand-11)] overflow-hidden`,children:[c.jsx("span",{className:`truncate min-w-px ${f>0?"copy-flash-text":""}`,children:vft(l)},f),l&&c.jsx("button",{type:"button",onClick:()=>{Ja(l,"User agent"),p(m=>m+1)},"aria-label":"Copy user agent",className:"shrink-0 cursor-pointer text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",children:c.jsx(Pd,{size:16})})]}),c.jsx("div",{className:`${tl} ${bU} border-l-[0.5px]`,children:a?c.jsxs("span",{className:"inline-flex items-center gap-[8px] text-[var(--sand-10)] text-[14px] leading-[20px]",children:[c.jsx(yft,{size:20,className:"shrink-0"}),"Expired"]}):i?c.jsxs("span",{className:"inline-flex items-center gap-[8px] text-[var(--green-11)] dark:text-[#34d399] text-[14px] leading-[20px]",children:[c.jsx(Ane,{size:20,className:"shrink-0"}),"Live"]}):c.jsxs("span",{className:"inline-flex items-center gap-[8px] text-[var(--sand-12)] dark:text-white text-[14px] leading-[20px]",children:[c.jsx(Ane,{size:20,className:"shrink-0"}),"Completed"]})}),c.jsx("div",{className:`${tl} ${SU} border-l-[0.5px]`,children:!a&&c.jsxs(c.Fragment,{children:[i?s?s(e):c.jsx(mye,{sessionId:e.id,children:c.jsx("button",{type:"button","aria-label":"Stop session",className:"cursor-pointer shrink-0 flex size-[32px] items-center justify-center rounded-full text-danger transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-danger-hover",children:c.jsx(xft,{size:20})})}):c.jsx("span",{className:"size-[32px] shrink-0","aria-hidden":!0}),c.jsx("button",{type:"button","aria-label":"View session",onClick:()=>{QBe(),r(`/sessions/${e.id}`)},className:"cursor-pointer shrink-0 flex size-[32px] items-center justify-center rounded-full text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)]",children:c.jsx(gye,{size:20})})]})})]})});function wft({since:t}){const e=new Date(t).getTime(),n=gft();return c.jsx("span",{children:M0e(Math.max(0,n-e))})}function _ft(){const t=e=>c.jsx("div",{className:"h-[12px] animate-pulse rounded-[6px] bg-[var(--sand-4)]",style:{width:e}});return c.jsxs("div",{className:"flex w-full h-[44px] min-h-0 shrink-0 items-stretch",children:[c.jsx("div",{className:`${tl} ${gU}`,children:t("80px")}),c.jsx("div",{className:`${tl} ${vU} border-l-[0.5px]`,children:t("160px")}),c.jsx("div",{className:`${tl} ${xU} border-l-[0.5px]`,children:t("60px")}),c.jsx("div",{className:`${tl} ${yU} border-l-[0.5px]`,children:t("150px")}),c.jsx("div",{className:`${tl} ${bU} border-l-[0.5px]`,children:t("64px")}),c.jsx("div",{className:`${tl} ${SU} border-l-[0.5px]`,children:t("16px")})]})}function Eft(t,e=1500){const n=w.useRef(t);n.current=t,w.useEffect(()=>{let s=0;const r=()=>{if(document.visibilityState!=="visible")return;const i=Date.now();i-s<e||(s=i,n.current())};return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[e])}const Nne=20,Cft=20,Ine="sessions-status-filter";function Lne({label:t,active:e,count:n,onClick:s,onHover:r,animate:i}){const a=n!=null&&n>0;return c.jsxs("button",{type:"button",onClick:s,onMouseEnter:r,className:`relative flex items-center h-[32px] pl-[12px] rounded-full font-medium text-[14px] leading-[20px] transition-[color,padding] duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer ${a?"pr-[8px]":"pr-[12px]"} ${e?"text-[var(--sand-12)]":"text-[var(--sand-11)] hover:text-[var(--sand-12)]"}`,children:[e&&c.jsx(wt.span,{layoutId:"sessions-filter-pill",transition:i?{type:"spring",bounce:.18,duration:.45}:{duration:0},className:"absolute inset-0 z-0",children:c.jsx(wt.span,{initial:!1,animate:i?{scaleX:[1,1.1,1]}:{scaleX:1},transition:{duration:.45,ease:"easeOut",times:[0,.4,1]},className:"block h-full w-full rounded-full bg-[var(--sand-4)]"})}),c.jsx("span",{className:"relative z-[1]",children:t}),c.jsx(xr,{initial:!1,children:a&&c.jsx(wt.span,{initial:{width:0,marginLeft:0,opacity:0}
504,animate:{width:"auto",marginLeft:6,opacity:1},exit:{width:0,marginLeft:0,opacity:0},transition:{type:"spring",bounce:.35,duration:.45},className:`relative z-[1] inline-flex h-[20px] items-center overflow-hidden rounded-[999px] text-[11px] font-medium leading-[20px] text-[var(--green-11)] dark:text-[#34d399] ${e?"bg-[var(--green-4)] dark:bg-[#123d2e]":"bg-[var(--green-3)] dark:bg-[#0b2e22]"}`,children:c.jsx("span",{className:"inline-flex min-w-[20px] justify-center px-[6px]",children:n})},"badge")})]})}function Tft(){var ne;const[t,e]=Po(),{useSessions:n,useLiveSessionsCount:s,prefetchSessions:r,useOrgDetails:i}=fr(),a=parseInt(t.get("page")||"0",10),o=Math.min(Cft,parseInt(t.get("limit")||String(Nne),10)||Nne),l=t.get("status")||"live",u=t.get("cursor")||void 0,[d,f]=w.useState([]),[p,m]=w.useState(!1),v=w.useMemo(()=>({cursorId:a===0?void 0:u,limit:o,status:l==="live"?"live":void 0}),[u,o,l,a]),{data:x,error:y,isLoading:S,isFetching:_,refetch:E}=n(v),{data:T=0,refetch:k,isSuccess:R}=s(),{data:I,error:A,isLoading:L,refetch:j}=i(),F=(I==null?void 0:I.plan)??"hobby",O=S||L,M=!!(y||A);Eft(()=>{E(),k()}),w.useEffect(()=>{if(t.has("status"))return;const Q=localStorage.getItem(Ine);let ee;if(Q==="all")ee="all";else{if(!R)return;ee=T>0?"live":"all"}e(te=>{const ue=new URLSearchParams(te);return ue.set("status",ee),ue},{replace:!0})},[t,R,T,e]);const U=w.useCallback(()=>{const Q=[];if(y&&Q.push(E()),A&&Q.push(j()),Q.length!==0)return Promise.all(Q)},[y,A,E,j]),G=w.useCallback(Q=>{if(Q>a&&(x!=null&&x.nextCursor))u&&f(ee=>[...ee,u]),e(ee=>{const te=new URLSearchParams(ee);return te.set("page",String(Q)),te.set("cursor",x.nextCursor),te});else if(Q<a){const ee=d[d.length-1];f(te=>te.slice(0,-1)),e(te=>{const ue=new URLSearchParams(te);return ue.set("page",String(Q)),Q===0?ue.delete("cursor"):ee&&ue.set("cursor",ee),ue})}},[a,x==null?void 0:x.nextCursor,u,d,e]),$=w.useCallback(Q=>{f([]),e(ee=>{const te=new URLSearchParams(ee);return te.set("limit",String(Q)),te.set("page","0"),te.delete("cursor"),te})},[e]),V=w.useCallback(Q=>{m(!0),localStorage.setItem(Ine,Q),f([]),e(ee=>{const te=new URLSearchParams(ee);return te.set("status",Q),te.set("page","0"),te.delete("cursor"),te})},[e]),B=w.useRef(new Set);w.useEffect(()=>{if(!(x!=null&&x.nextCursor)||_)return;const Q=`next:${x.nextCursor}:${o}:${l}`;B.current.has(Q)||(B.current.add(Q),r({cursorId:x.nextCursor,limit:o,status:l==="live"?"live":void 0}))},[x==null?void 0:x.nextCursor,o,l,_,r]),w.useEffect(()=>{const Q=`tab:${l==="live"?"all":"live"}:${o}`;B.current.has(Q)||(B.current.add(Q),r(l==="live"?{limit:o}:{limit:o,status:"live"}))},[l,o,r]);const q=w.useCallback(()=>{r({limit:o,status:"live"})},[r,o]),z=w.useCallback(()=>{r({limit:o})},[r,o]);if(M)return c.jsx(dft,{message:(ne=y??A)==null?void 0:ne.message,onRetry:U});const D=(x==null?void 0:x.sessions)||[],K=!!(x!=null&&x.nextCursor),Y=a>0,J=T>0;return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto [scrollbar-gutter:stable_both-edges]",children:c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"Sessions"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"View and manage your browser sessions."})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[J&&c.jsx(mye,{children:c.jsx("button",{type:"button",className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-3)] hover:bg-danger-hover flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger whitespace-nowrap",children:"Release all sessions"})}),c.jsx(uft,{children:c.jsx("button",{type:"button",className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] whitespace-nowrap",children:"Start session"})})]})]}),c.jsxs("div",{className:"flex flex-col gap-[24px] p-[24px] w-full",children:[c.jsx("div",{className:"flex items-center justify-between gap-[16px] w-full",children:c.jsxs("div",{className:"flex items-center gap-[4px] p-[4px] rounded-full bg-[var(--sand-2)]",children:[c.jsx(Lne,{label:"Live sessions",active:l==="live",count:T,onClick:()=>V("live"),onHover:q,animate:p}),c.jsx(Lne,{label:"All sessions",active:l==="all",onClick:()=>V("all"),onHover:z,animate:p})]})}),c.jsx(bft,{sessions:D,isLoading:O,isFetching:_,statusFilter:l,plan:F,pageSize:o,pageIndex:a,onPageChange:G,onPageSizeChange:$,hasNextPage:K,hasPreviousPage:Y,totalCount:x==null?void 0:x.totalCount})]})]})})}const kft=168;
504function Rft({projects:t,value:e,onChange:n,disabled:s}){const[r,i]=w.useState(!1),a=w.useRef(null),o=t.find(l=>l.id===e);return w.useEffect(()=>{if(!r)return;const l=u=>{a.current&&!a.current.contains(u.target)&&i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[r]),c.jsxs("div",{ref:a,className:"relative",children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,disabled:s,onClick:()=>i(l=>!l),className:"bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] flex items-center justify-between cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-[var(--sand-3)]",children:[c.jsx("span",{className:`font-medium text-[14px] leading-[20px] truncate ${o?"text-[var(--sand-12)]":"text-[var(--sand-10)]"}`,children:(o==null?void 0:o.name)??"Select a project"}),c.jsx(G1,{size:20,className:"size-[20px] shrink-0 text-[var(--sand-9)]"})]}),r&&t.length>0&&c.jsx("div",{role:"menu",className:"origin-bottom absolute left-0 right-0 bottom-[calc(100%+6px)] z-50 flex flex-col gap-[4px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)] max-h-[200px] overflow-y-auto",children:t.map(l=>c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(l.id),i(!1)},className:`w-full text-left cursor-pointer flex items-center justify-between gap-[8px] h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] ${l.id===e?"bg-[var(--sand-4)] text-[var(--sand-12)]":"text-[var(--sand-11)]"}`,children:[c.jsx("span",{className:"truncate min-w-0",children:l.name}),c.jsx("span",{className:`shrink-0 flex h-[20px] items-center px-[8px] rounded-[999px] text-[11px] font-medium leading-[20px] ${l.isProduction?"bg-[var(--green-a3)] text-[var(--green-11)]":"bg-[var(--yellow-a3)] text-[var(--yellow-11)]"}`,children:l.isProduction?"Prod":"Dev"})]},l.id))})]})}function Aft(){var D;const t=Z1(),{projects:e,projectsQuery:n,selectedProjectId:s,defaultProject:r}=lc(),i=e.length>0,a=s??(r==null?void 0:r.id)??((D=e[0])==null?void 0:D.id)??"",[o,l]=w.useState(!1),[u,d]=w.useState("form"),[f,p]=w.useState("Default"),[m,v]=w.useState(""),[x,y]=w.useState(""),[S,_]=w.useState(!1),[E,T]=w.useState(null),k=w.useRef(null),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),{render:L,exiting:j}=Kh(o,220),{mutate:F,reset:O}=Bi({mutationFn:async K=>{const Y=await Fme({body:K});if(Y.error)throw Y.error;return Y.data},onSuccess:K=>{K&&(Pn.invalidateQueries({queryKey:["api-keys"]}),y(K.key),d("done"),t.capture("api-key-created",{name:K.name}))},onError:()=>{d("form"),Bn({title:"Error creating API key"})}}),M=()=>l(!1),U=()=>{O(),d("form"),p("Default"),v(a),y(""),_(!1),l(!0)},G=()=>{m&&(d("loading"),F({name:f,projectId:m||void 0}))},$=()=>{var K;Ja(x,"API key"),(K=A.current)==null||K.animate([{backgroundColor:"var(--sand-3)"},{backgroundColor:"var(--sand-7)",offset:.22},{backgroundColor:"var(--sand-3)"}],{duration:600,easing:"ease-out"})};w.useLayoutEffect(()=>{var K,Y;L&&T(u==="form"?((K=R.current)==null?void 0:K.offsetHeight)??null:u==="loading"?kft:((Y=I.current)==null?void 0:Y.offsetHeight)??null)},[L,u]),w.useEffect(()=>{if(!o)return;const K=J=>J.key==="Escape"&&M();document.addEventListener("keydown",K);const Y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",K),document.body.style.overflow=Y}},[o]);const V="pt-[32px] px-[32px] pb-[28px]",B="font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",q="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]",z=!m;return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:U,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap",children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:"Create API key"})}),L&&typeof document<"u"&&nr.createPortal(c.jsx("div",{className:`${j?"modal
504-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/70 backdrop-blur-[8px]`,onMouseDown:K=>{k.current&&!k.current.contains(K.target)&&M()},children:c.jsxs("div",{ref:k,role:"dialog","aria-modal":"true",style:E?{height:E}:void 0,className:`${j?"modal-card-out":"modal-card-in"} relative overflow-hidden bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full shadow-modal transition-[height] [transition-duration:400ms] [transition-timing-function:var(--ease-out)]`,children:[c.jsxs("form",{ref:R,onSubmit:K=>{K.preventDefault(),G()},className:`absolute inset-x-0 top-0 flex flex-col transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${u==="form"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsx("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Create API key"})}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[24px] p-[16px]",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:B,children:"Name your key"}),c.jsx("input",{type:"text",value:f,onChange:K=>p(K.target.value),placeholder:"e.g. Production",className:q})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:B,children:"Project"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"API keys are scoped to one project. Use the project switcher for the active environment, or choose a different project here."}),c.jsx(Rft,{projects:e,value:m,onChange:v,disabled:n.isLoading||!i}),z&&!n.isLoading&&c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-danger",children:"Select a project before creating an API key."})]})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:M,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:z,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:active:scale-100",children:"Create API key"})]})]}),c.jsxs("div",{className:`absolute inset-0 ${V} flex flex-col items-center justify-center gap-[16px] transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${u==="loading"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px] text-center",children:"Generating API key"})]}),c.jsxs("div",{ref:I,className:`absolute inset-x-0 top-0 flex flex-col transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${u==="done"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"API key created"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Please keep this key as you will not be able to see it again."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsx("div",{className:"p-[16px]",children:c.jsxs("div",{ref:A,className:"bg-[var(--sand-3)] flex items-center gap-[10px] h-[40p
504x] pl-[12px] pr-[8px] rounded-[8px] w-full overflow-hidden",children:[c.jsx("div",{className:"relative min-w-0 flex-1",children:c.jsx(xr,{mode:"wait",initial:!1,children:c.jsx(wt.span,{initial:{opacity:0,filter:"blur(4px)"},animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:{duration:.2,ease:"easeOut"},className:"ph-no-capture block overflow-hidden whitespace-nowrap font-medium text-[14px] leading-[20px] text-[var(--sand-12)] tracking-[0.02em]",children:S?x:"•".repeat(x.length)},S?"shown":"hidden")})}),c.jsx("button",{type:"button",onClick:()=>_(K=>!K),className:"shrink-0 flex h-[26px] items-center px-[10px] rounded-[999px] bg-[var(--sand-5)] text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer hover:bg-[var(--sand-6)]",children:S?"Hide key":"Show key"})]})}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:M,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Close"}),c.jsx("button",{type:"button",onClick:$,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Copy"})]})]})]})}),document.body)]})}const ha="flex items-center min-w-px h-[44px] px-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",g9="flex items-center justify-center h-[44px] w-[148px] gap-[4px] shrink-0 border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",Nft=`${g9} bg-[var(--sand-3)]`,jne="cursor-pointer flex items-center justify-center h-[32px] rounded-full text-[var(--sand-10)] hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:opacity-50 disabled:cursor-not-allowed";function Ift(t,e){var n;return t?((n=e.find(s=>s.id===t))==null?void 0:n.name)??null:null}function Lft(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px]",children:[c.jsx("path",{d:"M3 6h18"}),c.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]})}function t0({w:t="100%",h:e=12,rounded:n="rounded-[6px]"}){return c.jsx("div",{className:`animate-pulse bg-[var(--sand-4)] ${n}`,style:{width:t,height:e}})}function jft({apiKeys:t,isError:e,isLoading:n,projects:s=[]}){var m;const[r,i]=w.useState(null),[a,o]=w.useState(null),l=((m=t.find(v=>v.id===r))==null?void 0:m.name)??null,{mutate:u,isPending:d}=Bi({mutationFn:async v=>{const x=await LZe({path:{id:v}});if(x.error)throw x.error;return x.data},onSuccess:()=>{Pn.invalidateQueries({queryKey:["api-keys"]}),Pn.invalidateQueries({queryKey:["onboarding-api-key"]}),i(null)},onError:()=>{Bn({title:"Error deleting API key"})}}),{mutate:f,isPending:p}=Bi({mutationFn:async v=>{const x=await ht.post({url:`/v1/api-keys/${v}/rotate`,security:[{name:"steel-api-key",type:"apiKey"}]});if(x.error)throw x.error;return x.data},onSuccess:v=>{Pn.invalidateQueries({queryKey:["api-keys"]}),Pn.invalidateQueries({queryKey:["onboarding-api-key"]}),o(v.key)},onError:()=>Bn({title:"Could not rotate API key"})});return c.jsxs("div",{className:"rise-in flex flex-col w-full",children:[c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${ha} flex-1 bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"API key name"}),c.jsx("div",{className:`${ha} flex-none w-[180px] border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Key"}),c.jsx("div",{className:`${ha} flex-1 border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Scope"}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Created at"}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Last used"}),c.jsx("div",{className:Nft})]}),n&&Array.from({length:5}).map((v,x)=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${ha} flex-1`,children:c.jsx(t0,{w:"120px"})}),c.jsx("div",{className:`${ha} flex-none w-[180px] border-l-[0.5px]`,children:c.jsx(t0,{w:"140px"})}),c.jsx("div",{className:`${ha}
504 flex-1 border-l-[0.5px]`,children:c.jsx(t0,{w:"80px",h:20,rounded:"rounded-[999px]"})}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px]`,children:c.jsx(t0,{w:"130px"})}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px]`,children:c.jsx(t0,{w:"130px"})}),c.jsx("div",{className:g9,children:c.jsx(t0,{w:"20px",h:20,rounded:"rounded-full"})})]},`sk-${x}`)),!n&&t.map(v=>{var y;const x=Ift(v.projectId,s);return c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${ha} flex-1 text-[var(--sand-12)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:v.name??"Default"})}),c.jsx("div",{className:`${ha} flex-none w-[180px] border-l-[0.5px] text-[var(--sand-11)] tracking-[0.02em] overflow-hidden`,children:c.jsx("span",{className:"ph-no-capture truncate min-w-0",children:v.key})}),c.jsx("div",{className:`${ha} flex-1 border-l-[0.5px] text-[var(--sand-11)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:x??"Project"})}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px] text-[var(--sand-12)]`,children:c.jsx("span",{className:"whitespace-nowrap",children:zm(v.createdAt)})}),c.jsx("div",{className:`${ha} flex-none w-[200px] border-l-[0.5px] text-[var(--sand-12)]`,children:c.jsx("span",{className:"whitespace-nowrap",children:zm(v.updatedAt)})}),c.jsxs("div",{className:g9,children:[!((y=v.name)!=null&&y.startsWith("stripe-projects:"))&&c.jsxs("button",{type:"button",disabled:p,onClick:()=>{window.confirm(`Rotate ${v.name??"this key"}? The old value will stop working. Save the new value when it appears.`)&&f(v.id)},"aria-label":`Rotate ${v.name??"Default"} key`,className:`${jne} gap-[6px] px-[10px] font-medium text-[13px] leading-[20px] hover:text-[var(--sand-12)]`,children:[c.jsx(fR,{size:16}),"Rotate"]}),c.jsx("button",{type:"button","aria-label":`Delete ${v.name??"Default"} key`,onClick:()=>i(v.id),className:`${jne} w-[32px] hover:text-danger`,children:c.jsx(Lft,{})})]})]},v.id)}),!n&&!e&&t.length===0&&c.jsx("div",{className:"flex items-center justify-center p-[24px] font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No API keys yet."}),e&&c.jsx("div",{className:"flex items-center justify-center p-[24px] font-medium text-[14px] leading-[20px] text-danger",children:"Error fetching API keys."})]}),c.jsx(ss,{open:r!==null,onClose:()=>{d||i(null)},noIcon:!0,danger:!0,title:"Are you sure?",subtitle:`This permanently revokes ${l??"this key"}. Any requests using it will stop working.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>i(null),disabled:d,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>r&&u(r),disabled:d,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",children:d?"Deleting…":"Yes, delete"})]})}),c.jsx(ss,{open:a!==null,onClose:()=>o(null),noIcon:!0,title:"API key rotated",subtitle:"Copy and save this key now. You won't be able to see it again.",footer:c.jsxs("div",{className:"flex flex-col gap-3 w-full min-w-0",children:[c.jsx("code",{className:"ph-no-capture block overflow-x-auto rounded-md bg-[var(--sand-3)] p-3 text-sm text-[var(--sand-12)]",children:a}),c.jsx("button",{type:"button",onClick:()=>a&&Ja(a,"API key"),className:"rounded-md bg-[var(--sand-12)] px-4 py-2 text-[var(--sand-1)]",children:"Copy key"})]})})]})}function Pft(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),{projects:s}=lc(),{data:r,isLoading:i,isError:a}=rs({queryKey:to.apiKeys(n),queryFn:async()=>{const o=await $me({});if(o.error)throw o.error;if(!o.data)throw new Error("No data returned from API");return o.data},enabled:t&&!!e&&!!n});return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"API keys"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage the keys used to authenticate with the Steel API."})]}),c.jsx(Aft,{})]}),c.jsx("div",{className:"flex flex-col gap-[24px] p-[24px] w-full",children:c.jsx(jft,{apiKeys:(r==null?void 0:r.apiKeys)??[],isError:a,isLoading:i,projects:s})})]})})}function Mft(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M8 6L12 2L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12 3V13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M17 10C18.1046 10 19 10.8954 19 12V18C19 19.1046 18.1046 20 17 20H7C5.89543 20 5 19.1046 5 18V12C5 10.8954 5.89543 10 7 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Pne=10;function Dft({name:t,handle:e,avatarUrl:n,signatureUrl:s,memberNumber:r,stats:i}){const a=w.useRef(null),[o,l]=w.useState({rx:0,ry:0,active:!1}),u=f=>{const p=a.current;
504if(!p)return;const m=p.getBoundingClientRect(),v=(f.clientX-m.left)/m.width,x=(f.clientY-m.top)/m.height;l({rx:(x-.5)*2*Pne,ry:-(v-.5)*2*Pne,active:!0})},d=()=>l({rx:0,ry:0,active:!1});return c.jsx("div",{style:{perspective:"1000px"},className:"relative w-full max-w-[504px]",children:c.jsx("div",{ref:a,onMouseMove:u,onMouseLeave:d,style:{transform:`rotateX(${o.rx}deg) rotateY(${o.ry}deg)`,transition:o.active?"transform 80ms ease-out":"transform 400ms cubic-bezier(0.22, 1, 0.36, 1)"},className:"relative z-10 aspect-[1.586/1] w-full overflow-hidden rounded-[16px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] shadow-[0_10px_28px_-18px_rgba(0,0,0,0.25)] dark:shadow-[0_10px_28px_-18px_rgba(0,0,0,0.5)]",children:c.jsxs("div",{className:"relative flex h-full flex-col justify-between p-5 font-sans",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s?c.jsx(wt.img,{src:s,alt:"Signature",initial:{clipPath:"inset(0 100% 0 0)"},animate:{clipPath:"inset(0 0 0 0)"},transition:{duration:.9,ease:"easeInOut"},className:"h-[40px] w-auto max-w-[70%] object-contain object-left invert dark:invert-0"},s):c.jsxs("div",{className:"flex min-w-0 flex-col",children:[c.jsx("span",{className:"truncate text-[16px] font-medium leading-[20px] text-[var(--sand-12)]",children:t}),e&&c.jsx("span",{className:"truncate text-[14px] leading-[18px] text-[var(--sand-10)]",children:e})]}),c.jsx("div",{className:"size-[40px] shrink-0 overflow-hidden rounded-full border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)]",children:n&&c.jsx("img",{src:n,alt:"",className:"size-full object-cover"})})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[14px] font-medium leading-[18px] text-[var(--sand-10)]",children:e||"Steel member"}),r!=null&&c.jsxs("span",{className:"font-mono text-[20px] font-medium leading-[24px] tabular-nums text-[var(--sand-12)]",children:["#",r.toLocaleString()]})]}),c.jsx("div",{className:"flex items-end gap-[28px]",children:i.map(f=>c.jsxs("div",{className:"flex min-w-0 flex-col gap-[2px]",children:[c.jsx("span",{className:"truncate text-[14px] leading-[18px] text-[var(--sand-10)]",children:f.label}),c.jsx("span",{className:"truncate text-[14px] font-medium leading-[18px] text-[var(--sand-12)]",children:f.value})]},f.label))})]})})})}function Oft(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12.9474 9.10176L15.7696 4.14333C16.3823 3.06675 17.7491 2.6833 18.8339 3.28361C19.9268 3.88843 20.3217 5.26328 19.7159 6.35441L16.933 11.3664M9.00214 11.8465C7.35656 13.7876 5.49042 14.3736 3 13.8438C4 20.5 15.5045 24.8292 16.5048 16.3405M17.9582 16.5011L7.9937 10.9869C8.23647 10.5497 8.47925 10.1125 8.72202 9.67522C9.2578 8.71027 10.474 8.36165 11.4395 8.8963L17.9053 12.4764C18.871 13.0111 19.2207 14.227 18.685 15.1922C18.4428 15.6285 18.2005 16.0648 17.9582 16.5011Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",strokeLinejoin:"round"})})}function $ft({open:t,onClose:e,onSave:n}){const s=w.useRef(null),r=w.useRef(!1),i=w.useRef(null),a=w.useRef(null),[o,l]=w.useState(!1),[u,d]=w.useState(!1);w.useEffect(()=>{if(!t)return;const S=_=>_.key==="Escape"&&e();return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,e]),w.useEffect(()=>{if(!t)return;const S=requestAnimationFrame(()=>{const _=s.current;if(!_)return;const E=window.devicePixelRatio||1,T=_.offsetWidth,k=_.offsetHeight;if(!T||!k)return;_.width=T*E,_.height=k*E;const R=_.getContext("2d");R&&(R.scale(E,E),R.lineCap="round",R.lineJoin="round",R.lineWidth=3,R.strokeStyle="#f4f3ee"),l(!1)});return()=>cancelAnimationFrame(S)},[t]);const f=S=>{const E=s.current.getBoundingClientRect();return{x:S.clientX-E.left,y:S.clientY-E.top}},p=S=>{S.currentTarget.setPointerCapture(S.pointerId),r.current=!0,d(!0);const _=f(S);i.current=_,a.current=_},m=S=>{var T;if(!r.current||!i.current||!a.current)return;const _=(T=s.current)==null?void 0:T.getContext("2d"),E=f(S);if(_){const k={x:(i.current.x+E.x)/2,y:(i.current.y+E.y)/2};_.beginPath(),_.moveTo(a.current.x,a.current.y),_.quadraticCurveTo(i.current.x,i.current.y,k.x,k.y),_.stroke(),a.current=k,l(!0)}i.current=E},v=()=>{r.current=!1,d(!1),i.current=null,a.current=null},x=()=>{const S=s.current,_=S==null?void 0:S.getContext("2d");S&&_&&_.clearRect(0,0,S.width,S.height),l(!1)},y=()=>{const S=s.current;if(!S)return;const _=Fft(S);_&&n(_),e()};return c.jsx(xr,{initial:!1,children:t&&c.jsx(wt.div,{initial:{opacity:0,height:0}
504,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:[.22,1,.36,1]},className:"w-[252px] overflow-hidden pt-[16px]",children:c.jsxs("div",{className:"relative overflow-hidden rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] font-sans",children:[c.jsx("canvas",{ref:s,onPointerDown:p,onPointerMove:m,onPointerUp:v,onPointerLeave:v,className:"block h-[150px] w-full cursor-crosshair touch-none invert dark:invert-0"}),c.jsx("button",{type:"button",onClick:x,"aria-label":"Clear signature",className:`absolute left-[8px] top-[8px] flex size-[40px] cursor-pointer items-center justify-center rounded-full bg-[var(--sand-6)] transition-[opacity,color] ${u?"opacity-40":o?"opacity-100":"opacity-60"} ${o&&!u?"text-[var(--sand-12)] dark:text-white":"text-[var(--sand-12)]"}`,children:c.jsx(Oft,{size:20})}),c.jsx("button",{type:"button",onClick:y,disabled:!o,"aria-label":"Save signature",className:`absolute right-[8px] top-[8px] flex size-[40px] items-center justify-center rounded-full transition-[opacity,background-color,color] disabled:cursor-not-allowed ${u?"opacity-40":o?"cursor-pointer opacity-100":"opacity-60"} ${o&&!u?"bg-[var(--sand-12)] text-[var(--sand-1)] dark:bg-white dark:text-black":"bg-[var(--sand-6)] text-[var(--sand-12)]"}`,children:c.jsx(j4,{size:24})})]})},"signature-pad")})}function Fft(t){const e=t.getContext("2d");if(!e)return null;const{width:n,height:s}=t,{data:r}=e.getImageData(0,0,n,s);let i=n,a=s,o=0,l=0,u=!1;for(let x=0;x<s;x++)for(let y=0;y<n;y++)r[(x*n+y)*4+3]>10&&(u=!0,y<i&&(i=y),y>o&&(o=y),x<a&&(a=x),x>l&&(l=x));if(!u)return null;const d=8;i=Math.max(0,i-d),a=Math.max(0,a-d),o=Math.min(n,o+d),l=Math.min(s,l+d);const f=o-i,p=l-a,m=document.createElement("canvas");m.width=f,m.height=p;const v=m.getContext("2d");return v?(v.drawImage(t,i,a,f,p,0,0,f,p),m.toDataURL("image/png")):null}function Uft(t){return t?t.toLocaleDateString("en-US",{month:"short",year:"numeric"}):"—"}function Bft(){var T;const{user:t}=Vi(),{plan:e,planLabel:n,browserMinutes:s,isLoading:r}=mu(),{useSessions:i}=fr(),{data:a}=i({limit:1}),o=a==null?void 0:a.totalCount,l=t!=null&&t.id?`steel-membership-signature-${t.id}`:null,[u,d]=w.useState(null),[f,p]=w.useState(!1);w.useEffect(()=>{if(l)try{d(localStorage.getItem(l))}catch{}},[l]);const m=k=>{if(d(k),!!l)try{localStorage.setItem(l,k)}catch{}},v=(T=t==null?void 0:t.primaryEmailAddress)==null?void 0:T.emailAddress,x=[t==null?void 0:t.firstName,t==null?void 0:t.lastName].filter(Boolean).join(" ")||(v==null?void 0:v.split("@")[0])||"Steel Member",y=t!=null&&t.username?`@${t.username}`:v?`@${v.split("@")[0]}`:"",S=n??(e?e.charAt(0).toUpperCase()+e.slice(1):"—"),_=[{label:"Forged on",value:Uft(t==null?void 0:t.createdAt)},{label:"Browser minutes",value:r||!Number.isFinite(s)?"—":Math.round(s).toLocaleString()},{label:"Sessions ran",value:(o==null?void 0:o.toLocaleString())??"—"},{label:"Plan",value:S}],E=async()=>{const k=window.location.href,R={title:"My Steel membership",text:`Steel Member · ${S}`,url:k};if(typeof navigator<"u"&&navigator.share){try{await navigator.share(R)}catch{}return}await navigator.clipboard.writeText(k),Ao({title:"Link copied"})};return c.jsx("div",{className:"flex min-w-px flex-1 flex-col items-center overflow-y-auto bg-[var(--sand-1)]",children:c.jsxs("div",{className:"flex w-full max-w-[1200px] flex-1 flex-col",children:[c.jsxs("div",{className:"flex w-full items-start justify-between gap-[16px] px-[24px] pb-[24px] pt-[40px]",children:[c.jsxs("div",{className:"flex min-w-px flex-col gap-[4px] font-medium",children:[c.jsx("p",{className:"text-[20px] leading-[28px] text-[var(--sand-12)]",children:"Membership"}),c.jsx("p",{className:"text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Your Steel membership card — plan, member number, and stats."})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-[8px]",children:[c.jsxs("button",{type:"button",onClick:E,className:"flex h-[40px] cursor-pointer items-center gap-[8px] rounded-[8px] bg-[var(--sand-4)] px-[12px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)] active:scale-[0.97]",children:[c.jsx(Mft,{size:16}),"Share"]}),c.jsx("button",{type:"button",onClick:()=>p(k=>!k),className:"flex h-[40px] cursor-pointer items-center rounded-[8px] bg-[var(--sand-12)] px-[16px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-11)] active:scale-[0.97]",children:u?"Re-sign card":"Sign membership card"})]})]}),c.jsx("div",{className:"mx-[24px] mb-[24px] flex flex-1 items-center justify-center rounded-[12px] border-[0.5px] border-solid border-[var(--gray-6)] bg-[var(--sand-1)] p-[24px]",children:c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx(Dft,{name:x,handle:y,avatarUrl:t!=null&&t.hasImage?t.imageUrl:void 0,signatureUrl:u??void 0,stats:_}),c.jsx($ft,{open:f,onClose:()=>p(!1),onSave:m})]})})]})})}const U0=25,vye=500,zft="https://docs.steel.dev/overview/sessions-api/dedicated-ips",Vft="We don't have that many dedicated IPs ready right now. Check back shortly or contact [email protected] if this is urgent.",B0=[{id:"us-ny-new-york",label:"New York",detail
504:"New York, NY",country:"US",state:"NY",city:"New York"},{id:"us-ca-los-angeles",label:"California",detail:"Los Angeles, CA",country:"US",state:"CA",city:"Los Angeles"}];function Hft(t){return t.unitPriceCents??vye}function tx(t){return t.status==="active"&&t.releaseReason==="unsubscribe"&&!!t.releaseAt}function xye(t){return t.status==="active"&&!tx(t)}function Gft(t){return t.reduce((e,n)=>e+(tx(n)?0:Hft(n)),0)}function yye({value:t,onChange:e,min:n,max:s,step:r,suffix:i="",disabled:a=!1,ariaLabel:o,hideValue:l=!1,fillClassName:u="bg-[var(--sand-5)] group-hover:bg-[var(--sand-6)]",filledNotchClassName:d="bg-[var(--sand-7)]"}){const f=s>n?(t-n)/(s-n):0,p=[];for(let m=n+r;m<s-1e-9;m+=r)p.push(Math.round(m));return c.jsxs("div",{className:`group relative h-[40px] w-full rounded-[10px] bg-[var(--sand-3)] overflow-hidden select-none ${a?"opacity-60":""}`,children:[c.jsx("div",{className:`absolute inset-y-0 left-0 ${u} transition-[width,background-color] duration-150 [transition-timing-function:var(--ease-out)]`,style:{width:`${f*100}%`}}),p.map(m=>{if(m===t)return null;const v=(m-n)/(s-n),x=v<=.78?1:Math.max(0,1-(v-.78)/.16),y=m<t?d:"bg-[var(--sand-7)]";return c.jsx("span",{className:`absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-[2px] h-[12px] rounded-full pointer-events-none ${y}`,style:{left:`${v*100}%`,opacity:x}},m)}),c.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-[6px] h-[24px] rounded-full bg-[var(--sand-12)] shadow-[0_2px_8px_rgba(0,0,0,0.2)] dark:shadow-[0_2px_8px_rgba(0,0,0,0.5)] opacity-0 group-hover:opacity-100 transition-[opacity,left] duration-150 [transition-timing-function:var(--ease-out)] pointer-events-none",style:{left:`${f*100}%`}}),!l&&c.jsxs("span",{className:"absolute right-[14px] top-1/2 -translate-y-1/2 font-normal text-[14px] leading-none text-[var(--sand-12)] tabular-nums pointer-events-none",children:[t,i]}),c.jsx("input",{type:"range",min:n,max:s,step:r,value:t,disabled:a,onChange:m=>e(parseInt(m.target.value,10)),"aria-label":o,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer disabled:cursor-not-allowed"})]})}const Wft=t=>["proxy-ips",t??"no-org"],qft=(t,e)=>["proxy-ip-availability",t??"no-org",e];function Kft(t){return B0.find(e=>e.id===t)??B0[0]}const Yft=[{id:"mixed",label:"Mixed lifecycle",description:"Active, scheduled unsubscribe, suspended, and provisioning rows."},{id:"empty",label:"Empty",description:"No dedicated IPs leased yet."},{id:"active",label:"Healthy",description:"All dedicated IP leases are active."},{id:"pending",label:"Provisioning",description:"Dedicated IP assignment is still pending."},{id:"loading",label:"Loading",description:"Table skeleton and refreshing state."},{id:"error",label:"Error",description:"Refresh failure with stale data."}];function Zft(t){return Yft.some(e=>e.id===t)}function bye(t){return`${t} dedicated IP${t===1?"":"s"}`}function Mne(t){const e=t/100;return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function mT(t,e){return t instanceof Error&&t.message?t.message:typeof t=="object"&&t!==null&&"message"in t?String(t.message):e}function Xft(t){if(typeof t=="object"&&t!==null&&"status"in t)return Number(t.status)}function Qft(t){const e=mT(t,"Please try again later"),n=e.toLowerCase();return Xft(t)===409||n.includes("inventory")||n.includes("available capacity")?Vft:e}function Sye(t){return t.status==="reserved"||t.status==="available"}function Dne(t){if(tx(t))return"Scheduled unsubscribe";switch(t.status){case"active":return"Active";case"suspended":return"Suspended";case"available":case"reserved":return"Provisioning";case"rotating":return"Updating";case"deleting":return"Releasing";case"deleted":return"Released";case"failed":return"Action needed";default:return"Unknown"}}function One(t){return[t.city,t.state].filter(Boolean).join(", ")||"Location pending"}function Jft(t){return t.status==="active"&&t.releaseReason!=="unsubscribe"}function eht(t){return tx(t)}function tht(t,e){const n=Number(t);return t.trim()?!Number.isInteger(n)||n<=0?"Enter a positive whole number.":n>U0?`Self-serve leases are limited to ${U0} dedicated IPs.`:e!==void 0&&n>e?e>0?`Only ${bye(e)} available in this location.`:"No dedicated IP inventory is available in this location right now.":null:"Enter a quantity."}function zE(t,e){var n;return((n=t==null?void 0:t.data)==null?void 0:n.available)===0}function nht(t,e){var n,s;return((n=t==null?void 0:t.data)==null?void 0:n.available)===0?"Coming soon":t!=null&&t.isLoading?"Checking stock...":t!=null&&t.isError?"Stock count unavailable":((s=t==null?void 0:t.data)==null?void 0:s.available)!==void 0?`${t.data.available} available now`:"Stock count loads when this dialog opens"}async function sht(t){var n;const e=await iXe({path:{identifier:t}});if(e.error)throw Object.assign(e.error,{status:(n=e.response)==null?void 0:n.status});if(!e.data)throw new Error("No dedicated IP unsubscribe response returned from API");return e.data}async function rht(t){var n;const e=await aXe({path:{identifier:t}});if(e.error)throw Object.assign(e.error,{status:(n=e.response)==null?void 0:n.status});if(!e.data)throw new Error("No dedicated IP unsubscribe recovery response returned from API");return e.data}function iht({kind:t,onLease:e}){return t==="checking"?c.jsxs("div",{className:"bg-[var(--sand-2)] flex flex-col items-center justify-center gap-[12px] rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] w-full",children:[c.jsx("div",{className:"h-[16px] w-[180px] animate-pulse rounded-[6px] bg-[var(--sand-4)]"}),c.jsx("div",{className:"h-[12px] w-[260px] animate-pulse rounded-[6px] bg-[var(--sand-4)]"})]}):t==="hobby"?c.jsxs("div",{className:"bg-[var(--sand-2)] flex flex-col items-center justify-center gap-[24px] rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] w-full text-center",children:[c.jsxs("div",{className:"flex flex-col gap-[8px]",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Dedicated Networks isn't available on Hobby"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Upgrade to a paid plan to lease dedicated IPs for routing Steel browser sessions."})]}),c.jsx(Hn,{to:"/settings/billing/plans",className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Upgrade plan"})]}):c.jsxs("div",{className:"bg-[var(--sand-2)] flex flex-col items-center justify-center gap-[24px] rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] w-full text-center",children:[c.jsx(Nh,{size:20,className:"size-[20px] text-[var(--sand-12)]"}),c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-9)]",children:["You haven't leased any dedicated IPs yet.",c.jsx("br",{}),e?c.jsx("button",{type:"button",onClick:e,className:"cursor-pointer text-[var(--sand-9)] underline decoration-dotted underline-offset-[3px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:"Lease dedicated IPs"}):"Lease dedicated IPs"," ","into your Dedicated Network to route Steel sessions through a stable, Steel-managed pool."]})]})}const xy="flex items-center min-w-px h-[44px] px-[16px] bg-[var(--sand-3)] text-[var(--sand-12)] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",bc="flex items-center min-w-px h-[44px] px-[16px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",aht="flex items-center justify-center h-[44px] w-[44px] shrink-0 bg-[var(--sand-3)] border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",$ne="flex items-center justify-center h-[44px] w-[44px] shrink-0 border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",a8="flex-none w-[170px]",o8="flex-1 min-w-0",l8="flex-none w-[230px]",c8="flex-none w-[160px]",u8="flex-none w-[210px]";function n0({w:t="100%",h:e=12,rounded:n="rounded-[6px]"}){return c.jsx("div",{className:`animate-pulse bg-[var(--sand-4)] ${n}`,style:{width:t,height:e}})}function Fne(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:15,height:15,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,
504children:[c.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2.5"}),c.jsx("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function VE({label:t,value:e,loading:n}){return c.jsxs("div",{className:"bg-[var(--sand-3)] border-[0.5px] border-solid border-[var(--sand-6)] inline-flex items-center gap-[8px] h-[40px] px-[14px] rounded-[8px]",children:[c.jsxs("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)] whitespace-nowrap",children:[t,":"]}),n?c.jsx("span",{className:"animate-pulse bg-[var(--sand-4)] rounded-[5px] h-[16px] w-[36px]"}):c.jsx("span",{className:"font-semibold text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:e})]})}function oht({ip:t}){return xye(t)?c.jsxs("span",{className:"flex items-center gap-[8px] text-[var(--green-11)] dark:text-[#34d399]",children:[c.jsx("span",{className:"size-[12px] rounded-full border-2 border-[var(--green-9)] dark:border-[#34d399]"}),"Active"]}):Sye(t)?c.jsxs("span",{className:"flex items-center gap-[8px] text-[var(--sand-8)]",children:[c.jsx("span",{className:"size-[12px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-10)] animate-spin"}),Dne(t)]}):tx(t)?c.jsxs("span",{className:"flex items-center gap-[8px] text-[var(--yellow-11)] dark:text-[#f0c000]",children:[c.jsx("span",{className:"size-[12px] rounded-full border-2 border-[var(--yellow-6)] dark:border-[#493c00] border-t-[var(--yellow-11)] dark:border-t-[#f0c000] animate-spin"}),"Unsubscribing"]}):t.status==="suspended"?c.jsxs("span",{className:"flex items-center gap-[8px] text-[var(--red-11)] dark:text-[#f87171]",children:[c.jsx("span",{className:"size-[12px] rounded-full border-2 border-[var(--red-9)] dark:border-[#f87171]"}),"Suspended"]}):c.jsx("span",{className:"text-[var(--sand-11)]",children:Dne(t)})}function lht(){var _n,Dt,nn,fn,Tt;const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),[s]=Po(),[r,i]=w.useState(!1),[a,o]=w.useState("1"),[l,u]=w.useState("us-ny-new-york"),[d,f]=w.useState(null),[p,m]=w.useState(null),[v,x]=w.useState(null),[y,S]=w.useState({}),_=!1,E=_,T=s.get("scenario");Zft(T);const k=t&&!!e&&!!n,R=Wft(n),I=to.orgDetails(n),A=rs({queryKey:R,queryFn:async()=>{const Ie=await Gme({});if(Ie.error)throw Ie.error;if(!Ie.data)throw new Error("No dedicated IP lease data returned from API");return Ie.data},enabled:k}),L=rs({queryKey:I,queryFn:async()=>{const Ie=await Ume({});if(Ie.error)throw Ie.error;if(!Ie.data)throw new Error("No organization details returned from API");return Ie.data},enabled:k,staleTime:6e4}),j=eFe({queries:B0.map(Ie=>({queryKey:qft(n,Ie.id),queryFn:async()=>{var ie;const Z=await sXe({query:{country:Ie.country,state:Ie.state,city:Ie.city}});if(Z.error)throw Object.assign(Z.error,{status:(ie=Z.response)==null?void 0:ie.status});if(!Z.data)throw new Error("No dedicated IP availability returned from API");return Z.data},enabled:k&&r,staleTime:3e4}))}),F=B0.map((Ie,Z)=>({location:Ie,query:j[Z]})),O=F.length>0&&F.every(Ie=>zE(Ie.query)),M=F.find(Ie=>Ie.location.id===l),U=((_n=F.find(Ie=>!zE(Ie.query)))==null?void 0:_n.location)??B0[0],G=zE(M==null?void 0:M.query)?U.id:l,$=Kft(G),V=((Dt=F.find(Ie=>Ie.location.id===G))==null?void 0:Dt.query)??(M==null?void 0:M.query),B=Bi({mutationFn:async({quantity:Ie,location:Z})=>{var le,Ee;const ie=await rXe({body:{quantity:Ie,country:Z.country,state:Z.state,city:Z.city}});if(ie.error)throw Object.assign(ie.error,{status:(le=ie.response)==null?void 0:le.status});if(!((Ee=ie.data)!=null&&Ee.url))throw new Error("No checkout URL returned from API");return ie.data},onSuccess:Ie=>{window.location.assign(Ie.url)},onError:Ie=>{const Z=Qft(Ie);f(Z),Bn({title:"Error starting checkout"})}}),q=Bi({mutationFn:async Ie=>sht(Ie),onSuccess:async Ie=>{await Pn.invalidateQueries({queryKey:R}),m(null),Ao({title:Ie.releaseAt?`Dedicated IP unsubscribe scheduled — routing until ${Tne(Ie.releaseAt)}`:"Dedicated IP unsubscribe scheduled at end of billing period",actionLabel:"Close"})},onError:Ie=>{Bn({title:mT(Ie,"Error unsubscribing dedicated IP")})}}),z=Bi({mutationFn:async Ie=>rht(Ie),onSuccess:async Ie=>{await Pn.invalidateQueries({queryKey:R}),x(null),na({title:`Unsubscribe undone — ${Ie.ipAddress??"this dedicated IP"} renews next billing period`,shapes:!1})},onError:Ie=>{Bn({title:mT(Ie,"Error undoing unsubscribe")})}}),D=((nn=A.data)==null?void 0:nn.proxyIps)??[],K=D.filter(xye).length,Y=D.filter(Ie=>Ie.status==="suspended").length,J=D.filter(tx).length,ne=Gft(D),Q=Number(a),ee=(fn=V==null?void 0:V.data)==null?void 0:fn.available,te=tht(a,ee),ue=te?0:
504Q*vye,ye=B.isPending,je=ye||O,Re=q.isPending,me=z.isPending,Ce=A.isLoading,Xe=A.isFetching,he=A.isError,De=L.isLoading,Ge=((Tt=L.data)==null?void 0:Tt.plan)==="hobby",Je=mT(A.error,"Please try again later"),Le=ye||De||Ge||O,qe=De?"checking":Ge?"hobby":"paid";function et(){f(null),i(!0)}function Ct(Ie){te||!Number.isInteger(Ie)||Ie<=0||ye||O||Ge||(f(null),B.mutate({quantity:Ie,location:$}))}function Ke(){A.refetch()}function dt(){p&&q.mutate(p.identifier)}function Xt(){v&&z.mutate(v.identifier)}return c.jsxs("div",{className:"relative bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"Network"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Route Steel sessions through a leased, dedicated IP. Steel manages the infra, so proxy credentials aren't exposed."})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[c.jsxs("a",{href:zft,target:"_blank",rel:"noreferrer",className:"cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[6px] h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:["Docs",c.jsx(La,{size:20,className:"text-[var(--sand-9)]"})]}),!Ge&&c.jsx("button",{type:"button",disabled:Le,onClick:et,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:brightness-100",children:"Lease dedicated IPs"})]})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] p-[24px] w-full",children:[he&&c.jsxs("div",{className:"flex gap-[16px] items-center justify-between w-full bg-[var(--yellow-3)] dark:bg-[#2c2100] border-[0.5px] border-solid border-[var(--yellow-6)] dark:border-[#493c00] rounded-[12px] px-[24px] py-[16px]",children:[c.jsxs("div",{className:"flex flex-col gap-[2px] min-w-px",children:[c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--yellow-11)] dark:text-[#f0c000]",children:D.length>0?"Could not refresh dedicated IP leases. Showing the last loaded list.":"Could not load dedicated IP leases."}),c.jsx("p",{className:"font-medium text-[13px] leading-[18px] text-[var(--yellow-11)] dark:text-[#b8901f]",children:Je})]}),c.jsx("button",{type:"button",disabled:Xe,onClick:Ke,className:"shrink-0 cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[rgba(240,192,0,0.12)] hover:bg-[rgba(240,192,0,0.2)] flex h-[36px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--yellow-11)] dark:text-[#f0c000] whitespace-nowrap disabled:opacity-60 disabled:cursor-not-allowed",children:"Retry"})]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:"Leased dedicated IPs"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Dedicated IP leases in this workspace's dedicated network."})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[J>0&&c.jsx(VE,{label:"Scheduled",value:String(J),loading:Ce}),Y>0&&c.jsx(VE,{label:"Suspended",value:String(Y),loading:Ce}),c.jsx(VE,{label:"Active IPs",value:String(K),loading:Ce}),c.jsx(VE,{label:"Cost / month",value:Mne(ne),loading:Ce})]})]}),Ce||D.length>0?c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${xy} ${a8}`,children:"IP"}),c.jsx("div",{className:`${xy} ${o8} border-l-[0.5px]`,children:"Location"}),c.jsx("div",{className:`${xy} ${l8} border-l-[0.5px]`,children:"ID"}),c.jsx("div",{className:`${xy} ${c8} border-l-[0.5px]`,children:"Status"}),c.jsx("div",{className:`${xy} ${u8} border-l-[0.5px]`,children:"Leased"}),c.jsx("div",{className:aht})]}),Ce?Array.from({length:5}).map((Ie,Z)=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${bc} ${a8}`,children:c.jsx(n0,{w:"100px"})}),c.jsx("div",{className:`${bc} ${o8} border-l-[0.5px]`,children:c.jsx(n0,{w:"160px"})}),c.jsx("div",{className:`${bc} ${l8} border-l-[0.5px]`,children:c.jsx(n0,{w:"150px"})}),c.jsx("div",{className:`${bc} ${c8}
504 border-l-[0.5px]`,children:c.jsx(n0,{w:"84px",h:20,rounded:"rounded-[999px]"})}),c.jsx("div",{className:`${bc} ${u8} border-l-[0.5px]`,children:c.jsx(n0,{w:"150px"})}),c.jsx("div",{className:$ne,children:c.jsx(n0,{w:"20px",h:20,rounded:"rounded-full"})})]},Z)):D.map(Ie=>{const Z=Sye(Ie),ie=Jft(Ie),le=eht(Ie);return c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${bc} ${a8} ${Z?"text-[var(--sand-8)]":"text-[var(--sand-12)]"} tracking-[0.01em] overflow-hidden`,children:Z||!Ie.ipAddress?"Pending":c.jsxs("button",{type:"button",onClick:()=>Ja(Ie.ipAddress,"Dedicated IP"),"aria-label":`Copy dedicated IP ${Ie.ipAddress}`,className:"group flex items-center gap-[8px] min-w-0 cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:[c.jsx("span",{className:"truncate min-w-0",children:Ie.ipAddress}),c.jsx("span",{className:"shrink-0 text-[var(--sand-8)] group-hover:text-[var(--sand-11)]",children:c.jsx(Fne,{})})]})}),c.jsx("div",{className:`${bc} ${o8} border-l-[0.5px] ${Z?"text-[var(--sand-8)]":"text-[var(--sand-11)]"} overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:Z?"Pending assignment":Ie.country?`${Ie.country} · ${One(Ie)}`:One(Ie)})}),c.jsx("div",{className:`${bc} ${l8} border-l-[0.5px] text-[var(--sand-11)] overflow-hidden`,children:c.jsxs("button",{type:"button",onClick:()=>Ja(Ie.identifier,"Dedicated IP ID"),"aria-label":`Copy dedicated IP ID ${Ie.identifier}`,className:"group flex items-center gap-[8px] min-w-0 cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:[c.jsx("span",{className:"truncate min-w-0 tracking-[0.01em]",children:Ie.identifier}),c.jsx("span",{className:"shrink-0 text-[var(--sand-8)] group-hover:text-[var(--sand-11)]",children:c.jsx(Fne,{})})]})}),c.jsx("div",{className:`${bc} ${c8} border-l-[0.5px]`,children:c.jsx(oht,{ip:Ie})}),c.jsx("div",{className:`${bc} ${u8} border-l-[0.5px] ${Z?"text-[var(--sand-8)]":"text-[var(--sand-11)]"}`,children:Z?"N/A":zm(Ie.createdAt)}),c.jsx("div",{className:$ne,children:le?c.jsx("button",{type:"button","aria-label":`Resubscribe ${Ie.identifier}`,disabled:me,onClick:()=>x(Ie),className:"cursor-pointer flex items-center justify-center size-[32px] rounded-full text-[var(--yellow-11)] dark:text-[#f0c000] hover:text-[var(--yellow-12)] dark:hover:text-[#ffd633] hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:opacity-50 disabled:cursor-not-allowed",children:c.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M8 5.5v13a1 1 0 0 0 1.54.84l10-6.5a1 1 0 0 0 0-1.68l-10-6.5A1 1 0 0 0 8 5.5Z"})})}):ie?c.jsx("button",{type:"button","aria-label":`Unsubscribe ${Ie.identifier}`,disabled:Re,onClick:()=>m(Ie),className:"cursor-pointer flex items-center justify-center size-[32px] rounded-full text-[var(--sand-10)] hover:text-danger hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:opacity-50 disabled:cursor-not-allowed",children:c.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"currentColor","aria-hidden":!0,children:c.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2.5"})})}):null})]},Ie.identifier)})]}):c.jsx(iht,{kind:qe,onLease:qe==="paid"?et:void 0}),E]})]}),_,c.jsx(ss,{open:r,onClose:()=>{ye||i(!1)},noIcon:!0,title:"Lease dedicated IPs",subtitle:`Lease up to ${U0} dedicated IPs for your Dedicated Network.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>i(!1),disabled:ye,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"button",disabled:!!te||Le,onClick:()=>Ct(Q),className:He("flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)]",te||Le?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95"),children:ye?"Opening checkout…":"Continue to checkout"})]}),children:c.jsxs("div",{className:"flex flex-col gap-[20px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Location"}),c.jsx("div",{className:"grid grid-cols-2 gap-[12px]",children:B0.map(Ie=>{var ke;const Z=(ke=F.find(Ae=>Ae.location.id===Ie.id))==null?void 0:ke.query,ie=G===Ie.id,le=zE(Z),Ee=nht(Z);return c.jsxs("button",{type:"button",disabled:le,onClick:()=>{le||(u(Ie.id),f(null))},className:He("flex items-start justify-between gap-[12px] p-[16px] rounded-[12px] border-solid text-left transition-colors duration-150 [transition-timing-function:var(--ease-out)]",ie?"border-[1px] border-[var(--sand-12)] bg-[var(--sand-4)]":le?"border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] opacity-60 cursor-default":"border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)] hover:bg-[var(--sand-3)] cursor-pointer"),children:[c.jsxs("div",{className:"flex flex-col gap-[4px] min-w-px",children:[c.jsx("span",{className:He("font-medium text-[14px] leading-[20px]",le?"text-[var(--sand-11)]":"text-[var(--sand-12)]"),children:Ie.label}),c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:Ie.detail}),c.jsx("span",{className:He("font-medium text-[14px] leading-[20px]",le?"text-[var(--sand-8)]":"text-[var(--sand-12)]",(Z==null?void 0:Z.isError)&&"text-[var(--yellow-11)] dark:text-[#f0c000]"),children:Ee})]}),c.jsx("span",{className:He("shrink-0 mt-[2px] size-[18px] rounded-full border-[1.5px] border-solid flex items-center justify-center",ie?"bg-[var(--sand-6)] border-[var(--sand-6)]":"border-[var(--sand-6)]"),children:ie&&c.jsx("span",{className:"size-[8px] rounded-full bg-[var(--sand-12)]"})})]},Ie.id)})})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Quantity"}),c.jsx(yye,{value:Number.isInteger(Q)&&Q>
504=1?Math.min(Q,U0):1,onChange:Ie=>{o(String(Ie)),f(null)},min:1,max:U0,step:1,disabled:je,ariaLabel:"Quantity"}),c.jsx("p",{className:He("font-medium text-[13px] leading-[18px] text-[var(--sand-10)]",te&&"text-danger"),children:te||c.jsxs(c.Fragment,{children:["Need more than ",U0," dedicated IPs? Contact"," ",c.jsx("a",{href:"mailto:[email protected]",className:"text-[var(--sand-12)] underline decoration-dotted underline-offset-[3px]",children:"[email protected]"})]})})]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:te?"—":bye(Q)}),c.jsxs("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:[Mne(ue),"/month"]})]}),d&&c.jsx("p",{className:"font-medium text-[13px] leading-[18px] text-danger",children:d})]})}),c.jsx(ss,{open:!!p,onClose:()=>{Re||m(null)},noIcon:!0,title:"Unsubscribe dedicated IP?",subtitle:`This dedicated IP (${(p==null?void 0:p.ipAddress)??"pending"}) will keep routing Steel sessions until the end of your current billing period, then it will be released from your Dedicated Network.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>m(null),disabled:Re,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"button",onClick:dt,disabled:!p||Re,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--red-3)] dark:bg-[#3a1d20] hover:bg-[var(--red-4)] dark:hover:bg-[#4a2429] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--red-11)] dark:text-[#f87171] disabled:opacity-60 disabled:cursor-not-allowed",children:Re?"Unsubscribing…":"Unsubscribe"})]})}),c.jsx(ss,{open:!!v,onClose:()=>{me||x(null)},noIcon:!0,title:"Undo unsubscribe?",subtitle:v!=null&&v.releaseAt?`This dedicated IP (${v.ipAddress??"pending"}) will stay in your Dedicated Network and renew next billing period. Previously scheduled release: ${Tne(v.releaseAt)}.`:`This dedicated IP (${(v==null?void 0:v.ipAddress)??"pending"}) will stay in your Dedicated Network and renew next billing period.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>x(null),disabled:me,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"button",onClick:Xt,disabled:!v||me,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--yellow-3)] dark:bg-[#2c2100] hover:bg-[var(--yellow-4)] dark:hover:bg-[#3a2c00] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--yellow-11)] dark:text-[#f0c000] disabled:opacity-60 disabled:cursor-not-allowed",children:me?"Undoing…":"Undo unsubscribe"})]})}),c.jsx("div",{className:"sr-only","aria-live":"polite",children:ye?"Opening dedicated IP lease checkout.":me?"Undoing dedicated IP unsubscribe.":Xe?"Refreshing dedicated IP list.":""})]})}function cht(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M8 15.25V21.0363C8 21.5938 8.58673 21.9564 9.08541 21.7071L11.6646 20.4175C11.8757 20.3119 12.1243 20.3119 12.3354 20.4175L14.9146 21.7071C15.4133 21.9564 16 21.5938 16 21.0363V15.25M19 9C19 12.866 15.866 16 12 16C8.13401 16 5 12.866 5 9C5 5.13401 8.13401 2 12 2C15.866 2 19 5.13401 19 9Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function wye(){return N4("referrals")??!1}const uht={"api-keys":RS,network:Nh,projects:U7,members:z7,organization:r2,w
504allet:NS,usage:V7,limits:AS,plans:P4,referrals:yd,profile:U1,membership:cht,security:B7};function _ye({name:t,size:e=20}){const n=uht[t];return c.jsx(n,{size:e,className:"shrink-0"})}function Al({iconName:t,label:e,active:n,onClick:s,badge:r}){return c.jsxs("button",{type:"button",onClick:s,className:He("flex w-full cursor-pointer items-center gap-2 rounded-lg p-2 text-left transition-colors duration-150",n?"bg-[var(--sand-3)] text-[var(--sand-12)]":"text-[var(--sand-10)] hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]"),children:[c.jsx(_ye,{name:t}),c.jsx("span",{className:"text-[14px] font-medium leading-5",children:e}),r&&c.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-[rgba(245,217,10,0.16)] px-[8px] py-[2px] text-[12px] font-medium leading-[16px] text-[var(--yellow-11)] dark:text-[#f5d90a]",children:r})]})}function T5({path:t,label:e,on:n,navigate:s,count:r}){return c.jsxs("button",{type:"button",onClick:()=>s(t),className:He("flex w-full cursor-pointer items-center gap-2 rounded-lg p-2 text-left text-[14px] font-medium leading-5 transition-colors duration-150",n?"bg-[var(--sand-3)] text-[var(--sand-12)]":"text-[var(--sand-10)] hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]"),children:[c.jsx("span",{className:"min-w-px flex-1 truncate",children:e}),r!=null&&c.jsx("span",{className:He("inline-flex h-[20px] min-w-[20px] shrink-0 items-center justify-center rounded-[999px] px-[6px] text-[11px] font-medium leading-[20px]",n?"bg-[var(--sand-6)] text-[var(--sand-12)]":"bg-[var(--sand-4)] text-[var(--sand-11)]"),children:r})]})}function Eye({iconName:t,label:e,path:n,active:s,expanded:r,onExpand:i,children:a}){return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("button",{type:"button",onClick:()=>i(n),className:He("flex w-full cursor-pointer items-center justify-between gap-2 rounded-lg p-2 text-left transition-colors duration-150",s?"bg-[var(--sand-3)] text-[var(--sand-12)]":"text-[var(--sand-10)] hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]"),children:[c.jsxs("span",{className:"flex min-w-px items-center gap-2",children:[c.jsx(_ye,{name:t}),c.jsx("span",{className:"text-[14px] font-medium leading-5",children:e})]}),c.jsx(u1,{size:20,className:He("shrink-0 text-[var(--sand-10)] transition-transform duration-200 ease-out",r&&"rotate-180")})]}),c.jsx("div",{className:"grid transition-[grid-template-rows] [transition-duration:260ms] ease-out",style:{gridTemplateRows:r?"1fr":"0fr"},children:c.jsx("div",{className:"min-h-0 overflow-hidden",children:c.jsx("div",{className:"ml-[18px] mt-2 flex flex-col gap-2 border-l-[0.5px] border-[var(--sand-6)] pl-[14px]",children:a})})})]})}const v9="/settings/organization/organization-members",Cye="/settings/organization/organization-members/invites";function dht({active:t,subActive:e,navigate:n}){const[s,r]=w.useState(t);w.useEffect(()=>r(t),[t]);const{memberships:i,invitations:a}=Mo({memberships:{pageSize:100,keepPreviousData:!0},invitations:{pageSize:100,keepPreviousData:!0}});return c.jsxs(Eye,{iconName:"members",label:"Members",path:v9,active:t,expanded:s,onExpand:o=>{r(!0),n(o)},children:[c.jsx(T5,{path:v9,label:"Organization members",on:e==="members",navigate:n,count:i==null?void 0:i.count}),c.jsx(T5,{path:Cye,label:"Invited members",on:e==="invites",navigate:n,count:a==null?void 0:a.count})]})}const Une="/settings/billing/usage",fht="/settings/billing/usage/proxy";function hht({active:t,subActive:e,navigate:n}){const[s,r]=w.useState(t);return w.useEffect(()=>r(t),[t]),c.jsxs(Eye,{iconName:"usage",label:"Usage",path:Une,active:t,expanded:s,onExpand:i=>{r(!0),n(i)},children:[c.jsx(T5,{path:Une,label:"Overview",on:e==="overview",navigate:n}),c.jsx(T5,{path:fht,label:"Proxy & Network",on:e==="proxy",navigate:n})]})}function pht(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),s=di(),r=Gs(),i=wye(),a=xF(),[o,l]=w.useState("profile"),u=L4();w.useEffect(()=>{if(!t||!e||!n)return;(async()=>{try{await Pn.prefetchQuery({queryKey:to.apiKeys(n),queryFn:async()=>{const{error:p,data:m}=await $me({});if(p)throw p;return m}})}catch(p){console.error("Failed to prefetch API keys:",p)}})()},[t,e,n]);const d={"/settings/profile":"profile","/settings/membership":"membership","/settings/organization":"organization","/settings/organization/organization-members":"members","/settings/organization/organization-members/invites":"members","/settings/profile#/security":"security","/settings/usage":"legacy-usage","/settings/api-keys":"api-keys","/settings/network":"network","/settings/projects":"projects","/settings/billing/wallet":"billing-wallet","/settings/billing/usage":"usage","/settings/billing/usage/proxy":"proxy-usage","/settings/billing/limits":"billing-limits","/settings/billing/plans":"billing-plans","/settings/referrals":"referrals"};return w.useEffect(()=>{l(d[r.pathname+r.hash]??"profile")},[r.pathname,r.hash]),u?c.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pt-[40px]",children:c.jsx(Jl,{})}):c.jsxs("div",{className:"flex min-w-0 overflow-hidden flex-1 w-full",children:[c.jsxs(wt.div,{initial:{x:-40,opacity:0,filter:"blur(8px)"},animate:{x:0,opacity:1,filter:"blur(0px)"},transition:{type:"spring",bounce:.2,duration:.4},className:"flex h-full min-h-0 w-[18.5rem] shrink-0 flex-col overflow-y-auto border-r-[0.5px] border-[var(--sand-6)]",children:[c.jsxs("div",{className:"flex flex-col gap-2 border-b-[0.5px] border-[var(--sand-6)] p-4",children:[c.jsx(Al,{iconName:"projects",label:"Projects",active:o==="projects",onClick:()=>s("/settings/projects")}),c.jsx(Al,{iconName:"api-keys",label:"API Keys",active:o==="api-keys",onClick:()=>s("/settings/api-keys")}),c.jsx(Al,{iconName:"network",label:"Network",active:o==="network",onClick:()=>s("/settings/network")}),c.jsx(Al,{iconName:"organization",label:"Organization",active:o==="organization",onClick:()=>s("/settings/organization")}),c.jsx(dht,{active:o==="members",subActive:r.pathname===Cye?"invites":r.pathname===v9?"members":null,navigate:s})]}),c.jsxs("div",{className:"flex flex-col gap-2 border-b-[0.5px] border-[var(--sand-6)] p-4",children:[c.jsx(Al,{iconName:"wallet",label:"Wallet",active:o==="billing-wallet",onClick:()=>s("/settings/billing/wallet")}),a?c.jsx(hht,{active:o==="usage"||o==="proxy-usage",subActive:o==="proxy-usage"?"proxy":o==="usage"?"overview":null,navigate:s}):c.jsx(Al,{iconName:"usage",label:"Usage",active:o==="usage",onClick:()=>s("/settings/billing/usage")}),c.jsx(Al,{iconName:"limits",label:"Limits & alerts",active:o==="billing-limits",onClick:()=>s("/settings/billing/limits")}),c.jsx(Al,{iconName:"plans",label:"Plans",active:o==="billing-plans",onClick:()=>s("/settings/billing/plans")}),i&&c.jsx(Al,{iconName:"referrals",label:"Referrals",active:o==="referrals",onClick:()=>s("/settings/referrals")})]}),c.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[c.jsx(Al,{iconName:"profile",label:"Profile",active:o==="profile",onClick:()=>s("/settings/profile")}),c.jsx(Al,{iconName:"security",label:"Security",active:o==="security",onClick:()=>s("/settings/profile#/security")})]})]},"settings-sidebar"),c.jsx("div",{className:"flex min-w-0 flex-col flex-1",children:c.jsx(Jl,{})})]})}function HE(t,e){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):e}const Ko="flex items-center min-w-px h-[44px] px-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",mht={Development:"bg-[var(--yellow-3)] dark:bg-[#2c2100] border-[var(--yellow-6)] dark:border-[#493c00] text-[var(--yellow-11)] dark:text-[#f0c000]",Production:"bg-[var(--green-3)] dark:bg-[#0c2417] border-[var(--green-6)] dark:border-[#16482c] text-[var(--green-11)] dark:text-[#34d399]"},d8="cursor-pointer flex items-center justify-center size-[32px] rounded-full transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent",wU={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px]"},f8="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]",GE="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",ght="flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)]",vht="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed";function h8(t){return`${ght} ${t?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95"}`}function WE({w:t="100%",h:e=12,rounded:n="rounded-[6px]"}){return c.jsx("div",{className:`animate-pulse bg-[var(--sand-4)] ${n}`,style:{width:t,height:e}})}function xht(){return c.jsx("svg",{...wU,children:c.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function yht(){return c.jsxs("svg",{...wU,children:[c.jsx("path",{d:"M12 20h9"}),c.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"})]})}function bht(){return c.jsxs("svg",{...wU,children:[c.jsx("path",{d:"M3 6h18"}),c.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]})}function Sht(){const{orgRole:t}=zt(),{projects:e,projectsQuery:n,selectedProjectId:s,setSelectedProjectId:r,clearSelectedProject:i}=lc(),a=t==="org:admin",[o,l]=w.useState(!1),[u,d]=w.useState(""),[f,p]=w.useState(!1),[m,v]=w.useState(null),[x,y]=w.useState(""),[S,_]=w.useState(null),[E,T]=w.useState(null),[k,R]=w.useState("");w.useEffect(()=>{y((m==null?void 0:m.name)??"")},[m]);const I=async()=>{await Pn.invalidateQueries({queryKey:["projects"]})},A=Bi({mutationFn:async()=>{const $=await Hme({body:{name:u,isProduction:f}});if($.error)throw $.error;return $.data},onSuccess:async $=>
504{$&&r($.id),await I(),l(!1),d(""),p(!1)},onError:$=>{Bn({title:HE($,"Error creating project")})}}),L=Bi({mutationFn:async({projectId:$,name:V})=>{const B=await tXe({path:{id:$},body:{name:V}});if(B.error)throw B.error;return B.data},onSuccess:async()=>{await I(),v(null)},onError:$=>{Bn({title:HE($,"Error renaming project")})}}),j=Bi({mutationFn:async $=>{const V=await nXe({path:{id:$}});if(V.error)throw V.error;return V.data},onSuccess:async()=>{await I(),_(null)},onError:$=>{Bn({title:HE($,"Error promoting project")})}}),F=Bi({mutationFn:async $=>{const V=await eXe({path:{id:$.id}});if(V.error)throw V.error;return $},onSuccess:async $=>{$.id===s&&i(),await I(),T(null),R("")},onError:$=>{Bn({title:HE($,"Error deleting project")})}}),O=!a||!u.trim()||A.isPending,M=!a||!x.trim()||L.isPending,U=!!E&&k.trim()===E.name,G=()=>{d(""),p(!1),l(!0)};return c.jsxs("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"Projects"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage project boundaries, environments, and the organization default."})]}),a&&c.jsx("button",{type:"button",onClick:G,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-[var(--sand-1)] shrink-0",children:"Create project"})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] p-[24px] w-full",children:[!a&&c.jsx("div",{className:"rounded-[12px] bg-[var(--yellow-3)] dark:bg-[#2c2100] border-[0.5px] border-solid border-[var(--yellow-6)] dark:border-[#493c00] px-[16px] py-[12px] font-medium text-[14px] leading-[20px] text-[var(--yellow-11)] dark:text-[#f0c000]",children:"Project settings are read-only for your role. Ask an organization admin to create, rename, promote, or delete projects."}),c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${Ko} flex-1 bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Project name"}),c.jsx("div",{className:`${Ko} flex-none w-[160px] border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Environment"}),c.jsx("div",{className:`${Ko} flex-1 border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Created"}
504),a&&c.jsx("div",{className:`${Ko} flex-none w-[136px] border-l-[0.5px] bg-[var(--sand-3)] justify-end`})]}),n.isLoading&&Array.from({length:4}).map(($,V)=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${Ko} flex-1`,children:c.jsx(WE,{w:"140px"})}),c.jsx("div",{className:`${Ko} flex-none w-[160px] border-l-[0.5px]`,children:c.jsx(WE,{w:"84px",h:20,rounded:"rounded-[999px]"})}),c.jsx("div",{className:`${Ko} flex-1 border-l-[0.5px]`,children:c.jsx(WE,{w:"150px"})}),a&&c.jsx("div",{className:`${Ko} flex-none w-[136px] border-l-[0.5px] justify-end`,children:c.jsx(WE,{w:"20px",h:20,rounded:"rounded-full"})})]},`sk-${V}`)),!n.isLoading&&e.map($=>{var z;const V=$.isProduction?"Production":"Development",B=j.isPending&&j.variables===$.id,q=F.isPending&&((z=F.variables)==null?void 0:z.id)===$.id;return c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${Ko} flex-1 text-[var(--sand-12)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:$.name})}),c.jsx("div",{className:`${Ko} flex-none w-[160px] border-l-[0.5px]`,children:c.jsx("span",{className:`flex h-[20px] items-center px-[8px] rounded-[999px] font-medium text-[12px] leading-[20px] ${mht[V]}`,children:V})}),c.jsx("div",{className:`${Ko} flex-1 border-l-[0.5px] text-[var(--sand-12)]`,children:zm($.createdAt)}),a&&c.jsxs("div",{className:`${Ko} flex-none w-[136px] border-l-[0.5px] justify-end gap-[8px]`,children:[!$.isProduction&&c.jsx("button",{type:"button","aria-label":`Promote ${$.name} to production`,disabled:B,onClick:()=>_($),className:`${d8} text-[var(--green-11)] dark:text-[#34d399] hover:text-[var(--green-12)] dark:hover:text-[#5ee0aa] hover:bg-[var(--sand-4)]`,children:c.jsx(xht,{})}),c.jsx("button",{type:"button","aria-label":`Rename ${$.name}`,onClick:()=>v($),className:`${d8} text-[var(--sand-11)] hover:text-[var(--sand-12)] hover:bg-[var(--sand-4)]`,children:c.jsx(yht,{})}),c.jsx("button",{type:"button","aria-label":`Delete ${$.name}`,disabled:$.isDefault||q,title:$.isDefault?"Default project cannot be deleted":void 0,onClick:()=>{T($),R("")},className:`${d8} text-[var(--sand-10)] hover:text-danger hover:bg-[var(--sand-4)]`,children:c.jsx(bht,{})})]})]},$.id)}),!n.isLoading&&!n.isError&&e.length===0&&c.jsx("div",{className:"flex items-center justify-center p-[24px] font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No projects yet."}),n.isError&&c.jsx("div",{className:"flex items-center justify-center p-[24px] font-medium text-[14px] leading-[20px] text-danger",children:"Error fetching projects."})]})]})]}),c.jsx(ss,{open:o,onClose:()=>{A.isPending||l(!1)},noIcon:!0,title:"Create project",subtitle:"Give this project a name.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>l(!1),disabled:A.isPending,className:GE,children:"Cancel"}),c.jsx("button",{type:"submit",form:"create-project-form",disabled:O,className:h8(O),children:A.isPending?"Creating…":"Create project"})]}),children:c.jsxs("form",{id:"create-project-form",onSubmit:$=>{$.preventDefault(),!O&&A.mutate()},className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Name your project"}),c.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:$=>d($.target.value),placeholder:"e.g. Web Scraper",className:f8})]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full rounded-[12px] bg-[var(--sand-3)] p-[16px]",children:[c.jsxs("div",{className:"flex min-w-px flex-col gap-[4px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Production"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"The project will be created as production and can't be reverted to development."})]}),c.jsx(pv,{checked:f,onCheckedChange:p,"aria-label":"Production"})]})]})}),c.jsx(ss,{open:m!==null,onClose:()=>{L.isPending||v(null)},noIcon:!0,title:"Rename project",subtitle:"Give this project a new name.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>v(null),disabled:L.isPending,className:GE,children:"Cancel"}),c.jsx("button",{type:"submit",form:"rename-project-form",disabled:M,className:h8(M),children:L.isPending?"Renaming…":"Save"})]}),children:c.jsx("form",{id:"rename-project-form",onSubmit:$=>{$.preventDefault(),!(M||!m)&&L.mutate({projectId:m.id,name:x})},className:"flex flex-col gap-[16px] w-full",children:c.jsx("input",{type:"text",autoFocus:!0,value:x,onChange:$=>y($.target.value),placeholder:"Project name",className:f8})})}),c.jsx(ss,{open:S!==null,onClose:()=>{j.isPending||_(null)},noIcon:!0,title:"Promote to production?",subtitle:c.jsxs(c.Fragment,{children:["Promoting is irreversible. You ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"cannot"})," ","downgrade your project after promoting it to production."]}),footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>_(null),disabled:j.isPending,className:GE,children:"Cancel"}),c.jsx("button",{type:"button",disabled:!S||j.isPending,onClick:()=>{S&&j.mutate(S.id)},className:h8(!S||j.isPending),children:j.isPending?"Promoting…":"Promote"})]})}),c.jsx(ss,{open:E!==null,onClose:()=>{F.isPending||T(null)}
504,noIcon:!0,title:"Delete project?",subtitle:`This permanently deletes ${(E==null?void 0:E.name)??"this project"} and cannot be undone.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>T(null),disabled:F.isPending,className:GE,children:"Cancel"}),c.jsx("button",{type:"submit",form:"delete-project-form",disabled:!U||F.isPending,className:vht,children:F.isPending?"Deleting…":"Yes, delete"})]}),children:c.jsx("form",{id:"delete-project-form",onSubmit:$=>{$.preventDefault(),!(!U||F.isPending||!E)&&F.mutate(E)},className:"flex flex-col gap-[16px] w-full",children:c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsxs("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:["Type"," ",c.jsx("span",{className:"text-[var(--sand-12)] tracking-[0.01em]",children:E==null?void 0:E.name})," ","to confirm"]}),c.jsx("input",{type:"text",value:k,onChange:$=>R($.target.value),placeholder:(E==null?void 0:E.name)??"Project name",className:f8})]})})})]})}function wht(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M13 18L10.9142 20.0858C10.1332 20.8668 8.86684 20.8668 8.08579 20.0858L3.91422 15.9142C3.13317 15.1332 3.13317 13.8668 3.91422 13.0858L6 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M11 5.9997L13.0858 3.91391C13.8668 3.13286 15.1332 3.13286 15.9142 3.91391L20.0858 8.08548C20.8668 8.86653 20.8668 10.1329 20.0858 10.9139L18 12.9997",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 15L15 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tye(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12 7V12M12 12V17M12 12H7M12 12H17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function _ht(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7.4 7.5H7.6M4 11V6C4 4.89543 4.89543 4 6 4H18C19.1046 4 20 4.89543 20 6V11M4 11V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V11M4 11H20M11 7.5H17M8 7.5C8 7.77614 7.77614 8 7.5 8C7.22386 8 7 7.77614 7 7.5C7 7.22386 7.22386 7 7.5 7C7.77614 7 8 7.22386 8 7.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Ab=t=>"$"+t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),x9=[{id:"r1",name:"Jordan Lee",email:"[email protected]",earned:25},{id:"r2",name:"Priya Nair",email:"[email protected]",earned:25},{id:"r3",name:"Sam Rivera",email:"[email protected]",earned:25}],p8=x9.reduce((t,e)=>t+e.earned,0),gT=[{label:"Steel keychain",threshold:50},{label:"Steel hat",threshold:100},{label:"Steel hoodie",threshold:200}],m8=[{title:"Share your link with a friend",desc:"Send your referral link to members who are new to Steel Cloud.",Icon:wht},{title:"Your friend gets their payment matched",desc:"On their first eligible payment - a top-up or Scale subscription - Steel instantly matches it dollar for dollar, up to $25 in usage credit.",Icon:Tze},{title:"They spend some of their credits",desc:"Once that payment is 14 days old and they've run an equivalent amount of usage, your reward qualifies.",Icon:_ht},{title:"You earn credits",desc:"You receive the same matched amount - up to $25 in Steel usage credits - added to your wallet, valid for 90 days.",Icon:Tye}],s0="flex items-center min-w-px h-[44px] px-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap";function Eht(){var r;const{user:t}=Vi(),n=`https://steel.dev/r/${(t==null?void 0:t.username)??((r=t==null?void 0:t.id)==null?void 0:r.slice(-8))??"your-code"}`,s=()=>{var i;(i=navigator.clipboard)==null||i.writeText(n),Ao({title:"Referral link copied to clipboard",duration:2500})};return c.jsx("main",{className:"flex flex-1 justify-center overflow-y-auto [scrollbar-gutter:stable_both-edges]",children:c.jsxs("div",{className:"flex w-full max-w-[720px] flex-col gap-10 px-6 pb-6 pt-12",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("h1",{className:"text-[24px] font-medium leading-[30px] text-[var(--sand-12)]",children:"Refer friends and earn rewards"}),c.jsxs("p",{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:["You earned ",c.jsx("span",{className:"text-[var(--sand-12)]",children:Ab(p8)})," in referrals so far."]})]}),c.jsx(kht,{earned:p8}),c.jsxs("div",{className:"flex w-full gap-3",children:[c.jsx("div",{className:"flex h-[40px] flex-1 items-center overflow-hidden rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] px-[12px] font-sans text-[14px] leading-[20px] text-[var(--sand-12)]",children:c.jsx("span",{className:"truncate",children:n})}),c.jsx("button",{type:"button",onClick:s,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] whitespace-nowrap",children:"Copy link"})]}),c.jsx(Cht,{earned:p8}),c.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)]",children:m8.map((i,a)=>c.jsxs("div",{className:`flex items-start gap-[16px] p-[20px] ${a>0?"border-t-[0.5px] border-solid border-[var(--sand-6)]":""}`,children:[c.jsx("div",{className:"flex size-[28px] shrink-0 items-center justify-center rounded-full border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] text-[var(--sand-12)] dark:text-white",children:c.jsx(i.Icon,{size:16,className:a===m8.length-1?"text-[var(--yellow-11)] dark:text-[#f5d90a]":"text-[var(--sand-12)] dark:text-white",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsxs("div",{className:"flex flex-col gap-[2px]",children:[c.jsx("p",{className:`pt-[4px] text-[14px] font-medium leading-[20px] ${a===m8.length-1?"text-[var(--yellow-11)] dark:text-[#f5d90a]":"text-[var(--sand-12)]"}`,children:i.title}),c.jsx("p",{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:i.desc})]})]},i.title))}),c.jsxs("div",{className:"flex w-full flex-1 flex-col gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] font-medium",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"People referred"}),c.jsxs("p",{className:"text-[var(--sand-10)] text-[14px] leading-[20px]",children:["You invited a total of"," ",c.jsx("span",{className:"text-[var(--sand-12)]",children:x9.length})," people to Steel with your link."]})]}),c.jsx(Rht,{rows:x9})]})]})})}function Cht({earned:t}){const[e,n]=w.useState(!1),s=[...gT].reverse().find(r=>t>=r.threshold);return s?c.jsxs("div",{className:"flex w-full shrink-0 overflow-hidden rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsx("div",{className:"w-[180px] shrink-0 self-stretch overflow-hidden border-r-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)]",children:s.image?c.jsx("img",{src:s.image,alt:s.label,className:"h-full w-full object-cover"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center",children:c.jsx(yd,{size:28,className:"text-[var(--sand-9)]"})})}),c.jsxs("div",{className:"flex flex-1 flex-col items-start justify-center gap-[16px] p-[20px]",children:[c.jsxs("div",{className:"flex flex-col gap-[4px]",children:[c.jsx("p",{className:"text-[16px] font-medium leading-[24px] text-[var(--sand-12)]",children:"You're eligible for a reward"}),c.jsxs("p",{className:"text-[14px] leading-[20px] text-[var(--sand-10)]",children:["The ",s.label," is unlocked - claim it and we will ship it to you."]})]}),c.jsx("button",{type:"button",onClick:()=>n(!0),className:"flex h-[40px] shrink-0 cursor-pointer items-center whitespace-nowrap rounded-[8px] bg-[var(--sand-4)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)] active:scale-[0.97]",children:"Claim reward"})]}),c.jsx(Tht,{open:e,onClose:()=>n(!1),reward:s.label})]}):null}function Tht({open:t,onClose:e,reward:n}){const s={name:"",address:"",city:"",state:"",postal:"",country:""},[r,i]=w.useState(s),a=l=>u=>i(d=>({...d,[l]:u.target.value})),o=l=>{l.preventDefault()};return c.jsx(ss,{open:t,onClose:e,title:"Claim your reward",subtitle:`Tell us where to ship your ${n}
504 - we ship worldwide.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:e,className:"flex h-[40px] cursor-pointer items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)] active:scale-[0.97]",children:"Cancel"}),c.jsx("button",{type:"submit",form:"claim-reward-form",disabled:!0,title:"Reward claims open when referrals launch",className:"flex h-[40px] cursor-not-allowed items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[16px] text-[14px] font-medium leading-[20px] text-[var(--sand-10)]",children:"Submit"})]}),children:c.jsxs("form",{id:"claim-reward-form",onSubmit:o,className:"flex flex-col gap-[16px]",children:[c.jsx(r0,{label:"Full name",value:r.name,onChange:a("name"),placeholder:"Jane Doe"}),c.jsx(r0,{label:"Address",value:r.address,onChange:a("address"),placeholder:"123 Main St, Apt 4"}),c.jsxs("div",{className:"flex gap-[12px]",children:[c.jsx(r0,{label:"City",value:r.city,onChange:a("city"),placeholder:"San Francisco"}),c.jsx(r0,{label:"State / Province",value:r.state,onChange:a("state"),placeholder:"California"})]}),c.jsxs("div",{className:"flex gap-[12px]",children:[c.jsx(r0,{label:"Postal code",value:r.postal,onChange:a("postal"),placeholder:"94103"}),c.jsx(r0,{label:"Country",value:r.country,onChange:a("country"),placeholder:"United States"})]})]})})}function r0({label:t,value:e,onChange:n,placeholder:s}){return c.jsxs("label",{className:"flex flex-1 flex-col gap-[6px]",children:[c.jsx("span",{className:"text-[13px] font-medium leading-[18px] text-[var(--sand-11)]",children:t}),c.jsx("input",{required:!0,value:e,onChange:n,placeholder:s,className:"h-[44px] w-full rounded-[8px] bg-[var(--sand-3)] px-[12px] text-[14px] font-medium leading-[20px] text-[var(--sand-12)] outline-none transition-colors duration-150 [transition-timing-function:var(--ease-out)] placeholder:text-[var(--sand-10)] focus:bg-[var(--sand-4)]"})]})}function kht({earned:t}){const e=gT[gT.length-1].threshold,n=Math.min(100,t/e*100),[s,r]=w.useState(!1);return c.jsx(vF,{delayDuration:0,children:c.jsxs("div",{className:"relative my-[6px] h-[6px] w-full shrink-0",children:[c.jsx("div",{className:"absolute inset-0 cursor-default rounded-full bg-[var(--amber-a4)] dark:bg-[rgba(245,217,10,0.16)]",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:c.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-[var(--amber-9)] dark:bg-[#f5d90a]",style:{width:`${n}%`}})}),s&&c.jsx("div",{className:"pointer-events-none absolute bottom-full z-50 mb-[10px] -translate-x-1/2 whitespace-nowrap rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] px-[10px] py-[6px] shadow-popover",style:{left:`${n}%`},children:c.jsxs("p",{className:"text-[12px] leading-[16px] text-[var(--sand-10)]",children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:Ab(t)})," earned in referrals"]})}),gT.map(i=>{const a=t>=i.threshold,o=i.threshold>=e;return c.jsxs(Sb,{children:[c.jsx(wb,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":`${i.label} — ${Ab(i.threshold)}`,style:o?{right:0}:{left:`${i.threshold/e*100}%`},className:`absolute top-1/2 flex size-[24px] -translate-y-1/2 cursor-default items-center justify-center rounded-full bg-white text-[#2c2100] shadow-[0_1px_3px_rgba(0,0,0,0.35)] ${o?"":"-translate-x-1/2"}`,children:a?c.jsx(j4,{size:16}):c.jsx(yd,{size:16})})}),c.jsxs(ov,{side:"top",collisionPadding:8,className:"w-[200px] overflow-hidden rounded-[10px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-3)] p-0",children:[c.jsx("div",{className:"flex aspect-video w-full items-center justify-center overflow-hidden border-b-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)]",children:i.image?c.jsx("img",{src:i.image,alt:i.label,className:"h-full w-full object-cover"}):c.jsx(yd,{size:24,className:"text-[var(--sand-9)]"})}),c.jsxs("div",{className:"flex flex-col gap-[2px] px-[12px] py-[8px]",children:[c.jsxs("p",{className:"flex items-center gap-[6px] text-[13px] font-medium leading-[18px] text-[var(--sand-12)]",children:[c.jsx(yd,{size:14,className:"shrink-0 text-[var(--sand-11)]"}),i.label]}
504),c.jsx("p",{className:"text-[12px] leading-[16px] text-[var(--sand-10)]",children:a?"Reward available":`Reach ${Ab(i.threshold)} in referral earnings`})]})]})]},i.label)})]})})}function Rht({rows:t}){return c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${s0} flex-1 bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"User"}),c.jsx("div",{className:`${s0} flex-1 border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Email"}),c.jsx("div",{className:`${s0} flex-none w-[160px] justify-end border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"You earned"})]}),t.map(e=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${s0} flex-1 overflow-hidden text-[var(--sand-12)]`,children:c.jsx("span",{className:"truncate min-w-0",children:e.name})}),c.jsx("div",{className:`${s0} flex-1 overflow-hidden border-l-[0.5px] text-[var(--sand-11)]`,children:c.jsx("span",{className:"truncate min-w-0",children:e.email})}),c.jsx("div",{className:`${s0} flex-none w-[160px] justify-end border-l-[0.5px] text-[var(--sand-12)] tabular-nums`,children:Ab(e.earned)})]},e.id))]})}function kye(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M16 17H20C21.1046 17 22 16.1046 22 15V9C22 7.89543 21.1046 7 20 7H16M8 17H4C2.89543 17 2 16.1046 2 15V9C2 7.89543 2.89543 7 4 7H8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10 4L9 2M14 4L15 2M10 20L9 22M14 20L15 22",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rye(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12 1.95068C17.525 1.95068 22 6.42568 22 11.9507C21.9995 14.0459 21.3419 16.0883 20.1198 17.7902C18.8977 19.4922 17.1727 20.768 15.1875 21.4382C14.6875 21.5382 14.5 21.2257 14.5 20.9632C14.5 20.6257 14.5125 19.5507 14.5125 18.2132C14.5125 17.2757 14.2 16.6757 13.8375 16.3632C16.0625 16.1132 18.4 15.2632 18.4 11.4257C18.4 10.3257 18.0125 9.43818 17.375 8.73818C17.475 8.48818 17.825 7.46318 17.275 6.08818C17.275 6.08818 16.4375 5.81318 14.525 7.11318C13.725 6.88818 12.875 6.77568 12.025 6.77568C11.175 6.77568 10.325 6.88818 9.525 7.11318C7.6125 5.82568 6.775 6.08818 6.775 6.08818C6.225 7.46318 6.575 8.48818 6.675 8.73818C6.0375 9.43818 5.65 10.3382 5.65 11.4257C5.65 15.2507 7.975 16.1132 10.2 16.3632C9.9125 16.6132 9.65 17.0507 9.5625 17.7007C8.9875 17.9632 7.55 18.3882 6.65 16.8757C6.4625 16.5757 5.9 15.8382 5.1125 15.8507C4.275 15.8632 4.775 16.3257 5.125 16.5132C5.55 16.7507 6.0375 17.6382 6.15 17.9257C6.35 18.4882 7 19.5632 9.5125 19.1007C9.5125 19.9382 9.525 20.7257 9.525 20.9632C9.525 21.2257 9.3375 21.5257 8.8375 21.4382C6.8458 20.7752 5.11342 19.502 3.88611 17.799C2.65881 16.096 1.9989 14.0498 2 11.9507C2 6.42568 6.475 1.95068 12 1.95068Z",fill:"currentColor"})})}function Aht(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M21.5844 12.2273C21.5844 11.5182 21.5208 10.8363 21.4026 10.1818H11.9844V14.0545H17.3662C17.1298 15.3 16.4207 16.3545 15.3571 17.0636V19.5818H18.6026C20.4935 17.8363 21.5844 15.2727 21.5844 12.2273Z",fill:"currentColor"}),c.jsx("path",{d:"M11.982 22C14.682 22 16.9456 21.1091 18.6002 19.5818L15.3547 17.0636C14.4638 17.6636 13.3274 18.0273 11.982 18.0273C9.38197 18.0273 7.17287 16.2727 6.38196 13.9091H3.05469V16.4909C4.70014 19.7546 8.07288 22 11.982 22Z",fill:"currentColor"}),c.jsx("path",{d:"M6.38438 13.9C6.18438 13.3 6.0662 12.6636 6.0662 12C6.0662 11.3363 6.18438 10.7 6.38438 10.1V7.51816H3.0571C2.37528 8.86361 1.98438 10.3818 1.98438 12C1.98438 13.6182 2.37528 15.1364 3.0571 16.4818L5.64802 14.4636L6.38438 13.9Z",fill:"currentColor"}),c.jsx("path",{d:"M11.982 5.98182C13.4547 5.98182 14.7638 6.49091 15.8092 7.47273L18.6729 4.60909C16.9365 2.99091 14.682 2 11.982 2C8.07288 2 4.70014 4.24546 3.05469 7.51819L6.38196 10.1C7.17287 7.73637 9.38197 5.98182 11.982 5.98182Z",fill:"currentColor"})]})}function Nht(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M5 6.5L5.87156 19.1376C
5045.94388 20.1863 6.81565 21 7.86682 21H16.1332C17.1843 21 18.0561 20.1863 18.1284 19.1376L19 6.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10 11V16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14 11V16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M3.5 6H20.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.07092 5.74621C8.42348 3.89745 10.0485 2.5 12 2.5C13.9515 2.5 15.5765 3.89745 15.9291 5.74621",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Iht=168,Bne=60,g8=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim());function Lht({onAdded:t}){const{user:e}=Vi(),[n,s]=w.useState(!1),[r,i]=w.useState("form"),[a,o]=w.useState(""),[l,u]=w.useState("Adding your email"),[d,f]=w.useState(0),[p,m]=w.useState(null),[v,x]=w.useState(null),y=w.useRef(null),S=w.useRef(null),_=w.useRef(null),E=w.useRef(null),T=w.useRef(null),{render:k,exiting:R}=jht(n,220),I=()=>{var M;(M=T.current)==null||M.cancelEmailLinkFlow(),s(!1)};w.useEffect(()=>()=>{var M;return(M=T.current)==null?void 0:M.cancelEmailLinkFlow()},[]);const A=()=>{i("form"),o(""),f(0),m(null),E.current=null,s(!0)},L=M=>{var $;($=T.current)==null||$.cancelEmailLinkFlow();const U=M.createEmailLinkFlow();T.current=U;const G=new URL("/verify-email",window.location.origin).toString();U.startEmailLinkFlow({redirectUrl:G}).then(V=>{var B;((B=V.verification)==null?void 0:B.status)==="verified"&&(t(),s(!1))}).catch(()=>{})},j=async()=>{if(!(!g8(a)||!e)){m(null),u("Adding your email"),i("loading");try{const M=await e.createEmailAddress({email:a.trim()});E.current=M,t(),L(M),f(Bne),i("verify")}catch(M){m(M instanceof Error?M.message:"Could not add this email. Please try again."),i("form")}}},F=()=>{E.current&&(L(E.current),f(Bne))};return w.useLayoutEffect(()=>{var M,U;k&&x(r==="form"?((M=S.current)==null?void 0:M.offsetHeight)??null:r==="loading"?Iht:((U=_.current)==null?void 0:U.offsetHeight)??null)},[k,r,d,p]),w.useEffect(()=>{if(r!=="verify"||d<=0)return;const M=setInterval(()=>f(U=>Math.max(0,U-1)),1e3);return()=>clearInterval(M)},[r,d]),w.useEffect(()=>{if(!n)return;const M=G=>G.key==="Escape"&&I();document.addEventListener("keydown",M);const U=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",M),document.body.style.overflow=U}},[n]),c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:A,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap",children:c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:"Add another email"})}),k&&typeof document<"u"&&nr.createPortal(c.jsx("div",{className:`${R?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/70 backdrop-blur-[8px]`,onMouseDown:M=>{y.current&&!y.current.contains(M.target)&&I()},children:c.jsxs("div",{ref:y,role:"dialog","aria-modal":"true",style:v?{height:v}:void 0,className:`${R?"modal-card-out":"modal-card-in"} relative overflow-hidden bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full shadow-modal transition-[height] [transition-duration:400ms] [transition-timing-function:var(--ease-out)]`,children:[c.jsxs("form",{ref:S,onSubmit:M=>{M.preventDefault(),j()},className:`absolute inset-x-0 top-0 flex flex-col transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${r==="form"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Add an email"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"We'll send a verification link to confirm it."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[10px] p-[16px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Email address"}),c.jsx("input",{type:"email",autoFocus:!0,value:a,onChange:M=>o(M.target.value),placeholder:"[email protected]",className:"bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]"}),p&&c.jsx("p",{className:"font-medium text-[13px] leading-[18px] text-danger",children:p})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:I,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:!g8(a),className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] ${g8(a)?"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]"}`,children:"Add email"})]})]}),c.jsxs("div",{className:`absolute inset-0 pt-[32px] px-[32px] pb-[28px] flex flex-col items-center justify-center gap-[16px] transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${r==="loading"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px] text-center",children:l})]}),c.jsxs("div",{ref:_,className:`absolute inset-x-0 top-0 flex flex-col transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${r==="verify"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Click the verification link"}),c.jsxs("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:["We sent a verification link to"," ",c.jsx("span",{className:"text-[var(--sand-12)]",children:a.trim()})," — open it in your inbox to confirm this address."]})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:I,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Close"}),d>0?c.jsxs("button",{type:"button",disabled:!0,className:"cursor-not-allowed bg-[var(--sand-3)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-8)]",children:["Resend in ",d,"s"]}):c.jsx("button",{type:"button",onClick:()=>void F(),className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Resend"})]})]})]})}),document.body)]})}function jht(t,e=220){const[n,s]=w.useState(t),[r,i]=w.useState(!1),a=w.useRef(t);return a.current=n,w.useEffect(()=>{if(t)s(!0),i(!1);else if(a.current){i(!0);const o=setTimeout(()=>{s(!1),i(!1)},e);return()=>clearTimeout(o)}},[t,e]),{render:n,exiting:r}}const Gy="flex items-center min-w-px h-[44px] px-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",qE=`${Gy} bg-[var(--sand-3)] text-[var(--sand-12)]`,zne="flex items-center justify-center h-[44px] w-[44px] shrink-0 bg-[var(--sand-3)] border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",Vne="flex items-center justify-center h-[44px] w-[44px] shrink-0 border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",v8="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",Hne="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",Gne="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]",Pht=[{key:"google",strategy:"oauth_google",label:"Google",Icon:Aht},{key:"github",strategy:"oauth_github",label:"GitHub",Icon:Rye}];function yy({label:t,cls:e}){return c.jsx("span",{className:`flex h-[20px] items-center px-[8px] rounded-[999px] font-medium text-[12px] leading-[20px] ${e}`,children:t})}function Wne({title:t,subtitle:e,action:n}){return c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:t}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:e})]}),n]})}function Mht(){const{user:t,isLoaded:e}=Vi(),n=w.useRef(null),[s,r]=w.useState(!1),[i,a]=w.useState(!1),[o,l]=w.useState(""),[u,d]=w.useState(""),[f,p]=w.useState(!1),[m,v]=w.useState(null),[x,y]=w.useState(!1),[S,_]=w.useState(null),[E,T]=w.useState(!1);if(!e)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"})});if(!t)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No active user."})});const k=async M=>{var G;const U=(G=M.target.files)==null?void 0:G[0];if(M.target.value="",!!U){r(!0);try{await t.setProfileImage({file:U}),await t.reload(),na({title:"Profile photo updated",shapes:!1})}catch($){Bn({title:$ instanceof Error?$.message:"Could not update photo"})}finally{r(!1)}}},R=()=>{l(t.firstName??""),d(t.lastName??""),a(!0)},I=o.trim()!==(t.firstName??"")||u.trim()!==(t.lastName??""),A=!f&&o.trim()!==""&&I,L=async()=>
504{if(A){p(!0);try{await t.update({firstName:o.trim(),lastName:u.trim()}),await t.reload(),na({title:"Name updated",shapes:!1}),a(!1)}catch(M){Bn({title:M instanceof Error?M.message:"Could not update name"})}finally{p(!1)}}},j=async()=>{if(m){y(!0);try{await m.destroy(),await t.reload(),na({title:"Email removed",shapes:!1}),v(null)}catch(M){Bn({title:M instanceof Error?M.message:"Could not remove email"})}finally{y(!1)}}},F=async M=>{var U;try{const $=(U=(await t.createExternalAccount({strategy:M,redirectUrl:window.location.href})).verification)==null?void 0:U.externalVerificationRedirectURL;$&&(window.location.href=$.toString())}catch(G){Bn({title:G instanceof Error?G.message:"Could not connect account"})}},O=async()=>{if(S){T(!0);try{await S.destroy(),await t.reload(),na({title:"Account disconnected",shapes:!1}),_(null)}catch(M){Bn({title:M instanceof Error?M.message:"Could not disconnect account"})}finally{T(!1)}}};return c.jsxs("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"Profile"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage your photo, name, email addresses, and connected accounts."})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[c.jsx("input",{ref:n,type:"file",accept:"image/*",hidden:!0,onChange:k}),c.jsx("button",{type:"button",onClick:()=>{var M;return(M=n.current)==null?void 0:M.click()},disabled:s,"aria-label":"Change profile photo",className:"size-[40px] shrink-0 rounded-full overflow-hidden border-[0.5px] border-solid border-[var(--sand-6)] hover:border-[var(--sand-9)] flex items-center justify-center bg-[var(--sand-4)] cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:opacity-60 disabled:cursor-not-allowed",children:t.hasImage?c.jsx("img",{src:t.imageUrl,alt:"",className:"size-full object-cover"}):c.jsx(U1,{size:22,className:"text-[var(--sand-11)]"})}),c.jsx("button",{type:"button",onClick:R,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Change name"})]})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[48px] p-[24px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsx(Wne,{title:"Emails",subtitle:"Manage the email addresses linked to your account.",action:c.jsx(Lht,{onAdded:()=>void t.reload()})}),c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${qE} flex-1`,children:"Email"}),c.jsx("div",{className:`${qE} flex-1 border-l-[0.5px]`,children:"Status"}),c.jsx("div",{className:zne})]}),t.emailAddresses.map(M=>{var $;const U=M.id===t.primaryEmailAddressId,G=(($=M.verification)==null?void 0:$.status)==="verified";return c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${Gy} flex-1 text-[var(--sand-12)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:M.emailAddress})}),c.jsxs("div",{className:`${Gy} flex-1 border-l-[0.5px] gap-[6px]`,children:[U&&c.jsx(yy,{label:"Primary",cls:"bg-[var(--blue-3)] dark:bg-[#10243e] border-[var(--blue-6)] dark:border-[#0d3868] text-[var(--blue-11)] dark:text-[#52a9ff]"}),G?c.jsx(yy,{label:"Verified",cls:"bg-[var(--green-3)] dark:bg-[#0c2417] border-[var(--green-6)] dark:border-[#16482c] text-[var(--green-11)] dark:text-[#34d399]"}):c.jsx(yy,{label:"Check email",cls:"bg-[var(--sand-4)] border-[var(--sand-6)] text-[var(--sand-11)]"})]}),c.jsx("div",{className:Vne,children:!U&&c.jsx("button",{type:"button","aria-label":`Delete ${M.emailAddress}`,onClick:()=>v(M),className:"cursor-pointer shrink-0 aspect-square flex items-center justify-center size-[32px] rounded-full text-[var(--sand-10)] hover:text-danger hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(Nht,{size:18})})})]},M.id)})]})]}),c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsx(Wne,{title:"Connected accounts",subtitle:"Link a third-party account to sign in faster."}),c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${qE} flex-1`,children:"Provider"}),c.jsx("div",{className:`${qE} flex-1 border-l-[0.5px]`,children:"Status"}),c.jsx("div",{className:zne})]}),Pht.map(({key:M,strategy:U,label:G,Icon:$})=>{const V=t.externalAccounts.find(q=>q.provider===M),B=!!V;return c.jsxs("div",{className:"flex w-full",children:[c.jsxs("div",{className:`${Gy} flex-1 text-[var(--sand-12)] gap-[10px] ${B?"":"opacity-60"}`,children:[c.jsx($,{size:20,className:"shrink-0"}),G]}),c.jsx("div",{className:`${Gy} flex-1 border-l-[0.5px]`,children:B?c.jsx(yy,{label:"Connected",cls:"bg-[var(--green-3)] dark:bg-[#0c2417] border-[var(--green-6)] dark:border-[#16482c] text-[var(--green-11)] dark:text-[#34d399]"}):c.jsx(yy,{label:"Not connected",cls:"bg-[var(--sand-4)] border-[var(--sand-6)] text-[var(--sand-11)]"})}),c.jsx("div",{className:Vne,children:B&&V?c.jsx("button",{type:"button","aria-label":`Disconnect ${G}`,onClick:()=>_(V),className:"cursor-pointer shrink-0 aspect-square flex items-center justify-center size-[32px] rounded-full text-danger hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(kye,{size:18})}):c.jsx("button",{type:"button","aria-label":`Connect ${G}`,onClick:()=>void F(U),className:"cursor-pointer shrink-0 aspect-square flex items-center justify-center size-[32px] rounded-full text-[var(--sand-11)] hover:text-[var(--sand-12)] hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(Tye,{size:18})})})]},M)})]})]})]})]}),c.jsx(ss,{open:i,onClose:()=>{f||a(!1)},noIcon:!0,title:"Change your name",subtitle:"Update how your name appears across Steel.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>a(!1),disabled:f,className:v8,children:"Cancel"}),c.jsx("button",{type:"submit",form:"change-name-form",disabled:!A,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] ${A?"curs
504or-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]"}`,children:f?"Saving…":"Save"})]}),children:c.jsx("form",{id:"change-name-form",onSubmit:M=>{M.preventDefault(),L()},className:"flex flex-col gap-[16px] w-full",children:c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"First name"}),c.jsx("input",{type:"text",autoFocus:!0,value:o,onChange:M=>l(M.target.value),placeholder:"First name",className:Gne})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Last name"}),c.jsx("input",{type:"text",value:u,onChange:M=>d(M.target.value),placeholder:"Last name",className:Gne})]})]})})}),c.jsx(ss,{open:m!==null,onClose:()=>{x||v(null)},noIcon:!0,danger:!0,title:"Are you sure?",subtitle:`This removes ${(m==null?void 0:m.emailAddress)??"this email"} from your account.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>v(null),disabled:x,className:v8,children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>void j(),disabled:x,className:Hne,children:x?"Removing…":"Yes, delete"})]})}),c.jsx(ss,{open:S!==null,onClose:()=>{E||_(null)},noIcon:!0,title:"Disconnect this account?",subtitle:"Are you sure you want to disconnect this account? You can reconnect it anytime.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>_(null),disabled:E,className:v8,children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>void O(),disabled:E,className:Hne,children:E?"Disconnecting…":"Yes, disconnect"})]})})]})}function Aye(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M18 14L12 20L6 14M12 19V4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Dht(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M17 18V19C17 20.1046 16.1046 21 15 21H7C5.89543 21 5 20.1046 5 19V8C5 6.89543 5.89543 6 7 6H8M15 3H10C8.89543 3 8 3.89543 8 5V16C8 17.1046 8.89543 18 10 18H18C19.1046 18 20 17.1046 20 16V8M15 3L20 8M15 3V6C15 7.10457 15.8954 8 17 8H20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Oht=Object.defineProperty,k5=Object.getOwnPropertySymbols,Nye=Object.prototype.hasOwnProperty,Iye=Object.prototype.propertyIsEnumerable,qne=(t,e,n)=>e in t?Oht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y9=(t,e)=>{for(var n in e||(e={}))Nye.call(e,n)&&qne(t,n,e[n]);if(k5)for(var n of k5(e))Iye.call(e,n)&&qne(t,n,e[n]);return t},b9=(t,e)=>{var n={};for(var s in t)Nye.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&k5)for(var s of k5(t))e.indexOf(s)<0&&Iye.call(t,s)&&(n[s]=t[s]);return n};/**
505 * @license QR Code generator library (TypeScript)
506 * Copyright (c) Project Nayuki.
507 * SPDX-License-Identifier: MIT
508 */var Vm;(t=>{const e=class Rn{constructor(l,u,d,f){if(this.version=l,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],l<Rn.MIN_VERSION||l>Rn.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let p=[];for(let v=0;v<this.size;v++)p.push(!1);for(let v=0;v<this.size;v++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const m=this.addEccAndInterleave(d);if(this.drawCodewords(m),f==-1){let v=1e9;for(let x=0;x<8;x++){this.applyMask(x),this.drawFormatBits(x);const y=this.getPenaltyScore();y<v&&(f=x,v=y),this.applyMask(x)}}r(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(l,u){const d=t.QrSegment.makeSegments(l);return Rn.encodeSegments(d,u)}static encodeBinary(l,u){const d=t.QrSegment.makeBytes(l);return Rn.encodeSegments([d],u)}static encodeSegments(l,u,d=1,f=40,p=-1,m=!0){if(!(Rn.MIN_VERSION<=d&&d<=f&&f<=Rn.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let v,x;for(v=d;;v++){const E=Rn.getNumDataCodewords(v,u)*8,T=a.getTotalBits(l,v);if(T<=E){x=T;break}if(v>=f)throw new RangeError("Data too long")}for(const E of[Rn.Ecc.MEDIUM,Rn.Ecc.QUARTILE,Rn.Ecc.HIGH])m&&x<=Rn.getNumDataCodewords(v,E)*8&&(u=E);let y=[];for(const E of l){n(E.mode.modeBits,4,y),n(E.numChars,E.mode.numCharCountBits(v),y);for(const T of E.getData())y.push(T)}r(y.length==x);const S=Rn.getNumDataCodewords(v,u)*8;r(y.length<=S),n(0,Math.min(4,S-y.length),y),n(0,(8-y.length%8)%8,y),r(y.length%8==0);for(let E=236;y.length<S;E^=253)n(E,8,y);let _=[];for(;_.length*8<y.length;)_.push(0);
vendor: 5,469 bytes, line 508
508return y.forEach((E,T)=>_[T>>>3]|=E<<7-(T&7)),new Rn(v,u,_,p)}getModule(l,u){return 0<=l&&l<this.size&&0<=u&&u<this.size&&this.modules[u][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),u=l.length;for(let d=0;d<u;d++)for(let f=0;f<u;f++)d==0&&f==0||d==0&&f==u-1||d==u-1&&f==0||this.drawAlignmentPattern(l[d],l[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const u=this.errorCorrectionLevel.formatBits<<3|l;let d=u;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const f=(u<<10|d)^21522;r(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,s(f,p));this.setFunctionModule(8,7,s(f,6)),this.setFunctionModule(8,8,s(f,7)),this.setFunctionModule(7,8,s(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,s(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,s(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,s(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let d=0;d<12;d++)l=l<<1^(l>>>11)*7973;const u=this.version<<12|l;r(u>>>18==0);for(let d=0;d<18;d++){const f=s(u,d),p=this.size-11+d%3,m=Math.floor(d/3);this.setFunctionModule(p,m,f),this.setFunctionModule(m,p,f)}}drawFinderPattern(l,u){for(let d=-4;d<=4;d++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(d)),m=l+f,v=u+d;0<=m&&m<this.size&&0<=v&&v<this.size&&this.setFunctionModule(m,v,p!=2&&p!=4)}}drawAlignmentPattern(l,u){for(let d=-2;d<=2;d++)for(let f=-2;f<=2;f++)this.setFunctionModule(l+f,u+d,Math.max(Math.abs(f),Math.abs(d))!=1)}setFunctionModule(l,u,d){this.modules[u][l]=d,this.isFunction[u][l]=!0}addEccAndInterleave(l){const u=this.version,d=this.errorCorrectionLevel;if(l.length!=Rn.getNumDataCodewords(u,d))throw new RangeError("Invalid argument");const f=Rn.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][u],p=Rn.ECC_CODEWORDS_PER_BLOCK[d.ordinal][u],m=Math.floor(Rn.getNumRawDataModules(u)/8),v=f-m%f,x=Math.floor(m/f);let y=[];const S=Rn.reedSolomonComputeDivisor(p);for(let E=0,T=0;E<f;E++){let k=l.slice(T,T+x-p+(E<v?0:1));T+=k.length;const R=Rn.reedSolomonComputeRemainder(k,S);E<v&&k.push(0),y.push(k.concat(R))}let _=[];for(let E=0;E<y[0].length;E++)y.forEach((T,k)=>{(E!=x-p||k>=v)&&_.push(T[E])});return r(_.length==m),_}drawCodewords(l){if(l.length!=Math.floor(Rn.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const m=d-p,x=(d+1&2)==0?this.size-1-f:f;!this.isFunction[x][m]&&u<l.length*8&&(this.modules[x][m]=s(l[u>>>3],7-(u&7)),u++)}}r(u==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let d=0;d<this.size;d++){let f;switch(l){case 0:f=(d+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=d%3==0;break;case 3:f=(d+u)%3==0;break;case 4:f=(Math.floor(d/3)+Math.floor(u/2))%2==0;break;case 5:f=d*u%2+d*u%3==0;break;case 6:f=(d*u%2+d*u%3)%2==0;break;case 7:f=((d+u)%2+d*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][d]&&f&&(this.modules[u][d]=!this.modules[u][d])}}getPenaltyScore(){let l=0;for(let p=0;p<this.size;p++){let m=!1,v=0,x=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[p][y]==m?(v++,v==5?l+=Rn.PENALTY_N1:v>5&&l++):(this.finderPenaltyAddHistory(v,x),m||(l+=this.finderPenaltyCountPatterns(x)*Rn.PENALTY_N3),m=this.modules[p][y],v=1);l+=this.finderPenaltyTerminateAndCount(m,v,x)*Rn.PENALTY_N3}for(let p=0;p<this.size;p++){let m=!1,v=0,x=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][p]==m?(v++,v==5?l+=Rn.PENALTY_N1:v>5&&l++):(this.finderPenaltyAddHistory(v,x),m||(l+=this.finderPenaltyCountPatterns(x)*Rn.PENALTY_N3),m=this.modules[y][p],v=1);l+=this.finderPenaltyTerminateAndCount(m,v,x)*Rn.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let m=0;m<this.size-1;m++){const v=this.modules[p][m];v==this.modules[p][m+1]&&v==this.modules[p+1][m]&&v==this.modules[p+1][m+1]&&(l+=Rn.PENALTY_N2)}let u=0;for(const p of this.modules)u=p.reduce((m,v)=>m+(v?1:0),u);const d=this.size*this.size,f=Math.ceil(Math.abs(u*20-d*10)/d)-1;return r(0<=f&&f<=9),l+=f*Rn.PENALTY_N4,r(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let d=[6];for(let f=this.size-7;d.length<l;f-=u)d.splice(1,0,f);return d}}static getNumRawDataModules(l){if(l<Rn.MIN_VERSION||l>Rn.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*l+128)*l+64;if(l>=2){const d=Math.floor(l/7)+2;u-=(25*d-10)*d-55,l>=7&&(u-=36)}return r(208<=u&&u<=29648),u}static getNumDataCodewords(l,u){return Math.floor(Rn.getNumRawDataModules(l)/8)-Rn.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l]*Rn.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<l-1;f++)u.push(0);u.push(1);let d=1;for(let f=0;f<l;f++){for(let p=0;p<u.length;p++)u[p]=Rn.reedSolomonMultiply(u[p],d),p+1<u.length&&(u[p]^=u[p+1]);d=Rn.reedSolomonMultiply(d,2)}return u}static reedSolomonComputeRemainder(l,u){let d=u.map(f=>0);for(const f of l){const p=f^d.shift();d.push(0),u.forEach((m,v)=>
508d[v]^=Rn.reedSolomonMultiply(m,p))}return d}static reedSolomonMultiply(l,u){if(l>>>8||u>>>8)throw new RangeError("Byte out of range");let d=0;for(let f=7;f>=0;f--)d=d<<1^(d>>>7)*285,d^=(u>>>f&1)*l;return r(d>>>8==0),d}finderPenaltyCountPatterns(l){const u=l[1];r(u<=this.size*3);const d=u>0&&l[2]==u&&l[3]==u*3&&l[4]==u&&l[5]==u;return(d&&l[0]>=u*4&&l[6]>=u?1:0)+(d&&l[6]>=u*4&&l[0]>=u?1:0)}finderPenaltyTerminateAndCount(l,u,d){return l&&(this.finderPenaltyAddHistory(u,d),u=0),u+=this.size,this.finderPenaltyAddHistory(u,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(l,u){u[0]==0&&(l+=this.size),u.pop(),u.unshift(l)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=e;function n(o,l,u){if(l<0||l>31||o>>>l)throw new RangeError("Value out of range");for(let d=l-1;d>=0;d--)u.push(o>>>d&1)}function s(o,l){return(o>>>l&1)!=0}function r(o){if(!o)throw new Error("Assertion error")}const i=class wr{constructor(l,u,d){if(this.mode=l,this.numChars=u,this.bitData=d,u<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(l){let u=[];for(const d of l)n(d,8,u);return new wr(wr.Mode.BYTE,l.length,u)}static makeNumeric(l){if(!wr.isNumeric(l))throw new RangeError("String contains non-numeric characters");let u=[];for(let d=0;d<l.length;){const f=Math.min(l.length-d,3);n(parseInt(l.substring(d,d+f),10),f*3+1,u),d+=f}return new wr(wr.Mode.NUMERIC,l.length,u)}static makeAlphanumeric(l){if(!wr.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],d;for(d=0;d+2<=l.length;d+=2){let f=wr.ALPHANUMERIC_CHARSET.indexOf(l.charAt(d))*45;f+=wr.ALPHANUMERIC_CHARSET.indexOf(l.charAt(d+1)),n(f,11,u)}return d<l.length&&n(wr.ALPHANUMERIC_CHARSET.indexOf(l.charAt(d)),6,u),new wr(wr.Mode.ALPHANUMERIC,l.length,u)}static makeSegments(l){return l==""?[]:wr.isNumeric(l)?[wr.makeNumeric(l)]:wr.isAlphanumeric(l)?[wr.makeAlphanumeric(l)]:[wr.makeBytes(wr.toUtf8ByteArray(l))]}static makeEci(l){let u=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)n(l,8,u);else if(l<16384)n(2,2,u),n(l,14,u);else if(l<1e6)n(6,3,u),n(l,21,u);else throw new RangeError("ECI assignment value out of range");return new wr(wr.Mode.ECI,0,u)}static isNumeric(l){return wr.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return wr.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,u){let d=0;for(const f of l){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;d+=4+p+f.bitData.length}return d}static toUtf8ByteArray(l){l=encodeURI(l);let u=[];for(let d=0;d<l.length;d++)l.charAt(d)!="%"?u.push(l.charCodeAt(d)):(u.push(parseInt(l.substring(d+1,d+3),16)),d+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let a=i;t.QrSegment=i})(Vm||(Vm={}));(t=>{(e=>{const n=class{constructor(r,i){this.ordinal=r,this.formatBits=i}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),e.Ecc=n})(t.QrCode||(t.QrCode={}))})(Vm||(Vm={}));(t=>{(e=>{const n=class{constructor(r,i){this.modeBits=r,this.numBitsCharCount=i}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),e.Mode=n})(t.QrSegment||(t.QrSegment={}))})(Vm||(Vm={}));var z0=Vm;/**
509 * @license qrcode.react
510 * Copyright (c) Paul O'Shannessy
511 * SPDX-License-Identifier: ISC
512 */var $ht={L:z0.QrCode.Ecc.LOW,M:z0.QrCode.Ecc.MEDIUM,Q:z0.QrCode.Ecc.QUARTILE,H:z0.QrCode.Ecc.HIGH},Lye=128,jye="L",Pye="#FFFFFF",Mye="#000000",Dye=!1,Oye=1,Fht=4,Uht=0,Bht=.1;function $ye(t,e=0){const n=[];return t.forEach(function(s,r){let i=null;
512s.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+e} ${r+e}h${o-i}v1H${i+e}z`),i=null;return}if(o===s.length-1){if(!a)return;i===null?n.push(`M${o+e},${r+e} h1v1H${o+e}z`):n.push(`M${i+e},${r+e} h${o+1-i}v1H${i+e}z`);return}a&&i===null&&(i=o)})}),n.join("")}function Fye(t,e){return t.slice().map((n,s)=>s<e.y||s>=e.y+e.h?n:n.map((r,i)=>i<e.x||i>=e.x+e.w?r:!1))}function zht(t,e,n,s){if(s==null)return null;const r=t.length+n*2,i=Math.floor(e*Bht),a=r/e,o=(s.width||i)*a,l=(s.height||i)*a,u=s.x==null?t.length/2-o/2:s.x*a,d=s.y==null?t.length/2-l/2:s.y*a,f=s.opacity==null?1:s.opacity;let p=null;if(s.excavate){let v=Math.floor(u),x=Math.floor(d),y=Math.ceil(o+u-v),S=Math.ceil(l+d-x);p={x:v,y:x,w:y,h:S}}const m=s.crossOrigin;return{x:u,y:d,h:l,w:o,excavation:p,opacity:f,crossOrigin:m}}function Vht(t,e){return e!=null?Math.max(Math.floor(e),0):t?Fht:Uht}function Uye({value:t,level:e,minVersion:n,includeMargin:s,marginSize:r,imageSettings:i,size:a,boostLevel:o}){let l=re.useMemo(()=>{const v=(Array.isArray(t)?t:[t]).reduce((x,y)=>(x.push(...z0.QrSegment.makeSegments(y)),x),[]);return z0.QrCode.encodeSegments(v,$ht[e],n,void 0,void 0,o)},[t,e,n,o]);const{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=re.useMemo(()=>{let m=l.getModules();const v=Vht(s,r),x=m.length+v*2,y=zht(m,a,v,i);return{cells:m,margin:v,numCells:x,calculatedImageSettings:y}},[l,a,i,s,r]);return{qrcode:l,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var Hht=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Ght=re.forwardRef(function(e,n){const s=e,{value:r,size:i=Lye,level:a=jye,bgColor:o=Pye,fgColor:l=Mye,includeMargin:u=Dye,minVersion:d=Oye,boostLevel:f,marginSize:p,imageSettings:m}=s,x=b9(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=x,S=b9(x,["style"]),_=m==null?void 0:m.src,E=re.useRef(null),T=re.useRef(null),k=re.useCallback(U=>{E.current=U,typeof n=="function"?n(U):n&&(n.current=U)},[n]),[R,I]=re.useState(!1),{margin:A,cells:L,numCells:j,calculatedImageSettings:F}=Uye({value:r,level:a,minVersion:d,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:m,size:i});re.useEffect(()=>{if(E.current!=null){const U=E.current,G=U.getContext("2d");if(!G)return;let $=L;const V=T.current,B=F!=null&&V!==null&&V.complete&&V.naturalHeight!==0&&V.naturalWidth!==0;B&&F.excavation!=null&&($=Fye(L,F.excavation));const q=window.devicePixelRatio||1;U.height=U.width=i*q;const z=i/j*q;G.scale(z,z),G.fillStyle=o,G.fillRect(0,0,j,j),G.fillStyle=l,Hht?G.fill(new Path2D($ye($,A))):L.forEach(function(D,K){D.forEach(function(Y,J){Y&&G.fillRect(J+A,K+A,1,1)})}),F&&(G.globalAlpha=F.opacity),B&&G.drawImage(V,F.x+A,F.y+A,F.w,F.h)}}),re.useEffect(()=>{I(!1)},[_]);const O=y9({height:i,width:i},y);let M=null;return _!=null&&(M=re.createElement("img",{src:_,key:_,style:{display:"none"},onLoad:()=>{I(!0)},ref:T,crossOrigin:F==null?void 0:F.crossOrigin})),re.createElement(re.Fragment,null,re.createElement("canvas",y9({style:O,height:i,width:i,ref:k,role:"img"},S)),M)});Ght.displayName="QRCodeCanvas";var Bye=re.forwardRef(function(e,n){const s=e,{value:r,size:i=Lye,level:a=jye,bgColor:o=Pye,fgColor:l=Mye,includeMargin:u=Dye,minVersion:d=Oye,boostLevel:f,title:p,marginSize:m,imageSettings:v}=s,x=b9(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:S,numCells:_,calculatedImageSettings:E}=Uye({value:r,level:a,minVersion:d,boostLevel:f,includeMargin:u,marginSize:m,imageSettings:v,size:i});let T=S,k=null;v!=null&&E!=null&&(E.excavation!=null&&(T=Fye(S,E.excavation)),k=re.createElement("image",{href:v.src,height:E.h,width:E.w,x:E.x+y,y:E.y+y,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const R=$ye(T,y);return re.createElement("svg",y9({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:n,role:"img"},x),!!p&&re.createElement("title",null,p),re.createElement("path",{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:"crispEdges"}),re.createElement("path",{fill:l,d:R,shapeRendering:"crispEdges"}),k)});Bye.displayName="QRCodeSVG";const bf="flex items-center min-w-px h-[44px] px-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",Kne="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",Sc="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",x8="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",y8="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]";function KE(t,e=!1){return`${e?"":"flex-1 "}flex h-[40px] items-center justify-center ${e?"px-[16px]":"px-[12px]"} rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] ${t?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95"}`}function Yne({value:t,label:e}){return c.jsxs("div",{className:"bg-[var(--sand-3)] flex gap-[10px] h-[44px] items-center pl-[12px] pr-[8px] rounded-[8px] w-full",children:[c.jsx("span",{className:"flex-1 min-w-px truncate font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:t}),c.jsxs("button",{type:"button",onClick:()=>t&&Ja(t,e),"aria-label":`Copy ${e}`,className:"shrink-0 flex h-[26px] items-center gap-[6px] px-[10px] rounded-[999px] bg-[var(--sand-5)] text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-6)] curs
512or-pointer",children:[c.jsx(Pd,{size:16}),"Copy"]})]})}function YE({title:t,subtitle:e,action:n}){return c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:t}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:e})]}),n]})}function Wht({value:t,onChange:e}){const n=w.useRef([]),s=(r,i)=>{var l;const a=i.replace(/\D/g,"").slice(-1),o=t.padEnd(6).split("");o[r]=a||" ",e(o.join("").replace(/\s+$/g,"").replace(/ /g,"")),a&&r<5&&((l=n.current[r+1])==null||l.focus())};return c.jsx("div",{className:"flex justify-center gap-[8px] w-full",children:Array.from({length:6}).map((r,i)=>c.jsx("input",{ref:a=>{n.current[i]=a},inputMode:"numeric",maxLength:1,value:t[i]??"",onChange:a=>s(i,a.target.value),onKeyDown:a=>{var o;a.key==="Backspace"&&!t[i]&&i>0&&((o=n.current[i-1])==null||o.focus())},className:"size-[48px] shrink-0 bg-[var(--sand-3)] rounded-[8px] outline-none text-center font-medium text-[16px] leading-[24px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]"},i))})}const qht=232;function Kht({onComplete:t,busy:e}){const[s,r]=w.useState(!1),i=w.useRef(null),a=()=>{i.current!=null&&(clearTimeout(i.current),i.current=null),r(!1)},o=()=>{e||(r(!0),i.current=window.setTimeout(()=>{r(!1),t()},5e3))};return w.useEffect(()=>()=>{i.current!=null&&clearTimeout(i.current)},[]),c.jsxs("button",{type:"button",disabled:e,onPointerDown:o,onPointerUp:a,onPointerLeave:a,onPointerCancel:a,className:"relative flex h-[40px] cursor-pointer select-none items-center justify-center overflow-hidden rounded-[8px] px-[16px] bg-[var(--sand-4)] text-[14px] font-medium leading-[20px] text-danger disabled:cursor-not-allowed disabled:opacity-60",children:[c.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 bg-[var(--red-3)]",style:{width:s?"100%":"0%",transition:s?"width 5000ms linear":"width 150ms ease-out"}}),c.jsx("span",{className:"relative z-[1]",children:e?"Deleting…":"Hold to delete account"})]})}function Yht(){const{user:t,isLoaded:e}=Vi(),{sessionId:n}=zt(),[s,r]=w.useState(!1),[i,a]=w.useState(""),[o,l]=w.useState(""),[u,d]=w.useState(""),[f,p]=w.useState(!1),[m,v]=w.useState(null),[x,y]=w.useState(!1),[S,_]=w.useState(1),[E,T]=w.useState(null),[k,R]=w.useState(""),[I,A]=w.useState([]),[L,j]=w.useState(!1),[F,O]=w.useState(!1),[M,U]=w.useState(null),[G,$]=w.useState(null),[V,B]=w.useState(!1),q=w.useRef(null),z=w.useRef(null),D=w.useRef(null),K=w.useRef(null),Y=w.useRef(null),J=w.useRef(null),{render:ne,exiting:Q}=Kh(x,220),[ee,te]=w.useState(!1),[ue,ye]=w.useState(!1),[je,Re]=w.useState(!1),[me,Ce]=w.useState(!1),[Xe,he]=w.useState([]),[De,Ge]=w.useState(!0),[Je,Le]=w.useState(null),[qe,et]=w.useState(!1),[Ct,Ke]=w.useState(!1),[dt,Xt]=w.useState(!1),_n=()=>{t&&t.getSessions().then(Me=>he(Me)).catch(()=>{}).finally(()=>Ge(!1))};w.useEffect(()=>{_n()},[t==null?void 0:t.id]);const Dt=F?"verifying":S===1?V?"manual":"qr":S===2?"otp":"codes";if(w.useLayoutEffect(()=>{var Me,Ut,Nn,Cs;ne&&$(Dt==="verifying"?qht:Dt==="qr"?((Me=z.current)==null?void 0:Me.offsetHeight)??null:Dt==="manual"?((Ut=D.current)==null?void 0:Ut.offsetHeight)??null:Dt==="otp"?((Nn=K.current)==null?void 0:Nn.offsetHeight)??null:((Cs=Y.current)==null?void 0:Cs.offsetHeight)??null)},[ne,Dt]),w.useEffect(()=>{if(!x)return;const Me=Nn=>Nn.key==="Escape"&&y(!1);document.addEventListener("keydown",Me);const Ut=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",Me),document.body.style.overflow=Ut}},[x]),!e)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"})});if(!t)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No active user."})});const nn=!f&&o.length>=10&&/[A-Z]/.test(o)&&/[^A-Za-z0-9]/.test(o)&&o===u&&(!t.passwordEnabled||i.length>0),fn=()=>{a(""),l(""),d(""),v(null),r(!0)},Tt=async()=>
512{if(nn){p(!0),v(null);try{await t.updatePassword({newPassword:o,currentPassword:t.passwordEnabled?i:void 0,signOutOfOtherSessions:!1}),na({title:"Password updated",shapes:!1}),r(!1)}catch(Me){v(Me instanceof Error?Me.message:"Could not update password.")}finally{p(!1)}}},Ie=async()=>{R(""),U(null),A([]),O(!1),B(!1),_(1);try{const Me=await t.createTOTP();T(Me),y(!0)}catch(Me){Bn({title:Me instanceof Error?Me.message:"Could not start 2FA setup"})}},Z=async()=>{if(!(k.length<6)){O(!0),U(null);try{await t.verifyTOTP({code:k});const Me=await t.createBackupCode();A(Me.codes),_(3)}catch(Me){U(Me instanceof Error?Me.message:"That code didn't match. Try again.")}finally{O(!1)}}},ie=async()=>{y(!1),await t.reload()},le=()=>{var Me,Ut;(Me=navigator.clipboard)==null||Me.writeText(I.join(`
513`)).catch(()=>{}),j(!0),setTimeout(()=>j(!1),1500),(Ut=J.current)==null||Ut.querySelectorAll("[data-code]").forEach((Nn,Cs)=>Nn.animate([{backgroundColor:"var(--sand-3)"},{backgroundColor:"var(--sand-5)",offset:.3},{backgroundColor:"var(--sand-3)"}],{duration:300,delay:Cs*20,easing:"ease-out"}))},Ee=()=>{const Me=new Blob([I.join(`
514`)],{type:"text/plain"}),Ut=URL.createObjectURL(Me),Nn=document.createElement("a");Nn.href=Ut,Nn.download="steel-backup-codes.txt",Nn.click(),URL.revokeObjectURL(Ut)},ke=async()=>{ye(!0);try{await t.disableTOTP(),await t.reload(),na({title:"Authenticator app disconnected",shapes:!1}),te(!1)}catch(Me){Bn({title:Me instanceof Error?Me.message:"Could not disconnect"})}finally{ye(!1)}},Ae=async()=>{Ce(!0);try{const Me=await t.createBackupCode();A(Me.codes),Re(!1),_(3),y(!0)}catch(Me){Bn({title:Me instanceof Error?Me.message:"Could not regenerate codes"})}finally{Ce(!1)}},Ye=async()=>{if(Je){et(!0);try{await Je.revoke(),_n(),na({title:"Device signed out",shapes:!1}),Le(null)}catch(Me){Bn({title:Me instanceof Error?Me.message:"Could not sign out device"})}finally{et(!1)}}},Qe=async()=>{Xt(!0);try{await t.delete(),window.location.assign("/")}catch(Me){Bn({title:Me instanceof Error?Me.message:"Could not delete account"}),Xt(!1)}},ft=Me=>{var Ut,Nn;return[(Ut=Me.latestActivity)==null?void 0:Ut.browserName,(Nn=Me.latestActivity)==null?void 0:Nn.browserVersion].filter(Boolean).join(" ")||"Unknown browser"};return c.jsxs("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsx("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:"Security"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage your password, two-factor authentication, and active devices."})]})}),c.jsxs("div",{className:"rise-in flex flex-col gap-[48px] p-[24px] w-full",children:[c.jsx(YE,{title:"Password",subtitle:"Change the password used to sign in to your account.",action:c.jsx("button",{type:"button",onClick:fn,className:Kne,children:"Change password"})}),c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsx(YE,{title:"Two-factor authentication",subtitle:"Add an extra layer of security with an authenticator app.",action:t.totpEnabled?void 0:c.jsx("button",{type:"button",onClick:()=>void Ie(),className:Kne,children:"Connect app"})}),t.totpEnabled&&c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex items-center justify-between gap-[16px] p-[24px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsxs("div",{className:"flex items-center gap-[8px]",children:[c.jsx(Yde,{size:20,className:"shrink-0 text-[var(--sand-12)]"}),c.jsx("span",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Authenticator App"}),c.jsx("span",{className:"flex h-[20px] items-center px-[8px] rounded-[999px] font-medium text-[12px] leading-[20px] bg-[var(--blue-3)] dark:bg-[#10243e] text-[var(--blue-11)] dark:text-[#52a9ff]",children:"Primary"})]}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Use the 6-digit codes from your authenticator app."})]}),c.jsx("button",{type:"button","aria-label":"Disconnect authenticator app",onClick:()=>te(!0),className:"cursor-pointer shrink-0 flex items-center justify-center size-[40px] rounded-full bg-[var(--sand-4)] hover:bg-[var(--sand-5)] text-danger transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(kye,{size:20})})]}),c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex items-center justify-between gap-[16px] p-[24px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsxs("div",{className:"flex items-center gap-[8px]",children:[c.jsx(RS,{size:20,className:"shrink-0 text-[var(--sand-12)]"}),c.jsx("span",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Backup codes"})]}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Single-use recovery codes for when you lose access."})]}),c.jsx("button",{type:"button","aria-label":"Regenerate backup codes",onClick:()=>Re(!0),className:"cursor-pointer shrink-0 flex items-center justify-center size-[40px] rounded-full bg-[var(--sand-4)] hover:bg-[var(--sand-5)] text-[var(--sand-11)] hover:text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(fR,{size:20})})]})]})]}),c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsx(YE,{title:"Active devices",subtitle:"Devices currently signed in to your account."}),c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${bf} flex-1 bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Browser"}),c.jsx("div",{className:`${bf} flex-1 border-l-[0.5px] bg-[var(--sand-3)] text-[var(--sand-12)]`,children:"Last active"}),c.jsx("div",{className:`${bf} flex-none w-[44px] border-l-[0.5px] bg-[var(--sand-3)]`})]}),De&&c.jsx("div",{className:"flex w-full",children:c.jsx("div",{className:`${bf} flex-1 justify-center text-[var(--sand-10)]`,children:"Loading sessions…"})}),!De&&Xe.map(Me=>{const Ut=Me.id===n;return c.jsxs("div",{className:"flex w-full",children:[c.jsxs("div",{className:`${bf} flex-1 text-[var(--sand-12)] gap-[8px] overflow-hidden`,children:[c.jsx("span",{className:"truncate min-w-0",children:ft(Me)}),Ut&&c.jsx("span",{className:"shrink-0 flex h-[20px] items-center px-[8px] rounded-[999px] font-medium text-[12px] leading-[20px] bg-[var(--green-3)] dark:bg-[#0c2417] text-[var(--green-11)] dark:text-[#34d399]",children:"This device"})]}),c.jsx("div",{className:`${bf} flex-1 border-l-[0.5px] text-[var(--sand-11)]`,children:zm(Me.lastActiveAt)}),c.jsx("div",{className:`${bf} flex-none w-[44px] !px-0 justify-center border-l-[0.5px]`,children:!Ut&&c.jsx("button",{type:"button",onClick:()=>Le(Me),"aria-label":"Sign out this device",title:"Sign out",className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.92] flex size-[32px] items-center justify-center rounded-full text-[var(--red-11)] dark:text-[#f87171] hover:bg-[var(--sand-4)]",children:c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:"size-[18px]","aria-hidden":"true",children:[c.jsx("path",{d:"M9 21H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M16 17l5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M21 12H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})})]},Me.id)}
514),!De&&Xe.length===0&&c.jsx("div",{className:"flex w-full",children:c.jsx("div",{className:`${bf} flex-1 justify-center text-[var(--sand-10)]`,children:"No active sessions."})})]})]}),c.jsxs("div",{className:"flex flex-col gap-[4px]",children:[c.jsx("p",{className:"font-medium text-[20px] leading-[28px] text-[var(--red-11)]",children:"Danger zone"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"These actions are irreversible. Attempt at your own risk."})]}),c.jsx(YE,{title:"Delete account",subtitle:"Permanently delete your account and all of its data.",action:c.jsx("button",{type:"button",onClick:()=>Ke(!0),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-3)] hover:bg-danger-hover flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-danger",children:"Delete account"})})]})]}),c.jsx(ss,{open:s,onClose:()=>{f||r(!1)},noIcon:!0,title:"Change password",subtitle:"Enter a new password for your account.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>r(!1),disabled:f,className:Sc,children:"Cancel"}),c.jsx("button",{type:"submit",form:"change-password-form",disabled:!nn,className:KE(!nn,!0),children:f?"Updating…":"Update password"})]}),children:c.jsxs("form",{id:"change-password-form",onSubmit:Me=>{Me.preventDefault(),Tt()},className:"flex flex-col gap-[16px] w-full",children:[t.passwordEnabled&&c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Current password"}),c.jsx("input",{type:"password",value:i,onChange:Me=>a(Me.target.value),placeholder:"Enter your current password",className:y8})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"New password"}),c.jsx("input",{type:"password",autoFocus:!0,value:o,onChange:Me=>l(Me.target.value),placeholder:"Enter your new password",className:y8}),c.jsx("p",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-10)]",children:"Password must contain at least 10 characters, 1 uppercase and 1 special character (!@#$%&*…)."})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Confirm new password"}),c.jsx("input",{type:"password",value:u,onChange:Me=>d(Me.target.value),placeholder:"Re-enter your new password",className:y8})]}),m&&c.jsx("p",{className:"font-medium text-[13px] leading-[18px] text-danger",children:m})]})}),ne&&typeof document<"u"&&nr.createPortal(c.jsx("div",{className:`${Q?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/70 backdrop-blur-[8px]`,onMouseDown:Me=>{q.current&&!q.current.contains(Me.target)&&y(!1)},children:c.jsxs("div",{ref:q,role:"dialog","aria-modal":"true",style:G?{height:G}:void 0,className:`${Q?"modal-card-out":"modal-card-in"} relative overflow-hidden bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full shadow-modal transition-[height] [transition-duration:400ms] [transition-timing-function:var(--ease-out)]`,children:[c.jsxs("div",{ref:z,className:`absolute inset-x-0 top-0 flex flex-col transition-[opacity,filter] duration-300 [transition-timing-function:var(--ease-out)] ${Dt==="qr"?"opacity-100 blur-0 [transition-delay:300ms]":"opacity-0 blur-[6px] pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Set up authenticator app"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Scan this QR code with your authenticator app, then continue."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[c.jsx("div",{className:"self-center bg-[var(--sand-12)] rounded-[12px] p-[16px]",children:E!=null&&E.uri?c.jsx(Bye,{value:E.uri,size:180,bgColor:"var(--sand-12)",fgColor:"var(--sand-1)"}):c.jsx("div",{className:"size-[180px]"})}),c.jsx("button",{type:"button",onClick:()=>B(!0),className:"self-center cursor-pointer text-[var(--sand-10)] text-[14px] leading-[20px] font-medium underline decoration-dotted underline-offset-[3px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:"Can't scan QR code?"})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>y(!1),className:Sc,children:"Close"}),c.jsx("button",{type:"button",onClick:()=>_(2),className:KE(!1,!0),children:"Continue"})]})]}),c.jsxs("div",{ref:D,className:`absolute inset-x-0 top-0 flex flex-col transition-[opacity,filter] duration-300 [transition-timing-function:var(--ease-out)] ${Dt==="manual"?"opacity-100 blur-0 [transition-delay:300ms]":"opacity-0 blur-[6px] pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Add authenticator application"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Set up a new sign-in method in your authenticator and enter the Key provided below."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[c.jsxs("div",{className:"flex flex-col gap-[4px]",children:[c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Make sure Time-based or One-time passwords is enabled, then finish linking your account."}),c.jsx(Yne,{value:(E==null?void 0:E.secret)??"",label:"Key"})]}),c.jsxs("div",{className:"flex flex-col gap-[4px]",children:[c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Alternatively, if your authenticator supports TOTP URIs, you can also copy the full URI."}),c.jsx(Yne,{value:(E==null?void 0:E.uri)??"",label:"URI"})]}),c.jsx("button",{type:"button",onClick:()=>B(!1),className:"self-center cursor-pointer text-[var(--sand-10)] text-[14px] leading-[20px] font-medium underline decoration-dotted underline-offset-[3px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:"Scan QR code instead?"})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>y(!1),className:Sc,children:"Close"}),c.jsx("button",{type:"button",onClick:()=>{B(!1),_(2)},className:KE(!1,!0),children:"Continue"})]})]}),c.jsxs("div",{ref:K,className:`absolute inset-x-0 top-0 flex flex-col transition-[opacity,filter] duration-300 [transition-timing-function:var(--ease-out)] ${Dt==="otp"?"opacity-100 blur-0 [transition-delay:300ms]":"opacity-0 blur-[6px] pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Enter the 6-digit code"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Enter the code from your authenticator app to connect it."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex min-h-[280px] flex-col justify-center gap-[16px] p-[16px]",children:[c.jsx(Wht,{value:k,onChange:R}),M&&c.jsx("p",{className:"text-center font-medium text-[13px] leading-[18px] text-danger",children:M})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>_(1),className:Sc,children:"Back"}),c.jsx("button",{type:"button",disabled:k.length<6,onClick:()=>void Z(),className:KE(k.length<6,!0),children:"Continue"})]})]}),c.jsxs("div",{className:`absolute inset-0 p-[32px] flex flex-col items-center justify-center gap-[16px] transition-[opacity,filter] duration-300 [transition-timing-function:var(--ease-out)] ${Dt==="verifying"?"opacity-100 blur-0 [transition-delay:300ms]":"opacity-0 blur-[6px] pointer-events-none delay-0"}`,children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px] text-center",children:"Verifying code"})]}),c.jsxs("div",{ref:Y,className:`absolute inset-x-0 top-0 flex flex-col transition-[opacity,filter] duration-300 [transition-timing-function:var(--ease-out)] ${Dt==="codes"?"opacity-100 blur-0 [transition-delay:300ms]":"opacity-0 blur-[6px] pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Save your backup codes"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Store these somewhere safe. Each code can be used once if you lose access to your app."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsx("div",{className:"p-[16px]",children:c.jsx("div",{ref:J,className:"grid grid-cols-2 gap-[12px] w-full",children:I.map(Me=>c.jsx("div",{"data-code":!0,className:"bg-[var(--sand-3)] border-[0.5px] border-solid border-[var(--sand-6)] flex items-center justify-center h-[44px] rounded-[8px] font-medium text-[14px] leading-[20px] tracking-[0.12em] text-[var(--sand-12)]",children:Me},Me))})}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsxs("div",{className:"flex gap-[12px]",children:[c.jsxs("button",{type:"button",onClick:Ee,className:`${Sc} gap-[8px]`,children:[c.jsx(Aye,{size:18,className:"shrink-0"}),"Download"]}),c.jsxs("button",{type:"button",onClick:le,className:`${Sc} gap-[8px]`,children:[c.jsx(Dht,{size:18,className:"shrink-0"}),L?"Copied":"Copy"]})]}),c.jsx("button",{type:"button",onClick:()=>void ie(),className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Close"})]})]})]})}),document.body),c.jsx(ss,{open:ee,onClose:()=>{ue||te(!1)}
514,noIcon:!0,danger:!0,title:"Are you sure?",subtitle:"Are you sure you want to disconnect the app? You can reconnect it anytime.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>te(!1),disabled:ue,className:Sc,children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>void ke(),disabled:ue,className:x8,children:ue?"Disconnecting…":"Yes, disconnect"})]}),children:null}),c.jsx(ss,{open:je,onClose:()=>{me||Re(!1)},noIcon:!0,title:"Regenerate backup codes?",subtitle:"Are you sure you want to regenerate backup codes? You will lose access to your old ones.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>Re(!1),disabled:me,className:Sc,children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>void Ae(),disabled:me,className:x8,children:me?"Regenerating…":"Yes, regenerate"})]}),children:null}),c.jsx(ss,{open:Je!==null,onClose:()=>{qe||Le(null)},noIcon:!0,title:"Sign out this device?",subtitle:Je?`${ft(Je)} will be signed out and need to log in again.`:"This device will be signed out and need to log in again.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>Le(null),disabled:qe,className:Sc,children:"Cancel"}),c.jsx("button",{type:"button",onClick:()=>void Ye(),disabled:qe,className:x8,children:qe?"Signing out…":"Yes, sign out"})]}),children:null}),c.jsx(ss,{open:Ct,onClose:()=>{dt||Ke(!1)},noIcon:!0,danger:!0,title:"Delete account?",subtitle:"This permanently deletes your account and all of its data. This cannot be undone.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>Ke(!1),disabled:dt,className:Sc,children:"Cancel"}),c.jsx(Kht,{onComplete:()=>void Qe(),busy:dt})]}),children:null})]})}function Zht(){return Gs().hash==="#/security"?c.jsx(Yht,{}):c.jsx(Mht,{})}function zye(){return N4("finish-setup")??!1}function Xht({className:t}){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:t,children:c.jsx("path",{d:"M15.0026 12.5V5M15.0026 5H7.5026M15.0026 5L5.21094 14.7917",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}const Qht=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];function Vye(){const{theme:t,setTheme:e}=I4(),n=w.useId();return c.jsxs("div",{className:"flex flex-col gap-[6px] px-[8px] py-[6px]",children:[c.jsx("span",{id:n,className:"text-[12px] leading-[16px] font-medium text-[var(--sand-11)]",children:"Theme"}),c.jsx(N$,{options:Qht,value:t,onChange:e,layoutId:`theme-pill-${n}`,labelledBy:n,trackClassName:"bg-[var(--sand-3)] [&>button]:flex-1 [&>button]:px-[8px] [&>button]:h-[28px] [&>button]:text-[13px]",pillClassName:"bg-[var(--sand-1)] shadow-[0_1px_2px_rgba(0,0,0,0.08)] dark:bg-[var(--sand-6)] dark:shadow-none"})]})}function Jht(){const{user:t}=Vi(),{signOut:e}=Qm(),n=di(),[s,r]=w.useState(!1),i=w.useRef(null);return w.useEffect(()=>{if(!s)return;const a=l=>{i.current&&!i.current.contains(l.target)&&r(!1)},o=l=>l.key==="Escape"&&r(!1);return document.addEventListener("pointerdown",a),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",a),document.removeEventListener("keydown",o)}},[s]),c.jsxs("div",{ref:i,className:"relative",children:[c.jsx("button",{type:"button","aria-label":"Account","aria-haspopup":"menu","aria-expanded":s,onClick:()=>r(a=>!a),className:"group cursor-pointer border-[0.5px] border-solid border-[var(--sand-6)] hover:border-[var(--sand-9)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] rounded-[999px] size-[30px] overflow-hidden block",children:t!=null&&t.hasImage?c.jsx("img",{src:t.imageUrl,alt:"",className:"size-full object-cover"}):c.jsx("span",{className:"size-full flex items-center justify-center bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] group-hover:bg-[var(--sand-5)]",children:c.jsx(U1,{size:20,className:"text-[var(--sand-11)]"})})}),s&&c.jsxs("div",{role:"menu",className:"origin-top absolute right-0 top-[calc(100%+6px)] z-50 flex flex-col gap-[4px] w-[220px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:[c.jsx("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),n("/settings/profile")},className:"w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:"Manage account"}),c.jsx("div",{className:"h-[0.5px] -mx-[4px] bg-[var(--sand-6)]"}),c.jsx(Vye,{}),c.jsx("div",{className:"h-[0.5px] -mx-[4px] bg-[var(--sand-6)]"}),c.jsx("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),e()},className:"w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] text-danger transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-danger-hover",children:"Sign out"})]})]})}const ept=[{emoji:c.jsx(lBe,{className:"w-4 h-4"}),label:"Laugh",color:"green"},{emoji:c.jsx(fBe,{className:"w-4 h-4"}),label:"Smile",color:"blue"},{emoji:c.jsx(oBe,{className:"w-4 h-4"}),label:"Frown",color:"yellow"},{emoji:c.jsx(nBe,{className:"w-4 h-4"}),label:"Angry",color:"red"}],tpt={green:"bg-[var(--green-a3)] text-[var(--green-11)]",blue:"bg-[var(--blue-a3)] text-[var(--blue-11)]",yellow:"bg-[var(--yellow-a3)] text-[var(--yellow-11)]",red:"bg-[var(--red-a3)] text-[var(--red-11)]"},npt=[{value:"performance",label:"Performance"},{value:"bug",label:"Bug Report"},{value:"feature",label:"Feature Request"},{value:"ui",label:"User Interface"},{value:"api",label:"API and Documentation"},{value:"security",label:"Security and Privacy"},{value:"billing",label:"Billing and Subscription"},{value:"accessibility",label:"Accessibility"},{value:"marketplace",label:"Marketplace and Integrations"},{value:"other",label:"Other"}],YS=L7((t,e)=>({feedback:"",selectedTopic:null,selectedReaction:null,isLoading:!1,isSubmitted:!1,errors:{},setFeedback:n=>t({feedback:n}),setSelectedTopic:n=>
514t({selectedTopic:n}),setSelectedReaction:n=>t({selectedReaction:n}),setIsLoading:n=>t({isLoading:n}),setIsSubmitted:n=>t({isSubmitted:n}),setErrors:n=>t({errors:n}),resetForm:()=>t({feedback:"",selectedTopic:null,selectedReaction:null,errors:{},isLoading:!1}),submitFeedback:async()=>{var i,a;const{feedback:n,selectedTopic:s}=e(),r={};if(s||(r.topic="Please select a topic"),n.trim()||(r.feedback="Please enter your feedback"),Object.keys(r).length>0){t({errors:r});return}t({isLoading:!0});try{const o=await Bme({body:{topic:s,feedback:n.trim(),reaction:e().selectedReaction||void 0}});if(!((i=o.data)!=null&&i.success))throw new Error(((a=o.data)==null?void 0:a.message)||"Failed to send feedback");t({feedback:"",selectedTopic:null,selectedReaction:null,errors:{},isLoading:!1,isSubmitted:!0})}catch(o){console.error("Failed to send feedback:",o),t({isLoading:!1,errors:{feedback:o instanceof Error?o.message:"Failed to send feedback. Please try again."}})}}})),spt=()=>c.jsxs("div",{className:"p-8 text-center space-y-4 transition-all will-change-transform transform-gpu",children:[c.jsx("div",{className:"w-8 h-8 bg-green-500 text-[var(--sand-12)] rounded-full mx-auto flex items-center justify-center",children:c.jsx(jde,{className:"transform-gpu will-change-transform"})}),c.jsxs("div",{className:"space-y-1 transform-gpu will-change-transform",children:[c.jsx("h3",{className:"font-medium text-[var(--sand-12)]",children:"Your feedback has been received!"}),c.jsx("p",{className:"text-[var(--sand-10)] text-sm",children:"Thank you for your help."})]})]}),rpt=()=>{const{selectedTopic:t,setSelectedTopic:e,errors:n}=YS();return c.jsxs("div",{className:"space-y-1",children:[c.jsxs(PS,{value:t||"",onValueChange:e,children:[c.jsx(DS,{className:`w-full border-0 shadow-none focus:ring-0 focus:ring-offset-0 bg-[var(--sand-3)] hover:bg-[var(--sand-4)] data-[state=open]:bg-[var(--sand-4)] text-[var(--sand-12)] rounded-[8px] h-[40px] px-[12px] text-[14px] transition-colors duration-150 ${n.topic?"ring-1 ring-red-500":""}`,children:c.jsx(MS,{placeholder:"Select a topic"})}),c.jsx(W1,{className:"max-h-[480px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] rounded-[8px] shadow-menu",children:npt.map(s=>c.jsx(hd,{value:s.value,className:"h-[40px] py-0 cursor-pointer text-[var(--sand-10)] text-[14px] leading-[20px] rounded-[6px] focus:bg-[var(--sand-4)] focus:text-[var(--sand-12)] data-[highlighted]:bg-[var(--sand-4)] data-[highlighted]:text-[var(--sand-12)] data-[state=checked]:bg-[var(--sand-5)] data-[state=checked]:text-[var(--sand-12)]",children:s.label},s.value))})]}),n.topic&&c.jsxs("div",{className:"flex items-center gap-1 text-red-500 text-xs",children:[c.jsx(j7,{className:"w-3 h-3"}),c.jsx("span",{children:n.topic})]})]})},ipt=()=>{const{feedback:t,setFeedback:e,errors:n}=YS();return c.jsxs("div",{className:"space-y-1",children:[c.jsx(sR,{placeholder:"Share your feedback...",value:t,onChange:s=>e(s.target.value),className:`min-h-32 border-0 shadow-none focus-visible:ring-0 focus:ring-0 bg-[var(--sand-3)] text-[var(--sand-12)] text-[14px] placeholder:text-[var(--sand-9)] resize-none rounded-[8px] px-[12px] py-[10px] transition-colors duration-150 ${n.feedback?"ring-1 ring-red-500":""}`}),n.feedback&&c.jsxs("div",{className:"flex items-center gap-1 text-red-500 text-xs",children:[c.jsx(j7,{className:"w-3 h-3"}),c.jsx("span",{children:n.feedback})]})]})},apt=()=>{const{selectedReaction:t,setSelectedReaction:e}=YS();return c.jsx("div",{className:"flex items-center gap-[4px] ml-2",children:ept.map(n=>{const s=t===n.label;return c.jsx("button",{type:"button",onClick:()=>e(n.label),title:n.label,className:`flex w-8 h-8 items-center justify-center rounded-full cursor-pointer transition-colors duration-150 ease-out ${s?tpt[n.color]:"text-[var(--sand-10)] hover:bg-[var(--sand-3)] hover:text-[var(--sand-12)]"}`,children:n.emoji},n.label)})})},opt=()=>{const{isLoading:t,submitFeedback:e}=YS();return c.jsx(Zt,{onClick:async()=>{await e()},disabled:t,size:"sm",className:"h-[36px] bg-[var(--sand-12)] text-[var(--sand-1)] hover:bg-[var(--sand-11)] disabled:opacity-70 disabled:cursor-not-allowed rounded-[8px] px-4 py-2 text-[14px] font-medium transition-all duration-200 hover:shadow-md",children:t?c.jsxs(c.Fragment,{children:[c.jsx(kd,{className:"w-4 h-4 mr-2 animate-spin"}),"Sending..."]}):"Send"})},lpt=()=>c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"p-2 space-y-2",children:[c.jsx(rpt,{}),c.jsx(ipt,{})]}),c.jsx("div",{className:"p-2 bg-[var(--sand-2)] border-t-[0.5px] border-[var(--sand-6)]",children:c.jsxs("div",{className:"text-xs text-[var(--sand-9)] flex items-center justify-between gap-1",children:[c.jsx(apt,{}),c.jsx(opt,{})]})})]}),Hye=({trigger:t})=>{const{isSubmitted:e,setIsSubmitted:n,setErrors:s}=YS();return c.jsxs(HS,{onOpenChange:r=>{r||setTimeout(()=>{n(!1),s({})},500)},children:[c.jsx(GS,{asChild:!0,children:t??c.jsx(Zt,{variant:"ghost",className:"h-[40px] rounded-md pl-[12px] pr-[10px] text-[14px] font-medium text-[var(--sand-12)] bg-[var(--sand-3)] hover:bg-[var(--sand-4)] transition-colors",children:"Leave feedback"})}),c.jsx(Q1,{className:"w-[22rem] p-0 bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-xl rounded-xl overflow-hidden",sideOffset:8,children:e?c.jsx(spt,{}):c.jsx(lpt,{})})]})};function Gye({color:t="var(--team)"}){const e=[[0,0],[0,10],[5,5],[5,15],[10,0],[10,10],[15,5],[15,15]];return c.jsx("div",{className:"relative size-[20px] overflow-hidden shrink-0 [--team:var(--amber-9)] dark:[--team:#f5d90a]",children:e.map(([n,s],r)=>c.jsx("span",{className:"absolute size-[5px]",style:{left:n,top:s,background:t}},r))})}function Zne({imageUrl:t,color:e}){return t?c.jsx("img",{src:t,alt:"",className:"size-[22px] shrink-0 rounded-[6px] object-cover"}):c.jsx(Gye,{color:e})}const cpt=320;function upt(t){const e=t==null?void 0:t.replace(/^org:/,"").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"Member"}function Xne({role:t}){return c.jsx("span",{className:`flex h-[20px] shrink-0 items-center rounded-[999px] px-[6px] text-[12px] font-medium leading-[20px] ${t==="org:admin"?"bg-[var(--yellow-3)] dark:bg-[#3d2e00] text-[var(--yellow-11)] dark:text-[#f0c000]":"bg-[var(--sand-4)] text-[var(--sand-11)]"}`,children:upt(t)}
514)}const Wye=({fullWidth:t=!1})=>{const{createOrganization:e,organization:n,setActive:s,user:r}=Qm(),[i,a]=w.useState(!1),[o,l]=w.useState(!1),[u,d]=w.useState(!1),[f,p]=w.useState(""),[m,v]=w.useState(""),[x,y]=w.useState(null),S=w.useRef(null),_=w.useRef(null),E=w.useRef(null),[T,k]=w.useState(null),R=(r==null?void 0:r.organizationMemberships)??[],I=R.find(U=>U.organization.id===(n==null?void 0:n.id)),A=m.trim().toLowerCase(),L=A?R.filter(U=>U.organization.name.toLowerCase().includes(A)):R;w.useEffect(()=>{if(!i)return;const U=()=>a(!1),G=B=>{var z,D;const q=B.target;(z=S.current)!=null&&z.contains(q)||(D=_.current)!=null&&D.contains(q)||U()},$=B=>{B.key==="Escape"&&U()},V=B=>{var q;(q=_.current)!=null&&q.contains(B.target)||U()};return document.addEventListener("pointerdown",G),document.addEventListener("keydown",$),window.addEventListener("resize",U),window.addEventListener("scroll",V,!0),()=>{document.removeEventListener("pointerdown",G),document.removeEventListener("keydown",$),window.removeEventListener("resize",U),window.removeEventListener("scroll",V,!0)}},[i]);const j=()=>a(!1),F=()=>{var G;v("");const U=(G=E.current)==null?void 0:G.getBoundingClientRect();if(U){const $=Math.max(U.width,cpt);k({left:Math.max(8,Math.min(U.left,window.innerWidth-$-8)),top:U.bottom+6,width:$})}a(!0)},O=async U=>{y(null),await(s==null?void 0:s({organization:U})),j()},M=async()=>{const U=f.trim();if(!(!U||u)){d(!0),y(null);try{const G=await e({name:U});await(s==null?void 0:s({organization:G})),p(""),j(),l(!1)}catch(G){y(G instanceof Error?G.message:"Could not create organization.")}finally{d(!1)}}};return c.jsxs("div",{ref:S,className:t?"w-full":void 0,children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":i,ref:E,onClick:()=>i?j():F(),className:`cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[8px] h-[40px] items-center pl-[12px] pr-[10px] rounded-[8px]${t?" w-full justify-between":""}`,children:[c.jsxs("div",{className:"flex gap-[8px] items-center min-w-px",children:[c.jsx(Zne,{imageUrl:n==null?void 0:n.imageUrl}),c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap max-w-[160px] truncate",children:(n==null?void 0:n.name)??"Select org"}),c.jsx(Xne,{role:I==null?void 0:I.role})]}),c.jsx(G1,{size:20,className:"size-[20px] text-[var(--sand-9)]"})]}),i&&T&&nr.createPortal(c.jsxs("div",{role:"menu",ref:_,style:{left:T.left,top:T.top,width:T.width},className:"origin-top fixed z-[100] flex flex-col rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:[c.jsxs("div",{className:"flex h-[44px] shrink-0 items-center gap-[8px] pl-[12px] pr-[8px]",children:[c.jsx("input",{value:m,autoFocus:!0,onChange:U=>v(U.target.value),placeholder:"Find organization...","aria-label":"Find organization",className:"min-w-px flex-1 bg-transparent font-medium text-[14px] leading-[20px] text-[var(--sand-12)] outline-none placeholder:text-[var(--sand-10)]"}),c.jsx("button",{type:"button",onClick:j,"aria-label":"Close",className:"shrink-0 cursor-pointer rounded-[5px] border-[0.5px] border-solid border-[var(--sand-6)] px-[6px] py-[2px] font-medium text-[12px] leading-[16px] text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:"Esc"})]}),c.jsx("div",{className:"h-[0.5px] bg-[var(--sand-6)]"}),c.jsxs("div",{className:"flex max-h-[280px] flex-col gap-[4px] overflow-y-auto overscroll-contain p-[6px]",children:[L.map(U=>{const G=U.organization,$=G.id===(n==null?void 0:n.id);return c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void O(G),className:`w-full text-left cursor-pointer flex items-center gap-[8px] h-[40px] shrink-0 px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] ${$?"bg-[var(--sand-4)] text-[var(--sand-12)]":"text-[var(--sand-11)]"}`,children:[c.jsx(Zne,{imageUrl:G.imageUrl,color:$?"var(--team)":"var(--sand-10)"}),c.jsx("span",{className:"min-w-px truncate whitespace-nowrap",children:G.name}),c.jsx(Xne,{role:U.role}
514),c.jsx("span",{className:"ml-auto flex size-[16px] shrink-0 items-center justify-center",children:$&&c.jsx(cde,{className:"size-[16px] text-[var(--sand-12)]"})})]},G.id)}),L.length===0&&c.jsx("p",{className:"flex h-[40px] items-center px-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No organizations found"})]}),c.jsx("div",{className:"h-[0.5px] bg-[var(--sand-6)]"}),c.jsx("div",{className:"p-[6px]",children:c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{j(),y(null),l(!0)},className:"w-full text-left cursor-pointer flex items-center gap-[10px] px-[8px] py-[8px] rounded-[6px] text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:[c.jsx(DFe,{className:"size-[18px] shrink-0"}),c.jsxs("span",{className:"flex min-w-px flex-col",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px]",children:"Create organization"}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-10)]",children:"Collaborate with others in a shared workspace"})]})]})})]}),document.body),c.jsx(dpt,{open:o,creating:u,error:x,name:f,onNameChange:p,onClose:()=>{u||(l(!1),y(null))},onSubmit:M})]})};function dpt({open:t,creating:e,error:n,name:s,onClose:r,onNameChange:i,onSubmit:a}){const o=w.useRef(null),{render:l,exiting:u}=Kh(t);return w.useEffect(()=>{if(!t)return;const d=p=>p.key==="Escape"&&!e&&r();document.addEventListener("keydown",d);const f=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",d),document.body.style.overflow=f}},[e,r,t]),!l||typeof document>"u"?null:nr.createPortal(c.jsx("div",{className:`${u?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:d=>{!e&&o.current&&!o.current.contains(d.target)&&r()},children:c.jsxs("form",{ref:o,role:"dialog","aria-modal":"true",onSubmit:d=>{d.preventDefault(),a()},className:`${u?"modal-card-out":"modal-card-in"} bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[460px] max-w-full p-[32px] flex flex-col gap-[24px] shadow-modal`,children:[c.jsxs("div",{className:"flex items-start justify-between w-full",children:[c.jsx(Gye,{}),c.jsx("button",{type:"button",onClick:r,disabled:e,className:"cursor-pointer text-[var(--sand-11)] transition-colors hover:text-[var(--sand-12)] disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Close",children:c.jsx(ok,{className:"size-[24px]"})})]}),c.jsxs("div",{className:"flex flex-col gap-[8px] font-medium",children:[c.jsx("p",{className:"text-[20px] leading-[24px] text-[var(--sand-12)]",children:"Create organization"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Add a team workspace for projects, sessions, and billing."})]}),c.jsxs("div",{className:"flex flex-col gap-[12px] font-medium text-[14px]",children:[c.jsx("label",{className:"text-[var(--sand-10)] leading-[20px]",children:"Name"}),c.jsx("input",{value:s,onChange:d=>i(d.target.value),disabled:e,autoFocus:!0,placeholder:"Organization name",className:"h-[44px] rounded-[8px] bg-[var(--sand-3)] px-[12px] text-[var(--sand-12)] text-[14px] leading-[20px] outline-none placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)] disabled:opacity-60"})]}),n&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:n}),c.jsxs("div",{className:"flex gap-[12px] w-full",children:[c.jsx("button",{type:"button",onClick:r,disabled:e,className:"flex-1 cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] border-[0.5px] border-solid border-[var(--sand-6)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:!s.trim()||e,className:"flex-1 cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:e?"Creating...":"Create organization"})})]})]})}),document.body)}const fpt="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]",hpt="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",ppt="flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)]";function mpt(t){return`${ppt} ${t?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95"}`}function gpt(t,e){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):e}function vpt({open:t,onClose:e}){const{orgRole:n}=zt(),{setSelectedProjectId:s}
514=lc(),r=n==="org:admin",[i,a]=w.useState(""),[o,l]=w.useState(!1),u=()=>{a(""),l(!1)},d=Bi({mutationFn:async()=>{const m=await Hme({body:{name:i,isProduction:o}});if(m.error)throw m.error;return m.data},onSuccess:async m=>{await Pn.invalidateQueries({queryKey:["projects"]}),m&&s(m.id),u(),e()},onError:m=>{Bn({title:gpt(m,"Error creating project")})}}),f=!r||!i.trim()||d.isPending,p=()=>{d.isPending||(u(),e())};return c.jsx(ss,{open:t,onClose:p,noIcon:!0,title:"Create project",subtitle:"Give this project a name.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:p,disabled:d.isPending,className:hpt,children:"Cancel"}),c.jsx("button",{type:"submit",form:"create-project-modal-form",disabled:f,className:mpt(f),children:d.isPending?"Creating…":"Create project"})]}),children:c.jsxs("form",{id:"create-project-modal-form",onSubmit:m=>{m.preventDefault(),!f&&d.mutate()},className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Name your project"}),c.jsx("input",{type:"text",autoFocus:!0,value:i,onChange:m=>a(m.target.value),placeholder:"e.g. Web Scraper",className:fpt})]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full rounded-[12px] bg-[var(--sand-3)] p-[16px]",children:[c.jsxs("div",{className:"flex min-w-px flex-col gap-[4px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Production"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"The project will be created as production and can't be reverted to development."})]}),c.jsx(pv,{checked:o,onCheckedChange:l,"aria-label":"Production"})]})]})})}function xpt({production:t}){return c.jsx("span",{"aria-hidden":"true",className:He("globe-pulse size-[10px] shrink-0 rounded-full",t?"[--dot:var(--green-9)] dark:[--dot:#34d399]":"[--dot:var(--amber-9)] dark:[--dot:#f5d90a]"),style:{backgroundColor:"var(--dot)",boxShadow:"0 0 0 4px color-mix(in srgb, var(--dot) 35%, transparent), 0 0 18px var(--dot)"}})}function ypt({project:t}){const e=t.isProduction?"Prod":"Dev";return c.jsx("span",{className:He("flex h-[20px] items-center rounded-[999px] px-[8px] text-[12px] font-medium leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",t.isProduction?"bg-[var(--green-3)] text-[var(--green-11)] dark:text-[#34d399] group-hover:bg-[var(--green-4)]":"bg-[var(--yellow-3)] text-[var(--yellow-11)] dark:text-[#f5d90a] group-hover:bg-[var(--yellow-4)]"),children:e})}function bpt({project:t,selected:e,onSelect:n}){return c.jsxs("button",{type:"button",onClick:n,className:He("group w-full text-left cursor-pointer flex items-center justify-between gap-[8px] h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)]",e?"bg-[var(--sand-4)] text-[var(--sand-12)]":"text-[var(--sand-11)]"),children:[c.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",children:t.name}),c.jsx("span",{className:"flex shrink-0 items-center gap-2",children:c.jsx(ypt,{project:t})})]})}function qye(){const{projects:t,projectsQuery:e,selectedProject:n,selectedProjectId:s,setSelectedProjectId:r}=lc(),i=di(),[a,o]=w.useState(!1),[l,u]=w.useState(!1),d=w.useRef(null);w.useEffect(()=>{if(!a)return;const m=x=>{d.current&&!d.current.contains(x.target)&&o(!1)},v=x=>{x.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",v)}},[a]);const f=t.length>0,p=(n==null?void 0:n.name)??(e.isLoading?"Loading projects":"No projects");return c.jsxs("div",{ref:d,className:"relative",children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":a,onClick:()=>o(m=>!m),style:a?{backgroundColor:"var(--sand-4)"}:void 0,className:"cursor-pointer transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] flex gap-[8px] h-[40p
514x] items-center pl-[12px] pr-[10px] py-[8px] rounded-[8px] disabled:cursor-not-allowed disabled:opacity-60",disabled:e.isLoading,children:[c.jsxs("div",{className:"flex gap-[12px] items-center min-w-px",children:[c.jsx(xpt,{production:n==null?void 0:n.isProduction}),c.jsx("span",{className:"font-normal text-[var(--sand-12)] text-[14px] leading-[20px] whitespace-nowrap max-w-[160px] truncate",children:p})]}),c.jsx(G1,{size:20,className:"size-[20px] text-[var(--sand-9)]"})]}),a&&c.jsxs("div",{role:"menu",className:"origin-top absolute left-0 top-[calc(100%+6px)] z-50 flex flex-col gap-[4px] w-[240px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(m=>c.jsx(bpt,{project:m,selected:m.id===s,onSelect:()=>{r(m.id),o(!1)}},m.id)),!f&&!e.isLoading&&c.jsx("div",{className:"px-[8px] py-[8px] text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No projects found"})]}),c.jsx("div",{className:"h-[0.5px] -mx-[4px] bg-[var(--sand-6)]"}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),i("/settings/projects")},className:"w-full text-left cursor-pointer flex items-center gap-[10px] h-[36px] px-[8px] rounded-[6px] font-medium text-[var(--sand-11)] text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:[c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px] shrink-0",children:[c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"View & manage projects"]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),u(!0)},className:"w-full text-left cursor-pointer flex items-center gap-[10px] h-[36px] px-[8px] rounded-[6px] font-medium text-[var(--sand-11)] text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:[c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px] shrink-0",children:c.jsx("path",{d:"M12 5v14M5 12h14"})}),"Create project"]})]}),c.jsx(vpt,{open:l,onClose:()=>u(!1)})]})}function Qne(){return c.jsx(wt.span,{layoutId:"header-nav-underline",transition:{type:"spring",bounce:.2,duration:.5},className:"absolute bottom-0 left-0 right-0 h-[2px] bg-[var(--sand-12)]"})}function Spt({size:t=18}){return c.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,className:"shrink-0",children:c.jsx("path",{d:"M20.317 4.3698a19.7913 19.7913 0 0 0-4.8851-1.5152.0741.0741 0 0 0-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 0 0-.0785-.037 19.7363 19.7363 0 0 0-4.8852 1.515.0699.0699 0 0 0-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 0 0 .0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 0 0 .0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 0 0-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 0 1-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 0 1 .0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 0 1 .0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 0 1-.0066.1276 12.2986 12.2986 0 0 1-1.873.8914.0766.0766 0 0 0-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 0 0 .0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 0 0 .0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 0 0-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})})}const wpt=t=>
514"$"+t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});function _pt({progress:t}){const r=2*Math.PI*7.75;return c.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:c.jsxs("svg",{width:18,height:18,viewBox:"0 0 18 18",className:"-rotate-90","aria-hidden":!0,children:[c.jsx("circle",{cx:18/2,cy:18/2,r:7.75,fill:"none",stroke:"currentColor",strokeOpacity:.25,strokeWidth:2.5}),c.jsx("circle",{cx:18/2,cy:18/2,r:7.75,fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r*(1-t)})]})})}const Ept=()=>{var x,y;const{pathname:t}=Gs(),e=t==="/sessions"||t.startsWith("/sessions/"),n=t.startsWith("/sessions/")&&t.split("/").pop()!=="sessions"?t.split("/").pop():null,s=(x=t.match(/^\/computers\/([^/]+)$/))==null?void 0:x[1],r=(y=s==null?void 0:s.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i))==null?void 0:y[0],{useSession:i}=fr(),a=zye(),o=E7(),{data:l,isLoading:u}=i(n),{balanceDollars:d,isLoading:f}=mu(),p=[{label:"Docs",href:"https://docs.steel.dev",target:"_blank"},{label:"Discord",href:"https://discord.gg/steel-dev",target:"_blank",icon:c.jsx(Spt,{})}],m=[{label:"Quickstart",href:"/quickstart"},{label:"Sessions",href:"/sessions"},...o?[{label:"Computers",href:"/computers"}]:[]],v=t.includes("/settings");return c.jsxs("header",{className:"flex flex-col gap-4 px-[1.5rem] pt-[1rem] w-full border-b-[0.5px] border-[var(--sand-6)]",children:[c.jsxs("div",{className:"flex items-center gap-2 w-full",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Hn,{to:"/quickstart","aria-label":"Steel — go to Quickstart",className:"flex items-center cursor-pointer",children:c.jsx(Xde,{})}),c.jsx(fd,{size:20,className:"size-[20px] text-[var(--sand-10)]"}),c.jsx(Wye,{}),c.jsxs(c.Fragment,{children:[c.jsx(fd,{size:20,className:"size-[20px] text-[var(--sand-10)]"}),c.jsx(qye,{})]})]}),c.jsx("nav",{className:"flex-1 flex justify-end",children:c.jsxs("div",{className:"flex gap-[1rem] items-center",children:[p.map(S=>c.jsx(Hn,{to:S.href,target:S.target,"aria-label":S.label,className:"text-[14px] flex justify-center items-center gap-[2px] text-[var(--sand-10)] hover:text-[var(--sand-12)] active:text-[var(--sand-11)] curs
514or-pointer",children:S.icon??c.jsxs(c.Fragment,{children:[S.label,c.jsx(Xht,{})]})},S.href)),a&&c.jsxs(Hn,{to:"/finish-setup",className:"hidden sm:flex h-[40px] items-center gap-2 rounded-md bg-[var(--blue-3)] dark:bg-dark-blue-3 px-2.5 text-sm text-[var(--blue-11)] dark:text-dark-blue-9 transition-[filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-110","aria-label":"Finish setup",children:[c.jsx(yd,{size:20}),"Finish Setup",c.jsx(_pt,{progress:ZP})]}),c.jsx(Hye,{}),c.jsxs(Hn,{to:"/settings/billing/wallet",className:"hidden sm:flex h-[40px] items-center gap-2 rounded-md hover:bg-[var(--sand-4)] bg-[var(--sand-3)] px-2.5 text-sm text-[var(--sand-12)]","aria-label":"Open wallet",children:[c.jsx(NS,{size:20}),c.jsx("span",{className:f?"animate-pulse text-[var(--sand-10)]":"",children:f||d==null?"—":wpt(d)})]}),c.jsx(Jht,{})]})})]}),c.jsxs("div",{className:"flex-1 w-full flex gap-[1rem]",children:[m.map(S=>{const _=t===S.href||t.startsWith(`${S.href}/`);return c.jsxs(Hn,{to:S.href,className:`relative pb-[1rem] text-sm flex items-center gap-2 rounded-none transition-colors hover:text-[var(--sand-12)] ${_?"text-[var(--sand-12)]":"text-[var(--sand-10)]"}`,children:[S.label,_&&c.jsx(Qne,{})]},S.href)}),e&&n&&c.jsxs("div",{className:"relative pb-[1rem] flex items-center gap-1 text-[var(--sand-12)]",children:[c.jsx(fd,{size:20,className:"shrink-0 text-[var(--sand-12)]"}),c.jsx("span",{className:"text-sm",children:"Session"}),c.jsxs("span",{className:"text-[var(--sand-10)] text-sm",title:n,children:["#",n.slice(-8)]}),c.jsx(Pd,{size:20,className:"ml-1 shrink-0 text-[var(--sand-10)] hover:text-[var(--sand-12)] active:text-[var(--sand-11)] curs
514or-pointer",onClick:()=>{Ja(n,"Session ID")}}),!u&&(l==null?void 0:l.status)==="live"&&c.jsx("span",{className:"ml-1 flex h-[20px] items-center px-[8px] rounded-[999px] bg-[var(--green-3)] dark:bg-[#0b2e22] font-medium text-[12px] leading-[20px] text-[var(--green-11)] dark:text-[#34d399]",children:"Live"})]}),r&&c.jsxs("div",{className:"relative pb-[1rem] flex items-center gap-1 text-[var(--sand-12)]",children:[c.jsx(fd,{size:20,className:"shrink-0 text-[var(--sand-12)]"}),c.jsx("span",{className:"text-sm",children:"Computer"}),c.jsxs("span",{className:"text-[var(--sand-10)] text-sm",title:r,children:["#",r.slice(-8)]})]}),c.jsxs(Hn,{to:"/settings",className:`inline-flex items-center gap-2 relative pb-[1rem] text-sm rounded-none transition-colors hover:text-[var(--sand-12)] ${v?"text-[var(--sand-12)]":"text-[var(--sand-10)]"}`,children:["Settings",v&&c.jsx(Qne,{})]},"settings")]})]})};function Cpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M10 6L4 12L10 18M5 12H20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9 6C8.44772 6 8 6.44772 8 7C8 7.55228 8.44772 8 9 8V6ZM15 8C15.5523 8 16 7.55228 16 7C16 6.44772 15.5523 6 15 6V8ZM9 10C8.44772 10 8 10.4477 8 11C8 11.5523 8.44772 12 9 12V10ZM12 12C12.5523 12 13 11.5523 13 11C13 10.4477 12.5523 10 12 10V12ZM7 4H17V2H7V4ZM18 5V19H20V5H18ZM17 20H7V22H17V20ZM6 19V5H4V19H6ZM7 20C6.44771 20 6 19.5523 6 19H4C4 20.6569 5.34315 22 7 22V20ZM18 19C18 19.5523 17.5523 20 17 20V22C18.6569 22 20 20.6569 20 19H18ZM17 4C17.5523 4 18 4.44772 18 5H20C20 3.34315 18.6569 2 17 2V4ZM7 2C5.34315 2 4 3.34315 4 5H6C6 4.44772 6.44772 4 7 4V2ZM18 12V15H20V12H18ZM17 16H7V18H17V16ZM7 22H10V20H7V22ZM7 16C5.34315 16 4 17.3431 4 19H6C6 18.4477 6.44772 18 7 18V16ZM18 15C18 15.5523 17.5523 16 17 16V18C18.6569 18 20 16.6569 20 15H18ZM9 8H15V6H9V8ZM9 12H12V10H9V12Z",fill:"currentColor"})})}function kpt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M5.00195 4H19.002C20.1065 4 21.002 4.89543 21.002 6V16C21.002 17.1046 20.1065 18 19.002 18H12.002L7.00195 21V18H5.00195C3.89738 18 3.00195 17.1046 3.00195 16V6C3.00195 4.89543 3.89738 4 5.00195 4Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",strokeLinejoin:"round"}),c.jsx("path",{d:"M6.625 11C6.625 11.4832 7.01675 11.875 7.5 11.875C7.98325 11.875 8.375 11.4832 8.375 11C8.375 10.5168 7.98325 10.125 7.5 10.125C7.01675 10.125 6.625 10.5168 6.625 11ZM11.125 11C11.125 11.4832 11.5168 11.875 12 11.875C12.4832 11.875 12.875 11.4832 12.875 11C12.875 10.5168 12.4832 10.125 12 10.125C11.5168 10.125 11.125 10.5168 11.125 11ZM15.625 11C15.625 11.4832 16.0168 11.875 16.5 11.875C16.9832 11.875 17.375 11.4832 17.375 11C17.375 10.5168 16.9832 10.125 16.5 10.125C16.0168 10.125 15.625 10.5168 15.625 11Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.75",strokeLinecap:"square"})]})}function Rpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M19.6361 5.02282C18.1907 4.35757 16.6648 3.88563 15.0973 3.61903C14.8828 4.00449 14.6888 4.40107 14.5159 4.80712C12.8463 4.5542 11.1484 4.5542 9.47881 4.80712C9.30587 4.40111 9.1118 4.00453 8.8974 3.61903C7.32897 3.88788 5.80205 4.36095 4.35518 5.0263C1.48276 9.29853 0.70409 13.4647 1.09342 17.5716C2.77558 18.821 4.6584 19.7713 6.66003 20.3809C7.11074 19.7716 7.50956 19.1251 7.85226 18.4483C7.20135 18.204 6.57311 17.9024 5.9748 17.5473C6.13227 17.4325 6.28627 17.3142 6.43508 17.1994C8.17601 18.0224 10.0761 18.4491 12 18.4491C13.9238 18.4491 15.8239 18.0224 17.5648 17.1994C17.7154 17.3229 17.8694 17.4412 18.0251 17.5473C17.4257 17.903 16.7963 18.2051 16.1442 18.4501C16.4865 19.1265 16.8853 19.7724 17.3364 20.3809C19.3398 19.7737 21.224 18.8239 22.9065 17.5734C23.3633 12.8106 22.1261 8.68274 19.6361 5.02282ZM8.34541 15.0459C7.26047 15.0459 6.36414 14.0561 6.36414 12.8384C6.36414 11.6208 7.22932 10.6223 8.34195 10.6223C9.45458 10.6223 10.344 11.6208 10.325 12.8384C10.3059 14.0561 9.45112 15.0459 8.34541 15.0459ZM15.6545 15.0459C14.5678 15.0459 13.675 14.0561 13.675 12.8384C13.675 11.6208 14.5401 10.6223 15.6545 10.6223C16.7689 10.6223 17.6514 11.6208 17.6323 12.8384C17.6133 14.0561 16.7602 15.0459 15.6545 15.0459Z",fill:"currentColor"})})}function Apt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M13.75 12.437C14.507 11.8924 15 11.0038 15 10C15 8.34315 13.6569 7 12 7C10.3431 7 9 8.34315 9 10C9 11.0038 9.49297 11.8924 10.25 12.437V15.25C10.25 16.2165 11.0335 17 12 17C12.9665 17 13.75 16.2165 13.75 15.25V12.437Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})]})}function Npt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.3161 3.18487C11.7576 3.02432 12.2416 3.02431 12.6831 3.18487L20.7569 6.1208C22.5123 6.75911 22.5123 9.24166 20.7569 9.87998L12.6831 12.8159C12.2416 12.9765 11.7576 12.9765 11.3161 12.8159L3.2423 9.87998C1.48695 9.24167 1.48693 6.75912 3.24229 6.1208L11.3161 3.18487ZM20.0734 8.00039L11.9996 5.06445L3.92578 8.00039L11.9996 10.9363L20.0734 8.00039Z",fill:"currentColor"}),c.jsx("path",{d:"M20.7569 13.88L12.6831 16.8159C12.2416 16.9765 11.7576 16.9765 11.3161 16.8159L3.2423 13.88C2.10327 13.4658 1.70334 12.2751 2.04252 11.3156L11.9996 14.9363L21.9567 11.3156C22.2959 
51412.2751 21.896 13.4658 20.7569 13.88Z",fill:"currentColor"}),c.jsx("path",{d:"M20.7569 17.88L12.6831 20.8159C12.2416 20.9765 11.7576 20.9765 11.3161 20.8159L3.2423 17.88C2.10327 17.4658 1.70334 16.2751 2.04252 15.3156L11.9996 18.9363L21.9567 15.3156C22.2959 16.2751 21.896 17.4658 20.7569 17.88Z",fill:"currentColor"})]})}function Ipt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M5.09202 19.782L5.54601 18.891H5.54601L5.09202 19.782ZM4.21799 18.908L5.10899 18.454L5.10899 18.454L4.21799 18.908ZM19.782 18.908L18.891 18.454V18.454L19.782 18.908ZM18.908 19.782L18.454 18.891H18.454L18.908 19.782ZM19.782 5.09202L18.891 5.54601V5.54601L19.782 5.09202ZM18.908 4.21799L18.454 5.10899L18.454 5.10899L18.908 4.21799ZM4.21799 5.09202L3.32698 4.63803L3.32698 4.63803L4.21799 5.09202ZM5.09202 4.21799L4.63803 3.32698L4.63803 3.32698L5.09202 4.21799ZM19 7.2V16.8H21V7.2H19ZM16.8 19H7.2V21H16.8V19ZM5 16.8V7.2H3V16.8H5ZM7.2 5H16.8V3H7.2V5ZM7.2 19C6.62345 19 6.25117 18.9992 5.96784 18.9761C5.69617 18.9539 5.59545 18.9162 5.54601 18.891L4.63803 20.673C5.01641 20.8658 5.40963 20.9371 5.80497 20.9694C6.18864 21.0008 6.65645 21 7.2 21V19ZM3 16.8C3 17.3435 2.99922 17.8114 3.03057 18.195C3.06287 18.5904 3.13419 18.9836 3.32698 19.362L5.10899 18.454C5.0838 18.4045 5.04612 18.3038 5.02393 18.0322C5.00078 17.7488 5 17.3765 5 16.8H3ZM5.54601 18.891C5.35785 18.7951 5.20487 18.6421 5.10899 18.454L3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673L5.54601 18.891ZM19 16.8C19 17.3765 18.9992 17.7488 18.9761 18.0322C18.9539 18.3038 18.9162 18.4045 18.891 18.454L20.673 19.362C20.8658 18.9836 20.9371 18.5904 20.9694 18.195C21.0008 17.8114 21 17.3435 21 16.8H19ZM16.8 21C17.3436 21 17.8114 21.0008 18.195 20.9694C18.5904 20.9371 18.9836 20.8658 19.362 20.673L18.454 18.891C18.4045 18.9162 18.3038 18.9539 18.0322 18.9761C17.7488 18.9992 17.3766 19 16.8 19V21ZM18.891 18.454C18.7951 18.6421 18.6422 18.7951 18.454 18.891L19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362L18.891 18.454ZM21 7.2C21 6.65645 21.0008 6.18864 20.9694 5.80497C20.9371 5.40963 20.8658 5.01641 20.673 4.63803L18.891 5.54601C18.9162 5.59545 18.9539 5.69617 18.9761 5.96784C18.9992 6.25117 19 6.62345 19 7.2H21ZM16.8 5C17.3766 5 17.7488 5.00078 18.0322 5.02393C18.3038 5.04612 18.4045 5.0838 18.454 5.10899L19.362 3.32698C18.9836 3.13419 18.5904 3.06287 18.195 3.03057C17.8114 2.99922 17.3436 3 16.8 3V5ZM20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698L18.454 5.10899C18.6422 5.20487 18.7951 5.35785 18.891 5.54601L20.673 4.63803ZM5 7.2C5 6.62345 5.00078 6.25117 5.02393 5.96784C5.04612 5.69617 5.0838 5.59545 5.10899 5.54601L3.32698 4.63803C3.13419 5.01641 3.06287 5.40963 3.03057 5.80497C2.99922 6.18864 3 6.65645 3 7.2H5ZM7.2 3C6.65645 3 6.18864 2.99922 5.80497 3.03057C5.40963 3.06287 5.01641 3.13419 4.63803 3.32698L5.54601 5.10899C5.59545 5.0838 5.69617 5.04612 5.96784 5.02393C6.25117 5.00078 6.62345 5 7.2 5V3ZM5.10899 5.54601C5.20487 5.35785 5.35785 5.20487 5.54601 5.10899L4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803L5.10899 5.54601Z",fill:"currentColor"}),c.jsx("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square"}),c.jsx("path",{d:"M13 4V3H11V4H13ZM11 20V21H13V20H11ZM11 4V12H13V4H11ZM11 12V20H13V12H11Z",fill:"currentColor"})]})}function Lpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M12.0002 4.99693V2.99609M16 5V3M8.00018 5V2.99609M12 21V19M16 21V19M8 21V19M19 16H21M19 8H21M19 12H21M3 12H5M3 16H5M3 8H5M15.0013 12.0003C15.0013 13.6578 13.6576 15.0015 12 15.0015C10.3425 15.0015 8.99878 13.6578 8.99878 12.0003C8.99878 10.3427 10.3425 8.99902 12 8.99902C13.6576 8.99902 15.0013 10.3427 15.0013 12.0003ZM7 19H17C18.1046 19 19 18.1046 19 17V7C19 5.89543 18.1046 5 17 5H7C5.89543 5 5 5.89543 5 7V17C5 18.1046 5.89543 19 7 19Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function jpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9 8H15M9 12H11M19 21V5C19 3.89543 18.1046 3 17 3H7C5.89543 3 5 3.89543 5 5V21L7.33333 19L9.66667 21L12 19L14.3333 21L16.6667 19L19 21Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ppt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7 13H4.76619C3.9889 13 3.50878 12.152 3.9087 11.4855L5.41739 8.97101C5.7
5147884 8.3686 6.42985 8 7.13238 8H11.25M7 13L11 17M7 13L11.25 8M11 17V19.2338C11 20.0111 11.848 20.4912 12.5145 20.0913L15.029 18.5826C15.6314 18.2212 16 17.5701 16 16.8676V12.75M11 17L16 12.75M16 12.75C18.7449 10.2339 20.6526 7.50845 20.9572 3.99927C21.005 3.44906 20.5509 2.99502 20.0007 3.04278C16.4916 3.3474 13.7661 5.25513 11.25 8M5 21H3V19C3 17.8954 3.89543 17 5 17C6.10457 17 7 17.8954 7 19C7 20.1046 6.10457 21 5 21Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function Kye(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M7.98941 5.39755L7.30515 5.23965C6.72652 5.10612 6.11991 5.28009 5.7 5.7C5.28009 6.11991 5.10612 6.72651 5.23965 7.30515L5.39755 7.9894C5.57956 8.7781 5.25434 9.59711 4.58086 10.0461L3.74885 10.6008C3.28101 10.9127 3 11.4377 3 12C3 12.5623 3.28101 13.0873 3.74885 13.3992L4.58086 13.9539C5.25434 14.4029 5.57956 15.2219 5.39756 16.0106L5.23965 16.6949C5.10612 17.2735 5.28009 17.8801 5.7 18.3C6.11991 18.7199 6.72651 18.8939 7.30515 18.7604L7.9894 18.6024C8.7781 18.4204 9.59711 18.7457 10.0461 19.4191L10.6008 20.2512C10.9127 20.719 11.4377 21 12 21C12.5623 21 13.0873 20.719 13.3992 20.2512L13.9539 19.4191C14.4029 18.7457 15.2219 18.4204 16.0106 18.6024L16.6949 18.7604C17.2735 18.8939 17.8801 18.7199 18.3 18.3C18.7199 17.8801 18.8939 17.2735 18.7604 16.6949L18.6024 16.0106C18.4204 15.2219 18.7457 14.4029 19.4191 13.9539L20.2512 13.3992C20.719 13.0873 21 12.5623 21 12C21 11.4377 20.719 10.9127 20.2512 10.6008L19.4191 10.0461C18.7457 9.59711 18.4204 8.7781 18.6024 7.98941L18.7604 7.30515C18.8939 6.72652 18.7199 6.11991 18.3 5.7C17.8801 5.28009 17.2735 5.10612 16.6949 5.23965L16.0106 5.39755C15.2219 5.57956 14.4029 5.25434 13.9539 4.58086L13.3992 3.74884C13.0873 3.28101 12.5623 3 12 3C11.4377 3 10.9127 3.28101 10.6008 3.74885L10.0461 4.58086C9.59711 5.25434 8.7781 5.57956 7.98941 5.39755Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})]})}function Yye(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M3 7C3 5.89543 3.89543 5 5 5H19C20.1046 5 21 5.89543 21 7V17C21 18.1046 20.1046 19 19 19H5C3.89543 19 3 18.1046 3 17V7Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 5V12V19",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})]})}function Mpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M9 17H5C3.89543 17 3 16.1046 3 15V7C3 5.89543 3.89543 5 5 5H19C20.1046 5 21 5.89543 21 7V15C21 16.1046 20.1046 17 19 17H15M9 17V20H15V17M9 17H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"square",strokeLinejoin:"round"})})}function Dpt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M3 11H21M5 19H19C20.1046 19 21 18.1046 21 17V7C21 5.89543 20.1046 5 19 5H5C3.89543 5 3 5.89543 3 7V17C3 18.1046 3.89543 19 5 19Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M6 8.75C6.41421 8.75 6.75 8.41421 6.75 8C6.75 7.58579 6.41421 7.25 6 7.25C5.58579 7.25 5.25 7.58579 5.25 8C5.25 8.41421 5.58579 8.75 6 8.75ZM9 8.75C9.41421 8.75 9.75 8.41421 9.75 8C9.75 7.58579 9.41421 7.25 9 7.25C8.58579 7.25 8.25 7.58579 8.25 8C8.25 8.41421 8.58579 8.75 9 8.75ZM12 8.75C12.4142 8.75 12.75 8.41421 12.75 8C12.75 7.58579 12.4142 7.25 12 7.25C11.5858 7.25 11.25 7.58579 11.25 8C11.25 8.41421 11.5858 8.75 12 8.75Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.5"})]})}function p1(t){const e=new Date,n=new Date;switch(t){case"7d":n.setUTCDate(e.getUTCDate()-6);break;case"14d":n.setUTCDate(e.getUTCDate()-13);break;case"30d":n.setUTCDate(e.getUTCDate()-29);break}return{startDate:Jne(n),endDate:Jne(e)}}function Jne(t){const e=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${e}-${n}-${s}`}const Zye=6e4;async function Xye(t,e){const{data:n,error:s}=await KZe({query:{start_date:t.startDate,end_date:t.endDate,granularity:t.granularity,project_id:e??void 0}});if(s)throw new Error(typeof s=="object"&&s&&"message"in s?String(s.message):"Failed to fetch daily breakdown");if(!n)throw new Error("No data returned from daily breakdown endpoint");return n}function Opt(){const{isLoaded:t,isSignedIn:e,orgId:n}=zt(),s=aa();return w.useCallback((r,i)=>{!t||!e||!n||s.prefetchQuery({queryKey:to.dailyBreakdown(n,r.startDate,r.endDate,r.granularity,i??null),queryFn:()=>Xye(r,i),staleTime:Zye})},[t,e,n,s])}function _U(t,e=!0,n){const{isLoaded:s,isSignedIn:r,orgId:i}=zt(),{startDate:a,endDate:o,granularity:l}=t,u=w.useCallback(()=>Xye({startDate:a,endDate:o,granularity:l},n),[a,o,l,n]);return rs({queryKey:to.dailyBreakdown(i,t.startDate,t.endDate,t.granularity,n??null),queryFn:u,enabled:e&&s&&!!r&&!!i,staleTime:Zye,placeholderData:(f,p)=>
514K1(f,p,i,1),refetchOnWindowFocus:!1})}const $pt=["Last 24h","Last 3d","Last week","Last month","Last 3 months","Last 6 months"],Nb=3600*1e3,R5=24*Nb;function A5(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${s}`}function Fpt(t){const e=new Date(t);return e.setMinutes(0,0,0),e}function ese(t){const e=Fpt(t);return e.getTime()<=t.getTime()&&e.setHours(e.getHours()+1),e}function Upt(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function ZE(t,e,n){const s=Upt(n);s.setDate(s.getDate()+1);const r=new Date(s.getTime()-e*R5);return{label:t,start:r,end:s,startDate:A5(r),endDate:A5(new Date(s.getTime()-1)),granularity:"day",bucketSize:"day",chartBucketSize:e>31?"week":"day"}}function EU(t,e=new Date){if(t==="Last 24h"){const n=ese(e),s=new Date(n.getTime()-24*Nb);return{label:t,start:s,end:n,startDate:s.toISOString(),endDate:n.toISOString(),granularity:"hour",bucketSize:"hour",chartBucketSize:"hour"}}if(t==="Last 3d"){const n=ese(e),s=new Date(n.getTime()-3*R5);return{label:t,start:s,end:n,startDate:s.toISOString(),endDate:n.toISOString(),granularity:"hour",bucketSize:"hour",chartBucketSize:"hour"}}return t==="Last week"?ZE(t,7,e):t==="Last month"?ZE(t,30,e):t==="Last 3 months"?ZE(t,90,e):ZE(t,180,e)}function Bpt(t){return t==="hour"?Nb:t==="fourHours"?4*Nb:t==="sixHours"?6*Nb:t==="week"?7*R5:R5}function zpt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M20 14.75V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V14.75M12 4V15.25M12 4L16.5 8.5M12 4L7.5 8.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qye(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M20 13C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11C19.4477 11 19 11.4477 19 12C19 12.5523 19.4477 13 20 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M4 13C4.55228 13 5 12.5523 5 12C5 11.4477 4.55228 11 4 11C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vpt({onManageAccount:t}){var p;const{user:e}=Vi(),{signOut:n}=Qm(),[s,r]=w.useState(!1),i=w.useRef(null),a=w.useRef(null),[o,l]=w.useState(null),u=()=>{var v;const m=(v=i.current)==null?void 0:v.getBoundingClientRect();m&&l({left:m.left,bottom:window.innerHeight-m.top+6,width:Math.max(m.width,220)}),r(!0)},d=()=>s?r(!1):u();w.useEffect(()=>{if(!s)return;const m=y=>{var _,E;const S=y.target;(_=i.current)!=null&&_.contains(S)||(E=a.current)!=null&&E.contains(S)||r(!1)},v=y=>y.key==="Escape"&&r(!1),x=()=>r(!1);return document.addEventListener("pointerdown",m),document.addEventListener("keydown",v),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",v),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[s]);const f=(e==null?void 0:e.fullName)??((p=e==null?void 0:e.primaryEmailAddress)==null?void 0:p.emailAddress)??"Account";return c.jsxs("div",{ref:i,className:"relative",children:[c.jsxs("div",{className:"flex w-full items-center gap-2 rounded-lg p-2 text-[var(--sand-10)]",children:[e!=null&&e.imageUrl?c.jsx("img",{src:e.imageUrl,alt:"",className:"size-[20px] shrink-0 rounded-full border-[0.5px] border-solid border-[var(--sand-6)] object-cover"}):c.jsx(U1,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5 text-[var(--sand-12)]",children:f}),c.jsx("button",{type:"button","aria-label":"Account menu","aria-haspopup":"menu","aria-expanded":s,onClick:d,className:"flex size-[24px] shrink-0 cursor-pointer items-center justify-center rounded-full border-[0.5px] border-solid border-[var(--sand-6)] text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:c.jsx(Qye,{size:16,className:"shrink-0"})})]}),s&&o&&nr.createPortal(c.jsxs("div",{role:"menu",ref:a,style:{left:o.left,bottom:o.bottom,width:o.width},className:"origin-bottom fixed z-[100] flex flex-col rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[4px] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),t()},className:"flex h-[36px] w-full cursor-pointer items-center gap-[8px] rounded-[5px] px-[8px] text-left text-[14px] font-medium leading-[20px] text-[var(--sand-11)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:[c.jsx(Kye,{size:16,className:"shrink-0"}),"Manage account"]}),c.jsx("div",{className:"-mx-[4px] my-[4px] h-[0.5px] bg-[var(--sand-6)]"}),c.jsx(Vye,{}),c.jsx("div",{className:"-mx-[4px] my-[4px] h-[0.5px] bg-[var(--sand-6)]"}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),n()},className:"flex h-[36px] w-full cursor-pointer items-center gap-[8px] rounded-[5px] px-[8px] text-left text-[14px] font-medium leading-[20px] text-danger transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--red-a3)]",children:[c.jsx(zpt,{size:16,className:"shrink-0"}
514),"Sign out"]})]}),document.body)]})}const tse="steel-sidebar-collapsed",vT=.08,Jye=.22,Hpt=vT,xT=[.4,0,.2,1],ebe=w.createContext(null);function Gpt({children:t}){const[e,n]=w.useState(()=>{try{return localStorage.getItem(tse)==="1"}catch{return!1}});w.useEffect(()=>{try{localStorage.setItem(tse,e?"1":"0")}catch{}},[e]);const[s,r]=w.useState(!1),[i,a]=w.useState("rest");w.useEffect(()=>{if(i==="rest")return;const l=window.setTimeout(()=>{i==="fading"?(n(s),a("resizing")):a("rest")},(i==="fading"?Hpt:Jye)*1e3);return()=>window.clearTimeout(l)},[i,s]);const o=()=>{if(i!=="rest")return;const l=!e;r(l),l?a("fading"):(n(!1),a("resizing"))};return w.useEffect(()=>{const l=u=>{if(u.key.toLowerCase()!=="b"||!(u.metaKey||u.ctrlKey))return;const d=u.target;d!=null&&d.closest("input, textarea, [contenteditable='true']")||(u.preventDefault(),o())};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)}),c.jsx(ebe.Provider,{value:{collapsed:e,showContents:i==="rest",toggle:o},children:t})}function tbe(){const t=w.useContext(ebe);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t}function Wpt(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M10.7424 5.08581C14.6841 4.54668 18.7922 6.54985 21.4978 11.0954C21.8296 11.6529 21.8298 12.3468 21.498 12.9043C21.124 13.5326 20.7233 14.1123 20.3 14.6434",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M3.70711 2.29289C3.31658 1.90237 2.68342 1.90237 2.29289 2.29289C1.90237 2.68342 1.90237 3.31658 2.29289 3.70711L3.70711 2.29289ZM20.2929 21.7071C20.6834 22.0976 21.3166 22.0976 21.7071 21.7071C22.0976 21.3166 22.0976 20.6834 21.7071 20.2929L20.2929 21.7071ZM2.29289 3.70711L20.2929 21.7071L21.7071 20.2929L3.70711 2.29289L2.29289 3.70711Z",fill:"currentColor"}),c.jsx("path",{d:"M10.3327 10.8948C10.6385 10.4349 10.5136 9.81418 10.0537 9.50839C9.59377 9.20261 8.97305 9.32755 8.66727 9.78745L10.3327 10.8948ZM14.2126 15.3328C14.6725 15.027 14.7974 14.4063 14.4916 13.9463C14.1858 13.4864 13.5651 13.3615 13.1052 13.6673L14.2126 15.3328ZM12 14C10.8954 14 10 13.1046 10 12H8C8 14.2092 9.79086 16 12 16V14ZM10 12C10 11.5897 10.1225 11.211 10.3327 10.8948L8.66727 9.78745C8.24565 10.4216 8 11.1836 8 12H10ZM13.1052 13.6673C12.789 13.8775 12.4103 14 12 14V16C12.8164 16 13.5785 15.7544 14.2126 15.3328L13.1052 13.6673Z",fill:"currentColor"}),c.jsx("path",{d:"M6.12815 7C4.77316 7.99438 3.53535 9.35957 2.50209 11.0955C2.17024 11.6531 2.17115 12.3487 2.50305 12.9062C6.05251 18.8681 12.0149 20.4553 16.8492 17.6681",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const m1=[{color:"#f5d90a",dots:[[10,30],[30,30],[20,20],[10,10],[20,10],[30,10],[0,0]],left:"6%",top:"16%",rot:24},{color:"#9e8cfc",dots:[[10,30],[0,20],[0,10],[10,0],[20,0],[30,10],[30,20],[20,30]],left:"30%",top:"6%",rot:0},{color:"#f76808",dots:[[0,30],[20,30],[30,20],[10,20],[0,10],[10,0],[20,10],[30,0]],left:"53%",top:"18%",rot:-29},{color:"#dba16e",dots:[[0,0],[0,10],[0,20],[0,30],[10,0],[20,0],[30,0],[30,10],[10,30],[30,30]],left:"76%",top:"7%",rot:4},{color:"#d6409f",dots:[[0,30],[30,30],[20,20],[10,20],[10,10],[0,0],[20,10],[30,0]],left:"94%",top:"15%",rot:-25}];function qpt({color:t,dots:e,scale:n=1}){return c.jsx("div",{className:"relative size-[40px] shrink-0 overflow-hidden",style:n===1?void 0:{transform:`scale(${n})`},children:e.map(([s,r],i)=>c.jsx("span",{className:"absolute size-[10px]",style:{left:s,top:r,background:t}},i))})}function Kpt(t){const[e,n]=w.useState(()=>m1.map(()=>0));return w.useEffect(()=>{if(!t)return;const s=[],r=i=>{const a=setTimeout(()=>{n(o=>{const l=[...o];return l[i]=(Math.random()*2-1)*9,l}),r(i)},900+Math.random()*2200);s.push(a)};return m1.forEach((i,a)=>r(a)),()=>s.forEach(clearTimeout)},[t]),e}const Ypt=28,nse=[{left:"6%",top:"29%"},{left:"28%",top:"13%"},{left:"50%",top:"6%"},{left:"72%",top:"13%"},{left:"94%",top:"29%"}],Zpt=[{left:"10%",top:"132%"},{left:"33%",top:"-24%"},{left:"63%",top:"136%"},{left:"86%",top:"-20%"},{left:"103%",top:"46%"}],Xpt=[!1,!0,!1,!0,!0],sse=78,rse=t=>`calc(50% ${t<0?"-":"+"} ${Math.abs(Math.round(t))}px)`,Qpt=m1.map((t,e)=>{const n=e*2*Math.PI/m1.length;return{left:rse(Math.sin(n)*sse),top:rse(-Math.cos(n)*sse)}});function Jpt(t){const[e,n]=w.useState(0);return w.useEffect(()=>{if(!t)return;let s=0;const r=()=>{n(i=>i+18+Math.random()*30),s=window.setTimeout(r,1800+Math.random()*2600)};return s=window.setTimeout(r,900+Math.random()*1200),()=>window.clearTimeout(s)},[t]),e}function N5({active:t,layout:e="band",shapeScale:n=1,plane:s="all",positions:r,behind:i,rotate:a,sources:o,hidden:l}){const u=Kpt(t),d=Jpt(e==="circle"&&t),f=(m,v)=>e==="pill"?(r==null?void 0:r[v])??Zpt[v]:e==="circle"?Qpt[v]:e==="arc"?{left:nse[v].left,top:`calc(${nse[v].top} + ${Ypt}px)`}:{left:m.left,top:m.top},p=t?m1.map((m,v)=>{if(l!=null&&l[v])return null;const x=m1[(o==null?void 0:o[v])??v]??m,y=(i==null?void 0:i[v])??Xpt[v];if(s!=="all"&&y!==(s==="behind"))return null;const S=f(x,v);return c.jsx("div",{className:"absolute z-[1]",style:{left:S.left,top:S.top,transform:"translate(-50%, -50%)"},children:c.jsx("div",{style:{animation:"pop-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both",animationDelay:`${v*80}ms`},children:c.jsx("div",{className:"transition-transform [transition-duration:500ms] ease-in-out",style:{transform:`rotate(${x.rot+u[v]+((a==null?void 0:a[v])??0)}deg)`}
514,children:c.jsx(qpt,{color:x.color,dots:x.dots,scale:n})})})},v)}):null;return c.jsxs(c.Fragment,{children:[e!=="pill"&&s!=="front"&&c.jsx("img",{src:"/success-glow.png",alt:"",className:"absolute inset-0 size-full object-cover blur-[20px] opacity-70 pointer-events-none select-none"}),e==="circle"?c.jsx("div",{className:"absolute inset-0 z-[1]",style:{transform:`rotate(${d}deg)`,transition:"transform 2200ms cubic-bezier(0.4, 0, 0.2, 1)"},children:p}):p]})}function nbe({active:t,title:e,subtitle:n,cta:s="Done",onDone:r,layout:i="band",shapeScale:a=1}){return c.jsxs("div",{className:"relative flex flex-1 flex-col items-center justify-end gap-[24px] w-full min-h-[240px]",children:[c.jsx(N5,{active:t,layout:i,shapeScale:a}),c.jsxs("div",{className:"fade-in relative z-[10] flex flex-col gap-[8px] items-center text-center font-medium",children:[c.jsx("p",{className:"text-[20px] leading-[24px] text-[var(--sand-12)]",children:e}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:n})]}),c.jsx("button",{type:"button",onClick:r,className:"fade-in relative z-[10] cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-5)] bg-[var(--sand-4)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] w-full",children:c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:s})})]})}function b8(t,e){try{const n=localStorage.getItem(t);return n===null?e:JSON.parse(n)}catch{return e}}function S8(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}const emt=.02,ise=420,ase=.6,tmt=[{left:"1.5%",top:"90%"},{left:"29.2%",top:"-6.4%"},{left:"60%",top:"110%"},{left:"73.2%",top:"-20%"},{left:"98.1%",top:"100%"}],nmt=[!1,!1,!0,!1,!1],smt=[0,-4,0,0,0],rmt=[{left:"-1%",top:"24%"},{left:"26%",top:"calc(-9% + 10px)"},{left:"58%",top:"104%"},{left:"78%",top:"calc(-11% + 24px)"},{left:"calc(101% - 8px)",top:"68%"}],imt=[!1,!1,!1,!1,!1],amt=[!0,!1,!1,!1,!1],omt=[0,-4,0,6,0],lmt=[void 0,void 0,void 0,0,void 0],ose=260,lse=420;function cmt({done:t,total:e}){const s=2*Math.PI*7,r=Math.max(emt,e?t/e:0);return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",className:"shrink-0",children:[c.jsx("circle",{cx:"9",cy:"9",r:7,fill:"none",stroke:"var(--sand-6)",strokeWidth:"2"}),c.jsx("circle",{cx:"9",cy:"9",r:7,fill:"none",stroke:"var(--sand-12)",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:s*(1-r),transform:"rotate(-90 9 9)",className:"transition-[stroke-dashoffset] duration-300 [transition-timing-function:var(--ease-out)]"})]})}function umt(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:20,height:20,"aria-hidden":"true",className:"shrink-0",children:[c.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"var(--sand-12)"}),c.jsx("path",{d:"M8 12.5l2.5 2.5L16 9.5",fill:"none",stroke:"var(--sand-1)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function dmt({title:t,steps:e,description:n,storagePrefix:s,dismissLabel:r,blocks:i,lockUntilComplete:a=!1,marks:o="collapsed",progress:l=!0,icon:u}){const d=di(),f=`${s}-done`,p=`${s}-hidden`,m=`${s}-open`,[v,x]=w.useState(()=>b8(f,[])),[y,S]=w.useState(()=>b8(p,!1)),[_,E]=w.useState(()=>b8(m,!0)),[T,k]=w.useState(!1),[R,I]=w.useState(null),[A,L]=w.useState("idle"),[j,F]=w.useState(!1);w.useEffect(()=>S8(f,v),[f,v]),w.useEffect(()=>S8(p,y),[p,y]),w.useEffect(()=>S8(m,_),[m,_]);const O=e.every(ee=>v.includes(ee.id)),M=w.useRef(!1);if(w.useEffect(()=>{if(!O){M.current=!0,L("idle");return}!M.current||A!=="idle"||L("closing")},[O,A]),w.useEffect(()=>{if(A!=="closing")return;const ee=window.setTimeout(()=>F(!0),ose+lse);return()=>window.clearTimeout(ee)},[A]),y||j)return null;const U=e.filter(ee=>v.includes(ee.id)).length,G=[...e.filter(ee=>!v.includes(ee.id)),...e.filter(ee=>v.includes(ee.id))],$=a&&(!O||A==="closing"),V=$||_,B=o==="always"||!V,q=V?rmt:tmt,z=V?imt:nmt,D=V?omt:smt,K=V?lmt:void 0,Y=V?amt:void 0,J=u?c.jsx("span",{className:"flex size-[20px] shrink-0 items-center justify-center",children:u}):l?c.jsx("span",{role:"progressbar","aria-valuenow":U,"aria-valuemin":0,"aria-valuemax":e.length,"aria-label":`${t} progress`,className:"flex shrink-0 items-center",children:c.jsx(cmt,{done:U,total:e.length})}):null,ne=ee=>x(te=>te.includes(ee)?te.filter(ue=>ue!==ee):[...te,ee]),Q=ee=>{if(i==null?void 0:i(ee)){I(ee.id),window.setTimeout(()=>I(null),ise);return}ee.href?window.open(ee.href,"_blank","noopener,noreferrer"):ee.to&&d(ee.to)};return c.jsxs(wt.div,{className:"relative",initial:!1,animate:{o
514pacity:A==="closing"?0:1},transition:{duration:lse/1e3,delay:A==="closing"?ose/1e3:0,ease:[.4,0,.2,1]},children:[B&&c.jsx("div",{className:"pointer-events-none absolute inset-0 z-0",children:c.jsx(N5,{active:!0,layout:"pill",shapeScale:ase,plane:"behind",positions:q,behind:z,rotate:D,sources:K,hidden:Y})}),c.jsxs(wt.div,{layout:!0,initial:!1,transition:{duration:.28,ease:[.4,0,.2,1]},className:"relative z-[1] flex flex-col overflow-hidden rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)]",children:[V?c.jsxs("div",{className:He("relative flex h-[44px] shrink-0 items-center gap-[4px] bg-[var(--sand-3)] px-[12px] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",!$&&"hover:bg-[var(--sand-4)]"),children:[!$&&c.jsx("button",{type:"button",onClick:()=>E(!1),"aria-expanded":!0,"aria-label":`Collapse ${t}`,className:"absolute inset-0 z-0 cursor-pointer"}),c.jsxs("div",{className:"pointer-events-none relative z-[1] flex min-w-px flex-1 items-center gap-[10px]",children:[J,c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:t})]}),!$&&c.jsxs(HS,{open:T,onOpenChange:k,children:[c.jsx(GS,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":`${t} options`,className:"relative z-[2] flex size-[24px] shrink-0 cursor-pointer items-center justify-center rounded-full text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-6)] hover:text-[var(--sand-12)]",children:c.jsx(Qye,{size:16})})}),c.jsx(Q1,{align:"end",style:{width:160},className:"rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[4px] shadow-menu",children:c.jsxs("button",{type:"button",onClick:()=>{k(!1),S(!0)},className:"flex h-[36px] w-full cursor-pointer items-center gap-[8px] rounded-[6px] px-[12px] text-left text-[14px] leading-[20px] text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] hover:text-[var(--sand-12)]",children:[c.jsx(Wpt,{size:16,className:"shrink-0"}),r]})})]})]}):c.jsxs("button",{type:"button",onClick:()=>E(!0),"aria-expanded":!1,className:"group flex h-[44px] w-full cursor-pointer items-center gap-[10px] bg-[var(--sand-3)] px-[12px] text-left transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)]",children:[J,c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-[20px] text-[var(--sand-12)]",children:t}),l?c.jsxs("span",{className:"relative flex shrink-0 items-center justify-end",children:[c.jsxs("span",{className:"text-[14px] font-medium leading-[20px] text-[var(--sand-10)] opacity-100 transition-opacity duration-150 [transition-timing-function:var(--ease-out)] group-hover:opacity-0",children:[U," of ",e.length]}),c.jsx(fd,{size:20,className:"absolute right-0 text-[var(--sand-10)] opacity-0 transition-opacity duration-150 [transition-timing-function:var(--ease-out)] group-hover:opacity-100"})]}):c.jsx(fd,{size:20,className:"shrink-0 text-[var(--sand-10)]"})]}),c.jsx(xr,{initial:!1,children:V&&c.jsxs(wt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.28,ease:[.4,0,.2,1]},className:"overflow-hidden",children:[c.jsx("div",{className:"h-[0.5px] w-full bg-[var(--sand-6)]"}),c.jsxs("div",{className:"flex flex-col px-[12px] py-[8px]",children:[n&&c.jsx("p",{className:"px-[2px] pb-[8px] pt-[4px] text-[14px] leading-[20px] text-[var(--sand-11)]",children:n}),c.jsx("ul",{className:"flex flex-col",children:G.map(ee=>{const te=v.includes(ee.id);return c.jsx(wt.li,{layout:!0,transition:{duration:.28,ease:[.4,0,.2,1]},className:"flex items-center gap-[10px] py-[6px]",children:c.jsxs(wt.div,{animate:R===ee.id?{x:[0,-6,6,-4,4,0]}:{x:0},transition:{duration:ise/1e3,ease:"easeInOut"},className:"flex min-w-px flex-1 items-center gap-[10px]",children:[c.jsx("button",{type:"button",onClick:()=>
514ne(ee.id),"aria-pressed":te,"aria-label":`Mark "${ee.label}" ${te?"not done":"done"}`,className:"flex size-[20px] shrink-0 cursor-pointer items-center justify-center rounded-full",children:te?c.jsx(umt,{}):c.jsx("span",{className:"size-[18px] rounded-full border-[1.5px] border-solid border-[var(--sand-7)]"})}),c.jsxs("button",{type:"button",onClick:()=>Q(ee),disabled:te,className:He("flex min-w-px flex-1 items-center gap-[6px] text-left text-[14px] font-medium leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",te?"cursor-default text-[var(--sand-10)] line-through":"cursor-pointer text-[var(--sand-12)] hover:text-[var(--sand-11)]"),children:[c.jsx("span",{className:"min-w-px truncate",children:ee.label}),ee.external&&c.jsx(La,{size:20,className:"shrink-0 text-[var(--sand-10)]"})]})]})},ee.id)})})]})]},"steps")})]}),B&&c.jsx("div",{className:"pointer-events-none absolute inset-0 z-[2]",children:c.jsx(N5,{active:!0,layout:"pill",shapeScale:ase,plane:"front",positions:q,behind:z,rotate:D,sources:K,hidden:Y})})]})}const fmt="https://github.com/steel-dev/steel-browser",hmt=[{id:"star",label:"Star us on GitHub",href:fmt,external:!0}];function pmt(){return c.jsx(dmt,{title:"Welcome to Steel",description:"You now have beta-access to our new product, computers. Enjoy and let us know of any issues you may experience.",steps:hmt,storagePrefix:"steel-welcome",dismissLabel:"Dismiss welcome",progress:!1,icon:c.jsx(O1,{className:"h-[14px] w-[20px] text-[var(--sand-12)]"}),lockUntilComplete:!0,marks:"always"})}const mmt="https://docs.steel.dev",cse="https://discord.gg/steel-dev",gmt=t=>"$"+t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),Ib="flex w-full cursor-pointer items-center gap-2 rounded-lg p-2 text-left transition-colors duration-150",CU="bg-[var(--sand-3)] text-[var(--sand-12)]",Hm="text-[var(--sand-10)] hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]";function Sf({icon:t,label:e,to:n,active:s,badge:r}){return c.jsxs(Hn,{to:n,"aria-current":s?"page":void 0,className:He(Ib,s?CU:Hm),children:[c.jsx(t,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5",children:e}),r]})}function za({icon:t,label:e,to:n,active:s,external:r,onPrefetch:i}){return r?c.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:He("flex w-full cursor-pointer items-center gap-2 rounded-lg p-2 text-left text-[14px] font-medium leading-5 transition-colors duration-150",Hm),children:[c.jsx(t,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate",children:e}),c.jsx(La,{size:14,className:"shrink-0 text-[var(--sand-10)]"})]}):c.jsxs(Hn,{to:n,"aria-current":s?"page":void 0,onMouseEnter:i,onFocus:i,className:He("flex w-full cursor-pointer items-center gap-2 rounded-lg p-2 text-left text-[14px] font-medium leading-5 transition-colors duration-150",s?CU:Hm),children:[c.jsx(t,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate",children:e})]})}function w8({icon:t,label:e,active:n,expanded:s,onToggle:r,badge:i,children:a}){return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("button",{type:"button",onClick:r,"aria-expanded":s,className:He("flex w-full cursor-pointer items-center justify-between gap-2 rounded-lg p-2 text-left transition-colors duration-150",n?CU:Hm),children:[c.jsxs("span",{className:"flex min-w-px items-center gap-2",children:[c.jsx(t,{size:20,className:"shrink-0"}),c.jsx("span",{className:"text-[14px] font-medium leading-5",children:e}),i]}),c.jsx(u1,{size:20,className:He("shrink-0 text-[var(--sand-10)] transition-transform duration-200 ease-out",s&&"rotate-180")})]}),c.jsx(xr,{initial:!1,children:s&&c.jsx(wt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.26,ease:xT},className:"overflow-hidden",children:c.jsx(wt.div,{variants:bmt,initial:"hidden",animate:"show",exit:"hidden",className:"ml-[18px] mt-2 flex flex-col gap-2 border-l-[0.5px] border-[var(--sand-6)] pl-[14px]",children:w.Children.toArray(a).map((o,l)=>c.jsx(wt.div,{variants:Smt,children:o},w.isValidElement(o)?o.key:l))})},"items")})]})}function use({icon:t,label:e,to:n,external:s,trailing:r}){const i=c.jsxs(c.Fragment,{children:[c.jsx(t,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5",children:e}),r]}),a=He(Ib,Hm);return s?c.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:a,children:i}):c.jsx(Hn,{to:n,className:a,children:i})}const vmt=c.jsx("span",{className:"inline-flex h-[20px] shrink-0 items-center rounded-full bg-[var(--blue-3)] dark:bg-dark-blue-3 px-[6px] text-[11px] font-medium leading-[20px] text-[var(--blue-11)] dark:text-dark-blue-9",children:"Beta"}),xmt="w-[18.5rem]",ymt="w-[25rem]",XE="/settings/network",QE="/settings/billing/wallet",_8="/settings/billing/usage",dse="/settings/billing/usage/proxy",JE="/settings/projects",E8="/settings/organization/organization-members",fse="/settings/billing/invoices",bmt={hidden:{transition:{staggerChildren:.03,staggerDirection:-1}},show:{transition:{staggerChildren:.04,delayChildren:.04}}},Smt={hidden:{opacity:0,x:-8},show:{opacity:1,x:0,transition:{duration:.2,ease:"easeOut"}}};let hse="/quickstart";function wmt(){const{pathname:t,hash:e}=Gs(),n=di(),{collapsed:s,showContents:r,toggle:i}=tbe(),a=iFe(),o=E7(),l=zye(),u=wye(),d=xF(),{balanceDollars:f,isLoading:p}=mu(),{useSession:m}=fr(),v=Opt(),x=w.useCallback(()=>{const G=EU("Last 24h");
514v({startDate:G.startDate,endDate:G.endDate,granularity:G.granularity})},[v]),y=t.startsWith("/sessions")||t===XE,S=t.startsWith("/computers"),_=t.startsWith("/settings")&&t!==XE&&!t.startsWith(QE)&&!t.startsWith(fse)&&!t.startsWith(JE),E=y?"browsers":S?"computers":_?"settings":null,[T,k]=w.useState(E);w.useEffect(()=>{k(E)},[E]);const R=G=>k($=>$===G?null:G),I=G=>()=>R(G),A=t.startsWith("/sessions/")?t.split("/")[2]:void 0,{data:L,isError:j}=m(A),F=t.startsWith("/settings/profile")?"account":t.startsWith("/settings/organization")?"organization":t.startsWith(JE)?"projects":t.startsWith(fse)?"receipt":A?"session":null,O=F==="session"?ymt:xmt,M={transitionProperty:"width",transitionDuration:`${Jye*1e3}ms`,transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"};w.useEffect(()=>{F||(hse=`${t}${e}`)},[F,t,e]);const U=G=>t===G;return c.jsx("aside",{style:M,className:He("flex h-full min-h-0 shrink-0 flex-col overflow-y-auto overflow-x-hidden border-r-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)]",s?"w-0 border-r-0":O),children:!(s&&r)&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:M,className:He("flex h-[72px] shrink-0 items-center gap-2 border-b-[0.5px] border-solid border-[var(--sand-6)] px-4",O),children:[c.jsx(wt.div,{initial:!1,animate:{opacity:r?1:0},transition:{duration:vT,ease:xT},className:He("min-w-px flex-1",r?"":"pointer-events-none"),children:F?c.jsxs("button",{type:"button",onClick:()=>n(hse),className:He(Ib,Hm,"w-full"),children:[c.jsx(Cpt,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5",children:"Back"})]}):c.jsx(Wye,{fullWidth:!0})}),c.jsx(wt.button,{type:"button",onClick:i,"aria-label":"Collapse sidebar","aria-expanded":!0,title:"Collapse sidebar",initial:!1,animate:{opacity:r?1:0},transition:{duration:vT,ease:xT},className:"flex size-[36px] shrink-0 cursor-pointer items-center justify-center rounded-lg text-[var(--sand-10)] transition-colors duration-150 hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]",children:c.jsx(Yye,{size:20,className:"shrink-0"})})]}),c.jsxs(wt.div,{initial:!1,animate:{opacity:r?1:0},transition:{duration:vT,ease:xT},style:M,className:He("flex min-h-0 shrink-0 flex-1 flex-col",O,r?"":"pointer-events-none"),children:[F==="account"&&c.jsxs("nav",{className:"flex flex-col gap-2 px-4 pt-4",children:[c.jsx(Sf,{icon:U1,label:"Profile",to:"/settings/profile",active:U("/settings/profile")&&e!=="#/security"}),c.jsx(Sf,{icon:B7,label:"Security",to:"/settings/profile#/security",active:U("/settings/profile")&&e==="#/security"})]}),F==="projects"&&Ade&&c.jsx("nav",{className:"flex flex-col gap-2 px-4 pt-4",children:c.jsx(Sf,{icon:U7,label:"Projects",to:JE,active:t.startsWith(JE)})}),F==="session"&&A&&c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:L?c.jsx(cve,{id:A,sessionStatus:L.status,externalTabs:!0}):j?null:c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Mh,{className:"size-[20px] text-[var(--sand-10)]",strokeWidth:2.5})})}),F==="receipt"&&c.jsx("nav",{className:"flex flex-col gap-2 px-4 pt-4",children:c.jsx(Sf,{icon:jpt,label:"Receipt",to:t,active:!0})}),F==="organization"&&c.jsxs("nav",{className:"flex flex-col gap-2 px-4 pt-4",children:[c.jsx(Sf,{icon:r2,label:"Organization",to:"/settings/organization",active:!t.startsWith(E8)}),c.jsx(Sf,{icon:z7,label:"Members",to:E8,active:t.startsWith(E8)})]}),!F&&c.jsxs(c.Fragment,{children:[c.jsxs("nav",{className:"flex flex-col gap-2 px-4 pt-4",children:[c.jsx(Sf,{icon:Ppt,label:"Quickstart",to:"/quickstart",active:U("/quickstart")}),c.jsxs(w8,{icon:Ipt,label:"Browsers",active:y,expanded:T==="browsers",onToggle:I("browsers"),children:[c.jsx(za,{icon:Dpt,label:"Sessions",to:"/sessions",active:t.startsWith("/sessions")}),c.jsx(za,{icon:Nh,label:"Network Settings",to:XE,active:U(XE)})]}),a&&c.jsx(w8,{icon:Mpt,label:"Computers",active:S,expanded:T==="computers",onToggle:I("computers"),badge:vmt,children:o?[c.jsx(za,{icon:Lpt,label:"Machines",to:"/computers",active:U("/computers")},"machines"),c.jsx(za,{icon:Hde,label:"Checkpoints",to:"/computers/checkpoints",active:U("/computers/checkpoints")},"checkpoints"),c.jsx(za,{icon:Npt,label:"Environments",to:"/computers/environments",active:U("/computers/environments")},"environments"),c.jsx(za,{icon:Apt,label:"Secrets",to:"/computers/secrets",active:U("/computers/secrets")},"secrets")]:c.jsx(za,{icon:yd,label:"Sign up for beta",to:cse,external:!0,active:!1})})]}),c.jsx("div",{className:"my-4 h-[0.5px] shrink-0 bg-[var(--sand-6)]"}),c.jsxs("nav",{className:"flex flex-col gap-2 px-4",children:[c.jsxs(w8,{icon:Kye,label:"Settings",active:_,expanded:T==="settings",onToggle:I("settings"),children:[c.jsx(za,{icon:r2,label:"Organization",to:"/settings/organization",active:!1}),c.jsx(za,{icon:RS,label:"API Keys",to:"/settings/api-keys",active:U("/settings/api-keys")}),c.jsx(za,{icon:V7,label:"Usage",to:_8,active:d?U(_8):t.startsWith(_8),onPrefetch:x}),d?[c.jsx(za,{icon:Nh,label:"Proxy & Network",to:dse,active:U(dse)},"usage-proxy")]:[],c.jsx(za,{icon:AS,label:"Limits & alerts",to:"/settings/billing/limits",active:U("/settings/billing/limits")}),c.jsx(za,{icon:P4,label:"Plans",to:"/settings/billing/plans",active:U("/settings/billing/plans")}),u&&c.jsx(za,{icon:yd,label:"Referrals",to:"/settings/referrals",active:U("/settings/referrals")})]}),c.jsx(Sf,{icon:NS,label:"Wallet",to:QE,active:t.startsWith(QE),badge:c.jsx("span",{className:He("inline-flex h-[20px] shrink-0 items-center rounded-[999px] px-[8px] text-[12px] font-medium leading-[20px]",t.startsWith(QE)?"bg-[var(--sand-5)]":"bg-[var(--sand-3)]",p?"animate-pulse text-[var(--sand-10)]":"text-[var(--sand-11)]"),children:p||f==null?"—":gmt(f)})}),c.jsx(use,{icon:Tpt,label:"Docs",to:mmt,external:!0,trailing:c.jsx(La,{size:14,className:"shrink-0 text-[var(--sand-10)]"})}),c.jsx(use,{icon:Rpt,label:"Discord",to:cse,external:!0,trailing:c.jsx(La,{size:14,className:"shrink-0 text-[var(--sand-10)]"})}),c.jsx(Hye,{trigger:c.jsxs("button",{type:"button",className:He(Ib,Hm,"w-full"),children:[c.jsx(kpt,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5",children:"Leave feedback"})]})})]})]}),c.jsx("div",{className:"mt-auto flex shrink-0 flex-col gap-2 p-4",children:F==="session"?A&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"-mx-4 mb-2 h-[0.5px] shrink-0 bg-[var(--sand-6)]"}),c.jsxs("div",{className:"flex items-center justify-center gap-2",children:[c.jsx(rst,{}),c.jsx(rve,{id:A})]})]}):c.jsxs(c.Fragment,{children:[l&&c.jsxs(Hn,{to:"/finish-setup",className:He(Ib,"bg-[var(--blue-3)] dark:bg-dark-blue-3 text-[var(--blue-11)] dark:text-dark-blue-9 transition-[filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-110"),children:[c.jsx(yd,{size:20,className:"shrink-0"}),c.jsx("span",{className:"min-w-px flex-1 truncate text-[14px] font-medium leading-5",children:"Finish Setup"})]}),o&&!s&&c.jsx(pmt,{}),c.jsx("div",{className:"-mx-4 my-2 h-[0.5px] shrink-0 bg-[var(--sand-6)]"}),c.jsx(Vpt,{onManageAccount:()=>n("/settings/profile")})]})})]})]})})}function _mt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7.5 21H7C5.89543 21 5 20.1046 5 19V5C5 3.89543 5.89543 3 7 3H12.1716C12.702 3 13.2107 3.21071 13.5858 3.58579L18.4142 8.41421C18.7893 8.78929 19 9.29799 19 9.82843V19C19 20.1046 18.1046 21 17 21H16.5M13 3.5V7C13 8.10457 13.8954 9 15 9H18.5M12 14V20M12 20L14.5 17.5M12 20L9.5 17.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Emt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7 14V19C7 20.1046 7.89543 21 9 21H15C16.1046 21 17 20.1046 17 19V14M7 14H17M7 14V16C7 16.5523 6.55228 17 6 17H5C3.89543 17 3 16.1046 3 15V9C3 7.89543 3.89543 7 5 7H19C20.1046 7 21 7.89543 21 9V15C21 16.1046 20.1046 17 19 17H18C17.4477 17 17 16.5523 17 16V14M9 11H7M9 3H15C16.1046 3 17 3.89543 17 5V6C17 6.55228 16.5523 7 16 7H8C7.44772 7 7 6.55228 7 6V5C7 3.89543 7.89543 3 9 3Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Yo(t,e="usd"){const n=new Intl.NumberFormat("en-US",{style:"currency",currency:e.toUpperCase()}),s=n.resolvedOptions().maximumFractionDigits??2;return n.format(t/10**s)}function O2(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(t))}function sbe(t){return t.settlementStatus!=="none"?{refunded:"Refunded",partially_refunded:"Parti
514ally refunded",credited:"Credited"}[t.settlementStatus]:{paid:"Paid",open:"Due",void:"Void",draft:"Draft",uncollectible:"Uncollectible"}[t.status]}async function rbe(t){const{data:e,error:n}=await t;if(e!==void 0)return e;const s=n&&typeof n=="object"&&"message"in n?String(n.message):"Couldn’t load billing history. Please try again.";throw new Error(s)}function Cmt(){const{organization:t,membership:e}=Mo();return tFe({queryKey:["billingInvoices",t==null?void 0:t.id,e==null?void 0:e.role],enabled:!!(t!=null&&t.id&&(e==null?void 0:e.role)==="org:admin"),initialPageParam:void 0,queryFn:({pageParam:n,signal:s})=>rbe(OZe({query:{limit:20,startingAfter:n},signal:s})),getNextPageParam:n=>n.hasMore?n.nextCursor??void 0:void 0,retry:1})}function ibe(t){const{organization:e,membership:n}=Mo();return rs({queryKey:["billingInvoice",e==null?void 0:e.id,n==null?void 0:n.role,t],enabled:!!(e!=null&&e.id&&(n==null?void 0:n.role)==="org:admin"&&t),queryFn:({signal:s})=>rbe($Ze({path:{invoiceId:t},signal:s})),retry:1})}const pse="/settings/billing/invoices",mse="Receipt",gse="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-3)] hover:bg-[var(--sand-4)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap";function Tmt(){const{pathname:t}=Gs(),{collapsed:e,toggle:n}=tbe(),s=t.startsWith("/sessions/")?t.split("/")[2]:void 0,{useSession:r}=fr(),{data:i}=r(s),a=t.startsWith(`${pse}/`)?t.slice(pse.length+1).split("/")[0]:void 0,{data:o}=ibe(a),l=t.startsWith("/settings/profile")?"Profile Settings":t.startsWith("/settings/organization")?"Organization Settings":t.startsWith("/settings/projects")?"Project Settings":a?o?[mse,c.jsx("span",{className:"text-[var(--sand-10)]",children:` · ${O2(o.createdAt)}`},"date")]:mse:null,u=(i==null?void 0:i.id)??s,d=u?["Session",c.jsx("span",{className:"text-[var(--sand-10)]",children:` ${u}`},"id"),c.jsx("button",{type:"button",onClick:()=>Ja(u,"Session ID"),"aria-label":"Copy session ID",className:"pointer-events-auto ml-[8px] flex size-[20px] shrink-0 cursor-pointer items-center justify-center rounded-[4px] text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-3)] hover:text-[var(--sand-12)]",children:c.jsx(Pd,{size:14})},"copy")]:l,f=t.startsWith("/settings/profile")||t.startsWith("/settings/organization")||!!a||!!s;return c.jsxs("div",{className:"relative flex h-[72px] shrink-0 items-center border-b-[0.5px] border-solid border-[var(--sand-6)]",children:[e&&c.jsx("div",{className:"flex size-[72px] shrink-0 items-center justify-center self-stretch border-r-[0.5px] border-solid border-[var(--sand-6)]",children:c.jsx("button",{type:"button",onClick:n,"aria-label":"Expand sidebar","aria-expanded":!1,title:"Expand sidebar",className:"flex size-[36px] shrink-0 cursor-pointer items-center justify-center rounded-lg text-[var(--sand-10)] transition-colors duration-150 hover:bg-[var(--sand-2)] hover:text-[var(--sand-12)]",children:c.jsx(Yye,{size:20,className:"shrink-0"})})}),c.jsxs("div",{className:"flex min-w-px flex-1 items-center px-[24px]",children:[!f&&c.jsx("div",{className:"flex h-[40px] shrink-0 items-center",children:c.jsx(qye,{})}),o&&c.jsxs("div",{className:"flex h-[40px] shrink-0 items-center gap-[12px]",children:[o.invoicePdfUrl&&c.jsxs("a",{href:o.invoicePdfUrl,download:!0,target:"_blank",rel:"noopener noreferrer",className:`${gse} gap-[8px]`,children:[c.jsx(_mt,{size:20,className:"shrink-0 text-[var(--sand-10)]"}),"Download document"]}),c.jsxs("button",{type:"button",onClick:()=>window.print(),className:`${gse} gap-[8px]`,children:[c.jsx(Emt,{size:20,className:"shrink-0 text-[var(--sand-10)]"}),"Print Document"]})]}),d&&c.jsx("p",{className:"pointer-events-none absolute left-1/2 flex h-[40px] max-w-[50%] -translate-x-1/2 items-center whitespace-pre font-sans text-[14px] font-medium leading-5 text-[var(--sand-12)]",children:d}),!Ade]})]})}function kmt(){const{toasts:t,dismiss:e}=JBe();return c.jsx(_qe,{toasts:t.filter(n=>n.open!==!1).map(({id:n,title:s,actionLabel:r,onClick:i,duration:a,sweep:o,tone:l,progress:u,shapes:d})=>({id:n,title:s,actionLabel:r,onAction:i,onDismiss:()=>e(n),duration:a,sweep:o,tone:l,progress:u,shapes:d}))})}function Rmt(){const{createOrganization:t}=Qm(),{setActive:e}=Ile(),{organization:n}=Mo(),{user:s}=Vi(),[r,i]=w.useState(!1),a=di(),o=MBe(),{newNav:l,resolved:u}=o,{pathname:d}=Gs(),f=d.startsWith("/sessions/")?d.split("/")[2]:"none",[p,m]=w.useState(!1),v=w.useEffectEvent(()=>a("/questionnaire"));w.useEffect(()=>{!s||!r||p&&v()},[s,r,p]),w.useEffect(()=>{const y=async()=>{const S=await t({name:`${(s==null?void 0:s.firstName)||(s==null?void 0:s.username)||"Anon"}'s Team`});e&&e({organization:S}
514)};s&&(s==null?void 0:s.organizationMemberships.length)===0?(y(),m(!0)):e&&s&&s.organizationMemberships.length>0&&!n&&e({organization:s.organizationMemberships[0].organization})},[s,t,e,n]),w.useEffect(()=>{s&&n&&i(!0)},[s,n]);const x=r?c.jsx(Jl,{}):c.jsx("div",{className:"flex flex-col items-center justify-center flex-1 w-full",children:c.jsx(Mh,{className:"w-16 h-16 text-[var(--sand-6)]"})});return c.jsxs(Gde.Provider,{value:o,children:[c.jsxs($O,{children:[c.jsx("div",{className:u&&l?"flex flex-col h-screen overflow-hidden max-h-screen flex-1 bg-[var(--sand-1)] text-[var(--sand-12)]":"flex flex-col h-screen overflow-hidden max-h-screen items-center justify-center flex-1 bg-[var(--sand-1)] text-[var(--sand-12)]",children:u?l?c.jsx(Gpt,{children:c.jsx($0e,{children:c.jsxs("div",{className:"flex min-h-0 w-full flex-1 overflow-hidden",children:[c.jsx(wmt,{}),c.jsxs("div",{className:"flex min-w-px flex-1 flex-col overflow-hidden",children:[c.jsx(Tmt,{}),x]})]})},f)}):c.jsxs(c.Fragment,{children:[c.jsx(Ept,{}),c.jsx("div",{className:"flex flex-col overflow-hidden flex-1 w-full",children:x})]}):c.jsx("div",{className:"flex flex-col items-center justify-center flex-1 w-full",children:c.jsx(Mh,{className:"w-16 h-16 text-[var(--sand-6)]"})})}),c.jsx(kmt,{})]}),c.jsx(FO,{children:c.jsx(il,{to:"/sign-in"})})]})}const C8="steel_ph_actor_opt_out",vse="steel_ph_signed_in_session";function xse(t){try{return window.localStorage.getItem(t)}catch{return null}}function T8(t,e){try{e===null?window.localStorage.removeItem(t):window.localStorage.setItem(t,e)}catch{}}function Amt(){var m,v;const t=Z1(),{isLoaded:e,userId:n,sessionId:s,actor:r}=zt(),i=!!r,{user:a}=Vi(),{organization:o}=Mo(),l=e&&!i,u=((m=a==null?void 0:a.primaryEmailAddress)==null?void 0:m.emailAddress)??((v=a==null?void 0:a.emailAddresses[0])==null?void 0:v.emailAddress),d=a==null?void 0:a.fullName,f=o==null?void 0:o.id,p=o==null?void 0:o.name;return w.useEffect(()=>{if(e){if(i){t.has_opted_out_capturing()||(t.opt_out_capturing(),T8(C8,"1"));return}xse(C8)&&(T8(C8,null),t.reset(),t.opt_in_capturing()),t.get_property("$user_state")==="identified"&&t.get_distinct_id()!==n&&t.reset(),!(!n||!u)&&t.identify(n,{email:u,name:d})}},[e,n,u,d,i,t]),w.useEffect(()=>{!l||!n||(f?t.group("organization",f,{name:p}):t.getGroups().organization&&t.resetGroups())},[l,n,f,p,t]),w.useEffect(()=>{!l||!s||xse(vse)===s||(T8(vse,s),t.capture("user-signed-in"))},[l,s,t]),null}function Nmt(){const t=Gs(),e=Z1(),{isLoaded:n}=zt(),s=w.useEffectEvent(()=>{e==null||e.capture("$pageview",{$current_url:window.location.href})});return w.useEffect(()=>{n&&s()},[t.pathname,t.search,n]),null}const Imt=["__clerk_ticket","__clerk_db_jwt","user_code","code","state","token","jwt","ticket","apiKey","api_key"];function Lmt(t){if(!t.includes("?"))return t;try{const e=new URL(t),n=Imt.filter(s=>e.searchParams.has(s));if(n.length===0)return t;for(const s of n)e.searchParams.set(s,"[redacted]");return e.toString()}catch{return t}}function k8(t){if(t)for(const[e,n]of Object.entries(t))typeof n=="string"&&(t[e]=Lmt(n))}const jmt=t=>t&&(k8(t.properties),k8(t.$set),k8(t.$set_once),t),Pmt=20,Mmt=250;typeof window<"u"&&q1.init("phc_LA3X8iOYBZYOCG9TXglifCJpWwxbTK5tlcbzKqRxrt",{api_host:"https://echo.steel-edge.net",capture_pageview:!1,enable_recording_console_log:!1,before_send:jmt});function Dmt(){const{getToken:t,orgId:e}=zt(),{user:n}=Vi();dwe(t);const[s,r]=w.useState(null),i=w.useRef(0),a=w.useRef(null),o=w.useCallback(async()=>{const l=++i.current;try{const u=await t();l===i.current&&r(u??null)}catch(u){l===i.current&&r(null),console.error("Failed to get auth token:",u)}},[t]);return w.useEffect(()=>(r(null),o(),()=>{i.current+=1}),[o,e]),w.useEffect(()=>{var v,x;const l=((v=n==null?void 0:n.primaryEmailAddress)==null?void 0:v.emailAddress)??((x=n==null?void 0:n.emailAddresses[0])==null?void 0:x.emailAddress);if(!l||a.current===l)return;const u=l.split("@")[1],d={username:l,type:"email",...n!=null&&n.firstName?{firstname:n.firstName}:{},...n!=null&&n.lastName?{lastname:n.lastName}:{},...u?{company:u}:{}},f=()=>{var y;if(!((y=window.Reo)!=null&&y.identify))return!1;try{return window.Reo.identify(d),!0}catch{return!1}};if(f()){a.current=l;return}let p=0;const m=window.setInterval(()=>{p+=1,f()?(a.current=l,window.clearInterval(m)):p>=Pmt&&window.clearInterval(m)},Mmt);return()=>window.clearInterval(m)},[n]),c.jsx(Sm,{level:"page",context:"root-providers",children:c.jsxs(kJe,{client:q1,children:[c.jsx(Amt,{}),c.jsx(Nmt,{}),c.jsx(w$e,{client:Pn,children:c.jsx(xet,{children:c.jsx(Sm,{level:"section",context:"websocket-provider",children:c.jsx(Pet,{authToken:s||void 0,orgId:e??void 0,refreshToken:o,children:c.jsx(Sm,{level:"section",context:"session-providers",children:c.jsx(Det,{children:c.jsxs(Iet,{children:[c.jsx(Jl,{}),!1]})})})})})})})]})})}const Omt=()=>{const{user:t}=Vi(),{getToken:e}=zt(),n=aa(),s=w.useRef(null),r=w.useMemo(()=>(t==null?void 0:t.createdAt)&&new Date(t.createdAt)<new Date("2025-07-01"),[t]),{data:i,isLoading:a,refetch:o}=rs({queryKey:["questionnaire",t==null?void 0:t.id],queryFn:async()=>!t||!await e()?null:await oXe({}),enabled:!!t,retry:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),l=w.useMemo(()=>i?!i.error:null,[i]);w.useEffect(()=>{if(!(t!=null&&t.id))return;const d=new BroadcastChannel(`questionnaire-${t.id}`);s.current=d;const f=async p=>{p.data.type==="QUESTIONNAIRE_COMPLETED"&&await n.invalidateQueries({queryKey:["questionnaire",t.id]})};return d.addEventListener("message",f),()=>{d.removeEventListener("message",f),d.close()}},[t==null?void 0:t.id,n]),w.useEffect(()=>{l===!0&&n.setQueryDefaults(["questionnaire",t==null?void 0:t.id],{gcTime:1/0,staleTime:1/0})},[l,n,t==null?void 0:t.id]);const u=w.useCallback(()=>{s.current&&s.current.postMessage({type:"QUESTIONNAIRE_COMPLETED",timestamp:Date.now()})},[]);
514return{isQuestionnaireCompleted:l,isExistingUser:!!r,isLoading:a,refresh:o,notifyQuestionnaireCompletion:u}},$mt=()=>{const{isQuestionnaireCompleted:t,notifyQuestionnaireCompletion:e}=Omt(),{getToken:n}=zt(),{organization:s}=Mo(),{isLoaded:r,user:i}=Vi(),a=di(),o=aa();w.useEffect(()=>{if(r&&!i){a("/");return}t!==null&&t&&a("/")},[r,i,a,t]);const l=w.useMemo(()=>i?i.organizationMemberships.length>0?i.organizationMemberships[0].organization.name:`${i.firstName||i.username||"Anon"}'s Team`:"",[i]),u=w.useCallback(async d=>{if(!await n())return;const p=[],m=d.fullName.trim();if(m&&i){const[v,...x]=m.split(/\s+/),y=x.join(" ");p.push(i.update(y?{firstName:v,lastName:y}:{firstName:v}))}d.profileFile&&i&&p.push(i.setProfileImage({file:d.profileFile})),d.logoFile&&s&&p.push(s.setLogo({file:d.logoFile})),await Promise.allSettled(p);try{const v=d.organizationName.trim();s&&v&&v!==s.name&&await s.update({name:v});const x={organization_name:[v]};Object.entries(d.singleAnswers).forEach(([y,S])=>{S&&(x[y]=[S])}),Object.entries(d.questionAnswers).forEach(([y,S])=>{x[y]=S}),await lXe({body:{responses:x,metadata:{user_agent:navigator.userAgent}}}),e(),await o.invalidateQueries({queryKey:["questionnaire",i==null?void 0:i.id]}),a("/quickstart",{state:{welcomeCredits:!0}})}catch(v){console.error("Failed to submit questionnaire:",v)}},[n,i,s,e,o,a]);return!i||t?null:c.jsx("div",{className:"h-dvh w-dvw",children:c.jsx(Uqe,{onFinish:u,initialOrganizationName:l})})},Fmt=w.createContext(null);function Umt({children:t,defaultBehavior:e="into-view",defaultScrollOptions:n={behavior:"smooth"}}){const s=w.useRef(new Map),r=w.useCallback((o,l)=>{s.current.set(o,l)},[]),i=w.useCallback(o=>{s.current.delete(o)},[]),a=w.useCallback((o,l=e,u)=>{const d=s.current.get(o);if(!d){console.warn(`ScrollTarget with id "${o}" not found`);return}const f={...n,...u};switch(l){case"into-view":d.scrollIntoView(f);break;case"to-top":d.scrollIntoView({...f,block:"start"});break;case"to-center":d.scrollIntoView({...f,block:"center"});break;case"to-bottom":d.scrollIntoView({...f,block:"end"});break;default:d.scrollIntoView(f)}},[e,n]);return c.jsx(Fmt.Provider,{value:{registerTarget:r,unregisterTarget:i,scrollTo:a},children:t})}const abe={gray9:"#6e6e6e",gray11:"#b4b4b4"},Bmt={gray9:"#8d8d8d"},wf={sand2:"#f9f9f8",sand3:"#f1f0ef",sand4:"#e9e8e6",sand6:"#dad9d6",sand8:"#bcbbb5",sand9:"#8d8d86",sand11:"#63635e",sand12:"#21201c"},zmt={red11:"#ce2c31"},g1=({width:t,height:e,className:n,duration:s=2,delay:r=.4,color:i=abe.gray9,angle:a=-50,offset:o=0,reverse:l=!1,disableAnimation:u=!1,...d})=>{const f=w.useRef(null),[p,m]=w.useState(!1),[v,x]=w.useState({width:0,height:0}),[y,S]=w.useState(0);w.useEffect(()=>{const B=()=>{const z=f.current;if(!z)return;const D=t||z.clientWidth,K=e||z.clientHeight;(D!==v.width||K!==v.height)&&(x({width:D,height:K}),S(Y=>Y+1))};B(),window.addEventListener("resize",B);const q=new IntersectionObserver(([z])=>{m(z.isIntersecting)},{threshold:.1});return f.current&&q.observe(f.current),()=>{window.removeEventListener("resize",B),q.disconnect()}},[t,e,v.width,v.height]);const _=v.width/2,E=v.height/2+o,T=E,k=v.height-E,R=_,I=v.width-_,A=Math.min(Math.abs(I/Math.sin(a)),Math.abs(T/Math.cos(a))),L=Math.min(Math.abs(R/Math.sin(a)),Math.abs(k/Math.cos(a))),j=A*Math.sin(a),F=A*Math.cos(a),O=L*Math.sin(a),M=L*Math.cos(a),U=l?_-O:_+j,G=l?E+M:E-F,$=l?_+j:_-O,V=l?E-F:E+M;return c.jsx("div",{ref:f,className:He("h-full w-full relative overflow-hidden pointer-events-none",n),...d,children:c.jsx("svg",{className:"absolute inset-0",width:v.width,height:v.height,viewBox:`0 0 ${v.width} ${v.height}`,children:c.jsx("line",{x1:U,y1:G,x2:u?$:U,y2:u?V:G,stroke:i,strokeWidth:"1.5",children:!u&&p&&c.jsxs(c.Fragment,{children:[c.jsx("animate",{attributeName:"x2",values:`${U};${$}`,dur:`${s}s`,begin:`${r}s`,keyTimes:"0;1",keySplines:"0.16 1 0.08 1",calcMode:"spline",fill:"freeze"}),c.jsx("animate",{attributeName:"y2",values:`${G};${V}`,dur:`${s}s`,begin:`${r}s`,keyTimes:"0;1",keySplines:"0.16 1 0.08 1",calcMode:"spline",fill:"freeze"})]})})},y)})},Vmt=`
515  attribute vec2 a_position;
516  attribute float a_opacity;
517  attribute float a_flickerPhase;
518  attribute float a_isFlickering;
519  uniform vec2 u_resolution;
520  uniform float u_time;
521  uniform float u_dotSize;
522  
523  varying float v_opacity;
524  varying vec2 v_position;
525  
526  float fastHash(float n) {
527    return fract(n * 0.1031);
528  }
529  
530  void main() {
531    gl_Position = vec4((a_position / u_resolution) * 2.0 - 1.0, 0, 1);
532    gl_Position.y = -gl_Position.y;
533    gl_PointSize = u_dotSize;
534    
535    v_position = a_position / u_resolution;
536    
537    v_opacity = a_opacity * (1.0 - a_isFlickering * 0.5 * (1.0 - step(0.5, fastHash(floor(u_time + a_flickerPhase * 10.0)))));
538  }
539`,Hmt=`
540  precision mediump float;
541  
542  uniform vec3 u_color;
543  varying float v_opacity;
544  varying vec2 v_position;
545  
546  void main() {
547    vec2 pointCenter = gl_PointCoord - vec2(0.5);
548    float pointDistance = length(pointCenter);
549    float dotAlpha = smoothstep(0.5, 0.3, pointDistance);
550    
551    float finalAlpha = dotAlpha * v_opacity;
552    
553    gl_FragColor = vec4(u_color, finalAlpha);
554  }
555`;function yse(t){const e=(t==="light"?Bmt.gray9:abe.gray11).replace("#","");return[parseInt(e.substr(0,2),16)/255,parseInt(e.substr(2,2),16)/255,parseInt(e.substr(4,2),16)/255]}const TU=({dotSize:t=5,spacing:e=12,opacity:n=.8,width:s,height:r,className:i,flickerRatio:a=.1,flickeringSpeed:o=6,...l})=>{const{resolvedTheme:u}=I4(),d=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useRef(null),v=w.useRef(void 0),x=w.useRef(0),y=w.useRef(!0),[S,_]=w.useState(!1),[E,T]=w.useState({width:0,height:0}),k=w.useRef([]),R=w.useRef({}),I=w.useRef({color:yse(u),initialized:!1,needsOpacityUpdate:!0}),A=1e3/o;w.useEffect(()=>{I.current.color=yse(u)},[u]);const L=w.useCallback((B,q,z)=>
555{const D=B.createShader(q);return D?(B.shaderSource(D,z),B.compileShader(D),B.getShaderParameter(D,B.COMPILE_STATUS)?D:(console.error("Shader compile error:",B.getShaderInfoLog(D)),B.deleteShader(D),null)):null},[]),j=w.useCallback(B=>{const q=L(B,B.VERTEX_SHADER,Vmt),z=L(B,B.FRAGMENT_SHADER,Hmt);if(!q||!z)return null;const D=B.createProgram();return D?(B.attachShader(D,q),B.attachShader(D,z),B.linkProgram(D),B.getProgramParameter(D,B.LINK_STATUS)?D:(console.error("Program link error:",B.getProgramInfoLog(D)),B.deleteProgram(D),null)):null},[L]),F=w.useCallback(()=>{const B=d.current;if(!B)return!1;const q=B.getContext("webgl");if(!q)return console.error("WebGL not supported"),!1;p.current=q;const z=j(q);return z?(m.current=z,q.useProgram(z),q.enable(q.BLEND),q.blendFunc(q.SRC_ALPHA,q.ONE_MINUS_SRC_ALPHA),!0):!1},[j]),O=w.useCallback((B,q)=>{const z=[];for(let D=e;D<B;D+=e)for(let K=e;K<q;K+=e){const Y=Math.random()*.7+.1,J=Math.random()*Math.PI*2,ne=Math.random()<a;z.push({x:D,y:K,opacity:Y,flickerPhase:J,isFlickering:ne})}return z},[e,a]),M=w.useCallback(B=>{const q=new Float32Array(B.length*2),z=new Float32Array(B.length),D=new Float32Array(B.length),K=new Float32Array(B.length);B.forEach((Y,J)=>{q[J*2]=Y.x,q[J*2+1]=Y.y,z[J]=Y.opacity*n,D[J]=Y.flickerPhase,K[J]=Y.isFlickering?1:0}),I.current={positions:q,opacities:z,flickerPhases:D,isFlickeringArray:K,color:I.current.color,initialized:!0,needsOpacityUpdate:!0}},[n]),U=w.useCallback(()=>{const B=p.current;B&&(Object.values(R.current).forEach(q=>{q&&B.deleteBuffer(q)}),R.current={},I.current.initialized=!1)},[]),G=w.useCallback(B=>{const q=p.current,z=m.current,D=d.current;if(B-x.current<A){v.current=requestAnimationFrame(G);return}if(x.current=B,!q||!z||!D||!S||!y.current){v.current=requestAnimationFrame(G);return}q.viewport(0,0,D.width,D.height),q.clearColor(0,0,0,0),q.clear(q.COLOR_BUFFER_BIT),k.current.length===0&&(k.current=O(D.width,D.height));const K=k.current;I.current.initialized||M(K);const{positions:Y,opacities:J,flickerPhases:ne,isFlickeringArray:Q}=I.current;if(!Y||!J||!ne||!Q)return;I.current.needsOpacityUpdate&&(K.forEach((Ge,Je)=>{J[Je]=Ge.opacity*n}),I.current.needsOpacityUpdate=!1),R.current.position||(R.current.position=q.createBuffer(),q.bindBuffer(q.ARRAY_BUFFER,R.current.position),q.bufferData(q.ARRAY_BUFFER,Y,q.STATIC_DRAW));const ee=q.getAttribLocation(z,"a_position");q.bindBuffer(q.ARRAY_BUFFER,R.current.position),q.enableVertexAttribArray(ee),q.vertexAttribPointer(ee,2,q.FLOAT,!1,0,0),R.current.opacity?(q.bindBuffer(q.ARRAY_BUFFER,R.current.opacity),q.bufferSubData(q.ARRAY_BUFFER,0,J)):(R.current.opacity=q.createBuffer(),q.bindBuffer(q.ARRAY_BUFFER,R.current.opacity),q.bufferData(q.ARRAY_BUFFER,J,q.DYNAMIC_DRAW));const te=q.getAttribLocation(z,"a_opacity");q.enableVertexAttribArray(te),q.vertexAttribPointer(te,1,q.FLOAT,!1,0,0),R.current.flickerPhase||(R.current.flickerPhase=q.createBuffer(),q.bindBuffer(q.ARRAY_BUFFER,R.current.flickerPhase),q.bufferData(q.ARRAY_BUFFER,ne,q.STATIC_DRAW));const ue=q.getAttribLocation(z,"a_flickerPhase");q.bindBuffer(q.ARRAY_BUFFER,R.current.flickerPhase),q.enableVertexAttribArray(ue),q.vertexAttribPointer(ue,1,q.FLOAT,!1,0,0),R.current.isFlickering||(R.current.isFlickering=q.createBuffer(),q.bindBuffer(q.ARRAY_BUFFER,R.current.isFlickering),q.bufferData(q.ARRAY_BUFFER,Q,q.STATIC_DRAW));const ye=q.getAttribLocation(z,"a_isFlickering");q.bindBuffer(q.ARRAY_BUFFER,R.current.isFlickering),q.enableVertexAttribArray(ye),q.vertexAttribPointer(ye,1,q.FLOAT,!1,0,0);const je=q.getUniformLocation(z,"u_resolution");q.uniform2f(je,D.width,D.height);const Re=q.getUniformLocation(z,"u_time");q.uniform1f(Re,B*.001*o);const me=q.getUniformLocation(z,"u_dotSize");q.uniform1f(me,t);const Ce=q.getUniformLocation(z,"u_color"),[Xe,he,De]=I.current.color;q.uniform3f(Ce,Xe,he,De),q.drawArrays(q.POINTS,0,K.length),v.current=requestAnimationFrame(G)},[O,n,o,t,S,M,A]),$=w.useCallback(()=>{const B=f.current,q=d.current;if(!B||!q)return;const z=s||B.clientWidth,D=r||B.clientHeight,K=window.devicePixelRatio||1;q.width=z*K,q.height=D*K,q.style.width=`${z}px`,q.style.height=`${D}px`,T({width:z,height:D}),k.current=[],U()},[s,r,U]),V=w.useCallback(()=>{y.current=!document.hidden},[]);return w.useEffect(()=>{const B=d.current;if(!B||($(),!F()))return;const q=new IntersectionObserver(([z])=>{_(z.isIntersecting)},{threshold:0});return q.observe(B),document.addEventListener("visibilitychange",V),()=>{q.disconnect(),document.removeEventListener("visibilitychange",V),U(),v.current&&cancelAnimationFrame(v.current)}},[F,$,U,V]),w.useEffect(()=>{const B=()=>{$()};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[$]),w.useEffect(()=>(S&&y.current?v.current=requestAnimationFrame(G):v.current&&cancelAnimationFrame(v.current),()=>{v.current&&cancelAnimationFrame(v.current)}),[S,G]),w.useEffect(()=>{I.current.initialized&&(I.current.needsOpacityUpdate=!0)},[n]),c.jsx("div",{ref:f,className:He("h-full w-full relative",i),...l,children:c.jsx("canvas",{ref:d,className:"pointer-events-none absolute inset-0",style:{width:E.width,height:E.height,opacity:.75,mask:"radial-gradient(circle 380px at center, rgba(0,0,0,0.7) 50%, rgba(0,0,0,0.02) 100%)",WebkitMask:"radial-gradient(circle 380px at center, rgba(0,0,0,0.7) 50%, rgba(0,0,0,0.02) 100%)"}})})},Gmt=()=>{const[t]=Po(),{isSignedIn:e,isLoaded:n,getToken:s}=zt(),[r,i]=w.useState(!1),[a,o]=w.useState(null);return w.useEffect(()=>{if(!n)return;const l=t.get("cli_redirect")==="true",u=t.get("port"),d=t.get("state");if(!l||!u||!d){o("This sign-in link is missing required information. Please restart from the CLI.");return}if(!e){o("Your session has expired. Please sign in again from the CLI.");return}e&&!r&&(async()=>{try{i(!0);const p=await s();if(!p){o("Authentication token not available. Please try again.");return}const m=new URL(`http://localhost:${u}`);m.searchParams.set("jwt",p),m.searchParams.set("state",d),setTimeout(()=>{window.location.href=m.toString()},1500)}catch(p){console.error("Failed to perform CLI redirect:",p),o("Authentication failed. Please try again.")}})()},[e,n,s,t,r]),c.jsxs("div",{className:"relative flex flex-1 h-full py-[150px] justify-center items-center bg-#[1e1e1e]",children:[c.jsx(TU,{className:"absolute inset-0 z-0 size-full"}),c.jsxs("div",{className:"absolute inset-0 z-0",style:{mask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 100%)",WebkitMask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 100%)"},children:[c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:290,disableAnimation:!0}),c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:-290,reverse:!0,disableAnimation:!0})]}),c.jsxs("div",{className:"w-full max-w-[405px] rounded-[24px] border border-[var(--gray-3)] bg-[var(--gray-1)] shadow-[inset_0px_0px_20px_0px_rgba(255,255,255,0.04)] backdrop-blur-[12px]",children:[c.jsxs("div",{className:"flex gap-3 p-6 border-b border-b-[var(--gray-3)]",children:[c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"})]}),c.jsxs("div",{className:"p-8 space-y-6",children:[c.jsx("div",{className:"flex flex-col gap-4 items-center justify-center",children:c.jsx("a",{href:"https://steel.dev",className:"flex items-center gap-2",children:c.jsx(O1,{className:"text-[var(--sand-12)] dark:text-white"})})}),c.jsx("div",{className:"flex flex-col gap-6 items-center text-center",children:a?c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("h1",{className:"text-[var(--red-11)] font-semibold text-2xl",children:"Error"}),c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:a}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"Please close this window and try again."})]}):c.jsx("div",{className:"flex flex-col gap-4",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h1",{className:"text-[var(--gray-12)] font-semibold text-2xl animate-pulse",children:"Signing in..."}),c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:"Please wait while we authenticate you."}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"You'll be redirected automatically."})]})})})]})]})]})},Wmt=()=>c.jsxs("div",{className:"relative flex flex-1 h-full py-[150px] justify-center items-center bg-#[1e1e1e]",children:[c.jsx(TU,{className:"absolute inset-0 z-0 size-full"}),c.jsxs("div",{className:"absolute inset-0 z-0",style:{mask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 100%)",WebkitMask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 100%)"},children:[c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:290,disableAnimation:!0}),c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:-290,reverse:!0,disableAnimation:!0})]}),c.jsxs("div",{className:"w-full max-w-[405px] rounded-[24px] border border-[var(--gray-3)] bg-[var(--gray-1)] shadow-[inset_0px_0px_20px_0px_rgba(255,255,255,0.04)] backdrop-blur-[12px]",children:[c.jsxs("div",{className:"flex gap-3 p-6 border-b border-b-[var(--gray-3)]",children:[c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"})]}),c.jsxs("div",{className:"p-8 space-y-6",children:[c.jsx("div",{className:"flex flex-col gap-4 items-center justify-center",children:c.jsx("a",{href:"https://steel.dev",className:"flex items-center gap-2",children:c.jsx(O1,{className:"text-[var(--sand-12)] dark:text-white"})})}),c.jsx("div",{className:"flex flex-col gap-6 items-center text-center",children:c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("h1",{className:"text-[var(--gray-12)] font-semibold text-2xl",children:"Success!"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:"You are now authenticated."}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"You can close this window and return to your terminal."})]})]})})]})]})]}),qmt=()=>{const[t]=Po(),{getToken:e,isLoaded:n}=zt(),[s,r]=w.useState("confirming"),[i,a]=w.useState(null),o=t.get("user_code"),l=w.useCallback(async()=>
555{if(o)try{if(!await e()){a("Authentication token not available. Please try again."),r("error");return}const{error:d}=await jZe({body:{user_code:o}});if(d){a("Failed to authorize device. The code may be invalid or expired."),r("error");return}r("success")}catch{a("Network error. Please try again."),r("error")}},[o,e]);return n&&!o?c.jsx(bse,{children:c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("h1",{className:"text-[var(--gray-12)] font-semibold text-2xl",children:"Authorize Device"}),c.jsxs("p",{className:"text-[var(--gray-11)] text-base",children:["No device code provided. Please return to your terminal and run"," ",c.jsx("code",{className:"text-[var(--gray-12)] bg-[var(--gray-3)] px-1.5 py-0.5 rounded text-sm",children:"steel login"})," ","again."]})]})}):c.jsxs(c.Fragment,{children:[c.jsx(FO,{children:c.jsx(il,{to:`/sign-in?redirect_url=${encodeURIComponent(`/activate?user_code=${o}`)}`})}),c.jsx($O,{children:c.jsxs(bse,{children:[s==="confirming"&&c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("h1",{className:"text-[var(--gray-12)] font-semibold text-2xl",children:"Authorize Device"}),c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:"Your terminal is requesting access. Confirm the code below matches what you see in your terminal."})]}),c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"px-6 py-4 bg-[var(--gray-3)] rounded-xl border border-[var(--gray-4)]",children:c.jsx("span",{className:"text-[var(--gray-12)] font-mono font-bold text-3xl tracking-[0.2em]",children:o})})}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("button",{onClick:l,className:"w-full py-2.5 px-4 rounded-lg bg-[#f76a15] text-white font-medium text-base hover:bg-[#e5600f] transition-colors",children:"Yes, authorize this device"}),c.jsx("button",{onClick:()=>window.close(),className:"w-full py-2.5 px-4 rounded-lg bg-[var(--gray-3)] text-[var(--gray-11)] font-medium text-base hover:bg-[var(--gray-4)] transition-colors",children:"Cancel"})]})]}),s==="success"&&c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("h1",{className:"text-[var(--gray-12)] font-semibold text-2xl",children:"Device Authorized"}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:"Your CLI has been authenticated."}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"You can close this window and return to your terminal."})]})]}),s==="error"&&c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("h1",{className:"text-[var(--red-11)] font-semibold text-2xl",children:"Error"}),c.jsx("p",{className:"text-[var(--gray-11)] text-base",children:i}),c.jsx("p",{className:"text-[var(--gray-10)] text-sm",children:"Please close this window and try again."})]})]})})]})};function bse({children:t}){return c.jsxs("div",{className:"relative flex flex-1 h-full py-[150px] justify-center items-center bg-#[1e1e1e]",children:[c.jsx(TU,{className:"absolute inset-0 z-0 size-full"}),c.jsxs("div",{className:"absolute inset-0 z-0",style:{mask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 100%)",WebkitMask:"linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 100%)"},children:[c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:290,disableAnimation:!0}),c.jsx(g1,{angle:-.63,className:"absolute inset-0 z-0 size-full",offset:-290,reverse:!0,disableAnimation:!0})]}),c.jsxs("div",{className:"w-full max-w-[405px] rounded-[24px] border border-[var(--gray-3)] bg-[var(--gray-1)] shadow-[inset_0px_0px_20px_0px_rgba(255,255,255,0.04)] backdrop-blur-[12px]",children:[c.jsxs("div",{className:"flex gap-3 p-6 border-b border-b-[var(--gray-3)]",children:[c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"}),c.jsx("div",{className:"w-3 h-3 bg-[var(--gray-6)] rounded-full"})]}),c.jsxs("div",{className:"p-8 space-y-6",children:[c.jsx("div",{className:"flex flex-col gap-4 items-center justify-center",children:c.jsx("a",{href:"https://steel.dev",className:"flex items-center gap-2",children:c.jsx(O1,{className:"text-[var(--sand-12)] dark:text-white"})})}),c.jsx("div",{className:"flex flex-col gap-6 items-center text-center",children:t})]})]})]})}function Kmt(){const{handleEmailLinkVerification:t}=Qm(),[e,n]=w.useState("loading");return w.useEffect(()=>{let s=!0;return t({}).then(()=>s&&n("verified")).catch(()=>s&&n("failed")),()=>{s=!1}},[t]),c.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[var(--sand-1)] p-[16px] text-[var(--sand-12)]",children:c.jsxs("div",{className:"flex w-[420px] max-w-full flex-col items-center gap-[16px] rounded-[20px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-2)] p-[32px] text-center",children:[e==="loading"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:"Verifying your email…"})]}),e==="verified"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"font-medium text-[20px] leading-[24px]",children:"Email verified"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:"You can close this tab and return to Steel."}),c.jsx(Hn,{to:"/settings/profile",className:"mt-[8px] flex h-[40px] items-center justify-center rounded-[8px] bg-[var(--sand-12)] px-[16px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)] transition-[filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-95",children:"Back to settings"})]}),e==="failed"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"font-medium text-[20px] leading-[24px]",children:"Verification failed"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-11)]",children:"This link may have expired or already been used. Request a new one from your account settings."}),c.jsx(Hn,{to:"/settings/profile",className:"mt-[8px] flex h-[40px] items-center justify-center rounded-[8px] bg-[var(--sand-4)] px-[16px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-5)]",children:"Back to settings"})]})]})})}const Sse=(t,e)=>{if(!e)return t;const n={...t};for(const s in e){const r=e[s];r&&(n[s]=r)}return n};function Ymt(t){if(typeof t!="string")return{};const e={};return t.split(";").forEach(n=>{const[s,r]=n.split(":");if(s&&r){const i=s.trim();if(i.startsWith("--"))e[i]=r.trim();else{const a=i.replace(/-([a-z])/g,o=>o[1].toUpperCase());e[a]=r.trim()}}}),e}function yT({node:t,components:e,textTransform:n}){var r,i,a,o;const s=n??(l=>l);if(typeof t=="string")return c.jsx(c.Fragment,{children:s(t)});if(typeof t=="number")return c.jsx(c.Fragment,{children:t});if(!t)return null;if(Array.isArray(t)&&t[0]!=="$r")return c.jsx(w.Fragment,{children:t.map((l,u)=>c.jsx(yT,{node:l,components:e,textTransform:s},u))});if(Array.isArray(t)&&t[0]==="$r"){const[,l,u,d]=t,{children:f,style:p,...m}=d||{};if(l==="figure"&&f){const E=f==null?void 0:f.find(k=>Array.isArray(k)&&k[1]==="pre"),T=(i=(r=E==null?void 0:E[3])==null?void 0:r.children)==null?void 0:i.find(k=>Array.isArray(k)&&k[1]==="code");if(E&&T){const k=((a=E[3])==null?void 0:a["data-language"])||"bash",I=(((o=T[3])==null?void 0:o.meta)||"").match(/filename="([^"]+)"/),A=I?I[1]:null;m.lang=k,m.filename=A}}typeof p=="string"&&(m.style=Ymt(p));const v=e[l]||l,x=typeof v=="string",y=f?c.jsx(yT,{node:f,components:e,textTransform:s}):null,_=x?{...m,key:u}:{...m,__type:l,__renderchildren:f&&!x?E=>{let T=e,k=s;
555if(E)if("components"in E||"textTransform"in E){const R=E;T=Sse(e,R.components),k=R.textTransform??s}else T=Sse(e,E);return c.jsx(yT,{node:f,components:T,textTransform:k})}:void 0,key:u};return re.createElement(v,_,y)}return console.warn("Unknown node type encountered in JsonToReact:",t),null}function Zmt({width:t,height:e,color:n="var(--sand-12)",className:s}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 32 32",fill:"none",className:s,children:[c.jsx("defs",{}),c.jsx("path",{d:"M7 5.5C7 4.67157 7.67157 4 8.5 4H15.5C16.3284 4 17 4.67157 17 5.5V12H8.5C7.67157 12 7 11.3284 7 10.5V5.5Z",fill:n}),c.jsx("path",{d:"M17 12H25.5C26.3284 12 27 12.6716 27 13.5V18.5C27 19.3284 26.3284 20 25.5 20H17V12Z",fill:n}),c.jsx("path",{d:"M7 21.5C7 20.6716 7.67157 20 8.5 20H17V26.5C17 27.3284 16.3284 28 15.5 28H8.5C7.67157 28 7 27.3284 7 26.5V21.5Z",fill:n})]})}function obe({title:t}){return c.jsx("div",{className:"flex flex-col gap-2",children:c.jsx("div",{className:"flex items-center",children:c.jsx("h2",{className:"text-xl font-semibold text-[var(--sand-12)]",children:t})})})}function Xmt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M14.001 2C14.001 2 14.1787 3.04001 14.001 4C13.8095 5.03394 13.001 6 13.001 6M15.501 8.5L16.501 7.5M18.301 4.75L18.751 3.5M20.001 8L21.001 7.5M18.001 11C18.001 11 18.7571 11.032 19.501 11.27C20.1715 11.4846 21.001 12 21.001 12M5.78101 20.814L15.1635 17.118C16.5037 16.5901 16.8632 14.8615 15.8447 13.843L10.1586 8.15688C9.14017 7.13843 7.41158 7.49792 6.88362 8.83797L3.18721 18.22C2.54631 19.8468 4.15426 21.4548 5.78101 20.814Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qmt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M10 20L14 4M18 8.00004L20.5858 10.5858C21.3668 11.3669 21.3668 12.6332 20.5858 13.4143L18 16M6 16L3.41421 13.4143C2.63316 12.6332 2.63317 11.3669 3.41421 10.5858L6 8.00004",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jmt({isLast:t=!1,number:e}){return c.jsx("div",{className:"relative flex flex-col items-center",children:c.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-[var(--sand-1)] border-[0.5px] border-[var(--sand-6)] text-[var(--sand-9)]",children:t?c.jsx(Xmt,{size:20}):e!==void 0?c.jsx("span",{className:"align-middle font-regular leading-none",children:e}):c.jsx(Qmt,{size:20})})})}function lbe({children:t,isLast:e=!1,stepNumber:n,id:s}){return c.jsxs(cr,{id:s,children:[c.jsx(cr.Icon,{connection:!e,children:c.jsx(Jmt,{isLast:e,number:n})}),c.jsx(cr.Content,{className:"section-override-gap",children:t})]})}function egt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M7 13L10 16L17 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function cbe({text:t,className:e}){const[n,s]=w.useState(!1),r=()=>{const i=typeof t=="function"?t():t;navigator.clipboard.writeText(i),s(!0),setTimeout(()=>s(!1),1e3)};return c.jsxs("button",{onClick:r,className:He("text-[var(--sand-9)] hover:text-[var(--sand-12)] relative opacity-100",e),"aria-label":"Copy command",children:[c.jsx("span",{className:`absolute inset-0 flex items-center justify-center transition-all duration-300 ${n?"opacity-100 scale-100":"opacity-0 scale-50"}`,children:c.jsx(egt,{className:"text-[var(--sand-12)]"})}),c.jsx("span",{className:`flex items-center justify-center transition-all duration-300 ${n?"opacity-0 scale-50":"opacity-100 scale-100"}`,children:c.jsx(Yme,{className:"size-5"})})]})}const kU=re.forwardRef(({children:t,className:e,text:n},s)=>c.jsxs("div",{className:He("bg-[var(--sand-1)] border-[0.5px] border-[var(--sand-6)] rounded-lg flex shiki-override shiki-override-monotone p-3 mt-6 code-margin",e),children:[c.jsx("div",{className:"font-mono text-sm font-semibold mr-2",children:c.jsx("span",{children:"$"})}),c.jsx("div",{className:"flex-1 font-semibold text-sm text-[var(--sand-11)] dark:text-[rgb(160,160,160)] overflow-auto",ref:s,children:t}),c.jsx(cbe,{text:n,className:"self-start"})]}));kU.displayName="BashBlock";function ube({children:t,skipLink:e}){const n=mbe();return c.jsxs(lbe,{children:[c.jsx(obe,{title:`Setup Guide for ${n.title}`}),c.jsx("div",{className:"rt-Text rt-r-size-2 text-[var(--sand-11)] font-normal text-base",children:t}),c.jsx("p",{className:"font-medium text-base text-[var(--sand-12)] -mb-4",children:"If you want to skip the steps below, enter this command in the terminal:"}),c.jsxs(kU,{text:`steel forge ${n.shorthand}`,children:["steel forge ",n.shorthand]}),c.jsxs("a",{href:e,className:"flex items-center text-[var(--sand-9)] group cursor-pointer",children:[c.jsx("span",{className:"border-b-[0.5px] border-[var(--sand-6)] group-hover:border-[var(--sand-8)]",children:"Skip to full code example"}),c.jsx(Aye,{className:"ml-1 size-5 inline"})]})]})}ube.displayName="Intro";function dbe({number:t,title:e,children:n,isLast:s}){return c.jsxs(lbe,{stepNumber:t,isLast:s,children:[c.jsx(obe,{title:e}),c.jsx("div",{className:"max-w-[800px] prose prose-invert",children:n})]})}dbe.displayName="Step";function fbe({children:t}){const e=mbe();return c.jsx(cr,{dividerTop:!0,children:c.jsxs(cr.Content,{className:"gap-2",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("h2",{className:"text-[2rem] leading-[2.5rem] text-[var(--sand-12)] font-medium",id:"full-code-example",children:"Full example"}),c.jsxs("div",{className:"flex gap-3",children:[e.replitLink&&c.jsx(Zt,{variant:"tertiary",asChild:!0,children:c.jsxs("a",{href:e.replitLink,target:"_blank",referrerPolicy:"no-referrer",children:[c.jsx(Zmt,{width:20,className:"mr-1.5"}),"Run on Replit"]})}),e.githubLink&&c.jsx(Zt,{variant:"tertiary",asChild:!0,children:c.jsxs("a",{href:e.githubLink,target:"_blank",referrerPolicy:"no-referrer",children:[c.jsx(Rye,{size:20,className:"mr-1.5"}),"Fork on GitHub"]})})]})]}),c.jsx("div",{className:"max-w-[800px] prose prose-invert full-code",children:t})]})})}fbe.displayName="FullCodeExample";function hbe({__renderchildren:t}){return c.jsx(cr,{children:c.jsxs(cr.Content,{children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("h2",{className:"text-[2rem] leading-[2.5rem] text-[var(--sand-12)] font-medium",children:"Next steps"}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx(Zt,{variant:"tertiary",asChild:!0,children:c.jsxs("a",{href:"https://cal.com/hussien-hussien-fjxt3x/intro-chat-w-steel-founders",target:"_blank",children:[c.jsxs("div",{className:"flex -sp
555ace-x-3 overflow-hidden w-[1.875rem] h-5 mr-1.5",children:[c.jsx("img",{alt:"",src:"https://cdn.discordapp.com/avatars/711439146589356052/c94ebbecca8a46af928f155054723d3d.webp?size=80",className:"inline-block size-5 rounded-full border-[1.33px] border-[var(--sand-1)]"}),c.jsx("img",{alt:"",src:"https://cdn.discordapp.com/avatars/540729274408370206/6a305ece7f5adb7131ecc412365145e1.webp?size=80",className:"inline-block size-5 rounded-full border-[1.33px] border-[var(--sand-1)]"})]}),"Chat with Founders"]})}),c.jsx(Zt,{variant:"tertiary",asChild:!0,children:c.jsx("a",{href:"https://docs.steel.dev",target:"_blank",children:"Read Docs"})})]})]}),t==null?void 0:t({ul:e=>c.jsx("ul",{...e,className:cs("flex flex-col gap-2 w-full",e.className)}),li:e=>c.jsx("li",{...e,className:cs("flex w-full",e.className)}),a:e=>c.jsxs("a",{className:"w-full p-3 border-[var(--sand-6)] border text-sm font-medium rounded-xl bg-[var(--sand-1)] hover:bg-[var(--sand-3)] text-[var(--sand-9)] hover:text-[var(--sand-12)] inline-flex justify-between",href:e.href,children:[c.jsx("span",{children:e.children}),c.jsx(La,{size:20})]})})]})})}hbe.displayName="NextSteps";function tgt({className:t}){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[c.jsx("rect",{x:"3",y:"5",width:"17",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M7 10L9 12L7 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12 14H16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function ngt(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M10.6066 4.09503C10.0594 4.16988 9.67645 4.67413 9.75129 5.22132C9.82613 5.76851 10.3304 6.15143 10.8776 6.07658L10.6066 4.09503ZM19.5177 14.02C19.1734 14.4519 19.2444 15.0811 19.6763 15.4253C20.1082 15.7696 20.7373 15.6985 21.0816 15.2667L19.5177 14.02ZM13.4143 13.4142C13.0238 13.8047 13.0238 14.4379 13.4143 14.8284C13.8048 15.2189 14.438 15.2189 14.8285 14.8284L13.4143 13.4142ZM9.17168 9.17156C8.78115 9.56208 8.78115 10.1952 9.17168 10.5858C9.5622 10.9763 10.1954 10.9763 10.5859 10.5858L9.17168 9.17156ZM3.70699 2.29289C3.31646 1.90237 2.6833 1.90237 2.29277 2.29289C1.90225 2.68342 1.90225 3.31658 2.29277 3.70711L3.70699 2.29289ZM20.2928 21.7071C20.6833 22.0976 21.3165 22.0976 21.707 21.7071C22.0975 21.3166 22.0975 20.6834 21.707 20.2929L20.2928 21.7071ZM7.18925 7.48115C7.65194 7.17959 7.78256 6.56004 7.48101 6.09735C7.17945 5.63466 6.5599 5.50404 6.09721 5.8056L7.18925 7.48115ZM17.9025 18.1944C18.3652 17.8929 18.4959 17.2733 18.1943 16.8107C17.8927 16.348 17.2732 16.2173 16.8105 16.5189L17.9025 18.1944ZM2.50188 11.0957L1.64257 10.5843L2.50188 11.0957ZM2.50224 12.905L3.36153 12.3935L2.50224 12.905ZM21.4974 11.0954L22.3567 10.5839L21.4974 11.0954ZM21.4976 12.9043L20.6383 12.3929L21.4976 12.9043ZM10.8776 6.07658C14.352 5.60136 18.0994 7.34172 20.6381 11.6068L22.3567 10.5839C19.4842 5.75798 15.0155 3.49199 10.6066 4.09503L10.8776 6.07658ZM21.0816 15.2667C21.5343 14.6987 21.9607 14.0815 22.3569 13.4158L20.6383 12.3929C20.2867 12.9836 19.9116 13.5258 19.5177 14.02L21.0816 15.2667ZM13.4143 10.5858C14.1954 11.3668 14.1954 12.6331 13.4143 13.4142L14.8285 14.8284C16.3906 13.2663 16.3906 10.7337 14.8285 9.17156L13.4143 10.5858ZM10.5859 10.5858C11.3669 9.80472 12.6333 9.80472 13.4143 10.5858L14.8285 9.17156C13.2664 7.60946 10.7338 7.60946 9.17168 9.17156L10.5859 10.5858ZM2.29277 3.70711L20.2928 21.7071L21.707 20.2929L3.70699 2.29289L2.29277 3.70711ZM3.36119 11.6072C3.79394 10.8801 4.2622 10.2266 4.75762 9.64539L3.23551 8.34802C2.66361 9.01899 2.13026 9.76488 1.64257 10.5843L3.36119 11.6072ZM4.75762 9.64539C5.51393 8.75808 6.33385 8.03865 7.18925 7.48115L6.09721 5.8056C5.07162 6.47403 4.10877 7.32349 3.23551 8.34802L4.75762 9.64539ZM3.28946 9.70381L13.1126 19.527L14.5268 18.1128L4.70367 8.2896L3.28946 9.70381ZM1.64295 13.4165C4.65353 18.4742 9.41759 20.7166 14.0151 19.8006L13.6243 17.8391C10.0035 18.5605 6.02003 16.8597 3.36153 12.3935L1.64295 13.4165ZM14.0151 19.8006C15.3631 19.532 16.676 18.9938 17.9025 18.1944L16.8105 16.5189C15.7883 17.1851 14.712 17.6224 13.6243 17.8391L14.0151 19.8006ZM1.64257 10.5843C1.12294 11.4573 1.12369 12.5442 1.64295 13.4165L3.36153 12.3935C3.21707 12.1509 3.21715 11.8492 3.36119 11.6072L1.64257 10.5843ZM20.6381 11.6068C20.7825 11.8494 20.7824 12.1507 20.6383 12.3929L22.3569 13.4158C22.8764 12.5429 22.8761 11.4564 22.3567 10.5839L20.6381 11.6068Z",fill:"currentColor"})})}const sgt=({lang:t,className:e})=>{switch(t){case"typescript":case"ts":return c.jsx(qhe,{className:e});case"javascript":case"js":return c.jsx(Ghe,{className:e});case"python":return c.jsx(Whe,{className:e});case"bash":case"sh":return c.jsx(tgt,{className:e});case"text":return c.jsx(eve,{className:e});default:return null}},eC="ste-"+"°".repeat(99);function rgt({lang:t,filename:e,className:n,__renderchildren:s}){const{apiKey:r}=Kme(),[i,a]=w.useState(""),[o,l]=w.useState(!1),[u,d]=w.useState(!1),[f,p]=w.useState(!1),m=w.useRef(null);
555w.useLayoutEffect(()=>{if(m.current&&!i){const y=m.current.innerText;a(y);const S=y.split(`
556`).length;d(S>10)}},[m.current,i]);const v=()=>i.replace(new RegExp(eC,"g"),r??"YOUR_STEEL_API_KEY"),x=r&&(i.includes(r)||i.includes(eC));return t==="bash"?c.jsx(kU,{text:v,ref:m,className:n,children:s==null?void 0:s({textTransform:y=>y.replaceAll("YOUR_STEEL_API_KEY",f?r:eC)})}):c.jsxs("div",{className:"relative border-[0.5px] border-[var(--sand-6)] rounded-lg flex flex-col shiki-override overflow-hidden mt-6 code-margin",children:[c.jsxs("div",{className:"bg-[var(--sand-1)] flex justify-between p-3",children:[e?c.jsxs("div",{className:"text-sm flex items-center gap-2 text-[var(--sand-11)] font-medium",children:[c.jsx(sgt,{lang:t,className:"w-4 h-4 text-[var(--sand-9)] font-medium"}),e]}):c.jsx("div",{}),c.jsxs("div",{className:"flex gap-4",children:[x&&c.jsx("button",{onClick:()=>p(!f),className:"text-[var(--sand-9)] hover:text-[var(--sand-12)] opacity-100 transition-colors duration-300","aria-label":f?"Hide API Key":"Show API Key",title:f?"Hide API Key":"Show API Key",children:f?c.jsx(ngt,{className:"size-5"}):c.jsx(gye,{className:"size-5"})}),c.jsx(cbe,{text:v})]})]}),c.jsx("div",{className:cs("ph-no-capture bg-[var(--sand-1)] p-3 overflow-x-auto relative font-semibold text-sm",{"max-h-[200px] overflow-hidden":u&&!o,"pb-16":u&&o}),ref:m,children:s==null?void 0:s({textTransform:y=>y.replaceAll("YOUR_STEEL_API_KEY",f?r:eC)})}),u&&c.jsx("div",{className:`flex justify-center absolute bottom-0 pb-[1rem] w-full bg-gradient-to-t ${o?"from-transparent":"from-[var(--sand-1)]"} to-transparent`,children:c.jsxs("button",{onClick:()=>l(!o),className:"flex items-center text-sm font-normal text-[var(--sand-11)] bg-[var(--sand-1)] pl-[1rem] pr-[10px] py-1 border rounded-full border-[var(--sand-6)] hover:text-[var(--sand-12)] hover:border-[var(--sand-6)] transition-colors",children:[o?"Collapse code":"Expand code",o?c.jsx(dde,{className:"w-[0.875rem] h-[0.875rem] ml-1"}):c.jsx(ude,{className:"w-[0.875rem] h-[0.875rem] ml-1"})]})})]})}function igt({id:t,children:e}){const n={backgroundColor:`var(--highlight-color-${t})`,borderRadius:"4px",padding:"2px 4px"};return c.jsx("span",{style:n,children:e})}const agt=({children:t})=>c.jsx(c.Fragment,{children:t}),ogt={Guide:t=>c.jsx(c.Fragment,{children:t.children}),Intro:ube,Step:dbe,FullCodeExample:fbe,figure:rgt,HighlightRef:igt,wrapper:agt,NextSteps:hbe,p:t=>c.jsx("p",{...t,className:cs("text-[var(--sand-11)]",t.className)}),h1:t=>c.jsx("h3",{...t,className:cs("text-xl font-semibold text-[var(--sand-12)]",t.className)}),h2:t=>c.jsx("h3",{...t,className:cs("text-xl font-semibold text-[var(--sand-12)]",t.className)}),h3:t=>c.jsx("h4",{...t,className:cs("text-lg font-semibold text-[var(--sand-12)]",t.className)}),h4:t=>c.jsx("h5",{...t,className:cs("text-base font-medium text-[var(--sand-12)]",t.className)}),h5:t=>c.jsx("h6",{...t,className:cs("text-base font-medium text-[var(--sand-11)]",t.className)}),h6:t=>c.jsx("p",{...t,className:cs("text-base font-medium text-[var(--sand-10)]",t.className)}),ul:t=>c.jsx("ul",{...t,className:cs("list-disc list-inside pl-3 space-y-1",t.className)}),ol:t=>c.jsx("ul",{...t,className:cs("list-decimal list-inside pl-3 space-y-1",t.className)}),li:t=>c.jsx("li",{...t,className:cs("text-[var(--sand-11)] text-base",t.className)}),pre:t=>c.jsx("pre",{...t}),code:t=>c.jsx("code",{...t,className:cs("p-0",t.className)}),blockquote:t=>c.jsx("blockquote",{...t,className:cs("border-l-4 border-[var(--sand-6)] pl-4 italic text-[var(--sand-11)]",t.className)}),hr:t=>c.jsx("hr",{...t,className:cs("my-6 border-[var(--sand-6)]",t.className)}),table:t=>c.jsx("table",{...t,className:cs("w-full border-collapse text-sm text-[var(--sand-11)]",t.className)}),thead:t=>c.jsx("thead",{...t,className:cs("bg-[var(--sand-2)] text-[var(--sand-12)]",t.className)}),tbody:t=>c.jsx("tbody",{...t,className:cs("divide-y divide-[var(--sand-3)]",t.className)}),tr:t=>c.jsx("tr",{...t,className:cs("hover:bg-[var(--sand-2)] transition-colors",t.className)}),th:t=>c.jsx("th",{...t,className:cs("px-3 py-2 text-left font-medium border-b-[0.5px] border-[var(--sand-6)]",t.className)}),td:t=>c.jsx("td",{...t,className:cs("px-3 py-2 align-top border-b-[0.5px] border-[var(--sand-6)]",t.className)}),a:t=>c.jsx("a",{...t,className:cs("text-blue-11 hover:text-blue-12 underline underline-offset-2",t.className)}),strong:t=>c.jsx("strong",{...t,className:cs("font-semibold text-[var(--sand-12)]",t.className)}),em:t=>c.jsx("em",{...t,className:cs("italic text-[var(--sand-11)]",t.className)}),del:t=>c.jsx("del",{...t,className:cs("line-through text-[var(--sand-9)]",t.className)}),img:t=>c.jsx("img",{...t,className:cs("rounded-lg max-w-full h-auto",t.className)})},pbe=w.createContext(void 0);function lgt({error:t,isLoading:e,content:n,guide:s}){const[r,i]=w.useState(n);return w.useEffect(()=>{!e&&n&&i(n)},[n,e]),t?c.jsxs("div",{children:["Error: ",t.message]}):c.jsx(pbe,{value:s,children:c.jsx("div",{children:r&&c.jsx(yT,{node:r,components:ogt})})})}function mbe(){const t=w.useContext(pbe);if(!t)throw new Error("useAppContext must be used inside AppProvider");return t}function cgt({...t}){return c.jsx(cr,{children:c.jsx(cr.Content,{children:c.jsx(lgt,{...t,guide:{}})})})}function ugt(){return w.useEffect(()=>{const e=()=>window.parent.postMessage({type:"resize-iframe",height:document.body.scrollHeight},"*"),n=r=>{var i;((i=r.data)==null?void 0:i.type)==="get-height"&&e()};window.addEventListener("message",n);const s=new ResizeObserver(e);return s.observe(document.documentElement),e(),()=>{window.removeEventListener("message",n),s.disconnect()}},[]),c.jsx(cgt,{content:{},error:null,isLoading:!1})}function RU(t){return typeof t=="object"&&t&&"message"in t?String(t.message):"Request failed. Please try again."}async function gi(t){const{data:e,error:n}=await t;if(n)throw new Error(RU(n));if(e===void 0)throw new Error("Request failed. Please try again.");return e}
556class gbe extends Error{constructor(n,s){super(n);js(this,"clientSecret");this.name="PlanChangeAuthenticationRequiredError",this.clientSecret=s}}function dgt(t){if(!t||typeof t!="object")return null;const e=t;return e.requiresAction!==!0||typeof e.clientSecret!="string"?null:new gbe(RU(t),e.clientSecret)}function Yh(){const t=w.useCallback(async v=>{const{data:x,error:y}=await XZe({body:{plan:v}}),S=dgt(y);if(S)throw S;if(y)throw new Error(RU(y));if(x===void 0)throw new Error("Request failed. Please try again.");return x},[]),e=w.useCallback((v,x)=>gi(qZe({body:{amountCents:v,idempotencyKey:x}})),[]),n=w.useCallback(v=>gi(QZe({body:{plan:v}})),[]),s=w.useCallback(()=>gi(PZe({})),[]),r=w.useCallback(v=>gi(WZe(v?{query:{reference:v}}:{})),[]),i=w.useCallback(v=>gi(MZe({body:v})),[]),a=w.useCallback(()=>gi(Vme({})),[]),o=w.useCallback(v=>gi(zme({body:{paymentMethodId:v}})),[]),l=w.useCallback(v=>gi(GZe({body:{code:v}})),[]),u=w.useCallback(()=>gi(FZe({})),[]),d=w.useCallback(v=>gi(UZe({body:{budgetCents:v}})),[]),f=w.useCallback(v=>gi(BZe({body:{usagePercent:v}})),[]),p=w.useCallback((v,x)=>gi(VZe({body:{usagePercent:x},path:{alertId:v}})),[]),m=w.useCallback(v=>gi(zZe({path:{alertId:v}})),[]);return{changePlan:t,previewPlanChange:n,purchaseCredits:e,getCreditBalance:r,getAutoTopup:s,setAutoTopup:i,createSetupIntent:a,setDefaultPaymentMethod:o,redeemCoupon:l,getBudget:u,setBudget:d,createBudgetAlert:f,updateBudgetAlert:p,deleteBudgetAlert:m}}function vbe(){const[t,e]=w.useState(!1);return{openPortal:w.useCallback(async({newTab:s=!0}={})=>{e(!0);const r=s?window.open("","_blank"):null;try{const{url:i}=await gi(DZe({}));if(!i)throw new Error("No billing portal URL returned");r?r.location.replace(i):window.location.href=i}catch(i){r==null||r.close(),Bn({title:i instanceof Error?i.message:"Could not open the billing portal."})}finally{e(!1)}},[]),opening:t}}var R8={exports:{}},A8,wse;function fgt(){if(wse)return A8;wse=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return A8=t,A8}var N8,_se;function hgt(){if(_se)return N8;_se=1;var t=fgt();function e(){}function n(){}return n.resetWarningCache=e,N8=function(){function s(a,o,l,u,d,f){if(f!==t){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}s.isRequired=s;function r(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:r,element:s,elementType:s,instanceOf:r,node:s,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:e};return i.PropTypes=i,i},N8}var Ese;function pgt(){return Ese||(Ese=1,R8.exports=hgt()()),R8.exports}var mgt=pgt();const _r=Y2(mgt);function Cse(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=Array(e);n<e;n++)s[n]=t[n];return s}function ggt(t){if(Array.isArray(t))return t}function xbe(t,e,n){return(e=wgt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vgt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s,r,i,a,o=[],l=!0,u=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(l=(s=i.call(n)).done)&&(o.push(s.value),o.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}function xgt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
557In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tse(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,s)}return n}function kse(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tse(Object(n),!0).forEach(function(s){xbe(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tse(Object(n)).forEac
557h(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function ygt(t,e){if(t==null)return{};var n,s,r=bgt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function bgt(t,e){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(e.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function ybe(t,e){return ggt(t)||vgt(t,e)||_gt(t,e)||xgt()}function Sgt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wgt(t){var e=Sgt(t,"string");return typeof e=="symbol"?e:e+""}function S9(t){"@babel/helpers - typeof";return S9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S9(t)}function _gt(t,e){if(t){if(typeof t=="string")return Cse(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cse(t,e):void 0}}var Wi=function(e,n,s){var r=!!s,i=re.useRef(s);re.useEffect(function(){i.current=s},[s]),re.useEffect(function(){if(!r||!e)return function(){};var a=function(){if(i.current)return i.current.apply(i,arguments)};return e.on(n,a),function(){e.off(n,a)}},[r,n,e,i])},w9=function(e){var n=re.useRef(e);return re.useEffect(function(){n.current=e},[e]),n.current},v1=function(e){return e!==null&&S9(e)==="object"},Egt=function(e){return v1(e)&&typeof e.then=="function"},Cgt=function(e){return v1(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},Rse="[object Object]",Tgt=function t(e,n){if(!v1(e)||!v1(n))return e===n;var s=Array.isArray(e),r=Array.isArray(n);if(s!==r)return!1;var i=Object.prototype.toString.call(e)===Rse,a=Object.prototype.toString.call(n)===Rse;if(i!==a)return!1;if(!i&&!s)return e===n;var o=Object.keys(e),l=Object.keys(n);if(o.length!==l.length)return!1;for(var u={},d=0;d<o.length;d+=1)u[o[d]]=!0;for(var f=0;f<l.length;f+=1)u[l[f]]=!0;var p=Object.keys(u);if(p.length!==o.length)return!1;var m=e,v=n,x=function(S){return t(m[S],v[S])};return p.every(x)},bbe=function(e,n,s){return v1(e)?Object.keys(e).reduce(function(r,i){var a=!v1(n)||!Tgt(e[i],n[i]);return s.includes(i)?(a&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),r):a?kse(kse({},r||{}),{},xbe({},i,e[i])):r},null):null},Sbe="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Ase=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Sbe;if(e===null||Cgt(e))return e;throw new Error(n)},kgt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Sbe;if(Egt(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(r){return Ase(r,n)})};var s=Ase(e,n);return s===null?{tag:"empty"}:{tag:"sync",stripe:s}},Rgt=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"6.8.2"}),e.registerAppInfo({name:"react-stripe-js",version:"6.8.2",url:"https://stripe.com/docs/stripe-js/react"}))},$R=re.createContext(null);$R.displayName="ElementsContext";var wbe=function(e,n){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return e},ZS=function(e){var n=e.stripe,s=e.options,r=e.children,i=re.useMemo(function(){return kgt(n)},[n]),a=re.useState(function(){return{stripe:i.tag==="sync"?i.stripe:null,elements:i.tag==="sync"?i.stripe.elements(s):null}}),o=ybe(a,2),l=o[0],u=o[1];re.useEffect(function(){var p=!0,m=function(x){u(function(y){return y.stripe?y:{stripe:x,elements:x.elements(s)}})};return i.tag==="async"&&!l.stripe?i.stripePromise.then(function(v){v&&p&&m(v)}):i.tag==="sync"&&!l.stripe&&m(i.stripe),function(){p=!1}},[i,l,s]);var d=w9(n);re.useEffect(function(){d!==null&&d!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[d,n]);var f=w9(s);return re.useEffect(function(){if(l.elements){var p=bbe(s,f,["clientSecret","fonts"]);p&&l.elements.update(p)}},[s,f,l.elements]),re.useEffect(function(){Rgt(l.stripe)},[l.stripe]),re.createElement($R.Provider,{value:l},r)};ZS.propTypes={stripe:_r.any,options:_r.object};var Agt=function(e){var n=re.useContext($R);return wbe(n,e)},Ngt=function(){var e=Agt("calls useElements()"),n=e.elements;return n};_r.func.isRequired;var _be=re.createContext(null);_be.displayName="CheckoutContext";var _9=function(e){var n=re.useContext(_be),s=re.useContext($R);if(n){if(s)throw new Error("You cannot wrap the part of your app that ".concat(e," in both a checkout provider and <Elements> provider."));return n}else return wbe(s,e)},Igt=["mode"],Lgt=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},Pr=function(e,n,s){var r="".concat(Lgt(e),"Element"),i=function(u){var d=u.id,f=u.className,p=u.options,m=p===void 0?{}:p,v=u.onBlur,x=u.onFocus,y=u.onReady,S=u.onChange,_=u.onEscape,E=u.onClick,T=u.onLoadError,k=u.onLoaderStart,R=u.onNetworksChange,I=u.onConfirm,A=u.onCancel,L=u.onShippingAddressChange,j=u.onShippingRateChange,F=u.onSavedPaymentMethodRemove,O=u.onSavedPaymentMethodUpdate,M=u.onAvailablePaymentMethodsChange,U=_9("mounts <".concat(r,">")),G="elements"in U?U.elements:null,$="checkoutState"in U?U.checkoutState:null,V=($==null?void 0:$.type)==="success"||($==null?void 0:$.type)==="loading"?$.sdk:null,B=re.useState(null),q=ybe(B,2),z=q[0],D=q[1],K=re.useRef(null),Y=re.useRef(null);Wi(z,"blur",v),Wi(z,"focus",x),Wi(z,"escape",_),Wi(z,"click",E),Wi(z,"loaderror",T),Wi(z,"loaderstart",k),Wi(z,"
557networkschange",R),Wi(z,"confirm",I),Wi(z,"cancel",A),Wi(z,"shippingaddresschange",L),Wi(z,"shippingratechange",j),Wi(z,"savedpaymentmethodremove",F),Wi(z,"savedpaymentmethodupdate",O),Wi(z,"availablepaymentmethodschange",M),Wi(z,"change",S);var J;y&&(e==="expressCheckout"?J=y:J=function(){y(z)}),Wi(z,"ready",J),re.useLayoutEffect(function(){if(K.current===null&&Y.current!==null&&(G||V)){var Q=null;if(V){var ee=V,te=V;switch(e){case"paymentForm":Q=te.createForm(m);break;case"payment":Q=ee.createPaymentElement(m);break;case"address":if("mode"in m){var ue=m.mode,ye=ygt(m,Igt);if(ue==="shipping")Q=ee.createShippingAddressElement(ye);else if(ue==="billing")Q=ee.createBillingAddressElement(ye);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":Q=ee.createExpressCheckoutElement(m);break;case"currencySelector":Q=V.createCurrencySelectorElement();break;case"taxId":Q=ee.createTaxIdElement(m);break;case"contactDetails":Q=ee.createContactDetailsElement();break;case"terms":Q=ee.createTermsElement(m);break;default:throw new Error("<".concat(r,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else G&&(Q=G.create(e,m));K.current=Q,D(Q),Q&&Q.mount(Y.current)}},[G,V,m]);var ne=w9(m);return re.useEffect(function(){if(K.current){var Q=bbe(m,ne,["paymentRequest"]);Q&&"update"in K.current&&K.current.update(Q)}},[m,ne]),re.useLayoutEffect(function(){return function(){if(K.current&&typeof K.current.destroy=="function")try{K.current.destroy(),K.current=null}catch{}}},[]),re.createElement("div",{id:d,className:f,ref:Y})},a=function(u){_9("mounts <".concat(r,">"));var d=u.id,f=u.className;return re.createElement("div",{id:d,className:f})},o=n?a:i;return o.propTypes={id:_r.string,className:_r.string,onChange:_r.func,onBlur:_r.func,onFocus:_r.func,onReady:_r.func,onEscape:_r.func,onClick:_r.func,onLoadError:_r.func,onLoaderStart:_r.func,onNetworksChange:_r.func,onConfirm:_r.func,onCancel:_r.func,onShippingAddressChange:_r.func,onShippingRateChange:_r.func,onSavedPaymentMethodRemove:_r.func,onSavedPaymentMethodUpdate:_r.func,onAvailablePaymentMethodsChange:_r.func,options:_r.object},o.displayName=r,o.__elementType=e,o},Mr=typeof window>"u",jgt=re.createContext(null);jgt.displayName="EmbeddedCheckoutProviderContext";var Pgt=function(){var e=_9("calls useStripe()"),n=e.stripe;return n};Pr("auBankAccount",Mr);Pr("card",Mr);Pr("cardNumber",Mr);Pr("cardExpiry",Mr);Pr("cardCvc",Mr);Pr("currencySelector",Mr);Pr("iban",Mr);var Mgt=Pr("payment",Mr);Pr("expressCheckout",Mr);Pr("paymentRequestButton",Mr);Pr("linkAuthentication",Mr);Pr("contactDetails",Mr);Pr("address",Mr);Pr("shippingAddress",Mr);Pr("paymentMethodMessaging",Mr);Pr("taxId",Mr);Pr("issuingCardNumberDisplay",Mr);Pr("issuingCardCvcDisplay",Mr);Pr("issuingCardExpiryDisplay",Mr);Pr("issuingCardPinDisplay",Mr);Pr("issuingCardCopyButton",Mr);Pr("terms",Mr);function bT(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bT=function(e){return typeof e}:bT=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bT(t)}var Ebe="dahlia",Dgt=function(e){return e===3?"v3":e},Cbe="https://js.stripe.com",Ogt="".concat(Cbe,"/").concat(Ebe,"/stripe.js"),$gt=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Fgt=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var Ugt=function(e){return $gt.test(e)||Fgt.test(e)},Bgt=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Cbe,'"]')),n=0;n<e.length;n++){var s=e[n];if(Ugt(s.src))return s}return null},Nse=function(e){var n="",s=document.createElement("script");s.src="".concat(Ogt).concat(n);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(s),s},zgt=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.14.0",startTime:n})},by=null,tC=null,nC=null,Vgt=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},Hgt=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},Ggt=function(e){return by!==null?by:(by=new Promise(function(n,s){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe){n(window.Stripe);return}try{var r=Bgt();if(!(r&&e)){if(!r)r=Nse(e);else if(r&&nC!==null&&tC!==null){var i;r.removeEventListener("load",nC),r.removeEventListener("error",tC),(i=r.parentNode)===null||i===void 0||i.removeChild(r),r=Nse(e)}}nC=Hgt(n,s),tC=Vgt(s),r.addEventListener("load",nC),r.addEventListener("error",tC)}catch(a){s(a);return}}),by.catch(function(n){return by=null,Promise.reject(n)}))},Wgt=function(e,n,s){if(e===null)return null;var r=n[0];if(typeof r!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(bT(r)," instead."));var i=r.match(/^pk_test/),a=Dgt(e.version),o=Ebe;i&&a!==o&&console.warn("Stripe.js@".concat(a," was loaded on the page, but @stripe/stripe-js@").concat("9.14.0"," expected Stripe.js@").concat(o,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var l=e.apply(void 0,n);return zgt(l,s),l}
557,Sy,Tbe=!1,kbe=function(){return Sy||(Sy=Ggt(null).catch(function(e){return Sy=null,Promise.reject(e)}),Sy)};Promise.resolve().then(function(){return kbe()}).catch(function(t){Tbe||console.warn(t)});var qgt=function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];Tbe=!0;var r=Date.now();return kbe().then(function(i){return Wgt(i,n,r)})};const Kgt="/assets/Geist-Medium-t5LLWK2i.woff2",Ygt="/assets/Geist-Regular-C6H5Y334.woff2",Qc=qgt("pk_live_51LgXQFD09ysvpficWNNCe8VYcifrAWyfxGJa3ww9j7JyCplrOeUQdajTK4Rcq8zoaYnpyjhKM9h58p2ti1CzWkOh002NoM8H7D"),Ise=typeof window<"u"?window.location.origin:"",Zgt=[{family:"Geist",src:`url(${Ise}${Ygt})`,weight:"400"},{family:"Geist",src:`url(${Ise}${Kgt})`,weight:"500"}],Xgt={dark:{sand2:"#1C1C1A",sand3:"#232320",sand4:"#282826",sand6:"#353431",sand8:"#51504B",sand9:"#717069",sand11:"#A1A09A",sand12:"#EDEDEC",danger:"#ef4444"},light:{sand2:wf.sand2,sand3:wf.sand3,sand4:wf.sand4,sand6:wf.sand6,sand8:wf.sand8,sand9:wf.sand9,sand11:wf.sand11,sand12:wf.sand12,danger:zmt.red11}};function Lse(t){const e=Xgt[t];return{theme:t==="dark"?"night":"stripe",variables:{colorPrimary:e.sand12,colorBackground:e.sand2,colorText:e.sand12,colorTextSecondary:e.sand11,colorTextPlaceholder:e.sand9,colorDanger:e.danger,fontFamily:'"Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSizeBase:"14px",fontWeightNormal:"500",fontWeightMedium:"500",fontWeightBold:"600",borderRadius:"8px"},rules:{".Input":{backgroundColor:e.sand4,border:`0.5px solid ${e.sand6}`,boxShadow:"none",fontSize:"14px",fontWeight:"500",color:e.sand12},".Input:focus":{border:`0.5px solid ${e.sand8}`,boxShadow:"none",outline:"none"},".Input::placeholder":{color:e.sand9},".Label":{color:e.sand11,fontWeight:"500",fontSize:"14px"},".Tab, .Block, .PickerItem, .AccordionItem":{backgroundColor:e.sand3,boxShadow:"none",fontSize:"14px",fontWeight:"500",color:e.sand12},".Tab":{border:`0.5px solid ${e.sand6}`},".Tab--selected":{backgroundColor:e.sand4,border:`0.5px solid ${e.sand8}`},".TabLabel":{fontWeight:"500",color:e.sand12},".Error":{color:e.danger,fontSize:"14px",fontWeight:"500"}}}}const Qgt={dark:Lse("dark"),light:Lse("light")};function FR(){return Qgt[I4().resolvedTheme]}const Jgt={wallets:{link:"never"}};function $2(t){if(!t)return"Saved payment method";const e=t.brand&&t.brand!=="unknown"?t.brand.charAt(0).toUpperCase()+t.brand.slice(1):t.type.charAt(0).toUpperCase()+t.type.slice(1);return t.last4?`${e} •••• ${t.last4}`:e}function dh({label:t,value:e}){return c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("span",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px]",children:t}),c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:e})]})}function e0t(){const t=[[10,30],[30,30],[20,20],[10,10],[20,10],[30,10],[0,0]];return c.jsx("div",{className:"relative size-[40px] overflow-hidden shrink-0",children:t.map(([e,n],s)=>c.jsx("span",{className:"absolute size-[10px] bg-[#f5d90a]",style:{left:e,top:n}},s))})}function UR({submitting:t,setSubmitting:e,setError:n,onDone:s,onBack:r,cta:i="Save payment method"}){const a=w.useRef(!0);w.useEffect(()=>(a.current=!0,()=>{a.current=!1}),[]);const o=Pgt(),l=Ngt(),{setDefaultPaymentMethod:u}=Yh(),[d,f]=w.useState(!1),p=async()=>{var m;if(!(!o||!l||t)){e(!0),n(null);try{const v=await o.confirmSetup({elements:l,redirect:"if_required"});if(v.error)throw new Error(v.error.message||"Could not save payment method.");const x=(m=v.setupIntent)==null?void 0:m.payment_method;if(typeof x!="string")throw new Error("Stripe did not return a payment method.");if(!a.current)return;const y=await u(x);s(y.paymentMethod)}catch(v){n(v instanceof Error?v.message:"Payment failed. Please try again.")}finally{e(!1)}}};return c.jsxs("div",{className:"flex flex-col gap-[16px]",children:[c.jsx(Mgt,{options:Jgt,onChange:m=>f(m.complete)}),c.jsxs("div",{className:"flex justify-between gap-[12px] w-full",children:[c.jsx("button",{type:"button",onClick:r,disabled:t,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Back"}),c.jsx("button",{type:"button",disabled:!o||!l||!d||t,onClick:p,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:t?"Saving…":i})})]})]})}const I8=`$${Bk/100}`,L8=[{id:"50",label:"$50",amount:50},{id:"250",label:"$250",amount:250},{id:"1000",label:"$1,000",amount:1e3},{id:"other",label:"Other",amount:null}],j8=t=>
557t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),jse=["Confirming your payment","Confirming your credits","Adding credits to your wallet","Refreshing your balance"],Pse=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`;function t0t({triggerLabel:t="Buy credits"}={}){const[e,n]=w.useState(!1),[s,r]=w.useState("amount"),[i,a]=w.useState("50"),[o,l]=w.useState("50"),[u,d]=w.useState(!1),[f,p]=w.useState(""),[m,v]=w.useState(!1),[x,y]=w.useState(null),[S,_]=w.useState(null),[E,T]=w.useState(null),[k,R]=w.useState(null),[I,A]=w.useState(null),[L,j]=w.useState(null),[F,O]=w.useState(0),M=w.useRef(""),U=w.useRef(null),G=w.useRef(null),{render:$,exiting:V}=Kh(e),{createSetupIntent:B,getCreditBalance:q,purchaseCredits:z}=Yh(),D=FR(),K=async()=>{await Promise.all([Pn.invalidateQueries({queryKey:["usageDetails"]}),Pn.invalidateQueries({queryKey:["dailyBreakdown"]})])},Y=()=>{M.current=Pse(),y(null),_(null),T(null),A(null),j(null),O(0),r("amount"),n(!0)};w.useEffect(()=>{if(i===o)return;d(!0);const he=setTimeout(()=>{l(i),d(!1)},130);return()=>clearTimeout(he)},[i,o]),w.useEffect(()=>{if(!e)return;const he=Ge=>{Ge.key==="Escape"&&n(!1)};document.addEventListener("keydown",he);const De=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",he),document.body.style.overflow=De}},[e]);const J=i!==o,ne=L8.find(he=>he.id===o),Q=ne.amount===null,ee=Q?parseFloat(f)||0:ne.amount??0,te=Q&&ee>1e3,ue=ee,ye=Math.round(ue*100),je=Q&&ye<Bk,Re=`$${j8(ee)}`,me=te?"????":`$${j8(ue)}`;w.useLayoutEffect(()=>{if(!$)return;const he=G.current;if(!he)return;const De=()=>R(he.scrollHeight);De();const Ge=new ResizeObserver(De);return Ge.observe(he),()=>Ge.disconnect()},[$,s,S,x,m,o,f,F,E]);const Ce=async()=>{if(!(m||J)){if(te){window.open("https://cal.com/hussien-hussien-fjxt3x/intro-chat-w-steel-founders","_blank");return}if(je){y(`Enter an amount of at least ${I8}.`);return}if(!Qc){y("Stripe publishable key is not configured.");return}v(!0),y(null);try{const he=await B();if(he.hasDefaultPaymentMethod){if(!he.paymentMethod)throw new Error("Could not load saved payment method.");T(he.paymentMethod),r("confirm");return}if(!he.clientSecret)throw new Error("Could not start payment method setup.");_(he.clientSecret),r("payment")}catch(he){y(he instanceof Error?he.message:"Could not start payment setup.")}finally{v(!1)}}},Xe=async()=>{if(!(m||!E)){if(ye<Bk){y(`Enter an amount of at least ${I8}.`),r("amount");return}v(!0),y(null);try{const he=await q().catch(()=>({balanceCents:0})),De=await z(ye,M.current);A(he.balanceCents??0),j(De.reference),r("loading")}catch(he){y(he instanceof Error?he.message:"Could not start credit purchase.")}finally{v(!1)}}};return w.useEffect(()=>{if(s!=="loading")return;O(0);const he=window.setInterval(()=>O(qe=>(qe+1)%jse.length),2500);let De=!1,Ge=0;const Je=(I??0)+ye,Le=async()=>{Ge+=1;try{const qe=await q(L??void 0);if(!De&&(qe.paymentStatus==="failed"||qe.paymentStatus==="voided")){M.current=Pse(),y("Your payment was declined or canceled. Try again with a different payment method."),r("confirm");return}if(!De&&qe.balanceCents!=null&&qe.balanceCents>=Je){await K(),r("success");return}}catch{}!De&&Ge<30?window.setTimeout(Le,1500):De||(y("Payment is still processing. Refresh your wallet in a moment."),r("payment"))};return Le(),()=>{De=!0,window.clearInterval(he)}},[ye,q,L,s,I]),c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:Y,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px]",children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:t})}),$&&typeof document<"u"&&nr.createPortal(c.jsx("div",{className:`${V?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:he=>{U.current&&!U.current.contains(he.target)&&n(!1)},children:c.jsx("div",{ref:U,role:"dialog","aria-modal":"true","aria-labelledby":"buy-credits-title",style:k?{height:k}
557:void 0,className:`${V?"modal-card-out":"modal-card-in"} bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full max-h-[calc(100vh-32px)] overflow-hidden shadow-modal transition-[height] [transition-duration:360ms] [transition-timing-function:var(--ease-out)]`,children:c.jsx("div",{className:"max-h-[calc(100vh-32px)] overflow-y-auto",children:c.jsxs("div",{ref:G,className:"fade-in",children:[s==="amount"&&c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{id:"buy-credits-title",className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Buy credits"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Top-up your credit balance."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Credit amount"}),c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsx("div",{className:"flex gap-[16px] w-full",children:L8.slice(0,2).map(he=>c.jsx(Mse,{option:he,selected:i===he.id,onSelect:()=>a(he.id),custom:f,onCustom:p},he.id))}),c.jsx("div",{className:"flex gap-[16px] w-full",children:L8.slice(2).map(he=>c.jsx(Mse,{option:he,selected:i===he.id,onSelect:()=>a(he.id),custom:f,onCustom:p},he.id))})]}),c.jsxs("div",{className:`flex flex-col gap-[16px] w-full font-medium text-[14px] transition-[opacity,filter] duration-150 [transition-timing-function:var(--ease-out)] ${u?"opacity-0 blur-[2px]":"opacity-100 blur-0"}`,children:[c.jsx(dh,{label:"Usage Credits",value:Re}),c.jsx("div",{className:"bg-[var(--sand-6)] h-[0.5px] w-full"}),c.jsxs("div",{className:"flex items-start justify-between w-full",children:[c.jsx("span",{className:"text-[var(--sand-10)] leading-[20px]",children:"Total due"}),c.jsx("span",{className:"text-[var(--sand-12)] leading-[20px] underline decoration-dotted [text-underline-position:from-font]",children:me})]})]}),x&&s==="amount"&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x}),c.jsxs("p",{className:"-mt-[4px] font-medium text-[var(--sand-10)] text-[12px] leading-[20px] text-left w-full",children:["Minimum purchase is ",I8,". Usage purchases expire 1 year after purchase."]})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>n(!1),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"button",onClick:Ce,disabled:m,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",children:c.jsx("span",{className:`font-medium text-[var(--sand-1)] text-[14px] leading-[20px] transition-opacity duration-150 [transition-timing-function:var(--ease-out)] ${u?"opacity-0":"opacity-100"}`,children:m?"Preparing…":te?"Talk to sales":`Continue to pay $${j8(ue)}`})})]})]}),s==="payment"&&c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Add payment method"}),c.jsxs("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:["Save a payment method, then buy ",Re," in credits."]})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[S&&Qc?c.jsx(ZS,{stripe:Qc,options:{clientSecret:S,appearance:D},children:c.jsx(UR,{submitting:m,setSubmitting:v,setError:y,onDone:he=>{T(he),r("confirm")},onBack:()=>{y(null),r("amount")}})}):c.jsx("div",{className:"h-[120px] animate-pulse rounded-[12px] bg-[var(--sand-3)]"}),x&&s==="payment"&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x})]})]}),s==="confirm"&&c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Confirm purchase"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Review your payment method and credit purchase."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[c.jsxs("div",{className:"flex flex-col gap-[16px] w-full font-medium text-[14px]",children:[c.jsx(dh,{label:"Payment method",value:$2(E)}),c.jsx(dh,{label:"Usage Credits",value:Re}),c.jsx("div",{className:"bg-[var(--sand-6)] h-[0.5px] w-full"}),c.jsx(dh,{label:"Total due",value:me})]}),x&&s==="confirm"&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:()=>{y(null),r(S?"payment":"amount")},disabled:m,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Back"}),c.jsx("button",{type:"button",onClick:Xe,disabled:m||!E,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:m?"Processing…":`Buy ${Re}`})})]})]}),s==="loading"&&c.jsxs("div",{className:"p-[32px] flex flex-col items-center justify-center gap-[16px] min-h-[200px]",children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"fade-in font-medium text-[var(--sand-11)] text-[14px] leading-[20px] text-center",children:jse[F]},F)]}),s==="success"&&c.jsx("div",{className:"p-[32px] flex flex-col gap-[24px]",children:c.jsx(nbe,{active:s==="success",title:"Credits added",subtitle:`Your ${Re} credit purchase has been added to your wallet.`,cta:"Done",onDone:()=>n(!1)})})]},s)})})}),document.body)]})}function Mse({option:t,selected:e,onSelect:n,custom:s,onCustom:r}){const i=t.amount===null,a=`flex flex-1 h-[44px] items-center justify-between min-w-px px-[12px] rounded-[8px] border-[0.5px] border-solid transition-colors duration-150 [transition-timing-function:var(--ease-out)] ${e?"bg-[var(--sand-6)] border-[var(--sand-6)]":"bg-[var(--sand-3)] border-[var(--sand-6)] hover:bg-[var(--sand-4)]"}`;
557return i&&e?c.jsx("div",{className:`cursor-text ${a}`,onClick:n,children:c.jsxs("div",{className:"flex items-center gap-[6px] w-full",children:[c.jsx("span",{className:"text-[var(--sand-12)] text-[14px] leading-[20px]",children:"$"}),c.jsx("input",{autoFocus:!0,type:"number",inputMode:"decimal",min:Bk/100,value:s,placeholder:"0",onChange:o=>r(o.target.value),onClick:o=>o.stopPropagation(),className:"flex-1 min-w-px bg-transparent outline-none text-[var(--sand-12)] text-[14px] leading-[20px] placeholder:text-[var(--sand-10)] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"})]})}):c.jsx("button",{type:"button",onClick:n,className:`cursor-pointer ${a}`,children:c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:t.label})})}function Rbe({options:t,defaultValue:e,value:n,onChange:s,disabled:r,title:i}){const[a,o]=w.useState(!1),[l,u]=w.useState(e),d=w.useRef(null),f=n??l;return w.useEffect(()=>{if(!a)return;const p=v=>{d.current&&!d.current.contains(v.target)&&o(!1)},m=v=>v.key==="Escape"&&o(!1);return document.addEventListener("pointerdown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",m)}},[a]),c.jsxs("div",{ref:d,className:"relative",children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":a,disabled:r,title:i,onClick:()=>o(p=>!p),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[6px] h-[40px] items-center pl-[12px] pr-[10px] rounded-[8px] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-[var(--sand-3)] disabled:active:scale-100",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:f}),c.jsx(G1,{size:20,className:"size-[20px] text-[var(--sand-9)]"})]}),a&&c.jsx("div",{role:"menu",className:"origin-top absolute right-0 top-[calc(100%+6px)] z-50 w-[220px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:t.map(p=>c.jsx("button",{type:"button",role:"menuitem",onClick:()=>{u(p),s==null||s(p),o(!1)},className:`w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)] ${f===p?"text-[var(--sand-12)]":"text-[var(--sand-11)]"}`,children:p},p))})]})}const n0t="cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",s0t="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed";function r0t(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"shrink-0",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"var(--sand-12)"}),c.jsx("path",{d:"M15 9.5L10.5 15L8.5 13",stroke:"var(--sand-1)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const i0t=["$100 monthly included credits","100 concurrent browser sessions","30-day data retention","included anti-bot access"];function Abe({open:t,currentPlan:e,submitting:n,error:s,onClose:r,onConfirm:i}){const a=w.useRef(null),o=w.useRef(null),l=w.useRef(!1),{render:u,exiting:d}=Kh(t),[f,p]=w.useState(null);if(w.useEffect(()=>{n||(l.current=!1)},[n]),w.useEffect(()=>{if(!t)return;const v=y=>y.key==="Escape"&&!n&&r();document.addEventListener("keydown",v);const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",v),document.body.style.overflow=x}},[t,r,n]),w.useLayoutEffect(()=>{if(!u)return;const v=o.current;if(!v)return;const x=()=>p(v.scrollHeight);x();const y=new ResizeObserver(x);return y.observe(v),()=>y.disconnect()},[u,s,n]),!u||typeof document>"u")return null;const m=e==="scale";return nr.createPortal(c.jsx("div",{className:`${d?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:v=>{!n&&a.current&&!a.current.contains(v.target)&&r()},children:c.jsx("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":"downgrade-launch-title",style:f?{height:f}:void 0,className:`${d?"modal-card-out":"modal-card-in"} bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[460px] max-w-full overflow-hidden shadow-modal transition-[height] [transition-duration:360ms] [transition-timing-function:var(--ease-out)]`,children:c.jsx("div",{ref:o,className:"flex flex-col gap-[20px] p-[20px]",children:n?c.jsx(a0t,{title:"Downgrading to Launch",subtitle:"Preserving credits and updating your plan."}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium",children:[c.jsx("p",{id:"downgrade-launch-title",className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Downgrade to Launch?"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:m?"Are you sure? Launch is free, but you'll be missing out on:":"Launch is free, includes one-time credits, and keeps your unused credits."})]}),m&&c.jsx("div",{className:"flex flex-col gap-[12px] font-medium text-[14px] leading-[20px]",children:i0t.map(v=>c.jsxs("div",{className:"flex items-center gap-[10px]",children:[c.jsx(r0t,{}),c.jsx("span",{className:"text-[var(--sand-12)]",children:v})]},v))}),s&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:s}),c.jsxs("div",{className:"flex justify-between gap-[12px]",children:[c.jsx("button",{type:"button",onClick:r,disabled:n,className:s0t,children:"Keep current plan"}),c.jsx("button",{type:"button",disabled:n,onClick:()=>{n||l.current||(l.current=!0,i())},className:n0t,children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:"Downgrade to Launch"})})]})]})})})}),document.body)}function a0t({title:t,subtitle:e}){return c.jsxs("div",{className:"flex flex-col items-center justify-center gap-[16px] py-[32px]",children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsxs("div",{className:"flex flex-col gap-[4px] text-center font-medium",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[16px] leading-[24px]",children:t}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:e})]})]})}const o0t={launch:"Launch",scale:"Scale",hobby:"Hobby",starter:"Starter",developer:"Developer",pro:"Startups",enterprise:"Enterprise",admin:"Admin"},l0t={launch:{Icon:Bm,color:"var(--plan-launch)",width:18,height:20},scale:{Icon:D2,color:"var(--plan-scale)",width:21,height:20},enterprise:{Icon:M2,color:"var(--sand-10)",width:21,height:20}};function c0t(t,e=!1){const n=t==null?void 0:t.trim().toLowerCase();return n?`${o0t[n]??"Plan"} plan`:e?"Loading plan":"Plan"}function u0t({plan:t}){const e=t==null?void 0:t.trim().toLowerCase();if(e==="starter")return c.jsx(Bm,{width:18,height:20});if(e==="developer")return c.jsx(M2,{width:21,height:20});if(e==="pro")return c.jsx(D2,{color:"var(--plan-pro)",width:21,height:20});const n=l0t[e||""];return n?c.jsx(n.Icon,{color:n.color,width:n.width,height:n.height}):c.jsx(Bm,{color:"var(--sand-12)",width:18,height:20})}function sC({showChangePlan:t=!0}={}){const[e,n]=w.useState(!1),s=w.useRef(null),{plan:r,isLoading:i}=mu(),{changePlan:a}=Yh(),o=c0t(r,i),l=(r==null?void 0:r.trim().toLowerCase())==="launch",[u,d]=w.useState(!1),[f,p]=w.useState(!1),[m,v]=w.useState(null),x=async()=>{p(!0),v(null);try{await a("launch"),await Promise.all([Pn.invalidateQueries({queryKey:["usageDetails"]}
557),Pn.invalidateQueries({queryKey:["dailyBreakdown"]}),Pn.invalidateQueries({queryKey:["sessionCounts"]})]),d(!1)}catch(y){v(y instanceof Error?y.message:"Could not cancel plan. Please try again.")}finally{p(!1)}};return w.useEffect(()=>{if(!e)return;const y=_=>{s.current&&!s.current.contains(_.target)&&n(!1)},S=_=>{_.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",y),document.addEventListener("keydown",S),()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",S)}},[e]),c.jsxs("div",{ref:s,className:"relative",children:[c.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":e,onClick:()=>n(y=>!y),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center gap-[8px] pl-[12px] pr-[10px] rounded-[8px]",children:[c.jsxs("div",{className:"flex gap-[6px] items-center",children:[c.jsx(u0t,{plan:r}),c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:o})]}),c.jsx(G1,{size:20,className:"size-[20px] text-[var(--sand-9)]"})]}),e&&c.jsxs("div",{role:"menu",className:"origin-top absolute right-0 top-[calc(100%+6px)] z-50 w-[200px] p-[4px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:[t&&c.jsx(Hn,{to:ei.plans,role:"menuitem",onClick:()=>n(!1),className:"w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-[var(--sand-12)] text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)]",children:"Change plan"}),!l&&c.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n(!1),v(null),d(!0)},className:"w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-danger text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:bg-[var(--sand-4)]",children:"Cancel plan"})]}),c.jsx(Abe,{open:u,currentPlan:r,submitting:f,error:m,onClose:()=>{f||d(!1)},onConfirm:x})]})}const P8="All projects",Dse={[ei.wallet]:{title:"Wallet",description:"Check and manage your credit balance"},[ei.usage]:{title:"Usage overview",description:"Track your consumption and spending over time."},[ei.usageProxy]:{title:"Proxy and network",description:"Bandwidth and requests through Steel-managed proxies."},[ei.plans]:{title:"Plans",description:"Compare plans and pick the one that fits your team."},[ei.limits]:{title:"Limits & alerts",description:"Set spending limits and get alerted before you reach them."}};function M8(){const{openPortal:t,opening:e}=vbe();return c.jsxs("button",{disabled:e,onClick:()=>void t(),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[8px] h-[40px] items-center pl-[12px] pr-[10px] rounded-[8px] disabled:opacity-50 disabled:cursor-not-allowed",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:e?"Opening…":"Manage billing"}),c.jsx(La,{size:20,className:"text-[var(--sand-9)]"})]})}function d0t({onClick:t}){return c.jsx("button",{type:"button",onClick:t,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px]",children:c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-1)] whitespace-nowrap",children:"Edit budget"})})}function f0t({usageProjectId:t,onUsageProjectChange:e,isLegacyPlan:n}){var l;const{projects:s,projectsQuery:r}=lc(),i=w.useMemo(()=>[P8,...s.map(u=>u.name)],[s]),a=((l=s.find(u=>u.id===t))==null?void 0:l.name)??P8,o=n||r.isLoading;return c.jsx(Rbe,{options:i,defaultValue:P8,value:a,onChange:u=>{const d=s.find(f=>f.name===u);e(d==null?void 0:d.id)},disabled:o,title:n?"Project filtering isn't available on legacy plans":void 0})}function h0t({pathname:t,sessionId:e,usageRange:n,onUsageRangeChange:s,usageProjectId:r,onUsageProjectChange:i,onEditBudget:a}){const{isLegacyPlan:o}=mu();return t.startsWith(ei.usage)?c.jsxs(c.Fragment,{children:[t===ei.usage&&c.jsx(f0t,{usageProjectId:r,onUsageProjectChange:i,isLegacyPlan:o}),!(t===ei.usageProxy&&e)&&c.jsx(Rbe,{options:[...$pt],defaultValue:"Last 24h",value:n,onChange:l=>s(l)})]}):t===ei.plans?c.jsxs(c.Fragment,{children:[c.jsx(M8,{}),c.jsx(sC,{showChangePlan:!1})]}
557):t===ei.limits?c.jsxs(c.Fragment,{children:[!o&&c.jsx(d0t,{onClick:a}),c.jsx(sC,{})]}):t===ei.wallet?c.jsxs(c.Fragment,{children:[c.jsx(M8,{}),!o&&c.jsx(t0t,{}),c.jsx(sC,{})]}):c.jsxs(c.Fragment,{children:[c.jsx(M8,{}),c.jsx(sC,{})]})}function p0t(){var d;const{pathname:t}=Gs(),[e]=Po(),n=((d=e.get("session"))==null?void 0:d.trim())||null,s=t===ei.usageProxy&&n?{title:"Session proxy usage",description:`Bandwidth and hits for …${n.slice(-8)}`}:Dse[t]??Dse[ei.wallet],[r,i]=w.useState("Last 24h"),[a,o]=w.useState(void 0),[l,u]=w.useState(!1);return t.startsWith(`${ei.invoices}/`)?c.jsx("div",{className:"flex min-w-0 flex-1 overflow-y-auto bg-[var(--sand-1)]",children:c.jsx(Jl,{})}):c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsx("div",{className:"w-full",children:c.jsxs("div",{className:"flex min-h-[112px] w-full flex-col items-start justify-between gap-4 px-4 py-5 sm:flex-row sm:items-center sm:px-6",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:s.title}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:s.description})]}),c.jsx("div",{className:"flex flex-wrap gap-[12px] items-center",children:c.jsx(h0t,{pathname:t,sessionId:n,usageRange:r,onUsageRangeChange:i,usageProjectId:a,onUsageProjectChange:o,onEditBudget:()=>u(!0)})})]})}),c.jsx("div",{className:"flex flex-col gap-[24px] p-[24px] w-full",children:c.jsx(Jl,{context:{usageRange:r,usageProjectId:a,editBudgetOpen:l,setEditBudgetOpen:u}})})]})})}function m0t({data:t}){var i;const e=t.customerName||"—",n=t.status==="paid"&&t.settlementStatus==="none",s=sbe(t),r=t.number??t.id;return c.jsx("div",{className:"steel-invoice-page flex flex-col gap-[20px] w-full items-center",children:c.jsxs("div",{className:"steel-invoice-sheet relative break-words w-full max-w-[720px] text-[#1a1a1a]",children:[c.jsxs("div",{className:"flex flex-col items-start justify-between gap-[24px] sm:flex-row",children:[c.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-[24px]",children:[c.jsx(O1,{className:"block self-start text-[#1a1a1a] h-[28px] w-auto"}),c.jsxs("div",{className:"flex flex-col gap-[6px]",children:[c.jsx("h1",{className:"text-[28px] leading-[34px] font-semibold tracking-[-0.02em]",children:"Invoice"}),c.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[#6b6b6b] font-medium mt-[6px]",children:"Invoice number"}),c.jsx("p",{className:"break-all font-mono text-[12px] leading-[18px]",children:r}),c.jsxs("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b] mt-[6px]",children:["Issued ",O2(t.createdAt)]}),t.paidAt&&c.jsxs("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b]",children:["Paid ",O2(t.paidAt)]})]})]}),c.jsxs("address",{className:"flex shrink-0 flex-col gap-[4px] text-left text-[13px] leading-[18px] not-italic text-[#6b6b6b] sm:text-right",children:[c.jsx("p",{className:"font-medium text-[#1a1a1a]",children:"Steel.dev"}),c.jsxs("p",{children:["9450 Southwest Gemini Drive",c.jsx("br",{}),"PMB 34667",c.jsx("br",{}),"Beaverton, Oregon 97008",c.jsx("br",{}),"United States"]}),c.jsx("p",{className:"mt-[8px]",children:"+1 815-522-1655"}),c.jsx("p",{children:"[email protected]"})]})]}),c.jsxs("div",{className:"mt-[40px] grid grid-cols-1 gap-[24px] sm:grid-cols-2",children:[c.jsxs("div",{className:"flex flex-col gap-[6px]",children:[c.jsx("p",{className:"break-all text-[11px] tracking-[0.08em] uppercase text-[#6b6b6b] font-medium",children:"Bill to"}),c.jsx("p",{className:"text-[15px] leading-[22px] font-medium",children:e}),t.customerEmail&&c.jsx("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b]",children:t.customerEmail}),t.customerAddress&&c.jsx("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b] whitespace-pre-line",children:t.customerAddress}),(i=t.customerTaxIds)==null?void 0:i.map(({type:a,value:o})=>c.jsxs("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b]",children:[a.endsWith("_vat")||a==="eu_oss_vat"?"VAT ID":"Tax ID",": ",o]},`${a}:${o}`))]}),c.jsxs("div",{className:"flex flex-col items-start gap-[6px] text-left sm:items-end sm:text-right",children:[c.jsx("p",{className:"break-all text-[11px] tracking-[0.08em] uppercase text-[#6b6b6b] font-medium",children:"Status"}),c.jsx("p",{className:`text-[15px] leading-[22px] font-semibold ${n?"text-[#0a7a3e]":"text-[#1a1a1a]"}`,children:s}),(t.paymentMethodBrand||t.paymentMethodLast4)&&c.jsxs("p",{className:"text-[13px] leading-[18px] text-[#6b6b6b] capitalize",children:[t.paymentMethodBrand??"Payment method",t.paymentMethodLast4?` ···· ${t.paymentMethodLast4}`:null]})]})]}),c.jsxs("div",{className:"mt-[40px]",children:[c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_44px_88px] gap-[8px] border-b border-[#e8e8e8] pb-[10px] text-[11px] font-medium uppercase tracking-[0.08em] text-[#6b6b6b] sm:grid-cols-[minmax(0,1fr)_80px_120px] sm:gap-[12px]",children:[c.jsx("span",{children:"Description"}),c.jsx("span",{className:"text-right",children:"Qty"}),c.jsx("span",{className:"text-right",children:"Amount"})]}),t.lineItems.length===0?c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_44px_88px] gap-[8px] border-b border-[#f0f0f0] py-[14px] text-[14px] leading-[20px] sm:grid-cols-[minmax(0,1fr)_80px_120px] sm:gap-[12px]",children:[c.jsx("span",{className:"min-w-0 break-words",children:t.description}),c.jsx("span",{className:"text-right text-[#6b6b6b]",children:"—"}),c.jsx("span",{className:"text-right font-medium",children:Yo(t.totalCents,t.currency)})]}):t.lineItems.map((a,o)=>c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_44px_88px] gap-[8px] border-b border-[#f0f0f0] py-[14px] text-[14px] leading-[20px] sm:grid-cols-[minmax(0,1fr)_80px_120px] sm:gap-[12px]",children:[c.jsx("span",{className:"min-w-0 break-words",children:a.description}),c.jsx("span",{className:"text-right text-[#6b6b6b]",children:a.quantity!=null?a.quantity:"—"}),c.jsx("span",{className:"text-right font-medium",children:Yo(a.amountCents,t.currency)})]},`${a.description}-${o}`))]}),c.jsxs("div",{className:"mt-[24px] flex flex-col items-end gap-[8px] text-[14px] leading-[20px]",children:[c.jsxs("div",{className:"flex w-full justify-between text-[#6b6b6b] sm:w-[240px]",children:[c.jsx("span",{children:"Subtotal"}),c.jsx("span",{children:Yo(t.subtotalCents,t.currency)})]}),t.adjustments.map((a,o)=>c.jsxs("div",{className:"flex w-full justify-between text-[#6b6b6b] sm:w-[240px]",children:[c.jsx("span",{children:a.label}),c.jsx("span",{children:Yo(a.amountCents,t.currency)})]},`${a.label}-${o}
557`)),t.taxCents>0&&c.jsxs("div",{className:"flex w-full justify-between text-[#6b6b6b] sm:w-[240px]",children:[c.jsx("span",{children:"Tax"}),c.jsx("span",{children:Yo(t.taxCents,t.currency)})]}),c.jsxs("div",{className:"flex w-full justify-between border-t border-[#1a1a1a] pt-[10px] text-[16px] font-semibold sm:w-[240px]",children:[c.jsx("span",{children:"Total"}),c.jsx("span",{children:Yo(t.totalCents,t.currency)})]}),n&&t.amountPaidCents>0&&c.jsxs("div",{className:"flex w-full justify-between font-medium text-[#0a7a3e] sm:w-[240px]",children:[c.jsx("span",{children:"Amount paid"}),c.jsx("span",{children:Yo(t.amountPaidCents,t.currency)})]}),t.amountRefundedCents>0&&c.jsxs("div",{className:"flex w-full justify-between font-medium text-[#6b6b6b] sm:w-[240px]",children:[c.jsx("span",{children:"Refunded"}),c.jsxs("span",{children:["−",Yo(t.amountRefundedCents,t.currency)]})]}),t.amountCreditedCents>0&&c.jsxs("div",{className:"flex w-full justify-between font-medium text-[#6b6b6b] sm:w-[240px]",children:[c.jsx("span",{children:"Credited"}),c.jsxs("span",{children:["−",Yo(t.amountCreditedCents,t.currency)]})]}),t.settlementStatus!=="none"&&c.jsxs("div",{className:"flex w-full justify-between border-t border-[#e8e8e8] pt-[8px] font-semibold sm:w-[240px]",children:[c.jsx("span",{children:"Net paid"}),c.jsx("span",{children:Yo(t.netAmountPaidCents,t.currency)})]})]}),c.jsxs("div",{className:"mt-[48px] flex flex-col items-start justify-between gap-[16px] border-t border-[#e8e8e8] pt-[20px] sm:flex-row sm:items-end",children:[c.jsx("p",{className:"text-[12px] leading-[16px] text-[#8a8a8a] max-w-[360px]",children:"Thank you for building with Steel. Questions about this invoice? Contact [email protected]."}),n&&c.jsx("div",{className:"steel-invoice-paid-mark shrink-0 border-2 border-[#0a7a3e] text-[#0a7a3e] px-[14px] py-[6px] text-[12px] font-bold tracking-[0.14em] uppercase rotate-[-6deg] opacity-80",children:"Paid"}),t.settlementStatus==="refunded"&&c.jsx("div",{className:"steel-invoice-paid-mark shrink-0 border-2 border-[#6b6b6b] text-[#6b6b6b] px-[14px] py-[6px] text-[12px] font-bold tracking-[0.14em] uppercase rotate-[-6deg] opacity-80",children:"Refunded"})]})]})})}function g0t(){var u,d;const{invoiceId:t}=M5(),{membership:e,isLoaded:n}=Mo(),{user:s,isLoaded:r}=Vi(),i=ibe(t),a=(e==null?void 0:e.role)==="org:admin",o=a?i.data:void 0,l=(o==null?void 0:o.invoicePdfUrl)??(o==null?void 0:o.hostedInvoiceUrl);return c.jsxs("div",{className:"mx-auto w-full max-w-[1000px] p-4 sm:p-6",children:[c.jsxs("div",{className:"mb-8 flex flex-wrap items-center justify-between gap-4",children:[c.jsxs(Hn,{to:ei.wallet,className:"inline-flex items-center gap-2 rounded-sm text-sm text-[var(--sand-11)] hover:text-[var(--sand-12)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4",children:[c.jsx(sBe,{"aria-hidden":"true",className:"size-4"}),"Back to wallet"]}),o&&r&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs(Zt,{variant:"secondary",onClick:()=>window.print(),children:[c.jsx(uBe,{"aria-hidden":"true",className:"mr-2 size-4"}),"Print / save PDF"]}),l&&c.jsx(Zt,{variant:"secondary",asChild:!0,children:c.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:["Original document",c.jsx(Lde,{"aria-hidden":"true",className:"ml-2 size-4"})]})})]})]}),!n||!r||a&&i.isPending?c.jsx("div",{role:"status",className:"mx-auto h-[600px] max-w-[720px] animate-pulse rounded-lg bg-[var(--sand-2)]",children:c.jsx("span",{className:"sr-only",children:"Loading invoice"})}):a?o?c.jsx(m0t,{data:{...o,customerEmail:o.customerEmail||((u=s==null?void 0:s.primaryEmailAddress)==null?void 0:u.emailAddress)||null}}):c.jsxs("div",{role:"alert",className:"py-16 text-center",children:[c.jsx("h1",{className:"text-xl text-[var(--sand-12)]",children:"Couldn’t load this document"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--sand-11)]",children:((d=i.error)==null?void 0:d.message)??"Please try again."}),c.jsx(Zt,{variant:"secondary",className:"mt-5",onClick:()=>void i.refetch(),children:"Try again"})]}):c.jsxs("div",{className:"py-16 text-center",children:[c.jsx("h1",{className:"text-xl text-[var(--sand-12)]",children:"Admin access required"}),c.jsx("p",{className:"mt-2 text-sm text-[var(--sand-11)]",children:"Only organization admins can view billing documents."})]})]})}function v0t(t){return c.jsxs(rt,{...t,children:[c.jsx("rect",{x:"2.5",y:"5.5",width:"19",height:"13",rx:"2",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M21 9C19.3431 9 18 7.65685 18 6",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M6 6C6 7.65685 4.65685 9 3 9",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M18 18C18 16.3431 19.3431 15 21 15",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),c.jsx("path",{d:"M6 18C6 16.3431 4.65685 15 3 15",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})]})}function x0t({className:t="size-[20px]"}
557){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:t,"aria-hidden":!0,children:[c.jsx("path",{d:"M12 2c-1.1 0-2 .9-2 2v.29C7.12 5.14 5 7.8 5 11v5l-1.6 1.6c-.63.63-.18 1.71.7 1.71h15.8c.89 0 1.34-1.08.71-1.71L19 16v-5c0-3.2-2.12-5.86-5-6.71V4c0-1.1-.9-2-2-2Z"}),c.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2Z"})]})}function y0t({className:t="size-[18px]"}){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":!0,children:[c.jsx("path",{d:"M12 20h9"}),c.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"})]})}function b0t({className:t="size-[18px]"}){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":!0,children:[c.jsx("path",{d:"M3 6h18"}),c.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]})}function S0t(t){return"$"+Math.round(t/100).toLocaleString("en-US")}function w0t({alerts:t=[],budgetCents:e=null,loading:n=!1,disabled:s=!1,onCreateAlert:r,onUpdateAlert:i,onDeleteAlert:a,onEditBudget:o}){const[l,u]=w.useState(!1),[d,f]=w.useState(null),[p,m]=w.useState(null),[v,x]=w.useState(""),[y,S]=w.useState(!1),[_,E]=w.useState(null),T=w.useRef(!1),k=t.length>=5,R=!s&&!n&&e!=null,I=()=>{!R||k||(f(null),x("80"),E(null),u(!0))},A=G=>{R&&(f(G.id),x(String(G.usagePercent)),E(null),u(!0))},L=parseFloat(v),j=v.trim()!==""&&!Number.isNaN(L)&&L>=1&&L<=100,F=async()=>{if(!(!j||T.current)){T.current=!0,S(!0),E(null);try{const G=Math.round(L);d===null?await(r==null?void 0:r(G)):await(i==null?void 0:i(d,G)),u(!1)}catch(G){E(G instanceof Error?G.message:"Could not save alert.")}finally{T.current=!1,S(!1)}}},O=async()=>{if(!(p===null||T.current)){T.current=!0,S(!0),E(null);try{await(a==null?void 0:a(p)),m(null)}catch(G){E(G instanceof Error?G.message:"Could not delete alert.")}finally{T.current=!1,S(!1)}}},M="cursor-pointer size-[40px] rounded-full bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex items-center justify-center transition-[transform,background-color,color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60",U=n?["Loading alerts…",""]:e==null?["You haven't set a budget yet.","You must set a budget before creating alerts."]:["No alerts yet.","Create an alert to get notified about your usage."];return c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px]",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:"Alerts"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Set up your own alerts."})]}),c.jsx("button",{type:"button",onClick:I,disabled:!R||k,title:e==null?"Set a budget first":k?"You can have up to 5 alerts":void 0,className:`shrink-0 transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] whitespace-nowrap ${!R||k?"cursor-not-allowed text-[var(--sand-10)]":"cursor-pointer active:scale-[0.97] hover:bg-[var(--sand-4)] text-[var(--sand-12)]"}`,children:"New alert"})]}),t.length===0&&c.jsxs("div",{className:"bg-[var(--sand-2)] flex flex-col items-center justify-center gap-[24px] rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] w-full text-center",children:[c.jsx(v0t,{size:20,className:"size-[20px] text-[var(--sand-12)]"}),c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-9)]",children:[U[0],U[1]&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),!n&&e==null&&o?c.jsxs(c.Fragment,{children:["You must"," ",c.jsx("button",{type:"button",onClick:o,className:"cursor-pointer text-[var(--sand-9)] underline decoration-dotted underline-offset-[3px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)]",children:"set a budget"})," ","before creating alerts."]}):U[1]]})]})]}),t.map(G=>c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex items-center justify-between gap-[16px] p-[24px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsxs("div",{className:"flex items-center gap-[8px]",children:[c.jsx(x0t,{className:"size-[20px] text-[var(--sand-12)]"}),c.jsx("span",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Email alert"})]}),c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:["You will be notified when your budget usage reaches"," ",c.jsxs("span",{className:"text-[var(--sand-12)]",children:[G.usagePercent,"%"]}),e!=null?c.jsxs(c.Fragment,{children:[" (",S0t(G.thresholdCents)," of spend)"]}):null,"."]})]}),c.jsxs("div",{className:"flex items-center gap-[8px] shrink-0",children:[c.jsx("button",{type:"button","aria-label":"Edit alert",disabled:!R||y,onClick:()=>A(G),className:`${M} text-[var(--sand-11)] hover:text-[var(--sand-12)]`,children:c.jsx(y0t,{})}),c.jsx("button",{type:"button","aria-label":"Delete alert",disabled:!R||y,onClick:()=>{m(G.id),E(null)},className:`${M} text-danger`,children:c.jsx(b0t,{})})]})]},G.id)),c.jsx(ss,{open:l,onClose:()=>!y&&u(!1),title:"When do you want to be alerted?",subtitle:"We will send you an email notification.",n
557oIcon:!0,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",disabled:y,onClick:()=>u(!1),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"submit",form:"alert-form",disabled:!j||y,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color,filter] duration-150 [transition-timing-function:var(--ease-out)] ${j&&!y?"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-10)]"}`,children:y?"Saving...":"Save"})]}),children:c.jsxs("form",{id:"alert-form",onSubmit:G=>{G.preventDefault(),F()},className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[12px] font-medium text-[14px]",children:[c.jsx("label",{className:"text-[var(--sand-10)] leading-[20px]",children:"When usage is at"}),c.jsx(yye,{value:Number(v)||80,onChange:G=>x(String(G)),min:10,max:100,step:10,suffix:"%",disabled:y,ariaLabel:"Usage threshold"})]}),_&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:_})]})}),c.jsx(ss,{open:p!==null,onClose:()=>!y&&m(null),noIcon:!0,title:"Are you sure?",subtitle:"This permanently removes the email alert. You can set it up again anytime.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",disabled:y,onClick:()=>m(null),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"button",disabled:y,onClick:()=>void O(),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",children:y?"Deleting...":"Yes, delete"})]}),children:_&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:_})})]})}const Ose=t=>Math.round(t).toLocaleString("en-US");function _0t({usedDollars:t,isLoading:e=!1,budgetCents:n,open:s,onOpenChange:r,onSaveBudget:i}={}){const a=t??0,[o,l]=w.useState(!1),u=s??o,d=I=>r?r(I):l(I),[f,p]=w.useState(""),[m,v]=w.useState(!1),[x,y]=w.useState(null),S=n==null?void 0:n/100,_=S&&S>0?Math.min(100,Math.round(a/S*100)):0;w.useEffect(()=>{u&&(p(S==null?"":String(Math.round(S))),y(null))},[u]);const E=parseFloat(f),T=f.trim()!==""&&!Number.isNaN(E)&&E>0,k=async()=>{if(!(!T||!i||m)){v(!0),y(null);try{await i(Math.round(E*100)),d(!1)}catch(I){y(I instanceof Error?I.message:"Could not save budget.")}finally{v(!1)}}},R=async()=>{if(!(!i||m||n==null)){v(!0),y(null);try{await i(null),p(""),d(!1)}catch(I){y(I instanceof Error?I.message:"Could not clear budget.")}finally{v(!1)}}};return c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex flex-col min-w-px",children:[c.jsx("div",{className:"bg-[var(--sand-3)] border-b-[0.5px] border-solid border-[var(--sand-6)] rounded-t-[12px] flex items-center px-[24px] py-[16px] w-full",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Current usage"})}),c.jsx("div",{className:"bg-[var(--sand-2)] rounded-b-[12px] flex flex-1 flex-col p-[24px] w-full",children:c.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-[24px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Used vs. budget"}),c.jsxs("div",{className:"flex flex-col gap-[8px] w-full",children:[c.jsx("div",{className:"bg-[var(--sand-4)] h-[8px] rounded-[100px] overflow-hidden w-full",children:c.jsx("div",{className:"bar-fill h-full bg-[#f5d90a] rounded-[100px] transition-[width] duration-500 [transition-timing-function:var(--ease-out)]",style:{width:`${_}%`}})}),c.jsxs("div",{className:"flex items-start justify-between w-full font-medium text-[14px] leading-[20px]",children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:e?"—":`$${Ose(a)}`}),c.jsx("span",{className:"text-[var(--sand-10)]",children:S==null?"No budget set":`$${Ose(S)} total`})]})]})]})}),c.jsx(ss,{open:u,onClose:()=>d(!1),noIcon:!0,title:"Edit budget",subtitle:"Set the credit budget you want to cap usage at.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>d(!1),disabled:m,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",children:"Cancel"}),c.jsx("button",{type:"submit",form:"edit-budget-form",disabled:!T||m,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color,filter] duration-150 [transition-timing-function:var(--ease-out)] ${T&&!m?"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-10)]"}`,children:m?"Saving...":"Save"})]}),children:c.jsxs("form",{id:"edit-budget-form",onSubmit:I=>{I.preventDefault(),k()},className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[12px] font-medium text-[14px]",children:[c.jsx("label",{className:"text-[var(--sand-10)] leading-[20px]",children:"Budget"}),c.jsxs("div",{className:"bg-[var(--sand-3)] flex gap-[10px] h-[44px] items-center pl-[12px] pr-[8px] rounded-[8px] w-full transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-within:bg-[var(--sand-4)]",children:[c.jsx("span",{className:"text-[var(--sand-12)] leading-[20px]",children:"$"}),c.jsx("input",{type:"number",inputMode:"decimal",min:1,placeholder:"e.g 500",value:f,onChange:I=>p(I.target.value),disabled:m,className:"flex-1 min-w-px bg-transparent outline-none text-[var(--sand-12)] leading-[20px] placeholder:text-[var(--sand-10)] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"}),n!=null&&c.jsx("button",{type:"button",onClick:R,disabled:m,title:"Clear the saved budget",className:"shrink-0 flex h-[26px] items-center px-[10px] rounded-[999px] bg-[var(--sand-5)] text-[12px] font-medium leading-[20px] text-[var(--sand-12)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] cursor-pointer hover:bg-[var(--sand-6)] disabled:cursor-not-allowed disabled:opacity-60",children:"Clear budget"})]})]}),x&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x})]})})]})}const BR="—";function D8(t,e){return t==null?BR:t==="unlimited"?"Unlimited":e?`${t.toLocaleStr
557ing("en-US")} ${e}`:t.toLocaleString("en-US")}function E0t(t){if(t==null)return BR;if(t==="unlimited")return"Unlimited";if(t<24)return`${t} ${t===1?"hour":"hours"}`;const e=t/24;return Number.isInteger(e)?`${e} ${e===1?"day":"days"}`:`${t} hours`}function C0t(t){if(t==null)return BR;const e=Math.round(t/6e4);if(e<60)return`${e} min`;const n=e/60;return Number.isInteger(n)?`${n} ${n===1?"hour":"hours"}`:`${e} min`}function rC(t){return t==null?BR:t?"Yes":"No"}function O8({title:t,children:e}){return c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex flex-col min-w-px",children:[c.jsx("div",{className:"bg-[var(--sand-3)] border-b-[0.5px] border-solid border-[var(--sand-6)] rounded-t-[12px] flex items-center px-[24px] py-[16px] w-full",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:t})}),c.jsx("div",{className:"bg-[var(--sand-2)] rounded-b-[12px] flex flex-1 flex-col p-[24px] w-full",children:e})]})}function Uu({label:t,value:e}){return c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:t}),c.jsx("span",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:e})]})}function T0t(){const{usedCreditDollars:t,spendDollars:e,isLoading:n,isLegacyPlan:s,planLabel:r,planConfig:i}=mu(),{createBudgetAlert:a,deleteBudgetAlert:o,getBudget:l,setBudget:u,updateBudgetAlert:d}=Yh(),[f,p]=w.useState({budgetCents:null,alerts:[]}),[m,v]=w.useState(!1),{editBudgetOpen:x,setEditBudgetOpen:y}=P9(),S=n?void 0:t||e,_=i==null?void 0:i.limits,E=i==null?void 0:i.features;w.useEffect(()=>{if(n)return;if(s){p({budgetCents:null,alerts:[]});return}let k=!1;return v(!0),l().then(R=>{k||p(R)}).catch(()=>{k||p({budgetCents:null,alerts:[]})}).finally(()=>{k||v(!1)}),()=>{k=!0}},[l,s,n]);const T=k=>p(k);return c.jsxs(c.Fragment,{children:[s&&c.jsx("div",{className:"rise-in flex gap-[16px] items-center w-full bg-[var(--blue-3)] dark:bg-[#10243e] border-[0.5px] border-solid border-[var(--blue-6)] dark:border-[#0d3868] rounded-[12px] px-[24px] py-[16px]",children:c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--blue-11)] dark:text-[#0091ff]",children:["You are currently on a legacy plan (",r??"Legacy","). 
557Credit purchases and billing limit controls are available after switching to a usage-based plan."]})}),c.jsxs("div",{className:"rise-in grid grid-cols-2 items-stretch gap-[24px] w-full",children:[c.jsx(_0t,{usedDollars:S,isLoading:n||m,budgetCents:f.budgetCents,open:x,onOpenChange:y,onSaveBudget:async k=>T(await u(k))}),c.jsx(O8,{title:"Limits",children:c.jsxs("div",{className:"grid grid-cols-2 gap-[16px]",children:[c.jsx(Uu,{label:"Requests per minute",value:D8(_==null?void 0:_.requestsPerMinute)}),c.jsx(Uu,{label:"Data retention",value:E0t(_==null?void 0:_.retentionHours)})]})}),c.jsx(O8,{title:"Features",children:c.jsxs("div",{className:"flex flex-col gap-[24px]",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-[16px]",children:[c.jsx(Uu,{label:"Concurrent browser sessions",value:D8(_==null?void 0:_.concurrency)}),c.jsx(Uu,{label:"Stealth browser",value:rC(E==null?void 0:E.coreBrowser)})]}),c.jsxs("div",{className:"grid grid-cols-3 gap-[16px]",children:[c.jsx(Uu,{label:"Reserve pools",value:rC(E==null?void 0:E.reservePools)}),c.jsx(Uu,{label:"Max session time",value:C0t(_==null?void 0:_.maxSessionMs)}),c.jsx(Uu,{label:"Profiles",value:D8(_==null?void 0:_.profiles)})]})]})}),c.jsx(O8,{title:"Security",children:c.jsxs("div",{className:"grid grid-cols-2 gap-[16px]",children:[c.jsx(Uu,{label:"Enterprise SSO",value:rC(E==null?void 0:E.enterpriseSso)}),c.jsx(Uu,{label:"HIPAA-ready BAA",value:rC(E==null?void 0:E.hipaaBaa)})]})})]}),c.jsx("div",{className:"rise-in w-full",style:{animationDelay:"130ms"},children:c.jsx(w0t,{alerts:f.alerts,budgetCents:f.budgetCents,loading:n||m,disabled:s,onEditBudget:s?void 0:()=>y(!0),onCreateAlert:async k=>T(await a(k)),onUpdateAlert:async(k,R)=>T(await d(k,R)),onDeleteAlert:async k=>T(await o(k))})})]})}function AU(t){return c.jsxs(rt,{...t,children:[c.jsx("path",{d:"M11 11H12V16M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12 7.25C11.5858 7.25 11.25 7.58579 11.25 8C11.25 8.41421 11.5858 8.75 12 8.75C12.4142 8.75 12.75 8.41421 12.75 8C12.75 7.58579 12.4142 7.25 12 7.25Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.5"})]})}const k0t="flex-1 cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] disabled:opacity-60 disabled:cursor-not-allowed",R0t="flex-1 cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed";function iC(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:t%100===0?0:2}).format(t/100)}async function A0t(t){const e=await Qc;if(!e)throw new Error("Could not load the payment form. Please refresh and try again.");const{error:n}=await e.handleNextAction({clientSecret:t});if(n)throw new Error(n.message??"We couldn't confirm this payment with your bank.")}function N0t({open:t,onClose:e,onUpgraded:n}){const[s,r]=w.useState("confirm"),[i,a]=w.useState(!0),[o,l]=w.useState(!1),[u,d]=w.useState(null),[f,p]=w.useState(null),[m,v]=w.useState(null),[x,y]=w.useState(null),[S,_]=w.useState(null),E=w.useRef(null),T=w.useRef(null),{render:k,exiting:R}=Kh(t),{createSetupIntent:I,changePlan:A,previewPlanChange:L}=Yh(),j=FR();w.useEffect(()=>{if(!t)return;let O=!1;return r("confirm"),a(!0),d(null),l(!1),p(null),v(null),y(null),Promise.all([I(),L("scale")]).then(([M,U])=>{O||(y(U),p(M.clientSecret??null),M.hasDefaultPaymentMethod&&M.paymentMethod?(v(M.paymentMethod),r("confirm")):M.clientSecret?r("payment"):d("Could not start payment setup."))}).catch(M=>{O||d(M instanceof Error?M.message:"Could not load billing details.")}).finally(()=>{O||a(!1)}),()=>{O=!0}},[t,I,L]),w.useEffect(()=>{if(!t)return;const O=U=>U.key==="Escape"&&!o&&e();document.addEventListener("keydown",O);const M=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",O),document.body.style.overflow=M}},[t,e,o]),w.useLayoutEffect(()=>{if(!k)return;const O=T.current;if(!O)return;const M=()=>_(O.scrollHeight);M();const U=new ResizeObserver(M);return U.observe(O),()=>U.disconnect()},[k,s,i,f,u,o,x]);const F=async()=>
557{if(!o){l(!0),d(null),r("submitting");try{try{await A("scale")}catch(O){if(!(O instanceof gbe))throw O;await A0t(O.clientSecret),await A("scale")}await Promise.all([Pn.invalidateQueries({queryKey:["usageDetails"]}),Pn.invalidateQueries({queryKey:["dailyBreakdown"]}),Pn.invalidateQueries({queryKey:["sessionCounts"]})]),r("success")}catch(O){d(O instanceof Error?O.message:"Could not upgrade your plan."),r("confirm")}finally{l(!1)}}};return!k||typeof document>"u"?null:nr.createPortal(c.jsx("div",{className:`${R?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:O=>{!o&&E.current&&!E.current.contains(O.target)&&e()},children:c.jsx("div",{ref:E,role:"dialog","aria-modal":"true","aria-labelledby":"upgrade-scale-title",style:S?{height:S}:void 0,className:`${R?"modal-card-out":"modal-card-in"} bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[460px] max-w-full max-h-[calc(100vh-32px)] overflow-hidden shadow-modal transition-[height] [transition-duration:360ms] [transition-timing-function:var(--ease-out)]`,children:c.jsxs("div",{ref:T,className:"p-[32px] flex flex-col gap-[24px] max-h-[calc(100vh-32px)] overflow-y-auto",children:[s!=="success"&&s!=="payment"&&c.jsx("div",{className:"flex items-start w-full",children:c.jsx(e0t,{})}),i?c.jsxs("div",{className:"flex flex-col items-center justify-center gap-[16px] py-[24px]",children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Checking your billing details"})]}):s==="payment"&&f&&Qc?c.jsxs("div",{className:"-m-[32px] flex flex-col",children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{id:"upgrade-scale-title",className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:m?"Update payment method":"Add payment method"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:m?"Save a new payment method for Scale.":"Save a payment method to upgrade to Scale."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[16px]",children:[c.jsx(ZS,{stripe:Qc,options:{clientSecret:f,appearance:j},children:c.jsx(UR,{submitting:o,setSubmitting:l,setError:d,cta:"Save payment method",onDone:O=>{v(O),r("confirm")},onBack:m?()=>{d(null),r("confirm")}:e})}),u&&c.jsx($se,{children:u})]})]}):s==="submitting"?c.jsx(I0t,{title:"Upgrading to Scale",subtitle:"Setting up your plan and credits."}):s==="success"?c.jsx(nbe,{active:!0,title:"You're on Scale",subtitle:`Your plan is active with ${iC((x==null?void 0:x.includedCreditCents)??1e4)} in monthly credits.`,cta:"Done",onDone:()=>{n(),e()}}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-[8px] font-medium",children:[c.jsx("p",{id:"upgrade-scale-title",className:"text-[20px] leading-[24px] text-[var(--sand-12)]",children:"Upgrade to Scale"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Review your plan change."})]}),c.jsxs("div",{className:"flex flex-col gap-[16px] w-full font-medium text-[14px]",children:[c.jsx(dh,{label:"Plan",value:"Scale"}),c.jsx(dh,{label:"Platform fee",value:`${iC((x==null?void 0:x.platformFee.monthlyAmountCents)??0)} / month`}),c.jsx(dh,{label:"Due today",value:iC((x==null?void 0:x.platformFee.dueTodayCents)??0)}),c.jsx(dh,{label:"Included credits",value:`${iC((x==null?void 0:x.includedCreditCents)??1e4)} / month`}),c.jsx("div",{className:"bg-[var(--sand-6)] h-[0.5px] w-full"}),c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("span",{className:"text-[var(--sand-10)] leading-[20px]",children:"Payment method"}),c.jsxs("div",{className:"flex items-center gap-[12px]",children:[c.jsx("span",{className:"text-[var(--sand-12)] leading-[20px]",children:$2(m)}),c.jsx("button",{type:"button",onClick:()=>{d(null),r("payment")},disabled:!f||o,className:"cursor-pointer text-[var(--sand-11)] hover:text-[var(--sand-12)] leading-[20px] underline [text-underline-position:from-font] transition-colors duration-150 [transition-timing-function:var(--ease-out)] disabled:cursor-not-allowed disabled:opacity-60",children:"Edit"})]})]})]}),c.jsxs("div",{className:"flex gap-[12px] w-full",children:[c.jsx("button",{type:"button",onClick:e,disabled:o,className:R0t,children:"Cancel"}),c.jsx("button",{type:"button",onClick:F,disabled:o||!m||!x,className:k0t,children:c.jsx("span",{className:"font-medium text-[var(--sand-1)] text-[14px] leading-[20px]",children:o?"Upgrading…":"Upgrade to Scale"})})]}),u&&c.jsx($se,{children:u}),c.jsx("p",{className:"font-medium text-[var(--sand-10)] text-[12px] leading-[20px] text-left w-full",children:"Billed monthly. Today's charge covers the remaining current billing period."})]})]})})}),document.body)}function I0t({title:t,subtitle:e}){return c.jsxs("div",{className:"flex flex-col items-center justify-center gap-[16px] py-[32px]",children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsxs("div",{className:"flex flex-col gap-[4px] text-center font-medium",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[16px] leading-[24px]",children:t}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:e})]})]})}function $se({children:t}){return c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:t})}const ST="minmax(0, 1.7fr) repeat(3, minmax(0, 1fr))",Nbe=[{key:"launch",name:"Launch",Icon:Bm,iconColor:"var(--plan-launch)",w:22,h:24,nameClass:"text-[var(--yellow-12)] dark:text-[#fffad1]",price:"$0",suffix:"+ usage",tagline:c.jsxs(c.Fragment,{children:["Everything you need to ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"start"})," automating browsers."]}),button:"Coming soon",buttonClass:"bg-[var(--yellow-3)] text-[var(--yellow-11)] hover:bg-[var(--yellow-4)] dark:bg-[#2c2100] dark:text-[#f0c000] dark:hover:bg-[#3a2c00]"},{key:"scale",name:"Scale",Icon:D2,iconColor:"var(--plan-scale)",w:21,h:20,nameClass:"text-[var(--blue-12)] dark:text-[#eaf6ff]",price:"$250",
557suffix:"+ usage",tagline:c.jsxs(c.Fragment,{children:["Lower rates and higher limits to ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"scale"})," in production."]}),button:"Coming soon",buttonClass:"bg-[#0091ff] text-white dark:text-[var(--sand-12)] hover:bg-[#1aa0ff]"},{key:"enterprise",name:"Enterprise",Icon:M2,iconColor:"var(--sand-10)",w:21,h:20,nameClass:"text-[var(--sand-12)]",price:"Custom",suffix:"",tagline:c.jsxs(c.Fragment,{children:["Custom rates, security, and support for ",c.jsx("span",{className:"text-[var(--sand-12)]",children:"teams"})," ","at scale."]}),button:"Contact Sales",buttonClass:"bg-[var(--sand-4)] text-[var(--sand-12)] hover:bg-[var(--sand-5)]"}];function L0t(t,e){return t==="launch"?e==="scale"?"Downgrade to Launch":"Switch to Launch":t==="scale"?"Upgrade to Scale":t==="enterprise"?"Contact Sales":"Coming soon"}const j0t=[{title:"Included usage",rows:[{label:"Free usage credits",cells:[{value:"$30",note:"(one time)"},{value:"$100",note:"/ month"},"Custom"]}]},{title:"Rates",rows:[{label:"Browser hours",cells:["$0.10","$0.08","Custom"]},{label:"Proxy bandwidth",cells:["$10/GB","$6/GB","Custom"]},{label:"Captcha solves",cells:["$3/1k","$1/1k","Custom"]},{label:"Browser tools (",mono:"/scrape",tail:")",tip:"Browser tools such as /scrape and /extract are billed per 1,000 calls.",cells:["$5/1k","$5/1k","Custom"]}]},{title:"Features",rows:[{label:"Concurrent browser sessions",cells:["10",{value:"100",tip:"Need more than 100 concurrent sessions? Contact sales to raise your limit."},"1,000+"]},{label:"Stealth browser",tip:"Advanced anti-detection browser for sites with strong bot protection.",cells:[!1,!1,!0]},{label:"Dedicated IPs",cells:[!1,"$5/IP","Custom"]},{label:"Max session time",cells:["15 minutes","1 hour","Up to 24 hours"]},{label:"Number of seats",cells:["Up to 3","Unlimited","Unlimited"]},{label:"Reserve browser pools",cells:[!1,!1,!0]}]},{title:"Limits",rows:[{label:"Requests per minute",cells:["60","600","Custom"]},{label:"Data retention",cells:["7 days","14 days","Custom"]}]},{title:"Support",rows:[{label:"Email support",cells:[!0,!0,!0]},{label:"Community support",cells:[!0,!0,!0]},{label:"Dedicated Slack channel",cells:[!1,!0,!0]},{label:"911 email",cells:[!1,!1,!0]},{label:"Support & uptime SLAs",cells:[!1,!1,!0]}]},{title:"Security",rows:[{label:"Enterprise SSO",cells:[!1,!0,!0]},{label:"HIPAA-ready BAA",cells:[!1,!0,!0]}]}],_f="flex items-center gap-[10px] px-[24px] py-[12px] h-[48px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px]";function Ibe({text:t}){return c.jsxs(Sb,{children:[c.jsx(wb,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":t,className:"inline-flex items-center text-[var(--sand-11)] curs
557or-default focus:outline-none",children:c.jsx(AU,{size:16})})}),c.jsx(ov,{side:"top",className:"max-w-[260px] bg-[var(--sand-3)] border-[0.5px] border-solid border-[var(--sand-6)] text-[var(--sand-12)] text-[12px] leading-[16px]",children:t})]})}function P0t(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"var(--sand-12)"}),c.jsx("path",{d:"M15 9.5L10.5 15L8.5 13",stroke:"var(--sand-1)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function M0t({cell:t}){return t===!0?c.jsx(P0t,{}):t===!1?c.jsx("span",{className:"text-[var(--sand-9)]",children:"-"}):typeof t=="string"?c.jsx("span",{className:"text-[var(--sand-12)]",children:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:t.value}),t.note&&c.jsx("span",{className:"text-[var(--sand-11)]",children:t.note}),t.tip&&c.jsx(Ibe,{text:t.tip})]})}function D0t({currentPlan:t,onSelectPlan:e,pendingPlan:n,loading:s=!1}){return c.jsxs("div",{className:"grid w-full",style:{gridTemplateColumns:ST},children:[c.jsx("div",{}),Nbe.map(r=>{const i=t===r.key,a=r.key==="launch"||r.key==="scale"||r.key==="enterprise",o=n===r.key,l=r.key==="launch"||r.key==="scale",u=i||o||!a||s&&l;return c.jsxs("div",{className:"flex flex-col px-[24px]",children:[c.jsxs("div",{className:"flex flex-col gap-[12px]",children:[c.jsxs("div",{className:"flex gap-[6px] items-center",children:[c.jsx(r.Icon,{color:r.iconColor,width:r.w,height:r.h}),c.jsx("span",{className:`font-medium text-[20px] leading-[24px] ${r.nameClass}`,children:r.name})]}),c.jsxs("div",{className:"flex gap-[4px] items-end font-medium text-[16px] leading-[24px] whitespace-nowrap",children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:r.price}),c.jsx("span",{className:"text-[var(--sand-11)]",children:r.suffix})]}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-9)]",children:r.tagline})]}),c.jsx("div",{className:"pt-[16px]",children:c.jsx("button",{disabled:u,onClick:()=>{if(r.key==="enterprise"){window.open("https://cal.com/hussien-hussien-fjxt3x/steel-enterprise-demo","_blank");return}(r.key==="launch"||r.key==="scale")&&e(r.key)},className:i?"cursor-not-allowed flex h-[40px] items-center justify-center w-full rounded-[8px] bg-[var(--sand-3)] font-medium text-[14px] leading-[20px] text-[var(--sand-9)]":a?`cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] flex h-[40px] items-center justify-center w-full rounded-[8px] font-medium text-[14px] leading-[20px] ${r.buttonClass}`:"cursor-not-allowed flex h-[40px] items-center justify-center w-full rounded-[8px] bg-[var(--sand-3)] font-medium text-[14px] leading-[20px] text-[var(--sand-9)]",children:i?"Current Plan":o?"Changing...":s&&l?"Loading…":L0t(r.key,t)})})]},r.name)})]})}const O0t={starter:"Starter",developer:"Developer",pro:"Startups",enterprise:"Enterprise"};function $0t({currentPlan:t,loading:e=!1}={}){const{changePlan:n}=Yh(),[s,r]=w.useState(null),[i,a]=w.useState(!1),[o,l]=w.useState(null),[u,d]=w.useState(!1),f=t?O0t[t]:void 0,p=async()=>{await Promise.all([Pn.invalidateQueries({queryKey:["usageDetails"]}),Pn.invalidateQueries({queryKey:["dailyBreakdown"]}),Pn.invalidateQueries({queryKey:["sessionCounts"]})])},m=async()=>{r("launch"),l(null);try{await n("launch"),await p(),a(!1)}catch(x){l(x instanceof Error?x.message:"Could not switch to Launch.")}finally{r(null)}},v=async x=>{if(!e){if(x==="scale"){d(!0);return}l(null),a(!0)}};return c.jsx(vF,{delayDuration:0,children:c.jsxs("div",{className:"flex flex-col gap-[32px] w-full",children:[c.jsx(Abe,{open:i,currentPlan:t,submitting:s==="launch",error:o,onClose:()=>{s||(a(!1),l(null))},onConfirm:m}),c.jsx(N0t,{open:u,onClose:()=>d(!1),onUpgraded:()=>{Pn.invalidateQueries({queryKey:["usageDetails"]})}}),f&&c.jsx("div",{className:"rise-in flex gap-[16px] items-center w-full bg-[var(--blue-3)] dark:bg-[#10243e] border-[0.5px] border-solid border-[var(--blue-6)] dark:border-[#0d3868] rounded-[12px] px-[24px] py-[16px]",children:c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--blue-11)] dark:text-[#0091ff]",children:["You are currently on a legacy plan (",f,"). Select another plan below."]})}),c.jsx("div",{className:"rise-in",style:{animationDelay:"65ms"},children:c.jsx(D0t,{currentPlan:t,onSelectPlan:v,pendingPlan:s,loading:e})}),c.jsxs("div",{className:"rise-in border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden w-full",style:{animationDelay:"130ms"},children:[c.jsxs("div",{className:"grid w-full",style:{gridTemplateColumns:ST},children:[c.jsx("div",{className:`${_f} bg-[var(--sand-2)]`}),Nbe.map(x=>c.jsx("div",{className:`${_f} bg-[var(--sand-2)] text-[var(--sand-12)] border-l-[0.5px]`,children:x.name},x.name))]}),j0t.map(x=>c.jsxs("div",{children:[c.jsxs("div",{className:"grid w-full",style:{gridTemplateColumns:ST},children:[c.jsx("div",{className:`${_f} bg-[var(--sand-2)] font-semibold text-[var(--sand-12)]`,children:x.title}),c.jsx("div",{className:`${_f} border-l-[0.5px]`}),c.jsx("div",{className:`${_f} border-l-[0.5px]`}),c.jsx("div",{className:`${_f} border-l-[0.5px]`})]}),x.rows.map(y=>c.jsxs("div",{className:"grid w-full",style:{gridTemplateColumns:ST},children:[c.jsxs("div",{className:`${_f} bg-[var(--sand-2)] text-[var(--sand-11)]`,children:[c.jsx("span",{className:"truncate min-w-0",children:y.mono?c.jsxs(c.Fragment,{children:[y.label,c.jsx("span",{className:"font-semibold text-[var(--sand-12)]",children:y.mono}),y.tail]}):y.label}),y.tip&&c.jsx(Ibe,{text:y.tip})]}),y.cells.map((S,_)=>c.jsx("div",{className:`${_f} border-l-[0.5px]`,children:c.jsx(M0t,{cell:S})},_))]},y.label))]},x.title))]})]})})}function F0t(){const{plan:t,isLoading:e}=mu();return c.jsx($0t,{currentPlan:e?void 0:t,loading:e})}function F2(t){return t.data===void 0&&!t.isError}function U0t(t,e=!0){const{getToken:n,isLoaded:s,isSignedIn:r,orgId:i}=zt(),a=w.useCallback(async()=>
557{if(!await n())throw new Error("Unauthorized");const{data:l,error:u}=await cXe({query:{start_date:t.startDate,end_date:t.endDate,bucket:t.bucket,project_id:t.projectId??void 0}});if(u)throw new Error(typeof u=="object"&&u&&"message"in u?String(u.message):"Failed to fetch session counts");if(!l)throw new Error("No data returned from session counts endpoint");return l},[n,t.bucket,t.endDate,t.startDate,t.projectId]);return rs({queryKey:to.sessionCounts(i,t.startDate,t.endDate,t.bucket,t.projectId??null),queryFn:a,enabled:e&&s&&!!r&&!!i,staleTime:6e4,placeholderData:(o,l)=>K1(o,l,i,1),refetchOnWindowFocus:!1})}const B0t=8;function yh({className:t="",style:e}){return c.jsx("span",{"aria-hidden":!0,className:`billing-skeleton block ${t}`,style:e})}function Lbe({columns:t,cellClass:e,rows:n=B0t}){return c.jsx(c.Fragment,{children:Array.from({length:n},(s,r)=>c.jsx("div",{className:"flex w-full min-w-0",children:Array.from({length:t},(i,a)=>c.jsx("div",{className:`${e} ${a===0?"bg-[var(--sand-3)]":"border-l-[0.5px]"}`,children:c.jsx(yh,{className:"h-[12px] w-full max-w-[104px] rounded-[4px]"})},a))},r))})}function gd({label:t,value:e,loading:n}){return c.jsxs("div",{className:"flex flex-col gap-[8px] shrink-0",children:[c.jsx("p",{className:"font-medium text-[var(--sand-11)] text-[14px] leading-[20px] whitespace-nowrap",children:t}),n?c.jsx(yh,{className:"h-[24px] w-[88px] my-[8px] rounded-[8px]"}):c.jsx("p",{className:"font-medium text-[var(--sand-12)] text-[32px] leading-[40px] whitespace-nowrap",children:e})]})}const jbe=["Jan","Feb","Mar","Apr","May","Jun"],z0t=["January","February","March","April","May","June"],wy=jbe.length,V0t=t=>"$"+Math.round(t).toLocaleString("en-US"),H0t=t=>t>0&&t<1?`$${t.toFixed(2)}`:V0t(t),G0t=240,Fse=[38,62,47,80,55,30,68,44,72,51,35,60,85,42,57,33,74,49,65,40,78,53,36,59];function W0t(){return c.jsxs("div",{className:"flex flex-col gap-[8px] w-full min-w-0",children:[c.jsxs("div",{className:"flex gap-[8px] h-[140px]",children:[c.jsx("div",{className:"flex flex-col justify-between items-end w-[36px] shrink-0 -my-[7px]",children:[0,1,2].map(t=>c.jsx(yh,{className:"h-[10px] w-[28px] rounded-[4px]"},t))}),c.jsx("div",{className:"relative flex-1 min-w-0 flex items-end gap-[4px]",children:Fse.map((t,e)=>c.jsx(yh,{className:"flex-1 rounded-t-[4px]",style:{height:`${t}%`}},e))})]}),c.jsx("div",{className:"flex gap-[4px] pl-[44px]",children:Fse.map((t,e)=>c.jsx("span",{className:"flex-1 flex justify-center",children:e%5===0&&c.jsx(yh,{className:"h-[10px] w-[32px] rounded-[4px]"})},e))})]})}function q0t({lines:t,money:e=!1,labels:n=jbe,fullLabels:s=z0t,axisLabels:r=n,animationKey:i}){const[a,o]=w.useState(null),l=w.useRef(0),u=n.length,d=u>60?2:u>24?3:u>12?4:6,f=u>1?G0t/(u-1):0,p=I=>e?H0t(I):Math.round(I).toLocaleString("en-US"),m=n.map((I,A)=>t.reduce((L,j)=>L+j.data[A],0)),v=Math.max(...m,e?.01:1),x=10**Math.floor(Math.log10(v)),y=Math.max(Math.ceil(v/x)*x,e?.01:1),S=[y,y/2,0];a!==null&&(l.current=a);const _=a??l.current,E=(_+.5)/u*100,T=E>82?"translateX(-80%)":"translateX(-50%)",k={},R=r.length;return r.forEach((I,A)=>{const L=R<=1?0:Math.round(A/(R-1)*(u-1));k[L]=I}),c.jsxs("div",{className:"flex flex-col gap-[8px] w-full min-w-0",children:[c.jsxs("div",{className:"flex gap-[8px] h-[140px]",children:[c.jsx("div",{className:"flex flex-col justify-between items-end text-[var(--sand-10)] text-[11px] leading-[14px] w-[36px] shrink-0 -my-[7px]",children:S.map(I=>c.jsx("span",{children:p(I)},I))}),c.jsxs("div",{className:"relative flex-1 min-w-0 cursor-crosshair flex items-end gap-[8px]",style:{gap:d},onMouseLeave:()=>o(null),children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 bottom-0 z-0",children:S.map((I,A)=>c.jsx("div",{className:"absolute left-0 right-0 h-px bg-[var(--sand-4)]",style:{top:`${A/(S.length-1)*100}%`}},I))}),n.map((I,A)=>{const L=a!==null&&a!==A,j=m[A]<=0,F=j?0:m[A]/y*100;return c.jsx("div",{className:"relative flex-1 flex items-end h-full",onMouseEnter:()=>o(A),children:j?c.jsx("div",{className:"bar-rise relative z-[1] w-full h-[4px] rounded-[4px] bg-[var(--sand-6)] transition-opacity duration-150 [transition-timing-function:var(--ease-out)]",style:{opacity:L?.25:1,animationDelay:`${A*f}ms`}}):c.jsx("div",{className:"bar-rise relative z-[1] w-full flex flex-col-reverse overflow-hidden rounded-t-[4px] transition-opacity duration-150 [transition-timing-function:var(--ease-out)]",style:{height:`${F}%`,opacity:L?.25:1,animationDelay:`${A*f}ms`},children:t.map(O=>c.jsx("div",{style:{height:`${O.data[A]/m[A]*100}%`,background:O.color}},O.label))})},`${I}-${A}`)}),c.jsx("div",{className:"absolute bottom-full mb-[8px] z-10 pointer-events-none max-w-[min(260px,calc(100vw-48px))] transition-[left,opacity,transform] duration-150 [transition-timing-function:var(--ease-out)]",style:{left:`${E}%`,opacity:a!==null?1:0,transform:T},children:c.jsxs("div",{className:"whitespace-nowrap overflow-hidden rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] px-[12px] py-[10px] flex flex-col gap-[8px] min-w-[160px] shadow-popover",children:[c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[12px] leading-[16
557px]",children:s[_]}),c.jsx("div",{className:"h-px -mx-[12px] bg-[var(--sand-6)]"}),[...t].reverse().map(I=>c.jsxs("div",{className:"flex items-center justify-between gap-[16px]",children:[c.jsxs("div",{className:"flex items-center gap-[8px]",children:[c.jsx("span",{className:"size-[10px] rounded-full shrink-0",style:{background:I.color}}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-12)] dark:text-[var(--line-color)]",style:{"--line-color":I.color},children:I.tooltipLabel??I.label})]}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-12)] dark:text-[var(--line-color)]",style:{"--line-color":I.color},children:p(I.data[_])})]},I.label))]})})]},i)]}),c.jsx("div",{className:"flex pl-[44px] text-[var(--sand-10)] text-[11px] leading-[14px]",style:{gap:d},children:n.map((I,A)=>c.jsx("span",{className:"flex-1 text-center whitespace-nowrap",children:k[A]??""},A))})]})}function K0t({lines:t}){const e=t.length>5;return c.jsxs("div",{className:"relative w-full",children:[c.jsx("div",{className:`flex gap-[24px] ${e?"overflow-x-auto pr-[40px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"flex-wrap"}`,children:t.map(n=>c.jsxs("div",{className:"flex items-center gap-[8px] shrink-0",children:[c.jsx("span",{className:"size-[16px] rounded-full shrink-0",style:{background:n.color}}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-11)] whitespace-nowrap",children:n.label})]},n.label))}),e&&c.jsx("div",{className:"pointer-events-none absolute right-0 top-0 bottom-0 w-[40px] bg-gradient-to-l from-[var(--sand-2)] to-transparent"})]})}function Use({title:t,summary:e,lines:n,money:s=!1,labels:r,fullLabels:i,axisLabels:a,animationKey:o,loading:l}){return c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex flex-1 flex-col min-w-px",children:[c.jsxs("div",{className:"bg-[var(--sand-3)] border-b-[0.5px] border-solid border-[var(--sand-6)] rounded-t-[12px] flex items-center justify-between gap-[12px] px-[24px] py-[16px] w-full",children:[c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:t}),l?c.jsx(yh,{className:"h-[14px] w-[76px] my-[3px] rounded-[4px]"}):c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)] whitespace-nowrap",children:e})]}),c.jsxs("div",{className:"flex flex-col gap-[16px] p-[24px] w-full rounded-b-[12px]",children:[l?c.jsx(W0t,{}):c.jsx(q0t,{lines:n,money:s,labels:r,fullLabels:i,axisLabels:a,animationKey:o}),c.jsx(K0t,{lines:n})]})]})}const _y=t=>"$"+t.toFixed(2),Ef="flex flex-1 items-center min-w-px p-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",aC=30;function Y0t({tz:t,rows:e,dates:n,dateHeader:s="Date",loading:r}){const[i,a]=w.useState(0),o=e??[],l=n??[],u=o.length,d=Math.max(1,Math.ceil(u/aC)),f=i*aC,p=o.slice(f,f+aC),m=[s,"Browser","Proxy","Captcha","Scrapes","Total cost"],v=x=>`flex h-[36px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] ${x?"cursor-not-allowed bg-[var(--sand-3)] text-[var(--sand-8)]":"cursor-pointer active:scale-[0.97] bg-[var(--sand-3)] text-[var(--sand-12)] hover:bg-[var(--sand-4)]"}`;return c.jsxs("div",{className:"flex flex-col gap-[12px] w-full",children:[c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full",children:[c.jsx("div",{className:"flex w-full",children:m.map((x,y)=>c.jsx("div",{className:`${Ef} bg-[var(--sand-3)] text-[var(--sand-12)] ${y>0?"border-l-[0.5px]":""}`,children:x},x))}),r?c.jsx(Lbe,{columns:m.length,cellClass:Ef}):p.map((x,y)=>{const S=f+y;return c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${Ef} bg-[var(--sand-3)] text-[var(--sand-12)]`,children:l[S]??"—"}),c.jsxs("div",{className:`${Ef} border-l-[0.5px] text-[var(--sand-12)]`,children:[x.bMin," min / ",c.jsx("span",{className:"text-[var(--sand-10)]",children:_y(x.bCost)})]}),c.jsxs("div",{className:`${Ef} border-l-[0.5px] text-[var(--sand-12)]`,children:[x.pGB.toFixed(3),"GB /"," ",c.jsx("span",{className:"text-[var(--sand-10)]",children:_y(x.pCost)})]}),c.jsxs("div",{className:`${Ef} border-l-[0.5px] text-[var(--sand-12)]`,children:[x.cSolves," solves /"," ",c.jsx("span",{className:"text-[var(--sand-10)]",children:_y(x.cCost)})]}),c.jsxs("div",{className:`${Ef} border-l-[0.5px] text-[var(--sand-12)]`,children:[x.scrapes," / ",c.jsx("span",{className:"text-[var(--sand-10)]",children:_y(x.sCost)})]}),c.jsx("div",{className:`${Ef} border-l-[0.5px] text-[var(--sand-12)]`,children:_y(x.total)})]},S)})]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[r?c.jsx(yh,{className:"h-[14px] w-[220px] my-[3px] rounded-[4px]"}):c.jsxs("span",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px]",children:["Showing"," ",l&&u>0?`${l[Math.min(f+aC,u)-1]} – ${l[f]}
557`:"…"," ","(",t,")"]}),!r&&d>1&&c.jsxs("div",{className:"flex gap-[8px] items-center shrink-0",children:[c.jsx("button",{type:"button",onClick:()=>a(x=>Math.max(0,x-1)),disabled:i===0,className:v(i===0),children:"Previous"}),c.jsx("button",{type:"button",onClick:()=>a(x=>Math.min(d-1,x+1)),disabled:i>=d-1,className:v(i>=d-1),children:"Next"})]})]})]})}function Z0t({data:t,loading:e}){const[n,s]=w.useState("your timezone");return w.useEffect(()=>{var r;try{const i=(r=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(a=>a.type==="timeZoneName"))==null?void 0:r.value;i&&s(i)}catch{}},[]),c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px]",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:(t==null?void 0:t.breakdownTitle)??"Usage breakdown"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:(t==null?void 0:t.breakdownDescription)??"Usage details for the selected range"})]}),c.jsx("button",{type:"button",onClick:()=>{t&&(t.exportCsv(),Ao({title:"CSV Exported",duration:1e3}))},disabled:!t||e,className:"cursor-pointer shrink-0 transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[36px] items-center px-[12px] rounded-[8px] disabled:cursor-not-allowed disabled:opacity-50",children:c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Export as CSV"})})]}),c.jsx(Y0t,{tz:n,rows:t==null?void 0:t.dailyRows,dates:t==null?void 0:t.dailyDates,dateHeader:t==null?void 0:t.breakdownDateHeader,loading:e})]})}function X0t({data:t,sessionsAnimationKey:e,costAnimationKey:n,loading:s}={}){const r=t==null?void 0:t.trend,i=[{label:"All projects",color:"#0091ff",data:r?r.sessions:new Array(wy).fill(0),tooltipLabel:(r==null?void 0:r.sessionTitle)??"Sessions"}],a=[{label:"Browser minutes",color:"#fde047",data:r?r.cost.browser:new Array(wy).fill(0)},{label:"Proxy bandwidth",color:"#eab308",data:r?r.cost.proxy:new Array(wy).fill(0)},{label:"Captcha solves",color:"#a16207",data:r?r.cost.captcha:new Array(wy).fill(0)},{label:"Scrapes",color:"#713f12",data:r?r.cost.scrape:new Array(wy).fill(0)}],o=(t==null?void 0:t.stats)??[{label:"Spend",value:"$0"},{label:"Sessions",value:"0"},{label:"Browser minutes",value:"0"},{label:"Proxy bandwidth",value:"0.00 GB"},{label:"Captcha solves",value:"0"},{label:"Scrapes",value:"0"}];return c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsx("div",{className:"rise-in flex flex-wrap gap-[24px]",children:o.map(l=>c.jsx(gd,{label:l.label,value:l.value,loading:s},l.label))}),c.jsxs("div",{className:"rise-in flex gap-[24px] items-stretch w-full min-w-0",style:{animationDelay:"130ms"},children:[c.jsx(Use,{title:(r==null?void 0:r.sessionTitle)??"Sessions",summary:r?r.sessionSummary:"0 avg.",lines:i,labels:r==null?void 0:r.labels,fullLabels:r==null?void 0:r.fullLabels,axisLabels:r==null?void 0:r.axisLabels,animationKey:e,loading:s}),c.jsx(Use,{title:"Organization usage",summary:r?r.costSummary:"$0 avg.",lines:a,money:!0,labels:r==null?void 0:r.labels,fullLabels:r==null?void 0:r.fullLabels,axisLabels:r==null?void 0:r.axisLabels,animationKey:n,loading:s})]}),c.jsx("div",{className:"rise-in",style:{animationDelay:"260ms"},children:c.jsx(Z0t,{data:t,loading:s})})]})}const $8=6,Pbe=3600*1e3,Q0t=24*Pbe;function J0t(t,e,n,s){if(e.bucketSize==="hour")return t.toLocaleTimeString("en-US",{hour:"numeric"}).replace(" ","");if(e.bucketSize==="fourHours"||e.bucketSize==="sixHours"){const r=t.toLocaleDateString("en-US",{month:"short",day:"numeric"}),i=t.toLocaleTimeString("en-US",{hour:"numeric"}).replace(" ","");return s<=6&&e.label==="Last 24h"?i:`${r} ${i}`}return e.bucketSize==="week"?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):s<=31?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):s<=90?n%7===0||n===s-1?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):"":t.getUTCDate()===1||n===0||n===s-1?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):""}function evt(t,e){return e.bucketSize==="day"?t.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}
557):t.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric"})}function zR(t){return Bpt(t.bucketSize)}function tvt(t){const e=zR(t),n=Math.max(1,Math.ceil((t.end.getTime()-t.start.getTime())/e));return Array.from({length:n},(s,r)=>{const i=t.start.getTime()+r*e,a=Math.min(t.end.getTime(),i+e),o=new Date(i);return{startMs:i,endMs:a,label:J0t(o,t,r,n),fullLabel:evt(o,t),agg:{browser:0,proxy:0,captcha:0,scrape:0},sessionCount:0}})}function oC(t,e,n,s){const r=zR(e),i=e.start.getTime();for(const a of(s==null?void 0:s.data)??[]){const o=a.start_time*1e3,l=Math.floor((o-i)/r);l<0||l>=t.length||(t[l].agg[n]+=a.aggregated_value)}}function nvt(t,e,n){const s=zR(e),r=e.start.getTime(),i=e.end.getTime();for(const a of n){const o=a.start_time*1e3;if(o<r||o>=i)continue;const l=Math.floor((o-r)/s);l>=0&&l<t.length&&(t[l].sessionCount+=a.count)}}function Bse({range:t,browser:e,proxy:n,captcha:s,scrape:r,sessionCounts:i=[]}){const a=tvt(t);return oC(a,t,"browser",e),oC(a,t,"proxy",n),oC(a,t,"captcha",s),oC(a,t,"scrape",r),nvt(a,t,i),a}function lC(t){var e;return((e=t==null?void 0:t.data)==null?void 0:e.reduce((n,s)=>n+s.aggregated_value,0))??0}function svt(t,e){const n=t/Pbe;if(n<48)return`${Math.max(1,Math.round(n))}h`;const s=t/Q0t;if(s<14)return`${Math.max(1,Math.round(s))}d`;const r=s/7;return`${Math.max(1,Math.round(r))}w`}function zse(t){return t>0&&t<1?Jet(t):Qet(t)}function rvt(t){return t.bucketSize==="week"?"Sessions per week":t.bucketSize==="hour"?"Sessions per hour":"Sessions per day"}function ivt(t,e){return e.bucketSize==="hour"||e.bucketSize==="fourHours"?t.toLocaleTimeString("en-US",{hour:"numeric"}).replace(" ",""):e.bucketSize==="sixHours"?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):t.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function avt(t){const e=t.end.getTime()-t.start.getTime();return Array.from({length:$8},(n,s)=>{const r=s/($8-1),i=s===$8-1?t.end.getTime()-1:t.start.getTime()+e*r;return ivt(new Date(i),t)})}function ovt(t){return t.bucketSize==="hour"?{breakdownTitle:"Hourly breakdown",breakdownDescription:"Hour-by-hour breakdown on your browser usage",breakdownDateHeader:"Time"}:t.bucketSize==="sixHours"?{breakdownTitle:"6-hour breakdown",breakdownDescription:"Six-hour breakdown on your browser usage",breakdownDateHeader:"Time"}:{breakdownTitle:"Daily breakdown",breakdownDescription:"Day-by-day breakdown on your browser usage",breakdownDateHeader:"Date"}}function lvt(t){return t.bucketSize==="hour"?"hour":t.bucketSize==="week"?"week":"day"}function cvt(t,e,n){return[...t].reverse().map(({agg:s})=>{const r=e==="second"?s.browser/60:s.browser,i=s.browser*n.browser,a=s.proxy*n.proxy,o=s.captcha*n.captcha,l=s.scrape*n.scrape;return{bMin:Math.round(r),bCost:i,pGB:s.proxy/1e9,pCost:a,cSolves:Math.round(s.captcha),cCost:o,scrapes:Math.round(s.scrape),sCost:l,total:i+a+o+l}})}function uvt(){const t=P9();return{usageRange:(t==null?void 0:t.usageRange)??"Last 24h",usageProjectId:t==null?void 0:t.usageProjectId,editBudgetOpen:(t==null?void 0:t.editBudgetOpen)??!1,setEditBudgetOpen:(t==null?void 0:t.setEditBudgetOpen)??(()=>{})}}function dvt(){const{usageRange:t,usageProjectId:e}=uvt(),n=w.useMemo(()=>EU(t),[t]),s=w.useMemo(()=>({...n,bucketSize:n.chartBucketSize}),[n]),r=w.useMemo(()=>({startDate:n.startDate,endDate:n.endDate,granularity:n.granularity}),[n.endDate,n.granularity,n.startDate]),i=mu(),a=_U(r,!0,e),o=U0t({startDate:s.start.toISOString(),endDate:s.end.toISOString(),bucket:lvt(s),projectId:e}),l=w.useMemo(()=>{var q;const m=a.data,v=(m==null?void 0:m.browserUsageUnit)??i.browserUsageUnit,x=((q=o.data)==null?void 0:q.buckets)??[],y=Bse({range:n,browser:m==null?void 0:m.browserUsageDetails,proxy:m==null?void 0:m.proxyUsageDetails,captcha:m==null?void 0:m.captchaUsageDetails,scrape:m==null?void 0:m.scrapeUsageDetails}),S=Bse({range:s,browser:m==null?void 0:m.browserUsageDetails,proxy:m==null?void 0:m.proxyUsageDetails,captcha:m==null?void 0:m.captchaUsageDetails,scrape:m==null?void 0:m.scrapeUsageDetails,sessionCounts:x}),_=lC(m==null?void 0:m.browserUsageDetails),E=lC(m==null?void 0:m.proxyUsageDetails),T=lC(m==null?void 0:m.captchaUsageDetails),k=lC(m==null?void 0:m.scrapeUsageDetails),R=v==="second"?_/60:_,I=E/1e9,A=S.reduce((z,D)=>z+D.sessionCount,0),L=_*i.rates.browser+E*i.rates.proxy+T*i.rates.captcha+k*i.rates.scrape,j=cvt(y,v,i.rates),F=[...y].reverse().map(z=>z.fullLabel),O={browser:S.map(z=>z.agg.browser*i.rates.browser),proxy:S.map(z=>z.agg.proxy*i.rates.proxy),captcha:S.map(z=>z.agg.captcha*i.rates.captcha),scrape:S.map(z=>z.agg.scrape*i.rates.scrape)},M=Math.max(1,S.length),U=zR(s),G=svt(U),$={labels:S.map(z=>z.label),fullLabels:S.map(z=>z.fullLabel),axisLabels:avt(s),cost:O,sessions:S.map(z=>z.sessionCount),costSummary:`${zse(L/M)}/${G} avg.`,sessionSummary:`${Math.round(A/M)}/${G} avg.`,sessionTitle:rvt(s)};return{stats:[{label:"Spend",value:zse(L)}
557,{label:"Sessions",value:A.toLocaleString("en-US")},{label:"Browser minutes",value:X$(R)},{label:"Proxy bandwidth",value:`${I.toFixed(I>=10?0:2)} GB`},{label:"Captcha solves",value:T.toLocaleString("en-US")},{label:"Scrapes",value:k.toLocaleString("en-US")}],dailyRows:j,dailyDates:F,exportCsv:()=>{if(typeof document>"u")return;const z=[n.bucketSize==="day"?"Date":"Time","Browser (min)","Browser ($)","Proxy (GB)","Proxy ($)","Captcha (solves)","Captcha ($)","Scrapes","Scrapes ($)","Total Cost ($)"],D=j.map((ne,Q)=>[F[Q],ne.bMin,ne.bCost.toFixed(2),ne.pGB.toFixed(3),ne.pCost.toFixed(2),ne.cSolves,ne.cCost.toFixed(2),ne.scrapes,ne.sCost.toFixed(2),ne.total.toFixed(2)].join(",")),K=[z.join(","),...D].join(`
558`),Y=URL.createObjectURL(new Blob([K],{type:"text/csv"})),J=document.createElement("a");J.href=Y,J.download=`${n.label.toLowerCase().replace(/\s+/g,"-")}-usage.csv`,J.click(),URL.revokeObjectURL(Y)},trend:$,...ovt(n)}},[i,a.data,o.data,n,s]),u=e??"all",d=`${u}:${o.dataUpdatedAt}`,f=`${u}:${a.dataUpdatedAt}`,p=i.isLoading||F2(a)||F2(o);return c.jsx(X0t,{data:l,sessionsAnimationKey:d,costAnimationKey:f,loading:p})}const fvt="https://api.us-east.aws.tinybird.co",hvt=27e4,pvt=3e5,mvt=["analytics","tinybird_token"];function _i(t){if(!Number.isFinite(t)||t<=0)return"0 B";const e=["B","KB","MB","GB","TB"],n=1024,s=Math.min(Math.floor(Math.log(t)/Math.log(n)),e.length-1),r=t/n**s,i=s===0||r>=100?0:r>=10?1:2;return`${r.toFixed(i)} ${e[s]}`}function NU(t){switch(t){case"decodo":return"Decodo";case"nst":return"NST";case"massive":return"Massive";case"fizzy":return"Fizzy";case"nimble":return"Nimble";case"mixed":return"Mixed";case"unknown":case void 0:case"":return"Unknown";default:return t}}function Vse(t){return t==null?void 0:t.toISOString().slice(0,19).replace("T"," ")}async function gvt(t,e,n){const s=new URL(`${fvt}/v0/pipes/${t}.json`);for(const[i,a]of Object.entries(e))a!==void 0&&a!==""&&s.searchParams.set(i,String(a));const r=await fetch(s.toString(),{headers:{Authorization:`Bearer ${n}`}});if(!r.ok){const i=await r.text();throw new Error(`Analytics [${t}] error ${r.status}: ${i}`)}return await r.json()}function VR(){const{getToken:t,isLoaded:e,isSignedIn:n,orgId:s}=zt();return rs({queryKey:to.analyticsToken(s),queryFn:async()=>{if(!await t())throw new Error("Unauthorized");const i=await NZe({throwOnError:!0});if(!i.data)throw new Error("Unable to fetch Tinybird token");return i.data},enabled:e&&!!n&&!!s,staleTime:hvt,gcTime:pvt,refetchOnWindowFocus:!1,retry:1})}function HR(){const t=aa();return w.useCallback(async(e,n,s)=>{try{return await gvt(e,n,s)}catch(r){throw r instanceof Error&&r.message.includes("403")&&t.invalidateQueries({queryKey:mvt}),r}},[t])}function Mbe(t,e=!0){const{orgId:n}=zt(),{data:s}=VR(),r=HR(),i=s==null?void 0:s.token;return rs({queryKey:to.analytics(n,"customer_usage",t),queryFn:()=>r("customer_usage",{start_date:t.start_date,end_date:t.end_date},i),enabled:e&&!!i,staleTime:300*1e3,placeholderData:(a,o)=>K1(a,o,n,2),refetchOnWindowFocus:!1,retry:1})}function Dbe(t,e=!0){const{orgId:n}=zt(),{data:s}=VR(),r=HR(),i=s==null?void 0:s.token,a={start_hour:Vse(t.start_hour),end_hour:Vse(t.end_hour),limit:t.limit};return rs({queryKey:to.analytics(n,"top_domains",a),queryFn:()=>r("top_domains",a,i),enabled:e&&!!i,staleTime:300*1e3,placeholderData:(o,l)=>K1(o,l,n,2),refetchOnWindowFocus:!1,retry:1})}function Obe(t,e=!0){const{orgId:n}=zt(),{data:s}=VR(),r=HR(),i=s==null?void 0:s.token;return rs({queryKey:to.analytics(n,"org_sessions",t),queryFn:()=>r("org_sessions",{start_date:t.start_date,end_date:t.end_date,limit:t.limit},i),enabled:e&&!!i,staleTime:300*1e3,placeholderData:(a,o)=>K1(a,o,n,2),refetchOnWindowFocus:!1,retry:1})}function $be(t,e=!0){const{orgId:n}=zt(),{data:s}=VR(),r=HR(),i=s==null?void 0:s.token;return rs({queryKey:to.analytics(n,"session_domains",t),queryFn:()=>r("session_domains",{session_id:t.session_id,limit:t.limit},i),enabled:e&&!!i&&!!t.session_id,staleTime:300*1e3,placeholderData:(a,o)=>K1(a,o,n,2),refetchOnWindowFocus:!1,retry:1})}const vvt=500,xvt=200,yvt=200,cC=30,Fbe="Couldn't load proxy usage. Try again shortly.",Tp="flex flex-1 items-center min-w-0 overflow-hidden p-[12px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px]";function bvt(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px] shrink-0 text-[var(--sand-10)]",children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.3-4.3"})]})}function Svt({value:t,onChange:e,onSubmit:n}){return c.jsxs("form",{onSubmit:s=>{s.preventDefault(),n(t)}
558,className:"bg-[var(--sand-3)] flex gap-[8px] h-[40px] items-center px-[12px] rounded-[8px] w-[280px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-within:bg-[var(--sand-4)]",children:[c.jsx(bvt,{}),c.jsx("input",{value:t,onChange:s=>e(s.target.value),placeholder:"Session ID",className:"flex-1 min-w-px bg-transparent outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] font-mono",spellCheck:!1,autoComplete:"off"})]})}function Hse(t){return t?zm(t.endsWith("Z")?t:`${t}Z`):"—"}function Gse(t){return`flex h-[36px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] ${t?"cursor-not-allowed bg-[var(--sand-3)] text-[var(--sand-8)]":"cursor-pointer active:scale-[0.97] bg-[var(--sand-3)] text-[var(--sand-12)] hover:bg-[var(--sand-4)]"}`}function Ube({items:t,nameHeader:e,empty:n,monoLabels:s,showDate:r,onRowClick:i,loading:a,failed:o}){const[l,u]=w.useState(0),d=Math.max(1,Math.ceil(t.length/cC)),f=Math.min(l,d-1),p=f*cC,m=t.slice(p,p+cC),v=r?[e,"Last seen","Bandwidth","Hits"]:[e,"Bandwidth","Hits"],x=v.length,y=o??n;return c.jsxs("div",{className:"flex flex-col gap-[12px] w-full",children:[c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full",children:[c.jsx("div",{className:"flex w-full min-w-0",children:v.map((S,_)=>c.jsx("div",{className:`${Tp} bg-[var(--sand-3)] text-[var(--sand-12)] whitespace-nowrap ${_>0?"border-l-[0.5px]":""}`,children:S},S))}),a?c.jsx(Lbe,{columns:x,cellClass:Tp}):m.length===0?c.jsx("div",{className:"flex w-full min-w-0",children:Array.from({length:x},(S,_)=>c.jsx("div",{className:`${Tp} ${_===0?"bg-[var(--sand-3)] text-[var(--sand-10)]":"border-l-[0.5px] text-[var(--sand-10)]"}`,children:_===0?y:"—"},_))}):m.map(S=>c.jsxs("div",{className:`flex w-full min-w-0 ${i?"cursor-pointer transition-colors duration-150 hover:bg-[var(--sand-2)]":""}`,onClick:i?()=>i(S):void 0,onKeyDown:i?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),i(S))}:void 0,role:i?"button":void 0,tabIndex:i?0:void 0,children:[c.jsx("div",{className:`${Tp} bg-[var(--sand-3)] text-[var(--sand-12)]`,children:c.jsx("span",{className:`truncate min-w-0 ${s?"font-mono":""}`,title:S.title??S.label,children:S.label})}),r&&c.jsx("div",{className:`${Tp} border-l-[0.5px] text-[var(--sand-12)] whitespace-nowrap`,title:S.at?Hse(S.at):void 0,children:Hse(S.at)}),c.jsx("div",{className:`${Tp} border-l-[0.5px] text-[var(--sand-12)] whitespace-nowrap tabular-nums`,children:_i(S.bytes)}),c.jsx("div",{className:`${Tp} border-l-[0.5px] text-[var(--sand-12)] whitespace-nowrap tabular-nums`,children:S.hits.toLocaleString("en-US")})]},S.id))]}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[a?c.jsx(yh,{className:"h-[14px] w-[180px] my-[3px] rounded-[4px]"}):c.jsxs("span",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px]",children:["Showing ",t.length===0?0:p+1,"–",Math.min(p+cC,t.length)," ","of ",t.length.toLocaleString("en-US")," ",e.toLowerCase()+"s"]}),c.jsxs("div",{className:"flex gap-[8px] items-center shrink-0",children:[c.jsx("button",{type:"button",onClick:()=>u(S=>Math.max(0,S-1)),disabled:a||f===0,className:Gse(a||f===0),children:"Previous"}),c.jsx("button",{type:"button",onClick:()=>u(S=>Math.min(d-1,S+1)),disabled:a||f>=d-1,className:Gse(a||f>=d-1),children:"Next"})]})]})]})}function wvt(t,e){const n=t.trim();if(!n)return null;const s=n.toLowerCase(),r=e.find(a=>a.id.toLowerCase()===s);if(r)return r.id;const i=e.filter(a=>a.id.toLowerCase().includes(s)||a.label.toLowerCase().includes(s));return i.length===1?i[0].id:n}function _vt({sessionId:t,onBack:e}){const n=$be({session_id:t,limit:yvt},!0),{data:s,isFetching:r,refetch:i}=n,a=F2(n),o=((s==null?void 0:s.data)??[]).map((u,d)=>({id:`${u.domain}-${d}`,label:u.domain,bytes:u.total_bandwidth,hits:u.hits})),l=((s==null?void 0:s.data)??[]).reduce((u,d)=>({bandwidth:u.bandwidth+d.total_bandwidth,received:u.received+d.bytes_received,sent:u.sent+d.bytes_sent,hits:u.hits+d.hits}),{bandwidth:0,received:0,sent:0,hits:0});return c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsxs("div",{className:"rise-in flex flex-wrap gap-[24px]",children:[c.jsx(gd,{label:"Total bandwidth",value:_i(l.bandwidth),loading:a}),c.jsx(gd,{label:"Data received",value:_i(l.received),loading:a}),c.jsx(gd,{label:"Data sent",value:_i(l.sent),loading:a}),c.jsx(gd,{label:"Total requests",value:X$(l.hits),loading:a})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] w-full",style:{animationDelay:"130ms"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-0",children:[c.jsx("button",{type:"button",onClick:e,className:"self-start font-medium text-[14px] leading-[20px] text-[var(--sand-10)] hover:text-[var(--sand-12)] transition-colors",children:"← All sessions"}),c.jsxs("div",{className:"flex items-center gap-[8px] min-w-0",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Session"}),c.jsx("span",{className:"font-mono font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",title:t,children:t.slice(-8)}),c.jsx("button",{type:"button",onClick:()=>Ja(t,"Session ID"),"aria-label":"Copy session ID",className:"shrink-0 cursor-pointer text-[var(--sand-10)] transition-colors hover:text-[var(--sand-12)]",children:c.jsx(Pd,{size:18})})]}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"Hosts this session reached through the proxy"})]}),c.jsxs("div",{className:"flex items-center gap-[12px] shrink-0",children:[c.jsxs("button",{type:"button",onClick:()=>void i(),disabled:r,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[6px] h-[40p
558x] items-center pl-[12px] pr-[10px] rounded-[8px] disabled:opacity-50",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Refresh"}),c.jsx(fR,{size:18,className:r?"animate-spin text-[var(--sand-9)]":"text-[var(--sand-9)]"})]}),c.jsxs(Hn,{to:`/sessions/${t}`,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex gap-[6px] h-[40px] items-center pl-[12px] pr-[10px] rounded-[8px]",children:[c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Open session"}),c.jsx(La,{size:18,className:"text-[var(--sand-9)]"})]})]})]}),c.jsx(Ube,{items:o,nameHeader:"Domain",loading:a,failed:n.isError?Fbe:void 0,empty:"No proxy usage for this session."},t)]})]})}function Evt(){var j;const t=P9(),[e,n]=Po(),s=((j=e.get("session"))==null?void 0:j.trim())??"",[r,i]=w.useState(s?"sessions":"domains"),[a,o]=w.useState(""),l=w.useMemo(()=>EU((t==null?void 0:t.usageRange)??"Last 24h"),[t==null?void 0:t.usageRange]),u=w.useMemo(()=>({startDate:A5(l.start),endDate:A5(new Date(l.end.getTime()-1))}),[l]),d=Mbe({start_date:u.startDate,end_date:u.endDate}),f=Dbe({start_hour:l.start,end_hour:l.end,limit:xvt}),p=Obe({start_date:u.startDate,end_date:u.endDate,limit:vvt},!0),{data:m}=d,{data:v}=f,{data:x}=p,y=F2(d),S=r==="domains"?f:p,_=F2(S),E=((m==null?void 0:m.data)??[]).reduce((F,O)=>({bandwidth:F.bandwidth+O.total_bandwidth,received:F.received+O.bytes_received,sent:F.sent+O.bytes_sent,requests:F.requests+O.total_requests}),{bandwidth:0,received:0,sent:0,requests:0}),T=((v==null?void 0:v.data)??[]).map((F,O)=>({id:`${F.domain}-${O}`,label:F.domain,bytes:F.total_bandwidth,hits:F.hits})),k=((x==null?void 0:x.data)??[]).map(F=>({id:F.session_id,label:F.session_id.slice(-8),title:F.session_id,bytes:F.total_bandwidth,hits:F.total_requests,at:F.last_seen})),R=F=>{const O=F.trim();O&&(o(""),i("sessions"),n(M=>{const U=new URLSearchParams(M);return U.set("session",O),U},{replace:!1}))},I=()=>{o(""),n(F=>{const O=new URLSearchParams(F);return O.delete("session"),O},{replace:!1})},A=F=>{const O=wvt(F,k);O&&R(O)},L=a.trim()?k.filter(F=>F.id.toLowerCase().includes(a.trim().toLowerCase())||F.label.toLowerCase().includes(a.trim().toLowerCase())):k;return s?c.jsx(_vt,{sessionId:s,onBack:I}):c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsxs("div",{className:"rise-in flex flex-wrap gap-[24px]",children:[c.jsx(gd,{label:"Total bandwidth",value:_i(E.bandwidth),loading:y}),c.jsx(gd,{label:"Data received",value:_i(E.received),loading:y}),c.jsx(gd,{label:"Data sent",value:_i(E.sent),loading:y}),c.jsx(gd,{label:"Total requests",value:X$(E.requests),loading:y})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] w-full",style:{animationDelay:"130ms"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px]",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)] whitespace-nowrap",children:r==="domains"?"Top domains":"Sessions"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:r==="domains"?"Where proxy traffic went, ranked by bandwidth":"Which sessions used the most bandwidth"})]}),c.jsxs("div",{className:"flex items-center gap-[12px] shrink-0",children:[r==="sessions"&&c.jsx(Svt,{value:a,onChange:o,onSubmit:A}),c.jsxs("div",{className:"relative flex shrink-0 bg-[var(--sand-3)] rounded-[8px] p-[2px]",children:[c.jsx("div",{"aria-hidden":!0,className:"absolute top-[2px] bottom-[2px] left-[2px] w-[calc(50%-2px)] rounded-[6px] bg-[var(--sand-4)] transition-transform duration-200 [transition-timing-function:var(--ease-out)]",style:{transform:r==="sessions"?"translateX(100%)":"translateX(0)"}}),["domains","sessions"].map(F=>c.jsx("button",{type:"button",onClick:()=>{i(F),F==="domains"&&o("")},className:`relative z-[1] w-[96px] h-[32px] rounded-[6px] cursor-pointer font-medium text-[14px] leading-[20px] capitalize transition-colors duration-150 [transition-timing-function:var(--ease-out)] ${r===F?"text-[var(--sand-12)]":"text-[var(--sand-10)] hover:text-[var(--sand-12)]"}`,children:F},F))]})]})]}),c.jsx(Ube,{items:r==="domains"?T:L,nameHeader:r==="domains"?"Domain":"Session",showDate:r==="sessions",loading:_,failed:S.isError?Fbe:void 0,empty:r==="sessions"&&a.trim()?"No sessions match that ID. Press enter to look it up anyway.":"No proxy usage data yet.",monoLabels:r==="sessions",onRowClick:r==="sessions"?F=>R(F.id):void 0},`${r}:${a}`)]})]})}function Cvt(){return c.jsx(Evt,{})}const Wse=t=>t!=null?String(Math.round(t)/100):"";function Tvt(){const t=[[10,30],[20,30],[0,0],[10,0],[20,0],[30,0],[30,10],[0,10]];return c.jsx("div",{className:"relative size-[40px] shrink-0 [transform:scaleY(-1)]",children:t.map(([e,n],s)=>c.jsx("span",{className:"absolute size-[10px] bg-[#0091ff]",style:{left:e,top:n}},s))})}function kvt(){const t=FR(),[e,n]=w.useState(!1),[s,r]=w.useState(!1),[i,a]=w.useState(""),[o,l]=w.useState(""),[u,d]=w.useState(""),[f,p]=w.useState(""),[m,v]=w.useState(!1),[x,y]=w.useState(null),[S,_]=w.useState("form"),[E,T]=w.useState(null),{getAutoTopup:k,setAutoTopup:R,createSetupIntent:I}=Yh();w.useEffect(()=>{let G=!1;return k().then($=>{G||!$.enabled||(d(Wse($.thresholdCents)),p(Wse($.rechargeToCents)))}).catch(()=>{}),()=>{G=!0}},[k]);const A=f.trim()!=="",L=i!==u||o!==f,j=i.trim()!==""&&o.trim()!==""&&L&&!m,F=()=>{a(u),l(f),y(null),_("form"),T(null),n(!0)},O=async()=>{const G=Math.round(parseFloat(i)*100),$=Math.round(parseFloat(o)*100);await R({enabled:!0,thresholdCents:G,rechargeToCents:$}),d(i),p(o),n(!1)},M=async()=>{const G=Math.round(parseFloat(i)*100),$=Math.round(parseFloat(o)*100);if(!Number.isFinite(G)||!Number.isFinite($)){y("Enter valid amounts.");return}if(G<cQ){y(`The balance threshold must be at least $${cQ/100}.`);return}if($<lQ){y(`The top-up amount must be at least $${lQ/100}.`);return}v(!0),y(null);try{const V=await I();if(!V.hasDefaultPaymentMethod){if(!V.clientSecret)throw new Error("Could not start payment setup.");T(V.clientSecret),_("payment");return}await O()}catch(V){y(V instanceof Error?V.message:"Could not save auto top-up.")}finally{v(!1)}},U=async()=>{v(!0),y(null);try{await R({enabled:!1}),a(""),l(""),d(""),p(""),r(!1),n(!1)}catch(G){y(G instanceof Error?G.message:"Could not stop auto top-up.")}finally{v(!1)}};return c.jsxs("div",{className:"flex items-center justify-between w-full min-h-[52px]",children:[c.jsxs("div",{className:"flex flex-col gap-[8px]",children:[c.jsx("div",{className:"flex gap-[8px] items-center",children:c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Automatic top-up"})}),c.jsx("p",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px]",children:A?u.trim()!==""?c.jsxs(c.Fragment,{children:["When credits reach ",c.jsxs("span",{className:"text-[var(--sand-12)]",children:["$",u]})," your card will be auto-charged with"," ",c.jsxs("span",{className:"text-[var(--sand-12)]",children:["$",f]})]}):c.jsxs(c.Fragment,{children:["Your card will be auto-charged with"," ",c.jsxs("span",{className:"text-[var(--sand-12)]",children:["$",f]})]}):"Choose when to top-up your balance automatically"})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[A&&c.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger",children:"Stop top-up"}),c.jsx("button",{type:"button","aria-haspopup":"dialog",onClick:F,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:A?"Edit":"Configure"})]}),c.jsx(ss,{open:e&&!s,onClose:()=>n(!1),title:S==="payment"?"Add payment method":"Automatic top-up",subtitle:S==="payment"?"Save a card to enable automatic top-up.":"Choose when to top-up your balance automatically.",icon:c.jsx(Tvt,{}),footer:S==="payment"?void 0:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>n(!1),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"submit",form:"auto-top-up-form",disabled:!j,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color,filter] duration-150 [transition-timing-function:var(--ease-out)] ${j?"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-10)]"}`,children:"Save"})]}),children:S==="payment"?c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[E&&Qc?c.jsx(ZS,{stripe:Qc,options:{clientSecret:E,appearance:t},children:c.jsx(UR,{submitting:m,setSubmitting:v,setError:y,cta:"Save & enable top-up",onDone:()=>{O().catch(G=>y(G instanceof Error?G.message:"Could not save auto top-up."))},onBack:()=>{y(null),_("form")}})}):c.jsx("div",{className:"h-[120px] animate-pulse rounded-[12px] bg-[var(--sand-3)]"}),x&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x})]}):c.jsxs("form",{id:"auto-top-up-form",onSubmit:G=>{G.preventDefault(),j&&M()},className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex gap-[16px] items-start w-full font-medium text-[14px]",children:[c.jsx(qse,{label:"When credits reach",placeholder:"e.g 20",value:i,onChange:a}),c.jsx(qse,{label:"Top-up amount",placeholder:"e.g 100",value:o,onChange:l})]}),x&&c.jsx("p",{className:"font-medium text-danger text-[12px] leading-[20px] text-left w-full",children:x}),c.jsx("p",{className:"font-medium text-[var(--sand-10)] text-[12px] leading-[20px] text-left w-full",children:"By clicking Save, you agree to our Terms of Service. Usage purchases expire 1 year after purchase."})]})}),c.jsx(ss,{open:s,onClose:()=>
558r(!1),noIcon:!0,title:"Are you sure?",subtitle:"This turns off automatic top-up. You can set it up again anytime.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>r(!1),className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"button",onClick:U,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger",children:"Yes, stop"})]}),children:null})]})}function qse({label:t,placeholder:e,value:n,onChange:s}){return c.jsxs("div",{className:"flex flex-1 flex-col gap-[12px] min-w-px",children:[c.jsx("label",{className:"text-[var(--sand-10)] leading-[20px]",children:t}),c.jsxs("div",{className:"bg-[var(--sand-3)] flex gap-[10px] h-[44px] items-center px-[12px] rounded-[8px] w-full transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-within:bg-[var(--sand-4)]",children:[c.jsx("span",{className:"text-[var(--sand-12)] leading-[20px]",children:"$"}),c.jsx("input",{type:"number",inputMode:"decimal",placeholder:e,value:n,onChange:r=>s(r.target.value),className:"flex-1 min-w-px bg-transparent outline-none text-[var(--sand-12)] leading-[20px] placeholder:text-[var(--sand-10)] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"})]})]})}function Rvt({data:t,isLoading:e,busy:n,error:s,onAdd:r,onDefault:i,onRemove:a,onRetry:o}){return c.jsxs("section",{"aria-labelledby":"payment-methods-title",className:"w-full min-w-0",children:[c.jsxs("div",{className:"mb-5 flex items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{id:"payment-methods-title",className:"text-base font-medium text-[var(--sand-12)]",children:"Payment methods"}),c.jsx("p",{className:"mt-1 text-sm text-[var(--sand-11)]",children:"Choose how you pay for Steel."})]}),c.jsxs(Zt,{variant:"secondary",size:"sm",onClick:r,disabled:n,children:[c.jsx(cBe,{"aria-hidden":"true",className:"mr-2 size-3.5"}),"Add card"]})]}),c.jsxs("div",{className:"divide-y divide-[var(--sand-3)] overflow-hidden rounded-lg border border-[var(--sand-4)]",children:[e?c.jsxs("div",{role:"status",className:"p-4",children:[c.jsx("div",{className:"h-10 animate-pulse rounded bg-[var(--sand-3)]"}),c.jsx("span",{className:"sr-only",children:"Loading payment methods"})]}):t==null?void 0:t.paymentMethods.map(l=>{const u=l.id===t.defaultPaymentMethodId;return c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-4",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[c.jsx("div",{className:"rounded-md border border-[var(--sand-4)] bg-[var(--sand-2)] p-2.5",children:c.jsx(aBe,{"aria-hidden":"true",className:"size-5 text-[var(--sand-11)]"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-[var(--sand-12)]",children:$2(l)}),u&&c.jsx("span",{className:"rounded border border-[var(--sand-5)] bg-[var(--sand-3)] px-1.5 py-0.5 text-[10px] font-medium text-[var(--sand-11)]",children:"Default"})]}),c.jsx("p",{className:"mt-1 text-xs text-[var(--sand-11)]",children:l.expMonth&&l.expYear?`Expires ${String(l.expMonth).padStart(2,"0")}/${l.expYear}`:l.type==="us_bank_account"?"Bank account":"Saved payment method"})]})]}),!u&&c.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[c.jsx(Zt,{variant:"ghost",size:"sm",onClick:()=>i(l.id),disabled:n,children:"Make default"}),c.jsxs(Zt,{variant:"ghost",size:"sm",className:"text-[var(--sand-11)]",onClick:()=>a(l),disabled:n,children:["Remove",c.jsxs("span",{className:"sr-only",children:[" ",$2(l)]})]})]})]},l.id)}),!e&&!s&&!(t!=null&&t.paymentMethods.length)&&c.jsxs("div",{className:"p-6 text-center",children:[c.jsx("p",{className:"text-sm text-[var(--sand-12)]",children:"No payment methods yet"}),c.jsx("p",{className:"mt-1 text-sm text-[var(--sand-11)]",children:"Add a card to use for future purchases."})]}),s&&c.jsxs("div",{role:"alert",className:"flex flex-wrap items-center justify-between gap-3 p-4",children:[c.jsx("p",{className:"text-sm text-[var(--sand-11)]",children:s}),c.jsx(Zt,{variant:"secondary",size:"sm",onClick:o,children:"Try again"})]})]}),!!(t!=null&&t.defaultPaymentMethodId)&&c.jsx("p",{className:"mt-3 text-xs text-[var(--sand-11)]",children:"To remove your default method, choose another one first."})]})}function Avt({orgId:t}){var S,_,E;const e=FR(),n=aa(),s=["paymentMethods",t],r=rs({queryKey:s,queryFn:({signal:T})=>gi(ZZe({signal:T})),retry:1}),[i,a]=w.useState(!1),[o,l]=w.useState(!1),[u,d]=w.useState(null),[f,p]=w.useState(null),m=rs({queryKey:["paymentMethodSetup",t],enabled:i,queryFn:()=>gi(Vme({query:{cardsOnly:"true"}})),staleTime:1/0,gcTime:0,retry:!1,refetchOnWindowFocus:!1}),v=Bi({mutationFn:async({action:T,id:k})=>{T==="default"?await gi(zme({body:{paymentMethodId:k}}
558)):await gi(YZe({body:{paymentMethodId:k}}))},onSuccess:async()=>{p(null),await n.invalidateQueries({queryKey:s})}}),x=()=>{o||(a(!1),d(null),n.removeQueries({queryKey:["paymentMethodSetup",t]}))},y=((S=r.error)==null?void 0:S.message)??(v.error&&!f?v.error.message:void 0);return c.jsxs(c.Fragment,{children:[c.jsx(Rvt,{data:r.data,isLoading:r.isPending,busy:v.isPending,error:y,onAdd:()=>a(!0),onDefault:T=>v.mutate({action:"default",id:T}),onRemove:T=>{v.reset(),p(T)},onRetry:()=>{v.reset(),r.refetch()}}),c.jsx(Um,{open:i,onOpenChange:T=>{T||x()},children:c.jsxs($h,{hideClose:o,className:"max-h-[90dvh] w-[calc(100%-32px)] overflow-y-auto rounded-lg border-[var(--sand-4)] bg-[var(--sand-2)] text-[var(--sand-12)]",children:[c.jsxs(Fh,{children:[c.jsx(Ld,{children:"Add a card"}),c.jsx(jd,{children:"Your new card will be used as the default for future payments."})]}),m.isPending?c.jsxs("div",{role:"status",className:"flex items-center gap-2 py-6 text-sm text-[var(--sand-11)]",children:[c.jsx(kd,{"aria-hidden":"true",className:"size-4 animate-spin"}),"Loading secure card form…"]}):(_=m.data)!=null&&_.clientSecret&&Qc?c.jsx(ZS,{stripe:Qc,options:{clientSecret:m.data.clientSecret,appearance:e,fonts:Zgt},children:c.jsx(UR,{submitting:o,setSubmitting:l,setError:d,onBack:x,onDone:()=>{a(!1),d(null),n.removeQueries({queryKey:["paymentMethodSetup",t]}),n.invalidateQueries({queryKey:s})},cta:"Save card"})}):c.jsxs("div",{role:"alert",children:[c.jsx("p",{className:"text-sm text-[var(--sand-11)]",children:((E=m.error)==null?void 0:E.message)??"Card setup is unavailable. Please try again."}),c.jsx(Zt,{variant:"secondary",className:"mt-3",onClick:()=>void m.refetch(),children:"Try again"})]}),u&&c.jsx("p",{role:"alert",className:"text-sm text-[var(--red-11)]",children:u})]})}),c.jsx(Um,{open:!!f,onOpenChange:T=>{!T&&!v.isPending&&p(null)},children:c.jsxs($h,{hideClose:v.isPending,className:"w-[calc(100%-32px)] rounded-lg border-[var(--sand-4)] bg-[var(--sand-2)] text-[var(--sand-12)]",children:[c.jsxs(Fh,{children:[c.jsx(Ld,{children:"Remove payment method?"}),c.jsxs(jd,{children:[f?$2(f):"This payment method"," will be removed from your account."]})]}),v.error&&c.jsx("p",{role:"alert",className:"text-sm text-[var(--red-11)]",children:v.error.message}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(Zt,{variant:"secondary",disabled:v.isPending,onClick:()=>p(null),children:"Cancel"}),c.jsx(Zt,{variant:"destructive",disabled:v.isPending,onClick:()=>{f&&v.mutate({action:"remove",id:f.id})},children:v.isPending?"Removing…":"Remove"})]})]})})]})}function Nvt(){const{organization:t,membership:e}=Mo();return!t||(e==null?void 0:e.role)!=="org:admin"?null:c.jsx(Avt,{orgId:t.id},t.id)}const Bbe=w.forwardRef(({className:t,...e},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:He("w-full caption-bottom text-sm",t),...e})}));Bbe.displayName="Table";const zbe=w.forwardRef(({className:t,...e},n)=>c.jsx("thead",{ref:n,className:He("[&_tr]:border-b",t),...e}));zbe.displayName="TableHeader";const Vbe=w.forwardRef(({className:t,...e},n)=>c.jsx("tbody",{ref:n,className:He("[&_tr:last-child]:border-0",t),...e}));Vbe.displayName="TableBody";const Ivt=w.forwardRef(({className:t,...e},n)=>c.jsx("tfoot",{ref:n,className:He("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Ivt.displayName="TableFooter";const wT=w.forwardRef(({className:t,...e},n)=>c.jsx("tr",{ref:n,className:He("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));wT.displayName="TableRow";const Wy=w.forwardRef(({className:t,...e},n)=>c.jsx("th",{ref:n,className:He("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Wy.displayName="TableHead";const _0=w.forwardRef(({className:t,...e},n)=>c.jsx("td",{ref:n,className:He("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));_0.displayName="TableCell";const Lvt=w.forwardRef(({className:t,...e},n)=>c.jsx("caption",{ref:n,className:He("mt-4 text-sm text-muted-foreground",t),...e}));Lvt.displayName="TableCaption";function jvt({invoices:t,isLoading:e,error:n,hasMore:s,isLoadingMore:r,onRetry:i,onLoadMore:a}){return c.jsxs("section",{"aria-labelledby":"purchase-history-title",className:"w-full min-w-0",children:[c.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{id:"purchase-history-title",className:"text-base font-medium text-[var(--sand-12)]",children:"Purchase history"}),c.jsx("p",{className:"mt-1 text-sm text-[var(--sand-11)]",children:"Invoices for your credits, plans, and usage."})]}),c.jsx(bY,{"aria-hidden":"true",className:"mt-1 size-5 shrink-0 text-[var(--sand-9)]"})]}),c.jsxs("div",{className:"overflow-hidden rounded-lg border border-[var(--sand-4)]",children:[c.jsxs(Bbe,{className:"table-fixed sm:table-auto",children:[c.jsx(zbe,{className:"bg-[var(--sand-2)]",children:c.jsxs(wT,{className:"hover:bg-transparent",children:[c.jsx(Wy,{className:"w-[60%] pl-4 sm:w-auto",children:"Description"}),c.jsx(Wy,{className:"hidden sm:table-cell",children:"Date (UTC)"}),c.jsx(Wy,{className:"hidden sm:table-cell",children:"Status"}),c.jsx(Wy,{className:"pr-4 text-right",children:"Amount"})]})}),c.jsx(Vbe,{children:e?Array.from({length:3},(o,l)=>c.jsx(wT,{"aria-hidden":"true",children:c.jsx(_0,{colSpan:4,className:"p-4",children:c.jsx("div",{className:"h-8 animate-pulse rounded bg-[var(--sand-3)]"})})},l)):t.map(o=>{const l=o.status==="paid"&&o.settlementStatus==="none",u=c.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs ${l?"text-[var(--green-11)]":o.status==="open"?"text-[var(--amber-11)]":"text-[var(--sand-11)]"}`,children:[c.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-current"}),sbe(o)]});return c.jsxs(wT,{className:"group border-[var(--sand-3)] hover:bg-[var(--sand-2)]",children:[c.jsxs(_0,{className:"max-w-[240px] py-4 pl-4",children:[c.jsxs(Hn,{to:`${ei.invoices}/${o.id}`,className:"inline-flex max-w-full items-center gap-2 rounded-sm font-medium text-[var(--sand-12)] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-[var(--sand-8)]",children:[c.jsx("span",{className:"truncate",children:o.description}),c.jsx(Lde,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--sand-9)] group-hover:text-[var(--sand-12)]"}),c.jsxs("span",{className:"sr-only",children:[", ",o.number??o.id]})]}),c.jsx("p",{className:"mt-1 truncate font-mono text-xs text-[var(--sand-11)]",children:o.number??"Invoice"}),c.jsx("p",{className:"mt-1 text-xs text-[var(--sand-11)] sm:hidden",children:O2(o.createdAt)}),c.jsx("div",{className:"mt-1.5 sm:hidden",children:u})]}),c.jsx(_0,{className:"hidden whitespace-nowrap text-[var(--sand-11)] sm:table-cell",children:O2(o.createdAt)}),c.jsx(_0,{className:"hidden sm:table-cell",children:u}),c.jsxs(_0,{className:"whitespace-nowrap pr-4 text-right font-mono text-[var(--sand-12)]",children:[Yo(o.amountDueCents,o.currency),o.settlementStatus!=="none"&&c.jsxs("p",{className:"mt-1 whitespace-normal text-xs text-[var(--sand-11)]",children:[Yo(o.netAmountPaidCents,o.currency)," net paid"]})]})]},o.id)})})]}),e&&c.jsx("p",{role:"status",className:"sr-only",children:"Loading purchase history"}
558),!e&&!n&&t.length===0&&c.jsxs("div",{className:"flex flex-col items-center px-6 py-12 text-center",children:[c.jsx("div",{className:"mb-4 rounded-lg border border-[var(--sand-4)] bg-[var(--sand-2)] p-3",children:c.jsx(bY,{"aria-hidden":"true",className:"size-5 text-[var(--sand-11)]"})}),c.jsx("p",{className:"text-sm font-medium text-[var(--sand-12)]",children:"No purchases yet"}),c.jsx("p",{className:"mt-1 max-w-xs text-sm text-[var(--sand-11)]",children:"Your invoices will appear here after your first purchase."})]}),n&&c.jsxs("div",{role:"alert",className:"flex flex-wrap items-center justify-between gap-3 border-t border-[var(--sand-3)] p-4",children:[c.jsx("p",{className:"text-sm text-[var(--sand-11)]",children:n}),c.jsxs(Zt,{variant:"secondary",size:"sm",onClick:i,children:[c.jsx(dBe,{"aria-hidden":"true",className:"mr-2 size-3.5"}),"Try again"]})]}),s&&!n&&c.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--sand-3)] px-4 py-3",children:[c.jsxs("span",{className:"text-xs text-[var(--sand-11)]",children:[t.length," ",t.length===1?"document":"documents"]}),c.jsxs(Zt,{variant:"secondary",size:"sm",onClick:a,disabled:r,children:[r&&c.jsx(kd,{"aria-hidden":"true",className:"mr-2 size-3.5 animate-spin"}),r?"Loading…":"Load more"]})]})]})]})}function Pvt(){var s,r;const{membership:t}=Mo(),e=Cmt();if((t==null?void 0:t.role)!=="org:admin")return null;const n=((s=e.data)==null?void 0:s.pages.flatMap(i=>i.invoices))??[];return c.jsx(jvt,{invoices:n,isLoading:e.isPending,error:(r=e.error)==null?void 0:r.message,hasMore:e.hasNextPage,isLoadingMore:e.isFetchingNextPage,onRetry:()=>{e.isFetchNextPageError?e.fetchNextPage():e.refetch()},onLoadMore:()=>{e.isFetching||e.fetchNextPage()}})}const Mvt=168,Dvt=260,Kse=["Calling Santa's elves","Unboxing your package","The package driver is late","Polishing your credits","Wrapping it up with a bow"];function Ovt(){const[t,e]=w.useState(!1),[n,s]=w.useState("form"),[r,i]=w.useState(""),[a,o]=w.useState(!1),[l,u]=w.useState(null),[d,f]=w.useState(0),[p,m]=w.useState(null),v=w.useRef(null),x=w.useRef(null),{render:y,exiting:S}=Kh(t,220),{redeemCoupon:_}=Yh(),E=j=>(j.replace(/[^a-zA-Z0-9]/g,"").toUpperCase().slice(0,12).match(/.{1,4}/g)??[]).join("-"),T=r.replace(/-/g,""),k=T.length===12,R=()=>e(!1),I=()=>{s("form"),i(""),o(!1),e(!0)},A=()=>{k&&(o(!1),s("loading"),_(T).then(j=>{m(j.amountCents/100),s("reward"),Promise.all([Pn.invalidateQueries({queryKey:["usageDetails"]}),Pn.invalidateQueries({queryKey:["dailyBreakdown"]})])}).catch(()=>{o(!0),s("form")}))};w.useLayoutEffect(()=>{var j;y&&u(n==="form"?((j=x.current)==null?void 0:j.offsetHeight)??null:n==="loading"?Mvt:Dvt)},[y,n,r,a]),w.useEffect(()=>{if(n!=="loading")return;f(0);const j=setInterval(()=>f(F=>(F+1)%Kse.length),3e3);return()=>clearInterval(j)},[n]),w.useEffect(()=>{if(!t)return;const j=O=>O.key==="Escape"&&R();document.addEventListener("keydown",j);const F=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",j),document.body.style.overflow=F}},[t]);const L="pt-[40px] px-[40px] pb-[36px]";return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:I,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px]",children:c.jsx("span",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Redeem coupon"})}),y&&typeof document<"u"&&nr.createPortal(c.jsx("div",{className:`${S?"modal-overlay-out":"modal-overlay-in"} fixed inset-0 z-[100] flex items-center justify-center p-[16px] bg-black/30 dark:bg-black/90 backdrop-blur-[2px]`,onMouseDown:j=>{v.current&&!v.current.contains(j.target)&&R()},children:c.jsxs("div",{ref:v,role:"dialog","aria-modal":"true",style:l?{height:l}:void 0,className:`${S?"modal-card-out":"modal-card-in"} relative overflow-hidden bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[20px] w-[620px] max-w-full shadow-modal transition-[height] [transition-duration:400ms] [transition-timing-function:var(--ease-out)]`,children:[c.jsxs("form",{ref:x,onSubmit:j=>{j.preventDefault(),A()},className:`absolute inset-x-0 top-0 flex flex-col transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${n==="form"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsxs("div",{className:"flex flex-col gap-[6px] font-medium rounded-t-[20px] bg-[var(--sand-3)] px-[20px] pt-[20px] pb-[16px]",children:[c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Redeem coupon"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Enter your coupon code to redeem credits."})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex flex-col gap-[8px] p-[16px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Coupon code"}),c.jsx("input",{type:"text",autoFocus:!0,value:r,placeholder:"XXXX-XXXX-XXXX",onChange:j=>{i(E(j.target.value)),o(!1)},className:"bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] tracking-[0.04em] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] placeholder:tracking-[0.04em] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]"}),a&&c.jsx("p",{className:"fade-in font-medium text-danger text-[12px] leading-[20px]",children:"Incorrect coupon code. Please try again or c
558ontact support"})]}),c.jsx("div",{className:"border-t-[0.5px] border-solid border-[var(--gray-6)]"}),c.jsxs("div",{className:"flex justify-between gap-[12px] p-[12px]",children:[c.jsx("button",{type:"button",onClick:R,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:!k,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,background-color,filter] duration-150 [transition-timing-function:var(--ease-out)] ${k?"cursor-pointer bg-[var(--sand-12)] text-[var(--sand-1)] active:scale-[0.97] hover:brightness-95":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-10)]"}`,children:"Redeem"})]})]}),c.jsxs("div",{className:`absolute inset-0 ${L} flex flex-col items-center justify-center gap-[16px] transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${n==="loading"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"}),c.jsx("p",{className:"fade-in font-medium text-[var(--sand-11)] text-[14px] leading-[20px] text-center",children:Kse[d]},d)]}),c.jsxs("div",{className:`absolute inset-0 ${L} flex flex-col items-center justify-end gap-[24px] transition-opacity duration-300 [transition-timing-function:var(--ease-out)] ${n==="reward"?"opacity-100 [transition-delay:300ms]":"opacity-0 pointer-events-none delay-0"}`,children:[c.jsx(N5,{active:n==="reward"}),c.jsxs("div",{className:"fade-in relative z-[10] flex flex-col gap-[8px] items-center text-center font-medium",children:[c.jsxs("p",{className:"text-[20px] leading-[24px] text-[var(--sand-12)]",children:["You received $",(p??100).toLocaleString("en-US")," in credits!"]}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"A small gift from the Steel community"})]}),c.jsx("button",{type:"button",onClick:R,className:"fade-in relative z-[10] cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-5)] bg-[var(--sand-4)] flex h-[40px] items-center justify-center px-[12px] rounded-[8px] w-full",children:c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[14px] leading-[20px]",children:"Yay!"})})]})]})}),document.body)]})}const Hbe=28,$vt=6,uC=Hbe*$vt,Fvt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Yse=t=>String(t).padStart(2,"0");function Uvt(t){return t>0&&t<.01?"<$0.01":`$${t.toFixed(2)}`}function Bvt(t){return t===0?"var(--sand-4)":t<1?"rgba(0, 145, 255, 0.30)":t<2?"rgba(0, 145, 255, 0.50)":t<3?"rgba(0, 145, 255, 0.68)":t<4?"rgba(0, 145, 255, 0.84)":"#0091ff"}let F8=!1;function zvt({amounts:t}={}){const[e,n]=w.useState(null),s=u=>(t==null?void 0:t[u])??0,[r]=w.useState(()=>!F8);w.useEffect(()=>{if(F8)return;const u=window.setTimeout(()=>{F8=!0},1500);return()=>window.clearTimeout(u)},[]),w.useEffect(()=>{const u=new Date;n(Array.from({length:uC},(d,f)=>{const p=new Date(u);return p.setUTCDate(u.getUTCDate()-(uC-1-f)),`${Fvt[p.getUTCDay()]}, ${Yse(p.getUTCMonth()+1)}.${Yse(p.getUTCDate())}`}))},[]);const i=Array.from({length:uC},(u,d)=>d),a=Math.max(0,...i.map(u=>s(u))),o=a>0?i.reduce((u,d)=>s(d)===a?d:u,void 0):void 0,l=w.useMemo(()=>Array.from({length:uC},()=>450+Math.round(Math.random()*560)),[]);return c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"grid gap-[4px] w-full",style:{gridTemplateColumns:`repeat(${Hbe}, minmax(0, 1fr))`},children:i.map(u=>{const d=s(u);return c.jsxs("div",{className:"group relative aspect-square",children:[c.jsx("div",{className:`size-full rounded-[2px] ${u===o?"bg-[var(--blue-11)] dark:bg-[#cfe8ff]":""}`,style:{background:u===o?void 0:Bvt(d),animation:r?`dot-in 320ms var(--ease-out) ${l[u]}ms backwards`:void 0}}),c.jsx("div",{className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-[6px] -translate-x-1/2 origin-bottom scale-95 opacity-0 transition-[opacity,transform] duration-150 [transition-timing-function:var(--ease-out)] group-hover:scale-100 group-hover:opacity-100",children:c.jsxs("div",{className:"flex flex-col gap-[8px] whitespace-nowrap rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] px-[12px] py-[10px] min-w-[160px] text-left shadow-popover",children:[c.jsx("span",{className:"font-medium text-[var(--sand-12)] text-[12px] leading-[16
558px]",children:e?e[u]:"—"}),c.jsx("div",{className:"h-px -mx-[12px] bg-[var(--sand-6)]"}),c.jsxs("div",{className:"flex items-center justify-between gap-[16px]",children:[c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-11)]",children:"Balance used"}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-12)]",children:Uvt(d)})]})]})})]},u)})})})}const V0=t=>"$"+t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});function Vvt({usedDollars:t,includedDollars:e,balanceBreakdown:n,dailySpend:s,isLoading:r=!1}={}){const i=t??0,a=e??0,o=Math.max(0,a-i),l=(n==null?void 0:n.freeDollars)??o,u=(n==null?void 0:n.paidDollars)??0,d=(n==null?void 0:n.paidTotalDollars)??u,f=l+u,p=a>0?Math.min(100,Math.round(i/a*100)):0,m=r?"animate-pulse text-[var(--sand-10)]":"text-[var(--sand-12)]",v=(s??[]).filter(y=>y>0),x=v.length>0?v.reduce((y,S)=>y+S,0)/v.length:0;return c.jsxs("div",{className:"flex gap-[32px] items-stretch w-full",children:[c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex flex-1 flex-col min-w-px",children:[c.jsxs("div",{className:"bg-[var(--sand-3)] border-b-[0.5px] border-solid border-[var(--sand-6)] rounded-t-[12px] flex items-center gap-[8px] px-[24px] py-[16px] w-full",children:[c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Activity"}),c.jsxs("span",{className:"group relative flex items-center",children:[c.jsx(AU,{size:16,className:"size-[16px] cursor-help text-[var(--sand-11)] opacity-70 group-hover:opacity-100 transition-opacity duration-150 [transition-timing-function:var(--ease-out)]"}),c.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-30 mt-[8px] w-[220px] -translate-x-1/2 origin-top scale-95 opacity-0 transition-[opacity,transform] duration-150 [transition-timing-function:var(--ease-out)] group-hover:scale-100 group-hover:opacity-100",children:c.jsx("span",{className:"block rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] px-[12px] py-[10px] text-left font-medium text-[12px] leading-[16px] text-[var(--sand-11)] shadow-popover",children:"Average spend is calculated only across days with usage. Days with $0 spend are excluded."})})]})]}),c.jsxs("div",{className:"bg-[var(--sand-2)] rounded-b-[12px] flex flex-1 flex-col gap-[24px] p-[24px] w-full",children:[c.jsx("p",{className:`font-medium text-[32px] leading-[40px] whitespace-nowrap ${m}`,children:r?"—":V0(x)}),c.jsx("p",{className:"font-medium text-[var(--sand-10)] text-[14px] leading-[20px] -mt-[16px]",children:"Average spend per active day"}),c.jsx(zvt,{amounts:r?void 0:s})]})]}),c.jsxs("div",{className:"bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] rounded-[12px] flex flex-1 flex-col min-w-px",children:[c.jsx("div",{className:"bg-[var(--sand-3)] border-b-[0.5px] border-solid border-[var(--sand-6)] rounded-t-[12px] flex items-center px-[24px] py-[16px] w-full",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Current balance"})}),c.jsxs("div",{className:"bg-[var(--sand-2)] rounded-b-[12px] flex flex-1 flex-col justify-between gap-[24px] p-[24px] w-full",children:[c.jsx("p",{className:`font-medium text-[32px] leading-[40px] whitespace-nowrap ${m}`,children:r?"—":V0(n?f:o)}),n?c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsx(Zse,{label:"Included credits",amount:l,total:a,tip:"This is your credit balance that you receive from credits, coupons, or your plan.",barColor:"#0091ff"}),c.jsx(Zse,{label:"Purchased credits",amount:u,total:d,barColor:"#f5d90a"})]}):c.jsxs("div",{className:"flex flex-col gap-[8px] w-full",children:[c.jsx("div",{className:"bg-[var(--sand-4)] h-[8px] rounded-[100px] overflow-hidden w-full",children:c.jsx("div",{className:"bar-fill h-full bg-[#f5d90a] rounded-[100px]",style:{width:`${p}%`}})}),c.jsxs("div",{className:"flex items-start justify-between w-full font-medium text-[14px] leading-[20px]",children:[c.jsxs("span",{className:"text-[var(--sand-12)]",children:[r?"—":V0(i)," ",c.jsx("span",{className:"text-[var(--sand-10)]",children:"used"})]}),c.jsxs("span",{className:"text-[var(--sand-10)]",children:[r?"—":V0(a)," total"]})]})]})]})]})]})}function Zse({label:t,amount:e,total:n,tip:s,barColor:r}){const i=r&&n&&n>0?Math.max(2,Math.min(100,e/n*100)):0;return c.jsxs("div",{className:"flex flex-col gap-[12px] w-full",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] font-medium text-[14px] leading-[20px]",children:[c.jsxs("span",{className:"flex items-center gap-[6px] text-[var(--sand-11)]",children:[t,s&&c.jsxs("span",{className:"group relative flex items-center",children:[c.jsx(AU,{size:16,className:"size-[16
558px] cursor-help text-[var(--sand-11)] opacity-70 group-hover:opacity-100 transition-opacity duration-150 [transition-timing-function:var(--ease-out)]"}),c.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-30 mt-[8px] w-[220px] -translate-x-1/2 origin-top scale-95 opacity-0 transition-[opacity,transform] duration-150 [transition-timing-function:var(--ease-out)] group-hover:scale-100 group-hover:opacity-100",children:c.jsx("span",{className:"block rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] px-[12px] py-[10px] text-left font-medium text-[12px] leading-[16px] text-[var(--sand-11)] shadow-popover",children:s})})]})]}),c.jsxs("span",{className:"text-[var(--sand-12)]",children:[V0(e),n!=null&&c.jsxs("span",{className:"text-[var(--sand-10)]",children:[" / ",V0(n)]})]})]}),r&&c.jsx("div",{className:"bg-[var(--sand-4)] h-[8px] rounded-[100px] overflow-hidden w-full",children:c.jsx("div",{className:"bar-fill h-full rounded-[100px]",style:{width:`${i}%`,background:r}})})]})}const U8=168,Xse=t=>`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}-${String(t.getUTCDate()).padStart(2,"0")}`,Hvt=t=>{const e=new Date(t);return`${e.getUTCFullYear()}-${e.getUTCMonth()}-${e.getUTCDate()}`};function Gvt(){const{usedCreditDollars:t,includedCreditDollars:e,rates:n,isLoading:s,isLegacyPlan:r,planLabel:i,balanceBreakdownDollars:a}=mu(),o=w.useMemo(()=>{const d=new Date,f=new Date;return f.setUTCDate(d.getUTCDate()-(U8-1)),{startDate:Xse(f),endDate:Xse(d)}},[]),{data:l}=_U(o),u=w.useMemo(()=>{if(!l)return;const d=new Map,f=(m,v)=>{for(const x of(m==null?void 0:m.data)??[]){const y=Hvt(x.start_time*1e3);d.set(y,(d.get(y)??0)+x.aggregated_value*v)}};f(l.browserUsageDetails,n.browser),f(l.proxyUsageDetails,n.proxy),f(l.captchaUsageDetails,n.captcha),f(l.scrapeUsageDetails,n.scrape);const p=new Date;return Array.from({length:U8},(m,v)=>{const x=new Date(p);return x.setUTCDate(p.getUTCDate()-(U8-1-v)),d.get(`${x.getUTCFullYear()}-${x.getUTCMonth()}-${x.getUTCDate()}`)??0})},[l,n]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-[24px] w-full",children:[c.jsxs("div",{className:"rise-in flex flex-wrap items-center justify-between gap-4 w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] font-medium",children:[c.jsx("div",{className:"flex gap-[8px] items-center",children:c.jsx("p",{className:"text-[16px] leading-[24px] text-[var(--sand-12)]",children:"Credit usage and budget"})}),c.jsx("p",{className:"text-[var(--sand-10)] text-[14px] leading-[20px]",children:"Check your remaining balance"})]}),!r&&c.jsxs("div",{className:"flex gap-[12px] items-center",children:[c.jsx(Ovt,{}),c.jsx(Hn,{to:ei.limits,className:"cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:bg-[var(--sand-4)] bg-[var(--sand-3)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] whitespace-nowrap",children:"Edit usage limits"})]})]}),r&&c.jsx("div",{className:"rise-in flex gap-[16px] items-center w-full bg-[var(--blue-3)] dark:bg-[#10243e] border-[0.5px] border-solid border-[var(--blue-6)] dark:border-[#0d3868] rounded-[12px] px-[24px] py-[16px]",children:c.jsxs("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--blue-11)] dark:text-[#0091ff]",children:["You are currently on a legacy plan (",i??"Legacy","). 
558Credit purchases, coupon redemption, and auto top-up are available after switching to a usage-based plan."]})}),c.jsx("div",{className:"rise-in",style:{animationDelay:"130ms"},children:c.jsx(Vvt,{usedDollars:t,includedDollars:e,balanceBreakdown:a,dailySpend:u,isLoading:s})})]}),!r&&c.jsx("div",{className:"rise-in w-full",style:{animationDelay:"260ms"},children:c.jsx(kvt,{})}),c.jsx(Nvt,{}),c.jsx(Pvt,{})]})}function Wvt(){return c.jsx(Gvt,{})}const Qse="/settings/organization/organization-members",Jse="members-view-label",qi="flex items-center min-w-px h-[44px] px-[16px] border-b-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[14px] leading-[20px] whitespace-nowrap",kp=`${qi} bg-[var(--sand-3)] text-[var(--sand-12)]`,ere="flex items-center justify-center h-[44px] w-[44px] shrink-0 bg-[var(--sand-3)] border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",dC="flex items-center justify-center h-[44px] w-[44px] shrink-0 border-b-[0.5px] border-l-[0.5px] border-solid border-[var(--sand-6)]",IU="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",qvt="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",Kvt=[{key:"org:member",label:"Member",desc:"Can use the org and its projects."},{key:"org:admin",label:"Admin",desc:"Full access to settings and billing."}],tre=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Yvt(t){const e=t.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.length===1?e[0].slice(0,2).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase()}function Cf({w:t="100%",h:e=12,rounded:n="rounded-[6px]"}){return c.jsx("div",{className:`animate-pulse bg-[var(--sand-4)] ${n}`,style:{width:t,height:e}})}function Zvt({name:t,imageUrl:e}){return c.jsx("span",{className:"shrink-0 size-[20px] rounded-full bg-[var(--sand-4)] overflow-hidden flex items-center justify-center font-medium text-[9px] leading-none text-[var(--sand-12)]",children:e?c.jsx("img",{src:e,alt:"",className:"size-full object-cover"}):Yvt(t)})}function nre({role:t,label:e}){const n=t==="org:admin";return c.jsx("span",{className:`flex h-[20px] items-center px-[8px] rounded-[999px] font-medium text-[12px] leading-[20px] ${n?"bg-[var(--yellow-3)] dark:bg-[#2c2100] text-[var(--yellow-11)] dark:text-[#f0c000]":"bg-[var(--sand-4)] text-[var(--sand-11)]"}`,children:e})}function Xvt(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"size-[18px]",children:[c.jsx("circle",{cx:"12",cy:"5",r:"1.6"}),c.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),c.jsx("circle",{cx:"12",cy:"19",r:"1.6"})]})}function sre({items:t}){const[e,n]=w.useState(!1),[s,r]=w.useState(null),i=w.useRef(null);w.useEffect(()=>{if(!e)return;const o=()=>n(!1),l=u=>u.key==="Escape"&&n(!1);return window.addEventListener("pointerdown",o),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),document.addEventListener("keydown",l),()=>{window.removeEventListener("pointerdown",o),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),document.removeEventListener("keydown",l)}},[e]);const a=()=>{var l;const o=(l=i.current)==null?void 0:l.getBoundingClientRect();o&&r({top:o.bottom+6,right:window.innerWidth-o.right}),n(u=>!u)};return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:i,type:"button","aria-haspopup":"menu","aria-expanded":e,onPointerDown:o=>o.stopPropagation(),onClick:a,className:"cursor-pointer flex items-center justify-center size-[32px] rounded-full text-[var(--sand-10)] hover:text-[var(--sand-12)] hover:bg-[var(--sand-4)] transition-colors duration-150 [transition-timing-function:var(--ease-out)]",children:c.jsx(Xvt,{})}),e&&s&&typeof document<"u"&&nr.createPortal(c.jsx("div",{role:"menu",onPointerDown:o=>o.stopPropagation(),style:{position:"fixed",top:s.top,right:s.right},className:"origin-top-right z-[120] flex flex-col gap-[4px] p-[4px] min-w-[160px] rounded-[8px] bg-[var(--sand-2)] border-[0.5px] border-solid border-[var(--sand-6)] shadow-menu [animation:menu-in_180ms_var(--ease-out)]",children:t.map(o=>c.jsx("button",{type:"button",role:"menuitem",onClick:()=>{n(!1),o.onClick()},className:`w-full text-left cursor-pointer flex items-center h-[36px] px-[8px] rounded-[6px] font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] ${o.danger?"text-danger hover:bg-danger-hover":"text-[var(--sand-11)] hover:text-[var(--sand-12)] hover:bg-[var(--sand-4)]"}`,children:o.label},o.label))}),document.body)]})}function Gbe({value:t,onChange:e}){return c.jsx("div",{className:"grid grid-cols-2 gap-[12px] w-full",children:Kvt.map(n=>{const s=n.key===t;return c.jsxs("button",{type:"button",onClick:()=>e(n.key),className:`flex flex-col gap-[4px] items-start text-left p-[16px] rounded-[12px] border-[0.5px] border-solid border-[var(--sand-6)] curs
558or-pointer transition-[background-color,box-shadow] duration-150 [transition-timing-function:var(--ease-out)] ${s?"bg-[var(--sand-3)] shadow-[0_0_0_1.5px_var(--sand-12)]":"bg-[var(--sand-2)] hover:bg-[var(--sand-3)]"}`,children:[c.jsx("span",{className:`font-medium text-[14px] leading-[20px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] ${s?"text-[var(--sand-12)]":"text-[var(--sand-11)]"}`,children:n.label}),c.jsx("span",{className:"font-medium text-[12px] leading-[16px] text-[var(--sand-10)]",children:n.desc})]},n.key)})})}function Qvt(){const{user:t}=Vi(),{organization:e,membership:n,isLoaded:s,memberships:r,invitations:i}=Mo({memberships:{pageSize:100,keepPreviousData:!0},invitations:{pageSize:100,keepPreviousData:!0}}),a=(n==null?void 0:n.role)==="org:admin",{pathname:o}=Gs(),l=di(),u=o.endsWith("/invites")?"invites":"members",d=L4(),[f,p]=w.useState(""),[m,v]=w.useState(!1),[x,y]=w.useState(null),[S,_]=w.useState(null);if(!s)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"})});const E=((r==null?void 0:r.data)??[]).map(M=>{const U=M.publicUserData,G=[U==null?void 0:U.firstName,U==null?void 0:U.lastName].filter(Boolean).join(" ").trim()||(U==null?void 0:U.identifier)||"Unknown";return{membershipId:M.id,userId:U==null?void 0:U.userId,name:G,email:(U==null?void 0:U.identifier)??"—",imageUrl:U!=null&&U.hasImage?U.imageUrl:void 0,role:M.role,roleLabel:M.roleName,joined:M.createdAt}}),T=((i==null?void 0:i.data)??[]).filter(M=>M.status==="pending").map(M=>({id:M.id,email:M.emailAddress,role:M.role,roleLabel:M.roleName,sent:M.createdAt,revoke:()=>M.revoke()})),k=f.trim().toLowerCase(),R=k?E.filter(M=>M.name.toLowerCase().includes(k)||M.email.toLowerCase().includes(k)):E,I=k?T.filter(M=>M.email.toLowerCase().includes(k)):T,A=(r==null?void 0:r.isLoading)??!1,L=(i==null?void 0:i.isLoading)??!1,j=async M=>{var U;if(!(!(x!=null&&x.userId)||!e))try{await e.updateMember({userId:x.userId,role:M}),await((U=r==null?void 0:r.revalidate)==null?void 0:U.call(r)),na({title:"Role updated",shapes:!1})}catch(G){Bn({title:G instanceof Error?G.message:"Could not update role"})}finally{y(null)}},F=async()=>{var M;if(!(!(S!=null&&S.userId)||!e))try{await e.removeMember(S.userId),await((M=r==null?void 0:r.revalidate)==null?void 0:M.call(r)),na({title:"Member removed",shapes:!1})}catch(U){Bn({title:U instanceof Error?U.message:"Could not remove member"})}finally{_(null)}},O=async M=>{var U;try{await M.revoke(),await((U=i==null?void 0:i.revalidate)==null?void 0:U.call(i)),na({title:"Invitation revoked",shapes:!1})}catch(G){Bn({title:G instanceof Error?G.message:"Could not revoke invite"})}};return c.jsxs("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px]",children:u==="invites"?"Invited members":"Members"}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage team members and pending invitations."})]}),c.jsxs("div",{className:"flex gap-[12px] items-center shrink-0",children:[c.jsxs("div",{className:"bg-[var(--sand-3)] flex gap-[8px] h-[40px] items-center px-[12px] rounded-[8px] w-[260px] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-within:bg-[var(--sand-4)]",children:[c.jsx(s1t,{}),c.jsx("input",{value:f,onChange:M=>p(M.target.value),placeholder:u==="invites"?"Search email":"Search name or email",className:"flex-1 min-w-px bg-transparent outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)]"})]}),a&&c.jsx("button",{type:"button",onClick:()=>v(!0),className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Invite member"})]})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] p-[24px] w-full",children:[d&&c.jsxs("div",{className:"w-fit",children:[c.jsx("span",{id:Jse,className:"sr-only",children:"Members view"}),c.jsx(N$,{options:[{value:"members",label:"Current members"},{value:"invites",label:"Invited members"}],value:u,onChange:M=>l(M==="invites"?`${Qse}/invites`:Qse),layoutId:"members-view",labelledBy:Jse})]}),u==="members"&&c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${kp} flex-1`,children:"Member"}),c.jsx("div",{className:`${kp} flex-1 border-l-[0.5px]`,children:"Email"}),c.jsx("div",{className:`${kp} flex-none w-[160px] border-l-[0.5px]`,children:"Join date"}),c.jsx("div",{className:`${kp} flex-none w-[120px] border-l-[0.5px]`,children:"Role"}),c.jsx("div",{className:ere})]}),A&&Array.from({length:4}).map((M,U)=>c.jsxs("div",{className:"flex w-full",children:[c.jsxs("div",{className:`${qi}
558 flex-1 gap-[10px]`,children:[c.jsx(Cf,{w:"20px",h:20,rounded:"rounded-full"}),c.jsx(Cf,{w:"120px"})]}),c.jsx("div",{className:`${qi} flex-1 border-l-[0.5px]`,children:c.jsx(Cf,{w:"160px"})}),c.jsx("div",{className:`${qi} flex-none w-[160px] border-l-[0.5px]`,children:c.jsx(Cf,{w:"100px"})}),c.jsx("div",{className:`${qi} flex-none w-[120px] border-l-[0.5px]`,children:c.jsx(Cf,{w:"56px",h:20,rounded:"rounded-[999px]"})}),c.jsx("div",{className:dC})]},`m-sk-${U}`)),!A&&R.map(M=>{const U=M.userId&&(t==null?void 0:t.id)===M.userId;return c.jsxs("div",{className:"flex w-full",children:[c.jsxs("div",{className:`${qi} flex-1 gap-[10px] text-[var(--sand-12)] overflow-hidden`,children:[c.jsx(Zvt,{name:M.name,imageUrl:M.imageUrl}),c.jsxs("span",{className:"truncate min-w-0",children:[M.name,U&&c.jsx("span",{className:"text-[var(--sand-10)]",children:" (you)"})]})]}),c.jsx("div",{className:`${qi} flex-1 border-l-[0.5px] text-[var(--sand-11)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:M.email})}),c.jsx("div",{className:`${qi} flex-none w-[160px] border-l-[0.5px] text-[var(--sand-12)]`,children:kne(M.joined)}),c.jsx("div",{className:`${qi} flex-none w-[120px] border-l-[0.5px]`,children:c.jsx(nre,{role:M.role,label:M.roleLabel})}),c.jsx("div",{className:dC,children:a&&!U&&c.jsx(sre,{items:[{label:"Change role",onClick:()=>y(M)},{label:"Remove member",danger:!0,onClick:()=>_(M)}]})})]},M.membershipId)}),!A&&R.length===0&&c.jsx("div",{className:"flex w-full",children:c.jsx("div",{className:`${qi} flex-1 justify-center text-[var(--sand-10)]`,children:k?`No members match "${f}".`:"No members yet."})})]}),u==="invites"&&(!L&&I.length===0?c.jsx(n1t,{query:k?f:void 0}):c.jsxs("div",{className:"border-[0.5px] border-solid border-[var(--sand-6)] rounded-[8px] overflow-hidden flex flex-col w-full [&>div:last-child>div]:border-b-0",children:[c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${kp} flex-1`,children:"Email"}),c.jsx("div",{className:`${kp} flex-none w-[160px] border-l-[0.5px]`,children:"Invited"}),c.jsx("div",{className:`${kp} flex-none w-[120px] border-l-[0.5px]`,children:"Role"}),c.jsx("div",{className:ere})]}),L&&Array.from({length:2}).map((M,U)=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${qi} flex-1`,children:c.jsx(Cf,{w:"160px"})}),c.jsx("div",{className:`${qi} flex-none w-[160px] border-l-[0.5px]`,children:c.jsx(Cf,{w:"100px"})}),c.jsx("div",{className:`${qi} flex-none w-[120px] border-l-[0.5px]`,children:c.jsx(Cf,{w:"56px",h:20,rounded:"rounded-[999px]"})}),c.jsx("div",{className:dC})]},`i-sk-${U}`)),!L&&I.map(M=>c.jsxs("div",{className:"flex w-full",children:[c.jsx("div",{className:`${qi} flex-1 text-[var(--sand-12)] overflow-hidden`,children:c.jsx("span",{className:"truncate min-w-0",children:M.email})}),c.jsx("div",{className:`${qi} flex-none w-[160px] border-l-[0.5px] text-[var(--sand-12)]`,children:kne(M.sent)}),c.jsx("div",{className:`${qi} flex-none w-[120px] border-l-[0.5px]`,children:c.jsx(nre,{role:M.role,label:M.roleLabel})}),c.jsx("div",{className:dC,children:a&&c.jsx(sre,{items:[{label:"Revoke invite",danger:!0,onClick:()=>O(M)}]})})]},M.id))]}))]})]}),m&&e&&c.jsx(e1t,{open:m,onClose:()=>v(!1),onInvited:()=>{var M;(M=i==null?void 0:i.revalidate)==null||M.call(i),l("/settings/organization/organization-members/invites")},invite:(M,U)=>e.inviteMembers({emailAddresses:M,role:U})}),x&&c.jsx(Jvt,{member:x,onClose:()=>y(null),onSave:j}),c.jsx(ss,{open:S!==null,onClose:()=>_(null),noIcon:!0,danger:!0,title:"Remove member?",subtitle:S?`${S.name} will lose access to the organization. You can invite them again later.`:"They will lose access to the organization.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>_(null),className:IU,children:"Cancel"}),c.jsx("button",{type:"button",onClick:F,className:qvt,children:"Yes, remove"})]}),children:null})]})}function Jvt({member:t,onClose:e,onSave:n}){const s=t.role??"org:member",[r,i]=w.useState(s),[a,o]=w.useState(!1),l=a||r===s;return c.jsx(ss,{open:!0,onClose:e,noIcon:!0,title:"Change role",subtitle:`Choose a new role for ${t.name}
558.`,footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:e,disabled:a,className:IU,children:"Cancel"}),c.jsx("button",{type:"button",disabled:l,onClick:async()=>{o(!0),await n(r)},className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] ${l?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] text-[var(--sand-1)]"}`,children:a?"Saving…":"Save role"})]}),children:c.jsx("div",{className:"flex flex-col gap-[16px] w-full",children:c.jsx(Gbe,{value:r,onChange:i})})})}function e1t({open:t,onClose:e,onInvited:n,invite:s}){const[r,i]=w.useState([]),[a,o]=w.useState(""),[l,u]=w.useState("org:member"),[d,f]=w.useState(!1),p=()=>{const y=a.trim().replace(/,$/,"").trim();if(y){if(!tre.test(y)){Bn({title:`"${y}" is not a valid email`});return}r.includes(y)||i(S=>[...S,y]),o("")}},m=a.trim()&&tre.test(a.trim())?[...r,a.trim()]:r,v=!d&&m.length>0,x=async()=>{if(v){f(!0);try{await s(m,l),na({title:m.length===1?"Invitation sent":`${m.length} invitations sent`,shapes:!1}),n(),e()}catch(y){Bn({title:y instanceof Error?y.message:"Could not send invites"}),f(!1)}}};return c.jsx(ss,{open:t,onClose:()=>{d||e()},noIcon:!0,title:"Invite members",subtitle:"Invite people by email. Press enter after each address to add it.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:e,disabled:d,className:IU,children:"Cancel"}),c.jsx("button",{type:"button",onClick:x,disabled:!v,className:`flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] ${v?"cursor-pointer active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] text-[var(--sand-1)]":"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]"}`,children:d?"Sending…":m.length>1?`Send ${m.length} invites`:"Send invite"})]}),children:c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Email addresses"}),c.jsxs("div",{className:"bg-[var(--sand-3)] flex flex-wrap gap-[8px] min-h-[44px] items-center p-[8px] rounded-[8px] w-full transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus-within:bg-[var(--sand-5)]",children:[r.map(y=>c.jsxs("span",{className:"flex items-center gap-[4px] h-[28px] pl-[10px] pr-[6px] rounded-[999px] bg-[var(--sand-4)] border-[0.5px] border-solid border-[var(--sand-6)] font-medium text-[13px] leading-[20px] text-[var(--sand-12)]",children:[y,c.jsx("button",{type:"button",onClick:()=>i(S=>S.filter(_=>_!==y)),"aria-label":`Remove ${y}`,className:"cursor-pointer flex items-center justify-center size-[16px] rounded-full text-[var(--sand-11)] hover:text-[var(--sand-12)] hover:bg-[var(--sand-6)] transition-colors duration-150",children:"×"})]},y)),c.jsx("input",{value:a,onChange:y=>o(y.target.value),onKeyDown:y=>{y.key==="Enter"||y.key===","||y.key===" "?(y.preventDefault(),p()):y.key==="Backspace"&&!a&&r.length&&i(S=>S.slice(0,-1))},onBlur:p,placeholder:r.length?"":"[email protected]",className:"flex-1 min-w-[120px] h-[28px] bg-transparent outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)]"})]})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-12)]",children:"Role"}),c.jsx(Gbe,{value:l,onChange:u})]})]})})}function t1t({className:t}){return c.jsxs("svg",{viewBox:"0 0 18.3525 20",width:20,height:20,fill:"currentColor",className:t,"aria-hidden":!0,children:[c.jsx("path",{d:"M8.35254 0C5.86726 0 3.85254 2.01472 3.85254 4.5C3.85254 6.98528 5.86726 9 8.35254 9C10.8378 9 12.8525 6.98528 12.8525 4.5C12.8525 2.01472 10.8378 0 8.35254 0Z"}),c.jsx("path",{d:"M3.35555 11.5711C2.00858 12.5463 0.987893 13.9173 0.396635 15.516C0.38801 15.5393 0.379754 15.5626 0.371861 15.5859C0.242053 15.9456 0.13388 16.3164 0.0484696 16.6964C-0.241306 17.9858 0.815849 19 1.951 19H11.3525C9.69568 19 8.35254 17.6569 8.35254 16C8.35254 14.3431 9.69568 13 11.3525 13C11.3525 12.1759 11.6848 11.4295 12.2227 10.8873C11.0884 10.3198 9.78432 10 8.35258 10C8.18619 10 8.02151 10.0043 7.85863 10.0128"}),c.jsx("path",{d:"M14.3525 12C14.9048 12 15.3525 12.4477 15.3525 13V15H17.3525C17.9048 15 18.3525 15.4477 18.3525 16C18.3525 16.5523 17.9048 17 17.3525 17H15.3525V19C15.3525 19.5523 14.9048 20 14.3525 20C13.8003 20 13.3525 19.5523 13.3525 19V17H11.3525C10.8003 17 10.3525 16.5523 10.3525 16C10.3525 15.4477 10.8003 15 11.3525 15H13.3525V13C13.3525 12.4477 13.8003 12 14.3525 12Z"})]})}function n1t({query:t}){return c.jsxs("div",{className:"bg-[var(--sand-2)] flex flex-col items-center justify-center gap-[24px] rounded-[8px] border-[0.5px] border-solid border-[var(--sand-6)] p-[44px] w-full",children:[c.jsx(t1t,{className:"text-[var(--sand-12)]"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-9)] text-center",children:t?`No invitations match "${t}".`:c.jsxs(c.Fragment,{children:["There are no pending invitations right now.",c.jsx("br",{}),"Invite someone by clicking on Invite member."]})})]})}function s1t(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"size-[18px] shrink-0 text-[var(--sand-10)]",children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.3-4.3"})]})}function r1t(t){return c.jsx(rt,{...t,children:c.jsx("path",{d:"M15.4649 6L14.5993 6.50073C14.778 6.80972 15.1079 7 15.4649 7V6ZM8.53513 6V7C8.89209 7 9.22199 6.80972 9.40073 6.50073L8.53513 6ZM2 8V18H4V8H2ZM5 21H19V19H5V21ZM22 18V8H20V18H22ZM12 5C13.1092 5 14.079 5.60141 14.5993 6.50073L16.3305 5.49927C15.4675 4.00738 13.852 3 12 3V5ZM9.40073 6.50073C9.92096 5.60141 10.8908 5 12 5V3C10.148 3 8.53254 4.00738 7.66952 5.49927L9.40073 6.50073ZM19 5H15.4649V7H19V5ZM8.53513 5H5V7H8.53513V5ZM22 8C22 6.34315 20.6569 5 19 5V7C19.5523 7 20 7.44771 20 8H22ZM19 21C20.6569 21 22 19.6569 22 18H20C20 18.5523 19.5523 19 19 19V21ZM2 18C2 19.6569 3.34315 21 5 21V19C4.44772 19 4 18.5523 4 18H2ZM4 8C4 7.44772 4.44772 7 5 7V5C3.34315 5 2 6.34315 2 8H4ZM14 12.5C14 13.6046 13.1046 14.5 12 14.5V16.5C14.2091 16.5 16 14.7091 16 12.5H14ZM12 14.5C10.8954 14.5 10 13.6046 10 12.5H8C8 14.7091 9.79086 16.5 12 16.5V14.5ZM10 12.5C10 11.3954 10.8954 10.5 12 10.5V8.5C9.79086 8.5 8 10.2909 8 12.5H10ZM12 10.5C13.1046 10.5 14 11.3954 14 12.5H16C16 10.2909 14.2091 8.5 12 8.5V10.5Z",fill:"currentColor"})})}const i1t="flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)]",B8="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-4)] hover:bg-[var(--sand-5)] flex h-[40px] items-center justify-center px-[16px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-12)] disabled:opacity-60 disabled:cursor-not-allowed",rre="cursor-pointer transition-[transform,background-color] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] bg-[var(--sand-3)] hover:bg-danger-hover flex h-[40px] items-center px-[12px] rounded-[8px] whitespace-nowrap font-medium text-[14px] leading-[20px] text-danger disabled:opacity-60 disabled:cursor-not-allowed",ire="bg-[var(--sand-3)] h-[44px] w-full px-[12px] rounded-[8px] outline-none font-medium text-[14px] leading-[20px] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] focus:bg-[var(--sand-4)]",are="font-medium text-[14px] leading-[20px] text-[var(--sand-12)]";function a1t(t){return`${i1t} ${t?"cursor-not-allowed bg-[var(--sand-4)] text-[var(--sand-8)]":"cursor-pointer active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] text-[var(--sand-1)]"}`}function ore({label:t,busyLabel:e,onComplete:n,busy:s}){const[i,a]=w.useState(!1),o=w.useRef(null),l=()=>{o.current!=null&&(clearTimeout(o.current),o.current=null),a(!1)},u=()=>{s||(a(!0),o.current=window.setTimeout(()=>{a(!1),n()},5e3))};return w.useEffect(()=>()=>{o.current!=null&&clearTimeout(o.current)},[]),c.jsxs("button",{type:"button",disabled:s,onPointerDown:u,onPointerUp:l,onPointerLeave:l,onPointerCancel:l,className:"relative flex h-[40px] cursor-pointer select-none items-center justify-center overflow-hidden rounded-[8px] px-[16px] bg-[var(--sand-4)] text-[14px] font-medium leading-[20px] text-danger disabled:cursor-not-allowed disabled:opacity-60",children:[c.jsx("span",{"aria-hidden":!0,
558className:"absolute inset-y-0 left-0 bg-[var(--red-3)]",style:{width:i?"100%":"0%",transition:i?"width 5000ms linear":"width 150ms ease-out"}}),c.jsx("span",{className:"relative z-[1]",children:s?e:t})]})}function lre({title:t,subtitle:e,action:n}){return c.jsxs("div",{className:"flex items-center justify-between gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[8px] min-w-px",children:[c.jsx("p",{className:"font-medium text-[16px] leading-[24px] text-[var(--sand-12)]",children:t}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:e})]}),n]})}function o1t(){const{organization:t,membership:e,isLoaded:n}=Mo(),{useOrgDetails:s}=fr(),{data:r}=s(),i=r==null?void 0:r.orgId,a=w.useRef(null),[o,l]=w.useState(!1),[u,d]=w.useState(""),[f,p]=w.useState(""),[m,v]=w.useState(!1),[x,y]=w.useState(!1),[S,_]=w.useState(!1),[E,T]=w.useState(!1),[k,R]=w.useState(!1),[I,A]=w.useState(!1);if(!n)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("div",{className:"size-[28px] rounded-full border-2 border-[var(--sand-6)] border-t-[var(--sand-12)] animate-spin"})});if(!t)return c.jsx("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center justify-center overflow-y-auto",children:c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"No active organization."})});const L=(e==null?void 0:e.role)==="org:admin",j=L&&t.adminDeleteEnabled,F=()=>{L&&(d(t.name),p(t.slug??""),l(!0))},O=u.trim()!==t.name||f.trim()!==(t.slug??""),M=!L||m||!u.trim()||!O,U=async()=>{if(!M){v(!0);try{await t.update({name:u.trim(),slug:f.trim()||void 0}),na({title:"Organization updated",shapes:!1}),l(!1)}catch(B){Bn({title:B instanceof Error?B.message:"Could not update organization"})}finally{v(!1)}}},G=async B=>{var z;const q=(z=B.target.files)==null?void 0:z[0];if(B.target.value="",!(!L||!q)){A(!0);try{await t.setLogo({file:q}),na({title:"Logo updated",shapes:!1})}catch(D){Bn({title:D instanceof Error?D.message:"Could not update logo"})}finally{A(!1)}}},$=async()=>{if(!(S||!e)){_(!0);try{await e.destroy(),window.location.assign("/")}catch(B){Bn({title:B instanceof Error?B.message:"Could not leave organization"}),_(!1)}}},V=async()=>{if(!k){R(!0);try{await t.destroy(),window.location.assign("/")}catch(B){Bn({title:B instanceof Error?B.message:"Could not delete organization"}),R(!1)}}};return c.jsxs("div",{className:"bg-[var(--sand-1)] flex flex-col flex-1 min-w-px items-center overflow-y-auto",children:[c.jsxs("div",{className:"w-full max-w-[1200px] flex flex-col flex-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-[16px] px-[24px] h-[112px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px] font-medium min-w-px",children:[c.jsx("p",{className:"text-[var(--sand-12)] text-[20px] leading-[28px] truncate",children:t.name}),c.jsx("p",{className:"text-[var(--sand-11)] text-[14px] leading-[20px]",children:"Manage your organization’s details and ownership."})]}),c.jsx("div",{className:"flex flex-col items-end gap-[8px] shrink-0",children:L&&c.jsxs("div",{className:"flex gap-[12px] items-center",children:[c.jsx("input",{ref:a,type:"file",accept:"image/*",hidden:!0,onChange:G}),c.jsx("button",{type:"button",onClick:()=>{var B;return(B=a.current)==null?void 0:B.click()},disabled:I,"aria-label":"Change organization logo",className:"size-[40px] shrink-0 rounded-[8px] overflow-hidden border-[0.5px] border-solid border-[var(--sand-6)] bg-[var(--sand-4)] flex items-center justify-center cursor-pointer transition-[filter] duration-150 [transition-timing-function:var(--ease-out)] hover:brightness-110 disabled:opacity-60 disabled:cursor-not-allowed",children:t.hasImage?c.jsx("img",{src:t.imageUrl,alt:"",className:"size-full object-cover"}):c.jsx(r1t,{size:20,className:"size-[20px] text-[var(--sand-11)]"})}),c.jsx("button",{type:"button",onClick:F,className:"cursor-pointer transition-[transform,filter] duration-150 [transition-timing-function:var(--ease-out)] active:scale-[0.97] hover:brightness-95 bg-[var(--sand-12)] flex h-[40px] items-center px-[12px] rounded-[8px] font-medium text-[14px] leading-[20px] text-[var(--sand-1)]",children:"Edit organization"})]})})]}),c.jsxs("div",{className:"rise-in flex flex-col gap-[24px] p-[24px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[4px]",children:[c.jsx("p",{className:"font-medium text-[20px] leading-[28px] text-[var(--red-11)]",children:"Danger zone"}),c.jsx("p",{className:"font-medium text-[14px] leading-[20px] text-[var(--sand-10)]",children:"These actions are irreversible. Attempt at your own risk."})]}),c.jsxs("div",{className:"flex flex-col gap-[48px] w-full",children:[c.jsx(lre,{title:"Leave organization",subtitle:"Remove yourself from this organization. You can be re-invited later.",action:c.jsx("button",{type:"button",onClick:()=>y(!0),className:rre,children:"Leave organization"})}),j&&c.jsx(lre,{title:"Delete organization",subtitle:"Permanently delete this organization and all of its data.",action:c.jsx("button",{type:"button",onClick:()=>T(!0),className:rre,children:"Delete organization"})})]})]}),i&&c.jsxs("span",{className:"flex min-w-px items-center gap-[8px] px-[24px] pb-[24px]",children:[c.jsxs("span",{className:"truncate text-[13px] leading-[18px] text-[var(--sand-10)]",children:["Org ID: ",i]}),c.jsx("button",{type:"button",onClick:()=>Ja(i,"Organization ID"),"aria-label":"Copy organization ID",className:"shrink-0 flex size-[20px] items-center justify-center cursor-pointer text-[var(--sand-10)] transition-colors duration-150 [transition-timing-function:var(--ease-out)] hover:text-[var(--sand-12)] active:text-[var(--sand-11)]",children:c.jsx(Pd,{size:16})})]})]}),c.jsx(ss,{open:o,onClose:()=>{m||l(!1)},noIcon:!0,title:"Edit organization details",subtitle:"Update your organization's name and slug.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>l(!1),disabled:m,className:B8,children:"Cancel"}),c.jsx("button",{type:"button",onClick:U,disabled:M,className:a1t(M),children:m?"Saving…":"Save"})]}),children:c.jsxs("div",{className:"flex flex-col gap-[16px] w-full",children:[c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:are,children:"Name"}
558),c.jsx("input",{autoFocus:!0,type:"text",value:u,onChange:B=>d(B.target.value),placeholder:"Organization name",className:ire})]}),c.jsxs("div",{className:"flex flex-col gap-[10px]",children:[c.jsx("label",{className:are,children:"Slug"}),c.jsx("input",{type:"text",value:f,onChange:B=>p(B.target.value),placeholder:"organization-slug",className:`${ire} tracking-[0.02em]`})]})]})}),c.jsx(ss,{open:x,onClose:()=>{S||y(!1)},noIcon:!0,danger:!0,title:"Leave organization?",subtitle:"You'll lose access to this organization's projects and data. You can be re-invited later.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>y(!1),disabled:S,className:B8,children:"Cancel"}),c.jsx(ore,{label:"Hold to leave",busyLabel:"Leaving…",onComplete:$,busy:S})]})}),c.jsx(ss,{open:E,onClose:()=>{k||T(!1)},noIcon:!0,danger:!0,title:"Delete organization?",subtitle:"This permanently deletes the organization and all of its projects, keys, and data. This cannot be undone.",footer:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>T(!1),disabled:k,className:B8,children:"Cancel"}),c.jsx(ore,{label:"Hold to delete",busyLabel:"Deleting…",onComplete:V,busy:k})]})})]})}function l1t(){const t=Gs(),e=t.pathname.replace(/\/+$/,"");return e==="/settings/organization"?c.jsx(o1t,{}):e.startsWith("/settings/organization/organization-members")?c.jsx(Qvt,{}):c.jsx("div",{className:"clerk-organization-profile overflow-y-auto",children:c.jsx(FPe,{routing:"path",path:"/settings/organization",appearance:{variables:{colorBackground:"var(--sand-5)",colorTextOnPrimaryBackground:"#fff",colorPrimary:"#5472e4"}}},t.pathname)})}function Es({loading:t,children:e,className:n,skeletonClassName:s="w-4 h-4 rounded-md"}){return c.jsx(G$,{className:n,children:c.jsx(US,{className:He(s),loading:t,children:e})})}const c1t={"7d":"Last 7 days","14d":"Last 14 days","30d":"Last 30 days",custom:"Custom range"};function LU({dateRange:t,preset:e,onPresetChange:n,onCustomRangeChange:s}){const[r,i]=w.useState(t.startDate),[a,o]=w.useState(t.endDate),[l,u]=w.useState(!1),d=w.useId(),f=w.useId();w.useEffect(()=>{i(t.startDate),o(t.endDate)},[t.startDate,t.endDate]);const p=w.useCallback(y=>{n(y)},[n]),m=w.useCallback(()=>{s({startDate:r,endDate:a}),u(!1)},[r,a,s]),v=y=>new Date(y+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"}),x=e==="custom"?`${v(t.startDate)} – ${v(t.endDate)}`:c1t[e];return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(PS,{value:e,onValueChange:p,children:[c.jsx(DS,{className:"w-[160px] h-8 text-xs border-[var(--sand-6)] bg-[var(--sand-2)] text-[var(--sand-12)]",children:c.jsx(MS,{children:x})}),c.jsxs(W1,{className:"border-[var(--sand-6)] bg-[var(--sand-2)] text-[var(--sand-12)]",children:[c.jsx(hd,{value:"7d",className:"text-xs",children:"Last 7 days"}),c.jsx(hd,{value:"14d",className:"text-xs",children:"Last 14 days"}),c.jsx(hd,{value:"30d",className:"text-xs",children:"Last 30 days"}),c.jsx(hd,{value:"custom",className:"text-xs",children:"Custom range…"})]})]}),c.jsxs(HS,{open:l,onOpenChange:u,children:[c.jsx(GS,{asChild:!0,children:c.jsx(Zt,{variant:"outline",size:"sm","aria-label":"Pick custom date range",className:"h-8 px-2 text-[var(--sand-11)] border-[var(--sand-6)] bg-[var(--sand-2)]",title:"Pick custom date range",children:c.jsx(fFe,{className:"h-3.5 w-3.5"})})}),c.jsx(Q1,{className:"w-auto p-4 border-[var(--sand-4)] bg-[var(--sand-2)] text-[var(--sand-12)]",align:"end",children:c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("p",{className:"text-xs font-medium text-[var(--sand-11)]",children:"Custom Date Range"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("label",{htmlFor:d,className:"text-[10px] text-[var(--sand-11)]",children:"From"}),c.jsx("input",{id:d,type:"date",value:r,onChange:y=>i(y.target.value),max:a,className:"h-8 px-2 text-xs rounded-md border border-[var(--sand-6)] bg-[var(--sand-3)] text-[var(--sand-12)] outline-none focus:ring-1 focus:ring-[var(--sand-8)]"})]}),c.jsx("span",{className:"text-[var(--sand-11)] mt-4",children:"–"}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("label",{htmlFor:f,className:"text-[10px] text-[var(--sand-11)]",children:"To"}),c.jsx("input",{id:f,type:"date",value:a,onChange:y=>o(y.target.value),min:r,max:new Date().toISOString().split("T")[0],className:"h-8 px-2 text-xs rounded-md border border-[var(--sand-6)] bg-[var(--sand-3)] text-[var(--sand-12)] outline-none focus:ring-1 focus:ring-[var(--sand-8)]"})]})]}),c.jsx(Zt,{size:"sm",className:"h-7 text-xs",onClick:m,disabled:!r||!a||r>a,children:"Apply"})]})})]})]})}function u1t(t){return{start_hour:new Date(`${t.startDate}T00:00:00Z`),end_hour:new Date(`${t.endDate}T23:59:59Z`)}}function d1t(){const t=di(),[e,n]=w.useState("30d"),[s,r]=w.useState(()=>p1("30d")),i=w.useCallback(E=>{n(E),E!=="custom"&&r(p1(E))},[]),a=w.useCallback(E=>{n("custom"),r(E)},[]),{data:o,isLoading:l}=Mbe({start_date:s.startDate,end_date:s.endDate}),{start_hour:u,end_hour:d}=u1t(s),{data:f,isLoading:p}=Dbe({start_hour:u,end_hour:d,limit:100}),m=(o==null?void 0:o.data)??[],v=(f==null?void 0:f.data)??[],x=m.reduce((E,T)=>E+T.total_bandwidth,0),y=m.reduce((E,T)=>
558E+T.bytes_received,0),S=m.reduce((E,T)=>E+T.bytes_sent,0),_=m.reduce((E,T)=>E+T.total_requests,0);return c.jsxs("div",{className:"flex flex-col flex-1 w-full overflow-y-auto",children:[c.jsx("div",{className:"flex flex-col gap-[0.5rem] p-[1.5rem] border-b-[0.5px] border-[var(--sand-6)]",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("h1",{className:"text-2xl text-[var(--sand-12)] font-normal",children:"Proxy Usage"}),c.jsx("p",{className:"text-sm text-[var(--sand-11)]",children:"Bandwidth and request analytics for your organization's proxy traffic."})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(LU,{dateRange:s,preset:e,onPresetChange:i,onCustomRangeChange:a}),c.jsx("button",{onClick:()=>t("/settings/proxy-usage/sessions"),className:"text-xs text-[var(--sand-11)] hover:text-[var(--sand-12)] transition-colors border-[0.5px] border-[var(--sand-6)] rounded-md px-3 py-1.5 hover:bg-[var(--sand-2)]",children:"View all sessions →"})]})]})}),c.jsxs("div",{className:"flex flex-col gap-6 p-[1.5rem]",children:[c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[{label:"Total Bandwidth",value:_i(x),accent:"var(--cyan-9)",loading:l},{label:"Data Received",value:_i(y),accent:"var(--pink-9)",loading:l},{label:"Data Sent",value:_i(S),accent:"var(--blue-9)",loading:l},{label:"Total Requests",value:_.toLocaleString(),accent:"var(--green-9)",loading:l}].map(({label:E,value:T,accent:k,loading:R})=>c.jsxs("div",{className:"flex flex-col gap-2 border-[0.5px] border-[var(--sand-6)] rounded-lg p-4 bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:k}}),c.jsx("span",{className:"text-xs text-[var(--sand-11)]",children:E})]}),c.jsx("span",{className:"text-2xl font-mono text-[var(--sand-12)]",children:c.jsx(Es,{loading:R,children:T})})]},E))}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsx("h2",{className:"text-base text-[var(--sand-12)] font-normal",children:"Top Domains"}),c.jsx("span",{className:"text-xs text-[var(--sand-11)]",children:v.length>0?`Top ${v.length}`:""})]}),c.jsx("div",{className:"border-[0.5px] border-[var(--sand-6)] rounded-lg overflow-x-auto",children:c.jsxs("table",{className:"w-full min-w-[640px] text-xs font-mono",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal w-8",children:"#"}),c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Domain"}),c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Provider"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Bandwidth"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Hits"})]})}),c.jsx("tbody",{children:p?Array.from({length:5}).map((E,T)=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0",children:[c.jsx("td",{className:"px-4 py-2 text-[var(--sand-11)]",children:T+1}),c.jsx("td",{className:"px-4 py-2",children:c.jsx(Es,{loading:!0,children:"example.com"})}),c.jsx("td",{className:"px-4 py-2",children:c.jsx(Es,{loading:!0,children:"Decodo"})}),c.jsx("td",{className:"px-4 py-2 text-right",children:c.jsx(Es,{loading:!0,children:"0.00 KB"})}),c.jsx("td",{className:"px-4 py-2 text-right",children:c.jsx(Es,{loading:!0,children:"0"})})]},T)):v.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-[var(--sand-11)]",children:"No traffic data found for this period."})}):v.map((E,T)=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0 hover:bg-[var(--sand-2)]",children:[c.jsx("td",{className:"px-4 py-2 text-[var(--sand-11)]",children:T+1}),c.jsx("td",{className:"px-4 py-2 text-[var(--sand-12)] max-w-[320px] truncate",children:E.domain}),c.jsx("td",{className:"px-4 py-2 text-[var(--sand-11)]",children:NU(E.proxy_provider)}),c.jsx("td",{className:"px-4 py-2 text-right text-[var(--sand-12)]",children:_i(E.total_bandwidth)}),c.jsx("td",{className:"px-4 py-2 text-right text-[var(--sand-12)]",children:E.hits.toLocaleStr
558ing()})]},E.domain))})]})})]}),c.jsx("div",{className:"flex justify-end pt-2",children:c.jsx(Hn,{to:"/settings/proxy-usage/sessions",className:"text-sm text-[var(--sand-11)] hover:text-[var(--sand-12)] transition-colors",children:"View all sessions →"})})]})]})}function f1t(t){return new Date(t.endsWith("Z")?t:t+"Z").toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function h1t(t){return new Date(t.endsWith("Z")?t:t+"Z").toLocaleString()}function p1t(){const t=di(),[e,n]=w.useState("30d"),[s,r]=w.useState(()=>p1("30d")),i=w.useCallback(y=>{n(y),y!=="custom"&&r(p1(y))},[]),a=w.useCallback(y=>{n("custom"),r(y)},[]),{data:o,isLoading:l,error:u}=Obe({start_date:s.startDate,end_date:s.endDate,limit:100}),d=(o==null?void 0:o.data)??[],[f,p]=w.useState(!1),[m,v]=w.useState(""),x=m?d.filter(y=>y.session_id.toLowerCase().includes(m.toLowerCase())):d;return c.jsxs("div",{className:"flex flex-col flex-1 w-full overflow-y-auto",children:[c.jsx("div",{className:"flex flex-col gap-[0.5rem] p-[1.5rem] border-b-[0.5px] border-[var(--sand-6)]",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--sand-11)] mb-1",children:[c.jsx(Hn,{to:"/settings/proxy-usage",className:"hover:text-[var(--sand-12)] transition-colors",children:"Proxy Usage"}),c.jsx("span",{children:"/"}),c.jsx("span",{className:"text-[var(--sand-12)]",children:"All Sessions"})]}),c.jsx("h1",{className:"text-2xl text-[var(--sand-12)] font-normal",children:"All Sessions"}),c.jsx("p",{className:"text-sm text-[var(--sand-11)]",children:"Per-session bandwidth and request totals for your organization."})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:d.length>0?`${x.length} sessions`:""}),c.jsxs("div",{className:"flex items-center gap-1",children:[f&&c.jsx("input",{autoFocus:!0,t
558ype:"text",value:m,onChange:y=>v(y.target.value),placeholder:"Search session ID…",className:"h-7 px-2 text-xs font-mono rounded border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)] text-[var(--sand-12)] placeholder:text-[var(--sand-10)] focus:outline-none focus:ring-1 focus:ring-[var(--sand-7)] w-56 transition-all"}),c.jsx("button",{onClick:()=>{f&&v(""),p(y=>!y)},title:f?"Close search":"Search sessions",className:"flex items-center justify-center h-7 w-7 rounded border-[0.5px] border-[var(--sand-6)] bg-[var(--sand-1)] hover:bg-[var(--sand-3)] text-[var(--sand-11)] hover:text-[var(--sand-12)] transition-colors",children:f?c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}):c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"5",cy:"5",r:"3.5",stroke:"currentColor",strokeWidth:"1.5"}),c.jsx("path",{d:"M8 8l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),c.jsx(LU,{dateRange:s,preset:e,onPresetChange:i,onCustomRangeChange:a})]})]})}),c.jsx("div",{className:"flex flex-col gap-4 p-[1.5rem]",children:u?c.jsx("p",{className:"text-sm text-red-500",children:"Failed to load sessions. Please try again later."}):c.jsx("div",{className:"border-[0.5px] border-[var(--sand-6)] rounded-lg overflow-x-auto",children:c.jsxs("table",{className:"w-full min-w-[720px] text-xs font-mono",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Session ID"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Last Active"}),c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Provider"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Total Bandwidth"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Requests"})]})}),c.jsx("tbody",{children:l?Array.from({length:8}).map((y,S)=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0",children:[c.jsx("td",{className:"px-4 py-2.5",children:c.jsx(Es,{loading:!0,children:"00000000-0000-0000-0000-000000000000"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"Jan 1, 12:00 PM"})}),c.jsx("td",{className:"px-4 py-2.5",children:c.jsx(Es,{loading:!0,children:"Decodo"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0.00 KB"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0"})})]},S)):x.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-[var(--sand-11)]",children:d.length===0?"No sessions found for this date range.":"No sessions match your search."})}):x.map(y=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0 hover:bg-[var(--sand-2)] cursor-pointer transition-colors",onClick:()=>t(`/settings/proxy-usage/sessions/${y.session_id}`),children:[c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-12)]",children:c.jsx(Hn,{to:`/settings/proxy-usage/sessions/${y.session_id}`,className:"hover:underline",onClick:S=>S.stopPropagation(),children:y.session_id.length>36?`${y.session_id.slice(0,8)}…${y.session_id.slice(-8)}`:y.session_id})}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-11)]",title:y.last_seen?h1t(y.last_seen):void 0,children:y.last_seen?f1t(y.last_seen):"—"}),c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-11)]",children:NU(y.proxy_provider)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:_i(y.total_bandwidth)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:y.total_requests.toLocaleString()})]},y.session_id))})]})})})]})}const fC=50;function m1t(){const{sessionId:t}=M5(),{data:e,isLoading:n,error:s}=$be({session_id:t??"",limit:100},!!t),r=(e==null?void 0:e.data)??[],[i,a]=w.useState(1),o=Math.max(1,Math.ceil(r.length/fC)),l=r.slice((i-1)*fC,i*fC),u=r.reduce((m,v)=>m+v.total_bandwidth,0),d=r.reduce((m,v)=>
558m+v.bytes_received,0),f=r.reduce((m,v)=>m+v.bytes_sent,0),p=r.reduce((m,v)=>m+v.hits,0);return c.jsxs("div",{className:"flex flex-col flex-1 w-full overflow-y-auto",children:[c.jsx("div",{className:"flex flex-col gap-[0.5rem] p-[1.5rem] border-b-[0.5px] border-[var(--sand-6)]",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--sand-11)] mb-1",children:[c.jsx(Hn,{to:"/settings/proxy-usage",className:"hover:text-[var(--sand-12)] transition-colors",children:"Proxy Usage"}),c.jsx("span",{children:"/"}),c.jsx(Hn,{to:"/settings/proxy-usage/sessions",className:"hover:text-[var(--sand-12)] transition-colors",children:"All Sessions"}),c.jsx("span",{children:"/"}),c.jsx("span",{className:"text-[var(--sand-12)]",children:"Detail"})]}),c.jsx("h1",{className:"text-2xl text-[var(--sand-12)] font-normal",children:"Session Detail"}),t&&c.jsx("p",{className:"text-sm text-[var(--sand-11)] font-mono break-all",children:t})]}),t&&c.jsx(Hn,{to:`/sessions/${t}`,className:"flex items-center gap-1.5 text-xs text-[var(--sand-11)] hover:text-[var(--sand-12)] transition-colors border-[0.5px] border-[var(--sand-6)] rounded-md px-3 py-1.5 hover:bg-[var(--sand-2)] flex-shrink-0",title:"Open this session in the Session Viewer",children:"Open in Session Viewer ↗"})]})}),c.jsxs("div",{className:"flex flex-col gap-4 p-[1.5rem]",children:[!n&&r.length>0&&c.jsx("div",{className:"flex flex-wrap gap-3",children:[{label:"Total Bandwidth",value:_i(u),accent:"var(--cyan-9)"},{label:"Total Received",value:_i(d),accent:"var(--pink-9)"},{label:"Total Sent",value:_i(f),accent:"var(--blue-9)"},{label:"Total Requests",value:p.toLocaleString(),accent:"var(--green-9)"}].map(({label:m,value:v,accent:x})=>c.jsxs("div",{className:"flex items-center gap-3 border-[0.5px] border-[var(--sand-6)] rounded-lg px-4 py-2.5 bg-[var(--sand-2)]",children:[c.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:x}}),c.jsx("span",{className:"text-xs text-[var(--sand-11)]",children:m}),c.jsx("span",{className:"text-sm font-mono text-[var(--sand-12)]",children:v})]},m))}),s?c.jsx("p",{className:"text-sm text-red-500",children:"Failed to load session details. Please try again later."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-[0.5px] border-[var(--sand-6)] rounded-lg overflow-x-auto",children:c.jsxs("table",{className:"w-full min-w-[760px] text-xs font-mono",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] bg-[var(--sand-2)]",children:[c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal w-8",children:"#"}),c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Domain"}),c.jsx("th",{className:"text-left px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Provider"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Bandwidth"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Received"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Sent"}),c.jsx("th",{className:"text-right px-4 py-2.5 text-[var(--sand-11)] font-normal",children:"Hits"})]})}),c.jsx("tbody",{children:n?Array.from({length:8}).map((m,v)=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0",children:[c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-11)]",children:v+1}),c.jsx("td",{className:"px-4 py-2.5",children:c.jsx(Es,{loading:!0,children:"example.com"})}),c.jsx("td",{className:"px-4 py-2.5",children:c.jsx(Es,{loading:!0,children:"Decodo"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0.00 KB"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0.00 KB"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0.00 KB"})}),c.jsx("td",{className:"px-4 py-2.5 text-right",children:c.jsx(Es,{loading:!0,children:"0"})})]},v)):r.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-[var(--sand-11)]",children:"No domain data found for this session."})}):l.map((m,v)=>c.jsxs("tr",{className:"border-b-[0.5px] border-[var(--sand-6)] last:border-0 hover:bg-[var(--sand-2)] transition-colors",children:[c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-11)]",children:(i-1)*fC+v+1}),c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-12)] max-w-[280px] truncate",children:m.domain}),c.jsx("td",{className:"px-4 py-2.5 text-[var(--sand-11)]",children:NU(m.proxy_provider)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:_i(m.total_bandwidth)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:_i(m.bytes_received)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:_i(m.bytes_sent)}),c.jsx("td",{className:"px-4 py-2.5 text-right text-[var(--sand-12)]",children:m.hits.toLocaleStr
558ing()})]},m.domain))})]})}),o>1&&c.jsxs("div",{className:"flex items-center justify-center gap-2",children:[c.jsx("button",{onClick:()=>a(m=>Math.max(1,m-1)),disabled:i===1,className:"h-8 w-8 flex items-center justify-center rounded border-[0.5px] border-[var(--sand-6)] text-[var(--sand-11)] hover:bg-[var(--sand-2)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:"m15 18-6-6 6-6"})})}),c.jsxs("span",{className:"text-sm text-[var(--sand-11)] px-2",children:["Page ",i," of ",o]}),c.jsx("button",{onClick:()=>a(m=>Math.min(o,m+1)),disabled:i===o,className:"h-8 w-8 flex items-center justify-center rounded border-[0.5px] border-[var(--sand-6)] text-[var(--sand-11)] hover:bg-[var(--sand-2)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:"m9 18 6-6-6-6"})})})]})]})]})]})}var jU={};(function t(e,n,s,r){var i=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),a=typeof Path2D=="function"&&typeof DOMMatrix=="function",o=(function(){if(!e.OffscreenCanvas)return!1;try{var z=new OffscreenCanvas(1,1),D=z.getContext("2d");D.fillRect(0,0,1,1);var K=z.transferToImageBitmap();D.createPattern(K,"no-repeat")}catch{return!1}return!0})();function l(){}function u(z){var D=n.exports.Promise,K=D!==void 0?D:e.Promise;return typeof K=="function"?new K(z):(z(l,l),null)}var d=(function(z,D){return{transform:function(K){if(z)return K;if(D.has(K))return D.get(K);var Y=new OffscreenCanvas(K.width,K.height),J=Y.getContext("2d");return J.drawImage(K,0,0),D.set(K,Y),Y},clear:function(){D.clear()}}})(o,new Map),f=(function(){var z=Math.floor(16.666666666666668),D,K,Y={},J=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(D=function(ne){var Q=Math.random();return Y[Q]=requestAnimationFrame(function ee(te){J===te||J+z-1<te?(J=te,delete Y[Q],ne()):Y[Q]=requestAnimationFrame(ee)}),Q},K=function(ne){Y[ne]&&cancelAnimationFrame(Y[ne])}):(D=function(ne){return setTimeout(ne,z)},K=function(ne){return clearTimeout(ne)}),{frame:D,cancel:K}})(),p=(function(){var z,D,K={};function Y(J){function ne(Q,ee){J.postMessage({options:Q||{},callback:ee})}J.init=function(ee){var te=ee.transferControlToOffscreen();J.postMessage({canvas:te},[te])},J.fire=function(ee,te,ue){if(D)return ne(ee,null),D;var ye=Math.random().toString(36).slice(2);return D=u(function(je){function Re(me){me.data.callback===ye&&(delete K[ye],J.removeEventListener("message",Re),D=null,d.clear(),ue(),je())}J.addEventListener("message",Re),ne(ee,ye),K[ye]=Re.bind(null,{data:{callback:ye}})}),D},J.reset=function(){J.postMessage({reset:!0});for(var ee in K)K[ee](),delete K[ee]}}return function(){if(z)return z;if(!s&&i){var J=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {","  if (msg.data.options) {","    CONFETTI(msg.data.options).then(function () {","      if (msg.data.callback) {","        postMessage({ callback: msg.data.callback });","      }","    });","  } else if (msg.data.reset) {","    CONFETTI && CONFETTI.reset();","  } else if (msg.data.resize) {","    SIZE.width = msg.data.resize.width;","    SIZE.height = msg.data.resize.height;","  } else if (msg.data.canvas) {","    SIZE.width = msg.data.canvas.width;","    SIZE.height = msg.data.canvas.height;","    CONFETTI = module.exports.create(msg.data.canvas);","  }","}"].join(`
559`);try{z=new Worker(URL.createObjectURL(new Blob([J])))}catch(ne){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",ne),null}Y(z)}return z}})(),m={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function v(z,D){return D?D(z):z}function x(z){return z!=null}function y(z,D,K){return v(z&&x(z[D])?z[D]:m[D],K)}function S(z){return z<0?0:Math.floor(z)}function _(z,D){return Math.floor(Math.random()*(D-z))+z}function E(z){return parseInt(z,16)}function T(z){return z.map(k)}function k(z){var D=String(z).replace(/[^0-9a-f]/gi,"");return D.length<6&&(D=D[0]+D[0]+D[1]+D[1]+D[2]+D[2]),{r:E(D.substring(0,2)),g:E(D.substring(2,4)),b:E(D.substring(4,6))}}function R(z){var D=y(z,"origin",Object);return D.x=y(D,"x",Number),D.y=y(D,"y",Number),D}function I(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function A(z){var D=z.getBoundingClientRect();z.width=D.width,z.height=D.height}function L(z){var D=document.createElement("canvas");return D.style.position="fixed",D.style.top="0px",D.style.left="0px",D.style.pointerEvents="none",D.style.zIndex=z,D}function j(z,D,K,Y,J,ne,Q,ee,te){z.save(),z.translate(D,K),z.rotate(ne),z.scale(Y,J),z.arc(0,0,1,Q,ee,te),z.restore(
vendor: 2,874 bytes, line 559
559)}function F(z){var D=z.angle*(Math.PI/180),K=z.spread*(Math.PI/180);return{x:z.x,y:z.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:z.startVelocity*.5+Math.random()*z.startVelocity,angle2D:-D+(.5*K-Math.random()*K),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:z.color,shape:z.shape,tick:0,totalTicks:z.ticks,decay:z.decay,drift:z.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:z.gravity*3,ovalScalar:.6,scalar:z.scalar,flat:z.flat}}function O(z,D){D.x+=Math.cos(D.angle2D)*D.velocity+D.drift,D.y+=Math.sin(D.angle2D)*D.velocity+D.gravity,D.velocity*=D.decay,D.flat?(D.wobble=0,D.wobbleX=D.x+10*D.scalar,D.wobbleY=D.y+10*D.scalar,D.tiltSin=0,D.tiltCos=0,D.random=1):(D.wobble+=D.wobbleSpeed,D.wobbleX=D.x+10*D.scalar*Math.cos(D.wobble),D.wobbleY=D.y+10*D.scalar*Math.sin(D.wobble),D.tiltAngle+=.1,D.tiltSin=Math.sin(D.tiltAngle),D.tiltCos=Math.cos(D.tiltAngle),D.random=Math.random()+2);var K=D.tick++/D.totalTicks,Y=D.x+D.random*D.tiltCos,J=D.y+D.random*D.tiltSin,ne=D.wobbleX+D.random*D.tiltCos,Q=D.wobbleY+D.random*D.tiltSin;if(z.fillStyle="rgba("+D.color.r+", "+D.color.g+", "+D.color.b+", "+(1-K)+")",z.beginPath(),a&&D.shape.type==="path"&&typeof D.shape.path=="string"&&Array.isArray(D.shape.matrix))z.fill(V(D.shape.path,D.shape.matrix,D.x,D.y,Math.abs(ne-Y)*.1,Math.abs(Q-J)*.1,Math.PI/10*D.wobble));else if(D.shape.type==="bitmap"){var ee=Math.PI/10*D.wobble,te=Math.abs(ne-Y)*.1,ue=Math.abs(Q-J)*.1,ye=D.shape.bitmap.width*D.scalar,je=D.shape.bitmap.height*D.scalar,Re=new DOMMatrix([Math.cos(ee)*te,Math.sin(ee)*te,-Math.sin(ee)*ue,Math.cos(ee)*ue,D.x,D.y]);Re.multiplySelf(new DOMMatrix(D.shape.matrix));var me=z.createPattern(d.transform(D.shape.bitmap),"no-repeat");me.setTransform(Re),z.globalAlpha=1-K,z.fillStyle=me,z.fillRect(D.x-ye/2,D.y-je/2,ye,je),z.globalAlpha=1}else if(D.shape==="circle")z.ellipse?z.ellipse(D.x,D.y,Math.abs(ne-Y)*D.ovalScalar,Math.abs(Q-J)*D.ovalScalar,Math.PI/10*D.wobble,0,2*Math.PI):j(z,D.x,D.y,Math.abs(ne-Y)*D.ovalScalar,Math.abs(Q-J)*D.ovalScalar,Math.PI/10*D.wobble,0,2*Math.PI);else if(D.shape==="star")for(var Ce=Math.PI/2*3,Xe=4*D.scalar,he=8*D.scalar,De=D.x,Ge=D.y,Je=5,Le=Math.PI/Je;Je--;)De=D.x+Math.cos(Ce)*he,Ge=D.y+Math.sin(Ce)*he,z.lineTo(De,Ge),Ce+=Le,De=D.x+Math.cos(Ce)*Xe,Ge=D.y+Math.sin(Ce)*Xe,z.lineTo(De,Ge),Ce+=Le;else z.moveTo(Math.floor(D.x),Math.floor(D.y)),z.lineTo(Math.floor(D.wobbleX),Math.floor(J)),z.lineTo(Math.floor(ne),Math.floor(Q)),z.lineTo(Math.floor(Y),Math.floor(D.wobbleY));return z.closePath(),z.fill(),D.tick<D.totalTicks}function M(z,D,K,Y,J){var ne=D.slice(),Q=z.getContext("2d"),ee,te,ue=u(function(ye){function je(){ee=te=null,Q.clearRect(0,0,Y.width,Y.height),d.clear(),J(),ye()}function Re(){s&&!(Y.width===r.width&&Y.height===r.height)&&(Y.width=z.width=r.width,Y.height=z.height=r.height),!Y.width&&!Y.he
559ight&&(K(z),Y.width=z.width,Y.height=z.height),Q.clearRect(0,0,Y.width,Y.height),ne=ne.filter(function(me){return O(Q,me)}),ne.length?ee=f.frame(Re):je()}ee=f.frame(Re),te=je});return{addFettis:function(ye){return ne=ne.concat(ye),ue},canvas:z,promise:ue,reset:function(){ee&&f.cancel(ee),te&&te()}}}function U(z,D){var K=!z,Y=!!y(D||{},"resize"),J=!1,ne=y(D,"disableForReducedMotion",Boolean),Q=i&&!!y(D||{},"useWorker"),ee=Q?p():null,te=K?I:A,ue=z&&ee?!!z.__confetti_initialized:!1,ye=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,je;function Re(Ce,Xe,he){for(var De=y(Ce,"particleCount",S),Ge=y(Ce,"angle",Number),Je=y(Ce,"spread",Number),Le=y(Ce,"startVelocity",Number),qe=y(Ce,"decay",Number),et=y(Ce,"gravity",Number),Ct=y(Ce,"drift",Number),Ke=y(Ce,"colors",T),dt=y(Ce,"ticks",Number),Xt=y(Ce,"shapes"),_n=y(Ce,"scalar"),Dt=!!y(Ce,"flat"),nn=R(Ce),fn=De,Tt=[],Ie=z.width*nn.x,Z=z.height*nn.y;fn--;)Tt.push(F({x:Ie,y:Z,angle:Ge,spread:Je,startVelocity:Le,color:Ke[fn%Ke.length],shape:Xt[_(0,Xt.length)],ticks:dt,decay:qe,gravity:et,drift:Ct,scalar:_n,flat:Dt}));return je?je.addFettis(Tt):(je=M(z,Tt,te,Xe,he),je.promise)}function me(Ce){var Xe=ne||y(Ce,"disableForReducedMotion",Boolean),he=y(Ce,"zIndex",Number);if(Xe&&ye)return u(function(Le){Le()});K&&je?z=je.canvas:K&&!z&&(z=L(he),document.body.appendChild(z)),Y&&!ue&&te(z);var De={width:z.width,height:z.height};ee&&!ue&&ee.init(z),ue=!0,ee&&(z.__confetti_initialized=!0);function Ge(){if(ee){var Le={getBoundingClientRect:function(){if(!K)return z.getBoundingClientRect()}};te(Le),ee.postMessage({resize:{width:Le.width,height:Le.height}});return}De.width=De.height=null}function Je(){je=null,Y&&(J=!1,e.removeEventListener("resize",Ge)),K&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,ue=!1)}return Y&&!J&&(J=!0,e.addEventListener("resize",Ge,!1)),ee?ee.fire(Ce,De,Je):Re(Ce,De,Je)}return me.reset=function(){ee&&ee.reset(),je&&je.reset()},me}var G;function $(){return G||(G=U(null,{useWorker:!0,resize:!0})),G}function V(z,D,K,Y,J,ne,Q){var ee=new Path2D(z),te=new Path2D;te.addPath(ee,new DOMMatrix(D));var ue=new Path2D;return ue.addPath(te,new DOMMatrix([Math.cos(Q)*J,Math.sin(Q)*J,-Math.sin(Q)*ne,Math.cos(Q)*ne,K,Y])),ue}function B(z){if(!a)throw new Error("path confetti are not supported in this browser");var D,K;typeof z=="string"?D=z:(D=z.path,K=z.matrix);var Y=new Path2D(D),J=document.createElement("canvas"),ne=J.getContext("2d");if(!K){for(var Q=1e3,ee=Q,te=Q,ue=0,ye=0,je,Re,me=0;me<Q;me+=2)for(var Ce=0;Ce<Q;Ce+=2)ne.isPointInPath(Y,me,Ce,"nonzero")&&(ee=Math.min(ee,me),te=Math.min(te,Ce),ue=Math.max(ue,me),ye=Math.max(ye,Ce));je=ue-ee,Re=ye-te;var Xe=10,he=Math.min(Xe/je,Xe/Re);K=[he,0,0,he,-Math.round(je/2+ee)*he,-Math.round(Re/2+te)*he]}return{type:"path",path:D,matrix:K}}function q(z){var D,K=1,Y="#000000",J='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof z=="string"?D=z:(D=z.text,K="scalar"in z?z.scalar:K,J="fontFamily"in z?z.fontFamily:J,Y="color"in z?z.color:Y);var ne=10*K,Q=""+ne+"px "+J,ee=new OffscreenCanvas(ne,ne),te=ee.getContext("2d");te.font=Q;var ue=te.measureText(D),ye=Math.ceil(ue.actualBoundingBoxRight+ue.actualBoundingBoxLeft),je=Math.ceil(ue.actualBoundingBoxAscent+ue.actualBoundingBoxDescent),Re=2,me=ue.actualBoundingBoxLeft+Re,Ce=ue.actualBoundingBoxAscent+Re;ye+=Re+Re,je+=Re+Re,ee=new OffscreenCanvas(ye,je),te=ee.getContext("2d"),te.font=Q,te.fillStyle=Y,te.fillText(D,me,Ce);var Xe=1/K;return{type:"bitmap",bitmap:ee.transferToImageBitmap(),matrix:[Xe,0,0,Xe,-ye*Xe/2,-je*Xe/2]}}n.exports=function(){return $().apply(this,arguments)},n.exports.reset=function(){$().reset()},n.exports.create=U,n.exports.shapeFromPath=B,n.exports.shapeFromText=q})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),jU,!1);const g1t=jU.exports;jU.exports.create;const v1t=t=>t.endsWith("new plan")?t:`the ${t.charAt(0).toUpperCase()+t.slice(1)} plan`,x1t=({onComplete:t,planName:e="your new plan",usageDetails:n})=>{const s=v1t(e),[r,i]=w.useState("loading"),[a,o]=w.useState(0),l=w.useEffectEvent(()=>t==null?void 0:t());w.useEffect(()=>{const d=setTimeout(()=>{i("processing")},2e3),f=setInterval(()=>{o(v=>v>=100?100:v+Math.random()*15)},150),p=setTimeout(()=>{o(100),setTimeout(()=>{i("complete"),u()},100)},4e3),m=setTimeout(()=>{l()},6e3);return()=>{clearTimeout(d),clearTimeout(p),clearTimeout(m),clearInterval(f)}},[]),w.useEffect(()=>{if(!n)return;i("complete"),u();const d=setTimeout(()=>{l()},2e3);return()=>clearTimeout(d)},[n]);const u=()=>{const f={origin:{y:.7},zIndex:9999};function p(m,v){g1t({...f,...v,particleCount:Math.floor(200*m)})}p(.25,{spread:26,startVelocity:55}),p(.2,{spread:60}),p(.35,{spread:100,decay:.91,scalar:.8}),p(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),p(.1,{spread:120,startVelocity:45,origin:{x:.1,y:.6}}),p(.1,{spread:120,startVelocity:45,origin:{x:.9,y:.6}})};return c.jsx("div",{className:"flex flex-col h-full items-center justify-center p-8",children:c.jsx(TS,{className:"relative border-2 border-[var(--sand-3)] bg-[var(--sand-2)] pb-0 max-h-[500px] max-w-[400px] flex flex-col p-8",children:c.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-md text-center",children:[c.jsxs("div",{className:"relative",children:[r==="processing"&&c.jsx("div",{className:"relative",children:c.jsx("div",{className:"w-16 h-16 rounded-full border-4 border-[var(--violet-4)] flex items-center justify-center animate-pulse",children:c.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--violet-9)] animate-ping"})})}),r==="complete"&&c.jsx("div",{className:"animate-in zoom-in-50 duration-500",children:c.jsx("div",{className:"w-16 h-16 rounded-full bg-[var(--green-4)] flex items-center justify-center animate-in fade-in slide-in-from-bottom-4 duration-500",children:c.jsx(xFe,{className:"w-10 h-10 text-[var(--green-11)]"})})})]}),c.jsxs("div",{className:"space-y-2",children:[r==="loading"&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{className:"text-xl font-semibold text-[var(--sand-12)]",children:"Processing your subscription..."}),c.jsxs("p",{className:"text-[var(--sand-11)]",children:["We're setting up ",s," for you"]})]}),r==="processing"&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{className:"text-xl font-semibold text-[var(--sand-12)]",children:"Almost there!"}),c.jsx("p",{className:"text-[var(--sand-11)]",children:"Finalizing your subscription details..."})]}),r==="complete"&&c.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-4 duration-500",children:[c.jsxs("h2",{className:"text-2xl font-bold text-[var(--green-11)] mb-2",children:["🎉 Welcome to ",s,"!"]}),c.jsx("p",{className:"text-[var(--sand-11)]",children:"Your subscription is now active and ready to use"})]})]}),r!=="complete"&&c.jsxs("div",{className:"flex space-x-2",children:[c.jsx("div",{className:He("w-2 h-2 rounded-full bg-[var(--sand-9)]","animate-bounce"),style:{animationDelay:"0ms"}}),c.jsx("div",{className:He("w-2 h-2 rounded-full bg-[var(--sand-9)]","animate-bounce"),style:{animationDelay:"150ms"}}),c.jsx("div",{className:He("w-2 h-2 rounded-full bg-[var(--sand-9)]","animate-bounce"),style:{animationDelay:"300ms"}})]})]})})})};function hC(t,e){const n=new Date(t*1e3),s=n.getUTCFullYear(),r=String(n.getUTCMonth()+1).padStart(2,"0"),i=String(n.getUTCDate()).padStart(2,"0"),a=`${s}-${r}-${i}`;let o=e.get(a);return o||(o={date:n,dateString:a,browserUsage:0,proxyGB:0,captchaSolves:0,scrapes:0,browserCost:0,proxyCost:0,captchaCost:0,scrapeCost:0,totalCost:0},e.set(a,o)),o}function Wbe(t,e){var r,i,a,o,l,u,d,f;const n=new Map;(i=(r=t.browserUsageDetails)==null?void 0:r.data)==null||i.forEac
559h(p=>{const m=hC(p.start_time,n);m.browserUsage+=p.aggregated_value,m.browserCost+=p.aggregated_value*e.browser}),(o=(a=t.proxyUsageDetails)==null?void 0:a.data)==null||o.forEach(p=>{const m=hC(p.start_time,n);m.proxyGB=p.aggregated_value/(1024*1024*1024),m.proxyCost=p.aggregated_value*e.proxy}),(u=(l=t.captchaUsageDetails)==null?void 0:l.data)==null||u.forEach(p=>{const m=hC(p.start_time,n);m.captchaSolves=p.aggregated_value,m.captchaCost=p.aggregated_value*e.captcha}),(f=(d=t.scrapeUsageDetails)==null?void 0:d.data)==null||f.forEach(p=>{const m=hC(p.start_time,n);m.scrapes=p.aggregated_value,m.scrapeCost=p.aggregated_value*e.scrape});const s=Array.from(n.values());return s.forEach(p=>{p.totalCost=p.browserCost+p.proxyCost+p.captchaCost+p.scrapeCost}),s.sort((p,m)=>m.date.getTime()-p.date.getTime())}function y1t({breakdownData:t,planRates:e,isLoading:n}){const r=((t==null?void 0:t.browserUsageUnit)??"minute")==="second"?"sec":"min",i=o=>o.toLocaleString("en-US"),a=w.useMemo(()=>t?Wbe(t,e):[],[t,e]);return n&&!a.length?c.jsx("div",{className:"flex flex-col gap-2",children:c.jsx("div",{className:"text-sm text-[var(--sand-11)]",children:"Loading daily breakdown..."})}):a.length?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("div",{className:"border border-[var(--sand-6)] rounded-lg max-h-[400px] overflow-y-auto",children:c.jsxs("table",{className:"w-full caption-bottom text-sm",children:[c.jsx("thead",{className:"sticky top-0 bg-[var(--sand-2)] z-10 shadow-[0_1px_0_var(--sand-6)]",children:c.jsxs("tr",{className:"border-b border-[var(--sand-6)]",children:[c.jsx("th",{className:"h-10 px-2 text-left align-middle font-medium text-muted-foreground",children:"Date"}),c.jsx("th",{className:"h-10 px-2 text-right align-middle font-medium text-muted-foreground",children:"Browser"}),c.jsx("th",{className:"h-10 px-2 text-right align-middle font-medium text-muted-foreground",children:"Proxy"}),c.jsx("th",{className:"h-10 px-2 text-right align-middle font-medium text-muted-foreground",children:"Captcha"}),c.jsx("th",{className:"h-10 px-2 text-right align-middle font-medium text-muted-foreground",children:"Scrapes"}),c.jsx("th",{className:"h-10 px-2 text-right align-middle font-semibold text-muted-foreground",children:"Total Cost"})]})}),c.jsx("tbody",{className:"[&_tr:last-child]:border-0",children:a.map(o=>c.jsxs("tr",{className:"border-b border-[var(--sand-6)] transition-colors hover:bg-[var(--sand-3)]",children:[c.jsx("td",{className:"p-2 align-middle font-medium",children:new Date(o.date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"})}),c.jsx("td",{className:"p-2 align-middle text-right font-mono text-sm",children:c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-[var(--sand-12)]",children:[i(o.browserUsage)," ",r]}),c.jsxs("span",{className:"text-[var(--sand-11)] text-xs",children:["$",o.browserCost.toFixed(4)]})]})}),c.jsx("td",{className:"p-2 align-middle text-right font-mono text-sm",children:c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-[var(--sand-12)]",children:[o.proxyGB.toFixed(3)," GB"]}),c.jsxs("span",{className:"text-[var(--sand-11)] text-xs",children:["$",o.proxyCost.toFixed(4)]})]})}),c.jsx("td",{className:"p-2 align-middle text-right font-mono text-sm",children:c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-[var(--sand-12)]",children:[o.captchaSolves," solves"]}),c.jsxs("span",{className:"text-[var(--sand-11)] text-xs",children:["$",o.captchaCost.toFixed(4)]})]})}),c.jsx("td",{className:"p-2 align-middle text-right font-mono text-sm",children:c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-[var(--sand-12)]",children:[o.scrapes," scrapes"]}),c.jsxs("span",{className:"text-[var(--sand-11)] text-xs",children:["$",o.scrapeCost.toFixed(4)]})]})}),c.jsxs("td",{className:"p-2 align-middle text-right font-mono font-semibold text-[var(--sand-12)]",children:["$",o.totalCost.toFixed(4)]})]},o.dateString))})]})}),c.jsx("div",{className:"flex items-center justify-between text-xs text-[var(--sand-11)] mt-2",children:c.jsxs("span",{children:["Showing ",a.length," day",a.length!==1?"s":""," of usage"," ",c.jsx("span",{className:"font-bold",children:"(UTC timezone)"})]})})]}):c.jsx("div",{className:"flex flex-col gap-2",children:c.jsx("div",{className:"text-sm text-[var(--sand-11)]",children:"No usage data available for this period."})})}function b1t(t,e,n){if(!t)return;const s=Wbe(t,e),o=[["Date",(t.browserUsageUnit??"minute")==="second"?"Browser (sec)":"Browser (min)","Proxy (GB)","Captcha Solves","Scrapes","Browser Cost","Proxy Cost","Captcha Cost","Scrape Cost","Total Cost"].join(","),...s.map(f=>`${f.dateString},${Math.round(f.browserUsage)},${f.proxyGB.toFixed(4)},${f.captchaSolves},${f.scrapes},${f.browserCost.toFixed(4)},${f.proxyCost.toFixed(4)},${f.captchaCost.toFixed(4)},${f.scrapeCost.toFixed(4)},${f.totalCost.toFixed(4)}`)].join(`
560`),l=new Blob([o],{type:"text/csv"}),u=URL.createObjectURL(l),d=document.createElement("a");d.href=u,d.download=`steel-usage-breakdown-${n.startDate}_${n.endDate}.csv`,d.click(),d.remove(),URL.revokeObjectURL(u),Ao({title:"CSV Exported",duration:1e3})}function S1t(t){return t==="launch"||t==="starter"||t==="developer"||t==="pro"}function w1t(){return c.jsx("div",{className:"w-[20px] h-[20px] rounded-full bg-[var(--sand-12)] flex items-center justify-center",children:c.jsx(jde,{className:"w-[12px] h-[12px] text-[var(--sand-1)]",strokeWidth:3})})}function _1t({currentPlan:t,isLoading:e,planMetadata:n}){const[s,r]=w.useState(null),{createCheckoutSession:i}=fr(),a=async o=>{if(o!==t&&S1t(o)){r(o);try{const l=await i({plan:o});l.url&&(window.location.href=l.url)}catch(l){console.error("Failed to create checkout session:",l)}}};return c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[1.5rem]",children:Object.entries(n).map(([o,l])=>{if(!l)return null;const u=o===t,d=n[t],f=(l.price??0)>((d==null?void 0:d.price)??0);return o==="hobby"||o==="enterprise"?null:c.jsxs(TS,{className:"relative border-2 border-[var(--sand-3)] bg-[var(--sand-2)] pb-0 max-h-[500px] flex flex-col",children:[c.jsxs(T4,{className:"pb-4 border-b border-[var(--sand-3)]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(l.icon,{color:l.accentTextColor}),c.jsx(k4,{className:"text-md font-normal",style:{color:l.accentTextColor},children:l.name})]}),c.jsxs("div",{className:"flex items-baseline gap-1",children:[c.jsxs("span",{className:"text-2xl",children:["$",l.price]}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:"per month"})]}),c.jsxs(R4,{children:["$",l.credits," in credits included"]})]}),c.jsx(A4,{className:"space-y-2 pt-4 border-b border-[var(--sand-3)] flex-1",children:l.features.map((v,x)=>c.jsxs("div",{className:"flex items-center gap-[9px]",children:[c.jsx(w1t,{}),c.jsx("span",{className:"text-sm",children:v.amount>1?c.jsxs("span",{className:"text-sm",children:[v.amount>1e3?`${Math.round(v.amount/1e3*100)/100}k`:v.amount," ",c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:v.label})]}):c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:v.label})})]},x))}),c.jsx(Cde,{className:"pt-4",children:c.jsx(US,{loading:e,children:c.jsxs(Zt,{onClick:()=>a(o),disabled:u||s===o,className:`w-full font-normal ${u?"bg-gray-200 text-gray-500 cursor-not-allowed":""}`,style:{backgroundColor:l.accentColor,color:l.buttonTextColor},variant:u?"outline":"default",children:[s===o?"Loading Plan...":u?"Current Plan":f?"Upgrade Plan":"Downgrade Plan"," "]})})})]},o)})})}function E1t({usageDetails:t,isLoading:e,planRates:n,totalSpend:s,availableCredit:r}){var I,A,L,j,F,O,M,U;const i=e?100:((A=(I=t==null?void 0:t.proxyUsageDetails)==null?void 0:I.data)==null?void 0:A.reduce((G,$)=>G+$.aggregated_value,0))||0,a=i/1024/1024,o=e?1e3:((j=(L=t==null?void 0:t.browserUsageDetails)==null?void 0:L.data)==null?void 0:j.reduce((G,$)=>G+$.aggregated_value,0))||0,l=(t==null?void 0:t.browserUsageUnit)??"minute",u=l==="second"?"Browser Seconds":"Browser Minutes",d=l==="second"?"sec":"min",f=o.toLocaleStr
560ing("en-US"),p=e?1e3:((O=(F=t==null?void 0:t.captchaUsageDetails)==null?void 0:F.data)==null?void 0:O.reduce((G,$)=>G+$.aggregated_value,0))||0,m=e?1e3:((U=(M=t==null?void 0:t.scrapeUsageDetails)==null?void 0:M.data)==null?void 0:U.reduce((G,$)=>G+$.aggregated_value,0))||0,v=o*n.browser,x=i*n.proxy,y=p*n.captcha,S=m*n.scrape,_=Math.max(s,r),E=_>0?v/_*100:0,T=_>0?x/_*100:0,k=_>0?y/_*100:0,R=_>0?S/_*100:0;return c.jsxs("div",{className:"bg-[var(--sand-1)]",children:[c.jsxs("div",{className:"flex space-x-4 mb-6",children:[c.jsxs("div",{className:"flex items-center gap-2 border border-[var(--sand-3)] rounded-lg p-2 bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]",children:[c.jsx("div",{className:"w-3 h-3 rounded-full bg-[var(--green-9)]"}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:u})]}),c.jsx("div",{className:"flex-1 flex items-center gap-2",children:c.jsxs("span",{className:"text-sm font-mono text-[var(--sand-12)]",children:[c.jsx(Es,{loading:e,children:f})," ",d," /"," ",c.jsxs(Es,{loading:e,children:["$",v.toFixed(3)]})]})})]}),c.jsxs("div",{className:"flex items-center gap-2 border border-[var(--sand-3)] rounded-lg p-2 bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]",children:[c.jsx("div",{className:"w-3 h-3 rounded-full bg-[var(--pink-9)]"}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:"Proxy Bandwidth"})]}),c.jsx("div",{className:"flex-1 flex items-center gap-2",children:c.jsxs("span",{className:"text-sm font-mono text-[var(--sand-12)]",children:[c.jsx(Es,{loading:e,children:e?"1.90 GB":a>.1?`${(a/1024).toFixed(2)} GB`:`${a.toFixed(2)} MB`})," ","/ ",c.jsxs(Es,{loading:e,children:["$",x.toFixed(3)]})]})})]}),c.jsxs("div",{className:"flex items-center gap-2 border border-[var(--sand-3)] rounded-lg p-2 bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]",children:[c.jsx("div",{className:"w-3 h-3 rounded-full bg-[var(--blue-9)]"}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:"Captcha Solves"})]}),c.jsx("div",{className:"flex-1 flex items-center gap-2",children:c.jsxs("span",{className:"text-sm font-mono text-[var(--sand-12)]",children:[c.jsx(Es,{loading:e,children:p})," solves /"," ",c.jsxs(Es,{loading:e,children:["$",y.toFixed(3)]})]})})]}),c.jsxs("div",{className:"flex items-center gap-2 border border-[var(--sand-3)] rounded-lg p-2 bg-[var(--sand-2)]",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]",children:[c.jsx("div",{className:"w-3 h-3 rounded-full bg-[var(--amber-9)]"}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:"Scrapes"})]}),c.jsx("div",{className:"flex-1 flex items-center gap-2",children:c.jsxs("span",{className:"text-sm font-mono text-[var(--sand-12)]",children:[c.jsx(Es,{loading:e,children:m})," scrapes /"," ",c.jsxs(Es,{loading:e,children:["$",S.toFixed(3)]})]})})]})]}),c.jsx("div",{className:"mb-6",children:c.jsxs("div",{className:"flex h-2 bg-[var(--sand-3)] rounded-full overflow-hidden",children:[c.jsx("div",{className:"bg-[var(--green-9)] h-full slide-in-from-left",style:{width:`${e?0:E}%`}}),c.jsx("div",{className:"bg-[var(--pink-9)] h-full slide-in-from-left",style:{width:`${e?0:T}%`}}),c.jsx("div",{className:"bg-[var(--blue-9)] h-full slide-in-from-left",style:{width:`${e?0:k}%`}}),c.jsx("div",{className:"bg-[var(--amber-9)] h-full slide-in-from-left",style:{width:`${e?0:R}%`}})]})})]})}const C1t=({isPolling:t,incomingPlan:e,onSuccess:n,pollingInterval:s=1e3,maxPollingDuration:r=12e3})=>{const[i,a]=w.useState({isPolling:!1,isComplete:!1,data:null,error:null}),{useUsageDetails:o}=fr(),{refetch:l}=o(),u=w.useRef(n),d=w.useRef(t);u.current=n,d.current=t;const f=w.useCallback(async()=>{var p;try{const m=await l();return m.data&&m.data.plan===e?(a({isPolling:!1,isComplete:!0,data:m.data,error:null}),(p=u.current)==null||p.call(u,m.data),!0):!1}catch(m){return console.error("Error polling subscription status:",m),a(v=>({...v,isPolling:!1,error:"Failed to verify subscription status. Please refresh the page."})),!0}},[l]);return w.useEffect(()=>{if(!t){a(S=>({...S,isPolling:!1}));return}a(S=>({...S,isPolling:!0,error:null}));let p=0,m,v=!1;const x=Math.floor(r/s),y=async()=>
560{if(!(v||await f()||v)){if(p++,p>=x){v||a(_=>({..._,isPolling:!1,error:"Subscription verification timed out. Please refresh the page."}));return}v||(m=setTimeout(y,s))}};return y(),()=>{v=!0,m&&clearTimeout(m)}},[t,s,r,f]),i},z8={hobby:1e3,starter:2900,developer:9900,pro:49900,enterprise:3e5,admin:1e6},Rp={hobby:{browser:.0017,proxy:0,captcha:0,scrape:0},launch:{browser:.0016666667,proxy:1e-8,captcha:.003,scrape:.005},starter:{browser:.001677,proxy:1e-8,captcha:.004,scrape:0},developer:{browser:.0014,proxy:8e-9,captcha:.0035,scrape:0},pro:{browser:84e-5,proxy:5e-9,captcha:.003,scrape:0},enterprise:{browser:67e-5,proxy:3e-9,captcha:.003,scrape:0},admin:{browser:1e-10,proxy:1e-10,captcha:.03,scrape:.005}};function T1t({subscriptionStatus:t,newUsageDetails:e,setSearchParams:n}){var s;if(t.error)throw new Error(t.error);return c.jsx(x1t,{usageDetails:e,onComplete:()=>{n(new URLSearchParams)},planName:((s=t.data)==null?void 0:s.plan)||"your new plan"})}function k1t(){var ne,Q,ee,te,ue,ye,je,Re,me,Ce,Xe,he,De,Ge,Je,Le;const[t,e]=Po(),n=t.get("success")==="true",s=t.get("incoming_plan"),[r,i]=w.useState(),[a,o]=w.useState("7d"),[l,u]=w.useState(()=>p1("7d")),d=w.useCallback(qe=>{o(qe),qe!=="custom"&&u(p1(qe))},[]),f=w.useCallback(qe=>{o("custom"),u(qe)},[]),{openPortal:p,opening:m}=vbe(),v=()=>void p({newTab:!1}),{useUsageDetails:x}=fr(),{data:y,isLoading:S}=x(),{data:_,isLoading:E,isFetching:T}=_U(l,!n),k=y==null?void 0:y.planMetadataOverrides,R=w.useMemo(()=>nft((k==null?void 0:k.planMetadata)??null),[k==null?void 0:k.planMetadata]),I=w.useMemo(()=>{const qe=k==null?void 0:k.planAmountCredits;return!qe||Object.keys(qe).length===0?z8:{...z8,...qe}},[k==null?void 0:k.planAmountCredits]),A=w.useMemo(()=>{const qe=k==null?void 0:k.planRates;if(!qe||Object.keys(qe).length===0)return Rp;const et={};for(const[Ct,Ke]of Object.entries(Rp)){const dt=qe[Ct];et[Ct]={browser:(dt==null?void 0:dt.browser)??Ke.browser,proxy:(dt==null?void 0:dt.proxy)??Ke.proxy,captcha:(dt==null?void 0:dt.captcha)??Ke.captcha,scrape:(dt==null?void 0:dt.scrape)??Ke.scrape}}for(const[Ct,Ke]of Object.entries(qe))et[Ct]||(et[Ct]={browser:Ke.browser??Rp.hobby.browser,proxy:Ke.proxy??Rp.hobby.proxy,captcha:Ke.captcha??Rp.hobby.captcha,scrape:Ke.scrape??Rp.hobby.scrape});return et},[k==null?void 0:k.planRates]),L=C1t({isPolling:n,incomingPlan:s||"starter",onSuccess:qe=>{i(qe)}}),j=(y==null?void 0:y.plan)||"hobby",F=R[j]||C5.hobby,O=A[j]||A.hobby||Rp.hobby,M=(y==null?void 0:y.browserUsageUnit)==="second"&&((Q=(ne=k==null?void 0:k.planRates)==null?void 0:ne[j])==null?void 0:Q.browser)===void 0?O.browser/60:O.browser,U={...O,browser:M},G=I[j]??I.hobby??z8.hobby;if(n)return c.jsx(pY,{context:"success",planName:((ee=L.data)==null?void 0:ee.plan)||s||"unknown",children:c.jsx(T1t,{subscriptionStatus:L,incomingPlan:s,newUsageDetails:r,setSearchParams:e})});const $=((Re=(je=(ye=(ue=(te=y==null?void 0:y.creditBalanceSummary)==null?void 0:te.balances)==null?void 0:ue[0])==null?void 0:ye.available_balance)==null?void 0:je.monetary)==null?void 0:Re.value)??G,V=Math.max(0,Math.min(G,$)),B=Math.max(0,G-V),q=((Ce=(me=y==null?void 0:y.proxyUsageDetails)==null?void 0:me.data)==null?void 0:Ce.reduce((qe,et)=>qe+et.aggregated_value,0))||0,z=((he=(Xe=y==null?void 0:y.browserUsageDetails)==null?void 0:Xe.data)==null?void 0:he.reduce((qe,et)=>qe+et.aggregated_value,0))||0,D=((Ge=(De=y==null?void 0:y.captchaUsageDetails)==null?void 0:De.data)==null?void 0:Ge.reduce((qe,et)=>qe+et.aggregated_value,0))||0,K=((Le=(Je=y==null?void 0:y.scrapeUsageDetails)==null?void 0:Je.data)==null?void 0:Le.reduce((qe,et)=>qe+et.aggregated_value,0))||0,Y=z*U.browser+q*U.proxy+D*U.captcha+K*U.scrape,J=()=>{};return c.jsx(pY,{context:"usage-dashboard",planName:j,children:c.jsxs("div",{className:"flex flex-col flex-1 w-full overflow-y-auto",children:[c.jsxs("div",{className:"flex flex-col gap-[1.5rem] p-[1.5rem] border-b-[0.5px] border-[var(--sand-6)]",children:[c.jsx("div",{className:"flex flex-col gap-[0.5rem]",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h1",{className:"text-2xl text-[var(--sand-12)] font-normal",children:"Plans"}),S?c.jsx(US,{className:"w-48 h-6 rounded-md"}):c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Zt,{variant:"outline",size:"sm",disabled:m,className:"text-[var(--sand-11)] gap-2 font-[14px] bg-[var(--sand-2)]",onClick:v,children:["Manage Billing",c.jsx(NFe,{className:"h-4 w-4"})]}),c.jsxs(HS,{children:[c.jsx(GS,{asChild:!0,children:c.jsxs(Zt,{variant:"outline",size:"sm",className:"text-[var(--sand-11)] gap-2 font-[14px] bg-[var(--sand-2)]",children:[c.jsx("span",{className:"text-[var(--sand-12)]",children:"Current Plan:"}),c.jsx(F.icon,{className:"h-[20px] w-[18px]",color:F.accentTextColor}),c.jsx("span",{style:{color:F.accentTextColor},children:F.name}),c.jsx(lde,{className:"h-4 w-4"})]})}),c.jsx(Q1,{className:"w-56 p-0 border-[var(--sand-6)] bg-[var(--sand-2)] text-[var(--sand-12)]",align:"end",children:c.jsx("div",{className:"flex flex-col",children:c.jsxs(Zt,{variant:"ghost",className:"h-8 flex justify-between rounded-sm text-[var(--sand-11)] hover:bg-[var(--sand-3)] hover:text-[var(--sand-12)]",disabled:m,onClick:v,children:["Payment Methods",c.jsx(pFe,{className:"h-4 w-4"})]})})})]})]})]})}),c.jsx(_1t,{currentPlan:j,onPlanChange:J,isLoading:S,planMetadata:R})]}),c.jsxs("div",{className:"flex flex-col gap-2 p-[1.5rem]",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"flex gap-[1rem] items-center justify-end",children:c.jsx("h1",{className:"text-xl text-[var(--sand-12)] font-normal",children:"This Month's Usage"})}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("h1",{className:"text-md text-[var(--sand-11)] font-mono",children:[c.jsx(Es,{loading:S,children:new Date((y==null?void 0:y.lastBillingDate)||"").toLocaleDateString()})," ","- Today"]})})]}),c.jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto",children:[c.jsx(E1t,{usageDetails:y,isLoading:S,planRates:U,totalSpend:Y,availableCredit:V/100}),c.jsx("div",{className:"pt-3",children:c.jsxs(G$,{className:"text-sm",children:["You've used"," ",c.jsx(Es,{loading:S,children:c.jsxs("span",{className:"font-bold",children:["$",(B/100).toFixed(2)]})})," ","out of"," ",c.jsx(Es,{loading:S,children:c.jsxs("span",{className:"font-bold",children:["$",G/100]})})," ","total credits this period. The next payment of"," ",c.jsx(Es,{loading:S,children:c.jsxs("span",{className:"font-bold",children:["$",G/100]})})," ","will be charged on"," ",c.jsx(Es,{loading:S,children:c.jsx("span",{className:"font-bold",children:y!=null&&y.nextBillingDate?new Date(y==null?void 0:y.nextBillingDate).toLocaleDateString():new Date(new Date((y==null?void 0:y.lastBillingDate)||"").setMonth(new Date((y==null?void 0:y.lastBillingDate)||"").getMonth()+1)).toLocaleDateString()})}),"."]})}),c.jsxs("div",{className:"pt-6 relative",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("div",{className:"flex flex-col gap-1",children:c.jsx("h2",{className:"text-xl text-[var(--sand-12)] font-normal",children:"Daily Breakdown"})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Zt,{variant:"outline",size:"sm",onClick:()=>b1t(_,U,l),disabled:!_||E,className:"h-8 text-[var(--sand-11)] gap-2 text-xs",children:[c.jsx(T7,{className:"h-3 w-3"}),"Export CSV"]}),c.jsx(LU,{dateRange:l,preset:a,onPresetChange:d,onCustomRangeChange:f})]})]}),T&&c.jsx("div",{className:"absolute inset-0 bg-[var(--sand-1)]/60 backdrop-blur-[2px] flex items-center justify-center z-10 rounded-lg",children:c.jsxs("div",{className:"flex flex-col items-center gap-3",children:[c.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--sand-11)]"}),c.jsx("span",{className:"text-sm text-[var(--sand-11)]",children:"Loading breakdown..."})]})}),c.jsx(y1t,{breakdownData:_,planRates:U,isLoading:E})]})]})]})]})})}WBe(window.location.pathname);function R1t(){const{search:t}=Gs();return c.jsx(il,{to:`/sign-in${t}`,replace:!0})}const A1t=HEe([{element:c.jsx(Sm,{level:"page",context:"app-root",children:c.jsx(WUe,{children:c.jsx(NUe,{defaultTheme:"dark",storageKey:"steel-ui-theme",children:c.jsx(HUe,{children:c.jsx(Dmt,{})})})})}),children:[{path:"sign-in",element:c.jsx(Fn,{routeName:"sign-in",children:c.jsx(IBe,{})})},{path:"sign-up",element:c.jsx(Fn,{routeName:"sign-up",children:c.jsx(R1t,{})})},{path:"sign-in/cli-signing-in",element:c.jsx(Fn,{routeName:"sign-in-cli-signing-in",children:c.jsx(Gmt,{})})},{path:"sign-in/cli-success",element:c.jsx(Fn,{routeName:"sign-in-cli-success",children:c.jsx(Wmt,{})})},{path:"sign-in/sso-callback",element:c.jsx(kPe,{})},{path:"activate",element:c.jsx(Fn,{routeName:"device-activate",children:c.jsx(qmt,{})})},{path:"questionnaire",element:c.jsx($mt,{})},{path:"verify-email",element:c.jsx(Fn,{routeName:"verify-email",children:c.jsx(Kmt,{})})},{path:"embed",element:c.jsx(ugt,{})},{path:"computer-access",element:c.jsx(Fn,{routeName:"computer-access",children:c.jsx(Cze,{})})},{path:"hackathon-july",element:c.jsx(il,{to:"/computer-access",replace:!0})},{element:c.jsx(Rmt,{}),children:[{index:!0,element:c.jsx(il,{to:"/quickstart"})},{path:"quickstart",element:c.jsx(Fn,{routeName:"quickstart",children:c.jsx(Umt,{children:c.jsx(stt,{})})})},{path:"finish-setup",element:c.jsx(B_,{flag:"finish-setup",children:c.jsx(Fn,{routeName:"finish-setup",children:c.jsx(rze,{})})})},{path:"sessions",element:c.jsx(Jl,{}),children:[{index:!0,element:c.jsx(Fn,{routeName:"sessions-list",children:c.jsx(Tft,{})})},{path:":id",element:c.jsx(Fn,{routeName:"session-page",children:c.jsx(Jdt,{})})}]},{path:"computers",element:c.jsx(aFe,{children:c.jsx(w.Suspense,{fallback:null,children:c.jsx(Jl,{})})}),children:[{element:c.jsx(OBe,{}),children:[{index:!0,element:c.jsx(Fn,{routeName:"computers-list",children:c.jsx(UBe,{})})},{path:"checkpoints",element:c.jsx(Fn,{routeName:"computers-checkpoints",children:c.jsx(BBe,{})})},{path:"environments",element:c.jsx(Fn,{routeName:"computers-environments",children:c.jsx(zBe,{})})},{path:"secrets",element:c.jsx(Fn,{routeName:"computers-secrets",children:c.jsx(VBe,{})})}]},{path:":id",element:c.jsx(Fn,{routeName:"computer-page",children:c.jsx(HBe,{})}),children:[{index:!0},{path:"desktop"}]}]},{path:"settings",element:c.jsx(pht,{}),children:[{index:!0,element:c.jsx(il,{to:"profile"})},{path:"profile",element:c.jsx(Fn,{routeName:"settings-profile",children:c.jsx(Zht,{})})},{path:"membership",element:c.jsx(Fn,{routeName:"settings-membership",children:c.jsx(Bft,{})})},{path:"referrals",element:c.jsx(B_,{flag:"referrals",children:c.jsx(Fn,{routeName:"settings-referrals",children:c.jsx(Eht,{})})})},{path:"organization/*",element:c.jsx(Fn,{routeName:"settings-organization",children:c.jsx(l1t,{})})},{path:"usage",element:c.jsx(Fn,{routeName:"settings-usage",children:c.jsx(k1t,{})})},{path:"api-keys",element:c.jsx(Fn,{routeName:"settings-api-keys",children:c.jsx(Pft,{})})},{path:"network",element:c.jsx(Fn,{routeName:"settings-network",children:c.jsx(lht,{})})},{path:"projects",element:c.jsx(Fn,{routeName:"settings-projects",children:c.jsx(Sht,{})})},{path:"proxy-usage",element:c.jsx(B_,{flag:"proxy-usage-views",redirectTo:"/settings/billing/usage",children:c.jsx(Jl,{})}),children:[{index:!0,element:c.jsx(Fn,{routeName:"proxy-usage",children:c.jsx(d1t,{})})},{path:"sessions",element:c.jsx(Fn,{routeName:"proxy-usage-sessions",children:c.jsx(p1t,{})})},{path:"sessions/:sessionId",element:c.jsx(Fn,{routeName:"proxy-usage-session-detail",children:c.jsx(m1t,{})})}]},{path:"billing",element:c.jsx(p0t,{}),children:[{index:!0,element:c.jsx(il,{to:"/settings/billing/wallet",replace:!0})},{path:"invoices/:invoiceId",element:c.jsx(Fn,{routeName:"billing-invoice",children:c.jsx(g0t,{})})},{path:"wallet",element:c.jsx(Fn,{routeName:"billing-wallet",children:c.jsx(Wvt,{})})},{path:"usage",element:c.jsx(Fn,{routeName:"billing-usage",children:c.jsx(dvt,{})})},{path:"usage/proxy",element:c.jsx(B_,{flag:"proxy-usage-views",redirectTo:"/settings/billing/usage",children:c.jsx(Fn,{routeName:"billing-usage-proxy",children:c.jsx(Cvt,{})})})},{path:"limits",element:c.jsx(Fn,{routeName:"billing-limits",children:c.jsx(T0t,{})})},{path:"plans",element:c.jsx(Fn,{routeName:"billing-plans",children:c.jsx(F0t,{})})}]},{path:"*",element:c.jsx(w6,{})}]},{path:"create-org",element:c.jsx(Fn,{routeName:"create-org",children:c.jsx(qUe,{})})},{path:"*",element:c.jsx(w6,{})}]}]},{path:"*",element:c.jsx(w6,{})}]);function N1t(){return c.jsx(tCe,{router:A1t})}ht.setConfig({baseUrl:"https://api.steel.dev"});ht.interceptors.request.use(async(t,e)=>{var n;return t.headers.has("Authorization")?t:hwe(t,!!((n=e.security)!=null&&n.length))});const cre="steel:stale-chunk-reloaded-at",I1t=1e4;window.addEventListener("vite:preloadError",()=>{const t=Number(sessionStorage.getItem(cre)??0);Date.now()-t<I1t||(sessionStorage.setItem(cre,String(Date.now())),window.location.reload())});uwe.createRoot(document.getElementById("root")).render(c.jsx(N1t,{}));export{Qye as $,xr as A,zm as B,iBe as C,Um as D,ti as E,Bn as F,na as G,_7 as H,Npt as I,Po as J,AS as K,Mh as L,Hde as M,Nht as N,He as O,sR as P,Bi as Q,Pn as R,PS as S,pv as T,Tye as U,Ao as V,kd as W,Apt as X,rt as Y,HS as Z,GS as _,zt as a,Q1 as a0,ext as a1,gxt as a2,M5 as a3,j1t as a4,LBe as a5,Hn as a6,fie as a7,gft as a8,z1t as a9,aa,G1t as ab,W1t as ac,q1t as ad,K1t as ae,nxt as af,sxt as ag,X1t as ah,Q1t as ai,J1t as aj,V1t as ak,H1t as al,txt as am,Y1t as an,Z1t as ao,ht as ap,pwe as aq,lc as b,rs as c,Hh as d,hF as e,$h as f,Fh as g,Ld as h,jd as i,c as j,DS as k,MS as l,W1 as m,hd as n,Ah as o,rBe as p,wt as q,w as r,X1 as s,N$ as t,di as u,to as v,Mpt as w,Pd as x,Ja as y,rxt as z};

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