1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BIOqBQoB.js","assets/html-qXBqs9iO.js","assets/javascript-DGowZ4QF.js","assets/css-VvjYsK8G.js","assets/angular-ts-BZ0-gyXM.js","assets/scss-VtpMro89.js","assets/apl-DomBhgsI.js","assets/xml-D3voWj5l.js","assets/java-JdOfYUdK.js","assets/json-DMbQYFDD.js","assets/astro-D6X_Z2XS.js","assets/typescript-Bl2pc_8e.js","assets/postcss-BpkC9_c2.js","assets/tsx-uO4koM_N.js","assets/blade-bOo7sHim.js","assets/html-derivative-L_TmH9Cl.js","assets/sql-DIfKQ3UR.js","assets/bsl-J7bNLA7f.js","assets/sdbl-DYV3AuzD.js","assets/cairo-BSyRV25K.js","assets/python-F63zVH2W.js","assets/cobol-BtoQQPou.js","assets/coffee-CAbqQb4D.js","assets/cpp-BULsHryK.js","assets/regexp-D0rA2qln.js","assets/glsl-DQ9esmOg.js","assets/c-WUyxKBbu.js","assets/crystal-BKj-38Fu.js","assets/shellscript-DLWy-XKI.js","assets/edge-g4FheGsS.js","assets/elixir-DPFZ700c.js","assets/elm-DfouGvC_.js","assets/erb-BJXehSsM.js","assets/ruby-D6oex5d_.js","assets/haml-DAK3AdVH.js","assets/graphql-B0xrZH8z.js","assets/jsx-D1T1brdb.js","assets/lua-SBnGdSHe.js","assets/yaml-30KcodCe.js","assets/erlang-BYZ2Z4YE.js","assets/markdown-CyfEJjR-.js","assets/fortran-fixed-form-CbtQdryd.js","assets/fortran-free-form-CIkEJ740.js","assets/fsharp-B_KMJUO8.js","assets/gdresource-dTegv3Dv.js","assets/gdshader-CY3d6U6w.js","assets/gdscript-BLLEeoFt.js","assets/git-commit-C5zEsrao.js","assets/diff-DXT5zc-2.js","assets/git-rebase-CISAJg89.js","assets/glimmer-js-B1swgecw.js","assets/glimmer-ts-DtCVYfOS.js","assets/hack-CIKEyXN5.js","assets/handlebars-BXv0Bzt3.js","assets/http-D_t6wY6g.js","assets/hurl-D4ZoJPMF.js","assets/csv-ktAYfTAb.js","assets/hxml-yFbbJVA9.js","assets/haxe-vA1IaGxw.js","assets/jinja-yuqpYHnC.js","assets/jison-DKV7M0Ju.js","assets/julia-u6azWIKf.js","assets/r-CIZ9QnL2.js","assets/latex-BammeNcp.js","assets/tex-kctWGK22.js","assets/liquid-DfjUrw7I.js","assets/marko-DxsCREkK.js","assets/less-W9CowDDW.js","assets/mdc-BHw6nwLV.js","assets/nginx-B2fmmKMF.js","assets/nim-Bnnhjx9t.js","assets/perl-BfKvcVzF.js","assets/php-BYJ1Ypxm.js","assets/pug-GfiRoGJd.js","assets/qml-CJEfhMPF.js","assets/razor-BOBSbqZz.js","assets/csharp-DoXdt0nY.js","assets/rst-CKSVoj06.js","assets/cmake-DMKeYzL3.js","assets/sas-CbWl8rne.js","assets/shaderlab-CUm_dX6I.js","assets/hlsl-D7JhCZZU.js","assets/shellsession-BkNx190r.js","assets/soy-CCUQ6n2n.js","assets/sparql-UpL8FO9b.js","assets/turtle-Ba58ri9j.js","assets/stata-BBO-Ddf6.js","assets/svelte-C60UpK7x.js","assets/templ-D1Fgf1UR.js","assets/go-ve9NQPsj.js","assets/ts-tags-BZD7P4Bn.js","assets/twig-CrZj0Hws.js","assets/vue-Cj-mkyYi.js","assets/vue-html-CjBLplYn.js","assets/vue-vine-Bspp71h3.js","assets/stylus-vmpKpVxG.js","assets/xsl-CPTpEDiJ.js"])))=>i.map(i=>d[i]); 2var cJ=Object.defineProperty;var dJ=(e,t,s)=>t in e?cJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Re=(e,t,s)=>dJ(e,typeof t!="symbol"?t+"":t,s);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"c14b707938f5c3dbcbc30e6e1dc9c8240ea6f4d8"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6855851c-7885-483e-8253-e1b7fea2d5d6",e._sentryDebugIdIdentifier="sentry-dbid-6855851c-7885-483e-8253-e1b7fea2d5d6")}catch{}})();function uJ(e,t){for(var s=0;s<t.length;s++){const n=t[s];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(n,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function s(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();
vendor: 23,815 bytes, lines 2-49
2function EU(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var uk={exports:{}},gg={};/** 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 Q4;function pJ(){if(Q4)return gg;Q4=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,a,o){var i=null;if(o!==void 0&&(i=""+o),a.key!==void 0&&(i=""+a.key),"key"in a){o={};for(var l in a)l!=="key"&&(o[l]=a[l])}else o=a;return a=o.ref,{$$typeof:e,type:n,key:i,ref:a!==void 0?a:null,props:o}}return gg.Fragment=t,gg.jsx=s,gg.jsxs=s,gg}var Z4;function fJ(){return Z4||(Z4=1,uk.exports=pJ()),uk.exports}var r=fJ(),pk={exports:{}},ys={};/** 11 * @license React 12 * react.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 e3;function hJ(){if(e3)return ys;e3=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.iterator;function g($){return $===null||typeof $!="object"?null:($=h&&$[h]||$["@@iterator"],typeof $=="function"?$:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,_={};function j($,B,ae){this.props=$,this.context=B,this.refs=_,this.updater=ae||v}j.prototype.isReactComponent={},j.prototype.setState=function($,B){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,B,"setState")},j.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function w(){}w.prototype=j.prototype;function k($,B,ae){this.props=$,this.context=B,this.refs=_,this.updater=ae||v}var S=k.prototype=new w;S.constructor=k,y(S,j.prototype),S.isPureReactComponent=!0;var E=Array.isArray,T={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function R($,B,ae,H,U,oe){return ae=oe.ref,{$$typeof:e,type:$,key:B,ref:ae!==void 0?ae:null,props:oe}}function I($,B){return R($.type,B,void 0,void 0,void 0,$.props)}function L($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function M($){var B={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(ae){return B[ae]})}var O=/\/+/g;function z($,B){return typeof $=="object"&&$!==null&&$.key!=null?M(""+$.key):B.toString(36)}function X(){}function W($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(X,X):($.status="pending",$.then(function(B){$.status==="pending"&&($.status="fulfilled",$.value=B)},function(B){$.status==="pending"&&($.status="rejected",$.reason=B)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function K($,B,ae,H,U){var oe=typeof $;(oe==="undefined"||oe==="boolean")&&($=null);var fe=!1;if($===null)fe=!0;else switch(oe){case"bigint":case"string":case"number":fe=!0;break;case"object":switch($.$$typeof){case e:case t:fe=!0;break;case f:return fe=$._init,K(fe($._payload),B,ae,H,U)}}if(fe)return U=U($),fe=H===""?"."+z($,0):H,E(U)?(ae="",fe!=null&&(ae=fe.replace(O,"$&/")+"/"),K(U,B,ae,"",function(Se){return Se})):U!=null&&(L(U)&&(U=I(U,ae+(U.key==null||$&&$.key===U.key?"":(""+U.key).replace(O,"$&/")+"/")+fe)),B.push(U)),1;fe=0;var Q=H===""?".":H+":";if(E($))for(var le=0;le<$.length;le++)H=$[le],oe=Q+z(H,le),fe+=K(H,B,ae,oe,U);else if(le=g($),typeof le=="function")for($=le.call($),le=0;!(H=$.next()).done;)H=H.value,oe=Q+z(H,le++),fe+=K(H,B,ae,oe,U);else if(oe==="object"){if(typeof $.then=="function")return K(W($),B,ae,H,U);throw B=String($),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return fe}function q($,B,ae){if($==null)return $;var H=[],U=0;return K($,H,"","",function(oe){return B.call(ae,oe,U++)}),H}function J($){if($._status===-1){var B=$._result;B=B(),B.then(function(ae){($._status===0||$._status===-1)&&($._status=1,$._result=ae)},function(ae){($._status===0||$._status===-1)&&($._status=2,$._result=ae)}),$._status===-1&&($._status=0,$._result=B)}if($._status===1)return $._result.default;throw $._result}var F=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)};function V(){}return ys.Children={map:q,forEach:function($,B,ae){q($,function(){B.apply(this,arguments)},ae)},count:function($){var B=0;return q($,function(){B++}),B},toArray:function($){return q($,function(B){return B})||[]},only:function($){if(!L($))throw Error("React.Children.only expected to receive a single React element child.");return $}},ys.Component=j,ys.Fragment=s,ys.Profiler=a,ys.PureComponent=k,ys.StrictMode=n,ys.Suspense=c,ys.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,ys.act=function(){throw Error("act(...) is not supported in production builds of React.")},ys.cache=function($){return function(){return $.apply(null,arguments)}},ys.cloneElement=function($,B,ae){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var H=y({},$.props),U=$.key,oe=void 0;if(B!=null)for(fe in B.ref!==void 0&&(oe=void 0),B.key!==void 0&&(U=""+B.key),B)!A.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(H[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)H.children=ae;else if(1<fe){for(var Q=Array(fe),le=0;le<fe;le++)Q[le]=arguments[le+2];H.children=Q}return R($.type,U,void 0,void 0,oe,H)},ys.createContext=function($){return $={$$typeof:i,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:o,_context:$},$},ys.createElement=function($,B,ae){var H,U={},oe=null;if(B!=null)for(H in B.key!==void 0&&(oe=""+B.key),B)A.call(B,H)&&H!=="key"&&H!=="__self"&&H!=="__source"&&(U[H]=B[H]);var fe=arguments.length-2;if(fe===1)U.children=ae;else if(1<fe){for(var Q=Array(fe),le=0;le<fe;le++)Q[le]=arguments[le+2];U.children=Q}if($&&$.defaultProps)for(H in fe=$.defaultProps,fe)U[H]===void 0&&(U[H]=fe[H]);return R($,oe,void 0,void 0,null,U)},ys.createRef=function(){return{current:null}},ys.forwardRef=function($){return{$$typeof:l,render:$}},ys.isValidElement=L,ys.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:J}},ys.memo=function($,B){return{$$typeof:u,type:$,compare:B===void 0?null:B}},ys.startTransition=function($){var B=T.T,ae={};T.T=ae;try{var H=$(),U=T.S;U!==null&&U(ae,H),typeof H=="object"&&H!==null&&typeof H.then=="function"&&H.then(V,F)}catch(oe){F(oe)}finally{T.T=B}},ys.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},ys.use=function($){return T.H.use($)},ys.useActionState=function($,B,ae){return T.H.useActionState($,B,ae)},ys.useCallback=function($,B){return T.H.useCallback($,B)},ys.useContext=function($){return T.H.useContext($)},ys.useDebugValue=function(){},ys.useDeferredValue=function($,B){return T.H.useDeferredValue($,B)},ys.useEffect=function($,B){return T.H.useEffect($,B)},ys.useId=function(){return T.H.useId()},ys.useImperativeHandle=function($,B,ae){return T.H.useImperativeHandle($,B,ae)},ys.useInsertionEffect=function($,B){return T.H.useInsertionEffect($,B)},ys.useLayoutEffect=function($,B){return T.H.useLayoutEffect($,B)},ys.useMemo=function($,B){return T.H.useMemo($,B)},ys.useOptimistic=function($,B){return T.H.useOptimistic($,B)},ys.useReducer=function($,B,ae){return T.H.useReducer($,B,ae)},ys.useRef=function($){return T.H.useRef($)},ys.useState=function($){return T.H.useState($)},ys.useSyncExternalStore=function($,B,ae){return T.H.useSyncExternalStore($,B,ae)},ys.useTransition=function(){return T.H.useTransition()},ys.version="19.0.0",ys}var t3;function Yj(){return t3||(t3=1,pk.exports=hJ()),pk.exports}var x=Yj();const pe=EU(x),D5=uJ({__proto__:null,default:pe},[x]);var fk={exports:{}},xg={},hk={exports:{}},mk={};/** 19 * @license React 20 * scheduler.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 s3;function mJ(){return s3||(s3=1,function(e){function t(q,J){var F=q.length;q.push(J);e:for(;0<F;){var V=F-1>>>1,$=q[V];if(0<a($,J))q[V]=J,q[F]=$,F=V;else break e}}function s(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var J=q[0],F=q.pop();if(F!==J){q[0]=F;e:for(var V=0,$=q.length,B=$>>>1;V<B;){var ae=2*(V+1)-1,H=q[ae],U=ae+1,oe=q[U];if(0>a(H,F))U<$&&0>a(oe,H)?(q[V]=oe,q[U]=F,V=U):(q[V]=H,q[ae]=F,V=ae);else if(U<$&&0>a(oe,F))q[V]=oe,q[U]=F,V=U;else break e}}return J}function a(q,J){var F=q.sortIndex-J.sortIndex;return F!==0?F:q.id-J.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],f=1,h=null,g=3,v=!1,y=!1,_=!1,j=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function S(q){for(var J=s(u);J!==null;){if(J.callback===null)n(u);else if(J.startTime<=q)n(u),J.sortIndex=J.expirationTime,t(c,J);else break;J=s(u)}}function E(q){if(_=!1,S(q),!y)if(s(c)!==null)y=!0,W();else{var J=s(u);J!==null&&K(E,J.startTime-q)}}var T=!1,A=-1,R=5,I=-1;function L(){return!(e.unstable_now()-I<R)}function M(){if(T){var q=e.unstable_now();I=q;var J=!0;try{e:{y=!1,_&&(_=!1,w(A),A=-1),v=!0;var F=g;try{t:{for(S(q),h=s(c);h!==null&&!(h.expirationTime>q&&L());){var V=h.callback;if(typeof V=="function"){h.callback=null,g=h.priorityLevel;var $=V(h.expirationTime<=q);if(q=e.unstable_now(),typeof $=="function"){h.callback=$,S(q),J=!0;break t}h===s(c)&&n(c),S(q)}else n(c);h=s(c)}if(h!==null)J=!0;else{var B=s(u);B!==null&&K(E,B.startTime-q),J=!1}}break e}finally{h=null,g=F,v=!1}J=void 0}}finally{J?O():T=!1}}}var O;if(typeof k=="function")O=function(){k(M)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,X=z.port2;z.port1.onmessage=M,O=function(){X.postMessage(null)}}else O=function(){j(M,0)};function W(){T||(T=!0,O())}function K(q,J){A=j(function(){q(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_continueExecution=function(){y||v||(y=!0,W())},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return s(c)},e.unstable_next=function(q){switch(g){case 1:case 2:case 3:var J=3;break;default:J=g}var F=g;g=J;try{return q()}finally{g=F}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,J){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var F=g;g=q;try{return J()}finally{g=F}},e.unstable_scheduleCallback=function(q,J,F){var V=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?V+F:V):F=V,q){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=F+$,q={id:f++,callback:J,priorityLevel:q,startTime:F,expirationTime:$,sortIndex:-1},F>V?(q.sortIndex=F,t(u,q),s(c)===null&&q===s(u)&&(_?(w(A),A=-1):_=!0,K(E,F-V))):(q.sortIndex=$,t(c,q),y||v||(y=!0,W())),q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(q){var J=g;return function(){var F=g;g=J;try{return q.apply(this,arguments)}finally{g=F}}}}(mk)),mk}var r3;function gJ(){return r3||(r3=1,hk.exports=mJ()),hk.exports}var gk={exports:{}},Jn={};/** 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 n3;function xJ(){if(n3)return Jn;n3=1;var e=Yj();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)u+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var n={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(c,u,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:h==null?null:""+h,children:c,containerInfo:u,implementation:f}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Jn.createPortal=function(c,u){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return o(c,u,null,f)},Jn.flushSync=function(c){var u=i.T,f=n.p;try{if(i.T=null,n.p=2,c)return c()}finally{i.T=u,n.p=f,n.d.f()}},Jn.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(c,u))},Jn.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},Jn.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var f=u.as,h=l(f,u.crossOrigin),g=typeof u.integrity=="string"?u.integrity:void 0,v=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;f==="style"?n.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:h,integrity:g,fetchPriority:v}):f==="script"&&n.d.X(c,{crossOrigin:h,integrity:g,fetchPriority:v,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Jn.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var f=l(u.as,u.crossOrigin);n.d.M(c,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(c)},Jn.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var f=u.as,h=l(f,u.crossOrigin);n.d.L(c,f,{crossOrigin:h,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})}},Jn.preloadModule=function(c,u){if(typeof c=="string")if(u){var f=l(u.as,u.crossOrigin);n.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(c)},Jn.requestFormReset=function(c){n.d.r(c)},Jn.unstable_batchedUpdates=function(c,u){return c(u)},Jn.useFormState=function(c,u,f){return i.H.useFormState(c,u,f)},Jn.useFormStatus=function(){return i.H.useHostTransitionStatus()},Jn.version="19.0.0",Jn}var a3;function TU(){if(a3)return gk.exports;a3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),gk.exports=xJ(),gk.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 o3;function vJ(){if(o3)return xg;o3=1;var e=gJ(),t=Yj(),s=TU();function n(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(d){return!(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)}var o=Symbol.for("react.element"),i=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),g=Symbol.for("react.consumer"),v=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),E=Symbol.for("react.memo_cache_sentinel"),T=Symbol.iterator;function A(d){return d===null||typeof d!="object"?null:(d=T&&d[T]||d["@@iterator"],typeof d=="function"?d:null)}var R=Symbol.for("react.client.reference");function I(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===R?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case c:return"Fragment";case l:return"Portal";case f:return"Profiler";case u:return"StrictMode";case _:return"Suspense";case j:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case v:return(d.displayName||"Context")+".Provider";case g:return(d._context.displayName||"Context")+".Consumer";case y:var p=d.render;return d=d.displayName,d||(d=p.displayName||p.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case w:return p=d.displayName||null,p!==null?p:I(d.type)||"Memo";case k:p=d._payload,d=d._init;try{return I(d(p))}catch{}}return null}var L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.assign,O,z;function X(d){if(O===void 0)try{throw Error()}catch(m){var p=m.stack.trim().match(/\n( *(at )?)/);O=p&&p[1]||"",z=-1<m.stack.indexOf(` 43 at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return` 44`+O+d+z}var W=!1;function K(d,p){if(!d||W)return"";W=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(p){var pt=function(){throw Error()};if(Object.defineProperty(pt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pt,[])}catch(Xe){var Fe=Xe}Reflect.construct(d,[],pt)}else{try{pt.call()}catch(Xe){Fe=Xe}d.call(pt.prototype)}}else{try{throw Error()}catch(Xe){Fe=Xe}(pt=d())&&typeof pt.catch=="function"&&pt.catch(function(){})}}catch(Xe){if(Xe&&Fe&&typeof Xe.stack=="string")return[Xe.stack,Fe.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=b.DetermineComponentFrameRoot(),D=C[0],Y=C[1];if(D&&Y){var ce=D.split(` 45`),Ne=Y.split(` 46`);for(N=b=0;b<ce.length&&!ce[b].includes("DetermineComponentFrameRoot");)b++;for(;N<Ne.length&&!Ne[N].includes("DetermineComponentFrameRoot");)N++;if(b===ce.length||N===Ne.length)for(b=ce.length-1,N=Ne.length-1;1<=b&&0<=N&&ce[b]!==Ne[N];)N--;for(;1<=b&&0<=N;b--,N--)if(ce[b]!==Ne[N]){if(b!==1||N!==1)do if(b--,N--,0>N||ce[b]!==Ne[N]){var tt=` 47`+ce[b].replace(" at new "," at ");return d.displayName&&tt.includes("<anonymous>")&&(tt=tt.replace("<anonymous>",d.displayName)),tt}while(1<=b&&0<=N);break}}}finally{W=!1,Error.prepareStackTrace=m}return(m=d?d.displayName||d.name:"")?X(m):""}function q(d){switch(d.tag){case 26:case 27:case 5:return X(d.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 15:return d=K(d.type,!1),d;case 11:return d=K(d.type.render,!1),d;case 1:return d=K(d.type,!0),d;default:return""}}function J(d){try{var p="";do p+=q(d),d=d.return;while(d);return p}catch(m){return` 48Error generating stack: `+m.message+` 49`+m.stack}}function F(d){var p=d,m=d;if(d.alternate)for(;p.return;)p=p.return;else{d=p;do p=d,(p.flags&4098)!==0&&(m=p.return),d=p.return;while(d)}return p.tag===3?m:null}function V(d){if(d.tag===13){var p=d.memoizedState;if(p===null&&(d=d.alternate,d!==null&&(p=d.memoizedState)),p!==null)return p.dehydrated}return null}function $(d){if(F(d)!==d)throw Error(n(188))}function B(d){var p=d.alternate;if(!p){if(p=F(d),p===null)throw Error(n(188));return p!==d?null:d}for(var m=d,b=p;;){var N=m.return;if(N===null)break;var C=N.alternate;if(C===null){if(b=N.return,b!==null){m=b;continue}break}if(N.child===C.child){for(C=N.child;C;){if(C===m)return $(N),d;if(C===b)return $(N),p;C=C.sibling}throw Error(n(188))}if(m.return!==b.return)m=N,b=C;else{for(var D=!1,Y=N.child;Y;){if(Y===m){D=!0,m=N,b=C;break}if(Y===b){D=!0,b=N,m=C;break}Y=Y.sibling}if(!D){for(Y=C.child;Y;){if(Y===m){D=!0,m=C,b=N;break}if(Y===b){D=!0,b=C,m=N;break}Y=Y.sibling}if(!D)throw Error(n(189))}}if(m.alternate!==b)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?d:p}function ae(d){var p=d.tag;if(p===5||p===26||p===27||p===6)return d;for(d=d.child;d!==null;){if(p=ae(d),p!==null)return p;d=d.sibling}return null}var H=Array.isArray,U=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},fe=[],Q=-1;function le(d){return{current:d}}function Se(d){0>Q||(d.current=fe[Q],fe[Q]=null,Q--)}function we(d,p){Q++,fe[Q]=d.current,d.current=p}var Le=le(null),xe=le(null),de=le(null),Me=le(null);function je(d,p){switch(we(de,p),we(xe,d),we(Le,null),d=p.nodeType,d){case 9:case 11:p=(p=p.documentElement)&&(p=p.namespaceURI)?C4(p):0;break;default:if(d=d===8?p.parentNode:p,p=d.tagName,d=d.namespaceURI)d=C4(d),p=E4(d,p);else switch(p){case"svg":p=1;break;case"math":p=2;break;default:p=0}}Se(Le),we(Le,p)}function Ae(){Se(Le),Se(xe),Se(de)}function Oe(d){d.memoizedState!==null&&we(Me,d);var p=Le.current,m=E4(p,d.type);p!==m&&(we(xe,d),we(Le,m))}function Ke(d){xe.current===d&&(Se(Le),Se(xe)),Me.current===d&&(Se(Me),ug._currentValue=oe)}var ut=Object.prototype.hasOwnProperty,De=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,rt=e.unstable_shouldYield,mt=e.unstable_requestPaint,vt=e.unstable_now,gt=e.unstable_getCurrentPriorityLevel,Be=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,nt=e.unstable_LowPriority,Ze=e.unstable_IdlePriority,he=e.log,ke=e.unstable_setDisableYieldValue,Ve=null,at=null;function Pt(d){if(at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(Ve,d,void 0,(d.current.flags&128)===128)}catch{}}
vendor: 4,242 bytes, line 49
49function Ct(d){if(typeof he=="function"&&ke(d),at&&typeof at.setStrictMode=="function")try{at.setStrictMode(Ve,d)}catch{}}var St=Math.clz32?Math.clz32:ee,Xt=Math.log,It=Math.LN2;function ee(d){return d>>>=0,d===0?32:31-(Xt(d)/It|0)|0}var We=128,wt=4194304;function _t(d){var p=d&42;if(p!==0)return p;switch(d&-d){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: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 d&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return d&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return d}}function Ee(d,p){var m=d.pendingLanes;if(m===0)return 0;var b=0,N=d.suspendedLanes,C=d.pingedLanes,D=d.warmLanes;d=d.finishedLanes!==0;var Y=m&134217727;return Y!==0?(m=Y&~N,m!==0?b=_t(m):(C&=Y,C!==0?b=_t(C):d||(D=Y&~D,D!==0&&(b=_t(D))))):(Y=m&~N,Y!==0?b=_t(Y):C!==0?b=_t(C):d||(D=m&~D,D!==0&&(b=_t(D)))),b===0?0:p!==0&&p!==b&&(p&N)===0&&(N=b&-b,D=p&-p,N>=D||N===32&&(D&4194176)!==0)?p:b}function He(d,p){return(d.pendingLanes&~(d.suspendedLanes&~d.pingedLanes)&p)===0}function ie(d,p){switch(d){case 1:case 2:case 4:case 8:return p+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return p+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 Ce(){var d=We;return We<<=1,(We&4194176)===0&&(We=128),d}function Ye(){var d=wt;return wt<<=1,(wt&62914560)===0&&(wt=4194304),d}function Pe(d){for(var p=[],m=0;31>m;m++)p.push(d);return p}function Ge(d,p){d.pendingLanes|=p,p!==268435456&&(d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0)}function Nt(d,p,m,b,N,C){var D=d.pendingLanes;d.pendingLanes=m,d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0,d.expiredLanes&=m,d.entangledLanes&=m,d.errorRecoveryDisabledLanes&=m,d.shellSuspendCounter=0;var Y=d.entanglements,ce=d.expirationTimes,Ne=d.hiddenUpdates;for(m=D&~m;0<m;){var tt=31-St(m),pt=1<<tt;Y[tt]=0,ce[tt]=-1;var Fe=Ne[tt];if(Fe!==null)for(Ne[tt]=null,tt=0;tt<Fe.length;tt++){var Xe=Fe[tt];Xe!==null&&(Xe.lane&=-536870913)}m&=~pt}b!==0&&Tt(d,b,0),C!==0&&N===0&&d.tag!==0&&(d.suspendedLanes|=C&~(D&~p))}function Tt(d,p,m){d.pendingLanes|=p,d.suspendedLanes&=~p;var b=31-St(p);d.entangledLanes|=p,d.entanglements[b]=d.entanglements[b]|1073741824|m&4194218}function ss(d,p){var m=d.entangledLanes|=p;for(d=d.entanglements;m;){var b=31-St(m),N=1<<b;N&p|d[b]&p&&(d[b]|=p),m&=~N}}function Zt(d){return d&=-d,2<d?8<d?(d&134217727)!==0?32:268435456:8:2}function re(){var d=U.p;return d!==0?d:(d=window.event,d===void 0?32:G4(d.type))}function G(d,p){var m=U.p;try{return U.p=d,p()}finally{U.p=m}}var ge=Math.random().toString(36).slice(2),ze="__reactFiber$"+ge,Gt="__reactProps$"+ge,es="__reactContainer$"+ge,ls="__reactEvents$"+ge,pr="__reactListeners$"+ge,et="__reactHandles$"+ge,ye="__reactResources$"+ge,Qe="__reactMarker$"+ge;function ne(d){delete d[ze],delete d[Gt],delete d[ls],delete d[pr],delete d[et]}function P(d){var p=d[ze];if(p)return p;for(var m=d.parentNode;m;){if(p=m[es]||m[ze]){if(m=p.alternate,p.child!==null||m!==null&&m.child!==null)for(d=A4(d);d!==null;){if(m=d[ze])return m;d=A4(d)}return p}d=m,m=d.parentNode}return null}function te(d){if(d=d[ze]||d[es]){var p=d.tag;if(p===5||p===6||p===13||p===26||p===27||p===3)return d}return null}function me(d){var p=d.tag;if(p===5||p===26||p===27||p===6)return d.stateNode;throw Error(n(33))}function Te(d){var p=d[ye];return p||(p=d[ye]={hoistableStyles:new Map,hoistableScripts:new Map}),p}function st(d){d[Qe]=!0}var xt=new Set,Et={};function rs(d,p){Rt(d,p),Rt(d+"Capture",p)}function Rt(d,p){for(Et[d]=p,d=0;d<p.length;d++)xt.add(p[d])}var xs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
49037D\\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]*$"),qs={},Xr={};function pn(d){return ut.call(Xr,d)?!0:ut.call(qs,d)?!1:jt.test(d)?Xr[d]=!0:(qs[d]=!0,!1)}function Gn(d,p,m){if(pn(p))if(m===null)d.removeAttribute(p);else{switch(typeof m){case"undefined":case"function":case"symbol":d.removeAttribute(p);return;case"boolean":var b=p.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){d.removeAttribute(p);return}}d.setAttribute(p,""+m)}}function Zs(d,p,m){if(m===null)d.removeAttribute(p);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(p);return}d.setAttribute(p,""+m)}}function Cr(d,p,m,b){if(b===null)d.removeAttribute(m);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(m);return}d.setAttributeNS(p,m,""+b)}}function Wn(d){switch(typeof d){case"bigint":case"boolean":case"number":case"string":case"undefined":return d;case"object":return d;default:return""}}function Hd(d){var p=d.type;return(d=d.nodeName)&&d.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function gm(d){var p=Hd(d)?"checked":"value",m=Object.getOwnPropertyDescriptor(d.constructor.prototype,p),b=""+d[p];if(!d.hasOwnProperty(p)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var N=m.get,C=m.set;return Object.defineProperty(d,p,{configurable:!0,get:function(){return N.call(this)},set:function(D){b=""+D,C.call(this,D)}}),Object.defineProperty(d,p,{enumerable:m.enumerable}),{getValue:function(){return b},setValue:function(D){b=""+D},stopTracking:function(){d._valueTracker=null,delete d[p]}}}}function dl(d){d._valueTracker||(d._valueTracker=gm(d))}function On(d){if(!d)return!1;var p=d._valueTracker;if(!p)return!0;var m=p.getValue(),b="";return d&&(b=Hd(d)?d.checked?"true":"false":d.value),d=b,d!==m?(p.setValue(d),!0):!1}function Qo(d){if(d=d||(typeof document<"u"?document:void 0),typeof d>"u")return null;try{return d.activeElement||d.body}catch{return d.body}}var Vd=/[\n"\\]/g;function Ca(d){return d.replace(Vd,function(p){return"\\"+p.charCodeAt(0).toString(16)+" "})}function xm(d,p,m,b,N,C,D,Y){d.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?d.type=D:d.removeAttribute("type"),p!=null?D==="number"?(p===0&&d.value===""||d.value!=p)&&(d.value=""+Wn(p)):d.value!==""+Wn(p)&&(d.value=""+Wn(p)):D!=="submit"&&D!=="reset"||d.removeAttribute("value"),p!=null?vm(d,D,Wn(p)):m!=null?vm(d,D,Wn(m)):b!=null&&d.removeAttribute("value"),N==null&&C!=null&&(d.defaultChecked=!!C),N!=null&&(d.checked=N&&typeof N!="function"&&typeof N!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?d.name=""+Wn(Y):d.removeAttribute("name")}function ub(d,p,m,b,N,C,D,Y){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(d.type=C),p!=null||m!=null){if(!(C!=="submit"&&C!=="reset"||p!=null))return;m=m!=null?""+Wn(m):"",p=p!=null?""+Wn(p):m,Y||p===d.value||(d.value=p),d.defaultValue=p}b=b??N,b=typeof b!="function"&&typeof b!="symbol"&&!!b,d.checked=Y?d.checked:!!b,d.defaultChecked=!!b,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(d.name=D)}function vm(d,p,m){p==="number"&&Qo(d.ownerDocument)===d||d.defaultValue===""+m||(d.defaultValue=""+m)}function Ka(d,p,m,b){if(d=d.options,p){p={};for(var N=0;N<m.length;N++)p["$"+m[N]]=!0;for(m=0;m<d.length;m++)N=p.hasOwnProperty("$"+d[m].value),d[m].selected!==N&&(d[m].selected=N),N&&b&&(d[m].defaultSelected=!0)}else{for(m=""+Wn(m),p=null,N=0;N<d.length;N++){if(d[N].value===m){d[N].selected=!0,b&&(d[N].defaultSelected=!0);return}p!==null||d[N].disabled||(p=d[N])}p!==null&&(p.selected=!0)}}function pb(d,p,m){if(p!=null&&(p=""+Wn(p),p!==d.value&&(d.value=p),m==null)){d.defaultValue!==p&&(d.defaultValue=p);return}d.defaultValue=m!=null?""+Wn(m):""}function wi(d,p,m,b){if(p==null){if(b!=null){if(m!=null)throw Error(n(92));if(H(b)){if(1<b.length)throw Error(n(93));b=b[0]}m=b}m==null&&(m=""),p=m}m=Wn(p),d.defaultValue=m,b=d.textContent,b===m&&b!==""&&b!==null&&(d.value=b)}function Ea(d,p){if(p){var m=d.firstChild;if(m&&m===d.lastChild&&m.nodeType===3){m.nodeValue=p;return}}d.textContent=p}var fb=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 Yn(d,p,m){var b=p.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?b?d.setProperty(p,""):p==="float"?d.cssFloat="":d[p]="":b?d.setProperty(p,m):typeof m!="number"||m===0||fb.has(p)?p==="float"?d.cssFloat=m:d[p
vendor: 5,633 bytes, line 49
49]=(""+m).trim():d[p]=m+"px"}function hb(d,p,m){if(p!=null&&typeof p!="object")throw Error(n(62));if(d=d.style,m!=null){for(var b in m)!m.hasOwnProperty(b)||p!=null&&p.hasOwnProperty(b)||(b.indexOf("--")===0?d.setProperty(b,""):b==="float"?d.cssFloat="":d[b]="");for(var N in p)b=p[N],p.hasOwnProperty(N)&&m[N]!==b&&Yn(d,N,b)}else for(var C in p)p.hasOwnProperty(C)&&Yn(d,C,p[C])}function bm(d){if(d.indexOf("-")===-1)return!1;switch(d){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 x1=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"],["colorRendering","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"]]),xc=/^[\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 Mp(d){return xc.test(""+d)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":d}var ym=null;function _m(d){return d=d.target||d.srcElement||window,d.correspondingUseElement&&(d=d.correspondingUseElement),d.nodeType===3?d.parentNode:d}var Zo=null,Ni=null;function jm(d){var p=te(d);if(p&&(d=p.stateNode)){var m=d[Gt]||null;e:switch(d=p.stateNode,p.type){case"input":if(xm(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),p=m.name,m.type==="radio"&&p!=null){for(m=d;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+Ca(""+p)+'"][type="radio"]'),p=0;p<m.length;p++){var b=m[p];if(b!==d&&b.form===d.form){var N=b[Gt]||null;if(!N)throw Error(n(90));xm(b,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(p=0;p<m.length;p++)b=m[p],b.form===d.form&&On(b)}break e;case"textarea":pb(d,m.value,m.defaultValue);break e;case"select":p=m.value,p!=null&&Ka(d,!!m.multiple,p,!1)}}}var Gd=!1;function Wd(d,p,m){if(Gd)return d(p,m);Gd=!0;try{var b=d(p);return b}finally{if(Gd=!1,(Zo!==null||Ni!==null)&&(sy(),Zo&&(p=Zo,d=Ni,Ni=Zo=null,jm(p),d)))for(p=0;p<d.length;p++)jm(d[p])}}function hr(d,p){var m=d.stateNode;if(m===null)return null;var b=m[Gt]||null;if(b===null)return null;m=b[p];e:switch(p){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(d=d.type,b=!(d==="button"||d==="input"||d==="select"||d==="textarea")),d=!b;break e;default:d=!1}if(d)return null;if(m&&typeof m!="function")throw Error(n(231,p,typeof m));return m}var ki=!1;if(xs)try{var Ln={};Object.defineProperty(Ln,"passive",{get:function(){ki=!0}}),window.addEventListener("test",Ln,Ln),window.removeEventListener("test",Ln,Ln)}catch{ki=!1}var Si=null,Yd=null,Op=null;function mb(){if(Op)return Op;var d,p=Yd,m=p.length,b,N="value"in Si?Si.value:Si.textContent,C=N.length;for(d=0;d<m&&p[d]===N[d];d++);var D=m-d;for(b=1;b<=D&&p[m-b]===N[C-b];b++);return Op=N.slice(d,1<b?1-b:void 0)}function Lp(d){var p=d.keyCode;
vendor: 5,232 bytes, line 49
49return"charCode"in d?(d=d.charCode,d===0&&p===13&&(d=13)):d=p,d===10&&(d=13),32<=d||d===13?d:0}function Dp(){return!0}function $p(){return!1}function Dn(d){function p(m,b,N,C,D){this._reactName=m,this._targetInst=N,this.type=b,this.nativeEvent=C,this.target=D,this.currentTarget=null;for(var Y in d)d.hasOwnProperty(Y)&&(m=d[Y],this[Y]=m?m(C):C[Y]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?Dp:$p,this.isPropagationStopped=$p,this}return M(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=Dp)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=Dp)},persist:function(){},isPersistent:Dp}),p}var Ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(d){return d.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Up=Dn(Ci),kn=M({},Ci,{view:0,detail:0}),Ta=Dn(kn),wm,Nm,Kd,Fp=M({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ft,button:0,buttons:0,relatedTarget:function(d){return d.relatedTarget===void 0?d.fromElement===d.srcElement?d.toElement:d.fromElement:d.relatedTarget},movementX:function(d){return"movementX"in d?d.movementX:(d!==Kd&&(Kd&&d.type==="mousemove"?(wm=d.screenX-Kd.screenX,Nm=d.screenY-Kd.screenY):Nm=wm=0,Kd=d),wm)},movementY:function(d){return"movementY"in d?d.movementY:Nm}}),km=Dn(Fp),v1=M({},Fp,{dataTransfer:0}),b1=Dn(v1),Sm=M({},kn,{relatedTarget:0}),Jd=Dn(Sm),gb=M({},Ci,{animationName:0,elapsedTime:0,pseudoElement:0}),xb=Dn(gb),y1=M({},Ci,{clipboardData:function(d){return"clipboardData"in d?d.clipboardData:window.clipboardData}}),vb=Dn(y1),bb=M({},Ci,{data:0}),Cm=Dn(bb),yb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_b={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"},jb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Je(d){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(d):(d=jb[d])?!!p[d]:!1}function ft(){return Je}var Dt=M({},kn,{key:function(d){if(d.key){var p=yb[d.key]||d.key;if(p!=="Unidentified")return p}return d.type==="keypress"?(d=Lp(d),d===13?"Enter":String.fromCharCode(d)):d.type==="keydown"||d.type==="keyup"?_b[d.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ft,charCode:function(d){return d.type==="keypress"?Lp(d):0},keyCode:function(d){return d.type==="keydown"||d.type==="keyup"?d.keyCode:0},which:function(d){return d.type==="keypress"?Lp(d):d.type==="keydown"||d.type==="keyup"?d.keyCode:0}}),ms=Dn(Dt),Ys=M({},Fp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),er=Dn(Ys),yo=M({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ft}),ul=Dn(yo),pa=M({},Ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),pl=Dn(pa),Ks=M({},Fp,{deltaX:function(d){return"deltaX"in d?d.deltaX:"wheelDeltaX"in d?-d.wheelDeltaX:0},deltaY:function(d){return"deltaY"in d?d.deltaY:"wheelDeltaY"in d?-d.wheelDeltaY:"wheelDelta"in d?-d.wheelDelta:0},deltaZ:0,deltaMode:0}),Js=Dn(Ks),Ja=M({},Ci,{newState:0,oldState:0}),fa=Dn(Ja),Tr=[9,13,27,32],fn=xs&&"CompositionEvent"in window,ar=null;xs&&"documentMode"in document&&(ar=document.documentMode);var Ei=xs&&"TextEvent"in window&&!ar,vc=xs&&(!fn||ar&&8<ar&&11>=ar),Em=" ",Tm=!1;function Bp(d,p){switch(d){case"keyup":return Tr.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wb(d){return d=d.detail,typeof d=="object"&&"data"in d?d.data:null}var bc=!1;function Nb(d,p){switch(d){case"compositionend":return wb(p);case"keypress":return p.which!==32?null:(Tm=!0,Em);case"textInput":return d=p.data,d===Em&&Tm?null:d;default:return null}}function _1(d,p){if(bc)return d==="compositionend"||!fn&&Bp(d,p)?(d=mb(),Op=Yd=Si=null,bc=!1,d):null;switch(d){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return vc&&p.locale!=="ko"?null:p.data;default:return null}}var DY={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 KA(d){var p=d&&d.nodeName&&d.nodeName.toLowerCase();return p==="input"?!!DY[d.type]:p==="textarea"}
vendor: 5,679 bytes, line 49
49function JA(d,p,m,b){Zo?Ni?Ni.push(b):Ni=[b]:Zo=b,p=iy(p,"onChange"),0<p.length&&(m=new Up("onChange","change",null,m,b),d.push({event:m,listeners:p}))}var Rm=null,Am=null;function $Y(d){j4(d,0)}function kb(d){var p=me(d);if(On(p))return d}function XA(d,p){if(d==="change")return p}var QA=!1;if(xs){var j1;if(xs){var w1="oninput"in document;if(!w1){var ZA=document.createElement("div");ZA.setAttribute("oninput","return;"),w1=typeof ZA.oninput=="function"}j1=w1}else j1=!1;QA=j1&&(!document.documentMode||9<document.documentMode)}function eP(){Rm&&(Rm.detachEvent("onpropertychange",tP),Am=Rm=null)}function tP(d){if(d.propertyName==="value"&&kb(Am)){var p=[];JA(p,Am,d,_m(d)),Wd($Y,p)}}function UY(d,p,m){d==="focusin"?(eP(),Rm=p,Am=m,Rm.attachEvent("onpropertychange",tP)):d==="focusout"&&eP()}function FY(d){if(d==="selectionchange"||d==="keyup"||d==="keydown")return kb(Am)}function BY(d,p){if(d==="click")return kb(p)}function qY(d,p){if(d==="input"||d==="change")return kb(p)}function zY(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var Xa=typeof Object.is=="function"?Object.is:zY;function Pm(d,p){if(Xa(d,p))return!0;if(typeof d!="object"||d===null||typeof p!="object"||p===null)return!1;var m=Object.keys(d),b=Object.keys(p);if(m.length!==b.length)return!1;for(b=0;b<m.length;b++){var N=m[b];if(!ut.call(p,N)||!Xa(d[N],p[N]))return!1}return!0}function sP(d){for(;d&&d.firstChild;)d=d.firstChild;return d}function rP(d,p){var m=sP(d);d=0;for(var b;m;){if(m.nodeType===3){if(b=d+m.textContent.length,d<=p&&b>=p)return{node:m,offset:p-d};d=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=sP(m)}}function nP(d,p){return d&&p?d===p?!0:d&&d.nodeType===3?!1:p&&p.nodeType===3?nP(d,p.parentNode):"contains"in d?d.contains(p):d.compareDocumentPosition?!!(d.compareDocumentPosition(p)&16):!1:!1}function aP(d){d=d!=null&&d.ownerDocument!=null&&d.ownerDocument.defaultView!=null?d.ownerDocument.defaultView:window;for(var p=Qo(d.document);p instanceof d.HTMLIFrameElement;){try{var m=typeof p.contentWindow.location.href=="string"}catch{m=!1}if(m)d=p.contentWindow;else break;p=Qo(d.document)}return p}function N1(d){var p=d&&d.nodeName&&d.nodeName.toLowerCase();return p&&(p==="input"&&(d.type==="text"||d.type==="search"||d.type==="tel"||d.type==="url"||d.type==="password")||p==="textarea"||d.contentEditable==="true")}function HY(d,p){var m=aP(p);p=d.focusedElem;var b=d.selectionRange;if(m!==p&&p&&p.ownerDocument&&nP(p.ownerDocument.documentElement,p)){if(b!==null&&N1(p)){if(d=b.start,m=b.end,m===void 0&&(m=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(m,p.value.length);else if(m=(d=p.ownerDocument||document)&&d.defaultView||window,m.getSelection){m=m.getSelection();var N=p.textContent.length,C=Math.min(b.start,N);b=b.end===void 0?C:Math.min(b.end,N),!m.extend&&C>b&&(N=b,b=C,C=N),N=rP(p,C);var D=rP(p,b);N&&D&&(m.rangeCount!==1||m.anchorNode!==N.node||m.anchorOffset!==N.offset||m.focusNode!==D.node||m.focusOffset!==D.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),m.removeAllRanges(),C>b?(m.addRange(d),m.extend(D.node,D.offset)):(d.setEnd(D.node,D.offset),m.addRange(d)))}}for(d=[],m=p;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<d.length;p++)m=d[p],m.element.scrollLeft=m.left,m.element.scrollTop=m.top}}var VY=xs&&"documentMode"in document&&11>=document.documentMode,qp=null,k1=null,Im=null,S1=!1;function oP(d,p,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;S1||qp==null||qp!==Qo(b)||(b=qp,"selectionStart"in b&&N1(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Im&&Pm(Im,b)||(Im=b,b=iy(k1,"onSelect"),0<b.length&&(p=new Up("onSelect","select",null,p,m),d.push({event:p,listeners:b}),p.target=qp)))}function Xd(d,p){var m={};return m[d.toLowerCase()]=p.toLowerCase(),m["Webkit"+d]="webkit"+p,m["Moz"+d]="moz"+p,m}var zp={animationend:Xd("Animation","AnimationEnd"),animationiteration:Xd("Animation","AnimationIteration"),animationstart:Xd("Animation","AnimationStart"),transitionrun:Xd("Transition","TransitionRun"),transitionstart:Xd("Transition","TransitionStart"),transitioncancel:Xd("Transition","TransitionCancel"),transitionend:Xd("Transition","TransitionEnd")},C1={},iP={};xs&&(iP=document.createElement("div").style,"AnimationEvent"in window||(delete zp.animationend.animation,delete zp.animationiteration.animation,delete zp.animationstart.animation),"TransitionEvent"in window||delete zp.transitionend.transition);function Qd(d){if(C1[d])return C1[d];if(!zp[d])return d;var p=zp[d],m;for(m in p)if(p.hasOwnProperty(m)&&m in iP)return C1[d]=p[m];return d}var lP=Qd("animationend"),cP=Qd("animationiteration"),dP=Qd("animationstart"),GY=Qd("transitionrun"),WY=Qd("transitionstart"),YY=Qd("transitioncancel"),uP=Qd("transitionend"),pP=new Map,fP="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 scrollEnd toggle touchMove waiting wheel".split(" ");
vendor: 26,533 bytes, line 49
49function ei(d,p){pP.set(d,p),rs(p,[d])}var _o=[],Hp=0,E1=0;function Sb(){for(var d=Hp,p=E1=Hp=0;p<d;){var m=_o[p];_o[p++]=null;var b=_o[p];_o[p++]=null;var N=_o[p];_o[p++]=null;var C=_o[p];if(_o[p++]=null,b!==null&&N!==null){var D=b.pending;D===null?N.next=N:(N.next=D.next,D.next=N),b.pending=N}C!==0&&hP(m,N,C)}}function Cb(d,p,m,b){_o[Hp++]=d,_o[Hp++]=p,_o[Hp++]=m,_o[Hp++]=b,E1|=b,d.lanes|=b,d=d.alternate,d!==null&&(d.lanes|=b)}function T1(d,p,m,b){return Cb(d,p,m,b),Eb(d)}function yc(d,p){return Cb(d,null,null,p),Eb(d)}function hP(d,p,m){d.lanes|=m;var b=d.alternate;b!==null&&(b.lanes|=m);for(var N=!1,C=d.return;C!==null;)C.childLanes|=m,b=C.alternate,b!==null&&(b.childLanes|=m),C.tag===22&&(d=C.stateNode,d===null||d._visibility&1||(N=!0)),d=C,C=C.return;N&&p!==null&&d.tag===3&&(C=d.stateNode,N=31-St(m),C=C.hiddenUpdates,d=C[N],d===null?C[N]=[p]:d.push(p),p.lane=m|536870912)}function Eb(d){if(50<ng)throw ng=0,ON=null,Error(n(185));for(var p=d.return;p!==null;)d=p,p=d.return;return d.tag===3?d.stateNode:null}var Vp={},mP=new WeakMap;function jo(d,p){if(typeof d=="object"&&d!==null){var m=mP.get(d);return m!==void 0?m:(p={value:d,source:p,stack:J(p)},mP.set(d,p),p)}return{value:d,source:p,stack:J(p)}}var Gp=[],Wp=0,Tb=null,Rb=0,wo=[],No=0,Zd=null,fl=1,hl="";function eu(d,p){Gp[Wp++]=Rb,Gp[Wp++]=Tb,Tb=d,Rb=p}function gP(d,p,m){wo[No++]=fl,wo[No++]=hl,wo[No++]=Zd,Zd=d;var b=fl;d=hl;var N=32-St(b)-1;b&=~(1<<N),m+=1;var C=32-St(p)+N;if(30<C){var D=N-N%5;C=(b&(1<<D)-1).toString(32),b>>=D,N-=D,fl=1<<32-St(p)+N|m<<N|b,hl=C+d}else fl=1<<C|m<<N|b,hl=d}function R1(d){d.return!==null&&(eu(d,1),gP(d,1,0))}function A1(d){for(;d===Tb;)Tb=Gp[--Wp],Gp[Wp]=null,Rb=Gp[--Wp],Gp[Wp]=null;for(;d===Zd;)Zd=wo[--No],wo[No]=null,hl=wo[--No],wo[No]=null,fl=wo[--No],wo[No]=null}var ha=null,$n=null,Gs=!1,ti=null,Ti=!1,P1=Error(n(519));function tu(d){var p=Error(n(418,""));throw Lm(jo(p,d)),P1}function xP(d){var p=d.stateNode,m=d.type,b=d.memoizedProps;switch(p[ze]=d,p[Gt]=b,m){case"dialog":Ds("cancel",p),Ds("close",p);break;case"iframe":case"object":case"embed":Ds("load",p);break;case"video":case"audio":for(m=0;m<og.length;m++)Ds(og[m],p);break;case"source":Ds("error",p);break;case"img":case"image":case"link":Ds("error",p),Ds("load",p);break;case"details":Ds("toggle",p);break;case"input":Ds("invalid",p),ub(p,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0),dl(p);break;case"select":Ds("invalid",p);break;case"textarea":Ds("invalid",p),wi(p,b.value,b.defaultValue,b.children),dl(p)}m=b.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||p.textContent===""+m||b.suppressHydrationWarning===!0||S4(p.textContent,m)?(b.popover!=null&&(Ds("beforetoggle",p),Ds("toggle",p)),b.onScroll!=null&&Ds("scroll",p),b.onScrollEnd!=null&&Ds("scrollend",p),b.onClick!=null&&(p.onclick=ly),p=!0):p=!1,p||tu(d)}function vP(d){for(ha=d.return;ha;)switch(ha.tag){case 3:case 27:Ti=!0;return;case 5:case 13:Ti=!1;return;default:ha=ha.return}}function Mm(d){if(d!==ha)return!1;if(!Gs)return vP(d),Gs=!0,!1;var p=!1,m;if((m=d.tag!==3&&d.tag!==27)&&((m=d.tag===5)&&(m=d.type,m=!(m!=="form"&&m!=="button")||QN(d.type,d.memoizedProps)),m=!m),m&&(p=!0),p&&$n&&tu(d),vP(d),d.tag===13){if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(n(317));e:{for(d=d.nextSibling,p=0;d;){if(d.nodeType===8)if(m=d.data,m==="/$"){if(p===0){$n=ri(d.nextSibling);break e}p--}else m!=="$"&&m!=="$!"&&m!=="$?"||p++;d=d.nextSibling}$n=null}}else $n=ha?ri(d.stateNode.nextSibling):null;return!0}function Om(){$n=ha=null,Gs=!1}function Lm(d){ti===null?ti=[d]:ti.push(d)}var Dm=Error(n(460)),bP=Error(n(474)),I1={then:function(){}};function yP(d){return d=d.status,d==="fulfilled"||d==="rejected"}function Ab(){}function _P(d,p,m){switch(m=d[m],m===void 0?d.push(p):m!==p&&(p.then(Ab,Ab),p=m),p.status){case"fulfilled":return p.value;case"rejected":throw d=p.reason,d===Dm?Error(n(483)):d;default:if(typeof p.status=="string")p.then(Ab,Ab);else{if(d=mr,d!==null&&100<d.shellSuspendCounter)throw Error(n(482));d=p,d.status="pending",d.then(function(b){if(p.status==="pending"){var N=p;N.status="fulfilled",N.value=b}},function(b){if(p.status==="pending"){var N=p;N.status="rejected",N.reason=b}})}switch(p.status){case"fulfilled":return p.value;case"rejected":throw d=p.reason,d===Dm?Error(n(483)):d}throw $m=p,Dm}}var $m=null;function jP(){if($m===null)throw Error(n(459));var d=$m;return $m=null,d}var Yp=null,Um=0;function Pb(d){var p=Um;return Um+=1,Yp===null&&(Yp=[]),_P(Yp,d,p)}function Fm(d,p){p=p.props.ref,d.ref=p!==void 0?p:null}function Ib(d,p){throw p.$$typeof===o?Error(n(525)):(d=Object.prototype.toString.call(p),Error(n(31,d==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":d)))}function wP(d){var p=d._init;return p(d._payload)}function NP(d){function p(Ie,_e){if(d){var $e=Ie.deletions;$e===null?(Ie.deletions=[_e],Ie.flags|=16):$e.push(_e)}}function m(Ie,_e){if(!d)return null;for(;_e!==null;)p(Ie,_e),_e=_e.sibling;return null}function b(Ie){for(var _e=new Map;Ie!==null;)Ie.key!==null?_e.set(Ie.key,Ie):_e.set(Ie.index,Ie),Ie=Ie.sibling;return _e}function N(Ie,_e){return Ie=Pc(Ie,_e),Ie.index=0,Ie.sibling=null,Ie}function C(Ie,_e,$e){return Ie.index=$e,d?($e=Ie.alternate,$e!==null?($e=$e.index,$e<_e?(Ie.flags|=33554434,_e):$e):(Ie.flags|=33554434,_e)):(Ie.flags|=1048576,_e)}function D(Ie){return d&&Ie.alternate===null&&(Ie.flags|=33554434),Ie}function Y(Ie,_e,$e,ot){return _e===null||_e.tag!==6?(_e=CN($e,Ie.mode,ot),_e.return=Ie,_e):(_e=N(_e,$e),_e.return=Ie,_e)}function ce(Ie,_e,$e,ot){var Ft=$e.type;return Ft===c?tt(Ie,_e,$e.props.children,ot,$e.key):_e!==null&&(_e.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===k&&wP(Ft)===_e.type)?(_e=N(_e,$e.props),Fm(_e,$e),_e.return=Ie,_e):(_e=Xb($e.type,$e.key,$e.props,null,Ie.mode,ot),Fm(_e,$e),_e.return=Ie,_e)}function Ne(Ie,_e,$e,ot){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==$e.containerInfo||_e.stateNode.implementation!==$e.implementation?(_e=EN($e,Ie.mode,ot),_e.return=Ie,_e):(_e=N(_e,$e.children||[]),_e.return=Ie,_e)}function tt(Ie,_e,$e,ot,Ft){return _e===null||_e.tag!==7?(_e=uu($e,Ie.mode,ot,Ft),_e.return=Ie,_e):(_e=N(_e,$e),_e.return=Ie,_e)}function pt(Ie,_e,$e){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return _e=CN(""+_e,Ie.mode,$e),_e.return=Ie,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case i:return $e=Xb(_e.type,_e.key,_e.props,null,Ie.mode,$e),Fm($e,_e),$e.return=Ie,$e;case l:return _e=EN(_e,Ie.mode,$e),_e.return=Ie,_e;case k:var ot=_e._init;return _e=ot(_e._payload),pt(Ie,_e,$e)}if(H(_e)||A(_e))return _e=uu(_e,Ie.mode,$e,null),_e.return=Ie,_e;if(typeof _e.then=="function")return pt(Ie,Pb(_e),$e);if(_e.$$typeof===v)return pt(Ie,Yb(Ie,_e),$e);Ib(Ie,_e)}return null}function Fe(Ie,_e,$e,ot){var Ft=_e!==null?_e.key:null;if(typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint")return Ft!==null?null:Y(Ie,_e,""+$e,ot);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case i:return $e.key===Ft?ce(Ie,_e,$e,ot):null;case l:return $e.key===Ft?Ne(Ie,_e,$e,ot):null;case k:return Ft=$e._init,$e=Ft($e._payload),Fe(Ie,_e,$e,ot)}if(H($e)||A($e))return Ft!==null?null:tt(Ie,_e,$e,ot,null);if(typeof $e.then=="function")return Fe(Ie,_e,Pb($e),ot);if($e.$$typeof===v)return Fe(Ie,_e,Yb(Ie,$e),ot);Ib(Ie,$e)}return null}function Xe(Ie,_e,$e,ot,Ft){if(typeof ot=="string"&&ot!==""||typeof ot=="number"||typeof ot=="bigint")return Ie=Ie.get($e)||null,Y(_e,Ie,""+ot,Ft);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case i:return Ie=Ie.get(ot.key===null?$e:ot.key)||null,ce(_e,Ie,ot,Ft);case l:return Ie=Ie.get(ot.key===null?$e:ot.key)||null,Ne(_e,Ie,ot,Ft);case k:var Ts=ot._init;return ot=Ts(ot._payload),Xe(Ie,_e,$e,ot,Ft)}if(H(ot)||A(ot))return Ie=Ie.get($e)||null,tt(_e,Ie,ot,Ft,null);if(typeof ot.then=="function")return Xe(Ie,_e,$e,Pb(ot),Ft);if(ot.$$typeof===v)return Xe(Ie,_e,$e,Yb(_e,ot),Ft);Ib(_e,ot)}return null}function Wt(Ie,_e,$e,ot){for(var Ft=null,Ts=null,Qt=_e,ns=_e=0,En=null;Qt!==null&&ns<$e.length;ns++){Qt.index>ns?(En=Qt,Qt=null):En=Qt.sibling;var Ws=Fe(Ie,Qt,$e[ns],ot);if(Ws===null){Qt===null&&(Qt=En);break}d&&Qt&&Ws.alternate===null&&p(Ie,Qt),_e=C(Ws,_e,ns),Ts===null?Ft=Ws:Ts.sibling=Ws,Ts=Ws,Qt=En}if(ns===$e.length)return m(Ie,Qt),Gs&&eu(Ie,ns),Ft;if(Qt===null){for(;ns<$e.length;ns++)Qt=pt(Ie,$e[ns],ot),Qt!==null&&(_e=C(Qt,_e,ns),Ts===null?Ft=Qt:Ts.sibling=Qt,Ts=Qt);return Gs&&eu(Ie,ns),Ft}for(Qt=b(Qt);ns<$e.length;ns++)En=Xe(Qt,Ie,ns,$e[ns],ot),En!==null&&(d&&En.alternate!==null&&Qt.delete(En.key===null?ns:En.key),_e=C(En,_e,ns),Ts===null?Ft=En:Ts.sibling=En,Ts=En);return d&&Qt.forEach(function(Uc){return p(Ie,Uc)}),Gs&&eu(Ie,ns),Ft}function vs(Ie,_e,$e,ot){if($e==null)throw Error(n(151));for(var Ft=null,Ts=null,Qt=_e,ns=_e=0,En=null,Ws=$e.next();Qt!==null&&!Ws.done;ns++,Ws=$e.next()){Qt.index>ns?(En=Qt,Qt=null):En=Qt.sibling;var Uc=Fe(Ie,Qt,Ws.value,ot);if(Uc===null){Qt===null&&(Qt=En);break}d&&Qt&&Uc.alternate===null&&p(Ie,Qt),_e=C(Uc,_e,ns),Ts===null?Ft=Uc:Ts.sibling=Uc,Ts=Uc,Qt=En}if(Ws.done)return m(Ie,Qt),Gs&&eu(Ie,ns),Ft;if(Qt===null){for(;!Ws.done;ns++,Ws=$e.next())Ws=pt(Ie,Ws.value,ot),Ws!==null&&(_e=C(Ws,_e,ns),Ts===null?Ft=Ws:Ts.sibling=Ws,Ts=Ws);return Gs&&eu(Ie,ns),Ft}for(Qt=b(Qt);!Ws.done;ns++,Ws=$e.next())Ws=Xe(Qt,Ie,ns,Ws.value,ot),Ws!==null&&(d&&Ws.alternate!==null&&Qt.delete(Ws.key===null?ns:Ws.key),_e=C(Ws,_e,ns),Ts===null?Ft=Ws:Ts.sibling=Ws,Ts=Ws);return d&&Qt.forEach(function(lJ){return p(Ie,lJ)}),Gs&&eu(Ie,ns),Ft}function Br(Ie,_e,$e,ot){if(typeof $e=="object"&&$e!==null&&$e.type===c&&$e.key===null&&($e=$e.props.children),typeof $e=="object"&&$e!==null){switch($e.$$typeof){case i:e:{for(var Ft=$e.key;_e!==null;){if(_e.key===Ft){if(Ft=$e.type,Ft===c){if(_e.tag===7){m(Ie,_e.sibling),ot=N(_e,$e.props.children),ot.return=Ie,Ie=ot;break e}}else if(_e.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===k&&wP(Ft)===_e.type){m(Ie,_e.sibling),ot=N(_e,$e.props),Fm(ot,$e),ot.return=Ie,Ie=ot;break e}m(Ie,_e);break}else p(Ie,_e);_e=_e.sibling}$e.type===c?(ot=uu($e.props.children,Ie.mode,ot,$e.key),ot.return=Ie,Ie=ot):(ot=Xb($e.type,$e.key,$e.props,null,Ie.mode,ot),Fm(ot,$e),ot.return=Ie,Ie=ot)}return D(Ie);case l:e:{for(Ft=$e.key;_e!==null;){if(_e.key===Ft)if(_e.tag===4&&_e.stateNode.containerInfo===$e.containerInfo&&_e.stateNode.implementation===$e.implementation){m(Ie,_e.sibling),ot=N(_e,$e.children||[]),ot.return=Ie,Ie=ot;break e}else{m(Ie,_e);break}else p(Ie,_e);_e=_e.sibling}ot=EN($e,Ie.mode,ot),ot.return=Ie,Ie=ot}return D(Ie);case k:return Ft=$e._init,$e=Ft($e._payload),Br(Ie,_e,$e,ot)}if(H($e))return Wt(Ie,_e,$e,ot);if(A($e)){if(Ft=A($e),typeof Ft!="function")throw Error(n(150));return $e=Ft.call($e),vs(Ie,_e,$e,ot)}if(typeof $e.then=="function")return Br(Ie,_e,Pb($e),ot);if($e.$$typeof===v)return Br(Ie,_e,Yb(Ie,$e),ot);Ib(Ie,$e)}return typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint"?($e=""+$e,_e!==null&&_e.tag===6?(m(Ie,_e.sibling),ot=N(_e,$e),ot.return=Ie,Ie=ot):(m(Ie,_e),ot=CN($e,Ie.mode,ot),ot.return=Ie,Ie=ot),D(Ie)):m(Ie,_e)}return function(Ie,_e,$e,ot){try{Um=0;var Ft=Br(Ie,_e,$e,ot);return Yp=null,Ft}catch(Qt){if(Qt===Dm)throw Qt;var Ts=Eo(29,Qt,null,Ie.mode);return Ts.lanes=ot,Ts.return=Ie,Ts}finally{}}}var su=NP(!0),kP=NP(!1),Kp=le(null),Mb=le(0);function SP(d,p){d=kl,we(Mb,d),we(Kp,p),kl=d|p.baseLanes}function M1(){we(Mb,kl),we(Kp,Kp.current)}function O1(){kl=Mb.current,Se(Kp),Se(Mb)}var ko=le(null),Ri=null;function _c(d){var p=d.alternate;we(hn,hn.current&1),we(ko,d),Ri===null&&(p===null||Kp.current!==null||p.memoizedState!==null)&&(Ri=d)}function CP(d){if(d.tag===22){if(we(hn,hn.current),we(ko,d),Ri===null){var p=d.alternate;p!==null&&p.memoizedState!==null&&(Ri=d)}}else jc()}function jc(){we(hn,hn.current),we(ko,ko.current)}function ml(d){Se(ko),Ri===d&&(Ri=null),Se(hn)}var hn=le(0);function Ob(d){for(var p=d;p!==null;){if(p.tag===13){var m=p.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||m.data==="$!"))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var KY=typeof AbortController<"u"?AbortController:function(){var d=[],p=this.signal={aborted:!1,addEventListener:function(m,b){d.push(b)}};this.abort=function(){p.aborted=!0,d.forEach(function(m){return m()})}},JY=e.unstable_scheduleCallback,XY=e.unstable_NormalPriority,mn={$$typeof:v,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function L1(){return{controller:new KY,data:new Map,refCount:0}}function Bm(d){d.refCount--,d.refCount===0&&JY(XY,function(){d.controller.abort()})}var qm=null,D1=0,Jp=0,Xp=null;function QY(d,p){if(qm===null){var m=qm=[];D1=0,Jp=zN(),Xp={status:"pending",value:void 0,then:function(b){m.push(b)}}}return D1++,p.then(EP,EP),p}function EP(){if(--D1===0&&qm!==null){Xp!==null&&(Xp.status="fulfilled");var d=qm;qm=null,Jp=0,Xp=null;for(var p=0;p<d.length;p++)(0,d[p])()}}function ZY(d,p){var m=[],b={status:"pending",value:null,reason:null,then:function(N){m.push(N)}};return d.then(function(){b.status="fulfilled",b.value=p;for(var N=0;N<m.length;N++)(0,m[N])(p)},function(N){for(b.status="rejected",b.reason=N,N=0;N<m.length;N++)(0,m[N])(void 0)}),b}var TP=L.S;L.S=function(d,p){typeof p=="object"&&p!==null&&typeof p.then=="function"&&QY(d,p),TP!==null&&TP(d,p)};var ru=le(null);function $1(){var d=ru.current;return d!==null?d:mr.pooledCache}function Lb(d,p){p===null?we(ru,ru.current):we(ru,p.pool)}function RP(){var d=$1();return d===null?null:{parent:mn._currentValue,pool:d}}var wc=0,Ss=null,cr=null,Qr=null,Db=!1,Qp=!1,nu=!1,$b=0,zm=0,Zp=null,eK=0;function Yr(){throw Error(n(321))}function U1(d,p){if(p===null)return!1;for(var m=0;m<p.length&&m<d.length;m++)if(!Xa(d[m],p[m]))return!1;return!0}function F1(d,p,m,b,N,C){return wc=C,Ss=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,L.H=d===null||d.memoizedState===null?au:Nc,nu=!1,C=m(b,N),nu=!1,Qp&&(C=PP(p,m,b,N)),AP(d),C}function AP(d){L.H=Ai;var p=cr!==null&&cr.next!==null;if(wc=0,Qr=cr=Ss=null,Db=!1,zm=0,Zp=null,p)throw Error(n(300));d===null||Sn||(d=d.dependencies,d!==null&&Wb(d)&&(Sn=!0))}function PP(d,p,m,b){Ss=d;var N=0;do{if(Qp&&(Zp=null),zm=0,Qp=!1,25<=N)throw Error(n(301));if(N+=1,Qr=cr=null,d.updateQueue!=null){var C=d.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}L.H=ou,C=p(m,b)}while(Qp);return C}function tK(){var d=L.H,p=d.useState()[0];return p=typeof p.then=="function"?Hm(p):p,d=d.useState()[0],(cr!==null?cr.memoizedState:null)!==d&&(Ss.flags|=1024),p}function B1(){var d=$b!==0;return $b=0,d}function q1(d,p,m){p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~m}function z1(d){if(Db){for(d=d.memoizedState;d!==null;){var p=d.queue;p!==null&&(p.pending=null),d=d.next}Db=!1}wc=0,Qr=cr=Ss=null,Qp=!1,zm=$b=0,Zp=null}function Ra(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qr===null?Ss.memoizedState=Qr=d:Qr=Qr.next=d,Qr}function Zr(){if(cr===null){var d=Ss.alternate;d=d!==null?d.memoizedState:null}else d=cr.next;var p=Qr===null?Ss.memoizedState:Qr.next;if(p!==null)Qr=p,cr=d;else{if(d===null)throw Ss.alternate===null?Error(n(467)):Error(n(310));cr=d,d={memoizedState:cr.memoizedState,baseState:cr.baseState,baseQueue:cr.baseQueue,queue:cr.queue,next:null},Qr===null?Ss.memoizedState=Qr=d:Qr=Qr.next=d}return Qr}var Ub;Ub=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}};function Hm(d){var p=zm;return zm+=1,Zp===null&&(Zp=[]),d=_P(Zp,d,p),p=Ss,(Qr===null?p.memoizedState:Qr.next)===null&&(p=p.alternate,L.H=p===null||p.memoizedState===null?au:Nc),d}function Fb(d){if(d!==null&&typeof d=="object"){if(typeof d.then=="function")return Hm(d);if(d.$$typeof===v)return Kn(d)}throw Error(n(438,String(d)))}function H1(d){var p=null,m=Ss.updateQueue;if(m!==null&&(p=m.memoCache),p==null){var b=Ss.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(p={data:b.data.map(function(N){return N.slice()}),index:0})))}if(p==null&&(p={data:[],index:0}),m===null&&(m=Ub(),Ss.updateQueue=m),m.memoCache=p,m=p.data[p.index],m===void 0)for(m=p.data[p.index]=Array(d),b=0;b<d;b++)m[b]=E;return p.index++,m}function gl(d,p){return typeof p=="function"?p(d):p}function Bb(d){var p=Zr();return V1(p,cr,d)}function V1(d,p,m){var b=d.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=m;var N=d.baseQueue,C=b.pending;if(C!==null){if(N!==null){var D=N.next;N.next=C.next,C.next=D}p.baseQueue=N=C,b.pending=null}if(C=d.baseState,N===null)d.memoizedState=C;else{p=N.next;var Y=D=null,ce=null,Ne=p,tt=!1;do{var pt=Ne.lane&-536870913;if(pt!==Ne.lane?(Fs&pt)===pt:(wc&pt)===pt){var Fe=Ne.revertLane;if(Fe===0)ce!==null&&(ce=ce.next={lane:0,revertLane:0,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null}),pt===Jp&&(tt=!0);else if((wc&Fe)===Fe){Ne=Ne.next,Fe===Jp&&(tt=!0);continue}else pt={lane:0,revertLane:Ne.revertLane,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null},ce===null?(Y=ce=pt,D=C):ce=ce.next=pt,Ss.lanes|=Fe,Ic|=Fe;pt=Ne.action,nu&&m(C,pt),C=Ne.hasEagerState?Ne.eagerState:m(C,pt)}else Fe={lane:pt,revertLane:Ne.revertLane,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null},ce===null?(Y=ce=Fe,D=C):ce=ce.next=Fe,Ss.lanes|=pt,Ic|=pt;Ne=Ne.next}while(Ne!==null&&Ne!==p);if(ce===null?D=C:ce.next=Y,!Xa(C,d.memoizedState)&&(Sn=!0,tt&&(m=Xp,m!==null)))throw m;d.memoizedState=C,d.baseState=D,d.baseQueue=ce,b.lastRenderedState=C}return N===null&&(b.lanes=0),[d.memoizedState,b.dispatch]}function G1(d){var p=Zr(),m=p.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=d;var b=m.dispatch,N=m.pending,C=p.memoizedState;if(N!==null){m.pending=null;var D=N=N.next;do C=d(C,D.action),D=D.next;while(D!==N);Xa(C,p.memoizedState)||(Sn=!0),p.memoizedState=C,p.baseQueue===null&&(p.baseState=C),m.lastRenderedState=C}return[C,b]}function IP(d,p,m){var b=Ss,N=Zr(),C=Gs;if(C){if(m===void 0)throw Error(n(407));m=m()}else m=p();var D=!Xa((cr||N).memoizedState,m);if(D&&(N.memoizedState=m,Sn=!0),N=N.queue,K1(LP.bind(null,b,N,d),[d]),N.getSnapshot!==p||D||Qr!==null&&Qr.memoizedState.tag&1){if(b.flags|=2048,ef(9,OP.bind(null,b,N,m,p),{destroy:void 0},null),mr===null)throw Error(n(349));C||(wc&60)!==0||MP(b,p,m)}return m}function MP(d,p,m){d.flags|=16384,d={getSnapshot:p,value:m},p=Ss.updateQueue,p===null?(p=Ub(),Ss.updateQueue=p,p.stores=[d]):(m=p.stores,m===null?p.stores=[d]:m.push(d))}function OP(d,p,m,b){p.value=m,p.getSnapshot=b,DP(p)&&$P(d)}function LP(d,p,m){return m(function(){DP(p)&&$P(d)})}function DP(d){var p=d.getSnapshot;d=d.value;try{var m=p();return!Xa(d,m)}catch{return!0}}function $P(d){var p=yc(d,2);p!==null&&ma(p,d,2)}function W1(d){var p=Ra();if(typeof d=="function"){var m=d;if(d=m(),nu){Ct(!0);try{m()}finally{Ct(!1)}}}return p.memoizedState=p.baseState=d,p.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:d},p}function UP(d,p,m,b){return d.baseState=m,V1(d,cr,typeof b=="function"?b:gl)}function sK(d,p,m,b,N){if(Hb(d))throw Error(n(485));if(d=p.action,d!==null){var C={payload:N,action:d,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){C.listeners.push(D)}};L.T!==null?m(!0):C.isTransition=!1,b(C),m=p.pending,m===null?(C.next=p.pending=C,FP(p,C)):(C.next=m.next,p.pending=m.next=C)}}function FP(d,p){var m=p.action,b=p.payload,N=d.state;if(p.isTransition){var C=L.T,D={};L.T=D;try{var Y=m(N,b),ce=L.S;ce!==null&&ce(D,Y),BP(d,p,Y)}catch(Ne){Y1(d,p,Ne)}finally{L.T=C}}else try{C=m(N,b),BP(d,p,C)}catch(Ne){Y1(d,p,Ne)}}function BP(d,p,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(b){qP(d,p,b)},function(b){return Y1(d,p,b)}):qP(d,p,m)}function qP(d,p,m){p.status="fulfilled",p.value=m,zP(p),d.state=m,p=d.pending,p!==null&&(m=p.next,m===p?d.pending=null:(m=m.next,p.next=m,FP(d,m)))}function Y1(d,p,m){var b=d.pending;if(d.pending=null,b!==null){b=b.next;do p.status="rejected",p.reason=m,zP(p),p=p.next;while(p!==b)}d.action=null}function zP(d){d=d.listeners;for(var p=0;p<d.length;p++)(0,d[p])()}function HP(d,p){return p}function VP(d,p){if(Gs){var m=mr.formState;if(m!==null){e:{var b=Ss;if(Gs){if($n){t:{for(var N=$n,C=Ti;N.nodeType!==8;){if(!C){N=null;break t}if(N=ri(N.nextSibling),N===null){N=null;break t}}C=N.data,N=C==="F!"||C==="F"?N:null}if(N){$n=ri(N.nextSibling),b=N.data==="F!";break e}}tu(b)}b=!1}b&&(p=m[0])}}return m=Ra(),m.memoizedState=m.baseState=p,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:HP,lastRenderedState:p},m.queue=b,m=cI.bind(null,Ss,b),b.dispatch=m,b=W1(!1),C=eN.bind(null,Ss,!1,b.queue),b=Ra(),N={state:p,dispatch:null,action:d,pending:null},b.queue=N,m=sK.bind(null,Ss,N,C,m),N.dispatch=m,b.memoizedState=d,[p,m,!1]}function GP(d){var p=Zr();return WP(p,cr,d)}function WP(d,p,m){p=V1(d,p,HP)[0],d=Bb(gl)[0],p=typeof p=="object"&&p!==null&&typeof p.then=="function"?Hm(p):p;var b=Zr(),N=b.queue,C=N.dispatch;return m!==b.memoizedState&&(Ss.flags|=2048,ef(9,rK.bind(null,N,m),{destroy:void 0},null)),[p,C,d]}function rK(d,p){d.action=p}function YP(d){var p=Zr(),m=cr;if(m!==null)return WP(p,m,d);Zr(),p=p.memoizedState,m=Zr();var b=m.queue.dispatch;return m.memoizedState=d,[p,b,!1]}function ef(d,p,m,b){return d={tag:d,create:p,inst:m,deps:b,next:null},p=Ss.updateQueue,p===null&&(p=Ub(),Ss.updateQueue=p),m=p.lastEffect,m===null?p.lastEffect=d.next=d:(b=m.next,m.next=d,d.next=b,p.lastEffect=d),d}function KP(){return Zr().memoizedState}function qb(d,p,m,b){var N=Ra();Ss.flags|=d,N.memoizedState=ef(1|p,m,{destroy:void 0},b===void 0?null:b)}function zb(d,p,m,b){var N=Zr();b=b===void 0?null:b;var C=N.memoizedState.inst;cr!==null&&b!==null&&U1(b,cr.memoizedState.deps)?N.memoizedState=ef(p,m,C,b):(Ss.flags|=d,N.memoizedState=ef(1|p,m,C,b))}function JP(d,p){qb(8390656,8,d,p)}function K1(d,p){zb(2048,8,d,p)}function XP(d,p){return zb(4,2,d,p)}function QP(d,p){return zb(4,4,d,p)}function ZP(d,p){if(typeof p=="function"){d=d();var m=p(d);return function(){typeof m=="function"?m():p(null)}}if(p!=null)return d=d(),p.current=d,function(){p.current=null}}function eI(d,p,m){m=m!=null?m.concat([d]):null,zb(4,4,ZP.bind(null,p,d),m)}function J1(){}function tI(d,p){var m=Zr();p=p===void 0?null:p;var b=m.memoizedState;return p!==null&&U1(p,b[1])?b[0]:(m.memoizedState=[d,p],d)}function sI(d,p){var m=Zr();p=p===void 0?null:p;var b=m.memoizedState;if(p!==null&&U1(p,b[1]))return b[0];if(b=d(),nu){Ct(!0);try{d()}finally{Ct(!1)}}return m.memoizedState=[b,p],b}function X1(d,p,m){return m===void 0||(wc&1073741824)!==0?d.memoizedState=p:(d.memoizedState=m,d=n4(),Ss.lanes|=d,Ic|=d,m)}function rI(d,p,m,b){return Xa(m,p)?m:Kp.current!==null?(d=X1(d,m,b),Xa(d,p)||(Sn=!0),d):(wc&42)===0?(Sn=!0,d.memoizedState=m):(d=n4(),Ss.lanes|=d,Ic|=d,p)}function nI(d,p,m,b,N){var C=U.p;U.p=C!==0&&8>C?C:8;var D=L.T,Y={};L.T=Y,eN(d,!1,p,m);try{var ce=N(),Ne=L.S;if(Ne!==null&&Ne(Y,ce),ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var tt=ZY(ce,b);Vm(d,p,tt,to(d))}else Vm(d,p,b,to(d))}catch(pt){Vm(d,p,{then:function(){},status:"rejected",reason:pt},to())}finally{U.p=C,L.T=D}}function nK(){}function Q1(d,p,m,b){if(d.tag!==5)throw Error(n(476));var N=aI(d).queue;nI(d,N,p,oe,m===null?nK:function(){return oI(d),m(b)})}function aI(d){var p=d.memoizedState;if(p!==null)return p;p={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:oe},next:null};var m={};return p.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:m},next:null},d.memoizedState=p,d=d.alternate,d!==null&&(d.memoizedState=p),p}function oI(d){var p=aI(d).next.queue;Vm(d,p,{},to())}function Z1(){return Kn(ug)}function iI(){return Zr().memoizedState}function lI(){return Zr().memoizedState}function aK(d){for(var p=d.return;p!==null;){switch(p.tag){case 24:case 3:var m=to();d=Cc(m);var b=Ec(p,d,m);b!==null&&(ma(b,p,m),Ym(b,p,m)),p={cache:L1()},d.payload=p;return}p=p.return}}function oK(d,p,m){var b=to();m={lane:b,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null},Hb(d)?dI(p,m):(m=T1(d,p,m,b),m!==null&&(ma(m,d,b),uI(m,p,b)))}function cI(d,p,m){var b=to();Vm(d,p,m,b)}function Vm(d,p,m,b){var N={lane:b,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null};if(Hb(d))dI(p,N);else{var C=d.alternate;if(d.lanes===0&&(C===null||C.lanes===0)&&(C=p.lastRenderedReducer,C!==null))try{var D=p.lastRenderedState,Y=C(D,m);if(N.hasEagerState=!0,N.eagerState=Y,Xa(Y,D))return Cb(d,p,N,0),mr===null&&Sb(),!1}catch{}finally{}if(m=T1(d,p,N,b),m!==null)return ma(m,d,b),uI(m,p,b),!0}return!1}function eN(d,p,m,b){if(b={lane:2,revertLane:zN(),action:b,hasEagerState:!1,eagerState:null,next:null},Hb(d)){if(p)throw Error(n(479))}else p=T1(d,m,b,2),p!==null&&ma(p,d,2)}function Hb(d){var p=d.alternate;return d===Ss||p!==null&&p===Ss}function dI(d,p){Qp=Db=!0;var m=d.pending;m===null?p.next=p:(p.next=m.next,m.next=p),d.pending=p}function uI(d,p,m){if((m&4194176)!==0){var b=p.lanes;b&=d.pendingLanes,m|=b,p.lanes=m,ss(d,m)}}var Ai={readContext:Kn,use:Fb,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};Ai.useCacheRefresh=Yr,Ai.useMemoCache=Yr,Ai.useHostTransitionStatus=Yr,Ai.useFormState=Yr,Ai.useActionState=Yr,Ai.useOptimistic=Yr;var au={readContext:Kn,use:Fb,useCallback:function(d,p){return Ra().memoizedState=[d,p===void 0?null:p],d},useContext:Kn,useEffect:JP,useImperativeHandle:function(d,p,m){m=m!=null?m.concat([d]):null,qb(4194308,4,ZP.bind(null,p,d),m)},useLayoutEffect:function(d,p){return qb(4194308,4,d,p)},useInsertionEffect:function(d,p){qb(4,2,d,p)},useMemo:function(d,p){var m=Ra();p=p===void 0?null:p;var b=d();if(nu){Ct(!0);try{d()}finally{Ct(!1)}}return m.memoizedState=[b,p],b},useReducer:function(d,p,m){var b=Ra();if(m!==void 0){var N=m(p);if(nu){Ct(!0);try{m(p)}finally{Ct(!1)}}}else N=p;return b.memoizedState=b.baseState=N,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:N},b.queue=d,d=d.dispatch=oK.bind(null,Ss,d),[b.memoizedState,d]}
vendor: 10,117 bytes, line 49
49,useRef:function(d){var p=Ra();return d={current:d},p.memoizedState=d},useState:function(d){d=W1(d);var p=d.queue,m=cI.bind(null,Ss,p);return p.dispatch=m,[d.memoizedState,m]},useDebugValue:J1,useDeferredValue:function(d,p){var m=Ra();return X1(m,d,p)},useTransition:function(){var d=W1(!1);return d=nI.bind(null,Ss,d.queue,!0,!1),Ra().memoizedState=d,[!1,d]},useSyncExternalStore:function(d,p,m){var b=Ss,N=Ra();if(Gs){if(m===void 0)throw Error(n(407));m=m()}else{if(m=p(),mr===null)throw Error(n(349));(Fs&60)!==0||MP(b,p,m)}N.memoizedState=m;var C={value:m,getSnapshot:p};return N.queue=C,JP(LP.bind(null,b,C,d),[d]),b.flags|=2048,ef(9,OP.bind(null,b,C,m,p),{destroy:void 0},null),m},useId:function(){var d=Ra(),p=mr.identifierPrefix;if(Gs){var m=hl,b=fl;m=(b&~(1<<32-St(b)-1)).toString(32)+m,p=":"+p+"R"+m,m=$b++,0<m&&(p+="H"+m.toString(32)),p+=":"}else m=eK++,p=":"+p+"r"+m.toString(32)+":";return d.memoizedState=p},useCacheRefresh:function(){return Ra().memoizedState=aK.bind(null,Ss)}};au.useMemoCache=H1,au.useHostTransitionStatus=Z1,au.useFormState=VP,au.useActionState=VP,au.useOptimistic=function(d){var p=Ra();p.memoizedState=p.baseState=d;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return p.queue=m,p=eN.bind(null,Ss,!0,m),m.dispatch=p,[d,p]};var Nc={readContext:Kn,use:Fb,useCallback:tI,useContext:Kn,useEffect:K1,useImperativeHandle:eI,useInsertionEffect:XP,useLayoutEffect:QP,useMemo:sI,useReducer:Bb,useRef:KP,useState:function(){return Bb(gl)},useDebugValue:J1,useDeferredValue:function(d,p){var m=Zr();return rI(m,cr.memoizedState,d,p)},useTransition:function(){var d=Bb(gl)[0],p=Zr().memoizedState;return[typeof d=="boolean"?d:Hm(d),p]},useSyncExternalStore:IP,useId:iI};Nc.useCacheRefresh=lI,Nc.useMemoCache=H1,Nc.useHostTransitionStatus=Z1,Nc.useFormState=GP,Nc.useActionState=GP,Nc.useOptimistic=function(d,p){var m=Zr();return UP(m,cr,d,p)};var ou={readContext:Kn,use:Fb,useCallback:tI,useContext:Kn,useEffect:K1,useImperativeHandle:eI,useInsertionEffect:XP,useLayoutEffect:QP,useMemo:sI,useReducer:G1,useRef:KP,useState:function(){return G1(gl)},useDebugValue:J1,useDeferredValue:function(d,p){var m=Zr();return cr===null?X1(m,d,p):rI(m,cr.memoizedState,d,p)},useTransition:function(){var d=G1(gl)[0],p=Zr().memoizedState;return[typeof d=="boolean"?d:Hm(d),p]},useSyncExternalStore:IP,useId:iI};ou.useCacheRefresh=lI,ou.useMemoCache=H1,ou.useHostTransitionStatus=Z1,ou.useFormState=YP,ou.useActionState=YP,ou.useOptimistic=function(d,p){var m=Zr();return cr!==null?UP(m,cr,d,p):(m.baseState=d,[d,m.queue.dispatch])};function tN(d,p,m,b){p=d.memoizedState,m=m(b,p),m=m==null?p:M({},p,m),d.memoizedState=m,d.lanes===0&&(d.updateQueue.baseState=m)}var sN={isMounted:function(d){return(d=d._reactInternals)?F(d)===d:!1},enqueueSetState:function(d,p,m){d=d._reactInternals;var b=to(),N=Cc(b);N.payload=p,m!=null&&(N.callback=m),p=Ec(d,N,b),p!==null&&(ma(p,d,b),Ym(p,d,b))},enqueueReplaceState:function(d,p,m){d=d._reactInternals;var b=to(),N=Cc(b);N.tag=1,N.payload=p,m!=null&&(N.callback=m),p=Ec(d,N,b),p!==null&&(ma(p,d,b),Ym(p,d,b))},enqueueForceUpdate:function(d,p){d=d._reactInternals;var m=to(),b=Cc(m);b.tag=2,p!=null&&(b.callback=p),p=Ec(d,b,m),p!==null&&(ma(p,d,m),Ym(p,d,m))}};function pI(d,p,m,b,N,C,D){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(b,C,D):p.prototype&&p.prototype.isPureReactComponent?!Pm(m,b)||!Pm(N,C):!0}function fI(d,p,m,b){d=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(m,b),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(m,b),p.state!==d&&sN.enqueueReplaceState(p,p.state,null)}function iu(d,p){var m=p;if("ref"in p){m={};for(var b in p)b!=="ref"&&(m[b]=p[b])}if(d=d.defaultProps){m===p&&(m=M({},m));for(var N in d)m[N]===void 0&&(m[N]=d[N])}return m}var Vb=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=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(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}console.error(d)};function hI(d){Vb(d)}function mI(d){console.error(d)}function gI(d){Vb(d)}function Gb(d,p){try{var m=d.onUncaughtError;m(p.value,{componentStack:p.stack})}catch(b){setTimeout(function(){throw b})}}function xI(d,p,m){try{var b=d.onCaughtError;b(m.value,{componentStack:m.stack,errorBoundary:p.tag===1?p.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function rN(d,p,m){return m=Cc(m),m.tag=3,m.payload={element:null},m.callback=function(){Gb(d,p)},m}function vI(d){return d=Cc(d),d.tag=3,d}function bI(d,p,m,b){var N=m.type.getDerivedStateFromError;if(typeof N=="function"){var C=b.value;d.payload=function(){return N(C)},d.callback=function(){xI(p,m,b)}}var D=m.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(d.callback=function(){xI(p,m,b),typeof N!="function"&&(Mc===null?Mc=new Set([this]):Mc.add(this));var Y=b.stack;this.componentDidCatch(b.value,{componentStack:Y!==null?Y:""})})}function iK(d,p,m,b,N){if(m.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(p=m.alternate,p!==null&&Wm(p,m,N,!0),m=ko.current,m!==null){switch(m.tag){case 13:return Ri===null?$N():m.alternate===null&&Fr===0&&(Fr=3),m.flags&=-257,m.flags|=65536,m.lanes=N,b===I1?m.flags|=16384:(p=m.updateQueue,p===null?m.updateQueue=new Set([b]):p.add(b),FN(d,b,N)),!1;case 22:return m.flags|=65536,b===I1?m.flags|=16384:(p=m.updateQueue,p===null?(p={transitions:null,markerInstances:null,retryQueue:new Set([b])},m.updateQueue=p):(m=p.retryQueue,m===null?p.retryQueue=new Set([b]):m.add(b)),FN(d,b,N)),!1}throw Error(n(435,m.tag))}return FN(d,b,N),$N(),!1}if(Gs)return p=ko.current,p!==null?((p.flags&65536)===0&&(p.flags|=256),p.flags|=65536,p.lanes=N,b!==P1&&(d=Error(n(422),{cause:b}),Lm(jo(d,m)))):(b!==P1&&(p=Error(n(423),{cause:b}),Lm(jo(p,m))),d=d.current.alternate,d.flags|=65536,N&=-N,d.lanes|=N,b=jo(b,m),N=rN(d.stateNode,b,N),vN(d,N),Fr!==4&&(Fr=2)),!1;var C=Error(n(520),{cause:b});if(C=jo(C,m),sg===null?sg=[C]:sg.push(C),Fr!==4&&(Fr=2),p===null)return!0;b=jo(b,m),m=p;do{switch(m.tag){case 3:return m.flags|=65536,d=N&-N,m.lanes|=d,d=rN(m.stateNode,b,d),vN(m,d),!1;case 1:if(p=m.type,C=m.stateNode,(m.flags&128)===0&&(typeof p.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(Mc===null||!Mc.has(C))))return m.flags|=65536,N&=-N,m.lanes|=N,N=vI(N),bI(N,d,m,b),vN(m,N),!1}m=m.return}while(m!==null);return!1}var yI=Error(n(461)),Sn=!1;function Un(d,p,m,b){p.child=d===null?kP(p,null,m,b):su(p,d.child,m,b)}function _I(d,p,m,b,N){m=m.render;var C=p.ref;if("ref"in b){var D={};for(var Y in b)Y!=="ref"&&(D[Y]=b[Y])}else D=b;return cu(p),b=F1(d,p,m,D,C,N),Y=B1(),d!==null&&!Sn?(q1(d,p,N),xl(d,p,N)):(Gs&&Y&&R1(p),p.flags|=1,Un(d,p,b,N),p.child)}function jI(d,p,m,b,N){if(d===null){var C=m.type;return typeof C=="function"&&!SN(C)&&C.defaultProps===void 0&&m.compare===null?(p.tag=15,p.type=C,wI(d,p,C,b,N)):(d=Xb(m.type,null,b,p,p.mode,N),d.ref=p.ref,d.return=p,p.child=d)}if(C=d.child,!pN(d,N)){var D=C.memoizedProps;if(m=m.compare,m=m!==null?m:Pm,m(D,b)&&d.ref===p.ref)return xl(d,p,N)}return p.flags|=1,d=Pc(C,b),d.ref=p.ref,d.return=p,p.child=d}function wI(d,p,m,b,N){if(d!==null){var C=d.memoizedProps;if(Pm(C,b)&&d.ref===p.ref)if(Sn=!1,p.pendingProps=b=C,pN(d,N))(d.flags&131072)!==0&&(Sn=!0);else return p.lanes=d.lanes,xl(d,p,N)}return nN(d,p,m,b,N)}function NI(d,p,m){var b=p.pendingProps,N=b.children,C=(p.stateNode._pendingVisibility&2)!==0,D=d!==null?d.memoizedState:null;if(Gm(d,p),b.mode==="hidden"||C){if((p.flags&128)!==0){if(b=D!==null?D.baseLanes|m:m,d!==null){for(N=p.child=d.child,C=0;N!==null;)C=C|N.lanes|N.childLanes,N=N.sibling;p.childLanes=C&~b}else p.childLanes=0,p.child=null;return kI(d,p,b,m)}if((m&536870912)!==0)p.memoizedState={baseLanes:0,cachePool:null},d!==null&&Lb(p,D!==null?D.cachePool:null),D!==null?SP(p,D):M1(),CP(p);else return p.lanes=p.childLanes=536870912,kI(d,p,D!==null?D.baseLanes|m:m,m)}else D!==null?(Lb(p,D.cachePool),SP(p,D),jc(),p.memoizedState=null):(d!==null&&Lb(p,null),M1(),jc());return Un(d,p,N,m),p.child}function kI(d,p,m,b){var N=$1();return N=N===null?null:{parent:mn._currentValue,pool:N},p.memoizedState={baseLanes:m,cachePool:N},d!==null&&Lb(p,null),M1(),CP(p),d!==null&&Wm(d,p,b,!0),null}function Gm(d,p){var m=p.ref;if(m===null)d!==null&&d.ref!==null&&(p.flags|=2097664);else{if(typeof m!="function"&&typeof m!="object")throw Error(n(284));(d===null||d.ref!==m)&&(p.flags|=2097664)}}function nN(d,p,m,b,N){return cu(p),m=F1(d,p,m,b,void 0,N),b=B1(),d!==null&&!Sn?(q1(d,p,N),xl(d,p,N)):(Gs&&b&&R1(p),p.flags|=1,Un(d,p,m,N),p.child)}function SI(d,p,m,b,N,C){return cu(p),p.updateQueue=null,m=PP(p,b,m,N),AP(d),b=B1(),d!==null&&!Sn?(q1(d,p,C),xl(d,p,C)):(Gs&&b&&R1(p),p.flags|=1,Un(d,p,m,C),p.child)}function CI(d,p,m,b,N){if(cu(p),p.stateNode===null){var C=Vp,D=m.contextType;typeof D=="object"&&D!==null&&(C=Kn(D)),C=new m(b,C),p.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=sN,p.stateNode=C,C._reactInternals=p,C=p.stateNode,C.props=b,C.state=p.memoizedState,C.refs={},gN(p),D=m.contextType,C.context=typeof D=="object"&&D!==null?Kn(D):Vp,C.state=p.memoizedState,D=m.getDerivedStateFromProps,typeof D=="function"&&(tN(p,m,D,b),C.state=p.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(D=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),D!==C.state&&sN.enqueueReplaceState(C,C.state,null),Jm(p,b,C,N),Km(),C.state=p.memoizedState),typeof C.componentDidMount=="function"&&(p.flags|=4194308),b=!0}else if(d===null){C=p.stateNode;var Y=p.memoizedProps,ce=iu(m,Y);C.props=ce;
49var Ne=C.context,tt=m.contextType;D=Vp,typeof tt=="object"&&tt!==null&&(D=Kn(tt));var pt=m.getDerivedStateFromProps;tt=typeof pt=="function"||typeof C.getSnapshotBeforeUpdate=="function",Y=p.pendingProps!==Y,tt||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(Y||Ne!==D)&&fI(p,C,b,D),Sc=!1;var Fe=p.memoizedState;C.state=Fe,Jm(p,b,C,N),Km(),Ne=p.memoizedState,Y||Fe!==Ne||Sc?(typeof pt=="function"&&(tN(p,m,pt,b),Ne=p.memoizedState),(ce=Sc||pI(p,m,ce,b,Fe,Ne,D))?(tt||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(p.flags|=4194308)):(typeof C.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=b,p.memoizedState=Ne),C.props=b,C.state=Ne,C.context=D,b=ce):(typeof C.componentDidMount=="function"&&(p.flags|=4194308),b=!1)}else{C=p.stateNode,xN(d,p),D=p.memoizedProps,tt=iu(m,D),C.props=tt,pt=p.pendingProps,Fe=C.context,Ne=m.contextType,ce=Vp,typeof Ne=="object"&&Ne!==null&&(ce=Kn(Ne)),Y=m.getDerivedStateFromProps,(Ne=typeof Y=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(D!==pt||Fe!==ce)&&fI(p,C,b,ce),Sc=!1,Fe=p.memoizedState,C.state=Fe,Jm(p,b,C,N),Km();var Xe=p.memoizedState;D!==pt||Fe!==Xe||Sc||d!==null&&d.dependencies!==null&&Wb(d.dependencies)?(typeof Y=="function"&&(tN(p,m,Y,b),Xe=p.memoizedState),(tt=Sc||pI(p,m,tt,b,Fe,Xe,ce)||d!==null&&d.dependencies!==null&&Wb(d.dependencies))?(Ne||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(b,Xe,ce),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(b,Xe,ce)),typeof C.componentDidUpdate=="function"&&(p.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof C.componentDidUpdate!="function"||D===d.memoizedProps&&Fe===d.memoizedState||(p.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===d.memoizedProps&&Fe===d.memoizedState||(p.flags|=1024),p.memoizedProps=b,p.memoizedState=Xe),C.props=b,C.state=Xe,C.context=ce,b=tt):(typeof C.componentDidUpdate!="function"||D===d.memoizedProps&&Fe===d.memoizedState||(p.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||D===d.memoizedProps&&Fe===d.memoizedState||(p.flags|=1024),b=!1)}return C=b,Gm(d,p),b=(p.flags&128)!==0,C||b?(C=p.stateNode,m=b&&typeof m.getDerivedStateFromError!="function"?null:C.render(),p.flags|=1,d!==null&&b?(p.child=su(p,d.child,null,N),p.child=su(p,null,m,N)):Un(d,p,m,N),p.memoizedState=C.state,d=p.child):d=xl(d,p,N),d}function EI(d,p,m,b){return Om(),p.flags|=256,Un(d,p,m,b),p.child}var aN={dehydrated:null,treeContext:null,retryLane:0};function oN(d){return{baseLanes:d,cachePool:RP()}}function iN(d,p,m){return d=d!==null?d.childLanes&~m:0,p&&(d|=To),d}function TI(d,p,m){var b=p.pendingProps,N=!1,C=(p.flags&128)!==0,D;if((D=C)||(D=d!==null&&d.memoizedState===null?!1:(hn.current&2)!==0),D&&(N=!0,p.flags&=-129),D=(p.flags&32)!==0,p.flags&=-33,d===null){if(Gs){if(N?_c(p):jc(),Gs){var Y=$n,ce;if(ce=Y){e:{for(ce=Y,Y=Ti;ce.nodeType!==8;){if(!Y){Y=null;break e}if(ce=ri(ce.nextSibling),ce===null){Y=null;break e}}Y=ce}Y!==null?(p.memoizedState={dehydrated:Y,treeContext:Zd!==null?{id:fl,overflow:hl}:null,retryLane:536870912},ce=Eo(18,null,null,0),ce.stateNode=Y,ce.return=p,p.child=ce,ha=p,$n=null,ce=!0):ce=!1}ce||tu(p)}if(Y=p.memoizedState,Y!==null&&(Y=Y.dehydrated,Y!==null))return Y.data==="$!"?p.lanes=16:p.lanes=536870912,null;ml(p)}return Y=b.children,b=b.fallback,N?(jc(),N=p.mode,Y=cN({mode:"hidden",children:Y},N),b=uu(b,N,m,null),Y.return=p,b.return=p,Y.sibling=b,p.child=Y,N=p.child,N.memoizedState=oN(m),N.childLanes=iN(d,D,m),p.memoizedState=aN,b):(_c(p),lN(p,Y))}if(ce=d.memoizedState,ce!==null&&(Y=ce.dehydrated,Y!==null)){if(C)p.flags&256?(_c(p),p.flags&=-257,p=dN(d,p,m)):p.memoizedState!==null?(jc(),p.child=d.child,p.flags|=128,p=null):(jc(),N=b.fallback,Y=p.mode,b=cN({mode:"visible",children:b.children},Y),N=uu(N,Y,m,null),N.flags|=2,b.return=p,N.return=p,b.sibling=N,p.child=b,su(p,d.child,null,m),b=p.child,b.memoizedState=oN(m),b.childLanes=iN(d,D,m),p.memoizedState=aN,p=N);else if(_c(p),Y.data==="$!"){if(D=Y.nextSibling&&Y.nextSibling.dataset,D)var Ne=D.dgst;D=Ne,b=Error(n(419)),b.stack="",b.digest=D,Lm({value:b,source:null,stack:null}),p=dN(d,p,m)}else if(Sn||Wm(d,p,m,!1),D=(m&d.childLanes)!==0,Sn||D){if(D=mr,D!==null){if(b=m&-m,(b&42)!==0)b=1;else switch(b){case 2:b=1;break;case 8:b=4;break;case 32:b=16;break;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:b=64;break;case 268435456:b=134217728;break;default:b=0}if(b=(b&(D.suspendedLanes|m))!==0?0:b,b!==0&&b!==ce.retryLane)throw ce.retryLane=b,yc(d,b),ma(D,d,b),yI}Y.data==="$?"||$N(),p=dN(d,p,m)}else Y.data==="$?"?(p.flags|=128,p.child=d.child,p=jK.bind(null,d),Y._reactRetry=p,p=null):(d=ce.treeContext,$n=ri(Y.nextSibling),ha=p,Gs=!0,ti=null,Ti=!1,d!==null&&(wo[No++]=fl,wo[No++]=hl,wo[No++]=Zd,fl=d.id,hl=d.overflow,Zd=p),p=lN(p,b.children),p.flags|=4096);return p}return N?(jc(),N=b.fallback,Y=p.mode,ce=d.child,Ne=ce.sibling,b=Pc(ce,{mode:"hidden",children:b.children}),b.subtreeFlags=ce.subtreeFlags&31457280,Ne!==null?N=Pc(Ne,N):(N=uu(N,Y,m,null),N.flags|=2),N.return=p,b.return=p,b.sibling=N,p.child=b,b=N,N=p.child,Y=d.child.memoizedState,Y===null?Y=oN(m):(ce=Y.cachePool,ce!==null?(Ne=mn._currentValue,ce=ce.parent!==Ne?{parent:Ne,pool:Ne}:ce):ce=RP(),Y={baseLanes:Y.baseLanes|m,cachePool:ce}),N.memoizedState=Y,N.childLanes=iN(d,D,m),p.memoizedState=aN,b):(_c(p),m=d.child,d=m.sibling,m=Pc(m,{mode:"visible",children:b.children}
49),m.return=p,m.sibling=null,d!==null&&(D=p.deletions,D===null?(p.deletions=[d],p.flags|=16):D.push(d)),p.child=m,p.memoizedState=null,m)}function lN(d,p){return p=cN({mode:"visible",children:p},d.mode),p.return=d,d.child=p}function cN(d,p){return t4(d,p,0,null)}function dN(d,p,m){return su(p,d.child,null,m),d=lN(p,p.pendingProps.children),d.flags|=2,p.memoizedState=null,d}function RI(d,p,m){d.lanes|=p;var b=d.alternate;b!==null&&(b.lanes|=p),hN(d.return,p,m)}function uN(d,p,m,b,N){var C=d.memoizedState;C===null?d.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:b,tail:m,tailMode:N}:(C.isBackwards=p,C.rendering=null,C.renderingStartTime=0,C.last=b,C.tail=m,C.tailMode=N)}function AI(d,p,m){var b=p.pendingProps,N=b.revealOrder,C=b.tail;if(Un(d,p,b.children,m),b=hn.current,(b&2)!==0)b=b&1|2,p.flags|=128;else{if(d!==null&&(d.flags&128)!==0)e:for(d=p.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&RI(d,m,p);else if(d.tag===19)RI(d,m,p);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===p)break e;for(;d.sibling===null;){if(d.return===null||d.return===p)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}b&=1}switch(we(hn,b),N){case"forwards":for(m=p.child,N=null;m!==null;)d=m.alternate,d!==null&&Ob(d)===null&&(N=m),m=m.sibling;m=N,m===null?(N=p.child,p.child=null):(N=m.sibling,m.sibling=null),uN(p,!1,N,m,C);break;case"backwards":for(m=null,N=p.child,p.child=null;N!==null;){if(d=N.alternate,d!==null&&Ob(d)===null){p.child=N;break}d=N.sibling,N.sibling=m,m=N,N=d}uN(p,!0,m,null,C);break;case"together":uN(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function xl(d,p,m){if(d!==null&&(p.dependencies=d.dependencies),Ic|=p.lanes,(m&p.childLanes)===0)if(d!==null){if(Wm(d,p,m,!1),(m&p.childLanes)===0)return null}else return null;if(d!==null&&p.child!==d.child)throw Error(n(153));if(p.child!==null){for(d=p.child,m=Pc(d,d.pendingProps),p.child=m,m.return=p;d.sibling!==null;)d=d.sibling,m=m.sibling=Pc(d,d.pendingProps),m.return=p;m.sibling=null}return p.child}function pN(d,p){return(d.lanes&p)!==0?!0:(d=d.dependencies,!!(d!==null&&Wb(d)))}function lK(d,p,m){switch(p.tag){case 3:je(p,p.stateNode.containerInfo),kc(p,mn,d.memoizedState.cache),Om();break;case 27:case 5:Oe(p);break;case 4:je(p,p.stateNode.containerInfo);break;case 10:kc(p,p.type,p.memoizedProps.value);break;case 13:var b=p.memoizedState;if(b!==null)return b.dehydrated!==null?(_c(p),p.flags|=128,null):(m&p.child.childLanes)!==0?TI(d,p,m):(_c(p),d=xl(d,p,m),d!==null?d.sibling:null);_c(p);break;case 19:var N=(d.flags&128)!==0;if(b=(m&p.childLanes)!==0,b||(Wm(d,p,m,!1),b=(m&p.childLanes)!==0),N){if(b)return AI(d,p,m);p.flags|=128}if(N=p.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),we(hn,hn.current),b)break;return null;case 22:case 23:return p.lanes=0,NI(d,p,m);case 24:kc(p,mn,d.memoizedState.cache)}return xl(d,p,m)}function PI(d,p,m){if(d!==null)if(d.memoizedProps!==p.pendingProps)Sn=!0;else{if(!pN(d,m)&&(p.flags&128)===0)return Sn=!1,lK(d,p,m);Sn=(d.flags&131072)!==0}else Sn=!1,Gs&&(p.flags&1048576)!==0&&gP(p,Rb,p.index);switch(p.lanes=0,p.tag){case 16:e:{d=p.pendingProps;var b=p.elementType,N=b._init;if(b=N(b._payload),p.type=b,typeof b=="function")SN(b)?(d=iu(b,d),p.tag=1,p=CI(null,p,b,d,m)):(p.tag=0,p=nN(null,p,b,d,m));else{if(b!=null){if(N=b.$$typeof,N===y){p.tag=11,p=_I(null,p,b,d,m);break e}else if(N===w){p.tag=14,p=jI(null,p,b,d,m);break e}}throw p=I(b)||b,Error(n(306,p,""))}}return p;case 0:return nN(d,p,p.type,p.pendingProps,m);case 1:return b=p.type,N=iu(b,p.pendingProps),CI(d,p,b,N,m);case 3:e:{if(je(p,p.stateNode.containerInfo),d===null)throw Error(n(387));var C=p.pendingProps;
49N=p.memoizedState,b=N.element,xN(d,p),Jm(p,C,null,m);var D=p.memoizedState;if(C=D.cache,kc(p,mn,C),C!==N.cache&&mN(p,[mn],m,!0),Km(),C=D.element,N.isDehydrated)if(N={element:C,isDehydrated:!1,cache:D.cache},p.updateQueue.baseState=N,p.memoizedState=N,p.flags&256){p=EI(d,p,C,m);break e}else if(C!==b){b=jo(Error(n(424)),p),Lm(b),p=EI(d,p,C,m);break e}else for($n=ri(p.stateNode.containerInfo.firstChild),ha=p,Gs=!0,ti=null,Ti=!0,m=kP(p,null,C,m),p.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Om(),C===b){p=xl(d,p,m);break e}Un(d,p,C,m)}p=p.child}return p;case 26:return Gm(d,p),d===null?(m=O4(p.type,null,p.pendingProps,null))?p.memoizedState=m:Gs||(m=p.type,d=p.pendingProps,b=cy(de.current).createElement(m),b[ze]=p,b[Gt]=d,Fn(b,m,d),st(b),p.stateNode=b):p.memoizedState=O4(p.type,d.memoizedProps,p.pendingProps,d.memoizedState),null;case 27:return Oe(p),d===null&&Gs&&(b=p.stateNode=P4(p.type,p.pendingProps,de.current),ha=p,Ti=!0,$n=ri(b.firstChild)),b=p.pendingProps.children,d!==null||Gs?Un(d,p,b,m):p.child=su(p,null,b,m),Gm(d,p),p.child;case 5:return d===null&&Gs&&((N=b=$n)&&(b=$K(b,p.type,p.pendingProps,Ti),b!==null?(p.stateNode=b,ha=p,$n=ri(b.firstChild),Ti=!1,N=!0):N=!1),N||tu(p)),Oe(p),N=p.type,C=p.pendingProps,D=d!==null?d.memoizedProps:null,b=C.children,QN(N,C)?b=null:D!==null&&QN(N,D)&&(p.flags|=32),p.memoizedState!==null&&(N=F1(d,p,tK,null,null,m),ug._currentValue=N),Gm(d,p),Un(d,p,b,m),p.child;case 6:return d===null&&Gs&&((d=m=$n)&&(m=UK(m,p.pendingProps,Ti),m!==null?(p.stateNode=m,ha=p,$n=null,d=!0):d=!1),d||tu(p)),null;case 13:return TI(d,p,m);case 4:return je(p,p.stateNode.containerInfo),b=p.pendingProps,d===null?p.child=su(p,null,b,m):Un(d,p,b,m),p.child;case 11:return _I(d,p,p.type,p.pendingProps,m);case 7:return Un(d,p,p.pendingProps,m),p.child;case 8:return Un(d,p,p.pendingProps.children,m),p.child;case 12:return Un(d,p,p.pendingProps.children,m),p.child;case 10:return b=p.pendingProps,kc(p,p.type,b.value),Un(d,p,b.children,m),p.child;case 9:return N=p.type._context,b=p.pendingProps.children,cu(p),N=Kn(N),b=b(N),p.flags|=1,Un(d,p,b,m),p.child;case 14:return jI(d,p,p.type,p.pendingProps,m);case 15:return wI(d,p,p.type,p.pendingProps,m);case 19:return AI(d,p,m);case 22:return NI(d,p,m);case 24:return cu(p),b=Kn(mn),d===null?(N=$1(),N===null&&(N=mr,C=L1(),N.pooledCache=C,C.refCount++,C!==null&&(N.pooledCacheLanes|=m),N=C),p.memoizedState={parent:b,cache:N},gN(p),kc(p,mn,N)):((d.lanes&m)!==0&&(xN(d,p),Jm(p,null,null,m),Km()),N=d.memoizedState,C=p.memoizedState,N.parent!==b?(N={parent:b,cache:b},p.memoizedState=N,p.lanes===0&&(p.memoizedState=p.updateQueue.baseState=N),kc(p,mn,b)):(b=C.cache,kc(p,mn,b),b!==N.
vendor: 4,588 bytes, line 49
49cache&&mN(p,[mn],m,!0))),Un(d,p,p.pendingProps.children,m),p.child;case 29:throw p.pendingProps}throw Error(n(156,p.tag))}var fN=le(null),lu=null,vl=null;function kc(d,p,m){we(fN,p._currentValue),p._currentValue=m}function bl(d){d._currentValue=fN.current,Se(fN)}function hN(d,p,m){for(;d!==null;){var b=d.alternate;if((d.childLanes&p)!==p?(d.childLanes|=p,b!==null&&(b.childLanes|=p)):b!==null&&(b.childLanes&p)!==p&&(b.childLanes|=p),d===m)break;d=d.return}}function mN(d,p,m,b){var N=d.child;for(N!==null&&(N.return=d);N!==null;){var C=N.dependencies;if(C!==null){var D=N.child;C=C.firstContext;e:for(;C!==null;){var Y=C;C=N;for(var ce=0;ce<p.length;ce++)if(Y.context===p[ce]){C.lanes|=m,Y=C.alternate,Y!==null&&(Y.lanes|=m),hN(C.return,m,d),b||(D=null);break e}C=Y.next}}else if(N.tag===18){if(D=N.return,D===null)throw Error(n(341));D.lanes|=m,C=D.alternate,C!==null&&(C.lanes|=m),hN(D,m,d),D=null}else D=N.child;if(D!==null)D.return=N;else for(D=N;D!==null;){if(D===d){D=null;break}if(N=D.sibling,N!==null){N.return=D.return,D=N;break}D=D.return}N=D}}function Wm(d,p,m,b){d=null;for(var N=p,C=!1;N!==null;){if(!C){if((N.flags&524288)!==0)C=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var D=N.alternate;if(D===null)throw Error(n(387));if(D=D.memoizedProps,D!==null){var Y=N.type;Xa(N.pendingProps.value,D.value)||(d!==null?d.push(Y):d=[Y])}}else if(N===Me.current){if(D=N.alternate,D===null)throw Error(n(387));D.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(d!==null?d.push(ug):d=[ug])}N=N.return}d!==null&&mN(p,d,m,b),p.flags|=262144}function Wb(d){for(d=d.firstContext;d!==null;){if(!Xa(d.context._currentValue,d.memoizedValue))return!0;d=d.next}return!1}function cu(d){lu=d,vl=null,d=d.dependencies,d!==null&&(d.firstContext=null)}function Kn(d){return II(lu,d)}function Yb(d,p){return lu===null&&cu(d),II(d,p)}function II(d,p){var m=p._currentValue;if(p={context:p,memoizedValue:m,next:null},vl===null){if(d===null)throw Error(n(308));vl=p,d.dependencies={lanes:0,firstContext:p},d.flags|=524288}else vl=vl.next=p;return m}var Sc=!1;function gN(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xN(d,p){d=d.updateQueue,p.updateQueue===d&&(p.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,callbacks:null})}function Cc(d){return{lane:d,tag:0,payload:null,callback:null,next:null}}function Ec(d,p,m){var b=d.updateQueue;if(b===null)return null;if(b=b.shared,(Ar&2)!==0){var N=b.pending;return N===null?p.next=p:(p.next=N.next,N.next=p),b.pending=p,p=Eb(d),hP(d,null,m),p}return Cb(d,b,p,m),Eb(d)}function Ym(d,p,m){if(p=p.updateQueue,p!==null&&(p=p.shared,(m&4194176)!==0)){var b=p.lanes;b&=d.pendingLanes,m|=b,p.lanes=m,ss(d,m)}}function vN(d,p){var m=d.updateQueue,b=d.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var N=null,C=null;if(m=m.firstBaseUpdate,m!==null){do{var D={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};C===null?N=C=D:C=C.next=D,m=m.next}while(m!==null);C===null?N=C=p:C=C.next=p}else N=C=p;m={baseState:b.baseState,firstBaseUpdate:N,lastBaseUpdate:C,shared:b.shared,callbacks:b.callbacks},d.updateQueue=m;return}d=m.lastBaseUpdate,d===null?m.firstBaseUpdate=p:d.next=p,m.lastBaseUpdate=p}var bN=!1;function Km(){if(bN){var d=Xp;if(d!==null)throw d}}function Jm(d,p,m,b){bN=!1;var N=d.updateQueue;Sc=!1;var C=N.firstBaseUpdate,D=N.lastBaseUpdate,Y=N.shared.pending;if(Y!==null){N.shared.pending=null;var ce=Y,Ne=ce.next;ce.next=null,D===null?C=Ne:D.next=Ne,D=ce;var tt=d.alternate;tt!==null&&(tt=tt.updateQueue,Y=tt.lastBaseUpdate,Y!==D&&(Y===null?tt.firstBaseUpdate=Ne:Y.next=Ne,tt.lastBaseUpdate=ce))}if(C!==null){var pt=N.baseState;D=0,tt=Ne=ce=null,Y=C;do{var Fe=Y.lane&-536870913,Xe=Fe!==Y.lane;if(Xe?(Fs&Fe)===Fe:(b&Fe)===Fe){Fe!==0&&Fe===Jp&&(bN=!0),tt!==null&&(tt=tt.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var Wt=d,vs=Y;Fe=p;var Br=m;switch(vs.tag){case 1:if(Wt=vs.payload,typeof Wt=="function"){pt=Wt.call(Br,pt,Fe);break e}pt=Wt;break e;case 3:Wt.flags=Wt.flags&-65537|128;case 0:if(Wt=vs.payload,Fe=typeof Wt=="function"?Wt.call(Br,pt,Fe):Wt,Fe==null)break e;pt=M({},pt,Fe);break e;case 2:Sc=!0}}Fe=Y.callback,Fe!==null&&(d.flags|=64,Xe&&(d.flags|=8192),Xe=N.callbacks,Xe===null?N.callbacks=[Fe]:Xe.push(Fe))}else Xe={lane:Fe,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},tt===null?(Ne=tt=Xe,ce=pt):tt=tt.next=Xe,D|=Fe;if(Y=Y.next,Y===null){if(Y=N.shared.pending,Y===null)break;
49Xe=Y,Y=Xe.next,Xe.next=null,N.lastBaseUpdate=Xe,N.shared.pending=null}}while(!0);tt===null&&(ce=pt),N.baseState=ce,N.firstBaseUpdate=Ne,N.lastBaseUpdate=tt,C===null&&(N.shared.lanes=0),Ic|=D,d.lanes=D,d.memoizedState=pt}}function MI(d,p){if(typeof d!="function")throw Error(n(191,d));d.call(p)}function OI(d,p){var m=d.callbacks;if(m!==null)for(d.callbacks=null,d=0;d<m.length;d++)MI(m[d],p)}function Xm(d,p){try{var m=p.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var N=b.next;m=N;do{if((m.tag&d)===d){b=void 0;var C=m.create,D=m.inst;b=C(),D.destroy=b}m=m.next}while(m!==N)}}catch(Y){fr(p,p.return,Y)}}function Tc(d,p,m){try{var b=p.updateQueue,N=b!==null?b.lastEffect:null;if(N!==null){var C=N.next;b=C;do{if((b.tag&d)===d){var D=b.inst,Y=D.destroy;if(Y!==void 0){D.destroy=void 0,N=p;var ce=m;try{Y()}catch(Ne){fr(N,ce,Ne)}}}b=b.next}while(b!==C)}}catch(Ne){fr(p,p.return,Ne)}}function LI(d){var p=d.updateQueue;if(p!==null){var m=d.stateNode;try{OI(p,m)}catch(b){fr(d,d.return,b)}}}function DI(d,p,m){m.props=iu(d.type,d.memoizedProps),m.state=d.memoizedState;try{m.componentWillUnmount()}catch(b){fr(d,p,b)}}function du(d,p){try{var m=d.ref;if(m!==null){var b=d.stateNode;switch(d.tag){case 26:case 27:case 5:var N=b;break;default:N=b}typeof m=="function"?d.refCleanup=m(N):m.current=N}}catch(C){fr(d,p,C)}}function Qa(d,p){var m=d.ref,b=d.refCleanup;if(m!==null)if(typeof b=="function")try{b()}catch(N){fr(d,p,N)}finally{d.refCleanup=null,d=d.alternate,d!=null&&(d.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(N){fr(d,p,N)}else m.current=null}function $I(d){var p=d.type,m=d.memoizedProps,b=d.stateNode;try{e:switch(p){case"button":case"input":case"select":case"textarea":m.autoFocus&&b.focus();break e;case"img":m.src?b.src=m.src:m.srcSet&&(b.srcset=m.srcSet)}}catch(N){fr(d,d.return,N)}}function UI(d,p,m){try{var b=d.stateNode;IK(b,d.type,m,p),b[Gt]=p}catch(N){fr(d,d.return,N)}}function FI(d){return d.tag===5||d.tag===3||d.tag===26||d.tag===27||d.tag===4}function yN(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||FI(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==27&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function _N(d,p,m){var b=d.tag;if(b===5||b===6)d=d.stateNode,p?m.nodeType===8?m.parentNode.insertBefore(d,p):m.insertBefore(d,p):(m.nodeType===8?(p=m.parentNode,p.insertBefore(d,m)):(p=m,p.appendChild(d)),m=m._reactRootContainer,m!=null||p.onclick!==null||(p.onclick=ly));else if(b!==4&&b!==27&&(d=d.child,d!==null))for(_N(d,p,m),d=d.sibling;d!==null;)_N(d,p,m),d=d.sibling}function Kb(d,p,m){var b=d.tag;if(b===5||b===6)d=d.stateNode,p?m.insertBefore(d,p):m.appendChild(d);else if(b!==4&&b!==27&&(d=d.child,d!==null))for(Kb(d,p,m),d=d.sibling;d!==null;)Kb(d,p,m),d=d.sibling}var yl=!1,Ur=!1,jN=!1,BI=typeof WeakSet=="function"?WeakSet:Set,Cn=null,qI=!1;function cK(d,p){if(d=d.containerInfo,JN=my,d=aP(d),N1(d)){if("selectionStart"in d)var m={start:d.selectionStart,end:d.selectionEnd};else e:{m=(m=d.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var N=b.anchorOffset,C=b.focusNode;b=b.focusOffset;try{m.nodeType,C.nodeType}catch{m=null;break e}var D=0,Y=-1,ce=-1,Ne=0,tt=0,pt=d,Fe=null;t:for(;;){for(var Xe;pt!==m||N!==0&&pt.nodeType!==3||(Y=D+N),pt!==C||b!==0&&pt.nodeType!==3||(ce=D+b),pt.nodeType===3&&(D+=pt.nodeValue.length),(Xe=pt.firstChild)!==null;)Fe=pt,pt=Xe;for(;;){if(pt===d)break t;if(Fe===m&&++Ne===N&&(Y=D),Fe===C&&++tt===b&&(ce=D),(Xe=pt.nextSibling)!==null)break;pt=Fe,Fe=pt.parentNode}pt=Xe}m=Y===-1||ce===-1?null:{start:Y,end:ce}}else m=null}m=m||{start:0,end:0}}else m=null;for(XN={focusedElem:d,selectionRange:m},my=!1,Cn=p;Cn!==null;)if(p=Cn,d=p.child,(p.subtreeFlags&1028)!==0&&d!==null)d.return=p,Cn=d;else for(;Cn!==null;){switch(p=Cn,C=p.alternate,d=p.flags,p.tag){case 0:break;case 11:case 15:break;case 1:if((d&1024)!==0&&C!==null){d=void 0,m=p,N=C.memoizedProps,C=C.memoizedState,b
49=m.stateNode;try{var Wt=iu(m.type,N,m.elementType===m.type);d=b.getSnapshotBeforeUpdate(Wt,C),b.__reactInternalSnapshotBeforeUpdate=d}catch(vs){fr(m,m.return,vs)}}break;case 3:if((d&1024)!==0){if(d=p.stateNode.containerInfo,m=d.nodeType,m===9)tk(d);else if(m===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":tk(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((d&1024)!==0)throw Error(n(163))}if(d=p.sibling,d!==null){d.return=p.return,Cn=d;break}Cn=p.return}return Wt=qI,qI=!1,Wt}function zI(d,p,m){var b=m.flags;switch(m.tag){case 0:case 11:case 15:jl(d,m),b&4&&Xm(5,m);break;case 1:if(jl(d,m),b&4)if(d=m.stateNode,p===null)try{d.componentDidMount()}catch(Y){fr(m,m.return,Y)}else{var N=iu(m.type,p.memoizedProps);p=p.memoizedState;try{d.componentDidUpdate(N,p,d.__reactInternalSnapshotBeforeUpdate)}catch(Y){fr(m,m.return,Y)}}b&64&&LI(m),b&512&&du(m,m.return);break;case 3:if(jl(d,m),b&64&&(b=m.updateQueue,b!==null)){if(d=null,m.child!==null)switch(m.child.tag){case 27:case 5:d=m.child.stateNode;break;case 1:d=m.child.stateNode}try{OI(b,d)}catch(Y){fr(m,m.return,Y)}}break;case 26:jl(d,m),b&512&&du(m,m.return);break;case 27:case 5:jl(d,m),p===null&&b&4&&$I(m),b&512&&du(m,m.return);break;case 12:jl(d,m);break;case 13:jl(d,m),b&4&&GI(d,m);break;case 22:if(N=m.memoizedState!==null||yl,!N){p=p!==null&&p.memoizedState!==null||Ur;var C=yl,D=Ur;yl=N,(Ur=p)&&!D?Rc(d,m,(m.subtreeFlags&8772)!==0):jl(d,m),yl=C,Ur=D}b&512&&(m.memoizedProps.mode==="manual"?du(m,m.return):Qa(m,m.return));break;default:jl(d,m)}}function HI(d){var p=d.alternate;p!==null&&(d.alternate=null,HI(p)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(p=d.stateNode,p!==null&&ne(p)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}var en=null,Za=!1;function _l(d,p,m){for(m=m.child;m!==null;)VI(d,p,m),m=m.sibling}function VI(d,p,m){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Ve,m)}catch{}switch(m.tag){case 26:Ur||Qa(m,p),_l(d,p,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:Ur||Qa(m,p);var b=en,N=Za;for(en=m.stateNode,_l(d,p,m),m=m.stateNode,p=m.attributes;p.length;)m.removeAttributeNode(p[0]);ne(m),en=b,Za=N;break;case 5:Ur||Qa(m,p);case 6:N=en;var C=Za;if(en=null,_l(d,p,m),en=N,Za=C,en!==null)if(Za)try{d=en,b=m.stateNode,d.nodeType===8?d.parentNode.removeChild(b):d.removeChild(b)}catch(D){fr(m,p,D)}else try{en.removeChild(m.stateNode)}catch(D){fr(m,p,D)}break;case 18:en!==null&&(Za?(p=en,m=m.stateNode,p.nodeType===8?ek(p.parentNode,m):p.nodeType===1&&ek(p,m),mg(p)):ek(en,m.stateNode));break;case 4:b=en,N=Za,en=m.stateNode.containerInfo,Za=!0,_l(d,p,m),en=b,Za=N;break;case 0:case 11:case 14:case 15:Ur||Tc(2,m,p),Ur||Tc(4,m,p),_l(d,p,m);break;case 1:Ur||(Qa(m,p),b=m.stateNode,typeof b.componentWillUnmount=="function"&&DI(m,p,b)),_l(d,p,m);break;case 21:_l(d,p,m);break;case 22:Ur||Qa(m,p),Ur=(b=Ur)||m.memoizedState!==null,_l(d,p,m),Ur=b;break;default:_l(d,p,m)}}function GI(d,p){if(p.memoizedState===null&&(d=p.alternate,d!==null&&(d=d.memoizedState,d!==null&&(d=d.dehydrated,d!==null))))try{mg(d)}catch(m){fr(p,p.return,m)}}function dK(d){switch(d.tag){case 13:case 19:var p=d.stateNode;return p===null&&(p=d.stateNode=new BI),p;case 22:return d=d.stateNode,p=d._retryCache,p===null&&(p=d._retryCache=new BI),p;default:throw Error(n(435,d.tag))}}function wN(d,p){var m=dK(d);p.forEach(function(b){var N=wK.bind(null,d,b);m.has(b)||(m.add(b),b.then(N,N))})}function So(d,p){var m=p.deletions;if(m!==null)for(var b=0;b<m.length;b++){var N=m[b],C=d,D=p,Y=D;e:for(;Y!==null;){switch(Y.tag){case 27:case 5:en=Y.stateNode,Za=!1;break e;case 3:en=Y.stateNode.containerInfo,Za=!0;break e;case 4:en=Y.stateNode.containerInfo,Za=!0;break e}Y=Y.return}if(en===null)throw Error(n(160));VI(C,D,N),en=null,Za=!1,C=N.alternate,C!==null&&(C.return=null),N.return=null}if(p.subtreeFlags&13878)for(p=p.child;p!==null;)WI(p,d),p=p.sibling}var si=null;function WI(d,p){var m=d.alternate,b=d.flags;switch(d.tag){case 0:case 11:case 14:case 15:So(p,d),Co(d),b&4&&(Tc(3,d,d.return),Xm(3,d),Tc(5,d,d.return));break;case 1:So(p,d),Co(d),b&512&&(Ur||m===null||Qa(m,m.return)),b&64&&yl&&(d=d.updateQueue,d!==null&&(b=d.callbacks,b!==null&&(m=d.shared.hiddenCallbacks,d.shared.hiddenCallbacks=m===null?b:m.concat(b))));break;case 26:var N=si;if(So(p,d),Co(d),b&512&&(Ur||m===null||Qa(m,m.return)),b&4){var
49C=m!==null?m.memoizedState:null;if(b=d.memoizedState,m===null)if(b===null)if(d.stateNode===null){e:{b=d.type,m=d.memoizedProps,N=N.ownerDocument||N;t:switch(b){case"title":C=N.getElementsByTagName("title")[0],(!C||C[Qe]||C[ze]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=N.createElement(b),N.head.insertBefore(C,N.querySelector("head > title"))),Fn(C,b,m),C[ze]=d,st(C),b=C;break e;case"link":var D=$4("link","href",N).get(b+(m.href||""));if(D){for(var Y=0;Y<D.length;Y++)if(C=D[Y],C.getAttribute("href")===(m.href==null?null:m.href)&&C.getAttribute("rel")===(m.rel==null?null:m.rel)&&C.getAttribute("title")===(m.title==null?null:m.title)&&C.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){D.splice(Y,1);break t}}C=N.createElement(b),Fn(C,b,m),N.head.appendChild(C);break;case"meta":if(D=$4("meta","content",N).get(b+(m.content||""))){for(Y=0;Y<D.length;Y++)if(C=D[Y],C.getAttribute("content")===(m.content==null?null:""+m.content)&&C.getAttribute("name")===(m.name==null?null:m.name)&&C.getAttribute("property")===(m.property==null?null:m.property)&&C.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&C.getAttribute("charset")===(m.charSet==null?null:m.charSet)){D.splice(Y,1);break t}}C=N.createElement(b),Fn(C,b,m),N.head.appendChild(C);break;default:throw Error(n(468,b))}C[ze]=d,st(C),b=C}d.stateNode=b}else U4(N,d.type,d.stateNode);else d.stateNode=D4(N,b,d.memoizedProps);else C!==b?(C===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):C.count--,b===null?U4(N,d.type,d.stateNode):D4(N,b,d.memoizedProps)):b===null&&d.stateNode!==null&&UI(d,d.memoizedProps,m.memoizedProps)}break;case 27:if(b&4&&d.alternate===null){N=d.stateNode,C=d.memoizedProps;try{for(var ce=N.firstChild;ce;){var Ne=ce.nextSibling,tt=ce.nodeName;ce[Qe]||tt==="HEAD"||tt==="BODY"||tt==="SCRIPT"||tt==="STYLE"||tt==="LINK"&&ce.rel.toLowerCase()==="stylesheet"||N.removeChild(ce),ce=Ne}for(var pt=d.type,Fe=N.attributes;Fe.length;)N.removeAttributeNode(Fe[0]);Fn(N,pt,C),N[ze]=d,N[Gt]=C}catch(Wt){fr(d,d.return,Wt)}}case 5:if(So(p,d),Co(d),b&512&&(Ur||m===null||Qa(m,m.return)),d.flags&32){N=d.stateNode;try{Ea(N,"")}catch(Wt){fr(d,d.return,Wt)}}b&4&&d.stateNode!=null&&(N=d.memoizedProps,UI(d,N,m!==null?m.memoizedProps:N)),b&1024&&(jN=!0);break;case 6:if(So(p,d),Co(d),b&4){if(d.stateNode===null)throw Error(n(162));b=d.memoizedProps,m=d.stateNode;try{m.nodeValue=b}catch(Wt){fr(d,d.return,Wt)}}break;case 3:if(py=null,N=si,si=dy(p.containerInfo),So(p,d),si=N,Co(d),b&4&&m!==null&&m.memoizedState.isDehydrated)try{mg(p.containerInfo)}catch(Wt){fr(d,d.return,Wt)}jN&&(jN=!1,YI(d));break;case 4:b=si,si=dy(d.stateNode.containerInfo),So(p,d),Co(d),si=b;break;case 12:So(p,d),Co(d);break;case 13:So(p,d),Co(d),d.child.flags&8192&&d.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(PN=vt()),b&4&&(b=d.updateQueue,b!==null&&(d.updateQueue=null,wN(d,b)));break;case 22:if(b&512&&(Ur||m===null||Qa(m,m.return)),ce=d.memoizedState!==null,Ne=m!==null&&m.memoizedState!==null,tt=yl,pt=Ur,yl=tt||ce,Ur=pt||Ne,So(p,d),Ur=pt,yl=tt,Co(d),p=d.stateNode,p._current=d,p._visibility&=-3,p._visibility|=p._pendingVisibility&2,b&8192&&(p._visibility=ce?p._visibility&-2:p._visibility|1,ce&&(p=yl||Ur,m===null||Ne||p||tf(d)),d.memoizedProps===null||d.memoizedProps.mode!=="manual"))e:for(m=null,p=d;;){if(p.tag===5||p.tag===26||p.tag===27){if(m===null){Ne=m=p;try{if(N=Ne.stateNode,ce)C=N.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{D=Ne.stateNode,Y=Ne.memoizedProps.style;var Xe=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;D.style.display=Xe==null||typeof Xe=="boolean"?"":(""+Xe).trim()}}catch(Wt){fr(Ne,Ne.return,Wt)}}}else if(p.tag===6){if(m===null){Ne=p;try{Ne.stateNode.nodeValue=ce?"":Ne.memoizedProps}catch(Wt){fr(Ne,Ne.return,Wt)}}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===d)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break e;for(;p.sibling===null;){if(p.return===null||p.return===d)break e;m===p&&(m=null),p=p.return}m===p&&(m=null),p.sibling.return=p.return,p=p.sibling}b&4&&(b=d.updateQueue,b!==null&&(m=b.retryQueue,m!==null&&(b.retryQueue=null,wN(d,m))));break;case 19:So(p,d),Co(d),b&4&&(b=d.updateQueue,b!==null&&(d.updateQueue=null,wN(d,b)));break;case 21:break;default:So(p,d),Co(d)}}function Co(d){var p=d.flags;if(p&2){try{if(d.tag!==27){e:{for(var m=d.return;m!==null;){if(FI(m)){var b=m;break e}m=m.return}throw Error(n(160))}switch(b.tag){case 27:var N=b.stateNode,C=yN(d);Kb(d,C,N);break;case 5:var D=b.stateNode;b.flags&32&&(Ea(D,""),b.flags&=-33);var Y=yN(d);Kb(d,Y,D);break;case 3:case 4:var ce=b.stateNode.containerInfo,Ne=yN(d);_N(d,Ne,ce);break;default:throw Error(n(161))}}}catch(tt){fr(d,d.return,tt)}d.flags&=-3}p&4096&&(d.flags&=-4097)}function YI(d){if(d.subtreeFlags&1024)for(d=d.child;d!==null;){var p=d;YI(p),p.tag===5&&p.flags&1024&&p.stateNode.reset(),d=d.sibling}}function jl(d,p){if(p.subtreeFlags&8772)for(p=p.child;p!==null;)zI(d,p.alternate,p),p=p.sibling}function tf(d){for(d=d.child;d!==null;){var p=d;switch(p.tag){case 0:case 11:case 14:case 15:Tc(4,p,p.return),tf(p);break;case 1:Qa(p,p.return);var m=p.stateNode;typeof m.componentWillUnmount=="function"&&DI(p,p.return,m),tf(p);break;case 26:case 27:case 5:Qa(p,p.return),tf(p);break;case 22:Qa(p,p.return),p.memoizedState===null&&tf(p);break;default:tf(p)}d=d.sibling}}function Rc(d,p,m){for(m=m&&(p.subtreeFlags&8772)!==0,p=p.child;p!==null;){var b=p.alternate,N=d,C=p,D=C.flags;switch(C.tag){case 0:case 11:case 15:Rc(N,C,m),Xm(4,C);break;
vendor: 4,491 bytes, line 49
49case 1:if(Rc(N,C,m),b=C,N=b.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(Ne){fr(b,b.return,Ne)}if(b=C,N=b.updateQueue,N!==null){var Y=b.stateNode;try{var ce=N.shared.hiddenCallbacks;if(ce!==null)for(N.shared.hiddenCallbacks=null,N=0;N<ce.length;N++)MI(ce[N],Y)}catch(Ne){fr(b,b.return,Ne)}}m&&D&64&&LI(C),du(C,C.return);break;case 26:case 27:case 5:Rc(N,C,m),m&&b===null&&D&4&&$I(C),du(C,C.return);break;case 12:Rc(N,C,m);break;case 13:Rc(N,C,m),m&&D&4&&GI(N,C);break;case 22:C.memoizedState===null&&Rc(N,C,m),du(C,C.return);break;default:Rc(N,C,m)}p=p.sibling}}function NN(d,p){var m=null;d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(m=d.memoizedState.cachePool.pool),d=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(d=p.memoizedState.cachePool.pool),d!==m&&(d!=null&&d.refCount++,m!=null&&Bm(m))}function kN(d,p){d=null,p.alternate!==null&&(d=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==d&&(p.refCount++,d!=null&&Bm(d))}function Ac(d,p,m,b){if(p.subtreeFlags&10256)for(p=p.child;p!==null;)KI(d,p,m,b),p=p.sibling}function KI(d,p,m,b){var N=p.flags;switch(p.tag){case 0:case 11:case 15:Ac(d,p,m,b),N&2048&&Xm(9,p);break;case 3:Ac(d,p,m,b),N&2048&&(d=null,p.alternate!==null&&(d=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==d&&(p.refCount++,d!=null&&Bm(d)));break;case 12:if(N&2048){Ac(d,p,m,b),d=p.stateNode;try{var C=p.memoizedProps,D=C.id,Y=C.onPostCommit;typeof Y=="function"&&Y(D,p.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(ce){fr(p,p.return,ce)}}else Ac(d,p,m,b);break;case 23:break;case 22:C=p.stateNode,p.memoizedState!==null?C._visibility&4?Ac(d,p,m,b):Qm(d,p):C._visibility&4?Ac(d,p,m,b):(C._visibility|=4,sf(d,p,m,b,(p.subtreeFlags&10256)!==0)),N&2048&&NN(p.alternate,p);break;case 24:Ac(d,p,m,b),N&2048&&kN(p.alternate,p);break;default:Ac(d,p,m,b)}}function sf(d,p,m,b,N){for(N=N&&(p.subtreeFlags&10256)!==0,p=p.child;p!==null;){var C=d,D=p,Y=m,ce=b,Ne=D.flags;switch(D.tag){case 0:case 11:case 15:sf(C,D,Y,ce,N),Xm(8,D);break;case 23:break;case 22:var tt=D.stateNode;D.memoizedState!==null?tt._visibility&4?sf(C,D,Y,ce,N):Qm(C,D):(tt._visibility|=4,sf(C,D,Y,ce,N)),N&&Ne&2048&&NN(D.alternate,D);break;case 24:sf(C,D,Y,ce,N),N&&Ne&2048&&kN(D.alternate,D);break;default:sf(C,D,Y,ce,N)}p=p.sibling}}function Qm(d,p){if(p.subtreeFlags&10256)for(p=p.child;p!==null;){var m=d,b=p,N=b.flags;switch(b.tag){case 22:Qm(m,b),N&2048&&NN(b.alternate,b);break;case 24:Qm(m,b),N&2048&&kN(b.alternate,b);break;default:Qm(m,b)}p=p.sibling}}var Zm=8192;function rf(d){if(d.subtreeFlags&Zm)for(d=d.child;d!==null;)JI(d),d=d.sibling}function JI(d){switch(d.tag){case 26:rf(d),d.flags&Zm&&d.memoizedState!==null&&QK(si,d.memoizedState,d.memoizedProps);break;case 5:rf(d);break;case 3:case 4:var p=si;si=dy(d.stateNode.containerInfo),rf(d),si=p;break;case 22:d.memoizedState===null&&(p=d.alternate,p!==null&&p.memoizedState!==null?(p=Zm,Zm=16777216,rf(d),Zm=p):rf(d));break;default:rf(d)}}function XI(d){var p=d.alternate;if(p!==null&&(d=p.child,d!==null)){p.child=null;do p=d.sibling,d.sibling=null,d=p;while(d!==null)}}function eg(d){var p=d.deletions;if((d.flags&16)!==0){if(p!==null)for(var m=0;m<p.length;m++){var b=p[m];Cn=b,ZI(b,d)}XI(d)}if(d.subtreeFlags&10256)for(d=d.child;d!==null;)QI(d),d=d.sibling}function QI(d){switch(d.tag){case 0:case 11:case 15:eg(d),d.flags&2048&&Tc(9,d,d.return);break;case 3:eg(d);break;case 12:eg(d);break;case 22:var p=d.stateNode;d.memoizedState!==null&&p._visibility&4&&(d.return===null||d.return.tag!==13)?(p._visibility&=-5,Jb(d)):eg(d);break;default:eg(d)}}function Jb(d){var p=d.deletions;if((d.flags&16)!==0){if(p!==null)for(var m=0;m<p.length;m++){var b=p[m];Cn=b,ZI(b,d)}XI(d)}for(d=d.child;d!==null;){switch(p=d,p.tag){case 0:case 11:case 15:Tc(8,p,p.return),Jb(p);break;case 22:m=p.stateNode,m._visibility&4&&(m._visibility&=-5,Jb(p));break;default:Jb(p)}d=d.sibling}}function ZI(d,p){for(;Cn!==null;){var m=Cn;switch(m.tag){case 0:case 11:case 15:Tc(8,m,p);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var b=m.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:Bm(m.memoizedState.cache)}if(b=m.child,b!==null)b.return=m,Cn=b;else e:for(m=d;Cn!==null;){b=Cn;var N=b.sibling,C=b.return;if(HI(b),b===m){Cn=null;break e}if(N!==null){N.return=C,Cn=N;break e}Cn=C}}}function uK(d,p,m,b){this.tag=d,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.t
49ype=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Eo(d,p,m,b){return new uK(d,p,m,b)}function SN(d){return d=d.prototype,!(!d||!d.isReactComponent)}function Pc(d,p){var m=d.alternate;return m===null?(m=Eo(d.tag,p,d.key,d.mode),m.elementType=d.elementType,m.type=d.type,m.stateNode=d.stateNode,m.alternate=d,d.alternate=m):(m.pendingProps=p,m.type=d.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=d.flags&31457280,m.childLanes=d.childLanes,m.lanes=d.lanes,m.child=d.child,m.memoizedProps=d.memoizedProps,m.memoizedState=d.memoizedState,m.updateQueue=d.updateQueue,p=d.dependencies,m.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},m.sibling=d.sibling,m.index=d.index,m.ref=d.ref,m.refCleanup=d.refCleanup,m}function e4(d,p){d.flags&=31457282;var m=d.alternate;return m===null?(d.childLanes=0,d.lanes=p,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=m.childLanes,d.lanes=m.lanes,d.child=m.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=m.memoizedProps,d.memoizedState=m.memoizedState,d.updateQueue=m.updateQueue,d.type=m.type,p=m.dependencies,d.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext}),d}function Xb(d,p,m,b,N,C){var D=0;if(b=d,typeof d=="function")SN(d)&&(D=1);else if(typeof d=="string")D=JK(d,m,Le.current)?26:d==="html"||d==="head"||d==="body"?27:5;else e:switch(d){case c:return uu(m.children,N,C,p);case u:D=8,N|=24;break;case f:return d=Eo(12,m,p,N|2),d.elementType=f,d.lanes=C,d;case _:return d=Eo(13,m,p,N),d.elementType=_,d.lanes=C,d;case j:return d=Eo(19,m,p,N),d.elementType=j,d.lanes=C,d;case S:return t4(m,N,C,p);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case h:case v:D=10;break e;case g:D=9;break e;case y:D=11;break e;case w:D=14;break e;case k:D=16,b=null;break e}D=29,m=Error(n(130,d===null?"null":typeof d,"")),b=null}return p=Eo(D,m,p,N),p.elementType=d,p.type=b,p.lanes=C,p}function uu(d,p,m,b){return d=Eo(7,d,b,p),d.lanes=m,d}function t4(d,p,m,b){d=Eo(22,d,b,p),d.elementType=S,d.lanes=m;var N={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var C=N._current;if(C===null)throw Error(n(456));if((N._pendingVisibility&2)===0){var D=yc(C,2);D!==null&&(N._pendingVisibility|=2,ma(D,C,2))}},attach:function(){var C=N._current;if(C===null)throw Error(n(456));if((N._pendingVisibility&2)!==0){var D=yc(C,2);D!==null&&(N._pendingVisibility&=-3,ma(D,C,2))}}};return d.stateNode=N,d}function CN(d,p,m){return d=Eo(6,d,null,p),d.lanes=m,d}function EN(d,p,m){return p=Eo(4,d.children!==null?d.children:[],d.key,p),p.lanes=m,p.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},p}function wl(d){d.flags|=4}function s4(d,p){if(p.type!=="stylesheet"||(p.state.loading&4)!==0)d.flags&=-16777217;else if(d.flags|=16777216,!F4(p)){if(p=ko.current,p!==null&&((Fs&4194176)===Fs?Ri!==null:(Fs&62914560)!==Fs&&(Fs&536870912)===0||p!==Ri))throw $m=I1,bP;d.flags|=8192}}function Qb(d,p){p!==null&&(d.flags|=4),d.flags&16384&&(p=d.tag!==22?Ye():536870912,d.lanes|=p,af|=p)}function tg(d,p){if(!Gs)switch(d.tailMode){case"hidden":p=d.tail;for(var m=null;p!==null;)p.alternate!==null&&(m=p),p=p.sibling;m===null?d.tail=null:m.sibling=null;break;case"collapsed":m=d.tail;for(var b=null;m!==null;)m.alternate!==null&&(b=m),m=m.sibling;b===null?p||d.tail===null?d.tail=null:d.tail.sibling=null:b.sibling=null}}function Rr(d){var p=d.alternate!==null&&d.alternate.child===d.child,m=0,b=0;if(p)for(var N=d.child;N!==null;)m|=N.lanes|N.childLanes,b|=N.subtreeFlags&31457280,b|=N.flags&31457280,N.return=d,N=N.sibling;else for(N=d.child;N!==null;)m|=N.lanes|N.childLanes,b|=N.subtreeFlags,b|=N.flags,N.return=d,N=N.sibling;return d.subtreeFlags|=b,d.childLanes=m,p}function pK(d,p,m){var b=p.pendingProps;switch(A1(p),p.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rr(p),null;case 1:return Rr(p),null;case 3:return m=p.stateNode,b=null,d!==null&&(b=d.memoizedState.cache),p.memoizedState.cache!==b&&(p.flags|=2048),bl(mn),Ae(),m.pendingContext&&(m.context=m.pendingContext,m.pen
49dingContext=null),(d===null||d.child===null)&&(Mm(p)?wl(p):d===null||d.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,ti!==null&&(LN(ti),ti=null))),Rr(p),null;case 26:return m=p.memoizedState,d===null?(wl(p),m!==null?(Rr(p),s4(p,m)):(Rr(p),p.flags&=-16777217)):m?m!==d.memoizedState?(wl(p),Rr(p),s4(p,m)):(Rr(p),p.flags&=-16777217):(d.memoizedProps!==b&&wl(p),Rr(p),p.flags&=-16777217),null;case 27:Ke(p),m=de.current;var N=p.type;if(d!==null&&p.stateNode!=null)d.memoizedProps!==b&&wl(p);else{if(!b){if(p.stateNode===null)throw Error(n(166));return Rr(p),null}d=Le.current,Mm(p)?xP(p):(d=P4(N,b,m),p.stateNode=d,wl(p))}return Rr(p),null;case 5:if(Ke(p),m=p.type,d!==null&&p.stateNode!=null)d.memoizedProps!==b&&wl(p);else{if(!b){if(p.stateNode===null)throw Error(n(166));return Rr(p),null}if(d=Le.current,Mm(p))xP(p);else{switch(N=cy(de.current),d){case 1:d=N.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:d=N.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":d=N.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":d=N.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":d=N.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof b.is=="string"?N.createElement("select",{is:b.is}):N.createElement("select"),b.multiple?d.multiple=!0:b.size&&(d.size=b.size);break;default:d=typeof b.is=="string"?N.createElement(m,{is:b.is}):N.createElement(m)}}d[ze]=p,d[Gt]=b;e:for(N=p.child;N!==null;){if(N.tag===5||N.tag===6)d.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===p)break e;for(;N.sibling===null;){if(N.return===null||N.return===p)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}p.stateNode=d;e:switch(Fn(d,m,b),m){case"button":case"input":case"select":case"textarea":d=!!b.autoF
49ocus;break e;case"img":d=!0;break e;default:d=!1}d&&wl(p)}}return Rr(p),p.flags&=-16777217,null;case 6:if(d&&p.stateNode!=null)d.memoizedProps!==b&&wl(p);else{if(typeof b!="string"&&p.stateNode===null)throw Error(n(166));if(d=de.current,Mm(p)){if(d=p.stateNode,m=p.memoizedProps,b=null,N=ha,N!==null)switch(N.tag){case 27:case 5:b=N.memoizedProps}d[ze]=p,d=!!(d.nodeValue===m||b!==null&&b.suppressHydrationWarning===!0||S4(d.nodeValue,m)),d||tu(p)}else d=cy(d).createTextNode(b),d[ze]=p,p.stateNode=d}return Rr(p),null;case 13:if(b=p.memoizedState,d===null||d.memoizedState!==null&&d.memoizedState.dehydrated!==null){if(N=Mm(p),b!==null&&b.dehydrated!==null){if(d===null){if(!N)throw Error(n(318));if(N=p.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[ze]=p}else Om(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Rr(p),N=!1}else ti!==null&&(LN(ti),ti=null),N=!0;if(!N)return p.flags&256?(ml(p),p):(ml(p),null)}if(ml(p),(p.flags&128)!==0)return p.lanes=m,p;if(m=b!==null,d=d!==null&&d.memoizedState!==null,m){b=p.child,N=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(N=b.alternate.memoizedState.cachePool.pool);var C=null;b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(C=b.memoizedState.cachePool.pool),C!==N&&(b.flags|=2048)}return m!==d&&m&&(p.child.flags|=8192),Qb(p,p.updateQueue),Rr(p),null;case 4:return Ae(),d===null&&WN(p.stateNode.containerInfo),Rr(p),null;case 10:return bl(p.type),Rr(p),null;case 19:if(Se(hn),N=p.memoizedState,N===null)return Rr(p),null;if(b=(p.flags&128)!==0,C=N.rendering,C===null)if(b)tg(N,!1);else{if(Fr!==0||d!==null&&(d.flags&128)!==0)for(d=p.child;d!==null;){if(C=Ob(d),C!==null){for(p.flags|=128,tg(N,!1),d=C.updateQueue,p.updateQueue=d,Qb(p,d),p.subtreeFlags=0,d=m,m=p.child;m!==null;)e4(m,d),m=m.sibling;return we(hn,hn.current&1|2),p.child}d=d.sibling}N.tail!==null&&vt()>Zb&&(p.flags|=128,b=!0,tg(N,!1),p.lanes=4194304)}else{if(!b)if(d=Ob(C),d!==null){if(p.flags|=128,b=!0,d=d.updateQueue,p.updateQueue=d,Qb(p,d),tg(N,!0),N.tail===null&&N.tailMode==="hidden"&&!C.alternate&&!Gs)return Rr(p),null}else 2*vt()-N.renderingStartTime>Zb&&m!==536870912&&(p.flags|=128,b=!0,tg(N,!1),p.lanes=4194304);N.isBackwards?(C.sibling=p.child,p.child=C):(d=N.last,d!==null?d.sibling=C:p.child=C,N.last=C)}return N.tail!==null?(p=N.tail,N.rendering=p,N.tail=p.sibling,N.renderingStartTime=vt(),p.sibling=null,d=hn.current,we(hn,b?d&1|2:d&1),p):(Rr(p),null);case 22:case 23:return ml(p),O1(),b=p.memoizedState!==null,d!==null?d.memoizedState!==null!==b&&(p.flags|=8192):b&&(p.flags|=8192),b?(m&536870912)!==0&&(p.flags&128)===0&&(Rr(p),p.subtreeFlags&6&&(p.flags|=8192)):Rr(p),m=p.updateQueue,m!==null&&Qb(p,m.retryQueue),m=null,d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(m=d.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==m&&(p.flags|=2048),d!==null&&Se(ru),null;case 24:return m=null,d!==null&&(m=d.memoizedState.cache),p.memoizedState.cache!==m&&(p.flags|=2048),bl(mn),Rr(p),null;case 25:return null}throw Error(n(156,p.tag))}function fK(d,p){switch(A1(p),p.tag){case 1:return d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 3:return bl(mn),Ae(),d=p.flags,(d&65536)!==0&&(d&128)===0?(p.flags=d&-65537|128,p):null;case 26:case 27:case 5:return Ke(p),null;case 13:if(ml(p),d=p.memoizedState,d!==null&&d.dehydrated!==null){if(p.alternate===null)throw Error(n(340));Om()}return d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 19:return Se(hn),null;case 4:return Ae(),null;case 10:return bl(p.type),null;case 22:case 23:return ml(p),O1(),d!==null&&Se(ru),d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 24:return bl(mn),null;case 25:return null;default:return null}}function r4(d,p){switch(A1(p),p.tag){case 3:bl(mn),Ae();break;case 26:case 27:case 5:Ke(p);break;case 4:Ae();break;case 13:ml(p);break;case 19:Se(hn);break;case 10:bl(p.type);break;case 22:case 23:ml(p),O1(),d!==null&&Se(ru);break;case 24:bl(mn)}}var hK={getCacheForType:function(d){var p=Kn(mn),m=p.data.get(d);return m===void 0&&(m=d(),p.data.set(d,m)),m}},mK=typeof WeakMap=="function"?WeakMap:Map,Ar=0,mr=null,As=null,Fs=0,gr=0,eo=null,Nl=!1,nf=!1,TN=!1,kl=0,Fr=0,Ic=0,pu=0,RN=0,To=0,af=0,sg=null,Pi=null,AN=!1,PN=0,Zb=1/0,ey=null,Mc=null,ty=!1,fu=null,rg=0,IN=0,MN=null,ng=0,ON=null;function to(){if((Ar&2)!==0&&Fs!==0)return Fs&-Fs;if(L.T!==null){var d=Jp;return d!==0?d:zN()}return re()}function n4(){To===0&&(To=(Fs&536870912)===0||Gs?Ce():536870912);var d=ko.current;return d!==null&&(d.flags|=32),To}function ma(d,p,m){(d===mr&&gr===2||d.cancelPendingCommit!==null)&&(of(d,0),Sl(d,Fs,To,!1)),Ge(d,m),((Ar&2)===0||d!==mr)&&(d===mr&&((Ar&2)===0&&(pu|=m),Fr===4&&Sl(d,Fs,To,!1)),Ii(d))}function a4(d,p,m){if((Ar&6)!==0)throw Error(n(327));var b=!m&&(p&60)===0&&(p&d.expiredLanes)===0||He(d,p),N=b?vK(d,p):UN(d,p,!0),C=b;do{if(N===0){nf&&!b&&Sl(d,p,0,!1);break}else if(N===6)Sl(d,p,0,!Nl);else{if(m=d.current.alternate,C&&!gK(m)){N=UN(d,p,!1),C=!1;continue}if(N===2){if(C=p,d.errorRecoveryDisabledLanes&C)var D=0;else D=d.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){p=D;e:{var Y=d;N=sg;var ce=Y.current.memoizedState.isDehydrated;
49if(ce&&(of(Y,D).flags|=256),D=UN(Y,D,!1),D!==2){if(TN&&!ce){Y.errorRecoveryDisabledLanes|=C,pu|=C,N=4;break e}C=Pi,Pi=N,C!==null&&LN(C)}N=D}if(C=!1,N!==2)continue}}if(N===1){of(d,0),Sl(d,p,0,!0);break}e:{switch(b=d,N){case 0:case 1:throw Error(n(345));case 4:if((p&4194176)===p){Sl(b,p,To,!Nl);break e}break;case 2:Pi=null;break;case 3:case 5:break;default:throw Error(n(329))}if(b.finishedWork=m,b.finishedLanes=p,(p&62914560)===p&&(C=PN+300-vt(),10<C)){if(Sl(b,p,To,!Nl),Ee(b,0)!==0)break e;b.timeoutHandle=T4(o4.bind(null,b,m,Pi,ey,AN,p,To,pu,af,Nl,2,-0,0),C);break e}o4(b,m,Pi,ey,AN,p,To,pu,af,Nl,0,-0,0)}}break}while(!0);Ii(d)}function LN(d){Pi===null?Pi=d:Pi.push.apply(Pi,d)}function o4(d,p,m,b,N,C,D,Y,ce,Ne,tt,pt,Fe){var Xe=p.subtreeFlags;if((Xe&8192||(Xe&16785408)===16785408)&&(dg={stylesheets:null,count:0,unsuspend:XK},JI(p),p=ZK(),p!==null)){d.cancelPendingCommit=p(f4.bind(null,d,m,b,N,D,Y,ce,1,pt,Fe)),Sl(d,C,D,!Ne);return}f4(d,m,b,N,D,Y,ce,tt,pt,Fe)}function gK(d){for(var p=d;;){var m=p.tag;if((m===0||m===11||m===15)&&p.flags&16384&&(m=p.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var b=0;b<m.length;b++){var N=m[b],C=N.getSnapshot;N=N.value;try{if(!Xa(C(),N))return!1}catch{return!1}}if(m=p.child,p.subtreeFlags&16384&&m!==null)m.return=p,p=m;else{if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Sl(d,p,m,b){p&=~RN,p&=~pu,d.suspendedLanes|=p,d.pingedLanes&=~p,b&&(d.warmLanes|=p),b=d.expirationTimes;for(var N=p;0<N;){var C=31-St(N),D=1<<C;b[C]=-1,N&=~D}m!==0&&Tt(d,m,p)}function sy(){return(Ar&6)===0?(ag(0),!1):!0}function DN(){if(As!==null){if(gr===0)var d=As.return;else d=As,vl=lu=null,z1(d),Yp=null,Um=0,d=As;for(;d!==null;)r4(d.alternate,d),d=d.return;As=null}}function of(d,p){d.finishedWork=null,d.finishedLanes=0;var m=d.timeoutHandle;m!==-1&&(d.timeoutHandle=-1,OK(m)),m=d.cancelPendingCommit,m!==null&&(d.cancelPendingCommit=null,m()),DN(),mr=d,As=m=Pc(d.current,null),Fs=p,gr=0,eo=null,Nl=!1,nf=He(d,p),TN=!1,af=To=RN=pu=Ic=Fr=0,Pi=sg=null,AN=!1,(p&8)!==0&&(p|=p&32);var b=d.entangledLanes;if(b!==0)for(d=d.entanglements,b&=p;0<b;){var N=31-St(b),C=1<<N;p|=d[N],b&=~C}return kl=p,Sb(),m}function i4(d,p){Ss=null,L.H=Ai,p===Dm?(p=jP(),gr=3):p===bP?(p=jP(),gr=4):gr=p===yI?8:p!==null&&typeof p=="object"&&typeof p.then=="function"?6:1,eo=p,As===null&&(Fr=1,Gb(d,jo(p,d.current)))}function l4(){var d=L.H;return L.H=Ai,d===null?Ai:d}function c4(){var d=L.A;return L.A=hK,d}function $N(){Fr=4,Nl||(Fs&4194176)!==Fs&&ko.current!==null||(nf=!0),(Ic&134217727)===0&&(pu&134217727)===0||mr===null||Sl(mr,Fs,To,!1)}function UN(d,p,m){var b=Ar;Ar|=2;var N=l4(),C=c4();(mr!==d||Fs!==p)&&(ey=null,of(d,p)),p=!1;var D=Fr;e:do try{if(gr!==0&&As!==null){var Y=As,ce=eo;switch(gr){case 8:DN(),D=6;break e;case 3:case 2:case 6:ko.current===null&&(p=!0);var Ne=gr;if(gr=0,eo=null,lf(d,Y,ce,Ne),m&&nf){D=0;break e}break;default:Ne=gr,gr=0,eo=null,lf(d,Y,ce,Ne)}}xK(),D=Fr;break}catch(tt){i4(d,tt)}while(!0);return p&&d.shellSuspendCounter++,vl=lu=null,Ar=b,L.H=N,L.A=C,As===null&&(mr=null,Fs=0,Sb()),D}function xK(){for(;As!==null;)d4(As)}function vK(d,p){var m=Ar;Ar|=2;var b=l4(),N=c4();mr!==d||Fs!==p?(ey=null,Zb=vt()+500,of(d,p)):nf=He(d,p);e:do try{if(gr!==0&&As!==null){p=As;var C=eo;t:switch(gr){case 1:gr=0,eo=null,lf(d,p,C,1);break;case 2:if(yP(C)){gr=0,eo=null,u4(p);break}p=function(){gr===2&&mr===d&&(gr=7),Ii(d)},C.then(p,p);break e;case 3:gr=7;break e;case 4:gr=5;break e;case 7:yP(C)?(gr=0,eo=null,u4(p)):(gr=0,eo=null,lf(d,p,C,7));break;case 5:var D=null;switch(As.tag){case 26:D=As.memoizedState;case 5:case 27:var Y=As;if(!D||F4(D)){gr=0,eo=null;var ce=Y.sibling;if(ce!==null)As=ce;else{var Ne=Y.return;Ne!==null?(As=Ne,ry(Ne)):As=null}break t}}gr=0,eo=null,lf(d,p,C,5);break;case 6:gr=0,eo=null,lf(d,p,C,6);break;case 8:DN(),Fr=6;break e;default:throw Error(n(462))}}bK();break}catch(tt){i4(d,tt)}while(!0);return vl=lu=null,L.H=b,L.A=N,Ar=m,As!==null?0:(mr=null,Fs=0,Sb(),Fr)}function bK(){for(;As!==null&&!rt();)d4(As)}function d4(d){var p=PI(d.alternate,d,kl);
49d.memoizedProps=d.pendingProps,p===null?ry(d):As=p}function u4(d){var p=d,m=p.alternate;switch(p.tag){case 15:case 0:p=SI(m,p,p.pendingProps,p.type,void 0,Fs);break;case 11:p=SI(m,p,p.pendingProps,p.type.render,p.ref,Fs);break;case 5:z1(p);default:r4(m,p),p=As=e4(p,kl),p=PI(m,p,kl)}d.memoizedProps=d.pendingProps,p===null?ry(d):As=p}function lf(d,p,m,b){vl=lu=null,z1(p),Yp=null,Um=0;var N=p.return;try{if(iK(d,N,p,m,Fs)){Fr=1,Gb(d,jo(m,d.current)),As=null;return}}catch(C){if(N!==null)throw As=N,C;Fr=1,Gb(d,jo(m,d.current)),As=null;return}p.flags&32768?(Gs||b===1?d=!0:nf||(Fs&536870912)!==0?d=!1:(Nl=d=!0,(b===2||b===3||b===6)&&(b=ko.current,b!==null&&b.tag===13&&(b.flags|=16384))),p4(p,d)):ry(p)}function ry(d){var p=d;do{if((p.flags&32768)!==0){p4(p,Nl);return}d=p.return;var m=pK(p.alternate,p,kl);if(m!==null){As=m;return}if(p=p.sibling,p!==null){As=p;return}As=p=d}while(p!==null);Fr===0&&(Fr=5)}function p4(d,p){do{var m=fK(d.alternate,d);if(m!==null){m.flags&=32767,As=m;return}if(m=d.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!p&&(d=d.sibling,d!==null)){As=d;return}As=d=m}while(d!==null);Fr=6,As=null}function f4(d,p,m,b,N,C,D,Y,ce,Ne){var tt=L.T,pt=U.p;try{U.p=2,L.T=null,yK(d,p,m,b,pt,N,C,D,Y,ce,Ne)}finally{L.T=tt,U.p=pt}}function yK(d,p,m,b,N,C,D,Y){do cf();while(fu!==null);if((Ar&6)!==0)throw Error(n(327));var ce=d.finishedWork;if(b=d.finishedLanes,ce===null)return null;if(d.finishedWork=null,d.finishedLanes=0,ce===d.current)throw Error(n(177));d.callbackNode=null,d.callbackPriority=0,d.cancelPendingCommit=null;var Ne=ce.lanes|ce.childLanes;if(Ne|=E1,Nt(d,b,Ne,C,D,Y),d===mr&&(As=mr=null,Fs=0),(ce.subtreeFlags&10256)===0&&(ce.flags&10256)===0||ty||(ty=!0,IN=Ne,MN=m,NK(be,function(){return cf(),null})),m=(ce.flags&15990)!==0,(ce.subtreeFlags&15990)!==0||m?(m=L.T,L.T=null,C=U.p,U.p=2,D=Ar,Ar|=4,cK(d,ce),WI(ce,d),HY(XN,d.containerInfo),my=!!JN,XN=JN=null,d.current=ce,zI(d,ce.alternate,ce),mt(),Ar=D,U.p=C,L.T=m):d.current=ce,ty?(ty=!1,fu=d,rg=b):h4(d,Ne),Ne=d.pendingLanes,Ne===0&&(Mc=null),Pt(ce.stateNode),Ii(d),p!==null)for(N=d.onRecoverableError,ce=0;ce<p.length;ce++)Ne=p[ce],N(Ne.value,{componentStack:Ne.stack});return(rg&3)!==0&&cf(),Ne=d.pendingLanes,(b&4194218)!==0&&(Ne&42)!==0?d===ON?ng++:(ng=0,ON=d):ng=0,ag(0),null}function h4(d,p){(d.pooledCacheLanes&=p)===0&&(p=d.pooledCache,p!=null&&(d.pooledCache=null,Bm(p)))}function cf(){if(fu!==null){var d=fu,p=IN;IN=0;var m=Zt(rg),b=L.T,N=U.p;try{if(U.p=32>m?32:m,L.T=null,fu===null)var C=!1;else{m=MN,MN=null;var D=fu,Y=rg;if(fu=null,rg=0,(Ar&6)!==0)throw Error(n(331));var ce=Ar;if(Ar|=4,QI(D.current),KI(D,D.current,Y,m),Ar=ce,ag(0,!1),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(Ve,D)}catch{}C=!0}return C}finally{U.p=N,L.T=b,h4(d,p)}}return!1}function m4(d,p,m){p=jo(m,p),p=rN(d.stateNode,p,2),d=Ec(d,p,2),d!==null&&(Ge(d,2),Ii(d))}function fr(d,p,m){if(d.tag===3)m4(d,d,m);else for(;p!==null;){if(p.tag===3){m4(p,d,m);break}else if(p.tag===1){var b=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Mc===null||!Mc.has(b))){d=jo(m,d),m=vI(2),b=Ec(p,m,2),b!==null&&(bI(m,b,p,d),Ge(b,2),Ii(b));break}}p=p.return}}function FN(d,p,m){var b=d.pingCache;if(b===null){b=d.pingCache=new mK;var N=new Set;b.set(p,N)}else N=b.get(p),N===void 0&&(N=new Set,b.set(p,N));N.has(m)||(TN=!0,N.add(m),d=_K.bind(null,d,p,m),p.then(d,d))}function _K(d,p,m){var b=d.pingCache;b!==null&&b.delete(p),d.pingedLanes|=d.suspendedLanes&m,d.warmLanes&=~m,mr===d&&(Fs&m)===m&&(Fr===4||Fr===3&&(Fs&62914560)===Fs&&300>vt()-PN?(Ar&2)===0&&of(d,0):RN|=m,af===Fs&&(af=0)),Ii(d)}function g4(d,p){p===0&&(p=Ye()),d=yc(d,p),d!==null&&(Ge(d,p),Ii(d))}function jK(d){var p=d.memoizedState,m=0;p!==null&&(m=p.retryLane),g4(d,m)}function wK(d,p){var m=0;switch(d.tag){case 13:var b=d.stateNode,N=d.memoizedState;N!==null&&(m=N.retryLane);break;case 19:b=d.stateNode;break;case 22:b=d.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(p),g4(d,m)}function NK(d,p){return De(d,p)}var ny=null,df=null,BN=!1,ay=!1,qN=!1,hu=0;function Ii(d){d!==df&&d.next===null&&(df===null?ny=df=d:df=df.next=d),ay=!0,BN||(BN=!0,SK(kK))}function ag(d,p){if(!qN&&ay){qN=!0;do for(var m=!1,b=ny;b!==null;){if(d!==0){var N=b.pendingLanes;if(N===0)var C=0;else{var D=b.suspendedLanes,Y=b.pingedLanes;C=(1<<31-St(42|d)+1)-1,C&=N&~(D&~Y),C=C&201326677?C&201326677|1:C?C|2:0}C!==0&&(m=!0,b4(b,C))}else C=Fs,C=Ee(b,b===mr?C:0),(C&3)===0||He(b,C)||(m=!0,b4(b,C));b=b.next}
vendor: 4,654 bytes, line 49
49while(m);qN=!1}}function kK(){ay=BN=!1;var d=0;hu!==0&&(MK()&&(d=hu),hu=0);for(var p=vt(),m=null,b=ny;b!==null;){var N=b.next,C=x4(b,p);C===0?(b.next=null,m===null?ny=N:m.next=N,N===null&&(df=m)):(m=b,(d!==0||(C&3)!==0)&&(ay=!0)),b=N}ag(d)}function x4(d,p){for(var m=d.suspendedLanes,b=d.pingedLanes,N=d.expirationTimes,C=d.pendingLanes&-62914561;0<C;){var D=31-St(C),Y=1<<D,ce=N[D];ce===-1?((Y&m)===0||(Y&b)!==0)&&(N[D]=ie(Y,p)):ce<=p&&(d.expiredLanes|=Y),C&=~Y}if(p=mr,m=Fs,m=Ee(d,d===p?m:0),b=d.callbackNode,m===0||d===p&&gr===2||d.cancelPendingCommit!==null)return b!==null&&b!==null&&ct(b),d.callbackNode=null,d.callbackPriority=0;if((m&3)===0||He(d,m)){if(p=m&-m,p===d.callbackPriority)return p;switch(b!==null&&ct(b),Zt(m)){case 2:case 8:m=ve;break;case 32:m=be;break;case 268435456:m=Ze;break;default:m=be}return b=v4.bind(null,d),m=De(m,b),d.callbackPriority=p,d.callbackNode=m,p}return b!==null&&b!==null&&ct(b),d.callbackPriority=2,d.callbackNode=null,2}function v4(d,p){var m=d.callbackNode;if(cf()&&d.callbackNode!==m)return null;var b=Fs;return b=Ee(d,d===mr?b:0),b===0?null:(a4(d,b,p),x4(d,vt()),d.callbackNode!=null&&d.callbackNode===m?v4.bind(null,d):null)}function b4(d,p){if(cf())return null;a4(d,p,!0)}function SK(d){LK(function(){(Ar&6)!==0?De(Be,d):d()})}function zN(){return hu===0&&(hu=Ce()),hu}function y4(d){return d==null||typeof d=="symbol"||typeof d=="boolean"?null:typeof d=="function"?d:Mp(""+d)}function _4(d,p){var m=p.ownerDocument.createElement("input");return m.name=p.name,m.value=p.value,d.id&&m.setAttribute("form",d.id),p.parentNode.insertBefore(m,p),d=new FormData(d),m.parentNode.removeChild(m),d}function CK(d,p,m,b,N){if(p==="submit"&&m&&m.stateNode===N){var C=y4((N[Gt]||null).action),D=b.submitter;D&&(p=(p=D[Gt]||null)?y4(p.formAction):D.getAttribute("formAction"),p!==null&&(C=p,D=null));var Y=new Up("action","action",null,b,N);d.push({event:Y,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(hu!==0){var ce=D?_4(N,D):new FormData(N);Q1(m,{pending:!0,data:ce,method:N.method,action:C},null,ce)}}else typeof C=="function"&&(Y.preventDefault(),ce=D?_4(N,D):new FormData(N),Q1(m,{pending:!0,data:ce,method:N.method,action:C},C,ce))},currentTarget:N}]})}}for(var HN=0;HN<fP.length;HN++){var VN=fP[HN],EK=VN.toLowerCase(),TK=VN[0].toUpperCase()+VN.slice(1);ei(EK,"on"+TK)}ei(lP,"onAnimationEnd"),ei(cP,"onAnimationIteration"),ei(dP,"onAnimationStart"),ei("dblclick","onDoubleClick"),ei("focusin","onFocus"),ei("focusout","onBlur"),ei(GY,"onTransitionRun"),ei(WY,"onTransitionStart"),ei(YY,"onTransitionCancel"),ei(uP,"onTransitionEnd"),Rt("onMouseEnter",["mouseout","mouseover"]),Rt("onMouseLeave",["mouseout","mouseover"]),Rt("onPointerEnter",["pointerout","pointerover"]),Rt("onPointerLeave",["pointerout","pointerover"]),rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rs("onBeforeInput",["compositionend","keypress","textInput","paste"]),rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var og="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(" "),RK=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(og));function j4(d,p){p=(p&4)!==0;for(var m=0;m<d.length;m++){var b=d[m],N=b.event;b=b.listeners;e:{var C=void 0;if(p)for(var D=b.length-1;0<=D;D--){var Y=b[D],ce=Y.instance,Ne=Y.currentTarget;if(Y=Y.listener,ce!==C&&N.isPropagationStopped())break e;C=Y,N.currentTarget=Ne;try{C(N)}catch(tt){Vb(tt)}N.currentTarget=null,C=ce}else for(D=0;D<b.length;D++){if(Y=b[D],ce=Y.instance,Ne=Y.currentTarget,Y=Y.listener,ce!==C&&N.isPropagationStopped())break e;C=Y,N.currentTarget=Ne;try{C(N)}catch(tt){Vb(tt)}N.currentTarget=null,C=ce}}}}function Ds(d,p){var m=p[ls];m===void 0&&(m=p[ls]=new Set);var b=d+"__bubble";m.has(b)||(w4(p,d,2,!1),m.add(b))}function GN(d,p,m){var b=0;p&&(b|=4),w4(m,d,b,p)}var oy="_reactListening"+Math.random().toString(36).slice(2);function WN(d){if(!d[oy]){d[oy]=!0,xt.forEach(function(m){m!=="selectionchange"&&(RK.has(m)||GN(m,!1,d),GN(m,!0,d))});var p=d.nodeType===9?d:d.ownerDocument;p===null||p[oy]||(p[oy]=!0,GN("selectionchange",!1,p))}}
vendor: 1,839 bytes, line 49
49function w4(d,p,m,b){switch(G4(p)){case 2:var N=sJ;break;case 8:N=rJ;break;default:N=ok}m=N.bind(null,p,m,d),N=void 0,!ki||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(N=!0),b?N!==void 0?d.addEventListener(p,m,{capture:!0,passive:N}):d.addEventListener(p,m,!0):N!==void 0?d.addEventListener(p,m,{passive:N}):d.addEventListener(p,m,!1)}function YN(d,p,m,b,N){var C=b;if((p&1)===0&&(p&2)===0&&b!==null)e:for(;;){if(b===null)return;var D=b.tag;if(D===3||D===4){var Y=b.stateNode.containerInfo;if(Y===N||Y.nodeType===8&&Y.parentNode===N)break;if(D===4)for(D=b.return;D!==null;){var ce=D.tag;if((ce===3||ce===4)&&(ce=D.stateNode.containerInfo,ce===N||ce.nodeType===8&&ce.parentNode===N))return;D=D.return}for(;Y!==null;){if(D=P(Y),D===null)return;if(ce=D.tag,ce===5||ce===6||ce===26||ce===27){b=C=D;continue e}Y=Y.parentNode}}b=b.return}Wd(function(){var Ne=C,tt=_m(m),pt=[];e:{var Fe=pP.get(d);if(Fe!==void 0){var Xe=Up,Wt=d;switch(d){case"keypress":if(Lp(m)===0)break e;case"keydown":case"keyup":Xe=ms;break;case"focusin":Wt="focus",Xe=Jd;break;case"focusout":Wt="blur",Xe=Jd;break;case"beforeblur":case"afterblur":Xe=Jd;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Xe=km;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Xe=b1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Xe=ul;break;case lP:case cP:case dP:Xe=xb;break;case uP:Xe=pl;break;case"scroll":case"scrollend":Xe=Ta;break;case"wheel":Xe=Js;break;case"copy":case"cut":case"paste":Xe=vb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Xe=er;break;
vendor: 5,383 bytes, lines 49-50
49case"toggle":case"beforetoggle":Xe=fa}var vs=(p&4)!==0,Br=!vs&&(d==="scroll"||d==="scrollend"),Ie=vs?Fe!==null?Fe+"Capture":null:Fe;vs=[];for(var _e=Ne,$e;_e!==null;){var ot=_e;if($e=ot.stateNode,ot=ot.tag,ot!==5&&ot!==26&&ot!==27||$e===null||Ie===null||(ot=hr(_e,Ie),ot!=null&&vs.push(ig(_e,ot,$e))),Br)break;_e=_e.return}0<vs.length&&(Fe=new Xe(Fe,Wt,null,m,tt),pt.push({event:Fe,listeners:vs}))}}if((p&7)===0){e:{if(Fe=d==="mouseover"||d==="pointerover",Xe=d==="mouseout"||d==="pointerout",Fe&&m!==ym&&(Wt=m.relatedTarget||m.fromElement)&&(P(Wt)||Wt[es]))break e;if((Xe||Fe)&&(Fe=tt.window===tt?tt:(Fe=tt.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,Xe?(Wt=m.relatedTarget||m.toElement,Xe=Ne,Wt=Wt?P(Wt):null,Wt!==null&&(Br=F(Wt),vs=Wt.tag,Wt!==Br||vs!==5&&vs!==27&&vs!==6)&&(Wt=null)):(Xe=null,Wt=Ne),Xe!==Wt)){if(vs=km,ot="onMouseLeave",Ie="onMouseEnter",_e="mouse",(d==="pointerout"||d==="pointerover")&&(vs=er,ot="onPointerLeave",Ie="onPointerEnter",_e="pointer"),Br=Xe==null?Fe:me(Xe),$e=Wt==null?Fe:me(Wt),Fe=new vs(ot,_e+"leave",Xe,m,tt),Fe.target=Br,Fe.relatedTarget=$e,ot=null,P(tt)===Ne&&(vs=new vs(Ie,_e+"enter",Wt,m,tt),vs.target=$e,vs.relatedTarget=Br,ot=vs),Br=ot,Xe&&Wt)t:{for(vs=Xe,Ie=Wt,_e=0,$e=vs;$e;$e=uf($e))_e++;for($e=0,ot=Ie;ot;ot=uf(ot))$e++;for(;0<_e-$e;)vs=uf(vs),_e--;for(;0<$e-_e;)Ie=uf(Ie),$e--;for(;_e--;){if(vs===Ie||Ie!==null&&vs===Ie.alternate)break t;vs=uf(vs),Ie=uf(Ie)}vs=null}else vs=null;Xe!==null&&N4(pt,Fe,Xe,vs,!1),Wt!==null&&Br!==null&&N4(pt,Br,Wt,vs,!0)}}e:{if(Fe=Ne?me(Ne):window,Xe=Fe.nodeName&&Fe.nodeName.toLowerCase(),Xe==="select"||Xe==="input"&&Fe.type==="file")var Ft=XA;else if(KA(Fe))if(QA)Ft=qY;else{Ft=FY;var Ts=UY}else Xe=Fe.nodeName,!Xe||Xe.toLowerCase()!=="input"||Fe.type!=="checkbox"&&Fe.type!=="radio"?Ne&&bm(Ne.elementType)&&(Ft=XA):Ft=BY;if(Ft&&(Ft=Ft(d,Ne))){JA(pt,Ft,m,tt);break e}Ts&&Ts(d,Fe,Ne),d==="focusout"&&Ne&&Fe.type==="number"&&Ne.memoizedProps.value!=null&&vm(Fe,"number",Fe.value)}switch(Ts=Ne?me(Ne):window,d){case"focusin":(KA(Ts)||Ts.contentEditable==="true")&&(qp=Ts,k1=Ne,Im=null);break;case"focusout":Im=k1=qp=null;break;case"mousedown":S1=!0;break;case"contextmenu":case"mouseup":case"dragend":S1=!1,oP(pt,m,tt);break;case"selectionchange":if(VY)break;case"keydown":case"keyup":oP(pt,m,tt)}var Qt;if(fn)e:{switch(d){case"compositionstart":var ns="onCompositionStart";break e;case"compositionend":ns="onCompositionEnd";break e;case"compositionupdate":ns="onCompositionUpdate";break e}ns=void 0}else bc?Bp(d,m)&&(ns="onCompositionEnd"):d==="keydown"&&m.keyCode===229&&(ns="onCompositionStart");ns&&(vc&&m.locale!=="ko"&&(bc||ns!=="onCompositionStart"?ns==="onCompositionEnd"&&bc&&(Qt=mb()):(Si=tt,Yd="value"in Si?Si.value:Si.textContent,bc=!0)),Ts=iy(Ne,ns),0<Ts.length&&(ns=new Cm(ns,d,null,m,tt),pt.push({event:ns,listeners:Ts}),Qt?ns.data=Qt:(Qt=wb(m),Qt!==null&&(ns.data=Qt)))),(Qt=Ei?Nb(d,m):_1(d,m))&&(ns=iy(Ne,"onBeforeInput"),0<ns.length&&(Ts=new Cm("onBeforeInput","beforeinput",null,m,tt),pt.push({event:Ts,listeners:ns}),Ts.data=Qt)),CK(pt,d,Ne,m,tt)}j4(pt,p)})}function ig(d,p,m){return{instance:d,listener:p,currentTarget:m}}function iy(d,p){for(var m=p+"Capture",b=[];d!==null;){var N=d,C=N.stateNode;N=N.tag,N!==5&&N!==26&&N!==27||C===null||(N=hr(d,m),N!=null&&b.unshift(ig(d,N,C)),N=hr(d,p),N!=null&&b.push(ig(d,N,C))),d=d.return}return b}function uf(d){if(d===null)return null;do d=d.return;while(d&&d.tag!==5&&d.tag!==27);return d||null}function N4(d,p,m,b,N){for(var C=p._reactName,D=[];m!==null&&m!==b;){var Y=m,ce=Y.alternate,Ne=Y.stateNode;if(Y=Y.tag,ce!==null&&ce===b)break;Y!==5&&Y!==26&&Y!==27||Ne===null||(ce=Ne,N?(Ne=hr(m,C),Ne!=null&&D.unshift(ig(m,Ne,ce))):N||(Ne=hr(m,C),Ne!=null&&D.push(ig(m,Ne,ce)))),m=m.return}D.length!==0&&d.push({event:p,listeners:D})}var AK=/\r\n?/g,PK=/\u0000|\uFFFD/g;function k4(d){return(typeof d=="string"?d:""+d).replace(AK,` 50`).replace(PK,"")}function S4(d,p){return p=k4(p),k4(d)===p}function ly(){}function dr(d,p,m,b,N,C){switch(m){case"children":typeof b=="string"?p==="body"||p==="textarea"&&b===""||Ea(d,b):(typeof b=="number"||typeof b=="bigint")&&p!=="body"&&Ea(d,""+b);break;case"className":Zs(d,"class",b);break;case"tabIndex":Zs(d,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":Zs(d,m,b);break;case"style":hb(d,b,C);break;case"data":if(p!=="object"){Zs(d,"data",b);break}case"src":case"href":if(b===""&&(p!=="a"||m!=="href")){d.removeAttribute(m);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){d.removeAttribute(m);break}b=Mp(""+b),d.setAttribute(m,b);break;case"action":case"formAction":if(typeof b=="function"){d.setAttribute(m,"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 C=="function"&&(m==="formAction"?(p!=="input"&&dr(d,p,"name",N.name,N,null),dr(d,p,"formEncType",N.formEncType,N,null),dr(d,p,"formMethod",N.formMethod,N,null),dr(d,p,"formTarget",N.formTarget,N,null)):(dr(d,p,"encType",N.encType,N,null),dr(d,p,"method",N.method,N,null),dr(d,p,"target",N.target,N,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){d.removeAttribute(m);break}b=Mp(""+b),d.setAttribute(m,b);break;
vendor: 4,351 bytes, line 50
50case"onClick":b!=null&&(d.onclick=ly);break;case"onScroll":b!=null&&Ds("scroll",d);break;case"onScrollEnd":b!=null&&Ds("scrollend",d);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(m=b.__html,m!=null){if(N.children!=null)throw Error(n(60));d.innerHTML=m}}break;case"multiple":d.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":d.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){d.removeAttribute("xlink:href");break}m=Mp(""+b),d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?d.setAttribute(m,""+b):d.removeAttribute(m);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"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?d.setAttribute(m,""):d.removeAttribute(m);break;case"capture":case"download":b===!0?d.setAttribute(m,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?d.setAttribute(m,b):d.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?d.setAttribute(m,b):d.removeAttribute(m);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?d.removeAttribute(m):d.setAttribute(m,b);break;case"popover":Ds("beforetoggle",d),Ds("toggle",d),Gn(d,"popover",b);break;case"xlinkActuate":Cr(d,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":Cr(d,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":Cr(d,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":Cr(d,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":Cr(d,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":Cr(d,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":Cr(d,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":Cr(d,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":Cr(d,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":Gn(d,"is",b);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=x1.get(m)||m,Gn(d,m,b))}}function KN(d,p,m,b,N,C){switch(m){case"style":hb(d,b,C);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(m=b.__html,m!=null){if(N.children!=null)throw Error(n(60));d.innerHTML=m}}break;case"children":typeof b=="string"?Ea(d,b):(typeof b=="number"||typeof b=="bigint")&&Ea(d,""+b);break;case"onScroll":b!=null&&Ds("scroll",d);break;case"onScrollEnd":b!=null&&Ds("scrollend",d);break;case"onClick":b!=null&&(d.onclick=ly);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Et.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(N=m.endsWith("Capture"),p=m.slice(2,N?m.length-7:void 0),C=d[Gt]||null,C=C!=null?C[m]:null,typeof C=="function"&&d.removeEventListener(p,C,N),typeof b=="function")){typeof C!="function"&&C!==null&&(m in d?d[m]=null:d.hasAttribute(m)&&d.removeAttribute(m)),d.addEventListener(p,b,N);break e}m in d?d[m]=b:b===!0?d.setAttribute(m,""):Gn(d,m,b)}}}function Fn(d,p,m){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ds("error",d),Ds("load",d);var b=!1,N=!1,C;for(C in m)if(m.hasOwnProperty(C)){var D=m[C];if(D!=null)switch(C){case"src":b=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,p));default:dr(d,p,C,D,m,null)}}
vendor: 7,988 bytes, line 50
50N&&dr(d,p,"srcSet",m.srcSet,m,null),b&&dr(d,p,"src",m.src,m,null);return;case"input":Ds("invalid",d);var Y=C=D=N=null,ce=null,Ne=null;for(b in m)if(m.hasOwnProperty(b)){var tt=m[b];if(tt!=null)switch(b){case"name":N=tt;break;case"type":D=tt;break;case"checked":ce=tt;break;case"defaultChecked":Ne=tt;break;case"value":C=tt;break;case"defaultValue":Y=tt;break;case"children":case"dangerouslySetInnerHTML":if(tt!=null)throw Error(n(137,p));break;default:dr(d,p,b,tt,m,null)}}ub(d,C,Y,ce,Ne,D,N,!1),dl(d);return;case"select":Ds("invalid",d),b=D=C=null;for(N in m)if(m.hasOwnProperty(N)&&(Y=m[N],Y!=null))switch(N){case"value":C=Y;break;case"defaultValue":D=Y;break;case"multiple":b=Y;default:dr(d,p,N,Y,m,null)}p=C,m=D,d.multiple=!!b,p!=null?Ka(d,!!b,p,!1):m!=null&&Ka(d,!!b,m,!0);return;case"textarea":Ds("invalid",d),C=N=b=null;for(D in m)if(m.hasOwnProperty(D)&&(Y=m[D],Y!=null))switch(D){case"value":b=Y;break;case"defaultValue":N=Y;break;case"children":C=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(91));break;default:dr(d,p,D,Y,m,null)}wi(d,b,N,C),dl(d);return;case"option":for(ce in m)if(m.hasOwnProperty(ce)&&(b=m[ce],b!=null))switch(ce){case"selected":d.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:dr(d,p,ce,b,m,null)}return;case"dialog":Ds("cancel",d),Ds("close",d);break;case"iframe":case"object":Ds("load",d);break;case"video":case"audio":for(b=0;b<og.length;b++)Ds(og[b],d);break;case"image":Ds("error",d),Ds("load",d);break;case"details":Ds("toggle",d);break;case"embed":case"source":case"link":Ds("error",d),Ds("load",d);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ne in m)if(m.hasOwnProperty(Ne)&&(b=m[Ne],b!=null))switch(Ne){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,p));default:dr(d,p,Ne,b,m,null)}return;default:if(bm(p)){for(tt in m)m.hasOwnProperty(tt)&&(b=m[tt],b!==void 0&&KN(d,p,tt,b,m,void 0));return}}for(Y in m)m.hasOwnProperty(Y)&&(b=m[Y],b!=null&&dr(d,p,Y,b,m,null))}function IK(d,p,m,b){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,C=null,D=null,Y=null,ce=null,Ne=null,tt=null;for(Xe in m){var pt=m[Xe];if(m.hasOwnProperty(Xe)&&pt!=null)switch(Xe){case"checked":break;case"value":break;case"defaultValue":ce=pt;default:b.hasOwnProperty(Xe)||dr(d,p,Xe,null,b,pt)}}for(var Fe in b){var Xe=b[Fe];if(pt=m[Fe],b.hasOwnProperty(Fe)&&(Xe!=null||pt!=null))switch(Fe){case"type":C=Xe;break;case"name":N=Xe;break;case"checked":Ne=Xe;break;case"defaultChecked":tt=Xe;break;case"value":D=Xe;break;case"defaultValue":Y=Xe;break;case"children":case"dangerouslySetInnerHTML":if(Xe!=null)throw Error(n(137,p));break;default:Xe!==pt&&dr(d,p,Fe,Xe,b,pt)}}xm(d,D,Y,ce,Ne,tt,C,N);return;case"select":Xe=D=Y=Fe=null;for(C in m)if(ce=m[C],m.hasOwnProperty(C)&&ce!=null)switch(C){case"value":break;case"multiple":Xe=ce;default:b.hasOwnProperty(C)||dr(d,p,C,null,b,ce)}for(N in b)if(C=b[N],ce=m[N],b.hasOwnProperty(N)&&(C!=null||ce!=null))switch(N){case"value":Fe=C;break;case"defaultValue":Y=C;break;case"multiple":D=C;default:C!==ce&&dr(d,p,N,C,b,ce)}p=Y,m=D,b=Xe,Fe!=null?Ka(d,!!m,Fe,!1):!!b!=!!m&&(p!=null?Ka(d,!!m,p,!0):Ka(d,!!m,m?[]:"",!1));return;case"textarea":Xe=Fe=null;for(Y in m)if(N=m[Y],m.hasOwnProperty(Y)&&N!=null&&!b.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:dr(d,p,Y,null,b,N)}for(D in b)if(N=b[D],C=m[D],b.hasOwnProperty(D)&&(N!=null||C!=null))switch(D){case"value":Fe=N;break;case"defaultValue":Xe=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(n(91));break;default:N!==C&&dr(d,p,D,N,b,C)}pb(d,Fe,Xe);return;case"option":for(var Wt in m)if(Fe=m[Wt],m.hasOwnProperty(Wt)&&Fe!=null&&!b.hasOwnProperty(Wt))switch(Wt){case"selected":d.selected=!1;break;default:dr(d,p,Wt,null,b,Fe)}for(ce in b)if(Fe=b[ce],Xe=m[ce],b.hasOwnProperty(ce)&&Fe!==Xe&&(Fe!=null||Xe!=null))switch(ce){case"selected":d.selected=Fe&&typeof Fe!="function"&&typeof Fe!="symbol";break;default:dr(d,p,ce,Fe,b,Xe)}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 vs in m)Fe=m[vs],m.hasOwnProperty(vs)&&Fe!=null&&!b.hasOwnProperty(vs)&&dr(d,p,vs,null,b,Fe);for(Ne in b)if(Fe=b[Ne],Xe=m[Ne],b.hasOwnProperty(Ne)&&Fe!==Xe&&(Fe!=null||Xe!=null))switch(Ne){case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(n(137,p));break;default:dr(d,p,Ne,Fe,b,Xe)}return;default:if(bm(p)){for(var Br in m)Fe=m[Br],m.hasOwnProperty(Br)&&Fe!==void 0&&!b.hasOwnProperty(Br)&&KN(d,p,Br,void 0,b,Fe);for(tt in b)Fe=b[tt],Xe=m[tt],!b.hasOwnProperty(tt)||Fe===Xe||Fe===void 0&&Xe===void 0||KN(d,p,tt,Fe,b,Xe);return}}for(var Ie in m)Fe=m[Ie],m.hasOwnProperty(Ie)&&Fe!=null&&!b.hasOwnProperty(Ie)&&dr(d,p,Ie,null,b,Fe);for(pt in b)Fe=b[pt],Xe=m[pt],!b.hasOwnProperty(pt)||Fe===Xe||Fe==null&&Xe==null||dr(d,p,pt,Fe,b,Xe)}var JN=null,XN=null;function cy(d){return d.nodeType===9?d:d.ownerDocument}function C4(d){switch(d){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function E4(d,p){if(d===0)switch(p){case"svg":return 1;case"math":return 2;default:return 0}return d===1&&p==="foreignObject"?0:d}function QN(d,p){return d==="textarea"||d==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.children=="bigint"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var ZN=null;function MK(){var d=window.event;return d&&d.type==="popstate"?d===ZN?!1:(ZN=d,!0):(ZN=null,!1)}var T4=typeof setTimeout=="function"?setTimeout:void 0,OK=typeof clearTimeout=="function"?clearTimeout:void 0,R4=typeof Promise=="function"?Promise:void 0,LK=typeof queueMicrotask=="function"?queueMicrotask:typeof R4<"u"?function(d){return R4.resolve(null).then(d).catch(DK)}:T4;function DK(d){setTimeout(function(){throw d})}function ek(d,p){var m=p,b=0;do{var N=m.nextSibling;if(d.removeChild(m),N&&N.nodeType===8)if(m=N.data,m==="/$"){if(b===0){d.removeChild(N),mg(p);return}b--}else m!=="$"&&m!=="$?"&&m!=="$!"||b++;m=N}while(m);mg(p)}function tk(d){var p=d.firstChild;for(p&&p.nodeType===10&&(p=p.nextSibling);p;){var m=p;switch(p=p.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":tk(m),ne(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}d.removeChild(m)}}function $K(d,p,m,b){for(;d.nodeType===1;){var N=m;if(d.nodeName.toLowerCase()!==p.toLowerCase()){if(!b&&(d.nodeName!=="INPUT"||d.type!=="hidden"))break}else if(b){if(!d[Qe])switch(p){case"meta":if(!d.hasAttribute("itemprop"))break;return d;case"link":if(C=d.getAttribute("rel"),C==="stylesheet"&&d.hasAttribute("data-precedence"))break;if(C!==N.rel||d.getAttribute("href")!==(N.href==null?null:N.href)||d.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||d.getAttribute("title")!==(N.title==null?null:N.title))break;return d;case"style":if(d.hasAttribute("data-precedence"))break;return d;case"script":if(C=d.getAttribute("src"),(C!==(N.src==null?null:N.src)||d.getAttribute("type")!==(N.type==null?null:N.type)||d.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&C&&d.hasAttribute("async")&&!d.hasAttribute("itemprop"))break;return d;default:return d}}else if(p==="input"&&d.type==="hidden"){var C=N.name==null?null:""+N.name;if(N.type==="hidden"&&d.getAttribute("name")===C)return d}else return d;if(d=ri(d.nextSibling),d===null)break}return null}function UK(d,p,m){if(p==="")return null;for(;d.nodeType!==3;)if((d.nodeType!==1||d.nodeName!=="INPUT"||d.type!=="hidden")&&!m||(d=ri(d.nextSibling),d===null))return null;return d}function ri(d){for(;d!=null;d=d.nextSibling){var p=d.nodeType;if(p===1||p===3)break;if(p===8){if(p=d.data,p==="$"||p==="$!"||p==="$?"||p==="F!"||p==="F")break;
vendor: 8,318 bytes, line 50
50if(p==="/$")return null}}return d}function A4(d){d=d.previousSibling;for(var p=0;d;){if(d.nodeType===8){var m=d.data;if(m==="$"||m==="$!"||m==="$?"){if(p===0)return d;p--}else m==="/$"&&p++}d=d.previousSibling}return null}function P4(d,p,m){switch(p=cy(m),d){case"html":if(d=p.documentElement,!d)throw Error(n(452));return d;case"head":if(d=p.head,!d)throw Error(n(453));return d;case"body":if(d=p.body,!d)throw Error(n(454));return d;default:throw Error(n(451))}}var Ro=new Map,I4=new Set;function dy(d){return typeof d.getRootNode=="function"?d.getRootNode():d.ownerDocument}var Cl=U.d;U.d={f:FK,r:BK,D:qK,C:zK,L:HK,m:VK,X:WK,S:GK,M:YK};function FK(){var d=Cl.f(),p=sy();return d||p}function BK(d){var p=te(d);p!==null&&p.tag===5&&p.type==="form"?oI(p):Cl.r(d)}var pf=typeof document>"u"?null:document;function M4(d,p,m){var b=pf;if(b&&typeof p=="string"&&p){var N=Ca(p);N='link[rel="'+d+'"][href="'+N+'"]',typeof m=="string"&&(N+='[crossorigin="'+m+'"]'),I4.has(N)||(I4.add(N),d={rel:d,crossOrigin:m,href:p},b.querySelector(N)===null&&(p=b.createElement("link"),Fn(p,"link",d),st(p),b.head.appendChild(p)))}}function qK(d){Cl.D(d),M4("dns-prefetch",d,null)}function zK(d,p){Cl.C(d,p),M4("preconnect",d,p)}function HK(d,p,m){Cl.L(d,p,m);var b=pf;if(b&&d&&p){var N='link[rel="preload"][as="'+Ca(p)+'"]';p==="image"&&m&&m.imageSrcSet?(N+='[imagesrcset="'+Ca(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(N+='[imagesizes="'+Ca(m.imageSizes)+'"]')):N+='[href="'+Ca(d)+'"]';var C=N;switch(p){case"style":C=ff(d);break;case"script":C=hf(d)}Ro.has(C)||(d=M({rel:"preload",href:p==="image"&&m&&m.imageSrcSet?void 0:d,as:p},m),Ro.set(C,d),b.querySelector(N)!==null||p==="style"&&b.querySelector(lg(C))||p==="script"&&b.querySelector(cg(C))||(p=b.createElement("link"),Fn(p,"link",d),st(p),b.head.appendChild(p)))}}function VK(d,p){Cl.m(d,p);var m=pf;if(m&&d){var b=p&&typeof p.as=="string"?p.as:"script",N='link[rel="modulepreload"][as="'+Ca(b)+'"][href="'+Ca(d)+'"]',C=N;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=hf(d)}if(!Ro.has(C)&&(d=M({rel:"modulepreload",href:d},p),Ro.set(C,d),m.querySelector(N)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(cg(C)))return}b=m.createElement("link"),Fn(b,"link",d),st(b),m.head.appendChild(b)}}}function GK(d,p,m){Cl.S(d,p,m);var b=pf;if(b&&d){var N=Te(b).hoistableStyles,C=ff(d);p=p||"default";var D=N.get(C);if(!D){var Y={loading:0,preload:null};if(D=b.querySelector(lg(C)))Y.loading=5;else{d=M({rel:"stylesheet",href:d,"data-precedence":p},m),(m=Ro.get(C))&&sk(d,m);var ce=D=b.createElement("link");st(ce),Fn(ce,"link",d),ce._p=new Promise(function(Ne,tt){ce.onload=Ne,ce.onerror=tt}),ce.addEventListener("load",function(){Y.loading|=1}),ce.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,uy(D,p,b)}D={type:"stylesheet",instance:D,count:1,state:Y},N.set(C,D)}}}function WK(d,p){Cl.X(d,p);var m=pf;if(m&&d){var b=Te(m).hoistableScripts,N=hf(d),C=b.get(N);C||(C=m.querySelector(cg(N)),C||(d=M({src:d,async:!0},p),(p=Ro.get(N))&&rk(d,p),C=m.createElement("script"),st(C),Fn(C,"link",d),m.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},b.set(N,C))}}function YK(d,p){Cl.M(d,p);var m=pf;if(m&&d){var b=Te(m).hoistableScripts,N=hf(d),C=b.get(N);C||(C=m.querySelector(cg(N)),C||(d=M({src:d,async:!0,type:"module"},p),(p=Ro.get(N))&&rk(d,p),C=m.createElement("script"),st(C),Fn(C,"link",d),m.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},b.set(N,C))}}function O4(d,p,m,b){var N=(N=de.current)?dy(N):null;if(!N)throw Error(n(446));switch(d){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(p=ff(m.href),m=Te(N).hoistableStyles,b=m.get(p),b||(b={type:"style",instance:null,count:0,state:null},m.set(p,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){d=ff(m.href);var C=Te(N).hoistableStyles,D=C.get(d);if(D||(N=N.ownerDocument||N,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(d,D),(C=N.querySelector(lg(d)))&&!C._p&&(D.instance=C,D.state.loading=5),Ro.has(d)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Ro.set(d,m),C||KK(N,d,m,D.state))),p&&b===null)throw Error(n(528,""));return D}if(p&&b!==null)throw Error(n(529,""));return null;case"script":return p=m.async,m=m.src,typeof m=="string"&&p&&typeof p!="function"&&typeof p!="symbol"?(p=hf(m),m=Te(N).hoistableScripts,b=m.get(p),b||(b={type:"script",instance:null,count:0,state:null},m.set(p,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,d))}}function ff(d){return'href="'+Ca(d)+'"'}function lg(d){return'link[rel="stylesheet"]['+d+"]"}function L4(d){return M({},d,{"data-precedence":d.precedence,precedence:null})}function KK(d,p,m,b){d.querySelector('link[rel="preload"][as="style"]['+p+"]")?b.loading=1:(p=d.createElement("link"),b.preload=p,p.addEventListener("load",function(){return b.loading|=1}),p.addEventListener("error",function(){return b.loading|=2}),Fn(p,"link",m),st(p),d.head.appendChild(p))}function hf(d){return'[src="'+Ca(d)+'"]'}function cg(d){return"script[async]"+d}function D4(d,p,m){if(p.count++,p.instance===null)switch(p.type){case"style":var b=d.querySelector('style[data-href~="'+Ca(m.href)+'"]');if(b)return p.instance=b,st(b),b;var N=M({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return b=(d.ownerDocument||d).createElement("style"),st(b),Fn(b,"style",N),uy(b,m.precedence,d),p.instance=b;case"stylesheet":N=ff(m.href);var C=d.querySelector(lg(N));if(C)return p.state.loading|=4,p.instance=C,st(C),C;b=L4(m),(N=Ro.get(N))&&sk(b,N),C=(d.ownerDocument||d).createElement("link"),st(C);var D=C;return D._p=new Promise(function(Y,ce){D.onload=Y,D.onerror=ce}),Fn(C,"link",b),p.state.loading|=4,uy(C,m.precedence,d),p.instance=C;case"script":return C=hf(m.src),(N=d.querySelector(cg(C)))?(p.instance=N,st(N),N):(b=m,(N=Ro.get(C))&&(b=M({},m),rk(b,N)),d=d.ownerDocument||d,N=d.createElement("script"),st(N),Fn(N,"link",b),d.head.appendChild(N),p.instance=N);case"void":return null;default:throw Error(n(443,p.type))}else p.type==="stylesheet"&&(p.state.loading&4)===0&&(b=p.instance,p.state.loading|=4,uy(b,m.precedence,d));return p.instance}function uy(d,p,m){for(var b=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=b.length?b[b.length-1]:null,C=N,D=0;D<b.length;D++){var Y=b[D];if(Y.dataset.precedence===p)C=Y;else if(C!==N)break}C?C.parentNode.insertBefore(d,C.nextSibling):(p=m.nodeType===9?m.head:m,p.insertBefore(d,p.firstChild))}function sk(d,p){d.crossOrigin==null&&(d.crossOrigin=p.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=p.referrerPolicy),d.title==null&&(d.title=p.title)}function rk(d,p){d.crossOrigin==null&&(d.crossOrigin=p.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=p.referrerPolicy),d.integrity==null&&(d.integrity=p.integrity)}var py=null;function $4(d,p,m){if(py===null){var b=new Map,N=py=new Map;N.set(m,b)}else N=py,b=N.get(m),b||(b=new Map,N.set(m,b));if(b.has(d))return b;for(b.set(d,null),m=m.getElementsByTagName(d),N=0;N<m.length;N++){var C=m[N];if(!(C[Qe]||C[ze]||d==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var D=C.getAttribute(p)||"";D=d+D;var Y=b.get(D);Y?Y.push(C):b.set(D,[C])}}return b}function U4(d,p,m){d=d.ownerDocument||d,d.head.insertBefore(m,p==="title"?d.querySelector("head > title"):null)}function JK(d,p,m){if(m===1||p.itemProp!=null)return!1;switch(d){case"meta":case"title":return!0;case"style":if(typeof p.precedence!="string"||typeof p.href!="string"||p.href==="")break;return!0;case"link":if(typeof p.rel!="string"||typeof p.href!="string"||p.href===""||p.onLoad||p.onError)break;switch(p.rel){case"stylesheet":return d=p.disabled,typeof p.precedence=="string"&&d==null;default:return!0}case"script":if(p.async&&typeof p.async!="function"&&typeof p.async!="symbol"&&!p.onLoad&&!p.onError&&p.src&&typeof p.src=="string")return!0}return!1}
vendor: 4,924 bytes, line 50
50function F4(d){return!(d.type==="stylesheet"&&(d.state.loading&3)===0)}var dg=null;function XK(){}function QK(d,p,m){if(dg===null)throw Error(n(475));var b=dg;if(p.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var N=ff(m.href),C=d.querySelector(lg(N));if(C){d=C._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(b.count++,b=fy.bind(b),d.then(b,b)),p.state.loading|=4,p.instance=C,st(C);return}C=d.ownerDocument||d,m=L4(m),(N=Ro.get(N))&&sk(m,N),C=C.createElement("link"),st(C);var D=C;D._p=new Promise(function(Y,ce){D.onload=Y,D.onerror=ce}),Fn(C,"link",m),p.instance=C}b.stylesheets===null&&(b.stylesheets=new Map),b.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(b.count++,p=fy.bind(b),d.addEventListener("load",p),d.addEventListener("error",p))}}function ZK(){if(dg===null)throw Error(n(475));var d=dg;return d.stylesheets&&d.count===0&&nk(d,d.stylesheets),0<d.count?function(p){var m=setTimeout(function(){if(d.stylesheets&&nk(d,d.stylesheets),d.unsuspend){var b=d.unsuspend;d.unsuspend=null,b()}},6e4);return d.unsuspend=p,function(){d.unsuspend=null,clearTimeout(m)}}:null}function fy(){if(this.count--,this.count===0){if(this.stylesheets)nk(this,this.stylesheets);else if(this.unsuspend){var d=this.unsuspend;this.unsuspend=null,d()}}}var hy=null;function nk(d,p){d.stylesheets=null,d.unsuspend!==null&&(d.count++,hy=new Map,p.forEach(eJ,d),hy=null,fy.call(d))}function eJ(d,p){if(!(p.state.loading&4)){var m=hy.get(d);if(m)var b=m.get(null);else{m=new Map,hy.set(d,m);for(var N=d.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<N.length;C++){var D=N[C];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(m.set(D.dataset.precedence,D),b=D)}b&&m.set(null,b)}N=p.instance,D=N.getAttribute("data-precedence"),C=m.get(D)||b,C===b&&m.set(null,N),m.set(D,N),this.count++,b=fy.bind(this),N.addEventListener("load",b),N.addEventListener("error",b),C?C.parentNode.insertBefore(N,C.nextSibling):(d=d.nodeType===9?d.head:d,d.insertBefore(N,d.firstChild)),p.state.loading|=4}}var ug={$$typeof:v,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function tJ(d,p,m,b,N,C,D,Y){this.tag=1,this.containerInfo=d,this.finishedWork=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=Pe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pe(0),this.hiddenUpdates=Pe(null),this.identifierPrefix=b,this.onUncaughtError=N,this.onCaughtError=C,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function B4(d,p,m,b,N,C,D,Y,ce,Ne,tt,pt){return d=new tJ(d,p,m,D,Y,ce,Ne,pt),p=1,C===!0&&(p|=24),C=Eo(3,null,null,p),d.current=C,C.stateNode=d,p=L1(),p.refCount++,d.pooledCache=p,p.refCount++,C.memoizedState={element:b,isDehydrated:m,cache:p},gN(C),d}function q4(d){return d?(d=Vp,d):Vp}function z4(d,p,m,b,N,C){N=q4(N),b.context===null?b.context=N:b.pendingContext=N,b=Cc(p),b.payload={element:m},C=C===void 0?null:C,C!==null&&(b.callback=C),m=Ec(d,b,p),m!==null&&(ma(m,d,p),Ym(m,d,p))}function H4(d,p){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var m=d.retryLane;d.retryLane=m!==0&&m<p?m:p}}function ak(d,p){H4(d,p),(d=d.alternate)&&H4(d,p)}function V4(d){if(d.tag===13){var p=yc(d,67108864);p!==null&&ma(p,d,67108864),ak(d,67108864)}}var my=!0;function sJ(d,p,m,b){var N=L.T;L.T=null;var C=U.p;try{U.p=2,ok(d,p,m,b)}finally{U.p=C,L.T=N}}function rJ(d,p,m,b){var N=L.T;L.T=null;var C=U.p;try{U.p=8,ok(d,p,m,b)}finally{U.p=C,L.T=N}}function ok(d,p,m,b){if(my){var N=ik(b);if(N===null)YN(d,p,b,gy,m),W4(d,b);else if(aJ(N,d,p,m,b))b.stopPropagation();else if(W4(d,b),p&4&&-1<nJ.indexOf(d)){for(;N!==null;){var C=te(N);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var D=_t(C.pendingLanes);if(D!==0){var Y=C;for(Y.pendingLanes|=2,Y.entangledLanes|=2;D;){var ce=1<<31-St(D);Y.entanglements[1]|=ce,D&=~ce}Ii(C),(Ar&6)===0&&(Zb=vt()+500,ag(0))}}break;case 13:Y=yc(C,2),Y!==null&&ma(Y,C,2),sy(),ak(C,2)}if(C=ik(b),C===null&&YN(d,p,b,gy,m),C===N)break;N=C}N!==null&&b.stopPropagation()}else YN(d,p,b,null,m)}}function ik(d){return d=_m(d),lk(d)}var gy=null;function lk(d){if(gy=null,d=P(d),d!==null){var p=F(d);if(p===null)d=null;else{var m=p.tag;if(m===13){if(d=V(p),d!==null)return d;d=null}else if(m===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;d=null}else p!==d&&(d=null)}}return gy=d,null}function G4(d){switch(d){case"beforetoggle":case"cancel":case"click":case"close"
vendor: 4,109 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(gt()){case Be:return 2;case ve:return 8;case be:case nt:return 32;case Ze:return 268435456;default:return 32}default:return 32}}var ck=!1,Oc=null,Lc=null,Dc=null,pg=new Map,fg=new Map,$c=[],nJ="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 W4(d,p){switch(d){case"focusin":case"focusout":Oc=null;break;case"dragenter":case"dragleave":Lc=null;break;case"mouseover":case"mouseout":Dc=null;break;case"pointerover":case"pointerout":pg.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":fg.delete(p.pointerId)}}function hg(d,p,m,b,N,C){return d===null||d.nativeEvent!==C?(d={blockedOn:p,domEventName:m,eventSystemFlags:b,nativeEvent:C,targetContainers:[N]},p!==null&&(p=te(p),p!==null&&V4(p)),d):(d.eventSystemFlags|=b,p=d.targetContainers,N!==null&&p.indexOf(N)===-1&&p.push(N),d)}function aJ(d,p,m,b,N){switch(p){case"focusin":return Oc=hg(Oc,d,p,m,b,N),!0;case"dragenter":return Lc=hg(Lc,d,p,m,b,N),!0;case"mouseover":return Dc=hg(Dc,d,p,m,b,N),!0;case"pointerover":var C=N.pointerId;return pg.set(C,hg(pg.get(C)||null,d,p,m,b,N)),!0;case"gotpointercapture":return C=N.pointerId,fg.set(C,hg(fg.get(C)||null,d,p,m,b,N)),!0}return!1}function Y4(d){var p=P(d.target);if(p!==null){var m=F(p);if(m!==null){if(p=m.tag,p===13){if(p=V(m),p!==null){d.blockedOn=p,G(d.priority,function(){if(m.tag===13){var b=to(),N=yc(m,b);N!==null&&ma(N,m,b),ak(m,b)}});return}}else if(p===3&&m.stateNode.current.memoizedState.isDehydrated){d.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}d.blockedOn=null}function xy(d){if(d.blockedOn!==null)return!1;for(var p=d.targetContainers;0<p.length;){var m=ik(d.nativeEvent);if(m===null){m=d.nativeEvent;var b=new m.constructor(m.type,m);ym=b,m.target.dispatchEvent(b),ym=null}else return p=te(m),p!==null&&V4(p),d.blockedOn=m,!1;p.shift()}return!0}function K4(d,p,m){xy(d)&&m.delete(p)}function oJ(){ck=!1,Oc!==null&&xy(Oc)&&(Oc=null),Lc!==null&&xy(Lc)&&(Lc=null),Dc!==null&&xy(Dc)&&(Dc=null),pg.forEach(K4),fg.forEach(K4)}function vy(d,p){d.blockedOn===p&&(d.blockedOn=null,ck||(ck=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,oJ)))}var by=null;function J4(d){by!==d&&(by=d,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){by===d&&(by=null);for(var p=0;p<d.length;p+=3){var m=d[p],b=d[p+1],N=d[p+2];if(typeof b!="function"){if(lk(b||m)===null)continue;break}var C=te(m);C!==null&&(d.splice(p,3),p-=3,Q1(C,{pending:!0,data:N,method:m.method,action:b},b,N))}}))}function mg(d){function p(ce){return vy(ce,d)}Oc!==null&&vy(Oc,d),Lc!==null&&vy(Lc,d),Dc!==null&&vy(Dc,d),pg.forEach(p),fg.forEach(p);for(var m=0;m<$c.length;m++){var b=$c[m];b.blockedOn===d&&(b.blockedOn=null)}for(;0<$c.length&&(m=$c[0],m.blockedOn===null);)Y4(m),m.blockedOn===null&&$c.shift();if(m=(d.ownerDocument||d).$$reactFormReplay,m!=null)for(b=0;b<m.length;
50b+=3){var N=m[b],C=m[b+1],D=N[Gt]||null;if(typeof C=="function")D||J4(m);else if(D){var Y=null;if(C&&C.hasAttribute("formAction")){if(N=C,D=C[Gt]||null)Y=D.formAction;else if(lk(N)!==null)continue}else Y=D.action;typeof Y=="function"?m[b+1]=Y:(m.splice(b,3),b-=3),J4(m)}}}function dk(d){this._internalRoot=d}yy.prototype.render=dk.prototype.render=function(d){var p=this._internalRoot;if(p===null)throw Error(n(409));var m=p.current,b=to();z4(m,b,d,p,null,null)},yy.prototype.unmount=dk.prototype.unmount=function(){var d=this._internalRoot;if(d!==null){this._internalRoot=null;var p=d.containerInfo;d.tag===0&&cf(),z4(d.current,2,null,d,null,null),sy(),p[es]=null}};function yy(d){this._internalRoot=d}yy.prototype.unstable_scheduleHydration=function(d){if(d){var p=re();d={blockedOn:null,target:d,priority:p};for(var m=0;m<$c.length&&p!==0&&p<$c[m].priority;m++);$c.splice(m,0,d),m===0&&Y4(d)}};var X4=t.version;if(X4!=="19.0.0")throw Error(n(527,X4,"19.0.0"));U.findDOMNode=function(d){var p=d._reactInternals;if(p===void 0)throw typeof d.render=="function"?Error(n(188)):(d=Object.keys(d).join(","),Error(n(268,d)));return d=B(p),d=d!==null?ae(d):null,d=d===null?null:d.stateNode,d};var iJ={bundleType:0,version:"19.0.0",rendererPackageName:"react-dom",currentDispatcherRef:L,findFiberByHostInstance:P,reconcilerVersion:"19.0.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _y=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_y.isDisabled&&_y.supportsFiber)try{Ve=_y.inject(iJ),at=_y}catch{}}return xg.createRoot=function(d,p){if(!a(d))throw Error(n(299));var m=!1,b="",N=hI,C=mI,D=gI,Y=null;return p!=null&&(p.unstable_strictMode===!0&&(m=!0),p.identifierPrefix!==void 0&&(b=p.identifierPrefix),p.onUncaughtError!==void 0&&(N=p.onUncaughtError),p.onCaughtError!==void 0&&(C=p.onCaughtError),p.onRecoverableError!==void 0&&(D=p.onRecoverableError),p.unstable_transitionCallbacks!==void 0&&(Y=p.unstable_transitionCallbacks)),p=B4(d,1,!1,null,null,m,b,N,C,D,Y,null),d[es]=p.current,WN(d.nodeType===8?d.parentNode:d),new dk(p)},xg.hydrateRoot=function(d,p,m){if(!a(d))throw Error(n(299));var b=!1,N="",C=hI,D=mI,Y=gI,ce=null,Ne=null;return m!=null&&(m.unstable_strictMode===!0&&(b=!0),m.identifierPrefix!==void 0&&(N=m.identifierPrefix),m.onUncaughtError!==void 0&&(C=m.onUncaughtError),m.onCaughtError!==void 0&&(D=m.onCaughtError),m.onRecoverableError!==void 0&&(Y=m.onRecoverableError),m.unstable_transitionCallbacks!==void 0&&(ce=m.unstable_transitionCallbacks),m.formState!==void 0&&(Ne=m.formState)),p=B4(d,1,!0,p,m??null,b,N,C,D,Y,ce,Ne),p.context=q4(null),m=p.current,b=to(),N=Cc(b),N.callback=null,Ec(m,N,b),p.current.lanes=b,Ge(p,b),Ii(p),d[es]=p.current,WN(d),new yy(p)},xg.version="19.0.0",xg}var i3;function bJ(){if(i3)return fk.exports;i3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fk.exports=vJ(),fk.exports}var yJ=bJ();const Yt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Us=globalThis,Gu="10.32.0";function _p(){return Kj(Us),Us}function Kj(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Gu,t[Gu]=t[Gu]||{}}function Bh(e,t,s=Us){const n=s.__SENTRY__=s.__SENTRY__||{},a=n[Gu]=n[Gu]||{};return a[e]||(a[e]=t())}const _J=["debug","info","warn","error","log","assert","trace"],jJ="Sentry Logger ",T_={};function jp(e){if(!("console"in Us))return e();const t=Us.console,s={},n=Object.keys(T_);n.forEach(a=>{const o=T_[a];s[a]=t[a],t[a]=o});try{return e()}finally{n.forEach(a=>{t[a]=s[a]})}}function wJ(){U5().enabled=!0}function NJ(){U5().enabled=!1}function RU(){return U5().enabled}function kJ(...e){$5("log",...e)}function SJ(...e){$5("warn",...e)}function CJ(...e){$5("error",...e)}function $5(e,...t){Yt&&RU()&&jp(()=>{Us.console[e](`${jJ}[${e}]:`,...t)})}function U5(){return Yt?Bh("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const kt={enable:wJ,disable:NJ,isEnabled:RU,log:kJ,warn:SJ,error:CJ},AU=50,rp="?",l3=/\(error: (.*)\)/,c3=/captureMessage|captureException/;function PU(...e){const t=e.sort((s,n)=>s[0]-n[0]).map(s=>s[1]);return(s,n=0,a=0)=>{const o=[],i=s.split(` 51`);for(let l=n;l<i.length;l++){let c=i[l];c.length>1024&&(c=c.slice(0,1024));const u=l3.test(c)?c.replace(l3,"$1"):c;if(!u.match(/\S*Error: /)){for(const f of t){const h=f(u);if(h){o.push(h);break}}if(o.length>=AU+a)break}}return TJ(o.slice(a))}}function EJ(e){return Array.isArray(e)?PU(...e):e}function TJ(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(jy(t).function||"")&&t.pop(),t.reverse(),c3.test(jy(t).function||"")&&(t.pop(),c3.test(jy(t).function||"")&&t.pop()),t.slice(0,AU).map(s=>({...s,filename:s.filename||jy(t).filename,function:s.function||rp}))}function jy(e){return e[e.length-1]||{}}const xk="<anonymous>";function ac(e){try{return!e||typeof e!="function"?xk:e.name||xk}catch{return xk}}function d3(e){const t=e.exception;if(t){const s=[];
51try{return t.values.forEach(n=>{n.stacktrace.frames&&s.push(...n.stacktrace.frames)}),s}catch{return}}}function IU(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const Q0={},u3={};function Od(e,t){Q0[e]=Q0[e]||[],Q0[e].push(t)}function Ld(e,t){if(!u3[e]){u3[e]=!0;try{t()}catch(s){Yt&&kt.error(`Error while instrumenting ${e}`,s)}}}function Uo(e,t){const s=e&&Q0[e];if(s)for(const n of s)try{n(t)}catch(a){Yt&&kt.error(`Error while triggering instrumentation handler. 52Type: ${e} 53Name: ${ac(n)} 54Error:`,a)}}let vk=null;function MU(e){const t="error";Od(t,e),Ld(t,RJ)}function RJ(){vk=Us.onerror,Us.onerror=function(e,t,s,n,a){return Uo("error",{column:n,error:a,line:s,msg:e,url:t}),vk?vk.apply(this,arguments):!1},Us.onerror.__SENTRY_INSTRUMENTED__=!0}let bk=null;function OU(e){const t="unhandledrejection";Od(t,e),Ld(t,AJ)}function AJ(){bk=Us.onunhandledrejection,Us.onunhandledrejection=function(e){return Uo("unhandledrejection",e),bk?bk.apply(this,arguments):!0},Us.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const LU=Object.prototype.toString;function Jj(e){switch(LU.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return oc(e,Error)}}function qh(e,t){return LU.call(e)===`[object ${t}]`}function DU(e){return qh(e,"ErrorEvent")}function p3(e){return qh(e,"DOMError")}function PJ(e){return qh(e,"DOMException")}function Zl(e){return qh(e,"String")}function F5(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function ch(e){return e===null||F5(e)||typeof e!="object"&&typeof e!="function"}function Vx(e){return qh(e,"Object")}function Xj(e){return typeof Event<"u"&&oc(e,Event)}function IJ(e){return typeof Element<"u"&&oc(e,Element)}function MJ(e){return qh(e,"RegExp")}function zh(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function OJ(e){return Vx(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function oc(e,t){try{return e instanceof t}catch{return!1}}function $U(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}function B5(e){return typeof Request<"u"&&oc(e,Request)}const q5=Us,LJ=80;function Ba(e,t={}){if(!e)return"<unknown>";try{let s=e;const n=5,a=[];let o=0,i=0;const l=" > ",c=l.length;let u;const f=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||LJ;for(;s&&o++<n&&(u=DJ(s,f),!(u==="html"||o>1&&i+a.length*c+u.length>=h));)a.push(u),i+=u.length,s=s.parentNode;return a.reverse().join(l)}catch{return"<unknown>"}}function DJ(e,t){const s=e,n=[];if(!(s!=null&&s.tagName))return"";if(q5.HTMLElement&&s instanceof HTMLElement&&s.dataset){if(s.dataset.sentryComponent)return s.dataset.sentryComponent;if(s.dataset.sentryElement)return s.dataset.sentryElement}n.push(s.tagName.toLowerCase());const a=t!=null&&t.length?t.filter(i=>s.getAttribute(i)).map(i=>[i,s.getAttribute(i)]):null;if(a!=null&&a.length)a.forEach(i=>{n.push(`[${i[0]}="${i[1]}"]`)});else{s.id&&n.push(`#${s.id}`);const i=s.className;if(i&&Zl(i)){const l=i.split(/\s+/);for(const c of l)n.push(`.${c}`)}}const o=["aria-label","type","name","title","alt"];for(const i of o){const l=s.getAttribute(i);l&&n.push(`[${i}="${l}"]`)}return n.join("")}function Hh(){try{return q5.document.location.href}catch{return""}}function UU(e){if(!q5.HTMLElement)return null;let t=e;const s=5;for(let n=0;n<s;n++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function $a(e,t,s){if(!(t in e))return;const n=e[t];if(typeof n!="function")return;const a=s(n);typeof a=="function"&&FU(a,n);try{e[t]=a}catch{Yt&&kt.log(`Failed to replace method "${t}" in object`,e)}}function ho(e,t,s){try{Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0})}catch{Yt&&kt.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function FU(e,t){try{const s=t.prototype||{};e.prototype=t.prototype=s,ho(e,"__sentry_original__",t)}catch{}}function z5(e){return e.__sentry_original__}function BU(e){if(Jj(e))return{message:e.message,name:e.name,stack:e.stack,...h3(e)};if(Xj(e)){const t={type:e.type,target:f3(e.target),currentTarget:f3(e.currentTarget),...h3(e)};return typeof CustomEvent<"u"&&oc(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function f3(e){try{return IJ(e)?Ba(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function h3(e){if(typeof e=="object"&&e!==null){const t={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}else return{}}function $J(e){const t=Object.keys(BU(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}function Q2(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function m3(e,t){if(!Array.isArray(e))return"";const s=[];for(let n=0;n<e.length;n++){const a=e[n];try{$U(a)?s.push(IU(a)):s.push(String(a))}catch{s.push("[value cannot be serialized]")}}return s.join(t)}function Z0(e,t,s=!1){return Zl(e)?MJ(t)?t.test(e):Zl(t)?s?e===t:e.includes(t):!1:!1}function ec(e,t=[],s=!1){return t.some(n=>Z0(e,n,s))}function UJ(){const e=Us;return e.crypto||e.msCrypto}let yk;function FJ(){return Math.random()*16}function uo(e=UJ()){try{if(e!=null&&e.randomUUID)return e.randomUUID().replace(/-/g,"")}catch{}return yk||(yk="10000000100040008000"+1e11),yk.replace(/[018]/g,t=>(t^(FJ()&15)>>t/4).toString(16))}function qU(e){var t,s;return(s=(t=e.exception)==null?void 0:t.values)==null?void 0:s[0]}function Mu(e){const{message:t,event_id:s}=e;if(t)return t;const n=qU(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||s||"<unknown>":s||"<unknown>"}
54function Z2(e,t,s){const n=e.exception=e.exception||{},a=n.values=n.values||[],o=a[0]=a[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function dh(e,t){const s=qU(e);if(!s)return;const n={type:"generic",handled:!0},a=s.mechanism;if(s.mechanism={...n,...a,...t},t&&"data"in t){const o={...a==null?void 0:a.data,...t.data};s.mechanism.data=o}}function g3(e){if(BJ(e))return!0;try{ho(e,"__sentry_captured__",!0)}catch{}return!1}function BJ(e){try{return e.__sentry_captured__}catch{}}const zU=1e3;function wp(){return Date.now()/zU}function qJ(){const{performance:e}=Us;if(!(e!=null&&e.now)||!e.timeOrigin)return wp;const t=e.timeOrigin;return()=>(t+e.now())/zU}let x3;function An(){return(x3??(x3=qJ()))()}let _k;function zJ(){var f;const{performance:e}=Us;if(!(e!=null&&e.now))return[void 0,"none"];const t=3600*1e3,s=e.now(),n=Date.now(),a=e.timeOrigin?Math.abs(e.timeOrigin+s-n):t,o=a<t,i=(f=e.timing)==null?void 0:f.navigationStart,c=typeof i=="number"?Math.abs(i+s-n):t,u=c<t;return o||u?a<=c?[e.timeOrigin,"timeOrigin"]:[i,"navigationStart"]:[n,"dateNow"]}function Va(){return _k||(_k=zJ()),_k[0]}function HJ(e){const t=An(),s={sid:uo(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>GJ(s)};return e&&uh(s,e),s}function uh(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||An(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:uo()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const s=e.timestamp-e.started;e.duration=s>=0?s:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function VJ(e,t){let s={};e.status==="ok"&&(s={status:"exited"}),uh(e,s)}function GJ(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Pv(e,t,s=2){if(!t||typeof t!="object"||s<=0)return t;if(e&&Object.keys(t).length===0)return e;const n={...e};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=Pv(n[a],t[a],s-1));return n}function ic(){return uo()}function tc(){return uo().substring(16)}const eC="_sentrySpan";function ph(e,t){t?ho(e,eC,t):delete e[eC]}function R_(e){return e[eC]}const WJ=100;class rl{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ic(),sampleRand:Math.random()}}clone(){const t=new rl;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,ph(t,R_(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&uh(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,s){return this.setTags({[t]:s})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,s){return this.setAttributes({[t]:s})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,s){return this._extra={...this._extra,[t]:s},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,s){return s===null?delete this._contexts[t]:this._contexts[t]=s,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const s=typeof t=="function"?t(this):t,n=s instanceof rl?s.getScopeData():Vx(s)?t:void 0,{tags:a,attributes:o,extra:i,user:l,contexts:c,level:u,fingerprint:f=[],propagationContext:h}=n||{};return this._tags={...this._tags,...a},this._attributes={...this._attributes,...o},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},l&&Object.keys(l).length&&(this._user=l),u&&(this._level=u),f.length&&(this._fingerprint=f),h&&(this._propagationContext=h),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,ph(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ic(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(t,s){var o;const n=typeof s=="number"?s:WJ;if(n<=0)return this;const a={timestamp:wp(),...t,message:t.message?Q2(t.message,2048):t.message};return this._breadcrumbs.push(a),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),(o=this._client)==null||o.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:R_(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Pv(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,s){const n=(s==null?void 0:s.event_id)||uo();if(!this._client)return Yt&&kt.warn("No client configured on scope - will not capture exception!"),n;const a=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:a,...s,event_id:n},this),n}captureMessage(t,s,n){const a=(n==null?void 0:n.event_id)||uo();if(!this._client)return Yt&&kt.warn("No client configured on scope - will not capture message!"),a;const o=(n==null?void 0:n.syntheticException)??new Error(t);return this._client.captureMessage(t,s,{originalException:t,syntheticException:o,...n,event_id:a},this),a}captureEvent(t,s){const n=(s==null?void 0:s.event_id)||uo();return this._client?(this._client.captureEvent(t,{...s,event_id:n},this),n):(Yt&&kt.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEac
54h(t=>{t(this)}),this._notifyingListeners=!1)}}function YJ(){return Bh("defaultCurrentScope",()=>new rl)}function KJ(){return Bh("defaultIsolationScope",()=>new rl)}class JJ{constructor(t,s){let n;t?n=t:n=new rl;let a;s?a=s:a=new rl,this._stack=[{scope:n}],this._isolationScope=a}withScope(t){const s=this._pushScope();let n;try{n=t(s)}catch(a){throw this._popScope(),a}return zh(n)?n.then(a=>(this._popScope(),a),a=>{throw this._popScope(),a}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function fh(){const e=_p(),t=Kj(e);return t.stack=t.stack||new JJ(YJ(),KJ())}function XJ(e){return fh().withScope(e)}function QJ(e,t){const s=fh();return s.withScope(()=>(s.getStackTop().scope=e,t(e)))}function v3(e){return fh().withScope(()=>e(fh().getIsolationScope()))}function ZJ(){return{withIsolationScope:v3,withScope:XJ,withSetScope:QJ,withSetIsolationScope:(e,t)=>v3(t),getCurrentScope:()=>fh().getScope(),getIsolationScope:()=>fh().getIsolationScope()}}function Vh(e){const t=Kj(e);return t.acs?t.acs:ZJ()}function Qs(){const e=_p();return Vh(e).getCurrentScope()}function vo(){const e=_p();return Vh(e).getIsolationScope()}function eX(){return Bh("globalScope",()=>new rl)}function Np(...e){const t=_p(),s=Vh(t);if(e.length===2){const[n,a]=e;return n?s.withSetScope(n,a):s.withScope(a)}return s.withScope(e[0])}function Os(){return Qs().getClient()}function tX(e){const t=e.getPropagationContext(),{traceId:s,parentSpanId:n,propagationSpanId:a}=t,o={trace_id:s,span_id:a||tc()};return n&&(o.parent_span_id=n),o}const di="sentry.source",H5="sentry.sample_rate",HU="sentry.previous_trace_sample_rate",lc="sentry.op",wn="sentry.origin",Gx="sentry.idle_span_finish_reason",Iv="sentry.measurement_unit",Mv="sentry.measurement_value",b3="sentry.custom_span_name",V5="sentry.profile_id",Gh="sentry.exclusive_time",sX="sentry.link.type",rX=0,G5=1,vn=2;function nX(e){if(e<400&&e>=100)return{code:G5};if(e>=400&&e<500)switch(e){case 401:return{code:vn,message:"unauthenticated"};case 403:return{code:vn,message:"permission_denied"};case 404:return{code:vn,message:"not_found"};case 409:return{code:vn,message:"already_exists"};case 413:return{code:vn,message:"failed_precondition"};case 429:return{code:vn,message:"resource_exhausted"};case 499:return{code:vn,message:"cancelled"};default:return{code:vn,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:vn,message:"unimplemented"};case 503:return{code:vn,message:"unavailable"};case 504:return{code:vn,message:"deadline_exceeded"};default:return{code:vn,message:"internal_error"}}return{code:vn,message:"internal_error"}}function VU(e,t){e.setAttribute("http.response.status_code",t);const s=nX(t);s.message!=="unknown_error"&&e.setStatus(s)}const GU="_sentryScope",WU="_sentryIsolationScope";function aX(e){try{const t=Us.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function oX(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function iX(e,t,s){e&&(ho(e,WU,aX(s)),ho(e,GU,t))}function A_(e){const t=e;return{scope:t[GU],isolationScope:oX(t[WU])}}const W5="sentry-",lX=/^sentry-/,cX=8192;function YU(e){const t=uX(e);if(!t)return;const s=Object.entries(t).reduce((n,[a,o])=>{if(a.match(lX)){const i=a.slice(W5.length);n[i]=o}return n},{});if(Object.keys(s).length>0)return s}function dX(e){if(!e)return;const t=Object.entries(e).reduce((s,[n,a])=>(a&&(s[`${W5}${n}`]=a),s),{});return pX(t)}function uX(e){if(!(!e||!Zl(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,s)=>{const n=y3(s);return Object.entries(n).forEach(([a,o])=>{t[a]=o}),t},{}):y3(e)}function y3(e){return e.split(",").map(t=>{const s=t.indexOf("=");if(s===-1)return[];const n=t.slice(0,s),a=t.slice(s+1);return[n,a].map(o=>{try{return decodeURIComponent(o.trim())}catch{return}})}).reduce((t,[s,n])=>(s&&n&&(t[s]=n),t),{})}function pX(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[s,n],a)=>{const o=`${encodeURIComponent(s)}=${encodeURIComponent(n)}`,i=a===0?o:`${t},${o}`;return i.length>cX?(Yt&&kt.warn(`Not adding key: ${s} with val: ${n} to baggage header due to exceeding baggage size limits.`),t):i},"")}const fX=/^o(\d+)\./,hX=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function mX(e){return e==="http"||e==="https"}function kp(e,t=!1){const{host:s,path:n,pass:a,port:o,projectId:i,protocol:l,publicKey:c}=e;return`${l}://${c}${t&&a?`:${a}`:""}@${s}${o?`:${o}`:""}/${n&&`${n}/`}${i}`}function gX(e){const t=hX.exec(e);if(!t){jp(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[s,n,a="",o="",i="",l=""]=t.slice(1);let c="",u=l;const f=u.split("/");if(f.length>1&&(c=f.slice(0,-1).join("/"),u=f.pop()),u){const h=u.match(/^\d+/);h&&(u=h[0])}return KU({host:o,pass:a,path:c,projectId:u,port:i,protocol:s,publicKey:n})}function KU(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function xX(e){if(!Yt)return!0;const{port:t,projectId:s,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(i=>e[i]?!1:(kt.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:s.match(/^\d+$/)?mX(n)?t&&isNaN(parseInt(t,10))?(kt.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(kt.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(kt.error(`Invalid Sentry Dsn: Invalid projectId ${s}`),!1)}function vX(e){const t=e.match(fX);return t==null?void 0:t[1]}function bX(e){const t=e.getOptions(),{host:s}=e.getDsn()||{};let n;return t.orgId?n=String(t.orgId):s&&(n=vX(s)),n}function JU(e){const t=typeof e=="string"?gX(e):KU(e);if(!(!t||!xX(t)))return t}function np(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const XU=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function yX(e){if(!e)return;const t=e.match(XU);if(!t)return;let s;return t[3]==="1"?s=!0:t[3]==="0"&&(s=!1),{traceId:t[1],parentSampled:s,parentSpanId:t[2]}}function _X(e,t){const s=yX(e),n=YU(t);if(!(s!=null&&s.traceId))return{traceId:ic(),sampleRand:Math.random()};const a=jX(s,n);n&&(n.sample_rand=a.toString());const{traceId:o,parentSpanId:i,parentSampled:l}=s;return{traceId:o,parentSpanId:i,sampled:l,dsc:n||{},sampleRand:a}}function QU(e=ic(),t=tc(),s){let n="";return s!==void 0&&(n=s?"-1":"-0"),`${e}-${t}${n}`}function ZU(e=ic(),t=tc(),s){return`00-${e}-${t}-${s?"01":"00"}`}function jX(e,t){const s=np(t==null?void 0:t.sample_rand);if(s!==void 0)return s;const n=np(t==null?void 0:t.sample_rate);return n&&(e==null?void 0:e.parentSampled)!==void 0?e.parentSampled?Math.random()*n:n+Math.random()*(1-n):Math.random()}const eF=0,Y5=1;let _3=!1;function wX(e){const{spanId:t,traceId:s}=e.spanContext(),{data:n,op:a,parent_span_id:o,status:i,origin:l,links:c}=Hs(e);return{parent_span_id:o,span_id:t,trace_id:s,data:n,op:a,status:i,origin:l,links:c}}function NX(e){const{spanId:t,traceId:s,isRemote:n}=e.spanContext(),a=n?t:Hs(e).parent_span_id,o=A_(e).scope,i=n?(o==null?void 0:o.getPropagationContext().propagationSpanId)||tc():t;return{parent_span_id:a,span_id:i,trace_id:s}}function kX(e){const{traceId:t,spanId:s}=e.spanContext(),n=Dd(e);return QU(t,s,n)}function SX(e){const{traceId:t,spanId:s}=e.spanContext(),n=Dd(e);return ZU(t,s,n)}function tF(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:s,traceFlags:n,...a},attributes:o})=>({span_id:t,trace_id:s,sampled:n===Y5,attributes:o,...a}))}function Wu(e){return typeof e=="number"?j3(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?j3(e.getTime()):An()}function j3(e){return e>9999999999?e/1e3:e}function Hs(e){var n;if(EX(e))return e.getSpanJSON();const{spanId:t,traceId:s}=e.spanContext();if(CX(e)){const{attributes:a,startTime:o,name:i,endTime:l,status:c,links:u}=e,f="parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?(n=e.parentSpanContext)==null?void 0:n.spanId:void 0;return{span_id:t,trace_id:s,data:a,description:i,parent_span_id:f,start_timestamp:Wu(o),timestamp:Wu(l)||void 0,status:sF(c),op:a[lc],origin:a[wn],links:tF(u)}}return{span_id:t,trace_id:s,start_timestamp:0,data:{}}}function CX(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function EX(e){return typeof e.getSpanJSON=="function"}function Dd(e){const{traceFlags:t}=e.spanContext();return t===Y5}function sF(e){if(!(!e||e.code===rX))return e.code===G5?"ok":e.message||"internal_error"}const Yu="_sentryChildSpans",tC="_sentryRootSpan";function rF(e,t){const s=e[tC]||e;ho(t,tC,s),e[Yu]?e[Yu].add(t):ho(e,Yu,new Set([t]))}function TX(e,t){e[Yu]&&e[Yu].delete(t)}function e_(e){const t=new Set;
54function s(n){if(!t.has(n)&&Dd(n)){t.add(n);const a=n[Yu]?Array.from(n[Yu]):[];for(const o of a)s(o)}}return s(e),Array.from(t)}function la(e){return e[tC]||e}function ka(){const e=_p(),t=Vh(e);return t.getActiveSpan?t.getActiveSpan():R_(Qs())}function sC(){_3||(jp(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),_3=!0)}let w3=!1;function RX(){if(w3)return;function e(){const t=ka(),s=t&&la(t);if(s){const n="internal_error";Yt&&kt.log(`[Tracing] Root span: ${n} -> Global error occurred`),s.setStatus({code:vn,message:n})}}e.tag="sentry_tracingErrorCallback",w3=!0,MU(e),OU(e)}function pi(e){var s;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||((s=Os())==null?void 0:s.getOptions());return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function N3(e){kt.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function P_(e,t){if(!(t!=null&&t.length)||!e.description)return!1;for(const s of t){if(PX(s)){if(Z0(e.description,s))return Yt&&N3(e),!0;continue}if(!s.name&&!s.op)continue;const n=s.name?Z0(e.description,s.name):!0,a=s.op?e.op&&Z0(e.op,s.op):!0;if(n&&a)return Yt&&N3(e),!0}return!1}function AX(e,t){const s=t.parent_span_id,n=t.span_id;if(s)for(const a of e)a.parent_span_id===n&&(a.parent_span_id=s)}function PX(e){return typeof e=="string"||e instanceof RegExp}const K5="production",nF="_frozenDsc";function t_(e,t){ho(e,nF,t)}function aF(e,t){const s=t.getOptions(),{publicKey:n}=t.getDsn()||{},a={environment:s.environment||K5,release:s.release,public_key:n,trace_id:e,org_id:bX(t)};return t.emit("createDsc",a),a}function oF(e,t){const s=t.getPropagationContext();return s.dsc||aF(s.traceId,e)}function cc(e){var y;const t=Os();if(!t)return{};const s=la(e),n=Hs(s),a=n.data,o=s.spanContext().traceState,i=(o==null?void 0:o.get("sentry.sample_rate"))??a[H5]??a[HU];function l(_){return(typeof i=="number"||typeof i=="string")&&(_.sample_rate=`${i}`),_}const c=s[nF];if(c)return l(c);const u=o==null?void 0:o.get("sentry.dsc"),f=u&&YU(u);if(f)return l(f);const h=aF(e.spanContext().traceId,t),g=a[di],v=n.description;return g!=="url"&&v&&(h.transaction=v),pi()&&(h.sampled=String(Dd(s)),h.sample_rand=(o==null?void 0:o.get("sentry.sample_rand"))??((y=A_(s).scope)==null?void 0:y.getPropagationContext().sampleRand.toString())),l(h),t.emit("createDsc",h,s),h}class Sd{constructor(t={}){this._traceId=t.traceId||ic(),this._spanId=t.spanId||tc()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:eF}}end(t){}setAttribute(t,s){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,s,n){return this}addLink(t){return this}addLinks(t){return this}recordException(t,s){}}function ii(e,t=100,s=1/0){try{return rC("",e,t,s)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function iF(e,t=3,s=100*1024){const n=ii(e,t);return LX(n)>s?iF(e,t-1,s):n}function rC(e,t,s=1/0,n=1/0,a=DX()){const[o,i]=a;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const l=IX(e,t);if(!l.startsWith("[object "))return l;if(t.__sentry_skip_normalization__)return t;const c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:s;if(c===0)return l.replace("object ","");if(o(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{const v=u.toJSON();return rC("",v,c-1,n,a)}catch{}const f=Array.isArray(t)?[]:{};let h=0;const g=BU(t);for(const v in g){if(!Object.prototype.hasOwnProperty.call(g,v))continue;if(h>=n){f[v]="[MaxProperties ~]";break}const y=g[v];f[v]=rC(v,y,c-1,n,a),h++}return i(t),f}function IX(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if($U(t))return IU(t);if(OJ(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${ac(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const s=MX(t);return/^HTML(\w*)Element$/.test(s)?`[HTMLElement: ${s}]`:`[object ${s}]`}catch(s){return`**non-serializable** (${s})`}}function MX(e){const t=Object.getPrototypeOf(e);return t!=null&&t.constructor?t.constructor.name:"null prototype"}function OX(e){return~-encodeURI(e).split(/%..|./).length}function LX(e){return OX(JSON.stringify(e))}function DX(){const e=new WeakSet;function t(n){return e.has(n)?!0:(e.add(n),!1)}function s(n){e.delete(n)}return[t,s]}function $d(e,t=[]){return[e,t]}function $X(e,t){const[s,n]=e;return[s,[...n,t]]}function k3(e,t){const s=e[1];for(const n of s){const a=n[0].type;if(t(n,a))return!0}return!1}function nC(e){const t=Kj(Us);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function UX(e){const[t,s]=e;let n=JSON.stringify(t);
54function a(o){typeof n=="string"?n=typeof o=="string"?n+o:[nC(n),o]:n.push(typeof o=="string"?nC(o):o)}for(const o of s){const[i,l]=o;if(a(` 55${JSON.stringify(i)} 56`),typeof l=="string"||l instanceof Uint8Array)a(l);else{let c;try{c=JSON.stringify(l)}catch{c=JSON.stringify(ii(l))}a(c)}}return typeof n=="string"?n:FX(n)}function FX(e){const t=e.reduce((a,o)=>a+o.length,0),s=new Uint8Array(t);let n=0;for(const a of e)s.set(a,n),n+=a.length;return s}function BX(e){return[{type:"span"},e]}function qX(e){const t=typeof e.data=="string"?nC(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const zX={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",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function S3(e){return zX[e]}function J5(e){if(!(e!=null&&e.sdk))return;const{name:t,version:s}=e.sdk;return{name:t,version:s}}function lF(e,t,s,n){var o;const a=(o=e.sdkProcessingMetadata)==null?void 0:o.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!s&&n&&{dsn:kp(n)},...a&&{trace:a}}}function HX(e,t){var n,a,o,i;if(!t)return e;const s=e.sdk||{};return e.sdk={...s,name:s.name||t.name,version:s.version||t.version,integrations:[...((n=e.sdk)==null?void 0:n.integrations)||[],...t.integrations||[]],packages:[...((a=e.sdk)==null?void 0:a.packages)||[],...t.packages||[]],settings:(o=e.sdk)!=null&&o.settings||t.settings?{...(i=e.sdk)==null?void 0:i.settings,...t.settings}:void 0},e}function VX(e,t,s,n){const a=J5(s),o={sent_at:new Date().toISOString(),...a&&{sdk:a},...!!n&&t&&{dsn:kp(t)}},i="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return $d(o,[i])}function GX(e,t,s,n){const a=J5(s),o=e.type&&e.type!=="replay_event"?e.type:"event";HX(e,s==null?void 0:s.sdk);const i=lF(e,a,n,t);return delete e.sdkProcessingMetadata,$d(i,[[{type:o},e]])}function WX(e,t){function s(v){return!!v.trace_id&&!!v.public_key}const n=cc(e[0]),a=t==null?void 0:t.getDsn(),o=t==null?void 0:t.getOptions().tunnel,i={sent_at:new Date().toISOString(),...s(n)&&{trace:n},...!!o&&a&&{dsn:kp(a)}},{beforeSendSpan:l,ignoreSpans:c}=(t==null?void 0:t.getOptions())||{},u=c!=null&&c.length?e.filter(v=>!P_(Hs(v),c)):e,f=e.length-u.length;f&&(t==null||t.recordDroppedEvent("before_send","span",f));const h=l?v=>{const y=Hs(v),_=l(y);return _||(sC(),y)}:Hs,g=[];for(const v of u){const y=h(v);y&&g.push(BX(y))}return $d(i,g)}function YX(e){if(!Yt)return;const{description:t="< unknown name >",op:s="< unknown op >",parent_span_id:n}=Hs(e),{spanId:a}=e.spanContext(),o=Dd(e),i=la(e),l=i===e,c=`[Tracing] Starting ${o?"sampled":"unsampled"} ${l?"root ":""}span`,u=[`op: ${s}`,`name: ${t}`,`ID: ${a}`];if(n&&u.push(`parent ID: ${n}`),!l){const{op:f,description:h}=Hs(i);u.push(`root ID: ${i.spanContext().spanId}`),f&&u.push(`root op: ${f}`),h&&u.push(`root description: ${h}`)}kt.log(`${c} 57 ${u.join(` 58 `)}`)}function KX(e){if(!Yt)return;const{description:t="< unknown name >",op:s="< unknown op >"}=Hs(e),{spanId:n}=e.spanContext(),o=la(e)===e,i=`[Tracing] Finishing "${s}" ${o?"root ":""}span "${t}" with ID ${n}`;kt.log(i)}function JX(e,t,s,n=ka()){const a=n&&la(n);a&&(Yt&&kt.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${s}`),a.addEvent(e,{[Mv]:t,[Iv]:s}))}function C3(e){if(!e||e.length===0)return;const t={};return e.forEach(s=>{const n=s.attributes||{},a=n[Iv],o=n[Mv];typeof a=="string"&&typeof o=="number"&&(t[s.name]={value:o,unit:a})}),t}const E3=1e3;class Qj{constructor(t={}){this._traceId=t.traceId||ic(),this._spanId=t.spanId||tc(),this._startTime=t.startTimestamp||An(),this._links=t.links,this._attributes={},this.setAttributes({[wn]:"manual",[lc]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}
58addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,s){}spanContext(){const{_spanId:t,_traceId:s,_sampled:n}=this;return{spanId:t,traceId:s,traceFlags:n?Y5:eF}}setAttribute(t,s){return s===void 0?delete this._attributes[t]:this._attributes[t]=s,this}setAttributes(t){return Object.keys(t).forEach(s=>this.setAttribute(s,t[s])),this}updateStartTime(t){this._startTime=Wu(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(di,"custom"),this}end(t){this._endTime||(this._endTime=Wu(t),KX(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[lc],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:sF(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[wn],profile_id:this._attributes[V5],exclusive_time:this._attributes[Gh],measurements:C3(this._events),is_segment:this._isStandaloneSpan&&la(this)===this||void 0,segment_id:this._isStandaloneSpan?la(this).spanContext().spanId:void 0,links:tF(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,s,n){Yt&&kt.log("[Tracing] Adding an event to span:",t);const a=T3(s)?s:n||An(),o=T3(s)?{}:s||{},i={name:t,time:Wu(a),attributes:o};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=Os();if(t&&t.emit("spanEnd",this),!(this._isStandaloneSpan||this===la(this)))return;if(this._isStandaloneSpan){this._sampled?QX(WX([this],t)):(Yt&&kt.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}const n=this._convertSpanToTransaction();n&&(A_(this).scope||Qs()).captureEvent(n)}_convertSpanToTransaction(){var f;if(!R3(Hs(this)))return;this._name||(Yt&&kt.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:t,isolationScope:s}=A_(this),n=(f=t==null?void 0:t.getScopeData().sdkProcessingMetadata)==null?void 0:f.normalizedRequest;if(this._sampled!==!0)return;const o=e_(this).filter(h=>
58h!==this&&!XX(h)).map(h=>Hs(h)).filter(R3),i=this._attributes[di];delete this._attributes[b3],o.forEach(h=>{delete h.data[b3]});const l={contexts:{trace:wX(this)},spans:o.length>E3?o.sort((h,g)=>h.start_timestamp-g.start_timestamp).slice(0,E3):o,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:s,dynamicSamplingContext:cc(this)},request:n,...i&&{transaction_info:{source:i}}},c=C3(this._events);return c&&Object.keys(c).length&&(Yt&&kt.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),l.measurements=c),l}}function T3(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function R3(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function XX(e){return e instanceof Qj&&e.isStandaloneSpan()}function QX(e){const t=Os();if(!t)return;const s=e[1];if(!s||s.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function ZX(e,t,s=()=>{},n=()=>{}){let a;try{a=e()}catch(o){throw t(o),s(),o}return eQ(a,t,s,n)}function eQ(e,t,s,n){return zh(e)?e.then(a=>(s(),n(a),a),a=>{throw t(a),s(),a}):(s(),n(e),e)}function tQ(e,t,s){if(!pi(e))return[!1];let n,a;typeof e.tracesSampler=="function"?(a=e.tracesSampler({...t,inheritOrSampleWith:l=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):l}),n=!0):t.parentSampled!==void 0?a=t.parentSampled:typeof e.tracesSampleRate<"u"&&(a=e.tracesSampleRate,n=!0);const o=np(a);if(o===void 0)return Yt&&kt.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(a)} of type ${JSON.stringify(typeof a)}.`),[!1];if(!o)return Yt&&kt.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,o,n];const i=s<o;return i||Yt&&kt.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(a)})`),[i,o,n]}const cF="__SENTRY_SUPPRESS_TRACING__";function sQ(e,t){const s=Q5();if(s.startSpan)return s.startSpan(e,t);const n=uF(e),{forceTransaction:a,parentSpan:o,scope:i}=e,l=i==null?void 0:i.clone();return Np(l,()=>nQ(o)(()=>{const u=Qs(),f=pF(u,o),g=e.onlyIfParent&&!f?new Sd:dF({parentSpan:f,spanArguments:n,forceTransaction:a,scope:u});return ph(u,g),ZX(()=>t(g),()=>{const{status:v}=Hs(g);g.isRecording()&&(!v||v==="ok")&&g.setStatus({code:vn,message:"internal_error"})},()=>{g.end()})}))}function Wh(e){const t=Q5();if(t.startInactiveSpan)return t.startInactiveSpan(e);const s=uF(e),{forceTransaction:n,parentSpan:a}=e;return(e.scope?i=>Np(e.scope,i):a!==void 0?i=>X5(a,i):i=>i())(()=>{const i=Qs(),l=pF(i,a);return e.onlyIfParent&&!l?new Sd:dF({parentSpan:l,spanArguments:s,forceTransaction:n,scope:i})})}function X5(e,t){const s=Q5();return s.withActiveSpan?s.withActiveSpan(e,t):Np(n=>(ph(n,e||void 0),t(n)))}function dF({parentSpan:e,spanArguments:t,forceTransaction:s,scope:n}){if(!pi()){const i=new Sd;if(s||!e){const l={sampled:"false",sample_rate:"0",transaction:t.name,...cc(i)};t_(i,l)}return i}const a=vo();let o;if(e&&!s)o=rQ(e,n,t),rF(e,o);else if(e){const i=cc(e),{traceId:l,spanId:c}=e.spanContext(),u=Dd(e);o=A3({traceId:l,parentSpanId:c,...t},n,u),t_(o,i)}else{const{traceId:i,dsc:l,parentSpanId:c,sampled:u}={...a.getPropagationContext(),...n.getPropagationContext()};o=A3({traceId:i,parentSpanId:c,...t},n,u),l&&t_(o,l)}return YX(o),iX(o,n,a),o}function uF(e){const s={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const n={...s};return n.startTimestamp=Wu(e.startTime),delete n.startTime,n}return s}function Q5(){const e=_p();return Vh(e)}function A3(e,t,s){var y;const n=Os(),a=(n==null?void 0:n.getOptions())||{},{name:o=""}=e,i={spanAttributes:{...e.attributes},spanName:o,parentSampled:s};n==null||n.emit("beforeSampling",i,{decision:!1});const l=i.parentSampled??s,c=i.spanAttributes,u=t.getPropagationContext(),[f,h,g]=t.getScopeData().sdkProcessingMetadata[cF]?[!1]:tQ(a,{name:o,parentSampled:l,attributes:c,parentSampleRate:np((y=u.dsc)==null?void 0:y.sample_rate)},u.sampleRand),v=new Qj({...e,attributes:{[di]:"custom",[H5]:h!==void 0&&g?h:void 0,...c},sampled:f});return!f&&n&&(Yt&&kt.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),n.recordDroppedEvent("sample_rate","transaction")),n&&n.emit("spanStart",v),v}function rQ(e,t,s){const{spanId:n,traceId:a}=e.spanContext(),o=t.getScopeData().sdkProcessingMetadata[cF]?!1:Dd(e),i=o?new Qj({...s,parentSpanId:n,traceId:a,sampled:o}):new Sd({traceId:a});rF(e,i);const l=Os();return l&&(l.emit("spanStart",i),s.endTimestamp&&l.emit("spanEnd",i)),i}function pF(e,t){if(t)return t;if(t===null)return;const s=R_(e);if(!s)return;const n=Os();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?la(s):s}function nQ(e){return e!==void 0?t=>X5(e,t):t=>t()}const s_={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},aQ="heartbeatFailed",oQ="idleTimeout",iQ="finalTimeout",lQ="externalFinish";function fF(e,t={}){const s=new Map;let n=!1,a,o=lQ,i=!t.disableAutoFinish;
58const l=[],{idleTimeout:c=s_.idleTimeout,finalTimeout:u=s_.finalTimeout,childSpanTimeout:f=s_.childSpanTimeout,beforeSpanEnd:h,trimIdleSpanEndTimestamp:g=!0}=t,v=Os();if(!v||!pi()){const R=new Sd,I={sample_rate:"0",sampled:"false",...cc(R)};return t_(R,I),R}const y=Qs(),_=ka(),j=cQ(e);j.end=new Proxy(j.end,{apply(R,I,L){if(h&&h(j),I instanceof Sd)return;const[M,...O]=L,z=M||An(),X=Wu(z),W=e_(j).filter($=>$!==j),K=Hs(j);if(!W.length||!g)return A(X),Reflect.apply(R,I,[X,...O]);const q=v.getOptions().ignoreSpans,J=W==null?void 0:W.reduce(($,B)=>{const ae=Hs(B);return!ae.timestamp||q&&P_(ae,q)?$:$?Math.max($,ae.timestamp):ae.timestamp},void 0),F=K.start_timestamp,V=Math.min(F?F+u/1e3:1/0,Math.max(F||-1/0,Math.min(X,J||1/0)));return A(V),Reflect.apply(R,I,[V,...O])}});function w(){a&&(clearTimeout(a),a=void 0)}function k(R){w(),a=setTimeout(()=>{!n&&s.size===0&&i&&(o=oQ,j.end(R))},c)}function S(R){a=setTimeout(()=>{!n&&i&&(o=aQ,j.end(R))},f)}function E(R){w(),s.set(R,!0);const I=An();S(I+f/1e3)}function T(R){if(s.has(R)&&s.delete(R),s.size===0){const I=An();k(I+c/1e3)}}function A(R){n=!0,s.clear(),l.forEach(W=>W()),ph(y,_);const I=Hs(j),{start_timestamp:L}=I;if(!L)return;I.data[Gx]||j.setAttribute(Gx,o);const O=I.status;(!O||O==="unknown")&&j.setStatus({code:G5}),kt.log(`[Tracing] Idle span "${I.op}" finished`);const z=e_(j).filter(W=>W!==j);let X=0;z.forEach(W=>{W.isRecording()&&(W.setStatus({code:vn,message:"cancelled"}),W.end(R),Yt&&kt.log("[Tracing] Cancelling span since span ended early",JSON.stringify(W,void 0,2)));const K=Hs(W),{timestamp:q=0,start_timestamp:J=0}=K,F=J<=R,V=(u+c)/1e3,$=q-J<=V;if(Yt){const B=JSON.stringify(W,void 0,2);F?$||kt.log("[Tracing] Discarding span since it finished after idle span final timeout",B):kt.log("[Tracing] Discarding span since it happened after idle span was finished",B)}(!$||!F)&&(TX(j,W),X++)}),X>0&&j.setAttribute("sentry.idle_span_discarded_spans",X)}return l.push(v.on("spanStart",R=>{if(n||R===j||Hs(R).timestamp||R instanceof Qj&&R.isStandaloneSpan())return;e_(j).includes(R)&&E(R.spanContext().spanId)})),l.push(v.on("spanEnd",R=>{n||T(R.spanContext().spanId)})),l.push(v.on("idleSpanEnableAutoFinish",R=>{R===j&&(i=!0,k(),s.size&&S())})),t.disableAutoFinish||k(),setTimeout(()=>{n||(j.setStatus({code:vn,message:"deadline_exceeded"}),o=iQ,j.end())},u),j}function cQ(e){const t=Wh(e);return ph(Qs(),t),Yt&&kt.log("[Tracing] Started span is an idle span"),t}const jk=0,P3=1,I3=2;function Zj(e){return new Wx(t=>{t(e)})}function Z5(e){return new Wx((t,s)=>{s(e)})}class Wx{constructor(t){this._state=jk,this._handlers=[],this._runExecutor(t)}then(t,s){return new Wx((n,a)=>{this._handlers.push([!1,o=>{if(!t)n(o);else try{n(t(o))}catch(i){a(i)}},o=>{if(!s)a(o);else try{n(s(o))}catch(i){a(i)}}]),this._executeHandlers()})}catch(t){return this.then(s=>s,t)}finally(t){return new Wx((s,n)=>{let a,o;return this.then(i=>{o=!1,a=i,t&&t()},i=>{o=!0,a=i,t&&t()}).then(()=>{if(o){n(a);return}s(a)})})}_executeHandlers(){if(this._state===jk)return;const t=this._handlers.slice();this._handlers=[],t.forEach(s=>{s[0]||(this._state===P3&&s[1](this._value),this._state===I3&&s[2](this._value),s[0]=!0)})}_runExecutor(t){const s=(o,i)=>{if(this._state===jk){if(zh(i)){i.then(n,a);return}this._state=o,this._value=i,this._executeHandlers()}},n=o=>{s(P3,o)},a=o=>{s(I3,o)};try{t(n,a)}catch(o){a(o)}}}function dQ(e,t,s,n=0){try{const a=aC(t,s,e,n);return zh(a)?a:Zj(a)}catch(a){return Z5(a)}}function aC(e,t,s,n){const a=s[n];if(!e||!a)return e;const o=a({...e},t);return Yt&&o===null&&kt.log(`Event processor "${a.id||"?"}" dropped event`),zh(o)?o.then(i=>aC(i,t,s,n+1)):aC(o,t,s,n+1)}function uQ(e,t){const{fingerprint:s,span:n,breadcrumbs:a,sdkProcessingMetadata:o}=t;pQ(e,t),n&&mQ(e,n),gQ(e,s),fQ(e,a),hQ(e,o)}function M3(e,t){const{extra:s,tags:n,attributes:a,user:o,contexts:i,level:l,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:f,eventProcessors:h,attachments:g,propagationContext:v,transactionName:y,span:_}=t;vg(e,"extra",s),vg(e,"tags",n),vg(e,"attributes",a),vg(e,"user",o),vg(e,"contexts",i),e.sdkProcessingMetadata=Pv(e.sdkProcessingMetadata,c,2),l&&(e.level=l),y&&(e.transactionName=y),_&&(e.span=_),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),f.length&&(e.fingerprint=[...e.fingerprint,...f]),h.length&&(e.eventProcessors=[...e.eventProcessors,...h]
58),g.length&&(e.attachments=[...e.attachments,...g]),e.propagationContext={...e.propagationContext,...v}}function vg(e,t,s){e[t]=Pv(e[t],s,1)}function pQ(e,t){const{extra:s,tags:n,user:a,contexts:o,level:i,transactionName:l}=t;Object.keys(s).length&&(e.extra={...s,...e.extra}),Object.keys(n).length&&(e.tags={...n,...e.tags}),Object.keys(a).length&&(e.user={...a,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),i&&(e.level=i),l&&e.type!=="transaction"&&(e.transaction=l)}function fQ(e,t){const s=[...e.breadcrumbs||[],...t];e.breadcrumbs=s.length?s:void 0}function hQ(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function mQ(e,t){e.contexts={trace:NX(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:cc(t),...e.sdkProcessingMetadata};const s=la(t),n=Hs(s).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function gQ(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}let El,O3,L3,Fc;function xQ(e){const t=Us._sentryDebugIds,s=Us._debugIds;if(!t&&!s)return{};const n=t?Object.keys(t):[],a=s?Object.keys(s):[];if(Fc&&n.length===O3&&a.length===L3)return Fc;O3=n.length,L3=a.length,Fc={},El||(El={});const o=(i,l)=>{for(const c of i){const u=l[c],f=El==null?void 0:El[c];if(f&&Fc&&u)Fc[f[0]]=u,El&&(El[c]=[f[0],u]);else if(u){const h=e(c);for(let g=h.length-1;g>=0;g--){const v=h[g],y=v==null?void 0:v.filename;if(y&&Fc&&El){Fc[y]=u,El[c]=[y,u];break}}}}};return t&&o(n,t),s&&o(a,s),Fc}function hF(e,t,s,n,a,o){const{normalizeDepth:i=3,normalizeMaxBreadth:l=1e3}=e,c={...t,event_id:t.event_id||s.event_id||uo(),timestamp:t.timestamp||wp()},u=s.integrations||e.integrations.map(j=>j.name);vQ(c,e),_Q(c,u),a&&a.emit("applyFrameMetadata",t),t.type===void 0&&bQ(c,e.stackParser);const f=wQ(n,s.captureContext);s.mechanism&&dh(c,s.mechanism);const h=a?a.getEventProcessors():[],g=eX().getScopeData();if(o){const j=o.getScopeData();M3(g,j)}if(f){const j=f.getScopeData();M3(g,j)}const v=[...s.attachments||[],...g.attachments];v.length&&(s.attachments=v),uQ(c,g);const y=[...h,...g.eventProcessors];return dQ(y,c,s).then(j=>(j&&yQ(j),typeof i=="number"&&i>0?jQ(j,i,l):j))}function vQ(e,t){var l,c;const{environment:s,release:n,dist:a,maxValueLength:o}=t;e.environment=e.environment||s||K5,!e.release&&n&&(e.release=n),!e.dist&&a&&(e.dist=a);const i=e.request;i!=null&&i.url&&o&&(i.url=Q2(i.url,o)),o&&((c=(l=e.exception)==null?void 0:l.values)==null||c.forEach(u=>{u.value&&(u.value=Q2(u.value,o))}))}function bQ(e,t){var n,a;const s=xQ(t);(a=(n=e.exception)==null?void 0:n.values)==null||a.forEach(o=>{var i,l;(l=(i=o.stacktrace)==null?void 0:i.frames)==null||l.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}function yQ(e){var n,a;const t={};if((a=(n=e.exception)==null?void 0:n.values)==null||a.forEach(o=>{var i,l;(l=(i=o.stacktrace)==null?void 0:i.frames)==null||l.forEach(c=>{c.debug_id&&(c.abs_path?t[c.abs_path]=c.debug_id:c.filename&&(t[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const s=e.debug_meta.images;Object.entries(t).forEach(([o,i])=>{s.push({type:"sourcemap",code_file:o,debug_id:i})})}function _Q(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function jQ(e,t,s){var a,o;if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:ii(i.data,t,s)}}))},...e.user&&{user:ii(e.user,t,s)},...e.contexts&&{contexts:ii(e.contexts,t,s)},...e.extra&&{extra:ii(e.extra,t,s)}};return(a=e.contexts)!=null&&a.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=ii(e.contexts.trace.data,t,s))),e.spans&&(n.spans=e.spans.map(i=>({...i,...i.data&&{data:ii(i.data,t,s)}}))),(o=e.contexts)!=null&&o.flags&&n.contexts&&(n.contexts.flags=ii(e.contexts.flags,3,s)),n}function wQ(e,t){if(!t)return e;const s=e?e.clone():new rl;return s.update(t),s}function NQ(e){if(e)return kQ(e)?{captureContext:e}:CQ(e)?{captureContext:e}:e}function kQ(e){return e instanceof rl||typeof e=="function"}const SQ=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function CQ(e){return Object.keys(e).some(t=>SQ.includes(t))}function Ku(e,t){return Qs().captureException(e,NQ(t))}function EQ(e,t){const s=t;return Qs().captureMessage(e,s,void 0)}function mF(e,t){return Qs().captureEvent(e,t)}function gF(e,t){vo().setContext(e,t)}function TQ(e,t){vo().setTag(e,t)}function D3(e){vo().setUser(e)}function RQ(){return vo().lastEventId()}function AQ(){const e=Os();return(e==null?void 0:e.getOptions().enabled)!==!1&&!!(e!=null&&e.getTransport())}function PQ(e){vo().addEventProcessor(e)}function $3(e){const t=vo(),s=Qs(),{userAgent:n}=Us.navigator||{},a=HJ({user:s.getUser()||t.getUser(),...n&&{userAgent:n},...e}),o=t.getSession();return(o==null?void 0:o.status)==="ok"&&uh(o,{status:"exited"}),xF(),t.setSession(a),a}function xF(){const e=vo(),s=Qs().getSession()||e.getSession();s&&VJ(s),vF(),e.setSession()}function vF(){const e=vo(),t=Os(),s=e.getSession();s&&t&&t.captureSession(s)}function U3(e=!1){if(e){xF();return}vF()}const IQ="7";function bF(e){const t=e.protocol?`${e.protocol}:`:"",s=e.port?`:${e.port}`:"";return`${t}//${e.host}${s}${e.path?`/${e.path}`:""}/api/`}function MQ(e){return`${bF(e)}${e.projectId}/envelope/`}function OQ(e,t){const s={sentry_version:IQ};return e.publicKey&&(s.sentry_key=e.publicKey),t&&(s.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(s).toString()}function LQ(e,t,s){return t||`${MQ(e)}?${OQ(e,s)}`}function DQ(e,t){const s=JU(e);if(!s)return"";const n=`${bF(s)}embed/error-page/`;let a=`dsn=${kp(s)}`;for(const o in t)if(o!=="dsn"&&o!=="onClose")if(o==="user"){const i=t.user;if(!i)continue;i.name&&(a+=`&name=${encodeURIComponent(i.name)}`),i.email&&(a+=`&email=${encodeURIComponent(i.email)}`)}else a+=`&${encodeURIComponent(o)}=${encodeURIComponent(t[o])}`;return`${n}?${a}`}const F3=[];function $Q(e){const t={};return e.forEach(s=>{const{name:n}=s,a=t[n];a&&!a.isDefaultInstance&&s.isDefaultInstance||(t[n]=s)}),Object.values(t)}function UQ(e){const t=e.defaultIntegrations||[],s=e.integrations;t.forEach(a=>{a.isDefaultInstance=!0});let n;if(Array.isArray(s))n=[...t,...s];else if(typeof s=="function"){const a=s(t);n=Array.isArray(a)?a:[a]}else n=t;return $Q(n)}function FQ(e,t){const s={};return t.forEach(n=>
58{n&&yF(e,n,s)}),s}function B3(e,t){for(const s of t)s!=null&&s.afterAllSetup&&s.afterAllSetup(e)}function yF(e,t,s){if(s[t.name]){Yt&&kt.log(`Integration skipped because it was already installed: ${t.name}`);return}if(s[t.name]=t,!F3.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),F3.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(a,o)=>n(a,o,e))}if(typeof t.processEvent=="function"){const n=t.processEvent.bind(t),a=Object.assign((o,i)=>n(o,i,e),{id:t.name});e.addEventProcessor(a)}Yt&&kt.log(`Integration installed: ${t.name}`)}function BQ(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function qQ(e,t,s,n){const a={};return t!=null&&t.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),s&&n&&(a.dsn=kp(n)),$d(a,[BQ(e)])}function _F(e,t){const s=t??zQ(e)??[];if(s.length===0)return;const n=e.getOptions(),a=qQ(s,n._metadata,n.tunnel,e.getDsn());jF().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(a)}function zQ(e){return jF().get(e)}function jF(){return Bh("clientToLogBufferMap",()=>new WeakMap)}function HQ(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function VQ(e,t,s,n){const a={};return t!=null&&t.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),s&&n&&(a.dsn=kp(n)),$d(a,[HQ(e)])}function wF(e,t){const s=t??GQ(e)??[];if(s.length===0)return;const n=e.getOptions(),a=VQ(s,n._metadata,n.tunnel,e.getDsn());NF().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(a)}function GQ(e){return NF().get(e)}function NF(){return Bh("clientToMetricBufferMap",()=>new WeakMap)}const eT=Symbol.for("SentryBufferFullError");function tT(e=100){const t=new Set;function s(){return t.size<e}function n(i){t.delete(i)}function a(i){if(!s())return Z5(eT);const l=i();return t.add(l),l.then(()=>n(l),()=>n(l)),l}function o(i){if(!t.size)return Zj(!0);const l=Promise.allSettled(Array.from(t)).then(()=>!0);if(!i)return l;const c=[l,new Promise(u=>setTimeout(()=>u(!1),i))];return Promise.race(c)}return{get $(){return Array.from(t)},add:a,drain:o}}const WQ=60*1e3;function YQ(e,t=Date.now()){const s=parseInt(`${e}`,10);if(!isNaN(s))return s*1e3;const n=Date.parse(`${e}`);return isNaN(n)?WQ:n-t}function KQ(e,t){return e[t]||e.all||0}function kF(e,t,s=Date.now()){return KQ(e,t)>s}function SF(e,{statusCode:t,headers:s},n=Date.now()){const a={...e},o=s==null?void 0:s["x-sentry-rate-limits"],i=s==null?void 0:s["retry-after"];if(o)for(const l of o.trim().split(",")){const[c,u,,,f]=l.split(":",5),h=parseInt(c,10),g=(isNaN(h)?60:h)*1e3;if(!u)a.all=n+g;else for(const v of u.split(";"))v==="metric_bucket"?(!f||f.split(";").includes("custom"))&&(a[v]=n+g):a[v]=n+g}else i?a.all=n+YQ(i,n):t===429&&(a.all=n+60*1e3);return a}const CF=64;function JQ(e,t,s=tT(e.bufferSize||CF)){let n={};const a=i=>s.drain(i);function o(i){const l=[];if(k3(i,(h,g)=>{const v=S3(g);kF(n,v)?e.recordDroppedEvent("ratelimit_backoff",v):l.push(h)}),l.length===0)return Promise.resolve({});const c=$d(i[0],l),u=h=>{k3(c,(g,v)=>{e.recordDroppedEvent(h,S3(v))})},f=()=>t({body:UX(c)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&Yt&&kt.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=SF(n,h),h),h=>{throw u("network_error"),Yt&&kt.error("Encountered error running transport request:",h),h});return s.add(f).then(h=>h,h=>{if(h===eT)return Yt&&kt.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw h})}return{send:o,flush:a}}function XQ(e,t,s){const n=[{type:"client_report"},{timestamp:wp(),discarded_events:e}];return $d(t?{dsn:t}:{},[n])}function EF(e){const t=[];e.message&&t.push(e.message);try{const s=e.exception.values[e.exception.values.length-1];s!=null&&s.value&&(t.push(s.value),s.type&&t.push(`${s.type}: ${s.value}`))}catch{}return t}function QQ(e){var c;const{trace_id:t,parent_span_id:s,span_id:n,status:a,origin:o,data:i,op:l}=((c=e.contexts)==null?void 0:c.trace)??{};return{data:i??{},description:e.transaction,op:l,parent_span_id:s,span_id:n??"",start_timestamp:e.start_timestamp??0,status:a,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:i==null?void 0:i[V5],exclusive_time:i==null?void 0:i[Gh],measurements:e.measurements,is_segment:!0}}function ZQ(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[V5]:e.profile_id},...e.exclusive_time&&{[Gh]:e.exclusive_time}}}},measurements:e.measurements}}const q3="Not capturing exception because it's already been captured.",z3="Discarded session because of missing or non-string release",TF=Symbol.for("SentryInternalError"),RF=Symbol.for("SentryDoNotSendEventError"),eZ=5e3;function r_(e){return{message:e,[TF]:!0}}function wk(e){return{message:e,[RF]:!0}}function H3(e){return!!e&&typeof e=="object"&&TF in e}function V3(e){return!!e&&typeof e=="object"&&RF in e}function G3(e,t,s,n,a){let o=0,i,l=!1;e.on(s,()=>{o=0,clearTimeout(i),l=!1}),e.on(t,c=>{o+=n(c),o>=8e5?a(e):l||(l=!0,i=setTimeout(()=>{a(e)},eZ))}),e.on("flush",()=>{a(e)})}class tZ{constructor(t){var n,a,o;if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=tT(((n=t.transportOptions)==null?void 0:n.bufferSize)??CF),t.dsn?this._dsn=JU(t.dsn):Yt&&kt.warn("No DSN provided, client will not send events."),this._dsn){const i=LQ(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}this._options.enableLogs=this._options.enableLogs??((a=this._options._experiments)==null?void 0:a.enableLogs),this._options.enableLogs&&G3(this,"afterCaptureLog","flushLogs",aZ,_F),(this._options.enableMetrics??((o=this._options._experiments)==null?void 0:o.enableMetrics)??!0)&&G3(this,"afterCaptureMetric","flushMetrics",nZ,wF)}captureException(t,s,n){const a=uo();if(g3(t))return Yt&&kt.log(q3),a;const o={event_id:a,...s};return this._process(()=>this.eventFromException(t,o).then(i=>this._captureEvent(i,o,n)).then(i=>i),"error"),o.event_id}captureMessage(t,s,n,a){const o={event_id:uo(),...n},i=F5(t)?t:String(t),l=ch(t),c=l?this.eventFromMessage(i,s,o):this.eventFromException(t,o);return this._process(()=>c.then(u=>this._captureEvent(u,o,a)),l?"unknown":"error"),o.event_id}captureEvent(t,s,n){const a=uo();if(s!=null&&s.originalException&&g3(s.originalException))return Yt&&kt.log(q3),a;const o={event_id:a,...s},i=t.sdkProcessingMetadata||{},l=i.capturedSpanScope,c=i.capturedSpanIsolationScope,u=W3(t.type);return this._process(()=>this._captureEvent(t,o,l||n,c),u),o.event_id}captureSession(t){this.sendSession(t),uh(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const s=this._transport;if(!s)return!0;
58this.emit("flush");const n=await this._isClientDoneProcessing(t),a=await s.flush(t);return n&&a}async close(t){const s=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),s}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const s=this._integrations[t.name];yF(this,t,this._integrations),s||B3(this,[t])}sendEvent(t,s={}){this.emit("beforeSendEvent",t,s);let n=GX(t,this._dsn,this._options._metadata,this._options.tunnel);for(const a of s.attachments||[])n=$X(n,qX(a));this.sendEnvelope(n).then(a=>this.emit("afterSendEvent",t,a))}sendSession(t){const{release:s,environment:n=K5}=this._options;if("aggregates"in t){const o=t.attrs||{};if(!o.release&&!s){Yt&&kt.warn(z3);return}o.release=o.release||s,o.environment=o.environment||n,t.attrs=o}else{if(!t.release&&!s){Yt&&kt.warn(z3);return}t.release=t.release||s,t.environment=t.environment||n}this.emit("beforeSendSession",t);const a=VX(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(a)}recordDroppedEvent(t,s,n=1){if(this._options.sendClientReports){const a=`${t}:${s}`;Yt&&kt.log(`Recording outcome: "${a}"${n>1?` (${n} times)`:""}`),this._outcomes[a]=(this._outcomes[a]||0)+n}}on(t,s){const n=this._hooks[t]=this._hooks[t]||new Set,a=(...o)=>s(...o);return n.add(a),()=>{n.delete(a)}}emit(t,...s){const n=this._hooks[t];n&&n.forEach(a=>a(...s))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(s){return Yt&&kt.error("Error while sending envelope:",s),{}}return Yt&&kt.error("Transport disabled"),{}}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=FQ(this,t),B3(this,t)}_updateSessionFromEvent(t,s){var c,u;let n=s.level==="fatal",a=!1;const o=(c=s.exception)==null?void 0:c.values;if(o){a=!0,n=!1;for(const f of o)if(((u=f.mechanism)==null?void 0:u.handled)===!1){n=!0;break}}const i=t.status==="ok";(i&&t.errors===0||i&&n)&&(uh(t,{...n&&{status:"crashed"},errors:t.errors||Number(a||n)}),this.captureSession(t))}async _isClientDoneProcessing(t){let s=0;for(;!t||s<t;){if(await new Promise(n=>setTimeout(n,1)),!this._numProcessing)return!0;s++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,s,n,a){const o=this.getOptions(),i=Object.keys(this._integrations);return!s.integrations&&(i!=null&&i.length)&&(s.integrations=i),this.emit("preprocessEvent",t,s),t.type||a.setLastEventId(t.event_id||s.event_id),hF(o,t,s,n,this,a).then(l=>{if(l===null)return l;this.emit("postprocessEvent",l,s),l.contexts={trace:tX(n),...l.contexts};const c=oF(this,n);return l.sdkProcessingMetadata={dynamicSamplingContext:c,...l.sdkProcessingMetadata},l})}_captureEvent(t,s={},n=Qs(),a=vo()){return Yt&&oC(t)&&kt.log(`Captured error event \`${EF(t)[0]||"<unknown>"}\``),this._processEvent(t,s,n,a).then(o=>o.event_id,o=>{Yt&&(V3(o)?kt.log(o.message):H3(o)?kt.warn(o.message):kt.warn(o))})}_processEvent(t,s,n,a){const o=this.getOptions(),{sampleRate:i}=o,l=AF(t),c=oC(t),f=`before send for type \`${t.type||"error"}\``,h=typeof i>"u"?void 0:np(i);if(c&&typeof h=="number"&&Math.random()>h)return this.recordDroppedEvent("sample_rate","error"),Z5(wk(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));const g=W3(t.type);return this._prepareEvent(t,s,n,a).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",g),wk("An event processor returned `null`, will not send event.");if(s.data&&s.data.__sentry__===!0)return v;const _=rZ(this,o,v,s);return sZ(_,f)}).then(v=>{var j;if(v===null){if(this.recordDroppedEvent("before_send",g),l){const k=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",k)}throw wk(`${f} returned \`null\`, will not send event.`)}const y=n.getSession()||a.getSession();if(c&&y&&this._updateSessionFromEvent(y,v),l){const w=((j=v.sdkProcessingMetadata)==null?void 0:j.spanCountBeforeProcessing)||0,k=v.spans?v.spans.length:0,S=w-k;S>0&&this.recordDroppedEvent("before_send","span",S)}const _=v.transaction_info;if(l&&_&&v.transaction!==t.transaction){const w="custom";v.transaction_info={..._,source:w}}return this.sendEvent(v,s),v}).then(null,v=>{throw V3(v)||H3(v)?v:(this.captureException(v,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:v}),r_(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. 59Reason: ${v}`))})}_process(t,s){this._numProcessing++,this._promiseBuffer.add(t).then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n===eT&&this.recordDroppedEvent("queue_overflow",s),n))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([s,n])=>{const[a,o]=s.split(":");return{reason:a,category:o,quantity:n}})}_flushOutcomes(){Yt&&kt.log("Flushing outcomes...");const t=this._clearOutcomes();
59if(t.length===0){Yt&&kt.log("No outcomes to send");return}if(!this._dsn){Yt&&kt.log("No dsn provided, will not send outcomes");return}Yt&&kt.log("Sending outcomes:",t);const s=XQ(t,this._options.tunnel&&kp(this._dsn));this.sendEnvelope(s)}}function W3(e){return e==="replay_event"?"replay":e||"error"}function sZ(e,t){const s=`${t} must return \`null\` or a valid event.`;if(zh(e))return e.then(n=>{if(!Vx(n)&&n!==null)throw r_(s);return n},n=>{throw r_(`${t} rejected with ${n}`)});if(!Vx(e)&&e!==null)throw r_(s);return e}function rZ(e,t,s,n){const{beforeSend:a,beforeSendTransaction:o,beforeSendSpan:i,ignoreSpans:l}=t;let c=s;if(oC(c)&&a)return a(c,n);if(AF(c)){if(i||l){const u=QQ(c);if(l!=null&&l.length&&P_(u,l))return null;if(i){const f=i(u);f?c=Pv(s,ZQ(f)):sC()}if(c.spans){const f=[],h=c.spans;for(const v of h){if(l!=null&&l.length&&P_(v,l)){AX(h,v);continue}if(i){const y=i(v);y?f.push(y):(sC(),f.push(v))}else f.push(v)}const g=c.spans.length-f.length;g&&e.recordDroppedEvent("before_send","span",g),c.spans=f}}if(o){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata={...s.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return o(c,n)}}return c}function oC(e){return e.type===void 0}function AF(e){return e.type==="transaction"}function nZ(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+PF(e.attributes)}function aZ(e){let t=0;return e.message&&(t+=e.message.length*2),t+PF(e.attributes)}function PF(e){if(!e)return 0;let t=0;return Object.values(e).forEach(s=>{Array.isArray(s)?t+=s.length*Y3(s[0]):ch(s)?t+=Y3(s):t+=100}),t}function Y3(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function oZ(e,t){t.debug===!0&&(Yt?kt.enable():jp(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Qs().update(t.initialScope);const n=new e(t);return iZ(n),n.init(),n}function iZ(e){Qs().setClient(e)}const lZ="thismessage:/";function sT(e){return"isRelative"in e}function rT(e,t){const s=e.indexOf("://")<=0&&e.indexOf("//")!==0,n=s?lZ:void 0;try{if("canParse"in URL&&!URL.canParse(e,n))return;const a=new URL(e,n);return s?{isRelative:s,pathname:a.pathname,search:a.search,hash:a.hash}:a}catch{}}function cZ(e){if(sT(e))return e.pathname;const t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function Ju(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const s=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:s,hash:n,relative:t[5]+s+n}}function dZ(e){return e.split(/[?#]/,1)[0]}function uZ(e,t){const s=t==null?void 0:t.getDsn(),n=t==null?void 0:t.getOptions().tunnel;return fZ(e,s)||pZ(e,n)}function pZ(e,t){return t?K3(e)===K3(t):!1}function fZ(e,t){const s=rT(e);return!s||sT(s)?!1:t?s.host.includes(t.host)&&/(^|&|\?)sentry_key=/.test(s.search):!1}function K3(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function hZ(e){var t;"aggregates"in e?((t=e.attrs)==null?void 0:t.ip_address)===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function IF(e,t,s=[t],n="npm"){const a=e._metadata||{};a.sdk||(a.sdk={name:`sentry.javascript.${t}`,packages:s.map(o=>({name:`${n}:@sentry/${o}`,version:Gu})),version:Gu}),e._metadata=a}function MF(e={}){const t=e.client||Os();if(!AQ()||!t)return{};const s=_p(),n=Vh(s);if(n.getTraceData)return n.getTraceData(e);const a=e.scope||Qs(),o=e.span||ka(),i=o?kX(o):mZ(a),l=o?cc(o):oF(t,a),c=dX(l);if(!XU.test(i))return kt.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const f={"sentry-trace":i,baggage:c};return e.propagateTraceparent&&(f.traceparent=o?SX(o):gZ(a)),f}function mZ(e){const{traceId:t,sampled:s,propagationSpanId:n}=e.getPropagationContext();return QU(t,n,s)}function gZ(e){const{traceId:t,sampled:s,propagationSpanId:n}=e.getPropagationContext();return ZU(t,n,s)}function xZ(e,t,s){let n,a,o;const i=s!=null&&s.maxWait?Math.max(s.maxWait,t):0,l=(s==null?void 0:s.setTimeoutImpl)||setTimeout;function c(){return u(),n=e(),n}function u(){a!==void 0&&clearTimeout(a),o!==void 0&&clearTimeout(o),a=o=void 0}function f(){return a!==void 0||o!==void 0?c():n}function h(){return a&&clearTimeout(a),a=l(c,t),i&&o===void 0&&(o=l(c,i)),n}return h.cancel=u,h.flush=f,h}const vZ=100;function Cd(e,t){const s=Os(),n=vo();if(!s)return;const{beforeBreadcrumb:a=null,maxBreadcrumbs:o=vZ}=s.getOptions();if(o<=0)return;const l={timestamp:wp(),...e},c=a?jp(()=>a(l,t)):l;c!==null&&(s.emit&&s.emit("beforeAddBreadcrumb",c,t),n.addBreadcrumb(c,o))}let J3;const bZ="FunctionToString",X3=new WeakMap,yZ=()=>({name:bZ,setupOnce(){J3=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=z5(this),s=X3.has(Os())&&t!==void 0?t:this;return J3.apply(s,e)}}catch{}},setup(e){X3.set(e,!0)}}),_Z=yZ,jZ=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (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$/],wZ="EventFilters",NZ=(e={})=>{let t;return{name:wZ,setup(s){const n=s.getOptions();t=Q3(e,n)},processEvent(s,n,a){if(!t){const o=a.getOptions();t=Q3(e,o)}return SZ(s,t)?null:s}}},kZ=(e={})=>({...NZ(e),name:"InboundFilters"});function Q3(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:jZ],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function SZ(e,t){if(e.type){if(e.type==="transaction"&&EZ(e,t.ignoreTransactions))return Yt&&kt.warn(`Event dropped due to being matched by \`ignoreTransactions\` option. 60Event: ${Mu(e)}`),!0}else{if(CZ(e,t.ignoreErrors))return Yt&&kt.warn(`Event dropped due to being matched by \`ignoreErrors\` option. 61Event: ${Mu(e)}`),!0;if(PZ(e))return Yt&&kt.warn(`Event dropped due to not having an error message, error type or stacktrace. 62Event: ${Mu(e)}`),!0;if(TZ(e,t.denyUrls))return Yt&&kt.warn(`Event dropped due to being matched by \`denyUrls\` option. 63Event: ${Mu(e)}. 64Url: ${I_(e)}`),!0;if(!RZ(e,t.allowUrls))return Yt&&kt.warn(`Event dropped due to not being matched by \`allowUrls\` option. 65Event: ${Mu(e)}. 66Url: ${I_(e)}`),!0}return!1}function CZ(e,t){return t!=null&&t.length?EF(e).some(s=>ec(s,t)):!1}function EZ(e,t){if(!(t!=null&&t.length))return!1;const s=e.transaction;
66return s?ec(s,t):!1}function TZ(e,t){if(!(t!=null&&t.length))return!1;const s=I_(e);return s?ec(s,t):!1}function RZ(e,t){if(!(t!=null&&t.length))return!0;const s=I_(e);return s?ec(s,t):!0}function AZ(e=[]){for(let t=e.length-1;t>=0;t--){const s=e[t];if(s&&s.filename!=="<anonymous>"&&s.filename!=="[native code]")return s.filename||null}return null}function I_(e){var t,s;try{const n=[...((t=e.exception)==null?void 0:t.values)??[]].reverse().find(o=>{var i,l,c;return((i=o.mechanism)==null?void 0:i.parent_id)===void 0&&((c=(l=o.stacktrace)==null?void 0:l.frames)==null?void 0:c.length)}),a=(s=n==null?void 0:n.stacktrace)==null?void 0:s.frames;return a?AZ(a):null}catch{return Yt&&kt.error(`Cannot extract url for event ${Mu(e)}`),null}}function PZ(e){var t,s;return(s=(t=e.exception)==null?void 0:t.values)!=null&&s.length?!e.message&&!e.exception.values.some(n=>n.stacktrace||n.type&&n.type!=="Error"||n.value):!1}function IZ(e,t,s,n,a,o){var l;if(!((l=a.exception)!=null&&l.values)||!o||!oc(o.originalException,Error))return;const i=a.exception.values.length>0?a.exception.values[a.exception.values.length-1]:void 0;i&&(a.exception.values=iC(e,t,n,o.originalException,s,a.exception.values,i,0))}function iC(e,t,s,n,a,o,i,l){if(o.length>=s+1)return o;let c=[...o];if(oc(n[a],Error)){Z3(i,l);const u=e(t,n[a]),f=c.length;eM(u,a,f,l),c=iC(e,t,s,n[a],a,[u,...c],u,f)}return Array.isArray(n.errors)&&n.errors.forEach((u,f)=>{if(oc(u,Error)){Z3(i,l);const h=e(t,u),g=c.length;eM(h,`errors[${f}]`,g,l),c=iC(e,t,s,u,a,[h,...c],h,g)}}),c}function Z3(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function eM(e,t,s,n){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:s,parent_id:n}}function MZ(e){const t="console";Od(t,e),Ld(t,OZ)}function OZ(){"console"in Us&&_J.forEach(function(e){e in Us.console&&$a(Us.console,e,function(t){return T_[e]=t,function(...s){Uo("console",{args:s,level:e});const a=T_[e];a==null||a.apply(Us.console,s)}})})}function OF(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const LZ="Dedupe",DZ=()=>{let e;return{name:LZ,processEvent(t){if(t.type)return t;try{if(UZ(t,e))return Yt&&kt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},$Z=DZ;function UZ(e,t){return t?!!(FZ(e,t)||BZ(e,t)):!1}function FZ(e,t){const s=e.message,n=t.message;return!(!s&&!n||s&&!n||!s&&n||s!==n||!DF(e,t)||!LF(e,t))}function BZ(e,t){const s=tM(t),n=tM(e);return!(!s||!n||s.type!==n.type||s.value!==n.value||!DF(e,t)||!LF(e,t))}function LF(e,t){let s=d3(e),n=d3(t);if(!s&&!n)return!0;if(s&&!n||!s&&n||(s=s,n=n,n.length!==s.length))return!1;for(let a=0;a<n.length;a++){const o=n[a],i=s[a];if(o.filename!==i.filename||o.lineno!==i.lineno||o.colno!==i.colno||o.function!==i.function)return!1}return!0}function DF(e,t){let s=e.fingerprint,n=t.fingerprint;if(!s&&!n)return!0;if(s&&!n||!s&&n)return!1;s=s,n=n;try{return s.join("")===n.join("")}catch{return!1}}function tM(e){var t,s;return(s=(t=e.exception)==null?void 0:t.values)==null?void 0:s[0]}function qZ(e,t,s,n,a){if(!e.fetchData)return;const{method:o,url:i}=e.fetchData,l=pi()&&t(i);if(e.endTimestamp&&l){const v=e.fetchData.__span;if(!v)return;const y=n[v];y&&(VZ(y,e),zZ(y,e,a),delete n[v]);return}const{spanOrigin:c="auto.http.browser",propagateTraceparent:u=!1}=typeof a=="object"?a:{spanOrigin:a},f=!!ka(),h=l&&f?Wh(WZ(i,o,c)):new Sd;if(e.fetchData.__span=h.spanContext().spanId,n[h.spanContext().spanId]=h,s(e.fetchData.url)){const v=e.args[0],y=e.args[1]||{},_=HZ(v,y,pi()&&f?h:void 0,u);_&&(e.args[1]=y,y.headers=_)}const g=Os();if(g){const v={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};g.emit("beforeOutgoingRequestSpan",h,v)}return h}function zZ(e,t,s){var a;const n=typeof s=="object"&&s!==null?s.onRequestSpanEnd:void 0;n==null||n(e,{headers:(a=t.response)==null?void 0:a.headers,error:t.error})}function HZ(e,t,s,n){const a=MF({span:s,propagateTraceparent:n}),o=a["sentry-trace"],i=a.baggage,l=a.traceparent;if(!o)return;const c=t.headers||(B5(e)?e.headers:void 0);if(c)if(GZ(c)){const u=new Headers(c);if(u.get("sentry-trace")||u.set("sentry-trace",o),n&&l&&!u.get("traceparent")&&u.set("traceparent",l),i){const f=u.get("baggage");f?wy(f)||u.set("baggage",`${f},${i}`):u.set("baggage",i)}return u}else if(Array.isArray(c)){const u=[...c];c.find(h=>h[0]==="sentry-trace")||u.push(["sentry-trace",o]),n&&l&&!c.find(h=>h[0]==="traceparent")&&u.push(["traceparent",l]);const f=c.find(h=>h[0]==="baggage"&&wy(h[1]));return i&&!f&&u.push(["baggage",i]),u}else{const u="sentry-trace"in c?c["sentry-trace"]:void 0,f="traceparent"in c?c.traceparent:void 0,h="baggage"in c?c.baggage:void 0,g=h?Array.isArray(h)?[...h]:[h]:[],v=h&&(Array.isArray(h)?h.find(_=>wy(_)):wy(h));i&&!v&&g.push(i);const y={...c,"sentry-trace":u??o,baggage:g.length>0?g.join(","):void 0};return n&&l&&!f&&(y.traceparent=l),y}else return{...a}}function VZ(e,t){var s,n;if(t.response){VU(e,t.response.status);const a=(n=(s=t.response)==null?void 0:s.headers)==null?void 0:n.get("content-length");if(a){const o=parseInt(a);o>0&&e.setAttribute("http.response_content_length",o)}}else t.error&&e.setStatus({code:vn,message:"internal_error"});e.end()}function wy(e){return e.split(",").some(t=>t.trim().startsWith(W5))}function GZ(e){return typeof Headers<"u"&&oc(e,Headers)}function WZ(e,t,s){const n=rT(e);return{name:n?`${t} ${cZ(n)}`:t,attributes:YZ(e,n,t,s)}}function YZ(e,t,s,n){const a={url:e,type:"fetch","http.method":s,[wn]:n,[lc]:"http.client"};return t&&(sT(t)||(a["http.url"]=t.href,a["server.address"]=t.host),t.search&&(a["http.query"]=t.search),t.hash&&(a["http.fragment"]=t.hash)),a}function $F(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const Yx=Us;function KZ(){return"history"in Yx&&!!Yx.history}function JZ(){if(!("fetch"in Yx))return!1;
66try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function lC(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function XZ(){var s;if(typeof EdgeRuntime=="string")return!0;if(!JZ())return!1;if(lC(Yx.fetch))return!0;let e=!1;const t=Yx.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),(s=n.contentWindow)!=null&&s.fetch&&(e=lC(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){Yt&&kt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function UF(e,t){const s="fetch";Od(s,e),Ld(s,()=>FF(void 0,t))}function QZ(e){const t="fetch-body-resolved";Od(t,e),Ld(t,()=>FF(eee))}function FF(e,t=!1){t&&!XZ()||$a(Us,"fetch",function(s){return function(...n){const a=new Error,{method:o,url:i}=tee(n),l={args:n,fetchData:{method:o,url:i},startTimestamp:An()*1e3,virtualError:a,headers:see(n)};return e||Uo("fetch",{...l}),s.apply(Us,n).then(async c=>(e?e(c):Uo("fetch",{...l,endTimestamp:An()*1e3,response:c}),c),c=>{if(Uo("fetch",{...l,endTimestamp:An()*1e3,error:c}),Jj(c)&&c.stack===void 0&&(c.stack=a.stack,ho(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const u=new URL(l.fetchData.url);c.message=`${c.message} (${u.host})`}catch{}throw c})}})}async function ZZ(e,t){if(e!=null&&e.body){const s=e.body,n=s.getReader(),a=setTimeout(()=>{s.cancel().then(null,()=>{})},90*1e3);let o=!0;for(;o;){let i;try{i=setTimeout(()=>{s.cancel().then(null,()=>{})},5e3);const{done:l}=await n.read();clearTimeout(i),l&&(t(),o=!1)}catch{o=!1}finally{clearTimeout(i)}}clearTimeout(a),n.releaseLock(),s.cancel().then(null,()=>{})}}function eee(e){let t;try{t=e.clone()}catch{return}ZZ(t,()=>{Uo("fetch-body-resolved",{endTimestamp:An()*1e3,response:e})})}function n_(e,t){return!!e&&typeof e=="object"&&!!e[t]}function sM(e){return typeof e=="string"?e:e?n_(e,"url")?e.url:e.toString?e.toString():"":""}function tee(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[s,n]=e;return{url:sM(s),method:n_(n,"method")?String(n.method).toUpperCase():B5(s)&&n_(s,"method")?String(s.method).toUpperCase():"GET"}}const t=e[0];return{url:sM(t),method:n_(t,"method")?String(t.method).toUpperCase():"GET"}}function see(e){const[t,s]=e;try{if(typeof s=="object"&&s!==null&&"headers"in s&&s.headers)return new Headers(s.headers);if(B5(t))return new Headers(t.headers)}catch{}}function ree(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function nee(){return"npm"}function aee(){return!ree()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function cC(){return typeof window<"u"&&(!aee()||oee())}function oee(){const e=Us.process;return(e==null?void 0:e.type)==="renderer"}const Ms=Us;let dC=0;function BF(){return dC>0}function iee(){dC++,setTimeout(()=>{dC--})}function hh(e,t={}){function s(a){return typeof a=="function"}if(!s(e))return e;try{const a=e.__sentry_wrapped__;if(a)return typeof a=="function"?a:e;if(z5(e))return e}catch{return e}const n=function(...a){try{const o=a.map(i=>hh(i,t));return e.apply(this,o)}catch(o){throw iee(),Np(i=>{i.addEventProcessor(l=>(t.mechanism&&(Z2(l,void 0),dh(l,t.mechanism)),l.extra={...l.extra,arguments:a},l)),Ku(o)}),o}};try{for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a])}catch{}FU(n,e),ho(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return e.name}})}catch{}return n}function nT(){const e=Hh(),{referrer:t}=Ms.document||{},{userAgent:s}=Ms.navigator||{},n={...t&&{Referer:t},...s&&{"User-Agent":s}};return{url:e,headers:n}}function aT(e,t){const s=oT(e,t),n={type:pee(t),value:fee(t)};return s.length&&(n.stacktrace={frames:s}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function lee(e,t,s,n){const a=Os(),o=a==null?void 0:a.getOptions().normalizeDepth,i=vee(t),l={__serialized__:iF(t,o)};if(i)return{exception:{values:[aT(e,i)]},extra:l};const c={exception:{values:[{type:Xj(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:gee(t,{isUnhandledRejection:n})}]},extra:l};if(s){const u=oT(e,s);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function Nk(e,t){return{exception:{values:[aT(e,t)]}}}function oT(e,t){const s=t.stacktrace||t.stack||"",n=dee(t),a=uee(t);try{return e(s,n,a)}catch{}return[]}const cee=/Minified React error #\d+;/i;function dee(e){return e&&cee.test(e.message)?1:0}function uee(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function qF(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function pee(e){const t=e==null?void 0:e.name;return!t&&qF(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function fee(e){const t=e==null?void 0:e.message;return qF(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function hee(e,t,s,n){const a=(s==null?void 0:s.syntheticException)||void 0,o=iT(e,t,a,n);return dh(o),o.level="error",s!=null&&s.event_id&&(o.event_id=s.event_id),Zj(o)}function mee(e,t,s="info",n,a){const o=(n==null?void 0:n.syntheticException)||void 0,i=uC(e,t,o,a);return i.level=s,n!=null&&n.event_id&&(i.event_id=n.event_id),Zj(i)}function iT(e,t,s,n,a){let o;if(DU(t)&&t.error)return Nk(e,t.error);if(p3(t)||PJ(t)){const i=t;if("stack"in t)o=Nk(e,t);else{const l=i.name||(p3(i)?"DOMError":"DOMException"),c=i.message?`${l}: ${i.message}`:l;o=uC(e,c,s,n),Z2(o,c)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Jj(t)?Nk(e,t):Vx(t)||Xj(t)?(o=lee(e,t,s,a),dh(o,{synthetic:!0}),o):(o=uC(e,t,s,n),Z2(o,`${t}`),dh(o,{synthetic:!0}),o)}function uC(e,t,s,n){const a={};if(n&&s){const o=oT(e,s);o.length&&(a.exception={values:[{value:t,stacktrace:{frames:o}}]}),dh(a,{synthetic:!0})}
66if(F5(t)){const{__sentry_template_string__:o,__sentry_template_values__:i}=t;return a.logentry={message:o,params:i},a}return a.message=t,a}function gee(e,{isUnhandledRejection:t}){const s=$J(e),n=t?"promise rejection":"exception";return DU(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:Xj(e)?`Event \`${xee(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${s}`}function xee(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function vee(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const s=e[t];if(s instanceof Error)return s}}class bee extends tZ{constructor(t){var f;const s=yee(t),n=Ms.SENTRY_SDK_SOURCE||nee();IF(s,"browser",["browser"],n),(f=s._metadata)!=null&&f.sdk&&(s._metadata.sdk.settings={infer_ip:s.sendDefaultPii?"auto":"never",...s._metadata.sdk.settings}),super(s);const{sendDefaultPii:a,sendClientReports:o,enableLogs:i,_experiments:l,enableMetrics:c}=this._options,u=c??(l==null?void 0:l.enableMetrics)??!0;Ms.document&&(o||i||u)&&Ms.document.addEventListener("visibilitychange",()=>{Ms.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),i&&_F(this),u&&wF(this))}),a&&this.on("beforeSendSession",hZ)}eventFromException(t,s){return hee(this._options.stackParser,t,s,this._options.attachStacktrace)}eventFromMessage(t,s="info",n){return mee(this._options.stackParser,t,s,n,this._options.attachStacktrace)}_prepareEvent(t,s,n,a){return t.platform=t.platform||"javascript",super._prepareEvent(t,s,n,a)}}function yee(e){var t;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(t=Ms.SENTRY_RELEASE)==null?void 0:t.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const ap=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ps=Us,_ee=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",Ov=(e,t,s,n)=>{let a,o;return i=>{t.value>=0&&(i||n)&&(o=t.value-(a??0),(o||a===void 0)&&(a=t.value,t.delta=o,t.rating=_ee(t.value,s),e(t)))}},Lv=(e=!0)=>{var s,n;const t=(n=(s=ps.performance)==null?void 0:s.getEntriesByType)==null?void 0:n.call(s,"navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Yh=()=>{const e=Lv();return(e==null?void 0:e.activationStart)??0};function Xu(e,t,s){ps.document&&ps.addEventListener(e,t,s)}function lT(e,t,s){ps.document&&ps.removeEventListener(e,t,s)}let Jf=-1;const zF=new Set,jee=()=>{var e,t;return((e=ps.document)==null?void 0:e.visibilityState)==="hidden"&&!((t=ps.document)!=null&&t.prerendering)?0:1/0},a_=e=>{if(wee(e)&&Jf>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of zF)t();isFinite(Jf)||(Jf=e.type==="visibilitychange"?e.timeStamp:0,lT("prerenderingchange",a_,!0))}},Dv=()=>{var e;if(ps.document&&Jf<0){const t=Yh();Jf=(ps.document.prerendering||(e=globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>t)[0])==null?void 0:e.startTime)??jee(),Xu("visibilitychange",a_,!0),Xu("pagehide",a_,!0),Xu("prerenderingchange",a_,!0)}return{get firstHiddenTime(){return Jf},onHidden(t){zF.add(t)}}};function wee(e){var t;return e.type==="pagehide"||((t=ps.document)==null?void 0:t.visibilityState)==="hidden"}const Nee=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,$v=(e,t=-1)=>{var o,i;const s=Lv();let n="navigate";return s&&((o=ps.document)!=null&&o.prerendering||Yh()>0?n="prerender":(i=ps.document)!=null&&i.wasDiscarded?n="restore":s.type&&(n=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:Nee(),navigationType:n}},kk=new WeakMap;function cT(e,t){return kk.get(e)||kk.set(e,new t),kk.get(e)}class M_{constructor(){M_.prototype.__init.call(this),M_.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(t){var a;if(t.hadRecentInput)return;const s=this._sessionEntries[0],n=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&s&&n&&t.startTime-n.startTime<1e3&&t.startTime-s.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),(a=this._onAfterProcessingUnexpectedShift)==null||a.call(this,t)}}const Kh=(e,t,s={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(a=>{Promise.resolve().then(()=>{t(a.getEntries())})});return n.observe({type:e,buffered:!0,...s}),n}}catch{}},dT=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ew=e=>{var t;(t=ps.document)!=null&&t.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},kee=[1800,3e3],See=(e,t={})=>{ew(()=>{const s=Dv(),n=$v("FCP");let a;const i=Kh("paint",l=>{for(const c of l)c.name==="first-contentful-paint"&&(i.disconnect(),c.startTime<s.firstHiddenTime&&(n.value=Math.max(c.startTime-Yh(),0),n.entries.push(c),a(!0)))});i&&(a=Ov(e,n,kee,t.reportAllChanges))})},Cee=[.1,.25],Eee=(e,t={})=>
66{See(dT(()=>{var c;const s=$v("CLS",0);let n;const a=Dv(),o=cT(t,M_),i=u=>{for(const f of u)o._processEntry(f);o._sessionValue>s.value&&(s.value=o._sessionValue,s.entries=o._sessionEntries,n())},l=Kh("layout-shift",i);l&&(n=Ov(e,s,Cee,t.reportAllChanges),a.onHidden(()=>{i(l.takeRecords()),n(!0)}),(c=ps==null?void 0:ps.setTimeout)==null||c.call(ps,n))}))};let HF=0,Sk=1/0,Ny=0;const Tee=e=>{e.forEach(t=>{t.interactionId&&(Sk=Math.min(Sk,t.interactionId),Ny=Math.max(Ny,t.interactionId),HF=Ny?(Ny-Sk)/7+1:0)})};let pC;const VF=()=>pC?HF:performance.interactionCount||0,Ree=()=>{"interactionCount"in performance||pC||(pC=Kh("event",Tee,{type:"event",buffered:!0,durationThreshold:0}))},Ck=10;let GF=0;const Aee=()=>VF()-GF;class O_{constructor(){O_.prototype.__init.call(this),O_.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){GF=VF(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(Aee()/50));return this._longestInteractionList[t]}_processEntry(t){var a,o;if((a=this._onBeforeProcessingEntry)==null||a.call(this,t),!(t.interactionId||t.entryType==="first-input"))return;const s=this._longestInteractionList.at(-1);let n=this._longestInteractionMap.get(t.interactionId);if(n||this._longestInteractionList.length<Ck||t.duration>s._latency){if(n?t.duration>n._latency?(n.entries=[t],n._latency=t.duration):t.duration===n._latency&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(n.id,n),this._longestInteractionList.push(n)),this._longestInteractionList.sort((i,l)=>l._latency-i._latency),this._longestInteractionList.length>Ck){const i=this._longestInteractionList.splice(Ck);for(const l of i)this._longestInteractionMap.delete(l.id)}(o=this._onAfterProcessingINPCandidate)==null||o.call(this,n)}}}const WF=e=>{const t=s=>{var n;(s.type==="pagehide"||((n=ps.document)==null?void 0:n.visibilityState)==="hidden")&&e(s)};Xu("visibilitychange",t,!0),Xu("pagehide",t,!0)},YF=e=>{var s;const t=ps.requestIdleCallback||ps.setTimeout;((s=ps.document)==null?void 0:s.visibilityState)==="hidden"?e():(e=dT(e),Xu("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),lT("visibilitychange",e,{capture:!0})}),WF(e))},Pee=[200,500],Iee=40,Mee=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const s=Dv();ew(()=>{Ree();const n=$v("INP");let a;const o=cT(t,O_),i=c=>{YF(()=>{for(const f of c)o._processEntry(f);const u=o._estimateP98LongestInteraction();u&&u._latency!==n.value&&(n.value=u._latency,n.entries=u.entries,a())})},l=Kh("event",i,{durationThreshold:t.durationThreshold??Iee});a=Ov(e,n,Pee,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),s.onHidden(()=>{i(l.takeRecords()),a(!0)}))})};class Oee{_processEntry(t){var s;(s=this._onBeforeProcessingEntry)==null||s.call(this,t)}}const Lee=[2500,4e3],Dee=(e,t={})=>{ew(()=>{const s=Dv(),n=$v("LCP");let a;const o=cT(t,Oee),i=c=>{t.reportAllChanges||(c=c.slice(-1));for(const u of c)o._processEntry(u),u.startTime<s.firstHiddenTime&&(n.value=Math.max(u.startTime-Yh(),0),n.entries=[u],a())},l=Kh("largest-contentful-paint",i);if(l){a=Ov(e,n,Lee,t.reportAllChanges);const c=dT(()=>{i(l.takeRecords()),l.disconnect(),a(!0)}),u=f=>{f.isTrusted&&(YF(c),lT(f.type,u,{capture:!0}))};for(const f of["keydown","click","visibilitychange"])Xu(f,u,{capture:!0})}})},$ee=[800,1800],fC=e=>{var t,s;(t=ps.document)!=null&&t.prerendering?ew(()=>fC(e)):((s=ps.document)==null?void 0:s.readyState)!=="complete"?addEventListener("load",()=>fC(e),!0):setTimeout(e)},Uee=(e,t={})=>{const s=$v("TTFB"),n=Ov(e,s,$ee,t.reportAllChanges);fC(()=>{const a=Lv();a&&(s.value=Math.max(a.responseStart-Yh(),0),s.entries=[a],n(!0))})},bx={},L_={};let KF,JF,XF,QF;function uT(e,t=!1){return tw("cls",e,Bee,KF,t)}function pT(e,t=!1){return tw("lcp",e,qee,JF,t)}function Fee(e){return tw("ttfb",e,zee,XF)}function ZF(e){return tw("inp",e,Hee,QF)}function op(e,t){return e8(e,t),L_[e]||(Vee(e),L_[e]=!0),t8(e,t)}function Uv(e,t){const s=bx[e];if(s!=null&&s.length)for(const n of s)try{n(t)}catch(a){ap&&kt.error(`Error while triggering instrumentation handler. 67Type: ${e} 68Name: ${ac(n)} 69Error:`,a)}}function Bee(){return Eee(e=>{Uv("cls",{metric:e}),KF=e},{reportAllChanges:!0})}function qee(){return Dee(e=>{Uv("lcp",{metric:e}),JF=e},{reportAllChanges:!0})}function zee(){return Uee(e=>{Uv("ttfb",{metric:e}),XF=e})}function Hee(){return Mee(e=>{Uv("inp",{metric:e}),QF=e})}function tw(e,t,s,n,a=!1){e8(e,t);let o;return L_[e]||(o=s(),L_[e]=!0),n&&t({metric:n}),t8(e,t,a?o:void 0)}function Vee(e){const t={};e==="event"&&(t.durationThreshold=0),Kh(e,s=>{Uv(e,{entries:s})},t)}function e8(e,t){bx[e]=bx[e]||[],bx[e].push(t)}function t8(e,t,s){return()=>{s&&s();const n=bx[e];if(!n)return;const a=n.indexOf(t);a!==-1&&n.splice(a,1)}}function Gee(e){return"duration"in e}function Ek(e){return typeof e=="number"&&isFinite(e)}function Ed(e,t,s,{...n}){const a=Hs(e).start_timestamp;return a&&a>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),X5(e,()=>{const o=Wh({startTime:t,...n});return o&&o.end(s),o})}function fT(e){var j;const t=Os();if(!t)return;const{name:s,transaction:n,attributes:a,startTime:o}=e,{release:i,environment:l,sendDefaultPii:c}=t.getOptions(),u=t.getIntegrationByName("Replay"),f=u==null?void 0:u.getReplayId(),h=Qs(),g=h.getUser(),v=g!==void 0?g.email||g.id||g.ip_address:void 0;let y;try{y=h.getScopeData().contexts.profile.profile_id}catch{}const _={release:i,environment:l,user:v||void 0,profile_id:y||void 0,replay_id:f||void 0,transaction:n,"user_agent.original":(j=ps.navigator)==null?void 0:j.userAgent,"client.address":c?"{{auto}}":void 0,...a};return Wh({name:s,attributes:_,startTime:o,experimental:{standalone:!0}})}function Fv(){return ps.addEventListener&&ps.performance}function Vr(e){return e/1e3}function Wee(e){let t="unknown",s="unknown",n="";for(const a of e){if(a==="/"){[t,s]=e.split("/");break}if(!isNaN(Number(a))){t=n==="h"?"http":n,s=e.split(n)[1];break}n+=a}
69return n===e&&(t=n),{name:t,version:s}}function s8(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function r8(e,t){let s,n=!1;function a(l){!n&&s&&t(l,s),n=!0}WF(()=>{a("pagehide")});const o=e.on("beforeStartNavigationSpan",(l,c)=>{c!=null&&c.isRedirect||(a("navigation"),o(),i())}),i=e.on("afterStartPageLoadSpan",l=>{s=l.spanContext().spanId,i()})}function Yee(e){let t=0,s;if(!s8("layout-shift"))return;const n=uT(({metric:a})=>{const o=a.entries[a.entries.length-1];o&&(t=a.value,s=o)},!0);r8(e,(a,o)=>{Kee(t,s,o,a),n()})}function Kee(e,t,s,n){var u;ap&&kt.log(`Sending CLS span (${e})`);const a=t?Vr((Va()||0)+t.startTime):An(),o=Qs().getScopeData().transactionName,i=t?Ba((u=t.sources[0])==null?void 0:u.node):"Layout shift",l={[wn]:"auto.http.browser.cls",[lc]:"ui.webvital.cls",[Gh]:0,"sentry.pageload.span_id":s,"sentry.report_event":n};t!=null&&t.sources&&t.sources.forEach((f,h)=>{l[`cls.source.${h+1}`]=Ba(f.node)});const c=fT({name:i,transaction:o,attributes:l,startTime:a});c&&(c.addEvent("cls",{[Iv]:"",[Mv]:e}),c.end(a))}function Jee(e){let t=0,s;if(!s8("largest-contentful-paint"))return;const n=pT(({metric:a})=>{const o=a.entries[a.entries.length-1];o&&(t=a.value,s=o)},!0);r8(e,(a,o)=>{Xee(t,s,o,a),n()})}function Xee(e,t,s,n){ap&&kt.log(`Sending LCP span (${e})`);const a=Vr((Va()||0)+((t==null?void 0:t.startTime)||0)),o=Qs().getScopeData().transactionName,i=t?Ba(t.element):"Largest contentful paint",l={[wn]:"auto.http.browser.lcp",[lc]:"ui.webvital.lcp",[Gh]:0,"sentry.pageload.span_id":s,"sentry.report_event":n};t&&(t.element&&(l["lcp.element"]=Ba(t.element)),t.id&&(l["lcp.id"]=t.id),t.url&&(l["lcp.url"]=t.url),t.loadTime!=null&&(l["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(l["lcp.renderTime"]=t.renderTime),t.size!=null&&(l["lcp.size"]=t.size));const c=fT({name:i,transaction:o,attributes:l,startTime:a});c&&(c.addEvent("lcp",{[Iv]:"millisecond",[Mv]:e}),c.end(a))}function Ao(e){return e&&((Va()||performance.timeOrigin)+e)/1e3}function n8(e){var s;const t={};if(e.nextHopProtocol!=null){const{name:n,version:a}=Wee(e.nextHopProtocol);t["network.protocol.version"]=a,t["network.protocol.name"]=n}return Va()||(s=Fv())!=null&&s.timeOrigin?Qee({...t,"http.request.redirect_start":Ao(e.redirectStart),"http.request.redirect_end":Ao(e.redirectEnd),"http.request.worker_start":Ao(e.workerStart),"http.request.fetch_start":Ao(e.fetchStart),"http.request.domain_lookup_start":Ao(e.domainLookupStart),"http.request.domain_lookup_end":Ao(e.domainLookupEnd),"http.request.connect_start":Ao(e.connectStart),"http.request.secure_connection_start":Ao(e.secureConnectionStart),"http.request.connection_end":Ao(e.connectEnd),"http.request.request_start":Ao(e.requestStart),"http.request.response_start":Ao(e.responseStart),"http.request.response_end":Ao(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function Qee(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const Zee=2147483647;let rM=0,li={},Ia,Ff;function ete({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:s}){const n=Fv();if(n&&Va()){n.mark&&ps.performance.mark("sentry-tracing-init");const a=t?Jee(s):ate(),o=ote(),i=e?Yee(s):nte();return()=>{a==null||a(),o(),i==null||i()}}return()=>{}}function tte(){op("longtask",({entries:e})=>{const t=ka();if(!t)return;const{op:s,start_timestamp:n}=Hs(t);for(const a of e){const o=Vr(Va()+a.startTime),i=Vr(a.duration);s==="navigation"&&n&&o<n||Ed(t,o,o+i,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[wn]:"auto.ui.browser.metrics"}})}})}function ste(){new PerformanceObserver(t=>{const s=ka();if(s)for(const n of t.getEntries()){if(!n.scripts[0])continue;const a=Vr(Va()+n.startTime),{start_timestamp:o,op:i}=Hs(s);if(i==="navigation"&&o&&a<o)continue;const l=Vr(n.duration),c={[wn]:"auto.ui.browser.metrics"},u=n.scripts[0],{invoker:f,invokerType:h,sourceURL:g,sourceFunctionName:v,sourceCharPosition:y}=u;c["browser.script.invoker"]=f,c["browser.script.invoker_type"]=h,g&&(c["code.filepath"]=g),v&&(c["code.function"]=v),y!==-1&&(c["browser.script.source_char_position"]=y),Ed(s,a,a+l,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:c})}}).observe({type:"long-animation-frame",buffered:!0})}function rte(){op("event",({entries:e})=>{const t=ka();if(t){for(const s of e)if(s.name==="click"){const n=Vr(Va()+s.startTime),a=Vr(s.duration),o={name:Ba(s.target),op:`ui.interaction.${s.name}`,startTime:n,attributes:{[wn]:"auto.ui.browser.metrics"}},i=UU(s.target);i&&(o.attributes["ui.component_name"]=i),Ed(t,n,n+a,o)}}})}function nte(){return uT(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(li.cls={value:e.value,unit:""},Ff=t)},!0)}function ate(){return pT(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(li.lcp={value:e.value,unit:"millisecond"},Ia=t)},!0)}function ote(){return Fee(({metric:e})=>{e.entries[e.entries.length-1]&&(li.ttfb={value:e.value,unit:"millisecond"})})}function ite(e,t){const s=Fv(),n=Va();if(!(s!=null&&s.getEntries)||!n)return;const a=Vr(n),o=s.getEntries(),{op:i,start_timestamp:l}=Hs(e);
69o.slice(rM).forEach(c=>{const u=Vr(c.startTime),f=Vr(Math.max(0,c.duration));if(!(i==="navigation"&&l&&a+u<l))switch(c.entryType){case"navigation":{ute(e,c,a);break}case"mark":case"paint":case"measure":{cte(e,c,u,f,a,t.ignorePerformanceApiSpans);const h=Dv(),g=c.startTime<h.firstHiddenTime;c.name==="first-paint"&&g&&(li.fp={value:c.startTime,unit:"millisecond"}),c.name==="first-contentful-paint"&&g&&(li.fcp={value:c.startTime,unit:"millisecond"});break}case"resource":{hte(e,c,c.name,u,f,a,t.ignoreResourceSpans);break}}}),rM=Math.max(o.length-1,0),mte(e),i==="pageload"&&(vte(li),t.recordClsOnPageloadSpan||delete li.cls,t.recordLcpOnPageloadSpan||delete li.lcp,Object.entries(li).forEach(([c,u])=>{JX(c,u.value,u.unit)}),e.setAttribute("performance.timeOrigin",a),e.setAttribute("performance.activationStart",Yh()),gte(e,t)),Ia=void 0,Ff=void 0,li={}}function lte(e){if((e==null?void 0:e.entryType)==="measure")try{return e.detail.devtools.track==="Components â"}catch{return}}function cte(e,t,s,n,a,o){if(lte(t)||["mark","measure"].includes(t.entryType)&&ec(t.name,o))return;const i=Lv(!1),l=Vr(i?i.requestStart:0),c=a+Math.max(s,l),u=a+s,f=u+n,h={[wn]:"auto.resource.browser.metrics"};c!==u&&(h["sentry.browser.measure_happened_before_request"]=!0,h["sentry.browser.measure_start_time"]=c),dte(h,t),c<=f&&Ed(e,c,f,{name:t.name,op:t.entryType,attributes:h})}function dte(e,t){try{const s=t.detail;if(!s)return;if(typeof s=="object"){for(const[n,a]of Object.entries(s))if(a&&ch(a))e[`sentry.browser.measure.detail.${n}`]=a;else if(a!==void 0)try{e[`sentry.browser.measure.detail.${n}`]=JSON.stringify(a)}catch{}return}if(ch(s)){e["sentry.browser.measure.detail"]=s;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(s)}catch{}}catch{}}function ute(e,t,s){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(n=>{ky(e,t,n,s)}),ky(e,t,"secureConnection",s,"TLS/SSL"),ky(e,t,"fetch",s,"cache"),ky(e,t,"domainLookup",s,"DNS"),fte(e,t,s)}function ky(e,t,s,n,a=s){const o=pte(s),i=t[o],l=t[`${s}Start`];!l||!i||Ed(e,n+Vr(l),n+Vr(i),{op:`browser.${a}`,name:t.name,attributes:{[wn]:"auto.ui.browser.metrics",...s==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function pte(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function fte(e,t,s){const n=s+Vr(t.requestStart),a=s+Vr(t.responseEnd),o=s+Vr(t.responseStart);t.responseEnd&&(Ed(e,n,a,{op:"browser.request",name:t.name,attributes:{[wn]:"auto.ui.browser.metrics"}}),Ed(e,o,a,{op:"browser.response",name:t.name,attributes:{[wn]:"auto.ui.browser.metrics"}}))}function hte(e,t,s,n,a,o,i){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const l=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(i!=null&&i.includes(l))return;const c={[wn]:"auto.resource.browser.metrics"},u=Ju(s);u.protocol&&(c["url.scheme"]=u.protocol.split(":").pop()),u.host&&(c["server.address"]=u.host),c["url.same_origin"]=s.includes(ps.location.origin),xte(t,c,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const f={...c,...n8(t)},h=o+n,g=h+a;Ed(e,h,g,{name:s.replace(ps.location.origin,""),op:l,attributes:f})}function mte(e){const t=ps.navigator;if(!t)return;const s=t.connection;s&&(s.effectiveType&&e.setAttribute("effectiveConnectionType",s.effectiveType),s.type&&e.setAttribute("connectionType",s.type),Ek(s.rtt)&&(li["connection.rtt"]={value:s.rtt,unit:"millisecond"})),Ek(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Ek(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function gte(e,t){Ia&&t.recordLcpOnPageloadSpan&&(Ia.element&&e.setAttribute("lcp.element",Ba(Ia.element)),Ia.id&&e.setAttribute("lcp.id",Ia.id),Ia.url&&e.setAttribute("lcp.url",Ia.url.trim().slice(0,200)),Ia.loadTime!=null&&e.setAttribute("lcp.loadTime",Ia.loadTime),Ia.renderTime!=null&&e.setAttribute("lcp.renderTime",Ia.renderTime),e.setAttribute("lcp.size",Ia.size)),Ff!=null&&Ff.sources&&t.recordClsOnPageloadSpan&&Ff.sources.forEac
69h((s,n)=>e.setAttribute(`cls.source.${n+1}`,Ba(s.node)))}function xte(e,t,s){s.forEach(([n,a])=>{const o=e[n];o!=null&&(typeof o=="number"&&o<Zee||typeof o=="string")&&(t[a]=o)})}function vte(e){const t=Lv(!1);if(!t)return;const{responseStart:s,requestStart:n}=t;n<=s&&(e["ttfb.requestTime"]={value:s-n,unit:"millisecond"})}function bte(){return Fv()&&Va()?op("element",yte):()=>{}}const yte=({entries:e})=>{const t=ka(),s=t?la(t):void 0,n=s?Hs(s).description:Qs().getScopeData().transactionName;e.forEach(a=>{var v,y;const o=a;if(!o.identifier)return;const i=o.name,l=o.renderTime,c=o.loadTime,[u,f]=c?[Vr(c),"load-time"]:l?[Vr(l),"render-time"]:[An(),"entry-emission"],h=i==="image-paint"?Vr(Math.max(0,(l??0)-(c??0))):0,g={[wn]:"auto.ui.browser.elementtiming",[lc]:"ui.elementtiming",[di]:"component","sentry.span_start_time_source":f,"sentry.transaction_name":n,"element.id":o.id,"element.type":((y=(v=o.element)==null?void 0:v.tagName)==null?void 0:y.toLowerCase())||"unknown","element.size":o.naturalWidth&&o.naturalHeight?`${o.naturalWidth}x${o.naturalHeight}`:void 0,"element.render_time":l,"element.load_time":c,"element.url":o.url||void 0,"element.identifier":o.identifier,"element.paint_type":i};sQ({name:`element[${o.identifier}]`,attributes:g,startTime:u,onlyIfParent:!0},_=>{_.end(u+h)})})},_te=1e3;let nM,hC,mC;function a8(e){const t="dom";Od(t,e),Ld(t,jte)}function jte(){if(!ps.document)return;const e=Uo.bind(null,"dom"),t=aM(e,!0);ps.document.addEventListener("click",t,!1),ps.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(s=>{var o,i;const a=(o=ps[s])==null?void 0:o.prototype;(i=a==null?void 0:a.hasOwnProperty)!=null&&i.call(a,"addEventListener")&&($a(a,"addEventListener",function(l){return function(c,u,f){if(c==="click"||c=="keypress")try{const h=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},g=h[c]=h[c]||{refCount:0};if(!g.handler){const v=aM(e);g.handler=v,l.call(this,c,v,f)}g.refCount++}catch{}return l.call(this,c,u,f)}}),$a(a,"removeEventListener",function(l){return function(c,u,f){if(c==="click"||c=="keypress")try{const h=this.__sentry_instrumentation_handlers__||{},g=h[c];g&&(g.refCount--,g.refCount<=0&&(l.call(this,c,g.handler,f),g.handler=void 0,delete h[c]),Object.keys(h).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return l.call(this,c,u,f)}}))})}function wte(e){if(e.type!==hC)return!1;try{if(!e.target||e.target._sentryId!==mC)return!1}catch{}return!0}function Nte(e,t){return e!=="keypress"?!1:t!=null&&t.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function aM(e,t=!1){return s=>{if(!s||s._sentryCaptured)return;const n=kte(s);if(Nte(s.type,n))return;ho(s,"_sentryCaptured",!0),n&&!n._sentryId&&ho(n,"_sentryId",uo());const a=s.type==="keypress"?"input":s.type;wte(s)||(e({event:s,name:a,global:t}),hC=s.type,mC=n?n._sentryId:void 0),clearTimeout(nM),nM=ps.setTimeout(()=>{mC=void 0,hC=void 0},_te)}}function kte(e){try{return e.target}catch{return null}}let Sy;function sw(e){const t="history";Od(t,e),Ld(t,Ste)}function Ste(){if(ps.addEventListener("popstate",()=>{const t=ps.location.href,s=Sy;if(Sy=t,s===t)return;Uo("history",{from:s,to:t})}),!KZ())return;function e(t){return function(...s){const n=s.length>2?s[2]:void 0;if(n){const a=Sy,o=Cte(String(n));if(Sy=o,a===o)return t.apply(this,s);Uo("history",{from:a,to:o})}return t.apply(this,s)}}$a(ps.history,"pushState",e),$a(ps.history,"replaceState",e)}function Cte(e){try{return new URL(e,ps.location.origin).toString()}catch{return e}}const o_={};function o8(e){const t=o_[e];if(t)return t;let s=ps[e];if(lC(s))return o_[e]=s.bind(ps);const n=ps.document;if(n&&typeof n.createElement=="function")try{const a=n.createElement("iframe");a.hidden=!0,n.head.appendChild(a);const o=a.contentWindow;o!=null&&o[e]&&(s=o[e]),n.head.removeChild(a)}catch(a){ap&&kt.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,a)}return s&&(o_[e]=s.bind(ps))}function Ete(e){o_[e]=void 0}function Bv(...e){return o8("setTimeout")(...e)}const Fu="__sentry_xhr_v3__";function i8(e){const t="xhr";Od(t,e),Ld(t,Tte)}function Tte(){if(!ps.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,s,n){const a=new Error,o=An()*1e3,i=Zl(n[0])?n[0].toUpperCase():void 0,l=Rte(n[1]);if(!i||!l)return t.apply(s,n);s[Fu]={method:i,url:l,request_headers:{}}
69,i==="POST"&&l.match(/sentry_key/)&&(s.__sentry_own_request__=!0);const c=()=>{const u=s[Fu];if(u&&s.readyState===4){try{u.status_code=s.status}catch{}const f={endTimestamp:An()*1e3,startTimestamp:o,xhr:s,virtualError:a};Uo("xhr",f)}};return"onreadystatechange"in s&&typeof s.onreadystatechange=="function"?s.onreadystatechange=new Proxy(s.onreadystatechange,{apply(u,f,h){return c(),u.apply(f,h)}}):s.addEventListener("readystatechange",c),s.setRequestHeader=new Proxy(s.setRequestHeader,{apply(u,f,h){const[g,v]=h,y=f[Fu];return y&&Zl(g)&&Zl(v)&&(y.request_headers[g.toLowerCase()]=v),u.apply(f,h)}}),t.apply(s,n)}}),e.send=new Proxy(e.send,{apply(t,s,n){const a=s[Fu];if(!a)return t.apply(s,n);n[0]!==void 0&&(a.body=n[0]);const o={startTimestamp:An()*1e3,xhr:s};return Uo("xhr",o),t.apply(s,n)}})}function Rte(e){if(Zl(e))return e;try{return e.toString()}catch{}}const Ate=Symbol.for("sentry__originalRequestBody");function l8(e){return new URLSearchParams(e).toString()}function c8(e,t=kt){try{if(typeof e=="string")return[e];if(e instanceof URLSearchParams)return[e.toString()];if(e instanceof FormData)return[l8(e)];if(!e)return[void 0]}catch(s){return ap&&t.error(s,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return ap&&t.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function d8(e=[]){if(e.length>=2&&e[1]&&typeof e[1]=="object"&&"body"in e[1])return e[1].body;if(e.length>=1&&e[0]instanceof Request){const s=e[0][Ate];return s!==void 0?s:void 0}}function u8(e){let t;try{t=e.getAllResponseHeaders()}catch(s){return ap&&kt.error(s,"Failed to get xhr response headers",e),{}}return t?t.split(`\r 70`).reduce((s,n)=>{const[a,o]=n.split(": ");return o&&(s[a.toLowerCase()]=o),s},{}):{}}const Tk=[],i_=new Map,mf=new Map,Pte=60;function Ite(){if(Fv()&&Va()){const t=Mte();return()=>{t()}}return()=>{}}const gC={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 Mte(){return ZF(Ote)}const Ote=({metric:e})=>{if(e.value==null)return;const t=Vr(e.value);if(t>Pte)return;const s=e.entries.find(y=>y.duration===e.value&&gC[y.name]);if(!s)return;const{interactionId:n}=s,a=gC[s.name],o=Vr(Va()+s.startTime),i=ka(),l=i?la(i):void 0,c=n!=null?i_.get(n):void 0,u=(c==null?void 0:c.span)||l,f=u?Hs(u).description:Qs().getScopeData().transactionName,h=(c==null?void 0:c.elementName)||Ba(s.target),g={[wn]:"auto.http.browser.inp",[lc]:`ui.interaction.${a}`,[Gh]:s.duration},v=fT({name:h,transaction:f,attributes:g,startTime:o});v&&(v.addEvent("inp",{[Iv]:"millisecond",[Mv]:e.value}),v.end(o+t))};function Lte(){const e=Object.keys(gC);cC()&&e.forEach(a=>{ps.addEventListener(a,t,{capture:!0,passive:!0})});function t(a){const o=a.target;if(!o)return;const i=Ba(o),l=Math.round(a.timeStamp);if(mf.set(l,i),mf.size>50){const c=mf.keys().next().value;c!==void 0&&mf.delete(c)}}function s(a){const o=Math.round(a.startTime);let i=mf.get(o);if(!i)for(let l=-5;l<=5;l++){const c=mf.get(o+l);if(c){i=c;break}}return i||"<unknown>"}const n=({entries:a})=>{const o=ka(),i=o&&la(o);a.forEach(l=>{if(!Gee(l))return;const c=l.interactionId;if(c==null||i_.has(c))return;const u=l.target?Ba(l.target):s(l);if(Tk.length>10){const f=Tk.shift();i_.delete(f)}Tk.push(c),i_.set(c,{span:i,elementName:u})})};op("event",n),op("first-input",n)}const Dte=40;function $te(e,t=o8("fetch")){let s=0,n=0;async function a(o){const i=o.body.length;s+=i,n++;const l={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:s<=6e4&&n<15,...e.fetchOptions};try{const c=await t(e.url,l);return{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}}catch(c){throw Ete("fetch"),c}finally{s-=i,n--}}
70return JQ(e,a,tT(e.bufferSize||Dte))}const qa=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ute=30,Fte=50;function xC(e,t,s,n){const a={filename:e,function:t==="<anonymous>"?rp:t,in_app:!0};return s!==void 0&&(a.lineno=s),n!==void 0&&(a.colno=n),a}const Bte=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qte=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,zte=/\((\S*)(?::(\d+))(?::(\d+))\)/,Hte=/at (.+?) ?\(data:(.+?),/,Vte=e=>{const t=e.match(Hte);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const s=Bte.exec(e);if(s){const[,a,o,i]=s;return xC(a,rp,+o,+i)}const n=qte.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){const l=zte.exec(n[2]);l&&(n[2]=l[1],n[3]=l[2],n[4]=l[3])}const[o,i]=p8(n[1]||rp,n[2]);return xC(i,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Gte=[Ute,Vte],Wte=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Yte=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Kte=e=>{const t=Wte.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const o=Yte.exec(t[3]);o&&(t[1]=t[1]||"eval",t[3]=o[1],t[4]=o[2],t[5]="")}let n=t[3],a=t[1]||rp;return[a,n]=p8(a,n),xC(n,a,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Jte=[Fte,Kte],Xte=[Gte,Jte],Qte=PU(...Xte),p8=(e,t)=>{const s=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return s||n?[e.indexOf("@")!==-1?e.split("@")[0]:rp,s?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Cy=1024,Zte="Breadcrumbs",ese=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Zte,setup(s){t.console&&MZ(nse(s)),t.dom&&a8(rse(s,t.dom)),t.xhr&&i8(ase(s)),t.fetch&&UF(ose(s)),t.history&&sw(ise(s)),t.sentry&&s.on("beforeSendEvent",sse(s))}}},tse=ese;function sse(e){return function(s){Os()===e&&Cd({category:`sentry.${s.type==="transaction"?"transaction":"event"}`,event_id:s.event_id,level:s.level,message:Mu(s)},{event:s})}}function rse(e,t){return function(n){if(Os()!==e)return;let a,o,i=typeof t=="object"?t.serializeAttribute:void 0,l=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;l&&l>Cy&&(qa&&kt.warn(`\`dom.maxStringLength\` cannot exceed ${Cy}, but a value of ${l} was configured. Sentry will use ${Cy} instead.`),l=Cy),typeof i=="string"&&(i=[i]);try{const u=n.event,f=lse(u)?u.target:u;a=Ba(f,{keyAttrs:i,maxStringLength:l}),o=UU(f)}catch{a="<unknown>"}if(a.length===0)return;const c={category:`ui.${n.name}`,message:a};o&&(c.data={"ui.component_name":o}),Cd(c,{event:n.event,name:n.name,global:n.global})}}function nse(e){return function(s){if(Os()!==e)return;const n={category:"console",data:{arguments:s.args,logger:"console"},level:OF(s.level),message:m3(s.args," ")};if(s.level==="assert")if(s.args[0]===!1)n.message=`Assertion failed: ${m3(s.args.slice(1)," ")||"console.assert"}`,n.data.arguments=s.args.slice(1);else return;Cd(n,{input:s.args,level:s.level})}}function ase(e){return function(s){if(Os()!==e)return;const{startTimestamp:n,endTimestamp:a}=s,o=s.xhr[Fu];if(!n||!a||!o)return;const{method:i,url:l,status_code:c,body:u}=o,f={method:i,url:l,status_code:c},h={xhr:s.xhr,input:u,startTimestamp:n,endTimestamp:a},g={category:"xhr",data:f,type:"http",level:$F(c)};e.emit("beforeOutgoingRequestBreadcrumb",g,h),Cd(g,h)}}function ose(e){return function(s){if(Os()!==e)return;const{startTimestamp:n,endTimestamp:a}=s;if(a&&!(s.fetchData.url.match(/sentry_key/)&&s.fetchData.method==="POST"))if(s.fetchData.method,s.fetchData.url,s.error){const o=s.fetchData,i={data:s.error,input:s.args,startTimestamp:n,endTimestamp:a},l={category:"fetch",data:o,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",l,i),Cd(l,i)}else{const o=s.response,i={...s.fetchData,status_code:o==null?void 0:o.status};s.fetchData.request_body_size,s.fetchData.response_body_size,o==null||o.status;const l={input:s.args,response:o,startTimestamp:n,endTimestamp:a},c={category:"fetch",data:i,type:"http",level:$F(i.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,l),Cd(c,l)}}}function ise(e){return function(s){if(Os()!==e)return;let n=s.from,a=s.to;const o=Ju(Ms.location.href);let i=n?Ju(n):void 0;const l=Ju(a);i!=null&&i.path||(i=o),o.protocol===l.protocol&&o.host===l.host&&(a=l.relative),o.protocol===i.protocol&&o.host===i.host&&(n=i.relative),Cd({category:"navigation",data:{from:n,to:a}})}}function lse(e){return!!e&&!!e.target}const cse=["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"],dse="BrowserApiErrors",use=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:dse,setupOnce(){t.setTimeout&&$a(Ms,"setTimeout",oM),t.setInterval&&$a(Ms,"setInterval",oM),t.requestAnimationFrame&&$a(Ms,"requestAnimationFrame",fse),t.XMLHttpRequest&&"XMLHttpRequest"in Ms&&$a(XMLHttpRequest.prototype,"send",hse);const s=t.eventTarget;s&&(Array.isArray(s)?s:cse).forEach(a=>mse(a,t))}}},pse=use;function oM(e){return function(...t){const s=t[0];return t[0]=hh(s,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ac(e)}`}}),e.apply(this,t)}}function fse(e){return function(t){return e.apply(this,[hh(t,{mechanism:{data:{handler:ac(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function hse(e){return function(...t){const s=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(a=>{a in s&&typeof s[a]=="function"&&$a(s,a,function(o){const i={mechanism:{data:{handler:ac(o)},handled:!1,type:`auto.browser.browserapierrors.xhr.${a}`}},l=z5(o);return l&&(i.mechanism.data.handler=ac(l)),hh(o,i)})}),e.apply(this,t)}}function mse(e,t){var a,o;const n=(a=Ms[e])==null?void 0:a.prototype;(o=n==null?void 0:n.hasOwnProperty)!=null&&o.call(n,"addEventListener")&&($a(n,"addEventListener",function(i){return function(l,c,u){try{gse(c)&&(c.handleEvent=hh(c.handleEvent,{mechanism:{data:{handler:ac(c),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&xse(this,l,c),i.apply(this,[l,hh(c,{mechanism:{data:{handler:ac(c),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),u])}}),$a(n,"removeEventListener",function(i){return function(l,c,u){try{const f=c.__sentry_wrapped__;f&&i.call(this,l,f,u)}catch{}return i.call(this,l,c,u)}}))}function gse(e){return typeof e.handleEvent=="function"}function xse(e,t,s){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,s)}const vse=()=>({name:"BrowserSession",setupOnce(){if(typeof Ms.document>"u"){qa&&kt.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}$3({ignoreDuration:!0}),U3(),sw(({from:e,to:t})=>{e!==void 0&&e!==t&&($3({ignoreDuration:!0}),U3())})}}),bse="GlobalHandlers",yse=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:bse,setupOnce(){Error.stackTraceLimit=50},setup(s){t.onerror&&(jse(s),iM("onerror")),t.onunhandledrejection&&(wse(s),iM("onunhandledrejection"))}}},_se=yse;function jse(e){MU(t=>{const{stackParser:s,attachStacktrace:n}=f8();if(Os()!==e||BF())return;const{msg:a,url:o,line:i,column:l,error:c}=t,u=Sse(iT(s,c||a,void 0,n,!1),o,i,l);u.level="error",mF(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function wse(e){OU(t=>{const{stackParser:s,attachStacktrace:n}=f8();if(Os()!==e||BF())return;const a=Nse(t),o=ch(a)?kse(a):iT(s,a,void 0,n,!0);o.level="error",mF(o,{originalException:a,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function Nse(e){if(ch(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function kse(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function Sse(e,t,s,n){const a=e.exception=e.exception||{},o=a.values=a.values||[],i=o[0]=o[0]||{},l=i.stacktrace=i.stacktrace||{},c=l.frames=l.frames||[],u=n,f=s,h=Cse(t)??Hh();
70return c.length===0&&c.push({colno:u,filename:h,function:rp,in_app:!0,lineno:f}),e}function iM(e){qa&&kt.log(`Global Handler attached: ${e}`)}function f8(){const e=Os();return(e==null?void 0:e.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function Cse(e){if(!(!Zl(e)||e.length===0)){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/),s=t?t[1]:"text/javascript",n=e.includes("base64,");return`<data:${s}${n?",base64":""}>`}return e}}const Ese=()=>({name:"HttpContext",preprocessEvent(e){var n;if(!Ms.navigator&&!Ms.location&&!Ms.document)return;const t=nT(),s={...t.headers,...(n=e.request)==null?void 0:n.headers};e.request={...t,...e.request,headers:s}}}),Tse="cause",Rse=5,Ase="LinkedErrors",Pse=(e={})=>{const t=e.limit||Rse,s=e.key||Tse;return{name:Ase,preprocessEvent(n,a,o){const i=o.getOptions();IZ(aT,i.stackParser,s,t,n,a)}}},Ise=Pse;function Mse(){return Ose()?(qa&&jp(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function Ose(){var o;if(typeof Ms.window>"u")return!1;const e=Ms;if(e.nw)return!1;const t=e.chrome||e.browser;if(!((o=t==null?void 0:t.runtime)!=null&&o.id))return!1;const s=Hh(),n=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Ms===Ms.top&&n.some(i=>s.startsWith(`${i}://`)))}function Lse(e){return[kZ(),_Z(),pse(),tse(),_se(),Ise(),$Z(),Ese(),vse()]}function Dse(e={}){const t=!e.skipBrowserExtensionCheck&&Mse();let s=e.defaultIntegrations==null?Lse():e.defaultIntegrations;const n={...e,enabled:t?!1:e.enabled,stackParser:EJ(e.stackParser||Qte),integrations:UQ({integrations:e.integrations,defaultIntegrations:s}),transport:e.transport||$te};return oZ(bee,n)}function lM(e={}){const t=Ms.document,s=(t==null?void 0:t.head)||(t==null?void 0:t.body);if(!s){qa&&kt.error("[showReportDialog] Global document not defined");return}const n=Qs(),a=Os(),o=a==null?void 0:a.getDsn();if(!o){qa&&kt.error("[showReportDialog] DSN not configured");return}const i={...e,user:{...n.getUser(),...e.user},eventId:e.eventId||RQ()},l=Ms.document.createElement("script");l.async=!0,l.crossOrigin="anonymous",l.src=DQ(o,i);const{onLoad:c,onClose:u}=i;if(c&&(l.onload=c),u){const f=h=>{if(h.data==="__sentry_reportdialog_closed__")try{u()}finally{Ms.removeEventListener("message",f)}};Ms.addEventListener("message",f)}s.appendChild(l)}const br=Us,hT="sentryReplaySession",$se="replay_event",mT="Unable to send Replay",Use=3e5,Fse=9e5,Bse=5e3,qse=5500,zse=6e4,Hse=5e3,Vse=3,cM=15e4,Ey=5e3,Gse=3e3,Wse=300,gT=2e7,Yse=4999,Kse=5e4,dM=36e5;var Jse=Object.defineProperty,Xse=(e,t,s)=>t in e?Jse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,uM=(e,t,s)=>Xse(e,typeof t!="symbol"?t+"":t,s),rn=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(rn||{});function Qse(e){return e.nodeType===e.ELEMENT_NODE}function yx(e){const t=e==null?void 0:e.host;return(t==null?void 0:t.shadowRoot)===e}function _x(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Zse(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function ere(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const s=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?s.push("layer"):e.layerName&&s.push(`layer(${e.layerName})`),e.supportsText&&s.push(`supports(${e.supportsText})`),e.media.length&&s.push(e.media.mediaText),s.join(" ")+";"}function D_(e){try{const t=e.rules||e.cssRules;return t?Zse(Array.from(t,h8).join("")):null}catch{return null}}function tre(e){let t="";for(let s=0;s<e.style.length;s++){const n=e.style,a=n[s],o=n.getPropertyPriority(a);t+=`${a}:${n.getPropertyValue(a)}${o?" !important":""};`}return`${e.selectorText} { ${t} }`}function h8(e){let t;if(rre(e))try{t=D_(e.styleSheet)||ere(e)}catch{}else if(nre(e)){let s=e.cssText;const n=e.selectorText.includes(":"),a=typeof e.style.all=="string"&&e.style.all;if(a&&(s=tre(e)),n&&(s=sre(s)),n||a)return s}return t||e.cssText}function sre(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function rre(e){return"styleSheet"in e}function nre(e){return"selectorText"in e}class m8{constructor(){uM(this,"idNodeMap",new Map),uM(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);
70this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const n=s.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,s)}replace(t,s){const n=this.getNode(t);if(n){const a=this.nodeMetaMap.get(n);a&&this.nodeMetaMap.set(s,a)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function are(){return new m8}function rw({maskInputOptions:e,tagName:t,type:s}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||s&&e[s]||s==="password"||t==="INPUT"&&!s&&e.text)}function Kx({isMasked:e,element:t,value:s,maskInputFn:n}){let a=s||"";return e?(n&&(a=n(a,t)),"*".repeat(a.length)):a}function mh(e){return e.toLowerCase()}function vC(e){return e.toUpperCase()}const pM="__rrweb_original__";function ore(e){const t=e.getContext("2d");if(!t)return!0;const s=50;for(let n=0;n<e.width;n+=s)for(let a=0;a<e.height;a+=s){const o=t.getImageData,i=pM in o?o[pM]:o;if(new Uint32Array(i.call(t,n,a,Math.min(s,e.width-n),Math.min(s,e.height-a)).data.buffer).some(c=>c!==0))return!1}return!0}function xT(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?mh(t):null}function $_(e,t,s){return t==="INPUT"&&(s==="radio"||s==="checkbox")?e.getAttribute("value")||"":e.value}function g8(e,t){let s;try{s=new URL(e,t??window.location.href)}catch{return null}const n=/\.([0-9a-z]+)(?:$)/i,a=s.pathname.match(n);return(a==null?void 0:a[1])??null}const fM={};function x8(e){const t=fM[e];if(t)return t;const s=window.document;let n=window[e];if(s&&typeof s.createElement=="function")try{const a=s.createElement("iframe");a.hidden=!0,s.head.appendChild(a);const o=a.contentWindow;o&&o[e]&&(n=o[e]),s.head.removeChild(a)}catch{}return fM[e]=n.bind(window)}function bC(...e){return x8("setTimeout")(...e)}function v8(...e){return x8("clearTimeout")(...e)}function b8(e){try{return e.contentDocument}catch{}}let ire=1;const lre=new RegExp("[^a-z0-9-_:]"),Jx=-2;function vT(){return ire++}function cre(e){if(e instanceof HTMLFormElement)return"form";const t=mh(e.tagName);return lre.test(t)?"div":t}function dre(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let gf,hM;const ure=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,pre=/^(?:[a-z+]+:)?\/\//i,fre=/^www\..*/i,hre=/^(data:)([^,]*),(.*)/i;function mre(e,t){if(!e||t.size===0)return e;try{const s=e.split(";"),n=[];for(let a of s){if(a=a.trim(),!a)continue;const o=a.indexOf(":");if(o===-1){n.push(a);continue}const i=a.slice(0,o).trim();t.has(i)||n.push(a)}return n.join("; ")+(n.length>0&&e.endsWith(";")?";":"")}catch(s){return console.warn("Error filtering CSS properties:",s),e}}function U_(e,t){return(e||"").replace(ure,(s,n,a,o,i,l)=>{const c=a||i||l,u=n||o||"";if(!c)return s;if(pre.test(c)||fre.test(c))return`url(${u}${c}${u})`;if(hre.test(c))return`url(${u}${c}${u})`;if(c[0]==="/")return`url(${u}${dre(t)+c}${u})`;const f=t.split("/"),h=c.split("/");f.pop();for(const g of h)g!=="."&&(g===".."?f.pop():f.push(g));return`url(${u}${f.join("/")}${u})`})}const gre=/^[^ \t\n\r\u000c]+/,xre=/^[, \t\n\r\u000c]+/;function vre(e,t){if(t.trim()==="")return t;let s=0;function n(o){let i;const l=o.exec(t.substring(s));return l?(i=l[0],s+=i.length,i):""}const a=[];for(;n(xre),!(s>=t.length);){let o=n(gre);if(o.slice(-1)===",")o=Bf(e,o.substring(0,o.length-1)),a.push(o);else{let i="";o=Bf(e,o);let l=!1;for(;;){const c=t.charAt(s);if(c===""){a.push((o+i).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){s+=1,a.push((o+i).trim());break}else c==="("&&(l=!0);i+=c,s+=1}}}return a.join(", ")}const mM=new WeakMap;function Bf(e,t){return!t||t.trim()===""?t:nw(e,t)}function bre(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function nw(e,t){let s=mM.get(e);if(s||(s=e.createElement("a"),mM.set(e,s)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return s.setAttribute("href",t),s.href}function y8(e,t,s,n,a,o,i){if(!n)return n;if(s==="src"||s==="href"&&!(t==="use"&&n[0]==="#"))return Bf(e,n);if(s==="xlink:href"&&n[0]!=="#")return Bf(e,n);if(s==="background"&&(t==="table"||t==="td"||t==="th"))return Bf(e,n);if(s==="srcset")return vre(e,n);if(s==="style"){let l=U_(n,nw(e));return i&&i.size>0&&(l=mre(l,i)),l}else if(t==="object"&&s==="data")return Bf(e,n);return typeof o=="function"?o(s,n,a):n}
70function _8(e,t,s){return(e==="video"||e==="audio")&&t==="autoplay"}function yre(e,t,s,n){try{if(n&&e.matches(n))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let a=e.classList.length;a--;){const o=e.classList[a];if(t.test(o))return!0}if(s)return e.matches(s)}catch{}return!1}function _re(e,t){for(let s=e.classList.length;s--;){const n=e.classList[s];if(t.test(n))return!0}return!1}function Bu(e,t,s=1/0,n=0){return!e||e.nodeType!==e.ELEMENT_NODE||n>s?-1:t(e)?n:Bu(e.parentNode,t,s,n+1)}function qf(e,t){return s=>{const n=s;if(n===null)return!1;try{if(e){if(typeof e=="string"){if(n.matches(`.${e}`))return!0}else if(_re(n,e))return!0}return!!(t&&n.matches(t))}catch{return!1}}}function gh(e,t,s,n,a,o){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(i.tagName==="INPUT"){const u=i.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let l=-1,c=-1;if(o){if(c=Bu(i,qf(n,a)),c<0)return!0;l=Bu(i,qf(t,s),c>=0?c:1/0)}else{if(l=Bu(i,qf(t,s)),l<0)return!1;c=Bu(i,qf(n,a),l>=0?l:1/0)}return l>=0?c>=0?l<=c:!0:c>=0?!1:!!o}catch{}return!!o}function jre(e,t,s){const n=e.contentWindow;if(!n)return;let a=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){const l=bC(()=>{a||(t(),a=!0)},s);e.addEventListener("load",()=>{v8(l),a=!0,t()});return}const i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return bC(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function wre(e,t,s){let n=!1,a;try{a=e.sheet}catch{return}if(a)return;const o=bC(()=>{n||(t(),n=!0)},s);e.addEventListener("load",()=>{v8(o),n=!0,t()})}function Nre(e,t){const{doc:s,mirror:n,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:l,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:f,maskTextSelector:h,unmaskTextSelector:g,inlineStylesheet:v,maskInputOptions:y={},maskTextFn:_,maskInputFn:j,dataURLOptions:w={}
70,inlineImages:k,recordCanvas:S,keepIframeSrcFn:E,newlyAddedElement:T=!1,ignoreCSSAttributes:A}=t,R=kre(s,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:rn.Document,childNodes:[],compatMode:e.compatMode}:{type:rn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:rn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:R};case e.ELEMENT_NODE:return Cre(e,{doc:s,blockClass:a,blockSelector:o,unblockSelector:i,inlineStylesheet:v,maskAttributeFn:c,maskInputOptions:y,maskInputFn:j,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:E,newlyAddedElement:T,rootId:R,maskTextClass:u,unmaskTextClass:f,maskTextSelector:h,unmaskTextSelector:g,ignoreCSSAttributes:A});case e.TEXT_NODE:return Sre(e,{doc:s,maskAllText:l,maskTextClass:u,unmaskTextClass:f,maskTextSelector:h,unmaskTextSelector:g,maskTextFn:_,maskInputOptions:y,maskInputFn:j,rootId:R});case e.CDATA_SECTION_NODE:return{type:rn.CDATA,textContent:"",rootId:R};case e.COMMENT_NODE:return{type:rn.Comment,textContent:e.textContent||"",rootId:R};default:return!1}}function kre(e,t){if(!t.hasNode(e))return;const s=t.getId(e);return s===1?void 0:s}function Sre(e,t){var w;const{maskAllText:s,maskTextClass:n,unmaskTextClass:a,maskTextSelector:o,unmaskTextSelector:i,maskTextFn:l,maskInputOptions:c,maskInputFn:u,rootId:f}=t,h=e.parentNode&&e.parentNode.tagName;let g=e.textContent;const v=h==="STYLE"?!0:void 0,y=h==="SCRIPT"?!0:void 0,_=h==="TEXTAREA"?!0:void 0;if(v&&g){try{e.nextSibling||e.previousSibling||(w=e.parentNode.sheet)!=null&&w.cssRules&&(g=D_(e.parentNode.sheet))}catch(k){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${k}`,e)}g=U_(g,nw(t.doc))}y&&(g="SCRIPT_PLACEHOLDER");const j=gh(e,n,o,a,i,s);if(!v&&!y&&!_&&g&&j&&(g=l?l(g,e.parentElement):g.replace(/[\S]/g,"*")),_&&g&&(c.textarea||j)&&(g=u?u(g,e.parentNode):g.replace(/[\S]/g,"*")),h==="OPTION"&&g){const k=rw({type:null,tagName:h,maskInputOptions:c});g=Kx({isMasked:gh(e,n,o,a,i,k),element:e,value:g,maskInputFn:u})}return{type:rn.Text,textContent:g||"",isStyle:v,rootId:f}}function Cre(e,t){const{doc:s,blockClass:n,blockSelector:a,unblockSelector:o,inlineStylesheet:i,maskInputOptions:l={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:f={},inlineImages:h,recordCanvas:g,keepIframeSrcFn:v,newlyAddedElement:y=!1,rootId:_,maskTextClass:j,unmaskTextClass:w,maskTextSelector:k,unmaskTextSelector:S,ignoreCSSAttributes:E}=t,T=yre(e,n,a,o),A=cre(e);let R={};const I=e.attributes.length;for(let M=0;M<I;M++){const O=e.attributes[M];O.name&&!_8(A,O.name,O.value)&&(R[O.name]=y8(s,A,mh(O.name),O.value,e,c,E))}if(A==="link"&&i){const M=Array.from(s.styleSheets).find(z=>z.href===e.href);let O=null;M&&(O=D_(M)),O&&(R.rel=null,R.href=null,R.crossorigin=null,R._cssText=U_(O,M.href))}if(A==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const M=D_(e.sheet);M&&(R._cssText=U_(M,nw(s)))}if(A==="input"||A==="textarea"||A==="select"||A==="option"){const M=e,O=xT(M),z=$_(M,vC(A),O),X=M.checked;if(O!=="submit"&&O!=="button"&&z){const W=gh(M,j,k,w,S,rw({type:O,tagName:vC(A),maskInputOptions:l}));R.value=Kx({isMasked:W,element:M,value:z,maskInputFn:u})}X&&(R.checked=X)}if(A==="option"&&(e.selected&&!l.select?R.selected=!0:delete R.selected),A==="canvas"&&g){if(e.__context==="2d")ore(e)||(R.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){const M=e.toDataURL(f.type,f.quality),O=s.createElement("canvas");O.width=e.width,O.height=e.height;const z=O.toDataURL(f.type,f.quality);M!==z&&(R.rr_dataURL=M)}}if(A==="img"&&h){gf||(gf=s.createElement("canvas"),hM=gf.getContext("2d"));const M=e,O=M.currentSrc||M.getAttribute("src")||"<unknown-src>",z=M.crossOrigin,X=()=>{M.removeEventListener("load",X);try{gf.width=M.naturalWidth,gf.height=M.naturalHeight,hM.drawImage(M,0,0),R.rr_dataURL=gf.toDataURL(f.type,f.quality)}catch(W){if(M.crossOrigin!=="anonymous"){M.crossOrigin="anonymous",M.complete&&M.naturalWidth!==0?X():M.addEventListener("load",X);return}else console.warn(`Cannot inline img src=${O}! Error: ${W}`)}M.crossOrigin==="anonymous"&&(z?R.crossOrigin=z:M.removeAttribute("crossorigin"))};
70M.complete&&M.naturalWidth!==0?X():M.addEventListener("load",X)}if((A==="audio"||A==="video")&&(R.rr_mediaState=e.paused?"paused":"played",R.rr_mediaCurrentTime=e.currentTime),y||(e.scrollLeft&&(R.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(R.rr_scrollTop=e.scrollTop)),T){const{width:M,height:O}=e.getBoundingClientRect();R={class:R.class,rr_width:`${M}px`,rr_height:`${O}px`}}A==="iframe"&&!v(R.src)&&(!T&&!b8(e)&&(R.rr_src=R.src),delete R.src);let L;try{customElements.get(A)&&(L=!0)}catch{}return{type:rn.Element,tagName:A,attributes:R,childNodes:[],isSVG:bre(e)||void 0,needBlock:T,rootId:_,isCustom:L}}function xr(e){return e==null?"":e.toLowerCase()}function Ere(e,t){if(t.comment&&e.type===rn.Comment)return!0;if(e.type===rn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&g8(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(xr(e.attributes.name).match(/^msapplication-tile(image|color)$/)||xr(e.attributes.name)==="application-name"||xr(e.attributes.rel)==="icon"||xr(e.attributes.rel)==="apple-touch-icon"||xr(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&xr(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(xr(e.attributes.property).match(/^(og|twitter|fb):/)||xr(e.attributes.name).match(/^(og|twitter):/)||xr(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(xr(e.attributes.name)==="robots"||xr(e.attributes.name)==="googlebot"||xr(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(xr(e.attributes.name)==="author"||xr(e.attributes.name)==="generator"||xr(e.attributes.name)==="framework"||xr(e.attributes.name)==="publisher"||xr(e.attributes.name)==="progid"||xr(e.attributes.property).match(/^article:/)||xr(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(xr(e.attributes.name)==="google-site-verification"||xr(e.attributes.name)==="yandex-verification"||xr(e.attributes.name)==="csrf-token"||xr(e.attributes.name)==="p:domain_verify"||xr(e.attributes.name)==="verify-v1"||xr(e.attributes.name)==="verification"||xr(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function zf(e,t){const{doc:s,mirror:n,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:l,maskTextClass:c,unmaskTextClass:u,maskTextSelector:f,unmaskTextSelector:h,skipChild:g=!1,inlineStylesheet:v=!0,maskInputOptions:y={},maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOMOptions:k,dataURLOptions:S={},inlineImages:E=!1,recordCanvas:T=!1,onSerialize:A,onIframeLoad:R,iframeLoadTimeout:I=5e3,onBlockedImageLoad:L,onStylesheetLoad:M,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:z=()=>!1,newlyAddedElement:X=!1,ignoreCSSAttributes:W}=t;let{preserveWhiteSpace:K=!0}=t;const q=Nre(e,{doc:s,mirror:n,blockClass:a,blockSelector:o,maskAllText:l,unblockSelector:i,maskTextClass:c,unmaskTextClass:u,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:v,maskInputOptions:y,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,dataURLOptions:S,inlineImages:E,recordCanvas:T,keepIframeSrcFn:z,newlyAddedElement:X,ignoreCSSAttributes:W});if(!q)return console.warn(e,"not serialized"),null;let J;n.hasNode(e)?J=n.getId(e):Ere(q,k)||!K&&q.type===rn.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?J=Jx:J=vT();const F=Object.assign(q,{id:J});if(n.add(e,F),J===Jx)return null;A&&A(e);let V=!g;if(F.type===rn.Element){V=V&&!F.needBlock;const $=e.shadowRoot;$&&_x($)&&(F.isShadowHost=!0)}if((F.type===rn.Document||F.type===rn.Element)&&V){k.headWhitespace&&F.type===rn.Element&&F.tagName==="head"&&(K=!1);const $={doc:s,mirror:n,blockClass:a,blockSelector:o,maskAllText:l,unblockSelector:i,maskTextClass:c,unmaskTextClass:u,maskTextSelector:f,unmaskTextSelector:h,skipChild:g,inlineStylesheet:v,maskInputOptions:y,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOMOptions:k,dataURLOptions:S,inlineImages:E,recordCanvas:T,preserveWhiteSpace:K,onSerialize:A,onIframeLoad:R,iframeLoadTimeout:I,onBlockedImageLoad:L,onStylesheetLoad:M,stylesheetLoadTimeout:O,keepIframeSrcFn:z,ignoreCSSAttributes:W},B=e.childNodes?Array.from(e.childNodes):[];for(const ae of B){const H=zf(ae,$);H&&F.childNodes.push(H)}if(Qse(e)&&e.shadowRoot)for(const ae of Array.from(e.shadowRoot.childNodes)){const H=zf(ae,$);H&&(_x(e.shadowRoot)&&(H.isShadow=!0),F.childNodes.push(H))}}if(e.parentNode&&yx(e.parentNode)&&_x(e.parentNode)&&(F.isShadow=!0),F.type===rn.Element&&F.tagName==="iframe"&&!F.needBlock&&jre(e,()=>{const $=b8(e);if($&&R){const B=zf($,{doc:$,mirror:n,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:l,maskTextClass:c,unmaskTextClass:u,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:v,maskInputOptions:y,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOMOptions:k,dataURLOptions:S,inlineImages:E,recordCanvas:T,preserveWhiteSpace:K,onSerialize:A,onIframeLoad:R,iframeLoadTimeout:I,onStylesheetLoad:M,stylesheetLoadTimeout:O,keepIframeSrcFn:z,ignoreCSSAttributes:W});B&&R(e,B)}},I),F.type===rn.Element&&F.tagName==="img"&&!e.complete&&F.needBlock){const $=e,B=()=>
70{if($.isConnected&&!$.complete&&L)try{const ae=$.getBoundingClientRect();ae.width>0&&ae.height>0&&L($,F,ae)}catch{}$.removeEventListener("load",B)};$.isConnected&&$.addEventListener("load",B)}return F.type===rn.Element&&F.tagName==="link"&&typeof F.attributes.rel=="string"&&(F.attributes.rel==="stylesheet"||F.attributes.rel==="preload"&&typeof F.attributes.href=="string"&&g8(F.attributes.href)==="css")&&wre(e,()=>{if(M){const $=zf(e,{doc:s,mirror:n,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:l,maskTextClass:c,unmaskTextClass:u,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:v,maskInputOptions:y,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOMOptions:k,dataURLOptions:S,inlineImages:E,recordCanvas:T,preserveWhiteSpace:K,onSerialize:A,onIframeLoad:R,iframeLoadTimeout:I,onStylesheetLoad:M,stylesheetLoadTimeout:O,keepIframeSrcFn:z,ignoreCSSAttributes:W});$&&M(e,$)}},O),F.type===rn.Element&&delete F.needBlock,F}function Tre(e,t){const{mirror:s=new m8,blockClass:n="rr-block",blockSelector:a=null,unblockSelector:o=null,maskAllText:i=!1,maskTextClass:l="rr-mask",unmaskTextClass:c=null,maskTextSelector:u=null,unmaskTextSelector:f=null,inlineStylesheet:h=!0,inlineImages:g=!1,recordCanvas:v=!1,maskAllInputs:y=!1,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOM:k=!1,dataURLOptions:S,preserveWhiteSpace:E,onSerialize:T,onIframeLoad:A,iframeLoadTimeout:R,onBlockedImageLoad:I,onStylesheetLoad:L,stylesheetLoadTimeout:M,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:z=new Set([])}=t||{};return zf(e,{doc:e,mirror:s,blockClass:n,blockSelector:a,unblockSelector:o,maskAllText:i,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputOptions:y===!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}:y===!1?{}:y,maskAttributeFn:_,maskTextFn:j,maskInputFn:w,slimDOMOptions:k===!0||k==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:k==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:k===!1?{}:k,dataURLOptions:S,inlineImages:g,recordCanvas:v,preserveWhiteSpace:E,onSerialize:T,onIframeLoad:A,iframeLoadTimeout:R,onBlockedImageLoad:I,onStylesheetLoad:L,stylesheetLoadTimeout:M,keepIframeSrcFn:O,newlyAddedElement:!1,ignoreCSSAttributes:z})}function ya(e,t,s=document){const n={capture:!0,passive:!0};return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}const Pf=`Please stop import mirror directly. Instead of that,\r 71now you can use replayer.getMirror() to access the mirror instance of a replayer,\r 72or you can use record.mirror to access the mirror instance during recording.`;let gM={map:{},getId(){return console.error(Pf),-1},getNode(){return console.error(Pf),null},removeNodeFromMap(){console.error(Pf)},has(){return console.error(Pf),!1},reset(){console.error(Pf)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(gM=new Proxy(gM,{get(e,t,s){return t==="map"&&console.error(Pf),Reflect.get(e,t,s)}}));function Xx(e,t,s={}){let n=null,a=0;return function(...o){const i=Date.now();!a&&s.leading===!1&&(a=i);const l=t-(i-a),c=this;l<=0||l>t?(n&&(Lre(n),n=null),a=i,e.apply(c,o)):!n&&s.trailing!==!1&&(n=aw(()=>{a=s.leading===!1?0:Date.now(),n=null,e.apply(c,o)},l))}}function j8(e,t,s,n,a=window){const o=a.Object.getOwnPropertyDescriptor(e,t);return a.Object.defineProperty(e,t,n?s:{set(i){aw(()=>{s.set.call(this,i)},0),o&&o.set&&o.set.call(this,i)}}),()=>j8(e,t,o||{},!0)}function bT(e,t,s){try{if(!(t in e))return()=>{};const n=e[t],a=s(n);return typeof a=="function"&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=a,()=>{e[t]=n}}catch{return()=>{}}}let F_=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(F_=()=>new Date().getTime());function w8(e){var s,n,a,o,i,l;const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:(t==null?void 0:t.documentElement.scrollLeft)||((n=(s=t==null?void 0:t.body)==null?void 0:s.parentElement)==null?void 0:n.scrollLeft)||((a=t==null?void 0:t.body)==null?void 0:a.scrollLeft)||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(t==null?void 0:t.documentElement.scrollTop)||((i=(o=t==null?void 0:t.body)==null?void 0:o.parentElement)==null?void 0:i.scrollTop)||((l=t==null?void 0:t.body)==null?void 0:l.scrollTop)||0}}function N8(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function k8(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function S8(e){if(!e)return null;
72try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function ao(e,t,s,n,a){if(!e)return!1;const o=S8(e);if(!o)return!1;const i=qf(t,s);if(!a){const u=n&&o.matches(n);return i(o)&&!u}const l=Bu(o,i);let c=-1;return l<0?!1:(n&&(c=Bu(o,qf(null,n))),l>-1&&c<0?!0:l<c)}function Rre(e,t){return t.getId(e)!==-1}function Rk(e,t){return t.getId(e)===Jx}function C8(e,t){if(yx(e))return!1;const s=t.getId(e);return t.has(s)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?C8(e.parentNode,t):!0:!0}function yC(e){return!!e.changedTouches}function Are(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let s=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===s)return!0;while(s=s&&s.parentNode);return!1})}function E8(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function T8(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function _C(e){return!!(e!=null&&e.shadowRoot)}class Pre{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,s){if(this.has(t))return this.getId(t);let n;return s===void 0?n=this.id++:n=s,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function R8(e){var s,n;let t=null;return((n=(s=e.getRootNode)==null?void 0:s.call(e))==null?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function Ire(e){let t=e,s;for(;s=R8(t);)t=s;return t}function Mre(e){const t=e.ownerDocument;if(!t)return!1;const s=Ire(e);return t.contains(s)}function A8(e){const t=e.ownerDocument;return t?t.contains(e)||Mre(e):!1}const xM={};function yT(e){const t=xM[e];if(t)return t;const s=window.document;let n=window[e];if(s&&typeof s.createElement=="function")try{const a=s.createElement("iframe");a.hidden=!0,s.head.appendChild(a);const o=a.contentWindow;o&&o[e]&&(n=o[e]),s.head.removeChild(a)}catch{}return xM[e]=n.bind(window)}function Ore(...e){return yT("requestAnimationFrame")(...e)}function aw(...e){return yT("setTimeout")(...e)}function Lre(...e){return yT("clearTimeout")(...e)}var Es=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Es||{}),gs=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(gs||{}),va=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(va||{}),Dl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Dl||{}),If=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(If||{});function _T(e){try{return e.contentDocument}catch{}}function Dre(e){try{return e.contentWindow}catch{}}function vM(e){return"__ln"in e}class $re{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let s=this.head;for(let n=0;n<t;n++)s=(s==null?void 0:s.next)||null;return s}addNode(t){const s={value:t,previous:null,next:null};if(t.__ln=s,t.previousSibling&&vM(t.previousSibling)){const n=t.previousSibling.__ln.next;s.next=n,s.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=s,n&&(n.previous=s)}else if(t.nextSibling&&vM(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;
72s.previous=n,s.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=s,n&&(n.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++}removeNode(t){const s=t.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const bM=(e,t)=>`${e}@${t}`;class Ure{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=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],s=new Set,n=new $re,a=c=>{let u=c,f=Jx;for(;f===Jx;)u=u&&u.nextSibling,f=u&&this.mirror.getId(u);return f},o=c=>{if(!c.parentNode||!A8(c))return;const u=yx(c.parentNode)?this.mirror.getId(R8(c)):this.mirror.getId(c.parentNode),f=a(c);if(u===-1||f===-1)return n.addNode(c);const h=zf(c,{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.inlineImages,onSerialize:g=>{E8(g,this.mirror)&&!ao(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(g),T8(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),_C(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(g,v)=>{ao(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(g,v),g.contentWindow&&this.canvasManager.addWindow(g.contentWindow),this.shadowDomManager.observeAttachShadow(g))},onStylesheetLoad:(g,v)=>{this.stylesheetManager.attachLinkElement(g,v)},onBlockedImageLoad:(g,v,{width:y,height:_})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:v.id,attributes:{style:{width:`${y}px`,height:`${_}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});h&&(t.push({parentId:u,nextId:f,node:h}),s.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)yM(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||o(c);for(const c of this.addedSet)!_M(this.droppedSet,c)&&!yM(this.removes,c,this.mirror)||_M(this.movedSet,c)?o(c):this.droppedSet.add(c);let i=null;for(;n.length;){let c=null;if(i){const u=this.mirror.getId(i.value.parentNode),f=a(i.value);u!==-1&&f!==-1&&(c=i)}if(!c){let u=n.tail;for(;u;){const f=u;if(u=u.previous,f){const h=this.mirror.getId(f.value.parentNode);if(a(f.value)===-1)continue;if(h!==-1){c=f;break}else{const v=f.value;if(v.parentNode&&v.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const y=v.parentNode.host;if(this.mirror.getId(y)!==-1){c=f;break}}}}}}if(!c){for(;n.head;)n.removeNode(n.head.value);break}i=c.previous,n.removeNode(c.value),o(c.value)}const l={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!s.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:u}=c;if(typeof u.style=="string"){const f=JSON.stringify(c.styleDiff),h=JSON.stringify(c._unchangedStyles);f.length<u.style.length&&(f+h).split("var(").length===u.style.split("var(").length&&(u.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:u}}).filter(c=>!s.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:t};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))},this.processMutation=t=>{if(!Rk(t.target,this.mirror))switch(t.type){case"characterData":{const s=t.target.textContent;!ao(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&s!==t.oldValue&&this.texts.push({value:gh(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&s?this.maskTextFn?this.maskTextFn(s,S8(t.target)):s.replace(/[\S]/g,"*"):s,node:t.target});break}case"attributes":{const s=t.target;let n=t.attributeName,a=t.target.getAttribute(n);if(n==="value"){const i=xT(s),l=s.tagName;a=$_(s,l,i);const c=rw({maskInputOptions:this.maskInputOptions,tagName:l,type:i}),u=gh(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);a=Kx({isMasked:u,element:s,value:a,maskInputFn:this.maskInputFn})}if(ao(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||a===t.oldValue)return;let o=this.attributeMap.get(t.target);if(s.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(a))if(!_T(s))n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&s.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!_8(s.tagName,n)&&(o.attributes[n]=y8(this.doc,mh(s.tagName),mh(n),a,s,this.maskAttributeFn),n==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");t.oldValue&&i.setAttribute("style",t.oldValue);for(const l of Array.from(s.style)){const c=s.style.getPropertyValue(l),u=s.style.getPropertyPriority(l);c!==i.style.getPropertyValue(l)||u!==i.style.getPropertyPriority(l)?u===""?o.styleDiff[l]=c:o.styleDiff[l]=[c,u]:o._unchangedStyles[l]=[c,u]}for(const l of Array.from(i.style))s.style.getPropertyValue(l)===""&&(o.styleDiff[l]=!1)}break}
72case"childList":{if(ao(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(s=>this.genAdds(s,t.target)),t.removedNodes.forEach(s=>{const n=this.mirror.getId(s),a=yx(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);ao(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||Rk(s,this.mirror)||!Rre(s,this.mirror)||(this.addedSet.has(s)?(jC(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(t.target)&&n===-1||C8(t.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[bM(n,a)]?jC(this.movedSet,s):this.removes.push({parentId:a,id:n,isShadow:yx(t.target)&&_x(t.target)?!0:void 0})),this.mapRemoves.push(s))});break}}},this.genAdds=(t,s)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Rk(t,this.mirror))return;this.movedSet.add(t);let n=null;s&&this.mirror.hasNode(s)&&(n=this.mirror.getId(s)),n&&n!==-1&&(this.movedMap[bM(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ao(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes&&t.childNodes.forEach(n=>this.genAdds(n)),_C(t)&&t.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(s=>{this[s]=t[s]})}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 jC(e,t){var s;e.delete(t),(s=t.childNodes)==null||s.forEach(n=>jC(e,n))}function yM(e,t,s){return e.length===0?!1:Fre(e,t,s)}function Fre(e,t,s){let n=t.parentNode;for(;n;){const a=s.getId(n);if(e.some(o=>o.id===a))return!0;n=n.parentNode}return!1}function _M(e,t){return e.size===0?!1:P8(e,t)}function P8(e,t){const{parentNode:s}=t;return s?e.has(s)?!0:P8(e,s):!1}let jx;function Bre(e){jx=e}function qre(){jx=void 0}const Bs=e=>jx?(...s)=>{try{return e(...s)}catch(n){if(jx&&jx(n)===!0)return()=>{};throw n}}:e,Hf=[];function qv(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function I8(e,t){var i,l;const s=new Ure;Hf.push(s),s.init(e);let n=window.MutationObserver||window.__rrMutationObserver;const a=(l=(i=window==null?void 0:window.Zone)==null?void 0:i.__symbol__)==null?void 0:l.call(i,"MutationObserver");a&&window[a]&&(n=window[a]);const o=new n(Bs(c=>{e.onMutation&&e.onMutation(c)===!1||s.processMutations.bind(s)(c)}));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),o}function zre({mousemoveCb:e,sampling:t,doc:s,mirror:n}){if(t.mousemove===!1)return()=>{};const a=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let i=[],l;const c=Xx(Bs(h=>{const g=Date.now()-l;e(i.map(v=>(v.timeOffset-=g,v)),h),i=[],l=null}),o),u=Bs(Xx(Bs(h=>{const g=qv(h),{clientX:v,clientY:y}=yC(h)?h.changedTouches[0]:h;l||(l=F_()),i.push({x:v,y,id:n.getId(g),timeOffset:F_()-l}),c(typeof DragEvent<"u"&&h instanceof DragEvent?gs.Drag:h instanceof MouseEvent?gs.MouseMove:gs.TouchMove)}),a,{trailing:!1})),f=[ya("mousemove",u,s),ya("touchmove",u,s),ya("drag",u,s)];return Bs(()=>{f.forEach(h=>h())})}function Hre({mouseInteractionCb:e,doc:t,mirror:s,blockClass:n,blockSelector:a,unblockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};const l=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,c=[];let u=null;const f=h=>g=>{const v=qv(g);if(ao(v,n,a,o,!0))return;let y=null,_=h;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Dl.Mouse;break;case"touch":y=Dl.Touch;break;case"pen":y=Dl.Pen;break}y===Dl.Touch?va[h]===va.MouseDown?_="TouchStart":va[h]===va.MouseUp&&(_="TouchEnd"):Dl.Pen}else yC(g)&&(y=Dl.Touch);y!==null?(u=y,(_.startsWith("Touch")&&y===Dl.Touch||_.startsWith("Mouse")&&y===Dl.Mouse)&&(y=null)):va[h]===va.Click&&(y=u,u=null);const j=yC(g)?g.changedTouches[0]:g;if(!j)return;const w=s.getId(v),{clientX:k,clientY:S}=j;Bs(e)({type:va[_],id:w,x:k,y:S,...y!==null&&{pointerType:y}})};return Object.keys(va).filter(h=>Number.isNaN(Number(h))&&!h.endsWith("_Departed")&&l[h]!==!1).forEac
72h(h=>{let g=mh(h);const v=f(h);if(window.PointerEvent)switch(va[h]){case va.MouseDown:case va.MouseUp:g=g.replace("mouse","pointer");break;case va.TouchStart:case va.TouchEnd:return}c.push(ya(g,v,t))}),Bs(()=>{c.forEach(h=>h())})}function M8({scrollCb:e,doc:t,mirror:s,blockClass:n,blockSelector:a,unblockSelector:o,sampling:i}){const l=Bs(Xx(Bs(c=>{const u=qv(c);if(!u||ao(u,n,a,o,!0))return;const f=s.getId(u);if(u===t&&t.defaultView){const h=w8(t.defaultView);e({id:f,x:h.left,y:h.top})}else e({id:f,x:u.scrollLeft,y:u.scrollTop})}),i.scroll||100));return ya("scroll",l,t)}function Vre({viewportResizeCb:e},{win:t}){let s=-1,n=-1;const a=Bs(Xx(Bs(()=>{const o=N8(),i=k8();(s!==o||n!==i)&&(e({width:Number(i),height:Number(o)}),s=o,n=i)}),200));return ya("resize",a,t)}const Gre=["INPUT","TEXTAREA","SELECT"],jM=new WeakMap;function Wre({inputCb:e,doc:t,mirror:s,blockClass:n,blockSelector:a,unblockSelector:o,ignoreClass:i,ignoreSelector:l,maskInputOptions:c,maskInputFn:u,sampling:f,userTriggeredOnInput:h,maskTextClass:g,unmaskTextClass:v,maskTextSelector:y,unmaskTextSelector:_}){function j(R){let I=qv(R);const L=R.isTrusted,M=I&&vC(I.tagName);if(M==="OPTION"&&(I=I.parentElement),!I||!M||Gre.indexOf(M)<0||ao(I,n,a,o,!0))return;const O=I;if(O.classList.contains(i)||l&&O.matches(l))return;const z=xT(I);let X=$_(O,M,z),W=!1;const K=rw({maskInputOptions:c,tagName:M,type:z}),q=gh(I,g,y,v,_,K);(z==="radio"||z==="checkbox")&&(W=I.checked),X=Kx({isMasked:q,element:I,value:X,maskInputFn:u}),w(I,h?{text:X,isChecked:W,userTriggered:L}:{text:X,isChecked:W});const J=I.name;z==="radio"&&J&&W&&t.querySelectorAll(`input[type="radio"][name="${J}"]`).forEach(F=>{if(F!==I){const V=Kx({isMasked:q,element:F,value:$_(F,M,z),maskInputFn:u});w(F,h?{text:V,isChecked:!W,userTriggered:!1}:{text:V,isChecked:!W})}})}function w(R,I){const L=jM.get(R);if(!L||L.text!==I.text||L.isChecked!==I.isChecked){jM.set(R,I);const M=s.getId(R);Bs(e)({...I,id:M})}}const S=(f.input==="last"?["change"]:["input","change"]).map(R=>ya(R,Bs(j),t)),E=t.defaultView;if(!E)return()=>{S.forEach(R=>R())};const T=E.Object.getOwnPropertyDescriptor(E.HTMLInputElement.prototype,"value"),A=[[E.HTMLInputElement.prototype,"value"],[E.HTMLInputElement.prototype,"checked"],[E.HTMLSelectElement.prototype,"value"],[E.HTMLTextAreaElement.prototype,"value"],[E.HTMLSelectElement.prototype,"selectedIndex"],[E.HTMLOptionElement.prototype,"selected"]];return T&&T.set&&S.push(...A.map(R=>j8(R[0],R[1],{set(){Bs(j)({target:this,isTrusted:!1})}},!1,E))),Bs(()=>{S.forEach(R=>R())})}function B_(e){const t=[];function s(n,a){if(Ty("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ty("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ty("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ty("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const i=Array.from(n.parentRule.cssRules).indexOf(n);a.unshift(i)}else if(n.parentStyleSheet){const i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);a.unshift(i)}return a}return s(e,t)}function Zc(e,t,s){let n,a;return e?(e.ownerNode?n=t.getId(e.ownerNode):a=s.getId(e),{styleId:a,id:n}):{}}function Yre({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const a=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Bs((f,h,g)=>{const[v,y]=g,{id:_,styleId:j}=Zc(h,t,s.styleMirror);return(_&&_!==-1||j&&j!==-1)&&e({id:_,styleId:j,adds:[{rule:v,index:y}]}),f.apply(h,g)})});const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Bs((f,h,g)=>{const[v]=g,{id:y,styleId:_}=Zc(h,t,s.styleMirror);return(y&&y!==-1||_&&_!==-1)&&e({id:y,styleId:_,removes:[{index:v}]}),f.apply(h,g)})});let i;n.CSSStyleSheet.prototype.replace&&(i=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:Bs((f,h,g)=>{const[v]=g,{id:y,styleId:_}=Zc(h,t,s.styleMirror);return(y&&y!==-1||_&&_!==-1)&&e({id:y,styleId:_,replace:v}),f.apply(h,g)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Bs((f,h,g)=>{const[v]=g,{id:y,styleId:_}=Zc(h,t,s.styleMirror);return(y&&y!==-1||_&&_!==-1)&&e({id:y,styleId:_,replaceSync:v}),f.apply(h,g)})}));const c={};Ry("CSSGroupingRule")?c.CSSGroupingRule=n.CSSGroupingRule:(Ry("CSSMediaRule")&&(c.CSSMediaRule=n.CSSMediaRule),Ry("CSSConditionRule")&&(c.CSSConditionRule=n.CSSConditionRule),Ry("CSSSupportsRule")&&(c.CSSSupportsRule=n.CSSSupportsRule));const u={};
vendor: 8,760 bytes, line 72
72return Object.entries(c).forEach(([f,h])=>{u[f]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[f].insertRule,{apply:Bs((g,v,y)=>{const[_,j]=y,{id:w,styleId:k}=Zc(v.parentStyleSheet,t,s.styleMirror);return(w&&w!==-1||k&&k!==-1)&&e({id:w,styleId:k,adds:[{rule:_,index:[...B_(v),j||0]}]}),g.apply(v,y)})}),h.prototype.deleteRule=new Proxy(u[f].deleteRule,{apply:Bs((g,v,y)=>{const[_]=y,{id:j,styleId:w}=Zc(v.parentStyleSheet,t,s.styleMirror);return(j&&j!==-1||w&&w!==-1)&&e({id:j,styleId:w,removes:[{index:[...B_(v),_]}]}),g.apply(v,y)})})}),Bs(()=>{n.CSSStyleSheet.prototype.insertRule=a,n.CSSStyleSheet.prototype.deleteRule=o,i&&(n.CSSStyleSheet.prototype.replace=i),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([f,h])=>{h.prototype.insertRule=u[f].insertRule,h.prototype.deleteRule=u[f].deleteRule})})}function O8({mirror:e,stylesheetManager:t},s){var i,l,c;let n=null;s.nodeName==="#document"?n=e.getId(s):n=e.getId(s.host);const a=s.nodeName==="#document"?(i=s.defaultView)==null?void 0:i.Document:(c=(l=s.ownerDocument)==null?void 0:l.defaultView)==null?void 0:c.ShadowRoot,o=a!=null&&a.prototype?Object.getOwnPropertyDescriptor(a==null?void 0:a.prototype,"adoptedStyleSheets"):void 0;return n===null||n===-1||!a||!o?()=>{}:(Object.defineProperty(s,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get(){var u;return(u=o.get)==null?void 0:u.call(this)},set(u){var h;const f=(h=o.set)==null?void 0:h.call(this,u);if(n!==null&&n!==-1)try{t.adoptStyleSheets(u,n)}catch{}return f}}),Bs(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get:o.get,set:o.set})}))}function Kre({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:n},{win:a}){const o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Bs((l,c,u)=>{var _;const[f,h,g]=u;if(s.has(f))return o.apply(c,[f,h,g]);const{id:v,styleId:y}=Zc((_=c.parentRule)==null?void 0:_.parentStyleSheet,t,n.styleMirror);return(v&&v!==-1||y&&y!==-1)&&e({id:v,styleId:y,set:{property:f,value:h,priority:g},index:B_(c.parentRule)}),l.apply(c,u)})});const i=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:Bs((l,c,u)=>{var v;const[f]=u;if(s.has(f))return i.apply(c,[f]);const{id:h,styleId:g}=Zc((v=c.parentRule)==null?void 0:v.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||g&&g!==-1)&&e({id:h,styleId:g,remove:{property:f},index:B_(c.parentRule)}),l.apply(c,u)})}),Bs(()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=i})}function Jre({mediaInteractionCb:e,blockClass:t,blockSelector:s,unblockSelector:n,mirror:a,sampling:o,doc:i}){const l=Bs(u=>Xx(Bs(f=>{const h=qv(f);if(!h||ao(h,t,s,n,!0))return;const{currentTime:g,volume:v,muted:y,playbackRate:_}=h;e({type:u,id:a.getId(h),currentTime:g,volume:v,muted:y,playbackRate:_})}),o.media||500)),c=[ya("play",l(If.Play),i),ya("pause",l(If.Pause),i),ya("seeked",l(If.Seeked),i),ya("volumechange",l(If.VolumeChange),i),ya("ratechange",l(If.RateChange),i)];return Bs(()=>{c.forEach(u=>u())})}function Xre({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const n=[],a=new WeakMap,o=s.FontFace;s.FontFace=function(c,u,f){const h=new o(c,u,f);return a.set(h,{family:c,buffer:typeof u!="string",descriptors:f,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};const i=bT(t.fonts,"add",function(l){return function(c){return aw(Bs(()=>{const u=a.get(c);u&&(e(u),a.delete(c))}),0),l.apply(this,[c])}});return n.push(()=>{s.FontFace=o}),n.push(i),Bs(()=>{n.forEach(l=>l())})}function Qre(e){const{doc:t,mirror:s,blockClass:n,blockSelector:a,unblockSelector:o,selectionCb:i}=e;let l=!0;const c=Bs(()=>{const u=t.getSelection();if(!u||l&&(u!=null&&u.isCollapsed))return;l=u.isCollapsed||!1;const f=[],h=u.rangeCount||0;for(let g=0;g<h;g++){const v=u.getRangeAt(g),{startContainer:y,startOffset:_,endContainer:j,endOffset:w}=v;ao(y,n,a,o,!0)||ao(j,n,a,o,!0)||f.push({start:s.getId(y),startOffset:_,end:s.getId(j),endOffset:w})}i({ranges:f})});return c(),ya("selectionchange",c)}function Zre({doc:e,customElementCb:t}){const s=e.defaultView;return!s||!s.customElements?()=>{}:bT(s.customElements,"define",function(a){return function(o,i,l){try{t({define:{name:o}})}catch{}return a.apply(this,[o,i,l])}})}function ene(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let n;e.recordDOM&&(n=I8(e,e.doc));const a=zre(e),o=Hre(e),i=M8(e),l=Vre(e,{win:s}),c=Wre(e),u=Jre(e);let f=()=>{},h=()=>{},g=()=>{},v=()=>{};e.recordDOM&&(f=Yre(e,{win:s}),h=O8(e,e.doc),g=Kre(e,{win:s}),e.collectFonts&&(v=Xre(e)));const y=Qre(e),_=Zre(e),j=[];for(const w of e.plugins)j.push(w.observer(w.callback,s,w.options));return Bs(()=>{Hf.forEach(w=>w.reset()),n==null||n.disconnect(),a(),o(),i(),l(),c(),u(),f(),h(),g(),v(),y(),_(),j.forEach(w=>w())})}function Ty(e){return typeof window[e]<"u"}function Ry(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class wC{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,s,n,a){const o=n||this.getIdToRemoteIdMap(t),i=a||this.getRemoteIdToIdMap(t);let l=o.get(s);return l||(l=this.generateIdFn(),o.set(s,l),i.set(l,s)),l}getIds(t,s){const n=this.getIdToRemoteIdMap(t),a=this.getRemoteIdToIdMap(t);return s.map(o=>this.getId(t,o,n,a))}getRemoteId(t,s,n){const a=n||this.getRemoteIdToIdMap(t);if(typeof s!="number")return s;const o=a.get(s);return o||-1}getRemoteIds(t,s){const n=this.getRemoteIdToIdMap(t);return s.map(a=>this.getRemoteId(t,a,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let s=this.iframeIdToRemoteIdMap.get(t);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(t,s)),s}getRemoteIdToIdMap(t){let s=this.iframeRemoteIdToIdMap.get(t);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(t,s)),s}}class tne{constructor(){this.crossOriginIframeMirror=new wC(vT),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class sne{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new wC(vT),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new wC(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,s){var a,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((a=t.contentWindow)==null||a.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t);const n=_T(t);n&&n.adoptedStyleSheets&&n.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(n.adoptedStyleSheets,this.mirror.getId(n))}handleMessage(t){const s=t;if(s.data.type!=="rrweb"||s.origin!==s.data.origin||!t.source)return;const a=this.crossOriginIframeMap.get(t.source);if(!a)return;const o=this.transformCrossOriginEvent(a,s.data.event);o&&this.wrappedEmit(o,s.data.isCheckout)}transformCrossOriginEvent(t,s){var n;switch(s.type){case Es.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(s.data.node,t);const a=s.data.node.id;return this.crossOriginIframeRootIdMap.set(t,a),this.patchRootIdOnNode(s.data.node,a),{timestamp:s.timestamp,type:Es.IncrementalSnapshot,data:{source:gs.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Es.Meta:case Es.Load:case Es.DomContentLoaded:return!1;case Es.Plugin:return s;case Es.Custom:return this.replaceIds(s.data.payload,t,["id","parentId","previousId","nextId"]),s;case Es.IncrementalSnapshot:switch(s.data.source){case gs.Mutation:return s.data.adds.forEach(a=>{this.replaceIds(a,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(a.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(a.node,o)}
72),s.data.removes.forEach(a=>{this.replaceIds(a,t,["parentId","id"])}),s.data.attributes.forEach(a=>{this.replaceIds(a,t,["id"])}),s.data.texts.forEach(a=>{this.replaceIds(a,t,["id"])}),s;case gs.Drag:case gs.TouchMove:case gs.MouseMove:return s.data.positions.forEach(a=>{this.replaceIds(a,t,["id"])}),s;case gs.ViewportResize:return!1;case gs.MediaInteraction:case gs.MouseInteraction:case gs.Scroll:case gs.CanvasMutation:case gs.Input:return this.replaceIds(s.data,t,["id"]),s;case gs.StyleSheetRule:case gs.StyleDeclaration:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleId"]),s;case gs.Font:return s;case gs.Selection:return s.data.ranges.forEach(a=>{this.replaceIds(a,t,["start","end"])}),s;case gs.AdoptedStyleSheet:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleIds"]),(n=s.data.styles)==null||n.forEach(a=>{this.replaceStyleIds(a,t,["styleId"])}),s}}return!1}replace(t,s,n,a){for(const o of a)!Array.isArray(s[o])&&typeof s[o]!="number"||(Array.isArray(s[o])?s[o]=t.getIds(n,s[o]):s[o]=t.getId(n,s[o]));return s}replaceIds(t,s,n){return this.replace(this.crossOriginIframeMirror,t,s,n)}replaceStyleIds(t,s,n){return this.replace(this.crossOriginIframeStyleMirror,t,s,n)}replaceIdOnNode(t,s){this.replaceIds(t,s,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,s)})}patchRootIdOnNode(t,s){t.type!==rn.Document&&!t.rootId&&(t.rootId=s),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,s)})}}class rne{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class nne{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,s){if(!_x(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const n=I8({...this.bypassOptions,doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(M8({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),aw(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(O8({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const s=_T(t),n=Dre(t);!s||!n||this.patchAttachShadow(n.Element,s)}patchAttachShadow(t,s){const n=this;this.restoreHandlers.push(bT(t.prototype,"attachShadow",function(a){return function(o){const i=a.call(this,o);return this.shadowRoot&&A8(this)&&n.addShadowRoot(this.shadowRoot,s),i}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}var wM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ane=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ay=0;Ay<wM.length;Ay++)ane[wM.charCodeAt(Ay)]=Ay;class NM{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class one{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Pre,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,s){"_cssText"in s.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:s.id,attributes:s.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,s){if(t.length===0)return;const n={id:s,styleIds:[]},a=[];for(const o of t){let i;this.styleMirror.has(o)?i=this.styleMirror.getId(o):(i=this.styleMirror.add(o),a.push({styleId:i,rules:Array.from(o.rules||CSSRule,(l,c)=>({rule:h8(l),index:c}))})),n.styleIds.push(i)}a.length>0&&(n.styles=a),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class ine{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,s){const n=this.nodeMap.get(t);return n&&Array.from(n).some(a=>a!==s)}add(t,s){this.active||(this.active=!0,Ore(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(s))}destroy(){}}let qr,q_;var CU;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((CU=e.contentWindow)==null?void 0:CU.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const ni=are();function sc(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:n,blockClass:a="rr-block",blockSelector:o=null,unblockSelector:i=null,ignoreClass:l="rr-ignore",ignoreSelector:c=null,maskAllText:u=!1,maskTextClass:f="rr-mask",unmaskTextClass:h=null,maskTextSelector:g=null,unmaskTextSelector:v=null,inlineStylesheet:y=!0,maskAllInputs:_,maskInputOptions:j,slimDOMOptions:w,maskAttributeFn:k,maskInputFn:S,maskTextFn:E,maxCanvasSize:T=null,packFn:A,sampling:R={},dataURLOptions:I={},mousemoveWait:L,recordDOM:M=!0,recordCanvas:O=!1,recordCrossOriginIframes:z=!1,recordAfter:X=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:K=!1,inlineImages:q=!1,plugins:J,keepIframeSrcFn:F=()=>!1,ignoreCSSAttributes:V=new Set([]),errorHandler:$,onMutation:B,getCanvasManager:ae}=e;Bre($);const H=z?window.parent===window:!0;let U=!1;if(!H)try{window.parent.document&&(U=!1)}catch{U=!0}if(H&&!t)throw new Error("emit function is required");if(!H&&!U)return()=>{};L!==void 0&&R.mousemove===void 0&&(R.mousemove=L),ni.reset();const oe=_===!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}:j!==void 0?j:{},fe=w===!0||w==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:w==="all",headMetaDescKeywords:w==="all"}:w||{};Are();let Q,le=0;const Se=De=>{for(const ct of J||[])ct.eventProcessor&&(De=ct.eventProcessor(De));return A&&!U&&(De=A(De)),De};qr=(De,ct)=>{var mt;const rt=De;if(rt.timestamp=F_(),(mt=Hf[0])!=null&&mt.isFrozen()&&rt.type!==Es.FullSnapshot&&!(rt.type===Es.IncrementalSnapshot&&rt.data.source===gs.Mutation)&&Hf.forEach(vt=>vt.unfreeze()),H)t==null||t(Se(rt),ct);else if(U){const vt={type:"rrweb",event:Se(rt),origin:window.location.origin,isCheckout:ct};window.parent.postMessage(vt,"*")}if(rt.type===Es.FullSnapshot)Q=rt,le=0;else if(rt.type===Es.IncrementalSnapshot){if(rt.data.source===gs.Mutation&&rt.data.isAttachIframe)return;le++;const vt=n&&le>=n,gt=s&&Q&&rt.timestamp-Q.timestamp>s;(vt||gt)&&ut(!0)}};const we=De=>{qr({type:Es.IncrementalSnapshot,data:{source:gs.Mutation,...De}})},Le=De=>qr({type:Es.IncrementalSnapshot,data:{source:gs.Scroll,...De}}),xe=De=>qr({type:Es.IncrementalSnapshot,data:{source:gs.CanvasMutation,...De}}),de=De=>qr({type:Es.IncrementalSnapshot,data:{source:gs.AdoptedStyleSheet,...De}}),Me=new one({mutationCb:we,adoptedStyleSheetCb:de}),je=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new tne:new sne({mirror:ni,mutationCb:we,stylesheetManager:Me,recordCrossOriginIframes:z,wrappedEmit:qr});for(const De of J||[])De.getMirror&&De.getMirror({nodeMirror:ni,crossOriginIframeMirror:je.crossOriginIframeMirror,crossOriginIframeStyleMirror:je.crossOriginIframeStyleMirror});const Ae=new ine,Oe=cne(ae,{mirror:ni,win:window,mutationCb:De=>qr({type:Es.IncrementalSnapshot,data:{source:gs.CanvasMutation,...De}}),recordCanvas:O,blockClass:a,blockSelector:o,unblockSelector:i,maxCanvasSize:T,sampling:R.canvas,dataURLOptions:I,errorHandler:$}),Ke=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new rne:new nne({mutationCb:we,scrollCb:Le,bypassOptions:{onMutation:B,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:u,maskTextClass:f,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:y,maskInputOptions:oe,dataURLOptions:I,maskAttributeFn:k,maskTextFn:E,maskInputFn:S,recordCanvas:O,inlineImages:q,sampling:R,slimDOMOptions:fe,iframeManager:je,stylesheetManager:Me,canvasManager:Oe,keepIframeSrcFn:F,processedNodeManager:Ae,ignoreCSSAttributes:V},mirror:ni}),ut=(De=!1)=>
72{if(!M)return;qr({type:Es.Meta,data:{href:window.location.href,width:k8(),height:N8()}},De),Me.reset(),Ke.init(),Hf.forEach(rt=>rt.lock());const ct=Tre(document,{mirror:ni,blockClass:a,blockSelector:o,unblockSelector:i,maskAllText:u,maskTextClass:f,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:y,maskAllInputs:oe,maskAttributeFn:k,maskInputFn:S,maskTextFn:E,slimDOM:fe,dataURLOptions:I,recordCanvas:O,inlineImages:q,onSerialize:rt=>{E8(rt,ni)&&je.addIframe(rt),T8(rt,ni)&&Me.trackLinkElement(rt),_C(rt)&&Ke.addShadowRoot(rt.shadowRoot,document)},onIframeLoad:(rt,mt)=>{je.attachIframe(rt,mt),rt.contentWindow&&Oe.addWindow(rt.contentWindow),Ke.observeAttachShadow(rt)},onStylesheetLoad:(rt,mt)=>{Me.attachLinkElement(rt,mt)},onBlockedImageLoad:(rt,mt,{width:vt,height:gt})=>{we({adds:[],removes:[],texts:[],attributes:[{id:mt.id,attributes:{style:{width:`${vt}px`,height:`${gt}px`}}}]})},keepIframeSrcFn:F,ignoreCSSAttributes:V});if(!ct)return console.warn("Failed to snapshot the document");qr({type:Es.FullSnapshot,data:{node:ct,initialOffset:w8(window)}}),Hf.forEach(rt=>rt.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Me.adoptStyleSheets(document.adoptedStyleSheets,ni.getId(document))};q_=ut;try{const De=[],ct=mt=>{var vt;return Bs(ene)({onMutation:B,mutationCb:we,mousemoveCb:(gt,Be)=>qr({type:Es.IncrementalSnapshot,data:{source:Be,positions:gt}}),mouseInteractionCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.MouseInteraction,...gt}}),scrollCb:Le,viewportResizeCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.ViewportResize,...gt}}),inputCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.Input,...gt}}),mediaInteractionCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.MediaInteraction,...gt}}),styleSheetRuleCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.StyleSheetRule,...gt}}),styleDeclarationCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.StyleDeclaration,...gt}}),canvasMutationCb:xe,fontCb:gt=>qr({type:Es.IncrementalSnapshot,data:{source:gs.Font,...gt}}),selectionCb:gt=>{qr({type:Es.IncrementalSnapshot,data:{source:gs.Selection,...gt}})},customElementCb:gt=>{qr({type:Es.IncrementalSnapshot,data:{source:gs.CustomElement,...gt}})},blockClass:a,ignoreClass:l,ignoreSelector:c,maskAllText:u,maskTextClass:f,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,maskInputOptions:oe,inlineStylesheet:y,sampling:R,recordDOM:M,recordCanvas:O,inlineImages:q,userTriggeredOnInput:W,collectFonts:K,doc:mt,maskAttributeFn:k,maskInputFn:S,maskTextFn:E,keepIframeSrcFn:F,blockSelector:o,unblockSelector:i,slimDOMOptions:fe,dataURLOptions:I,mirror:ni,iframeManager:je,stylesheetManager:Me,shadowDomManager:Ke,processedNodeManager:Ae,canvasManager:Oe,ignoreCSSAttributes:V,plugins:((vt=J==null?void 0:J.filter(gt=>gt.observer))==null?void 0:vt.map(gt=>({observer:gt.observer,options:gt.options,callback:Be=>qr({type:Es.Plugin,data:{plugin:gt.name,payload:Be}})})))||[]},{})};je.addLoadListener(mt=>{try{De.push(ct(mt.contentDocument))}catch(vt){console.warn(vt)}});const rt=()=>{ut(),De.push(ct(document))};return document.readyState==="interactive"||document.readyState==="complete"?rt():(De.push(ya("DOMContentLoaded",()=>{qr({type:Es.DomContentLoaded,data:{}}),X==="DOMContentLoaded"&&rt()})),De.push(ya("load",()=>{qr({type:Es.Load,data:{}}),X==="load"&&rt()},window))),()=>{De.forEach(mt=>mt()),Ae.destroy(),q_=void 0,qre()}}catch(De){console.warn(De)}}function lne(e){if(!q_)throw new Error("please take full snapshot after start recording");q_(e)}sc.mirror=ni;sc.takeFullSnapshot=lne;function cne(e,t){try{return e?e(t):new NM}catch{return console.warn("Unable to initialize CanvasManager"),new NM}}var kM;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(kM||(kM={}));const dne=3,une=5;function jT(e){return e>9999999999?e:e*1e3}function Ak(e){return e>9999999999?e/1e3:e}function zv(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>
72(e.throttledAddEvent({type:Es.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:ii(t,10,1e3)}}),t.category==="console")))}const pne="button,a";function L8(e){return e.closest(pne)||e}function D8(e){const t=$8(e);return!t||!(t instanceof Element)?t:L8(t)}function $8(e){return fne(e)?e.target:e}function fne(e){return typeof e=="object"&&!!e&&"target"in e}let ed;function hne(e){return ed||(ed=[],mne()),ed.push(e),()=>{const t=ed?ed.indexOf(e):-1;t>-1&&ed.splice(t,1)}}function mne(){$a(br,"open",function(e){return function(...t){if(ed)try{ed.forEach(s=>s())}catch{}return e.apply(br,t)}})}const gne=new Set([gs.Mutation,gs.StyleSheetRule,gs.StyleDeclaration,gs.AdoptedStyleSheet,gs.CanvasMutation,gs.Selection,gs.MediaInteraction]);function xne(e,t,s){e.handleClick(t,s)}class vne{constructor(t,s,n=zv){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=s.timeout/1e3,this._threshold=s.threshold/1e3,this._scrollTimeout=s.scrollTimeout/1e3,this._replay=t,this._ignoreSelector=s.ignoreSelector,this._addBreadcrumbEvent=n}addListeners(){const t=hne(()=>{this._lastMutation=SM()});this._teardown=()=>{t(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(t,s){if(yne(s,this._ignoreSelector)||!_ne(t))return;const n={timestamp:Ak(t.timestamp),clickBreadcrumb:t,clickCount:0,node:s};this._clicks.some(a=>a.node===n.node&&Math.abs(a.timestamp-n.timestamp)<1)||(this._clicks.push(n),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(t=Date.now()){this._lastMutation=Ak(t)}registerScroll(t=Date.now()){this._lastScroll=Ak(t)}registerClick(t){const s=L8(t);this._handleMultiClick(s)}_handleMultiClick(t){this._getClicks(t).forEach(s=>{s.clickCount++})}_getClicks(t){return this._clicks.filter(s=>s.node===t)}_checkClicks(){const t=[],s=SM();this._clicks.forEach(n=>{!n.mutationAfter&&this._lastMutation&&(n.mutationAfter=n.timestamp<=this._lastMutation?this._lastMutation-n.timestamp:void 0),!n.scrollAfter&&this._lastScroll&&(n.scrollAfter=n.timestamp<=this._lastScroll?this._lastScroll-n.timestamp:void 0),n.timestamp+this._timeout<=s&&t.push(n)});for(const n of t){const a=this._clicks.indexOf(n);a>-1&&(this._generateBreadcrumbs(n),this._clicks.splice(a,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(t){const s=this._replay,n=t.scrollAfter&&t.scrollAfter<=this._scrollTimeout,a=t.mutationAfter&&t.mutationAfter<=this._threshold,o=!n&&!a,{clickCount:i,clickBreadcrumb:l}=t;if(o){const c=Math.min(t.mutationAfter||this._timeout,this._timeout)*1e3,u=c<this._timeout*1e3?"mutation":"timeout",f={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.slowClickDetected",data:{...l.data,url:br.location.href,route:s.getCurrentRoute(),timeAfterClickMs:c,endReason:u,clickCount:i||1}};this._addBreadcrumbEvent(s,f);return}if(i>1){const c={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.multiClick",data:{...l.data,url:br.location.href,route:s.getCurrentRoute(),clickCount:i,metric:!0}};this._addBreadcrumbEvent(s,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Bv(()=>this._checkClicks(),1e3)}}const bne=["A","BUTTON","INPUT"];function yne(e,t){return!!(!bne.includes(e.tagName)||e.tagName==="INPUT"&&!["submit","button"].includes(e.getAttribute("type")||"")||e.tagName==="A"&&(e.hasAttribute("download")||e.hasAttribute("target")&&e.getAttribute("target")!=="_self")||t&&e.matches(t))}function _ne(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function SM(){return Date.now()/1e3}function jne(e,t){try{if(!wne(t))return;const{source:s}=t.data;if(gne.has(s)&&e.registerMutation(t.timestamp),s===gs.Scroll&&e.registerScroll(t.timestamp),Nne(t)){const{type:n,id:a}=t.data,o=sc.mirror.getNode(a);o instanceof HTMLElement&&n===va.Click&&e.registerClick(o)}}catch{}}function wne(e){return e.type===dne}function Nne(e){return e.data.source===gs.MouseInteraction}function Vi(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var wT=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(wT||{});const kne=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function Sne(e){const t={};!e["data-sentry-component"]&&e["data-sentry-element"]&&(e["data-sentry-component"]=e["data-sentry-element"]);for(const s in e)if(kne.has(s)){let n=s;(s==="data-testid"||s==="data-test-id")&&(n="testId"),t[n]=e[s]}return t}const Cne=e=>t=>{if(!e.isEnabled())return;const s=Ene(t);if(!s)return;const n=t.name==="click",a=n?t.event:void 0;n&&e.clickDetector&&(a!=null&&a.target)&&!a.altKey&&!a.metaKey&&!a.ctrlKey&&!a.shift
72Key&&xne(e.clickDetector,s,D8(t.event)),zv(e,s)};function U8(e,t){const s=sc.mirror.getId(e),n=s&&sc.mirror.getNode(s),a=n&&sc.mirror.getMeta(n),o=a&&Rne(a)?a:null;return{message:t,data:o?{nodeId:s,node:{id:s,tagName:o.tagName,textContent:Array.from(o.childNodes).map(i=>i.type===wT.Text&&i.textContent).filter(Boolean).map(i=>i.trim()).join(""),attributes:Sne(o.attributes)}}:{}}}function Ene(e){const{target:t,message:s}=Tne(e);return Vi({category:`ui.${e.name}`,...U8(t,s)})}function Tne(e){const t=e.name==="click";let s,n=null;try{n=t?D8(e.event):$8(e.event),s=Ba(n,{maxStringLength:200})||"<unknown>"}catch{s="<unknown>"}return{target:n,message:s}}function Rne(e){return e.type===wT.Element}function Ane(e,t){if(!e.isEnabled())return;e.updateUserActivity();const s=Pne(t);s&&zv(e,s)}function Pne(e){const{metaKey:t,shiftKey:s,ctrlKey:n,altKey:a,key:o,target:i}=e;if(!i||Ine(i)||!o)return null;const l=t||n||a,c=o.length===1;if(!l&&c)return null;const u=Ba(i,{maxStringLength:200})||"<unknown>",f=U8(i,u);return Vi({category:"ui.keyDown",message:u,data:{...f.data,metaKey:t,shiftKey:s,ctrlKey:n,altKey:a,key:o}})}function Ine(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}const Mne={resource:Une,paint:Dne,navigation:$ne};function Pk(e,t){return({metric:s})=>void t.replayPerformanceEntries.push(e(s))}function One(e){return e.map(Lne).filter(Boolean)}function Lne(e){const t=Mne[e.entryType];return t?t(e):null}function xh(e){return((Va()||br.performance.timeOrigin)+e)/1e3}function Dne(e){const{duration:t,entryType:s,name:n,startTime:a}=e,o=xh(a);return{type:s,name:n,start:o,end:o+t,data:void 0}}function $ne(e){const{entryType:t,name:s,decodedBodySize:n,duration:a,domComplete:o,encodedBodySize:i,domContentLoadedEventStart:l,domContentLoadedEventEnd:c,domInteractive:u,loadEventStart:f,loadEventEnd:h,redirectCount:g,startTime:v,transferSize:y,type:_}=e;return a===0?null:{type:`${t}.${_}`,start:xh(v),end:xh(o),name:s,data:{size:y,decodedBodySize:n,encodedBodySize:i,duration:a,domInteractive:u,domContentLoadedEventStart:l,domContentLoadedEventEnd:c,loadEventStart:f,loadEventEnd:h,domComplete:o,redirectCount:g}}}function Une(e){const{entryType:t,initiatorType:s,name:n,responseEnd:a,startTime:o,decodedBodySize:i,encodedBodySize:l,responseStatus:c,transferSize:u}=e;return["fetch","xmlhttprequest"].includes(s)?null:{type:`${t}.${s}`,start:xh(o),end:xh(a),name:n,data:{size:u,statusCode:c,decodedBodySize:i,encodedBodySize:l}}}function Fne(e){const t=e.entries[e.entries.length-1],s=t!=null&&t.element?[t.element]:void 0;return NT(e,"largest-contentful-paint",s)}function Bne(e){return e.sources!==void 0}function qne(e){const t=[],s=[];for(const n of e.entries)if(Bne(n)){const a=[];for(const o of n.sources)if(o.node){s.push(o.node);const i=sc.mirror.getId(o.node);i&&a.push(i)}t.push({value:n.value,nodeIds:a.length?a:void 0})}return NT(e,"cumulative-layout-shift",s,t)}function zne(e){const t=e.entries[e.entries.length-1],s=t!=null&&t.target?[t.target]:void 0;return NT(e,"interaction-to-next-paint",s)}function NT(e,t,s,n){const a=e.value,o=e.rating,i=xh(a);return{type:"web-vital",name:t,start:i,end:i,data:{value:a,size:a,rating:o,nodeIds:s?s.map(l=>sc.mirror.getId(l)):void 0,attributions:n}}}function Hne(e){function t(a){e.performanceEntries.includes(a)||e.performanceEntries.push(a)}function s({entries:a}){a.forEach(t)}const n=[];return["navigation","paint","resource"].forEach(a=>{n.push(op(a,s))}),n.push(pT(Pk(Fne,e)),uT(Pk(qne,e)),ZF(Pk(zne,e))),()=>{n.forEach(a=>a())}}const ds=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Vne='
vendor: 10,329 bytes, line 72
72var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort(function(t,n){return t.f-n.f}),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort(function(t,n){return p[n.s]-p[t.s]||t.f-n.f});s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[s[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(s[t]^s[t+1]<<A^s[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});
72';function Gne(){const e=new Blob([Vne]);return URL.createObjectURL(e)}const CM=["log","warn","error"],l_="[Replay] ";function Ik(e,t="info"){Cd({category:"console",data:{logger:"replay"},level:t,message:`${l_}${e}`},{level:t})}function Wne(){let e=!1,t=!1;const s={exception:()=>{},infoTick:()=>{},setConfig:n=>{e=!!n.captureExceptions,t=!!n.traceInternals}};return ds?(CM.forEach(n=>{s[n]=(...a)=>{kt[n](l_,...a),t&&Ik(a.join(""),OF(n))}}),s.exception=(n,...a)=>{a.length&&s.error&&s.error(...a),kt.error(l_,n),e?Ku(n,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):t&&Ik(n,"error")},s.infoTick=(...n)=>{kt.log(l_,...n),t&&setTimeout(()=>Ik(n[0]),0)}):CM.forEach(n=>{s[n]=()=>{}}),s}const us=Wne();class kT extends Error{constructor(){super(`Event buffer exceeded maximum size of ${gT}.`)}}class F8{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(t){const s=JSON.stringify(t).length;if(this._totalSize+=s,this._totalSize>gT)throw new kT;this.events.push(t)}finish(){return new Promise(t=>{const s=this.events;this.clear(),t(JSON.stringify(s))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const t=this.events.map(s=>s.timestamp).sort()[0];return t?jT(t):null}}class Yne{constructor(t){this._worker=t,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((t,s)=>{this._worker.addEventListener("message",({data:n})=>{n.success?t():s()},{once:!0}),this._worker.addEventListener("error",n=>{s(n)},{once:!0})}),this._ensureReadyPromise)}destroy(){ds&&us.log("Destroying compression worker"),this._worker.terminate()}postMessage(t,s){const n=this._getAndIncrementId();return new Promise((a,o)=>{const i=({data:l})=>{const c=l;if(c.method===t&&c.id===n){if(this._worker.removeEventListener("message",i),!c.success){ds&&us.error("Error in compression worker: ",c.response),o(new Error("Error in compression worker"));return}a(c.response)}};this._worker.addEventListener("message",i),this._worker.postMessage({id:n,method:t,arg:s})})}_getAndIncrementId(){return this._id++}}class Kne{constructor(t){this._worker=new Yne(t),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(t){const s=jT(t.timestamp);(!this._earliestTimestamp||s<this._earliestTimestamp)&&(this._earliestTimestamp=s);const n=JSON.stringify(t);return this._totalSize+=n.length,this._totalSize>gT?Promise.reject(new kT):this._sendEventToWorker(n)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{ds&&us.exception(t,'Sending "clear" message to worker failed',t)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(t){return this._worker.postMessage("addEvent",t)}async _finishRequest(){const t=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,t}}class Jne{constructor(t){this._fallback=new F8,this._compression=new Kne(t),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(t){this._used.hasCheckout=t}set waitForCheckout(t){this._used.waitForCheckout=t}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(t){return this._used.addEvent(t)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(t){ds&&us.exception(t,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:t,hasCheckout:s,waitForCheckout:n}=this._fallback,a=[];for(const o of t)a.push(this._compression.addEvent(o));this._compression.hasCheckout=s,this._compression.waitForCheckout=n,this._used=this._compression;try{await Promise.all(a),this._fallback.clear()}catch(o){ds&&us.exception(o,"Failed to add events when switching buffers.")}}}function Xne({useCompression:e,workerUrl:t}){if(e&&window.Worker){const s=Qne(t);if(s)return s}return ds&&us.log("Using simple buffer"),new F8}function Qne(e){try{const t=e||Zne();if(!t)return;ds&&us.log(`Using compression worker${e?` from ${e}`:""}`);const s=new Worker(t);return new Jne(s)}catch(t){ds&&us.exception(t,"Failed to create compression worker")}}function Zne(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?Gne():""}function ST(){try{return"sessionStorage"in br&&!!br.sessionStorage}catch{return!1}}function eae(e){tae(),e.session=void 0}function tae(){if(ST())try{br.sessionStorage.removeItem(hT)}catch{}}function B8(e){return e===void 0?!1:Math.random()<e}function ow(e){if(ST())try{br.sessionStorage.setItem(hT,JSON.stringify(e))}catch{}}function q8(e){const t=Date.now(),s=e.id||uo(),n=e.started||t,a=e.lastActivity||t,o=e.segmentId||0,i=e.sampled,l=e.previousSessionId,c=e.dirty||!1;return{id:s,started:n,lastActivity:a,segmentId:o,sampled:i,previousSessionId:l,dirty:c}}function sae(e,t){return B8(e)?"session":t?"buffer":!1}function EM({sessionSampleRate:e,allowBuffering:t,stickySession:s=!1},{previousSessionId:n}={}){const a=sae(e,t),o=q8({sampled:a,previousSessionId:n});return s&&ow(o),o}function rae(){if(!ST())return null;try{const e=br.sessionStorage.getItem(hT);if(!e)return null;const t=JSON.parse(e);return ds&&us.infoTick("Loading existing session"),q8(t)}catch{return null}}function NC(e,t,s=+new Date){return e===null||t===void 0||t<0?!0:t===0?!1:e+t<=s}function z8(e,{maxReplayDuration:t,sessionIdleExpire:s,targetTime:n=Date.now()}){return NC(e.started,t,n)||NC(e.lastActivity,s,n)}function H8(e,{sessionIdleExpire:t,maxReplayDuration:s}){return!(!z8(e,{sessionIdleExpire:t,maxReplayDuration:s})||e.sampled==="buffer"&&e.segmentId===0)}function Mk({sessionIdleExpire:e,maxReplayDuration:t,previousSessionId:s},n){const a=n.stickySession&&rae();return a?H8(a,{sessionIdleExpire:e,maxReplayDuration:t})?(ds&&us.infoTick("Session in sessionStorage is expired, creating new one..."),EM(n,{previousSessionId:a.id})):a:(ds&&us.infoTick("Creating new session"),EM(n,{previousSessionId:s}))}function nae(e){return e.type===Es.Custom}function CT(e,t,s){return G8(e,t)?(V8(e,t,s),!0):!1}function aae(e,t,s){return G8(e,t)?V8(e,t,s):Promise.resolve(null)}async function V8(e,t,s){const{eventBuffer:n}=e;if(!n||n.waitForCheckout&&!s)return null;const a=e.recordingMode==="buffer";try{s&&a&&n.clear(),s&&(n.hasCheckout=!0,n.waitForCheckout=!1);const o=e.getOptions(),i=oae(t,o.beforeAddRecordingEvent);return i?await n.addEvent(i):void 0}catch(o){const i=o&&o instanceof kT,l=i?"addEventSizeExceeded":"addEvent",c=Os();if(c){const u=i?"buffer_overflow":"internal_sdk_error";c.recordDroppedEvent(u,"replay")}if(i&&a)return n.clear(),n.waitForCheckout=!0,null;e.handleException(o),await e.stop({reason:l})}}
72function G8(e,t){if(!e.eventBuffer||e.isPaused()||!e.isEnabled())return!1;const s=jT(t.timestamp);return s+e.timeouts.sessionIdlePause<Date.now()?!1:s>e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(ds&&us.infoTick(`Skipping event with timestamp ${s} because it is after maxReplayDuration`),!1):!0}function oae(e,t){try{if(typeof t=="function"&&nae(e))return t(e)}catch(s){return ds&&us.exception(s,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}function ET(e){return!e.type}function kC(e){return e.type==="transaction"}function iae(e){return e.type==="replay_event"}function TM(e){return e.type==="feedback"}function lae(e){return(t,s)=>{if(!e.isEnabled()||!ET(t)&&!kC(t))return;const n=s.statusCode;if(!(!n||n<200||n>=300)){if(kC(t)){cae(e,t);return}dae(e,t)}}}function cae(e,t){var n,a;const s=e.getContext();(a=(n=t.contexts)==null?void 0:n.trace)!=null&&a.trace_id&&s.traceIds.size<100&&s.traceIds.add(t.contexts.trace.trace_id)}function dae(e,t){const s=e.getContext();if(t.event_id&&s.errorIds.size<100&&s.errorIds.add(t.event_id),e.recordingMode!=="buffer"||!t.tags||!t.tags.replayId)return;const{beforeErrorSampling:n}=e.getOptions();typeof n=="function"&&!n(t)||Bv(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(a){e.handleException(a)}})}function uae(e){return t=>{!e.isEnabled()||!ET(t)||pae(e,t)}}function pae(e,t){var n,a,o;const s=(o=(a=(n=t.exception)==null?void 0:n.values)==null?void 0:a[0])==null?void 0:o.value;if(typeof s=="string"&&(s.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||s.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const i=Vi({category:"replay.hydrate-error",data:{url:Hh()}});zv(e,i)}}function fae(e){const t=Os();t&&t.on("beforeAddBreadcrumb",s=>hae(e,s))}function hae(e,t){if(!e.isEnabled()||!W8(t))return;const s=mae(t);s&&zv(e,s)}function mae(e){return!W8(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?gae(e):Vi(e)}function gae(e){var a;const t=(a=e.data)==null?void 0:a.arguments;if(!Array.isArray(t)||t.length===0)return Vi(e);let s=!1;const n=t.map(o=>{if(!o)return o;if(typeof o=="string")return o.length>Ey?(s=!0,`${o.slice(0,Ey)}â¦`):o;if(typeof o=="object")try{const i=ii(o,7);return JSON.stringify(i).length>Ey?(s=!0,`${JSON.stringify(i,null,2).slice(0,Ey)}â¦`):i}catch{}return o});return Vi({...e,data:{...e.data,arguments:n,...s?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function W8(e){return!!e.category}function xae(e,t){var s,n,a;return e.type||!((n=(s=e.exception)==null?void 0:s.values)!=null&&n.length)?!1:!!((a=t.originalException)!=null&&a.__rrweb__)}function Y8(){const e=Qs().getPropagationContext().dsc;e&&delete e.replay_id;const t=ka();if(t){const s=cc(t);delete s.replay_id}}function vae(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:Es.Custom,timestamp:t.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:t.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:t.event_id}}}}),!1):!0)}function bae(e,t){return e.recordingMode!=="buffer"||t.message===mT||!t.exception||t.type?!1:B8(e.getOptions().errorSampleRate)}function yae(e){return Object.assign((t,s)=>{var i;if(!e.isEnabled()||e.isPaused())return t;if(iae(t))return delete t.breadcrumbs,t;if(!ET(t)&&!kC(t)&&!TM(t))return t;if(!e.checkAndHandleExpiredSession())return Y8(),t;if(TM(t))return e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),vae(e,t),t;if(xae(t,s)&&!e.getOptions()._experiments.captureExceptions)return ds&&us.log("Ignoring error from rrweb internals",t),null;const a=bae(e,t);if((a||e.recordingMode==="session")&&(t.tags={...t.tags,replayId:e.getSessionId()}),a&&e.recordingMode==="buffer"&&((i=e.session)==null?void 0:i.sampled)==="buffer"){const l=e.session;l.dirty=!0,e.getOptions().stickySession&&ow(l)}return t},{id:"Replay"})}function iw(e,t){return t.map(({type:s,start:n,end:a,name:o,data:i})=>{const l=e.throttledAddEvent({type:Es.Custom,timestamp:n,data:{tag:"performanceSpan",payload:{op:s,description:o,startTimestamp:n,endTimestamp:a,data:i}}});return typeof l=="string"?Promise.resolve(null):l})}function _ae(e){const{from:t,to:s}=e,n=Date.now()/1e3;return{type:"navigation.push",start:n,end:n,name:s,data:{previous:t}}}function jae(e){return t=>{if(!e.isEnabled())return;const s=_ae(t);s!==null&&(e.getContext().urls.push(s.name),e.triggerUserActivity(),e.addUpdate(()=>(iw(e,[s]),!1)))}}function wae(e,t){return ds&&e.getOptions()._experiments.traceInternals?!1:uZ(t,Os())}function K8(e,t){e.isEnabled()&&t!==null&&(wae(e,t.name)||e.addUpdate(()=>(iw(e,[t]),!0)))}function lw(e){if(!e)return;const t=new TextEncoder;try{if(typeof e=="string")return t.encode(e).length;if(e instanceof URLSearchParams)return t.encode(e.toString()).length;if(e instanceof FormData){const s=l8(e);return t.encode(s).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function J8(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}function z_(e,t){if(!e)return{headers:{},size:void 0,_meta:{warnings:[t]}};const s={...e._meta},n=s.warnings||[];return s.warnings=[...n,t],e._meta=s,e}function X8(e,t){if(!t)return null;const{startTimestamp:s,endTimestamp:n,url:a,method:o,statusCode:i,request:l,response:c}=t;return{type:e,start:s/1e3,end:n/1e3,name:a,data:{method:o,statusCode:i,request:l,response:c}}}function Qx(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function xd(e,t,s){if(!t&&Object.keys(e).length===0)return;if(!t)return{headers:e};if(!s)return{headers:e,size:t};const n={headers:e,size:t},{body:a,warnings:o}=Nae(s);return n.body=a,o!=null&&o.length&&(n._meta={warnings:o}),n}function SC(e,t){return Object.entries(e).reduce((s,[n,a])=>{const o=n.toLowerCase();return t.includes(o)&&e[n]&&(s[o]=a),s},{})}function Nae(e){if(!e||typeof e!="string")return{body:e};const t=e.length>cM,s=kae(e);if(t){const n=e.slice(0,cM);return s?{body:n,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${n}â¦`,warnings:["TEXT_TRUNCATED"]}}if(s)try{return{body:JSON.parse(e)}}catch{}return{body:e}}function kae(e){const t=e[0],s=e[e.length-1];return t==="["&&s==="]"||t==="{"&&s==="}"}function H_(e,t){const s=Sae(e);return ec(s,t)}function Sae(e,t=br.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(br.location.origin))return e;const s=new URL(e,t);if(s.origin!==new URL(t).origin)return e;const n=s.href;return!e.endsWith("/")&&n.endsWith("/")?n.slice(0,-1):n}async function Cae(e,t,s){try{const n=await Tae(e,t,s),a=X8("resource.fetch",n);K8(s.replay,a)}catch(n){ds&&us.exception(n,"Failed to capture fetch breadcrumb")}}function Eae(e,t){const{input:s,response:n}=t,a=s?d8(s):void 0,o=lw(a),i=n?J8(n.headers.get("content-length")):void 0;o!==void 0&&(e.data.request_body_size=o),i!==void 0&&(e.data.response_body_size=i)}async function Tae(e,t,s){const n=Date.now(),{startTimestamp:a=n,endTimestamp:o=n}=t,{url:i,method:l,status_code:c=0,request_body_size:u,response_body_size:f}=e.data,h=H_(i,s.networkDetailAllowUrls)&&!H_(i,s.networkDetailDenyUrls),g=h?Rae(s,t.input,u):Qx(u),v=await Aae(h,s,t.response,f);return{startTimestamp:a,endTimestamp:o,url:i,method:l,statusCode:c,request:g,response:v}}function Rae({networkCaptureBodies:e,networkRequestHeaders:t},s,n){const a=s?Mae(s,t):{};if(!e)return xd(a,n,void 0);const o=d8(s),[i,l]=c8(o,us),c=xd(a,n,i);return l?z_(c,l):c}async function Aae(e,{networkCaptureBodies:t,networkResponseHeaders:s},n,a){if(!e&&a!==void 0)return Qx(a);const o=n?Q8(n.headers,s):{};if(!n||!t&&a!==void 0)return xd(o,a,void 0);const[i,l]=await Iae(n),c=Pae(i,{networkCaptureBodies:t,responseBodySize:a,captureDetails:e,headers:o});return l?z_(c,l):c}function Pae(e,{networkCaptureBodies:t,responseBodySize:s,captureDetails:n,headers:a}){try{const o=e!=null&&e.length&&s===void 0?lw(e):s;return n?t?xd(a,o,e):xd(a,o,void 0):Qx(o)}catch(o){return ds&&us.exception(o,"Failed to serialize response body"),xd(a,s,void 0)}}async function Iae(e){const t=Oae(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await Lae(t)]}catch(s){return s instanceof Error&&s.message.indexOf("Timeout")>-1?(ds&&us.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(ds&&us.exception(s,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function Q8(e,t){const s={};return t.forEach(n=>{e.get(n)&&(s[n]=e.get(n))}),s}
72function Mae(e,t){return e.length===1&&typeof e[0]!="string"?RM(e[0],t):e.length===2?RM(e[1],t):{}}function RM(e,t){if(!e)return{};const s=e.headers;return s?s instanceof Headers?Q8(s,t):Array.isArray(s)?{}:SC(s,t):{}}function Oae(e){try{return e.clone()}catch(t){ds&&us.exception(t,"Failed to clone response body")}}function Lae(e){return new Promise((t,s)=>{const n=Bv(()=>s(new Error("Timeout while trying to read response body")),500);Dae(e).then(a=>t(a),a=>s(a)).finally(()=>clearTimeout(n))})}async function Dae(e){return await e.text()}async function $ae(e,t,s){try{const n=Fae(e,t,s),a=X8("resource.xhr",n);K8(s.replay,a)}catch(n){ds&&us.exception(n,"Failed to capture xhr breadcrumb")}}function Uae(e,t){const{xhr:s,input:n}=t;if(!s)return;const a=lw(n),o=s.getResponseHeader("content-length")?J8(s.getResponseHeader("content-length")):zae(s.response,s.responseType);a!==void 0&&(e.data.request_body_size=a),o!==void 0&&(e.data.response_body_size=o)}function Fae(e,t,s){const n=Date.now(),{startTimestamp:a=n,endTimestamp:o=n,input:i,xhr:l}=t,{url:c,method:u,status_code:f=0,request_body_size:h,response_body_size:g}=e.data;if(!c)return null;if(!l||!H_(c,s.networkDetailAllowUrls)||H_(c,s.networkDetailDenyUrls)){const A=Qx(h),R=Qx(g);return{startTimestamp:a,endTimestamp:o,url:c,method:u,statusCode:f,request:A,response:R}}const v=l[Fu],y=v?SC(v.request_headers,s.networkRequestHeaders):{},_=SC(u8(l),s.networkResponseHeaders),[j,w]=s.networkCaptureBodies?c8(i,us):[void 0],[k,S]=s.networkCaptureBodies?Bae(l):[void 0],E=xd(y,h,j),T=xd(_,g,k);return{startTimestamp:a,endTimestamp:o,url:c,method:u,statusCode:f,request:w?z_(E,w):E,response:S?z_(T,S):T}}function Bae(e){const t=[];try{return[e.responseText]}catch(s){t.push(s)}try{return qae(e.response,e.responseType)}catch(s){t.push(s)}return ds&&us.warn("Failed to get xhr response body",...t),[void 0]}function qae(e,t){try{if(typeof e=="string")return[e];if(e instanceof Document)return[e.body.outerHTML];if(t==="json"&&e&&typeof e=="object")return[JSON.stringify(e)];if(!e)return[void 0]}catch(s){return ds&&us.exception(s,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return ds&&us.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function zae(e,t){try{const s=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return lw(s)}catch{return}}function Hae(e){const t=Os();try{const{networkDetailAllowUrls:s,networkDetailDenyUrls:n,networkCaptureBodies:a,networkRequestHeaders:o,networkResponseHeaders:i}=e.getOptions(),l={replay:e,networkDetailAllowUrls:s,networkDetailDenyUrls:n,networkCaptureBodies:a,networkRequestHeaders:o,networkResponseHeaders:i};t&&t.on("beforeAddBreadcrumb",(c,u)=>Vae(l,c,u))}catch{}}function Vae(e,t,s){if(t.data)try{Gae(t)&&Yae(s)&&(Uae(t,s),$ae(t,s,e)),Wae(t)&&Kae(s)&&(Eae(t,s),Cae(t,s,e))}catch(n){ds&&us.exception(n,"Error when enriching network breadcrumb")}}function Gae(e){return e.category==="xhr"}function Wae(e){return e.category==="fetch"}function Yae(e){return e==null?void 0:e.xhr}function Kae(e){return e==null?void 0:e.response}function Jae(e){const t=Os();a8(Cne(e)),sw(jae(e)),fae(e),Hae(e);const s=yae(e);PQ(s),t&&(t.on("beforeSendEvent",uae(e)),t.on("afterSendEvent",lae(e)),t.on("createDsc",n=>{const a=e.getSessionId();a&&e.isEnabled()&&e.recordingMode==="session"&&e.checkAndHandleExpiredSession()&&(n.replay_id=a)}),t.on("spanStart",n=>{e.lastActiveSpan=n}),t.on("spanEnd",n=>{e.lastActiveSpan=n}),t.on("beforeSendFeedback",async(n,a)=>{var i;const o=e.getSessionId();a!=null&&a.includeReplay&&e.isEnabled()&&o&&((i=n.contexts)!=null&&i.feedback)&&(n.contexts.feedback.source==="api"&&await e.sendBufferedReplayOrFlush(),n.contexts.feedback.replay_id=o)}),t.on("openFeedbackWidget",async()=>{await e.sendBufferedReplayOrFlush()}))}async function Xae(e){try{return Promise.all(iw(e,[Qae(br.performance.memory)]))}catch{return[]}}function Qae(e){const{jsHeapSizeLimit:t,totalJSHeapSize:s,usedJSHeapSize:n}=e,a=Date.now()/1e3;return{type:"memory",name:"memory",start:a,end:a,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:s,usedJSHeapSize:n}}}}function Zae(e,t,s){return xZ(e,t,{...s,setTimeoutImpl:Bv})}const Po=Us.navigator;function eoe(){return/iPhone|iPad|iPod/i.test((Po==null?void 0:Po.userAgent)??"")||/Macintosh/i.test((Po==null?void 0:Po.userAgent)??"")&&(Po!=null&&Po.maxTouchPoints)&&(Po==null?void 0:Po.maxTouchPoints)>1?{sampling:{mousemove:!1}}:{}}function toe(e){let t=!1;return(s,n)=>{if(!e.checkAndHandleExpiredSession()){ds&&us.warn("Received replay event after session expired.");return}const a=n||!t;t=!0,e.clickDetector&&jne(e.clickDetector,s),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&a&&e.setInitialState(),!CT(e,s,a))return!0;
72if(!a)return!1;const o=e.session;if(roe(e,a),e.recordingMode==="buffer"&&o&&e.eventBuffer&&!o.dirty){const i=e.eventBuffer.getEarliestTimestamp();i&&(ds&&us.log(`Updating session start time to earliest event in buffer to ${new Date(i)}`),o.started=i,e.getOptions().stickySession&&ow(o))}return o!=null&&o.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function soe(e){const t=e.getOptions();return{type:Es.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:e.isRecordingCanvas(),sessionSampleRate:t.sessionSampleRate,errorSampleRate:t.errorSampleRate,useCompressionOption:t.useCompression,blockAllMedia:t.blockAllMedia,maskAllText:t.maskAllText,maskAllInputs:t.maskAllInputs,useCompression:e.eventBuffer?e.eventBuffer.type==="worker":!1,networkDetailHasUrls:t.networkDetailAllowUrls.length>0,networkCaptureBodies:t.networkCaptureBodies,networkRequestHasHeaders:t.networkRequestHeaders.length>0,networkResponseHasHeaders:t.networkResponseHeaders.length>0}}}}function roe(e,t){!t||!e.session||e.session.segmentId!==0||CT(e,soe(e),!1)}function noe(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function aoe(e,t,s,n){return $d(lF(e,J5(e),n,s),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function ooe({recordingData:e,headers:t}){let s;const n=`${JSON.stringify(t)} 73`;if(typeof e=="string")s=`${n}${e}`;else{const o=new TextEncoder().encode(n);s=new Uint8Array(o.length+e.length),s.set(o),s.set(e,o.length)}return s}async function ioe({client:e,scope:t,replayId:s,event:n}){const a=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,o={event_id:s,integrations:a};e.emit("preprocessEvent",n,o);const i=await hF(e.getOptions(),n,o,t,e,vo());if(!i)return null;e.emit("postprocessEvent",i,o),i.platform=i.platform||"javascript";const l=e.getSdkMetadata(),{name:c,version:u,settings:f}=(l==null?void 0:l.sdk)||{};return i.sdk={...i.sdk,name:c||"sentry.javascript.unknown",version:u||"0.0.0",settings:f},i}async function loe({recordingData:e,replayId:t,segmentId:s,eventContext:n,timestamp:a,session:o}){const i=ooe({recordingData:e,headers:{segment_id:s}}),{urls:l,errorIds:c,traceIds:u,initialTimestamp:f}=n,h=Os(),g=Qs(),v=h==null?void 0:h.getTransport(),y=h==null?void 0:h.getDsn();if(!h||!v||!y||!o.sampled)return Promise.resolve({});const _={type:$se,replay_start_timestamp:f/1e3,timestamp:a/1e3,error_ids:c,trace_ids:u,urls:l,replay_id:t,segment_id:s,replay_type:o.sampled},j=await ioe({scope:g,client:h,replayId:t,event:_});if(!j)return h.recordDroppedEvent("event_processor","replay"),ds&&us.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete j.sdkProcessingMetadata;const w=aoe(j,i,y,h.getOptions().tunnel);let k;try{k=await v.send(w)}catch(E){const T=new Error(mT);try{T.cause=E}catch{}throw T}if(typeof k.statusCode=="number"&&(k.statusCode<200||k.statusCode>=300))throw new Z8(k.statusCode);const S=SF({},k);if(kF(S,"replay"))throw new TT(S);return k}class Z8 extends Error{constructor(t){super(`Transport returned status code ${t}`)}}class TT extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}}async function eB(e,t={count:0,interval:Hse}){const{recordingData:s,onError:n}=e;if(s.length)try{return await loe(e),!0}catch(a){if(a instanceof Z8||a instanceof TT)throw a;if(gF("Replays",{_retryCount:t.count}),n&&n(a),t.count>=Vse){const o=new Error(`${mT} - max retries exceeded`);try{o.cause=a}catch{}throw o}return t.interval*=++t.count,new Promise((o,i)=>{Bv(async()=>{try{await eB(e,t),o(!0)}catch(l){i(l)}},t.interval)})}}const tB="__THROTTLED",coe="__SKIPPED";function doe(e,t,s){const n=new Map,a=l=>{const c=l-s;n.forEach((u,f)=>{f<c&&n.delete(f)})},o=()=>[...n.values()].reduce((l,c)=>l+c,0);let i=!1;return(...l)=>{const c=Math.floor(Date.now()/1e3);if(a(c),o()>=t){const f=i;return i=!0,f?coe:tB}i=!1;const u=n.get(c)||0;return n.set(c,u+1),e(...l)}}class uoe{constructor({options:t,recordingOptions:s}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:Use,sessionIdleExpire:Fse},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=s,this._options=t,this._debouncedFlush=Zae(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=doe((i,l)=>aae(this,i,l),300,5);const{slowClickTimeout:n,slowClickIgnoreSelectors:a}=this.getOptions(),o=n?{threshold:Math.min(Gse,n),timeout:n,scrollTimeout:Wse,ignoreSelector:a?a.join(","):""}:void 0;if(o&&(this.clickDetector=new vne(this,o)),ds){const i=t._experiments;us.setConfig({captureExceptions:!!i.captureExceptions,traceInternals:!!i.traceInternals})}this._handleVisibilityChange=()=>{br.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroun
73dTasks()},this._handleWindowBlur=()=>{const i=Vi({category:"ui.blur"});this._doChangeToBackgroundTasks(i)},this._handleWindowFocus=()=>{const i=Vi({category:"ui.focus"});this._doChangeToForegroundTasks(i)},this._handleKeyboardEvent=i=>{Ane(this,i)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){ds&&us.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){const{errorSampleRate:s,sessionSampleRate:n}=this._options,a=s<=0&&n<=0;if(this._requiresManualStart=a,!a){if(this._initializeSessionForSampling(t),!this.session){ds&&us.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",ds&&us.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){ds&&us.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){ds&&us.log("Buffering is in progress, call `flush()` to save the replay");return}ds&&us.infoTick("Starting replay in session mode"),this._updateUserActivity();const t=Mk({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=t,this.recordingMode="session",this._initializeRecording()}startBuffering(){if(this._isEnabled){ds&&us.log("Buffering is in progress, call `flush()` to save the replay");return}ds&&us.infoTick("Starting replay in buffer mode");const t=Mk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=t,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const t=this._canvas;this._stopRecording=sc({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:zse}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:toe(this),...eoe(),onMutation:this._onMutationHandler.bind(this),...t?{recordCanvas:t.recordCanvas,getCanvasManager:t.getCanvasManager,sampling:t.sampling,dataURLOptions:t.dataURLOptions}:{}})}catch(t){this.handleException(t)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(t){return this.handleException(t),!1}}async stop({forceFlush:t=!1,reason:s}={}){var n;if(this._isEnabled){this._isEnabled=!1,this.recordingMode="buffer";try{ds&&us.log(`Stopping Replay${s?` triggered by ${s}`:""}`),Y8(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),(n=this.eventBuffer)==null||n.destroy(),this.eventBuffer=null,eae(this)}catch(a){this.handleException(a)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),ds&&us.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),ds&&us.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const s=Date.now();ds&&us.log("Converting buffer to session"),await this.flushImmediate();const n=this.stopRecording();!t||!n||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this.session.dirty=!1,this._updateUserActivity(s),this._updateSessionActivity(s),this._maybeSaveSession()),this.startRecording())}addUpdate(t){const s=t();this.recordingMode==="buffer"||!this._isEnabled||s!==!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(t){var s,n;if(!(t&&((s=this.session)==null?void 0:s.sampled)===!1))return(n=this.session)==null?void 0:n.id}
73checkAndHandleExpiredSession(){if(this._lastActivity&&NC(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const t=`${br.location.pathname}${br.location.hash}${br.location.search}`,s=`${br.location.origin}${t}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=s,this._context.initialTimestamp=Date.now(),this._context.urls.push(s)}throttledAddEvent(t,s){const n=this._throttledAddEvent(t,s);if(n===tB){const a=Vi({category:"replay.throttled"});this.addUpdate(()=>!CT(this,{type:une,timestamp:a.timestamp||0,data:{tag:"breadcrumb",payload:a,metric:!0}}))}return n}getCurrentRoute(){const t=this.lastActiveSpan||ka(),s=t&&la(t),a=(s&&Hs(s).data||{})[di];if(!(!s||!a||!["route","custom"].includes(a)))return Hs(s).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=Xne({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(t){const s=this._options.errorSampleRate>0,n=Mk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:t},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:s});this.session=n}_checkSession(){if(!this.session)return!1;const t=this.session;return H8(t,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(t),!1):!0}async _refreshSession(t){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(t.id))}_addListeners(){try{br.document.addEventListener("visibilitychange",this._handleVisibilityChange),br.addEventListener("blur",this._handleWindowBlur),br.addEventListener("focus",this._handleWindowFocus),br.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(Jae(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=Hne(this)}_removeListeners(){try{br.document.removeEventListener("visibilitychange",this._handleVisibilityChange),br.removeEventListener("blur",this._handleWindowBlur),br.removeEventListener("focus",this._handleWindowFocus),br.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}_doChangeToBackgroundTasks(t){!this.session||z8(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(t&&this._createCustomBreadcrumb(t),this.conditionalFlush())}_doChangeToForegroundTasks(t){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){ds&&us.log("Document has become active, but session has expired");return}t&&this._createCustomBreadcrumb(t)}_updateUserActivity(t=Date.now()){this._lastActivity=t}_updateSessionActivity(t=Date.now()){this.session&&(this.session.lastActivity=t,this._maybeSaveSession())}_createCustomBreadcrumb(t){this.addUpdate(()=>{this.throttledAddEvent({type:Es.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=One(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const s=this._context.initialTimestamp/1e3;t=t.filter(n=>n.start>=s)}return Promise.all(iw(this,t))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:t,eventBuffer:s}=this;if(!t||!s||this._requiresManualStart||t.segmentId)return;const n=s.getEarliestTimestamp();n&&n<this._context.initialTimestamp&&(this._context.initialTimestamp=n)}
73_popEventContext(){const t={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(),t}async _runFlush(){var s;const t=this.getSessionId();if(!this.session||!this.eventBuffer||!t){ds&&us.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!((s=this.eventBuffer)!=null&&s.hasEvents)&&(await Xae(this),!!this.eventBuffer&&t===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 a=this._popEventContext(),o=this.session.segmentId++;this._maybeSaveSession();const i=await this.eventBuffer.finish();await eB({replayId:t,recordingData:i,segmentId:o,eventContext:a,session:this.session,timestamp:n,onError:l=>this.handleException(l)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const a=Os();if(a){const o=n instanceof TT?"ratelimit_backoff":"send_error";a.recordDroppedEvent(o,"replay")}}}async _flush({force:t=!1}={}){if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){ds&&us.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const s=this.session.started,a=Date.now()-s;this._debouncedFlush.cancel();const o=a<this._options.minReplayDuration,i=a>this._options.maxReplayDuration+5e3;if(o||i){ds&&us.log(`Session duration (${Math.floor(a/1e3)}s) is too ${o?"short":"long"}, not sending replay.`),o&&this._debouncedFlush();return}const l=this.eventBuffer;l&&this.session.segmentId===0&&!l.hasCheckout&&ds&&us.log("Flushing initial segment without checkout.");const c=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,c&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&ow(this.session)}_onMutationHandler(t){const{ignoreMutations:s}=this._options._experiments;if(s!=null&&s.length&&t.some(l=>{const c=noe(l.target),u=s.join(",");return c==null?void 0:c.matches(u)}))return!1;const n=t.length,a=this._options.mutationLimit,o=this._options.mutationBreadcrumbLimit,i=a&&n>a;if(n>o||i){const l=Vi({category:"replay.mutations",data:{count:n,limit:i}});this._createCustomBreadcrumb(l)}return i?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function bg(e,t){return[...e,...t].join(",")}function poe({mask:e,unmask:t,block:s,unblock:n,ignore:a}){const o=["base","iframe[srcdoc]:not([src])"],i=bg(e,[".sentry-mask","[data-sentry-mask]"]),l=bg(t,[]);return{maskTextSelector:i,unmaskTextSelector:l,blockSelector:bg(s,[".sentry-block","[data-sentry-block]",...o]),unblockSelector:bg(n,[]),ignoreSelector:bg(a,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function foe({el:e,key:t,maskAttributes:s,maskAllText:n,privacyOptions:a,value:o}){return!n||a.unmaskTextSelector&&e.matches(a.unmaskTextSelector)?o:s.includes(t)||t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"")?o.replace(/[\S]/g,"*"):o}const AM='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',hoe=["content-length","content-type","accept"],moe=Symbol.for("sentry__originalRequestBody");let PM=!1,IM=!1;function goe(){if(typeof Request>"u"||IM)return;const e=Request;try{const t=function(s,n){const a=new e(s,n);return(n==null?void 0:n.body)!=null&&(a[moe]=n.body),a};t.prototype=e.prototype,Us.Request=t,IM=!0}catch{}}const xoe=e=>new voe(e);class voe{constructor({flushMinDelay:t=Bse,flushMaxDelay:s=qse,minReplayDuration:n=Yse,maxReplayDuration:a=dM,stickySession:o=!0,useCompression:i=!0,workerUrl:l,_experiments:c={},maskAllText:u=!0,maskAllInputs:f=!0,blockAllMedia:h=!0,mutationBreadcrumbLimit:g=750,mutationLimit:v=1e4,slowClickTimeout:y=7e3,slowClickIgnoreSelectors:_=[],networkDetailAllowUrls:j=[],networkDetailDenyUrls:w=[],networkCaptureBodies:k=!0,networkRequestHeaders:S=[],networkResponseHeaders:E=[],mask:T=[],maskAttributes:A=["title","placeholder","aria-label"],unmask:R=[],block:I=[],unblock:L=[],ignore:M=[],maskFn:O,beforeAddRecordingEvent:z,beforeErrorSampling:X,onError:W,attachRawBodyFromRequest:K=!1}={}){this.name="Replay";const q=poe({mask:T,unmask:R,block:I,unblock:L,ignore:M});if(this._recordingOptions={maskAllInputs:f,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:O,maskInputFn:O,maskAttributeFn:(J,F,V)=>foe({maskAttributes:A,maskAllText:u,privacyOptions:q,key:J,value:F,el:V}),...q,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:J=>{try{J.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!c.recordCrossOriginIframes},this._initialOptions={flushMinDelay:t,flushMaxDelay:s,minReplayDuration:Math.min(n,Kse),maxReplayDuration:Math.min(a,dM),stickySession:o,useCompression:i,workerUrl:l,blockAllMedia:h,maskAllInputs:f,maskAllText:u,mutationBreadcrumbLimit:g,mutationLimit:v,slowClickTimeout:y,slowClickIgnoreSelectors:_,networkDetailAllowUrls:j,networkDetailDenyUrls:w,networkCaptureBodies:k,networkRequestHeaders:MM(S),networkResponseHeaders:MM(E),beforeAddRecordingEvent:z,beforeErrorSampling:X,onError:W,attachRawBodyFromRequest:K,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${AM}`:AM,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&cC())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return PM}set _isInitialized(t){PM=t}afterAllSetup(t){!cC()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&goe(),this._setup(t),this._initialize(t))}start(){this._replay&&this._replay.start()}
73startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(t){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(t):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(t){var s;if((s=this._replay)!=null&&s.isEnabled())return this._replay.getSessionId(t)}getRecordingMode(){var t;if((t=this._replay)!=null&&t.isEnabled())return this._replay.recordingMode}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){const s=boe(this._initialOptions,t);this._replay=new uoe({options:s,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{const s=t.getIntegrationByName("ReplayCanvas");if(!s)return;this._replay._canvas=s.getOptions()}catch{}}}function boe(e,t){const s=t.getOptions(),n={sessionSampleRate:0,errorSampleRate:0,...e},a=np(s.replaysSessionSampleRate),o=np(s.replaysOnErrorSampleRate);return a==null&&o==null&&jp(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),a!=null&&(n.sessionSampleRate=a),o!=null&&(n.errorSampleRate=o),n}function MM(e){return[...hoe,...e.map(t=>t.toLowerCase())]}function yoe(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function sB(e){try{return new URL(e,Ms.location.origin).href}catch{return}}function _oe(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function rB(e){try{return new Headers(e)}catch{return}}const OM=new WeakMap,Ok=new Map,nB={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function joe(e,t){const{traceFetch:s,traceXHR:n,trackFetchStreamPerformance:a,shouldCreateSpanForRequest:o,enableHTTPTimings:i,tracePropagationTargets:l,onRequestSpanStart:c,onRequestSpanEnd:u}={...nB,...t},f=typeof o=="function"?o:y=>!0,h=y=>woe(y,l),g={},v=e.getOptions().propagateTraceparent;s&&(e.addEventProcessor(y=>(y.type==="transaction"&&y.spans&&y.spans.forEach(_=>{if(_.op==="http.client"){const j=Ok.get(_.span_id);j&&(_.timestamp=j/1e3,Ok.delete(_.span_id))}}),y)),a&&QZ(y=>{if(y.response){const _=OM.get(y.response);_&&y.endTimestamp&&Ok.set(_,y.endTimestamp)}}),UF(y=>{const _=qZ(y,f,h,g,{propagateTraceparent:v,onRequestSpanEnd:u});if(y.response&&y.fetchData.__span&&OM.set(y.response,y.fetchData.__span),_){const j=sB(y.fetchData.url),w=j?Ju(j).host:void 0;_.setAttributes({"http.url":j,"server.address":w}),i&&LM(_),c==null||c(_,{headers:y.headers})}})),n&&i8(y=>{var j;const _=Noe(y,f,h,g,v,u);_&&(i&&LM(_),c==null||c(_,{headers:rB((j=y.xhr.__sentry_xhr_v3__)==null?void 0:j.request_headers)}))})}function LM(e){const{url:t}=Hs(e).data;if(!t||typeof t!="string")return;const s=op("resource",({entries:n})=>{n.forEach(a=>{_oe(a)&&a.name.endsWith(t)&&(e.setAttributes(n8(a)),setTimeout(s))})})}function woe(e,t){const s=Hh();if(s){let n,a;try{n=new URL(e,s),a=new URL(s).origin}catch{return!1}const o=n.origin===a;return t?ec(n.toString(),t)||o&&ec(n.pathname,t):o}else{const n=!!e.match(/^\/(?!\/)/);return t?ec(e,t):n}}function Noe(e,t,s,n,a,o){const i=e.xhr,l=i==null?void 0:i[Fu];if(!i||i.__sentry_own_request__||!l)return;const{url:c,method:u}=l,f=pi()&&t(c);if(e.endTimestamp&&f){const w=i.__sentry_xhr_span_id__;if(!w)return;const k=n[w];k&&l.status_code!==void 0&&(VU(k,l.status_code),k.end(),o==null||o(k,{headers:rB(u8(i)),error:e.error}),delete n[w]);return}const h=sB(c),g=Ju(h||c),v=dZ(c),y=!!ka(),_=f&&y?Wh({name:`${u} ${v}`,attributes:{url:c,type:"xhr","http.method":u,"http.url":h,"server.address":g==null?void 0:g.host,[wn]:"auto.http.browser",[lc]:"http.client",...(g==null?void 0:g.search)&&{"http.query":g==null?void 0:g.search},...(g==null?void 0:g.hash)&&{"http.fragment":g==null?void 0:g.hash}}}):new Sd;i.__sentry_xhr_span_id__=_.spanContext().spanId,n[i.__sentry_xhr_span_id__]=_,s(c)&&koe(i,pi()&&y?_:void 0,a);const j=Os();return j&&j.emit("beforeOutgoingRequestSpan",_,e),_}function koe(e,t,s){const{"sentry-trace":n,baggage:a,traceparent:o}=MF({span:t,propagateTraceparent:s});n&&Soe(e,n,a,o)}function Soe(e,t,s,n){var o;const a=(o=e.__sentry_xhr_v3__)==null?void 0:o.request_headers;if(!(a!=null&&a["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),n&&!(a!=null&&a.traceparent)&&e.setRequestHeader("traceparent",n),s){const i=a==null?void 0:a.baggage;(!i||!yoe(i))&&e.setRequestHeader("baggage",s)}}catch{}}function Coe(){Ms.document?Ms.document.addEventListener("visibilitychange",()=>{const e=ka();if(!e)return;const t=la(e);if(Ms.document.hidden&&t){const s="cancelled",{op:n,status:a}=Hs(t);qa&&kt.log(`[Tracing] Transaction: ${s} -> since tab moved to the background, op: ${n}`),a||t.setStatus({code:vn,message:s}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):qa&&kt.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const Eoe=3600,aB="sentry_previous_trace",Toe="sentry.previous_trace";function Roe(e,{linkPreviousTrace:t,consistentTraceSampling:s}){const n=t==="session-storage";let a=n?Ioe():void 0;e.on("spanStart",i=>{if(la(i)!==i)return;const l=Qs().getPropagationContext();a=Aoe(a,i,l),n&&Poe(a)});let o=!0;s&&e.on("beforeSampling",i=>{if(!a)return;const l=Qs(),c=l.getPropagationContext();if(o&&c.parentSpanId){o=!1;return}l.setPropagationContext({...c,dsc:{...c.dsc,sample_rate:String(a.sampleRate),sampled:String(CC(a.spanContext))},sampleRand:a.sampleRand}),i.parentSampled=CC(a.spanContext),i.parentSampleRate=a.sampleRate,i.spanAttributes={...i.spanAttributes,[HU]:a.sampleRate}})}function Aoe(e,t,s){const n=Hs(t);function a(){var l,c;try{return Number((l=s.dsc)==null?void 0:l.sample_rate)??Number((c=n.data)==null?void 0:c[H5])}catch{return 0}}const o={spanContext:t.spanContext(),startTimestamp:n.start_timestamp,sampleRate:a(),sampleRand:s.sampleRand};if(!e)return o;const i=e.spanContext;return i.traceId===n.trace_id?e:(Date.now()/1e3-e.startTimestamp<=Eoe&&(qa&&kt.log(`Adding previous_trace \`${JSON.stringify(i)}\` link to span \`${JSON.stringify({op:n.op,...t.spanContext()})}\``),t.addLink({context:i,attributes:{[sX]:"previous_trace"}}),t.setAttribute(Toe,`${i.traceId}-${i.spanId}-${CC(i)?1:0}`)),o)}function Poe(e){try{Ms.sessionStorage.setItem(aB,JSON.stringify(e))}catch(t){qa&&kt.warn("Could not store previous trace in sessionStorage",t)}}function Ioe(){var e;try{const t=(e=Ms.sessionStorage)==null?void 0:e.getItem(aB);return JSON.parse(t)}catch{return}}function CC(e){return e.traceFlags===1}const Moe="BrowserTracing",Ooe={...s_,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroun
73dSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...nB},Loe=(e={})=>{const t={name:void 0,source:void 0},s=Ms.document,{enableInp:n,enableElementTiming:a,enableLongTask:o,enableLongAnimationFrame:i,_experiments:{enableInteractions:l,enableStandaloneClsSpans:c,enableStandaloneLcpSpans:u},beforeStartSpan:f,idleTimeout:h,finalTimeout:g,childSpanTimeout:v,markBackgroundSpan:y,traceFetch:_,traceXHR:j,trackFetchStreamPerformance:w,shouldCreateSpanForRequest:k,enableHTTPTimings:S,ignoreResourceSpans:E,ignorePerformanceApiSpans:T,instrumentPageLoad:A,instrumentNavigation:R,detectRedirects:I,linkPreviousTrace:L,consistentTraceSampling:M,enableReportPageLoaded:O,onRequestSpanStart:z,onRequestSpanEnd:X}={...Ooe,...e};let W,K,q;function J(F,V,$=!0){const B=V.op==="pageload",ae=V.name,H=f?f(V):V,U=H.attributes||{};if(ae!==H.name&&(U[di]="custom",H.attributes=U),!$){const Q=wp();Wh({...H,startTime:Q}).end(Q);return}t.name=H.name,t.source=U[di];const oe=fF(H,{idleTimeout:h,finalTimeout:g,childSpanTimeout:v,disableAutoFinish:B,beforeSpanEnd:Q=>{W==null||W(),ite(Q,{recordClsOnPageloadSpan:!c,recordLcpOnPageloadSpan:!u,ignoreResourceSpans:E,ignorePerformanceApiSpans:T}),$M(F,void 0);const le=Qs(),Se=le.getPropagationContext();le.setPropagationContext({...Se,traceId:oe.spanContext().traceId,sampled:Dd(oe),dsc:cc(Q)}),B&&(q=void 0)},trimIdleSpanEndTimestamp:!O});B&&O&&(q=oe),$M(F,oe);function fe(){s&&["interactive","complete"].includes(s.readyState)&&F.emit("idleSpanEnableAutoFinish",oe)}B&&!O&&s&&(s.addEventListener("readystatechange",()=>{fe()}),fe())}return{name:Moe,setup(F){if(RX(),W=ete({recordClsStandaloneSpans:c||!1,recordLcpStandaloneSpans:u||!1,client:F}),n&&Ite(),a&&bte(),i&&Us.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?ste():o&&tte(),l&&rte(),I&&s){const $=()=>{K=An()};addEventListener("click",$,{capture:!0}),addEventListener("keydown",$,{capture:!0,passive:!0})}function V(){const $=Zx(F);$&&!Hs($).timestamp&&(qa&&kt.log(`[Tracing] Finishing current active span with op: ${Hs($).op}`),$.setAttribute(Gx,"cancelled"),$.end())}F.on("startNavigationSpan",($,B)=>{if(Os()!==F)return;if(B!=null&&B.isRedirect){qa&&kt.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),J(F,{op:"navigation.redirect",...$},!1);return}K=void 0,V(),vo().setPropagationContext({traceId:ic(),sampleRand:Math.random(),propagationSpanId:pi()?void 0:tc()});const ae=Qs();ae.setPropagationContext({traceId:ic(),sampleRand:Math.random(),propagationSpanId:pi()?void 0:tc()}),ae.setSDKProcessingMetadata({normalizedRequest:void 0}),J(F,{op:"navigation",...$,parentSpan:null,forceTransaction:!0})}),F.on("startPageLoadSpan",($,B={})=>{if(Os()!==F)return;V();const ae=B.sentryTrace||DM("sentry-trace"),H=B.baggage||DM("baggage"),U=_X(ae,H),oe=Qs();oe.setPropagationContext(U),pi()||(oe.getPropagationContext().propagationSpanId=tc()),oe.setSDKProcessingMetadata({normalizedRequest:nT()}),J(F,{op:"pageload",...$})}),F.on("endPageloadSpan",()=>{O&&q&&(q.setAttribute(Gx,"reportPageLoaded"),q.end())})},afterAllSetup(F){let V=Hh();if(L!=="off"&&Roe(F,{linkPreviousTrace:L,consistentTraceSampling:M}),Ms.location){if(A){const $=Va();Doe(F,{name:Ms.location.pathname,startTime:$?$/1e3:void 0,attributes:{[di]:"url",[wn]:"auto.pageload.browser"}})}R&&sw(({to:$,from:B})=>{if(B===void 0&&(V==null?void 0:V.indexOf($))!==-1){V=void 0;return}V=void 0;const ae=rT($),H=Zx(F),U=H&&I&&Foe(H,K);$oe(F,{name:(ae==null?void 0:ae.pathname)||Ms.location.pathname,attributes:{[di]:"url",[wn]:"auto.navigation.browser"}},{url:$,isRedirect:U})})}y&&Coe(),l&&Uoe(F,h,g,v,t),n&&Lte(),joe(F,{traceFetch:_,traceXHR:j,trackFetchStreamPerformance:w,tracePropagationTargets:F.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:k,enableHTTPTimings:S,onRequestSpanStart:z,onRequestSpanEnd:X})}}};function Doe(e,t,s){e.emit("startPageLoadSpan",t,s),Qs().setTransactionName(t.name);const n=Zx(e);return n&&e.emit("afterStartPageLoadSpan",n),n}function $oe(e,t,s){const{url:n,isRedirect:a}=s||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:a}),e.emit("startNavigationSpan",t,{isRedirect:a});const o=Qs();return o.setTransactionName(t.name),n&&!a&&o.setSDKProcessingMetadata({normalizedRequest:{...nT(),url:n}}),Zx(e)}function DM(e){const t=Ms.document,s=t==null?void 0:t.querySelector(`meta[name=${e}]`);return(s==null?void 0:s.getAttribute("content"))||void 0}function Uoe(e,t,s,n,a){const o=Ms.document;let i;const l=()=>{const c="ui.action.click",u=Zx(e);if(u){const f=Hs(u).op;
73if(["navigation","pageload"].includes(f)){qa&&kt.warn(`[Tracing] Did not create ${c} span because a pageload or navigation span is in progress.`);return}}if(i&&(i.setAttribute(Gx,"interactionInterrupted"),i.end(),i=void 0),!a.name){qa&&kt.warn(`[Tracing] Did not create ${c} transaction because _latestRouteName is missing.`);return}i=fF({name:a.name,op:c,attributes:{[di]:a.source||"url"}},{idleTimeout:t,finalTimeout:s,childSpanTimeout:n})};o&&addEventListener("click",l,{capture:!0})}const oB="_sentry_idleSpan";function Zx(e){return e[oB]}function $M(e,t){ho(e,oB,t)}const UM=1.5;function Foe(e,t){const s=Hs(e),n=wp(),a=s.start_timestamp;return!(n-a>UM||t&&n-t<=UM)}function Boe(e){const t={...e};return IF(t,"react"),gF("react",{version:x.version}),Dse(t)}function qoe(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function zoe(e,t){const s=new WeakSet;function n(a,o){if(!s.has(a)){if(a.cause)return s.add(a),n(a.cause,o);a.cause=o}}n(e,t)}function Hoe(e,{componentStack:t},s){if(qoe(x.version)&&Jj(e)&&t){const n=new Error(e.message);n.name=`React ErrorBoundary ${e.name}`,n.stack=t,zoe(e,n)}return Np(n=>(n.setContext("react",{componentStack:t}),Ku(e,s)))}const Voe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Lk={componentStack:null,error:null,eventId:null};class Goe extends x.Component{constructor(t){super(t),this.state=Lk,this._openFallbackReportDialog=!0;const s=Os();s&&t.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=s.on("afterSendEvent",n=>{!n.type&&this._lastEventId&&n.event_id===this._lastEventId&&lM({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,s){const{componentStack:n}=s,{beforeCapture:a,onError:o,showDialog:i,dialogOptions:l}=this.props;Np(c=>{a&&a(c,t,n);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,f=Hoe(t,s,{mechanism:{handled:u,type:"auto.function.react.error_boundary"}});o&&o(t,n,f),i&&(this._lastEventId=f,this._openFallbackReportDialog&&lM({...l,eventId:f})),this.setState({error:t,componentStack:n,eventId:f})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:s,eventId:n}=this.state,{onUnmount:a}=this.props;a&&(this.state===Lk?a(null,null,null):a(t,s,n)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){const{onReset:t}=this.props,{error:s,componentStack:n,eventId:a}=this.state;t&&t(s,n,a),this.setState(Lk)}render(){const{fallback:t,children:s}=this.props,n=this.state;if(n.componentStack===null)return typeof s=="function"?s():s;const a=typeof t=="function"?x.createElement(t,{error:n.error,componentStack:n.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:n.eventId}):t;return x.isValidElement(a)?a:(t&&Voe&&kt.warn("fallback did not produce a valid ReactElement"),null)}}var Woe=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invali
73d. 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 iB({packageName:e,customMessages:t}){let s=e;const n={...Woe,...t};function a(o,i){if(!i)return`${s}: ${o}`;let l=o;const c=o.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(const u of c){const f=(i[u[1]]||"").toString();l=l.replace(`{{${u[1]}}}`,f)}return`${s}: ${l}`}return{setPackageName({packageName:o}){return typeof o=="string"&&(s=o),this},setMessages({customMessages:o}){return Object.assign(n,o||{}),this},throwInvalidPublishableKeyError(o){throw new Error(a(n.InvalidPublishableKeyErrorMessage,o))},throwInvalidProxyUrl(o){throw new Error(a(n.InvalidProxyUrlErrorMessage,o))},throwMissingPublishableKeyError(){throw new Error(a(n.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw new Error(a(n.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(o){throw new Error(a(n.MissingClerkProvider,o))},throw(o){throw new Error(a(o))}}}var lB=Object.defineProperty,Yoe=Object.getOwnPropertyDescriptor,Koe=Object.getOwnPropertyNames,Joe=Object.prototype.hasOwnProperty,Xoe=(e,t)=>{for(var s in t)lB(e,s,{get:t[s],enumerable:!0})},Qoe=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Koe(t))!Joe.call(e,a)&&a!==s&&lB(e,a,{get:()=>t[a],enumerable:!(n=Yoe(t,a))||n.enumerable});return e},Zoe=(e,t,s)=>(Qoe(e,t,"default"),s),eie={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"}},tie=new Set(["first_factor","second_factor","multi_factor"]),sie=new Set(["strict_mfa","strict","moderate","lax"]),rie=e=>typeof e=="number"&&e>0,nie=e=>tie.has(e),aie=e=>sie.has(e),Dk=e=>e.replace(/^(org:)*/,"org:"),oie=(e,t)=>{const{orgId:s,orgRole:n,orgPermissions:a}=t;return!e.role&&!e.permission||!s||!n||!a?null:e.permission?a.includes(Dk(e.permission)):e.role?Dk(n)===Dk(e.role):null},FM=(e,t)=>{const{org:s,user:n}=lie(e),[a,o]=t.split(":"),i=o||a;return a==="org"?s.includes(i):a==="user"?n.includes(i):[...s,...n].includes(i)},iie=(e,t)=>{const{features:s,plans:n}=t;return e.feature&&s?FM(s,e.feature):e.plan&&n?FM(n,e.plan):null},lie=e=>{const t=e?e.split(",").map(s=>s.trim()):[];return{org:t.filter(s=>s.split(":")[0].includes("o")).map(s=>s.split(":")[1]),user:t.filter(s=>s.split(":")[0].includes("u")).map(s=>s.split(":")[1])}},cie=e=>{if(!e)return!1;const t=a=>typeof a=="string"?eie[a]:a,s=typeof e=="string"&&aie(e),n=typeof e=="object"&&nie(e.level)&&rie(e.afterMinutes);return s||n?t.bind(null,e):!1},die=(e,{factorVerificationAge:t})=>{if(!e.reverification||!t)return null;const s=cie(e.reverification);if(!s)return null;const{level:n,afterMinutes:a}=s(),[o,i]=t,l=o!==-1?a>o:null,c=i!==-1?a>i:null;switch(n){case"first_factor":return l;case"second_factor":return i!==-1?c:l;case"multi_factor":return i===-1?l:l&&c}},uie=e=>t=>{if(!e.userId)return!1;const s=iie(t,e),n=oie(t,e),a=die(t,e);return[s||n,a].some(o=>o===null)?[s||n,a].some(o=>o===!0):[s||n,a].every(o=>o===!0)},pie=({authObject:{sessionId:e,sessionStatus:t,userId:s,actor:n,orgId:a,orgRole:o,orgSlug:i,signOut:l,getToken:c,has:u,sessionClaims:f},options:{treatPendingAsSignedOut:h=!0}})=>{if(e===void 0&&s===void 0)return{isLoaded:!1,isSignedIn:void 0,sessionId:e,sessionClaims:void 0,userId:s,actor:void 0,orgId:void 0,orgRole:void 0,orgSlug:void 0,has:void 0,signOut:l,getToken:c};if(e===null&&s===null)return{isLoaded:!0,isSignedIn:!1,sessionId:e,userId:s,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:l,getToken:c};if(h&&t==="pending")return{isLoaded:!0,isSignedIn:!1,sessionId:null,userId:null,sessionClaims:null,actor:null,orgId:null,orgRole:null,orgSlug:null,has:()=>!1,signOut:l,getToken:c};if(e&&f&&s&&a&&o)return{isLoaded:!0,isSignedIn:!0,sessionId:e,sessionClaims:f,userId:s,actor:n||null,orgId:a,orgRole:o,orgSlug:i||null,has:u,signOut:l,getToken:c};if(e&&f&&s&&!a)return{isLoaded:!0,isSignedIn:!0,sessionId:e,sessionClaims:f,userId:s,actor:n||null,orgId:null,orgRole:null,orgSlug:null,has:u,signOut:l,getToken:c}},cB=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e,fie=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],dB="pk_live_",hie="pk_test_";function BM(e,t={}
73){if(e=e||"",!e||!EC(e)){if(t.fatal&&!e)throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(t.fatal&&!EC(e))throw new Error("Publishable key not valid.");return null}const s=e.startsWith(dB)?"production":"development";let n=cB(e.split("_")[2]);return n=n.slice(0,-1),t.proxyUrl?n=t.proxyUrl:s!=="development"&&t.domain&&t.isSatellite&&(n=`clerk.${t.domain}`),{instanceType:s,frontendApi:n}}function EC(e=""){try{const t=e.startsWith(dB)||e.startsWith(hie),s=cB(e.split("_")[2]||"").endsWith("$");return t&&s}catch{return!1}}function mie(){const e=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;const s=typeof t=="string"?t:t.hostname;let n=e.get(s);return n===void 0&&(n=fie.some(a=>s.endsWith(a)),e.set(s,n)),n}}}var gie="METHOD_CALLED";function uB(e,t){return{event:gie,payload:{method:e,...t}}}var $k={exports:{}},Uk={};/** 74 * @license React 75 * use-sync-external-store-shim.production.js 76 * 77 * Copyright (c) Meta Platforms, Inc. and affiliates. 78 * 79 * This source code is licensed under the MIT license found in the 80 * LICENSE file in the root directory of this source tree. 81 */var qM;function xie(){if(qM)return Uk;qM=1;var e=Yj();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var s=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function l(h,g){var v=g(),y=n({inst:{value:v,getSnapshot:g}}),_=y[0].inst,j=y[1];return o(function(){_.value=v,_.getSnapshot=g,c(_)&&j({inst:_})},[h,v,g]),a(function(){return c(_)&&j({inst:_}),h(function(){c(_)&&j({inst:_})})},[h]),i(v),v}function c(h){var g=h.getSnapshot;h=h.value;try{var v=g();return!s(h,v)}catch{return!0}}function u(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return Uk.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Uk}var zM;function vie(){return zM||(zM=1,$k.exports=xie()),$k.exports}var pB=vie();const fB=0,hB=1,mB=2,HM=3;var VM=Object.prototype.hasOwnProperty;function TC(e,t){var s,n;if(e===t)return!0;if(e&&t&&(s=e.constructor)===t.constructor){if(s===Date)return e.getTime()===t.getTime();if(s===RegExp)return e.toString()===t.toString();if(s===Array){if((n=e.length)===t.length)for(;n--&&TC(e[n],t[n]););return n===-1}if(!s||typeof e=="object"){n=0;for(s in e)if(VM.call(e,s)&&++n&&!VM.call(t,s)||!(s in t)||!TC(e[s],t[s]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}const ci=new WeakMap,ld=()=>{},_n=ld(),V_=Object,Ns=e=>e===_n,Do=e=>typeof e=="function",dc=(e,t)=>({...e,...t}),gB=e=>Do(e.then),Fk={},Py={},RT="undefined",Hv=typeof window!=RT,RC=typeof document!=RT,bie=Hv&&"Deno"in window,yie=()=>Hv&&typeof window.requestAnimationFrame!=RT,td=(e,t)=>{const s=ci.get(e);return[()=>!Ns(t)&&e.get(t)||Fk,n=>{if(!Ns(t)){const a=e.get(t);t in Py||(Py[t]=a),s[5](t,dc(a,n),a||Fk)}},s[6],()=>!Ns(t)&&t in Py?Py[t]:!Ns(t)&&e.get(t)||Fk]};let AC=!0;const _ie=()=>AC,[PC,IC]=Hv&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ld,ld],jie=()=>{const e=RC&&document.visibilityState;return Ns(e)||e!=="hidden"},wie=e=>(RC&&document.addEventListener("visibilitychange",e),PC("focus",e),()=>{RC&&document.removeEventListener("visibilitychange",e),IC("focus",e)}),Nie=e=>{const t=()=>{AC=!0,e()},s=()=>{AC=!1};return PC("online",t),PC("offline",s),()=>{IC("online",t),IC("offline",s)}},kie={isOnline:_ie,isVisible:jie},Sie={initFocus:wie,initReconnect:Nie},GM=!pe.useId,ev=!Hv||bie,Cie=e=>yie()?window.requestAnimationFrame(e):setTimeout(e,1),wx=ev?x.useEffect:x.useLayoutEffect,Bk=typeof navigator<"u"&&navigator.connection,WM=!ev&&Bk&&(["slow-2g","2g"].includes(Bk.effectiveType)||Bk.saveData),Iy=new WeakMap,Eie=e=>V_.prototype.toString.call(e),qk=(e,t)=>e===`[object ${t}]`;let Tie=0;const MC=e=>{const t=typeof e,s=Eie(e),n=qk(s,"Date"),a=qk(s,"RegExp"),o=qk(s,"Object");let i,l;if(V_(e)===e&&!n&&!a){if(i=Iy.get(e),i)return i;if(i=++Tie+"~",Iy.set(e,i),Array.isArray(e)){for(i="@",l=0;l<e.length;l++)i+=MC(e[l])+",";Iy.set(e,i)}if(o){i="#";const c=V_.keys(e).sort();for(;!Ns(l=c.pop());)Ns(e[l])||(i+=l+":"+MC(e[l])+",");Iy.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i}
81,vh=e=>{if(Do(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?MC(e):"",[e,t]};let Rie=0;const OC=()=>++Rie;async function xB(...e){const[t,s,n,a]=e,o=dc({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let i=o.populateCache;const l=o.rollbackOnError;let c=o.optimisticData;const u=g=>typeof l=="function"?l(g):l!==!1,f=o.throwOnError;if(Do(s)){const g=s,v=[],y=t.keys();for(const _ of y)!/^\$(inf|sub)\$/.test(_)&&g(t.get(_)._k)&&v.push(_);return Promise.all(v.map(h))}return h(s);async function h(g){const[v]=vh(g);if(!v)return;const[y,_]=td(t,v),[j,w,k,S]=ci.get(t),E=()=>{const W=j[v];return(Do(o.revalidate)?o.revalidate(y().data,g):o.revalidate!==!1)&&(delete k[v],delete S[v],W&&W[0])?W[0](mB).then(()=>y().data):y().data};if(e.length<3)return E();let T=n,A,R=!1;const I=OC();w[v]=[I,0];const L=!Ns(c),M=y(),O=M.data,z=M._c,X=Ns(z)?O:z;if(L&&(c=Do(c)?c(X,O):c,_({data:c,_c:X})),Do(T))try{T=T(X)}catch(W){A=W,R=!0}if(T&&gB(T))if(T=await T.catch(W=>{A=W,R=!0}),I!==w[v][0]){if(R)throw A;return T}else R&&L&&u(A)&&(i=!0,_({data:X,_c:_n}));if(i&&!R)if(Do(i)){const W=i(T,X);_({data:W,error:_n,_c:_n})}else _({data:T,error:_n,_c:_n});if(w[v][1]=OC(),Promise.resolve(E()).then(()=>{_({_c:_n})}),R){if(f)throw A;return}return T}}const YM=(e,t)=>{for(const s in e)e[s][0]&&e[s][0](t)},vB=(e,t)=>{if(!ci.has(e)){const s=dc(Sie,t),n=Object.create(null),a=xB.bind(_n,e);let o=ld;const i=Object.create(null),l=(f,h)=>{const g=i[f]||[];return i[f]=g,g.push(h),()=>g.splice(g.indexOf(h),1)},c=(f,h,g)=>{e.set(f,h);const v=i[f];if(v)for(const y of v)y(h,g)},u=()=>{if(!ci.has(e)&&(ci.set(e,[n,Object.create(null),Object.create(null),Object.create(null),a,c,l]),!ev)){const f=s.initFocus(setTimeout.bind(_n,YM.bind(_n,n,fB))),h=s.initReconnect(setTimeout.bind(_n,YM.bind(_n,n,hB)));o=()=>{f&&f(),h&&h(),ci.delete(e)}}};return u(),[e,a,u,o]}return[e,ci.get(e)[4]]},Aie=(e,t,s,n,a)=>{const o=s.errorRetryCount,i=a.retryCount,l=~~((Math.random()+.5)*(1<<(i<8?i:8)))*s.errorRetryInterval;!Ns(o)&&i>o||setTimeout(n,l,a)},Pie=TC,[Vv,bB]=vB(new Map),yB=dc({onLoadingSlow:ld,onSuccess:ld,onError:ld,onErrorRetry:Aie,onDiscarded:ld,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:WM?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:WM?5e3:3e3,compare:Pie,isPaused:()=>!1,cache:Vv,mutate:bB,fallback:{}},kie),_B=(e,t)=>{const s=dc(e,t);if(t){const{use:n,fallback:a}=e,{use:o,fallback:i}=t;n&&o&&(s.use=n.concat(o)),a&&i&&(s.fallback=dc(a,i))}return s},LC=x.createContext({}),Iie=e=>{const{value:t}=e,s=x.useContext(LC),n=Do(t),a=x.useMemo(()=>n?t(s):t,[n,s,t]),o=x.useMemo(()=>n?a:_B(s,a),[n,s,a]),i=a&&a.provider,l=x.useRef(_n);i&&!l.current&&(l.current=vB(i(o.cache||Vv),a));const c=l.current;return c&&(o.cache=c[0],o.mutate=c[1]),wx(()=>{if(c)return c[2]&&c[2](),c[3]},[]),x.createElement(LC.Provider,dc(e,{value:o}))},jB="$inf$",wB=Hv&&window.__SWR_DEVTOOLS_USE__,Mie=wB?window.__SWR_DEVTOOLS_USE__:[],Oie=()=>{wB&&(window.__SWR_DEVTOOLS_REACT__=pe)},NB=e=>Do(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],kB=()=>dc(yB,x.useContext(LC)),Lie=(e,t)=>{const[s,n]=vh(e),[,,,a]=ci.get(Vv);if(a[s])return a[s];const o=t(n);return a[s]=o,o},Die=e=>(t,s,n)=>e(t,s&&((...o)=>{const[i]=vh(t),[,,,l]=ci.get(Vv);if(i.startsWith(jB))return s(...o);const c=l[i];return Ns(c)?s(...o):(delete l[i],c)}),n),$ie=Mie.concat(Die),Uie=e=>function(...s){const n=kB(),[a,o,i]=NB(s),l=_B(n,i);let c=e;const{use:u}=l,f=(u||[]).concat($ie);for(let h=f.length;h--;)c=f[h](c);return c(a,o||l.fetcher||null,l)},Fie=(e,t,s)=>{const n=t[e]||(t[e]=[]);return n.push(s),()=>{const a=n.indexOf(s);a>=0&&(n[a]=n[n.length-1],n.pop())}},Bie=(e,t)=>(...s)=>{const[n,a,o]=NB(s),i=(o.use||[]).concat(t);return e(n,a,{...o,use:i})};Oie();const qie=()=>{},zie=qie(),DC=Object,KM=e=>e===zie,Hie=e=>typeof e=="function",My=new WeakMap,Vie=e=>DC.prototype.toString.call(e),zk=(e,t)=>e===`[object ${t}]`;let Gie=0;const $C=e=>{const t=typeof e,s=Vie(e),n=zk(s,"Date"),a=zk(s,"RegExp"),o=zk(s,"Object");let i,l;if(DC(e)===e&&!n&&!a){if(i=My.get(e),i)return i;if(i=++Gie+"~",My.set(e,i),Array.isArray(e)){for(i="@",l=0;l<e.length;l++)i+=$C(e[l])+",";My.set(e,i)}if(o){i="#";const c=DC.keys(e).sort();for(;!KM(l=c.pop());)KM(e[l])||(i+=l+":"+$C(e[l])+",");My.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},Wie=e=>{if(Hie(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?$C(e):"",[e,t]},Yie=e=>Wie(e)[0],Hk=pe.use||(e=>
81{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Vk={dedupe:!0},Kie=(e,t,s)=>{const{cache:n,compare:a,suspense:o,fallbackData:i,revalidateOnMount:l,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:h,keepPreviousData:g}=s,[v,y,_,j]=ci.get(n),[w,k]=vh(e),S=x.useRef(!1),E=x.useRef(!1),T=x.useRef(w),A=x.useRef(t),R=x.useRef(s),I=()=>R.current,L=()=>I().isVisible()&&I().isOnline(),[M,O,z,X]=td(n,w),W=x.useRef({}).current,K=Ns(i)?Ns(s.fallback)?_n:s.fallback[w]:i,q=(de,Me)=>{for(const je in W){const Ae=je;if(Ae==="data"){if(!a(de[Ae],Me[Ae])&&(!Ns(de[Ae])||!a(oe,Me[Ae])))return!1}else if(Me[Ae]!==de[Ae])return!1}return!0},J=x.useMemo(()=>{const de=!w||!t?!1:Ns(l)?I().isPaused()||o?!1:c!==!1:l,Me=De=>{const ct=dc(De);return delete ct._k,de?{isValidating:!0,isLoading:!0,...ct}:ct},je=M(),Ae=X(),Oe=Me(je),Ke=je===Ae?Oe:Me(Ae);let ut=Oe;return[()=>{const De=Me(M());return q(De,ut)?(ut.data=De.data,ut.isLoading=De.isLoading,ut.isValidating=De.isValidating,ut.error=De.error,ut):(ut=De,De)},()=>Ke]},[n,w]),F=pB.useSyncExternalStore(x.useCallback(de=>z(w,(Me,je)=>{q(je,Me)||de()}),[n,w]),J[0],J[1]),V=!S.current,$=v[w]&&v[w].length>0,B=F.data,ae=Ns(B)?K&&gB(K)?Hk(K):K:B,H=F.error,U=x.useRef(ae),oe=g?Ns(B)?Ns(U.current)?ae:U.current:B:ae,fe=$&&!Ns(H)?!1:V&&!Ns(l)?l:I().isPaused()?!1:o?Ns(ae)?!1:c:Ns(ae)||c,Q=!!(w&&t&&V&&fe),le=Ns(F.isValidating)?Q:F.isValidating,Se=Ns(F.isLoading)?Q:F.isLoading,we=x.useCallback(async de=>{const Me=A.current;if(!w||!Me||E.current||I().isPaused())return!1;let je,Ae,Oe=!0;const Ke=de||{},ut=!_[w]||!Ke.dedupe,De=()=>GM?!E.current&&w===T.current&&S.current:w===T.current,ct={isValidating:!1,isLoading:!1},rt=()=>{O(ct)},mt=()=>{const gt=_[w];gt&>[1]===Ae&&delete _[w]},vt={isValidating:!0};Ns(M().data)&&(vt.isLoading=!0);try{if(ut&&(O(vt),s.loadingTimeout&&Ns(M().data)&&setTimeout(()=>{Oe&&De()&&I().onLoadingSlow(w,s)},s.loadingTimeout),_[w]=[Me(k),OC()]),[je,Ae]=_[w],je=await je,ut&&setTimeout(mt,s.dedupingInterval),!_[w]||_[w][1]!==Ae)return ut&&De()&&I().onDiscarded(w),!1;ct.error=_n;const gt=y[w];if(!Ns(gt)&&(Ae<=gt[0]||Ae<=gt[1]||gt[1]===0))return rt(),ut&&De()&&I().onDiscarded(w),!1;const Be=M().data;ct.data=a(Be,je)?Be:je,ut&&De()&&I().onSuccess(je,w,s)}catch(gt){mt();const Be=I(),{shouldRetryOnError:ve}=Be;Be.isPaused()||(ct.error=gt,ut&&De()&&(Be.onError(gt,w,Be),(ve===!0||Do(ve)&&ve(gt))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||L())&&Be.onErrorRetry(gt,w,Be,be=>{const nt=v[w];nt&&nt[0]&&nt[0](HM,be)},{retryCount:(Ke.retryCount||0)+1,dedupe:!0})))}return Oe=!1,rt(),!0},[w,n]),Le=x.useCallback((...de)=>xB(n,T.current,...de),[]);if(wx(()=>{A.current=t,R.current=s,Ns(B)||(U.current=B)}),wx(()=>{if(!w)return;const de=we.bind(_n,Vk);let Me=0;I().revalidateOnFocus&&(Me=Date.now()+I().focusThrottleInterval);const Ae=Fie(w,v,(Oe,Ke={})=>{if(Oe==fB){const ut=Date.now();I().revalidateOnFocus&&ut>Me&&L()&&(Me=ut+I().focusThrottleInterval,de())}else if(Oe==hB)I().revalidateOnReconnect&&L()&&de();else{if(Oe==mB)return we();if(Oe==HM)return we(Ke)}});return E.current=!1,T.current=w,S.current=!0,O({_k:k}),fe&&(_[w]||(Ns(ae)||ev?de():Cie(de))),()=>{E.current=!0,Ae()}},[w]),wx(()=>{let de;function Me(){const Ae=Do(u)?u(M().data):u;Ae&&de!==-1&&(de=setTimeout(je,Ae))}function je(){!M().error&&(f||I().isVisible())&&(h||I().isOnline())?we(Vk).then(Me):Me()}return Me(),()=>{de&&(clearTimeout(de),de=-1)}},[u,f,h,w]),x.useDebugValue(oe),o&&Ns(ae)&&w){if(!GM&&ev)throw new Error("Fallback data is required when using Suspense in SSR.");A.current=t,R.current=s,E.current=!1;const de=j[w];if(!Ns(de)){const Me=Le(de);Hk(Me)}if(Ns(H)){const Me=we(Vk);Ns(oe)||(Me.status="fulfilled",Me.value=!0),Hk(Me)}else throw H}return{mutate:Le,get data(){return W.data=!0,oe},get error(){return W.error=!0,H},get isValidating(){return W.isValidating=!0,le},get isLoading(){return W.isLoading=!0,Se}}},Jie=V_.defineProperty(Iie,"defaultValue",{value:yB}),AT=Uie(Kie),Xie=Object.freeze(Object.defineProperty({__proto__:null,SWRConfig:Jie,default:AT,mutate:bB,preload:Lie,unstable_serialize:Yie,useSWRConfig:kB},Symbol.toStringTag,{value:"Module"})),Qie=()=>{},Zie=Qie(),UC=Object,JM=e=>e===Zie,ele=e=>typeof e=="function",Oy=new WeakMap,tle=e=>UC.prototype.toString.call(e),Gk=(e,t)=>e===`[object ${t}]`;let sle=0;const FC=e=>{const t=typeof e,s=tle(e),n=Gk(s,"Date"),a=Gk(s,"RegExp"),o=Gk(s,"Object");let i,l;if(UC(e)===e&&!n&&!a){if(i=Oy.get(e),i)return i;if(i=++sle+"~",Oy.set(e,i),Array.isArray(e)){for(i="@",l=0;l<e.length;l++)i+=FC(e[l])+",";Oy.set(e,i)}if(o){i="#";const c=UC.keys(e).sort();for(;!JM(l=c.pop());)JM(e[l])||(i+=l+":"+FC(e[l])+",");Oy.set(e,i)}}else i=n?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},rle=e=>{if(ele(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?FC(e):"",[e,t]},nle=e=>rle(e?e(0,null):null)[0],Wk=Promise.resolve(),ale=e=>(t,s,n)=>{const a=x.useRef(!1),{cache:o,initialSize:i=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:f=!1,parallel:h=!1}=n,[,,,g]=ci.get(Vv);let v;try{v=nle(t),v&&(v=jB+v)}catch{}const[y,_,j]=td(o,v),w=x.useCallback(()=>Ns(y()._l)?i:y()._l,[o,v,i]);pB.useSyncExternalStore(x.useCallback(I=>v?j(v,()=>{I()}):()=>{},[o,v]),w,w);const k=x.useCallback(()=>{const I=y()._l;return Ns(I)?i:I},[v,i]),S=x.useRef(k());wx(()=>
81{if(!a.current){a.current=!0;return}v&&_({_l:c?S.current:k()})},[v,o]);const E=f&&!a.current,T=e(v,async I=>{const L=y()._i,M=y()._r;_({_r:_n});const O=[],z=k(),[X]=td(o,I),W=X().data,K=[];let q=null;for(let J=0;J<z;++J){const[F,V]=vh(t(J,h?null:q));if(!F)break;const[$,B]=td(o,F);let ae=$().data;const H=l||L||Ns(ae)||u&&!J&&!Ns(W)||E||W&&!Ns(W[J])&&!n.compare(W[J],ae);if(s&&(typeof M=="function"?M(ae,V):H)){const U=async()=>{if(!(F in g))ae=await s(V);else{const fe=g[F];delete g[F],ae=await fe}B({data:ae,_k:V}),O[J]=ae};h?K.push(U):await U()}else O[J]=ae;h||(q=ae)}return h&&await Promise.all(K.map(J=>J())),_({_i:_n}),O},n),A=x.useCallback(function(I,L){const M=typeof L=="boolean"?{revalidate:L}:L||{},O=M.revalidate!==!1;return v?(O&&(Ns(I)?_({_i:!0,_r:M.revalidate}):_({_i:!1,_r:M.revalidate})),arguments.length?T.mutate(I,{...M,revalidate:O}):T.mutate()):Wk},[v,o]),R=x.useCallback(I=>{if(!v)return Wk;const[,L]=td(o,v);let M;if(Do(I)?M=I(k()):typeof I=="number"&&(M=I),typeof M!="number")return Wk;L({_l:M}),S.current=M;const O=[],[z]=td(o,v);let X=null;for(let W=0;W<M;++W){const[K]=vh(t(W,X)),[q]=td(o,K),J=K?q().data:_n;if(Ns(J))return A(z().data);O.push(J),X=J}return A(O)},[v,o,A,k]);return{size:k(),setSize:R,mutate:A,get data(){return T.data},get error(){return T.error},get isValidating(){return T.isValidating},get isLoading(){return T.isLoading}}},ole=Bie(AT,ale);var XM=Object.prototype.hasOwnProperty;function QM(e,t,s){for(s of e.keys())if(Nx(s,t))return s}function Nx(e,t){var s,n,a;if(e===t)return!0;if(e&&t&&(s=e.constructor)===t.constructor){if(s===Date)return e.getTime()===t.getTime();if(s===RegExp)return e.toString()===t.toString();if(s===Array){if((n=e.length)===t.length)for(;n--&&Nx(e[n],t[n]););return n===-1}if(s===Set){if(e.size!==t.size)return!1;for(n of e)if(a=n,a&&typeof a=="object"&&(a=QM(t,a),!a)||!t.has(a))return!1;return!0}if(s===Map){if(e.size!==t.size)return!1;for(n of e)if(a=n[0],a&&typeof a=="object"&&(a=QM(t,a),!a)||!Nx(n[1],t.get(a)))return!1;return!0}if(s===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(s===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!s||typeof e=="object"){n=0;for(s in e)if(XM.call(e,s)&&++n&&!XM.call(t,s)||!(s in t)||!Nx(e[s],t[s]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function ile(e,t){if(!e)throw typeof t=="string"?new Error(t):new Error(`${t.displayName} not found`)}var Jh=(e,t)=>{const{assertCtxFn:s=ile}={},n=pe.createContext(void 0);return n.displayName=e,[n,()=>{const i=pe.useContext(n);return s(i,`${e} not found`),i.value},()=>{const i=pe.useContext(n);return i?i.value:{}}]},PT={};Xoe(PT,{useSWR:()=>AT,useSWRInfinite:()=>ole});Zoe(PT,Xie);var[SB,IT]=Jh("ClerkInstanceContext"),[lle,cle]=Jh("UserContext"),[dle,SOe]=Jh("ClientContext"),[ule,COe]=Jh("SessionContext");pe.createContext({});var[ple,EOe]=Jh("OrganizationContext"),fle=({children:e,organization:t,swrConfig:s})=>pe.createElement(PT.SWRConfig,{value:s},pe.createElement(ple.Provider,{value:{value:{organization:t}}},e));function MT(e){if(!pe.useContext(SB)){if(typeof e=="function"){e();return}throw new Error(`${e} can only be used within the <ClerkProvider /> component. 82 83Possible fixes: 841. Ensure that the <ClerkProvider /> is correctly wrapping your application where this component is used. 852. 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. 86 87Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}typeof window<"u"?pe.useLayoutEffect:pe.useEffect;var ZM="useUser";function _r(){var s;MT(ZM);const e=cle();return(s=IT().telemetry)==null||s.record(uB(ZM)),e===void 0?{isLoaded:!1,isSignedIn:void 0,user:void 0}:e===null?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:e}}var hle=()=>(MT("useClerk"),IT()),eO=Nx,mle=()=>{try{return!1}catch{}return!1},gle=()=>{try{return!1}catch{}return!1},xle=()=>{try{return!0}catch{}return!1},tO=new Set,OT=(e,t,s)=>{const n=gle()||xle(),a=e;tO.has(a)||n||(tO.add(a),console.warn(`Clerk - DEPRECATION WARNING: "${e}" is deprecated and will be removed in the next major release. 88${t}`))},Xi=iB({packageName:"@clerk/clerk-react"});function vle(e){Xi.setMessages(e).setPackageName(e)}var[ble,yle]=Jh("AuthContext"),_le=SB,CB=IT,jle="You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.",wle=e=>`You've passed multiple children components to <${e}/>. You can only pass a single child component or text.`,Nle="Invalid state. Feel free to submit a bug or reach out to supp
88ort here: https://clerk.com/support",Yk="Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.",kle="<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",Sle="<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",Cle="<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",Ele="<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",Tle=e=>`<${e} /> can only accept <${e}.Page /> and <${e}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`,Rle=e=>`Missing props. <${e}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`,Ale=e=>`Missing props. <${e}.Link /> component requires the following props: url, label and labelIcon.`,Ple="<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.",Ile="<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.",Mle="<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.",Ole="<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.",Lle="<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.",Dle="Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.",$le="Missing props. <UserButton.Action /> component requires the following props: label.",cw=e=>{MT(()=>{Xi.throwMissingClerkProviderError({source:e})})},EB=e=>new Promise(t=>{const s=n=>{["ready","degraded"].includes(n)&&(t(),e.off("status",s))};e.on("status",s,{notify:!0})}),Ule=e=>async t=>(await EB(e),e.session?e.session.getToken(t):null),Fle=e=>async(...t)=>(await EB(e),e.signOut(...t)),zt=(e={})=>{var t,s;cw("useAuth");const{treatPendingAsSignedOut:n,...a}=e??{},o=a;let l=yle();l.sessionId===void 0&&l.userId===void 0&&(l=o??{});const c=CB(),u=x.useCallback(Ule(c),[c]),f=x.useCallback(Fle(c),[c]);return(t=c.telemetry)==null||t.record(uB("useAuth",{treatPendingAsSignedOut:n})),Ble({...l,getToken:u,signOut:f},{treatPendingAsSignedOut:n??((s=c.__internal_getOption)==null?void 0:s.call(c,"treatPendingAsSignedOut"))})};function Ble(e,{treatPendingAsSignedOut:t=!0}={}){const{userId:s,orgId:n,orgRole:a,has:o,signOut:i,getToken:l,orgPermissions:c,factorVerificationAge:u,sessionClaims:f}=e??{},h=x.useCallback(v=>o?o(v):uie({userId:s,orgId:n,orgRole:a,orgPermissions:c,factorVerificationAge:u,features:(f==null?void 0:f.fea)||"",plans:(f==null?void 0:f.pla)||""})(v),[o,s,n,a,c,u]),g=pie({authObject:{...e,getToken:l,signOut:i,has:h},options:{treatPendingAsSignedOut:t}});return g||Xi.throw(Nle)}var Gr=(e,t)=>{const n=(typeof t=="string"?t:t==null?void 0:t.component)||e.displayName||e.name||"Component";e.displayName=n;const a=typeof t=="string"?void 0:t,o=i=>{cw(n||"withClerk");const l=CB();return!l.loaded&&!(a!=null&&a.renderWhileLoading)?null:pe.createElement(e,{...i,component:n,clerk:l})};return o.displayName=`withClerk(${n})`,o},vd=({children:e,treatPendingAsSignedOut:t})=>{cw("SignedIn");const{userId:s}=zt({treatPendingAsSignedOut:t});return s?e:null},Gi=({children:e,treatPendingAsSignedOut:t})=>{cw("SignedOut");const{userId:s}=zt({treatPendingAsSignedOut:t});return s===null?e:null};Gr(({clerk:e,...t})=>{const{client:s,session:n}=e,a=s.signedInSessions?s.signedInSessions.length>0:s.activeSessions&&s.activeSessions.length>0;return pe.useEffect(()=>{n===null&&a?e.redirectToAfterSignOut():e.redirectToSignIn(t)},[]),null},"RedirectToSignIn");Gr(({clerk:e,...t})=>(pe.useEffect(()=>{e.redirectToSignUp(t)},[]),null),"RedirectToSignUp");Gr(({clerk:e})=>(pe.useEffect(()=>{OT("RedirectToUserProfile","Use the `redirectToUserProfile()` method instead."),e.redirectToUserProfile()},[]),null),"RedirectToUserProfile");Gr(({clerk:e})=>(pe.useEffect(()=>{OT("RedirectToOrganizationProfile","Use the `redirectToOrganizationProfile()` method instead."),e.redirectToOrganizationProfile()},[]),null),"RedirectToOrganizationProfile");Gr(({clerk:e})=>(pe.useEffect(()=>{OT("RedirectToCreateOrganization","Use the `redirectToCreateOrganization()` method instead."),e.redirectToCreateOrganization()},[]),null),"RedirectToCreateOrganization");Gr(({clerk:e,...t})=>(pe.useEffect(()=>{e.handleRedirectCallback(t)},[]),null),"AuthenticateWithRedirectCallback");var TB=e=>{throw TypeError(e)},LT=(e,t,s)=>t.has(e)||TB("Cannot "+s),Pr=(e,t,s)=>(LT(e,t,"read from private field"),s?s.call(e):t.get(e)),Cu=(e,t,s)=>t.has(e)?TB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),xf=(e,t,s,n)=>(LT(e,t,"write to private field"),t.set(e,s),s),sO=(e,t,s)=>(LT(e,t,"access private method"),s),qle=(e,t="5.70.0")=>{if(e)return e;const s=zle(t);return s?s==="snapshot"?"5.70.0":s:Hle(t)},zle=e=>{var t;return(t=e.trim().replace(/^v/,"").match(/-(.+?)(\.|$)/))==null?void 0:t[1]},Hle=e=>e.trim().replace(/^v/,"").split(".")[0];function Vle(e){return e?Gle(e)||RB(e):!0}function Gle(e){return/^http(s)?:\/\//.test(e||"")}function RB(e){return e.startsWith("/")}function Wle(e){return e?RB(e)?new URL(e,window.location.origin).toString():e:""}function Yle(e){if(!e)return"";let t;if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;
88else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}var Kle={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(e,t)=>t<5,retryImmediately:!1,jitter:!0},Jle=100,AB=async e=>new Promise(t=>setTimeout(t,e)),PB=(e,t)=>t?e*(1+Math.random()):e,Xle=e=>{let t=0;const s=()=>{const n=e.initialDelay,a=e.factor;let o=n*Math.pow(a,t);return o=PB(o,e.jitter),Math.min(e.maxDelayBetweenRetries||o,o)};return async()=>{await AB(s()),t++}},Qle=async(e,t={})=>{let s=0;const{shouldRetry:n,initialDelay:a,maxDelayBetweenRetries:o,factor:i,retryImmediately:l,jitter:c}={...Kle,...t},u=Xle({initialDelay:a,maxDelayBetweenRetries:o,factor:i,jitter:c});for(;;)try{return await e()}catch(f){if(s++,!n(f,s))throw f;l&&s===1?await AB(PB(Jle,c)):await u()}},Zle="loadScript cannot be called when document does not exist",ece="loadScript cannot be called without a src";async function tce(e="",t){const{async:s,defer:n,beforeLoad:a,crossOrigin:o,nonce:i}=t||{};return Qle(()=>new Promise((c,u)=>{e||u(new Error(ece)),(!document||!document.body)&&u(Zle);const f=document.createElement("script");o&&f.setAttribute("crossorigin",o),f.async=s||!1,f.defer=n||!1,f.addEventListener("load",()=>{f.remove(),c(f)}),f.addEventListener("error",()=>{f.remove(),u()}),f.src=e,f.nonce=i,a==null||a(f),document.body.appendChild(f)}),{shouldRetry:(c,u)=>u<=5})}var rO="Clerk: Failed to load Clerk",{isDevOrStagingUrl:sce}=mie(),IB=iB({packageName:"@clerk/shared"});function rce(e){IB.setPackageName({packageName:e})}var nce=async e=>{const t=document.querySelector("script[data-clerk-js-script]");if(t)return new Promise((s,n)=>{t.addEventListener("load",()=>{s(t)}),t.addEventListener("error",()=>{n(rO)})});if(!(e!=null&&e.publishableKey)){IB.throwMissingPublishableKeyError();return}return tce(ace(e),{async:!0,crossOrigin:"anonymous",nonce:e.nonce,beforeLoad:ice(e)}).catch(()=>{throw new Error(rO)})},ace=e=>{var f,h;const{clerkJSUrl:t,clerkJSVariant:s,clerkJSVersion:n,proxyUrl:a,domain:o,publishableKey:i}=e;if(t)return t;let l="";
88a&&Vle(a)?l=Wle(a).replace(/http(s)?:\/\//,""):o&&!sce(((f=BM(i))==null?void 0:f.frontendApi)||"")?l=Yle(o):l=((h=BM(i))==null?void 0:h.frontendApi)||"";const c=s?`${s.replace(/\.+$/,"")}.`:"",u=qle(n);return`https://${l}/npm/@clerk/clerk-js@${u}/dist/clerk.${c}browser.js`},oce=e=>{const t={};return e.publishableKey&&(t["data-clerk-publishable-key"]=e.publishableKey),e.proxyUrl&&(t["data-clerk-proxy-url"]=e.proxyUrl),e.domain&&(t["data-clerk-domain"]=e.domain),e.nonce&&(t.nonce=e.nonce),t},ice=e=>t=>{const s=oce(e);for(const n in s)t.setAttribute(n,s[n])},_a=e=>{mle()&&console.error(`Clerk: ${e}`)};function Kk(e,t,s){if(typeof e=="function")return e(t);if(typeof e<"u")return e;if(typeof s<"u")return s}var Xh=TU();const MB=EU(Xh);var nO=(e,...t)=>{const s={...e};for(const n of t)delete s[n];return s},lce=(e,t,s)=>!e&&s?cce(s):dce(t),cce=e=>{const t=e.userId,s=e.user,n=e.sessionId,a=e.sessionStatus,o=e.sessionClaims,i=e.session,l=e.organization,c=e.orgId,u=e.orgRole,f=e.orgPermissions,h=e.orgSlug,g=e.actor,v=e.factorVerificationAge;return{userId:t,user:s,sessionId:n,session:i,sessionStatus:a,sessionClaims:o,organization:l,orgId:c,orgRole:u,orgPermissions:f,orgSlug:h,actor:g,factorVerificationAge:v}},dce=e=>{var _,j,w,k;const t=e.user?e.user.id:e.user,s=e.user,n=e.session?e.session.id:e.session,a=e.session,o=(_=e.session)==null?void 0:_.status,i=e.session?(w=(j=e.session.lastActiveToken)==null?void 0:j.jwt)==null?void 0:w.claims:null,l=e.session?e.session.factorVerificationAge:null,c=a==null?void 0:a.actor,u=e.organization,f=e.organization?e.organization.id:e.organization,h=u==null?void 0:u.slug,g=u&&((k=s==null?void 0:s.organizationMemberships)==null?void 0:k.find(S=>S.organization.id===f)),v=g&&g.permissions,y=g&&g.role;return{userId:t,user:s,sessionId:n,session:a,sessionStatus:o,sessionClaims:i,organization:u,orgId:f,orgRole:y,orgSlug:h,orgPermissions:v,actor:c,factorVerificationAge:l}};function aO(){return typeof window<"u"}var oO=(e,t,s,n,a)=>{const{notify:o}=a||{};let i=e.get(s);i||(i=[],e.set(s,i)),i.push(n),o&&t.has(s)&&n(t.get(s))},iO=(e,t,s)=>(e.get(t)||[]).map(n=>n(s)),lO=(e,t,s)=>{const n=e.get(t);n&&(s?n.splice(n.indexOf(s)>>>0,1):e.set(t,[]))},uce=()=>{const e=new Map,t=new Map,s=new Map;return{on:(...a)=>oO(e,t,...a),prioritizedOn:(...a)=>oO(s,t,...a),emit:(a,o)=>{t.set(a,o),iO(s,a,o),iO(e,a,o)},off:(...a)=>lO(e,...a),prioritizedOff:(...a)=>lO(s,...a),internal:{retrieveListeners:a=>e.get(a)||[]}}},Ly={Status:"status"},pce=()=>uce();typeof window<"u"&&!window.global&&(window.global=typeof global>"u"?window:global);var dw=e=>t=>{try{return pe.Children.only(e)}catch{return Xi.throw(wle(t))}},uw=(e,t)=>(e||(e=t),typeof e=="string"&&(e=pe.createElement("button",null,e)),e),pw=e=>(...t)=>{if(e&&typeof e=="function")return e(...t)};function fce(e){return typeof e=="function"}var Dy=new Map;function hce(e,t,s=1){pe.useEffect(()=>{const n=Dy.get(e)||0;return n==s?Xi.throw(t):(Dy.set(e,n+1),()=>{Dy.set(e,(Dy.get(e)||1)-1)})},[])}function mce(e,t,s){const n=e.displayName||e.name||t||"Component",a=o=>(hce(t,s),pe.createElement(e,{...o}));return a.displayName=`withMaxAllowedInstancesGuard(${n})`,a}var kx=e=>{const t=Array(e.length).fill(null),[s,n]=x.useState(t);return e.map((a,o)=>({id:a.id,mount:i=>n(l=>l.map((c,u)=>u===o?i:c)),unmount:()=>n(i=>i.map((l,c)=>c===o?null:l)),portal:()=>pe.createElement(pe.Fragment,null,s[o]?Xh.createPortal(a.component,s[o]):null)}))},ba=(e,t)=>!!e&&pe.isValidElement(e)&&(e==null?void 0:e.type)===t,OB=(e,t)=>$B({children:e,reorderItemsLabels:["account","security"],LinkComponent:Wv,PageComponent:Gv,MenuItemsComponent:hw,componentName:"UserProfile"},t),LB=(e,t)=>$B({children:e,reorderItemsLabels:["general","members"],LinkComponent:gw,PageComponent:mw,componentName:"OrganizationProfile"},t),DB=e=>{const t=[],s=[gw,mw,hw,Gv,Wv];return pe.Children.forEach(e,n=>{s.some(a=>
88ba(n,a))||t.push(n)}),t},$B=(e,t)=>{const{children:s,LinkComponent:n,PageComponent:a,MenuItemsComponent:o,reorderItemsLabels:i,componentName:l}=e,{allowForAnyChildren:c=!1}=t||{},u=[];pe.Children.forEach(s,k=>{if(!ba(k,a)&&!ba(k,n)&&!ba(k,o)){k&&!c&&_a(Tle(l));return}const{props:S}=k,{children:E,label:T,url:A,labelIcon:R}=S;if(ba(k,a))if(cO(S,i))u.push({label:T});else if(Jk(S))u.push({label:T,labelIcon:R,children:E,url:A});else{_a(Rle(l));return}if(ba(k,n))if(Xk(S))u.push({label:T,labelIcon:R,url:A});else{_a(Ale(l));return}});const f=[],h=[],g=[];u.forEach((k,S)=>{if(Jk(k)){f.push({component:k.children,id:S}),h.push({component:k.labelIcon,id:S});return}Xk(k)&&g.push({component:k.labelIcon,id:S})});const v=kx(f),y=kx(h),_=kx(g),j=[],w=[];return u.forEach((k,S)=>{if(cO(k,i)){j.push({label:k.label});return}if(Jk(k)){const{portal:E,mount:T,unmount:A}=v.find(M=>M.id===S),{portal:R,mount:I,unmount:L}=y.find(M=>M.id===S);j.push({label:k.label,url:k.url,mount:T,unmount:A,mountIcon:I,unmountIcon:L}),w.push(E),w.push(R);return}if(Xk(k)){const{portal:E,mount:T,unmount:A}=_.find(R=>R.id===S);j.push({label:k.label,url:k.url,mountIcon:T,unmountIcon:A}),w.push(E);return}}),{customPages:j,customPagesPortals:w}},cO=(e,t)=>{const{children:s,label:n,url:a,labelIcon:o}=e;return!s&&!a&&!o&&t.some(i=>i===n)},Jk=e=>{const{children:t,label:s,url:n,labelIcon:a}=e;return!!t&&!!n&&!!a&&!!s},Xk=e=>{const{children:t,label:s,url:n,labelIcon:a}=e;return!t&&!!n&&!!a&&!!s},gce=e=>xce({children:e,reorderItemsLabels:["manageAccount","signOut"],MenuItemsComponent:hw,MenuActionComponent:FB,MenuLinkComponent:BB,UserProfileLinkComponent:Wv,UserProfilePageComponent:Gv}),xce=({children:e,MenuItemsComponent:t,MenuActionComponent:s,MenuLinkComponent:n,UserProfileLinkComponent:a,UserProfilePageComponent:o,reorderItemsLabels:i})=>{const l=[],c=[],u=[];pe.Children.forEach(e,y=>{if(!ba(y,t)&&!ba(y,a)&&!ba(y,o)){y&&_a(Ple);return}if(ba(y,a)||ba(y,o))return;const{props:_}=y;pe.Children.forEach(_.children,j=>{if(!ba(j,s)&&!ba(j,n)){j&&_a(Ile);return}const{props:w}=j,{label:k,labelIcon:S,href:E,onClick:T,open:A}=w;if(ba(j,s))if(dO(w,i))l.push({label:k});else if(Qk(w)){const R={label:k,labelIcon:S};if(T!==void 0)l.push({...R,onClick:T});else if(A!==void 0)l.push({...R,open:A.startsWith("/")?A:`/${A}`});else{_a("Custom menu item must have either onClick or open property");return}}else{_a($le);return}if(ba(j,n))if(Zk(w))l.push({label:k,labelIcon:S,href:E});else{_a(Dle);return}})});const f=[],h=[];l.forEach((y,_)=>{Qk(y)&&f.push({component:y.labelIcon,id:_}),Zk(y)&&h.push({component:y.labelIcon,id:_})});const g=kx(f),v=kx(h);return l.forEach((y,_)=>{if(dO(y,i)&&c.push({label:y.label}),Qk(y)){const{portal:j,mount:w,unmount:k}=g.find(E=>E.id===_),S={label:y.label,mountIcon:w,unmountIcon:k};"onClick"in y?S.onClick=y.onClick:"open"in y&&(S.open=y.open),c.push(S),u.push(j)}if(Zk(y)){const{portal:j,mount:w,unmount:k}=v.find(S=>S.id===_);c.push({label:y.label,href:y.href,mountIcon:w,unmountIcon:k}),u.push(j)}}),{customMenuItems:c,customMenuItemsPortals:u}},dO=(e,t)=>{const{children:s,label:n,onClick:a,labelIcon:o}=e;return!s&&!a&&!o&&t.some(i=>i===n)},Qk=e=>{const{label:t,labelIcon:s,onClick:n,open:a}=e;return!!s&&!!t&&(typeof n=="function"||typeof a=="string")},Zk=e=>{const{label:t,href:s,labelIcon:n}=e;return!!s&&!!n&&!!t};function vce(e){const{root:t=document==null?void 0:document.body,selector:s,timeout:n=0}=e;return new Promise((a,o)=>{if(!t){o(new Error("No root element provided"));return}let i=t;if(s&&(i=t==null?void 0:t.querySelector(s)),(i==null?void 0:i.childElementCount)&&i.childElementCount>0){a();return}const c=new MutationObserver(u=>{for(const f of u)if(f.type==="childList"&&(!i&&s&&(i=t==null?void 0:t.querySelector(s)),i!=null&&i.childElementCount&&i.childElementCount>0)){c.disconnect(),a();return}});c.observe(t,{childList:!0,subtree:!0}),n>0&&setTimeout(()=>{c.disconnect(),o(new Error("Timeout waiting for element children"))},n)})}function Jo(e){const t=x.useRef(),[s,n]=x.useState("rendering");return x.useEffect(()=>{if(!e)throw new Error("Clerk: no component name provided, unable to detect mount.");typeof window<"u"&&!t.current&&(t.current=vce({selector:`[data-clerk-component="${e}"]`}).then(()=>{n("rendered")}
88).catch(()=>{n("error")}))},[e]),s}var $y=e=>"mount"in e,uO=e=>"open"in e,pO=e=>e==null?void 0:e.map(({mountIcon:t,unmountIcon:s,...n})=>n),Ga=class extends pe.PureComponent{constructor(){super(...arguments),this.rootRef=pe.createRef()}componentDidUpdate(e){var t,s,n,a;if(!$y(e)||!$y(this.props))return;const o=nO(e.props,"customPages","customMenuItems","children"),i=nO(this.props.props,"customPages","customMenuItems","children"),l=((t=o.customPages)==null?void 0:t.length)!==((s=i.customPages)==null?void 0:s.length),c=((n=o.customMenuItems)==null?void 0:n.length)!==((a=i.customMenuItems)==null?void 0:a.length),u=pO(e.props.customMenuItems),f=pO(this.props.props.customMenuItems);(!eO(o,i)||!eO(u,f)||l||c)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&($y(this.props)&&this.props.mount(this.rootRef.current,this.props.props),uO(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&($y(this.props)&&this.props.unmount(this.rootRef.current),uO(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:e=!1}=this.props,t={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-clerk-component":this.props.component}};return pe.createElement(pe.Fragment,null,!e&&pe.createElement("div",{...t}),this.props.children)}},fw=e=>{var t,s;return pe.createElement(pe.Fragment,null,(t=e==null?void 0:e.customPagesPortals)==null?void 0:t.map((n,a)=>x.createElement(n,{key:a})),(s=e==null?void 0:e.customMenuItemsPortals)==null?void 0:s.map((n,a)=>x.createElement(n,{key:a})))};Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountSignIn,unmount:e.unmountSignIn,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"SignIn",renderWhileLoading:!0});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountSignUp,unmount:e.unmountSignUp,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"SignUp",renderWhileLoading:!0});function Gv({children:e}){return _a(kle),pe.createElement(pe.Fragment,null,e)}function Wv({children:e}){return _a(Sle),pe.createElement(pe.Fragment,null,e)}var bce=Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}},{customPages:l,customPagesPortals:c}=OB(n.children);return pe.createElement(pe.Fragment,null,o&&s,pe.createElement(Ga,{component:t,mount:e.mountUserProfile,unmount:e.unmountUserProfile,updateProps:e.__unstable__updateProps,props:{...n,customPages:l},rootProps:i},pe.createElement(fw,{customPagesPortals:c})))},{component:"UserProfile",renderWhileLoading:!0});Object.assign(bce,{Page:Gv,Link:Wv});var UB=x.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),yce=Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}},{customPages:l,customPagesPortals:c}=OB(n.children,{allowForAnyChildren:!!n.__experimental_asProvider}),u=Object.assign(n.userProfileProps||{},{customPages:l}),{customMenuItems:f,customMenuItemsPortals:h}=gce(n.children),g=DB(n.children),v={mount:e.mountUserButton,unmount:e.unmountUserButton,updateProps:e.__unstable__updateProps,props:{...n,userProfileProps:u,customMenuItems:f}},y={customPagesPortals:c,customMenuItemsPortals:h};return pe.createElement(UB.Provider,{value:v},o&&s,e.loaded&&pe.createElement(Ga,{component:t,...v,hideRootHtmlElement:!!n.__experimental_asProvider,rootProps:i},n.__experimental_asProvider?g:null,pe.createElement(fw,{...y})))},{component:"UserButton",renderWhileLoading:!0});function hw({children:e}){return _a(Mle),pe.createElement(pe.Fragment,null,e)}function FB({children:e}){return _a(Ole),pe.createElement(pe.Fragment,null,e)}function BB({children:e}){return _a(Lle),pe.createElement(pe.Fragment,null,e)}function _ce(e){const t=x.useContext(UB),s={...t,props:{...t.props,...e}};return pe.createElement(Ga,{...s})}var jce=Object.assign(yce,{UserProfilePage:Gv,UserProfileLink:Wv,MenuItems:hw,Action:FB,Link:BB,__experimental_Outlet:_ce});function mw({children:e}){return _a(Cle),pe.createElement(pe.Fragment,null,e)}function gw({children:e}){return _a(Ele),pe.createElement(pe.Fragment,null,e)}var wce=Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}},{customPages:l,customPagesPortals:c}=LB(n.children);return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountOrganizationProfile,unmount:e.unmountOrganizationProfile,updateProps:e.__unstable__updateProps,props:{...n,customPages:l},rootProps:i},pe.createElement(fw,{customPagesPortals:c})))},{component:"OrganizationProfile",renderWhileLoading:!0});Object.assign(wce,{Page:mw,Link:gw});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountCreateOrganization,unmount:e.unmountCreateOrganization,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"CreateOrganization",renderWhileLoading:!0});var qB=x.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),Nce=Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}},{customPages:l,customPagesPortals:c}=LB(n.children,{allowForAnyChildren:!!n.__experimental_asProvider}),u=Object.assign(n.organizationProfileProps||{},{customPages:l}),f=DB(n.children),h={mount:e.mountOrganizationSwitcher,unmount:e.unmountOrganizationSwitcher,updateProps:e.__unstable__updateProps,props:{...n,organizationProfileProps:u},rootProps:i,component:t};return e.__experimental_prefetchOrganizationSwitcher(),pe.createElement(qB.Provider,{value:h},pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{...h,hideRootHtmlElement:!!n.__experimental_asProvider},n.__experimental_asProvider?f:null,pe.createElement(fw,{customPagesPortals:c}))))},{component:"OrganizationSwitcher",renderWhileLoading:!0});function kce(e){const t=x.useContext(qB),s={...t,props:{...t.props,...e}};return pe.createElement(Ga,{...s})}Object.assign(Nce,{OrganizationProfilePage:mw,OrganizationProfileLink:gw,__experimental_Outlet:kce});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountOrganizationList,unmount:e.unmountOrganizationList,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"OrganizationList",renderWhileLoading:!0});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,open:e.openGoogleOneTap,close:e.closeGoogleOneTap,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"GoogleOneTap",renderWhileLoading:!0});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountWaitlist,unmount:e.unmountWaitlist,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"Waitlist",renderWhileLoading:!0});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountPricingTable,unmount:e.unmountPricingTable,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"PricingTable",renderWhileLoading:!0});Gr(({clerk:e,component:t,fallback:s,...n})=>{const o=Jo(t)==="rendering"||!e.loaded,i={...o&&s&&{style:{display:"none"}}};return pe.createElement(pe.Fragment,null,o&&s,e.loaded&&pe.createElement(Ga,{component:t,mount:e.mountApiKeys,unmount:e.unmountApiKeys,updateProps:e.__unstable__updateProps,props:n,rootProps:i}))},{component:"ApiKeys",renderWhileLoading:!0});var ip=Gr(({clerk:e,children:t,...s})=>{const{signUpFallbackRedirectUrl:n,forceRedirectUrl:a,fallbackRedirectUrl:o,signUpForceRedirectUrl:i,mode:l,initialValues:c,withSignUp:u,oauthFlow:f,...h}=s;t=uw(t,"Sign in");const g=dw(t)("SignInButton"),v=()=>{const j={forceRedirectUrl:a,fallbackRedirectUrl:o,signUpFallbackRedirectUrl:n,signUpForceRedirectUrl:i,initialValues:c,withSignUp:u,oauthFlow:f};return l==="modal"?e.openSignIn({...j,appearance:s.appearance}):e.redirectToSignIn({...j,signInFallbackRedirectUrl:o,signInForceRedirectUrl:a})},_={...h,onClick:async j=>(g&&typeof g=="object"&&"props"in g&&await pw(g.props.onClick)(j),v())};return pe.cloneElement(g,_)}
88,{component:"SignInButton",renderWhileLoading:!0}),Xf=Gr(({clerk:e,children:t,...s})=>{const{fallbackRedirectUrl:n,forceRedirectUrl:a,signInFallbackRedirectUrl:o,signInForceRedirectUrl:i,mode:l,unsafeMetadata:c,initialValues:u,oauthFlow:f,...h}=s;t=uw(t,"Sign up");const g=dw(t)("SignUpButton"),v=()=>{const j={fallbackRedirectUrl:n,forceRedirectUrl:a,signInFallbackRedirectUrl:o,signInForceRedirectUrl:i,unsafeMetadata:c,initialValues:u,oauthFlow:f};return l==="modal"?e.openSignUp({...j,appearance:s.appearance}):e.redirectToSignUp({...j,signUpFallbackRedirectUrl:n,signUpForceRedirectUrl:a})},_={...h,onClick:async j=>(g&&typeof g=="object"&&"props"in g&&await pw(g.props.onClick)(j),v())};return pe.cloneElement(g,_)},{component:"SignUpButton",renderWhileLoading:!0});Gr(({clerk:e,children:t,...s})=>{const{redirectUrl:n="/",signOutOptions:a,...o}=s;t=uw(t,"Sign out");const i=dw(t)("SignOutButton"),l=()=>e.signOut({redirectUrl:n,...a}),u={...o,onClick:async f=>(await pw(i.props.onClick)(f),l())};return pe.cloneElement(i,u)},{component:"SignOutButton",renderWhileLoading:!0});Gr(({clerk:e,children:t,...s})=>{const{redirectUrl:n,...a}=s;t=uw(t,"Sign in with Metamask");const o=dw(t)("SignInWithMetamaskButton"),i=async()=>{async function u(){await e.authenticateWithMetamask({redirectUrl:n||void 0})}u()},c={...a,onClick:async u=>(await pw(o.props.onClick)(u),i())};return pe.cloneElement(o,c)},{component:"SignInWithMetamask",renderWhileLoading:!0});typeof globalThis.__BUILD_DISABLE_RHC__>"u"&&(globalThis.__BUILD_DISABLE_RHC__=!1);var Sce={name:"@clerk/clerk-react",version:"5.32.4",environment:"production"},c_,Mf,Of,Kc,$l,sd,d_,BC,zB=class HB{constructor(t){Cu(this,d_),this.clerkjs=null,this.preopenOneTap=null,this.preopenUserVerification=null,this.preopenSignIn=null,this.preopenCheckout=null,this.preopenPlanDetails=null,this.preopenSignUp=null,this.preopenUserProfile=null,this.preopenOrganizationProfile=null,this.preopenCreateOrganization=null,this.preOpenWaitlist=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=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.premountAddListenerCalls=new Map,this.loadedListeners=[],Cu(this,c_,"loading"),Cu(this,Mf),Cu(this,Of),Cu(this,Kc),Cu(this,$l,pce()),this.buildSignInUrl=a=>{const o=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildSignInUrl(a))||""};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("buildSignInUrl",o)},this.buildSignUpUrl=a=>{const o=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildSignUpUrl(a))||""};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("buildSignUpUrl",o)},this.buildAfterSignInUrl=(...a)=>{const o=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildAfterSignInUrl(...a))||""};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("buildAfterSignInUrl",o)},this.buildAfterSignUpUrl=(...a)=>{const o=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildAfterSignUpUrl(...a))||""};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("buildAfterSignUpUrl",o)},this.buildAfterSignOutUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildAfterSignOutUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildAfterSignOutUrl",a)},this.buildNewSubscriptionRedirectUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildNewSubscriptionRedirectUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl",a)},this.buildAfterMultiSessionSingleSignOutUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildAfterMultiSessionSingleSignOutUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl",a)},this.buildUserProfileUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildUserProfileUrl())||""};
88if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildUserProfileUrl",a)},this.buildCreateOrganizationUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildCreateOrganizationUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildCreateOrganizationUrl",a)},this.buildOrganizationProfileUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildOrganizationProfileUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildOrganizationProfileUrl",a)},this.buildWaitlistUrl=()=>{const a=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildWaitlistUrl())||""};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("buildWaitlistUrl",a)},this.buildUrlWithAuth=a=>{const o=()=>{var i;return((i=this.clerkjs)==null?void 0:i.buildUrlWithAuth(a))||""};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("buildUrlWithAuth",o)},this.handleUnauthenticated=async()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.handleUnauthenticated()};this.clerkjs&&this.loaded?a():this.premountMethodCalls.set("handleUnauthenticated",a)},this.on=(...a)=>{var o;if((o=this.clerkjs)!=null&&o.on)return this.clerkjs.on(...a);Pr(this,$l).on(...a)},this.off=(...a)=>{var o;if((o=this.clerkjs)!=null&&o.off)return this.clerkjs.off(...a);Pr(this,$l).off(...a)},this.addOnLoaded=a=>{this.loadedListeners.push(a),this.loaded&&this.emitLoaded()},this.emitLoaded=()=>{this.loadedListeners.forEach(a=>a()),this.loadedListeners=[]},this.beforeLoad=a=>{if(!a)throw new Error("Failed to hydrate latest Clerk JS")},this.hydrateClerkJS=a=>{var o;if(!a)throw new Error("Failed to hydrate latest Clerk JS");return this.clerkjs=a,this.premountMethodCalls.forEach(i=>i()),this.premountAddListenerCalls.forEach((i,l)=>{i.nativeUnsubscribe=a.addListener(l)}),(o=Pr(this,$l).internal.retrieveListeners("status"))==null||o.forEach(i=>{this.on("status",i,{notify:!0})}),this.preopenSignIn!==null&&a.openSignIn(this.preopenSignIn),this.preopenCheckout!==null&&a.__internal_openCheckout(this.preopenCheckout),this.preopenPlanDetails!==null&&a.__internal_openPlanDetails(this.preopenPlanDetails),this.preopenSignUp!==null&&a.openSignUp(this.preopenSignUp),this.preopenUserProfile!==null&&a.openUserProfile(this.preopenUserProfile),this.preopenUserVerification!==null&&a.__internal_openReverification(this.preopenUserVerification),this.preopenOneTap!==null&&a.openGoogleOneTap(this.preopenOneTap),this.preopenOrganizationProfile!==null&&a.openOrganizationProfile(this.preopenOrganizationProfile),this.preopenCreateOrganization!==null&&a.openCreateOrganization(this.preopenCreateOrganization),this.preOpenWaitlist!==null&&a.openWaitlist(this.preOpenWaitlist),this.premountSignInNodes.forEach((i,l)=>{a.mountSignIn(l,i)}),this.premountSignUpNodes.forEach((i,l)=>{a.mountSignUp(l,i)}),this.premountUserProfileNodes.forEach((i,l)=>{a.mountUserProfile(l,i)}),this.premountUserButtonNodes.forEach((i,l)=>{a.mountUserButton(l,i)}),this.premountOrganizationListNodes.forEach((i,l)=>{a.mountOrganizationList(l,i)}),this.premountWaitlistNodes.forEach((i,l)=>{a.mountWaitlist(l,i)}),this.premountPricingTableNodes.forEach((i,l)=>{a.mountPricingTable(l,i)}),this.premountApiKeysNodes.forEach((i,l)=>{a.mountApiKeys(l,i)}),this.premountOAuthConsentNodes.forEach((i,l)=>{a.__internal_mountOAuthConsent(l,i)}),typeof this.clerkjs.status>"u"&&Pr(this,$l).emit(Ly.Status,"ready"),this.emitLoaded(),this.clerkjs},this.__unstable__updateProps=async a=>{const o=await sO(this,d_,BC).call(this);if(o&&"__unstable__updateProps"in o)return o.__unstable__updateProps(a)},this.__experimental_navigateToTask=async a=>this.clerkjs?this.clerkjs.__experimental_navigateToTask(a):Promise.reject(),this.setActive=a=>this.clerkjs?this.clerkjs.setActive(a):Promise.reject(),this.openSignIn=a=>{this.clerkjs&&this.loaded?this.clerkjs.openSignIn(a):this.preopenSignIn=a},this.closeSignIn=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignIn():this.preopenSignIn=null},this.__internal_openCheckout=a=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openCheckout(a):this.preopenCheckout=a},this.__internal_closeCheckout=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeCheckout():this.preopenCheckout=null},this.__internal_openPlanDetails=a=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openPlanDetails(a):this.preopenPlanDetails=a},this.__internal_closePlanDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closePlanDetails():this.preopenPlanDetails=null},this.__internal_openReverification=a=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openReverification(a):this.preopenUserVerification=a},this.__internal_closeReverification=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeReverification():this.preopenUserVerification=null},this.openGoogleOneTap=a=>{this.clerkjs&&this.loaded?this.clerkjs.openGoogleOneTap(a):this.preopenOneTap=a},this.closeGoogleOneTap=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeGoogleOneTap():this.preopenOneTap=null},this.openUserProfile=a=>{this.clerkjs&&this.loaded?this.clerkjs.openUserProfile(a):this.preopenUserProfile=a},this.closeUserProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeUserProfile():this.preopenUserProfile=null},this.openOrganizationProfile=a=>{this.clerkjs&&this.loaded?this.clerkjs.openOrganizationProfile(a):this.preopenOrganizationProfile=a},this.closeOrganizationProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeOrganizationProfile():this.preopenOrganizationProfile=null},this.openCreateOrganization=a=>{this.clerkjs&&this.loaded?this.clerkjs.openCreateOrganization(a):this.preopenCreateOrganization=a},this.closeCreateOrganization=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeCreateOrganization():this.preopenCreateOrganization=null},this.openWaitlist=a=>{this.clerkjs&&this.loaded?this.clerkjs.openWaitlist(a):this.preOpenWaitlist=a},this.closeWaitlist=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeWaitlist():this.preOpenWaitlist=null},this.openSignUp=a=>{this.clerkjs&&this.loaded?this.clerkjs.openSignUp(a):this.preopenSignUp=a},this.closeSignUp=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignUp():this.preopenSignUp=null}
88,this.mountSignIn=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignIn(a,o):this.premountSignInNodes.set(a,o)},this.unmountSignIn=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignIn(a):this.premountSignInNodes.delete(a)},this.mountSignUp=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignUp(a,o):this.premountSignUpNodes.set(a,o)},this.unmountSignUp=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignUp(a):this.premountSignUpNodes.delete(a)},this.mountUserProfile=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserProfile(a,o):this.premountUserProfileNodes.set(a,o)},this.unmountUserProfile=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserProfile(a):this.premountUserProfileNodes.delete(a)},this.mountOrganizationProfile=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationProfile(a,o):this.premountOrganizationProfileNodes.set(a,o)},this.unmountOrganizationProfile=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationProfile(a):this.premountOrganizationProfileNodes.delete(a)},this.mountCreateOrganization=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountCreateOrganization(a,o):this.premountCreateOrganizationNodes.set(a,o)},this.unmountCreateOrganization=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountCreateOrganization(a):this.premountCreateOrganizationNodes.delete(a)},this.mountOrganizationSwitcher=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationSwitcher(a,o):this.premountOrganizationSwitcherNodes.set(a,o)},this.unmountOrganizationSwitcher=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationSwitcher(a):this.premountOrganizationSwitcherNodes.delete(a)},this.__experimental_prefetchOrganizationSwitcher=()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.__experimental_prefetchOrganizationSwitcher()};this.clerkjs&&this.loaded?a():this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher",a)},this.mountOrganizationList=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationList(a,o):this.premountOrganizationListNodes.set(a,o)},this.unmountOrganizationList=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationList(a):this.premountOrganizationListNodes.delete(a)},this.mountUserButton=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserButton(a,o):this.premountUserButtonNodes.set(a,o)},this.unmountUserButton=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserButton(a):this.premountUserButtonNodes.delete(a)},this.mountWaitlist=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountWaitlist(a,o):this.premountWaitlistNodes.set(a,o)},this.unmountWaitlist=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountWaitlist(a):this.premountWaitlistNodes.delete(a)},this.mountPricingTable=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountPricingTable(a,o):this.premountPricingTableNodes.set(a,o)},this.unmountPricingTable=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountPricingTable(a):this.premountPricingTableNodes.delete(a)},this.mountApiKeys=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.mountApiKeys(a,o):this.premountApiKeysNodes.set(a,o)},this.unmountApiKeys=a=>{this.clerkjs&&this.loaded?this.clerkjs.unmountApiKeys(a):this.premountApiKeysNodes.delete(a)},this.__internal_mountOAuthConsent=(a,o)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountOAuthConsent(a,o):this.premountOAuthConsentNodes.set(a,o)},this.__internal_unmountOAuthConsent=a=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountOAuthConsent(a):this.premountOAuthConsentNodes.delete(a)},this.addListener=a=>{if(this.clerkjs)return this.clerkjs.addListener(a);{const o=()=>{var i;const l=this.premountAddListenerCalls.get(a);l&&((i=l.nativeUnsubscribe)==null||i.call(l),this.premountAddListenerCalls.delete(a))};return this.premountAddListenerCalls.set(a,{unsubscribe:o,nativeUnsubscribe:void 0}),o}},this.navigate=a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.navigate(a)};this.clerkjs&&this.loaded?o():this.premountMethodCalls.set("navigate",o)},this.redirectWithAuth=async(...a)=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectWithAuth(...a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("redirectWithAuth",o)},this.redirectToSignIn=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToSignIn(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("redirectToSignIn",o)},this.redirectToSignUp=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.redirectToSignUp(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("redirectToSignUp",o)},this.redirectToUserProfile=async()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToUserProfile()};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("redirectToUserProfile",a)},this.redirectToAfterSignUp=()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToAfterSignUp()};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("redirectToAfterSignUp",a)},this.redirectToAfterSignIn=()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToAfterSignIn()};this.clerkjs&&this.loaded?a():this.premountMethodCalls.set("redirectToAfterSignIn",a)},this.redirectToAfterSignOut=()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToAfterSignOut()};this.clerkjs&&this.loaded?a():this.premountMethodCalls.set("redirectToAfterSignOut",a)},this.redirectToOrganizationProfile=async()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToOrganizationProfile()};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("redirectToOrganizationProfile",a)},this.redirectToCreateOrganization=async()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToCreateOrganization()};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("redirectToCreateOrganization",a)},this.redirectToWaitlist=async()=>{const a=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToWaitlist()};if(this.clerkjs&&this.loaded)return a();this.premountMethodCalls.set("redirectToWaitlist",a)},this.handleRedirectCallback=async a=>{var o;const i=()=>{var l;return(l=this.clerkjs)==null?void 0:l.handleRedirectCallback(a)};
88this.clerkjs&&this.loaded?(o=i())==null||o.catch(()=>{}):this.premountMethodCalls.set("handleRedirectCallback",i)},this.handleGoogleOneTapCallback=async(a,o)=>{var i;const l=()=>{var c;return(c=this.clerkjs)==null?void 0:c.handleGoogleOneTapCallback(a,o)};this.clerkjs&&this.loaded?(i=l())==null||i.catch(()=>{}):this.premountMethodCalls.set("handleGoogleOneTapCallback",l)},this.handleEmailLinkVerification=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.handleEmailLinkVerification(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("handleEmailLinkVerification",o)},this.authenticateWithMetamask=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.authenticateWithMetamask(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("authenticateWithMetamask",o)},this.authenticateWithCoinbaseWallet=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.authenticateWithCoinbaseWallet(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("authenticateWithCoinbaseWallet",o)},this.authenticateWithOKXWallet=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.authenticateWithOKXWallet(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("authenticateWithOKXWallet",o)},this.authenticateWithWeb3=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.authenticateWithWeb3(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("authenticateWithWeb3",o)},this.authenticateWithGoogleOneTap=async a=>(await sO(this,d_,BC).call(this)).authenticateWithGoogleOneTap(a),this.createOrganization=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.createOrganization(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("createOrganization",o)},this.getOrganization=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.getOrganization(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("getOrganization",o)},this.joinWaitlist=async a=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.joinWaitlist(a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("joinWaitlist",o)},this.signOut=async(...a)=>{const o=()=>{var i;return(i=this.clerkjs)==null?void 0:i.signOut(...a)};if(this.clerkjs&&this.loaded)return o();this.premountMethodCalls.set("signOut",o)};const{Clerk:s=null,publishableKey:n}=t||{};xf(this,Kc,n),xf(this,Of,t==null?void 0:t.proxyUrl),xf(this,Mf,t==null?void 0:t.domain),this.options=t,this.Clerk=s,this.mode=aO()?"browser":"server",this.options.sdkMetadata||(this.options.sdkMetadata=Sce),Pr(this,$l).emit(Ly.Status,"loading"),Pr(this,$l).prioritizedOn(Ly.Status,a=>xf(this,c_,a)),Pr(this,Kc)&&this.loadClerkJS()}get publishableKey(){return Pr(this,Kc)}get loaded(){var t;return((t=this.clerkjs)==null?void 0:t.loaded)||!1}get status(){var t;return this.clerkjs?((t=this.clerkjs)==null?void 0:t.status)||(this.clerkjs.loaded?"ready":"loading"):Pr(this,c_)}static getOrCreateInstance(t){return(!aO()||!Pr(this,sd)||t.Clerk&&Pr(this,sd).Clerk!==t.Clerk||Pr(this,sd).publishableKey!==t.publishableKey)&&xf(this,sd,new HB(t)),Pr(this,sd)}static clearInstance(){xf(this,sd,null)}get domain(){return typeof window<"u"&&window.location?Kk(Pr(this,Mf),new URL(window.location.href),""):typeof Pr(this,Mf)=="function"?Xi.throw(Yk):Pr(this,Mf)||""}get proxyUrl(){return typeof window<"u"&&window.location?Kk(Pr(this,Of),new URL(window.location.href),""):typeof Pr(this,Of)=="function"?Xi.throw(Yk):Pr(this,Of)||""}__internal_getOption(t){var s,n;return(s=this.clerkjs)!=null&&s.__internal_getOption?(n=this.clerkjs)==null?void 0:n.__internal_getOption(t):this.options[t]}get sdkMetadata(){var t;return((t=this.clerkjs)==null?void 0:t.sdkMetadata)||this.options.sdkMetadata||void 0}get instanceType(){var t;return(t=this.clerkjs)==null?void 0:t.instanceType}get frontendApi(){var t;return((t=this.clerkjs)==null?void 0:t.frontendApi)||""}get isStandardBrowser(){var t;return((t=this.clerkjs)==null?void 0:t.isStandardBrowser)||this.options.standardBrowser||!1}get isSatellite(){return typeof window<"u"&&window.location?Kk(this.options.isSatellite,new URL(window.location.href),!1):typeof this.options.isSatellite=="function"?Xi.throw(Yk):!1}async loadClerkJS(){var t;if(!(this.mode!=="browser"||this.loaded)){typeof window<"u"&&(window.__clerk_publishable_key=Pr(this,Kc),window.__clerk_proxy_url=this.proxyUrl,window.__clerk_domain=this.domain);try{if(this.Clerk){let s;fce(this.Clerk)?(s=new this.Clerk(Pr(this,Kc),{proxyUrl:this.proxyUrl,domain:this.domain}),this.beforeLoad(s),await s.load(this.options)):(s=this.Clerk,s.loaded||(this.beforeLoad(s),await s.load(this.options))),global.Clerk=s}else if(!__BUILD_DISABLE_RHC__){if(global.Clerk||await nce({...this.options,publishableKey:Pr(this,Kc),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(t=global.Clerk)!=null&&t.loaded?this.hydrateClerkJS(global.Clerk):void 0}catch(s){const n=s;Pr(this,$l).emit(Ly.Status,"error"),console.error(n.stack||n.message||n);return}}}get version(){var t;
88return(t=this.clerkjs)==null?void 0:t.version}get client(){if(this.clerkjs)return this.clerkjs.client}get session(){if(this.clerkjs)return this.clerkjs.session}get 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 t;return(t=this.clerkjs)==null?void 0:t.billing}get apiKeys(){var t;return(t=this.clerkjs)==null?void 0:t.apiKeys}__unstable__setEnvironment(...t){if(this.clerkjs&&"__unstable__setEnvironment"in this.clerkjs)this.clerkjs.__unstable__setEnvironment(t);else return}};c_=new WeakMap;Mf=new WeakMap;Of=new WeakMap;Kc=new WeakMap;$l=new WeakMap;sd=new WeakMap;d_=new WeakSet;BC=function(){return new Promise(e=>{this.addOnLoaded(()=>e(this.clerkjs))})};Cu(zB,sd);var fO=zB;function Cce(e){const{isomorphicClerkOptions:t,initialState:s,children:n}=e,{isomorphicClerk:a,clerkStatus:o}=Ece(t),[i,l]=pe.useState({client:a.client,session:a.session,user:a.user,organization:a.organization});pe.useEffect(()=>a.addListener(z=>l({...z})),[]);const c=lce(a.loaded,i,s),u=pe.useMemo(()=>({value:a}),[o]),f=pe.useMemo(()=>({value:i.client}),[i.client]),{sessionId:h,sessionStatus:g,sessionClaims:v,session:y,userId:_,user:j,orgId:w,actor:k,organization:S,orgRole:E,orgSlug:T,orgPermissions:A,factorVerificationAge:R}=c,I=pe.useMemo(()=>({value:{sessionId:h,sessionStatus:g,sessionClaims:v,userId:_,actor:k,orgId:w,orgRole:E,orgSlug:T,orgPermissions:A,factorVerificationAge:R}}),[h,g,_,k,w,E,T,R,v==null?void 0:v.__raw]),L=pe.useMemo(()=>({value:y}),[h,y]),M=pe.useMemo(()=>({value:j}),[_,j]),O=pe.useMemo(()=>({value:{organization:S}}),[w,S]);return pe.createElement(_le.Provider,{value:u},pe.createElement(dle.Provider,{value:f},pe.createElement(ule.Provider,{value:L},pe.createElement(fle,{...O.value},pe.createElement(ble.Provider,{value:I},pe.createElement(lle.Provider,{value:M},n))))))}var Ece=e=>{const t=pe.useRef(fO.getOrCreateInstance(e)),[s,n]=pe.useState(t.current.status);return pe.useEffect(()=>{t.current.__unstable__updateProps({appearance:e.appearance})},[e.appearance]),pe.useEffect(()=>{t.current.__unstable__updateProps({options:e})},[e.localization]),pe.useEffect(()=>(t.current.on("status",n),()=>{t.current&&t.current.off("status",n),fO.clearInstance()}),[]),{isomorphicClerk:t.current,clerkStatus:s}};function Tce(e){const{initialState:t,children:s,__internal_bypassMissingPublishableKey:n,...a}=e,{publishableKey:o="",Clerk:i}=a;return!i&&!n&&(o?o&&!EC(o)&&Xi.throwInvalidPublishableKeyError({key:o}):Xi.throwMissingPublishableKeyError()),pe.createElement(Cce,{initialState:t,isomorphicClerkOptions:a},s)}var VB=mce(Tce,"ClerkProvider",jle);VB.displayName="ClerkProvider";vle({packageName:"@clerk/clerk-react"});rce("@clerk/clerk-react");var yg={},hO;function Rce(){if(hO)return yg;hO=1,Object.defineProperty(yg,"__esModule",{value:!0}),yg.parse=i,yg.serialize=u;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,s=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,o=(()=>{const g=function(){};return g.prototype=Object.create(null),g})();function i(g,v){const y=new o,_=g.length;if(_<2)return y;const j=(v==null?void 0:v.decode)||f;let w=0;do{const k=g.indexOf("=",w);if(k===-1)break;const S=g.indexOf(";",w),E=S===-1?_:S;if(k>E){w=g.lastIndexOf(";",k-1)+1;continue}const T=l(g,w,k),A=c(g,k,T),R=g.slice(T,A);if(y[R]===void 0){let I=l(g,k+1,E),L=c(g,E,I);const M=j(g.slice(I,L));y[R]=M}w=E+1}while(w<_);return y}function l(g,v,y){do{const _=g.charCodeAt(v);if(_!==32&&_!==9)return v}while(++v<y);return y}function c(g,v,y){for(;v>y;){const _=g.charCodeAt(--v);if(_!==32&&_!==9)return v+1}return y}function u(g,v,y){const _=(y==null?void 0:y.encode)||encodeURIComponent;if(!e.test(g))throw new TypeError(`argument name is invalid: ${g}`);const j=_(v);
88if(!t.test(j))throw new TypeError(`argument val is invalid: ${v}`);let w=g+"="+j;if(!y)return w;if(y.maxAge!==void 0){if(!Number.isInteger(y.maxAge))throw new TypeError(`option maxAge is invalid: ${y.maxAge}`);w+="; Max-Age="+y.maxAge}if(y.domain){if(!s.test(y.domain))throw new TypeError(`option domain is invalid: ${y.domain}`);w+="; Domain="+y.domain}if(y.path){if(!n.test(y.path))throw new TypeError(`option path is invalid: ${y.path}`);w+="; Path="+y.path}if(y.expires){if(!h(y.expires)||!Number.isFinite(y.expires.valueOf()))throw new TypeError(`option expires is invalid: ${y.expires}`);w+="; Expires="+y.expires.toUTCString()}if(y.httpOnly&&(w+="; HttpOnly"),y.secure&&(w+="; Secure"),y.partitioned&&(w+="; Partitioned"),y.priority)switch(typeof y.priority=="string"?y.priority.toLowerCase():void 0){case"low":w+="; Priority=Low";break;case"medium":w+="; Priority=Medium";break;case"high":w+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${y.priority}`)}if(y.sameSite)switch(typeof y.sameSite=="string"?y.sameSite.toLowerCase():y.sameSite){case!0:case"strict":w+="; SameSite=Strict";break;case"lax":w+="; SameSite=Lax";break;case"none":w+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${y.sameSite}`)}return w}function f(g){if(g.indexOf("%")===-1)return g;try{return decodeURIComponent(g)}catch{return g}}function h(g){return a.call(g)==="[object Date]"}return yg}Rce();var mO="popstate";function Ace(e={}){function t(n,a){let{pathname:o,search:i,hash:l}=n.location;return qC("",{pathname:o,search:i,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function s(n,a){return typeof a=="string"?a:tv(a)}return Ice(t,s,null,e)}function Er(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ho(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Pce(){return Math.random().toString(36).substring(2,10)}function gO(e,t){return{usr:e.state,key:e.key,idx:t}}function qC(e,t,s=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Qh(t):t,state:s,key:t&&t.key||n||Pce()}}function tv({pathname:e="/",search:t="",hash:s=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Qh(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substring(s),e=e.substring(0,s));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function Ice(e,t,s,n={}){let{window:a=document.defaultView,v5Compat:o=!1}=n,i=a.history,l="POP",c=null,u=f();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function f(){return(i.state||{idx:null}).idx}function h(){l="POP";let j=f(),w=j==null?null:j-u;u=j,c&&c({action:l,location:_.location,delta:w})}function g(j,w){l="PUSH";let k=qC(_.location,j,w);u=f()+1;let S=gO(k,u),E=_.createHref(k);try{i.pushState(S,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;a.location.assign(E)}o&&c&&c({action:l,location:_.location,delta:1})}function v(j,w){l="REPLACE";let k=qC(_.location,j,w);u=f();let S=gO(k,u),E=_.createHref(k);i.replaceState(S,"",E),o&&c&&c({action:l,location:_.location,delta:0})}function y(j){return Mce(j)}let _={get action(){return l},get location(){return e(a,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(mO,h),c=j,()=>{a.removeEventListener(mO,h),c=null}},createHref(j){return t(a,j)},createURL:y,encodeLocation(j){let w=y(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:g,replace:v,go(j){return i.go(j)}};return _}function Mce(e,t=!1){let s="http://localhost";
88typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Er(s,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:tv(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=s+n),new URL(n,s)}function GB(e,t,s="/"){return Oce(e,t,s,!1)}function Oce(e,t,s,n){let a=typeof t=="string"?Qh(t):t,o=uc(a.pathname||"/",s);if(o==null)return null;let i=WB(e);Lce(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=Wce(o);l=Vce(i[c],u,n)}return l}function WB(e,t=[],s=[],n=""){let a=(o,i,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};c.relativePath.startsWith("/")&&(Er(c.relativePath.startsWith(n),`Absolute route path "${c.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(n.length));let u=rc([n,c.relativePath]),f=s.concat(c);o.children&&o.children.length>0&&(Er(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),WB(o.children,t,f,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:zce(u,o.index),routesMeta:f})};return e.forEach((o,i)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))a(o,i);else for(let c of YB(o.path))a(o,i,c)}),t}function YB(e){let t=e.split("/");if(t.length===0)return[];let[s,...n]=t,a=s.endsWith("?"),o=s.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let i=YB(n.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Lce(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:Hce(t.routesMeta.map(n=>n.childrenIndex),s.routesMeta.map(n=>n.childrenIndex)))}var Dce=/^:[\w-]+$/,$ce=3,Uce=2,Fce=1,Bce=10,qce=-2,xO=e=>e==="*";function zce(e,t){let s=e.split("/"),n=s.length;return s.some(xO)&&(n+=qce),t&&(n+=Uce),s.filter(a=>!xO(a)).reduce((a,o)=>a+(Dce.test(o)?$ce:o===""?Fce:Bce),n)}function Hce(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Vce(e,t,s=!1){let{routesMeta:n}=e,a={},o="/",i=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,f=o==="/"?t:t.slice(o.length)||"/",h=G_({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},f),g=c.route;if(!h&&u&&s&&!n[n.length-1].route.index&&(h=G_({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!h)return null;
88Object.assign(a,h.params),i.push({params:a,pathname:rc([o,h.pathname]),pathnameBase:Xce(rc([o,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(o=rc([o,h.pathnameBase]))}return i}function G_(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,n]=Gce(e.path,e.caseSensitive,e.end),a=t.match(s);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((u,{paramName:f,isOptional:h},g)=>{if(f==="*"){let y=l[g]||"";i=o.slice(0,o.length-y.length).replace(/(.)\/+$/,"$1")}const v=l[g];return h&&!v?u[f]=void 0:u[f]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Gce(e,t=!1,s=!0){Ho(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Wce(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ho(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function uc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,n=e.charAt(s);return n&&n!=="/"?null:e.slice(s)||"/"}function Yce(e,t="/"){let{pathname:s,search:n="",hash:a=""}=typeof e=="string"?Qh(e):e;return{pathname:s?s.startsWith("/")?s:Kce(s,t):t,search:Qce(n),hash:Zce(a)}}function Kce(e,t){let s=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?s.length>1&&s.pop():a!=="."&&s.push(a)}),s.length>1?s.join("/"):"/"}function eS(e,t,s,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Jce(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function DT(e){let t=Jce(e);return t.map((s,n)=>n===t.length-1?s.pathname:s.pathnameBase)}function $T(e,t,s,n=!1){let a;typeof e=="string"?a=Qh(e):(a={...e},Er(!a.pathname||!a.pathname.includes("?"),eS("?","pathname","search",a)),Er(!a.pathname||!a.pathname.includes("#"),eS("#","pathname","hash",a)),Er(!a.search||!a.search.includes("#"),eS("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(i==null)l=s;else{let h=t.length-1;if(!n&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),h-=1;a.pathname=g.join("/")}l=h>=0?t[h]:"/"}let c=Yce(a,l),u=i&&i!=="/"&&i.endsWith("/"),f=(o||i===".")&&s.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}var rc=e=>e.join("/").replace(/\/\/+/g,"/"),Xce=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Qce=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Zce=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ede(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var KB=["POST","PUT","PATCH","DELETE"];new Set(KB);var tde=["GET",...KB];new Set(tde);var Zh=x.createContext(null);Zh.displayName="DataRouter";var xw=x.createContext(null);xw.displayName="DataRouterState";var JB=x.createContext({isTransitioning:!1});JB.displayName="ViewTransition";var sde=x.createContext(new Map);sde.displayName="Fetchers";var rde=x.createContext(null);rde.displayName="Await";var bi=x.createContext(null);bi.displayName="Navigation";var Yv=x.createContext(null);Yv.displayName="Location";var yi=x.createContext({outlet:null,matches:[],isDataRoute:!1});yi.displayName="Route";var UT=x.createContext(null);UT.displayName="RouteError";
88function nde(e,{relative:t}={}){Er(em(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:n}=x.useContext(bi),{hash:a,pathname:o,search:i}=Jv(e,{relative:t}),l=o;return s!=="/"&&(l=o==="/"?s:rc([s,o])),n.createHref({pathname:l,search:i,hash:a})}function em(){return x.useContext(Yv)!=null}function Wr(){return Er(em(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Yv).location}var XB="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function QB(e){x.useContext(bi).static||x.useLayoutEffect(e)}function un(){let{isDataRoute:e}=x.useContext(yi);return e?xde():ade()}function ade(){Er(em(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Zh),{basename:t,navigator:s}=x.useContext(bi),{matches:n}=x.useContext(yi),{pathname:a}=Wr(),o=JSON.stringify(DT(n)),i=x.useRef(!1);return QB(()=>{i.current=!0}),x.useCallback((c,u={})=>{if(Ho(i.current,XB),!i.current)return;if(typeof c=="number"){s.go(c);return}let f=$T(c,JSON.parse(o),a,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:rc([t,f.pathname])),(u.replace?s.replace:s.push)(f,u.state,u)},[t,s,o,a,e])}x.createContext(null);function Kv(){let{matches:e}=x.useContext(yi),t=e[e.length-1];return t?t.params:{}}function Jv(e,{relative:t}={}){let{matches:s}=x.useContext(yi),{pathname:n}=Wr(),a=JSON.stringify(DT(s));return x.useMemo(()=>$T(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function ode(e,t){return ZB(e,t)}function ZB(e,t,s,n){var w;Er(em(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(bi),{matches:o}=x.useContext(yi),i=o[o.length-1],l=i?i.params:{},c=i?i.pathname:"/",u=i?i.pathnameBase:"/",f=i&&i.route;{let k=f&&f.path||"";eq(c,!f||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${k}">) 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. 89 90Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=Wr(),g;if(t){let k=typeof t=="string"?Qh(t):t;Er(u==="/"||((w=k.pathname)==null?void 0:w.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let v=g.pathname||"/",y=v;if(u!=="/"){let k=u.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let _=GB(e,{pathname:y});Ho(f||_!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ho(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=ude(_&&_.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:rc([u,a.encodeLocation?a.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?u:rc([u,a.encodeLocation?a.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,s,n);return t&&j?x.createElement(Yv.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},j):j}function ide(){let e=gde(),t=ede(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=x.createElement(x.Fragment,null,x.createElement("p",null,"ð¿ Hey developer ð"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:o},"ErrorBoundary")," or"," ",x.createElement("code",{style:o},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application
90Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),s?x.createElement("pre",{style:a},s):null,i)}var lde=x.createElement(ide,null),cde=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?x.createElement(yi.Provider,{value:this.props.routeContext},x.createElement(UT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function dde({routeContext:e,match:t,children:s}){let n=x.useContext(Zh);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(yi.Provider,{value:e},s)}function ude(e,t=[],s=null,n=null){if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let a=e,o=s==null?void 0:s.errors;if(o!=null){let c=a.findIndex(u=>u.route.id&&(o==null?void 0:o[u.route.id])!==void 0);Er(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,c+1))}let i=!1,l=-1;if(s)for(let c=0;c<a.length;c++){let u=a[c];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=c),u.route.id){let{loaderData:f,errors:h}=s,g=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!h||h[u.route.id]===void 0);if(u.route.lazy||g){i=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((c,u,f)=>{let h,g=!1,v=null,y=null;s&&(h=o&&u.route.id?o[u.route.id]:void 0,v=u.route.errorElement||lde,i&&(l<0&&f===0?(eq("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,y=null):l===f&&(g=!0,y=u.route.hydrateFallbackElement||null)));let _=t.concat(a.slice(0,f+1)),j=()=>{let w;return h?w=v:g?w=y:u.route.Component?w=x.createElement(u.route.Component,null):u.route.element?w=u.route.element:w=c,x.createElement(dde,{match:u,routeContext:{outlet:c,matches:_,isDataRoute:s!=null},children:w})};return s&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?x.createElement(cde,{location:s.location,revalidation:s.revalidation,component:v,error:h,children:j(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):j()},null)}function FT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pde(e){let t=x.useContext(Zh);return Er(t,FT(e)),t}function fde(e){let t=x.useContext(xw);return Er(t,FT(e)),t}function hde(e){let t=x.useContext(yi);return Er(t,FT(e)),t}function BT(e){let t=hde(e),s=t.matches[t.matches.length-1];return Er(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function mde(){return BT("useRouteId")}function gde(){var n;let e=x.useContext(UT),t=fde("useRouteError"),s=BT("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[s]}function xde(){let{router:e}=pde("useNavigate"),t=BT("useNavigate"),s=x.useRef(!1);return QB(()=>{s.current=!0}),x.useCallback(async(a,o={})=>{Ho(s.current,XB),s.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var vO={};function eq(e,t,s){!t&&!vO[e]&&(vO[e]=!0,Ho(!1,s))}x.memo(vde);function vde({routes:e,future:t,state:s}){return ZB(e,void 0,s,t)}function sv({to:e,replace:t,state:s,relative:n}){Er(em(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=x.useContext(bi);Ho(!a,"<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:o}=x.useContext(yi),{pathname:i}=Wr(),l=un(),c=$T(e,DT(o),i,n==="path"),u=JSON.stringify(c);return x.useEffect(()=>{l(JSON.parse(u),{replace:t,state:s,relative:n})},[l,u,n,t,s]),null}function jr(e){Er(!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 bde({basename:e="/",children:t=null,location:s,navigationType:n="POP",navigator:a,static:o=!1}){Er(!em(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),l=x.useMemo(()=>({basename:i,navigator:a,static:o,future:{}}),[i,a,o]);typeof s=="string"&&(s=Qh(s));let{pathname:c="/",search:u="",hash:f="",state:h=null,key:g="default"}=s,v=x.useMemo(()=>{let y=uc(c,i);
90return y==null?null:{location:{pathname:y,search:u,hash:f,state:h,key:g},navigationType:n}},[i,c,u,f,h,g,n]);return Ho(v!=null,`<Router basename="${i}"> is not able to match the URL "${c}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:x.createElement(bi.Provider,{value:l},x.createElement(Yv.Provider,{children:t,value:v}))}function yde({children:e,location:t}){return ode(zC(e),t)}function zC(e,t=[]){let s=[];return x.Children.forEach(e,(n,a)=>{if(!x.isValidElement(n))return;let o=[...t,a];if(n.type===x.Fragment){s.push.apply(s,zC(n.props.children,o));return}Er(n.type===jr,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Er(!n.props.index||!n.props.children,"An index route cannot have child routes.");let i={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=zC(n.props.children,o)),s.push(i)}),s}var u_="get",p_="application/x-www-form-urlencoded";function vw(e){return e!=null&&typeof e.tagName=="string"}function _de(e){return vw(e)&&e.tagName.toLowerCase()==="button"}function jde(e){return vw(e)&&e.tagName.toLowerCase()==="form"}function wde(e){return vw(e)&&e.tagName.toLowerCase()==="input"}function Nde(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kde(e,t){return e.button===0&&(!t||t==="_self")&&!Nde(e)}function HC(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let n=e[s];return t.concat(Array.isArray(n)?n.map(a=>[s,a]):[[s,n]])},[]))}function Sde(e,t){let s=HC(e);return t&&t.forEach((n,a)=>{s.has(a)||t.getAll(a).forEach(o=>{s.append(a,o)})}),s}var Uy=null;function Cde(){if(Uy===null)try{new FormData(document.createElement("form"),0),Uy=!1}catch{Uy=!0}return Uy}var Ede=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tS(e){return e!=null&&!Ede.has(e)?(Ho(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${p_}"`),null):e}function Tde(e,t){let s,n,a,o,i;if(jde(e)){let l=e.getAttribute("action");n=l?uc(l,t):null,s=e.getAttribute("method")||u_,a=tS(e.getAttribute("enctype"))||p_,o=new FormData(e)}else if(_de(e)||wde(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(n=c?uc(c,t):null,s=e.getAttribute("formmethod")||l.getAttribute("method")||u_,a=tS(e.getAttribute("formenctype"))||tS(l.getAttribute("enctype"))||p_,o=new FormData(l,e),!Cde()){let{name:u,type:f,value:h}=e;if(f==="image"){let g=u?`${u}.`:"";o.append(`${g}x`,"0"),o.append(`${g}y`,"0")}else u&&o.append(u,h)}}else{if(vw(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=u_,n=null,a=p_,i=e}return o&&a==="text/plain"&&(i=o,o=void 0),{action:n,method:s.toLowerCase(),encType:a,formData:o,body:i}}function qT(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function Rde(e,t){if(e.id in t)return t[e.id];try{let s=await import(e.module);return t[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ade(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Pde(e,t,s){let n=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let i=await Rde(o,s);return i.links?i.links():[]}return[]}));return Lde(n.flat(1).filter(Ade).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function bO(e,t,s,n,a,o){let i=(c,u)=>s[u]?c.route.id!==s[u].route.id:!0,l=(c,u)=>{var f;return s[u].pathname!==c.pathname||((f=s[u].route.path)==null?void 0:f.endsWith("*"))&&s[u].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,u)=>i(c,u)||l(c,u)):o==="data"?t.filter((c,u)=>{var h;let f=n.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;
90if(c.route.shouldRevalidate){let g=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((h=s[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function Ide(e,t,{includeHydrateFallback:s}={}){return Mde(e.map(n=>{let a=t.routes[n.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),s&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function Mde(e){return[...new Set(e)]}function Ode(e){let t={},s=Object.keys(e).sort();for(let n of s)t[n]=e[n];return t}function Lde(e,t){let s=new Set;return new Set(t),e.reduce((n,a)=>{let o=JSON.stringify(Ode(a));return s.has(o)||(s.add(o),n.push({key:o,link:a})),n},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Dde=new Set([100,101,204,205]);function $de(e,t){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s.pathname==="/"?s.pathname="_root.data":t&&uc(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.data`:s.pathname=`${s.pathname.replace(/\/$/,"")}.data`,s}function tq(){let e=x.useContext(Zh);return qT(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ude(){let e=x.useContext(xw);return qT(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var zT=x.createContext(void 0);zT.displayName="FrameworkContext";function sq(){let e=x.useContext(zT);return qT(e,"You must render this element inside a <HydratedRouter> element"),e}function Fde(e,t){let s=x.useContext(zT),[n,a]=x.useState(!1),[o,i]=x.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:f,onTouchStart:h}=t,g=x.useRef(null);x.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let _=w=>{w.forEach(k=>{i(k.isIntersecting)})},j=new IntersectionObserver(_,{threshold:.5});return g.current&&j.observe(g.current),()=>{j.disconnect()}}},[e]),x.useEffect(()=>{if(n){let _=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(_)}}},[n]);let v=()=>{a(!0)},y=()=>{a(!1),i(!1)};return s?e!=="intent"?[o,g,{}]:[o,g,{onFocus:_g(l,v),onBlur:_g(c,y),onMouseEnter:_g(u,v),onMouseLeave:_g(f,y),onTouchStart:_g(h,v)}]:[!1,g,{}]}function _g(e,t){return s=>{e&&e(s),s.defaultPrevented||t(s)}}function Bde({page:e,...t}){let{router:s}=tq(),n=x.useMemo(()=>GB(s.routes,e,s.basename),[s.routes,e,s.basename]);return n?x.createElement(zde,{page:e,matches:n,...t}):null}function qde(e){let{manifest:t,routeModules:s}=sq(),[n,a]=x.useState([]);return x.useEffect(()=>{let o=!1;return Pde(e,t,s).then(i=>{o||a(i)}),()=>{o=!0}},[e,t,s]),n}function zde({page:e,matches:t,...s}){let n=Wr(),{manifest:a,routeModules:o}=sq(),{basename:i}=tq(),{loaderData:l,matches:c}=Ude(),u=x.useMemo(()=>bO(e,t,c,a,n,"data"),[e,t,c,a,n]),f=x.useMemo(()=>bO(e,t,c,a,n,"assets"),[e,t,c,a,n]),h=x.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let y=new Set,_=!1;if(t.forEach(w=>{var S;let k=a.routes[w.route.id];!k||!k.hasLoader||(!u.some(E=>E.route.id===w.route.id)&&w.route.id in l&&((S=o[w.route.id])!=null&&S.shouldRevalidate)||k.hasClientLoader?_=!0:y.add(w.route.id))}),y.size===0)return[];let j=$de(e,i);return _&&y.size>0&&j.searchParams.set("_routes",t.filter(w=>y.has(w.route.id)).map(w=>w.route.id).join(",")),[j.pathname+j.search]},[i,l,n,a,u,t,e,o]),g=x.useMemo(()=>Ide(f,a),[f,a]),v=qde(f);return x.createElement(x.Fragment,null,h.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...s})),g.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...s})),v.map(({key:y,link:_})=>x.createElement("link",{key:y,..._})))}function Hde(...e){return t=>{e.forEach(s=>{typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var rq=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rq&&(window.__reactRouterVersion="7.6.3")}catch{}function Vde({basename:e,children:t,window:s}){let n=x.useRef();n.current==null&&(n.current=Ace({window:s,v5Compat:!0}));let a=n.current,[o,i]=x.useState({action:a.action,location:a.location}),l=x.useCallback(c=>{x.startTransition(()=>i(c))},[i]);return x.useLayoutEffect(()=>a.listen(l),[a,l]),x.createElement(bde,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a})}var nq=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dt=x.forwardRef(function({onClick:t,discover:s="render",prefetch:n="none",relative:a,reloadDocument:o,replace:i,state:l,target:c,to:u,preventScrollReset:f,viewTransition:h,...g},v){let{basename:y}=x.useContext(bi),_=typeof u=="string"&&nq.test(u),j,w=!1;if(typeof u=="string"&&_&&(j=u,rq))try{let L=new URL(window.location.href),M=u.startsWith("//")?new URL(L.protocol+u):new URL(u),O=uc(M.pathname,y);M.origin===L.origin&&O!=null?u=O+M.search+M.hash:w=!0}catch{Ho(!1,`<Link to="${u}">
90 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let k=nde(u,{relative:a}),[S,E,T]=Fde(n,g),A=Kde(u,{replace:i,state:l,target:c,preventScrollReset:f,relative:a,viewTransition:h});function R(L){t&&t(L),L.defaultPrevented||A(L)}let I=x.createElement("a",{...g,...T,href:j||k,onClick:w||o?t:R,ref:Hde(v,E),target:c,"data-discover":!_&&s==="render"?"true":void 0});return S&&!_?x.createElement(x.Fragment,null,I,x.createElement(Bde,{page:k})):I});dt.displayName="Link";var Gde=x.forwardRef(function({"aria-current":t="page",caseSensitive:s=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:c,...u},f){let h=Jv(i,{relative:u.relative}),g=Wr(),v=x.useContext(xw),{navigator:y,basename:_}=x.useContext(bi),j=v!=null&&eue(h)&&l===!0,w=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,k=g.pathname,S=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;s||(k=k.toLowerCase(),S=S?S.toLowerCase():null,w=w.toLowerCase()),S&&_&&(S=uc(S,_)||S);const E=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let T=k===w||!a&&k.startsWith(w)&&k.charAt(E)==="/",A=S!=null&&(S===w||!a&&S.startsWith(w)&&S.charAt(w.length)==="/"),R={isActive:T,isPending:A,isTransitioning:j},I=T?t:void 0,L;typeof n=="function"?L=n(R):L=[n,T?"active":null,A?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let M=typeof o=="function"?o(R):o;return x.createElement(dt,{...u,"aria-current":I,className:L,ref:f,style:M,to:i,viewTransition:l},typeof c=="function"?c(R):c)});Gde.displayName="NavLink";var Wde=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:s,reloadDocument:n,replace:a,state:o,method:i=u_,action:l,onSubmit:c,relative:u,preventScrollReset:f,viewTransition:h,...g},v)=>{let y=Qde(),_=Zde(l,{relative:u}),j=i.toLowerCase()==="get"?"get":"post",w=typeof l=="string"&&nq.test(l),k=S=>{if(c&&c(S),S.defaultPrevented)return;S.preventDefault();let E=S.nativeEvent.submitter,T=(E==null?void 0:E.getAttribute("formmethod"))||i;y(E||S.currentTarget,{fetcherKey:t,method:T,navigate:s,replace:a,state:o,relative:u,preventScrollReset:f,viewTransition:h})};return x.createElement("form",{ref:v,method:j,action:_,onSubmit:n?c:k,...g,"data-discover":!w&&e==="render"?"true":void 0})});Wde.displayName="Form";function Yde(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aq(e){let t=x.useContext(Zh);return Er(t,Yde(e)),t}function Kde(e,{target:t,replace:s,state:n,preventScrollReset:a,relative:o,viewTransition:i}={}){let l=un(),c=Wr(),u=Jv(e,{relative:o});return x.useCallback(f=>{if(kde(f,t)){f.preventDefault();let h=s!==void 0?s:tv(c)===tv(u);l(e,{replace:h,state:n,preventScrollReset:a,relative:o,viewTransition:i})}},[c,l,u,s,n,t,e,a,o,i])}function Wa(e){Ho(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 t=x.useRef(HC(e)),s=x.useRef(!1),n=Wr(),a=x.useMemo(()=>Sde(n.search,s.current?null:t.current),[n.search]),o=un(),i=x.useCallback((l,c)=>{const u=HC(typeof l=="function"?l(a):l);s.current=!0,o("?"+u,c)},[o,a]);return[a,i]}var Jde=0,Xde=()=>`__${String(++Jde)}__`;function Qde(){let{router:e}=aq("useSubmit"),{basename:t}=x.useContext(bi),s=mde();return x.useCallback(async(n,a={})=>{let{action:o,method:i,encType:l,formData:c,body:u}=Tde(n,t);if(a.navigate===!1){let f=a.fetcherKey||Xde();await e.fetch(f,s,a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:u,formMethod:a.method||i,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:c,body:u,formMethod:a.method||i,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:s,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,s])}function Zde(e,{relative:t}={}){let{basename:s}=x.useContext(bi),n=x.useContext(yi);Er(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),o={...Jv(e||".",{relative:t})},i=Wr();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(f=>f==="")){l.delete("index"),c.filter(h=>
90h).forEach(h=>l.append("index",h));let f=l.toString();o.search=f?`?${f}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(o.pathname=o.pathname==="/"?s:rc([s,o.pathname])),tv(o)}function eue(e,t={}){let s=x.useContext(JB);Er(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=aq("useViewTransitionState"),a=Jv(e,{relative:t.relative});if(!s.isTransitioning)return!1;let o=uc(s.currentLocation.pathname,n)||s.currentLocation.pathname,i=uc(s.nextLocation.pathname,n)||s.nextLocation.pathname;return G_(a.pathname,i)!=null||G_(a.pathname,o)!=null}[...Dde];function oq(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(s=oq(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function rv(){for(var e,t,s=0,n="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=oq(e))&&(n&&(n+=" "),n+=t);return n}const HT="-",tue=e=>{const t=rue(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const l=i.split(HT);return l[0]===""&&l.length!==1&&l.shift(),iq(l,t)||sue(i)},getConflictingClassGroupIds:(i,l)=>{const c=s[i]||[];return l&&n[i]?[...c,...n[i]]:c}}},iq=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const s=e[0],n=t.nextPart.get(s),a=n?iq(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(HT);return(i=t.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},yO=/^\[(.+)\]$/,sue=e=>{if(yO.test(e)){const t=yO.exec(e)[1],s=t==null?void 0:t.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},rue=e=>{const{theme:t,classGroups:s}=e,n={nextPart:new Map,validators:[]};for(const a in s)VC(s[a],n,a,t);return n},VC=(e,t,s,n)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:_O(t,a);o.classGroupId=s;return}if(typeof a=="function"){if(nue(a)){VC(a(n),t,s,n);return}t.validators.push({validator:a,classGroupId:s});return}Object.entries(a).forEach(([o,i])=>{VC(i,_O(t,o),s,n)})})},_O=(e,t)=>{let s=e;return t.split(HT).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},nue=e=>e.isThemeGetter,aue=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,n=new Map;const a=(o,i)=>{s.set(o,i),t++,t>e&&(t=0,n=s,s=new Map)};return{get(o){let i=s.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return a(o,i),i},set(o,i){s.has(o)?s.set(o,i):a(o,i)}}},GC="!",WC=":",oue=WC.length,iue=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=a=>{const o=[];let i=0,l=0,c=0,u;for(let y=0;y<a.length;y++){let _=a[y];if(i===0&&l===0){if(_===WC){o.push(a.slice(c,y)),c=y+oue;continue}if(_==="/"){u=y;continue}}_==="["?i++:_==="]"?i--:_==="("?l++:_===")"&&l--}const f=o.length===0?a:a.substring(c),h=lue(f),g=h!==f,v=u&&u>c?u-c:void 0;return{modifiers:o,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}};if(t){const a=t+WC,o=n;n=i=>i.startsWith(a)?o(i.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(s){const a=n;n=o=>s({className:o,parseClassName:a})}return n},lue=e=>e.endsWith(GC)?e.substring(0,e.length-1):e.startsWith(GC)?e.substring(1):e,cue=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const a=[];let o=[];return n.forEach(i=>{i[0]==="["||t[i]?(a.push(...o.sort(),i),o=[]):o.push(i)}),a.push(...o.sort()),a}},due=e=>({cache:aue(e.cacheSize),parseClassName:iue(e),sortModifiers:cue(e),...tue(e)}),uue=/\s+/,pue=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],l=e.trim().split(uue);let c="";for(let u=l.length-1;u>=0;u-=1){const f=l[u],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:_}=s(f);if(h){c=f+(c.length>0?" "+c:c);continue}let j=!!_,w=n(j?y.substring(0,_):y);if(!w){if(!j){c=f+(c.length>0?" "+c:c);continue}if(w=n(y),!w){c=f+(c.length>0?" "+c:c);continue}j=!1}const k=o(g).join(":"),S=v?k+GC:k,E=S+w;if(i.includes(E))continue;i.push(E);const T=a(w,j);for(let A=0;A<T.length;++A){const R=T[A];i.push(S+R)}c=f+(c.length>0?" "+c:c)}return c};function fue(){let e=0,t,s,n="";for(;e<arguments.length;)(t=arguments[e++])&&(s=lq(t))&&(n&&(n+=" "),n+=s);return n}const lq=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=lq(e[n]))&&(s&&(s+=" "),s+=t);return s};function hue(e,...t){let s,n,a,o=i;function i(c){const u=t.reduce((f,h)=>h(f),e());return s=due(u),n=s.cache.get,a=s.cache.set,o=l,l(c)}function l(c){const u=n(c);if(u)return u;const f=pue(c,s);return a(c,f),f}return function(){return o(fue.apply(null,arguments))}}const gn=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},cq=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dq=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mue=/^\d+\/\d+$/,gue=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xue=/\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$/,vue=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bue=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yue=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vf=e=>mue.test(e),Cs=e=>!!e&&!Number.isNaN(Number(e)),Bc=e=>!!e&&Number.isInteger(Number(e)),sS=e=>e.endsWith("%")&&Cs(e.slice(0,-1)),Tl=e=>gue.test(e),_ue=()=>!0,jue=e=>xue.test(e)&&!vue.test(e),uq=()=>!1,wue=e=>bue.test(e),Nue=e=>yue.test(e),kue=e=>!Bt(e)&&!qt(e),Sue=e=>tm(e,hq,uq),Bt=e=>cq.test(e),mu=e=>tm(e,mq,jue),rS=e=>tm(e,Aue,Cs),jO=e=>tm(e,pq,uq),Cue=e=>tm(e,fq,Nue),Fy=e=>tm(e,gq,wue),qt=e=>dq.test(e),jg=e=>sm(e,mq),Eue=e=>sm(e,Pue),wO=e=>sm(e,pq),Tue=e=>sm(e,hq),Rue=e=>sm(e,fq),By=e=>sm(e,gq,!0),tm=(e,t,s)=>{const n=cq.exec(e);
vendor: 4,478 bytes, line 90
90return n?n[1]?t(n[1]):s(n[2]):!1},sm=(e,t,s=!1)=>{const n=dq.exec(e);return n?n[1]?t(n[1]):s:!1},pq=e=>e==="position"||e==="percentage",fq=e=>e==="image"||e==="url",hq=e=>e==="length"||e==="size"||e==="bg-size",mq=e=>e==="length",Aue=e=>e==="number",Pue=e=>e==="family-name",gq=e=>e==="shadow",Iue=()=>{const e=gn("color"),t=gn("font"),s=gn("text"),n=gn("font-weight"),a=gn("tracking"),o=gn("leading"),i=gn("breakpoint"),l=gn("container"),c=gn("spacing"),u=gn("radius"),f=gn("shadow"),h=gn("inset-shadow"),g=gn("text-shadow"),v=gn("drop-shadow"),y=gn("blur"),_=gn("perspective"),j=gn("aspect"),w=gn("ease"),k=gn("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),qt,Bt],A=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],I=()=>[qt,Bt,c],L=()=>[vf,"full","auto",...I()],M=()=>[Bc,"none","subgrid",qt,Bt],O=()=>["auto",{span:["full",Bc,qt,Bt]},Bc,qt,Bt],z=()=>[Bc,"auto",qt,Bt],X=()=>["auto","min","max","fr",qt,Bt],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...I()],J=()=>[vf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],F=()=>[e,qt,Bt],V=()=>[...E(),wO,jO,{position:[qt,Bt]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",Tue,Sue,{size:[qt,Bt]}],ae=()=>[sS,jg,mu],H=()=>["","none","full",u,qt,Bt],U=()=>["",Cs,jg,mu],oe=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[Cs,sS,wO,jO],le=()=>["","none",y,qt,Bt],Se=()=>["none",Cs,qt,Bt],we=()=>["none",Cs,qt,Bt],Le=()=>[Cs,qt,Bt],xe=()=>[vf,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tl],breakpoint:[Tl],color:[_ue],container:[Tl],"drop-shadow":[Tl],ease:["in","out","in-out"],font:[kue],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tl],shadow:[Tl],spacing:["px",Cs],text:[Tl],"text-shadow":[Tl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vf,Bt,qt,j]}],container:["container"],columns:[{columns:[Cs,Bt,qt,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Bc,"auto",qt,Bt]}],basis:[{basis:[vf,"full","auto",l,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Cs,vf,"auto","initial","none",Bt]}],grow:[{grow:["",Cs,qt,Bt]}],shrink:[{shrink:["",Cs,qt,Bt]}],order:[{order:[Bc,"first","last","none",qt,Bt]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":z()}
vendor: 11,023 bytes, line 90
90],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":X()}],"auto-rows":[{"auto-rows":X()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[l,"screen",...J()]}],"min-w":[{"min-w":[l,"screen","none",...J()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",s,jg,mu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,qt,rS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sS,Bt]}],"font-family":[{font:[Eue,Bt,t]}],"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:[a,qt,Bt]}],"line-clamp":[{"line-clamp":[Cs,"none",qt,rS]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",qt,Bt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qt,Bt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Cs,"from-font","auto",qt,mu]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Cs,"auto",qt,Bt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qt,Bt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qt,Bt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Bc,qt,Bt],radial:["",qt,Bt],conic:[Bc,qt,Bt]},Rue,Cue]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Cs,qt,Bt]}],"outline-w":[{outline:["",Cs,jg,mu]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",f,By,Fy]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",h,By,Fy]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Cs,mu]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",g,By,Fy]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Cs,qt,Bt]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Cs]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[qt,Bt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[Cs]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qt,Bt]}],filter:[{filter:["","none",qt,Bt]}],blur:[{blur:le()}],brightness:[{brightness:[Cs,qt,Bt]}],contrast:[{contrast:[Cs,qt,Bt]}],"drop-shadow":[{"drop-shadow":["","none",v,By,Fy]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Cs,qt,Bt]}],"hue-rotate":[{"hue-rotate":[Cs,qt,Bt]}],invert:[{invert:["",Cs,qt,Bt]}],saturate:[{saturate:[Cs,qt,Bt]}],sepia:[{sepia:["",Cs,qt,Bt]}],"backdrop-filter":[{"backdrop-filter":["","none",qt,Bt]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Cs,qt,Bt]}],"backdrop-contrast":[{"backdrop-contrast":[Cs,qt,Bt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Cs,qt,Bt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Cs,qt,Bt]}],"backdrop-invert":[{"backdrop-invert":["",Cs,qt,Bt]}],"backdrop-opacity":[{"backdrop-opacity":[Cs,qt,Bt]}],"backdrop-saturate":[{"backdrop-saturate":[Cs,qt,Bt]}],"backdrop-sepia":[{"backdrop-sepia":["",Cs,qt,Bt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qt,Bt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Cs,"initial",qt,Bt]}],ease:[{ease:["linear","initial",w,qt,Bt]}],delay:[{delay:[Cs,qt,Bt]}],animate:[{animate:["none",k,qt,Bt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,qt,Bt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:we()}],"scale-x":[{"scale-x":we()}],"scale-y":[{"scale-y":we()}],"scale-z":[{"scale-z":we()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[qt,Bt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}
vendor: 4,630 bytes, line 90
90],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qt,Bt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",qt,Bt]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Cs,jg,mu,rS]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},xq=hue(Iue);function Nr(...e){return xq(rv(e))}const vq=x.forwardRef(({logo:e,title:t,actions:s,navLinks:n=[],className:a,...o},i)=>{const l=Nr("group relative font-medium transition-colors text-foreground
90/80","hover:text-foreground focus-visible:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#5A45FF]/70 focus-visible:ring-offset-0");return r.jsx("div",{ref:i,className:Nr("sticky top-0 z-50 border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]/95 backdrop-blur supports-[backdrop-filter]:bg-[var(--color-bg-alt)]/60",a),...o,children:r.jsxs("div",{className:"flex h-16 items-center justify-between gap-3 pl-[4.5rem] pr-4 sm:gap-6 sm:pl-20 sm:pr-6 lg:pl-8 lg:pr-10",children:[r.jsxs("div",{className:"flex items-center gap-6 min-w-0",children:[(e||t)&&r.jsxs("div",{className:"flex items-center space-x-3",children:[e&&r.jsx("div",{className:"flex items-center space-x-2",children:e}),t&&r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t})]}),n.length>0&&r.jsx("div",{className:"hidden md:flex items-center gap-6 text-sm",children:n.map((c,u)=>{const f="pointer-events-none absolute inset-x-0 -bottom-1 h-px origin-center scale-x-0 bg-gradient-to-r from-transparent via-[#5A45FF] to-transparent transition-transform duration-200 ease-out group-hover:scale-x-100 group-focus-visible:scale-x-100";return c.external?r.jsx("a",{href:c.href,className:l,...c.dataAttributes,children:r.jsxs("span",{className:"relative inline-flex items-center",children:[c.label,r.jsx("span",{className:f})]})},`${c.label}-${u}`):r.jsx(dt,{to:c.href,className:l,...c.dataAttributes,children:r.jsxs("span",{className:"relative inline-flex items-center",children:[c.label,r.jsx("span",{className:f})]})},`${c.label}-${u}`)})})]}),s&&s.length>0&&r.jsx("div",{className:"flex items-center space-x-3",children:s.map((c,u)=>r.jsx(x.Fragment,{children:c},u))})]})})});vq.displayName="TopNav";function NO(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hc(...e){return t=>{let s=!1;const n=e.map(a=>{const o=NO(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a<n.length;a++){const o=n[a];typeof o=="function"?o():NO(e[a],null)}}}}function Vs(...e){return x.useCallback(hc(...e),e)}var Mue=Symbol.for("react.lazy"),W_=D5[" use ".trim().toString()];function Oue(e){return typeof e=="object"&&e!==null&&"then"in e}function bq(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Mue&&"_payload"in e&&Oue(e._payload)}function Lue(e){const t=Due(e),s=x.forwardRef((n,a)=>{let{children:o,...i}=n;bq(o)&&typeof W_=="function"&&(o=W_(o._payload));const l=x.Children.toArray(o),c=l.find(Uue);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}var yq=Lue("Slot");function Due(e){const t=x.forwardRef((s,n)=>{let{children:a,...o}=s;if(bq(a)&&typeof W_=="function"&&(a=W_(a._payload)),x.isValidElement(a)){const i=Bue(a),l=Fue(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $ue=Symbol("radix.slottable");function Uue(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$ue}function Fue(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function Bue(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}const kO=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,SO=rv,rm=(e,t)=>s=>{var n;if((t==null?void 0:t.variants)==null)return SO(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(u=>{const f=s==null?void 0:s[u],h=o==null?void 0:o[u];if(f===null)return null;const g=kO(f)||kO(h);return a[u][g]}),l=s&&Object.entries(s).reduce((u,f)=>{let[h,g]=f;return g===void 0||(u[h]=g),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(y=>{let[_,j]=y;return Array.isArray(j)?j.includes({...o,...l}[_]):{...o,...l}[_]===j})?[...u,h,g]:u},[]);return SO(e,i,c,s==null?void 0:s.class,s==null?void 0:s.className)},que=rm("inline-flex items-center justify-center whitespace-nowrap rounded-md text-xs font-medium transition focus:outline-none focus:ring-2 focus:ring-offset-0 disabled:pointer-events-none disabled:opacity-60 disabled:cursor-not-allowed",{variants:{variant:{primary:"bg-indigo-500 text-white shadow-sm hover:bg-indigo-400 focus:ring-indigo-500/70",secondary:"border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-default)] shadow-sm hover:bg-[var(--color-bg-hover)] focus:ring-[var(--color-accent-blue)]/60",outline:"border border-[var(--color-border-default)] bg-transparent text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] focus:ring-[var(--color-accent-blue)]/60",ghost:"text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] focus:ring-[var(--color-accent-blue)]/60",subtle:"text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] focus:ring-[var(--color-accent-blue)]/60",destructive:"border border-rose-500/60 bg-transparent text-rose-500 dark:text-rose-300 hover:bg-rose-500/10 focus:ring-rose-500/50",success:"border border-emerald-500/50 bg-emerald-500/10 text-emerald-600 dark:text-emerald-100 hover:bg-emerald-500/20 focus:ring-emerald-500/50",warning:"border border-amber-500/50 bg-amber-500/10 text-amber-600 dar
90k:text-amber-100 hover:bg-amber-500/20 focus:ring-amber-500/50",info:"border border-blue-500/50 bg-blue-500/10 text-blue-600 dark:text-blue-100 hover:bg-blue-500/20 focus:ring-blue-500/50"},size:{sm:"px-3 py-1.5 text-xs",md:"px-3.5 py-2 text-xs",lg:"px-4 py-2.5 text-sm",icon:"h-10 w-10"}},defaultVariants:{variant:"primary",size:"md"}}),ht=x.forwardRef(({className:e,variant:t,size:s,asChild:n=!1,loading:a=!1,iconLeft:o,iconRight:i,children:l,disabled:c,...u},f)=>{const h=n?yq:"button",g=r.jsxs("span",{className:"inline-flex items-center justify-center gap-2",children:[a?r.jsxs("svg",{className:"h-4 w-4 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):o&&r.jsx("span",{className:"flex-shrink-0",children:o}),r.jsx("span",{className:"inline-flex items-center",children:l}),!a&&i&&r.jsx("span",{className:"flex-shrink-0",children:i})]});return r.jsx(h,{className:Nr(que({variant:t,size:s,className:e})),ref:f,disabled:c||a,...u,children:g})});ht.displayName="Button";const _q=x.createContext(void 0),CO={getItem(e){try{return(localStorage==null?void 0:localStorage.getItem(e))??null}catch{return null}},setItem(e,t){try{localStorage==null||localStorage.setItem(e,t)}catch{}}};function zue({children:e}){const[t,s]=x.useState(()=>{if(typeof window>"u")return"dark";const o=CO.getItem("reqres-theme");return o||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});x.useEffect(()=>{const o=document.documentElement;t==="light"?(o.classList.add("light"),o.classList.remove("dark")):(o.classList.add("dark"),o.classList.remove("light")),CO.setItem("reqres-theme",t)},[t]);const n=o=>{s(o)},a=()=>{s(o=>o==="dark"?"light":"dark")};return r.jsx(_q.Provider,{value:{theme:t,toggleTheme:a,setTheme:n},children:e})}function Sp(){const e=x.useContext(_q);if(e===void 0)throw new Error("useTheme must be used within ThemeProvider");return e}/** 91 * @license lucide-react v0.525.0 - ISC 92 * 93 * This source code is licensed under the ISC license. 94 * See the LICENSE file in the root directory of this source tree. 95 */const Hue=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vue=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase()),EO=e=>{const t=Vue(e);return t.charAt(0).toUpperCase()+t.slice(1)},jq=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim(),Gue=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** 96 * @license lucide-react v0.525.0 - ISC 97 * 98 * This source code is licensed under the ISC license. 99 * See the LICENSE file in the root directory of this source tree. 100 */var Wue={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"};/** 101 * @license lucide-react v0.525.0 - ISC 102 * 103 * This source code is licensed under the ISC license. 104 * See the LICENSE file in the root directory of this source tree. 105 */const Yue=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...l},c)=>x.createElement("svg",{ref:c,...Wue,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:jq("lucide",a),...!o&&!Gue(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,f])=>x.createElement(u,f)),...Array.isArray(o)?o:[o]]));/** 106 * @license lucide-react v0.525.0 - ISC 107 * 108 * This source code is licensed under the ISC license. 109 * See the LICENSE file in the root directory of this source tree. 110 */const lt=(e,t)=>{const s=x.forwardRef(({className:n,...a},o)=>x.createElement(Yue,{ref:o,iconNode:t,className:jq(`lucide-${Hue(EO(e))}`,`lucide-${e}`,n),...a}
110));return s.displayName=EO(e),s};/** 111 * @license lucide-react v0.525.0 - ISC 112 * 113 * This source code is licensed under the ISC license. 114 * See the LICENSE file in the root directory of this source tree. 115 */const Kue=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Qf=lt("activity",Kue);/** 116 * @license lucide-react v0.525.0 - ISC 117 * 118 * This source code is licensed under the ISC license. 119 * See the LICENSE file in the root directory of this source tree. 120 */const Jue=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Lf=lt("arrow-down",Jue);/** 121 * @license lucide-react v0.525.0 - ISC 122 * 123 * This source code is licensed under the ISC license. 124 * See the LICENSE file in the root directory of this source tree. 125 */const Xue=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],cn=lt("arrow-left",Xue);/** 126 * @license lucide-react v0.525.0 - ISC 127 * 128 * This source code is licensed under the ISC license. 129 * See the LICENSE file in the root directory of this source tree. 130 */const Que=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Kt=lt("arrow-right",Que);/** 131 * @license lucide-react v0.525.0 - ISC 132 * 133 * This source code is licensed under the ISC license. 134 * See the LICENSE file in the root directory of this source tree. 135 */const Zue=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ou=lt("arrow-up-down",Zue);/** 136 * @license lucide-react v0.525.0 - ISC 137 * 138 * This source code is licensed under the ISC license. 139 * See the LICENSE file in the root directory of this source tree. 140 */const epe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Df=lt("arrow-up",epe);/** 141 * @license lucide-react v0.525.0 - ISC 142 * 143 * This source code is licensed under the ISC license. 144 * See the LICENSE file in the root directory of this source tree. 145 */const tpe=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],spe=lt("badge-check",tpe);/** 146 * @license lucide-react v0.525.0 - ISC 147 * 148 * This source code is licensed under the ISC license. 149 * See the LICENSE file in the root directory of this source tree. 150 */const rpe=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],bd=lt("book-open",rpe);/** 151 * @license lucide-react v0.525.0 - ISC 152 * 153 * This source code is licensed under the ISC license. 154 * See the LICENSE file in the root directory of this source tree. 155 */const npe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],YC=lt("bot",npe);/** 156 * @license lucide-react v0.525.0 - ISC 157 * 158 * This source code is licensed under the ISC license. 159 * See the LICENSE file in the root directory of this source tree. 160 */const ape=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],KC=lt("building-2",ape);/** 161 * @license lucide-react v0.525.0 - ISC 162 * 163 * This source code is licensed under the ISC license. 164 * See the LICENSE file in the root directory of this source tree. 165 */const ope=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ipe=lt("calendar",ope);/** 166 * @license lucide-react v0.525.0 - ISC 167 * 168 * This source code is licensed under the ISC license. 169 * See the LICENSE file in the root directory of this source tree. 170 */const lpe=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],cpe=lt("camera",lpe);/** 171 * @license lucide-react v0.525.0 - ISC 172 * 173 * This source code is licensed under the ISC license. 174 * See the LICENSE file in the root directory of this source tree. 175 */const dpe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Y_=lt("chart-column",dpe);/** 176 * @license lucide-react v0.525.0 - ISC 177 * 178 * This source code is licensed under the ISC license. 179 * See the LICENSE file in the root directory of this source tree. 180 */const upe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ts=lt("check",upe);/** 181 * @license lucide-react v0.525.0 - ISC 182 * 183 * This source code is licensed under the ISC license. 184 * See the LICENSE file in the root directory of this source tree. 185 */const ppe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sr=lt("chevron-down",ppe);/** 186 * @license lucide-react v0.525.0 - ISC 187 * 188 * This source code is licensed under the ISC license. 189 * See the LICENSE file in the root directory of this source tree. 190 */const fpe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],JC=lt("chevron-left",fpe);/** 191 * @license lucide-react v0.525.0 - ISC 192 * 193 * This source code is licensed under the ISC license. 194 * See the LICENSE file in the root directory of this source tree. 195 */const hpe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Hn=lt("chevron-right",hpe);/** 196 * @license lucide-react v0.525.0 - ISC 197 * 198 * This source code is licensed under the ISC license. 199 * See the LICENSE file in the root directory of this source tree. 200 */const mpe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],cd=lt("chevron-up",mpe);/** 201 * @license lucide-react v0.525.0 - ISC 202 * 203 * This source code is licensed under the ISC license. 204 * See the LICENSE file in the root directory of this source tree. 205 */const gpe=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],xpe=lt("chevrons-left",gpe);/** 206 * @license lucide-react v0.525.0 - ISC 207 * 208 * This source code is licensed under the ISC license. 209 * See the LICENSE file in the root directory of this source tree. 210 */const vpe=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],bpe=lt("chevrons-right",vpe);/** 211 * @license lucide-react v0.525.0 - ISC 212 * 213 * This source code is licensed under the ISC license. 214 * See the LICENSE file in the root directory of this source tree. 215 */const ype=[["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"}]],lr=lt("circle-alert",ype);/** 216 * @license lucide-react v0.525.0 - ISC 217 * 218 * This source code is licensed under the ISC license. 219 * See the LICENSE file in the root directory of this source tree. 220 */const _pe=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],yd=lt("circle-check-big",_pe);/** 221 * @license lucide-react v0.525.0 - ISC 222 * 223 * This source code is licensed under the ISC license. 224 * See the LICENSE file in the root directory of this source tree. 225 */const jpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Or=lt("circle-check",jpe);/** 226 * @license lucide-react v0.525.0 - ISC 227 * 228 * This source code is licensed under the ISC license. 229 * See the LICENSE file in the root directory of this source tree. 230 */const wpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],wq=lt("circle-question-mark",wpe);/** 231 * @license lucide-react v0.525.0 - ISC 232 * 233 * This source code is licensed under the ISC license. 234 * See the LICENSE file in the root directory of this source tree. 235 */const Npe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Nq=lt("circle-x",Npe);/** 236 * @license lucide-react v0.525.0 - ISC 237 * 238 * This source code is licensed under the ISC license. 239 * See the LICENSE file in the root directory of this source tree. 240 */const kpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Spe=lt("circle",kpe);/** 241 * @license lucide-react v0.525.0 - ISC 242 * 243 * This source code is licensed under the ISC license. 244 * See the LICENSE file in the root directory of this source tree. 245 */const Cpe=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],nv=lt("clock-3",Cpe);/** 246 * @license lucide-react v0.525.0 - ISC 247 * 248 * This source code is licensed under the ISC license. 249 * See the LICENSE file in the root directory of this source tree. 250 */const Epe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Cp=lt("clock",Epe);/** 251 * @license lucide-react v0.525.0 - ISC 252 * 253 * This source code is licensed under the ISC license. 254 * See the LICENSE file in the root directory of this source tree. 255 */const Tpe=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],nm=lt("code-xml",Tpe);/** 256 * @license lucide-react v0.525.0 - ISC 257 * 258 * This source code is licensed under the ISC license. 259 * See the LICENSE file in the root directory of this source tree. 260 */const Rpe=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Vl=lt("code",Rpe);/** 261 * @license lucide-react v0.525.0 - ISC 262 * 263 * This source code is licensed under the ISC license. 264 * See the LICENSE file in the root directory of this source tree. 265 */const Ape=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",ke
265y:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ppe=lt("compass",Ape);/** 266 * @license lucide-react v0.525.0 - ISC 267 * 268 * This source code is licensed under the ISC license. 269 * See the LICENSE file in the root directory of this source tree. 270 */const Ipe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],is=lt("copy",Ipe);/** 271 * @license lucide-react v0.525.0 - ISC 272 * 273 * This source code is licensed under the ISC license. 274 * See the LICENSE file in the root directory of this source tree. 275 */const Mpe=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],zi=lt("credit-card",Mpe);/** 276 * @license lucide-react v0.525.0 - ISC 277 * 278 * This source code is licensed under the ISC license. 279 * See the LICENSE file in the root directory of this source tree. 280 */const Ope=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Wi=lt("crown",Ope);/** 281 * @license lucide-react v0.525.0 - ISC 282 * 283 * This source code is licensed under the ISC license. 284 * See the LICENSE file in the root directory of this source tree. 285 */const Lpe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Rn=lt("database",Lpe);/** 286 * @license lucide-react v0.525.0 - ISC 287 * 288 * This source code is licensed under the ISC license. 289 * See the LICENSE file in the root directory of this source tree. 290 */const Dpe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],av=lt("download",Dpe);/** 291 * @license lucide-react v0.525.0 - ISC 292 * 293 * This source code is licensed under the ISC license. 294 * See the LICENSE file in the root directory of this source tree. 295 */const $pe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],ov=lt("ellipsis",$pe);/** 296 * @license lucide-react v0.525.0 - ISC 297 * 298 * This source code is licensed under the ISC license. 299 * See the LICENSE file in the root directory of this source tree. 300 */const Upe=[["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"}]],ja=lt("external-link",Upe);/** 301 * @license lucide-react v0.525.0 - ISC 302 * 303 * This source code is licensed under the ISC license. 304 * See the LICENSE file in the root directory of this source tree. 305 */const Fpe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],bh=lt("eye-off",Fpe);/** 306 * @license lucide-react v0.525.0 - ISC 307 * 308 * This source code is licensed under the ISC license. 309 * See the LICENSE file in the root directory of this source tree. 310 */const Bpe=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],za=lt("eye",Bpe);/** 311 * @license lucide-react v0.525.0 - ISC 312 * 313 * This source code is licensed under the ISC license. 314 * See the LICENSE file in the root directory of this source tree. 315 */const qpe=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],zpe=lt("file-pen",qpe);/** 316 * @license lucide-react v0.525.0 - ISC 317 * 318 * This source code is licensed under the ISC license. 319 * See the LICENSE file in the root directory of this source tree. 320 */const Hpe=[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],TO=lt("file-plus",Hpe);/** 321 * @license lucide-react v0.525.0 - ISC 322 * 323 * This source code is licensed under the ISC license. 324 * See the LICENSE file in the root directory of this source tree. 325 */const Vpe=[["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"}]],nc=lt("file-text",Vpe);/** 326 * @license lucide-react v0.525.0 - ISC 327 * 328 * This source code is licensed under the ISC license. 329 * See the LICENSE file in the root directory of this source tree. 330 */const Gpe=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Lu=lt("flask-conical",Gpe);/** 331 * @license lucide-react v0.525.0 - ISC 332 * 333 * This source code is licensed under the ISC license. 334 * See the LICENSE file in the root directory of this source tree. 335 */const Wpe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ype=lt("folder-open",Wpe);/** 336 * @license lucide-react v0.525.0 - ISC 337 * 338 * This source code is licensed under the ISC license. 339 * See the LICENSE file in the root directory of this source tree. 340 */const Kpe=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}
340]],nS=lt("folder",Kpe);/** 341 * @license lucide-react v0.525.0 - ISC 342 * 343 * This source code is licensed under the ISC license. 344 * See the LICENSE file in the root directory of this source tree. 345 */const Jpe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],VT=lt("funnel",Jpe);/** 346 * @license lucide-react v0.525.0 - ISC 347 * 348 * This source code is licensed under the ISC license. 349 * See the LICENSE file in the root directory of this source tree. 350 */const Xpe=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Qpe=lt("gauge",Xpe);/** 351 * @license lucide-react v0.525.0 - ISC 352 * 353 * This source code is licensed under the ISC license. 354 * See the LICENSE file in the root directory of this source tree. 355 */const Zpe=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],efe=lt("gift",Zpe);/** 356 * @license lucide-react v0.525.0 - ISC 357 * 358 * This source code is licensed under the ISC license. 359 * See the LICENSE file in the root directory of this source tree. 360 */const tfe=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],sfe=lt("git-branch",tfe);/** 361 * @license lucide-react v0.525.0 - ISC 362 * 363 * This source code is licensed under the ISC license. 364 * See the LICENSE file in the root directory of this source tree. 365 */const rfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],iv=lt("globe",rfe);/** 366 * @license lucide-react v0.525.0 - ISC 367 * 368 * This source code is licensed under the ISC license. 369 * See the LICENSE file in the root directory of this source tree. 370 */const nfe=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],lp=lt("graduation-cap",nfe);/** 371 * @license lucide-react v0.525.0 - ISC 372 * 373 * This source code is licensed under the ISC license. 374 * See the LICENSE file in the root directory of this source tree. 375 */const afe=[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]],qy=lt("hammer",afe);/** 376 * @license lucide-react v0.525.0 - ISC 377 * 378 * This source code is licensed under the ISC license. 379 * See the LICENSE file in the root directory of this source tree. 380 */const ofe=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],ife=lt("hard-drive",ofe);/** 381 * @license lucide-react v0.525.0 - ISC 382 * 383 * This source code is licensed under the ISC license. 384 * See the LICENSE file in the root directory of this source tree. 385 */const lfe=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],cfe=lt("house",lfe);/** 386 * @license lucide-react v0.525.0 - ISC 387 * 388 * This source code is licensed under the ISC license. 389 * See the LICENSE file in the root directory of this source tree. 390 */const dfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],kq=lt("info",dfe);/** 391 * @license lucide-react v0.525.0 - ISC 392 * 393 * This source code is licensed under the ISC license. 394 * See the LICENSE file in the root directory of this source tree. 395 */const ufe=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],_d=lt("key",ufe);/** 396 * @license lucide-react v0.525.0 - ISC 397 * 398 * This source code is licensed under the ISC license. 399 * See the LICENSE file in the root directory of this source tree. 400 */const pfe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aS=lt("layers",pfe);
400/** 401 * @license lucide-react v0.525.0 - ISC 402 * 403 * This source code is licensed under the ISC license. 404 * See the LICENSE file in the root directory of this source tree. 405 */const ffe=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],hfe=lt("layout-dashboard",ffe);/** 406 * @license lucide-react v0.525.0 - ISC 407 * 408 * This source code is licensed under the ISC license. 409 * See the LICENSE file in the root directory of this source tree. 410 */const mfe=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],gfe=lt("layout-grid",mfe);/** 411 * @license lucide-react v0.525.0 - ISC 412 * 413 * This source code is licensed under the ISC license. 414 * See the LICENSE file in the root directory of this source tree. 415 */const xfe=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],vfe=lt("layout-template",xfe);/** 416 * @license lucide-react v0.525.0 - ISC 417 * 418 * This source code is licensed under the ISC license. 419 * See the LICENSE file in the root directory of this source tree. 420 */const bfe=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Sq=lt("lightbulb",bfe);/** 421 * @license lucide-react v0.525.0 - ISC 422 * 423 * This source code is licensed under the ISC license. 424 * See the LICENSE file in the root directory of this source tree. 425 */const yfe=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],_fe=lt("list",yfe);/** 426 * @license lucide-react v0.525.0 - ISC 427 * 428 * This source code is licensed under the ISC license. 429 * See the LICENSE file in the root directory of this source tree. 430 */const jfe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],on=lt("loader-circle",jfe);/** 431 * @license lucide-react v0.525.0 - ISC 432 * 433 * This source code is licensed under the ISC license. 434 * See the LICENSE file in the root directory of this source tree. 435 */const wfe=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Nfe=lt("log-in",wfe);/** 436 * @license lucide-react v0.525.0 - ISC 437 * 438 * This source code is licensed under the ISC license. 439 * See the LICENSE file in the root directory of this source tree. 440 */const kfe=[["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"}]],Ep=lt("lock",kfe);/** 441 * @license lucide-react v0.525.0 - ISC 442 * 443 * This source code is licensed under the ISC license. 444 * See the LICENSE file in the root directory of this source tree. 445 */const Sfe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],yh=lt("mail",Sfe);/** 446 * @license lucide-react v0.525.0 - ISC 447 * 448 * This source code is licensed under the ISC license. 449 * See the LICENSE file in the root directory of this source tree. 450 */const Cfe=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],oS=lt("megaphone",Cfe);/** 451 * @license lucide-react v0.525.0 - ISC 452 * 453 * This source code is licensed under the ISC license. 454 * See the LICENSE file in the root directory of this source tree. 455 */const Efe=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],Tfe=lt("menu",Efe);/** 456 * @license lucide-react v0.525.0 - ISC 457 * 458 * This source code is licensed under the ISC license. 459 * See the LICENSE file in the root directory of this source tree. 460 */const Rfe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Afe=lt("monitor",Rfe);/** 461 * @license lucide-react v0.525.0 - ISC 462 * 463 * This source code is licensed under the ISC license. 464 * See the LICENSE file in the root directory of this source tree. 465 */const Pfe=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Ife=lt("moon",Pfe);/** 466 * @license lucide-react v0.525.0 - ISC 467 * 468 * This source code is licensed under the ISC license. 469 * See the LICENSE file in the root directory of this source tree. 470 */const Mfe=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}
470],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]],Ofe=lt("notebook",Mfe);/** 471 * @license lucide-react v0.525.0 - ISC 472 * 473 * This source code is licensed under the ISC license. 474 * See the LICENSE file in the root directory of this source tree. 475 */const Lfe=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Dfe=lt("pause",Lfe);/** 476 * @license lucide-react v0.525.0 - ISC 477 * 478 * This source code is licensed under the ISC license. 479 * See the LICENSE file in the root directory of this source tree. 480 */const $fe=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]],Ufe=lt("pencil-line",$fe);/** 481 * @license lucide-react v0.525.0 - ISC 482 * 483 * This source code is licensed under the ISC license. 484 * See the LICENSE file in the root directory of this source tree. 485 */const Ffe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Cq=lt("pencil",Ffe);/** 486 * @license lucide-react v0.525.0 - ISC 487 * 488 * This source code is licensed under the ISC license. 489 * See the LICENSE file in the root directory of this source tree. 490 */const Bfe=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],cp=lt("play",Bfe);/** 491 * @license lucide-react v0.525.0 - ISC 492 * 493 * This source code is licensed under the ISC license. 494 * See the LICENSE file in the root directory of this source tree. 495 */const qfe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ca=lt("plus",qfe);/** 496 * @license lucide-react v0.525.0 - ISC 497 * 498 * This source code is licensed under the ISC license. 499 * See the LICENSE file in the root directory of this source tree. 500 */const zfe=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]],Hfe=lt("receipt",zfe);/** 501 * @license lucide-react v0.525.0 - ISC 502 * 503 * This source code is licensed under the ISC license. 504 * See the LICENSE file in the root directory of this source tree. 505 */const Vfe=[["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"}]],bw=lt("refresh-cw",Vfe);/** 506 * @license lucide-react v0.525.0 - ISC 507 * 508 * This source code is licensed under the ISC license. 509 * See the LICENSE file in the root directory of this source tree. 510 */const Gfe=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Wfe=lt("rocket",Gfe);/** 511 * @license lucide-react v0.525.0 - ISC 512 * 513 * This source code is licensed under the ISC license. 514 * See the LICENSE file in the root directory of this source tree. 515 */const Yfe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Kfe=lt("rotate-ccw",Yfe);/** 516 * @license lucide-react v0.525.0 - ISC 517 * 518 * This source code is licensed under the ISC license. 519 * See the LICENSE file in the root directory of this source tree. 520 */const Jfe=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Eq=lt("rotate-cw",Jfe);/** 521 * @license lucide-react v0.525.0 - ISC 522 * 523 * This source code is licensed under the ISC license. 524 * See the LICENSE file in the root directory of this source tree. 525 */const Xfe=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Qfe=lt("route",Xfe);/** 526 * @license lucide-react v0.525.0 - ISC 527 * 528 * This source code is licensed under the ISC license. 529 * See the LICENSE file in the root directory of this source tree. 530 */const Zfe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_h=lt("search",Zfe);
530/** 531 * @license lucide-react v0.525.0 - ISC 532 * 533 * This source code is licensed under the ISC license. 534 * See the LICENSE file in the root directory of this source tree. 535 */const ehe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],the=lt("send",ehe);/** 536 * @license lucide-react v0.525.0 - ISC 537 * 538 * This source code is licensed under the ISC license. 539 * See the LICENSE file in the root directory of this source tree. 540 */const she=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],XC=lt("settings",she);/** 541 * @license lucide-react v0.525.0 - ISC 542 * 543 * This source code is licensed under the ISC license. 544 * See the LICENSE file in the root directory of this source tree. 545 */const rhe=[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]],nhe=lt("share",rhe);/** 546 * @license lucide-react v0.525.0 - ISC 547 * 548 * This source code is licensed under the ISC license. 549 * See the LICENSE file in the root directory of this source tree. 550 */const ahe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ohe=lt("shield-alert",ahe);/** 551 * @license lucide-react v0.525.0 - ISC 552 * 553 * This source code is licensed under the ISC license. 554 * See the LICENSE file in the root directory of this source tree. 555 */const ihe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]],lhe=lt("shield-ban",ihe);/** 556 * @license lucide-react v0.525.0 - ISC 557 * 558 * This source code is licensed under the ISC license. 559 * See the LICENSE file in the root directory of this source tree. 560 */const che=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Sx=lt("shield-check",che);/** 561 * @license lucide-react v0.525.0 - ISC 562 * 563 * This source code is licensed under the ISC license. 564 * See the LICENSE file in the root directory of this source tree. 565 */const dhe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Qu=lt("shield",dhe);/** 566 * @license lucide-react v0.525.0 - ISC 567 * 568 * This source code is licensed under the ISC license. 569 * See the LICENSE file in the root directory of this source tree. 570 */const uhe=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],phe=lt("sliders-horizontal",uhe);/** 571 * @license lucide-react v0.525.0 - ISC 572 * 573 * This source code is licensed under the ISC license. 574 * See the LICENSE file in the root directory of this source tree. 575 */const fhe=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],rr=lt("sparkles",fhe);/** 576 * @license lucide-react v0.525.0 - ISC 577 * 578 * This source code is licensed under the ISC license. 579 * See the LICENSE file in the root directory of this source tree. 580 */const hhe=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Zu=lt("star",hhe);/** 581 * @license lucide-react v0.525.0 - ISC 582 * 583 * This source code is licensed under the ISC license. 584 * See the LICENSE file in the root directory of this source tree. 585 */const mhe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ghe=lt("sun",mhe);/** 586 * @license lucide-react v0.525.0 - ISC 587 * 588 * This source code is licensed under the ISC license. 589 * See the LICENSE file in the root directory of this source tree. 590 */const xhe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],mo=lt("terminal",xhe);/** 591 * @license lucide-react v0.525.0 - ISC 592 * 593 * This source code is licensed under the ISC license. 594 * See the LICENSE file in the root directory of this source tree. 595 */const vhe=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],bhe=lt("test-tube",vhe);/** 596 * @license lucide-react v0.525.0 - ISC 597 * 598 * This source code is licensed under the ISC license. 599 * See the LICENSE file in the root directory of this source tree. 600 */const yhe=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
600],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],nl=lt("trash-2",yhe);/** 601 * @license lucide-react v0.525.0 - ISC 602 * 603 * This source code is licensed under the ISC license. 604 * See the LICENSE file in the root directory of this source tree. 605 */const _he=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],GT=lt("triangle-alert",_he);/** 606 * @license lucide-react v0.525.0 - ISC 607 * 608 * This source code is licensed under the ISC license. 609 * See the LICENSE file in the root directory of this source tree. 610 */const jhe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],RO=lt("upload",jhe);/** 611 * @license lucide-react v0.525.0 - ISC 612 * 613 * This source code is licensed under the ISC license. 614 * See the LICENSE file in the root directory of this source tree. 615 */const whe=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Nhe=lt("user-check",whe);/** 616 * @license lucide-react v0.525.0 - ISC 617 * 618 * This source code is licensed under the ISC license. 619 * See the LICENSE file in the root directory of this source tree. 620 */const khe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],WT=lt("user-plus",khe);/** 621 * @license lucide-react v0.525.0 - ISC 622 * 623 * This source code is licensed under the ISC license. 624 * See the LICENSE file in the root directory of this source tree. 625 */const She=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],Che=lt("user-x",She);/** 626 * @license lucide-react v0.525.0 - ISC 627 * 628 * This source code is licensed under the ISC license. 629 * See the LICENSE file in the root directory of this source tree. 630 */const Ehe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],AO=lt("user",Ehe);/** 631 * @license lucide-react v0.525.0 - ISC 632 * 633 * This source code is licensed under the ISC license. 634 * See the LICENSE file in the root directory of this source tree. 635 */const The=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],Tq=lt("users-round",The);/** 636 * @license lucide-react v0.525.0 - ISC 637 * 638 * This source code is licensed under the ISC license. 639 * See the LICENSE file in the root directory of this source tree. 640 */const Rhe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ln=lt("users",Rhe);/** 641 * @license lucide-react v0.525.0 - ISC 642 * 643 * This source code is licensed under the ISC license. 644 * See the LICENSE file in the root directory of this source tree. 645 */const Ahe=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Eu=lt("wand-sparkles",Ahe);/** 646 * @license lucide-react v0.525.0 - ISC 647 * 648 * This source code is licensed under the ISC license. 649 * See the LICENSE file in the root directory of this source tree. 650 */const Phe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}
650],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ir=lt("x",Phe);/** 651 * @license lucide-react v0.525.0 - ISC 652 * 653 * This source code is licensed under the ISC license. 654 * See the LICENSE file in the root directory of this source tree. 655 */const Ihe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Dr=lt("zap",Ihe);function Mhe({className:e=""}){const{theme:t,toggleTheme:s}=Sp();return r.jsx("button",{onClick:s,type:"button",className:`inline-flex items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-2 text-[var(--color-fg-default)] transition-colors hover:bg-[var(--color-bg-hover)] active:bg-[var(--color-bg-active)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-blue)] focus:ring-offset-2 focus:ring-offset-[var(--color-bg-default)] ${e}`,"aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,title:`Switch to ${t==="dark"?"light":"dark"} mode`,children:t==="dark"?r.jsx(ghe,{className:"h-4 w-4"}):r.jsx(Ife,{className:"h-4 w-4"})})}const Ohe=[{label:"How it works",href:"https://reqres.in/#how",external:!0},{label:"Use cases",href:"https://reqres.in/#use-cases",external:!0},{label:"Pricing",href:"https://reqres.in/#pricing",external:!0},{label:"Docs",href:"/documentation",dataAttributes:{"data-visitors-event":"Docs CTA","data-visitors-source":"app_top_nav"}}],Lhe=ip;function Dhe(){const e=Wr(),t=x.useMemo(()=>{const n=new URLSearchParams(e.search).get("next");return n&&n.startsWith("/")?n:"/dashboard"},[e.search]);return r.jsx(vq,{logo:r.jsxs("a",{href:"https://reqres.in",className:"flex items-center gap-2 sm:gap-2.5 group",children:[r.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 rounded-lg border border-indigo-500/20 bg-indigo-500/[0.08] flex items-center justify-center text-xs sm:text-sm font-bold text-indigo-400 dark:text-indigo-300/70 tracking-tight transition-all duration-300 group-hover:border-indigo-500/30 group-hover:bg-indigo-500/[0.12]",children:"R"}),r.jsxs("span",{className:"text-sm sm:text-[15px] font-medium text-[var(--color-fg-secondary)] tracking-tight",children:["Req",r.jsx("span",{className:"text-indigo-400 dark:text-indigo-300/60",children:"Res"})]})]}),navLinks:Ohe,actions:[r.jsx(Mhe,{},"theme-toggle"),r.jsx(vd,{children:r.jsx(jce,{afterSignOutUrl:"/",appearance:{elements:{avatarBox:"w-10 h-10 border-2 border-[var(--color-border-default)] shadow-lg",userButtonPopoverCard:"bg-[var(--color-bg-card)] backdrop-blur-xl border border-[var(--color-border-default)] shadow-2xl",userButtonPopoverActionButton:"hover:bg-[var(--color-bg-hover)] transition-colors",userButtonPopoverActionButtonText:"text-[var(--color-fg-default)] font-medium",userButtonPopoverFooter:"border-t border-[var(--color-border-default)]"}}})},"user-button"),r.jsx(Gi,{children:r.jsx(Lhe,{mode:"modal",afterSignInUrl:t,afterSignUpUrl:t,appearance:{elements:{modalContent:"bg-[var(--color-bg-card)] backdrop-blur-xl border border-[var(--color-border-default)] shadow-2xl",modalCloseButton:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",headerTitle:"text-[var(--color-fg-default)] font-semibold",headerSubtitle:"text-[var(--color-fg-muted)]",socialButtonsBlockButton:"bg-[var(--color-bg-card)] border border-[var(--color-border-default)] hover:bg-[var(--color-bg-hover)] transition-colors",socialButtonsBlockButtonText:"text-[var(--color-fg-default)] font-medium",formButtonPrimary:"bg-[var(--color-accent-blue)] hover:brightness-110 text-white font-semibold py-3 px-6 rounded-lg shadow-lg hover:shadow-xl transition-all duration-200",formFieldInput:"border border-[var(--color-border-default)] focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200",footerActionLink:"text-blue-600 hover:text-blue-700 font-medium"}},children:r.jsx(ht,{variant:"primary","data-visitors-event":"Signup CTA","data-visitors-source":"app_top_nav",children:"Get Started"})})},"sign-in-button")]})}const $s="https://reqres.in";class yt extends Error{constructor(t,s,n){super(t),this.status=s,this.data=n,this.name="ApiError"}}function $he(e){return e.startsWith("/templates")||e.startsWith("/templates/categories")}const Uhe=()=>{if(typeof window>"u")return"api_client";const e=window.location.pathname||"";return e.startsWith("/logs")?"logs":e.startsWith("/data-explorer")?"data_explorer":e.startsWith("/dashboard")?"dashboard":e.startsWith("/api-keys")?"api_keys":"api_client"},wg=(e,t,s)=>{if(typeof window>"u"||s!==429||!t||typeof t!="object"||t.error!=="rate_limit_exceeded")return;const n={limit:t.limit,remaining:t.remaining,reset_at:t.reset_at,upgrade_url:t.upgrade_url,recommended_plan:t.recommended_plan,why_this_happened:t.why_this_happened,message:t.message,tier:t.tier,endpoint:e,surface:Uhe()};window.dispatchEvent(new CustomEvent("reqres:limit-hit",{detail:n}))},Ng=(e,t,s)=>{if(typeof window>"u"||s!==402||!t||typeof t!="object"||t.error_code!=="TRIAL_EXPIRED")return;const n={error_code:t.error_code,message:t.message,upgrade_url:t.upgrade_url,trial:t.trial,endpoint:e};window.dispatchEvent(new CustomEvent("reqres:trial-expired",{detail:n}))},kg=({endpoint:e,method:t,status:s,message:n,data:a})=>{s<400||s>=500||s!==401&&s!==403&&s!==404&&s!==429&&Np(o=>{o.setTag("api_status",String(s)),o.setTag("api_method",t),o.setTag("api_endpoint",e),o.setExtra("api_message",n),a!==void 0&&o.setExtra("api_error",a),EQ(`API ${s} ${t} ${e}`,"warning")})};function Sg(e,t){const s={...e};return t&&typeof t=="object"&&!(t instanceof Headers)&&Object.entries(t).forEach(([n,a])=>
655{typeof a=="string"&&(s[n]=a)}),s}const ue={async get(e,t){const s=`${$s}${e}`;let n={"Content-Type":"application/json"};$he(e)?n.Accept="application/json":t!=null&&t.authToken&&(n.Authorization=`Bearer ${t.authToken}`,n["x-reqres-client"]="web_app"),t!=null&&t.env&&(n["X-Reqres-Env"]=t.env),n=Sg(n,t==null?void 0:t.headers);const a={...t,method:"GET",headers:n};delete a.authToken;try{const o=await fetch(s,a),i=await o.text();let l=null;if(i)try{l=JSON.parse(i)}catch{l=i}if(!o.ok){wg(e,l,o.status),Ng(e,l,o.status);let c=`HTTP error! status: ${o.status}`;throw typeof l=="object"&&l!==null?c=l.message||l.error||c:o.status===429?c="Rate limit exceeded. Please wait a moment and try again.":o.status===503?c="Service temporarily unavailable. Please try again in a few minutes.":o.status===500?c="Server error. Our team has been notified.":o.status===403&&(c="Access denied. Please check your API key or upgrade to Pro."),kg({endpoint:e,method:"GET",status:o.status,message:c,data:l}),new yt(c,o.status,l)}return{data:l,status:o.status}}catch(o){if(o instanceof yt)throw o;let i="Network error";throw o instanceof TypeError&&o.message.includes("fetch")?i="Connection failed. Please check your internet connection.":o instanceof Error&&(i=`Network error: ${o.message}`),new yt(i,0)}},async post(e,t,s){const n=`${$s}${e}`;let a={"Content-Type":"application/json"};s!=null&&s.authToken&&(a.Authorization=`Bearer ${s.authToken}`,a["x-reqres-client"]="web_app"),s!=null&&s.env&&(a["X-Reqres-Env"]=s.env),a=Sg(a,s==null?void 0:s.headers);const o={...s,method:"POST",headers:a,body:t?JSON.stringify(t):void 0};delete o.authToken;try{const i=await fetch(n,o),l=await i.text();let c=null;if(l)try{c=JSON.parse(l)}catch{c=l}if(!i.ok){wg(e,c,i.status),Ng(e,c,i.status);const u=typeof c=="object"&&c!==null&&(c.message||c.error)||`HTTP error! status: ${i.status}`;throw kg({endpoint:e,method:"POST",status:i.status,message:u,data:c}),new yt(u,i.status,c)}return{data:c,status:i.status}}catch(i){throw i instanceof yt?i:new yt(`Network error: ${i instanceof Error?i.message:"Unknown error"}`,0)}},async patch(e,t,s){const n=`${$s}${e}`;let a={"Content-Type":"application/json"};s!=null&&s.authToken&&(a.Authorization=`Bearer ${s.authToken}`,a["x-reqres-client"]="web_app"),s!=null&&s.env&&(a["X-Reqres-Env"]=s.env),a=Sg(a,s==null?void 0:s.headers);const o={...s,method:"PATCH",headers:a,body:t?JSON.stringify(t):void 0};delete o.authToken;try{const i=await fetch(n,o),l=await i.text();let c=null;if(l)try{c=JSON.parse(l)}catch{c=l}if(!i.ok){wg(e,c,i.status),Ng(e,c,i.status);const u=typeof c=="object"&&c!==null&&(c.message||c.error)||`HTTP error! status: ${i.status}`;throw kg({endpoint:e,method:"PATCH",status:i.status,message:u,data:c}),new yt(u,i.status,c)}return{data:c,status:i.status}}catch(i){throw i instanceof yt?i:new yt(`Network error: ${i instanceof Error?i.message:"Unknown error"}`,0)}},async put(e,t,s){const n=`${$s}${e}`;let a={"Content-Type":"application/json"};s!=null&&s.authToken&&(a.Authorization=`Bearer ${s.authToken}`,a["x-reqres-client"]="web_app"),s!=null&&s.env&&(a["X-Reqres-Env"]=s.env),a=Sg(a,s==null?void 0:s.headers);const o={...s,method:"PUT",headers:a,body:t?JSON.stringify(t):void 0};delete o.authToken;try{const i=await fetch(n,o),l=await i.text();let c=null;if(l)try{c=JSON.parse(l)}catch{c=l}if(!i.ok){wg(e,c,i.status),Ng(e,c,i.status);const u=typeof c=="object"&&c!==null&&(c.message||c.error)||`HTTP error! status: ${i.status}`;throw kg({endpoint:e,method:"PUT",status:i.status,message:u,data:c}),new yt(u,i.status,c)}return{data:c,status:i.status}}catch(i){throw i instanceof yt?i:new yt(`Network error: ${i instanceof Error?i.message:"Unknown error"}`,0)}},async delete(e,t){const s=`${$s}${e}`;let n={"Content-Type":"application/json"};t!=null&&t.authToken&&(n.Authorization=`Bearer ${t.authToken}`,n["x-reqres-client"]="web_app"),t!=null&&t.env&&(n["X-Reqres-Env"]=t.env),n=Sg(n,t==null?void 0:t.headers);const a={...t,method:"DELETE",headers:n};delete a.authToken;try{const o=await fetch(s,a),i=await o.text();let l;if(i)try{l=JSON.parse(i)}catch{l=i}if(!o.ok){wg(e,l,o.status),Ng(e,l,o.status);const c=typeof l=="object"&&l!==null&&(l.message||l.error)||`HTTP error! status: ${o.status}`;throw kg({endpoint:e,method:"DELETE",status:o.status,message:c,data:l}),new yt(c,o.status,l)}return{data:l,status:o.status}}catch(o){throw o instanceof yt?o:new yt(`Network error: ${o instanceof Error?o.message:"Unknown error"}`,0)}}},Rq={getEndpoints:e=>ue.get("/custom-endpoints",e),getEndpoint:(e,t)=>
655ue.get(`/custom-endpoints/${e}`,t),createEndpoint:(e,t)=>ue.post("/custom-endpoints",e,t),updateEndpoint:(e,t,s)=>ue.put(`/custom-endpoints/${e}`,t,s),deleteEndpoint:(e,t)=>ue.delete(`/custom-endpoints/${e}`,t)},Td={getPaymentStatus:e=>{const{organizationId:t,...s}=e||{},n=t?`/clerk/payment-status?organization_id=${encodeURIComponent(t)}`:"/clerk/payment-status";return ue.get(n,s)},createCheckoutSession:e=>{const{authToken:t,...s}=e;return ue.post("/clerk/checkout-session",s,{authToken:t})}},lv={getBillingStatus:(e,t)=>ue.get(`/api/org/${e}/billing`,t),createCheckoutSession:e=>{const{authToken:t,...s}=e;return ue.post("/api/checkout/team",s,{authToken:t})},createPortalSession:(e,t)=>{const{authToken:s,return_url:n}=t||{};return ue.post(`/api/org/${e}/billing/portal`,{return_url:n},{authToken:s})}},Cx={getProKey:e=>ue.get(`/get-pro-key?email=${encodeURIComponent(e)}`),createPortalSession:(e,t)=>ue.post("/create-portal-session",{},{authToken:t==null?void 0:t.authToken,headers:{"x-api-key":e}})},Fhe=Object.freeze(Object.defineProperty({__proto__:null,API_BASE_URL:$s,ApiError:yt,api:ue,customEndpointsApi:Rq,orgBillingApi:lv,paymentApi:Td,proApi:Cx},Symbol.toStringTag,{value:"Module"}));async function Ue(e,t={}){if(typeof e=="function")try{return await e(t)??void 0}catch(s){console.error("Failed to retrieve Clerk auth token:",s);return}}const Aq=x.forwardRef(({groups:e,collapsed:t=!1,onToggleCollapse:s,onClose:n,className:a,...o},i)=>{const l=Wr(),[c,u]=x.useState(()=>{if(typeof window>"u")return{};try{const g=localStorage.getItem("sideNavCollapsedGroups");return g?JSON.parse(g):{}}catch{return{}}}),f=g=>{var v;return(v=g.matchPrefixes)!=null&&v.some(y=>l.pathname.startsWith(y))?!0:l.pathname===g.href},h=(g,v)=>{u(y=>{const _={...y,[g]:v};return typeof window<"u"&&localStorage.setItem("sideNavCollapsedGroups",JSON.stringify(_)),_})};return r.jsx("div",{ref:i,className:Nr("flex h-full flex-col border-r border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",t?"w-16":"w-full sm:w-80 lg:w-[22rem]","rounded-2xl overflow-hidden",a),...o,children:r.jsx("nav",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:e.map((g,v)=>{const y=g.id||g.label||`group-${v}`,_=g.items.some(S=>!S.external&&f(S)),j=g.collapsible&&!t,w=y in c,k=j?w?c[y]:g.defaultCollapsed??!1:!1;return r.jsxs("div",{className:Nr("space-y-3",g.tone==="muted"&&"opacity-80"),children:[g.label&&!t&&(j?r.jsxs("button",{type:"button",onClick:()=>h(y,!k),className:"flex w-full items-center justify-between px-2 mb-2 text-foreground-muted hover:text-[var(--color-fg-default)] transition-colors",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide",children:g.label}),k?r.jsx(Hn,{className:"h-4 w-4"}):r.jsx(sr,{className:"h-4 w-4"})]}):r.jsx("div",{className:"flex items-center justify-between px-2 mb-2",children:r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-foreground-muted",children:g.label})})),!k&&r.jsxs("div",{className:"space-y-3",children:[g.items.map((S,E)=>{const T=S.variant==="child",A=S.variant==="parent",R=!S.external&&f(S),I=r.jsxs(r.Fragment,{children:[S.icon&&!T&&r.jsx("span",{className:Nr("flex-shrink-0",t&&"mx-auto"),children:S.icon}),!t&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:Nr("flex-1 min-w-0 truncate",A&&"text-sm font-semibold",S.completed&&"line-through text-[var(--color-fg-faint)]"),children:S.label}),S.badge&&r.jsx("span",{className:Nr("inline-flex flex-shrink-0 items-center rounded-full border border-dashed border-[#4F71F5] bg-[#4F71F5]/10 px-2 py-0.5 text-[11px] font-semibold text-[#4F71F5] transition-opacity",S.badgeMuted&&"opacity-55"),children:S.badge})]})]}),L=Nr("flex items-center gap-3 transition-all duration-150",T?"relative rounded-xl px-4 py-3 pl-8 text-xs font-medium text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] before:absolute before:left-4 before:top-1/2 before:h-1 before:w-1 before:-translate-y-1/2 before:rounded-full before:bg-[var(--color-accent-blue)]/60":"relative rounded-2xl px-5 py-4 text-sm font-medium hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] border border-transparent",A&&"text-sm font-semibold",R&&(T?"bg-[var(--color-bg-card)] text-[var(--color-fg-default)] border border-[var(--color-border-default)] before:bg-[var(--color-accent-blue)]":"text-[var(--color-fg-default)] shadow-[0_10px_40px_var(--color-shadow)] before:absolute before:left-0 before:top-0 before:h-full before:w-1.5 before:rounded-full before:bg-[var(--color-accent-blue)] before:shadow-[0_0_12px_3px_rgba(85,97,255,0.45)] bg-[var(--color-bg-card)] border border-[var(--color-border-default)]"),!
655R&&"text-[var(--color-fg-secondary)]",S.disabled&&"opacity-50 cursor-not-allowed hover:bg-transparent",t&&"justify-center px-3 py-3 rounded-xl");return S.external?r.jsx("a",{href:S.href,target:S.target||"_blank",rel:S.rel||"noreferrer noopener",title:S.tooltip,className:L,onClick:S.onClick,children:I},E):r.jsx(dt,{to:S.href,title:S.tooltip,className:L,onClick:S.onClick,children:I},E)}),g.note&&r.jsx("p",{className:"px-5 pt-1 text-[11px] leading-relaxed text-foreground-muted",children:g.note})]})]},y)})})})});Aq.displayName="SideNav";function yw({hasProject:e,collectionCount:t,totalDataItems:s,appUsers:n=[],projectLogs:a=[],logs:o=[]}){const i=(t??0)>0,l=n.length>0,c=n.some(g=>!!g.last_login_at),u=a.length>0||o.length>0,f=s!=null?s>0:void 0,h=t!=null?t>0:void 0;return{projectCreated:e,requestMade:u,hasCollection:i,hasAppUser:l,appUserLoggedIn:c,recordCreated:f,collectionDataFetched:h}}const Ha="/examples/notes-app",Ex="notes",cv="rr-onboarding-updated";function _w(){const{getToken:e,isLoaded:t}=zt(),[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,l]=x.useState(null),c=x.useCallback(async()=>{if(t){o(!0),l(null);try{const u=await Ue(e);if(!u){n(null);return}const{data:f}=await ue.get("/api/onboarding/status",{authToken:u});n({persona_goal:f.persona_goal??null,persona_role:f.persona_role??null,persona_urgency:f.persona_urgency??null,persona_stack:f.persona_stack??null})}catch(u){u instanceof yt||u instanceof Error?l(u.message):l("Unable to load onboarding persona.")}finally{o(!1)}}},[e,t]);return x.useEffect(()=>{c()},[c]),x.useEffect(()=>{if(typeof window>"u")return;const u=()=>{c()};return window.addEventListener(cv,u),()=>{window.removeEventListener(cv,u)}},[c]),{status:s,loading:a,error:i,refresh:c}}const YT="rr_getting_started_track_v1",QC="rr-persona-track-updated",Bhe=e=>e==="qa"||e==="frontend"||e==="educator";function KT(e,t){const s=(e==null?void 0:e.persona_role)??null,n=(e==null?void 0:e.persona_goal)??null;if(s==="qa"||n==="qa_testing")return"qa";if(s==="educator"||n==="education")return"educator";if(s==="frontend_dev"||n==="client_only_app"||n==="demo_mvp")return"frontend";if(!s&&!n&&t){if(t.hasCollections)return"frontend";if(t.requestCount&&t.requestCount>50&&!t.hasCollections)return"qa"}return"qa"}function K_(){if(typeof window>"u")return null;const e=window.localStorage.getItem(YT);return Bhe(e)?e:null}function ZC(e){typeof window>"u"||(window.localStorage.setItem(YT,e),window.dispatchEvent(new CustomEvent(QC)))}function Pq(e){if(typeof window>"u")return()=>{};const t=s=>{s.key===YT&&e()};return window.addEventListener("storage",t),window.addEventListener(QC,e),()=>{window.removeEventListener("storage",t),window.removeEventListener(QC,e)}}const qhe="modulepreload",zhe=function(e){return"/"+e},PO={},se=function(t,s,n){let a=Promise.resolve();if(s&&s.length>0){let i=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(s.map(u=>{if(u=zhe(u),u in PO)return;PO[u]=!0;const f=u.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":qhe,f||(g.as="script"),g.crossOrigin="",g.href=u,c&&g.setAttribute("nonce",c),document.head.appendChild(g),f)return new Promise((v,y)=>{g.addEventListener("load",v),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})};var qe=typeof window<"u"?window:void 0,Ua=typeof globalThis<"u"?globalThis:qe,Iq=Array.prototype,IO=Iq.forEach,MO=Iq.indexOf,lo=Ua==null?void 0:Ua.navigator,$t=Ua==null?void 0:Ua.document,La=Ua==null?void 0:Ua.location,eE=Ua==null?void 0:Ua.fetch,tE=Ua!=null&&Ua.XMLHttpRequest&&"withCredentials"in new Ua.XMLHttpRequest?Ua.XMLHttpRequest:void 0,OO=Ua==null?void 0:Ua.AbortController,Ma=lo==null?void 0:lo.userAgent,hs=qe??{},Gl={DEBUG:!1,LIB_VERSION:"1.259.0"},iS="$copy_autocapture",Hhe=["$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"],Yl=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Vhe=["fatal","error","warning","log","info","debug"];function Ps(e,t){return e.indexOf(t)!==-1}var jw=function(e){return e.trim()},sE=function(e){return e.replace(/^\$/,"")},Ghe=Array.isArray,Mq=Object.prototype,Oq=Mq.hasOwnProperty,ww=Mq.toString,kr=Ghe||function(e){return ww.call(e)==="[object Array]"},Fo=e=>typeof e=="function",zr=e=>e===Object(e)&&!kr(e),Vf=e=>{if(zr(e)){for(var t in e)if(Oq.call(e,t))return!1;return!0}return!1},At=e=>e===void 0,Hr=e=>ww.call(e)=="[object String]",rE=e=>Hr(e)&&e.trim().length===0,Ud=e=>e===null,Xs=e=>At(e)||Ud(e),ra=e=>ww.call(e)=="[object Number]",Yi=e=>
655ww.call(e)==="[object Boolean]",Whe=e=>e instanceof FormData,Yhe=e=>Ps(Hhe,e),Lq=e=>{var t={t:function(s){if(qe&&(Gl.DEBUG||hs.POSTHOG_DEBUG)&&!At(qe.console)&&qe.console){for(var n=("__rrweb_original__"in qe.console[s])?qe.console[s].__rrweb_original__:qe.console[s],a=arguments.length,o=new Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];n(e,...o)}},info:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];t.t("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];t.t("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];t.t("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];console.error(e,...n)},uninitializedWarning:s=>{t.error("You must initialize PostHog before calling "+s)},createLogger:s=>Lq(e+" "+s)};return t},Ut=Lq("[PostHog.js]"),In=Ut.createLogger,Khe=In("[ExternalScriptsLoader]"),LO=(e,t,s)=>{if(e.config.disable_external_dependency_loading)return Khe.warn(t+" was requested but loading of external scripts is disabled."),s("Loading of external scripts is disabled");var n=$t==null?void 0:$t.querySelectorAll("script");if(n){for(var a=0;a<n.length;a++)if(n[a].src===t)return s()}var o=()=>{if(!$t)return s("document not found");var i=$t.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=u=>s(void 0,u),i.onerror=u=>s(u),e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return s("prepare_external_dependency_script returned null");var l,c=$t.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(i,c[0]):$t.body.appendChild(i)};$t!=null&&$t.body?o():$t==null||$t.addEventListener("DOMContentLoaded",o)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)({}).hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},Ot.apply(null,arguments)}function Dq(e,t){if(e==null)return{};var s={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;s[n]=e[n]}return s}hs.__PosthogExtensions__=hs.__PosthogExtensions__||{},hs.__PosthogExtensions__.loadExternalDependency=(e,t,s)=>{var n="/static/"+t+".js?v="+e.version;if(t==="remote-config"&&(n="/array/"+e.config.token+"/config.js"),t==="toolbar"){var a=3e5;n=n+"&t="+Math.floor(Date.now()/a)*a}var o=e.requestRouter.endpointFor("assets",n);LO(e,o,s)},hs.__PosthogExtensions__.loadSiteApp=(e,t,s)=>{var n=e.requestRouter.endpointFor("api",t);LO(e,n,s)};var J_={};function jd(e,t,s){if(kr(e)){if(IO&&e.forEach===IO)e.forEach(t,s);else if("length"in e&&e.length===+e.length){for(var n=0,a=e.length;n<a;n++)if(n in e&&t.call(s,e[n],n)===J_)return}}}function ur(e,t,s){if(!Xs(e)){if(kr(e))return jd(e,t,s);if(Whe(e)){for(var n of e.entries())if(t.call(s,n[1],n[0])===J_)return}else for(var a in e)if(Oq.call(e,a)&&t.call(s,e[a],a)===J_)return}}var Kr=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];return jd(s,function(a){for(var o in a)a[o]!==void 0&&(e[o]=a[o])}),e},Nw=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];return jd(s,function(a){jd(a,function(o){e.push(o)})}),e};function f_(e){for(var t=Object.keys(e),s=t.length,n=new Array(s);s--;)n[s]=[t[s],e[t[s]]];return n}var DO=function(e){try{return e()}catch{return}},Jhe=function(e){return function(){try{for(var t=arguments.length,s=new Array(t),n=0;n<t;n++)s[n]=arguments[n];return e.apply(this,s)}catch(a){Ut.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ut.critical(a)}}},JT=function(e){var t={};return ur(e,function(s,n){(Hr(s)&&s.length>0||ra(s))&&(t[n]=s)}),t};function Xhe(e,t){return s=e,n=o=>Hr(o)&&!Ud(t)?o.slice(0,t):o,a=new Set,function o(i,l){return i!==Object(i)?n?n(i,l):i:a.has(i)?void 0:(a.add(i),kr(i)?(c=[],jd(i,u=>{c.push(o(u))})):(c={},ur(i,(u,f)=>{a.has(u)||(c[f]=o(u,f))})),c);var c}(s);var s,n,a}var Qhe=["herokuapp.com","vercel.app","netlify.app"];function Zhe(e){var t=e==null?void 0:e.hostname;if(!Hr(t))return!1;var s=t.split(".").slice(-2).join(".");for(var n of Qhe)if(s===n)return!1;return!0}function $q(e,t){for(var s=0;s<e.length;s++)if(t(e[s]))return e[s]}function Mr(e,t,s,n){var{capture:a=!1,passive:o=!0}=n??{};e==null||e.addEventListener(t,s,{capture:a,passive:o})}var Uq="$people_distinct_id",tx="__alias",sx="__timers",$O="$autocapture_disabled_server_side",nE="$heatmaps_enabled_server_side",UO="$exception_capture_enabled_server_side",aE="$error_tracking_suppression_rules",FO="$error_tracking_capture_extension_exceptions",BO="$web_vitals_enabled_server_side",Fq="$dead_clicks_enabled_server_side",qO="$web_vitals_allowed_metrics",oE="$session_recording_enabled_server_side",zO="$console_log_recording_enabled_server_side",HO="$session_recording_network_payload_capture",VO="$session_recording_masking",GO="$session_recording_canvas_recording",WO="$replay_sample_rate",YO="$replay_minimum_duration",KO="$replay_script_config",X_="$sesid",rx="$session_is_sampled",iE="$session_recording_url_trigger_activated_session",lE="$session_recording_event_trigger_activated_session",Gf="$enabled_feature_flags",nx="$early_access_features",cE="$feature_flag_details",ax="$stored_person_properties",Tu="$stored_group_properties",dE="$surveys",zy="$surveys_activated",Q_="$flag_call_reported",Bl="$user_state",uE="$client_session_props",pE="$capture_rate_limit",fE="$initial_campaign_params",hE="$initial_referrer_info",Z_="$initial_person_info",ej="$epp",Bq="__POSTHOG_TOOLBAR__",Hy="$posthog_cookieless",eme=[Uq,tx,"__cmpns",sx,oE,nE,X_,Gf,aE,Bl,nx,cE,Tu,ax,dE,Q_,uE,pE,fE,hE,ej,Z_];function JO(e){return e instanceof Element&&(e.id===Bq||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function kw(e){return!!e&&e.nodeType===1}function wd(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function qq(e){return!!e&&e.nodeType===3}function zq(e){return!!e&&e.nodeType===11}function XT(e){return e?jw(e).split(/\s+/):[]}function XO(e){var t=qe==null?void 0:qe.location.href;return!!(t&&e&&e.some(s=>t.match(s)))}function tj(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return XT(t)}function Hq(e){return Xs(e)?null:jw(e).split(/(\s+)/).filter(t=>jh(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Sw(e){var t="";return gE(e)&&!Wq(e)&&e.childNodes&&e.childNodes.length&&ur(e.childNodes,function(s){var n;qq(s)&&s.textContent&&(t+=(n=Hq(s.textContent))!==null&&n!==void 0?n:"")}),jw(t)}function Vq(e){return At(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var mE=["a","button","form","input","select","textarea","label"];function Gq(e){var t=e.parentNode;return!(!t||!kw(t))&&t}function tme(e,t,s,n,a){var o,i,l;if(s===void 0&&(s=void 0),!qe||!e||wd(e,"html")||!kw(e)||(o=s)!=null&&o.url_allowlist&&!XO(s.url_allowlist)||(i=s)!=null&&i.url_ignorelist&&XO(s.url_ignorelist))return!1;if((l=s)!=null&&l.dom_event_allowlist){var c=s.dom_event_allowlist;if(c&&!c.some(j=>t.type===j))return!1}for(var u=!1,f=[e],h=!0,g=e;g.parentNode&&!wd(g,"body");)if(zq(g.parentNode))f.push(g.parentNode.host),g=g.parentNode.host;else{if(!(h=Gq(g)))break;if(n||mE.indexOf(h.tagName.toLowerCase())>-1)u=!0;else{var v=qe.getComputedStyle(h);v&&v.getPropertyValue("cursor")==="pointer"&&(u=!0)}f.push(h),g=h}if(!function(j,w){var k=w==null?void 0:w.element_allowlist;if(At(k))return!0;var S,E=function(A){if(k.some(R=>A.tagName.toLowerCase()===R))return{v:!0}};for(var T of j)if(S=E(T))return S.v;return!1}(f,s)||!function(j,w){var k=w==null?void 0:w.css_selector_allowlist;if(At(k))return!0;var S,E=function(A){if(k.some(R=>A.matches(R)))return{v:!0}};for(var T of j)if(S=E(T))return S.v;return!1}(f,s))return!1;var y=qe.getComputedStyle(e);
655if(y&&y.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var _=e.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(a||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(a||["change","click"]).indexOf(t.type)>=0;default:return u?(a||["click"]).indexOf(t.type)>=0:(a||["click"]).indexOf(t.type)>=0&&(mE.indexOf(_)>-1||e.getAttribute("contenteditable")==="true")}}function gE(e){for(var t=e;t.parentNode&&!wd(t,"body");t=t.parentNode){var s=tj(t);if(Ps(s,"ph-sensitive")||Ps(s,"ph-no-capture"))return!1}if(Ps(tj(e),"ph-include"))return!0;var n=e.type||"";if(Hr(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!(Hr(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 Wq(e){return!!(wd(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||wd(e,"select")||wd(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Yq="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",sme=new RegExp("^(?:"+Yq+")$"),rme=new RegExp(Yq),Kq="\\d{3}-?\\d{2}-?\\d{4}",nme=new RegExp("^("+Kq+")$"),ame=new RegExp("("+Kq+")");function jh(e,t){return t===void 0&&(t=!0),!(Xs(e)||Hr(e)&&(e=jw(e),(t?sme:rme).test((e||"").replace(/[- ]/g,""))||(t?nme:ame).test(e)))}function Jq(e){var t=Sw(e);return jh(t=(t+" "+Xq(e)).trim())?t:""}function Xq(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ur(e.childNodes,function(s){var n;if(s&&((n=s.tagName)==null?void 0:n.toLowerCase())==="span")try{var a=Sw(s);t=(t+" "+a).trim(),s.childNodes&&s.childNodes.length&&(t=(t+" "+Xq(s)).trim())}catch(o){Ut.error("[AutoCapture]",o)}}),t}function ome(e){return function(t){var s=t.map(n=>{var a,o,i="";if(n.tag_name&&(i+=n.tag_name),n.attr_class)for(var l of(n.attr_class.sort(),n.attr_class))i+="."+l.replace(/"/g,"");var c=Ot({},n.text?{text:n.text}:{},{"nth-child":(a=n.nth_child)!==null&&a!==void 0?a:0,"nth-of-type":(o=n.nth_of_type)!==null&&o!==void 0?o:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),u={};return f_(c).sort((f,h)=>{var[g]=f,[v]=h;return g.localeCompare(v)}).forEach(f=>{var[h,g]=f;return u[QO(h.toString())]=QO(g.toString())}),i+=":",i+=f_(u).map(f=>{var[h,g]=f;return h+'="'+g+'"'}).join("")});return s.join(";")}(function(t){return t.map(s=>{var n,a,o={text:(n=s.$el_text)==null?void 0:n.slice(0,400),tag_name:s.tag_name,href:(a=s.attr__href)==null?void 0:a.slice(0,2048),attr_class:ime(s),attr_id:s.attr__id,nth_child:s.nth_child,nth_of_type:s.nth_of_type,attributes:{}};return f_(s).filter(i=>{var[l]=i;return l.indexOf("attr__")===0}).forEach(i=>{var[l,c]=i;return o.attributes[l]=c}),o})}(e))}function QO(e){return e.replace(/"|\\"/g,'\\"')}function ime(e){var t=e.attr__class;return t?kr(t)?t:XT(t):void 0}class Qq{constructor(){this.clicks=[]}isRageClick(t,s,n){var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(s-a.y)<30&&n-a.timestamp<1e3){if(this.clicks.push({x:t,y:s,timestamp:n}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:s,timestamp:n}];return!1}}var lme=["localhost","127.0.0.1"],wh=e=>{var t=$t==null?void 0:$t.createElement("a");return At(t)?null:(t.href=e,t)},cme=function(e,t){var s,n;t===void 0&&(t="&");var a=[];return ur(e,function(o,i){At(o)||At(i)||i==="undefined"||(s=encodeURIComponent((l=>l instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(i),a[a.length]=n+"="+s)}),a.join(t)},sj=function(e,t){for(var s,n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;a<n.length;a++){var o=n[a].split("=");if(o[0]===t){s=o;break}}if(!kr(s)||s.length<2)return"";var i=s[1];try{i=decodeURIComponent(i)}catch{Ut.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},QT=function(e,t,s){if(!e||!t||!t.length)return e;for(var n=e.split("#"),a=n[0]||"",o=n[1],i=a.split("?"),l=i[1],c=i[0],u=(l||"").split("&"),f=[],h=0;h<u.length;h++){var g=u[h].split("=");kr(g)&&(t.includes(g[0])?f.push(g[0]+"="+s):f.push(u[h]))}var v=c;return l!=null&&(v+="?"+f.join("&")),o!=null&&(v+="#"+o),v},rj=function(e,t){var s=e.match(new RegExp(t+"=([^&]*)"));return s?s[1]:null},ZO=In("[AutoCapture]");function lS(e,t){return t.length>e?t.slice(0,e)+"...":t}function dme(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!kw(t));return t}function ume(e,t,s,n){var a=e.tagName.toLowerCase(),o={tag_name:a};mE.indexOf(a)>-1&&!s&&(a.toLowerCase()==="a"||a.toLowerCase()==="button"?o.$el_text=lS(1024,Jq
655(e)):o.$el_text=lS(1024,Sw(e)));var i=tj(e);i.length>0&&(o.classes=i.filter(function(f){return f!==""})),ur(e.attributes,function(f){var h;if((!Wq(e)||["name","id","class","aria-label"].indexOf(f.name)!==-1)&&(n==null||!n.includes(f.name))&&!t&&jh(f.value)&&(h=f.name,!Hr(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var g=f.value;f.name==="class"&&(g=XT(g).join(" ")),o["attr__"+f.name]=lS(1024,g)}});for(var l=1,c=1,u=e;u=dme(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}function pme(e,t){for(var s,n,{e:a,maskAllElementAttributes:o,maskAllText:i,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],f=e;f.parentNode&&!wd(f,"body");)zq(f.parentNode)?(u.push(f.parentNode.host),f=f.parentNode.host):(u.push(f.parentNode),f=f.parentNode);var h,g=[],v={},y=!1,_=!1;if(ur(u,E=>{var T=gE(E);E.tagName.toLowerCase()==="a"&&(y=E.getAttribute("href"),y=T&&y&&jh(y)&&y),Ps(tj(E),"ph-no-capture")&&(_=!0),g.push(ume(E,o,i,l));var A=function(R){if(!gE(R))return{};var I={};return ur(R.attributes,function(L){if(L.name&&L.name.indexOf("data-ph-capture-attribute")===0){var M=L.name.replace("data-ph-capture-attribute-",""),O=L.value;M&&O&&jh(O)&&(I[M]=O)}}),I}(E);Kr(v,A)}),_)return{props:{},explicitNoCapture:_};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?g[0].$el_text=Jq(e):g[0].$el_text=Sw(e)),y){var j,w;g[0].attr__href=y;var k=(j=wh(y))==null?void 0:j.host,S=qe==null||(w=qe.location)==null?void 0:w.host;k&&S&&k!==S&&(h=y)}return{props:Kr({$event_type:a.type,$ce_version:1},c?{}:{$elements:g},{$elements_chain:ome(g)},(s=g[0])!=null&&s.$el_text?{$el_text:(n=g[0])==null?void 0:n.$el_text}:{},h&&a.type==="click"?{$external_click_url:h}:{},v)}}class fme{constructor(t){this.i=!1,this.o=null,this.rageclicks=new Qq,this.h=!1,this.instance=t,this.m=null}get S(){var t,s,n=zr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(a=>new RegExp(a)),n.url_ignorelist=(s=n.url_ignorelist)==null?void 0:s.map(a=>new RegExp(a)),n}$(){if(this.isBrowserSupported()){if(qe&&$t){var t=n=>{n=n||(qe==null?void 0:qe.event);try{this.k(n)}catch(a){ZO.error("Failed to capture event",a)}};if(Mr($t,"submit",t,{capture:!0}),Mr($t,"change",t,{capture:!0}),Mr($t,"click",t,{capture:!0}),this.S.capture_copied_text){var s=n=>{n=n||(qe==null?void 0:qe.event),this.k(n,iS)};Mr($t,"copy",s,{capture:!0}),Mr($t,"cut",s,{capture:!0})}}}else ZO.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.i&&(this.$(),this.i=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.h=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$O]:!!t.autocapture_opt_out}),this.o=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.m=t}getElementSelectors(t){var s,n=[];return(s=this.m)==null||s.forEach(a=>{var o=$t==null?void 0:$t.querySelectorAll(a);o==null||o.forEach(i=>{t===i&&n.push(a)})}),n}get isEnabled(){var t,s,n=(t=this.instance.persistence)==null?void 0:t.props[$O],a=this.o;if(Ud(a)&&!Yi(n)&&!this.instance.I())return!1;var o=(s=this.o)!==null&&s!==void 0?s:!!n;return!!this.instance.config.autocapture&&!o}k(t,s){if(s===void 0&&(s="$autocapture"),this.isEnabled){var n,a=Vq(t);qq(a)&&(a=a.parentNode||null),s==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.k(t,"$rageclick");var o=s===iS;if(a&&tme(a,t,this.S,o,o?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:l}=pme(a,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.S.element_attribute_ignorelist,elementsChainAsString:this.h});if(l)return!1;var c=this.getElementSelectors(a);if(c&&c.length>0&&(i.$element_selectors=c),s===iS){var u,f=Hq(qe==null||(u=qe.getSelection())==null?void 0:u.toString()),h=t.type||"clipboard";if(!f)return!1;i.$selected_content=f,i.$copy_type=h}return this.instance.capture(s,i),!0}}}isBrowserSupported(){return Fo($t==null?void 0:$t.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ra(e)&&isFinite(e)&&Math.floor(e)===e});var eL="0123456789abcdef";class nj{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,s,n,a){if(!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(n)||!Number.isInteger(a)||t<0||s<0||n<0||a<0||t>0xffffffffffff||s>4095||n>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|s>>>8,o[7]=s,o[8]=128|n>>>24,o[9]=n>
655>>16,o[10]=n>>>8,o[11]=n,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new nj(o)}toString(){for(var t="",s=0;s<this.bytes.length;s++)t=t+eL.charAt(this.bytes[s]>>>4)+eL.charAt(15&this.bytes[s]),s!==3&&s!==5&&s!==7&&s!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new nj(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var s=0;s<16;s++){var n=this.bytes[s]-t.bytes[s];if(n!==0)return Math.sign(n)}return 0}}class hme{constructor(){this.P=0,this.R=0,this.T=new mme}generate(){var t=this.generateOrAbort();if(At(t)){this.P=0;var s=this.generateOrAbort();if(At(s))throw new Error("Could not generate UUID after timestamp reset");return s}return t}generateOrAbort(){var t=Date.now();if(t>this.P)this.P=t,this.M();else{if(!(t+1e4>this.P))return;this.R++,this.R>4398046511103&&(this.P++,this.M())}return nj.fromFieldsV7(this.P,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.T.nextUint32())}M(){this.R=1024*this.T.nextUint32()+(1023&this.T.nextUint32())}}var tL,Zq=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};qe&&!At(qe.crypto)&&crypto.getRandomValues&&(Zq=e=>crypto.getRandomValues(e));class mme{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(Zq(this.C),this.F=0),this.C[this.F++]}}var dd=()=>gme().toString(),gme=()=>(tL||(tL=new hme)).generate(),Cg="",xme=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function vme(e,t){if(t){var s=function(a,o){if(o===void 0&&(o=$t),Cg)return Cg;if(!o||["localhost","127.0.0.1"].includes(a))return"";for(var i=a.split("."),l=Math.min(i.length,8),c="dmn_chk_"+dd();!Cg&&l--;){var u=i.slice(l).join("."),f=c+"=1;domain=."+u+";path=/";o.cookie=f+";max-age=3",o.cookie.includes(c)&&(o.cookie=f+";max-age=0",Cg=u)}return Cg}(e);if(!s){var n=(a=>{var o=a.match(xme);return o?o[0]:""})(e);n!==s&&Ut.info("Warning: cookie subdomain discovery mismatch",n,s),s=n}return s?"; domain=."+s:""}return""}var Qi={O:()=>!!$t,A:function(e){Ut.error("cookieStore error: "+e)},D:function(e){if($t){try{for(var t=e+"=",s=$t.cookie.split(";").filter(o=>o.length),n=0;n<s.length;n++){for(var a=s[n];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}},L:function(e){var t;try{t=JSON.parse(Qi.D(e))||{}}catch{}return t},j:function(e,t,s,n,a){if($t)try{var o="",i="",l=vme($t.location.hostname,n);if(s){var c=new Date;c.setTime(c.getTime()+24*s*60*60*1e3),o="; expires="+c.toUTCString()}a&&(i="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+i;return u.length>3686.4&&Ut.warn("cookieStore warning: large cookie, len="+u.length),$t.cookie=u,u}catch{return}},N:function(e,t){try{Qi.j(e,"",-1,t)}catch{return}}},cS=null,yn={O:function(){if(!Ud(cS))return cS;var e=!0;if(At(qe))e=!1;else try{var t="__mplssupport__";yn.j(t,"xyz"),yn.D(t)!=='"xyz"'&&(e=!1),yn.N(t)}catch{e=!1}return e||Ut.error("localStorage unsupported; falling back to cookie store"),cS=e,e},A:function(e){Ut.error("localStorage error: "+e)},D:function(e){try{return qe==null?void 0:qe.localStorage.getItem(e)}catch(t){yn.A(t)}return null},L:function(e){try{return JSON.parse(yn.D(e))||{}}catch{}return null},j:function(e,t){try{qe==null||qe.localStorage.setItem(e,JSON.stringify(t))}catch(s){yn.A(s)}},N:function(e){try{qe==null||qe.localStorage.removeItem(e)}catch(t){yn.A(t)}}},bme=["distinct_id",X_,rx,ej,Z_],Vy=Ot({},yn,{L:function(e){try{var t={};try{t=Qi.L(e)||{}}catch{}var s=Kr(t,JSON.parse(yn.D(e)||"{}"));return yn.j(e,s),s}catch{}return null},j:function(e,t,s,n,a,o){try{yn.j(e,t,void 0,void 0,o);var i={};bme.forEach(l=>{t[l]&&(i[l]=t[l])}),Object.keys(i).length&&Qi.j(e,i,s,n,a,o)}catch(l){yn.A(l)}},N:function(e,t){try{qe==null||qe.localStorage.removeItem(e),Qi.N(e,t)}catch(s){yn.A(s)}}}),Gy={},yme={O:function(){return!0},A:function(e){Ut.error("memoryStorage error: "+e)},D:function(e){return Gy[e]||null},L:function(e){return Gy[e]||null},j:function(e,t){Gy[e]=t},N:function(e){delete Gy[e]}},gu=null,zn={O:function(){if(!Ud(gu))return gu;if(gu=!0,At(qe))gu=!1;else try{var e="__support__";zn.j(e,"xyz"),zn.D(e)!=='"xyz"'&&(gu=!1),zn.N(e)}catch{gu=!1}return gu},A:function(e){Ut.error("sessionStorage error: ",e)},D:function(e){try{return qe==null?void 0:qe.sessionStorage.getItem(e)}catch(t){zn.A(t)}return null},L:function(e){try{return JSON.parse(zn.D(e))||null}catch{}return null},j:function(e,t){try{qe==null||qe.sessionStorage.setItem(e,JSON.stringify(t))}catch(s){zn.A(s)}},N:function(e){try{qe==null||qe.sessionStorage.removeItem(e)}catch(t){zn.A(t)}}}
655,bf=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class _me{constructor(t){this._instance=t}get S(){return this._instance.config}get consent(){return this.U()?bf.DENIED:this.q}isOptedOut(){return this.consent===bf.DENIED||this.consent===bf.PENDING&&this.S.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.B.j(this.H,t?1:0,this.S.cookie_expiration,this.S.cross_subdomain_cookie,this.S.secure_cookie)}reset(){this.B.N(this.H,this.S.cross_subdomain_cookie)}get H(){var{token:t,opt_out_capturing_cookie_prefix:s}=this._instance.config;return(s||"__ph_opt_in_out_")+t}get q(){var t=this.B.D(this.H);return t==="1"?bf.GRANTED:t==="0"?bf.DENIED:bf.PENDING}get B(){if(!this.W){var t=this.S.opt_out_capturing_persistence_type;this.W=t==="localStorage"?yn:Qi;var s=t==="localStorage"?Qi:yn;s.D(this.H)&&(this.W.D(this.H)||this.optInOut(s.D(this.H)==="1"),s.N(this.H,this.S.cross_subdomain_cookie))}return this.W}U(){return!!this.S.respect_dnt&&!!$q([lo==null?void 0:lo.doNotTrack,lo==null?void 0:lo.msDoNotTrack,hs.doNotTrack],t=>Ps([!0,1,"1","yes"],t))}}var Wy=In("[Dead Clicks]"),jme=()=>!0,wme=e=>{var t,s=!((t=e.instance.persistence)==null||!t.get_property(Fq)),n=e.instance.config.capture_dead_clicks;return Yi(n)?n:s};class ez{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(t,s,n){this.instance=t,this.isEnabled=s,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Fq]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.J(()=>{this.V()})}J(t){var s,n;(s=hs.__PosthogExtensions__)!=null&&s.initDeadClicksAutocapture&&t(),(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",a=>{a?Wy.error("failed to load script",a):t()})}V(){var t;if($t){if(!this.G&&(t=hs.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var s=zr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};s.__onCapture=this.onCapture,this.G=hs.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,s),this.G.start($t),Wy.info("starting...")}}else Wy.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,Wy.info("stopping..."))}}function co(e,t,s,n,a){return t>s&&(Ut.warn("min cannot be greater than max."),t=s),ra(e)?e>s?(n&&Ut.warn(n+" cannot be greater than max: "+s+". Using max value instead."),s):e<t?(n&&Ut.warn(n+" cannot be less than min: "+t+". Using min value instead."),t):e:(n&&Ut.warn(n+" must be a number. using max or fallback. max: "+s+", fallback: "+a),co(a||s,t,s,n))}class tz{constructor(t){this.K={},this.Y=()=>{Object.keys(this.K).forEach(s=>{var n=this.X(s)+this.Z;n>=this.tt?delete this.K[s]:this.it(s,n)})},this.X=s=>this.K[String(s)],this.it=(s,n)=>{this.K[String(s)]=n},this.consumeRateLimit=s=>{var n,a=(n=this.X(s))!==null&&n!==void 0?n:this.tt;if((a=Math.max(a-1,0))===0)return!0;this.it(s,a);var o,i=a===0;return i&&((o=this.et)==null||o.call(this,s)),i},this.rt=t,this.et=this.rt.et,this.tt=co(this.rt.bucketSize,0,100,"rate limiter bucket size"),this.Z=co(this.rt.refillRate,0,this.tt,"rate limiter refill rate"),this.st=co(this.rt.refillInterval,0,864e5,"rate limiter refill interval"),setInterval(()=>{this.Y()},this.st)}}var Yy=In("[ExceptionAutocapture]");class Nme{constructor(t){var s,n,a;this.nt=()=>{var o;if(qe&&this.isEnabled&&(o=hs.__PosthogExtensions__)!=null&&o.errorWrappingFunctions){var i=hs.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=hs.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=hs.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ot&&this.S.capture_unhandled_errors&&(this.ot=i(this.captureException.bind(this))),!this.lt&&this.S.capture_unhandled_rejections&&(this.lt=l(this.captureException.bind(this))),!this.ut&&this.S.capture_console_errors&&(this.ut=c(this.captureException.bind(this)))}catch(u){Yy.error("failed to start",u),this.ht()}}},this._instance=t,this.dt=!((s=this._instance.persistence)==null||!s.props[UO]),this.S=this.vt(),this.ct=new tz({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(a=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:10,refillInterval:1e4}),this.startIfEnabled()}vt(){var t=this._instance.config.capture_exceptions,s={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return zr(t)?s=Ot({},s,t):(At(t)?this.dt:t)&&(s=Ot({},s,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),s}get isEnabled(){return this.S.capture_console_errors||this.S.capture_unhandled_errors||this.S.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Yy.info("enabled"),this.J(this.nt))}J(t){var s,n;(s=hs.__PosthogExtensions__)!=null&&s.errorWrappingFunctions&&t(),(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",a=>{if(a)return Yy.error("failed to load script",a);t()})}ht(){var t,s,n;(t=this.ot)==null||t.call(this),this.ot=void 0,(s=this.lt)==null||s.call(this),this.lt=void 0,(n=this.ut)==null||n.call(this),this.ut=void 0}onRemoteConfig(t){var s=t.autocaptureExceptions;this.dt=!!s||!1,this.S=this.vt(),this._instance.persistence&&this._instance.persistence.register({[UO]:this.dt}),this.startIfEnabled()}captureException(t){var s,n=this._instance.requestRouter.endpointFor("ui");t.$exception_personURL=n+"/project/"+this._instance.config.token+"/pers
655on/"+this._instance.get_distinct_id();var a=(s=t.$exception_list[0].type)!==null&&s!==void 0?s:"Exception";this.ct.consumeRateLimit(a)?Yy.info("Skipping exception capture because of client rate limiting.",{exception:t.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(t)}}function sz(e){return!At(Event)&&rz(e,Event)}function rz(e,t){try{return e instanceof t}catch{return!1}}function nz(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return rz(e,Error)}}function h_(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function dS(e){return h_(e,"DOMError")}var sL=/\(error: (.*)\)/,rL=50,Wf="?";function uS(e,t,s,n){var a={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Wf:t,in_app:!0};return At(s)||(a.lineno=s),At(n)||(a.colno=n),a}var kme=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Sme=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Cme=/\((\S*)(?::(\d+))(?::(\d+))\)/,Eme=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Tme=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Rme=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];var n=t.sort((a,o)=>a[0]-o[0]).map(a=>a[1]);return function(a,o){o===void 0&&(o=0);for(var i=[],l=a.split(` 656`),c=o;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var f=sL.test(u)?u.replace(sL,"$1"):u;if(!f.match(/\S*Error: /)){for(var h of n){var g=h(f);if(g){i.push(g);break}}if(i.length>=rL)break}}}return function(v){if(!v.length)return[];var y=Array.from(v);return y.reverse(),y.slice(0,rL).map(_=>Ot({},_,{filename:_.filename||Ame(y).filename,function:_.function||Wf}))}(i)}}([30,e=>{var t=kme.exec(e);if(t){var[,s,n,a]=t;return uS(s,Wf,+n,+a)}var o=Sme.exec(e);if(o){if(o[2]&&o[2].indexOf("eval")===0){var i=Cme.exec(o[2]);i&&(o[2]=i[1],o[3]=i[2],o[4]=i[3])}var[l,c]=aL(o[1]||Wf,o[2]);return uS(c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,e=>{var t=Eme.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=Tme.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var n=t[3],a=t[1]||Wf;return[a,n]=aL(a,n),uS(n,a,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function Ame(e){return e[e.length-1]||{}}var Ky,nL,pS,aL=(e,t)=>{var s=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return s||n?[e.indexOf("@")!==-1?e.split("@")[0]:Wf,s?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Pme=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function ZT(e,t){t===void 0&&(t=0);var s=e.stacktrace||e.stack||"",n=function(i){return i&&Ime.test(i.message)?1:0}(e);try{var a=Rme,o=function(i,l){var c=function(u){var f=globalThis._posthogChunkIds;if(!f)return{};var h=Object.keys(f);return pS&&h.length===nL||(nL=h.length,pS=h.reduce((g,v)=>{Ky||(Ky={});var y=Ky[v];if(y)g[y[0]]=y[1];else for(var _=u(v),j=_.length-1;j>=0;j--){var w=_[j],k=w==null?void 0:w.filename,S=f[v];if(k&&S){g[k]=S,Ky[v]=[k,S];break}}return g},{})),pS}(l);return i.forEach(u=>{u.filename&&(u.chunk_id=c[u.filename])}),i}(a(s,n),a);return o.slice(0,o.length-t)}catch{}return[]}var Ime=/Minified React error #\d+;/i;function Mme(e,t){var s,n,a=ZT(e),o=(s=t==null?void 0:t.handled)===null||s===void 0||s,i=(n=t==null?void 0:t.synthetic)!==null&&n!==void 0&&n;return{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(l){var c=l.message;return c.error&&typeof c.error.message=="string"?String(c.error.message):String(c)}(e),stacktrace:{frames:a,type:"raw"},mechanism:{handled:o,synthetic:i}}}function az(e,t){var s=Mme(e,t);return e.cause&&nz(e.cause)&&e.cause!==e?[s,...az(e.cause,{handled:t==null?void 0:t.handled,synthetic:t==null?void 0:t.synthetic})]:[s]}function fS(e,t){return{$exception_list:az(e,t),$exception_level:"error"}}function hS(e,t){var s,n,a,o=(s=t==null?void 0:t.handled)===null||s===void 0||s,i=(n=t==null?void 0:t.synthetic)===null||n===void 0||n,l={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(a=t==null?void 0:t.defaultExceptionType)!==null&&a!==void 0?a:"Error",value:e||(t==null?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:i}};if(t!=null&&t.syntheticException){var c=ZT(t.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:"error"}}function Ome(e){return Hr(e)&&!rE(e)&&Vhe.indexOf(e)>=0}function Lme(e,t){var s,n,a=(s=t==null?void 0:t.handled)===null||s===void 0||s,o=(n=t==null?void 0:t.synthetic)===null||n===void 0||n,i=t!=null&&t.overrideExceptionType?t.overrideExceptionType:sz(e)?e.constructor.name:"Error",l="Non-Error 'exception' captured with keys: "+function(f,h){h===void 0&&(h=40);var g=Object.keys(f);if(g.sort(),!g.length)return"[object has no keys]";for(var v=g.length;v>0;v--){var y=g.slice(0,v).join(", ");
656if(!(y.length>h))return v===g.length||y.length<=h?y:y.slice(0,h)+"..."}return""}(e),c={type:i,value:l,mechanism:{handled:a,synthetic:o}};if(t!=null&&t.syntheticException){var u=ZT(t==null?void 0:t.syntheticException,1);u.length&&(c.stacktrace={frames:u,type:"raw"})}return{$exception_list:[c],$exception_level:Ome(e.level)?e.level:"error"}}function Dme(e,t){var{error:s,event:n}=e,a={$exception_list:[]},o=s||n;if(dS(o)||function(g){return h_(g,"DOMException")}(o)){var i=o;if(function(g){return"stack"in g}(o))a=fS(o,t);else{var l=i.name||(dS(i)?"DOMError":"DOMException"),c=i.message?l+": "+i.message:l;a=hS(c,Ot({},t,{overrideExceptionType:dS(i)?"DOMError":"DOMException",defaultExceptionMessage:c}))}return"code"in i&&(a.$exception_DOMException_code=""+i.code),a}if(function(g){return h_(g,"ErrorEvent")}(o)&&o.error)return fS(o.error,t);if(nz(o))return fS(o,t);if(function(g){return h_(g,"Object")}(o)||sz(o))return Lme(o,t);if(At(s)&&Hr(n)){var u="Error",f=n,h=n.match(Pme);return h&&(u=h[1],f=h[2]),hS(f,Ot({},t,{overrideExceptionType:u,defaultExceptionMessage:f}))}return hS(o,t)}function oL(e,t,s){try{if(!(t in e))return()=>{};var n=e[t],a=s(n);return Fo(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=a,()=>{e[t]=n}}catch{return()=>{}}}class $me{constructor(t){var s;this._instance=t,this.ft=(qe==null||(s=qe.location)==null?void 0:s.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ut.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._t&&this._t(),this._t=void 0,Ut.info("History API monitoring stopped")}monitorHistoryChanges(){var t,s;if(qe&&qe.history){var n=this;(t=qe.history.pushState)!=null&&t.__posthog_wrapped__||oL(qe.history,"pushState",a=>function(o,i,l){a.call(this,o,i,l),n.gt("pushState")}),(s=qe.history.replaceState)!=null&&s.__posthog_wrapped__||oL(qe.history,"replaceState",a=>function(o,i,l){a.call(this,o,i,l),n.gt("replaceState")}),this.bt()}}gt(t){try{var s,n=qe==null||(s=qe.location)==null?void 0:s.pathname;if(!n)return;n!==this.ft&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.ft=n}catch(a){Ut.error("Error capturing "+t+" pageview",a)}}bt(){if(!this._t){var t=()=>{this.gt("popstate")};Mr(qe,"popstate",t),this._t=()=>{qe&&qe.removeEventListener("popstate",t)}}}}function aj(e){var t,s;return((t=JSON.stringify(e,(s=[],function(n,a){if(zr(a)){for(;s.length>0&&s[s.length-1]!==this;)s.pop();return s.includes(a)?"[Circular]":(s.push(a),a)}return a})))==null?void 0:t.length)||0}function xE(e,t){if(t===void 0&&(t=66060288e-1),e.size>=t&&e.data.length>1){var s=Math.floor(e.data.length/2),n=e.data.slice(0,s),a=e.data.slice(s);return[xE({size:aj(n),data:n,sessionId:e.sessionId,windowId:e.windowId}),xE({size:aj(a),data:a,sessionId:e.sessionId,windowId:e.windowId})].flatMap(o=>o)}return[e]}var ql=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(ql||{}),oi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(oi||{}),vE="[SessionRecording]",bE="redacted",Jy={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Ume=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Fme=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Bme=["/s/","/e/","/i/"];function iL(e,t,s,n){if(Xs(e))return e;var a=(t==null?void 0:t["content-length"])||function(o){return new Blob([o]).size}(e);return Hr(a)&&(a=parseInt(a)),a>s?vE+" "+n+" body too large to record ("+a+" bytes)":e}function lL(e,t){if(Xs(e))return e;var s=e;return jh(s,!1)||(s=vE+" "+t+" body "+bE),ur(Fme,n=>{var a,o;(a=s)!=null&&a.length&&((o=s)==null?void 0:o.indexOf(n))!==-1&&(s=vE+" "+t+" body "+bE+" as might contain: "+n)}),s}var qme=(e,t)=>
656{var s,n,a,o={payloadSizeLimitBytes:Jy.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Jy.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Jy.payloadHostDenyList]},i=e.session_recording.recordHeaders!==!1&&t.recordHeaders,l=e.session_recording.recordBody!==!1&&t.recordBody,c=e.capture_performance!==!1&&t.recordPerformance,u=(s=o,a=Math.min(1e6,(n=s.payloadSizeLimitBytes)!==null&&n!==void 0?n:1e6),g=>(g!=null&&g.requestBody&&(g.requestBody=iL(g.requestBody,g.requestHeaders,a,"Request")),g!=null&&g.responseBody&&(g.responseBody=iL(g.responseBody,g.responseHeaders,a,"Response")),g)),f=g=>{return u(((_,j)=>{var w,k=wh(_.name),S=j.indexOf("http")===0?(w=wh(j))==null?void 0:w.pathname:j;S==="/"&&(S="");var E=k==null?void 0:k.pathname.replace(S||"","");if(!(k&&E&&Bme.some(T=>E.indexOf(T)===0)))return _})((y=(v=g).requestHeaders,Xs(y)||ur(Object.keys(y??{}),_=>{Ume.includes(_.toLowerCase())&&(y[_]=bE)}),v),e.api_host));var v,y},h=Fo(e.session_recording.maskNetworkRequestFn);return h&&Fo(e.session_recording.maskCapturedNetworkRequestFn)&&Ut.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=g=>{var v=e.session_recording.maskNetworkRequestFn({url:g.name});return Ot({},g,{name:v==null?void 0:v.url})}),o.maskRequestFn=Fo(e.session_recording.maskCapturedNetworkRequestFn)?g=>{var v,y=f(g);return y&&(v=e.session_recording.maskCapturedNetworkRequestFn==null?void 0:e.session_recording.maskCapturedNetworkRequestFn(y))!==null&&v!==void 0?v:void 0}:g=>function(v){if(!At(v))return v.requestBody=lL(v.requestBody,"Request"),v.responseBody=lL(v.responseBody,"Response"),v}(f(g)),Ot({},Jy,o,{recordHeaders:i,recordBody:l,recordPerformance:c,recordInitialRequests:c})};let zme=class{constructor(t,s){var n,a;s===void 0&&(s={}),this.yt={},this.wt=o=>{if(!this.yt[o]){var i,l;this.yt[o]=!0;var c=this.St(o);(i=(l=this.rt).onBlockedNode)==null||i.call(l,o,c)}},this.$t=o=>{var i=this.St(o);if((i==null?void 0:i.nodeName)!=="svg"&&i instanceof Element){var l=i.closest("svg");if(l)return[this._rrweb.mirror.getId(l),l]}return[o,i]},this.St=o=>this._rrweb.mirror.getNode(o),this.xt=o=>{var i,l,c,u,f,h,g,v;return((i=(l=o.removes)==null?void 0:l.length)!==null&&i!==void 0?i:0)+((c=(u=o.attributes)==null?void 0:u.length)!==null&&c!==void 0?c:0)+((f=(h=o.texts)==null?void 0:h.length)!==null&&f!==void 0?f:0)+((g=(v=o.adds)==null?void 0:v.length)!==null&&g!==void 0?g:0)},this.throttleMutations=o=>{if(o.type!==3||o.data.source!==0)return o;var i=o.data,l=this.xt(i);i.attributes&&(i.attributes=i.attributes.filter(u=>{var[f]=this.$t(u.id);return!this.ct.consumeRateLimit(f)&&u}));var c=this.xt(i);return c!==0||l===c?o:void 0},this._rrweb=t,this.rt=s,this.ct=new tz({bucketSize:(n=this.rt.bucketSize)!==null&&n!==void 0?n:100,refillRate:(a=this.rt.refillRate)!==null&&a!==void 0?a:10,refillInterval:1e3,et:this.wt})}};var Bo=Uint8Array,Fa=Uint16Array,Nh=Uint32Array,eR=new Bo([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]),tR=new Bo([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]),cL=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oz=function(e,t){for(var s=new Fa(31),n=0;n<31;++n)s[n]=t+=1<<e[n-1];var a=new Nh(s[30]);for(n=1;n<30;++n)for(var o=s[n];o<s[n+1];++o)a[o]=o-s[n]<<5|n;return[s,a]},iz=oz(eR,2),Hme=iz[0],yE=iz[1];Hme[28]=258,yE[258]=28;for(var dL=oz(tR,0)[1],lz=new Fa(32768),Sr=0;Sr<32768;++Sr){var xu=(43690&Sr)>>>1|(21845&Sr)<<1;xu=(61680&(xu=(52428&xu)>>>2|(13107&xu)<<2))>>>4|(3855&xu)<<4,lz[Sr]=((65280&xu)>>>8|(255&xu)<<8)>>>1}var Tx=function(e,t,s){for(var n=e.length,a=0,o=new Fa(t);a<n;++a)++o[e[a]-1];var i,l=new Fa(t);for(a=0;a<t;++a)l[a]=l[a-1]+o[a-1]<<1;for(i=new Fa(n),a=0;a<n;++a)i[a]=lz[l[e[a]-1]++]>>>15-e[a];return i},dp=new Bo(288);for(Sr=0;Sr<144;++Sr)dp[Sr]=8;for(Sr=144;Sr<256;++Sr)dp[Sr]=9;for(Sr=256;Sr<280;++Sr)dp[Sr]=7;for(Sr=280;Sr<288;++Sr)dp[Sr]=8;var oj=new Bo(32);for(Sr=0;Sr<32;++Sr)oj[Sr]=5;var Vme=Tx(dp,9),Gme=Tx(oj,5),cz=function(e){return(e/8>>0)+(7&e&&1)},dz=function(e,t,s){(s==null||s>e.length)&&(s=e.length);var n=new(e instanceof Fa?Fa:e instanceof Nh?Nh:Bo)(s-t);return n.set(e.subarray(t,s)),n},Rl=function(e,t,s){s<<=7&t;var n=t/8>>0;e[n]|=s,e[n+1]|=s>>>8},Eg=function(e,t,s){s<<=7&t;var n=t/8>>0;e[n]|=s,e[n+1]|=s>>>8,e[n+2]|=s>>>16},mS=function(e,t){for(var s=[],n=0;n<e.length;
656++n)e[n]&&s.push({s:n,f:e[n]});var a=s.length,o=s.slice();if(!a)return[new Bo(0),0];if(a==1){var i=new Bo(s[0].s+1);return i[s[0].s]=1,[i,1]}s.sort(function(T,A){return T.f-A.f}),s.push({s:-1,f:25001});var l=s[0],c=s[1],u=0,f=1,h=2;for(s[0]={s:-1,f:l.f+c.f,l,r:c};f!=a-1;)l=s[s[u].f<s[h].f?u++:h++],c=s[u!=f&&s[u].f<s[h].f?u++:h++],s[f++]={s:-1,f:l.f+c.f,l,r:c};var g=o[0].s;for(n=1;n<a;++n)o[n].s>g&&(g=o[n].s);var v=new Fa(g+1),y=_E(s[f-1],v,0);if(y>t){n=0;var _=0,j=y-t,w=1<<j;for(o.sort(function(T,A){return v[A.s]-v[T.s]||T.f-A.f});n<a;++n){var k=o[n].s;if(!(v[k]>t))break;_+=w-(1<<y-v[k]),v[k]=t}for(_>>>=j;_>0;){var S=o[n].s;v[S]<t?_-=1<<t-v[S]++-1:++n}for(;n>=0&&_;--n){var E=o[n].s;v[E]==t&&(--v[E],++_)}y=t}return[new Bo(v),y]},_E=function(e,t,s){return e.s==-1?Math.max(_E(e.l,t,s+1),_E(e.r,t,s+1)):t[e.s]=s},uL=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new Fa(++t),n=0,a=e[0],o=1,i=function(c){s[n++]=c},l=1;l<=t;++l)if(e[l]==a&&l!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(a),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(a);o=1,a=e[l]}return[s.subarray(0,n),t]},Tg=function(e,t){for(var s=0,n=0;n<t.length;++n)s+=e[n]*t[n];return s},jE=function(e,t,s){var n=s.length,a=cz(t+2);e[a]=255&n,e[a+1]=n>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;o<n;++o)e[a+o+4]=s[o];return 8*(a+4+n)},pL=function(e,t,s,n,a,o,i,l,c,u,f){Rl(t,f++,s),++a[256];for(var h=mS(a,15),g=h[0],v=h[1],y=mS(o,15),_=y[0],j=y[1],w=uL(g),k=w[0],S=w[1],E=uL(_),T=E[0],A=E[1],R=new Fa(19),I=0;I<k.length;++I)R[31&k[I]]++;for(I=0;I<T.length;++I)R[31&T[I]]++;for(var L=mS(R,7),M=L[0],O=L[1],z=19;z>4&&!M[cL[z-1]];--z);var X,W,K,q,J=u+5<<3,F=Tg(a,dp)+Tg(o,oj)+i,V=Tg(a,g)+Tg(o,_)+i+14+3*z+Tg(R,M)+(2*R[16]+3*R[17]+7*R[18]);if(J<=F&&J<=V)return jE(t,f,e.subarray(c,c+u));if(Rl(t,f,1+(V<F)),f+=2,V<F){X=Tx(g,v),W=g,K=Tx(_,j),q=_;var $=Tx(M,O);for(Rl(t,f,S-257),Rl(t,f+5,A-1),Rl(t,f+10,z-4),f+=14,I=0;I<z;++I)Rl(t,f+3*I,M[cL[I]]);f+=3*z;for(var B=[k,T],ae=0;ae<2;++ae){var H=B[ae];for(I=0;I<H.length;++I){var U=31&H[I];Rl(t,f,$[U]),f+=M[U],U>15&&(Rl(t,f,H[I]>>>5&127),f+=H[I]>>>12)}}}else X=Vme,W=dp,K=Gme,q=oj;for(I=0;I<l;++I)if(n[I]>255){U=n[I]>>>18&31,Eg(t,f,X[U+257]),f+=W[U+257],U>7&&(Rl(t,f,n[I]>>>23&31),f+=eR[U]);var oe=31&n[I];Eg(t,f,K[oe]),f+=q[oe],oe>3&&(Eg(t,f,n[I]>>>5&8191),f+=tR[oe])}else Eg(t,f,X[n[I]]),f+=W[n[I]];return Eg(t,f,X[256]),f+W[256]},Wme=new Nh([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yme=function(){for(var e=new Nh(256),t=0;t<256;++t){for(var s=t,n=9;--n;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e}(),Kme=function(){var e=4294967295;return{p:function(t){for(var s=e,n=0;n<t.length;++n)s=Yme[255&s^t[n]]^s>>>8;e=s},d:function(){return 4294967295^e}}},Jme=function(e,t,s,n,a){return function(o,i,l,c,u,f){var h=o.length,g=new Bo(c+h+5*(1+Math.floor(h/7e3))+u),v=g.subarray(c,g.length-u),y=0;if(!i||h<8)for(var _=0;_<=h;_+=65535){var j=_+65535;j<h?y=jE(v,y,o.subarray(_,j)):(v[_]=f,y=jE(v,y,o.subarray(_,h)))}else{for(var w=Wme[i-1],k=w>>>13,S=8191&w,E=(1<<l)-1,T=new Fa(32768),A=new Fa(E+1),R=Math.ceil(l/3),I=2*R,L=function(Oe){return(o[Oe]^o[Oe+1]<<R^o[Oe+2]<<I)&E},M=new Nh(25e3),O=new Fa(288),z=new Fa(32),X=0,W=0,K=(_=0,0),q=0,J=0;_<h;++_){var F=L(_),V=32767&_,$=A[F];if(T[V]=$,A[F]=V,q<=_){var B=h-_;if((X>7e3||K>24576)&&B>423){y=pL(o,v,0,M,O,z,W,K,J,_-J,y),K=X=W=0,J=_;for(var ae=0;ae<286;++ae)O[ae]=0;for(ae=0;ae<30;++ae)z[ae]=0}var H=2,U=0,oe=S,fe=V-$&32767;if(B>2&&F==L(_-fe))for(var Q=Math.min(k,B)-1,le=Math.min(32767,_),Se=Math.min(258,B);fe<=le&&--oe&&V!=$;){if(o[_+H]==o[_+H-fe]){for(var we=0;we<Se&&o[_+we]==o[_+we-fe];++we);if(we>H){if(H=we,U=fe,we>Q)break;var Le=Math.min(fe,we-2),xe=0;for(ae=0;ae<Le;++ae){var de=_-fe+ae+32768&32767,Me=de-T[de]+32768&32767;Me>xe&&(xe=Me,$=de)}}}fe+=(V=$)-($=T[V])+32768&32767}if(U){M[K++]=268435456|yE[H]<<18|dL[U];var je=31&yE[H],Ae=31&dL[U];W+=eR[je]+tR[Ae],++O[257+je],++z[Ae],q=_+H,++X}else M[K++]=o[_],++O[o[_]]}}y=pL(o,v,f,M,O,z,W,K,J,_-J,y)}return dz(g,0,c+cz(y)+u)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,s,n,!0)},wE=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8},Xme=function(e,t){var s=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&wE(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),s){e[3]=8;for(var n=0;n<=s.length;++n)e[n+10]=s.charCodeAt(n)}},Qme=function(e){return 10+(e.filename&&e.filename.length+1||0)};function uz(e,t){t===void 0&&(t={});var s=Kme(),n=e.length;s.p(e);var a=Jme(e,t,Qme(t),8),o=a.length;return Xme(a,t),wE(a,o-8,s.d()),wE(a,o-4,n),a}function pz(e,t){var s=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var n=new Bo(e.length+(e.length>>>1)),a=0,o=function(u){n[a++]=u},i=0;i<s;++i){if(a+5>n.length){var l=new Bo(a+8+(s-i<<1));l.set(n),n=l}var c=e.charCodeAt(i);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return dz(n,0,a)}function Zme(e,t){return function(s){for(var n=0,a=0;a<s.length;a++)n=(n<<5)-n+s.charCodeAt(a),n|=0;return Math.abs(n)}(e)%100<co(100*t,0,100)}var Rd="disabled",sR="sampled",ij="active",up="buffering",rR="paused",nR="trigger",Zi=nR+"_activated",da=nR+"_pending",al=nR+"_"+Rd;function fL(e,t){return t.some(s=>s.matching==="regex"&&new RegExp(s.url).test(e))}class fz{constructor(t){this.kt=t}triggerStatus(t){var s=this.kt.map(n=>n.triggerStatus(t));return s.includes(Zi)?Zi:s.includes(da)?da:al}stop(){this.kt.forEach(t=>t.stop())}}class hz{constructor(t){this.kt=t}triggerStatus(t){var s=new Set;for(var n of this.kt)s.add(n.triggerStatus(t));switch(s.delete(al),s.size){case 0:return al;case 1:return Array.from(s)[0];default:return da}}stop(){this.kt.forEach(t=>t.stop())}}class ege{triggerStatus(){return da}stop(){}}class tge{constructor(t){this.Et=[],this.It=[],this.urlBlocked=!1,this._instance=t}onRemoteConfig(t){var s,n;this.Et=((s=t.sessionRecording)==null?void 0:s.urlTriggers)||[],this.It=((n=t.sessionRecording)==null?void 0:n.urlBlocklist)||[]}Pt(t){var s;return this.Et.length===0?al:((s=this._instance)==null?void 0:s.get_property(iE))===t?Zi:da}triggerStatus(t){var s=this.Pt(t),n=s===Zi?Zi:s===da?da:al;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:n}),n}checkUrlTriggerConditions(t,s,n){if(qe!==void 0&&qe.location.href){var a=qe.location.href,o=this.urlBlocked,i=fL(a,this.It);o&&i||(i&&!o?t():!i&&o&&s(),fL(a,this.Et)&&n("url"))}}stop(){}}class sge{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Rt=()=>{},this._instance=t}triggerStatus(){var t=da;return Xs(this.linkedFlag)&&(t=al),this.linkedFlagSeen&&(t=Zi),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onRemoteConfig(t,s){var n;if(this.linkedFlag=((n=t.sessionRecording)==null?void 0:n.linkedFlag)||null,!Xs(this.linkedFlag)&&!this.linkedFlagSeen){var a=Hr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,o=Hr(this.linkedFlag)?null:this.linkedFlag.variant;this.Rt=this._instance.onFeatureFlags((i,l)=>{var c=!1;if(zr(l)&&a in l){var u=l[a];c=Yi(u)?u===!0:o?u===o:!!u}this.linkedFlagSeen=c,c&&s(a,o)})}}stop(){this.Rt()}}class rge{constructor(t){this.Tt=[],this._instance=t}onRemoteConfig(t){var s;this.Tt=((s=t.sessionRecording)==null?void 0:s.eventTriggers)||[]}Mt(t){var s;return this.Tt.length===0?al:((s=this._instance)==null?void 0:s.get_property(lE))===t?Zi:da}triggerStatus(t){var s=this.Mt(t),n=s===Zi?Zi:s===da?da:al;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:n}),n}stop(){}}function nge(e){return e.isRecordingEnabled?up:Rd}function age(e){if(!e.receivedFlags)return up;if(!e.isRecordingEnabled)return Rd;if(e.urlTriggerMatching.urlBlocked)return rR;var t=e.isSampled===!0,s=new fz([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?sR:s===Zi?ij:s===da?up:e.isSampled===!1?Rd:ij}function oge(e){if(!e.receivedFlags)return up;if(!e.isRecordingEnabled)return Rd;if(e.urlTriggerMatching.urlBlocked)return rR;var t=new hz([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),s=t!==al,n=Yi(e.isSampled);return s&&t===da?up:s&&t===al||n&&!e.isSampled?Rd:e.isSampled===!0?sR:ij}var ox="[SessionRecording]",Xn=In(ox);function Xy(){var e;return hs==null||(e=hs.__PosthogExtensions__)==null||(e=e.rrweb)==null?void 0:e.record}var ige=3e5,lge=[oi.MouseMove,oi.MouseInteraction,oi.Scroll,oi.ViewportResize,oi.Input,oi.TouchMove,oi.MediaInteraction,oi.Drag],hL=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function vu(e){return function(t,s){for(var n="",a=0;a<t.length;){var o=t[a++];n+=String.fromCharCode(o)}return n}(uz(pz(JSON.stringify(e))))}function mL(e){return e.type===ql.Custom&&e.data.tag==="sessionIdle"}class cge{get sessionId(){return this.Ct}get Ft(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Ot}get At(){if(!this._instance.sessionManager)throw new Error(ox+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Dt(){var t,s;return this.Lt.triggerStatus(this.sessionId)===da?6e4:(t=(s=this._instance.config.session_recording)==null?void 0:s.full_snapshot_interval_millis)!==null&&t!==void 0?t:ige}get jt(){var t=this._instance.get_property(rx);return Yi(t)?t:null}get Nt(){var t,s,n=(t=this.C)==null?void 0:t.data[((s=this.C)==null?void 0:s.data.length)-1],{sessionStartTimestamp:a}=this.At.checkAndGetSessionAndWindowId(!0);return n?n.timestamp-a:null}get zt(){var t=!!this._instance.get_property(oE),s=!this._instance.config.disable_session_recording;return qe&&t&&s}get Ut(){var t=!!this._instance.get_property(zO),s=this._instance.config.enable_recording_console_log;return s??t}get qt(){var t,s,n,a,o,i,l=this._instance.config.session_recording.captureCanvas,c=this._instance.get_property(GO),u=(t=(s=l==null?void 0:l.recordCanvas)!==null&&s!==void 0?s:c==null?void 0:c.enabled)!==null&&t!==void 0&&t,f=(n=(a=l==null?void 0:l.canvasFps)!==null&&a!==void 0?a:c==null?void 0:c.fps)!==null&&n!==void 0?n:4,h=(o=(i=l
656==null?void 0:l.canvasQuality)!==null&&i!==void 0?i:c==null?void 0:c.quality)!==null&&o!==void 0?o:.4;if(typeof h=="string"){var g=parseFloat(h);h=isNaN(g)?.4:g}return{enabled:u,fps:co(f,0,12,"canvas recording fps",4),quality:co(h,0,1,"canvas recording quality",.4)}}get Bt(){var t,s,n=this._instance.get_property(HO),a={recordHeaders:(t=this._instance.config.session_recording)==null?void 0:t.recordHeaders,recordBody:(s=this._instance.config.session_recording)==null?void 0:s.recordBody},o=(a==null?void 0:a.recordHeaders)||(n==null?void 0:n.recordHeaders),i=(a==null?void 0:a.recordBody)||(n==null?void 0:n.recordBody),l=zr(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,c=!!(Yi(l)?l:n!=null&&n.capturePerformance);return o||i||c?{recordHeaders:o,recordBody:i,recordPerformance:c}:void 0}get Ht(){var t,s,n,a,o,i,l=this._instance.get_property(VO),c={maskAllInputs:(t=this._instance.config.session_recording)==null?void 0:t.maskAllInputs,maskTextSelector:(s=this._instance.config.session_recording)==null?void 0:s.maskTextSelector,blockSelector:(n=this._instance.config.session_recording)==null?void 0:n.blockSelector},u=(a=c==null?void 0:c.maskAllInputs)!==null&&a!==void 0?a:l==null?void 0:l.maskAllInputs,f=(o=c==null?void 0:c.maskTextSelector)!==null&&o!==void 0?o:l==null?void 0:l.maskTextSelector,h=(i=c==null?void 0:c.blockSelector)!==null&&i!==void 0?i:l==null?void 0:l.blockSelector;return At(u)&&At(f)&&At(h)?void 0:{maskAllInputs:u==null||u,maskTextSelector:f,blockSelector:h}}get Wt(){var t=this._instance.get_property(WO);return ra(t)?t:null}get Gt(){var t=this._instance.get_property(YO);return ra(t)?t:null}get status(){return this.Jt?this.Vt({receivedFlags:this.Jt,isRecordingEnabled:this.zt,isSampled:this.jt,urlTriggerMatching:this.Kt,eventTriggerMatching:this.Yt,linkedFlagMatching:this.Xt,sessionId:this.sessionId}):up}constructor(t){if(this.Vt=nge,this.Jt=!1,this.Qt=[],this.Zt="unknown",this.ti=Date.now(),this.Lt=new ege,this.ii=void 0,this.ei=void 0,this.ri=void 0,this.si=void 0,this.ni=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.oi=()=>{this.ai()},this.li=()=>{this.ui("browser offline",{})},this.hi=()=>{this.ui("browser online",{})},this.di=()=>{if($t!=null&&$t.visibilityState){var a="window "+$t.visibilityState;this.ui(a,{})}},this._instance=t,this.Ot=!1,this.vi="/s/",this.ci=void 0,this.Jt=!1,!this._instance.sessionManager)throw Xn.error("started without valid sessionManager"),new Error(ox+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(ox+" cannot be used with __preview_experimental_cookieless_mode.");this.Xt=new sge(this._instance),this.Kt=new tge(this._instance),this.Yt=new rge(this._instance);var{sessionId:s,windowId:n}=this.At.checkAndGetSessionAndWindowId();this.Ct=s,this.fi=n,this.C=this.pi(),this.Ft>=this.At.sessionTimeoutMs&&Xn.warn("session_idle_threshold_ms ("+this.Ft+") is greater than the session timeout ("+this.At.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(t){this.zt?(this.gi(t),Mr(qe,"beforeunload",this.oi),Mr(qe,"offline",this.li),Mr(qe,"online",this.hi),Mr(qe,"visibilitychange",this.di),this.mi(),this.bi(),Xs(this.ii)&&(this.ii=this._instance.on("eventCaptured",s=>{try{if(s.event==="$pageview"){var n=s!=null&&s.properties.$current_url?this.yi(s==null?void 0:s.properties.$current_url):"";if(!n)return;this.ui("$pageview",{href:n})}}catch(a){Xn.error("Could not add $pageview to rrweb session",a)}})),this.ei||(this.ei=this.At.onSessionId((s,n,a)=>{var o,i;a&&(this.ui("$session_id_change",{sessionId:s,windowId:n,changeReason:a}),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(lE),(i=this._instance)==null||(i=i.persistence)==null||i.unregister(iE))}))):this.stopRecording()}stopRecording(){var t,s,n,a;this.Ot&&this.ci&&(this.ci(),this.ci=void 0,this.Ot=!1,qe==null||qe.removeEventListener("beforeunload",this.oi),qe==null||qe.removeEventListener("offline",this.li),qe==null||qe.removeEventListener("online",this.hi),qe==null||qe.removeEventListener("visibilitychange",this.di),this.pi(),clearInterval(this.wi),(t=this.ii)==null||t.call(this),this.ii=void 0,(s=this.ni)==null||s.call(this),this.ni=void 0,(n=this.ei)==null||n.call(this),this.ei=void 0,(a=this.si)==null||a.call(this),this.si=void 0,this.Yt.stop(),this.Kt.stop(),this.Xt.stop(),Xn.info("stopped"))}Si(){var t;(t=this._instance.persistence)==null||t.unregister(rx)}$i(t){var s,n=this.Ct!==t,a=this.Wt;if(ra(a)){var o=this.jt,i=n||!Yi(o),l=i?Zme(t,a):o;
656i&&(l?this.xi(sR):Xn.warn("Sample rate ("+a+") has determined that this sessionId ("+t+") will not be sent to the server."),this.ui("samplingDecisionMade",{sampleRate:a,isSampled:l})),(s=this._instance.persistence)==null||s.register({[rx]:l})}else this.Si()}onRemoteConfig(t){var s,n,a,o;this.ui("$remote_config_received",t),this.ki(t),(s=t.sessionRecording)!=null&&s.endpoint&&(this.vi=(o=t.sessionRecording)==null?void 0:o.endpoint),this.mi(),((n=t.sessionRecording)==null?void 0:n.triggerMatchType)==="any"?(this.Vt=age,this.Lt=new fz([this.Yt,this.Kt])):(this.Vt=oge,this.Lt=new hz([this.Yt,this.Kt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(a=t.sessionRecording)==null?void 0:a.triggerMatchType}),this.Kt.onRemoteConfig(t),this.Yt.onRemoteConfig(t),this.Xt.onRemoteConfig(t,(i,l)=>{this.xi("linked_flag_matched",{flag:i,variant:l})}),this.Jt=!0,this.startIfEnabledOrStop()}mi(){ra(this.Wt)&&Xs(this.si)&&(this.si=this.At.onSessionId(t=>{this.$i(t)}))}ki(t){if(this._instance.persistence){var s,n=this._instance.persistence,a=()=>{var o,i,l,c,u,f,h,g,v,y=(o=t.sessionRecording)==null?void 0:o.sampleRate,_=Xs(y)?null:parseFloat(y);Xs(_)&&this.Si();var j=(i=t.sessionRecording)==null?void 0:i.minimumDurationMilliseconds;n.register({[oE]:!!t.sessionRecording,[zO]:(l=t.sessionRecording)==null?void 0:l.consoleLogRecordingEnabled,[HO]:Ot({capturePerformance:t.capturePerformance},(c=t.sessionRecording)==null?void 0:c.networkPayloadCapture),[VO]:(u=t.sessionRecording)==null?void 0:u.masking,[GO]:{enabled:(f=t.sessionRecording)==null?void 0:f.recordCanvas,fps:(h=t.sessionRecording)==null?void 0:h.canvasFps,quality:(g=t.sessionRecording)==null?void 0:g.canvasQuality},[WO]:_,[YO]:At(j)?null:j,[KO]:(v=t.sessionRecording)==null?void 0:v.scriptConfig})};a(),(s=this.ri)==null||s.call(this),this.ri=this.At.onSessionId(a)}}log(t,s){var n;s===void 0&&(s="log"),(n=this._instance.sessionRecording)==null||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:s,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}gi(t){if(!At(Object.assign)&&!At(Array.from)&&!(this.Ot||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var s;this.Ot=!0,this.At.checkAndGetSessionAndWindowId(),Xy()?this.Ei():(s=hs.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ii,n=>{if(n)return Xn.error("could not load recorder",n);this.Ei()}),Xn.info("starting"),this.status===ij&&this.xi(t||"recording_initialized")}}get Ii(){var t;return((t=this._instance)==null||(t=t.persistence)==null||(t=t.get_property(KO))==null?void 0:t.script)||"recorder"}Pi(t){var s;return t.type===3&&lge.indexOf((s=t.data)==null?void 0:s.source)!==-1}Ri(t){var s=this.Pi(t);s||this.Zt||t.timestamp-this.ti>this.Ft&&(this.Zt=!0,clearInterval(this.wi),this.ui("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ti,threshold:this.Ft,bufferLength:this.C.data.length,bufferSize:this.C.size}),this.ai());var n=!1;if(s&&(this.ti=t.timestamp,this.Zt)){var a=this.Zt==="unknown";this.Zt=!1,a||(this.ui("sessionNoLongerIdle",{reason:"user activity",type:t.type}),n=!0)}if(!this.Zt){var{windowId:o,sessionId:i}=this.At.checkAndGetSessionAndWindowId(!s,t.timestamp),l=this.Ct!==i,c=this.fi!==o;this.fi=o,this.Ct=i,l||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this.Ti()}}Mi(t){try{return t.rrwebMethod(),!0}catch(s){return this.Qt.length<10?this.Qt.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):Xn.warn("could not emit queued rrweb event.",s,t),!1}}ui(t,s){return this.Mi(hL(()=>Xy().addCustomEvent(t,s)))}Ci(){return this.Mi(hL(()=>Xy().takeFullSnapshot()))}Ei(){var t,s,n,a,o={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this._instance.config.session_recording;for(var[l,c]of Object.entries(i||{}))l in o&&(l==="maskInputOptions"?o.maskInputOptions=Ot({password:!0},c):o[l]=c);this.qt&&this.qt.enabled&&(o.recordCanvas=!0,o.sampling={canvas:this.qt.fps},o.dataURLOptions={type:"image/webp",quality:this.qt.quality}),this.Ht&&(o.maskAllInputs=(s=this.Ht.maskAllInputs)===null||s===void 0||s,o.maskTextSelector=(n=this.Ht.maskTextSelector)!==null&&n!==void 0?n:void 0,o.blockSelector=(a=this.Ht.blockSelector)!==null&&a!==void 0?a:void 0);var u=Xy();if(u){this.Fi=(t=this.Fi)!==null&&t!==void 0?t:new zme(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(h,g)=>
656{var v="Too many mutations on node '"+h+"'. Rate limiting. This could be due to SVG animations or something similar";Xn.info(v,{node:g}),this.log(ox+" "+v,"warn")}});var f=this.Oi();this.ci=u(Ot({emit:h=>{this.onRRwebEmit(h)},plugins:f},o)),this.ti=Date.now(),this.Zt=Yi(this.Zt)?this.Zt:"unknown",this.ui("$session_options",{sessionRecordingOptions:o,activePlugins:f.map(h=>h==null?void 0:h.name)}),this.ui("$posthog_config",{config:this._instance.config})}else Xn.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ti(){if(this.wi&&clearInterval(this.wi),this.Zt!==!0){var t=this.Dt;t&&(this.wi=setInterval(()=>{this.Ci()},t))}}Oi(){var t,s,n=[],a=(t=hs.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordConsolePlugin;a&&this.Ut&&n.push(a());var o=(s=hs.__PosthogExtensions__)==null||(s=s.rrwebPlugins)==null?void 0:s.getRecordNetworkPlugin;return this.Bt&&Fo(o)&&(!lme.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(o(qme(this._instance.config,this.Bt))):Xn.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(t){var s;if(this.Ai(),t&&zr(t)){if(t.type===ql.Meta){var n=this.yi(t.data.href);if(this.Di=n,!n)return;t.data.href=n}else this.Li();if(this.Kt.checkUrlTriggerConditions(()=>this.ji(),()=>this.Ni(),g=>this.zi(g)),!this.Kt.urlBlocked||(a=t).type===ql.Custom&&a.data.tag==="recording paused"){var a;t.type===ql.FullSnapshot&&this.Ti(),t.type===ql.FullSnapshot&&this.Jt&&this.Lt.triggerStatus(this.sessionId)===da&&this.pi();var o=this.Fi?this.Fi.throttleMutations(t):t;if(o){var i=function(g){var v=g;if(v&&zr(v)&&v.type===6&&zr(v.data)&&v.data.plugin==="rrweb/console@1"){v.data.payload.payload.length>10&&(v.data.payload.payload=v.data.payload.payload.slice(0,10),v.data.payload.payload.push("...[truncated]"));for(var y=[],_=0;_<v.data.payload.payload.length;_++)v.data.payload.payload[_]&&v.data.payload.payload[_].length>2e3?y.push(v.data.payload.payload[_].slice(0,2e3)+"...[truncated]"):y.push(v.data.payload.payload[_]);return v.data.payload.payload=y,g}return g}(o);if(this.Ri(i),this.Zt!==!0||mL(i)){if(mL(i)){var l=i.data.payload;if(l){var c=l.lastActivityTimestamp,u=l.threshold;i.timestamp=c+u}}var f=(s=this._instance.config.session_recording.compress_events)===null||s===void 0||s?function(g){if(aj(g)<1024)return g;try{if(g.type===ql.FullSnapshot)return Ot({},g,{data:vu(g.data),cv:"2024-10"});if(g.type===ql.IncrementalSnapshot&&g.data.source===oi.Mutation)return Ot({},g,{cv:"2024-10",data:Ot({},g.data,{texts:vu(g.data.texts),attributes:vu(g.data.attributes),removes:vu(g.data.removes),adds:vu(g.data.adds)})});if(g.type===ql.IncrementalSnapshot&&g.data.source===oi.StyleSheetRule)return Ot({},g,{cv:"2024-10",data:Ot({},g.data,{adds:g.data.adds?vu(g.data.adds):void 0,removes:g.data.removes?vu(g.data.removes):void 0})})}catch(v){Xn.error("could not compress event - will use uncompressed event",v)}return g}(i):i,h={$snapshot_bytes:aj(f),$snapshot_data:f,$session_id:this.Ct,$window_id:this.fi};this.status!==Rd?this.Ui(h):this.pi()}}}}}Li(){if(!this._instance.config.capture_pageview&&qe){var t=this.yi(qe.location.href);this.Di!==t&&(this.ui("$url_changed",{href:t}),this.Di=t)}}Ai(){if(this.Qt.length){var t=[...this.Qt];this.Qt=[],t.forEach(s=>{Date.now()-s.enqueuedAt<=2e3&&this.Mi(s)})}}yi(t){var s=this._instance.config.session_recording;if(s.maskNetworkRequestFn){var n,a={url:t};return(n=a=s.maskNetworkRequestFn(a))==null?void 0:n.url}return t}pi(){return this.C={size:0,data:[],sessionId:this.Ct,windowId:this.fi},this.C}ai(){this.qi&&(clearTimeout(this.qi),this.qi=void 0);var t=this.Gt,s=this.Nt,n=ra(s)&&s>=0,a=ra(t)&&n&&s<t;return this.status===up||this.status===rR||this.status===Rd||a?(this.qi=setTimeout(()=>{this.ai()},2e3),this.C):(this.C.data.length>0&&xE(this.C).forEach(o=>{this.Bi({$snapshot_bytes:o.size,$snapshot_data:o.data,$session_id:o.sessionId,$window_id:o.windowId,$lib:"web",$lib_version:Gl.LIB_VERSION})}),this.pi())}Ui(t){var s,n=2+(((s=this.C)==null?void 0:s.data.length)||0);!this.Zt&&(this.C.size+t.$snapshot_bytes+n>943718.4||this.C.sessionId!==this.Ct)&&(this.C=this.ai()),this.C.size+=t.$snapshot_bytes,this.C.data.push(t.$snapshot_data),this.qi||this.Zt||(this.qi=setTimeout(()=>{this.ai()},2e3))}Bi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.vi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(t){var s;this.Lt.triggerStatus(this.sessionId)===da&&((s=this._instance)==null||(s=s.persistence)==null||s.register({[t==="url"?iE:lE]:this.Ct}),this.ai(),this.xi(t+"_trigger_matched"))}ji(){this.Kt.urlBlocked||(this.Kt.urlBlocked=!0,clearInterval(this.wi),Xn.info("recording paused due to URL blocker"),this.ui("recording paused",{reason:"url blocker"}))}Ni(){this.Kt.urlBlocked&&(this.Kt.urlBlocked=!1,this.Ci(),this.Ti(),this.ui("recording resumed",{reason:"left blocked url"}),Xn.info("recording resumed"))}bi(){this.Yt.Tt.length!==0&&Xs(this.ni)&&(this.ni=this._instance.on("eventCaptured",t=>{try{this.Yt.Tt.includes(t.event)&&this.zi("event")}catch(s){Xn.error("Could not activate event trigger",s)}}))}overrideLinkedFlag(){this.Xt.linkedFlagSeen=!0,this.Ci(),this.xi("linked_flag_overridden")}overrideSampling(){var t;(t=this._instance.persistence)==null||t.register({[rx]:!0}),this.Ci(),this.xi("sampling_overridden")}overrideTrigger(t){this.zi(t)}xi(t,s){this._instance.register_for_session({$session_recording_start_reason:t}),Xn.info(t.replace("_"," "),s),Ps(["recording_initialized","session_id_changed"],t)||this.ui(t,s)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.At.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.C.data.length,$sdk_debug_replay_internal_buffer_size:this.C.size,$sdk_debug_current_session_duration:this.Nt,$sdk_debug_session_start:t}}}var gS=In("[SegmentIntegration]");function dge(e,t){var s=e.config.segment;if(!s)return t();(function(n,a){var o=n.config.segment;if(!o)return a();var i=c=>{var u=()=>c.anonymousId()||dd();n.config.get_device_id=u,c.id()&&(n.register({distinct_id:c.id(),$device_id:u()}),n.persistence.set_property(Bl,"identified")),a()},l=o.user();"then"in l&&Fo(l.then)?l.then(c=>i(c)):i(l)})(e,()=>{s.register((n=>{Promise&&Promise.resolve||gS.warn("This browser does not have Promise support, and can not use the segment integration");var a=(o,i)=>{if(!i)return o;o.event.userId||o.event.anonymousId===n.get_distinct_id()||(gS.info("No userId set, resetting PostHog"),n.reset()),o.event.userId&&o.event.userId!==n.get_distinct_id()&&(gS.info("UserId set, identifying with PostHog"),n.identify(o.event.userId)
656);var l=n.calculateEventProperties(i,o.event.properties);return o.event.properties=Object.assign({},l,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>a(o,o.event.event),page:o=>a(o,"$pageview"),identify:o=>a(o,"$identify"),screen:o=>a(o,"$screen")}})(e)).then(()=>{t()})})}var mz="posthog-js";function gz(e,t){var{organization:s,projectId:n,prefix:a,severityAllowList:o=["error"]}=t===void 0?{}:t;return i=>{var l,c,u,f,h;if(!(o==="*"||o.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var g=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());i.tags["PostHog Person URL"]=g,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var v=((l=i.exception)==null?void 0:l.values)||[],y=v.map(j=>Ot({},j,{stacktrace:j.stacktrace?Ot({},j.stacktrace,{type:"raw",frames:(j.stacktrace.frames||[]).map(w=>Ot({},w,{platform:"web:javascript"}))}):void 0})),_={$exception_message:((c=v[0])==null?void 0:c.value)||i.message,$exception_type:(u=v[0])==null?void 0:u.type,$exception_personURL:g,$exception_level:i.level,$exception_list:y,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((f=v[0])==null?void 0:f.value)||i.message,$sentry_exception_type:(h=v[0])==null?void 0:h.type,$sentry_tags:i.tags};return s&&n&&(_.$sentry_url=(a||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(_),i}}class uge{constructor(t,s,n,a,o){this.name=mz,this.setupOnce=function(i){i(gz(t,{organization:s,projectId:n,prefix:a,severityAllowList:o}))}}}var pge=qe!=null&&qe.location?rj(qe.location.hash,"__posthog")||rj(location.hash,"state"):null,gL="_postHogToolbarParams",xL=In("[Toolbar]"),Jc=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Jc||{});class fge{constructor(t){this.instance=t}Hi(t){hs.ph_toolbar_state=t}Wi(){var t;return(t=hs.ph_toolbar_state)!==null&&t!==void 0?t:Jc.UNINITIALIZED}maybeLoadToolbar(t,s,n){if(t===void 0&&(t=void 0),s===void 0&&(s=void 0),n===void 0&&(n=void 0),!qe||!$t)return!1;t=t??qe.location,n=n??qe.history;try{if(!s){try{qe.localStorage.setItem("test","test"),qe.localStorage.removeItem("test")}catch{return!1}s=qe==null?void 0:qe.localStorage}var a,o=pge||rj(t.hash,"__posthog")||rj(t.hash,"state"),i=o?DO(()=>JSON.parse(atob(decodeURIComponent(o))))||DO(()=>JSON.parse(decodeURIComponent(o))):null;return i&&i.action==="ph_authorize"?((a=i).source="url",a&&Object.keys(a).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((a=JSON.parse(s.getItem(gL)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}Gi(t){var s=hs.ph_load_toolbar||hs.ph_load_editor;!Xs(s)&&Fo(s)?s(t,this.instance):xL.warn("No toolbar load function found")}loadToolbar(t){var s=!($t==null||!$t.getElementById(Bq));if(!qe||s)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,a=Ot({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(qe.localStorage.setItem(gL,JSON.stringify(Ot({},a,{source:void 0}))),this.Wi()===Jc.LOADED)this.Gi(a);else if(this.Wi()===Jc.UNINITIALIZED){var o;this.Hi(Jc.LOADING),(o=hs.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",i=>{if(i)return xL.error("[Toolbar] Failed to load",i),void this.Hi(Jc.UNINITIALIZED);this.Hi(Jc.LOADED),this.Gi(a)}),Mr(qe,"turbolinks:load",()=>{this.Hi(Jc.UNINITIALIZED),this.loadToolbar(a)})}return!0}Ji(t){return this.loadToolbar(t)}maybeLoadEditor(t,s,n){return t===void 0&&(t=void 0),s===void 0&&(s=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,s,n)}}var hge=In("[TracingHeaders]");class mge{constructor(t){this.Vi=void 0,this.Ki=void 0,this.nt=()=>{var s,n;At(this.Vi)&&((s=hs.__PosthogExtensions__)==null||(s=s.tracingHeadersPatchFns)==null||s._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),At(this.Ki)&&((n=hs.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}J(t){var s,n;(s=hs.__PosthogExtensions__)!=null&&s.tracingHeadersPatchFns&&t(),(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",a=>{if(a)return hge.error("failed to load script",a);t()})}startIfEnabledOrStop(){var t,s;this._instance.config.__add_tracing_headers?this.J(this.nt):((t=this.Vi)==null||t.call(this),(s=this.Ki)==null||s.call(this),this.Vi=void 0,this.Ki=void 0)}}var qc=In("[Web Vitals]"),vL=9e5;class gge{constructor(t){var s;this.Yi=!1,this.i=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Xi=()=>{clearTimeout(this.Qi),this.C.metrics.length!==0&&(this._instance.capture("$web_vitals",this.C.metrics.reduce((n,a)=>Ot({},n,{["$web_vitals_"+a.name+"_event"]:Ot({},a),["$web_vitals_"+a.name+"_value"]:a.value}),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Zi=n=>{var a,o=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0);if(At(o))qc.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.te();At(i)||(Xs(n==null?void 0:n.name)||Xs(n==null?void 0:n.value)?qc.error("Invalid metric received",n):this.ie&&n.value>=this.ie?qc.error("Ignoring metric with value >= "+this.ie,n):(this.C.url!==i&&(this.Xi(),this.Qi=setTimeout(this.Xi,this.flushToCaptureTimeoutMs)),At(this.C.url)&&(this.C.url=i),this.C.firstMetricTimestamp=At(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(Ot({},n,{$current_url:i,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Xi()))}},this.nt=()=>{var n,a,o,i,l=hs.__PosthogExtensions__;At(l)||At(l.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:a,onFCP:o,onINP:i}=l.postHogWebVitalsCallbacks),n&&a&&o&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Zi.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(this.Zi.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.Zi.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.Zi.bind(this)),this.i=!0):qc.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Yi=!((s=this._instance.persistence)==null||!s.props[BO]),this.startIfEnabled()}get allowedMetrics(){var t,s,n=zr(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return At(n)?((s=this._instance.persistence)==null?void 0:s.props[qO])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(zr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get ie(){var t=zr(this._instance.config.capture_performance)&&ra(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:vL;return 0<t&&t<=6e4?vL:t}get isEnabled(){var t=La==null?void 0:La.protocol;if(t!=="http:"&&t!=="https:")return qc.info("Web Vitals are disabled on non-http/https protocols"),!1;var s=zr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Yi(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Yi(s)?s:this.Yi}startIfEnabled(){this.isEnabled&&!this.i&&(qc.info("enabled, starting..."),this.J(this.nt))}onRemoteConfig(t){var s=zr(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=zr(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[BO]:s}),this._instance.persistence.register({[qO]:n})),this.Yi=s,this.startIfEnabled()}J(t){var s,n;(s=hs.__PosthogExtensions__)!=null&&s.postHogWebVitalsCallbacks&&t(),(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",a=>{a?qc.error("failed to load script",a):t()})}te(){var t=qe?qe.location.href:void 0;return t||qc.error("Could not determine current URL"),t}}var xge=In("[Heatmaps]");function bL(e){return zr(e)&&"clientX"in e&&"clientY"in e&&ra(e.clientX)&&ra(e.clientY)}class vge{constructor(t){var s;this.rageclicks=new Qq,this.Yi=!1,this.i=!1,this.ee=null,this.instance=t,this.Yi=!((s=this.instance.persistence)==null||!s.props[nE])}get flushIntervalMilliseconds(){var t=5e3;return zr(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return At(this.instance.config.capture_heatmaps)?At(this.instance.config.enable_heatmaps)?this.Yi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.i)return;xge.info("starting..."),this.re(),this.ee=setInterval(this.se.bind(this),this.flushIntervalMilliseconds)}else{var t,s;clearInterval((t=this.ee)!==null&&t!==void 0?t:void 0),(s=this.ne)==null||s.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var s=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[nE]:s}),this.Yi=s,this.startIfEnabled()}getAndClearBuffer(){var t=this.C;return this.C=void 0,t}oe(t){this.ae(t.originalEvent,"deadclick")}re(){qe&&$t&&(Mr(qe,"beforeunload",this.se.bind(this)),Mr($t,"click",t=>this.ae(t||(qe==null?void 0:qe.event)),{capture:!0}),Mr($t,"mousemove",t=>this.le(t||(qe==null?void 0:qe.event)),{capture:!0}),this.ne=new ez(this.instance,jme,this.oe.bind(this)),this.ne.startIfEnabled(),this.i=!0)}ue(t,s){var n=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),i=function(l,c,u){for(var f=l;f&&kw(f)&&!wd(f,"body");){if(f===u)return!1;if(Ps(c,qe==null?void 0:qe.getComputedStyle(f).position))return!0;f=Gq(f)}return!1}(Vq(t),["fixed","sticky"],o);return{x:t.clientX+(i?0:a),y:t.clientY+(i?0:n),target_fixed:i,type:s}}ae(t,s){var n;if(s===void 0&&(s="click"),!JO(t.target)&&bL(t)){var a=this.ue(t,s);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.he(Ot({},a,{type:"rageclick"})),this.he(a)}}le(t){!JO(t.target)&&bL(t)&&(clearTimeout(this.de),this.de=setTimeout(()=>{this.he(this.ue(t,"mousemove"))},500))}he(t){if(qe){var s=qe.location.href;this.C=this.C||{},this.C[s]||(this.C[s]=[]),this.C[s].push(t)}}se(){this.C&&!Vf(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class bge{constructor(t){this._instance=t}doPageView(t,s){var n,a=this.ve(t,s);return this.ce={pathname:(n=qe==null?void 0:qe.location.pathname)!==null&&n!==void 0?n:"",pageViewId:s,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var s;return this.ve(t,(s=this.ce)==null?void 0:s.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ce)==null?void 0:t.pageViewId}}ve(t,s){var n=this.ce;if(!n)return{$pageview_id:s};var a={$pageview_id:s,$prev_pageview_id:n.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:i,lastScrollY:l,maxScrollY:c,maxContentHeight:u,last
656ContentY:f,maxContentY:h}=o;if(!(At(i)||At(l)||At(c)||At(u)||At(f)||At(h))){i=Math.ceil(i),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h);var g=i<=1?1:co(l/i,0,1),v=i<=1?1:co(c/i,0,1),y=u<=1?1:co(f/u,0,1),_=u<=1?1:co(h/u,0,1);a=Kr(a,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:g,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:f,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(a.$prev_pageview_pathname=n.pathname),n.timestamp&&(a.$prev_pageview_duration=(t.getTime()-n.timestamp.getTime())/1e3),a}}var yge=function(e){var t,s,n,a,o="";for(t=s=0,n=(e=(e+"").replace(/\r\n/g,` 657`).replace(/\r/g,` 658`)).length,a=0;a<n;a++){var i=e.charCodeAt(a),l=null;i<128?s++:l=i>127&&i<2048?String.fromCharCode(i>>6|192,63&i|128):String.fromCharCode(i>>12|224,i>>6&63|128,63&i|128),Ud(l)||(s>t&&(o+=e.substring(t,s)),o+=l,t=s=a+1)}return s>t&&(o+=e.substring(t,e.length)),o},_ge=!!tE||!!eE,yL="text/plain",lj=(e,t)=>{var[s,n]=e.split("?"),a=Ot({},t);n==null||n.split("&").forEach(i=>{var[l]=i.split("=");delete a[l]});var o=cme(a);return s+"?"+(o=o?(n?n+"&":"")+o:n)},ix=(e,t)=>JSON.stringify(e,(s,n)=>typeof n=="bigint"?n.toString():n,t),xS=e=>{var{data:t,compression:s}=e;if(t){if(s===Yl.GZipJS){var n=uz(pz(ix(t)),{mtime:0}),a=new Blob([n],{type:yL});return{contentType:yL,body:a,estimatedSize:a.size}}if(s===Yl.Base64){var o=function(c){var u,f,h,g,v,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,j=0,w="",k=[];if(!c)return c;c=yge(c);do u=(v=c.charCodeAt(_++)<<16|c.charCodeAt(_++)<<8|c.charCodeAt(_++))>>18&63,f=v>>12&63,h=v>>6&63,g=63&v,k[j++]=y.charAt(u)+y.charAt(f)+y.charAt(h)+y.charAt(g);while(_<c.length);switch(w=k.join(""),c.length%3){case 1:w=w.slice(0,-2)+"==";break;case 2:w=w.slice(0,-1)+"="}return w}(ix(t)),i=(c=>"data="+encodeURIComponent(typeof c=="string"?c:ix(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var l=ix(t);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Rx=[];eE&&Rx.push({transport:"fetch",method:e=>{var t,s,{contentType:n,body:a,estimatedSize:o}=(t=xS(e))!==null&&t!==void 0?t:{},i=new Headers;ur(e.headers,function(f,h){i.append(h,f)}),n&&i.append("Content-Type",n);var l=e.url,c=null;if(OO){var u=new OO;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}eE(l,Ot({method:(e==null?void 0:e.method)||"GET",headers:i,keepalive:e.method==="POST"&&(o||0)<52428.8,body:a,signal:(s=c)==null?void 0:s.signal},e.fetchOptions)).then(f=>f.text().then(h=>{var g={statusCode:f.status,text:h};if(f.status===200)try{g.json=JSON.parse(h)}catch(v){Ut.error(v)}e.callback==null||e.callback(g)})).catch(f=>{Ut.error(f),e.callback==null||e.callback({statusCode:0,text:f})}).finally(()=>c?clearTimeout(c.timeout):null)}}),tE&&Rx.push({transport:"XHR",method:e=>{var t,s=new tE;s.open(e.method||"GET",e.url,!0);var{contentType:n,body:a}=(t=xS(e))!==null&&t!==void 0?t:{};ur(e.headers,function(o,i){s.setRequestHeader(i,o)}),n&&s.setRequestHeader("Content-Type",n),e.timeout&&(s.timeout=e.timeout),s.withCredentials=!0,s.onreadystatechange=()=>{if(s.readyState===4){var o={statusCode:s.status,text:s.responseText};if(s.status===200)try{o.json=JSON.parse(s.responseText)}catch{}e.callback==null||e.callback(o)}},s.send(a)}}),lo!=null&&lo.sendBeacon&&Rx.push({transport:"sendBeacon",method:e=>{var t=lj(e.url,{beacon:"1"});try{var s,{contentType:n,body:a}=(s=xS(e))!==null&&s!==void 0?s:{},o=typeof a=="string"?new Blob([a],{type:n}):a;lo.sendBeacon(t,o)}catch{}}});var kh=function(e,t){if(!function(s){try{new RegExp(s)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function _L(e,t,s){return ix({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:s})}var jge={exact:(e,t)=>t.some(s=>e.some(n=>s===n)),is_not:(e,t)=>t.every(s=>e.every(n=>s!==n)),regex:(e,t)=>t.some(s=>e.some(n=>kh(s,n))),not_regex:(e,t)=>t.every(s=>e.every(n=>!kh(s,n))),icontains:(e,t)=>t.map(Qy).some(s=>e.map(Qy).some(n=>s.includes(n))),not_icontains:(e,t)=>t.map(Qy).every(s=>e.map(Qy).every(n=>!s.includes(n)))},Qy=e=>e.toLowerCase(),jL=In("[Error tracking]");class wge{constructor(t){var s,n;this.fe=[],this._instance=t,this.fe=(s=(n=this._instance.persistence)==null?void 0:n.get_property(aE))!==null&&s!==void 0?s:[]}onRemoteConfig(t){var s,n,a,o=(s=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&s!==void 0?s:[],i=(a=t.errorTracking)==null?void 0:a.captureExtensionExceptions;this.fe=o,this._instance.persistence&&this._instance.persistence.register({[aE]:this.fe,[FO]:i})}get pe(){var t,s=!!this._instance.get_property(FO),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??s)!==null&&t!==void 0&&t}sendExceptionEvent(t){if(this._e(t))jL.info("Skipping exception capture because a suppression rule matched");else{if(this.pe||!this.ge(t))return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"});jL.info("Skipping exception capture because it was thrown by an extension")}}_e(t){var s=t.$exception_list;if(!s||!kr(s)||s.length===0)return!1;var n=s.reduce((a,o)=>{var{type:i,value:l}=o;return Hr(i)&&i.length>0&&a.$exception_types.push(i),Hr(l)&&l.length>0&&a.$exception_values.push(l),a},{$exception_types:[],$exception_values:[]});return this.fe.some(a=>{var o=a.values.map(i=>{var l,c=jge[i.operator],u=kr(i.value)?i.value:[i.value],f=(l=n[i.key])!==null&&l!==void 0?l:[];return u.length>0&&c(u,f)});return a.type==="OR"?o.some(Boolean):o.every(Boolean)})}ge(t){var s=t.$exception_list;return!(!s||!kr(s))&&s.flatMap(n=>{var a,o;return(a=(o=n.stacktrace)==null?void 0:o.frames)!==null&&a!==void 0?a:[]}).some(n=>n.filename&&n.filename.startsWith("chrome-extension://"))}}var qo="Mobile",cj="iOS",Ki="Android",dv="Tablet",xz=Ki+" "+dv,vz="iPad",bz="Apple",yz=bz+" Watch",uv="Safari",Sh="BlackBerry",_z="Samsung",jz=_z+"Browser",wz=_z+" Internet",pp="Chrome",Nge=pp+" OS",Nz=pp+" "+cj,aR="Internet Explorer",kz=aR+" "+qo,oR="Opera",kge=oR+" Mini",iR="Edge",Sz="Microsoft "+iR,Zf="Firefox",Cz=Zf+" "+cj,pv="Nintendo",fv="PlayStation",eh="Xbox",Ez=Ki+" "+qo,Tz=qo+" "+uv,lx="Windows",NE=lx+" Phone",wL="Nokia",kE="Ouya",Rz="Generic",Sge=Rz+" "+qo.toLowerCase(),Az=Rz+" "+dv.toLowerCase(),SE="Konqueror",xa="(\\d+(\\.\\d+)?)",vS=new RegExp("Version/"+xa),Cge=new RegExp(eh,"i"),Ege=new RegExp(fv+" \\w+","i"),Tge=new RegExp(pv+" \\w+","i"),lR=new RegExp(Sh+"|PlayBook|BB10","i"),Rge={"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"},Age=(e,t)=>
658t&&Ps(t,bz)||function(s){return Ps(s,uv)&&!Ps(s,pp)&&!Ps(s,Ki)}(e),Pz=function(e,t){return t=t||"",Ps(e," OPR/")&&Ps(e,"Mini")?kge:Ps(e," OPR/")?oR:lR.test(e)?Sh:Ps(e,"IE"+qo)||Ps(e,"WPDesktop")?kz:Ps(e,jz)?wz:Ps(e,iR)||Ps(e,"Edg/")?Sz:Ps(e,"FBIOS")?"Facebook "+qo:Ps(e,"UCWEB")||Ps(e,"UCBrowser")?"UC Browser":Ps(e,"CriOS")?Nz:Ps(e,"CrMo")||Ps(e,pp)?pp:Ps(e,Ki)&&Ps(e,uv)?Ez:Ps(e,"FxiOS")?Cz:Ps(e.toLowerCase(),SE.toLowerCase())?SE:Age(e,t)?Ps(e,qo)?Tz:uv:Ps(e,Zf)?Zf:Ps(e,"MSIE")||Ps(e,"Trident/")?aR:Ps(e,"Gecko")?Zf:""},Pge={[kz]:[new RegExp("rv:"+xa)],[Sz]:[new RegExp(iR+"?\\/"+xa)],[pp]:[new RegExp("("+pp+"|CrMo)\\/"+xa)],[Nz]:[new RegExp("CriOS\\/"+xa)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+xa)],[uv]:[vS],[Tz]:[vS],[oR]:[new RegExp("(Opera|OPR)\\/"+xa)],[Zf]:[new RegExp(Zf+"\\/"+xa)],[Cz]:[new RegExp("FxiOS\\/"+xa)],[SE]:[new RegExp("Konqueror[:/]?"+xa,"i")],[Sh]:[new RegExp(Sh+" "+xa),vS],[Ez]:[new RegExp("android\\s"+xa,"i")],[wz]:[new RegExp(jz+"\\/"+xa)],[aR]:[new RegExp("(rv:|MSIE )"+xa)],Mozilla:[new RegExp("rv:"+xa)]},Ige=function(e,t){var s=Pz(e,t),n=Pge[s];if(At(n))return null;for(var a=0;a<n.length;a++){var o=n[a],i=e.match(o);if(i)return parseFloat(i[i.length-2])}return null},NL=[[new RegExp(eh+"; "+eh+" (.*?)[);]","i"),e=>[eh,e&&e[1]||""]],[new RegExp(pv,"i"),[pv,""]],[new RegExp(fv,"i"),[fv,""]],[lR,[Sh,""]],[new RegExp(lx,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[NE,""];if(new RegExp(qo).test(t)&&!/IEMobile\b/.test(t))return[lx+" "+qo,""];var s=/Windows NT ([0-9.]+)/i.exec(t);if(s&&s[1]){var n=s[1],a=Rge[n]||"";return/arm/i.test(t)&&(a="RT"),[lx,a]}return[lx,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[cj,t.join(".")]}return[cj,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=At(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ki+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ki+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Ki,t.join(".")]}return[Ki,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var s=[e[1],e[2],e[3]||"0"];t[1]=s.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Nge,""]],[/Linux|debian/i,["Linux",""]]],kL=function(e){return Tge.test(e)?pv:Ege.test(e)?fv:Cge.test(e)?eh:new RegExp(kE,"i").test(e)?kE:new RegExp("("+NE+"|WPDesktop)","i").test(e)?NE:/iPad/.test(e)?vz:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?yz:lR.test(e)?Sh:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(wL,"i").test(e)?wL:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(qo).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ki:xz:Ki:new RegExp("(pda|"+qo+")","i").test(e)?Sge:new RegExp(dv,"i").test(e)&&!new RegExp(dv+" pc","i").test(e)?Az:""},Zy="https?://(.*)",Cw=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Mge=Nw(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Cw),cR="<masked>",Oge=["li_fat_id"];function Iz(e,t,s){if(!$t)return{};var n,a=t?Nw([],Cw,s||[]):[],o=Mz(QT($t.URL,a,cR),e),i=(n={},ur(Oge,function(l){var c=Qi.D(l);n[l]=c||null}),n);return Kr(i,o)}function Mz(e,t){var s=Mge.concat(t||[]),n={};return ur(s,function(a){var o=sj(e,a);n[a]=o||null}),n}function Oz(e){var t=function(o){return o?o.search(Zy+"google.([^/?]*)")===0?"google":o.search(Zy+"bing.com")===0?"bing":o.search(Zy+"yahoo.com")===0?"yahoo":o.search(Zy+"duckduckgo.com")===0?"duckduckgo":null:null}(e),s=t!="yahoo"?"q":"p",n={};if(!Ud(t)){n.$search_engine=t;var a=$t?sj($t.referrer,s):"";a.length&&(n.ph_keyword=a)}return n}function SL(){return navigator.language||navigator.userLanguage}function Lz(){return($t==null?void 0:$t.referrer)||"$direct"}function Dz(e,t){var s=e?Nw([],Cw,t||[]):[],n=La==null?void 0:La.href.substring(0,1e3);return{r:Lz().substring(0,1e3),u:n?QT(n,s,cR):void 0}}function $z(e){var t,{r:s,u:n}=e,a={$referrer:s,$referring_domain:s==null?void 0:s=="$direct"?"$direct":(t=wh(s))==null?void 0:t.host};
658if(n){a.$current_url=n;var o=wh(n);a.$host=o==null?void 0:o.host,a.$pathname=o==null?void 0:o.pathname;var i=Mz(n);Kr(a,i)}if(s){var l=Oz(s);Kr(a,l)}return a}function Uz(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Lge(){try{return new Date().getTimezoneOffset()}catch{return}}function Dge(e,t){if(!Ma)return{};var s,n,a,o=e?Nw([],Cw,t||[]):[],[i,l]=function(c){for(var u=0;u<NL.length;u++){var[f,h]=NL[u],g=f.exec(c),v=g&&(Fo(h)?h(g,c):h);if(v)return v}return["",""]}(Ma);return Kr(JT({$os:i,$os_version:l,$browser:Pz(Ma,navigator.vendor),$device:kL(Ma),$device_type:(n=Ma,a=kL(n),a===vz||a===xz||a==="Kobo"||a==="Kindle Fire"||a===Az?dv:a===pv||a===eh||a===fv||a===kE?"Console":a===yz?"Wearable":a?qo:"Desktop"),$timezone:Uz(),$timezone_offset:Lge()}),{$current_url:QT(La==null?void 0:La.href,o,cR),$host:La==null?void 0:La.host,$pathname:La==null?void 0:La.pathname,$raw_user_agent:Ma.length>1e3?Ma.substring(0,997)+"...":Ma,$browser_version:Ige(Ma,navigator.vendor),$browser_language:SL(),$browser_language_prefix:(s=SL(),typeof s=="string"?s.split("-")[0]:void 0),$screen_height:qe==null?void 0:qe.screen.height,$screen_width:qe==null?void 0:qe.screen.width,$viewport_height:qe==null?void 0:qe.innerHeight,$viewport_width:qe==null?void 0:qe.innerWidth,$lib:"web",$lib_version:Gl.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Li=In("[FeatureFlags]"),bS="$active_feature_flags",yf="$override_feature_flags",CL="$feature_flag_payloads",Rg="$override_feature_flag_payloads",EL="$feature_flag_request_id",TL=e=>{var t={};for(var[s,n]of f_(e||{}))n&&(t[s]=n);return t},$ge=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(s=>{var n;return[s,(n=t[s].variant)!==null&&n!==void 0?n:t[s].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(s=>t[s].enabled).filter(s=>{var n;return(n=t[s].metadata)==null?void 0:n.payload}).map(s=>{var n;return[s,(n=t[s].metadata)==null?void 0:n.payload]}))):Li.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},Uge=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class Fge{constructor(t){this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.xe=!1,this._instance=t,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.$e=!0;else{var t=!this.ke&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ee({disableFlags:t})}}get hasLoadedFlags(){return this.be}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(cE),s=this._instance.get_property(yf),n=this._instance.get_property(Rg);if(!n&&!s)return t||{};var a=Kr({},t||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(s||{})])];for(var i of o){var l,c,u=a[i],f=s==null?void 0:s[i],h=At(f)?(l=u==null?void 0:u.enabled)!==null&&l!==void 0&&l:!!f,g=At(f)?u.variant:typeof f=="string"?f:void 0,v=n==null?void 0:n[i],y=Ot({},u,{enabled:h,variant:h?g??(u==null?void 0:u.variant):void 0});h!==(u==null?void 0:u.enabled)&&(y.original_enabled=u==null?void 0:u.enabled),g!==(u==null?void 0:u.variant)&&(y.original_variant=u==null?void 0:u.variant),v&&(y.metadata=Ot({},u==null?void 0:u.metadata,{payload:v,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),a[i]=y}return this.me||(Li.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:a}),this.me=!0),a}getFlagVariants(){var t=this._instance.get_property(Gf),s=this._instance.get_property(yf);if(!s)return t||{};for(var n=Kr({},t),a=Object.keys(s),o=0;o<a.length;o++)n[a[o]]=s[a[o]];return this.me||(Li.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:s,finalFlags:n}),this.me=!0),n}getFlagPayloads(){var t=this._instance.get_property(CL),s=this._instance.get_property(Rg);if(!s)return t||{};for(var n=Kr({},t||{}),a=Object.keys(s),o=0;o<a.length;o++)n[a[o]]=s[a[o]];return this.me||(Li.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:s,finalPayloads:n}),this.me=!0),n}reloadFeatureFlags(){this.we||this._instance.config.advanced_disable_feature_flags||this.ke||(this.ke=setTimeout(()=>{this.Ee()},5))}Ie(){clearTimeout(this.ke),this.ke=void 0}ensureFlagsLoaded(){this.be||this.ye||this.ke||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.we=t}Ee(t){var s;if(this.Ie(),!this._instance.I())if(this.ye)this.Se=!0;else{var n={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ot({},((s=this._instance.persistence)==null?void 0:s.get_initial_props())||{},this._instance.get_property(ax)||{}),group_properties:this._instance.get_property(Tu)};(t!=null&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var a=this._instance.config.__preview_remote_config,o=a?"/flags/?v=2":"/flags/?v=2&config=true",i=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("api",o+i);a&&(n.timezone=Uz()),this.ye=!0,this._instance.Pe({method:"POST",url:l,data:n,compression:this._instance.config.disable_compression?void 0:Yl.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var u,f,h=!0;if(c.statusCode===200&&(this.Se||(this.$anon_distinct_id=void 0),h=!1),this.ye=!1,this.$e||(this.$e=!0,this._instance.Re((f=c.json)!==null&&f!==void 0?f:{})),!n.disable_flags||this.Se)if(this.xe=!h,c.json&&(u=c.json.quotaLimited)!=null&&u.includes(Uge.FeatureFlags))Li.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.");else{var g;n.disable_flags||this.receivedFeatureFlags((g=c.json)!==null&&g!==void 0?g:{},h),this.Se&&(this.Se=!1,this.Ee())}}})}}getFeatureFlag(t,s){if(s===void 0&&(s={}),this.be||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[t],a=""+n,o=this._instance.get_property(EL)||void 0,i=this._instance.get_property(Q_)||{};if((s.send_event||!("send_event"in s))&&(!(t in i)||!i[t].includes(a))){var l,c,u,f,h,g,v,y,_;kr(i[t])?i[t].push(a):i[t]=[a],(l=this._instance.persistence)==null||l.register({[Q_]:i});var j=this.getFeatureFlagDetails(t),w={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:o,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[t])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[t])||null,$used_bootstrap_value:!this.xe};At(j==null||(f=j.metadata)==null?void 0:f.version)||(w.$feature_flag_version=j.metadata.version);var k,S=(h=j==null||(g=j.reason)==null?void 0:g.description)!==null&&h!==void 0?h:j==null||(v=j.reason)==null?void 0:v.code;S&&(w.$feature_flag_reason=S),j!=null&&(y=j.metadata)!=null&&y.id&&(w.$feature_flag_id=j.metadata.id),At(j==null?void 0:j.original_variant)&&At(j==null?void 0:j.original_enabled)||(w.$feature_flag_original_response=At(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(_=j.metadata)!=null&&_.original_payload&&(w.$feature_flag_original_payload=j==null||(k=j.metadata)==null?void 0:k.original_payload),this._instance.capture("$feature_flag_called",w)}return n}Li.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,s){var n=this._instance.config.token;this._instance.Pe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:n},compression:this._instance.config.disable_compression?void 0:Yl.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var o,i=(o=a.json)==null?void 0:o.featureFlagPayloads;s((i==null?void 0:i[t])||void 0)}})}isFeatureEnabled(t,s){if(s===void 0&&(s={}),this.be||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,s);Li.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(s=>s!==t)}receivedFeatureFlags(t,s){if(this._instance.persistence){this.be=!0;var n=this.getFlagVariants(),a=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(i,l,c,u,f){c===void 0&&(c={}),u===void 0&&(u={}),f===void 0&&(f={});var h=$ge(i),g=h.flags,v=h.featureFlags,y=h.featureFlagPayloads;if(v){var _=i.requestId;if(kr(v)){Li.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var j={};if(v)for(var w=0;w<v.length;w++)j[v[w]]=!0;l&&l.register({[bS]:v,[Gf]:j})}else{var k=v,S=y,E=g;i.errorsWhileComputingFlags&&(k=Ot({},c,k),S=Ot({},u,S),E=Ot({},f,E)),l&&l.register(Ot({[bS]:Object.keys(TL(k)),[Gf]:k||{},[CL]:S||{},[cE]:E||{}},_?{[EL]:_}:{}))}}})(t,this._instance.persistence,n,a,o),this.Te(s)}}override(t,s){s===void 0&&(s=!1),Li.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:s})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return Li.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this._instance.persistence.unregister(yf),this._instance.persistence.unregister(Rg),void this.Te();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var s,n=t;if(this.me=!!((s=n.suppressWarning)!==null&&s!==void 0&&s),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(yf);else if(n.flags)if(kr(n.flags)){for(var a={},o=0;o<n.flags.length;o++)a[n.flags[o]]=!0;this._instance.persistence.register({[yf]:a})}else this._instance.persistence.register({[yf]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(Rg):n.payloads&&this._instance.persistence.register({[Rg]:n.payloads})),void this.Te()}this.Te()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.be){var{flags:s,flagVariants:n}=this.Me();t(s,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,s,n){var a,o=(this._instance.get_property(nx)||[]).find(u=>u.flagKey===t),i={["$feature_enrollment/"+t]:s},l={$feature_flag:t,$feature_enrollment:s,$set:i};o&&(l.$early_access_feature_name=o.name),n&&(l.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(i,!1);var c=Ot({},this.getFlagVariants(),{[t]:s});(a=this._instance.persistence)==null||a.register({[bS]:Object.keys(TL(c)),[Gf]:c}),this.Te()}getEarlyAccessFeatures(t,s,n){s===void 0&&(s=!1);var a=this._instance.get_property(nx),o=n?"&"+n.map(i=>"stage="+i).join("&"):"";if(a&&!s)return t(a);this._instance.Pe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+o),method:"GET",callback:i=>{var l,c;if(i.json){var u=i.json.earlyAccessFeatures;return(l=this._instance.persistence)==null||l.unregister(nx),(c=this._instance.persistence)==null||c.register({[nx]:u}),t(u)}}})}Me(){var t=this.getFlags(),s=this.getFlagVariants();return{flags:t.filter(n=>s[n]),flagVariants:Object.keys(s).filter(n=>s[n]).reduce((n,a)=>(n[a]=s[a],n),{})}}Te(t){var{flags:s,flagVariants:n}=this.Me();
658this.featureFlagEventHandlers.forEach(a=>a(s,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,s){s===void 0&&(s=!0);var n=this._instance.get_property(ax)||{};this._instance.register({[ax]:Ot({},n,t)}),s&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ax)}setGroupPropertiesForFlags(t,s){s===void 0&&(s=!0);var n=this._instance.get_property(Tu)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(a=>{n[a]=Ot({},n[a],t[a]),delete t[a]}),this._instance.register({[Tu]:Ot({},n,t)}),s&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var s=this._instance.get_property(Tu)||{};this._instance.register({[Tu]:Ot({},s,{[t]:{}})})}else this._instance.unregister(Tu)}reset(){this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.xe=!1,this.$anon_distinct_id=void 0,this.Ie(),this.me=!1}}var Bge=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class yS{constructor(t,s){this.S=t,this.props={},this.Ce=!1,this.Fe=(n=>{var a="";return n.token&&(a=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+a+"_posthog"})(t),this.B=this.Oe(t),this.load(),t.debug&&Ut.info("Persistence loaded",t.persistence,Ot({},this.props)),this.update_config(t,t,s),this.save()}isDisabled(){return!!this.Ae}Oe(t){Bge.indexOf(t.persistence.toLowerCase())===-1&&(Ut.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var s=t.persistence.toLowerCase();return s==="localstorage"&&yn.O()?yn:s==="localstorage+cookie"&&Vy.O()?Vy:s==="sessionstorage"&&zn.O()?zn:s==="memory"?yme:s==="cookie"?Qi:Vy.O()?Vy:Qi}properties(){var t={};return ur(this.props,function(s,n){if(n===Gf&&zr(s))for(var a=Object.keys(s),o=0;o<a.length;o++)t["$feature/"+a[o]]=s[a[o]];else l=n,c=!1,(Ud(i=eme)?c:MO&&i.indexOf===MO?i.indexOf(l)!=-1:(ur(i,function(u){if(c||(c=u===l))return J_}),c))||(t[n]=s);var i,l,c}),t}load(){if(!this.Ae){var t=this.B.L(this.Fe);t&&(this.props=Kr({},t))}}save(){this.Ae||this.B.j(this.Fe,this.props,this.De,this.Le,this.je,this.S.debug)}remove(){this.B.N(this.Fe,!1),this.B.N(this.Fe,!0)}clear(){this.remove(),this.props={}}register_once(t,s,n){if(zr(t)){At(s)&&(s="None"),this.De=At(n)?this.Ne:n;var a=!1;if(ur(t,(o,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==s||(this.props[i]=o,a=!0)}),a)return this.save(),!0}return!1}register(t,s){if(zr(t)){this.De=At(s)?this.Ne:s;var n=!1;if(ur(t,(a,o)=>{t.hasOwnProperty(o)&&this.props[o]!==a&&(this.props[o]=a,n=!0)}),n)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.Ce){var t=Iz(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);Vf(JT(t))||this.register(t),this.Ce=!0}}update_search_keyword(){var t;this.register((t=$t==null?void 0:$t.referrer)?Oz(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Lz(),$referring_domain:$t!=null&&$t.referrer&&((t=wh($t.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[fE]||this.props[hE]||this.register_once({[Z_]:Dz(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};ur([hE,fE],i=>{var l=this.props[i];l&&ur(l,function(c,u){t["$initial_"+sE(u)]=c})});var s,n,a=this.props[Z_];if(a){var o=(s=$z(a),n={},ur(s,function(i,l){n["$initial_"+sE(l)]=i}),n);Kr(t,o)}return t}safe_merge(t){return ur(this.props,function(s,n){n in t||(t[n]=s)}),t}update_config(t,s,n){if(this.Ne=this.De=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!n),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==s.persistence){var a=this.Oe(t),o=this.props;this.clear(),this.B=a,this.props=o,this.save()}}set_disabled(t){this.Ae=t,this.Ae?this.remove():this.save()}set_cross_subdomain(t){t!==this.Le&&(this.Le=t,this.remove(),this.save())}set_secure(t){t!==this.je&&(this.je=t,this.remove(),this.save())}set_event_timer(t,s){var n=this.props[sx]||{};n[t]=s,this.props[sx]=n,this.save()}remove_event_timer(t){var s=(this.props[sx]||{})[t];return At(s)||(delete this.props[sx][t],this.save()),s}get_property(t){return this.props[t]}set_property(t,s){this.props[t]=s,this.save()}}class Fz{constructor(){this.ze={},this.ze={}}on(t,s){return this.ze[t]||(this.ze[t]=[]),this.ze[t].push(s),()=>{this.ze[t]=this.ze[t].filter(n=>n!==s)}}emit(t,s){for(var n of this.ze[t]||[])n(s);for(var a of this.ze["*"]||[])a(t,s)}}class Du{constructor(t){this.Ue=new Fz,this.qe=(s,n)=>this.Be(s,n)&&this.He(s,n)&&this.We(s,n),this.Be=(s,n)=>n==null||!n.event||(s==null?void 0:s.event)===(n==null?void 0:n.event),this._instance=t,this.Ge=new Set,this.Je=new Set}init(){var t;if(!At((t=this._instance)==null?void 0:t.Ve)){var s;(s=this._instance)==null||s.Ve((n,a)=>{this.on(n,a)})}}register(t){var s,n;if(!At((s=this._instance)==null?void 0:s.Ve)&&(t.forEach(i=>
658{var l,c;(l=this.Je)==null||l.add(i),(c=i.steps)==null||c.forEach(u=>{var f;(f=this.Ge)==null||f.add((u==null?void 0:u.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var a,o=new Set;t.forEach(i=>{var l;(l=i.steps)==null||l.forEach(c=>{c!=null&&c.selector&&o.add(c==null?void 0:c.selector)})}),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,s){var n;s!=null&&t.length!=0&&(this.Ge.has(t)||this.Ge.has(s==null?void 0:s.event))&&this.Je&&((n=this.Je)==null?void 0:n.size)>0&&this.Je.forEach(a=>{this.Ke(s,a)&&this.Ue.emit("actionCaptured",a.name)})}Ye(t){this.onAction("actionCaptured",s=>t(s))}Ke(t,s){if((s==null?void 0:s.steps)==null)return!1;for(var n of s.steps)if(this.qe(t,n))return!0;return!1}onAction(t,s){return this.Ue.on(t,s)}He(t,s){if(s!=null&&s.url){var n,a=t==null||(n=t.properties)==null?void 0:n.$current_url;if(!a||typeof a!="string"||!Du.Xe(a,s==null?void 0:s.url,(s==null?void 0:s.url_matching)||"contains"))return!1}return!0}static Xe(t,s,n){switch(n){case"regex":return!!qe&&kh(t,s);case"exact":return s===t;case"contains":var a=Du.Qe(s).replace(/_/g,".").replace(/%/g,".*");return kh(t,a);default:return!1}}static Qe(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}We(t,s){if((s!=null&&s.href||s!=null&&s.tag_name||s!=null&&s.text)&&!this.Ze(t).some(o=>!(s!=null&&s.href&&!Du.Xe(o.href||"",s==null?void 0:s.href,(s==null?void 0:s.href_matching)||"exact"))&&(s==null||!s.tag_name||o.tag_name===(s==null?void 0:s.tag_name))&&!(s!=null&&s.text&&!Du.Xe(o.text||"",s==null?void 0:s.text,(s==null?void 0:s.text_matching)||"exact")&&!Du.Xe(o.$el_text||"",s==null?void 0:s.text,(s==null?void 0:s.text_matching)||"exact"))))return!1;if(s!=null&&s.selector){var n,a=t==null||(n=t.properties)==null?void 0:n.$element_selectors;if(!a||!a.includes(s==null?void 0:s.selector))return!1}return!0}Ze(t){return(t==null?void 0:t.properties.$elements)==null?[]:t==null?void 0:t.properties.$elements}}(function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e})({});(function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e})({});var _S=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({});(function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e})({});(function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e})({});(function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e})({});var jS=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),RL=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),xn=In("[Surveys]"),CE="seenSurvey_",qge=(e,t)=>{var s="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(s="$survey_"+t+"/"+e.id+"/"+e.current_iteration),s},zge=[_S.Popover,_S.Widget,_S.API];class Hge{constructor(t){this._instance=t,this.tr=new Map,this.ir=new Map}register(t){var s;At((s=this._instance)==null?void 0:s.Ve)||(this.er(t),this.rr(t))}rr(t){var s=t.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.actions)&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0});s.length!==0&&(this.sr==null&&(this.sr=new Du(this._instance),this.sr.init(),this.sr.Ye(n=>{this.onAction(n)})),s.forEach(n=>{var a,o,i,l,c;n.conditions&&(a=n.conditions)!=null&&a.actions&&(o=n.conditions)!=null&&(o=o.actions)!=null&&o.values&&((i=n.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0&&((l=this.sr)==null||l.register(n.conditions.actions.values),(c=n.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEac
658h(u=>{if(u&&u.name){var f=this.ir.get(u.name);f&&f.push(n.id),this.ir.set(u.name,f||[n.id])}}))}))}er(t){var s;t.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0}).length!==0&&((s=this._instance)==null||s.Ve((n,a)=>{this.onEvent(n,a)}),t.forEach(n=>{var a;(a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null||a.forEach(o=>{if(o&&o.name){var i=this.tr.get(o.name);i&&i.push(n.id),this.tr.set(o.name,i||[n.id])}})}))}onEvent(t,s){var n,a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[zy])||[];if(t==="survey shown"&&s&&a.length>0){var o;xn.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:s,existingActivatedSurveys:a});var i=s==null||(o=s.properties)==null?void 0:o.$survey_id;if(i){var l=a.indexOf(i);l>=0&&(a.splice(l,1),this.nr(a))}}else this.tr.has(t)&&(xn.info("survey event matched, updating activated surveys",{event:t,surveys:this.tr.get(t)}),this.nr(a.concat(this.tr.get(t)||[])))}onAction(t){var s,n=((s=this._instance)==null||(s=s.persistence)==null?void 0:s.props[zy])||[];this.ir.has(t)&&this.nr(n.concat(this.ir.get(t)||[]))}nr(t){var s;(s=this._instance)==null||(s=s.persistence)==null||s.register({[zy]:[...new Set(t)]})}getSurveys(){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[zy];return s||[]}getEventToSurveys(){return this.tr}ar(){return this.sr}}class Vge{constructor(t){this.lr=void 0,this._surveyManager=null,this.ur=!1,this.hr=!1,this.dr=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var s=t.surveys;if(Xs(s))return xn.warn("Flags not loaded yet. Not loading surveys.");var n=kr(s);this.lr=n?s.length>0:s,xn.info("flags response received, isSurveysEnabled: "+this.lr),this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],s=0;s<localStorage.length;s++){var n=localStorage.key(s);(n!=null&&n.startsWith(CE)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(a=>localStorage.removeItem(a))}loadIfEnabled(){if(!this._surveyManager)if(this.hr)xn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)xn.info("Disabled. Not loading surveys.");else{var t=hs==null?void 0:hs.__PosthogExtensions__;if(t){if(!At(this.lr)||this._instance.config.advanced_enable_surveys){var s=this.lr||this._instance.config.advanced_enable_surveys;this.hr=!0;try{var n=t.generateSurveys;if(n)return void this.vr(n,s);var a=t.loadExternalDependency;if(!a)return void this.cr("PostHog loadExternalDependency extension not found.");a(this._instance,"surveys",o=>{o||!t.generateSurveys?this.cr("Could not load surveys script",o):this.vr(t.generateSurveys,s)})}catch(o){throw this.cr("Error initializing surveys",o),o}finally{this.hr=!1}}}else xn.error("PostHog Extensions not found.")}}vr(t,s){this._surveyManager=t(this._instance,s),this._surveyEventReceiver=new Hge(this._instance),xn.info("Surveys loaded successfully"),this.pr({isLoaded:!0})}cr(t,s){xn.error(t,s),this.pr({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.dr.push(t),this._surveyManager&&this.pr({isLoaded:!0}),()=>{this.dr=this.dr.filter(s=>s!==t)}}getSurveys(t,s){if(s===void 0&&(s=!1),this._instance.config.disable_surveys)return xn.info("Disabled. Not loading surveys."),t([]);var n=this._instance.get_property(dE);if(n&&!s)return t(n,{isLoaded:!0});if(this.ur)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ur=!0,this._instance.Pe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:a=>{var o;this.ur=!1;var i=a.statusCode;if(i!==200||!a.json){var l="Surveys API could not be loaded, status: "+i;return xn.error(l),t([],{isLoaded:!1,error:l})}var c,u=a.json.surveys||[],f=u.filter(h=>function(g){return!(!g.start_date||g.end_date)}(h)&&(function(g){var v;return!((v=g.conditions)==null||(v=v.events)==null||(v=v.values)==null||!v.length)}(h)||function(g){var v;return!((v=g.conditions)==null||(v=v.actions)==null||(v=v.values)==null||!v.length)}(h)));return f.length>0&&((c=this._surveyEventReceiver)==null||c.register(f)),(o=this._instance.persistence)==null||o.register({[dE]:u}),t(u,{isLoaded:!0})}})}catch(a){throw this.ur=!1,a}}pr(t){for(var s of this.dr)try{if(!t.isLoaded)return s([],t);
658this.getSurveys(s)}catch(n){xn.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,s){if(s===void 0&&(s=!1),!Xs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,s);xn.warn("init was not called")}_r(t){var s=null;return this.getSurveys(n=>{var a;s=(a=n.find(o=>o.id===t))!==null&&a!==void 0?a:null}),s}gr(t){if(Xs(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var s=typeof t=="string"?this._r(t):t;return s?this._surveyManager.checkSurveyEligibility(s):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Xs(this._surveyManager))return xn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var s=this.gr(t);return{visible:s.eligible,disabledReason:s.reason}}canRenderSurveyAsync(t,s){return Xs(this._surveyManager)?(xn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(a=>{var o,i=(o=a.find(c=>c.id===t))!==null&&o!==void 0?o:null;if(i){var l=this.gr(i);n({visible:l.eligible,disabledReason:l.reason})}else n({visible:!1,disabledReason:"Survey not found"})},s)})}renderSurvey(t,s){if(Xs(this._surveyManager))xn.warn("init was not called");else{var n=this._r(t);if(n)if(zge.includes(n.type)){var a=$t==null?void 0:$t.querySelector(s);a?this._surveyManager.renderSurvey(n,a):xn.warn("Survey element not found")}else xn.warn("Surveys of type "+n.type+" cannot be rendered in the app");else xn.warn("Survey not found")}}}var AL=In("[RateLimiter]");class Gge{constructor(t){var s,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=a=>{var o=a.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{AL.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void AL.warn('could not rate limit - continuing. Error: "'+(i==null?void 0:i.message)+'"',{text:o})}},this.instance=t,this.captureEventsPerSecond=((s=t.config.rate_limiting)==null?void 0:s.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=t.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var s,n,a;t===void 0&&(t=!1);var o=new Date().getTime(),i=(s=(n=this.instance.persistence)==null?void 0:n.get_property(pE))!==null&&s!==void 0?s:{tokens:this.captureEventsBurstLimit,last:o};i.tokens+=(o-i.last)/1e3*this.captureEventsPerSecond,i.last=o,i.tokens>this.captureEventsBurstLimit&&(i.tokens=this.captureEventsBurstLimit);var l=i.tokens<1;return l||t||(i.tokens=Math.max(0,i.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(a=this.instance.persistence)==null||a.set_property(pE,i),{isRateLimited:l,remainingTokens:i.tokens}}isServerRateLimited(t){var s=this.serverLimits[t||"events"]||!1;return s!==!1&&new Date().getTime()<s}}var bu=In("[RemoteConfig]");class Wge{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=hs._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}mr(t){var s,n;(s=hs.__PosthogExtensions__)!=null&&s.loadExternalDependency?(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):(bu.error("PostHog Extensions not found. Cannot load remote config."),t())}br(t){this._instance.Pe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:s=>{t(s.json)}})}load(){try{if(this.remoteConfig)return bu.info("Using preloaded remote config",this.remoteConfig),void this.Re(this.remoteConfig);if(this._instance.I())return void bu.warn("Remote config is disabled. Falling back to local config.");this.mr(t=>{if(!t)return bu.info("No config found after loading remote JS config. Falling back to JSON."),void this.br(s=>{this.Re(s)});this.Re(t)})}catch(t){bu.error("Error loading remote config",t)}}Re(t){t?this._instance.config.__preview_remote_config?(this._instance.Re(t),t.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):bu.info("__preview_remote_config is disabled. Logging config instead",t):bu.error("Failed to fetch remote config from PostHog.")}}var EE=3e3;class Yge{constructor(t,s){this.yr=!0,this.wr=[],this.Sr=co((s==null?void 0:s.flush_interval_ms)||EE,250,5e3,"flush interval",EE),this.$r=t}enqueue(t){this.wr.push(t),this.kr||this.Er()}unload(){this.Ir();var t=this.wr.length>0?this.Pr():{},s=Object.values(t);[...s.filter(n=>n.url.indexOf("/e")===0),...s.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.$r(Ot({},n,{transport:"sendBeacon"}))})}enable(){this.yr=!1,this.Er()}Er(){var t=this;this.yr||(this.kr=setTimeout(()=>{if(this.Ir(),this.wr.length>0){var s=this.Pr(),n=function(){var o=s[a],i=new Date().getTime();o.data&&kr(o.data)&&ur(o.data,l=>{l.offset=Math.abs(l.timestamp-i),delete l.timestamp}),t.$r(o)};for(var a in s)n()}},this.Sr))}Ir(){clearTimeout(this.kr),this.kr=void 0}Pr(){var t={};return ur(this.wr,s=>{var n,a=s,o=(a?a.batchKey:null)||a.url;At(t[o])&&(t[o]=Ot({},a,{data:[]})),(n=t[o].data)==null||n.push(a.data)}),this.wr=[],t}}var Kge=["retriesPerformedSoFar"];class Jge{constructor(t){this.Rr=!1,this.Tr=3e3,this.wr=[],this._instance=t,this.wr=[],this.Mr=!0,!At(qe)&&"onLine"in qe.navigator&&(this.Mr=qe.navigator.onLine,Mr(qe,"online",()=>{this.Mr=!0,this.se()}),Mr(qe,"offline",()=>{this.Mr=!1}))}get length(){return this.wr.length}retriableRequest(t){var{retriesPerformedSoFar:s}=t,n=Dq(t,Kge);ra(s)&&s>0&&(n.url=lj(n.url,{retry_count:s})),this._instance.Pe(Ot({},n,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(s??0)<10?this.Cr(Ot({retriesPerformedSoFar:s},n)):n.callback==null||n.callback(a)}}))}Cr(t){var s=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=s+1;var n=function(i){var l=3e3*Math.pow(2,i),c=l/2,u=Math.min(18e5,l),f=(Math.random()-.5)*(u-c);return Math.ceil(u+f)}
658(s),a=Date.now()+n;this.wr.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+n;navigator.onLine||(o+=" (Browser is offline)"),Ut.warn(o),this.Rr||(this.Rr=!0,this.Fr())}Fr(){this.Or&&clearTimeout(this.Or),this.Or=setTimeout(()=>{this.Mr&&this.wr.length>0&&this.se(),this.Fr()},this.Tr)}se(){var t=Date.now(),s=[],n=this.wr.filter(o=>o.retryAt<t||(s.push(o),!1));if(this.wr=s,n.length>0)for(var{requestOptions:a}of n)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.Or&&(clearTimeout(this.Or),this.Or=void 0),this.wr))try{this._instance.Pe(Ot({},t,{transport:"sendBeacon"}))}catch(s){Ut.error(s)}this.wr=[]}}class Xge{constructor(t){this.Ar=()=>{var s,n,a,o;this.Dr||(this.Dr={});var i=this.scrollElement(),l=this.scrollY(),c=i?Math.max(0,i.scrollHeight-i.clientHeight):0,u=l+((i==null?void 0:i.clientHeight)||0),f=(i==null?void 0:i.scrollHeight)||0;this.Dr.lastScrollY=Math.ceil(l),this.Dr.maxScrollY=Math.max(l,(s=this.Dr.maxScrollY)!==null&&s!==void 0?s:0),this.Dr.maxScrollHeight=Math.max(c,(n=this.Dr.maxScrollHeight)!==null&&n!==void 0?n:0),this.Dr.lastContentY=u,this.Dr.maxContentY=Math.max(u,(a=this.Dr.maxContentY)!==null&&a!==void 0?a:0),this.Dr.maxContentHeight=Math.max(f,(o=this.Dr.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}getContext(){return this.Dr}resetContext(){var t=this.Dr;return setTimeout(this.Ar,0),t}startMeasuringScrollPosition(){Mr(qe,"scroll",this.Ar,{capture:!0}),Mr(qe,"scrollend",this.Ar,{capture:!0}),Mr(qe,"resize",this.Ar)}scrollElement(){if(!this._instance.config.scroll_root_selector)return qe==null?void 0:qe.document.documentElement;var t=kr(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var s of t){var n=qe==null?void 0:qe.document.querySelector(s);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return qe&&(qe.scrollY||qe.pageYOffset||qe.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return qe&&(qe.scrollX||qe.pageXOffset||qe.document.documentElement.scrollLeft)||0}}var Qge=e=>Dz(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class Zge{constructor(t,s,n,a){this.Lr=o=>{var i=this.jr();if(!i||i.sessionId!==o){var l={sessionId:o,props:this.Nr(this._instance)};this.zr.register({[uE]:l})}},this._instance=t,this.Ur=s,this.zr=n,this.Nr=a||Qge,this.Ur.onSessionId(this.Lr)}jr(){return this.zr.props[uE]}getSetOnceProps(){var t,s=(t=this.jr())==null?void 0:t.props;return s?"r"in s?$z(s):{$referring_domain:s.referringDomain,$pathname:s.initialPathName,utm_source:s.utm_source,utm_campaign:s.utm_campaign,utm_medium:s.utm_medium,utm_content:s.utm_content,utm_term:s.utm_term}:{}}getSessionProps(){var t={};return ur(JT(this.getSetOnceProps()),(s,n)=>{n==="$current_url"&&(n="url"),t["$session_entry_"+sE(n)]=s}),t}}var PL=In("[SessionId]");class exe{constructor(t,s,n){var a;if(this.qr=[],this.Br=(f,h)=>Math.abs(f-h)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=t.config,this.zr=t.persistence,this.fi=void 0,this.Ct=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Hr=s||dd,this.Wr=n||dd;var o=this.S.persistence_name||this.S.token,i=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*co(i,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Gr(),this.Jr="ph_"+o+"_window_id",this.Vr="ph_"+o+"_primary_window_exists",this.Kr()){var l=zn.L(this.Jr),c=zn.L(this.Vr);l&&!c?this.fi=l:zn.N(this.Jr),zn.j(this.Vr,!0)}if((a=this.S.bootstrap)!=null&&a.sessionID)try{var u=(f=>{var h=f.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.S.bootstrap.sessionID);this.Yr(this.S.bootstrap.sessionID,new Date().getTime(),u)}catch(f){PL.error("Invalid sessionID in bootstrap",f)}this.Xr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return At(this.qr)&&(this.qr=[]),this.qr.push(t),this.Ct&&t(this.Ct,this.fi),()=>{this.qr=this.qr.filter(s=>s!==t)}}Kr(){return this.S.persistence!=="memory"&&!this.zr.Ae&&zn.O()}Qr(t){t!==this.fi&&(this.fi=t,this.Kr()&&zn.j(this.Jr,t))}Zr(){return this.fi?this.fi:this.Kr()?zn.L(this.Jr):null}Yr(t,s,n){t===this.Ct&&s===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=s,this.Ct=t,this.zr.register({[X_]:[s,t,n]}))}ts(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var t=this.zr.props[X_];return kr(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Yr(null,null,null)}Xr(){Mr(qe,"beforeunload",()=>{this.Kr()&&zn.N(this.Vr)},{capture:!1})}
658checkAndGetSessionAndWindowId(t,s){if(t===void 0&&(t=!1),s===void 0&&(s=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=s||new Date().getTime(),[a,o,i]=this.ts(),l=this.Zr(),c=ra(i)&&i>0&&Math.abs(n-i)>864e5,u=!1,f=!o,h=!t&&this.Br(n,a);f||h||c?(o=this.Hr(),l=this.Wr(),PL.info("new session ID generated",{sessionId:o,windowId:l,changeReason:{noSessionId:f,activityTimeout:h,sessionPastMaximumLength:c}}),i=n,u=!0):l||(l=this.Wr(),u=!0);var g=a===0||!t||c?n:a,v=i===0?new Date().getTime():i;return this.Qr(l),this.Yr(o,g,v),t||this.Gr(),u&&this.qr.forEach(y=>y(o,l,u?{noSessionId:f,activityTimeout:h,sessionPastMaximumLength:c}:void 0)),{sessionId:o,windowId:l,sessionStartTimestamp:v,changeReason:u?{noSessionId:f,activityTimeout:h,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:a}}Gr(){clearTimeout(this.es),this.es=setTimeout(()=>{var[t]=this.ts();this.Br(new Date().getTime(),t)&&this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var txe=["$set_once","$set"],zc=In("[SiteApps]");class sxe{constructor(t){this._instance=t,this.rs=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ss(t,s){if(s){var n=this.globalsForEvent(s);this.rs.push(n),this.rs.length>1e3&&(this.rs=this.rs.slice(10))}}get siteAppLoaders(){var t;return(t=hs._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ve(this.ss.bind(this));this.ns=()=>{t(),this.rs=[],this.ns=void 0}}}globalsForEvent(t){var s,n,a,o,i,l,c;if(!t)throw new Error("Event payload is required");var u={},f=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[g,v]of Object.entries(h))u[g]={id:f[g],type:g,properties:v};var{$set_once:y,$set:_}=t;return{event:Ot({},Dq(t,txe),{properties:Ot({},t.properties,_?{$set:Ot({},(s=(n=t.properties)==null?void 0:n.$set)!==null&&s!==void 0?s:{},_)}:{},y?{$set_once:Ot({},(a=(o=t.properties)==null?void 0:o.$set_once)!==null&&a!==void 0?a:{},y)}:{}),elements_chain:(i=(l=t.properties)==null?void 0:l.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(c=t.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var s=this.apps[t.id],n=()=>{var l;!s.errored&&this.rs.length&&(zc.info("Processing "+this.rs.length+" events for site app with id "+t.id),this.rs.forEach(c=>s.processEvent==null?void 0:s.processEvent(c)),s.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((l=this.ns)==null||l.call(this))},a=!1,o=l=>{s.errored=!l,s.loaded=!0,zc.info("Site app with id "+t.id+" "+(l?"loaded":"errored")),a&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback:l=>{o(l)}});i&&(s.processEvent=i),a=!0}catch(l){zc.error("Error while initializing PostHog app with config id "+t.id,l),o(!1)}if(a&&s.loaded)try{n()}catch(l){zc.error("Error while processing buffered events PostHog app with config id "+t.id,l),s.errored=!0}}os(){var t=this.siteAppLoaders||[];for(var s of t)this.apps[s.id]={id:s.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ls(t){if(Object.keys(this.apps).length!==0){var s=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(s)}catch(a){zc.error("Error while processing event "+t.event+" for site app "+n.id,a)}}}onRemoteConfig(t){var s,n,a,o=this;if((s=this.siteAppLoaders)!=null&&s.length)return this.isEnabled?(this.os(),void this._instance.on("eventCaptured",u=>this.ls(u))):void zc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.ns)==null||n.call(this),(a=t.siteApps)!=null&&a.length)if(this.isEnabled){var i=function(u){var f;hs["__$$ph_site_app_"+u]=o._instance,(f=hs.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(o._instance,c,h=>{if(h)return zc.error("Error while initializing PostHog app with config id "+u,h)})};for(var{id:l,url:c}of t.siteApps)i(l)}else zc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var rxe=["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
658spot","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"],IL=function(e,t){if(!e)return!1;var s=e.toLowerCase();return rxe.concat(t||[]).some(n=>{var a=n.toLowerCase();return s.indexOf(a)!==-1})},Bz=function(e,t){if(!e)return!1;var s=e.userAgent;if(s&&IL(s,t))return!0;try{var n=e==null?void 0:e.userAgentData;if(n!=null&&n.brands&&n.brands.some(a=>IL(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver},cx=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),ML="i.posthog.com";class nxe{constructor(t){this.us={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,s=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return s||(s=this.apiHost.replace("."+ML,".posthog.com")),s==="https://app.posthog.com"?"https://us.posthog.com":s}get region(){return this.us[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.us[this.apiHost]=cx.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.us[this.apiHost]=cx.EU:this.us[this.apiHost]=cx.CUSTOM),this.us[this.apiHost]}endpointFor(t,s){if(s===void 0&&(s=""),s&&(s=s[0]==="/"?s:"/"+s),t==="ui")return this.uiHost+s;if(this.region===cx.CUSTOM)return this.apiHost+s;var n=ML+s;switch(t){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var axe={icontains:(e,t)=>!!qe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!qe&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!qe&&kh(t.href,e),not_regex:(e,t)=>!!qe&&!kh(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class ea{constructor(t){var s=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),s.getWebExperiments(a=>{ea.hs("retrieved web experiments from the server"),s.ds=new Map,a.forEach(o=>{if(o.feature_flag_key){var i;s.ds&&(ea.hs("setting flag key ",o.feature_flag_key," to web experiment ",o),(i=s.ds)==null||i.set(o.feature_flag_key,o));var l=s._instance.getFeatureFlag(o.feature_flag_key);Hr(l)&&o.variants[l]&&s.vs(o.name,l,o.variants[l].transforms)}else if(o.variants)for(var c in o.variants){var u=o.variants[c];ea.cs(u)&&s.vs(o.name,c,u.transforms)}})},n)},this._instance=t,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(t){if(this._is_bot())ea.hs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Xs(this.ds))return this.ds=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ea.hs("applying feature flags",t),t.forEach(s=>{var n;if(this.ds&&(n=this.ds)!=null&&n.has(s)){var a,o=this._instance.getFeatureFlag(s),i=(a=this.ds)==null?void 0:a.get(s);o&&i!=null&&i.variants[o]&&this.vs(i.name,o,i.variants[o].transforms)}})}}previewWebExperiment(){var t=ea.getWindowLocation();if(t!=null&&t.search){var s=sj(t==null?void 0:t.search,"__experiment_id"),n=sj(t==null?void 0:t.search,"__experiment_variant");s&&n&&(ea.hs("previewing web experiments "+s+" && "+n),this.getWebExperiments(a=>{this.fs(parseInt(s),n,a)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,s,n){if(this._instance.config.disable_web_experiments&&!n)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!s)return t(a);this._instance.Pe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return t([]);var i=o.json.experiments||[];return t(i)}})}fs(t,s,n){var a=n.filter(o=>o.id===t);a&&a.length>0&&(ea.hs("Previewing web experiment ["+a[0].name+"] with variant ["+s+"]"),this.vs(a[0].name,s,a[0].variants[s].transforms))}static cs(t){return!Xs(t.conditions)&&ea.ps(t)&&ea._s(t)}static ps(t){var s;if(Xs(t.conditions)||Xs((s=t.conditions)==null?void 0:s.url))return!0;var n,a,o,i=ea.getWindowLocation();return!!i&&((n=t.conditions)==null||!n.url||axe[(a=(o=t.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,i))}
658static getWindowLocation(){return qe==null?void 0:qe.location}static _s(t){var s;if(Xs(t.conditions)||Xs((s=t.conditions)==null?void 0:s.utm))return!0;var n=Iz();if(n.utm_source){var a,o,i,l,c,u,f,h,g=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==n.utm_campaign,v=(i=t.conditions)==null||(i=i.utm)==null||!i.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==n.utm_source,y=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==n.utm_medium,_=(f=t.conditions)==null||(f=f.utm)==null||!f.utm_term||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==n.utm_term;return g&&y&&_&&v}return!1}static hs(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];Ut.info("[WebExperiments] "+t,n)}vs(t,s,n){this._is_bot()?ea.hs("Refusing to render web experiment since the viewer is a likely bot"):s!=="control"?n.forEach(a=>{if(a.selector){var o;ea.hs("applying transform of variant "+s+" for experiment "+t+" ",a);var i=(o=document)==null?void 0:o.querySelectorAll(a.selector);i==null||i.forEach(l=>{var c=l;a.html&&(c.innerHTML=a.html),a.css&&c.setAttribute("style",a.css)})}}):ea.hs("Control variants leave the page unmodified.")}_is_bot(){return lo&&this._instance?Bz(lo,this._instance.config.custom_blocked_useragents):void 0}}var oxe=In("[PostHog ExternalIntegrations]"),ixe={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class lxe{constructor(t){this._instance=t}J(t,s){var n;(n=hs.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,t,a=>{if(a)return oxe.error("failed to load script",a);s()})}startIfEnabledOrStop(){var t=this,s=function(i){var l,c,u;!a||(l=hs.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[i]||t.J(ixe[i],()=>{var f;(f=hs.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[i])==null||f.start(t._instance)}),!a&&(c=hs.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[i]&&((u=hs.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[i])==null||u.stop())};for(var[n,a]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;s(n)}}}var Ax={},TE=()=>{},$f="posthog",qz=!_ge&&(Ma==null?void 0:Ma.indexOf("MSIE"))===-1&&(Ma==null?void 0:Ma.indexOf("Mozilla"))===-1,OL=e=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Zhe($t==null?void 0:$t.location),persistence:"localStorage+cookie",persistence_name:"",loaded:TE,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:e!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:e??"unset",debug:La&&Hr(La==null?void 0:La.search)&&La.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(qe==null||(t=qe.location)==null?void 0:t.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",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,session_recording:{},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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:s=>{var n="Bad HTTP status: "+s.statusCode+" "+s.text;Ut.error(n)},get_device_id:s=>s,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:EE},error_tracking:{},_onCapture:TE}},LL=e=>{var t={};At(e.process_person)||(t.person_profiles=e.process_person),At(e.xhr_headers)||(t.request_headers=e.x
658hr_headers),At(e.cookie_name)||(t.persistence_name=e.cookie_name),At(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),At(e.store_google)||(t.save_campaign_params=e.store_google),At(e.verbose)||(t.debug=e.verbose);var s=Kr({},t,e);return kr(e.property_blacklist)&&(At(e.property_denylist)?s.property_denylist=e.property_blacklist:kr(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ut.error("Invalid value for property_denylist config: "+e.property_denylist)),s};class cxe{constructor(){this.__forceAllowLocalhost=!1}get gs(){return this.__forceAllowLocalhost}set gs(t){Ut.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ew{get decideEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)==null?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)==null?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){this.webPerformance=new cxe,this.bs=!1,this.version=Gl.LIB_VERSION,this.ys=new Fz,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=OL(),this.SentryIntegration=uge,this.sentryIntegration=t=>function(s,n){var a=gz(s,n);return{name:mz,processEvent:o=>a(o)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ws=!1,this.Ss=null,this.$s=null,this.xs=null,this.featureFlags=new Fge(this),this.toolbar=new fge(this),this.scrollManager=new Xge(this),this.pageViewManager=new bge(this),this.surveys=new Vge(this),this.experiments=new ea(this),this.exceptions=new wge(this),this.rateLimiter=new Gge(this),this.requestRouter=new nxe(this),this.consent=new _me(this),this.externalIntegrations=new lxe(this),this.people={set:(t,s,n)=>{var a=Hr(t)?{[t]:s}:t;this.setPersonProperties(a),n==null||n({})},set_once:(t,s,n)=>{var a=Hr(t)?{[t]:s}:t;this.setPersonProperties(void 0,a),n==null||n({})}},this.on("eventCaptured",t=>Ut.info('send "'+(t==null?void 0:t.event)+'"',t))}init(t,s,n){if(n&&n!==$f){var a,o=(a=Ax[n])!==null&&a!==void 0?a:new Ew;return o._init(t,s,n),Ax[n]=o,Ax[$f][n]=o,o}return this._init(t,s,n)}_init(t,s,n){var a,o;if(s===void 0&&(s={}),At(t)||rE(t))return Ut.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 Ut.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.ks=s,this.Es=[],s.person_profiles&&(this.$s=s.person_profiles),this.set_config(Kr({},OL(s.defaults),LL(s),{name:n,token:t})),this.config.on_xhr_error&&Ut.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:Yl.GZipJS;var i=this.Is();this.persistence=new yS(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yS(Ot({},this.config,{persistence:"sessionStorage"}),i);var l=Ot({},this.persistence.props),c=Ot({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.Ps=new Yge(k=>this.Rs(k),this.config.request_queue_config),this.Ts=new Jge(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new exe(this),this.sessionPropsManager=new Zge(this,this.sessionManager,this.persistence)),new mge(this).startIfEnabledOrStop(),this.siteApps=new sxe(this),(a=this.siteApps)==null||a.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new cge(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new fme(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new vge(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new gge(this),this.exceptionObserver=new Nme(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new ez(this,wme),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new $me(this),this.historyAutocapture.startIfEnabled(),Gl.DEBUG=Gl.DEBUG||this.config.debug,Gl.DEBUG&&Ut.info("Starting in debug mode",{this:this,config:s,thisC:Ot({},this.config),p:l,s:c}),((o=s.bootstrap)==null?void 0:o.distinctID)!==void 0){var u,f,h=this.config.get_device_id(dd()),g=(u=s.bootstrap)!=null&&u.isIdentifiedID?h:s.bootstrap.distinctID;this.persistence.set_property(Bl,(f=s.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:g})}if(this.Ms()){var v,y,_=Object.keys(((v=s.bootstrap)==null?void 0:v.featureFlags)||{}).filter(k=>{var S;return!((S=s.bootstrap)==null||(S=S.featureFlags)==null||!S[k])}).reduce((k,S)=>{var E;return k[S]=((E=s.bootstrap)==null||(E=E.featureFlags)==null?void 0:E[S])||!1,k},{}),j=Object.keys(((y=s.bootstrap)==null?void 0:y.featureFlagPayloads)||{}).filter(k=>_[k]).reduce((k,S)=>{var E,T;return(E=s.bootstrap)!=null&&(E=E.featureFlagPayloads)!=null&&E[S]&&(k[S]=(T=s.bootstrap)==null||(T=T.featureFlagPayloads)==null?void 0:T[S]),k},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:j})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Hy,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(dd());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(Bl,"anonymous")}return Mr(qe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),s.segment?dge(this,()=>this.Cs()):this.Cs(),Fo(this.config._onCapture)&&this.config._onCapture!==TE&&(Ut.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",k=>this.config._onCapture(k.event,k))),this.config.ip&&Ut.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}Re(t){var s,n,a,o,i,l,c,u;if(!$t||!$t.body)return Ut.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Re(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ps(t.supportedCompression,Yl.GZipJS)?Yl.GZipJS:Ps(t.supportedCompression,Yl.Base64)?Yl.Base64:void 0),(s=t.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.$s?this.$s:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(t),(a=this.sessionRecording)==null||a.onRemoteConfig(t),(o=this.autocapture)==null||o.onRemoteConfig(t),(i=this.heatmaps)==null||i.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(t),(c=this.exceptionObserver)==null||c.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(t)}Cs(){try{this.config.loaded(this)}catch(t){Ut.critical("`loaded` function failed",t)}this.Fs(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Os()},1),new Wge(this).load(),this.featureFlags.flags()}Fs(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this.Ps)==null||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||jd(this.__request_queue,t=>this.Rs(t)),this.__request_queue=[],this.Fs()}_handle_unload(){var t,s;this.config.request_batching?(this.As()&&this.capture("$pageleave"),(t=this.Ps)==null||t.unload(),(s=this.Ts)==null||s.unload()):this.As()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Pe(t){this.__loaded&&(qz?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=lj(t.url,{ip:this.config.ip?1:0}),t.headers=Ot({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,
658(s=>{var n,a,o,i=Ot({},s);i.timeout=i.timeout||6e4,i.url=lj(i.url,{_:new Date().getTime().toString(),ver:Gl.LIB_VERSION,compression:i.compression});var l=(n=i.transport)!==null&&n!==void 0?n:"fetch",c=(a=(o=$q(Rx,u=>u.transport===l))==null?void 0:o.method)!==null&&a!==void 0?a:Rx[0].method;if(!c)throw new Error("No available transport method");c(i)})(Ot({},t,{callback:s=>{var n,a;this.rateLimiter.checkForLimiting(s),s.statusCode>=400&&((n=(a=this.config).on_request_error)==null||n.call(a,s)),t.callback==null||t.callback(s)}}))))}Rs(t){this.Ts?this.Ts.retriableRequest(t):this.Pe(t)}_execute_array(t){var s,n=[],a=[],o=[];jd(t,l=>{l&&(s=l[0],kr(s)?o.push(l):Fo(l)?l.call(this):kr(l)&&s==="alias"?n.push(l):kr(l)&&s.indexOf("capture")!==-1&&Fo(this[s])?o.push(l):a.push(l))});var i=function(l,c){jd(l,function(u){if(kr(u[0])){var f=c;ur(u,function(h){f=f[h[0]].apply(f,h.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};i(n,this),i(a,this),i(o,this)}Ms(){var t,s;return((t=this.config.bootstrap)==null?void 0:t.featureFlags)&&Object.keys((s=this.config.bootstrap)==null?void 0:s.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,s,n){var a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ps){if(!this.consent.isOptedOut())if(!At(t)&&Hr(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){s!=null&&s.$current_url&&!Hr(s==null?void 0:s.$current_url)&&(Ut.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),s==null||delete s.$current_url),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 i=new Date,l=(n==null?void 0:n.timestamp)||i,c=dd(),u={uuid:c,event:t,properties:this.calculateEventProperties(t,s||{},l,c)};o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n!=null&&n.$set&&(u.$set=n==null?void 0:n.$set);var f,h,g=this.Ds(n==null?void 0:n.$set_once);if(g&&(u.$set_once=g),(u=Xhe(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,At(n==null?void 0:n.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=i),t===jS.DISMISSED||t===jS.SENT){var v=s==null?void 0:s[RL.SURVEY_ID],y=s==null?void 0:s[RL.SURVEY_ITERATION];localStorage.setItem((h=""+CE+(f={id:v,current_iteration:y}).id,f.current_iteration&&f.current_iteration>0&&(h=""+CE+f.id+"_"+f.current_iteration),h),"true"),u.$set=Ot({},u.$set,{[qge({id:v,current_iteration:y},t===jS.SENT?"responded":"dismissed")]:!0})}var _=Ot({},u.properties.$set,u.$set);if(Vf(_)||this.setPersonPropertiesForFlags(_),!Xs(this.config.before_send)){var j=this.Ls(u);if(!j)return;u=j}this.ys.emit("eventCaptured",u);var w={method:"POST",url:(a=n==null?void 0:n._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Rs(w):this.Ps.enqueue(w),u}Ut.critical("This capture call is ignored due to client rate limiting.")}}else Ut.error("No event name provided to posthog.capture")}else Ut.uninitializedWarning("posthog.capture")}Ve(t){return this.on("eventCaptured",s=>t(s.event,s))}calculateEventProperties(t,s,n,a,o){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return s;var i=o?void 0:this.persistence.remove_event_timer(t),l=Ot({},s);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.config.__preview_experimental_cookieless_mode&&(l.$cookieless_mode=!0),t==="$snapshot"){var c=Ot({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!Hr(l.distinct_id)&&!ra(l.distinct_id)||rE(l.distinct_id))&&Ut.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,f=Dge(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(o,n.getTime());l.$session_id=h,l.$window_id=g}this.sessionPropsManager&&Kr(l,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&Kr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(v=this.Ts)==null?void 0:v.length}catch(w){l.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===cx.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||o?t!=="$pageleave"||o?this.pageViewM
658anager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,a),l=Kr(l,u),t==="$pageview"&&$t&&(l.title=$t.title),!At(i)){var y=n.getTime()-i;l.$duration=parseFloat((y/1e3).toFixed(3))}Ma&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Kr({},f,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),kr(this.config.property_denylist)?ur(this.config.property_denylist,function(w){delete l[w]}):Ut.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Ut.error("sanitize_properties is deprecated. Use before_send instead"),l=_(l,t));var j=this.js();return l.$process_person_profile=j,j&&!o&&this.Ns("_calculate_event_properties"),l}Ds(t){var s;if(!this.persistence||!this.js()||this.bs)return t;var n=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),o=Kr({},n,a||{},t||{}),i=this.config.sanitize_properties;return i&&(Ut.error("sanitize_properties is deprecated. Use before_send instead"),o=i(o,"$set_once")),this.bs=!0,Vf(o)?void 0:o}register(t,s){var n;(n=this.persistence)==null||n.register(t,s)}register_once(t,s,n){var a;(a=this.persistence)==null||a.register_once(t,s,n)}register_for_session(t){var s;(s=this.sessionPersistence)==null||s.register(t)}unregister(t){var s;(s=this.persistence)==null||s.unregister(t)}unregister_for_session(t){var s;(s=this.sessionPersistence)==null||s.unregister(t)}zs(t,s){this.register({[t]:s})}getFeatureFlag(t,s){return this.featureFlags.getFeatureFlag(t,s)}getFeatureFlagPayload(t){var s=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(s)}catch{return s}}isFeatureEnabled(t,s){return this.featureFlags.isFeatureEnabled(t,s)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,s,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,s,n)}getEarlyAccessFeatures(t,s,n){return s===void 0&&(s=!1),this.featureFlags.getEarlyAccessFeatures(t,s,n)}on(t,s){return this.ys.on(t,s)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var s,n;return(s=(n=this.sessionManager)==null?void 0:n.onSessionId(t))!==null&&s!==void 0?s:()=>{}}getSurveys(t,s){s===void 0&&(s=!1),this.surveys.getSurveys(t,s)}getActiveMatchingSurveys(t,s){s===void 0&&(s=!1),this.surveys.getActiveMatchingSurveys(t,s)}renderSurvey(t,s){this.surveys.renderSurvey(t,s)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,s){return s===void 0&&(s=!1),this.surveys.canRenderSurveyAsync(t,s)}identify(t,s,n){if(!this.__loaded||!this.persistence)return Ut.uninitializedWarning("posthog.identify");if(ra(t)&&(t=t.toString(),Ut.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Ut.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==Hy){if(this.Ns("posthog.identify")){var a=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var o=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}t!==a&&t!==this.get_property(tx)&&(this.unregister(tx),this.register({distinct_id:t}));var i=(this.persistence.get_property(Bl)||"anonymous")==="anonymous";t!==a&&i?(this.persistence.set_property(Bl,"identified"),this.setPersonPropertiesForFlags(Ot({},n||{},s||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:s||{},$set_once:n||{}}),this.xs=_L(t,s,n),this.featureFlags.setAnonymousDistinctId(a)):(s||n)&&this.setPersonProperties(s,n),t!==a&&(this.reloadFeatureFlags(),this.unregister(Q_))}}else Ut.critical('The string "'+Hy+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ut.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,s){if((t||s)&&this.Ns("posthog.setPersonProperties")){var n=_L(this.get_distinct_id(),t,s);this.xs!==n?(this.setPersonPropertiesForFlags(Ot({},s||{},t||{})),this.capture("$set",{$set:t||{},$set_once:s||{}}),this.xs=n):Ut.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,s,n){if(t&&s){if(this.Ns("posthog.group")){var a=this.getGroups();a[t]!==s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Ot({},a,{[t]:s})}),n&&(this.capture("$groupidentify",{$group_type:t,$group_key:s,$group_set:n}),this.setGroupPropertiesForFlags({[t]:n})),a[t]===s||n||this.reloadFeatureFlags()}}else Ut.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,s){s===void 0&&(s=!0),this.featureFlags.setPersonPropertiesForFlags(t,s)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,s){s===void 0&&(s=!0),this.Ns("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,s)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var s,n,a,o;if(Ut.info("reset"),!this.__loaded)return Ut.uninitializedWarning("posthog.reset");var i=this.get_property("$device_id");if(this.consent.reset(),(s=this.persistence)==null||s.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(a=this.persistence)==null||a.set_property(Bl,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.xs=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Hy,$device_id:null},"");else{var l=this.config.get_device_id(dd());this.register_once({distinct_id:l,$device_id:t?l:i},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:s,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+s);if(t!=null&&t.withTimestamp&&n){var o,i=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!n)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return a}
658alias(t,s){return t===this.get_property(Uq)?(Ut.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ns("posthog.alias")?(At(s)&&(s=this.get_distinct_id()),t!==s?(this.zs(tx,t),this.capture("$create_alias",{alias:t,distinct_id:s})):(Ut.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var s=Ot({},this.config);if(zr(t)){var n,a,o,i,l;Kr(this.config,LL(t));var c=this.Is();(n=this.persistence)==null||n.update_config(this.config,s,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yS(Ot({},this.config,{persistence:"sessionStorage"}),c),yn.O()&&yn.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Gl.DEBUG=!0,Ut.info("set_config",{config:t,oldConfig:s,newConfig:Ot({},this.config)})),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(i=this.heatmaps)==null||i.startIfEnabled(),this.surveys.loadIfEnabled(),this.Us(),(l=this.externalIntegrations)==null||l.startIfEnabledOrStop()}}startSessionRecording(t){var s=t===!0,n={sampling:s||!(t==null||!t.sampling),linked_flag:s||!(t==null||!t.linked_flag),url_trigger:s||!(t==null||!t.url_trigger),event_trigger:s||!(t==null||!t.event_trigger)};if(Object.values(n).some(Boolean)){var a,o,i,l,c;(a=this.sessionManager)==null||a.checkAndGetSessionAndWindowId(),n.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),n.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),n.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),n.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,s){var n=new Error("PostHog syntheticException");return this.exceptions.sendExceptionEvent(Ot({},Dme((a=>a instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:n}),s))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var s;return(s=this.persistence)==null?void 0:s.props[t]}getSessionProperty(t){var s;return(s=this.sessionPersistence)==null?void 0:s.props[t]}toString(){var t,s=(t=this.config.name)!==null&&t!==void 0?t:$f;return s!==$f&&(s=$f+"."+s),s}_isIdentified(){var t,s;return((t=this.persistence)==null?void 0:t.get_property(Bl))==="identified"||((s=this.sessionPersistence)==null?void 0:s.get_property(Bl))==="identified"}js(){var t,s;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Vf(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[tx])&&((s=this.persistence)==null||(s=s.props)==null||!s[ej]))}As(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.js()||this.Ns("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Ns(t){return this.config.person_profiles==="never"?(Ut.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.zs(ej,!0),!0)}Is(){var t=this.consent.isOptedOut(),s=this.config.opt_out_persistence_by_default;return this.config.disable_persistence||t&&!!s}Us(){var t,s,n,a,o=this.Is();return((t=this.persistence)==null?void 0:t.Ae)!==o&&((n=this.persistence)==null||n.set_disabled(o)),((s=this.sessionPersistence)==null?void 0:s.Ae)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o}opt_in_capturing(t){var s;this.consent.optInOut(!0),this.Us(),(At(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((s=t==null?void 0:t.captureEventName)!==null&&s!==void 0?s:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Os()}opt_out_capturing(){this.consent.optInOut(!1),this.Us()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.Us()}_is_bot(){return lo?Bz(lo,this.config.custom_blocked_useragents):void 0}Os(){$t&&($t.visibilityState==="visible"?this.ws||(this.ws=!0,this.capture("$pageview",{title:$t.title},{send_instantly:!0}),this.Ss&&($t.removeEventListener("visibilitychange",this.Ss),this.Ss=null)):this.Ss||(this.Ss=this.Os.bind(this),Mr($t,"visibilitychange",this.Ss)))}debug(t){t===!1?(qe==null||qe.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(qe==null||qe.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}I(){var t,s,n,a,o,i,l,c=this.ks||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Ut.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):(n="advanced_disable_decide",a=!1,o=Ut,i=(s="advanced_disable_flags")in(t=c)&&!At(t[s]),l=n in t&&!At(t[n]),i?t[s]:l?(o&&o.warn("Config field '"+n+"' is deprecated. Please use '"+s+"' instead. The old field will be removed in a future major version."),t[n]):a)}Ls(t){if(Xs(this.config.before_send))return t;var s=kr(this.config.before_send)?this.config.before_send:[this.config.before_send],n=t;for(var a of s){if(n=a(n),Xs(n)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Yhe(t.event)?Ut.warn(o+". This can cause unexpected behavior."):Ut.info(o),null}n.properties&&!Vf(n.properties)||Ut.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var t;
658return(t=this.pageViewManager.ce)==null?void 0:t.pageViewId}captureTraceFeedback(t,s){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:s})}captureTraceMetric(t,s,n){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:s,$ai_metric_value:String(n)})}}(function(e,t){for(var s=0;s<t.length;s++)e.prototype[t[s]]=Jhe(e.prototype[t[s]])})(Ew,["identify"]);var DL,sa=(DL=Ax[$f]=new Ew,function(){function e(){e.done||(e.done=!0,qz=!1,ur(Ax,function(t){t._dom_loaded()}))}$t!=null&&$t.addEventListener?$t.readyState==="complete"?e():Mr($t,"DOMContentLoaded",e,{capture:!1}):qe&&Ut.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),DL);const Tw="reqres_attribution",Rw="reqres_attribution_ts",RE="reqres_first_seen",AE="reqres_anon_id",PE="rr_ph_identified_user",dxe="rr_ph_debug",IE="ph_distinct_id",ME="rr_ph_xdomain_alias",uxe=1e3*60*60*24*30,Uf=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],zz={page_view:["path","referrer_domain",...Uf],cta_clicked:["cta_id","cta_label","location","path",...Uf],legacy_console_used:["endpoint","method","has_api_key","path",...Uf],playground_viewed:[],playground_request_sent:["method","endpoint_category"],playground_request_succeeded:["method","endpoint_category","status_group","status_code","path","has_api_key","api_key_included_in_request"],playground_request_failed:["method","endpoint_category","status_group","status_code","path","has_api_key","api_key_included_in_request","error_message"],signup_started:["path",...Uf],signup_completed:["path","method",...Uf],onboarding_modal_shown:["version"],onboarding_completed:["version","persona_goal","persona_role","persona_urgency","persona_team_size","stack_framework"],api_key_created:["key_type","plan_tier"],project_created:["template_used","is_second_project","creation_method","has_starter_project","plan_tier"],collection_created:["env","plan_tier"],record_created:["env","write_mode","payload_empty","plan_tier"],record_create_attempted:["source","write_mode","plan_tier"],app_user_invited:["env","invite_method","plan_tier"],session_token_verified:["env","plan_tier"],logs_viewed:["env","project_scoped","filters_used","plan_tier"],aha_waiting_shown:["project_id","has_api_key","persona_track","plan_tier"],aha_request_seen:["project_id","status","method","path_type","time_seconds","plan_tier"],aha_copy_curl_clicked:["project_id","has_first_request","plan_tier"],logs_empty_cta_clicked:["project_id","cta_type","plan_tier"],logs_fix_suggestion_shown:["status_code","path_type","suggestion_type","plan_tier"],logs_fix_copy_clicked:["cta_type","status_code","plan_tier"],logs_quick_filter_clicked:["filter","plan_tier"],write_mode_changed:["mode","project_id","plan_tier"],app_user_use_clicked:["app_user_id","project_id","env","plan_tier"],app_user_flow_completed:["app_user_id","project_id","env","plan_tier"],auth_confusion_detected:["type","path","expected_auth","plan_tier"],limit_warning_shown:["used","limit","remaining","reset_at","surface","tier","warning_level"],limit_hit:["used","limit","remaining","reset_at","surface","tier","endpoint"],upgrade_viewed:["source","stage","has_starter_project","second_project_exists","days_since_signup","segment","plan_tier"],upgrade_plan_selected:["plan_code","interval","lane","source"],upgrade_more_plans_opened:[],reason_banner_shown:["reason","plan","source"],billing_default_applied:["interval","lane"],project_deleted:["project_id","is_starter","surface"],starter_reseed_clicked:[],upgrade_page_abandoned:["source","time_on_page_seconds","plan_tier","saw_plans","max_scroll_pct"],education_callout_clicked:["source"],upgrade_clicked:["source","current_tier"],checkout_started:["plan_code","interval","source"],checkout_completed:["plan_code","interval","amount","currency","source"],post_checkout_cta_clicked:["cta"],starter_project_seeded:["project_id","project_slug"],starter_project_first_request:["project_id","status","latency"],starter_project_customised:["action","project_id"],starter_project_deleted:["project_id"],dashboard_stage_viewed:["stage","is_v2_starter","has_collections","has_records","first_request_found","project_count","is_paid","plan_tier"],dashboard_stage_changed:["from_stage","to_stage","days_in_previous_stage","plan_tier"],starter_hero_viewed:["project_id","project_name","plan_tier"],starter_hero_next_action:["action","project_id","seconds_since_fetch","plan_tier"],starter_fetch_clicked:["project_id"],starter_fetch_succeeded:["project_id","record_count"],starter_code_copied:["snippet_type","project_id"],starter_build_own_clicked:["cta","project_id"],starter_record_edited:["project_id","collection_name"],starter_record_added:["project_id","collection_name","record_count_after"],starter_record_deleted:["project_id","collection_name","record_count_after"],starter_crud_section_viewed:["project_id"],starter_snippet_tab_changed:["tab","project_id"],checklist_item_clicked:["item","was_completed","items_completed","items_total","plan_tier"],request_failed:["surface","status_code","error_code","path"],welcome_shown:["has_api_key","has_project"],welcome_key_copied:["source"],welcome_classic_request_sent:[],welcome_classic_request_succeeded:["status_code"],welcome_classic_request_failed:["error","status_code"],welcome_backend_request_sent:[],welcome_backend_request_succeeded:["status_code","record_count"],welcome_backend_request_failed:["error","status_code"],welcome_scroll_to_step2:[],welcome_scroll_nudge_shown:[],welcome_playground_clicked:[],welcome_project_clicked:[],welcome_dismissed:[],playground_request_proxied:["method","endpoint_category","status_code","status_group","path","trigger"],sidebar_upgrade_nudge_clicked:["plan_tier"],onboarding_role_selected:["persona_role"],onboarding_context_selected:["persona_context","persona_role"],onboarding_work_cta:["clicked"],upgrade_lane_assigned:["lane","detection_method","source"],upgrade_lane_switched:["from_lane","to_lane","source"],upgrade_chooser_shown:["source"],lite_upsell_shown:["surface","source"],lite_upsell_clicked:["surface","source","destination"],pack_offer_shown:["surface","source"],pack_offer_clicked:["surface","source","destination"],pack_purchase_landed:["stripe_session_id"],billing_page_viewed:["tier","billingState","status"],billing_manage_clicked:["intent","tier","billingState"],billing_upgrade_clicked:["tier","billingState"]},pxe=new Set(["template_preview","template_deploy_success","template_deploy_failed","template_deploy_started","endpoint_created","endpoint_tested","data_explorer_viewed","upgrade_clicked","checkout_started","share_clicked","usage_warning_shown","feature_locked_clicked","first_template_deployed","abandoned_checkout"]),fxe=new Set(["page_view","cta_clicked","legacy_console_used","signup_started","signup_completed"]);let OE=!1,dx=null,nd,ad=null,qu=!1,Oo=!1,$L=null,UL=0;const Pn=()=>typeof window<"u",hxe=()=>{if(!Pn())return!1;try{return localStorage.getItem(dxe)==="true"}catch{return!1}},mxe=()=>{if(!Pn())return null;try{const s=localStorage.getItem(AE);if(s)return s}catch{}const e=typeof crypto<"u"?crypto:null,t=e&&typeof e.randomUUID=="function"?e.randomUUID():`anon_${Date.now()}`;try{localStorage.setItem(AE,t)}catch{}return t},FL=250,gxe=new Set(["email","name","first_name","last_name","full_name","message","password","authorization","headers"]),xxe=["token","api_key","apikey","authorization","password","headers"],vxe=["pro_","pub_","free_user_"],bxe=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+$/,yxe=e=>{const t=e.toLowerCase();return gxe.has(t)?!0:xxe.some(s=>t.includes(s))},_xe=e=>!!(vxe.some(t=>e.startsWith(t))||bxe.test(e)||/^Bearer\\s+/i.test(e)),Hz=e=>{if(!e)return;const t=e.trim();if(t&&!_xe(t))return t.length>FL?`${t.slice(0,FL)}â¦`:t},jxe=e=>{if(!e)return;const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(!t)return;const s=t.replace(/Bearer\\s+[A-Za-z0-9-_.]+/gi,"Bearer [redacted]").replace(/(pro_|pub_|free_user_)[A-Za-z0-9]+/gi,"[redacted]");return Hz(s)},wxe=e=>{if(e!=null){if(typeof e=="string")return Hz(e);if(typeof e=="number"||typeof e=="boolean")return e;if(e instanceof Date)return e.toISOString();if(e instanceof Error)return jxe(e);Array.isArray(e)}},Xc=e=>{const t={};return e&&Object.entries(e).forEach(([s,n])=>{if(!s||yxe(s))return;const a=wxe(n);a!==void 0&&(t[s]=a)}),t},Nxe=e=>{if(!e)return null;try{return new URL(e,window.location.origin).pathname||"/"}catch{const[t]=e.split("?");return t.split("#")[0]||null}},kxe=()=>
658{if(!Pn()||!document.referrer)return null;try{return new URL(document.referrer).hostname||null}catch{return null}},BL=e=>{if(!e)return null;const t=e.trim();return!t||t.length>200?null:t},qL=()=>{if(Pn())try{const e=new URL(window.location.href);if(!e.searchParams.has(IE))return;e.searchParams.delete(IE);const t=`${e.pathname}${e.search}${e.hash}`;window.history.replaceState({},"",t)}catch{}},Sxe=()=>{if(!Pn()||!Oo)return;const e=new URL(window.location.href),t=BL(e.searchParams.get(IE));if(!t)return;const s=BL(dR()||null);try{if(localStorage.getItem(ME)===t){qL();return}}catch{}if(s&&s!==t)try{sa.alias(t,s)}catch(n){console.warn("PostHog cross-domain alias skipped",n)}try{sa.identify(t)}catch(n){console.warn("PostHog cross-domain identify skipped",n)}try{localStorage.setItem(ME,t)}catch{}qL()},Cxe=(e,t)=>{const s=zz[e];if(!s)return t;const n={};return s.forEach(a=>{t[a]!==void 0&&(n[a]=t[a])}),n},Exe=()=>{if(Pn())try{ad=localStorage.getItem(RE),ad||(ad=new Date().toISOString(),localStorage.setItem(RE,ad))}catch{ad=new Date().toISOString()}},Txe=()=>{if(!Pn())return null;const e=new URLSearchParams(window.location.search),t={utm_source:e.get("utm_source"),utm_medium:e.get("utm_medium"),utm_campaign:e.get("utm_campaign"),utm_term:e.get("utm_term"),utm_content:e.get("utm_content")};return Object.values(t).some(n=>n!==null)?t:null},Rxe=e=>{if(Pn())try{localStorage.setItem(Tw,JSON.stringify(e)),localStorage.setItem(Rw,String(Date.now()))}catch{}},Vz=()=>{if(Pn())try{localStorage.removeItem(Tw),localStorage.removeItem(Rw)}catch{}},Gz=()=>{if(!Pn())return null;try{const e=localStorage.getItem(Tw),t=localStorage.getItem(Rw);if(!e||!t)return null;const s=Number(t);if(!Number.isFinite(s)||Date.now()-s>uxe)return Vz(),null;const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}},Axe=()=>{const e=Gz();if(!e)return{};const t=Xc(e),s={};return Uf.forEach(n=>{t[n]!==void 0&&(s[n]=t[n])}),s},Pxe=()=>{if(!Pn())return;const e=Txe();if(e){Rxe(e);return}Gz()},Wz=()=>{if(!Pn())return null;try{return localStorage.getItem(PE)}catch{return null}},zL=e=>{if(Pn())try{e?localStorage.setItem(PE,e):localStorage.removeItem(PE)}catch{}},dR=()=>{var e;try{return(e=sa.get_distinct_id)==null?void 0:e.call(sa)}catch{return}},dj=e=>{if(!qu)return;const t={stage:e,distinctId:dR(),storedUser:Wz(),currentUserId:dx,plan_tier:nd};console.info("[analytics health]",t)},Ixe=e=>{const t={env:"prod"};return nd&&(t.plan_tier=nd),ad&&(t.first_seen=ad),{...t,...e}},Yz=()=>{if(!Pn()||OE)return;qu=hxe();const e="phc_NrJczFx5WV2TAzo2YWa3fMmalFDTuTfl3MfZVtjW7Of";{const t={api_host:"https://eu.i.posthog.com",person_profiles:"identified_only",capture_pageview:!1,capture_pageleave:!1,autocapture:!1,web_vitals:!1,persistence:"localStorage+cookie",cross_subdomain_cookie:!0,cookie_domain:".reqres.in",session_recording:{recordCrossOriginIframes:!1},loaded:s=>{qu&&s.debug(),Oo=!0,dj("loaded")}};sa.init(e,t),Oo=!0}if(Sxe(),Pxe(),Exe(),Pn()){const t=window;t.__rrTrackTest||(t.__rrTrackTest=()=>{Z.track("cta_clicked",{cta_id:"rr_track_test",cta_label:"RR Track Test",location:"app",path:window.location.pathname})})}OE=!0,dj("init")},Hc=()=>{OE||Yz()},Z={init:Yz,clearAttribution:Vz,identify:(e,t={})=>{var c;if(!e)return;Hc();const s=Wz(),n=dR();nd=(t.plan_tier??t.planTier)||nd;const o=Xc({plan_tier:nd,created_at:t.created_at??t.createdAt,first_seen_at:ad}),i=s===e&&n===e;if(Oo&&n&&n!==e&&s!==e)try{sa.alias(e,n)}catch(u){console.warn("PostHog alias skipped",u)}Oo&&(i?Object.keys(o).length&&sa.setPersonProperties(o):sa.identify(e,o)),dx=e,zL(e),(c=t.org)!=null&&c.id&&Z.group("org",t.org.id,{org_name:t.org.name,org_slug:t.org.slug,plan_tier:t.org.plan_tier,seats:t.org.seats}),dj("identify")},alias:(e,t)=>{if(Hc(),!!Oo)try{sa.alias(e,t)}catch(s){console.warn("Alias failed",s)}},group:(e,t,s)=>{if(Hc(),!(!e||!t||!Oo))try{sa.group(e,t,Xc(s))}catch(n){console.warn("PostHog group skipped",n)}},reset:()=>{try{Oo&&sa.reset()}catch(e){console.warn("PostHog reset skipped",e)}dx=null,nd=void 0,zL(null),Pn()&&(localStorage.removeItem(Tw),localStorage.removeItem(Rw),localStorage.removeItem(RE),localStorage.removeItem(AE
658),localStorage.removeItem(ME))},page:(e,t)=>{if(Hc(),!Pn())return;const s=`${window.location.pathname}${window.location.search}`,n=Date.now();if($L===s&&n-UL<750)return;$L=s,UL=n;const a={path:e||Nxe(window.location.href)||window.location.pathname,referrer_domain:kxe(),...Xc(t)};qu&&console.info("[analytics] page",a),qu&&console.info("[analytics] page_view skipped (GA4 handles this)")},track:(e,t)=>{if(Hc(),!Pn())return;const s=!!zz[e],n=pxe.has(e),a=fxe.has(e)?Axe():{},o=Xc(t),i={...Ixe(),...o,...a},l=Cxe(e,i);if(qu&&console.info("[analytics] track",e,l),s)try{Oo&&(sa.capture(e,l),(e==="signup_completed"||e==="session_token_verified"||e==="record_created")&&dj(`capture:${e}`))}catch{console.log("PostHog event tracking skipped:",e)}else qu&&console.info("[analytics] skipped non-canonical event",e);if(n){const c=dx?null:mxe();Z.sendToBackend(e,o,{userId:dx,anonymousId:c}).catch(u=>{console.warn("Failed to send event to backend:",u)})}},sendToBackend:async(e,t,s)=>{try{const{api:n}=await se(async()=>{const{api:a}=await Promise.resolve().then(()=>Fhe);return{api:a}},[]);await n.post("/events",{event:e,properties:Xc(t),userId:(s==null?void 0:s.userId)??null,anonymousId:(s==null?void 0:s.anonymousId)??null})}catch(n){console.warn("Backend event tracking failed:",n)}},setSessionProperties:e=>{Hc();try{Oo&&sa.register(Xc(e))}catch{console.log("PostHog setSessionProperties skipped")}},setUserProperties:e=>{Hc();try{Oo&&sa.setPersonProperties(Xc(e))}catch{console.log("PostHog setUserProperties skipped")}},setPlanTier:e=>{nd=e||void 0,e&&Z.setUserProperties({plan_tier:e})},isFeatureEnabled:e=>{Hc();try{if(Oo)return sa.isFeatureEnabled(e)||!1}catch{console.log("PostHog isFeatureEnabled skipped")}return!1},templatePreview:(e,t,s)=>{Z.track("template_preview",{template_id:e,template_name:t,template_category:s})},templateDeployStarted:(e,t,s)=>{Z.track("template_deploy_started",{template_id:e,template_name:t,project_slug:s})},templateDeploySuccess:(e,t,s,n)=>{Z.track("template_deploy_success",{template_id:e,template_name:t,project_slug:s,project_id:n})},templateDeployFailed:(e,t,s)=>{Z.track("template_deploy_failed",{template_id:e,template_name:t,error:s})},endpointCreated:(e,t,s)=>{Z.track("endpoint_created",{method:e,path:t,project_id:s})},endpointTested:(e,t,s,n)=>{Z.track("endpoint_tested",{endpoint_id:e,method:t,path:s,status_code:n})},dataExplorerViewed:()=>{Z.track("data_explorer_viewed")},codeBlockCopied:(e,t)=>{Z.track("code_copied",{source:e,language:t||"javascript"})},upgradeClicked:(e,t)=>{Z.track("upgrade_clicked",{source:e,current_tier:t})},checkoutStarted:(e,t,s)=>{Z.track("checkout_started",{plan_code:e,interval:s,source:t})},checkoutCompleted:(e,t)=>{Z.track("checkout_completed",{plan_code:e,amount:t})},shareClicked:(e,t)=>{Z.track("share_clicked",{share_type:e,item_id:t})},searchPerformed:(e,t,s)=>{Z.track("search_performed",{query:e,results_count:t,source:s})},filterApplied:(e,t,s)=>{Z.track("filter_applied",{filter_type:e,filter_value:t,source:s})},usageWarningShown:(e,t,s)=>{Z.track("usage_warning_shown",{warning_type:e,usage_percentage:Math.round(t/s*100),usage:t,limit:s})},upgradePromptShown:(e,t)=>{Z.track("upgrade_prompt_shown",{source:e,current_tier:t})},featureLockedClicked:(e,t)=>{Z.track("feature_locked_clicked",{feature:e,current_tier:t})},poweredByClicked:e=>{Z.track("powered_by_clicked",{source:e})},templateForked:(e,t)=>{Z.track("template_forked",{template_id:e,template_name:t})},dataPersisted:(e,t)=>{Z.track("data_persisted",{endpoint_path:e,data_size:t})},firstTemplateDeployed:(e,t)=>{Z.track("first_template_deployed",{template_id:e,template_name:t})},firstCustomEndpointCreated:(e,t)=>{Z.track("first_custom_endpoint_created",{method:e,path:t})},shareTemplate:(e,t,s)=>{Z.track("share_template",{template_id:e,template_name:t,platform:s})},shareProject:(e,t,s)=>{Z.track("share_project",{project_id:e,project_slug:t,platform:s})},enterpriseInquiry:(e,t,s)=>{Z.track("enterprise_inquiry",{company:e,email:t,message:s})},onboardingStarted:()=>{Z.track("onboarding_started")},onboardingCompleted:e=>{Z.track("onboarding_completed",{steps_completed:e})},dashboardViewed:e=>{Z.track("dashboard_viewed",{time_spent:e})},documentationViewed:e=>{Z.track("documentation_viewed",{section:e})},apiError:(e,t,s)=>{Z.track("api_error",{endpoint:e,status_code:t,error:s})},featureUsed:(e,t)=>{Z.track("feature_used",{feature:e,context:t})},firstCollectionCreated:e=>{Z.track("first_collection_created",e)},firstRecordCreated:e=>{Z.track("first_record_created",e)},firstExternalRequest:e=>{Z.track("first_external_request",e)},activationMilestone:e=>{Z.track("activation_milestone",e)},timeToFirstRequest:e=>{Z.track("time_to_first_request",e)},ahaWaitingShown:e=>{Z.track("aha_waiting_shown",e)},ahaRequestSeen:e=>{Z.track("aha_request_seen",e)},ahaCopyCurlClicked:e=>{Z.track("aha_copy_curl_clicked",e)},logsEmptyCtaClicked:e=>{Z.track("logs_empty_cta_clicked",e)},writeModeChanged:e=>{Z.track("write_mode_changed",e)},authConfusionDetected:e=>{Z.track("auth_confusion_detected",e)}},Ru=1,HL=`rr_onboarding_shown_v${Ru}`,wS="rr_onboarding_done_v1",Kz="rr_onboarding_modal_dismissed",NS="rr_onboarding_skipped",Mxe=e=>{if(!e||typeof e!="object")return;const t=e.stack_framework||e.framework||e.frontend||e.stack;
658if(typeof t=="string")return t;const s=e.tools;if(Array.isArray(s)&&typeof s[0]=="string")return s[0]},Oxe=()=>typeof window>"u"?!1:window.sessionStorage.getItem(Kz)==="true",VL=()=>{typeof window>"u"||window.sessionStorage.setItem(Kz,"true")};function Jz(){const{getToken:e,isLoaded:t}=zt(),[s,n]=x.useState(null),[a,o]=x.useState(!1),[i,l]=x.useState(!1),[c,u]=x.useState(!1),[f,h]=x.useState(null),g=x.useRef(!1),v=x.useMemo(()=>s?!!(s.completed_at||s.persona_goal):!1,[s]),y=x.useMemo(()=>!(!s||s.onboarding_version&&s.onboarding_version!==Ru||s.completed_at||s.persona_goal||typeof window<"u"&&localStorage.getItem(NS)==="true"),[s]),_=x.useCallback(()=>{typeof window>"u"||localStorage.setItem(wS,"true")},[]),j=x.useCallback(async()=>{if(t){o(!0),h(null);try{const A=await Ue(e);if(!A){o(!1);return}const{data:R}=await ue.get("/api/onboarding/status",{authToken:A});if(n(R),R.completed_at||R.persona_goal){_(),l(!1),u(!1);return}if(typeof window<"u"&&localStorage.getItem(wS)==="true"&&!R.completed_at&&!R.persona_goal&&localStorage.removeItem(wS),typeof window<"u"&&localStorage.getItem(NS)==="true"){l(!1),u(!1);return}if(Oxe()){u(!0),l(!1);return}l(!0)}catch(A){console.warn("Failed to load onboarding status",A),Ku(A),A instanceof yt||A instanceof Error?h(A.message):h("Unable to load onboarding status.")}finally{o(!1)}}},[e,t,_]);x.useEffect(()=>{j()},[j]),x.useEffect(()=>{if(!i||g.current)return;let A=!1;try{A=localStorage.getItem(HL)==="true"}catch{}if(A){g.current=!0;return}Z.track("onboarding_modal_shown",{version:Ru});try{localStorage.setItem(HL,"true")}catch{}g.current=!0},[i]);const w=x.useCallback(async A=>{const R=await Ue(e);if(!R)throw new Error("Missing auth token");o(!0),h(null);try{const{data:I}=await ue.post("/api/onboarding/complete",A,{authToken:R});n(I),_(),l(!1),u(!1);const L=Mxe(A.persona_stack??null);return Z.track("onboarding_completed",{version:Ru,persona_goal:A.persona_goal,persona_role:A.persona_role,persona_urgency:A.persona_urgency,persona_team_size:A.persona_team_size,stack_framework:L}),Z.setUserProperties({persona_goal:A.persona_goal,persona_role:A.persona_role,persona_urgency:A.persona_urgency,persona_team_size:A.persona_team_size,stack_framework:L}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(cv)),I}catch(I){Ku(I);const L=I instanceof yt||I instanceof Error?I.message:"Unable to complete onboarding.";h(L);return}finally{o(!1)}},[e,_]),k=x.useCallback(async A=>{const R=await Ue(e);if(R)try{const{data:I}=await ue.post("/api/onboarding/partial",A,{authToken:R});return n(I),Z.track("onboarding_partial_saved",{...A,version:Ru}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(cv)),I}catch(I){console.warn("Failed to save partial onboarding:",I),Ku(I)}},[e,_]),S=x.useCallback(async A=>{VL(),typeof window<"u"&&localStorage.setItem(NS,"true"),l(!1),u(!1),Z.track("onboarding_skipped",{step:A,onboarding_version:Ru})},[]),E=x.useCallback(()=>{l(!0),u(!1)},[]),T=x.useCallback(()=>{VL(),l(!1),u(!0)},[]);return{status:s,loading:a,error:f,showModal:i,shouldNudge:c,needsOnboarding:y,isGenuinelyDone:v,refreshStatus:j,openModal:E,closeModal:T,markComplete:w,markSkip:S,savePartial:k,onboardingVersion:Ru}}function bs({size:e="md",variant:t="spinner",text:s,textClassName:n="text-sm text-[var(--color-fg-faint)] animate-pulse",className:a=""}){const o={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"},i=()=>{switch(t){case"dots":return r.jsxs("div",{className:"flex space-x-1",children:[r.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce"}),r.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),r.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]});case"pulse":return r.jsx("div",{className:`${o[e]} bg-blue-600 rounded-full animate-pulse`});case"bars":return r.jsxs("div",{className:"flex space-x-1",children:[r.jsx("div",{className:"w-1 h-4 bg-blue-600 rounded animate-pulse"}),r.jsx("div",{className:"w-1 h-4 bg-blue-600 rounded animate-pulse",style:{animationDelay:"0.1s"}}),r.jsx("div",{className:"w-1 h-4 bg-blue-600 rounded animate-pulse",style:{animationDelay:"0.2s"}}),r.jsx("div",{className:"w-1 h-4 bg-blue-600 rounded animate-pulse",style:{animationDelay:"0.3s"}})]});case"rocket":return r.jsxs("div",{className:`${o[e]} relative`,children:[r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("span",{className:"text-2xl animate-bounce",style:{animationDuration:"1s"},children:"ð"})}),r.jsx("div",{className:"absolute inset-0 border-2 border-[var(--color-border-secondary)] border-t-blue-600 rounded-full animate-spin"})]});default:return r.jsx("div",{className:`${o[e]} border-2 border-[var(--color-border-secondary)] border-t-blue-600 rounded-full animate-spin`})}};return r.jsxs("div",{className:`flex items-center justify-center gap-2 ${a}`,children:[i(),s&&r.jsx("span",{className:n,children:s})]})}const Lxe=[{value:"qa",label:"API testing & QA",helper:"Mock endpoints, inspect logs, and run test flows.",inferredGoal:"qa_testing"},{value:"frontend_dev",label:"Building a frontend app",helper:"Wire a React/Next/Vite UI to real backend data.",inferredGoal:"client_only_app"},{value:"educator",label:"Teaching a class",helper:"Give students a real backend without servers.",inferredGoal:"education"},{value:"exploring",label:"Just exploring",helper:"Poke around and see what's here.",inferredGoal:"exploring"}],GL=new Set(["qa","frontend_dev","exploring"]),Dxe="https://reqres.in/commercial?src=onboarding_work";function Xz({open:e,status:t,version:s,loading:n=!1,onComplete:a,onSkip:o,onClose:i,onSavePartial:l}){const[c,u]=x.useState(1),[f,h]=x.useState(null),[g,v]=x.useState(!1),[y,_]=x.useState(null);if(x.useEffect(()=>{if(!e){u(1),h(null),v(!1),_(null);return}u(1),_(null)},[e,t]),!e)return null;const j=I=>({persona_goal:I.inferredGoal,persona_role:I.value}),w=async I=>{v(!0),_(null);try{await a(j(I))}catch(L){Ku(L),_((L==null?void 0:L.message)||"Could not save. Please try again."),v(!1)}},k=I=>{g||n||(h(I),Z.track("onboarding_role_selected",{persona_role:I.value}),l==null||l({persona_goal:I.inferredGoal,persona_role:I.value}),GL.has(I.value)?u(2):w(I))},S=async I=>{!f||g||(Z.track("onboarding_context_selected",{persona_context:I,persona_role:f.value}),l==null||l({persona_context:I}),I==="work"?u(3):await w(f))},E=async I=>{f&&(Z.track("onboarding_work_cta",{clicked:I}),I&&typeof window<"u"&&window.open(Dxe,"_blank","noopener"),await w(f))},T=()=>{Z.track("onboarding_modal_skipped",{step:c,onboarding_version:s}),o(c)},A=c===1?"What brings you to ReqRes?":c===2?"Is this for work or a personal project?":"Using ReqRes at work?",R=c===1?"One tap - we'll show you the right things first.":c===2?"Helps us point you at the right plan. No wrong answer.":"The free tier is for personal use. Company and team use is what the commercial licence covers.";return r.jsx("div",{className:"modal-overlay z-[70] items-start md:items-center overflow-hidden py-4 sm:py-8 min-h-screen",role:"dialog","aria-modal":"true","aria-labelledby":"onboarding-title",children:r.jsx("div",{className:"modal-content relative max-w-xl bg-[var(--color-bg-card)] backdrop-blur-xl border border-[var(--color-border-default)] shadow-[0_24px_80px_rgba(0,0,0,0.65)] w-full",children:r.jsxs("div",{className:"relative z-10 p-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{id:"onboarding-title",className:"text-xl font-semibold text-[var(--color-fg-default)]",children:A}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:R})]}),r.jsx("button",{type:"button",onClick:T,className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-2 text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-secondary)] transition","aria-label":"Skip",disabled:g,children:r.jsx(Ir,{className:"h-4 w-4"})})]}),c===1&&r.jsx("div",{className:"mt-5 grid grid-cols-1 sm:grid-cols-2 gap-3",children:Lxe.map(I=>{const L=(f==null?void 0:f.value)===I.value,M=g||n;return r.jsxs("button",{type:"button",onClick:()=>k(I),disabled:M,"aria-pressed":L,className:`text-left rounded-xl border bg-[var(--color-bg-alt)] px-4 py-4 transition ${L?"border-[var(--color-accent-blue)]/70 bg-[var(--color-accent-blue)]/10":"border-[var(--color-border-default)] hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)]"} disabled:opacity-60 disabled:cursor-wait`,children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:I.label}),r.jsx("p",{className:"mt-1 text-xs text-[var(--color-fg-muted)]",children:I.helper})]},I.value)})}),c===2&&r.jsxs("div",{className:"mt-5 grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>S("work"),disabled:g,className:"text-left rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-4 transition hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)] disabled:opacity-60 disabled:cursor-wait",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"For work"}),r.jsx("p",{className:"mt-1 text-xs text-[var(--color-fg-muted)]",children:"A project or product at my job or company."})]}),r.jsxs("button",{type:"button",onClick:()=>S("personal"),disabled:g,className:"text-left rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-4 transition hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)] disabled:opacity-60 disabled:cursor-wait",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Personal"}),r.jsx("p",{className:"mt-1 text-xs text-[var(--color-fg-muted)]",children:"A side project, learning, or just trying it out."})]})]}),c===3&&r.jsxs("div",{className:"mt-5",children:[r.jsx("div",{className:"rounded-xl border border-[var(--color-accent-blue)]/40 bg-[var(--color-accent-blue)]/10 px-4 py-4 text-sm text-[var(--color-fg-secondary)]",children:"If your team relies on ReqRes, the commercial licence covers use rights, higher limits, and priority support, payable by card or invoice. Not the person who owns that budget? The page has a one-click way to forward it to whoever does."}),r.jsxs("div",{className:"mt-4 flex flex-col sm:flex-row gap-3",children:[r.jsx("button",{type:"button",onClick:()=>E(!0),disabled:g,className:"flex-1 rounded-xl bg-[var(--color-accent-blue)] px-4 py-3 text-sm font-semibold text-white transition hover:opacity-90 disabled:opacity-60 disabled:cursor-wait",children:"See the commercial licence"}),r.jsx("button",{type:"button",onClick:()=>E(!1),disabled:g,className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-3 text-sm font-medium text-[var(--color-fg-secondary)] transition hover:text-[var(--color-fg-default)] disabled:opacity-60",children:"Maybe later"})]})]}),y?r.jsx("div",{className:"mt-4 rounded-lg border border-[var(--color-semantic-danger)]/40 bg-[var(--color-semantic-danger-bg)] px-3 py-2 text-sm text-[var(--color-semantic-danger)]",children:y}):null,r.jsxs("div",{className:"mt-5 flex items-center justify-between gap-3 text-xs text-[var(--color-fg-muted)]",children:[r.jsx("button",{type:"button",onClick:T,disabled:g,className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition disabled:opacity-50",children:"Skip"}),g||n?r.jsxs("span",{className:"inline-flex items-center gap-2 text-[var(--color-fg-secondary)]",children:[r.jsx(bs,{size:"sm",variant:"spinner"}),"Savingâ¦"]}):r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["Step ",c," of ",f&&GL.has(f.value)?3:1," · v",s]})]})]})})})}function Qz(e){var s;return((s=e==null?void 0:e.publicMetadata)==null?void 0:s.role)==="admin"}function e0({children:e}){const{user:t,isLoaded:s}=_r();return s?!t||!Qz(t)?r.jsxs("div",{className:"max-w-3xl mx-auto p-6 rounded-xl bg-[var(--color-bg-card)] border border-[var(--color-border-default)] shadow-lg",children:[r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)] mb-2",children:"Access denied"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"You need an admin role in Clerk public metadata to view this page. C
658ontact an administrator if you believe this is incorrect."})]}):r.jsx(r.Fragment,{children:e}):r.jsx("div",{className:"text-[var(--color-fg-default)] text-sm",children:"Checking admin accessâ¦"})}const $xe=["gmail.com","yahoo.com","hotmail.com","outlook.com","mail.ru","yandex.ru","rambler.ru","protonmail.com","icloud.com","live.com","aol.com","me.com","msn.com","zoho.com"];function Uxe(){var nt;const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),n=Wr(),[a,o]=x.useState(null),[i,l]=x.useState(!1),[c,u]=x.useState(!1),[f,h]=x.useState(null),[g,v]=x.useState(null),[y,_]=x.useState(null),[j,w]=x.useState(!1),[k,S]=x.useState(()=>["/custom-endpoints"].some(Ze=>n.pathname.startsWith(Ze))),[E,T]=x.useState(()=>{if(typeof window>"u")return new Set;try{const Ze=localStorage.getItem("navVisitedPaths");return new Set(Ze?JSON.parse(Ze):[])}catch{return new Set}}),{status:A}=_w(),R=KT(A),[I,L]=x.useState(()=>K_()),M=I??R,O=Jz(),[z,X]=x.useState(!1);x.useEffect(()=>Pq(()=>{L(K_())}),[]),x.useEffect(()=>{(async()=>{if(!t||!e){o(null);return}try{const he=await Ue(s);if(!he){o({hasPaid:!1,paymentMethod:"none",isActive:!1});return}const ke=await Td.getPaymentStatus({authToken:he});o(ke.data)}catch(he){console.error("Failed to fetch payment status:",he),o({hasPaid:!1,paymentMethod:"none",isActive:!1})}})()},[t,e,s]),x.useEffect(()=>{l(!1),["/custom-endpoints"].some(Ze=>n.pathname.startsWith(Ze))&&S(!0),T(Ze=>{const he=new Set(Ze);return he.add(n.pathname),typeof window<"u"&&localStorage.setItem("navVisitedPaths",JSON.stringify(Array.from(he))),he})},[n.pathname]),x.useEffect(()=>(i?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),()=>{document.body.classList.remove("sidebar-open")}),[i]),x.useEffect(()=>{const Ze=he=>{he.key==="Escape"&&l(!1)};return document.addEventListener("keydown",Ze),()=>document.removeEventListener("keydown",Ze)},[]),x.useEffect(()=>{if(!t||!e){h(null),v(null);return}let Ze=!0;return(async()=>{var ke,Ve,at,Pt,Ct,St,Xt,It;try{const ee=await Ue(s);if(!ee)return;const[We,wt]=await Promise.all([ue.get("/projects?limit=50",{authToken:ee}),ue.get("/logs?limit=10",{authToken:ee})]),_t=((ke=We.data)==null?void 0:ke.projects)||[],Ee=_t[0]||null;let He=0,ie=0,Ce=[],Ye=[];if(_t.length>0)try{const Ge=await Promise.all(_t.map(Tt=>Promise.all([ue.get(`/data-explorer/collections?project_id=${Tt.id}`,{authToken:ee}).catch(()=>({data:{data:[]}})),ue.get(`/data-explorer/stats?project_id=${Tt.id}`,{authToken:ee}).catch(()=>({data:{stats:null}})),ue.get(`/api/app-users?project_id=${Tt.id}&limit=5`,{authToken:ee}).catch(()=>({data:{data:[]}}))])));for(const[Tt,ss,Zt]of Ge){He+=(((Ve=Tt.data)==null?void 0:Ve.data)||[]).length;const re=(Pt=(at=ss.data)==null?void 0:at.stats)==null?void 0:Pt.totalDataItems;typeof re=="number"&&(ie=(ie??0)+re),Ce=Ce.concat(((Ct=Zt.data)==null?void 0:Ct.data)||[])}Ye=((St=(await ue.get(`/logs?project_id=${Ee.id}&limit=10`,{authToken:ee}).catch(()=>({data:{data:[]}}))).data)==null?void 0:St.data)||[]}catch(Ge){console.warn("Failed to load onboarding context",Ge)}const Pe=yw({hasProject:!!Ee,collectionCount:He,totalDataItems:ie,appUsers:Ce,projectLogs:Ye,logs:((Xt=wt.data)==null?void 0:Xt.data)||[]});Ze&&(h(Pe),v((Ee==null?void 0:Ee.id)??null),_((Ee==null?void 0:Ee.name)??null),w(!!((It=Ee==null?void 0:Ee.config)!=null&&It.is_starter&&(Ee.config.seeded_version??0)>=2)))}catch(ee){console.warn("Unable to fetch onboarding progress",ee)}})(),()=>{Ze=!1}},[s,t,e]);const W=x.useCallback(async Ze=>{await O.markComplete(Ze),X(!1),typeof window<"u"&&window.dispatchEvent(new CustomEvent(cv))},[O]),K=x.useCallback(async Ze=>{await O.markSkip(Ze),X(!1)},[O]);if(!t||!e)return null;const q=Qz(e),J=a==null?void 0:a.hasPaid,V=!((f==null?void 0:f.projectCreated)&&(f==null?void 0:f.hasCollection)&&(f==null?void 0:f.recordCreated)&&(f==null?void 0:f.requestMade))&&(j||!f||!f.projectCreated||!f.hasCollection||!f.recordCreated),$=Ze=>{for(const he of E)if(he===Ze||he.startsWith(`${Ze}/`))return!0;return!1},B=!!(f!=null&&f.hasCollection),ae=!!(f!=null&&f.requestMade),H=!!(f!=null&&f.hasAppUser),U=!!(f!=null&&f.recordCreated),oe=k,fe=M==="educator",Q=M==="frontend",le=
658M==="qa",we=(((nt=e==null?void 0:e.primaryEmailAddress)==null?void 0:nt.emailAddress)||"").split("@")[1]||"",Le=we&&!$xe.some(Ze=>we===Ze),xe=(a==null?void 0:a.plan)||"free",de=["team","scale","enterprise"].includes(xe),Me=Ze=>{const he=[];return g&&he.push(`projectId=${g}`),he.push(`tab=${Ze}`),he.length>0?`/data-explorer?${he.join("&")}`:"/data-explorer"},je=!!(f!=null&&f.requestMade),Ae=$("/projects"),Oe=j?[{label:`Backend ready - ${y||"starter project"}`,href:g?`/projects/${g}`:"/projects",icon:r.jsx(Or,{className:"w-5 h-5 text-emerald-400/60"}),completed:!0,badgeMuted:!0},{label:"Sample data loaded",href:Me("records"),icon:r.jsx(Or,{className:"w-5 h-5 text-emerald-400/60"}),matchPrefixes:["/data-explorer"],completed:!0,badgeMuted:!0},{label:"Try your API",href:"/console",icon:r.jsx(mo,{className:`w-5 h-5 ${je?"text-emerald-400/60":"text-indigo-400"}`}),badge:je?void 0:"Next",completed:je,badgeMuted:je},{label:"Build your own project",href:"/projects",icon:r.jsx(rr,{className:`w-5 h-5 ${Ae?"text-emerald-400/60":"text-[var(--color-fg-faint)]"}`}),completed:Ae,badgeMuted:Ae}]:M==="frontend"?[{label:"Create first collection",href:"/collections",icon:r.jsx(Rn,{className:`w-5 h-5 ${B?"text-emerald-400/60":"text-indigo-400"}`}),matchPrefixes:["/collections"],badge:B?void 0:"Next",completed:B,badgeMuted:B||$("/collections")},{label:"Invite an app user",href:"/app-users",icon:r.jsx(ln,{className:`w-5 h-5 ${H?"text-emerald-400/60":B?"text-indigo-400":"text-[var(--color-fg-faint)]"}`}),badge:B&&!H?"Next":void 0,completed:H,badgeMuted:H||$("/app-users")},{label:"Create first record",href:"/console",icon:r.jsx(TO,{className:`w-5 h-5 ${U?"text-emerald-400/60":H?"text-indigo-400":"text-[var(--color-fg-faint)]"}`}),matchPrefixes:["/console"],badge:H&&!U?"Next":void 0,completed:U,badgeMuted:U||$("/console")}]:M==="educator"?[{label:"Get a free API key",href:"/api-keys",icon:r.jsx(_d,{className:"w-5 h-5"}),badge:"Next",badgeMuted:$("/api-keys")},{label:"Open examples",href:Ha,icon:r.jsx(bd,{className:"w-5 h-5"}),badgeMuted:$("/guides")},{label:"API reference",href:"/documentation#api-reference",icon:r.
658jsx(Vl,{className:"w-5 h-5"}),badgeMuted:$("/documentation")}]:[{label:"Get a free API key",href:"/api-keys",icon:r.jsx(_d,{className:"w-5 h-5"}),badge:"Next",badgeMuted:$("/api-keys")},{label:"Send a test request",href:"/playground",icon:r.jsx(Vl,{className:"w-5 h-5"}),badgeMuted:$("/dashboard")},{label:"View logs",href:"/logs",icon:r.jsx(nc,{className:"w-5 h-5"}),badgeMuted:$("/logs")}],Ke=Oe.map(Ze=>({...Ze,onClick:()=>{const he=Oe.filter(ke=>"completed"in ke&&ke.completed).length;Z.track("checklist_item_clicked",{item:Ze.label,was_completed:"completed"in Ze?!!Ze.completed:!1,items_completed:he,items_total:Oe.length})}})),De={id:"your-backend",label:"Your backend",items:[{label:"Dashboard",href:"/dashboard",icon:r.jsx(cfe,{className:"w-5 h-5"})},...Q?[{label:"Projects",href:"/projects",icon:r.jsx(aS,{className:"w-5 h-5"})}]:[],{label:le?"Test Data":"Collections",href:"/collections",icon:r.jsx(aS,{className:"w-5 h-5"})},...B?[{label:"Data",href:"/data-explorer",icon:r.jsx(Rn,{className:"w-5 h-5"})}]:[],...Q||H?[{label:"App users",href:"/app-users",icon:r.jsx(AO,{className:"w-5 h-5"})}]:[],{label:"Project Console",href:"/console",icon:r.jsx(mo,{className:"w-5 h-5"}),matchPrefixes:["/console"]},...oe?[{label:"Custom endpoints",href:"/custom-endpoints",icon:r.jsx(Vl,{className:"w-5 h-5"})}]:[],...ae?[{label:"Logs",href:"/logs",icon:r.jsx(nc,{className:"w-5 h-5"})}]:[]]},ct={id:"classic-api",label:"Classic API",collapsible:!0,defaultCollapsed:Q,note:"Read-only demo data. For persistent data, try Collections.",items:[{label:"API Playground",href:"/playground",icon:r.jsx(Vl,{className:"w-5 h-5"}),matchPrefixes:["/playground"]},{label:"GET /api/users",href:"/playground?path=/api/users&method=GET",icon:r.jsx(ln,{className:"w-5 h-5"}),matchPrefixes:[]},{label:"GET /api/unknown",href:"/playground?path=/api/unknown&method=GET",icon:r.jsx(wq,{className:"w-5 h-5"}),matchPrefixes:[]}]},rt=xe==="agent_developer",mt={id:"agents",label:"ReqRes for Agents",items:[{label:rt?"Agent keys & usage":"Setup & upgrade",href:"/agents",icon:r.jsx(YC,{className:"w-5 h-5"}),matchPrefixes:["/agents"],badge:rt?void 0:"New",badgeMuted:$("/agents")}]},vt={id:"classrooms",label:"Classrooms",items:[{label:"My Classrooms",href:"/classrooms",icon:r.jsx(lp,{className:"w-5 h-5"}),matchPrefixes:["/classrooms"]},{label:"Create a Classroom",href:"/classrooms/new",icon:r.jsx(TO,{className:"w-5 h-5"})}]},gt=[...!Q&&!H?[{label:"App users",href:"/app-users",icon:r.jsx(AO,{className:"w-5 h-5"})}]:[],{label:"Automations",href:"/automations",icon:r.jsx(Dr,{className:"w-5 h-5"})},...oe?[]:[{label:"Custom endpoints",href:"/custom-endpoints",icon:r.jsx(Vl,{className:"w-5 h-5"})}],...Q?[]:[{label:"Projects",href:"/projects",icon:r.jsx(aS,{className:"w-5 h-5"})}],...!rt&&!$("/agents")?[{label:"ReqRes for Agents",href:"/agents",icon:r.jsx(YC,{className:"w-5 h-5"}),badge:"New"}]:[],{label:"Organizations",href:"/organizations",icon:r.jsx(ln,{className:"w-5 h-5"})},{label:"API keys",href:"/api-keys",icon:r.jsx(_d,{className:"w-5 h-5"})},{label:J?"Plans":"Upgrade",href:"/upgrade",icon:r.jsx(Dr,{className:"w-5 h-5"})},{label:J?"Subscription & billing":"Billing",href:"/billing",icon:r.jsx(zi,{className:"w-5 h-5"})}],Be={id:"more",label:"More",collapsible:!0,defaultCollapsed:!J,items:gt},ve={id:"learn",label:"Learn",collapsible:!0,defaultCollapsed:!0,items:[{label:"Documentation",href:"/documentation",icon:r.jsx(nc,{className:"w-5 h-5"})},{label:"API reference",href:"/documentation#api-reference",icon:r.
658jsx(Vl,{className:"w-5 h-5"})},{label:"LLM Prompts",href:"/prompts",icon:r.jsx(rr,{className:"w-5 h-5"}),badge:"New",badgeMuted:$("/prompts")},{label:"Examples",href:"/guides",icon:r.jsx(bd,{className:"w-5 h-5"}),variant:"parent",matchPrefixes:["/guides","/examples"]},{label:"Todo app backend",href:"/guides/todo-app",variant:"child"},{label:"Notes app backend",href:Ha,variant:"child"},{label:"Event tracker backend",href:"/guides/event-tracker",variant:"child"},{label:"LLM UI â backend",href:"/guides/connect-ui-to-real-backend",variant:"child"},{label:"Templates",href:"/templates",icon:r.jsx(vfe,{className:"w-5 h-5"})},{label:"FAQ",href:"/faq",icon:r.jsx(bd,{className:"w-5 h-5"})}]},be=[];if(q&&be.push({id:"admin",label:"Admin",items:[{label:"Admin",href:"/admin",icon:r.jsx(Sx,{className:"w-5 h-5"})}]}),V){const Ze=Ke.length>0&&Ke.every(he=>"completed"in he&&he.completed);be.push({id:"start-here",label:"Start here",items:Ke,collapsible:Ze,defaultCollapsed:Ze})}return fe?be.push(vt,De,ct):Q?be.push(De,ct):be.push(ct,De),!fe&&$("/classrooms")&&be.push(vt),(rt||$("/agents"))&&be.push(mt),be.push(Be,ve),Le&&!de&&J&&be.push({id:"team-nudge",items:[{label:"Invite your team",href:"/upgrade",icon:r.jsx(Tq,{className:"w-5 h-5"})}]}),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed left-3 top-3 z-[60] lg:hidden",children:r.jsx(ht,{variant:"secondary",size:"icon",onClick:()=>l(!i),className:"h-10 w-10","aria-label":i?"Close navigation":"Open navigation","aria-expanded":i,children:i?r.jsx(Ir,{className:"w-5 h-5"}):r.jsx(Tfe,{className:"w-5 h-5"})})}),i&&r.jsx("div",{className:"lg:hidden fixed inset-0 bg-[var(--color-overlay)] backdrop-blur-sm z-40",onClick:()=>l(!1),role:"presentation"}),r.jsx("div",{className:` 659 fixed inset-y-0 left-0 z-50 flex h-full w-full px-4 pt-28 pb-6 transition-transform duration-300 ease-in-out 660 sm:max-w-md 661 lg:static lg:inset-auto lg:z-auto lg:h-auto lg:w-auto lg:translate-x-0 lg:px-0 lg:pt-2 lg:pb-0 662 ${i?"translate-x-0":"-translate-x-full"} 663 `,children:r.jsxs("div",{className:"flex h-full flex-col w-full",children:[!c&&r.jsx("div",{className:"mx-1 mb-2",children:r.jsx("div",{className:"flex items-center rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-1 gap-1",role:"tablist","aria-label":"Dashboard view",children:[{track:"frontend",label:"Builder"},{track:"qa",label:"QA"},{track:"educator",label:"Educator"}].map(({track:Ze,label:he})=>r.jsx("button",{type:"button",role:"tab","aria-selected":M===Ze,onClick:()=>{L(Ze),ZC(Ze),Z.track("persona_tab_switched",{persona:Ze})},className:`flex-1 px-2 py-1.5 rounded-lg text-[11px] font-medium transition-colors ${M===Ze?"bg-[var(--color-accent-blue)] text-white":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]"}`,children:he},Ze))})}),r.jsx(Aq,{groups:be,collapsed:c,onToggleCollapse:()=>u(!c),onClose:()=>l(!1),className:"h-full max-h-full overflow-y-auto surface-card elevation-1 rounded-2xl shadow-sm"}),!c&&!J&&r.jsx("a",{href:"/upgrade",onClick:()=>Z.track("sidebar_upgrade_nudge_clicked",{plan_tier:xe}),className:"mx-1 mt-2 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2.5 text-xs hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)] transition",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)] truncate",children:"Free plan"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)] truncate",children:"250 requests/day"})]}),r.jsx("span",{className:"shrink-0 text-[var(--color-accent-blue)] font-semibold",children:"See plans â"})]})})]})}),z&&r.jsx(Xz,{open:z,status:O.status,version:O.onboardingVersion,loading:O.loading,onComplete:W,onSkip:K,onClose:()=>X(!1)})]})}function Fxe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}const Bxe=e=>{switch(e){case"success":return Hxe;case"info":return Gxe;case"warning":return Vxe;case"error":return Wxe;default:return null}},qxe=Array(12).fill(0),zxe=({visible:e,className:t})=>pe.createElement("div",{className:["sonner-loading-wrapper",t].filter(
vendor: 10,894 bytes, line 663
663Boolean).join(" "),"data-visible":e},pe.createElement("div",{className:"sonner-spinner"},qxe.map((s,n)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Hxe=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Vxe=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Gxe=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Wxe=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Yxe=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Kxe=()=>{const[e,t]=pe.useState(document.hidden);return pe.useEffect(()=>{const s=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),e};let LE=1;class Jxe{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;const{message:n,...a}=t,o=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:LE++,i=this.toasts.find(c=>c.id===o),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),i?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:n}),{...c,...t,id:o,dismissible:l,title:n}):c):this.addToast({title:n,...a,dismissible:l,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(s=>s({id:t,dismiss:!0})))):this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let o=n!==void 0,i;const l=a.then(async u=>{if(i=["resolve",u],pe.isValidElement(u))o=!1,this.create({id:n,type:"default",message:u});else if(Qxe(u)&&!u.ok){o=!1;const h=typeof s.error=="function"?await s.error(`HTTP error! status: ${u.status}`):s.error,g=typeof s.description=="function"?await s.description(`HTTP error! status: ${u.status}`):s.description,y=typeof h=="object"&&!pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:g,...y})}else if(u instanceof Error){o=!1;const h=typeof s.error=="function"?await s.error(u):s.error,g=typeof s.description=="function"?await s.description(u):s.description,y=typeof h=="object"&&!pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:g,...y})}else if(s.success!==void 0){o=!1;const h=typeof s.success=="function"?await s.success(u):s.success,g=typeof s.description=="function"?await s.description(u):s.description,y=typeof h=="object"&&!pe.isValidElement(h)?h:{message:h};this.create({id:n,type:"success",description:g,...y})}}).catch(async u=>{if(i=["reject",u],s.error!==void 0){o=!1;const f=typeof s.error=="function"?await s.error(u):s.error,h=typeof s.description=="function"?await s.description(u):s.description,v=typeof f=="object"&&!pe.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...v})}}).finally(()=>{o&&(this.dismiss(n),n=void 0),s.finally==null||s.finally.call(s)}),c=()=>new Promise((u,f)=>l.then(()=>i[0]==="reject"?f(i[1]):u(i[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,s)=>{const n=(s==null?void 0:s.id)||LE++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Oa=new Jxe,Xxe=(e,t)=>{const s=(t==null?void 0:t.id)||LE++;return Oa.addToast({title:e,...t,id:s}),s},Qxe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Zxe=Xxe,eve=()=>Oa.toasts,tve=()=>Oa.getActiveToasts(),it=Object.assign(Zxe,{success:Oa.success,info:Oa.info,warning:Oa.warning,error:Oa.error,custom:Oa.custom,message:Oa.message,promise:Oa.promise,dismiss:Oa.dismiss,loading:Oa.loading},{getHistory:eve,getToasts:tve});Fxe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;
663left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true
vendor: 8,850 bytes, line 663
663]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function
vendor: 12,645 bytes, line 663
663t0(e){return e.label!==void 0}const sve=3,rve="24px",nve="16px",WL=4e3,ave=356,ove=14,ive=45,lve=200;function Mi(...e){return e.filter(Boolean).join(" ")}function cve(e){const[t,s]=e.split("-"),n=[];return t&&n.push(t),s&&n.push(s),n}const dve=e=>{var t,s,n,a,o,i,l,c,u;const{invert:f,toast:h,unstyled:g,interacting:v,setHeights:y,visibleToasts:_,heights:j,index:w,toasts:k,expanded:S,removeToast:E,defaultRichColors:T,closeButton:A,style:R,cancelButtonStyle:I,actionButtonStyle:L,className:M="",descriptionClassName:O="",duration:z,position:X,gap:W,expandByDefault:K,classNames:q,icons:J,closeButtonAriaLabel:F="Close toast"}=e,[V,$]=pe.useState(null),[B,ae]=pe.useState(null),[H,U]=pe.useState(!1),[oe,fe]=pe.useState(!1),[Q,le]=pe.useState(!1),[Se,we]=pe.useState(!1),[Le,xe]=pe.useState(!1),[de,Me]=pe.useState(0),[je,Ae]=pe.useState(0),Oe=pe.useRef(h.duration||z||WL),Ke=pe.useRef(null),ut=pe.useRef(null),De=w===0,ct=w+1<=_,rt=h.type,mt=h.dismissible!==!1,vt=h.className||"",gt=h.descriptionClassName||"",Be=pe.useMemo(()=>j.findIndex(Ee=>Ee.toastId===h.id)||0,[j,h.id]),ve=pe.useMemo(()=>{var Ee;return(Ee=h.closeButton)!=null?Ee:A},[h.closeButton,A]),be=pe.useMemo(()=>h.duration||z||WL,[h.duration,z]),nt=pe.useRef(0),Ze=pe.useRef(0),he=pe.useRef(0),ke=pe.useRef(null),[Ve,at]=X.split("-"),Pt=pe.useMemo(()=>j.reduce((Ee,He,ie)=>ie>=Be?Ee:Ee+He.height,0),[j,Be]),Ct=Kxe(),St=h.invert||f,Xt=rt==="loading";Ze.current=pe.useMemo(()=>Be*W+Pt,[Be,Pt]),pe.useEffect(()=>{Oe.current=be},[be]),pe.useEffect(()=>{U(!0)},[]),pe.useEffect(()=>{const Ee=ut.current;if(Ee){const He=Ee.getBoundingClientRect().height;return Ae(He),y(ie=>[{toastId:h.id,height:He,position:h.position},...ie]),()=>y(ie=>ie.filter(Ce=>Ce.toastId!==h.id))}},[y,h.id]),pe.useLayoutEffect(()=>{if(!H)return;const Ee=ut.current,He=Ee.style.height;Ee.style.height="auto";const ie=Ee.getBoundingClientRect().height;Ee.style.height=He,Ae(ie),y(Ce=>Ce.find(Pe=>Pe.toastId===h.id)?Ce.map(Pe=>Pe.toastId===h.id?{...Pe,height:ie}:Pe):[{toastId:h.id,height:ie,position:h.position},...Ce])},[H,h.title,h.description,y,h.id,h.jsx,h.action,h.cancel]);const It=pe.useCallback(()=>{fe(!0),Me(Ze.current),y(Ee=>Ee.filter(He=>He.toastId!==h.id)),setTimeout(()=>{E(h)},lve)},[h,E,y,Ze]);pe.useEffect(()=>{if(h.promise&&rt==="loading"||h.duration===1/0||h.type==="loading")return;let Ee;return S||v||Ct?(()=>{if(he.current<nt.current){const Ce=new Date().getTime()-nt.current;Oe.current=Oe.current-Ce}he.current=new Date().getTime()})():(()=>{Oe.current!==1/0&&(nt.current=new Date().getTime(),Ee=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),It()},Oe.current))})(),()=>clearTimeout(Ee)},[S,v,h,rt,Ct,It]),pe.useEffect(()=>{h.delete&&(It(),h.onDismiss==null||h.onDismiss.call(h,h))},[It,h.delete]);function ee(){var Ee;if(J!=null&&J.loading){var He;return pe.createElement("div",{className:Mi(q==null?void 0:q.loader,h==null||(He=h.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":rt==="loading"},J.loading)}return pe.createElement(zxe,{className:Mi(q==null?void 0:q.loader,h==null||(Ee=h.classNames)==null?void 0:Ee.loader),visible:rt==="loading"})}const We=h.icon||(J==null?void 0:J[rt])||Bxe(rt);var wt,_t;return pe.createElement("li",{tabIndex:0,ref:ut,className:Mi(M,vt,q==null?void 0:q.toast,h==null||(t=h.classNames)==null?void 0:t.toast,q==null?void 0:q.default,q==null?void 0:q[rt],h==null||(s=h.classNames)==null?void 0:s[rt]),"data-sonner-toast":"","data-rich-colors":(wt=h.richColors)!=null?wt:T,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":H,"data-promise":!!h.promise,"data-swiped":Le,"data-removed":oe,"data-visible":ct,"data-y-position":Ve,"data-x-position":at,"data-index":w,"data-front":De,"data-swiping":Q,"data-dismissible":mt,"data-type":rt,"data-invert":St,"data-swipe-out":Se,"data-swipe-direction":B,"data-expanded":!!(S||K&&H),"data-testid":h.testId,style:{"--index":w,"--toasts-before":w,"--z-index":k.length-w,"--offset":`${oe?de:Ze.current}px`,"--initial-height":K?"auto":`${je}px`,...R,...h.style},onDragEnd:()=>{le(!1),$(null),ke.current=null},onPointerDown:Ee=>{Ee.button!==2&&(Xt||!mt||(Ke.current=new Date,Me(Ze.current),Ee.target.setPointerCapture(Ee.pointerId),Ee.target.tagName!=="BUTTON"&&(le(!0),ke.current={x:Ee.clientX,y:Ee.clientY})))},onPointerUp:()=>{var Ee,He,ie;if(Se||!mt)return;ke.current=null;const Ce=Number(((Ee=ut.current)==null?void 0:Ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ye=Number(((He=ut.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Pe=new Date().getTime()-((ie=Ke.current)==null?void 0:ie.getTime()),Ge=V==="x"?Ce:Ye,Nt=Math.abs(Ge)/Pe;if(Math.abs(Ge)>=ive||Nt>.11){Me(Ze.current),h.onDismiss==null||h.onDismiss.call(h,h),ae(V==="x"?Ce>0?"right":"left":Ye>0?"down":"up"),It(),we(!0);return}else{var Tt,ss;(Tt=ut.current)==null||Tt.style.setProperty("--swipe-amount-x","0px"),(ss=ut.current)==null||ss.style.setProperty("--swipe-amount-y","0px")}xe(!1),le(!1),$(null)},onPointerMove:Ee=>{var He,ie,Ce;if(!ke.current||!mt||((He=window.getSelection())==null?void 0:He.toString().length)>0)return;const Pe=Ee.clientY-ke.current.y,Ge=Ee.clientX-ke.current.x;var Nt;const Tt=(Nt=e.swipeDirections)!=null?Nt:cve(X);!V&&(Math.abs(Ge)>1||Math.abs(Pe)>1)&&$(Math.abs(Ge)>Math.abs(Pe)?"x":"y");let ss={x:0,y:0};const Zt=re=>1/(1.5+Math.abs(re)/20);if(V==="y"){if(Tt.includes("top")||Tt.includes("bottom"))if(Tt.includes("top")&&Pe<0||Tt.includes("bottom")&&Pe>0)ss.y=Pe;else{const re=Pe*Zt(Pe);ss.y=Math.abs(re)<Math.abs(Pe)?re:Pe}}else if(V==="x"&&(Tt.includes("left")||Tt.includes("right")))if(Tt.includes("left")&&Ge<0||Tt.includes("right")&&Ge>0)ss.x=Ge;else{const re=Ge*Zt(Ge);ss.x=Math.abs(re)<Math.abs(Ge)?re:Ge}(Math.abs(ss.x)>0||Math.abs(ss.y)>0)&&xe(!0),(ie=ut.current)==null||ie.style.setProperty("--swipe-amount-x",`${ss.x}px`),(Ce=ut.current)==null||Ce.style.setProperty("--swipe-amount-y",`${ss.y}px`)}},ve&&!h.jsx&&rt!=="loading"?pe.createElement("button",{"aria-label":F,"data-disabled":Xt,"data-close-button":!0,onClick:Xt||!mt?()=>{}:()=>{It(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Mi(q==null?void 0:q.closeButton,h==null||(n=h.classNames)==null?void 0:n.closeButton)},(_t=J==null?void 0:J.close)!=null?_t:Yxe):null,(rt||h.icon||h.promise)&&h.icon!==null&&((J==null?void 0:J[rt])!==null||h.icon)?pe.createElement("div",{"data-icon":"",className:Mi(q==null?void 0:q.icon,h==null||(a=h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||ee():null,h.type!=="loading"?We:null):null,pe.createElement("div",{"data-content":"",className:Mi(q==null?void 0:q.content,h==null||(o=h.classNames)==null?void 0:o.content)},pe.createElement("div",{"data-title":"",className:Mi(q==null?void 0:q.title,h==null||(i=h.classNames)==null?void 0:i.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?pe.createElement("div",{"data-description":"",className:Mi(O,gt,q==null?void 0:q.description,h==null||(l=h.classNames)==null?void 0:l.description)},typeof h.description=="function"?h.description():h.description):null),pe.isValidElement(h.cancel)?h.cancel:h.cancel&&t0(h.cancel)?pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||I,onClick:Ee=>{t0(h.cancel)&&mt&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ee),It())},className:Mi(q==null?void 0:q.cancelButton,h==null||(c=h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,pe.isValidElement(h.action)?h.action:h.action&&t0(h.action)?pe.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||L,onClick:Ee=>{t0(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ee),!Ee.defaultPrevented&&It())},className:Mi(q==null?void 0:q.actionButton,h==null||(u=h.classNames)==null?void 0:u.actionButton)},h.action.label):null)};function YL(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function uve(e,t){const s={};return[e,t].forEach((n,a)=>{const o=a===1,i=o?"--mobile-offset":"--offset",l=o?nve:rve;function c(u){["top","right","bottom","left"].forEach(f=>{s[`${i}-${f}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?s[`${i}-${u}`]=l:s[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),s}const pve=pe.forwardRef(function(t,s){const{id:n,invert:a,position:o="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:f,mobileOffset:h,theme:g="light",richColors:v,duration:y,style:_,visibleToasts:j=sve,toastOptions:w,dir:k=YL(),gap:S=ove,icons:E,containerAriaLabel:T="Notifications"}=t,[A,R]=pe.useState([]),I=pe.useMemo(()=>n?A.filter(H=>H.toasterId===n):A.filter(H=>!H.toasterId),[A,n]),L=pe.useMemo(()=>Array.from(new Set([o].concat(I.filter(H=>H.position).map(H=>H.position)))),[I,o]),[M,O]=pe.useState([]),[z,X]=pe.useState(!1),[W,K]=pe.useState(!1),[q,J]=pe.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=pe.useRef(null),V=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=pe.useRef(null),B=pe.useRef(!1),ae=pe.useCallback(H=>{R(U=>{var oe;return(oe=U.find(fe=>fe.id===H.id))!=null&&oe.delete||Oa.dismiss(H.id),U.filter(({id:fe})=>fe!==H.id)})},[]);return pe.useEffect(()=>Oa.subscribe(H=>{if(H.dismiss){requestAnimationFrame(()=>{R(U=>U.map(oe=>oe.id===H.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{MB.flushSync(()=>{R(U=>{const oe=U.findIndex(fe=>fe.id===H.id);return oe!==-1?[...U.slice(0,oe),{...U[oe],...H},...U.slice(oe+1)]:[H,...U]})})})}),[A]),pe.useEffect(()=>{if(g!=="system"){J(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?J("dark"):J("light")),typeof window>"u")return;const H=window.matchMedia("(prefers-color-scheme: dark)");try{H.addEventListener("change",({matches:U})=>{J(U?"dark":"light")})}catch{H.addListener(({matches:oe})=>{try{J(oe?"dark":"light")}catch(fe){console.error(fe)}})}},[g]),pe.useEffect(()=>{A.length<=1&&X(!1)},[A]),pe.useEffect(()=>{const H=U=>{var oe;if(i.every(le=>U[le]||U.code===le)){var Q;X(!0),(Q=F.current)==null||Q.focus()}U.code==="Escape"&&(document.activeElement===F.current||(oe=F.current)!=null&&oe.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),pe.useEffect(()=>{if(F.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,B.current=!1)}},[F.current]),pe.createElement("section",{ref:s,"aria-label":`${T} ${V}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((H,U)=>{var oe;const[fe,Q]=H.split("-");return I.length?pe.createElement("ol",{key:H,dir:k==="auto"?YL():k,tabIndex:-1,ref:F,className:u,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":fe,"data-x-position":Q,style:{"--front-toast-height":`${((oe=M[0])==null?void 0:oe.height)||0}px`,"--width":`${ave}px`,"--gap":`${S}px`,..._,...uve(f,h)},onBlur:le=>{B.current&&!le.currentTarget.contains(le.relatedTarget)&&(B.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||B.current||(B.current=!0,$.current=le.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{W||X(!1)},onDragEnd:()=>X(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||K(!0)},onPointerUp:()=>K(!1)},I.filter(le=>!le.position&&U===0||le.position===H).map((le,Se)=>{var we,Le;return pe.createElement(dve,{key:le.id,icons:E,index:Se,toast:le,defaultRichColors:v,duration:(we=w==null?void 0:w.duration)!=null?we:y,className:w==null?void 0:w.className,descriptionClassName:w==null?void 0:w.descriptionClassName,invert:a,visibleToasts:j,closeButton:(Le=w==null?void 0:w.closeButton)!=null?Le:c,interacting:W,position:H,style:w==null?void 0:w.style,unstyled:w==null?void 0:w.unstyled,classNames:w==null?void 0:w.classNames,cancelButtonStyle:w==null?void 0:w.cancelButtonStyle,actionButtonStyle:w==null?void 0:w.actionButtonStyle,closeButtonAriaLabel:w==null?void 0:w.closeButtonAriaLabel,removeToast:ae,toasts:I.filter(xe=>xe.position==le.position),heights:M.filter(xe=>xe.position==le.position),setHeights:O,expandByDefault:l,gap:S,expanded:z,swipeDirections:t.swipeDirections})})):null}))}
663),Mt={dark:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 md:p-5"},Jt={primary:"inline-flex items-center justify-center rounded-md bg-indigo-500 px-3.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500/70 focus:ring-offset-0 disabled:opacity-60 disabled:cursor-not-allowed",primaryEmphasis:"inline-flex items-center justify-center rounded-md bg-indigo-500 px-3.5 py-2 text-xs font-medium text-white shadow-sm hover:bg-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500/70 focus:ring-offset-0 disabled:opacity-60 disabled:cursor-not-allowed",secondary:"inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-3.5 py-2 text-xs font-medium text-[var(--color-fg-default)] shadow-sm hover:bg-[var(--color-bg-hover)] transition focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-blue)]/60 focus:ring-offset-0 disabled:opacity-60 disabled:cursor-not-allowed",secondaryEmphasis:"inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-3.5 py-2 text-xs font-medium text-[var(--color-fg-default)] shadow-sm hover:bg-[var(--color-bg-hover)] transition focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-blue)]/60 focus:ring-offset-0 disabled:opacity-60 disabled:cursor-not-allowed"},Fd={dark:"w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2.5 text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] shadow-sm outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500/80 disabled:opacity-60 disabled:cursor-not-allowed"},od={ctaDark:"inline-flex items-center text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]"},ud={dark:"font-mono text-[11px] leading-relaxed text-[var(--color-fg-secondary)] bg-[var(--color-bg-code)] rounded-lg p-3 overflow-x-auto whitespace-pre-wrap"},hi={pill:"inline-flex items-center rounded-md border border-[var(--color-border-default)] px-2.5 py-1 text-[11px] font-medium text-[var(--color-fg-default)]",tag:"inline-flex items-center rounded-full bg-[var(--color-bg-alt)] px-2 py-1 text-[11px] font-medium text-[var(--color-fg-secondary)]"},fve=["/logs","/data-explorer","/api-keys","/projects","/dashboard","/custom-endpoints","/clerk"],hve=e=>{if(!e)return!1;const[t]=e.split("?");return fve.some(s=>t.startsWith(s))},s0=e=>!(!e||Number(e.status)===304||hve(e.path)),mve=()=>new Date(Date.now()-864e5).toISOString(),r0=()=>{try{const e=window.localStorage.getItem("rr_onboarding_first_request");if(e)return{id:"onboarding",project_id:null,project_name:null,method:"GET",path:"/api/users?page=1",status:200,created_at:e,latency_ms:null}}catch{}return null};function gve({projectId:e,enabled:t,initialLog:s,useApiKeySignal:n=!1,useAppUserSignal:a=!1}){const{getToken:o}=zt(),[i,l]=x.useState(()=>{const S=r0();return S||(s0(s)?s??null:null)}),[c,u]=x.useState(()=>r0()?"onboarding":s0(s)?"logs":null),[f,h]=x.useState(!1),[g,v]=x.useState(null),y=x.useRef(null),_=x.useRef(null),j=x.useRef(0);x.useEffect(()=>{if(!i){const S=r0();if(S){l(S),u("onboarding");return}s0(s)&&(l(s??null),u("logs"))}},[i,s]);const w=x.useCallback(()=>{y.current&&(window.clearTimeout(y.current),y.current=null)},[]),k=x.useCallback(async()=>{var A,R,I,L,M;if(!t||i)return;const S=r0();if(S){l(S),u("onboarding"),w();return}if(typeof document<"u"&&document.visibilityState==="hidden")return;let E=!1;(A=_.current)==null||A.abort();const T=new AbortController;_.current=T,h(!0),v(null);try{const O=await Ue(o);if(!O)return;if(e||!n){const z=new URLSearchParams;z.set("limit","1"),z.set("since",mve()),e&&z.set("project_id",String(e));const W=((I=(R=(await ue.get(`/logs?${z}`,{authToken:O,signal:T.signal})).data)==null?void 0:R.data)==null?void 0:I[0])||null;if(s0(W)){l(W),u("logs"),w();return}}if(a&&e){const X=((L=(await ue.get(`/api/app-users?project_id=${e}&limit=5`,{authToken:O,signal:T.signal})).data)==null?void 0:L.data)||[],W=X.filter(J=>J==null?void 0:J.last_login_at).sort((J,F)=>new Date(F.last_login_at).getTime()-new Date(J.last_login_at).getTime())[0],K=X.filter(J=>J==null?void 0:J.created_at).sort((J,F)=>new Date(F.created_at).getTime()-new Date(J.created_at).getTime())[0],q=(W==null?void 0:W.last_login_at)||(K==null?void 0:K.created_at)||null;if(q){l({id:(W==null?void 0:W.id)||(K==null?void 0:K.id)||"app-user",project_id:e,project_name:null,method:"POST",path:"/api/app-users/login",status:200,created_at:q,latency_ms:null}),u("app_user"),w();return}}if(n){const z=await ue.get("/api-keys",{authToken:O,signal:T.signal}),X=Array.isArray(z.data)?z.data:(M=z.data)==null?void 0:M.data;if(Array.isArray(X)){const W=X.filter(V=>V&&V.last_used_at).map(V=>({...V,last_used_at_ms:new Date(V.last_used_at).getTime()})).filter(V=>Number.isFinite(V.last_used_at_ms)),K=V=>V.sort(($,B)=>B.last_used_at_ms-$.last_used_at_ms)[0],q=e?W.filter(V=>Number(V.project_id)===Number(e)):[],J=W.filter(V=>!V.project_id),F=K(q)||K(J)||K(W);
663if(F!=null&&F.last_used_at){l({id:F.id||"classic-key",project_id:F.project_id??null,project_name:F.project_name||(F.project_id?null:"Classic key"),method:"GET",path:"/api/users?page=2",status:200,created_at:F.last_used_at,latency_ms:null}),u("api_key"),w();return}}}}catch(O){E=!0,j.current=2,(O==null?void 0:O.name)!=="AbortError"&&v((O==null?void 0:O.message)||"Could not check logs yet.")}finally{!E&&j.current>0&&(j.current-=1),h(!1)}},[t,i,o,e,w,n,a]);return x.useEffect(()=>{if(!t||i){w();return}let S=!0;const E=A=>{!S||!t||i||(w(),y.current=window.setTimeout(()=>{k().catch(()=>{}).finally(()=>{const R=j.current>0?2e4:1e4;E(R)})},A))};k().catch(()=>{}),E(j.current>0?2e4:1e4);const T=()=>{if(!(!t||i)){if(document.visibilityState!=="visible"){w();return}E(0)}};return window.addEventListener("visibilitychange",T),()=>{var A;S=!1,w(),(A=_.current)==null||A.abort(),window.removeEventListener("visibilitychange",T)}},[t,k,i,w]),{firstRequest:i,loading:f,error:g,source:c}}const Ag=(e,t=0)=>{const s=Number(e);return Number.isFinite(s)?s:t};function Aw({projectId:e,env:t,enabled:s=!0}){const{getToken:n}=zt(),[a,o]=x.useState(null),[i,l]=x.useState(!1),[c,u]=x.useState(null),f=x.useCallback(async()=>{var h;if(s)try{l(!0),u(null);const g=await Ue(n);if(!g)return;const v=new URLSearchParams;e&&v.set("project_id",String(e));const y=v.toString()?`/usage?${v.toString()}`:"/usage",_=await ue.get(y,{authToken:g,env:t}),j=((h=_.data)==null?void 0:h.data)??_.data;o({used:Ag(j==null?void 0:j.requests_today,0),limit:(j==null?void 0:j.requests_limit)!==null&&(j==null?void 0:j.requests_limit)!==void 0?Ag(j==null?void 0:j.requests_limit,0):null,remaining:(j==null?void 0:j.remaining)!==null&&(j==null?void 0:j.remaining)!==void 0?Ag(j==null?void 0:j.remaining,0):null,resetAt:(j==null?void 0:j.reset_at)!==null&&(j==null?void 0:j.reset_at)!==void 0?Ag(j==null?void 0:j.reset_at,0):null,tier:(j==null?void 0:j.tier)||"free",retentionDays:(j==null?void 0:j.logs_retention_days)!==null&&(j==null?void 0:j.logs_retention_days)!==void 0?Ag(j==null?void 0:j.logs_retention_days,0):null,projectId:(j==null?void 0:j.project_id)??e??null,environmentKey:(j==null?void 0:j.environment_key)||t||null})}catch(g){g instanceof yt?u(g.message):u("Failed to load usage")}finally{l(!1)}},[s,t,n,e]);return x.useEffect(()=>{f()},[f]),{stats:a,loading:i,error:c,refresh:f}}const kS={isTrial:!1,daysRemaining:0,expired:!1,expiresAt:null,isGrandfathered:!1,isPaid:!1,loading:!0,error:null};function Pw(){const{getToken:e}=zt(),{user:t,isLoaded:s}=_r(),[n,a]=x.useState(kS),o=x.useCallback(async()=>{if(s){if(!t){a({...kS,loading:!1});return}try{a(f=>({...f,loading:!0,error:null}));const i=await Ue(e);if(!i){a({...kS,loading:!1});return}const c=(await ue.get("/clerk/payment-status",{authToken:i})).data,u=c==null?void 0:c.trial;if(!u){a({isTrial:!1,daysRemaining:0,expired:!1,expiresAt:null,isGrandfathered:!0,isPaid:(c==null?void 0:c.hasPaid)||!1,loading:!1,error:null});return}a({isTrial:u.isTrial||!1,daysRemaining:u.daysRemaining||0,expired:u.expired||!1,expiresAt:u.expiresAt||null,isGrandfathered:u.isGrandfathered||!1,isPaid:u.isPaid||!1,loading:!1,error:null})}catch(i){let l="Failed to fetch trial status";(i instanceof yt||i instanceof Error)&&(l=i.message),a(c=>({...c,loading:!1,error:l}))}}},[t,s,e]);return x.useEffect(()=>{o()},[o]),{...n,refresh:o}}const xve=e=>{if(!e)return"Resets soon";const t=e*1e3-Date.now();if(t<=0)return"Resets soon";const s=Math.floor(t/6e4),n=Math.floor(s/1440),a=Math.floor(s%1440/60),o=s%60;return n>0?`${n}d ${a}h`:a>0?`${a}h ${o}m`:`${o}m`},Al="#d4d4c8",Pl=.75;function vve({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 120",className:e,fill:"none",children:[r.jsx("polygon",{points:"50,100 70,90 70,55 50,65",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"50,65 70,55 90,65 70,75",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"90,100 110,90 110,30 90,40",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"90,40 110,30 130,40 110,50",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"130,100 150,90 150,50 130,60",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"130,60 150,50 170,60 150,70",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"170,100 190,90 190,20 170,30",stroke:Al,strokeWidth:Pl}),r.jsx("polygon",{points:"170,30 190,20 210,30 190,40",stroke:Al,strokeWidth:Pl}),r.jsx("line",{x1:"30",y1:"110",x2:"220",y2:"70",stroke:Al,strokeWidth:Pl,opacity:"0.4"})]})}function uR({label:e,used:t,limit:s,resetAt:n,ctaLabel:a,ctaHref:o="/upgrade",ctaSource:i,tone:l,surface:c,tier:u="free"}){const f=x.useMemo(()=>!s||s<=0?0:Math.min(1,t/s),[s,t]),h=s!==null?Math.max(0,s-t):null,g=l||(f>=.9?"danger":f>=.7?"warning":"neutral"),v=s?Math.min(100,Math.round(f*100)):0,y=x.useRef("none");x.useEffect(()=>{if(!s||s<=0)return;const S=f>=.9?"danger":f>=.7?"warning":"none";S==="none"||y.current===S||(y.current=S,Z.track("limit_warning_shown",{used:t,limit:s,remaining:h,reset_at:n??null,surface:c||"unknown",tier:u,warning_level:S}))},[s,f,h,n,c,u,t]);const _={neutral:"",warning:"border-amber-400/30",danger:"border-rose-400/40"},j={neutral:"bg-sky-500 dark:bg-sky-400",warning:"bg-amber-500 dark:bg-amber-400",danger:"bg-rose-500 dark:bg-rose-400"},w={neutral:"text-[var(--color-fg-default)]",warning:"text-amber-700 dark:text-amber-100",danger:"text-rose-700 dark:text-rose-100"},k=g==="danger"?Jt.primaryEmphasis:Jt.secondaryEmphasis;return r.jsxs("div",{className:`relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40 p-4 md:p-5 ${_[g]}`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.15]",children:r.jsx(vve,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.24em] text-[var(--color-fg-muted)]",children:e}),r.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[r.jsxs("span",{className:`text-lg font-semibold ${w[g]}
663`,children:[t.toLocaleString(),r.jsxs("span",{className:"text-sm text-[var(--color-fg-muted)]",children:["/",s!==null?s.toLocaleString():"â"]})]}),r.jsx("span",{className:"text-sm text-[var(--color-fg-muted)]",children:"requests today"})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Resets in ",xve(n)," ",r.jsx("span",{className:"text-[var(--color-fg-muted)]/70",children:"(midnight UTC)"})]})]}),a?r.jsx(dt,{className:k,to:o.includes("source=limit_warning")&&s!==null?`${o}&used=${t}&limit=${s}&highlight=dev&reason=request_limit`:o,onClick:()=>{i&&Z.upgradeClicked(i,u)},children:a}):null]}),r.jsx("div",{className:"relative z-[1] mt-4 h-1.5 w-full rounded-full bg-[var(--color-border-default)]",children:r.jsx("div",{className:`h-full rounded-full ${j[g]}`,style:{width:`${v}%`}})})]})}let nn=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function bve(e){return pR(e)}function pR(e){return Array.isArray(e)?yve(e):e instanceof RegExp?e:typeof e=="object"?_ve(e):e}function yve(e){let t=[];for(let s=0,n=e.length;s<n;s++)t[s]=pR(e[s]);return t}function _ve(e){let t={};for(let s in e)t[s]=pR(e[s]);return t}function Zz(e,...t){return t.forEach(s=>{for(let n in s)e[n]=s[n]}),e}function eH(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?eH(e.substring(0,e.length-1)):e.substr(~t+1)}var SS=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,n0=class{static hasCaptures(e){return e===null?!1:(SS.lastIndex=0,SS.test(e))}static replaceCaptures(e,t,s){return e.replace(SS,(n,a,o,i)=>{let l=s[parseInt(a||o,10)];if(l){let c=t.substring(l.start,l.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return n})}};function tH(e,t){return e<t?-1:e>t?1:0}function sH(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let s=e.length,n=t.length;if(s===n){for(let a=0;a<s;a++){let o=tH(e[a],t[a]);if(o!==0)return o}return 0}return s-n}function KL(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function rH(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var nH=class{constructor(e){Re(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},uj=class{constructor(e,t,s){Re(this,"_cachedMatchRoot",new nH(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=s}static createFromRawTheme(e,t){return this.createFromParsedTheme(Nve(e),t)}static createFromParsedTheme(e,t){return Sve(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(a=>jve(e.parent,a.parentScopes));return n?new aH(n.fontStyle,n.foreground,n.background):null}},CS=class m_{constructor(t,s){this.parent=t,this.scopeName=s}static push(t,s){for(const n of s)t=new m_(t,n);return t}static from(...t){let s=null;for(let n=0;n<t.length;n++)s=new m_(s,t[n]);return s}push(t){return new m_(this,t)}getSegments(){let t=this;const s=[];for(;t;)s.push(t.scopeName),t=t.parent;return s.reverse(),s}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const s=[];let n=this;for(;n&&n!==t;)s.push(n.scopeName),n=n.parent;return n===t?s.reverse():void 0}};function jve(e,t){if(t.length===0)return!0;for(let s=0;s<t.length;s++){let n=t[s],a=!1;if(n===">"){if(s===t.length-1)return!1;n=t[++s],a=!0}for(;e&&!wve(e.scopeName,n);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function wve(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var aH=class{constructor(e,t,s){this.fontStyle=e,this.foregroundId=t,this.backgroundId=s}};function Nve(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,s=[],n=0;for(let a=0,o=t.length;a<o;a++){let i=t[a];if(!i.settings)continue;let l;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(i.scope)?l=i.scope:l=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,v=h.length;g<v;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let u=null;typeof i.settings.foreground=="string"&&KL(i.settings.foreground)&&
663(u=i.settings.foreground);let f=null;typeof i.settings.background=="string"&&KL(i.settings.background)&&(f=i.settings.background);for(let h=0,g=l.length;h<g;h++){let y=l[h].trim().split(" "),_=y[y.length-1],j=null;y.length>1&&(j=y.slice(0,y.length-1),j.reverse()),s[n++]=new kve(_,j,a,c,u,f)}}return s}var kve=class{constructor(e,t,s,n,a,o){this.scope=e,this.parentScopes=t,this.index=s,this.fontStyle=n,this.foreground=a,this.background=o}},na=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(na||{});function Sve(e,t){e.sort((c,u)=>{let f=tH(c.scope,u.scope);return f!==0||(f=sH(c.parentScopes,u.parentScopes),f!==0)?f:c.index-u.index});let s=0,n="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(s=c.fontStyle),c.foreground!==null&&(n=c.foreground),c.background!==null&&(a=c.background)}let o=new Cve(t),i=new aH(s,o.getId(n),o.getId(a)),l=new Tve(new DE(0,null,-1,0,0),[]);for(let c=0,u=e.length;c<u;c++){let f=e[c];l.insert(0,f.scope,f.parentScopes,f.fontStyle,o.getId(f.foreground),o.getId(f.background))}return new uj(o,i,l)}var Cve=class{constructor(e){Re(this,"_isFrozen");Re(this,"_lastColorId");Re(this,"_id2color");Re(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,s=e.length;t<s;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Eve=Object.freeze([]),DE=class oH{constructor(t,s,n,a,o){Re(this,"scopeDepth");Re(this,"parentScopes");Re(this,"fontStyle");Re(this,"foreground");Re(this,"background");this.scopeDepth=t,this.parentScopes=s||Eve,this.fontStyle=n,this.foreground=a,this.background=o}clone(){return new oH(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let s=[];for(let n=0,a=t.length;n<a;n++)s[n]=t[n].clone();return s}acceptOverwrite(t,s,n,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,s!==-1&&(this.fontStyle=s),n!==0&&(this.foreground=n),a!==0&&(this.background=a)}},Tve=class $E{constructor(t,s=[],n={}){Re(this,"_rulesWithParentScopes");this._mainRule=t,this._children=n,this._rulesWithParentScopes=s}static _cmpBySpecificity(t,s){if(t.scopeDepth!==s.scopeDepth)return s.scopeDepth-t.scopeDepth;let n=0,a=0;for(;t.parentScopes[n]===">"&&n++,s.parentScopes[a]===">"&&a++,!(n>=t.parentScopes.length||a>=s.parentScopes.length);){const o=s.parentScopes[a].length-t.parentScopes[n].length;if(o!==0)return o;n++,a++}return s.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let n=t.indexOf("."),a,o;if(n===-1?(a=t,o=""):(a=t.substring(0,n),o=t.substring(n+1)),this._children.hasOwnProperty(a))return this._children[a].match(o)}const s=this._rulesWithParentScopes.concat(this._mainRule);return s.sort($E._cmpBySpecificity),s}insert(t,s,n,a,o,i){if(s===""){this._doInsertHere(t,n,a,o,i);return}let l=s.indexOf("."),c,u;l===-1?(c=s,u=""):(c=s.substring(0,l),u=s.substring(l+1));let f;this._children.hasOwnProperty(c)?f=this._children[c]:(f=new $E(this._mainRule.clone(),DE.cloneArr(this._rulesWithParentScopes)),this._children[c]=f),f.insert(t+1,u,n,a,o,i)}_doInsertHere(t,s,n,a,o){if(s===null){this._mainRule.acceptOverwrite(t,n,a,o);return}for(let i=0,l=this._rulesWithParentScopes.length;i<l;i++){let c=this._rulesWithParentScopes[i];if(sH(c.parentScopes,s)===0){c.acceptOverwrite(t,n,a,o);return}}n===-1&&(n=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new DE(t,s,n,a,o))}},Ch=class Mo{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const s=Mo.getLanguageId(t),n=Mo.getTokenType(t),a=Mo.getFontStyle(t),o=Mo.getForeground(t),i=Mo.getBackgroun
663d(t);console.log({languageId:s,tokenType:n,fontStyle:a,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,s,n,a,o,i,l){let c=Mo.getLanguageId(t),u=Mo.getTokenType(t),f=Mo.containsBalancedBrackets(t)?1:0,h=Mo.getFontStyle(t),g=Mo.getForeground(t),v=Mo.getBackground(t);return s!==0&&(c=s),n!==8&&(u=n),a!==null&&(f=a?1:0),o!==-1&&(h=o),i!==0&&(g=i),l!==0&&(v=l),(c<<0|u<<8|f<<10|h<<11|g<<15|v<<24)>>>0}};function pj(e,t){const s=[],n=Rve(e);let a=n.next();for(;a!==null;){let c=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=n.next()}let u=i();if(s.push({matcher:u,priority:c}),a!==",")break;a=n.next()}return s;function o(){if(a==="-"){a=n.next();const c=o();return u=>!!c&&!c(u)}if(a==="("){a=n.next();const c=l();return a===")"&&(a=n.next()),c}if(JL(a)){const c=[];do c.push(a),a=n.next();while(JL(a));return u=>t(c,u)}return null}function i(){const c=[];let u=o();for(;u;)c.push(u),u=o();return f=>c.every(h=>h(f))}function l(){const c=[];let u=i();for(;u&&(c.push(u),a==="|"||a===",");){do a=n.next();while(a==="|"||a===",");u=i()}return f=>c.some(h=>h(f))}}function JL(e){return!!e&&!!e.match(/[\w\.:]+/)}function Rve(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,s=t.exec(e);return{next:()=>{if(!s)return null;const n=s[0];return s=t.exec(e),n}}}function iH(e){typeof e.dispose=="function"&&e.dispose()}var hv=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ave=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Pve=class{constructor(){Re(this,"_references",[]);Re(this,"_seenReferenceKeys",new Set);Re(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Ive=class{constructor(e,t){Re(this,"seenFullScopeRequests",new Set);Re(this,"seenPartialScopeRequests",new Set);Re(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new hv(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Pve;for(const s of e)Mve(s,this.initialScopeName,this.repo,t);for(const s of t.references)if(s instanceof hv){if(this.seenFullScopeRequests.has(s.scopeName))continue;this.seenFullScopeRequests.add(s.scopeName),this.Q.push(s)}else{if(this.seenFullScopeRequests.has(s.scopeName)||this.seenPartialScopeRequests.has(s.toKey()))continue;this.seenPartialScopeRequests.add(s.toKey()),this.Q.push(s)}}};function Mve(e,t,s,n){const a=s.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=s.lookup(t);e instanceof hv?g_({baseGrammar:o,selfGrammar:a},n):UE(e.ruleName,{baseGrammar:o,selfGrammar:a,repository:a.repository},n);const i=s.injections(e.scopeName);if(i)for(const l of i)n.add(new hv(l))}function UE(e,t,s){if(t.repository&&t.repository[e]){const n=t.repository[e];fj([n],t,s)}}function g_(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&fj(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&fj(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function fj(e,t,s){for(const n of e){if(s.visitedRule.has(n))continue;s.visitedRule.add(n);const a=n.repository?Zz({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&fj(n.patterns,{...t,repository:a},s);const o=n.include;if(!o)continue;const i=lH(o);switch(i.kind){case 0:g_({...t,selfGrammar:t.baseGrammar},s);break;case 1:g_(t,s);break;case 2:UE(i.ruleName,{...t,repository:a},s);break;case 3:case 4:const l=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:a};i.kind===4?UE(i.ruleName,c,s):g_(c,s)}else i.kind===4?s.add(new Ave(i.scopeName,i.ruleName)):s.add(new hv(i.scopeName));break}}}var Ove=class{constructor(){Re(this,"kind",0)}},Lve=class{constructor(){Re(this,"kind",1)}},Dve=class{constructor(e){Re(this,"kind",2);this.ruleName=e}},$ve=class{constructor(e){Re(this,"kind",3);this.scopeName=e}},Uve=class{constructor(e,t){Re(this,"kind",4);this.scopeName=e,this.ruleName=t}};function lH(e){if(e==="$base")return new Ove;if(e==="$self")return new Lve;const t=e.indexOf("#");if(t===-1)return new $ve(e);
663if(t===0)return new Dve(e.substring(1));{const s=e.substring(0,t),n=e.substring(t+1);return new Uve(s,n)}}var Fve=/\\(\d+)/,XL=/\\(\d+)/g,Bve=-1,cH=-2;var Xv=class{constructor(e,t,s,n){Re(this,"$location");Re(this,"id");Re(this,"_nameIsCapturing");Re(this,"_name");Re(this,"_contentNameIsCapturing");Re(this,"_contentName");this.$location=e,this.id=t,this._name=s||null,this._nameIsCapturing=n0.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=n0.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${eH(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:n0.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:n0.replaceCaptures(this._contentName,e,t)}},qve=class extends Xv{constructor(t,s,n,a,o){super(t,s,n,a);Re(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(t,s){throw new Error("Not supported!")}compile(t,s){throw new Error("Not supported!")}compileAG(t,s,n,a){throw new Error("Not supported!")}},zve=class extends Xv{constructor(t,s,n,a,o){super(t,s,n,null);Re(this,"_match");Re(this,"captures");Re(this,"_cachedCompiledPatterns");this._match=new mv(a,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,s){s.push(this._match)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new gv,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},QL=class extends Xv{constructor(t,s,n,a,o){super(t,s,n,a);Re(this,"hasMissingPatterns");Re(this,"patterns");Re(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,s){for(const n of this.patterns)t.getRule(n).collectPatterns(t,s)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new gv,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},FE=class extends Xv{constructor(t,s,n,a,o,i,l,c,u,f){super(t,s,n,a);Re(this,"_begin");Re(this,"beginCaptures");Re(this,"_end");Re(this,"endHasBackReferences");Re(this,"endCaptures");Re(this,"applyEndPatternLast");Re(this,"hasMissingPatterns");Re(this,"patterns");Re(this,"_cachedCompiledPatterns");this._begin=new mv(o,this.id),this.beginCaptures=i,this._end=new mv(l||"ï¿¿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=u||!1,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,s){return this._end.resolveBackReferences(t,s)}collectPatterns(t,s){s.push(this._begin)}compile(t,s){return this._getCachedCompiledPatterns(t,s).compile(t)}compileAG(t,s,n,a){return this._getCachedCompiledPatterns(t,s).compileAG(t,n,a)}_getCachedCompiledPatterns(t,s){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new gv;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,s):this._cachedCompiledPatterns.setSource(0,s)),this._cachedCompiledPatterns}},hj=class extends Xv{constructor(t,s,n,a,o,i,l,c,u){super(t,s,n,a);Re(this,"_begin");Re(this,"beginCaptures");Re(this,"whileCaptures");Re(this,"_while");Re(this,"whileHasBackReferences");Re(this,"hasMissingPatterns");Re(this,"patterns");Re(this,"_cachedCompiledPatterns");Re(this,"_cachedCompiledWhilePatterns");this._begin=new mv(o,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=ne
663w mv(l,cH),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,s){return this._while.resolveBackReferences(t,s)}collectPatterns(t,s){s.push(this._begin)}compile(t,s){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,s,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new gv;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,s){return this._getCachedCompiledWhilePatterns(t,s).compile(t)}compileWhileAG(t,s,n,a){return this._getCachedCompiledWhilePatterns(t,s).compileAG(t,n,a)}_getCachedCompiledWhilePatterns(t,s){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new gv,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,s||"ï¿¿"),this._cachedCompiledWhilePatterns}
663},dH=class Zn{static createCaptureRule(t,s,n,a,o){return t.registerRule(i=>new qve(s,i,n,a,o))}static getCompiledRuleId(t,s,n){return t.id||s.registerRule(a=>{if(t.id=a,t.match)return new zve(t.$vscodeTextmateLocation,t.id,t.name,t.match,Zn._compileCaptures(t.captures,s,n));if(typeof t.begin>"u"){t.repository&&(n=Zz({},n,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new QL(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Zn._compilePatterns(o,s,n))}return t.while?new hj(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Zn._compileCaptures(t.beginCaptures||t.captures,s,n),t.while,Zn._compileCaptures(t.whileCaptures||t.captures,s,n),Zn._compilePatterns(t.patterns,s,n)):new FE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Zn._compileCaptures(t.beginCaptures||t.captures,s,n),t.end,Zn._compileCaptures(t.endCaptures||t.captures,s,n),t.applyEndPatternLast,Zn._compilePatterns(t.patterns,s,n))}),t.id}static _compileCaptures(t,s,n){let a=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);l>o&&(o=l)}for(let i=0;i<=o;i++)a[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);let c=0;t[i].patterns&&(c=Zn.getCompiledRuleId(t[i],s,n)),a[l]=Zn.createCaptureRule(s,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return a}static _compilePatterns(t,s,n){let a=[];if(t)for(let o=0,i=t.length;o<i;o++){const l=t[o];let c=-1;if(l.include){const u=lH(l.include);switch(u.kind){case 0:case 1:c=Zn.getCompiledRuleId(n[l.include],s,n);break;case 2:let f=n[u.ruleName];f&&(c=Zn.getCompiledRuleId(f,s,n));break;case 3:case 4:const h=u.scopeName,g=u.kind===4?u.ruleName:null,v=s.getExternalGrammar(h,n);if(v)if(g){let y=v.repository[g];y&&(c=Zn.getCompiledRuleId(y,s,v.repository))}else c=Zn.getCompiledRuleId(v.repository.$self,s,v.repository);break}}else c=Zn.getCompiledRuleId(l,s,n);if(c!==-1){const u=s.getRule(c);let f=!1;if((u instanceof QL||u instanceof FE||u instanceof hj)&&u.hasMissingPatterns&&u.patterns.length===0&&(f=!0),f)continue;a.push(c)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},mv=class uH{constructor(t,s){Re(this,"source");Re(this,"ruleId");Re(this,"hasAnchor");Re(this,"hasBackReferences");Re(this,"_anchorCache");if(t&&typeof t=="string"){const n=t.length;let a=0,o=[],i=!1;for(let l=0;l<n;l++)if(t.charAt(l)==="\\"&&l+1<n){const u=t.charAt(l+1);u==="z"?(o.push(t.substring(a,l)),o.push("$(?!\\n)(?<!\\n)"),a=l+2):(u==="A"||u==="G")&&(i=!0),l++}this.hasAnchor=i,a===0?this.source=t:(o.push(t.substring(a,n)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=s,typeof this.source=="string"?this.hasBackReferences=Fve.test(this.source):this.hasBackReferences=!1}clone(){return new uH(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,s){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let n=s.map(a=>t.substring(a.start,a.end));return XL.lastIndex=0,this.source.replace(XL,(a,o)=>rH(n[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],s=[],n=[],a=[],o,i,l,c;for(o=0,i=this.source.length;o<i;o++)l=this.source.charAt(o),t[o]=l,s[o]=l,n[o]=l,a[o]=l,l==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="ï¿¿",s[o+1]="ï¿¿",n[o+1]="A",a[o+1]="A"):c==="G"?(t[o+1]="ï¿¿",s[o+1]="G",n[o+1]="ï¿¿",a[o+1]="G"):(t[o+1]=c,s[o+1]=c,n[o+1]=c,a[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:s.join(""),A1_G0:n.join(""),A1_G1:a.join("")}}resolveAnchors(t,s){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?s?this._anchorCache.A1_G1:this._anchorCache.A1_G0:s?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},gv=class{constructor(){Re(this,"_items");Re(this,"_hasAnchors");Re(this,"_cached");Re(this,"_anchorCache");
663this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(s=>s.source);this._cached=new ZL(e,t,this._items.map(s=>s.ruleId))}return this._cached}compileAG(e,t,s){return this._hasAnchors?t?s?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,s)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,s)),this._anchorCache.A1_G0):s?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,s)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,s)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,s){let n=this._items.map(a=>a.resolveAnchors(t,s));return new ZL(e,n,this._items.map(a=>a.ruleId))}},ZL=class{constructor(e,t,s){Re(this,"scanner");this.regExps=t,this.rules=s,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,s=this.rules.length;t<s;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(` 664`)}findNextMatchSync(e,t,s){const n=this.scanner.findNextMatchSync(e,t,s);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},ES=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Kl,Hve=(Kl=class{constructor(t,s){Re(this,"_defaultAttributes");Re(this,"_embeddedLanguagesMatcher");Re(this,"_getBasicScopeAttributes",new nH(t=>{const s=this._scopeToLanguage(t),n=this._toStandardTokenType(t);return new ES(s,n)}));this._defaultAttributes=new ES(t,8),this._embeddedLanguagesMatcher=new Vve(Object.entries(s||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Kl._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const s=t.match(Kl.STANDARD_TOKEN_TYPE_REGEXP);if(!s)return 8;switch(s[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},Re(Kl,"_NULL_SCOPE_METADATA",new ES(0,0)),Re(Kl,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Kl),Vve=class{constructor(e){Re(this,"values");Re(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([s,n])=>rH(s));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},eD=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function pH(e,t,s,n,a,o,i,l){const c=t.content.length;let u=!1,f=-1;if(i){const v=Gve(e,t,s,n,a,o);a=v.stack,n=v.linePos,s=v.isFirstLine,f=v.anchorPosition}const h=Date.now();for(;!u;){if(l!==0&&Date.now()-h>l)return new eD(a,!0);g()}return new eD(a,!1);function g(){const v=Wve(e,t,s,n,a,f);if(!v){o.produce(a,c),u=!0;return}const y=v.captureIndices,_=v.matchedRuleId,j=y&&y.length>0?y[0].end>n:!1;if(_===Bve){const w=a.getRule(e);o.produce(a,y[0].start),a=a.withContentNameScopesList(a.nameScopesList),ux(e,t,s,a,o,w.endCaptures,y),o.produce(a,y[0].end);const k=a;if(a=a.parent,f=k.getAnchorPos(),!j&&k.getEnterPos()===n){a=k,o.produce(a,c),u=!0;return}}else{const w=e.getRule(_);o.produce(a,y[0].start);const k=a,S=w.getName(t.content,y),E=a.contentNameScopesList.pushAttributed(S,e);if(a=a.push(_,n,f,y[0].end===c,null,E,E),w instanceof FE){const T=w;ux(e,t,s,a,o,T.beginCaptures,y),o.produce(a,y[0].end),f=y[0].end;const A=T.getContentName(t.content,y),R=E.pushAttributed(A,e);if(a=a.withContentNameScopesList(R),T.endHasBackReferences&&(a=a.withEndRule(T.getEndWithResolvedBackReferences(t.content,y))),!j&&k.hasSameRuleAs(a)){a=a.pop(),o.produce(a,c),u=!0;return}}else if(w instanceof hj){const T=w;ux(e,t,s,a,o,T.beginCaptures,y),o.produce(a,y[0].end),f=y[0].end;const A=T.getContentName(t.content,y),R=E.pushAttributed(A,e);if(a=a.withContentNameScopesList(R),T.whileHasBackReferences&&(a=a.withEndRule(T.getWhileWithRes
664olvedBackReferences(t.content,y))),!j&&k.hasSameRuleAs(a)){a=a.pop(),o.produce(a,c),u=!0;return}}else if(ux(e,t,s,a,o,w.captures,y),o.produce(a,y[0].end),a=a.pop(),!j){a=a.safePop(),o.produce(a,c),u=!0;return}}y[0].end>n&&(n=y[0].end,s=!1)}}function Gve(e,t,s,n,a,o){let i=a.beginRuleCapturedEOL?0:-1;const l=[];for(let c=a;c;c=c.pop()){const u=c.getRule(e);u instanceof hj&&l.push({rule:u,stack:c})}for(let c=l.pop();c;c=l.pop()){const{ruleScanner:u,findOptions:f}=Jve(c.rule,e,c.stack.endRule,s,n===i),h=u.findNextMatchSync(t,n,f);if(h){if(h.ruleId!==cH){a=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(o.produce(c.stack,h.captureIndices[0].start),ux(e,t,s,c.stack,o,c.rule.whileCaptures,h.captureIndices),o.produce(c.stack,h.captureIndices[0].end),i=h.captureIndices[0].end,h.captureIndices[0].end>n&&(n=h.captureIndices[0].end,s=!1))}else{a=c.stack.pop();break}}return{stack:a,linePos:n,anchorPosition:i,isFirstLine:s}}function Wve(e,t,s,n,a,o){const i=Yve(e,t,s,n,a,o),l=e.getInjections();if(l.length===0)return i;const c=Kve(l,e,t,s,n,a,o);if(!c)return i;if(!i)return c;const u=i.captureIndices[0].start,f=c.captureIndices[0].start;return f<u||c.priorityMatch&&f===u?c:i}function Yve(e,t,s,n,a,o){const i=a.getRule(e),{ruleScanner:l,findOptions:c}=fH(i,e,a.endRule,s,n===o),u=l.findNextMatchSync(t,n,c);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function Kve(e,t,s,n,a,o,i){let l=Number.MAX_VALUE,c=null,u,f=0;const h=o.contentNameScopesList.getScopeNames();for(let g=0,v=e.length;g<v;g++){const y=e[g];if(!y.matcher(h))continue;const _=t.getRule(y.ruleId),{ruleScanner:j,findOptions:w}=fH(_,t,null,n,a===i),k=j.findNextMatchSync(s,a,w);if(!k)continue;const S=k.captureIndices[0].start;if(!(S>=l)&&(l=S,c=k.captureIndices,u=k.ruleId,f=y.priority,l===a))break}return c?{priorityMatch:f===-1,captureIndices:c,matchedRuleId:u}:null}function fH(e,t,s,n,a){return{ruleScanner:e.compileAG(t,s,n,a),findOptions:0}}function Jve(e,t,s,n,a){return{ruleScanner:e.compileWhileAG(t,s,n,a),findOptions:0}}function ux(e,t,s,n,a,o,i){if(o.length===0)return;const l=t.content,c=Math.min(o.length,i.length),u=[],f=i[0].end;for(let h=0;h<c;h++){const g=o[h];if(g===null)continue;const v=i[h];if(v.length===0)continue;if(v.start>f)break;for(;u.length>0&&u[u.length-1].endPos<=v.start;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?a.produceFromScopes(u[u.length-1].scopes,v.start):a.produce(n,v.start),g.retokenizeCapturedWithRuleId){const _=g.getName(l,i),j=n.contentNameScopesList.pushAttributed(_,e),w=g.getContentName(l,i),k=j.pushAttributed(w,e),S=n.push(g.retokenizeCapturedWithRuleId,v.start,-1,!1,null,j,k),E=e.createOnigString(l.substring(0,v.end));pH(e,E,s&&v.start===0,v.start,S,a,!1,0),iH(E);continue}const y=g.getName(l,i);if(y!==null){const j=(u.length>0?u[u.length-1].scopes:n.contentNameScopesList).pushAttributed(y,e);u.push(new Xve(j,v.end))}}for(;u.length>0;)a.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var Xve=class{constructor(e,t){Re(this,"scopes");Re(this,"endPos");this.scopes=e,this.endPos=t}};function Qve(e,t,s,n,a,o,i,l){return new ebe(e,t,s,n,a,o,i,l)}function tD(e,t,s,n,a){const o=pj(t,mj),i=dH.getCompiledRuleId(s,n,a.repository);for(const l of o)e.push({debugSelector:t,matcher:l.matcher,ruleId:i,grammar:a,priority:l.priority})}function mj(e,t){if(t.length<e.length)return!1;let s=0;return e.every(n=>{for(let a=s;a<t.length;a++)if(Zve(t[a],n))return s=a+1,!0;return!1})}function Zve(e,t){if(!e)return!1;if(e===t)return!0;const s=t.length;return e.length>s&&e.substr(0,s)===t&&e[s]==="."}var ebe=class{constructor(e,t,s,n,a,o,i,l){Re(this,"_rootId");Re(this,"_lastRuleId");Re(this,"_ruleId2desc");Re(this,"_includedGrammars");Re(this,"_grammarRepository");Re(this,"_grammar");Re(this,"_injections");Re(this,"_basicScopeAttributesProvider");Re(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new Hve(s,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={}
664,this._grammarRepository=i,this._grammar=sD(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const c of Object.keys(a)){const u=pj(c,mj);for(const f of u)this._tokenTypeMatchers.push({matcher:f.matcher,type:a[c]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],s=this._rootScopeName,n=e.lookup(s);if(n){const a=n.injections;if(a)for(let i in a)tD(t,i,a[i],this,n);const o=this._grammarRepository.injections(s);o&&o.forEach(i=>{const l=this.getExternalGrammar(i);if(l){const c=l.injectionSelector;c&&tD(t,c,l,this,l)}})}return t.sort((a,o)=>a.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,s=e(t);return this._ruleId2desc[t]=s,s}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const s=this._grammarRepository.lookup(e);if(s)return this._includedGrammars[e]=sD(s,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,s=0){const n=this._tokenize(e,t,!1,s);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(e,t,s=0){const n=this._tokenize(e,t,!0,s);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(e,t,s,n){this._rootId===-1&&(this._rootId=dH.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===BE.NULL){a=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),f=this.themeProvider.getDefaults(),h=Ch.set(0,u.languageId,u.tokenType,null,f.fontStyle,f.foregroundId,f.backgroundId),g=this.getRule(this._rootId).getName(null,null);let v;g?v=Px.createRootAndLookUpScopeName(g,h,this):v=Px.createRoot("unknown",h),t=new BE(null,this._rootId,-1,-1,!1,null,v,v)}else a=!1,t.reset();e=e+` 665`;const o=this.createOnigString(e),i=o.content.length,l=new sbe(s,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=pH(this,o,a,0,t,l,!0,n);return iH(o),{lineLength:i,lineTokens:l,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function sD(e,t){return e=bve(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Px=class Di{constructor(t,s,n){this.parent=t,this.scopePath=s,this.tokenAttributes=n}static fromExtension(t,s){let n=t,a=(t==null?void 0:t.scopePath)??null;for(const o of s)a=CS.push(a,o.scopeNames),n=new Di(n,a,o.encodedTokenAttributes);return n}static createRoot(t,s){return new Di(null,new CS(null,t),s)}static createRootAndLookUpScopeName(t,s,n){const a=n.getMetadataForScope(t),o=new CS(null,t),i=n.themeProvider.themeMatch(o),l=Di.mergeAttributes(s,a,i);return new Di(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Di.equals(this,t)}static equals(t,s){do{if(t===s||!t&&!s)return!0;if(!t||!s||t.scopeName!==s.scopeName||t.tokenAttributes!==s.tokenAttributes)return!1;t=t.parent,s=s.parent}while(!0)}static mergeAttributes(t,s,n){let a=-1,o=0,i=0;return n!==null&&(a=n.fontStyle,o=n.foregroundId,i=n.backgroundId),Ch.set(t,s.languageId,s.tokenType,null,a,o,i)}pushAttributed(t,s){if(t===null)return this;if(t.indexOf(" ")===-1)return Di._pushAttributed(this,t,s);const n=t.split(/ /g);let a=this;for(const o of n)a=Di._pushAttributed(a,o,s);return a}static _pushAttributed(t,s,n){const a=n.getMetadataForScope(s),o=t.scopePath.push(s),i=n.themeProvider.themeMatch(o),l=Di.mergeAttributes(t.tokenAttributes,a,i);return new Di(t,o,l)}
665getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var a;const s=[];let n=this;for(;n&&n!==t;)s.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(((a=n.parent)==null?void 0:a.scopePath)??null)}),n=n.parent;return n===t?s.reverse():void 0}},Lo,BE=(Lo=class{constructor(t,s,n,a,o,i,l,c){Re(this,"_stackElementBrand");Re(this,"_enterPos");Re(this,"_anchorPos");Re(this,"depth");this.parent=t,this.ruleId=s,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=l,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=a}equals(t){return t===null?!1:Lo._equals(this,t)}static _equals(t,s){return t===s?!0:this._structuralEquals(t,s)?Px.equals(t.contentNameScopesList,s.contentNameScopesList):!1}static _structuralEquals(t,s){do{if(t===s||!t&&!s)return!0;if(!t||!s||t.depth!==s.depth||t.ruleId!==s.ruleId||t.endRule!==s.endRule)return!1;t=t.parent,s=s.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Lo._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,s,n,a,o,i,l){return new Lo(this,t,s,n,a,o,i,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,s){var n,a;return this.parent&&(s=this.parent._writeString(t,s)),t[s++]=`(${this.ruleId}, ${(n=this.nameScopesList)==null?void 0:n.toString()}, ${(a=this.contentNameScopesList)==null?void 0:a.toString()})`,s}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Lo(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let s=this;for(;s&&s._enterPos===t._enterPos;){if(s.ruleId===t.ruleId)return!0;s=s.parent}return!1}toStateStackFrame(){var t,s,n;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((s=this.nameScopesList)==null?void 0:s.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((n=this.contentNameScopesList)==null?void 0:n.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,s){const n=Px.fromExtension((t==null?void 0:t.nameScopesList)??null,s.nameScopesList);return new Lo(t,s.ruleId,s.enterPos??-1,s.anchorPos??-1,s.beginRuleCapturedEOL,s.endRule,n,Px.fromExtension(n,s.contentNameScopesList))}},Re(Lo,"NULL",new Lo(null,0,0,0,!1,null,null,null)),Lo),tbe=class{constructor(e,t){Re(this,"balancedBracketScopes");Re(this,"unbalancedBracketScopes");Re(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(s=>s==="*"?(this.allowAny=!0,[]):pj(s,mj).map(n=>n.matcher)),this.unbalancedBracketScopes=t.flatMap(s=>pj(s,mj).map(n=>n.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},sbe=class{constructor(e,t,s,n){Re(this,"_emitBinaryTokens");Re(this,"_lineText");Re(this,"_tokens");Re(this,"_binaryTokens");Re(this,"_lastTokenEndIndex");Re(this,"_tokenTypeOverrides");this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=s,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var n;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let a=(e==null?void 0:e.tokenAttributes)??0,o=!1;if((n=this.balancedBracketSelectors)!=null&&n.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>
6650||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(e==null?void 0:e.getScopeNames())??[];for(const l of this._tokenTypeOverrides)l.matcher(i)&&(a=Ch.set(a,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(i))}if(o&&(a=Ch.set(a,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}const s=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:s}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const s=new Uint32Array(this._binaryTokens.length);for(let n=0,a=this._binaryTokens.length;n<a;n++)s[n]=this._binaryTokens[n];return s}},rbe=class{constructor(e,t){Re(this,"_grammars",new Map);Re(this,"_rawGrammars",new Map);Re(this,"_injectionGrammars",new Map);Re(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,s,n,a){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,Qve(e,o,t,s,n,a,this,this._onigLib))}return this._grammars.get(e)}},nbe=class{constructor(t){Re(this,"_options");Re(this,"_syncRegistry");Re(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new rbe(uj.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,s){this._syncRegistry.setTheme(uj.createFromRawTheme(t,s))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,s,n){return this.loadGrammarWithConfiguration(t,s,{embeddedLanguages:n})}loadGrammarWithConfiguration(t,s,n){return this._loadGrammar(t,s,n.embeddedLanguages,n.tokenTypes,new tbe(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,s,n,a,o){const i=new Ive(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(l=>this._loadSingleGrammar(l.scopeName)),i.processQueue();return this._grammarForScopeName(t,s,n,a,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const s=this._options.loadGrammar(t);if(s){const n=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(s,n)}}addGrammar(t,s=[],n=0,a=null){return this._syncRegistry.addGrammar(t,s),this._grammarForScopeName(t.scopeName,n,a)}_grammarForScopeName(t,s=0,n=null,a=null,o=null){return this._syncRegistry.grammarForScopeName(t,s,n,a,o)}},qE=BE.NULL;const abe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Qv{constructor(t,s,n){this.normal=s,this.property=t,n&&(this.space=n)}}Qv.prototype.normal={};Qv.prototype.property={};Qv.prototype.space=void 0;function hH(e,t){const s={},n={};for(const a of e)Object.assign(s,a.property),Object.assign(n,a.normal);return new Qv(s,n,t)}function zE(e){return e.toLowerCase()}class Ya{constructor(t,s){this.attribute=s,this.property=t}}Ya.prototype.attribute="";Ya.prototype.booleanish=!1;Ya.prototype.boolean=!1;Ya.prototype.commaOrSpaceSeparated=!1;Ya.prototype.commaSeparated=!1;Ya.prototype.defined=!1;Ya.prototype.mustUseProperty=!1;Ya.prototype.number=!1;Ya.prototype.overloadedBoolean=!1;Ya.prototype.property="";Ya.prototype.spaceSeparated=!1;Ya.prototype.space=void 0;let obe=0;const _s=Tp(),tn=Tp(),HE=Tp(),bt=Tp(),vr=Tp(),th=Tp(),ro=Tp();function Tp(){return 2**++obe}const VE=Object.freeze(Object.defineProperty({__proto__:null,boolean:_s,booleanish:tn,commaOrSpaceSeparated:ro,commaSeparated:th,number:bt,overloadedBoolean:HE,spaceSeparated:vr},Symbol.toStringTag,{value:"Module"})),TS=Object.keys(VE);class fR extends Ya{constructor(t,s,n,a){let o=-1;if(super(t,s),rD(this,"space",a),typeof n=="number")for(;++o<TS.length;){const i=TS[o];rD(this,TS[o],(n&VE[i])===VE[i])}}}fR.prototype.defined=!0;function rD(e,t,s){s&&(e[t]=s)}function am(e){const t={},s={};for(const[n,a]of Object.entries(e.properties)){const o=new fR(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,s[zE(n)]=n,s[zE(o.attribute)]=n}return new Qv(t,s,e.space)}const mH=am({properties:{ariaActiveDescendant:null,ariaAtomic:tn,ariaAutoComplete:null,ariaBusy:tn,ariaChecked:tn,ariaColCount:bt,ariaColIndex:bt,ariaColSpan:bt,ariaControl
vendor: 4,622 bytes, line 665
665s:vr,ariaCurrent:null,ariaDescribedBy:vr,ariaDetails:null,ariaDisabled:tn,ariaDropEffect:vr,ariaErrorMessage:null,ariaExpanded:tn,ariaFlowTo:vr,ariaGrabbed:tn,ariaHasPopup:null,ariaHidden:tn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vr,ariaLevel:bt,ariaLive:null,ariaModal:tn,ariaMultiLine:tn,ariaMultiSelectable:tn,ariaOrientation:null,ariaOwns:vr,ariaPlaceholder:null,ariaPosInSet:bt,ariaPressed:tn,ariaReadOnly:tn,ariaRelevant:null,ariaRequired:tn,ariaRoleDescription:vr,ariaRowCount:bt,ariaRowIndex:bt,ariaRowSpan:bt,ariaSelected:tn,ariaSetSize:bt,ariaSort:null,ariaValueMax:bt,ariaValueMin:bt,ariaValueNow:bt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function gH(e,t){return t in e?e[t]:t}function xH(e,t){return gH(e,t.toLowerCase())}const ibe=am({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:th,acceptCharset:vr,accessKey:vr,action:null,allow:null,allowFullScreen:_s,allowPaymentRequest:_s,allowUserMedia:_s,alt:null,as:null,async:_s,autoCapitalize:null,autoComplete:vr,autoFocus:_s,autoPlay:_s,blocking:vr,capture:null,charSet:null,checked:_s,cite:null,className:vr,cols:bt,colSpan:null,content:null,contentEditable:tn,controls:_s,controlsList:vr,coords:bt|th,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_s,defer:_s,dir:null,dirName:null,disabled:_s,download:HE,draggable:tn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_s,formTarget:null,headers:vr,height:bt,hidden:HE,high:bt,href:null,hrefLang:null,htmlFor:vr,httpEquiv:vr,id:null,imageSizes:null,imageSrcSet:null,inert:_s,inputMode:null,integrity:null,is:null,isMap:_s,itemId:null,itemProp:vr,itemRef:vr,itemScope:_s,itemType:vr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_s,low:bt,manifest:null,max:null,maxLength:bt,media:null,method:null,min:null,minLength:bt,multiple:_s,muted:_s,name:null,nonce:null,noModule:_s,noValidate:_s,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_s,optimum:bt,pattern:null,ping:vr,placeholder:null,playsInline:_s,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_s,referrerPolicy:null,rel:vr,required:_s,reversed:_s,rows:bt,rowSpan:bt,sandbox:vr,scope:null,scoped:_s,seamless:_s,selected:_s,shadowRootClonable:_s,shadowRootDelegatesFocus:_s,shadowRootMode:null,shape:null,size:bt,sizes:null,slot:null,span:bt,spellCheck:tn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:bt,step:null,style:null,tabIndex:bt,target:null,title:null,translate:null,type:null,typeMustMatch:_s,useMap:null,value:tn,width:bt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vr,axis:null,background:null,bgColor:null,border:bt,borderColor:null,bottomMargin:bt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_s,declare:_s,event:null,face:null,frame:null,frameBorder:null,hSpace:bt,leftMargin:bt,link:null,longDesc:null,lowSrc:null,marginHeight:bt,marginWidth:bt,n
665oResize:_s,noHref:_s,noShade:_s,noWrap:_s,object:null,profile:null,prompt:null,rev:null,rightMargin:bt,rules:null,scheme:null,scrolling:tn,standby:null,summary:null,text:null,topMargin:bt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:bt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_s,disableRemotePlayback:_s,prefix:null,property:null,results:bt,security:null,unselectable:null},space:"html",transform:xH}),lbe=am({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
665-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ro,accentHeight:bt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:bt,amplitude:bt,arabicForm:null,ascent:bt,attributeName:null,attributeType:null,azimuth:bt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:bt,by:null,calcMode:null,capHeight:bt,className:vr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:bt,diffuseConstant:bt,direction:null,display:null,dur:null,divisor:bt,dominantBaseline:null,download:_s,dx:null,dy:null,edgeMode:null,editable:null,elevation:bt,enableBackground:null,end:null,event:null,exponent:bt,externalResourcesRequired:null,fill:null,fillOpacity:bt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:th,g2:th,glyphName:th,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:bt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:bt,horizOriginX:bt,horizOriginY:bt,id:null,ideographic:bt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:bt,k:bt,k1:bt,k2:bt,k3:bt,k4:bt,kernelMatrix:ro,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:bt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:bt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 2,948 bytes, line 665
665Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:bt,overlineThickness:bt,paintOrder:null,panose1:null,path:null,pathLength:bt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:bt,pointsAtY:bt,pointsAtZ:bt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ro,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ro,rev:ro,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ro,requiredFeatures:ro,requiredFonts:ro,requiredFormats:ro,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:bt,specularExponent:bt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:bt,strikethroughThickness:bt,string:null,stroke:null,strokeDashArray:ro,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:bt,strokeOpacity:bt,strokeWidth:null,style:null,surfaceScale:bt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ro,tabIndex:bt,tableValues:null,target:null,targetX:bt,targetY:bt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ro,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:bt,underlineThickness:bt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:bt,values:null,vAlphabetic:bt,vMathematical:bt,vectorEffect:null,vHanging:bt,vIdeographic:bt,version:null,vertAdvY:bt,vertOriginX:bt,vertOriginY:bt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:bt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gH}),vH=am({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),bH=am({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:xH}),yH=am({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),cbe=/[A-Z]/g,nD=/-[a-z]/g,dbe=/^data[-\w.:]+$/i;function ube(e,t){const s=zE(t);let n=t,a=Ya;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&dbe.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(nD,fbe);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!nD.test(o)){let i=o.replace(cbe,pbe);
665i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}a=fR}return new a(n,t)}function pbe(e){return"-"+e.toLowerCase()}function fbe(e){return e.charAt(1).toUpperCase()}const hbe=hH([mH,ibe,vH,bH,yH],"html"),_H=hH([mH,lbe,vH,bH,yH],"svg"),aD={}.hasOwnProperty;function mbe(e,t){const s=t||{};function n(a,...o){let i=n.invalid;const l=n.handlers;if(a&&aD.call(a,e)){const c=String(a[e]);i=aD.call(l,c)?l[c]:n.unknown}if(i)return i.call(this,a,...o)}return n.handlers=s.handlers||{},n.invalid=s.invalid,n.unknown=s.unknown,n}const gbe=/["&'<>`]/g,xbe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,vbe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,bbe=/[|\\{}()[\]^$+*?.]/g,oD=new WeakMap;function ybe(e,t){if(e=e.replace(t.subset?_be(t.subset):gbe,n),t.subset||t.escapeOnly)return e;return e.replace(xbe,s).replace(vbe,n);function s(a,o,i){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function n(a,o,i){return t.format(a.charCodeAt(0),i.charCodeAt(o+1),t)}}function _be(e){let t=oD.get(e);return t||(t=jbe(e),oD.set(e,t)),t}function jbe(e){const t=[];let s=-1;for(;++s<e.length;)t.push(e[s].replace(bbe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const wbe=/[\dA-Fa-f]/;function Nbe(e,t,s){const n="&#x"+e.toString(16).toUpperCase();return s&&t&&!wbe.test(String.fromCharCode(t))?n:n+";"}const kbe=/\d/;function Sbe(e,t,s){const n="&#"+String(e);return s&&t&&!kbe.test(String.fromCharCode(t))?n:n+";"}const Cbe=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","
665sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],RS={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"Â¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"Â",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"Ã",Aacute:"Ã",Acirc:"Ã",Atilde:"Ã",Auml:"Ã",Aring:"Ã
",AElig:"Ã",Ccedil:"Ã",Egrave:"Ã",Eacute:"Ã",Ecirc:"Ã",Euml:"Ã",Igrave:"Ã",Iacute:"Ã",Icirc:"Ã",Iuml:"Ã",ETH:"Ã",Ntilde:"Ã",Ograve:"Ã",Oacute:"Ã",Ocirc:"Ã",Otilde:"Ã",Ouml:"Ã",times:"Ã",Oslash:"Ã",Ugrave:"Ã",Uacute:"Ã",Ucirc:"Ã",Uuml:"Ã",Yacute:"Ã",THORN:"Ã",szlig:"Ã",agrave:"à ",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"Ã¥",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"Ã",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"Æ",Alpha:"Î",Beta:"Î",Gamma:"Î",Delta:"Î",Epsilon:"Î",Zeta:"Î",Eta:"Î",Theta:"Î",Iota:"Î",Kappa:"Î",Lambda:"Î",Mu:"Î",Nu:"Î",Xi:"Î",Omicron:"Î",Pi:"Î ",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Î¥",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"Ï",rho:"Ï",sigmaf:"Ï",sigma:"Ï",tau:"Ï",upsilon:"Ï
",phi:"Ï",chi:"Ï",psi:"Ï",omega:"Ï",thetasym:"Ï",upsih:"Ï",piv:"Ï",bull:"â¢",hellip:"â¦",prime:"â²",Prime:"â³",oline:"â¾",frasl:"â",weierp:"â",image:"â",real:"â",trade:"â¢",alefsym:"âµ",larr:"â",uarr:"â",rarr:"â",darr:"â",harr:"â",crarr:"âµ",lArr:"â",uArr:"â",rArr:"â",dArr:"â",hArr:"â",forall:"â",part:"â",exist:"â",empty:"â
",nabla:"â",isin:"â",notin:"â",ni:"â",prod:"â",sum:"â",minus:"â",lowast:"â",radic:"â",prop:"â",infin:"â",ang:"â ",and:"â§",or:"â¨",cap:"â©",cup:"âª",int:"â«",there4:"â´",sim:"â¼",cong:"â
",asymp:"â",ne:"â ",equiv:"â¡",le:"â¤",ge:"â¥",sub:"â",sup:"â",nsub
665:"â",sube:"â",supe:"â",oplus:"â",otimes:"â",perp:"â¥",sdot:"â
",lceil:"â",rceil:"â",lfloor:"â",rfloor:"â",lang:"â©",rang:"âª",loz:"â",spades:"â ",clubs:"â£",hearts:"â¥",diams:"â¦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Å",oelig:"Å",Scaron:"Å ",scaron:"Å¡",Yuml:"Ÿ",circ:"Ë",tilde:"Ë",ensp:"â",emsp:"â",thinsp:"â",zwnj:"â",zwj:"â",lrm:"â",rlm:"â",ndash:"â",mdash:"â",lsquo:"â",rsquo:"â",sbquo:"â",ldquo:"â",rdquo:"â",bdquo:"â",dagger:"â ",Dagger:"â¡",permil:"â°",lsaquo:"â¹",rsaquo:"âº",euro:"â¬"},Ebe=["cent","copy","divide","gt","lt","not","para","times"],jH={}.hasOwnProperty,GE={};let a0;for(a0 in RS)jH.call(RS,a0)&&(GE[RS[a0]]=a0);const Tbe=/[^\dA-Za-z]/;function Rbe(e,t,s,n){const a=String.fromCharCode(e);if(jH.call(GE,a)){const o=GE[a],i="&"+o;return s&&Cbe.includes(o)&&!Ebe.includes(o)&&(!n||t&&t!==61&&Tbe.test(String.fromCharCode(t)))?i:i+";"}return""}function Abe(e,t,s){let n=Nbe(e,t,s.omitOptionalSemicolons),a;if((s.useNamedReferences||s.useShortestReferences)&&(a=Rbe(e,t,s.omitOptionalSemicolons,s.attribute)),(s.useShortestReferences||!a)&&s.useShortestReferences){const o=Sbe(e,t,s.omitOptionalSemicolons);o.length<n.length&&(n=o)}return a&&(!s.useShortestReferences||a.length<n.length)?a:n}function sh(e,t){return ybe(e,Object.assign({format:Abe},t))}const Pbe=/^>|^->|<!--|-->|--!>|<!-$/g,Ibe=[">"],Mbe=["<",">"];function Obe(e,t,s,n){return n.settings.bogusComments?"<?"+sh(e.value,Object.assign({},n.settings.characterReferences,{subset:Ibe}))+">":"<!--"+e.value.replace(Pbe,a)+"-->";function a(o){return sh(o,Object.assign({},n.settings.characterReferences,{subset:Mbe}))}}function Lbe(e,t,s,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function iD(e,t){const s=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,a=s.indexOf(t);for(;a!==-1;)n++,a=s.indexOf(t,a+t.length);return n}function Dbe(e,t){const s=t||{};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}function $be(e){return e.join(" ").trim()}const Ube=/[ \t\n\f\r]/g;function hR(e){return typeof e=="object"?e.type==="text"?lD(e.value):!1:lD(e)}function lD(e){return e.replace(Ube,"")===""}const Nn=NH(1),wH=NH(-1),Fbe=[];function NH(e){return t;function t(s,n,a){const o=s?s.children:Fbe;let i=(n||0)+e,l=o[i];if(!a)for(;l&&hR(l);)i+=e,l=o[i];return l}}const Bbe={}.hasOwnProperty;function kH(e){return t;function t(s,n,a){return Bbe.call(e,s.tagName)&&e[s.tagName](s,n,a)}}const mR=kH({body:zbe,caption:AS,colgroup:AS,dd:Wbe,dt:Gbe,head:AS,html:qbe,li:Vbe,optgroup:Ybe,option:Kbe,p:Hbe,rp:cD,rt:cD,tbody:Xbe,td:dD,tfoot:Qbe,th:dD,thead:Jbe,tr:Zbe});function AS(e,t,s){const n=Nn(s,t,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&hR(n.value.charAt(0)))}function qbe(e,t,s){const n=Nn(s,t);return!n||n.type!=="comment"}function zbe(e,t,s){const n=Nn(s,t);return!n||n.type!=="comment"}function Hbe(e,t,s){const n=Nn(s,t);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!s||!(s.type==="element"&&(s.tagName==="a"||s.tagName==="audio"||s.tagName==="del"||s.tagName==="ins"||s.tagName==="map"||s.tagName==="noscript"||s.tagName==="video"))}function Vbe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&n.tagName==="li"}function Gbe(e,t,s){const n=Nn(s,t);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function Wbe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function cD(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function Ybe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&n.tagName==="optgroup"}
665function Kbe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function Jbe(e,t,s){const n=Nn(s,t);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function Xbe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function Qbe(e,t,s){return!Nn(s,t)}function Zbe(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&n.tagName==="tr"}function dD(e,t,s){const n=Nn(s,t);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const eye=kH({body:rye,colgroup:nye,head:sye,html:tye,tbody:aye});function tye(e){const t=Nn(e,-1);return!t||t.type!=="comment"}function sye(e){const t=new Set;for(const n of e.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(t.has(n.tagName))return!1;t.add(n.tagName)}const s=e.children[0];return!s||s.type==="element"}function rye(e){const t=Nn(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&hR(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function nye(e,t,s){const n=wH(s,t),a=Nn(e,-1,!0);return s&&n&&n.type==="element"&&n.tagName==="colgroup"&&mR(n,s.children.indexOf(n),s)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function aye(e,t,s){const n=wH(s,t),a=Nn(e,-1);return s&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&mR(n,s.children.indexOf(n),s)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const o0={name:[[` 666\f\r &/=>`.split(""),` 667\f\r "&'/=>\``.split("")],[`\0 668\f\r "&'/<=>`.split(""),`\0 669\f\r "&'/<=>\``.split("")]],unquoted:[[` 670\f\r &>`.split(""),`\0 671\f\r "&'<=>\``.split("")],[`\0 672\f\r "&'<=>\``.split(""),`\0 673\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function oye(e,t,s,n){const a=n.schema,o=a.space==="svg"?!1:n.settings.omitOptionalTags;let i=a.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase());const l=[];let c;a.space==="html"&&e.tagName==="svg"&&(n.schema=_H);const u=iye(n,e.properties),f=n.all(a.space==="html"&&e.tagName==="template"?e.content:e);return n.schema=a,f&&(i=!1),(u||!o||!eye(e,t,s))&&(l.push("<",e.tagName,u?" "+u:""),i&&(a.space==="svg"||n.settings.closeSelfClosing)&&(c=u.charAt(u.length-1),(!n.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(f),!i&&(!o||!mR(e,t,s))&&l.push("</"+e.tagName+">"),l.join("")}function iye(e,t){const s=[];let n=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const o=lye(e,a,t[a]);o&&s.push(o)}}for(;++n<s.length;){const o=e.settings.tightAttributes?s[n].charAt(s[n].length-1):void 0;n!==s.length-1&&o!=='"'&&o!=="'"&&(s[n]+=" ")}return s.join("")}function lye(e,t,s){const n=ube(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let i=e.quote,l;if(n.overloadedBoolean&&(s===n.attribute||s==="")?s=!0:(n.boolean||n.overloadedBoolean)&&(typeof s!="string"||s===n.attribute||s==="")&&(s=!!s),s==null||s===!1||typeof s=="number"&&Number.isNaN(s))return"";const c=sh(n.attribute,Object.assign({},e.settings.characterReferences,{subset:o0.name[a][o]}));return s===!0||(s=Array.isArray(s)?(n.commaSeparated?Dbe:$be)(s,{padLeft:!e.settings.tightCommaSeparatedLists}):String(s),e.settings.collapseEmptyAttributes&&!s)?c:(e.settings.preferUnquoted&&(l=sh(s,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:o0.unquoted[a][o]}))),l!==s&&(e.settings.quoteSmart&&iD(s,i)>iD(s,e.alternative)&&(i=e.alternative),l=i+sh(s,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?o0.single:o0.double)[a][o],attribute:!0}))+i),c+(l&&"="+l))}const cye=["<","&"];function SH(e,t,s,n){return s&&s.type==="element"&&(s.tagName==="script"||s.tagName==="style")?e.value:sh(e.value,Object.assign({},n.settings.characterReferences,{subset:cye}))}function dye(e,t,s,n){return n.settings.allowDangerousHtml?e.value:SH(e,t,s,n)}function uye(e,t,s,n){return n.all(e)}const pye=mbe("type",{invalid:fye,unknown:hye,handlers:{comment:Obe,doctype:Lbe,element:oye,raw:dye,root:uye,text:SH}});function fye(e){throw new Error("Expected node, not `"+e+"`")}function hye(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const mye={},gye={},xye=[];function vye(e,t){const s=t||mye,n=s.quote||'"',a=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:bye,all:yye,settings:{omitOptionalTags:s.omitOptionalTags||!1,allowParseErrors:s.allowParseErrors||!1,allowDangerousCharacters:s.allowDangerousCharacters||!1,quoteSmart:s.quoteSmart||!1,preferUnquoted:s.preferUnquoted||!1,tightAttributes:s.tightAttributes||!1,upperDoctype:s.upperDoctype||!1,tightDoctype:s.tightDoctype||!1,bogusComments:s.bogusComments||!1,tightCommaSeparatedLists:s.tightCommaSeparatedLists||!1,tightSelfClosing:s.tightSelfClosing||!1,collapseEmptyAttributes:s.collapseEmptyAttributes||!1,allowDangerousHtml:s.allowDangerousHtml||!1,voids:s.voids||abe,characterReferences:s.characterReferences||gye,closeSelfClosing:s.closeSelfClosing||!1,closeEmptyElements:s.closeEmptyElements||!1},schema:s.space==="svg"?_H:hbe,quote:n,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function bye(e,t,s){return pye(e,t,s,this)}function yye(e){const t=[],s=e&&e.children||xye;let n=-1;for(;++n<s.length;)t[n]=this.one(s[n],n,e);return t.join("")}function gj(e,t){const s=typeof e=="string"?{}:{...e.colorReplacements},n=typeof e=="string"?e:e.name;
673for(const[a,o]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof o=="string"?s[a]=o:a===n&&Object.assign(s,o);return s}function Nd(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function _ye(e){return Array.isArray(e)?e:[e]}async function CH(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function gR(e){return!e||["plaintext","txt","text","plain"].includes(e)}function EH(e){return e==="ansi"||gR(e)}function xR(e){return e==="none"}function TH(e){return xR(e)}function RH(e,t){var n;if(!t)return e;e.properties||(e.properties={}),(n=e.properties).class||(n.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const s=Array.isArray(t)?t:t.split(/\s+/g);for(const a of s)a&&!e.properties.class.includes(a)&&e.properties.class.push(a);return e}function Iw(e,t=!1){var o;if(e.length===0)return[["",0]];const s=e.split(/(\r?\n)/g);let n=0;const a=[];for(let i=0;i<s.length;i+=2){const l=t?s[i]+(s[i+1]||""):s[i];a.push([l,n]),n+=s[i].length,n+=((o=s[i+1])==null?void 0:o.length)||0}return a}function jye(e){const t=Iw(e,!0).map(([a])=>a);function s(a){if(a===e.length)return{line:t.length-1,character:t[t.length-1].length};let o=a,i=0;for(const l of t){if(o<l.length)break;o-=l.length,i++}return{line:i,character:o}}function n(a,o){let i=0;for(let l=0;l<a;l++)i+=t[l].length;return i+=o,i}return{lines:t,indexToPos:s,posToIndex:n}}function wye(e,t,s){const n=new Set;for(const o of e.matchAll(/:?lang=["']([^"']+)["']/g)){const i=o[1].toLowerCase().trim();i&&n.add(i)}for(const o of e.matchAll(/(?:```|~~~)([\w-]+)/g)){const i=o[1].toLowerCase().trim();i&&n.add(i)}for(const o of e.matchAll(/\\begin\{([\w-]+)\}/g)){const i=o[1].toLowerCase().trim();i&&n.add(i)}for(const o of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const i=o[1].toLowerCase().trim(),l=i.includes("/")?i.split("/").pop():i;l&&n.add(l)}if(!s)return Array.from(n);const a=s.getBundledLanguages();return Array.from(n).filter(o=>o&&a[o])}const vR="light-dark()",Nye=["color","background-color"];function kye(e,t){let s=0;const n=[];for(const a of t)a>s&&n.push({...e,content:e.content.slice(s,a),offset:e.offset+s}),s=a;return s<e.content.length&&n.push({...e,content:e.content.slice(s),offset:e.offset+s}),n}function Sye(e,t){const s=Array.from(t instanceof Set?t:new Set(t)).sort((n,a)=>n-a);return s.length?e.map(n=>n.flatMap(a=>{const o=s.filter(i=>a.offset<i&&i<a.offset+a.content.length).map(i=>i-a.offset).sort((i,l)=>i-l);return o.length?kye(a,o):a})):e}function Cye(e,t,s,n,a="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(f=>xj(e.variants[f])),l=new Set(i.flatMap(f=>Object.keys(f))),c={},u=(f,h)=>{const g=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return s+t[f]+(h==="color"?"":g)};return i.forEach((f,h)=>{for(const g of l){const v=f[g]||"inherit";if(h===0&&n&&Nye.includes(g))if(n===vR&&i.length>1){const y=t.findIndex(k=>k==="light"),_=t.findIndex(k=>k==="dark");if(y===-1||_===-1)throw new nn('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const j=i[y][g]||"inherit",w=i[_][g]||"inherit";c[g]=`light-dark(${j}, ${w})`,a==="css-vars"&&(c[u(h,g)]=v)}else c[g]=v;else a==="css-vars"&&(c[u(h,g)]=v)}}),o.htmlStyle=c,o}function xj(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&na.Italic&&(t["font-style"]="italic"),e.fontStyle&na.Bold&&(t["font-weight"]="bold");const s=[];e.fontStyle&na.Underline&&s.push("underline"),e.fontStyle&na.Strikethrough&&s.push("line-through"),s.length&&(t["text-decoration"]=s.join(" "))}return t}function WE(e){return typeof e=="string"?e:Object.entries(e).map(([t,s])=>`${t}:${s}`).join(";")}const AH=new WeakMap;function Mw(e,t){AH.set(e,t)}function xv(e){return AH.get(e)}class om{constructor(...t){Re(this,"_stacks",{});Re(this,"lang");if(t.length===2){const[s,n]=t;this.lang=n,this._stacks=s}else{const[s,n,a]=t;this.lang=n,this._stacks={[a]:s}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,s){return new om(Object.fromEntries(_ye(s).map(n=>[n,qE])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Eye(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Eye(e){const t=[],s=new Set;function n(a){var i;if(s.has(a))return;s.add(a);const o=(i=a==null?void 0:a.nameScopesList)==null?void 0:i.scopeName;o&&t.push(o),a.parent&&n(a.parent)}return n(e),t}function Tye(e,t){if(!(e instanceof om))throw new nn("Invalid grammar state");return e.getInternalStack(t)}function Rye(){const e=new WeakMap;function t(s){if(!e.has(s.meta)){let n=function(i){if(typeof i=="number"){if(i<0||i>s.source.length)throw new nn(`Invalid decoration offset: ${i}. Code length: ${s.source.length}`);return{...a.indexToPos(i),offset:i}}else{const l=a.lines[i.line];if(l===void 0)throw new nn(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${a.lines.length}`);let c=i.character;if(c<0&&(c=l.length+c),c<0||c>l.length)throw new nn(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${l.length}`);return{...i,character:c,offset:a.posToIndex(i.line,c)}}};const a=jye(s.source),o=(s.options.decorations||[]).map(i=>({...i,start:n(i.start),end:n(i.end)}));Aye(o),e.set(s.meta,{decorations:o,converter:a,source:s.source})}return e.get(s.meta)}return{name:"shiki:decorations",tokens(s){var i;if(!((i=this.options.decorations)!=null&&i.length))return;const a=t(this).decorations.flatMap(l=>[l.start.offset,l.end.offset]);return Sye(s,a)},code(s){var f;if(!((f=this.options.decorations)!=null&&f.length))return;const n=t(this),a=Array.from(s.children).filter(h=>h.type==="element"&&h.tagName==="span");if(a.length!==n.converter.lines.length)throw new nn(`Number of lines in code element (${a.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function o(h,g,v,y){const _=a[h];let j="",w=-1,k=-1;if(g===0&&(w=0),v===0&&(k=0),v===Number.POSITIVE_INFINITY&&(k=_.children.length),w===-1||k===-1)for(let E=0;E<_.children.length;E++)j+=PH(_.children[E]),w===-1&&j.length===g&&(w=E+1),k===-1&&j.length===v&&(k=E+1);if(w===-1)throw new nn(`Failed to find start index for decoration ${JSON.stringify(y.start)}`);
673if(k===-1)throw new nn(`Failed to find end index for decoration ${JSON.stringify(y.end)}`);const S=_.children.slice(w,k);if(!y.alwaysWrap&&S.length===_.children.length)l(_,y,"line");else if(!y.alwaysWrap&&S.length===1&&S[0].type==="element")l(S[0],y,"token");else{const E={type:"element",tagName:"span",properties:{},children:S};l(E,y,"wrapper"),_.children.splice(w,S.length,E)}}function i(h,g){a[h]=l(a[h],g,"line")}function l(h,g,v){var j;const y=g.properties||{},_=g.transform||(w=>w);return h.tagName=g.tagName||"span",h.properties={...h.properties,...y,class:h.properties.class},(j=g.properties)!=null&&j.class&&RH(h,g.properties.class),h=_(h,v)||h,h}const c=[],u=n.decorations.sort((h,g)=>g.start.offset-h.start.offset||h.end.offset-g.end.offset);for(const h of u){const{start:g,end:v}=h;if(g.line===v.line)o(g.line,g.character,v.character,h);else if(g.line<v.line){o(g.line,g.character,Number.POSITIVE_INFINITY,h);for(let y=g.line+1;y<v.line;y++)c.unshift(()=>i(y,h));o(v.line,0,v.character,h)}}c.forEach(h=>h())}}}function Aye(e){for(let t=0;t<e.length;t++){const s=e[t];if(s.start.offset>s.end.offset)throw new nn(`Invalid decoration range: ${JSON.stringify(s.start)} - ${JSON.stringify(s.end)}`);for(let n=t+1;n<e.length;n++){const a=e[n],o=s.start.offset<=a.start.offset&&a.start.offset<s.end.offset,i=s.start.offset<a.end.offset&&a.end.offset<=s.end.offset,l=a.start.offset<=s.start.offset&&s.start.offset<a.end.offset,c=a.start.offset<s.end.offset&&s.end.offset<=a.end.offset;if(o||i||l||c){if(o&&i||l&&c||l&&s.start.offset===s.end.offset||i&&a.start.offset===a.end.offset)continue;throw new nn(`Decorations ${JSON.stringify(s.start)} and ${JSON.stringify(a.start)} intersect.`)}}}}function PH(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(PH).join(""):""}const Pye=[Rye()];function vj(e){const t=Iye(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Pye]}function Iye(e){const t=[],s=[],n=[];for(const a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":s.push(a);break;default:n.push(a)}return{pre:t,post:s,normal:n}}var zu=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],PS={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Mye(e,t){const s=e.indexOf("\x1B",t);if(s!==-1&&e[s+1]==="["){const n=e.indexOf("m",s);if(n!==-1)return{sequence:e.substring(s+2,n).split(";"),startPosition:s,position:n+1}}return{position:e.length}}function uD(e){const t=e.shift();if(t==="2"){const s=e.splice(0,3).map(n=>Number.parseInt(n));return s.length!==3||s.some(n=>Number.isNaN(n))?void 0:{type:"rgb",rgb:s}}else if(t==="5"){const s=e.shift();if(s)return{type:"table",index:Number(s)}}}function Oye(e){const t=[];for(;e.length>0;){const s=e.shift();if(!s)continue;const n=Number.parseInt(s);if(!Number.isNaN(n))if(n===0)t.push({type:"resetAll"});else if(n<=9)PS[n]&&t.push({type:"setDecoration",value:PS[n]});else if(n<=29){const a=PS[n-20];a&&(t.push({type:"resetDecoration",value:a}),a==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:zu[n-30]}});else if(n===38){const a=uD(e);a&&t.push({type:"setForegroundColor",value:a})}else if(n===39)t.push({type:"resetForegroundColor"});else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:zu[n-40]}});else if(n===48){const a=uD(e);a&&t.push({type:"setBackgroundColor",value:a})}else n===49?t.push({type:"resetBackgroundColor"}):n===53?t.push({type:"setDecoration",value:"overline"}):n===55?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:zu[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:zu[n-100+8]}})}return t}function Lye(){let e=null,t=null,s=new Set;return{parse(n){const a=[];let o=0;do{const i=Mye(n,o),l=i.sequence?n.substring(o,i.startPosition):n.substring(o);if(l.length>0&&a.push({value:l,foreground:e,background:t,decorations:new Set(s)}),i.sequence){const c=Oye(i.sequence);for(const u of c)u.type==="resetAll"?(e=null,t=null,s.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroun
673dColor"?t=null:u.type==="resetDecoration"&&s.delete(u.value);for(const u of c)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&s.add(u.value)}o=i.position}while(o<n.length);return a}}}var Dye={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function $ye(e=Dye){function t(l){return e[l]}function s(l){return`#${l.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let n;function a(){if(n)return n;n=[];for(let u=0;u<zu.length;u++)n.push(t(zu[u]));let l=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let f=0;f<6;f++)for(let h=0;h<6;h++)n.push(s([l[u],l[f],l[h]]));let c=8;for(let u=0;u<24;u++,c+=10)n.push(s([c,c,c]));return n}function o(l){return a()[l]}function i(l){switch(l.type){case"named":return t(l.name);case"rgb":return s(l.rgb);case"table":return o(l.index)}}return{value:i}}const Uye={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Fye(e,t,s){const n=gj(e,s),a=Iw(t),o=Object.fromEntries(zu.map(c=>{var h;const u=`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`,f=(h=e.colors)==null?void 0:h[u];return[c,f||Uye[c]]})),i=$ye(o),l=Lye();return a.map(c=>l.parse(c[0]).map(u=>{let f,h;u.decorations.has("reverse")?(f=u.background?i.value(u.background):e.bg,h=u.foreground?i.value(u.foreground):e.fg):(f=u.foreground?i.value(u.foreground):e.fg,h=u.background?i.value(u.background):void 0),f=Nd(f,n),h=Nd(h,n),u.decorations.has("dim")&&(f=Bye(f));let g=na.None;return u.decorations.has("bold")&&(g|=na.Bold),u.decorations.has("italic")&&(g|=na.Italic),u.decorations.has("underline")&&(g|=na.Underline),u.decorations.has("strikethrough")&&(g|=na.Strikethrough),{content:u.value,offset:c[1],color:f,bgColor:h,fontStyle:g}}))}function Bye(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const n=t[1];if(n.length===8){const a=Math.round(Number.parseInt(n.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${n.slice(0,6)}${a}`}else{if(n.length===6)return`#${n}80`;if(n.length===4){const a=n[0],o=n[1],i=n[2],l=n[3],c=Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0");return`#${a}${a}${o}${o}${i}${i}${c}`}else if(n.length===3){const a=n[0],o=n[1],i=n[2];return`#${a}${a}${o}${o}${i}${i}80`}}}const s=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return s?`var(${s[1]}-dim)`:e}function bR(e,t,s={}){const{theme:n=e.getLoadedThemes()[0]}=s,a=e.resolveLangAlias(s.lang||"text");if(gR(a)||xR(n))return Iw(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:o,colorMap:i}=e.setTheme(n);if(a==="ansi")return Fye(o,t,s);const l=e.getLanguage(s.lang||"text");if(s.grammarState){if(s.grammarState.lang!==l.name)throw new nn(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${l.name}"`);if(!s.grammarState.themes.includes(o.name))throw new nn(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return zye(t,l,o,i,s)}function qye(...e){if(e.length===2)return xv(e[1]);const[t,s,n={}]=e,{lang:a="text",theme:o=t.getLoadedThemes()[0]}=n;if(gR(a)||xR(o))throw new nn("Plain language does not have grammar state");if(a==="ansi")throw new nn("ANSI language does not have grammar state");const{theme:i,colorMap:l}=t.setTheme(o),c=t.getLanguage(a);return new om(bj(s,c,i,l,n).stateStack,c.name,i.name)}function zye(e,t,s,n,a){const o=bj(e,t,s,n,a),i=new om(bj(e,t,s,n,a).stateStack,t.name,s.name);return Mw(o.tokens,i),o.tokens}function bj(e,t,s,n,a){const o=gj(s,a),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500}=a,c=Iw(e);let u=a.grammarState?Tye(a.grammarState,s.name)??qE:a.grammarContextCode!=null?bj(a.grammarContextCode,t,s,n,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:qE,f=[];const h=[];for(let g=0,v=c.length;g<v;g++){const[y,_]=c[g];if(y===""){f=[],h.push([]);continue}if(i>0&&y.length>=i){f=[],h.push([{content:y,offset:_,color:"",fontStyle:0}]);continue}let j,w,k;a.includeExplanation&&(j=t.tokenizeLine(y,u,l),w=j.tokens,k=0);const S=t.tokenizeLine2(y,u,l),E=S.tokens.length/2;for(let T=0;T<E;T++){const A=S.tokens[2*T],R=T+1<E?S.tokens[2*T+2]:y.length;if(A===R)continue;const I=S.tokens[2*T+1],L=Nd(n[Ch.getForeground(I)],o),M=Ch.getFontStyle(I),O={content:y.substring(A,R),offset:_+A,color:L,fontStyle:M};if(a.includeExplanation){const z=[];if(a.includeExplanation!=="scopeName")for(const W of s.settings){let K;switch(typeof W.scope){case"string":K=W.scope.split(/,/).map(q=>q.trim());break;case"object":K=W.scope;break;default:continue}z.push({settings:W,selectors:K.map(q=>q.split(/ /))})}O.explanation=[];let X=0;for(;A+X<R;
673){const W=w[k],K=y.substring(W.startIndex,W.endIndex);X+=K.length,O.explanation.push({content:K,scopes:a.includeExplanation==="scopeName"?Hye(W.scopes):Vye(z,W.scopes)}),k+=1}}f.push(O)}h.push(f),f=[],u=S.ruleStack}return{tokens:h,stateStack:u}}function Hye(e){return e.map(t=>({scopeName:t}))}function Vye(e,t){const s=[];for(let n=0,a=t.length;n<a;n++){const o=t[n];s[n]={scopeName:o,themeMatches:Wye(e,o,t.slice(0,n))}}return s}function pD(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Gye(e,t,s){if(!pD(e[e.length-1],t))return!1;let n=e.length-2,a=s.length-1;for(;n>=0&&a>=0;)pD(e[n],s[a])&&(n-=1),a-=1;return n===-1}function Wye(e,t,s){const n=[];for(const{selectors:a,settings:o}of e)for(const i of a)if(Gye(i,t,s)){n.push(o);break}return n}function IH(e,t,s){const n=Object.entries(s.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),a=n.map(c=>{const u=bR(e,t,{...s,theme:c.theme}),f=xv(u),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:u,state:f,theme:h}}),o=Yye(...a.map(c=>c.tokens)),i=o[0].map((c,u)=>c.map((f,h)=>{const g={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in s&&s.includeExplanation&&(g.explanation=f.explanation),o.forEach((v,y)=>{const{content:_,explanation:j,offset:w,...k}=v[u][h];g.variants[n[y].color]=k}),g})),l=a[0].state?new om(Object.fromEntries(a.map(c=>{var u;return[c.theme,(u=c.state)==null?void 0:u.getInternalStack(c.theme)]})),a[0].state.lang):void 0;return l&&Mw(i,l),i}function Yye(...e){const t=e.map(()=>[]),s=e.length;for(let n=0;n<e[0].length;n++){const a=e.map(c=>c[n]),o=t.map(()=>[]);t.forEach((c,u)=>c.push(o[u]));const i=a.map(()=>0),l=a.map(c=>c[0]);for(;l.every(c=>c);){const c=Math.min(...l.map(u=>u.content.length));for(let u=0;u<s;u++){const f=l[u];f.content.length===c?(o[u].push(f),i[u]+=1,l[u]=a[u][i[u]]):(o[u].push({...f,content:f.content.slice(0,c)}),l[u]={...f,content:f.content.slice(c),offset:f.offset+c})}}}return t}function yj(e,t,s){let n,a,o,i,l,c;if("themes"in s){const{defaultColor:u="light",cssVariablePrefix:f="--shiki-",colorsRendering:h="css-vars"}=s,g=Object.entries(s.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,k)=>w.color===u?-1:k.color===u?1:0);if(g.length===0)throw new nn("`themes` option must not be empty");const v=IH(e,t,s);if(c=xv(v),u&&vR!==u&&!g.find(w=>w.color===u))throw new nn(`\`themes\` option must contain the defaultColor key \`${u}\``);const y=g.map(w=>e.getTheme(w.theme)),_=g.map(w=>w.color);o=v.map(w=>w.map(k=>Cye(k,_,f,u,h))),c&&Mw(o,c);const j=g.map(w=>gj(w.theme,s));a=fD(g,y,j,f,u,"fg",h),n=fD(g,y,j,f,u,"bg",h),i=`shiki-themes ${y.map(w=>w.name).join(" ")}`,l=u?void 0:[a,n].join(";")}else if("theme"in s){const u=gj(s.theme,s);o=bR(e,t,s);const f=e.getTheme(s.theme);n=Nd(f.bg,u),a=Nd(f.fg,u),i=f.name,c=xv(o)}else throw new nn("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:a,bg:n,themeName:i,rootStyle:l,grammarState:c}}function fD(e,t,s,n,a,o,i){return e.map((l,c)=>{const u=Nd(t[c][o],s[c])||"inherit",f=`${n+l.color}${o==="bg"?"-bg":""}:${u}`;if(c===0&&a){if(a===vR&&e.length>1){const h=e.findIndex(_=>_.color==="light"),g=e.findIndex(_=>_.color==="dark");if(h===-1||g===-1)throw new nn('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const v=Nd(t[h][o],s[h])||"inherit",y=Nd(t[g][o],s[g])||"inherit";return`light-dark(${v}, ${y});${f}`}return u}return i==="css-vars"?f:null}).filter(l=>!!l).join(";")}function _j(e,t,s,n={meta:{},options:s,codeToHast:(a,o)=>_j(e,a,o),codeToTokens:(a,o)=>yj(e,a,o)}){var y,_;let a=t;for(const j of vj(s))a=((y=j.preprocess)==null?void 0:y.call(n,a,s))||a;let{tokens:o,fg:i,bg:l,themeName:c,rootStyle:u,grammarState:f}=yj(e,a,s);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:g=!1}=s;h===!0?o=Jye(o):h==="never"&&(o=Xye(o)),g&&(o=Qye(o));const v={...n,get source(){return a}};for(const j of vj(s))o=((_=j.tokens)==null?void 0:_.call(v,o))||o;return Kye(o,{...s,fg:i,bg:l,themeName:c,rootStyle:s.rootStyle===!1?!1:s.rootStyle??u},v,f)}function Kye(e,t,s,n=xv(e)){var _,j,w,k;const a=vj(t),o=[],i={type:"root",children:[]},{structure:l="classic",tabindex:c="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),c!==!1&&c!=null&&(u.tabindex=c.toString());for(const[S,E]of Object.entries(t.meta||{}))S.startsWith("_")||(u[S]=E);let f={type:"element",tagName:"pre",properties:u,children:[]},h={type:"element",tagName:"code",properties:{},children:o};const g=[],v={...s,structure:l,addClassToHast:RH,get source(){return s.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return f},get code(){return h},get lines(){return g}};if(e.forEach((S,E)=>{var R,I;E&&(l==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:` 674`}));let T={type:"element",tagName:"span",properties:{class:"line"}
674,children:[]},A=0;for(const L of S){let M={type:"element",tagName:"span",properties:{...L.htmlAttrs},children:[{type:"text",value:L.content}]};const O=WE(L.htmlStyle||xj(L));O&&(M.properties.style=O);for(const z of a)M=((R=z==null?void 0:z.span)==null?void 0:R.call(v,M,E+1,A,T,L))||M;l==="inline"?i.children.push(M):l==="classic"&&T.children.push(M),A+=L.content.length}if(l==="classic"){for(const L of a)T=((I=L==null?void 0:L.line)==null?void 0:I.call(v,T,E+1))||T;g.push(T),o.push(T)}else l==="inline"&&g.push(T)}),l==="classic"){for(const S of a)h=((_=S==null?void 0:S.code)==null?void 0:_.call(v,h))||h;f.children.push(h);for(const S of a)f=((j=S==null?void 0:S.pre)==null?void 0:j.call(v,f))||f;i.children.push(f)}else if(l==="inline"){const S=[];let E={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const R of i.children)R.type==="element"&&R.tagName==="br"?(S.push(E),E={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(R.type==="element"||R.type==="text")&&E.children.push(R);S.push(E);let A={type:"element",tagName:"code",properties:{},children:S};for(const R of a)A=((w=R==null?void 0:R.code)==null?void 0:w.call(v,A))||A;i.children=[];for(let R=0;R<A.children.length;R++){R>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const I=A.children[R];I.type==="element"&&i.children.push(...I.children)}}let y=i;for(const S of a)y=((k=S==null?void 0:S.root)==null?void 0:k.call(v,y))||y;return n&&Mw(y,n),y}function Jye(e){return e.map(t=>{const s=[];let n="",a;return t.forEach((o,i)=>{const c=!(o.fontStyle&&(o.fontStyle&na.Underline||o.fontStyle&na.Strikethrough));c&&o.content.match(/^\s+$/)&&t[i+1]?(a===void 0&&(a=o.offset),n+=o.content):n?(c?s.push({...o,offset:a,content:n+o.content}):s.push({content:n,offset:a},o),a=void 0,n=""):s.push(o)}),s})}function Xye(e){return e.map(t=>t.flatMap(s=>{if(s.content.match(/^\s+$/))return s;const n=s.content.match(/^(\s*)(.*?)(\s*)$/);if(!n)return s;const[,a,o,i]=n;if(!a&&!i)return s;const l=[{...s,offset:s.offset+a.length,content:o}];return a&&l.unshift({content:a,offset:s.offset}),i&&l.push({content:i,offset:s.offset+a.length+o.length}),l}))}function Qye(e){return e.map(t=>{const s=[];for(const n of t){if(s.length===0){s.push({...n});continue}const a=s[s.length-1],o=WE(a.htmlStyle||xj(a)),i=WE(n.htmlStyle||xj(n)),l=a.fontStyle&&(a.fontStyle&na.Underline||a.fontStyle&na.Strikethrough),c=n.fontStyle&&(n.fontStyle&na.Underline||n.fontStyle&na.Strikethrough);!l&&!c&&o===i?a.content+=n.content:s.push({...n})}return s})}const Zye=vye;function e0e(e,t,s){var o;const n={meta:{},options:s,codeToHast:(i,l)=>_j(e,i,l),codeToTokens:(i,l)=>yj(e,i,l)};let a=Zye(_j(e,t,s,n));for(const i of vj(s))a=((o=i.postprocess)==null?void 0:o.call(n,a,s))||a;return a}const hD={light:"#333333",dark:"#bbbbbb"},mD={light:"#fffffe",dark:"#1e1e1e"},gD="__shiki_resolved";function yR(e){var l,c,u,f,h;if(e!=null&&e[gD])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:s,fg:n}=t;if(!s||!n){const g=t.settings?t.settings.find(v=>!v.name&&!v.scope):void 0;(l=g==null?void 0:g.settings)!=null&&l.foreground&&(n=g.settings.foreground),(c=g==null?void 0:g.settings)!=null&&c.background&&(s=g.settings.background),!n&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(n=t.colors["editor.foreground"]),!s&&((f=t==null?void 0:t.colors)!=null&&f["editor.background"])&&(s=t.colors["editor.background"]),n||(n=t.type==="light"?hD.light:hD.dark),s||(s=t.type==="light"?mD.light:mD.dark),t.fg=n,t.bg=s}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0;const o=new Map;function i(g){var y;if(o.has(g))return o.get(g);a+=1;const v=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return(y=t.colorReplacements)!=null&&y[`#${v}`]?i(g):(o.set(g,v),v)}t.settings=t.settings.map(g=>{var j,w;const v=((j=g.settings)==null?void 0:j.foreground)&&!g.settings.foreground.startsWith("#"),y=((w=g.settings)==null?void 0:w.background)&&!g.settings.background.startsWith("#");if(!v&&!y)return g;const _={...g,settings:{...g.settings}};if(v){const k=i(g.settings.foreground);t.colorReplacements[k]=g.settings.foreground,_.settings.foreground=k}if(y){const k=i(g.settings.background);t.colorReplacements[k]=g.settings.background,_.settings.background=k}return _});for(const g of Object.keys(t.colors||{}))if((g==="editor.foreground"||g==="editor.background"||g.startsWith("terminal.ansi"))&&!((h=t.colors[g])!=null&&h.startsWith("#"))){const v=i(t.colors[g]);t.colorReplacements[v]=t.colors[g],t.colors[g]=v}return Object.defineProperty(t,gD,{enumerable:!1,writable:!1,value:!0}),t}async function MH(e){return Array.from(new Set((await Promise.all(e.filter(t=>!EH(t)).map(async t=>await CH(t).then(s=>Array.isArray(s)?s:[s])))).flat()))}async function OH(e){return(await Promise.all(e.map(async s=>TH(s)?null:yR(await CH(s))))).filter(s=>!!s)}let t0e=3;function s0e(e,t=3){t>t0e||console.trace(`[SHIKI DEPRECATE]: ${e}`)}
674let Yf=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function LH(e,t){if(!t)return e;if(t[e]){const s=new Set([e]);for(;t[e];){if(e=t[e],s.has(e))throw new Yf(`Circular alias \`${Array.from(s).join(" -> ")} -> ${e}\``);s.add(e)}}return e}let r0e=class extends nbe{constructor(s,n,a,o={}){super(s);Re(this,"_resolvedThemes",new Map);Re(this,"_resolvedGrammars",new Map);Re(this,"_langMap",new Map);Re(this,"_langGraph",new Map);Re(this,"_textmateThemeCache",new WeakMap);Re(this,"_loadedThemesCache",null);Re(this,"_loadedLanguagesCache",null);this._resolver=s,this._themes=n,this._langs=a,this._alias=o,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(s){return typeof s=="string"?this._resolvedThemes.get(s):this.loadTheme(s)}loadTheme(s){const n=yR(s);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(s){let n=this._textmateThemeCache.get(s);n||(n=uj.createFromRawTheme(s),this._textmateThemeCache.set(s,n)),this._syncRegistry.setTheme(n)}getGrammar(s){return s=LH(s,this._alias),this._resolvedGrammars.get(s)}loadLanguage(s){var i,l,c,u;if(this.getGrammar(s.name))return;const n=new Set([...this._langMap.values()].filter(f=>{var h;return(h=f.embeddedLangsLazy)==null?void 0:h.includes(s.name)}));this._resolver.addLanguage(s);const a={balancedBracketSelectors:s.balancedBracketSelectors||["*"],unbalancedBracketSelectors:s.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(s.scopeName,s);const o=this.loadGrammarWithConfiguration(s.scopeName,1,a);if(o.name=s.name,this._resolvedGrammars.set(s.name,o),s.aliases&&s.aliases.forEach(f=>{this._alias[f]=s.name}),this._loadedLanguagesCache=null,n.size)for(const f of n)this._resolvedGrammars.delete(f.name),this._loadedLanguagesCache=null,(l=(i=this._syncRegistry)==null?void 0:i._injectionGrammars)==null||l.delete(f.scopeName),(u=(c=this._syncRegistry)==null?void 0:c._grammars)==null||u.delete(f.scopeName),this.loadLanguage(this._langMap.get(f.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(s){for(const o of s)this.resolveEmbeddedLanguages(o);const n=Array.from(this._langGraph.entries()),a=n.filter(([o,i])=>!i);if(a.length){const o=n.filter(([i,l])=>{if(!l)return!1;const c=l.embeddedLanguages||l.embeddedLangs;return c==null?void 0:c.some(u=>a.map(([f])=>f).includes(u))}).filter(i=>!a.includes(i));throw new Yf(`Missing languages ${a.map(([i])=>`\`${i}\``).join(", ")}, required by ${o.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[o,i]of n)this._resolver.addLanguage(i);for(const[o,i]of n)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(s){this._langMap.set(s.name,s),this._langGraph.set(s.name,s);const n=s.embeddedLanguages??s.embeddedLangs;if(n)for(const a of n)this._langGraph.set(a,this._langMap.get(a))}};class n0e{constructor(t,s){Re(this,"_langs",new Map);Re(this,"_scopeToLang",new Map);Re(this,"_injections",new Map);Re(this,"_onigLib");this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},s.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(s=>{this._langs.set(s,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(s=>{this._injections.get(s)||this._injections.set(s,[]),this._injections.get(s).push(t.scopeName)})}getInjections(t){const s=t.split(".");let n=[];for(let a=1;a<=s.length;a++){const o=s.slice(0,a).join(".");n=[...n,...this._injections.get(o)||[]]}return n}}let Pg=0;function a0e(e){Pg+=1,e.warnings!==!1&&Pg>
674=10&&Pg%10===0&&console.warn(`[Shiki] ${Pg} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Yf("`engine` option is required for synchronous mode");const s=(e.langs||[]).flat(1),n=(e.themes||[]).flat(1).map(yR),a=new n0e(e.engine,s),o=new r0e(a,n,s,e.langAlias);let i;function l(S){return LH(S,e.langAlias)}function c(S){w();const E=o.getGrammar(typeof S=="string"?S:S.name);if(!E)throw new Yf(`Language \`${S}\` not found, you may need to load it first`);return E}function u(S){if(S==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const E=o.getTheme(S);if(!E)throw new Yf(`Theme \`${S}\` not found, you may need to load it first`);return E}function f(S){w();const E=u(S);i!==S&&(o.setTheme(E),i=S);const T=o.getColorMap();return{theme:E,colorMap:T}}function h(){return w(),o.getLoadedThemes()}function g(){return w(),o.getLoadedLanguages()}function v(...S){w(),o.loadLanguages(S.flat(1))}async function y(...S){return v(await MH(S))}function _(...S){w();for(const E of S.flat(1))o.loadTheme(E)}async function j(...S){return w(),_(await OH(S))}function w(){if(t)throw new Yf("Shiki instance has been disposed")}function k(){t||(t=!0,o.dispose(),Pg-=1)}return{setTheme:f,getTheme:u,getLanguage:c,getLoadedThemes:h,getLoadedLanguages:g,resolveLangAlias:l,loadLanguage:y,loadLanguageSync:v,loadTheme:j,loadThemeSync:_,dispose:k,[Symbol.dispose]:k}}async function o0e(e){e.engine||s0e("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,s,n]=await Promise.all([OH(e.themes||[]),MH(e.langs||[]),e.engine]);return a0e({...e,themes:t,langs:s,engine:n})}async function i0e(e){const t=await o0e(e);return{getLastGrammarState:(...s)=>qye(t,...s),codeToTokensBase:(s,n)=>bR(t,s,n),codeToTokensWithThemes:(s,n)=>IH(t,s,n),codeToTokens:(s,n)=>yj(t,s,n),codeToHast:(s,n)=>_j(t,s,n),codeToHtml:(s,n)=>e0e(t,s,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function l0e(e){const t=e.langs,s=e.themes,n=e.engine;async function a(o){function i(h){var g;if(typeof h=="string"){if(h=((g=o.langAlias)==null?void 0:g[h])||h,EH(h))return[];const v=t[h];if(!v)throw new nn(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return v}return h}function l(h){if(TH(h))return"none";if(typeof h=="string"){const g=s[h];if(!g)throw new nn(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}const c=(o.themes??[]).map(h=>l(h)),u=(o.langs??[]).map(h=>i(h)),f=await i0e({engine:o.engine??n(),...o,themes:c,langs:u});return{...f,loadLanguage(...h){return f.loadLanguage(...h.map(i))},loadTheme(...h){return f.loadTheme(...h.map(l))},getBundledLanguages(){return t},getBundledThemes(){return s}}}return a}function c0e(e){let t;async function s(n={}){if(t){const a=await t;return await Promise.all([a.loadTheme(...n.themes||[]),a.loadLanguage(...n.langs||[])]),a}else{t=e({...n,themes:[],langs:[]});const a=await t;return await Promise.all([a.loadTheme(...n.themes||[]),a.loadLanguage(...n.langs||[])]),a}}return s}function d0e(e,t){const s=c0e(e);async function n(a,o){var c;const i=await s({langs:[o.lang],themes:"theme"in o?[o.theme]:Object.values(o.themes)}),l=await((c=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:c.call(t,a,o.lang,i));return l&&await i.loadLanguage(...l),i}return{getSingletonHighlighter(a){return s(a)},async codeToHtml(a,o){return(await n(a,o)).codeToHtml(a,o)},async codeToHast(a,o){return(await n(a,o)).codeToHast(a,o)},async codeToTokens(a,o){return(await n(a,o)).codeToTokens(a,o)},async codeToTokensBase(a,o){return(await n(a,o)).codeToTokensBase(a,o)},async codeToTokensWithThemes(a,o){return(await n(a,o)).codeToTokensWithThemes(a,o)},async getLastGrammarState(a,o){return(await s({langs:[o.lang],themes:[o.theme]})).getLastGrammarState(a,o)}}}const DH=[{id:"abap",name:"ABAP",import:()=>se(()=>import("./abap-DVQkB1tB.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>se(()=>import("./actionscript-3-C8cB-GmP.js"),[])},{id:"ada",name:"Ada",import:()=>se(()=>import("./ada-Dm88O13a.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>se(()=>import("./angular-html-BIOqBQoB.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>se(()=>import("./angular-ts-BZ0-gyXM.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>se(()=>import("./apache-Cjup4Wn8.js"),[])},{id:"apex",name:"Apex",import:()=>se(()=>import("./apex-BxOuiOFa.js"),[])},{id:"apl",name:"APL",import:()=>se(()=>import("./apl-DomBhgsI.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>se(()=>import("./applescript-C033qOEt.js"),[])},{id:"ara",name:"Ara",import:()=>se(()=>import("./ara-mjabF_Bz.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>se(()=>import("./asciidoc-QoNvWadS.js"),[])},{id:"asm",name:"Assembly",import:()=>se(()=>import("./asm-BVLg6lFO.js"),[])},{id:"astro",name:"Astro",import:()=>se(()=>import("./astro-D6X_Z2XS.js"),__vite__mapDeps([10,9,2,11,3,12,13]))},{id:"awk",name:"AWK",import:()=>se(()=>import("./awk-BukV0VL3.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>se(()=>import("./ballerina-DsQ1IMXl.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>se(()=>import("./bat-BxTh7ETs.js"),[])},{id:"beancount",name:"Beancount",import:()=>se(()=>import("./beancount-y5OGDHxg.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>se(()=>import("./berry-CNeaz4o1.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>se(()=>import("./bibtex-BhLg1p6O.js"),[])},{id:"bicep",name:"Bicep",import:()=>se(()=>import("./bicep-BOhqnaai.js"),[])},{id:"blade",name:"Blade",import:()=>se(()=>import("./blade-bOo7sHim.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>se(()=>import("./bsl-J7bNLA7f.js"),__vite__mapDeps([17,18]))},{id:"c",name:"C",import:()=>se(()=>import("./c-WUyxKBbu.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>se(()=>import("./cadence-B2KY2hv2.js"),[])},{id:"cairo",name:"Cairo",import:()=>se(()=>import("./cairo-BSyRV25K.js"),__vite__mapDeps([19,20]))},{id:"clarity",name:"Clarity",import:()=>se(()=>import("./clarity-XYsjiL4K.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>se(()=>import("./clojure-D_7xq8Fy.js"),[])},{id:"cmake",name:"CMake",import:()=>se(()=>import("./cmake-DMKeYzL3.js"),[])},{id:"cobol",name:"COBOL",import:()=>se(()=>import("./cobol-BtoQQPou.js"),__vite__mapDeps([21,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>se(()=>import("./codeowners-C6gvADs6.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>se(()=>import("./codeql-C7_7JbQo.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>se(()=>import("./coffee-CAbqQb4D.js"),__vite__mapDeps([22,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>se(()=>import("./common-lisp-6iq4KwHE.js"),[])},{id:"coq",name:"Coq",import:()=>se(()=>import("./coq-8r8EsuzO.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>se(()=>import("./cpp-BULsHryK.js"),__vite__mapDeps([23,24,25,26,16]))},{id:"crystal",name:"Crystal",import:()=>se(()=>import("./crystal-BKj-38Fu.js"),__vite__mapDeps([27,1,2,3,16,26,28]))}
674,{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>se(()=>import("./csharp-DoXdt0nY.js"),[])},{id:"css",name:"CSS",import:()=>se(()=>import("./css-VvjYsK8G.js"),[])},{id:"csv",name:"CSV",import:()=>se(()=>import("./csv-ktAYfTAb.js"),[])},{id:"cue",name:"CUE",import:()=>se(()=>import("./cue-C9wilGUT.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>se(()=>import("./cypher-Xf-2q2hU.js"),[])},{id:"d",name:"D",import:()=>se(()=>import("./d-B93Q4mat.js"),[])},{id:"dart",name:"Dart",import:()=>se(()=>import("./dart-BCyE0qtr.js"),[])},{id:"dax",name:"DAX",import:()=>se(()=>import("./dax-B7rIr5bo.js"),[])},{id:"desktop",name:"Desktop",import:()=>se(()=>import("./desktop-BrzbK-KI.js"),[])},{id:"diff",name:"Diff",import:()=>se(()=>import("./diff-DXT5zc-2.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>se(()=>import("./docker-Bko2FRSc.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>se(()=>import("./dotenv-CHBkbAPM.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>se(()=>import("./dream-maker-C_HYNssT.js"),[])},{id:"edge",name:"Edge",import:()=>se(()=>import("./edge-g4FheGsS.js"),__vite__mapDeps([29,11,1,2,3,15]))},{id:"elixir",name:"Elixir",import:()=>se(()=>import("./elixir-DPFZ700c.js"),__vite__mapDeps([30,1,2,3]))},{id:"elm",name:"Elm",import:()=>se(()=>import("./elm-DfouGvC_.js"),__vite__mapDeps([31,25,26]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>se(()=>import("./emacs-lisp-BSK0grnv.js"),[])},{id:"erb",name:"ERB",import:()=>se(()=>import("./erb-BJXehSsM.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>se(()=>import("./erlang-BYZ2Z4YE.js"),__vite__mapDeps([39,40]))},{id:"fennel",name:"Fennel",import:()=>se(()=>import("./fennel-DwHBePZV.js"),[])},{id:"fish",name:"Fish",import:()=>se(()=>import("./fish-CeM-LHX7.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>se(()=>import("./fluent-BMT5qN3J.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>se(()=>import("./fortran-fixed-form-CbtQdryd.js"),__vite__mapDeps([41,42]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>se(()=>import("./fortran-free-form-CIkEJ740.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>se(()=>import("./fsharp-B_KMJUO8.js"),__vite__mapDeps([43,40]))},{id:"gdresource",name:"GDResource",import:()=>se(()=>import("./gdresource-dTegv3Dv.js"),__vite__mapDeps([44,45,46]))},{id:"gdscript",name:"GDScript",import:()=>se(()=>import("./gdscript-BLLEeoFt.js"),[])},{id:"gdshader",name:"GDShader",import:()=>se(()=>import("./gdshader-CY3d6U6w.js"),[])},{id:"genie",name:"Genie",import:()=>se(()=>import("./genie-C_N-s-Rs.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>se(()=>import("./gherkin-C4Y_9U4i.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>se(()=>import("./git-commit-C5zEsrao.js"),__vite__mapDeps([47,48]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>se(()=>import("./git-rebase-CISAJg89.js"),__vite__mapDeps([49,28]))},{id:"gleam",name:"Gleam",import:()=>se(()=>import("./gleam-DO20FBVE.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>se(()=>import("./glimmer-js-B1swgecw.js"),__vite__mapDeps([50,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>se(()=>import("./glimmer-ts-DtCVYfOS.js"),__vite__mapDeps([51,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>se(()=>import("./glsl-DQ9esmOg.js"),__vite__mapDeps([25,26]))},{id:"gnuplot",name:"Gnuplot",import:()=>se(()=>import("./gnuplot-CkvvlMo6.js"),[])},{id:"go",name:"Go",import:()=>se(()=>import("./go-ve9NQPsj.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>se(()=>import("./graphql-B0xrZH8z.js"),__vite__mapDeps([35,2,11,36,13]))},{id:"groovy",name:"Groovy",import:()=>se(()=>import("./groovy-B2kwCDA_.js"),[])},{id:"hack",name:"Hack",import:()=>se(()=>import("./hack-CIKEyXN5.js"),__vite__mapDeps([52,1,2,3,16]))},{id:"haml",name:"Ruby Haml",import:()=>se(()=>
674import("./haml-DAK3AdVH.js"),__vite__mapDeps([34,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>se(()=>import("./handlebars-BXv0Bzt3.js"),__vite__mapDeps([53,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>se(()=>import("./haskell-BC0-pEeM.js"),[])},{id:"haxe",name:"Haxe",import:()=>se(()=>import("./haxe-vA1IaGxw.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>se(()=>import("./hcl-5_lL2nCd.js"),[])},{id:"hjson",name:"Hjson",import:()=>se(()=>import("./hjson-BhaqDtNR.js"),[])},{id:"hlsl",name:"HLSL",import:()=>se(()=>import("./hlsl-D7JhCZZU.js"),[])},{id:"html",name:"HTML",import:()=>se(()=>import("./html-qXBqs9iO.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>se(()=>import("./html-derivative-L_TmH9Cl.js"),__vite__mapDeps([15,1,2,3]))},{id:"http",name:"HTTP",import:()=>se(()=>import("./http-D_t6wY6g.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13]))},{id:"hurl",name:"Hurl",import:()=>se(()=>import("./hurl-D4ZoJPMF.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56]))},{id:"hxml",name:"HXML",import:()=>se(()=>import("./hxml-yFbbJVA9.js"),__vite__mapDeps([57,58]))},{id:"hy",name:"Hy",import:()=>se(()=>import("./hy-DPgPXUOm.js"),[])},{id:"imba",name:"Imba",import:()=>se(()=>import("./imba-C_PO_ckt.js"),[])},{id:"ini",name:"INI",aliases:["properties"],import:()=>se(()=>import("./ini-fW5HFzEY.js"),[])},{id:"java",name:"Java",import:()=>se(()=>import("./java-JdOfYUdK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>se(()=>import("./javascript-DGowZ4QF.js"),[])},{id:"jinja",name:"Jinja",import:()=>se(()=>import("./jinja-yuqpYHnC.js"),__vite__mapDeps([59,1,2,3]))},{id:"jison",name:"Jison",import:()=>se(()=>import("./jison-DKV7M0Ju.js"),__vite__mapDeps([60,2]))},{id:"json",name:"JSON",import:()=>se(()=>import("./json-DMbQYFDD.js"),[])},{id:"json5",name:"JSON5",import:()=>se(()=>import("./json5-BF8BU5WH.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>se(()=>import("./jsonc-xLkgwEMk.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>se(()=>import("./jsonl-DNddnaRk.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>se(()=>import("./jsonnet-CsZxsm3R.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>se(()=>import("./jssm-C9BX099q.js"),[])},{id:"jsx",name:"JSX",import:()=>se(()=>import("./jsx-D1T1brdb.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>se(()=>import("./julia-u6azWIKf.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62]))},{id:"kdl",name:"KDL",import:()=>se(()=>import("./kdl-CLLmEtgj.js"),[])},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>se(()=>import("./kotlin-9hX87m7h.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>se(()=>import("./kusto-CNtNz7kg.js"),[])},{id:"latex",name:"LaTeX",import:()=>se(()=>import("./latex-BammeNcp.js"),__vite__mapDeps([63,64,62]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>se(()=>import("./lean-DrVX8JiF.js"),[])},{id:"less",name:"Less",import:()=>se(()=>import("./less-W9CowDDW.js"),[])},{id:"liquid",name:"Liquid",import:()=>se(()=>import("./liquid-DfjUrw7I.js"),__vite__mapDeps([65,1,2,3,9]))},{id:"llvm",name:"LLVM IR",import:()=>se(()=>import("./llvm-D576Q3VP.js"),[])},{id:"log",name:"Log file",import:()=>se(()=>import("./log-DnNjE_n-.js"),[])},{id:"logo",name:"Logo",import:()=>se(()=>import("./logo-sQZ9fNGF.js"),[])},{id:"lua",name:"Lua",import:()=>se(()=>import("./lua-SBnGdSHe.js"),__vite__mapDeps([37,26]))},{id:"luau",name:"Luau",import:()=>se(()=>import("./luau-DURB_4zD.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>se(()=>import("./make-D1zH9BOf.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>se(()=>import("./markdown-CyfEJjR-.js"),[])},{id:"marko",name:"Marko",import:()=>se(()=>import("./marko-DxsCREkK.js"),__vite__mapDeps([66,3,67,5,11]))},{id:"matlab",name:"MATLAB",import:()=>se(()=>import("./matlab--lhk93Lq.js"),[])},{id:"mdc",name:"MDC",import:()=>se(()=>import("./mdc-BHw6nwLV.js"),__vite__mapDeps([68,40,38,15,1,2,3]))},{id:"mdx",name:"MDX",import:()=>se(()=>import("./mdx-BkWTq_rD.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>se(()=>import("./mermaid-rCC0u-mv.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>se(()=>import("./mipsasm-Dho1H-pQ.js"),[])},{id:"mojo",name:"Mojo",import:()=>se(()=>import("./mojo-B-7TxnPp.js"),[])},{id:"move",name:"Move",import:()=>se(()=>import("./move-rOaKE9AO.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>se(()=>import("./narrat-Dx0aSkI_.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>se(()=>import("./nextflow-DEL1cuoy.js"),[])},{id:"nginx",name:"Nginx",import:()=>se(()=>import("./nginx-B2fmmKMF.js"),__vite__mapDeps([69,37,26]))},{id:"nim",name:"Nim",import:()=>se(()=>import("./nim-Bnnhjx9t.js"),__vite__mapDeps([70,26,1,2,3,7,8,25,40]))},{id:"nix",name:"Nix",import:()=>se(()=>
674import("./nix-B-S5UFdG.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>se(()=>import("./nushell-BlJmyIzw.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>se(()=>import("./objective-c-BtuiZUpu.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>se(()=>import("./objective-cpp-C1IpNDkr.js"),[])},{id:"ocaml",name:"OCaml",import:()=>se(()=>import("./ocaml-CDuWqNgj.js"),[])},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>se(()=>import("./openscad-DjD0p97z.js"),[])},{id:"pascal",name:"Pascal",import:()=>se(()=>import("./pascal-DnwQ-Qcs.js"),[])},{id:"perl",name:"Perl",import:()=>se(()=>import("./perl-BfKvcVzF.js"),__vite__mapDeps([71,1,2,3,7,8,16]))},{id:"php",name:"PHP",import:()=>se(()=>import("./php-BYJ1Ypxm.js"),__vite__mapDeps([72,1,2,3,7,8,16,9]))},{id:"pkl",name:"Pkl",import:()=>se(()=>import("./pkl-DcdSOBu6.js"),[])},{id:"plsql",name:"PL/SQL",import:()=>se(()=>import("./plsql-OtgKNdAj.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>se(()=>import("./po-QLCT6Uk8.js"),[])},{id:"polar",name:"Polar",import:()=>se(()=>import("./polar-BJlvlTr1.js"),[])},{id:"postcss",name:"PostCSS",import:()=>se(()=>import("./postcss-BpkC9_c2.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>se(()=>import("./powerquery-CE9nJDpy.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>se(()=>import("./powershell-BGsP0hwK.js"),[])},{id:"prisma",name:"Prisma",import:()=>se(()=>import("./prisma-C3aIV1iS.js"),[])},{id:"prolog",name:"Prolog",import:()=>se(()=>import("./prolog-b-LHuK4W.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>se(()=>import("./proto-D2jGrBKA.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>se(()=>import("./pug-GfiRoGJd.js"),__vite__mapDeps([73,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>se(()=>import("./puppet-Cc8l1pnQ.js"),[])},{id:"purescript",name:"PureScript",import:()=>se(()=>import("./purescript-BBtkobTv.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>se(()=>import("./python-F63zVH2W.js"),[])},{id:"qml",name:"QML",import:()=>se(()=>import("./qml-CJEfhMPF.js"),__vite__mapDeps([74,2]))},{id:"qmldir",name:"QML Directory",import:()=>se(()=>import("./qmldir-DEZjTU0r.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>se(()=>import("./qss-CJ7fdBY0.js"),[])},{id:"r",name:"R",import:()=>se(()=>import("./r-CIZ9QnL2.js"),[])},{id:"racket",name:"Racket",import:()=>se(()=>import("./racket-BRdU3iEd.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>se(()=>import("./raku-C_gJxJHD.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>se(()=>import("./razor-BOBSbqZz.js"),__vite__mapDeps([75,1,2,3,76]))},{id:"reg",name:"Windows Registry Script",import:()=>se(()=>import("./reg-B4QHrlTx.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>se(()=>import("./regexp-D0rA2qln.js"),[])},{id:"rel",name:"Rel",import:()=>se(()=>import("./rel-CHjTvGxV.js"),[])},{id:"riscv",name:"RISC-V",import:()=>se(()=>import("./riscv-Cv3fMx-U.js"),[])},{id:"rosmsg",name:"ROS Interface",import:()=>se(()=>import("./rosmsg-BkwMHCGW.js"),[])},{id:"rst",name:"reStructuredText",import:()=>se(()=>import("./rst-CKSVoj06.js"),__vite__mapDeps([77,15,1,2,3,23,24,25,26,16,20,28,38,78,33,34,7,8,35,11,36,13,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>se(()=>import("./ruby-D6oex5d_.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>se(()=>import("./rust-C-wpXuNi.js"),[])},{id:"sas",name:"SAS",import:()=>se(()=>import("./sas-CbWl8rne.js"),__vite__mapDeps([79,16]))},{id:"sass",name:"Sass",import:()=>se(()=>import("./sass-BDZkJ6l1.js"),[])},{id:"scala",name:"Scala",import:()=>se(()=>import("./scala-DghkOeMb.js"),[])},{id:"scheme",name:"Scheme",import:()=>se(()=>import("./scheme-cJp38xFT.js"),[])},{id:"scss",name:"SCSS",import:()=>se(()=>import("./scss-VtpMro89.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>se(()=>import("./sdbl-DYV3AuzD.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>se(()=>import("./shaderlab-CUm_dX6I.js"),__vite__mapDeps([80,81]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>se(()=>import("./shellscript-DLWy-XKI.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>se(()=>import("./shellsession-BkNx190r.js"),__vite__mapDeps([82,28]))},{id:"smalltalk",name:"Smalltalk",import:()=>se(()=>import("./smalltalk-BNwI9tko.js"),[])},{id:"solidity",name:"Solidity",import:()=>se(()=>import("./solidity-G8JXL7yS.js"),[])}
674,{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>se(()=>import("./soy-CCUQ6n2n.js"),__vite__mapDeps([83,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>se(()=>import("./sparql-UpL8FO9b.js"),__vite__mapDeps([84,85]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>se(()=>import("./splunk-DZs6hq-y.js"),[])},{id:"sql",name:"SQL",import:()=>se(()=>import("./sql-DIfKQ3UR.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>se(()=>import("./ssh-config-_6S4dYXx.js"),[])},{id:"stata",name:"Stata",import:()=>se(()=>import("./stata-BBO-Ddf6.js"),__vite__mapDeps([86,16]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>se(()=>import("./stylus-vmpKpVxG.js"),[])},{id:"svelte",name:"Svelte",import:()=>se(()=>import("./svelte-C60UpK7x.js"),__vite__mapDeps([87,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>se(()=>import("./swift-BH5JLYmT.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>se(()=>import("./system-verilog-C2QO4Icr.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>se(()=>import("./systemd-D33oSu_s.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>se(()=>import("./talonscript-BKVGrlST.js"),[])},{id:"tasl",name:"Tasl",import:()=>se(()=>import("./tasl-n_1eLqJy.js"),[])},{id:"tcl",name:"Tcl",import:()=>se(()=>import("./tcl-DG_tCSGv.js"),[])},{id:"templ",name:"Templ",import:()=>se(()=>import("./templ-D1Fgf1UR.js"),__vite__mapDeps([88,89,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>se(()=>import("./terraform-Bs1vHlDh.js"),[])}
674,{id:"tex",name:"TeX",import:()=>se(()=>import("./tex-kctWGK22.js"),__vite__mapDeps([64,62]))},{id:"toml",name:"TOML",import:()=>se(()=>import("./toml-CVbN73-u.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>se(()=>import("./ts-tags-BZD7P4Bn.js"),__vite__mapDeps([90,11,3,2,25,26,1,16,7,8]))},{id:"tsv",name:"TSV",import:()=>se(()=>import("./tsv-S0Z4lVVY.js"),[])},{id:"tsx",name:"TSX",import:()=>se(()=>import("./tsx-uO4koM_N.js"),[])},{id:"turtle",name:"Turtle",import:()=>se(()=>import("./turtle-Ba58ri9j.js"),[])},{id:"twig",name:"Twig",import:()=>se(()=>import("./twig-CrZj0Hws.js"),__vite__mapDeps([91,3,2,5,72,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>se(()=>import("./typescript-Bl2pc_8e.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>se(()=>import("./typespec-BUpf3j4Y.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>se(()=>import("./typst-erGOg5ql.js"),[])},{id:"v",name:"V",
674import:()=>se(()=>import("./v-B6jUVViM.js"),[])},{id:"vala",name:"Vala",import:()=>se(()=>import("./vala-DZnCxCk_.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>se(()=>import("./vb-BMo0VC1i.js"),[])},{id:"verilog",name:"Verilog",import:()=>se(()=>import("./verilog-Dd7HFyQ5.js"),[])},{id:"vhdl",name:"VHDL",import:()=>se(()=>import("./vhdl-Cml7SlW9.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>se(()=>import("./viml-DLx4hn90.js"),[])},{id:"vue",name:"Vue",import:()=>se(()=>import("./vue-Cj-mkyYi.js"),__vite__mapDeps([92,3,2,11,9,15,1]))},{id:"vue-html",name:"Vue HTML",import:()=>se(()=>import("./vue-html-CjBLplYn.js"),__vite__mapDeps([93,92,3,2,11,9,15,1]))},{id:"vue-vine",name:"Vue Vine",import:()=>se(()=>import("./vue-vine-Bspp71h3.js"),__vite__mapDeps([94,3,5,67,95,12,92,2,11,9,15,1]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>se(()=>import("./vyper-C7j1tD9N.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>se(()=>import("./wasm-DPEzICzI.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["æè¨"],import:()=>se(()=>import("./wenyan-3-KOqLlu.js"),[])},{id:"wgsl",name:"WGSL",import:()=>se(()=>import("./wgsl-DADDAwbC.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>se(()=>import("./wikitext-DsB4F6oG.js"),[])},{id:"wit",name:"WebAssembly Interface Types",import:()=>se(()=>import("./wit-Defys0ov.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>se(()=>import("./wolfram-qA3aZY-_.js"),[])},{id:"xml",name:"XML",import:()=>se(()=>import("./xml-D3voWj5l.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>se(()=>import("./xsl-CPTpEDiJ.js"),__vite__mapDeps([96,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>se(()=>import("./yaml-30KcodCe.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>se(()=>import("./zenscript-Cob0seHA.js"),[])},{id:"zig",name:"Zig",import:()=>se(()=>import("./zig-MH9tKTbO.js"),[])}],u0e=Object.fromEntries(DH.map(e=>[e.id,e.import])),p0e=Object.fromEntries(DH.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(s=>[s,e.import]))||[]})),f0e={...u0e,...p0e},h0e=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>se(()=>import("./andromeeda-BlOy2fyC.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>se(()=>import("./aurora-x-3Ryt56XO.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>se(()=>import("./ayu-dark-Cbyal9wb.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>se(()=>import("./catppuccin-frappe-DX4bB6iI.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>se(()=>import("./catppuccin-latte-CyWPoOxz.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>se(()=>import("./catppuccin-macchiato-DmGiE6nh.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>se(()=>import("./catppuccin-mocha-Bf4Q5guf.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>se(()=>import("./dark-plus-MWFj74ao.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>se(()=>import("./dracula-DmlUkekF.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>se(()=>import("./dracula-soft-90Fl1o42.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>se(()=>import("./everforest-dark-fNzQIuVR.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>se(()=>import("./everforest-light-Jaef-rKs.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>se(()=>import("./github-dark-D_ZeOO4k.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>se(()=>import("./github-dark-default-l-0f9G0L.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>se(()=>import("./github-dark-dimmed-7mah4xHJ.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>se(()=>import("./github-dark-high-contrast-BA3Rm_6n.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>se(()=>import("./github-light-Bv4poYqh.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>se(()=>import("./github-light-default-BxZ1fWsS.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>se(()=>import("./github-light-high-contrast-C4KNzsaH.js"),[])},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>se(()=>import("./gruvbox-dark-hard-DSAR4Qg5.js"),[])},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>se(()=>import("./gruvbox-dark-medium-37hNwxz7.js"),[])},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>se(()=>import("./gruvbox-dark-soft-BLj-RMbH.js"),[])},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>se(()=>import("./gruvbox-light-hard-FOrehsVr.js"),[])},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>se(()=>import("./gruvbox-light-medium-BowDIYaE.js"),[])},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>se(()=>import("./gruvbox-light-soft-BLcwA-P1.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>se(()=>
674import("./houston-CUQgj_9F.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>se(()=>import("./kanagawa-dragon-BFKoL336.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>se(()=>import("./kanagawa-lotus-DWVQEru1.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>se(()=>import("./kanagawa-wave-TJxiYQL2.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>se(()=>import("./laserwave-wOJ6Bzc4.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>se(()=>import("./light-plus-DCqE6czE.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>se(()=>import("./material-theme-BE1dpXJE.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>se(()=>import("./material-theme-darker-D6T8RGiX.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>se(()=>import("./material-theme-lighter-C2RszNn4.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>se(()=>import("./material-theme-ocean-ChJKZMBw.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>se(()=>import("./material-theme-palenight-CIaP6bHq.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>se(()=>import("./min-dark-LZQpNrsR.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>se(()=>import("./min-light-B7VzdIw0.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>se(()=>import("./monokai-BKxG5gsR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>se(()=>import("./night-owl-j09BrpN4.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>se(()=>import("./nord-B6fowdj8.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>se(()=>import("./one-dark-pro-uoN4nK1U.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>se(()=>import("./one-light-DDDGDbFu.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>se(()=>import("./plastic-DOF6gLSs.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>se(()=>import("./poimandres-Dg0LGyN1.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>se(()=>import("./red-DA_J5fPV.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>se(()=>import("./rose-pine-DhsLsj5d.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>se(()=>import("./rose-pine-dawn-D9mYLBEZ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>se(()=>import("./rose-pine-moon-dTQSs44A.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>se(()=>import("./slack-dark-DihA_W5u.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>se(()=>import("./slack-ochin-DHo-hAor.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>se(()=>import("./snazzy-light-B0P9tjiW.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>se(()=>import("./solarized-dark-xftrLFK5.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>se(()=>import("./solarized-light-CZAwntVM.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>se(()=>import("./synthwave-84-t-Y6-RqO.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>se(()=>import("./tokyo-night-Dbnew_9G.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>se(()=>import("./vesper-BeLq8T3C.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>se(()=>import("./vitesse-black-DqbRpNNa.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>se(()=>import("./vitesse-dark-DcGfkm8_.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>se(()=>import("./vitesse-light-CoGGZvIO.js"),[])}],m0e=Object.fromEntries(h0e.map(e=>[e.id,e.import]));
674class _R extends Error{constructor(t){super(t),this.name="ShikiError"}}function g0e(){return 2147483648}function x0e(){return typeof performance<"u"?performance.now():Date.now()}const v0e=(e,t)=>e+(t-e%t)%t;async function b0e(e){let t,s;const n={};function a(v){s=v,n.HEAPU8=new Uint8Array(v),n.HEAPU32=new Uint32Array(v)}function o(v,y,_){n.HEAPU8.copyWithin(v,y,y+_)}function i(v){try{return t.grow(v-s.byteLength+65535>>>16),a(t.buffer),1}catch{}}function l(v){const y=n.HEAPU8.length;v=v>>>0;const _=g0e();if(v>_)return!1;for(let j=1;j<=4;j*=2){let w=y*(1+.2/j);w=Math.min(w,v+100663296);const k=Math.min(_,v0e(Math.max(v,w),65536));if(i(k))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(v,y,_=1024){const j=y+_;let w=y;for(;v[w]&&!(w>=j);)++w;if(w-y>16&&v.buffer&&c)return c.decode(v.subarray(y,w));let k="";for(;y<w;){let S=v[y++];if(!(S&128)){k+=String.fromCharCode(S);continue}const E=v[y++]&63;if((S&224)===192){k+=String.fromCharCode((S&31)<<6|E);continue}const T=v[y++]&63;if((S&240)===224?S=(S&15)<<12|E<<6|T:S=(S&7)<<18|E<<12|T<<6|v[y++]&63,S<65536)k+=String.fromCharCode(S);else{const A=S-65536;k+=String.fromCharCode(55296|A>>10,56320|A&1023)}}return k}function f(v,y){return v?u(n.HEAPU8,v,y):""}const h={emscripten_get_now:x0e,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function g(){const y=await e({env:h,wasi_snapshot_preview1:h});t=y.memory,a(t.buffer),Object.assign(n,y),n.UTF8ToString=f}return await g(),n}var y0e=Object.defineProperty,_0e=(e,t,s)=>t in e?y0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,bn=(e,t,s)=>_0e(e,typeof t!="symbol"?t+"":t,s);let Tn=null;
674function j0e(e){throw new _R(e.UTF8ToString(e.getLastOnigError()))}class Ow{constructor(t){bn(this,"utf16Length"),bn(this,"utf8Length"),bn(this,"utf16Value"),bn(this,"utf8Value"),bn(this,"utf16OffsetToUtf8"),bn(this,"utf8OffsetToUtf16");const s=t.length,n=Ow._utf8ByteLength(t),a=n!==s,o=a?new Uint32Array(s+1):null;a&&(o[s]=n);const i=a?new Uint32Array(n+1):null;a&&(i[n]=s);const l=new Uint8Array(n);let c=0;for(let u=0;u<s;u++){const f=t.charCodeAt(u);let h=f,g=!1;if(f>=55296&&f<=56319&&u+1<s){const v=t.charCodeAt(u+1);v>=56320&&v<=57343&&(h=(f-55296<<10)+65536|v-56320,g=!0)}a&&(o[u]=c,g&&(o[u+1]=c),h<=127?i[c+0]=u:h<=2047?(i[c+0]=u,i[c+1]=u):h<=65535?(i[c+0]=u,i[c+1]=u,i[c+2]=u):(i[c+0]=u,i[c+1]=u,i[c+2]=u,i[c+3]=u)),h<=127?l[c++]=h:h<=2047?(l[c++]=192|(h&1984)>>>6,l[c++]=128|(h&63)>>>0):h<=65535?(l[c++]=224|(h&61440)>>>12,l[c++]=128|(h&4032)>>>6,l[c++]=128|(h&63)>>>0):(l[c++]=240|(h&1835008)>>>18,l[c++]=128|(h&258048)>>>12,l[c++]=128|(h&4032)>>>6,l[c++]=128|(h&63)>>>0),g&&u++}this.utf16Length=s,this.utf8Length=n,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(t){let s=0;for(let n=0,a=t.length;n<a;n++){const o=t.charCodeAt(n);let i=o,l=!1;if(o>=55296&&o<=56319&&n+1<a){const c=t.charCodeAt(n+1);c>=56320&&c<=57343&&(i=(o-55296<<10)+65536|c-56320,l=!0)}i<=127?s+=1:i<=2047?s+=2:i<=65535?s+=3:s+=4,l&&n++}return s}createString(t){const s=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,s),s}}const Lw=class $i{constructor(t){if(bn(this,"id",++$i.LAST_ID),bn(this,"_onigBinding"),bn(this,"content"),bn(this,"utf16Length"),bn(this,"utf8Length"),bn(this,"utf16OffsetToUtf8"),bn(this,"utf8OffsetToUtf16"),bn(this,"ptr"),!Tn)throw new _R("Must invoke loadWasm first.");this._onigBinding=Tn,this.content=t;const s=new Ow(t);this.utf16Length=s.utf16Length,this.utf8Length=s.utf8Length,this.utf16OffsetToUtf8=s.utf16OffsetToUtf8,this.utf8OffsetToUtf16=s.utf8OffsetToUtf16,this.utf8Length<1e4&&!$i._sharedPtrInUse?($i._sharedPtr||($i._sharedPtr=Tn.omalloc(1e4)),$i._sharedPtrInUse=!0,Tn.HEAPU8.set(s.utf8Value,$i._sharedPtr),this.ptr=$i._sharedPtr):this.ptr=s.createString(Tn)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===$i._sharedPtr?$i._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};bn(Lw,"LAST_ID",0);bn(Lw,"_sharedPtr",0);bn(Lw,"_sharedPtrInUse",!1);let $H=Lw;class w0e{constructor(t){if(bn(this,"_onigBinding"),bn(this,"_ptr"),!Tn)throw new _R("Must invoke loadWasm first.");const s=[],n=[];for(let l=0,c=t.length;l<c;l++){const u=new Ow(t[l]);s[l]=u.createString(Tn),n[l]=u.utf8Length}const a=Tn.omalloc(4*t.length);Tn.HEAPU32.set(s,a/4);const o=Tn.omalloc(4*t.length);Tn.HEAPU32.set(n,o/4);const i=Tn.createOnigScanner(a,o,t.length);for(let l=0,c=t.length;l<c;l++)Tn.ofree(s[l]);Tn.ofree(o),Tn.ofree(a),i===0&&j0e(Tn),this._onigBinding=Tn,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,s,n){let a=0;if(typeof n=="number"&&(a=n),typeof t=="string"){t=new $H(t);const o=this._findNextMatchSync(t,s,!1,a);return t.dispose(),o}return this._findNextMatchSync(t,s,!1,a)}_findNextMatchSync(t,s,n,a){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(s),a);if(i===0)return null;const l=o.HEAPU32;let c=i/4;const u=l[c++],f=l[c++],h=[];for(let g=0;g<f;g++){const v=t.convertUtf8OffsetToUtf16(l[c++]),y=t.convertUtf8OffsetToUtf16(l[c++]);h[g]={start:v,end:y,length:y-v}}return{index:u,captureIndices:h}}}function N0e(e){return typeof e.instantiator=="function"}function k0e(e){return typeof e.default=="function"}function S0e(e){return typeof e.data<"u"}function C0e(e){return typeof Response<"u"&&e instanceof Response}function E0e(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let i0;function T0e(e){if(i0)return i0;async function t(){Tn=await b0e(async s=>{let n=e;return n=await n,typeof n=="function"&&(n=await n(s)),typeof n=="function"&&(n=await n(s)),N0e(n)?n=await n.instantiator(s):k0e(n)?n=await n.default(s):(S0e(n)&&(n=n.data),C0e(n)?typeof WebAssembly.instantiateStreaming=="function"?n=await R0e(n)(s):n=await A0e(n)(s):E0e(n)?n=await IS(n)(s):n instanceof WebAssembly.Module?n=await IS(n)(s):"default"in n&&n.default instanceof WebAssembly.Module&&(n=await IS(n.default)(s))),"instance"in n&&(n=n.instance),"exports"in n&&
vendor: 6,030 bytes, line 674
674(n=n.exports),n})}return i0=t(),i0}function IS(e){return t=>WebAssembly.instantiate(e,t)}function R0e(e){return t=>WebAssembly.instantiateStreaming(e,t)}function A0e(e){return async t=>{const s=await e.arrayBuffer();return WebAssembly.instantiate(s,t)}}async function P0e(e){return e&&await T0e(e),{createScanner(t){return new w0e(t.map(s=>typeof s=="string"?s:s.source))},createString(t){return new $H(t)}}}const I0e=l0e({langs:f0e,themes:m0e,engine:()=>P0e(se(()=>import("./wasm-Cu_PwRFu.js"),[]))}),{codeToHtml:Zv}=d0e(I0e,{guessEmbeddedLanguages:wye});/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:UH,setPrototypeOf:xD,isFrozen:M0e,getPrototypeOf:O0e,getOwnPropertyDescriptor:L0e}=Object;let{freeze:wa,seal:Vo,create:x_}=Object,{apply:YE,construct:KE}=typeof Reflect<"u"&&Reflect;wa||(wa=function(t){return t});Vo||(Vo=function(t){return t});YE||(YE=function(t,s){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;o<n;o++)a[o-2]=arguments[o];return t.apply(s,a)});KE||(KE=function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return new t(...n)});const l0=Na(Array.prototype.forEach),D0e=Na(Array.prototype.lastIndexOf),vD=Na(Array.prototype.pop),Ig=Na(Array.prototype.push),$0e=Na(Array.prototype.splice),v_=Na(String.prototype.toLowerCase),MS=Na(String.prototype.toString),OS=Na(String.prototype.match),Mg=Na(String.prototype.replace),U0e=Na(String.prototype.indexOf),F0e=Na(String.prototype.trim),no=Na(Object.prototype.hasOwnProperty),ga=Na(RegExp.prototype.test),Og=B0e(TypeError);function Na(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return YE(e,t,n)}}function B0e(e){return function(){for(var t=arguments.length,s=new Array(t),n=0;n<t;n++)s[n]=arguments[n];return KE(e,s)}}function Rs(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v_;xD&&xD(e,null);let n=t.length;for(;n--;){let a=t[n];if(typeof a=="string"){const o=s(a);o!==a&&(M0e(t)||(t[n]=o),a=o)}e[a]=!0}return e}function q0e(e){for(let t=0;t<e.length;t++)no(e,t)||(e[t]=null);return e}function Ui(e){const t=x_(null);for(const[s,n]of UH(e))no(e,s)&&(Array.isArray(n)?t[s]=q0e(n):n&&typeof n=="object"&&n.constructor===Object?t[s]=Ui(n):t[s]=n);return t}function Lg(e,t){for(;e!==null;){const n=L0e(e,t);if(n){if(n.get)return Na(n.get);if(typeof n.value=="function")return Na(n.value)}e=O0e(e)}function s(){return null}return s}const bD=wa(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),LS=wa(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),DS=wa(["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"]),z0e=wa(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),$S=wa(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),H0e=wa(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yD=wa(["#text"]),_D=wa(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
674spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),US=wa(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),jD=wa(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),c0=wa(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V0e=Vo(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G0e=Vo(/<%[\w\W]*|[\w\W]*%>/gm),W0e=Vo(/\$\{[\w\W]*/gm),Y0e=Vo(/^data-[\-\w.\u00B7-\uFFFF]+$/),K0e=Vo(/^aria-[\-\w]+$/),FH=Vo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),J0e=Vo(/^(?:\w+script|data):/i),X0e=Vo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),BH=Vo(/^html$/i),Q0e=Vo(/^[a-z][.\w]*(-[.\w]+)+$/i);var wD=Object.freeze({__proto__:null,ARIA_ATTR:K0e,ATTR_WHITESPACE:X0e,CUSTOM_ELEMENT:Q0e,DATA_ATTR:Y0e,DOCTYPE_NAME:BH,ERB_EXPR:G0e,IS_ALLOWED_URI:FH,IS_SCRIPT_OR_DATA:J0e,MUSTACHE_EXPR:V0e,TMPLIT_EXPR:W0e});const Dg={element:1,text:3,progressingInstruction:7,comment:8,document:9},Z0e=function(){return typeof window>"u"?null:window},e_e=function(t,s){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";s&&s.hasAttribute(a)&&(n=s.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ND=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function qH(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Z0e();const t=ne=>qH(ne);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Dg.document||!e.Element)return t.isSupported=!1,t;let{document:s}=e;const n=s,a=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:v}=e,y=c.prototype,_=Lg(y,"cloneNode"),j=Lg(y,"remove"),w=Lg(y,"nextSibling"),k=Lg(y,"childNodes"),S=Lg(y,"parentNode");if(typeof i=="function"){const ne=s.createElement("template");ne.content&&ne.content.ownerDocument&&(s=ne.content.ownerDocument)}let E,T="";const{implementation:A,createNodeIterator:R,createDocumentFragment:I,getElementsByTagName:L}=s,{importNode:M}=n;let O=ND();t.isSupported=typeof UH=="function"&&typeof S=="function"&&A&&A.createHTMLDocument!==void 0;
vendor: 8,220 bytes, line 674
674const{MUSTACHE_EXPR:z,ERB_EXPR:X,TMPLIT_EXPR:W,DATA_ATTR:K,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:J,ATTR_WHITESPACE:F,CUSTOM_ELEMENT:V}=wD;let{IS_ALLOWED_URI:$}=wD,B=null;const ae=Rs({},[...bD,...LS,...DS,...$S,...yD]);let H=null;const U=Rs({},[..._D,...US,...jD,...c0]);let oe=Object.seal(x_(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,Q=null;const le=Object.seal(x_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Se=!0,we=!0,Le=!1,xe=!0,de=!1,Me=!0,je=!1,Ae=!1,Oe=!1,Ke=!1,ut=!1,De=!1,ct=!0,rt=!1;const mt="user-content-";let vt=!0,gt=!1,Be={},ve=null;const be=Rs({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let nt=null;const Ze=Rs({},["audio","video","img","source","image","track"]);let he=null;const ke=Rs({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",at="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xhtml";let Ct=Pt,St=!1,Xt=null;const It=Rs({},[Ve,at,Pt],MS);let ee=Rs({},["mi","mo","mn","ms","mtext"]),We=Rs({},["annotation-xml"]);const wt=Rs({},["title","style","font","a","script"]);let _t=null;const Ee=["application/xhtml+xml","text/html"],He="text/html";let ie=null,Ce=null;const Ye=s.createElement("form"),Pe=function(P){return P instanceof RegExp||P instanceof Function},Ge=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ce&&Ce===P)){if((!P||typeof P!="object")&&(P={}),P=Ui(P),_t=Ee.indexOf(P.PARSER_MEDIA_TYPE)===-1?He:P.PARSER_MEDIA_TYPE,ie=_t==="application/xhtml+xml"?MS:v_,B=no(P,"ALLOWED_TAGS")?Rs({},P.ALLOWED_TAGS,ie):ae,H=no(P,"ALLOWED_ATTR")?Rs({},P.ALLOWED_ATTR,ie):U,Xt=no(P,"ALLOWED_NAMESPACES")?Rs({},P.ALLOWED_NAMESPACES,MS):It,he=no(P,"ADD_URI_SAFE_ATTR")?Rs(Ui(ke),P.ADD_URI_SAFE_ATTR,ie):ke,nt=no(P,"ADD_DATA_URI_TAGS")?Rs(Ui(Ze),P.ADD_DATA_URI_TAGS,ie):Ze,ve=no(P,"FORBID_CONTENTS")?Rs({},P.FORBID_CONTENTS,ie):be,fe=no(P,"FORBID_TAGS")?Rs({},P.FORBID_TAGS,ie):Ui({}),Q=no(P,"FORBID_ATTR")?Rs({},P.FORBID_ATTR,ie):Ui({}),Be=no(P,"USE_PROFILES")?P.USE_PROFILES:!1,Se=P.ALLOW_ARIA_ATTR!==!1,we=P.ALLOW_DATA_ATTR!==!1,Le=P.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=P.SAFE_FOR_TEMPLATES||!1,Me=P.SAFE_FOR_XML!==!1,je=P.WHOLE_DOCUMENT||!1,Ke=P.RETURN_DOM||!1,ut=P.RETURN_DOM_FRAGMENT||!1,De=P.RETURN_TRUSTED_TYPE||!1,Oe=P.FORCE_BODY||!1,ct=P.SANITIZE_DOM!==!1,rt=P.SANITIZE_NAMED_PROPS||!1,vt=P.KEEP_CONTENT!==!1,gt=P.IN_PLACE||!1,$=P.ALLOWED_URI_REGEXP||FH,Ct=P.NAMESPACE||Pt,ee=P.MATHML_TEXT_INTEGRATION_POINTS||ee,We=P.HTML_INTEGRATION_POINTS||We,oe=P.CUSTOM_ELEMENT_HANDLING||{},P.CUSTOM_ELEMENT_HANDLING&&Pe(P.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=P.CUSTOM_ELEMENT_HANDLING.tagNameCheck),P.CUSTOM_ELEMENT_HANDLING&&Pe(P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(we=!1),ut&&(Ke=!0),Be&&(B=Rs({},yD),H=x_(null),Be.html===!0&&(Rs(B,bD),Rs(H,_D)),Be.svg===!0&&(Rs(B,LS),Rs(H,US),Rs(H,c0)),Be.svgFilters===!0&&(Rs(B,DS),Rs(H,US),Rs(H,c0)),Be.mathMl===!0&&(Rs(B,$S),Rs(H,jD),Rs(H,c0))),no(P,"ADD_TAGS")||(le.tagCheck=null),no(P,"ADD_ATTR")||(le.attributeCheck=null),P.ADD_TAGS&&(typeof P.ADD_TAGS=="function"?le.tagCheck=P.ADD_TAGS:(B===ae&&(B=Ui(B)),Rs(B,P.ADD_TAGS,ie))),P.ADD_ATTR&&(typeof P.ADD_ATTR=="function"?le.attributeCheck=P.ADD_ATTR:(H===U&&(H=Ui(H)),Rs(H,P.ADD_ATTR,ie))),P.ADD_URI_SAFE_ATTR&&Rs(he,P.ADD_URI_SAFE_ATTR,ie),P.FORBID_CONTENTS&&(ve===be&&(ve=Ui(ve)),Rs(ve,P.FORBID_CONTENTS,ie)),P.ADD_FORBID_CONTENTS&&(ve===be&&(ve=Ui(ve)),Rs(ve,P.ADD_FORBID_CONTENTS,ie)),vt&&(B["#text"]=!0),je&&Rs(B,["html","head","body"]),B.table&&(Rs(B,["tbody"]),delete fe.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw Og('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Og('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=P.TRUSTED_TYPES_POLICY,T=E.createHTML("")}else E===void 0&&(E=e_e(v,a)),E!==null&&typeof T=="string"&&(T=E.createHTML(""));wa&&wa(P),Ce=P}},Nt=Rs({},[...LS,...DS,...z0e]),Tt=Rs({},[...$S,...H0e]),ss=function(P){let te=S(P);(!te||!te.tagName)&&(te={namespaceURI:Ct,tagName:"template"});const me=v_(P.tagName),Te=v_(te.tagName);return Xt[P.namespaceURI]?P.namespaceURI===at?te.namespaceURI===Pt?me==="svg":te.namespaceURI===Ve?me==="svg"&&(Te==="annotation-xml"||ee[Te]):!!Nt[me]:P.namespaceURI===Ve?te.namespaceURI===Pt?me==="math":te.namespaceURI===at?me==="math"&&We[Te]:!!Tt[me]:P.namespaceURI===Pt?te.namespaceURI===at&&!We[Te]||te.namespaceURI===Ve&&!ee[Te]?!1:!Tt[me]&&(wt[me]||!Nt[me]):!!(_t==="application/xhtml+xml"&&Xt[P.namespaceURI]):!1},Zt=function(P){Ig(t.removed,{element:P});try{S(P).removeChild(P)}catch{j(P)}},re=function(P,te){try{Ig(t.removed,{attribute:te.getAttributeNode(P),from:te})}catch{Ig(t.removed,{attribute:null,from:te})}if(te.removeAttribute(P),P==="is")if(Ke||ut)try{Zt(te)}catch{}else try{te.setAttribute(P,"")}catch{}},G=function(P){let te=null,me=null;if(Oe)P="<remove></remove>"+P;else{const xt=OS(P,/^[\r\n\t ]+/);me=xt&&xt[0]}_t==="application/xhtml+xml"&&Ct===Pt&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const Te=E?E.createHTML(P):P;if(Ct===Pt)try{te=new g().parseFromString(Te,_t)}catch{}if(!te||!te.documentElement){te=A.createDocument(Ct,"template",null);try{te.documentElement.innerHTML=St?T:Te}catch{}}const st=te.body||te.documentElement;return P&&me&&st.insertBefore(s.createTextNode(me),st.childNodes[0]||null),Ct===Pt?L.call(te,je?"html":"body")[0]:je?te.documentElement:st},ge=function(P){return R.call(P.ownerDocument||P,P,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ze=function(P){return P instanceof h&&(typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||!(P.attributes instanceof f)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function")},Gt=function(P){return typeof l=="function"&&P instanceof l};function es(ne,P,te){l0(ne,me=>{me.call(t,P,te,Ce)})}const ls=function(P){let te=null;if(es(O.beforeSanitizeElements,P,null),ze(P))return Zt(P),!0;const me=ie(P.nodeName);if(es(O.uponSanitizeElement,P,{tagName:me,allowedTags:B}),Me&&P.hasChildNodes()&&!Gt(P.firstElementChild)&&ga(/<[/\w!]/g,P.innerHTML)&&ga(/<[/\w!]/g,P.textContent)||P.nodeType===Dg.progressingInstruction||Me&&P.nodeType===Dg.comment&&ga(/<[/\w]/g,P.data))return Zt(P),!0;if(!(le.tagCheck instanceof Function&&le.tagCheck(me))&&(!B[me]||fe[me])){if(!fe[me]&&et(me)&&(oe.tagNameCheck instanceof RegExp&&ga(oe.tagNameCheck,me)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(me)))return!1;if(vt&&!ve[me]){const Te=S(P)||P.parentNode,st=k(P)||P.childNodes;if(st&&Te){const xt=st.length;for(let Et=xt-1;Et>=0;--Et){const rs=_(st[Et],!0);rs.__removalCount=(P.__removalCount||0)+1,Te.insertBefore(rs,w(P))}}}return Zt(P),!0}return P instanceof c&&!ss(P)||(me==="noscript"||me==="noembed"||me==="noframes")&&ga(/<\/no(script|embed|frames)/i,P.innerHTML)?(Zt(P),!0):(de&&P.nodeType===Dg.text&&(te=P.textContent,l0([z,X,W],Te=>{te=Mg(te,Te," ")}),P.textContent!==te&&(Ig(t.removed,{element:P.cloneNode()}),P.textContent=te)),es(O.afterSanitizeElements,P,null),!1)},pr=function(P,te,me){if(Q[te]||ct&&(te==="id"||te==="name")&&(me in s||me in Ye))return!1;
674if(!(we&&!Q[te]&&ga(K,te))){if(!(Se&&ga(q,te))){if(!(le.attributeCheck instanceof Function&&le.attributeCheck(te,P))){if(!H[te]||Q[te]){if(!(et(P)&&(oe.tagNameCheck instanceof RegExp&&ga(oe.tagNameCheck,P)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(P))&&(oe.attributeNameCheck instanceof RegExp&&ga(oe.attributeNameCheck,te)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(te,P))||te==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&ga(oe.tagNameCheck,me)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(me))))return!1}else if(!he[te]){if(!ga($,Mg(me,F,""))){if(!((te==="src"||te==="xlink:href"||te==="href")&&P!=="script"&&U0e(me,"data:")===0&&nt[P])){if(!(Le&&!ga(J,Mg(me,F,"")))){if(me)return!1}}}}}}}return!0},et=function(P){return P!=="annotation-xml"&&OS(P,V)},ye=function(P){es(O.beforeSanitizeAttributes,P,null);const{attributes:te}=P;if(!te||ze(P))return;const me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let Te=te.length;for(;Te--;){const st=te[Te],{name:xt,namespaceURI:Et,value:rs}=st,Rt=ie(xt),xs=rs;let jt=xt==="value"?xs:F0e(xs);if(me.attrName=Rt,me.attrValue=jt,me.keepAttr=!0,me.forceKeepAttr=void 0,es(O.uponSanitizeAttribute,P,me),jt=me.attrValue,rt&&(Rt==="id"||Rt==="name")&&(re(xt,P),jt=mt+jt),Me&&ga(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,jt)){re(xt,P);continue}if(Rt==="attributename"&&OS(jt,"href")){re(xt,P);continue}if(me.forceKeepAttr)continue;if(!me.keepAttr){re(xt,P);continue}if(!xe&&ga(/\/>/i,jt)){re(xt,P);continue}de&&l0([z,X,W],Xr=>{jt=Mg(jt,Xr," ")});const qs=ie(P.nodeName);if(!pr(qs,Rt,jt)){re(xt,P);continue}if(E&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Et)switch(v.getAttributeType(qs,Rt)){case"TrustedHTML":{jt=E.createHTML(jt);break}case"TrustedScriptURL":{jt=E.createScriptURL(jt);break}}if(jt!==xs)try{Et?P.setAttributeNS(Et,xt,jt):P.setAttribute(xt,jt),ze(P)?Zt(P):vD(t.removed)}catch{re(xt,P)}}es(O.afterSanitizeAttributes,P,null)},Qe=function ne(P){let te=null;const me=ge(P);for(es(O.beforeSanitizeShadowDOM,P,null);te=me.nextNode();)es(O.uponSanitizeShadowNode,te,null),ls(te),ye(te),te.content instanceof o&&ne(te.content);es(O.afterSanitizeShadowDOM,P,null)};return t.sanitize=function(ne){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=null,me=null,Te=null,st=null;if(St=!ne,St&&(ne="<!-->"),typeof ne!="string"&&!Gt(ne))if(typeof ne.toString=="function"){if(ne=ne.toString(),typeof ne!="string")throw Og("dirty is not a string, aborting")}else throw Og("toString is not a function");if(!t.isSupported)return ne;if(Ae||Ge(P),t.removed=[],typeof ne=="string"&&(gt=!1),gt){if(ne.nodeName){const rs=ie(ne.nodeName);if(!B[rs]||fe[rs])throw Og("root node is forbidden and cannot be sanitized in-place")}}else if(ne instanceof l)te=G("<!---->"),me=te.ownerDocument.importNode(ne,!0),me.nodeType===Dg.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?te=me:te.appendChild(me);else{if(!Ke&&!de&&!je&&ne.indexOf("<")===-1)return E&&De?E.createHTML(ne):ne;if(te=G(ne),!te)return Ke?null:De?T:""}te&&Oe&&Zt(te.firstChild);const xt=ge(gt?ne:te);for(;Te=xt.nextNode();)ls(Te),ye(Te),Te.content instanceof o&&Qe(Te.content);if(gt)return ne;if(Ke){if(ut)for(st=I.call(te.ownerDocument);te.firstChild;)st.appendChild(te.firstChild);else st=te;return(H.shadowroot||H.shadowrootmode)&&(st=M.call(n,st,!0)),st}let Et=je?te.outerHTML:te.innerHTML;return je&&B["!doctype"]&&te.ownerDocument&&te.ownerDocument.doctype&&te.ownerDocument.doctype.name&&ga(BH,te.ownerDocument.doctype.name)&&(Et="<!DOCTYPE "+te.ownerDocument.doctype.name+`> 675`+Et),de&&l0([z,X,W],rs=>{Et=Mg(Et,rs," ")}),E&&De?E.createHTML(Et):Et},t.setConfig=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ge(ne),Ae=!0},t.clearConfig=function(){Ce=null,Ae=!1},t.isValidAttribute=function(ne,P,te){Ce||Ge({});const me=ie(ne),Te=ie(P);return pr(me,Te,te)},t.addHook=function(ne,P){typeof P=="function"&&Ig(O[ne],P)},t.removeHook=function(ne,P){if(P!==void 0){const te=D0e(O[ne],P);return te===-1?void 0:$0e(O[ne],te,1)[0]}return vD(O[ne])},t.removeHooks=function(ne){O[ne]=[]},t.removeAllHooks=function(){O=ND()},t}var t_e=qH();function Rp(e){return t_e.sanitize(e,{ADD_TAGS:["use"],ADD_ATTR:["target","rel"],FORBID_ATTR:["onerror","onload","onclick","onmouseover"],ALLOW_ARIA_ATTR:!0})}function FS({json:e,maxLength:t=80}){const{theme:s}=Sp(),n=e.length>t?e.slice(0,t)+"...":e,a=o=>{const i=[];let l=o,c=0;const u=/("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(\btrue\b|\bfalse\b)|(\bnull\b)|([\[\]{}:,])/g;let f=0,h;for(;(h=u.exec(l))!==null;){h.index>f&&i.push(r.jsx("span",{children:l.slice(f,h.index)},c++));const[g,v,y,_,j,w]=h;v?l.slice(h.index+g.length).trimStart().startsWith(":")?i.push(r.jsx("span",{className:s==="light"?"text-indigo-600":"text-indigo-300",children:g},c++)):i.push(r.jsx("span",{className:s==="light"?"text-emerald-600":"text-emerald-400",children:g},c++)):y?i.push(r.jsx("span",{className:s==="light"?"text-amber-600":"text-amber-400",children:g},c++)):_?i.push(r.jsx("span",{className:s==="light"?"text-sky-600":"text-sky-400",children:g},c++)):j?i.push(r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:g},c++)):w&&i.push(r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:g},c++)),f=h.index+g.length}return f<l.length&&i.push(r.jsx("span",{children:l.slice(f)},c++)),i};return r.jsx("code",{className:"text-xs bg-[var(--color-bg-code)] px-2 py-1 rounded max-w-[400px] truncate block font-mono",children:a(n)})}function aa({json:e,className:t=""}){const{theme:s}=Sp(),[n,a]=x.useState(null);return x.useEffect(()=>{let o=!0;return a(null),(async()=>{try{const i=await Zv(e,{lang:"json",theme:s==="light"?"vitesse-light":"vitesse-dark"});o&&a(i)}catch(i){console.error("JSON highlighting failed",i)}})(),()=>{o=!1}},[e,s]),n?r.jsx("div",{className:`json-highlight rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] overflow-auto [&_pre]:!bg-transparent [&_pre]:p-4 [&_pre]:m-0 [&_code]:text-sm ${t}`,dangerouslySetInnerHTML:{__html:Rp(n)}}):r.jsx("pre",{className:`p-4 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-sm text-[var(--color-fg-secondary)] font-mono overflow-auto ${t}`,children:e})}function Go({code:e,language:t,className:s=""}){const{theme:n}=Sp(),[a,o]=x.useState(null);return x.useEffect(()=>{let i=!0;return o(null),(async()=>{try{const l=await Zv(e,{lang:t,theme:n==="light"?"vitesse-light":"vitesse-dark"});i&&o(l)}catch(l){console.error(`${t} highlighting failed`,l)}})(),()=>{i=!1}},[e,t,n]),a?r.jsx("div",{className:`code-highlight rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] overflow-auto [&_pre]:!bg-transparent [&_pre]:p-3 [&_pre]:m-0 [&_code]:text-xs [&_code]:whitespace-pre-wrap ${s}`,dangerouslySetInnerHTML:{__html:Rp(a)}}):r.jsx("pre",{className:`p-3 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-xs text-[var(--color-fg-secondary)] font-mono overflow-auto whitespace-pre-wrap ${s}`,children:e})}
675function s_e({value:e,onChange:t,rows:s=12,placeholder:n,className:a=""}){const{theme:o}=Sp(),[i,l]=x.useState(null),[c,u]=x.useState(!1);return x.useEffect(()=>{let f=!0;if(c){l(null);return}return(async()=>{try{let h=e;try{JSON.parse(e)}catch{l(null);return}const g=await Zv(h,{lang:"json",theme:o==="light"?"vitesse-light":"vitesse-dark"});f&&l(g)}catch(h){console.error("JSON highlighting failed",h),l(null)}})(),()=>{f=!1}},[e,c,o]),r.jsxs("div",{className:`relative ${a}`,children:[i&&!c&&r.jsx("div",{className:"absolute inset-0 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] overflow-auto pointer-events-none [&_pre]:!bg-transparent [&_pre]:p-3 [&_pre]:m-0 [&_code]:text-sm [&_code]:leading-relaxed",dangerouslySetInnerHTML:{__html:Rp(i)}}),r.jsx("textarea",{value:e,onChange:f=>t(f.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),rows:s,placeholder:n,className:`w-full font-mono text-sm resize-none rounded-lg border border-[var(--color-border-default)] p-3 leading-relaxed ${i&&!c?"bg-transparent text-transparent caret-[var(--color-fg-secondary)] selection:bg-indigo-500/30":"bg-[var(--color-bg-alt)] text-[var(--color-fg-secondary)]"} focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent placeholder:text-[var(--color-fg-muted)]`,spellCheck:!1})]})}const jR="rr_onboarding_wizard_v1",Ix="rr_onboarding_wizard_skipped",Kf=[{name:"Todos",schema:{title:"string",completed:"boolean",priority:"number"},sampleData:{title:"Buy groceries",completed:!1,priority:1}},{name:"Users",schema:{name:"string",email:"string",role:"string"},sampleData:{name:"Jane Doe",email:"[email protected]",role:"admin"}},{name:"Posts",schema:{title:"string",body:"string",author:"string"},sampleData:{title:"Hello World",body:"This is my first post.",author:"Jane"}}],BS={path:null,builderStep:1,testerStep:1,aiStep:1,exploreStep:1,projectId:null,projectName:"My app",projectSlug:"",projectApiKey:null,collectionName:"Todos",collectionSlug:"",collectionSchema:Kf[0].schema,recordId:null,recordData:null,apiKey:null,apiKeyName:"My API key",aiPrompt:"",aiBlueprint:null,aiCreationResult:null,aiGenerationsRemaining:null,skipped:!1},fp="rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-[0_20px_60px_var(--color-shadow)]",dn=Jt.primaryEmphasis,im=Jt.secondaryEmphasis;function zH(e){const t=["swift","bright","calm","bold","keen"],s=["fox","owl","bear","wolf","hawk"],n=t[Math.floor(Math.random()*t.length)],a=s[Math.floor(Math.random()*s.length)];return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${n}-${a}`}function r_e(){if(typeof window>"u")return BS;try{const e=window.localStorage.getItem(jR);if(e){const t=JSON.parse(e);return{...BS,...t}}}catch{}return BS}function n_e(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jR,JSON.stringify(e))}catch{}}function kD(){if(!(typeof window>"u"))try{window.localStorage.removeItem(jR)}catch{}}function a_e(){if(typeof window>"u")return!1;try{window.localStorage.getItem(Ix)&&window.localStorage.removeItem(Ix)}catch{}return window.sessionStorage.getItem(Ix)==="true"}function o_e(e){if(!(typeof window>"u")){window.sessionStorage.setItem(Ix,"true");try{window.localStorage.removeItem(Ix)}catch{}}}function ll({current:e,total:t,label:s}){const n=e/t*100;return r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:s}),r.jsx("div",{className:"h-1.5 w-full bg-[var(--color-bg-hover)] rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-emerald-400 rounded-full transition-all duration-500 ease-out",style:{width:`${n}%`}})})]})}function wR({status:e,statusText:t,data:s,latency:n,headers:a}){const o=e>=200&&e<300;return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsxs("span",{className:o?"text-[var(--color-semantic-success)]":"text-[var(--color-semantic-danger)]",children:[o?r.jsx(ts,{className:"h-4 w-4 inline mr-1"}):r.jsx(lr,{className:"h-4 w-4 inline mr-1"}),e," ",t||(o?"OK":"Error")]}),n&&r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["· ",n,"ms"]})]}),a&&Object.keys(a).length>0&&r.jsxs("div",{className:"text-xs space-y-1",children:[r.jsx("p",{className:"text-[var(--color-fg-muted)] font-medium",children:"Response Headers:"}),r.jsx("div",{className:"bg-[var(--color-bg-code)] rounded-lg p-2 font-mono text-[var(--color-fg-muted)]",children:Object.entries(a).map(([i,l])=>r.jsxs("div",{children:[r.jsx("span",{className:"text-indigo-300",children:i}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:": "}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:l})]},i))})]}),r.jsx(aa,{json:JSON.stringify(s,null,2)})]})}function i_e({onSelect:e,onSkip:t}
675){return r.jsxs("div",{className:"relative max-w-4xl mx-auto space-y-8 text-center",children:[r.jsx("div",{className:"absolute inset-0 -z-10 flex items-center justify-center pointer-events-none",children:r.jsx("div",{className:"w-[600px] h-[400px] rounded-full bg-gradient-radial from-indigo-500/[0.06] via-transparent to-transparent blur-2xl"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-[var(--color-fg-default)]",children:"Welcome to ReqRes"}),r.jsx("p",{className:"text-base text-[var(--color-fg-muted)]",children:"What are you here to do?"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5",children:[r.jsxs("button",{type:"button",onClick:()=>e("ai"),className:"relative flex flex-col rounded-2xl border border-[var(--color-semantic-success)]/40 bg-[var(--color-bg-card)] p-7 text-left hover:border-[var(--color-semantic-success)]/60 hover:bg-[var(--color-bg-hover)] hover:-translate-y-0.5 transition-all duration-200 group shadow-[0_20px_60px_var(--color-shadow)]",children:[r.jsx("span",{className:"absolute -top-2.5 right-4 px-2.5 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wide bg-[var(--color-semantic-success)] text-white",children:"Recommended"}),r.jsx("div",{className:"p-2.5 rounded-xl bg-[var(--color-semantic-success)]/10 text-[var(--color-semantic-success)] w-fit transition-transform duration-200 group-hover:scale-105",children:r.jsx(rr,{className:"h-6 w-6"})}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mt-4",children:"Use AI"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-2 flex-1",children:"Describe your app. We'll build the backend."}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-[var(--color-semantic-success)] mt-5 group-hover:gap-2 transition-all",children:["Describe ",r.jsx(Kt,{className:"h-4 w-4"})]})]}),r.jsxs("button",{type:"button",onClick:()=>e("builder"),className:"relative flex flex-col rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-7 text-left hover:border-[var(--color-border-strong)] hover:bg-[var(--color-bg-hover)] hover:-translate-y-0.5 transition-all duration-200 group shadow-[0_20px_60px_var(--color-shadow)]",children:[r.jsx("div",{className:"p-2.5 rounded-xl bg-indigo-500/10 text-indigo-400 w-fit transition-transform duration-200 group-hover:scale-105",children:r.jsx(Dr,{className:"h-6 w-6"})}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mt-4",children:"Build"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-2 flex-1",children:"Step-by-step project and collection setup."}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-indigo-400 mt-5 group-hover:gap-2 transition-all",children:["Start ",r.jsx(Kt,{className:"h-4 w-4"})]})]}),r.jsxs("button",{type:"button",onClick:()=>e("tester"),className:"relative flex flex-col rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-7 text-left hover:border-[var(--color-border-strong)] hover:bg-[var(--color-bg-hover)] hover:-translate-y-0.5 transition-all duration-200 group shadow-[0_20px_60px_var(--color-shadow)] sm:col-span-2 lg:col-span-1",children:[r.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 text-emerald-400 w-fit transition-transform duration-200 group-hover:scale-105",children:r.jsx(Lu,{className:"h-6 w-6"})}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mt-4",children:"Test"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-2 flex-1",children:"Get an API key and send your first request."}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-emerald-400 mt-5 group-hover:gap-2 transition-all",children:["Start ",r.jsx(Kt,{className:"h-4 w-4"})]})]})]}),r.jsx("button",{type:"button",onClick:t,className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition mt-2",children:"Skip setup â"})]})}function l_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}
675=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(!1);x.useEffect(()=>{if(!e.projectId)return;(async()=>{var v;if(e.projectApiKey){f(!0),setTimeout(()=>s(),800);return}try{const y=await Ue(a);if(!y)return;const j=(v=(await ue.get("/projects",{authToken:y})).data.projects)==null?void 0:v.find(w=>w.id===e.projectId);j!=null&&j.api_key&&t({projectApiKey:j.api_key}),f(!0),setTimeout(()=>s(),800)}catch{f(!0),setTimeout(()=>s(),800)}})()},[e.projectId,e.projectApiKey,s,a,t]);const h=async()=>{if(!e.projectName.trim()){c("Please enter a project name");return}if(e.projectId&&e.projectApiKey){f(!0),setTimeout(()=>s(),800);return}i(!0),c(null);try{const g=await Ue(a);if(!g)throw new Error("Please sign in");const y=(await ue.get("/projects",{authToken:g})).data.projects||[];if(e.projectId&&!e.projectApiKey){const k=y.find(S=>S.id===e.projectId);if(k!=null&&k.api_key){t({projectApiKey:k.api_key}),f(!0),setTimeout(()=>s(),800);return}}const _=y.find(k=>k.name.toLowerCase()===e.projectName.trim().toLowerCase());if(_){t({projectId:_.id,projectSlug:_.slug,projectApiKey:_.api_key||null}),f(!0),setTimeout(()=>s(),800);return}if(y.length>0){const k=y[0];t({projectId:k.id,projectSlug:k.slug,projectApiKey:k.api_key||null,projectName:k.name}),f(!0),setTimeout(()=>s(),800);return}const j=zH(e.projectName),w=await ue.post("/projects",{name:e.projectName,slug:j},{authToken:g});t({projectId:w.data.id,projectSlug:w.data.slug,projectApiKey:w.data.api_key||null}),f(!0),setTimeout(()=>s(),800)}catch(g){const v=g instanceof yt?g.message:"Failed to create project";c(v)}finally{i(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:1,total:4,label:"Step 1 of 4 · Create a project"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Create a project"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"A project is your backend workspace - it holds your data, auth, and API keys."})]}),u?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-success)] py-3",children:[r.jsx(ts,{className:"h-5 w-5"}),r.jsxs("span",{children:['Project "',e.projectName,'" created']})]}),r.jsxs("button",{type:"button",onClick:s,className:dn,children:["Continue ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]}):r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm text-[var(--color-fg-secondary)] mb-2",children:"What's your project called?"}),r.jsx("input",{type:"text",value:e.projectName,onChange:g=>t({projectName:g.target.value}),placeholder:"My app",className:"w-full px-4 py-3 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none focus:border-[var(--color-border-strong)] focus:bg-[var(--color-bg-card)] transition-colors",onKeyDown:g=>g.key==="Enter"&&h(),autoFocus:!0})]}),l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("button",{type:"button",onClick:h,disabled:o,className:dn,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Create project ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})}),r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)]",children:"Next: Choose a collection template"})]})]})]})]})}function c_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(!1),[h,g]=x.useState(0),[v,y]=x.useState(""),[_,j]=x.useState(!1),w=async()=>{const S=_?v:Kf[h].name;if(!S.trim()){c("Please enter a collection name");return}i(!0),c(null);try{const E=await Ue(a);if(!E)throw new Error("Please sign in");const T=S.toLowerCase().replace(/[^a-z0-9]+/g,"-"),A=_?Kf[0]:Kf[h],R=await ue.post("/api/collections",{name:S,slug:T,visibility:"private",project_id:e.projectId},{authToken:E,headers:{"X-Reqres-Env":"prod",...e.projectApiKey&&{"x-api-key":e.projectApiKey}}});t({collectionName:S,collectionSlug:R.data.data.slug,collectionSchema:A.schema,recordData:A.sampleData}),f(!0),setTimeout(()=>s(),800)}catch(E){const T=E instanceof yt?E.message:"Failed to create collection";c(T)}finally{i(!1)}},k=S=>Object.entries(S).map(([E])=>`${E}`).join(", ");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:2,total:4,label:"Step 2 of 4 · Create a collection"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Create a collection"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"A collection is like a database table - it defines what your data looks like."})]}),u?r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-success)] py-4",children:[r.jsx(ts,{className:"h-5 w-5"}),r.jsxs("span",{children:['Collection "',e.collectionName,'" created']})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Pick a starter template or name your own:"}),r.jsxs("div",{className:"space-y-2",children:[Kf.map((S,E)=>r.jsx("button",{type:"button",onClick:()=>{g(E),j(!1)},className:`w-full text-left px-4 py-3 rounded-lg border transition-all ${!_&&h===E?"border-indigo-500/50 bg-indigo-500/[0.06]":"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-secondary)]"}`,children:r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors ${!_&&h===E?"border-indigo-400":"border-[var(--color-fg-faint)]"}`,children:!_&&h===E&&r.jsx("span",{className:"w-2 h-2 rounded-full bg-indigo-400"})}),r.jsx("span",{className:"text-[var(--color-fg-default)] font-medium",children:S.name}),E===0&&r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-indigo-400/70 font-medium",children:"Recommended"}),r.jsxs("span",{className:"text-[var(--color-fg-muted)] text-sm font-mono",children:["(",k(S.schema),")"]})]})},S.name)),r.jsx("button",{type:"button",onClick:()=>j(!0),className:`w-full text-left px-4 py-3 rounded-lg border transition-all ${_?"border-indigo-500/50 bg-indigo-500/[0.06]":"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-secondary)]"}`,children:r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors ${_?"border-indigo-400":"border-[var(--color-fg-faint)]"}`,children:_&&r.jsx("span",{className:"w-2 h-2 rounded-full bg-indigo-400"})}),r.jsx("span",{className:"text-[var(--color-fg-default)] font-medium",children:"Custom name"})]})}),_&&r.jsxs("div",{className:"mt-3 pl-7",children:[r.jsx("input",{type:"text",value:v,onCh
675ange:S=>y(S.target.value),placeholder:"e.g. products, events, messages",className:"w-full px-4 py-3 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none focus:border-indigo-500/50 focus:bg-[var(--color-bg-card)] transition-colors",autoFocus:!0}),r.jsx("p",{className:"mt-2 text-xs text-[var(--color-fg-muted)]",children:"Enter a name for your collection (e.g. products, events, messages)"})]})]}),l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsx("button",{type:"button",onClick:w,disabled:o,className:dn,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Create collection ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})})]})]})]})}function d_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(null),[h,g]=x.useState(!1),[v,y]=x.useState(JSON.stringify(e.recordData||Kf[0].sampleData,null,2)),_=x.useMemo(()=>{if(!h)return{isValid:!0,error:null};try{return JSON.parse(v),{isValid:!0,error:null}}catch(S){return{isValid:!1,error:S.message}}},[h,v]),j=x.useMemo(()=>{if(!h)return e.recordData;try{return JSON.parse(v)}catch{return null}},[h,v,e.recordData]),w=()=>{try{const S=JSON.parse(v);y(JSON.stringify(S,null,2))}catch{}},k=async()=>{if(h&&!_.isValid){c("Please fix the JSON syntax errors before sending");return}i(!0),c(null);try{const S=await Ue(a);if(!S)throw new Error("Please sign in");const E=h?JSON.parse(v):e.recordData,T=await ue.post(`/api/collections/${e.collectionSlug}/records?project_id=${e.projectId}`,{data:E},{authToken:S,headers:{"X-Reqres-Env":"prod",...e.projectApiKey&&{"x-api-key":e.projectApiKey}}}),A={id:T.data.data.id,...E,created_at:T.data.data.created_at||new Date().toISOString()};f({status:201,data:A}),t({recordId:T.data.data.id,recordData:E}),setTimeout(()=>s(),1e4)}catch(S){const E=S instanceof yt?S.message:"Failed to create record";c(E)}finally{i(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:3,total:4,label:"Step 3 of 4 · Add your first record"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Add your first record"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Your collection is ready. Let's add some data."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[r.jsx("span",{className:"text-emerald-400 font-semibold",children:"POST"}),r.jsxs("span",{className:"text-[var(--color-fg-secondary)]",children:["/api/collections/",e.collectionSlug,"/records"]})]}),h?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{value:v,onChange:S=>y(S.target.value),className:`w-full h-48 px-4 py-3 rounded-lg bg-[var(--color-bg-code)] border text-[var(--color-fg-secondary)] font-mono text-sm focus:outline-none focus:ring-1 transition-colors ${_.isValid?"border-[var(--color-border-default)] focus:border-indigo-500/50 focus:ring-indigo-500/50":"border-[var(--color-semantic-danger)]/50 focus:border-[var(--color-semantic-danger)] focus:ring-[var(--color-semantic-danger)]/50"}`,spellCheck:!1}),r.jsx("button",{type:"button",onClick:w,disabled:!_.isValid,className:"absolute top-2 right-2 p-1.5 rounded bg-[var(--color-bg-hover)] hover:bg-[var(--color-bg-active)] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition disabled:opacity-50 disabled:cursor-not-allowed",title:"Format JSON",children:r.jsx(Dr,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"flex items-center gap-2 text-xs",children:_.isValid?r.jsxs("span",{className:"text-[var(--color-semantic-success)] flex items-center gap-1",children:[r.jsx(ts,{className:"h-3 w-3"})," Valid JSON"]}):r.jsxs("span",{className:"text-[var(--color-semantic-danger)] flex items-center gap-1",children:[r.jsx(lr,{className:"h-3 w-3"})," ",_.error]})})]}):r.jsx(aa,{json:JSON.stringify(j,null,2)})]}),u?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-gradient-to-r from-emerald-500/20 via-indigo-500/20 to-purple-500/20 border border-emerald-500/30 p-4",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_50%,rgba(16,185,129,0.15),transparent_50%)]"}),r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_70%_50%,rgba(139,92,246,0.15),transparent_50%)]"}),r.jsxs("div",{className:"relative flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-full bg-emerald-500/20 animate-bounce",children:r.jsx(rr,{className:"h-5 w-5 text-emerald-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-emerald-300 font-medium",children:"Record created successfully!"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Your first data is now persisted in the cloud."})]})]}),r.jsx("div",{className:"absolute top-2 left-1/4 w-2 h-2 bg-yellow-400 rounded-full animate-ping opacity-75",style:{animationDelay:"0s"}}),r.jsx("div",{className:"absolute top-4 right-1/3 w-1.5 h-1.5 bg-pink-400 rounded-full animate-ping opacity-75",style:{animationDelay:"0.5s"}}),r.jsx("div",{className:"absolute bottom-3 left-1/2 w-2 h-2 bg-indigo-400 rounded-full animate-ping opacity-75",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 right-1/4 w-1.5 h-1.5 bg-emerald-400 rounded-full animate-ping opacity-75",style:{animationDelay:"0.3s"}})]}),r.jsx(wR,{status:u.status,statusText:"Created",data:u.data}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] animate-pulse",children:"Auto-continuing in a moment..."}),r.jsxs("button",{type:"button",onClick:s,className:dn,children:["Continue ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]})]}):r.jsxs("div",{className:"space-y-4",children:[l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["This will create a real record
675in your ",e.collectionName.toLowerCase()," collection."]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{type:"button",onClick:k,disabled:o||h&&!_.isValid,className:dn,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Send request ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})}),r.jsx("button",{type:"button",onClick:()=>g(!h),className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:h?"Use defaults":"Edit JSON"})]})]})]})]})}function u_e({state:e,onComplete:t,onBack:s}){const{getToken:n}=zt(),a=un(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(!1),[h,g]=x.useState(!1),v=$s,y=`${v}/api/collections/${e.collectionSlug}/records?project_id=${e.projectId}`,_=`${v}/api/collections/${e.collectionSlug}/records`,j={"x-api-key":e.projectApiKey||"<your-api-key>","X-Reqres-Env":"prod"},w=`curl "${y}" \\ 676 -H "x-api-key: ${e.projectApiKey||"<your-api-key>"}" \\ 677 -H "X-Reqres-Env: prod"`,k=`const response = await fetch( 678 "${y}", 679 { 680 headers: { 681 "x-api-key": "${e.projectApiKey||"<your-api-key>"}", 682 "X-Reqres-Env": "prod" 683 } 684 } 685); 686const data = await response.json(); 687console.log(data);`,S=async()=>{i(!0);const T=Date.now();try{const A=await Ue(n);if(!A)throw new Error("Please sign in");const R=await ue.get(`/api/collections/${e.collectionSlug}/records?project_id=${e.projectId}`,{authToken:A,headers:{"X-Reqres-Env":"prod",...e.projectApiKey&&{"x-api-key":e.projectApiKey}}}),I=Date.now()-T;c({status:200,data:R.data,latency:I})}catch{const R=Date.now()-T;c({status:500,data:{error:"Failed to fetch records"},latency:R})}finally{i(!1)}},E=(T,A)=>{navigator.clipboard.writeText(T),Z.track("onboarding_snippet_copied",{type:A,step:"try_it"}),A==="curl"?(f(!0),setTimeout(()=>f(!1),2e3)):(g(!0),setTimeout(()=>g(!1),2e3))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsxs("button",{type:"button",onClick:()=>{t(),e.projectId&&a(`/projects/${e.projectId}`)},className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:["Visit Project ",r.jsx(Kt,{className:"h-4 w-4"})]})]}),r.jsx(ll,{current:4,total:4,label:"Step 4 of 4 · Your backend is live"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Your backend is live!"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Your data is persisted and ready to query. Try it:"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[r.jsx("span",{className:"text-sky-400 font-semibold",children:"GET"}),r.jsx("span",{className:"text-[var(--color-fg-secondary)] break-all",children:_})]}),r.jsxs("div",{className:"text-xs space-y-1",children:[r.jsx("p",{className:"text-[var(--color-fg-muted)] font-medium",children:"Request Headers:"}),r.jsx("div",{className:"bg-[var(--color-bg-code)] rounded-lg p-2 font-mono text-[var(--color-fg-muted)]",children:Object.entries(j).map(([T,A])=>r.jsxs("div",{children:[r.jsx("span",{className:"text-indigo-300",children:T}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:": "}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:A})]},T))})]}),l?r.jsxs("div",{className:"space-y-5",children:[r.jsx(wR,{status:l.status,statusText:"OK",data:l.data,latency:l.latency,headers:{"content-type":"application/json; charset=utf-8","x-reqres-env":"prod"}}),r.jsx("p",{className:"text-lg text-[var(--color-semantic-success)] font-medium py-2",children:"That's your backend. No servers, no deploy, no config. It's just a URL."}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:"Use this in your app:"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(mo,{className:"h-3.5 w-3.5"})," cURL"]}),r.jsxs("button",{type:"button",onClick:()=>E(w,"curl"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[u?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),u?"Copied!":"Copy"]})]}),r.jsx(Go,{code:w,language:"bash"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(nm,{className:"h-3.5 w-3.5"})," JavaScript fetch()"]}),r.jsxs("button",{type:"button",onClick:()=>E(k,"fetch"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[h?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),h?"Copied!":"Copy"]})]}),r.jsx(Go,{code:k,language:"javascript"})]})]}),r.jsxs("div",{className:"pt-4 border-t border-[var(--color-border-default)] space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:"What's next?"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(dt,{to:"/prompts",className:dn,onClick:t,children:["Build with AI prompts ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]}),r.jsx(dt,{to:`/data-explorer?projectId=${e.projectId}`,className:im,onClick:t,children:"Browse your data"}),r.jsx("a",{href:"/documentation",rel:"noopener noreferrer",className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:t,children:"Read the docs â"})]})]})]}):r.jsx("button",{type:"button",onClick:S,disabled:o,className:dn,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Fetch my data ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})})]})]})]})}function p_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}
687=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(!1),[h,g]=x.useState(!0);x.useEffect(()=>{(async()=>{try{const j=await Ue(a);if(!j){g(!1);return}const k=(await ue.get("/api-keys",{authToken:j})).data||[];k.length>0&&!e.apiKey&&t({apiKey:k[0].api_key});const E=(await ue.get("/projects",{authToken:j})).data.projects||[];if(E.length>0){const T=E[0];t({projectId:T.id,projectApiKey:T.api_key||null})}}catch(j){console.warn("Failed to fetch existing keys:",j)}finally{g(!1)}})()},[a]);const v=async()=>{i(!0),c(null);try{const _=await Ue(a);if(!_)throw new Error("Please sign in");let j=e.projectId,w=e.projectApiKey;const S=(await ue.get("/projects",{authToken:_})).data.projects||[];if(S.length>0){const T=S[0];j=T.id,w=T.api_key||null,t({projectId:j,projectApiKey:w})}else{const T=await ue.post("/projects",{name:"My project",slug:zH("My project")},{authToken:_});j=T.data.id,w=T.data.api_key||null,t({projectId:j,projectApiKey:w})}const E=await ue.post("/api-keys",{keyName:"My API key",permissions:"read_write"},{authToken:_});t({apiKey:E.data.apiKey.api_key})}catch(_){const j=_ instanceof yt?_.message:"Failed to create API key";c(j)}finally{i(!1)}},y=()=>{e.apiKey&&(navigator.clipboard.writeText(e.apiKey),Z.track("onboarding_snippet_copied",{type:"api_key",step:"copy_key"}),f(!0),it.success("API key copied"),setTimeout(()=>{f(!1),s()},1500))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:1,total:3,label:"Step 1 of 3 · Get your API key"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:e.apiKey?"Your API key":"Get your API key"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:e.apiKey?"Use this key to authenticate requests to ReqRes.":"An API key lets you authenticate requests to your ReqRes backend."})]}),h?r.jsxs("div",{className:"flex items-center gap-3 py-8",children:[r.jsx(on,{className:"h-5 w-5 animate-spin text-[var(--color-fg-muted)]"}),r.jsx("span",{className:"text-sm text-[var(--color-fg-muted)]",children:"Checking for existing API keys..."})]}):e.apiKey?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-success)]",children:[r.jsx(ts,{className:"h-5 w-5"}),r.jsx("span",{children:"API key ready"})]}),r.jsx("div",{className:"p-4 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] font-mono text-sm text-[var(--color-fg-secondary)] break-all",children:e.apiKey}),r.jsx("button",{type:"button",onClick:y,className:dn,children:u?r.jsxs(r.Fragment,{children:[r.jsx(ts,{className:"h-4 w-4 mr-1"})," Copied!"]}):r.jsxs(r.Fragment,{children:[r.jsx(is,{className:"h-4 w-4 mr-1"})," Copy and continue"]})})]}):r.jsxs("div",{className:"space-y-5",children:[l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("button",{type:"button",onClick:v,disabled:o,className:dn,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Generate API key ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})}),r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)]",children:"Next: Send your first request"})]})]})]})]})}function f_e({state:e,onNext:t,onBack:s}){const[n,a]=x.useState(!1),[o,i]=x.useState(null),[l,c]=x.useState(null),u=`${$s}/api/users?page=1`,f=e.projectApiKey||e.apiKey||"",h=async()=>{a(!0),c(null);const g=Date.now();try{const v=await fetch(u,{headers:{"x-api-key":f}}),y=await v.json(),_=Date.now()-g;i({status:v.status,data:y,latency:_});try{window.localStorage.setItem("rr_onboarding_first_request",new Date().toISOString())}catch{}setTimeout(()=>t(),1e4)}catch{c("Failed to send request")}finally{a(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:2,total:3,label:"Step 2 of 3 · Send your first request"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Send your first request"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Let's hit the API. Here's a ready-made request:"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[r.jsx("span",{className:"text-sky-400 font-semibold",children:"GET"}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:"/api/users?page=1"})]}),r.jsxs("div",{className:"text-xs space-y-1",children:[r.jsx("p",{className:"text-[var(--color-fg-muted)] font-medium",children:"Request Headers:"}),r.jsx("div",{className:"bg-[var(--color-bg-code)] rounded-lg p-2 font-mono text-[var(--color-fg-muted)]",children:r.jsxs("div",{children:[r.jsx("span",{className:"text-indigo-300",children:"x-api-key"}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:": "}),r.jsxs("span",{className:"text-[var(--color-fg-secondary)]",children:[f==null?void 0:f.slice(0,24),"..."]})]})})]})]}),o?r.jsxs("div",{className:"space-y-4",children:[r.jsx(wR,{status:o.status,data:o.data,latency:o.latency}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] animate-pulse",children:"Auto-continuing in a moment..."}),r.jsxs("button",{type:"button",onClick:t,className:dn,children:["Continue ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]})]}):r.jsxs("div",{className:"space-y-4",children:[l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"This will fetch sample user data from the ReqRes API."}),r.jsx("button",{type:"button",onClick:h,disabled:n,className:dn,children:n?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Send request ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})})]})]})]})}function h_e({state:e,onComplete:t,onBack:s}){const[n,a]=x.useState(!1),[o,i]=x.useState(!1),l=e.projectApiKey||e.apiKey||"<your-api-key>",c=`curl -H "x-api-key: ${l}" \\ 688 ${$s}/api/users?page=1`,u=`const response = await request.get( 689 '${$s}/api/users?page=1', 690 { headers: { 'x-api-key': '${l}' }} 691);`,f=(h,g)=>{navigator.clipboard.writeText(h),Z.track("onboarding_snippet_copied",{type:g,step:"qa_try_it"}),g==="curl"?(a(!0),setTimeout(()=>a(!1),2e3)):(i(!0),setTimeout(()=>i(!1),2e3))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:3,total:3,label:"Step 3 of 3 · You're set up"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"You're set up"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Your request was logged and the response is cached for testing. You now have a working API endpoint!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(mo,{className:"h-3.5 w-3.5"})," cURL"]}),r.jsxs("button",{type:"button",onClick:()=>f(c,"curl"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[n?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),n?"Copied!":"Copy"]})]}),r.jsx(Go,{code:c,language:"bash"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(nm,{className:"h-3.5 w-3.5"})," Playwright"]}),r.jsxs("button",{type:"button",onClick:()=>f(u,"playwright"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[o?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),o?"Copied!":"Copy"]})]}),r.jsx(Go,{code:u,language:"javascript"})]})]}),r.jsxs("div",{className:"pt-4 border-t border-[var(--color-border-default)] space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:"What's next?"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(dt,{to:"/prompts",className:dn,onClick:t,children:["Write tests with AI ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]}),r.jsx(dt,{to:"/api-keys",className:im,onClick:t,children:"Manage API keys"}),r.jsx(dt,{to:`/logs${e.projectId?`?projectId=${e.projectId}`:""}`,className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:t,children:"View request logs â"})]})]})]})]})}const m_e=["A todo app with tasks, projects, and tags","A blog with posts, authors, and comments","An e-commerce store with products and orders","User CRUD endpoints for Playwright testing","Mock API with users and products for Postman"];function g_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}
691=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(!1),h=async()=>{if(!e.aiPrompt.trim()){c("Please describe what you want to build. Try one of the examples below."),f(!0),setTimeout(()=>f(!1),2e3);return}i(!0),c(null);try{const v=await Ue(a);if(!v)throw new Error("Please sign in");const y=await ue.post("/api/ai/generate-backend",{prompt:e.aiPrompt},{authToken:v});if(!y.data.success)throw new Error(y.data.message||"Generation failed");t({aiBlueprint:y.data.blueprint,aiGenerationsRemaining:y.data.generations_remaining}),s()}catch(v){let y="Failed to generate blueprint. Please try again.";v instanceof yt?y=v.message||y:v.message&&(y=v.message),c(y),(y.toLowerCase().includes("example")||y.toLowerCase().includes("detail"))&&(f(!0),setTimeout(()=>f(!1),2e3))}finally{i(!1)}},g=v=>{t({aiPrompt:v}),c(null),f(!1)};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:1,total:3,label:"Step 1 of 3 · Describe your backend"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"What do you need?"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Describe your app and we'll create the collections and sample data for you."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("textarea",{value:e.aiPrompt,onChange:v=>t({aiPrompt:v.target.value}),placeholder:"e.g., A task management app with projects, tasks, and team members...",className:"w-full h-32 px-4 py-3 rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none focus:border-purple-500/50 focus:bg-[var(--color-bg-card)] transition-colors resize-none",autoFocus:!0}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Try an example:"}),r.jsx("div",{className:`flex flex-wrap gap-2 ${u?"animate-pulse":""}`,children:m_e.map(v=>r.jsx("button",{type:"button",onClick:()=>g(v),className:`px-3 py-1.5 rounded-full text-xs bg-[var(--color-bg-alt)] border text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] hover:border-purple-500/30 transition-all ${u?"border-purple-500/50 ring-2 ring-purple-500/20":"border-[var(--color-border-default)]"}`,children:v},v))})]})]}),l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("button",{type:"button",onClick:h,disabled:o||!e.aiPrompt.trim(),className:`${dn} ${e.aiPrompt.trim()?"":"opacity-50"}`,children:o?r.jsxs(r.Fragment,{children:[r.jsx(on,{className:"h-4 w-4 animate-spin mr-2"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(rr,{className:"h-4 w-4 mr-2"}),"Generate backend"]}
691)}),e.aiGenerationsRemaining!==null&&r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:[e.aiGenerationsRemaining," AI generation",e.aiGenerationsRemaining!==1?"s":""," remaining this month"]})]})]})]})}function x_e({state:e,onUpdate:t,onNext:s,onBack:n}){const{getToken:a}=zt(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(new Set),[h,g]=x.useState(new Set),v=e.aiBlueprint;if(!v)return null;const y=v.collections.filter(T=>!u.has(T.name)),_=y.reduce((T,A)=>T+A.sample_records.length,0),j=T=>{f(A=>new Set([...A,T]))},w=T=>{f(A=>{const R=new Set(A);return R.delete(T),R})},k=T=>{g(A=>{const R=new Set(A);return R.has(T)?R.delete(T):R.add(T),R})},S=T=>T.map(R=>{const I=R.title||R.name||R.subject||R.label||R.email||R.task||R.item||Object.values(R)[0];return typeof I=="string"?I.length>25?I.slice(0,25)+"...":I:String(I)}).join(", "),E=async()=>{if(y.length===0){c("Please keep at least one collection");return}i(!0),c(null);try{const T=await Ue(a);if(!T)throw new Error("Please sign in");const A={removed_collections:Array.from(u)},R=await ue.post("/api/ai/create-from-blueprint",{blueprint:v,modifications:A},{authToken:T});if(!R.data.success)throw new Error(R.data.message||"Creation failed");t({aiCreationResult:{project:R.data.project,collections:R.data.collections,api_key:R.data.api_key,first_request:R.data.first_request},projectId:R.data.project.id,projectName:R.data.project.name,projectSlug:R.data.project.slug,projectApiKey:R.data.api_key}),s()}catch(T){const A=T instanceof yt?T.message:T.message||"Failed to create resources";c(A)}finally{i(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(cn,{className:"h-4 w-4"})," Back"]}),r.jsx(ll,{current:2,total:3,label:"Step 2 of 3 · Review your backend"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:v.project_name}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:v.project_description})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)] font-medium",children:["Collections (",y.length,")"]}),y.map(T=>{const A=h.has(T.name),R=S(T.sample_records);return r.jsxs("div",{className:`${fp} p-4 space-y-3`,children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-[var(--color-fg-default)]",children:T.name}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:T.description})]}),y.length>1&&r.jsx("button",{type:"button",onClick:()=>j(T.name),className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-semantic-danger)] transition",children:"Remove"})]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.fields.map(I=>r.jsxs("span",{className:"px-2 py-1 rounded text-xs bg-[var(--color-bg-alt)] text-[var(--color-fg-secondary)] font-mono",children:[I.name,r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:[": ",I.type]})]},I.name))}),T.sample_records.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("button",{type:"button",onClick:()=>k(T.name),className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(Kt,{className:`h-3 w-3 transition-transform ${A?"rotate-90":""}`}),r.jsxs("span",{children:[T.sample_records.length," sample record",T.sample_records.length!==1?"s":"",!A&&": "]}),!A&&r.jsx("span",{className:"text-[var(--color-fg-faint)] truncate max-w-[200px]",children:R})]}),A&&r.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.jsx(aa,{json:JSON.stringify(T.sample_records,null,2)})})]})]},T.name)}),u.size>0&&r.jsxs("div",{className:"pt-2 space-y-2",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Removed:"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from(u).map(T=>r.jsxs("button",{type:"button",onClick:()=>w(T),className:"px-2 py-1 rounded text-xs bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] line-through hover:no-underline transition",children:[T," (restore)"]},T))})]})]}),r.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-[var(--color-bg-alt)] border border-[var(--color-border-default)]",children:[r.jsx(Lu,{className:"h-4 w-4 text-[var(--color-fg-muted)] mt-0.5 shrink-0"}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Sample data will be created in your ",r.jsx("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:"development"})," environment. Production starts empty."]})]}),l&&r.jsxs("p",{className:"text-sm text-[var(--color-semantic-danger)] flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"})," ",l]}),r.jsxs("div",{className:"space-y-3 pt-2",children:[r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["This will create ",r.jsx("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:"1 project"}),","," ",r.jsxs("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:[y.length," collection",y.length!==1?"s":""]}),", and"," ",r.jsxs("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:[_," sample record",_!==1?"s":""]}),"."]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{type:"button",onClick:E,disabled:o||y.length===0,className:dn,children:o?r.jsxs(r.Fragment,{children:[r.jsx(on,{className:"h-4 w-4 animate-spin mr-2"}),"Creating..."]}):r.jsxs(r.Fragment,{children:["Create backend ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})}),r.jsx("button",{type:"button",onClick:n,className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Start over"})]})]})]})]})}function v_e({state:e,onComplete:t,onStartAgain:s}){const[n,a]=x.useState(!1),[o,i]=x.useState(!1),l=e.aiCreationResult;if(!l)return null;const c=l.api_key,u=l.first_request.url,f=j=>j.length<=20?j:`${j.slice(0,12)}...${j.slice(-6)}`,h=`curl -H 'x-api-key: ${f(c)}' '${u}'`,g=l.first_request.curl,v=`const response = await fetch("${u}", { 692 headers: { "x-api-key": "${f(c)}" } 693}); 694const data = await response.json();`,y=`const response = await fetch("${u}", { 695 headers: { "x-api-key": "${c}" } 696}); 697const data = await response.json(); 698console.log(data);`,_=(j,w)=>{navigator.clipboard.writeText(j),Z.track("onboarding_snippet_copied",{type:w,step:"app_users_try_it"}),w==="curl"?(a(!0),setTimeout(()=>a(!1),2e3)):(i(!0),setTimeout(()=>i(!1),2e3))};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ll,{current:3,total:3,label:"Step 3 of 3 · Your backend is live"}),r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-[var(--color-semantic-success)]/10 border border-[var(--color-semantic-success)]/30",children:[r.jsx(yd,{className:"h-5 w-5 text-[var(--color-semantic-success)] shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-[var(--color-fg-default)]",children:"Backend created successfully"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-muted)]",children:[l.collections.length," collection",l.collections.length!==1?"s":""," with sample data ready to use"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:`${fp} p-3`,children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Project"}),r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:l.project.name})]}),r.jsxs("div",{className:`${fp} p-3`,children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Environment"}),r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Development"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] font-medium",children:"Your collections"}),r.jsx("div",{className:"space-y-2",children:l.collections.map(j=>r.jsxs(dt,{to:`/data-explorer?projectId=${l.project.id}&collection=${j.slug}`,onClick:t,className:"flex items-center justify-between px-4 py-3 rounded-lg bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-elevated)] transition group",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)] group-hover:text-[var(--color-fg-interactive)]",children:j.name}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] font-mono truncate max-w-[280px]",children:j.endpoint})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[j.record_count.development," record",j.record_count.development!==1?"s":""]}),r.jsx(ja,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] opacity-0 group-hover:opacity-100 transition"})]})]},j.slug))})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:"Try it now"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"These examples use your development environment where your sample data lives."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(mo,{className:"h-3.5 w-3.5"})," cURL"]}),r.jsxs("button",{type:"button",onClick:()=>_(g,"curl"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[n?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),n?"Copied!":"Copy"]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsx(Go,{code:h,language:"bash"})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(nm,{className:"h-3.5 w-3.5"})," JavaScript"]}),r.jsxs("button",{type:"button",onClick:()=>_(y,"fetch"),className:"flex items-center gap-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:[o?r.jsx(ts,{className:"h-3 w-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3 w-3"}),o?"Copied!":"Copy"]})]}),r.jsx(Go,{code:v,language:"javascript"})]})]}),r.jsxs("div",{className:"pt-4 border-t border-[var(--color-border-default)] space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:"What's next?"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(dt,{to:`/data-explorer?projectId=${l.project.id}`,className:dn,onClick:t,children:["Browse your data ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]}),r.jsx("a",{href:"/documentation",rel:"noopener noreferrer",className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:t,children:"Read the docs â"})]}),r.jsx("button",{type:"button",onClick:s,className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Start again"})]}),r.jsx("div",{className:"pt-3 border-t border-[var(--color-border-default)]",children:r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Want to see a complete app built on ReqRes?"," ",r.jsx("a",{href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Waitlist Demo"})," · ",r.jsx("a",{href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Task Manager Demo"})]})})]})}function b_e({state:e,onNext:t,onBack:s,onStartFresh:n}){return r.jsxs("div",{className:`${fp} p-8 md:p-12 space-y-6`,children:[r.jsxs("button",{type:"button",onClick:s,className:`${im} text-xs`,children:[r.jsx(cn,{className:"h-3.5 w-3.5 mr-1"})," Back"]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1 text-xs font-semibold text-emerald-400",children:[r.jsx(yd,{className:"h-3.5 w-3.5"}),"Ready to go"]}),r.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-[var(--color-fg-default)]",children:"Your starter project is ready"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-lg",children:["We created ",r.jsx("strong",{className:"text-[var(--color-fg-default)]",children:e.projectName})," with a ",r.jsx("strong",{className:"text-[var(--color-fg-default)]",children:"Users"})," collection and sample data so you can start exploring right away."]})]}),r.jsx("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-3",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/15 border border-indigo-500/30 flex items-center justify-center",children:r.jsx(Dr,{className:"h-4 w-4 text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:e.projectName}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"1 collection · 3 records"})]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:t,className:`${dn} text-sm`,children:["See your data ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]}),r.jsx("button",{type:"button",onClick:n,className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition",children:"Start from scratch instead"})]})]})}
698function y_e({state:e,onNext:t,onBack:s}){const{getToken:n}=zt(),[a,o]=x.useState(null),[i,l]=x.useState(!0);return x.useEffect(()=>{let c=!1;return(async()=>{try{const u=await Ue(n);if(!u||c)return;const{data:f}=await ue.get(`/api/collections/products/records?project_id=${e.projectId}`,{authToken:u,headers:{"X-Reqres-Env":"prod"}});c||o((f==null?void 0:f.data)||[])}catch{c||o([])}finally{c||l(!1)}})(),()=>{c=!0}},[n,e.projectId]),r.jsxs("div",{className:`${fp} p-8 md:p-12 space-y-6`,children:[r.jsxs("button",{type:"button",onClick:s,className:`${im} text-xs`,children:[r.jsx(cn,{className:"h-3.5 w-3.5 mr-1"})," Back"]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-[var(--color-fg-default)]",children:"You already have a working API"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-lg",children:["Your ",r.jsx("strong",{className:"text-[var(--color-fg-default)]",children:"Products"})," collection has ",(a==null?void 0:a.length)||3," records. This data is yours - edit it, add to it, or replace it entirely."]})]}),r.jsx("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-hidden",children:i?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(on,{className:"h-5 w-5 animate-spin text-[var(--color-fg-muted)]"})}):r.jsx("div",{className:"divide-y divide-[var(--color-border-default)]",children:(a||[]).map((c,u)=>r.jsx("div",{className:"px-4 py-3 text-sm",children:r.jsx(aa,{json:JSON.stringify(c,null,2)})},u))})}),r.jsxs("button",{type:"button",onClick:t,className:`${dn} text-sm`,children:["Try it now ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]})}function __e({state:e,onNext:t,onBack:s}){const{getToken:n}=zt(),[a,o]=x.useState(null),[i,l]=x.useState(!1),[c,u]=x.useState(null),f=`curl -H "x-api-key: ${e.projectApiKey||"<your_api_key>"}" \\ 699 "${$s}/api/collections/products/records?project_id=${e.projectId}"`,h=`const res = await fetch( 700 "${$s}/api/collections/products/records?project_id=${e.projectId}", 701 { headers: { "x-api-key": "${e.projectApiKey||"<your_api_key>"}" } } 702); 703const data = await res.json();`,g=async()=>{l(!0);const y=performance.now();try{const _=await Ue(n);if(!_)return;const j=await fetch(`${$s}/api/collections/products/records?project_id=${e.projectId}`,{headers:{"x-api-key":e.projectApiKey||"","X-Reqres-Env":"prod",Authorization:`Bearer ${_}`}}),w=await j.json(),k=Math.round(performance.now()-y);o({status:j.status,data:w,latency:k}),Z.track("starter_project_first_request",{project_id:e.projectId,status:j.status,latency:k})}catch{o({status:0,data:{error:"Request failed"},latency:0})}finally{l(!1)}},v=async(y,_)=>{try{await navigator.clipboard.writeText(y),u(_),setTimeout(()=>u(null),2e3)}catch{}};return r.jsxs("div",{className:`${fp} p-8 md:p-12 space-y-6`,children:[r.jsxs("button",{type:"button",onClick:s,className:`${im} text-xs`,children:[r.jsx(cn,{className:"h-3.5 w-3.5 mr-1"})," Back"]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-[var(--color-fg-default)]",children:"Try it now"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-lg",children:"Copy this command into your terminal, or hit the button to fetch your data right here."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(mo,{className:"h-3.5 w-3.5"}),"cURL"]}),r.jsx("button",{type:"button",onClick:()=>v(f,"curl"),className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:c==="curl"?r.jsx(ts,{className:"h-3.5 w-3.5"}):r.jsx(is,{className:"h-3.5 w-3.5"})})]}),r.jsx(Go,{code:f,language:"bash",className:"text-xs rounded-none border-0"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(nm,{className:"h-3.5 w-3.5"}),"JavaScript"]}),r.jsx("button",{type:"button",onClick:()=>v(h,"fetch"),className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:c==="fetch"?r.jsx(ts,{className:"h-3.5 w-3.5"}):r.jsx(is,{className:"h-3.5 w-3.5"})})]}),r.jsx(Go,{code:h,language:"javascript",className:"text-xs rounded-none border-0"})]})]}),r.jsxs("button",{type:"button",onClick:g,disabled:i,className:`${dn} text-sm`,children:[i?r.jsx(on,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Dr,{className:"h-4 w-4 mr-1"}),"Fetch my data"]}),a&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsx("span",{className:`text-xs font-semibold ${a.status===200?"text-emerald-400":"text-red-400"}`,children:a.status}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[a.latency,"ms"]})]}),r.jsx("div",{className:"px-4 py-3 max-h-64 overflow-y-auto",children:r.jsx(aa,{json:JSON.stringify(a.data,null,2)})})]}),(a==null?void 0:a.status)===200&&r.jsxs("button",{type:"button",onClick:t,className:`${dn} text-sm`,children:["Make it yours ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]})}function j_e({state:e,onComplete:t,onBack:s}){return r.jsxs("div",{className:`${fp} p-8 md:p-12 space-y-6`,children:[r.jsxs("button",{type:"button",onClick:s,className:`${im} text-xs`,children:[r.jsx(cn,{className:"h-3.5 w-3.5 mr-1"})," Back"]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1 text-xs font-semibold text-emerald-400",children:[r.jsx(yd,{className:"h-3.5 w-3.5"}),"Youâre set up"]}),r.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-[var(--color-fg-default)]",children:"Make it yours"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-lg",children:"Your starter project is a real backend - edit the sample data, add new collections, or describe what you need and let AI generate it."})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsxs(dt,{to:`/data-explorer?projectId=${e.projectId}`,onClick:()=>{Z.track("starter_project_customised",{action:"browse_data",project_id:e.projectId}),t()},className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)] transition text-left",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Browse your data"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Edit records, add fields, manage collections"}),r.jsxs("p",{className:"text-xs font-medium text-indigo-400 mt-2 group-hover:text-indigo-300",children:["Open data explorer ",r.jsx(Kt,{className:"h-3 w-3 inline ml-0.5"})]})]}),r.jsxs(dt,{to:"/documentation",onClick:()=>{Z.track("starter_project_customised",{action:"view_docs",project_id:e.projectId}),t()},className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)] transition text-left",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Read the docs"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Collections, auth, environments, and more"}),r.jsxs("p",{className:"text-xs font-medium text-indigo-400 mt-2 group-hover:text-indigo-300",children:["View documentation ",r.jsx(ja,{className:"h-3 w-3 inline ml-0.5"})]})]})]}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("starter_project_customised",{action:"go_to_dashboard",project_id:e.projectId}),t()},className:`${dn} text-sm`,children:["Go to Dashboard ",r.jsx(Kt,{className:"h-4 w-4 ml-1"})]})]})}function w_e({onComplete:e,onSkip:t,initialPath:s,initialPrompt:n,starterProject:a}){const[o,i]=x.useState(()=>{const k=r_e();return s==="explore"&&a?{...k,path:"explore",exploreStep:1,projectId:a.id,projectName:a.name,projectSlug:a.slug,projectApiKey:a.api_key||null}:s?{...k,path:s,...n?{aiPrompt:n}:{}}:k}),[l,c]=x.useState("right"),u=x.useRef(null);x.useEffect(()=>{n_e(o)}
703,[o]);const f=x.useCallback(k=>{i(S=>({...S,...k}))},[]),h=()=>{Z.track("wizard_skipped",{path:o.path||"none"}),o_e(),kD(),t()},g=()=>{kD(),e()},v=()=>{setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},100)},y=k=>{c("right"),f({path:k}),v()},_=k=>{if(c("left"),o.path==="builder")if(o.builderStep===1){h();return}else f({builderStep:o.builderStep-1});else if(o.path==="tester")if(o.testerStep===1){h();return}else f({testerStep:o.testerStep-1});else if(o.path==="ai")if(o.aiStep===1){h();return}else f({aiStep:1,aiBlueprint:null});else if(o.path==="explore")if(o.exploreStep===1){h();return}else f({exploreStep:o.exploreStep-1});v()},j=()=>{c("right"),o.path==="builder"?f({builderStep:o.builderStep+1}):o.path==="tester"?f({testerStep:o.testerStep+1}):o.path==="ai"?f({aiStep:o.aiStep+1}):o.path==="explore"&&f({exploreStep:o.exploreStep+1}),v()},w=()=>{if(!o.path)return r.jsx(i_e,{onSelect:y,onSkip:h});if(o.path==="builder")switch(o.builderStep){case 1:return r.jsx(l_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 2:return r.jsx(c_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 3:return r.jsx(d_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 4:return r.jsx(u_e,{state:o,onComplete:g,onBack:()=>_()})}if(o.path==="tester")switch(o.testerStep){case 1:return r.jsx(p_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 2:return r.jsx(f_e,{state:o,onNext:j,onBack:()=>_()});case 3:return r.jsx(h_e,{state:o,onComplete:g,onBack:()=>_()})}if(o.path==="ai")switch(o.aiStep){case 1:return r.jsx(g_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 2:return r.jsx(x_e,{state:o,onUpdate:f,onNext:j,onBack:()=>_()});case 3:return r.jsx(v_e,{state:o,onComplete:g,onStartAgain:()=>{c("left"),f({aiStep:1,aiPrompt:"",aiBlueprint:null,aiCreationResult:null}),v()}})}if(o.path==="explore"){const k={state:o,onUpdate:f,onNext:j,onBack:()=>_(),onComplete:g,onStartFresh:()=>{Z.track("starter_project_deleted",{project_id:o.projectId}),f({path:"builder",builderStep:1,projectId:null,projectName:"My app",projectSlug:"",projectApiKey:null}),v()}};switch(o.exploreStep){case 1:return r.jsx(b_e,{...k});case 2:return r.jsx(y_e,{...k});case 3:return r.jsx(__e,{...k});case 4:return r.jsx(j_e,{...k})}}return null};return r.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-10",children:[r.jsx("div",{ref:u,className:`transition-all duration-300 ease-out ${l==="right"?"animate-slide-in-right":"animate-slide-in-left"}`,children:w()},`${o.path}-${o.builderStep}-${o.testerStep}-${o.aiStep}`),r.jsx("style",{children:` 704 @keyframes slide-in-right { 705 from { 706 opacity: 0; 707 transform: translateX(20px); 708 } 709 to { 710 opacity: 1; 711 transform: translateX(0); 712 } 713 } 714 @keyframes slide-in-left { 715 from { 716 opacity: 0; 717 transform: translateX(-20px); 718 } 719 to { 720 opacity: 1; 721 transform: translateX(0); 722 } 723 } 724 .animate-slide-in-right { 725 animation: slide-in-right 0.3s ease-out; 726 } 727 .animate-slide-in-left { 728 animation: slide-in-left 0.3s ease-out; 729 } 730 `})]})}function N_e(e,t,s){return a_e()?!1:!!(!e||s)}function Mn(e){x.useEffect(()=>{document.title=e?`${e} - ReqRes`:"ReqRes"},[e])}const qS=5,Pa="relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40",Il=`${Pa} p-5 md:p-6 h-full flex flex-col`,zS="rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] px-4 py-3 flex items-start justify-between gap-3",_f="text-[12px] uppercase tracking-[0.2em] font-semibold text-[var(--color-fg-muted)]",js="#d4d4c8",ws=.75;function $g({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 135",className:e,fill:"none",children:[r.jsx("polygon",{points:"120,0 185,20 120,40 55,20",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"120,45 185,65 120,85 55,65",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"120,90 185,110 120,130 55,110",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"55",y1:"20",x2:"55",y2:"110",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"120",y1:"40",x2:"120",y2:"130",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"185",y1:"20",x2:"185",y2:"110",stroke:js,strokeWidth:ws})]})}function d0({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 100",className:e,fill:"none",children:[r.jsx("polygon",{points:"75,5 101,20 101,50 75,65 49,50 49,20",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"49",y1:"20",x2:"75",y2:"35",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"101",y1:"20",x2:"75",y2:"35",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"75",y1:"35",x2:"75",y2:"65",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"165,20 191,35 191,65 165,80 139,65 139,35",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"139",y1:"35",x2:"165",y2:"50",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"191",y1:"35",x2:"165",y2:"50",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"165",y1:"50",x2:"165",y2:"80",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"101",y1:"35",x2:"139",y2:"35",stroke:js,strokeWidth:ws,strokeDasharray:"4 3"})]})}function u0({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 120",className:e,fill:"none",children:[r.jsx("polygon",{points:"65,20 160,10 160,90 65,100",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"65,20 160,10 175,17 80,27",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"160,10 175,17 175,97 160,90",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"80",y1:"42",x2:"145",y2:"37",stroke:js,strokeWidth:ws,opacity:"0.5"}),r.jsx("line",{x1:"80",y1:"55",x2:"135",y2:"50",stroke:js,strokeWidth:ws,opacity:"0.5"}),r.jsx("line",{x1:"80",y1:"68",x2:"120",y2:"64",stroke:js,strokeWidth:ws,opacity:"0.5"})]})}function HS({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 120",className:e,fill:"none",children:[r.jsx("polygon",{points:"50,100 70,90 70,55 50,65",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"50,65 70,55 90,65 70,75",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"90,100 110,90 110,30 90,40",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"90,40 110,30 130,40 110,50",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"130,100 150,90 150,50 130,60",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"130,60 150,50 170,60 150,70",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"170,100 190,90 190,20 170,30",stroke:js,strokeWidth:ws}),r.jsx("polygon",{points:"170,30 190,20 210,30 190,40",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"30",y1:"110",x2:"220",y2:"70",stroke:js,strokeWidth:ws,opacity:"0.4"})]})}function VS({className:e}){return r.jsxs("svg",{viewBox:"0 0 240 120",className:e,fill:"none",children:[r.jsx("circle",{cx:"60",cy:"40",r:"8",stroke:js,strokeWidth:ws}),r.jsx("circle",{cx:"120",cy:"20",r:"8",stroke:js,strokeWidth:ws}),r.jsx("circle",{cx:"180",cy:"50",r:"8",stroke:js,strokeWidth:ws}),r.jsx("circle",{cx:"90",cy:"90",r:"8",stroke:js,strokeWidth:ws}),r.jsx("circle",{cx:"150",cy:"95",r:"8",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"68",y1:"38",x2:"112",y2:"22",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"128",y1:"22",x2:"172",y2:"48",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"65",y1:"48",x2:"85",y2:"82",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"98",y1:"90",x2:"142",y2:"95",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"155",y1:"87",x2:"175",y2:"58",stroke:js,strokeWidth:ws}),r.jsx("line",{x1:"95",y1:"83",x2:"115",y2:"27",stroke:js,strokeWidth:ws,strokeDasharray:"4 3"})]})}const GS="text-sm text-[var(--color-fg-secondary)]",yu=Jt.primaryEmphasis,Ug=Jt.secondaryEmphasis,k_e=od.ctaDark,SD="rr_traffic_card_dismissed_v1",CD="rr_welcome_dev_dismissed",ED="rr_welcome_back_dismissed",TD="rr_baas_nudge_dism
730issed",RD="rr_write_nudge_dismissed",AD=3*24*60*60*1e3,PD=7*24*60*60*1e3,S_e=["A todo app with user auth","An e-commerce API with products and orders","A blog backend with posts and comments"],jf=e=>{if(!e)return"-";const t=new Date(e).getTime(),s=Date.now(),n=Math.max(0,s-t),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`},C_e=e=>`curl -H "x-api-key: ${e}" https://reqres.in/api/users?page=2`,E_e=e=>`curl -H "x-api-key: ${e}" https://reqres.in/api/collections`,T_e=e=>`curl -X POST \\ 731 -H "content-type: application/json" \\ 732 -H "x-api-key: ${e}" \\ 733 -d '{ "email": "[email protected]" }' \\ 734 https://reqres.in/api/app-users/login`,R_e=(e,t)=>{const s=e.path||"",n=e.status,a=s.startsWith("/app/"),o=s.startsWith("/api/");return n===401&&a?{title:"Missing Bearer token",hint:"/app/* endpoints require an app-user session token, not x-api-key.",steps:["Create an app user via /api/app-users","Login via /api/app-users/login to get a session token","Include Authorization: Bearer <token> header"],exampleCurl:`curl -X GET \\ 735 -H "Authorization: Bearer <session_token>" \\ 736 -H "X-Reqres-Env: prod" \\ 737 https://reqres.in${s}`,docsUrl:"https://app.reqres.in/docs#app-user-auth",ctaLabel:"Manage App Users",ctaHref:"/app-users"}:n===401&&o?{title:"Missing or invalid API key",hint:"/api/* endpoints require x-api-key header.",steps:["Get your API key from the API Keys page","Include x-api-key: <your_key> header"],exampleCurl:t?`curl -X GET \\ 738 -H "x-api-key: ${t}" \\ 739 https://reqres.in${s}`:`curl -X GET \\ 740 -H "x-api-key: <your_api_key>" \\ 741 https://reqres.in${s}`,docsUrl:"https://app.reqres.in/docs#api-keys",ctaLabel:"Get API Key",ctaHref:"/api-keys"}:n===400&&(s.includes("/collections")||s.includes("/records"))?{title:"Missing environment header",hint:"Collection endpoints require the X-Reqres-Env header to specify prod or dev.",steps:["Add X-Reqres-Env: prod (or dev) header to your request","This separates production and development data"],exampleCurl:a?`curl -X GET \\ 742 -H "Authorization: Bearer <session_token>" \\ 743 -H "X-Reqres-Env: prod" \\ 744 https://reqres.in${s}`:`curl -X GET \\ 745 -H "x-api-key: ${t||"<your_api_key>"}" \\ 746 -H "X-Reqres-Env: prod" \\ 747 https://reqres.in${s}`,docsUrl:"https://app.reqres.in/docs#environments"}:n===404&&a?{title:"Invalid endpoint",hint:"This /app/* path does not exist. Common endpoints are /app/collections and /app/me.",steps:["Use /app/collections/:slug/records for app-user data access","Use /app/me to get current user info","Check the docs for available endpoints"],docsUrl:"https://app.reqres.in/docs#app-endpoints"}:n===403?{title:"Insufficient permissions",hint:"Your API key or session token does not have permission for this operation.",steps:["Check that your API key has the required scope (read_only vs read_write)","For app-user endpoints, ensure the user has access to this resource"],docsUrl:"https://app.reqres.in/docs#permissions",ctaLabel:"Check API Keys",ctaHref:"/api-keys"}:n===429?{title:"Rate limited",hint:"You have exceeded the request rate limit. Wait before retrying.",steps:["Implement exponential backoff in your client","Consider upgrading for higher limits"],docsUrl:"https://app.reqres.in/docs#rate-limits",ctaLabel:"View Plan Limits",ctaHref:"/billing"}:null};function A_e(){var vb,bb,Cm,yb,_b,jb;Mn("Dashboard");const{getToken:e}=zt(),t=un(),s=Jz(),{status:n}=_w(),a=KT(n),[o,i]=x.useState([]),[l,c]=x.useState("idle"),u=x.useCallback(async()=>{c("working"),Z.track("starter_reseed_clicked",{});try{const Je=await Ue(e);if(!Je)throw new Error("no auth");await ue.post("/projects/seed-starter",{},{authToken:Je}),window.location.reload()}catch(Je){if(Je instanceof yt&&Je.status===409){window.location.reload();return}c("error")}},[e]),[f,h]=x.useState([]),[g,v]=x.useState([]),[y,_]=x.useState(null),[j,w]=x.useState([]),[k,S]=x.useState([]),[E,T]=x.useState(null),[A,R]=x.useState(!0),[I,L]=x.useState(null),[M,O]=x.useState(null),[z,X]=x.useState(null),[W,K]=x.useState("idle"),[q,J]=x.useState(null),[F,V]=x.useState(!1),[$,B]=x.useState(null),[ae,H]=x.useState(()=>{try{return localStorage.getItem("rr_wizard_completed")==="true"}catch{return!1}}
747),[U,oe]=x.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(SD)==="true"),[fe,Q]=x.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(CD)==="true"),[le,Se]=x.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(ED)==="true"),[we,Le]=x.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(TD)==="true"),[xe,de]=x.useState(()=>{if(typeof window>"u")return!1;const Je=window.localStorage.getItem(RD);return Je?Date.now()-parseInt(Je,10)<PD:!1}),[Me,je]=x.useState(0),[Ae,Oe]=x.useState(null),[Ke,ut]=x.useState(null),[De]=x.useState(()=>{try{const Je=parseInt(localStorage.getItem("rr_dashboard_visits")||"0",10);return localStorage.setItem("rr_dashboard_visits",String(Je+1)),Je===0}catch{return!0}}),[ct,rt]=x.useState("idle"),[mt,vt]=x.useState(null),[gt,Be]=x.useState(null),[ve,be]=x.useState("curl"),[nt,Ze]=x.useState(null),[he,ke]=x.useState(null),[Ve,at]=x.useState(!1),[Pt,Ct]=x.useState({}),[St,Xt]=x.useState(null),[It,ee]=x.useState({name:"Your Product",price:9.99,category:"New",in_stock:!0}),[We,wt]=x.useState(null),[_t,Ee]=x.useState(null),He=x.useRef(!1),ie=x.useRef(!1),Ce=x.useRef(!1),Ye=x.useRef(null),{user:Pe}=_r(),{isPaid:Ge}=Pw(),Nt=x.useCallback(()=>{oe(!0),window.localStorage.setItem(SD,"true")},[]),Tt=x.useCallback(()=>{Q(!0),window.localStorage.setItem(CD,"true"),Z.track("welcome_dev_dismissed")},[]),ss=x.useCallback(()=>{Se(!0),window.localStorage.setItem(ED,"true")},[]),Zt=x.useCallback(()=>{Le(!0),window.localStorage.setItem(TD,"true"),Z.track("baas_nudge_dismissed")},[]),re=x.useCallback(()=>{de(!0),window.localStorage.setItem(RD,String(Date.now())),Z.track("write_nudge_dismissed")},[]),G=o[0],{stats:ge}=Aw({projectId:(G==null?void 0:G.id)??null,enabled:!!G}),ze=x.useMemo(()=>yw({hasProject:!!G,collectionCount:y,totalDataItems:E,appUsers:g,projectLogs:k,logs:f}),[G,y,E,g,k,f]),Gt=!ze.collectionDataFetched||!ze.appUserLoggedIn||!ze.hasCollection,es=x.useCallback(async(Je,ft)=>{const Dt=[];for(const Ys of Je){if(Dt.length>=qS)break;try{const er=qS-Dt.length,ul=((await ue.get(`/api/app-users?project_id=${Ys.id}&limit=${er}`,{authToken:ft})).data.data||[]).map(pa=>({...pa,projectId:Ys.id,projectName:Ys.name}))||[];Dt.push(...ul)}catch(er){console.warn("App users fetch failed for project",Ys.id,er)}}if(Dt.length===0){v([]);return}const ms=[...Dt].sort((Ys,er)=>{const yo=new Date(Ys.last_login_at||Ys.created_at||0).getTime();return new Date(er.last_login_at||er.created_at||0).getTime()-yo});v(ms.slice(0,qS))},[]),ls=x.useCallback(async()=>{var Je,ft,Dt,ms,Ys;try{R(!0),L(null);const er=await Ue(e);if(!er){L("Please sign in to view your dashboard.");return}const[yo,ul]=await Promise.all([ue.get("/projects?limit=5",{authToken:er}),ue.get("/logs?limit=20",{authToken:er})]),pa=yo.data.projects||[];i(pa),h(ul.data.data||[]);const pl=((Je=pa.find(Ks=>Ks.public_api_key))==null?void 0:Je.public_api_key)||null;pl&&X(Ks=>Ks||pl);try{const Ks=await ue.get("/api-keys",{authToken:er}),Js=Array.isArray(Ks.data)?Ks.data:(ft=Ks.data)==null?void 0:ft.data;if(Array.isArray(Js)){O(Js.length);const Ja=((Dt=Js.find(fa=>(fa==null?void 0:fa.permissions)==="read_only"&&(fa==null?void 0:fa.api_key)))==null?void 0:Dt.api_key)||null;Ja&&!pl&&X(fa=>fa||Ja)}else O(0)}catch(Ks){console.warn("API key fetch failed",Ks)}try{const Js=(Ys=(ms=(await ue.get("/api-keys/stats",{authToken:er})).data)==null?void 0:ms.stats)==null?void 0:Ys.writePercent7d;typeof Js=="number"&&je(Js)}catch(Ks){console.warn("API key stats fetch failed",Ks)}if(pa.length>0){try{const Ks=await Promise.all(pa.map(async ar=>{var Ei,vc,Em,Tm;try{const[Bp,wb,bc]=await Promise.all([ue.get(`/data-explorer/collections?project_id=${ar.id}`,{authToken:er}),ue.get(`/logs?project_id=${ar.id}&limit=20`,{authToken:er}),ue.get(`/data-explorer/stats?project_id=${ar.id}`,{authToken:er})]),Nb=((Ei=Bp.data)==null?void 0:Ei.data)||[];return{projectId:ar.id,collectionCount:Nb.length??0,collectionSlugs:Nb.map(_1=>
747_1.slug).filter(Boolean),logs:((vc=wb.data)==null?void 0:vc.data)||[],totalDataItems:((Tm=(Em=bc.data)==null?void 0:Em.stats)==null?void 0:Tm.totalDataItems)??null}}catch(Bp){return console.warn("Progress fetch failed for project",ar.id,Bp),{projectId:ar.id,collectionCount:0,collectionSlugs:[],logs:[],totalDataItems:null}}})),Js=Ks.reduce((ar,Ei)=>ar+(Ei.collectionCount??0),0),Ja=Ks.flatMap(ar=>ar.logs),fa=Ks.some(ar=>ar.totalDataItems!==null&&ar.totalDataItems!==void 0),Tr=Ks.reduce((ar,Ei)=>{const vc=Ei.totalDataItems;return ar+(typeof vc=="number"?vc:0)},0),fn=Ks.flatMap(ar=>ar.collectionSlugs);_(Js),w(fn),S(Ja),T(fa?Tr:null)}catch(Ks){console.warn("Progress fetch failed",Ks),_(0),w([]),S([]),T(null)}await es(pa,er)}else v([]),_(0),w([]),S([]),T(null)}catch(er){console.error("Failed to load dashboard",er),er instanceof yt?L(er.message):L("Could not load dashboard data.")}finally{R(!1)}},[es,e]);x.useEffect(()=>{ls()},[ls]);const pr=x.useRef(!1);x.useEffect(()=>{if(A||pr.current||o.length>0||(Pe!=null&&Pe.createdAt?Date.now()-new Date(Pe.createdAt).getTime():1/0)>3e4)return;pr.current=!0;const ft=window.setTimeout(()=>{ls()},3e3);return()=>window.clearTimeout(ft)},[A,o.length,Pe==null?void 0:Pe.createdAt,ls]),x.useEffect(()=>{if(!Ge)return;let Je=!1;return(async()=>{var Dt;try{const ms=await Ue(e);if(!ms||Je)return;const Ys=await Td.getPaymentStatus({authToken:ms});Je||ut(((Dt=Ys.data)==null?void 0:Dt.currentPeriodStart)||null)}catch{}})(),()=>{Je=!0}},[Ge,e]);const et=o.find(Je=>{var ft;return(ft=Je.config)==null?void 0:ft.is_starter}),ye=!!((vb=et==null?void 0:et.config)!=null&&vb.seeded_version&&et.config.seeded_version>=2),Qe=j[0]||"products";x.useEffect(()=>{if(A)return;const Je=o.length>0,ft=(M||0)>0;N_e(Je,ft,ye)&&!ae&&(V(!0),ye&&et&&B("explore"))},[A,o.length,M,ae,ye,et]);const ne=x.useMemo(()=>[...k,...f],[k,f]),P=x.useMemo(()=>[...ne].sort((Je,ft)=>new Date(ft.created_at||"").getTime()-new Date(Je.created_at||"").getTime()),[ne]),te=(y||0)>0,me=E!=null?E>0:void 0,Te=P.length>0,st=o.some(Je=>Je.public_api_key||Je.api_key),xt=st||typeof M=="number"&&M>0,Et=G?`/logs?projectId=${G.id}`:"/logs",rs=!!G&&st,{firstRequest:Rt,loading:xs}=gve({projectId:(G==null?void 0:G.id)??null,enabled:xt,initialLog:P[0]??null,useApiKeySignal:xt,useAppUserSignal:rs}),jt=!!Rt,qs=x.useMemo(()=>o.length===0?"no_projects":jt?"active":"no_requests",[o.length,jt]),Xr=x.useRef(!1);x.useEffect(()=>{!A&&xt&&!jt&&!Xr.current&&(Xr.current=!0,Z.ahaWaitingShown({project_id:(G==null?void 0:G.id)??null,has_api_key:xt,persona_track:a}))},[A,xt,jt,G==null?void 0:G.id,a]);const pn=Je=>`rr_first_request_celebrated_${Je??"global"}`,Gn=x.useRef(!1),Zs=x.useRef(null);x.useEffect(()=>{if(typeof window>"u")return;const Je=pn(G==null?void 0:G.id);window.localStorage.getItem(Je)==="true"&&(Gn.current=!0)},[G==null?void 0:G.id]),x.useEffect(()=>{!A&&xt&&!jt&&Zs.current===null&&(Zs.current=Date.now())},[A,xt,jt]),x.useEffect(()=>{var Je,ft;if(jt&&!Gn.current){Gn.current=!0;try{window.localStorage.setItem(pn(G==null?void 0:G.id),"true")}catch{}if(G!=null&&G.created_at&&Date.now()-new Date(G.created_at).getTime()>60*60*1e3)return;const Dt=Zs.current?Math.round((Date.now()-Zs.current)/1e3):0,ms=(Je=Rt==null?void 0:Rt.path)!=null&&Je.startsWith("/app/")?"app":(ft=Rt==null?void 0:Rt.path)!=null&&ft.includes("/collections")||Rt!=null&&Rt.project_id?"project":"classic";if(Z.ahaRequestSeen({project_id:(G==null?void 0:G.id)??null,status:(Rt==null?void 0:Rt.status)??200,method:(Rt==null?void 0:Rt.method)||"GET",path_type:ms,time_seconds:Dt}),it.success("First request received! Your backend is live.",{description:"Check out your logs to see the full request details.",duration:5e3}),Z.activationMilestone({milestone:"first_request",project_id:G==null?void 0:G.id}),G!=null&&G.created_at){const Ys=new Date(G.created_at).getTime(),er=Date.now();Number.isFinite(Ys)&&Z.timeToFirstRequest({project_id:G.id,duration_ms:er-Ys,source:"dashboard"})}}},[jt,G==null?void 0:G.id,G==null?void 0:G.created_at,Rt]);const Cr=x.useMemo(()=>ye?{body:"Copy the curl command above and run it - we'll confirm it landed and show you the exact log.",hint:""}:a==="educator"?{body:st?"Make one request from class - we'll show the response path and the log so students can debug.":"Make one request from class - we'll confirm it landed and keep the endpoint handy.",hint:"Tip: use the classic /api/users endpoint first."}:a==="frontend"?{body:st?"Call your project from the browser once - we'll confirm it landed and show you the exact log.":"Send a classic request now, or create a project to unlock logs.",hint:"Tip: app-user reads/writes use Authorization: Bearer <session_token>."}:{body:st?"Run your Postman/Bruno/Playwright test once - we'll show it here and link you to the log.":"Run your Postman/Bruno/Playwright test once - we'll confirm it landed and show it here.",hint:""},[st,a,ye]),Wn=z||"<your_api_key>",Hd=(G==null?void 0:G.public_api_key)||z||"<project_public_key>",gm=st?a==="frontend"?T_e(Hd):E_e(Hd):C_e(Wn),dl=Rt?jf(Rt.created_at):"-",On=x.useMemo(()=>{const Je=G?`?projectId=${G.id}`:"",ft=g.length>0;return G?te?me?ft?{label:"Upgrade for production",description:"Get higher limits, longer log retention, and priority support.",href:"/upgrade?source=journey_complete",upgradeNudge:!0}:{label:"Add user authentication",description:"Invite an app user to enable login and per-user data.",href:`/app-users${Je}`,upgradeNudge:!1}:{label:"Add your first record",description:"Use the Project Console to create a record and try every endpoint.",href:`/console${G?`?project_id=${G.id}`:""}`,upgradeNudge:!1}:{label:"Define your data model",description:"Create a collection to store and query your app data.",href:`/data-explorer${Je}&tab=collections`,upgradeNudge:!1}:{label:"Create a project",description:"Scope your API keys, data, and users to a project.",href:"/projects",upgradeNudge:!1}},[G,te,me,g.length]),Qo=Rt!=null&&Rt.created_at?Date.now()-new Date(Rt.created_at).getTime():null,Vd=Qo!==null&&Qo<24*60*60*1e3,Ca=Qo!==null&&Qo>14*24*60*60*1e3,xm=jt?Vd?"ReqRes is receiving traffic":"Your backend has received traffic":ye?`Listening for requests to ${et.name}â¦`:"Waiting for your first request",ub=(ge==null?void 0:ge.tier)==="free"?"Upgrade for more requests":"View plan limits",vm=(ge==null?void 0:ge.tier)==="free"?"/upgrade?source=limit_warning":"/billing",Ka=async(Je,ft,Dt=!1)=>{try{await navigator.clipboard.writeText(Je),it.success(ft),Dt&&Z.ahaCopyCurlClicked({project_id:(G==null?void 0:G.id)??null,has_first_request:jt})}catch(ms){console.warn("Copy failed",ms),it.error("Could not copy the request.")}},pb=o.some(Je=>{var ft;return!((ft=Je.config)!=null&&ft.is_starter)}),wi=ye?te&&pb:te,Ea=x.useMemo(()=>wi?"operating":ye?"starter":o.length===0?"empty":"building",[wi,ye,o.length]),fb=x.useRef(!1);x.useEffect(()=>{A||fb.current||(fb.current=!0,Z.track("dashboard_stage_viewed",{stage:Ea,is_v2_starter:ye,has_collections:te,has_records:me,first_request_found:jt,project_count:o.length,is_paid:Ge}))},[A,Ea,ye,te,me,jt,o.length,Ge]),x.useEffect(()=>{if(!(A||!Ea))try{const Je=localStorage.getItem("rr_dashboard_stage");if(Je&&Je!==Ea){const Dt=localStorage.getItem("rr_dashboard_stage_entered"),ms=Dt?Math.round((Date.now()-Number(Dt))/(1e3*60*60*24)):void 0;Z.track("dashboard_stage_changed",{from_stage:Je,to_stage:Ea,days_in_previous_stage:ms}),localStorage.setItem("rr_dashboard_stage_entered",String(Date.now()))}localStorage.setItem("rr_dashboard_stage",Ea),localStorage.getItem("rr_dashboard_stage_entered")||localStorage.setItem("rr_dashboard_stage_entered",String(Date.now()))}catch{}},[A,Ea]),x.useEffect(()=>{A||!ye||wi||ie.current||(ie.current=!0,Z.track("starter_hero_viewed",{project_id:et==null?void 0:et.id,project_name:et==null?void 0:et.name}))},[A,ye,wi,et==null?void 0:et.id,et==null?void 0:et.name]),x.useEffect(()=>{ct==="success"&&!Ye.current&&(Ye.current=Date.now())},[ct]);const Yn=x.useCallback(Je=>{if(ct!=="success"||Ce.current)return;Ce.current=!0;
747const ft=Ye.current?Math.round((Date.now()-Ye.current)/1e3):void 0;Z.track("starter_hero_next_action",{action:Je,project_id:et==null?void 0:et.id,seconds_since_fetch:ft})},[ct,et==null?void 0:et.id]),hb=x.useCallback(async()=>{if(!z){J("Add a Public or read-only API key first.");return}K("loading"),J(null);try{const Je=await fetch("https://reqres.in/api/users?page=2",{headers:{"Content-Type":"application/json","x-api-key":z}}),ft=await Je.text();let Dt=null;try{Dt=ft?JSON.parse(ft):null}catch{Dt=ft||null}if(!Je.ok){const ms=(Dt==null?void 0:Dt.error)||(Dt==null?void 0:Dt.message)||`Request failed with status ${Je.status}`;throw new Error(ms)}it.success("Request sent - check Logs"),K("success");try{await ls()}catch(ms){console.warn("Log refresh after test request failed",ms)}}catch(Je){const ft=(Je==null?void 0:Je.message)||(Je instanceof Error?Je.message:"Request failed unexpectedly");let Dt=ft;(ft.toLowerCase().includes("401")||ft.toLowerCase().includes("403"))&&(Dt=`${ft} - ensure your Public or read-only key is set.`),ft.includes("429")&&(Dt="Rate limited - try again in a few seconds."),J(Dt),K("error")}},[z,ls]),bm=x.useCallback(async()=>{var ft;if(!et||ct==="loading")return;const Je=z||et.api_key;if(!Je){Be("API key not available yet. Try refreshing."),rt("error");return}rt("loading"),Be(null),Z.track("starter_fetch_clicked",{project_id:et.id});try{const Dt=await fetch(`${$s}/api/collections/${Qe}/records?project_id=${et.id}`,{headers:{"x-api-key":Je,"X-Reqres-Env":"prod","Content-Type":"application/json"}}),ms=await Dt.json();if(!Dt.ok)throw new Error((ms==null?void 0:ms.error)||`Request failed (${Dt.status})`);vt(ms),rt("success"),Z.track("starter_fetch_succeeded",{project_id:et.id,record_count:((ft=ms==null?void 0:ms.data)==null?void 0:ft.length)??0}),ls()}catch(Dt){Be((Dt==null?void 0:Dt.message)||"Request failed"),rt("error")}},[et,z,ct,ls]),x1=x.useCallback(async(Je,ft)=>{try{await navigator.clipboard.writeText(Je),Ze(ft),setTimeout(()=>Ze(null),2e3),Z.track("starter_code_copied",{snippet_type:ft,project_id:(et==null?void 0:et.id)??null}),Yn(ft==="curl"?"copied_curl":"copied_js")}catch{it.error("Could not copy to clipboard.")}},[et==null?void 0:et.id,Yn]),xc=x.useCallback(async()=>{if(!et)return;const Je=z||et.api_key;if(Je)try{const ft=await fetch(`${$s}/api/collections/${Qe}/records?project_id=${et.id}`,{headers:{"x-api-key":Je,"X-Reqres-Env":"prod","Content-Type":"application/json"}}),Dt=await ft.json();ft.ok&&vt(Dt)}catch{}},[et,z,Qe]),Mp=x.useCallback(async()=>{if(!et||!St||Ve)return;const Je=et.api_key;if(!Je){it.error("No manage key found for this project");return}at(!0);try{const ft=await fetch(`${$s}/api/collections/${Qe}/records/${St}?project_id=${et.id}`,{method:"PUT",headers:{"x-api-key":Je,"X-Reqres-Env":"prod","Content-Type":"application/json"},body:JSON.stringify({data:Pt})});if(!ft.ok){const Dt=await ft.json().catch(()=>({}));throw new Error((Dt==null?void 0:Dt.message)||"Update failed")}await xc(),Ee(St),setTimeout(()=>Ee(null),2e3),ke(null),Xt(null),Z.track("starter_record_edited",{project_id:et.id,collection_name:Qe}),Yn("edited_record")}catch(ft){it.error((ft==null?void 0:ft.message)||"Failed to update record")}finally{at(!1)}},[et,Qe,St,Pt,Ve,xc,Yn]),ym=x.useCallback(async()=>{if(!et||Ve)return;const Je=et.api_key;if(!Je){it.error("No manage key found for this project");return}at(!0);try{const ft=await fetch(`${$s}/api/collections/${Qe}/records?project_id=${et.id}`,{method:"POST",headers:{"x-api-key":Je,"X-Reqres-Env":"prod","Content-Type":"application/json"},body:JSON.stringify({data:It})});if(!ft.ok){const Ys=await ft.json().catch(()=>({}));throw new Error((Ys==null?void 0:Ys.message)||"Create failed")}const Dt=await ft.json();await xc(),Ee((Dt==null?void 0:Dt.id)||null),setTimeout(()=>Ee(null),2e3),ke(null),ee({name:"Your Product",price:9.99,category:"New",in_stock:!0});const ms=mt;Z.track("starter_record_added",{project_id:et.id,collection_name:Qe,record_count_after:(Array.isArray(ms==null?void 0:ms.data)?ms.data.length:0)+1}
747),Yn("added_record")}catch(ft){it.error((ft==null?void 0:ft.message)||"Failed to add record")}finally{at(!1)}},[et,Qe,It,Ve,mt,xc,Yn]),_m=x.useCallback(async Je=>{if(!et||Ve)return;const ft=et.api_key;if(!ft){it.error("No manage key found for this project");return}at(!0);try{const Dt=await fetch(`${$s}/api/collections/${Qe}/records/${Je}?project_id=${et.id}`,{method:"DELETE",headers:{"x-api-key":ft,"X-Reqres-Env":"prod"}});if(!Dt.ok){const Ys=await Dt.json().catch(()=>({}));throw new Error((Ys==null?void 0:Ys.message)||"Delete failed")}await xc(),ke(null),wt(null);const ms=mt;Z.track("starter_record_deleted",{project_id:et.id,collection_name:Qe,record_count_after:Math.max(0,(Array.isArray(ms==null?void 0:ms.data)?ms.data.length:0)-1)}),Yn("deleted_record")}catch(Dt){it.error((Dt==null?void 0:Dt.message)||"Failed to delete record")}finally{at(!1)}},[et,Qe,Ve,mt,xc,Yn]),Zo=P.length,Ni=P.filter(Je=>Je.status>=400).length,jm=Zo>0?Math.round(Ni/Zo*100):null,Gd=P.map(Je=>Je==null?void 0:Je.latency_ms).filter(Je=>typeof Je=="number"),Wd=Gd.length>0?Math.round(Gd.reduce((Je,ft)=>Je+ft,0)/Gd.length):null,hr=P[0],ki=P.find(Je=>Je.status>=400),Ln=ki?R_e(ki,z||void 0):null,Si=P.reduce((Je,ft)=>(ft.path&&(Je[ft.path]=(Je[ft.path]||0)+1),Je),{}),Yd=Object.entries(Si).sort((Je,ft)=>ft[1]-Je[1])[0]||null,Op=hr?jf(hr.created_at):"-",mb=async Je=>{await s.markComplete(Je)?it.success("Saved your path. We'll tailor the dashboard."):s.error&&it.error(s.error)},Lp=Je=>{s.markSkip(Je)},Dp=Gt||!me,$p=(ge==null?void 0:ge.tier)==="free",Dn=$p&&o.length>=2,Ci=ge!=null&&ge.limit?ge.used/ge.limit*100:0,Up=x.useMemo(()=>$p?!!(Dn||Ci>50):!1,[$p,Dn,Ci]),kn=(Je=null,ft)=>{B(Je),Oe(ft||null),V(!0)},Ta=x.useMemo(()=>{var Dt,ms;const Je=(Dt=s.status)==null?void 0:Dt.persona_goal,ft=(ms=s.status)==null?void 0:ms.persona_role;return ft==="qa"||Je==="qa_testing"||ft==="educator"||Je==="education"?"test":"ai"},[(bb=s.status)==null?void 0:bb.persona_goal,(Cm=s.status)==null?void 0:Cm.persona_role]),wm=(yb=s.status)!=null&&yb.persona_goal?"Let's get you set up":"Create your first backend",Nm=Pe!=null&&Pe.createdAt?Date.now()-new Date(Pe.createdAt).getTime()>AD:!1,Kd=Ke?Date.now()-new Date(Ke).getTime()<PD:!1,Fp=Ge&&Kd&&!fe,km=((_b=f[0])==null?void 0:_b.created_at)||((jb=k[0])==null?void 0:jb.created_at),v1=km?Date.now()-new Date(km).getTime()>AD:!1,b1=Ge&&o.length>0&&v1&&!le&&!A,Sm=!Ge&&!A&&o.length>0&&y===0&&!we,Jd=!Ge&&!A&&Me>50&&!xe,gb=x.useRef(!1);x.useEffect(()=>{Sm&&!gb.current&&(gb.current=!0,Z.track("baas_nudge_shown",{project_id:(G==null?void 0:G.id)??null}))},[Sm,G==null?void 0:G.id]);const xb=x.useRef(!1);x.useEffect(()=>{Jd&&!xb.current&&(xb.current=!0,Z.track("write_nudge_shown",{write_percent:Me}))},[Jd,Me]);const y1=s.showModal;return F&&!A&&!y1?r.jsx(w_e,{initialPath:$,initialPrompt:Ae,starterProject:et?{id:et.id,name:et.name,slug:et.slug,api_key:et.api_key}:null,onComplete:()=>{H(!0);try{localStorage.setItem("rr_wizard_completed","true")}catch{}V(!1),B(null),Oe(null),ls()},onSkip:()=>{V(!1),B(null),Oe(null)}}):r.jsxs("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-8 space-y-4 md:space-y-5",children:[r.jsx("div",{className:"flex flex-wrap items-start justify-between gap-4",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Dashboard"}),s.status&&r.jsxs("button",{type:"button",onClick:s.openModal,className:"inline-flex items-center gap-1.5 text-xs text-[var(--color-fg-faint)] hover:text-[var(--color-fg-secondary)] transition",children:[r.jsx(phe,{className:"h-3 w-3"}),"Personalize"]})]})}),o.length===0?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-3 px-4 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",onClick:()=>kn("ai"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--color-accent-blue)] text-white hover:brightness-110 transition shadow-sm",children:[r.jsx(Eu,{className:"h-3 w-3"}),"AI Generate"]}),r.jsxs("button",{type:"button",onClick:()=>kn("builder"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)] transition",children:[r.jsx(qy,{className:"h-3 w-3"}),"New project"]}),r.jsxs("button",{type:"button",onClick:()=>t("/playground?path=/api/users&method=GET"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)] transition",children:[r.jsx(Lu,{className:"h-3 w-3"}),"Open playground"]}
747)]}):r.jsx("div",{className:"flex items-center gap-1.5",children:Up?r.jsxs(dt,{to:"/upgrade",className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",children:[r.jsx(Dr,{className:"h-3.5 w-3.5 text-amber-500"}),r.jsx("span",{children:"Upgrade for AI generation + more projects"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>kn("ai"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-indigo-500/15 text-indigo-400 border border-indigo-500/25 hover:bg-indigo-500/25 hover:border-indigo-500/40 transition",title:"Generate a new project with AI",children:[r.jsx(Eu,{className:"h-3.5 w-3.5"}),"AI Generate"]}),r.jsxs("button",{type:"button",onClick:()=>kn("builder"),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",title:"Create a new project manually",children:[r.jsx(qy,{className:"h-3.5 w-3.5"}),"New project"]})]})}),Fp&&r.jsxs("div",{className:`${Pa} border-indigo-500/20 p-5 md:p-6`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.15]",children:r.jsx($g,{className:"w-full h-full"})}),r.jsx("button",{type:"button",onClick:Tt,className:"absolute top-3 right-3 z-10 p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-4 w-4"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500/20 to-purple-500/20 border border-indigo-500/30 flex items-center justify-center",children:r.jsx(efe,{className:"h-5 w-5 text-indigo-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"text-base font-semibold text-[var(--color-fg-default)] mb-1",children:"Welcome to Dev"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] mb-3",children:"Here's what you just unlocked:"}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(dt,{to:"/data-explorer",className:"group flex items-center gap-2 text-sm text-[var(--color-fg-secondary)] hover:text-indigo-400 transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] group-hover:text-indigo-400 transition"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Collections"})," - custom data models"]})]}),r.jsxs("button",{type:"button",onClick:()=>kn("ai"),className:"group flex items-center gap-2 text-sm text-[var(--color-fg-secondary)] hover:text-indigo-400 transition text-left",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] group-hover:text-indigo-400 transition"}),r.jsxs("span",{children:[r.jsx("strong",{children:"AI Generation"})," - describe, generate"]})]}),r.jsxs(dt,{to:"/app-users",className:"group flex items-center gap-2 text-sm text-[var(--color-fg-secondary)] hover:text-indigo-400 transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] group-hover:text-indigo-400 transition"}),r.jsxs("span",{children:[r.jsx("strong",{children:"App Users"})," - magic-code auth"]})]}),r.jsxs(dt,{to:"/custom-endpoints",className:"group flex items-center gap-2 text-sm text-[var(--color-fg-secondary)] hover:text-indigo-400 transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] group-hover:text-indigo-400 transition"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Custom Endpoints"})," - your own routes"]})]}),r.jsxs(dt,{to:"/environments",className:"group flex items-center gap-2 text-sm text-[var(--color-fg-secondary)] hover:text-indigo-400 transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)] group-hover:text-indigo-400 transition"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Environments"})," - dev & prod"]})]})]})]})]})]}),b1&&r.jsxs("div",{className:`${Pa} border-emerald-500/20 p-5 md:p-6`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.15]",children:r.jsx(d0,{className:"w-full h-full"})}),r.jsx("button",{type:"button",onClick:ss,className:"absolute top-3 right-3 z-10 p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-4 w-4"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500/20 to-teal-500/20 border border-emerald-500/30 flex items-center justify-center",children:r.jsx(rr,{className:"h-5 w-5 text-emerald-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"text-base font-semibold text-[var(--color-fg-default)] mb-1",children:"Welcome back!"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Your ",r.jsx("strong",{children:(G==null?void 0:G.name)||"project"})," has"," ",y!==null&&y>0?`${y} collection${y!==1?"s":""}`:"collections"," ",E!==null&&E>0?`and ${E} record${E!==1?"s":""}`:"","."," ","Pick up where you left off."]})]})]})]}),Sm&&r.jsxs("div",{className:`${Pa} border-cyan-500/20 p-5 md:p-6`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.15]",children:r.jsx(u0,{className:"w-full h-full"})}),r.jsx("button",{type:"button",onClick:Zt,className:"absolute top-3 right-3 z-10 p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-4 w-4"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-xl bg-gradient-to-br from-cyan-500/20 to-blue-500/20 border border-cyan-500/30 flex items-center justify-center",children:r.jsx(Rn,{className:"h-5 w-5 text-cyan-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"text-base font-semibold text-[var(--color-fg-default)] mb-1",children:"Your project is ready for custom data"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] mb-3",children:"Collections let you define custom data models, store records, and query them via API - same patterns you already know."}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(dt,{to:"/data-explorer",className:yu+" text-xs px-3 py-1.5",onClick:()=>Z.track("baas_nudge_clicked",{cta:"create_collection"}),children:"Create Your First Collection"}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("baas_nudge_clicked",{cta:"generate_ai"}),kn("ai")},className:Ug+" text-xs px-3 py-1.5",children:[r.jsx(Eu,{className:"h-3.5 w-3.5 mr-1"}),"Generate with AI"]})]})]})]})]}),Jd&&r.jsxs("div",{className:`${Pa} border-amber-500/20 p-5 md:p-6`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.15]",children:r.jsx(HS,{className:"w-full h-full"})}),r.jsx("button",{type:"button",onClick:re,className:"absolute top-3 right-3 z-10 p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-4 w-4"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-4",children:[r.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-xl bg-gradient-to-br from-amber-500/20 to-orange-500/20 border border-amber-500/30 flex items-center justify-center",children:r.jsx(Qf,{className:"h-5 w-5 text-amber-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"text-base font-semibold text-[var(--color-fg-default)] mb-1",children:"You're building something real"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)] mb-3",children:[Me,"% of your API traffic this week was write operations. The Dev plan includes environments, automations, and 20,000 requests/day."]}),r.jsxs(dt,{to:"/upgrade?source=write_heavy&highlight=dev",className:yu+" text-xs px-3 py-1.5 inline-flex",onClick:()=>Z.track("write_nudge_clicked"),children:["See Dev Plan",r.jsx(Kt,{className:"h-3.5 w-3.5 ml-1"})]})]})]})]}),qs==="no_projects"&&!A&&!I&&r.jsxs("div",{className:`${Pa} p-5 sm:p-8 md:p-12`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-4 -top-2 w-52 h-36 opacity-[0.2]",children:r.jsx($g,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-10 max-w-2xl space-y-6",children:[r.jsxs("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/[0.06] p-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Looking for your starter project?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] mt-0.5",children:"If you deleted it, or it never appeared, one click brings back a working project with sample data and an API key."})]}),r.jsx("button",{type:"button",disabled:l==="working",onClick:u,className:"shrink-0 inline-flex items-center justify-center rounded-lg bg-emerald-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-emerald-400 disabled:opacity-60 transition",children:l==="working"?"Restoringâ¦":"Restore starter project"})]}),l==="error"&&r.jsx("p",{className:"text-sm text-amber-500",children:"That didn't work. Try again, or email [email protected] and a human will fix it."}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-2xl sm:text-3xl md:text-4xl font-bold text-[var(--color-fg-default)]",children:wm}),r.jsx("p",{className:"text-lg text-[var(--color-fg-secondary)]",children:"Get a working test API in seconds - endpoints, sample data, and auth flows ready for your suite to hit."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[r.jsxs("button",{type:"button",onClick:()=>kn("ai"),className:`group relative overflow-hidden rounded-xl p-5 text-left transition-all ${Ta==="ai"?"border-2 border-indigo-500/50 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 hover:border-indigo-400 hover:from-indigo-500/20 hover:to-purple-500/20":"border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]"}`,children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Eu,{className:`h-5 w-5 ${Ta==="ai"?"text-indigo-400":"text-[var(--color-fg-muted)]"}`}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"AI Generate"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Describe your app and let AI create everything"})]}),r.jsx("div",{className:`mt-3 text-xs font-medium ${Ta==="ai"?"text-indigo-400 group-hover:text-indigo-300":"text-[var(--color-fg-muted)] group-hover:text-[var(--color-fg-secondary)]"}`,children:Ta==="ai"?"Recommended â":"AI setup â"})]}),r.jsxs("button",{type:"button",onClick:()=>kn("builder"),className:`group rounded-xl p-5 text-left transition-all ${Ta==="build"?"border-2 border-indigo-500/50 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 hover:border-indigo-400 hover:from-indigo-500/20 hover:to-purple-500/20":"border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]"}`,children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qy,{className:`h-5 w-5 ${Ta==="build"?"text-indigo-400":"text-[var(--color-fg-muted)]"}`}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"New project"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Create a project and define your own schema"})]}),r.jsx("div",{className:`mt-3 text-xs font-medium ${Ta==="build"?"text-indigo-400 group-hover:text-indigo-300":"text-[var(--color-fg-muted)] group-hover:text-[var(--color-fg-secondary)]"}`,children:Ta==="build"?"Recommended â":"Manual setup â"})]}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("playground_entered_from_dashboard_empty"),t("/playground?path=/api/users&method=GET")},className:`group rounded-xl p-5 text-left transition-all ${Ta==="test"?"border-2 border-indigo-500/50 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 hover:border-indigo-400 hover:from-indigo-500/20 hover:to-purple-500/20":"border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]"}`,children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lu,{className:`h-5 w-5 ${Ta==="test"?"text-indigo-400":"text-[var(--color-fg-muted)]"}`}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Send a request"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Try the API playground - no setup needed"})]}),r.jsx("div",{className:`mt-3 text-xs font-medium ${Ta==="test"?"text-indigo-400 group-hover:text-indigo-300":"text-[var(--color-fg-muted)] group-hover:text-[var(--color-fg-secondary)]"}`,children:Ta==="test"?"Recommended â":"Open playground â"})]})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] pt-2",children:["Not sure where to start? Check out"," ",r.jsx("a",{href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Task Manager"})," and ",r.jsx("a",{href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Waitlist"})," ","- complete apps built on ReqRes with source code."]}),Nm&&!Ge&&r.jsxs("div",{className:"mt-4 rounded-xl border border-indigo-500/20 bg-indigo-500/5 p-4",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:"Skip the setup - describe what you need:"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:S_e.map(Je=>r.jsxs("button",{type:"button",onClick:()=>kn("ai",Je),className:"inline-flex items-center gap-1.5 rounded-lg border border-indigo-500/30 bg-indigo-500/10 px-3 py-1.5 text-xs font-medium text-indigo-300 hover:bg-indigo-500/20 hover:border-indigo-400/50 transition",children:[r.jsx(Eu,{className:"h-3 w-3"}),Je]},Je))})]})]})]}),ye&&!wi&&!A&&!I&&(()=>{const Je=z||et.api_key||"",ft=et.api_key||"<your_manage_key>",Dt=`${$s}/api/collections/${Qe}/records?project_id=${et.id}`,ms=`/api/collections/${Qe}/records?project_id=${et.id}`,Ys=`/collections/${Qe}/records`,er=Je||"<your_api_key>",yo=`${$s}/api/collections/${Qe}/records/{id}?project_id=${et.id}`,ul={curl:{code:`curl -H "x-api-key: ${ft}" \\ 748 -H "X-Reqres-Env: prod" \\ 749 "${Dt}"`,lang:"bash"},js:{code:`const response = await fetch( 750 "${Dt}", 751 { 752 headers: { 753 "x-api-key": "${er}", 754 "X-Reqres-Env": "prod", 755 }, 756 } 757); 758const data = await response.json();`,lang:"javascript",hint:"This public key is read-only - safe for browsers. For writes from a client app, use App Users with session tokens instead."},post:{code:`curl -X POST \\ 759 -H "x-api-key: ${ft}" \\ 760 -H "X-Reqres-Env: prod" \\ 761 -H "Content-Type: application/json" \\ 762 -d '{"data":{"name":"New Product","price":19.99,"category":"New","in_stock":true}}' \\ 763 "${Dt}"`,lang:"bash"},patch:{code:`curl -X PUT \\ 764 -H "x-api-key: ${ft}" \\ 765 -H "X-Reqres-Env: prod" \\ 766 -H "Content-Type: application/json" \\ 767 -d '{"data":{"price":29.99}}' \\ 768 "${yo}"`,lang:"bash"},delete:{code:`curl -X DELETE \\ 769 -H "x-api-key: ${ft}" \\ 770 -H "X-Reqres-Env: prod" \\ 771 "${yo}"`,lang:"bash"}},pa=ul[ve]||ul.curl,pl=ct==="success",Ks=mt;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:`${Pa} p-5 sm:p-8 md:p-10`,children:[r.jsx("div",{className:"pointer-events-none absolute -right
771-4 -top-2 w-44 h-36 opacity-[0.3]",children:r.jsx($g,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-10 space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[r.jsx(Or,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm font-semibold",children:"Your backend is live"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[r.jsx("h2",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-[var(--color-fg-default)] break-all",children:et.name}),r.jsxs(dt,{to:`/projects/${et.id}`,className:"shrink-0 inline-flex items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)] transition",children:["View project ",r.jsx(ja,{className:"h-3 w-3"})]})]}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:[j.length||1," collection",j.length!==1?"s":""," · ready to query"]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] max-w-lg",children:["We created a ",r.jsx("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:"Products"})," collection with sample data. Try editing a record - unlike the free API, your changes persist. It's yours to explore, edit, or delete."]}),j.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:j.map(Js=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] px-2.5 py-0.5 text-[11px] font-medium text-[var(--color-fg-secondary)]",children:[r.jsx(Rn,{className:"h-3 w-3 text-[var(--color-fg-faint)]"}),Js]},Js))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 sm:px-4 py-3 border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[11px] font-bold bg-emerald-500/15 text-emerald-400 border border-emerald-500/25",children:"GET"}),r.jsxs("code",{className:"text-xs font-mono min-w-0",children:[r.jsx("span",{className:"hidden sm:inline text-[var(--color-fg-muted)]",children:$s}),r.jsx("span",{className:"hidden sm:inline text-[var(--color-fg-secondary)] break-all",children:ms}),r.jsx("span",{className:"sm:hidden text-[var(--color-fg-secondary)]",children:Ys})]})]}),Je&&r.jsxs("span",{className:"hidden sm:flex shrink-0 ml-2 text-[11px] text-[var(--color-fg-muted)] items-center gap-1",children:[r.jsx(ts,{className:"h-3 w-3 text-emerald-400"})," authenticated"]})]}),r.jsxs("div",{className:"p-4 min-h-[52px]",children:[ct==="idle"&&r.jsxs("button",{type:"button",onClick:bm,className:"inline-flex items-center gap-2 rounded-lg bg-[var(--color-accent-blue)] px-5 py-2.5 text-sm font-semibold text-white shadow-sm hover:brightness-110 transition-all",children:[r.jsx(cp,{className:"h-4 w-4"}),"Fetch data"]}),ct==="loading"&&r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg bg-[var(--color-accent-blue)]/60 px-5 py-2.5 text-sm font-semibold text-white/80",children:[r.jsx(bs,{size:"sm",variant:"spinner"}),r.jsx("span",{children:"Fetching recordsâ¦"})]}),ct==="error"&&r.jsxs("div",{className:"space-y-2 animate-fade-in",children:[r.jsx("p",{className:"text-sm text-[var(--color-semantic-warning)]",children:gt}),r.jsx("button",{type:"button",onClick:()=>{rt("idle"),Be(null)},className:"text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition",children:"Try again"})]}),pl&&Ks&&r.jsxs("div",{className:"space-y-3 animate-slide-up",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Or,{className:"h-4 w-4 text-emerald-400"}),r.jsx("span",{className:"font-medium text-emerald-400",children:"200 OK"}),r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["· ",Array.isArray(Ks.data)?Ks.data.length:0," records"]})]}),r.jsx("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] overflow-hidden max-h-80 overflow-y-auto",children:Array.isArray(Ks.data)&&Ks.data.map(Js=>r.jsx("div",{className:`px-3 py-2 border-b border-[var(--color-border-default)] last:border-b-0 text-xs font-mono transition-colors duration-700 ${_t===Js.id?"bg-emerald-500/10":""}`,children:r.jsx(aa,{json:JSON.stringify(Js,null,2)})},Js.id))})]})]})]}),pl&&Ks&&(()=>{var fa;
771const Js=Array.isArray(Ks.data)?Ks.data:[],Ja=Js[0];return He.current||(He.current=!0,Z.track("starter_crud_section_viewed",{project_id:et.id})),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 sm:p-5 space-y-4 animate-fade-in-delayed",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"That's your data - try changing it"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Unlike the legacy API, changes here persist. Edit a record and fetch again - you'll see the update."})]}),!he&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("button",{type:"button",disabled:!Ja,onClick:()=>{Ja&&(ke("edit"),Xt(Ja.id),Ct(typeof Ja.data=="object"&&Ja.data?{...Ja.data}:{}))},className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-xs font-medium text-[var(--color-fg-secondary)] hover:border-indigo-500/40 hover:text-[var(--color-fg-default)] transition disabled:opacity-40",children:[r.jsx(Cq,{className:"h-3.5 w-3.5"})," Edit a record"]}),r.jsxs("button",{type:"button",onClick:()=>ke("add"),className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-xs font-medium text-[var(--color-fg-secondary)] hover:border-emerald-500/40 hover:text-[var(--color-fg-default)] transition",children:[r.jsx(ca,{className:"h-3.5 w-3.5"})," Add a record"]}),r.jsxs("button",{type:"button",disabled:Js.length===0,onClick:()=>{const Tr=Js[Js.length-1];Tr&&wt(Tr.id),ke("delete")},className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-xs font-medium text-[var(--color-fg-secondary)] hover:border-red-500/40 hover:text-[var(--color-fg-default)] transition disabled:opacity-40",children:[r.jsx(nl,{className:"h-3.5 w-3.5"})," Delete a record"]})]}),he==="edit"&&St&&r.jsxs("div",{className:"space-y-3 rounded-lg border border-indigo-500/20 bg-indigo-500/5 p-3",children:[r.jsxs("p",{className:"text-xs font-medium text-indigo-400",children:["Editing: ",Pt.name?String(Pt.name):`record ${String(St).slice(0,8)}`]}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(Pt).map(([Tr,fn])=>r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:Tr}),typeof fn=="boolean"?r.jsx("button",{type:"button",onClick:()=>Ct(ar=>({...ar,[Tr]:!ar[Tr]})),className:`block w-full rounded-md border px-2.5 py-1.5 text-xs font-mono text-left transition ${fn?"border-emerald-500/40 bg-emerald-500/10 text-emerald-400":"border-red-500/30 bg-red-500/10 text-red-400"}`,children:String(fn)}):r.jsx("input",{type:typeof fn=="number"?"number":"text",step:typeof fn=="number"?"0.01":void 0,value:String(fn??""),onChange:ar=>Ct(Ei=>({...Ei,[Tr]:typeof fn=="number"?parseFloat(ar.target.value)||0:ar.target.value})),className:"block w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-2.5 py-1.5 text-xs font-mono text-[var(--color-fg-default)] focus:border-indigo-500 focus:outline-none"})]},Tr))}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:Mp,disabled:Ve,className:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-500 px-3 py-1.5 text-xs font-semibold text-white hover:bg-indigo-400 transition disabled:opacity-50",children:Ve?"Savingâ¦":"Save"}),r.jsx("button",{type:"button",onClick:()=>{ke(null),Xt(null)},className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Cancel"})]})]}),he==="add"&&r.jsxs("div",{className:"space-y-3 rounded-lg border border-emerald-500/20 bg-emerald-500/5 p-3",children:[r.jsx("p",{className:"text-xs font-medium text-emerald-400",children:"New product"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"name"}),r.jsx("input",{type:"text",value:It.name,onChange:Tr=>ee(fn=>({...fn,name:Tr.target.value})),className:"block w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-2.5 py-1.5 text-xs font-mono text-[var(--color-fg-default)] focus:border-emerald-500 focus:outline-none"})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"price"}),r.jsx("input",{type:"number",step:"0.01",value:It.price,onChange:Tr=>ee(fn=>({...fn,price:parseFloat(Tr.target.value)||0})),className:"block w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-2.5 py-1.5 text-xs font-mono text-[var(--color-fg-default)] focus:border-emerald-500 focus:outline-none"})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"category"}),r.jsx("input",{type:"text",value:It.category,onChange:Tr=>ee(fn=>({...fn,category:Tr.target.value})),className:"block w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-2.5 py-1.5 text-xs font-mono text-[var(--color-fg-default)] focus:border-emerald-500 focus:outline-none"})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"in_stock"}),r.jsx("button",{type:"button",onClick:()=>ee(Tr=>({...Tr,in_stock:!Tr.in_stock})),className:`block w-full rounded-md border px-2.5 py-1.5 text-xs font-mono text-left transition ${It.
771in_stock?"border-emerald-500/40 bg-emerald-500/10 text-emerald-400":"border-red-500/30 bg-red-500/10 text-red-400"}`,children:String(It.in_stock)})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:ym,disabled:Ve,className:"inline-flex items-center gap-1.5 rounded-lg bg-emerald-500 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-400 transition disabled:opacity-50",children:Ve?"Addingâ¦":"Add record"}),r.jsx("button",{type:"button",onClick:()=>ke(null),className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Cancel"})]})]}),he==="delete"&&We&&r.jsxs("div",{className:"space-y-3 rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[r.jsxs("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:["Remove ",r.jsx("span",{className:"font-medium text-[var(--color-fg-default)]",children:((fa=Js.find(Tr=>Tr.id===We))==null?void 0:fa.name)||`record #${We}`}),"?"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>_m(We),disabled:Ve,className:"inline-flex items-center gap-1.5 rounded-lg bg-red-500 px-3 py-1.5 text-xs font-semibold text-white hover:bg-red-400 transition disabled:opacity-50",children:Ve?"Deletingâ¦":"Delete"}),r.jsx("button",{type:"button",onClick:()=>{ke(null),wt(null)},className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Cancel"})]})]})]})})(),pl&&r.jsxs("div",{className:"space-y-3 animate-fade-in-delayed",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Use in your code"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:[{key:"curl",label:"GET (curl)",icon:!0},{key:"js",label:"GET (JS)",icon:!1},{key:"post",label:"POST",icon:!1},{key:"patch",label:"PUT",icon:!1},{key:"delete",label:"DELETE",icon:!1}].map(Js=>r.jsxs("button",{type:"button",onClick:()=>{be(Js.key),["post","patch","delete"].includes(Js.key)&&Z.track("starter_snippet_tab_changed",{tab:Js.key,project_id:et.id})},className:`rounded-md px-2.5 py-1 text-xs font-medium transition ${ve===Js.key?"bg-[var(--color-bg-hover)] text-[var(--color-fg-default)]":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)]"}`,children:[Js.icon&&r.jsx(mo,{className:"inline h-3 w-3 mr-1"}),Js.label]},Js.key))}),r.jsxs("div",{className:"group/snippet relative",children:[r.jsx(Go,{code:pa.code,language:pa.lang}),r.jsx("button",{type:"button",onClick:()=>x1(pa.code,ve),className:"absolute top-2 right-2 p-1.5 rounded-md bg-[var(--color-bg-alt)]/80 backdrop-blur text-[var(--color-fg-faint)] opacity-0 group-hover/snippet:opacity-100 hover:!opacity-100 hover:text-[var(--color-fg-default)] border border-[var(--color-border-default)] transition-all",title:nt===ve?"Copied!":"Copy",children:nt===ve?r.jsx(ts,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(is,{className:"h-3.5 w-3.5"})})]}),pa.hint&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)] leading-relaxed",children:pa.hint}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("starter_console_cta_clicked",{project_id:et.id}),t(`/console?project_id=${et.id}`)},className:"flex items-center gap-3 w-full rounded-lg border border-indigo-500/20 bg-indigo-500/5 px-4 py-3 text-left transition-all hover:border-indigo-500/30 hover:bg-indigo-500/10 group",children:[r.jsx(Lu,{className:"h-4 w-4 text-indigo-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Try POST, PUT, DELETE and more"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Open the interactive console to test every endpoint for your project"})]}),r.jsx(Kt,{className:"h-4 w-4 text-indigo-400/60 group-hover:text-indigo-400 group-hover:translate-x-0.5 transition-all shrink-0"})]})]})]})]}),r.jsxs("div",{className:`${Pa} p-5 sm:p-6 md:p-8`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-36 h-24 opacity-[0.18]",children:r.jsx(VS,{className:"w-full h-full"})}),De?r.jsxs("div",{className:"relative z-[1] space-y-5",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Explore your backend"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Your starter project has a Products collection with sample data. Try these next."})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>{Z.track("explore_starter_clicked",{cta:"add_record",project_id:et.id}),t(`/data-explorer?projectId=${et.id}&collection=${Qe}`)},className:"group flex items-center gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-left transition-all cursor-pointer hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]",children:[r.jsx(Rn,{className:"h-4 w-4 text-[var(--color-fg-muted)] shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Browse your data"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"View and edit records"})]})]}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("explore_starter_clicked",{cta:"try_post",project_id:et.id}),t(`/playground?path=/api/collections/${Qe}/records&method=POST&project_id=${et.id}`)},className:"group flex items-center gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-left transition-all cursor-pointer hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]",children:[r.jsx(cp,{className:"h-4 w-4 text-[var(--color-fg-muted)] shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Try a POST request"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Add your own record"})]})]}),r.jsxs("button",{type:"button",onClick:()=>{Z.track("explore_starter_clicked",{cta:"console",project_id:et.id}),t(`/console?project_id=${et.id}`)},className:"group flex items-center gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-left transition-all cursor-pointer hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]",children:[r.jsx(Lu,{className:"h-4 w-4 text-[var(--color-fg-muted)] shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Try all endpoints"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Interactive API console"})]})]})]})]}):r.jsxs("div",{className:"relative z-[1] space-y-5",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Ready to build your own?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Create a project for your actual use case."})]}),r.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0}),Z.track("starter_build_own_clicked",{cta:"ai_generate",project_id:et.id}),Yn("clicked_ai_generate"),kn("ai")},className:"group relative overflow-hidden rounded-xl border-2 border-indigo-500/50 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 p-5 text-left transition-all cursor-pointer hover:border-indigo-400 hover:from-indigo-500/20 hover:to-purple-500/20",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Eu,{className:"h-5 w-5 text-indigo-400"}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"AI Generate"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Describe your app and let AI create everything"})]}),r.jsx("div",{className:"mt-3 text-xs font-medium text-indigo-400 group-hover:text-indigo-300",children:"Recommended â"})]}),r.jsxs("div",{className:"hidden sm:grid sm:grid-cols-2 gap-4",children:[r.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0}),Z.track("starter_build_own_clicked",{cta:"new_project",project_id:et.id}),Yn("clicked_new_project"),kn("builder")},className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 text-left transition-all cursor-pointer hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qy,{className:"h-5 w-5 text-[var(--color-fg-muted)]"}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"New project"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Create a project and define your own schema"})]}),r.jsx("div",{className:"mt-3 text-xs font-medium text-[var(--color-fg-muted)] group-hover:text-[var(--color-fg-secondary)]",children:"Manual setup â"})]}),r.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0}),Z.track("starter_build_own_clicked",{cta:"console",project_id:et.id}),Yn("clicked_console"),t(`/console?project_id=${et.id}`)},className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 text-left transition-all cursor-pointer hover:border-[var(--color-border-interactive)] hover:bg-[var(--color-bg-hover)]",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lu,{className:"h-5 w-5 text-[var(--color-fg-muted)]"}),r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Try all endpoints"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Interactive API console for your project"})]}),r.jsx("div",{className:"mt-3 text-xs font-medium text-[var(--color-fg-muted)] group-hover:text-[var(--color-fg-secondary)]",children:"Open playground â"})]})]}),r.jsxs("div",{className:"sm:hidden space-y-1",children:[r.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0}),Z.track("starter_build_own_clicked",{cta:"new_project",project_id:et.id}),Yn("clicked_new_project"),kn("builder")},className:"flex items-center gap-2 w-full rounded-lg px-1 py-2 text-sm text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)]"}),r.jsx("span",{children:"New project"}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"- manual setup"})]}),r.jsxs("button",{type:"button",onClick:()=>{window.scrollTo({top:0}),Z.track("starter_build_own_clicked",{cta:"console",project_id:et.id}),Yn("clicked_console"),t(`/console?project_id=${et.id}`)},className:"flex items-center gap-2 w-full rounded-lg px-1 py-2 text-sm text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition",children:[r.jsx(Kt,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)]"}),r.jsx("span",{children:"Try all endpoints"}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"- API console"})]})]})]})]})]})})(),qs!=="no_projects"&&ge&&ge.limit!==null?r.jsx(uR,{label:"Project usage",used:ge.used,limit:ge.limit,resetAt:ge.resetAt,ctaLabel:ub,ctaHref:vm,ctaSource:ge.tier==="free"?"limit_warning":void 0,surface:"dashboard",tier:ge.tier}):null,qs!=="no_projects"&&(!jt||!U)&&!Ca&&r.jsxs(r.Fragment,{children:[ye&&ct==="success"&&jt&&r.jsxs("div",{className:`sm:hidden ${Pa} px-4 py-3 flex items-center justify-between gap-3`,children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Or,{className:"h-4 w-4 text-emerald-400 shrink-0"}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"First request received"}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)] shrink-0",children:["· ",dl]})]}),r.jsx("button",{type:"button",onClick:Nt,className:"shrink-0 p-1 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:`${Pa} p-5 md:p-6 ${ye&&ct==="success"&&jt?"hidden sm:block":""}`,children:[jt&&r.jsx("button",{type:"button",onClick:Nt,className:"absolute top-3 right-3 z-20 p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"h-4 w-4"})}),r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-40 h-28 opacity-[0.25]",children:r.jsx(d0,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-10 space-y-4",children:[r.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-2 max-w-2xl",children:[r.jsx("p",{className:_f,children:"First request"}),r.jsx("h2",{className:"text-xl md:text-2xl font-semibold text-[var(--color-fg-default)]",children:xm}),!jt&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:GS,children:Cr.body}),Cr.hint&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:Cr.hint}),xt&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)]",children:"We'll stop listening as soon as your first request lands."})]})]}),r.jsx("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 shrink-0",children:jt?null:xt?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:yu,onClick:()=>Ka(gm,"cURL copied to clipboard.",!0),children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx(is,{className:"h-4 w-4"}),"Copy curl"]})}),r.jsx(dt,{className:Ug,to:"/api-keys",children:"Go to API Keys"})]}):r.jsx(dt,{className:yu,to:"/api-keys",children:"Create a free API key"})})]}),r.jsx("div",{children:jt?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 text-sm text-[var(--color-semantic-success)]",children:[r.jsx(Or,{className:"h-6 w-6 shrink-0"}),r.jsx("span",{className:"font-semibold",children:Vd?"First request received":"Last request seen"}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:["· ",dl]}),r.jsx(dt,{to:Et,className:"sm:ml-auto text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors",children:"View in logs â"})]}),Vd?r.jsxs("div",{className:`${zS} flex-col sm:flex-row gap-4`,children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-secondary)]",children:On.label}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:On.description})]}),r.jsxs(dt,{to:On.href,className:On.upgradeNudge?"inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--color-accent-blue)] px-4 py-2 text-xs font-semibold text-white shadow-sm transition-all hover:brightness-110":"inl
771ine-flex items-center justify-center gap-1.5 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3.5 py-2 text-xs font-medium text-[var(--color-fg-secondary)] transition-colors hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)]",children:[On.label,r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"â"})]})]}):r.jsxs("div",{className:`${zS} flex-col sm:flex-row gap-4`,children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-secondary)]",children:"Send a new request"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Your API is still live - pick up where you left off."})]}),r.jsxs(dt,{to:"/playground",className:"inline-flex items-center justify-center gap-1.5 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3.5 py-2 text-xs font-medium text-[var(--color-fg-secondary)] transition-colors hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)]",children:["Open playground",r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"â"})]})]})]}):r.jsxs("div",{className:zS,children:[r.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(bs,{size:"sm",variant:"pulse",className:"text-[var(--color-semantic-success)]"}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"inline-flex h-1.5 w-1.5 rounded-full bg-[var(--color-semantic-success)] animate-pulse"}),r.jsx("span",{children:"Listening for the first requestâ¦"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:xt?"We'll surface it here within 10 seconds.":"Create a key to start listening."})]})]}),r.jsxs("div",{className:"hidden md:flex items-center gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"inline-flex h-2 w-2 rounded-full bg-[var(--color-semantic-success)] animate-pulse"}),xt?xs?"Checking nowâ¦":"Standing byâ¦":"Waiting for a key"]})]})})]})]})]}),!A&&xt&&z&&(()=>{const Je=G==null?void 0:G.name,ft=j[0],Dt="https://reqres.in",ms=ft?`${Dt}/api/collections/${ft}/records${G?`?project_id=${G.id}`:""}`:`${Dt}/api/users?page=1`,Ys=`curl -H "x-api-key: ${z}" \\ 772 "${ms}"`,er=z.length>16?`${z.slice(0,12)}â¦`:z;return r.jsxs("div",{className:`${Pa} p-5 md:p-6`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-3 -top-1 w-36 h-28 opacity-[0.2]",children:r.jsx(u0,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-10 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(_d,{className:"h-4 w-4 text-[var(--color-fg-muted)] shrink-0"}),r.jsx("p",{className:`${_f} truncate`,children:Je?r.jsxs(r.Fragment,{children:[Je,r.jsx("span",{className:"hidden sm:inline",children:" - API reference"})]}):"Your API key & endpoints"})]}),r.jsxs(dt,{to:"/api-keys",className:"shrink-0 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition-colors flex items-center gap-1",children:["Manage keys ",r.jsx(ja,{className:"h-3 w-3"})]})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"group relative rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)] mb-1.5",children:"API key"}),r.jsx("code",{className:"block text-sm font-mono text-[var(--color-fg-default)] truncate",children:er}),r.jsx("button",{type:"button",className:"absolute top-2.5 right-2.5 p-1.5 rounded-md text-[var(--color-fg-faint)] opacity-0 group-hover:opacity-100 hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-all",onClick:()=>Ka(z,"API key copied."),title:"Copy full key",children:r.jsx(is,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"group relative rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)] mb-1.5",children:"Required header"}),r.jsxs("code",{className:"block text-sm font-mono text-[var(--color-fg-default)] truncate",children:[r.jsx("span",{className:"text-indigo-400",children:"x-api-key"}),": ",er]}),r.jsx("button",{type:"button",className:"absolute top-2.5 right-2.5 p-1.5 rounded-md text-[var(--color-fg-faint)] opacity-0 group-hover:opacity-100 hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-all",onClick:()=>Ka(`x-api-key: ${z}`,"Header copied."),title:"Copy full header",children:r.jsx(is,{className:"h-3.5 w-3.5"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)]",children:j.length>0?"Your endpoints":"Endpoint patterns"}),j.length>0?r.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3 space-y-1.5 overflow-x-auto",children:[j.slice(0,4).map(yo=>r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)] break-all",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," ","reqres.in/api/collections/",r.jsx("span",{className:"text-amber-300",children:yo}),"/records"]},yo)),r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)] break-all",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," ","reqres.in/api/",r.jsx("span",{className:"text-amber-300",children:"users"}),r.jsx("span",{className:"text-[var(--color-fg-faint)] ml-2",children:"â classic API"})]})]}):r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3 space-y-1",children:[r.jsx("p",{className:"text-[11px] font-medium text-[var(--color-fg-muted)] mb-1.5",children:"Classic API"}),r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," reqres.in/api/",r.jsx("span",{className:"text-amber-300",children:"users"})]}),r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," reqres.in/api/",r.jsx("span",{className:"text-amber-300",children:"{resource}"})]})]}),r.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3 space-y-1",children:[r.jsx("p",{className:"text-[11px] font-medium text-[var(--color-fg-muted)] mb-1.5",children:"Collections"}),r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," reqres.in/api/",r.jsx("span",{className:"text-amber-300",children:"collections"})]}),r.jsxs("code",{className:"block text-xs font-mono text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"text-emerald-400",children:"GET"})," â¦/",r.jsx("span",{className:"text-amber-300",children:"{slug}"}
772),"/records"]})]})]})]}),r.jsxs("div",{className:"sm:hidden flex items-center justify-between rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(mo,{className:"h-3.5 w-3.5 text-indigo-400 shrink-0"}),r.jsxs("span",{className:"text-xs font-medium text-[var(--color-fg-secondary)] truncate",children:["curl - Fetch ",ft||"products"]})]}),r.jsxs("button",{type:"button",className:"shrink-0 ml-2 inline-flex items-center gap-1.5 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1.5 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-interactive)] transition",onClick:()=>Ka(Ys,"curl command copied."),children:[r.jsx(is,{className:"h-3 w-3"}),"Copy"]})]}),r.jsxs("div",{className:"hidden sm:block group relative rounded-lg bg-[var(--color-bg-code)] border border-[var(--color-border-secondary)] px-4 py-3",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)] mb-1.5",children:ft?`Try it - fetch ${ft}`:"Try it"}),r.jsxs("pre",{className:"text-xs font-mono text-[var(--color-fg-secondary)] whitespace-pre-wrap break-all leading-relaxed",children:[r.jsx("span",{className:"text-indigo-400",children:"curl"})," -H ",r.jsxs("span",{className:"text-amber-300",children:['"x-api-key: ',z,'"']})," \\",` 773`," ",r.jsxs("span",{className:"text-emerald-400",children:['"',ms,'"']})]}),r.jsx("button",{type:"button",className:"absolute top-2.5 right-2.5 p-1.5 rounded-md text-[var(--color-fg-faint)] opacity-0 group-hover:opacity-100 hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-all",onClick:()=>Ka(Ys,"curl command copied."),children:r.jsx(is,{className:"h-3.5 w-3.5"})})]})]})]})})(),A&&r.jsx("div",{className:`${Il} text-center py-10`,children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading your dashboardâ¦"})}),I&&r.jsx("div",{className:`${Il} text-sm text-[var(--color-fg-secondary)]`,children:I}),!A&&!I&&r.jsxs(r.Fragment,{children:[!wi&&qs!=="no_projects"&&!ye&&r.jsxs("div",{className:"space-y-6",children:[Dp&&r.jsxs("div",{className:`${Pa} px-4 py-3.5 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-24 h-16 opacity-[0.12]",children:r.jsx(u0,{className:"w-full h-full"})}),r.jsx("p",{className:"relative z-[1] text-sm font-medium text-[var(--color-fg-default)]",children:"Learn by example"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4",children:[r.jsx(dt,{className:`${od.ctaDark} text-sm`,to:Ha,children:"Open example in your project"}),r.jsx("span",{className:"hidden sm:inline text-[var(--color-fg-default)]/20",children:"|"}),r.jsx("a",{className:`${od.ctaDark} text-sm`,href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",children:"Task Manager demo"}),r.jsx("span",{className:"hidden sm:inline text-[var(--color-fg-default)]/20",children:"|"}),r.jsx("a",{className:`${od.ctaDark} text-sm`,href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",children:"Waitlist demo"})]})]}),r.jsxs("div",{className:`${Pa} border-indigo-500/20 px-4 py-3.5 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-24 h-16 opacity-[0.12]",children:r.jsx(d0,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-center gap-3",children:[r.jsx(rr,{className:"h-5 w-5 text-indigo-300"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Build with AI"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Copy a prompt into Claude Code or Cursor to start building"})]})]}),r.jsx(dt,{className:`${od.ctaDark} text-sm`,to:G?`/prompts?projectId=${G.id}
773`:"/prompts",children:"Browse LLM Prompts â"})]})]}),wi&&qs!=="no_projects"&&r.jsxs("div",{className:"space-y-4",children:[!xt&&r.jsxs("div",{className:`${Pa} px-4 py-3.5 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-24 h-16 opacity-[0.12]",children:r.jsx($g,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"API keys"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Create a key to call classic endpoints or your project."})]}),r.jsx(dt,{className:`relative z-[1] ${yu} px-4`,to:"/api-keys",children:"Create API key"})]}),r.jsxs("div",{className:`${Il} space-y-4`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-36 h-24 opacity-[0.18]",children:r.jsx(HS,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:_f,children:"System health"}),r.jsx("p",{className:GS,children:"Traffic, errors, latency, and log freshness."})]}),r.jsx("span",{title:"System health",children:r.jsx(Qpe,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3.5 transition-[border-color] duration-150 hover:border-[var(--color-border-strong)]",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)]",children:"Traffic"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)] mt-1",children:Zo}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-0.5",children:"Recent requests"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3.5 transition-[border-color] duration-150 hover:border-[var(--color-border-strong)]",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)]",children:"Errors"}),r.jsxs("p",{className:"text-xl font-semibold text-[var(--color-fg-default)] mt-1",children:[Ni,jm!==null&&r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[" ","· ",jm,"%"]})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-0.5",children:"4xx/5xx across last logs"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3.5 transition-[border-color] duration-150 hover:border-[var(--color-border-strong)]",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)]",children:"Latency"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)] mt-1",children:Wd!==null?`${Wd} ms`:"-"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-0.5",children:"Avg per recent request"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3.5 transition-[border-color] duration-150 hover:border-[var(--color-border-strong)]",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)]",children:"Logs retention"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)] mt-1",children:Te?P.length===1?"1 log entry":`${P.length} log entries`:"No logs yet"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-0.5",children:Te?`${Op} available`:"Send one request"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[r.jsxs("div",{className:`${Il} space-y-3 lg:col-span-2`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-36 h-24 opacity-[0.18]",children:r.jsx(u0,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:_f,children:"Logs story"}),r.jsx("p",{className:GS,children:"Highlights from recent traffic."})]}),r.jsx(Qf,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),Te?r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-2xs text-[var(--color-fg-faint)]",children:[r.jsx("span",{children:"Latest request"}),r.jsx("span",{children:jf(hr==null?void 0:hr.created_at)})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"shrink-0 rounded px-2 py-1 text-2xs bg-[var(--color-bg-hover)] text-[var(--color-fg-default)] border border-[var(--color-border-default)]",children:hr==null?void 0:hr.method}),r.jsx("span",{className:"font-mono text-[11px] text-[var(--color-fg-secondary)] truncate",children:(hr==null?void 0:hr.path)||"-"}),(hr==null?void 0:hr.status)&&r.jsx("span",{className:`rounded px-2 py-1 text-2xs ${hr.status<400?"bg-[var(--color-semantic-success)]/10 text-[var(--color-semantic-success)]":"bg-[var(--color-semantic-warning)]/10 text-[var(--color-semantic-warning)]"}`,children:hr.status})]}),(hr==null?void 0:hr.project_name)&&r.jsx("p",{className:"mt-1 text-2xs text-[var(--color-fg-faint)]",children:hr.project_name})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-2xs uppercase tracking-wide text-[var(--color-fg-faint)]",children:[r.jsx(GT,{className:"h-4 w-4"}),"Errors"]}),ki?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:"shrink-0 rounded px-2 py-1 text-2xs bg-amber-100 text-amber-700",children:ki.status}),r.jsx("span",{className:"font-mono text-[11px] text-[var(--color-fg-secondary)] truncate",children:ki.path}),r.jsx("span",{className:"shrink-0 text-2xs text-[var(--color-fg-faint)]",children:jf(ki.created_at)})]}),Ln&&r.jsxs("div",{className:"mt-2 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-amber-200",children:Ln.title}),r.jsx("p",{className:"text-2xs text-[var(--color-fg-muted)]",children:Ln.hint}),r.jsx("ul",{className:"text-2xs text-[var(--color-fg-muted)] space-y-1 ml-3 list-disc",children:Ln.steps.map((Je,ft)=>r.jsx("li",{children:Je},ft))}),Ln.exampleCurl&&r.jsx("div",{className:"mt-2",children:r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 text-2xs text-indigo-300 hover:text-indigo-200",onClick:()=>Ka(Ln.exampleCurl,"Corrected curl copied to clipboard."),children:[r.jsx(is,{className:"h-3 w-3"}),"Copy corrected curl"]})}),r.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[Ln.ctaHref&&r.jsx(dt,{className:"text-2xs text-indigo-300 hover:text-indigo-200",to:Ln.ctaHref,children:Ln.ctaLabel||"Fix this"}),Ln.docsUrl&&r.jsx("a",{href:Ln.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-2xs text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)]",children:"View docs"})]})]})]}):r.jsxs("p",{className:"text-2xs text-[var(--color-fg-muted)]",children:["No errors in the last ",P.length," requests."]})]}),Yd&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-2xs text-[var(--color-fg-faint)]",children:[r.jsx("span",{children:"Top path"}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(nv,{className:"h-3.5 w-3.5"}),Yd[1]," hits"]})]}),r.jsx("p",{className:"mt-1 font-mono text-[11px] text-[var(--color-fg-secondary)] break-words",children:Yd[0]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1",children:[r.jsx(dt,{className:"text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:underline transition-colors",to:Et,children:"Open full logs"}),r.jsxs("div",{className:"text-2xs text-[var(--color-fg-faint)]",children:[Zo," requests · ",Ni," errors ·"," ",Wd!==null?`${Wd} ms avg`:"latency unknown"]})]})]}):r.jsxs("div",{className:"space-y-2 rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] p-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"No logs yet. Send a single request to light up telemetry."}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{type:"button",className:yu,onClick:hb,disabled:!z||W==="loading",children:W==="loading"?"Sendingâ¦":"Send test request"}),r.jsx(dt,{className:k_e,to:Et,children:"Open Logs"})]}),q&&r.jsx("p",{className:"text-2xs text-amber-200",children:q})]})]}),r.jsxs("div",{className:`${Il} space-y-3`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-2 -top-1 w-36 h-24 opacity-[0.18]",children:r.jsx(VS,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:_f,children:"Users & sessions"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Recent activity across app users."})]}),r.jsx(ln,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("span",{className:"rounded bg-[var(--color-bg-hover)] px-2 py-1 text-2xs",children:g.length}),r.jsx("span",{className:"text-2xs text-[var(--color-fg-muted)]",children:"recent users"})]}),g.slice(0,3).map(Je=>
773{const ft=Je.last_login_at?`Active ${jf(Je.last_login_at)}`:Je.created_at?`Created ${jf(Je.created_at)}`:"No activity yet";return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] truncate",title:Je.email,children:Je.email}),r.jsxs("p",{className:"text-2xs text-[var(--color-fg-faint)] flex items-center gap-2",children:[r.jsx("span",{className:"inline-flex items-center rounded-full bg-[var(--color-bg-hover)] px-2 py-0.5 text-2xs text-[var(--color-fg-secondary)]",children:Je.status}),ft]})]},Je.id)}),g.length===0&&r.jsx("p",{className:"text-2xs text-[var(--color-fg-faint)]",children:"No users yet. Invite one to create a session."}),r.jsx("div",{className:"pt-1",children:r.jsx(dt,{className:od.ctaDark,to:"/app-users",children:"Manage app users"})})]})]})]}),r.jsxs("section",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:_f,children:"Your backend"}),r.jsx("p",{className:"text-2xs text-[var(--color-fg-faint)]",children:"Quick access to data, users, and logs."})]}),r.jsx(dt,{className:"text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:underline transition-colors",to:Et,children:"See live requests"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:`${Il} min-h-[160px] flex flex-col gap-4`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-20 h-14 opacity-[0.12]",children:r.jsx($g,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-3",children:[r.jsx("span",{className:"h-10 w-10 rounded-xl bg-indigo-100 text-indigo-700 flex items-center justify-center shrink-0",children:r.jsx(Rn,{className:"h-5 w-5"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Collections"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Data Explorer for schemas and data."})]})]}),r.jsx("div",{className:"mt-auto",children:r.jsx(dt,{className:`${yu} w-full justify-center`,to:G?`/data-explorer?projectId=${G.id}`:"/data-explorer",children:"Open Explorer"})})]}),r.jsxs("div",{className:`${Il} min-h-[160px] flex flex-col gap-4`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-20 h-14 opacity-[0.12]",children:r.jsx(HS,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-3",children:[r.jsx("span",{className:"h-10 w-10 rounded-xl bg-[var(--color-semantic-success)]/10 text-[var(--color-semantic-success)] flex items-center justify-center shrink-0",children:r.jsx(Qf,{className:"h-5 w-5"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Logs"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Inspect requests and retention."})]})]}),r.jsx("div",{className:"mt-auto",children:r.jsx(dt,{className:`${Ug} w-full justify-center`,to:Et,children:"View Logs"})})]}),r.jsxs("div",{className:`${Il} min-h-[160px] flex flex-col gap-4`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-20 h-14 opacity-[0.12]",children:r.jsx(VS,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-3",children:[r.jsx("span",{className:"h-10 w-10 rounded-xl bg-sky-100 text-sky-700 flex items-center justify-center shrink-0",children:r.jsx(ln,{className:"h-5 w-5"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"App Users"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Magic links & sessions."})]})]}),r.jsx("div",{className:"mt-auto",children:r.jsx(dt,{className:`${Ug} w-full justify-center`,to:"/app-users",children:"Manage Users"})})]}),r.jsxs("div",{className:`${Il} min-h-[160px] flex flex-col gap-4`,children:[r.jsx("div",{className:"pointer-events-none absolute -right-1 -top-0.5 w-20 h-14 opacity-[0.12]",children:r.jsx(d0,{className:"w-full h-full"})}),r.jsxs("div",{className:"relative z-[1] flex items-start gap-3",children:[r.jsx("span",{className:"h-10 w-10 rounded-xl bg-amber-100 text-amber-700 flex items-center justify-center shrink-0",children:r.jsx(rr,{className:"h-5 w-5"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"LLM Prompts"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Build with AI tools."})]})]}),r.jsx("div",{className:"mt-auto",children:r.jsx(dt,{className:`${Ug} w-full justify-center`,to:G?`/prompts?projectId=${G.id}`:"/prompts",children:"Browse Prompts"})})]})]})]})]})]}),r.jsx(Xz,{open:s.showModal,status:s.status,version:s.onboardingVersion,loading:s.loading,onComplete:mb,onSkip:Lp,onClose:s.closeModal,onSavePartial:s.savePartial})]})}function eb({type:e,message:t,onClose:s,autoClose:n=!0,duration:a=
7735e3}){x.useEffect(()=>{if(n){const c=setTimeout(()=>{s()},a);return()=>clearTimeout(c)}},[n,a,s]);const i=(()=>{switch(e){case"success":return{accentColor:"bg-[var(--color-semantic-success)]",iconColor:"text-[var(--color-semantic-success)]",Icon:Or};case"error":return{accentColor:"bg-[var(--color-semantic-danger)]",iconColor:"text-[var(--color-semantic-danger)]",Icon:Nq};default:return{accentColor:"bg-[var(--color-semantic-info)]",iconColor:"text-[var(--color-semantic-info)]",Icon:kq}}})(),{Icon:l}=i;return r.jsxs("div",{className:"mb-4 relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40 animate-in slide-in-from-top-2 duration-300",children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-1 -top-0.5 w-20 h-14 opacity-[0.1]",viewBox:"0 0 240 120",fill:"none",children:[r.jsx("polygon",{points:"120,0 185,20 120,40 55,20",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"120,45 185,65 120,85 55,65",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"120,90 185,110 120,130 55,110",stroke:"#d4d4c8",strokeWidth:.75})]}),r.jsxs("div",{className:"relative z-[1] flex items-center justify-between px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(l,{className:`h-5 w-5 ${i.iconColor} shrink-0`}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:t})]}),r.jsx("button",{type:"button",onClick:s,className:"rounded-md p-1 text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",children:r.jsx(Ir,{className:"h-4 w-4"})})]})]})}const P_e=["GET","POST","PUT","DELETE","PATCH"],I_e=()=>`legacy-endpoint-${Date.now()}-${Math.random().toString(16).slice(2)}`;function WS(e){const t=typeof(e==null?void 0:e.method)=="string"?e.method.toUpperCase():"GET",s=P_e.includes(t)?t:"GET";return{id:String((e==null?void 0:e.id)??(e==null?void 0:e.endpoint_id)??(e==null?void 0:e.path)??(typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():I_e())),name:(e==null?void 0:e.name)||(e==null?void 0:e.path)||"Custom endpoint",path:(e==null?void 0:e.path)||(e==null?void 0:e.endpoint_path)||"/",method:s,statusCode:(e==null?void 0:e.statusCode)??(e==null?void 0:e.status_code)??200,projectName:(e==null?void 0:e.projectName)??(e==null?void 0:e.project_name),projectSlug:(e==null?void 0:e.projectSlug)??(e==null?void 0:e.project_slug),updatedAt:(e==null?void 0:e.updatedAt)??(e==null?void 0:e.updated_at)}}function M_e(e){if(!e)return[];const t=(e==null?void 0:e.data)??e;if(Array.isArray(t))return t.map(WS);if(t!=null&&t.standalone||t!=null&&t.projects){const s=[];return Array.isArray(t.standalone)&&s.push(...t.standalone.map(WS)),t.projects&&typeof t.projects=="object"&&Object.values(t.projects).forEach(n=>{Array.isArray(n==null?void 0:n.endpoints)&&s.push(...n.endpoints.map(WS))}),s}return[]}function O_e(){const{getToken:e}=zt(),[t,s]=x.useState([]),[n,a]=x.useState(!0),[o,i]=x.useState(null),[l,c]=x.useState(null);return x.useEffect(()=>{(async()=>{var f;try{a(!0),i(null);const h=await Ue(e),g=await Rq.getEndpoints(h?{authToken:h}:void 0),v=M_e(g.data);s(v)}catch(h){console.error("Failed to load custom endpoints",h);const g=h instanceof yt?((f=h.data)==null?void 0:f.message)||h.message:"Could not load custom endpoints.";i(g),c({type:"error",message:g})}finally{a(!1)}})()},[e]),r.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-10",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsxs("p",{className:"text-[11px] uppercase tracking-[0.18em] text-amber-400 flex items-center gap-2",children:[r.jsx(GT,{className:"h-4 w-4"}),"Legacy Feature"]}),r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Legacy Feature: Custom Endpoints"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-3xl",children:"Custom Endpoints were part of the original ReqRes mock-API system. For new backends, we recommend using Collections and App Users. This section remains available for backwards compatibility."})]}),r.jsxs("div",{className:`${Mt.dark} rounded-2xl border border-amber-300/30 bg-amber-500/5 p-6 space-y-4`,children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Legacy notice"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"We no longer recommend creating custom endpoints for new apps. Collections give you real data storage, auth-scoped CRUD, logs, and automation triggers without defining ad-hoc routes."})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)] text-sm",children:"Recommended"}),r.jsx("p",{children:"Use Collections + App Users for everything: schema, auth, per-user data, logs."})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)] text-sm",children:"Still need mocks?"}),r.jsx("p",{children:"Use this legacy area only if you must keep existing mock endpoints alive."})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(dt,{className:Jt.primaryEmphasis,to:"/documentation?section=collections",children:"Learn about Collections"}),r.jsx(dt,{className:Jt.secondaryEmphasis,to:"/data-explorer",children:"Open Data Explorer"})]})]}),r.jsxs("div",{className:`${Mt.dark} rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6`,children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] mb-3",children:"Need to maintain existing custom endpoints? New creation is disabled by default to keep experiences consistent. You can inspect what remains below; contact us to migrate them to Collections."}),n&&r.jsx("div",{className:"py-6",children:r.jsx(bs,{text:"Loading legacy endpointsâ¦"})}),o&&r.jsx("div",{className:"text-xs text-[var(--color-semantic-danger)]",children:o}),!n&&!o&&r.jsx(r.Fragment,{children:t.length===0?r.jsx("div",{className:"text-sm text-[var(--color-fg-muted)]",children:"No legacy custom endpoints detected for your account."}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Existing endpoints are read-only. Migrate them to Collections for full support."}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:t.map(u=>r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 space-y-2",children:[(()=>{const f=u.path||"",h=f.replace(/^\/?api\/custom\/?/i,"").replace(/^\/*|\/*$/g,""),g=h?`/api/custom/${h}`:f||"/api/custom";return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-[var(--color-bg-card)] px-2 py-1 text-[11px] text-[var(--color-fg-default)] border border-[var(--color-border-default)]",children:[r.jsx("span",{className:"rounded px-2 py-0.5 bg-indigo-500/20 text-indigo-100 border border-indigo-400/40",children:u.method}),r.jsx("span",{className:"font-mono text-[11px] text-[var(--color-fg-default)] truncate",children:g})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:u.statusCode?`${u.statusCode}`:""})]})})(),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:u.name}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:u.projectName||u.projectSlug?`Project: ${u.projectName||u.projectSlug}`:"Standalone endpoint"}),u.updatedAt&&r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Updated ",new Date(u.updatedAt).toLocaleStr
773ing()]})]})]},u.id))})]})})]})]}),l&&r.jsx("div",{className:"mt-4",children:r.jsx(eb,{type:l.type,message:l.message,onClose:()=>c(null)})})]})}function cs(...e){return xq(rv(e))}function id({className:e,type:t,...s}){return r.jsx("input",{type:t,"data-slot":"input",className:cs("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}function Lt(e,t,{checkForDefaultPrevented:s=!0}={}){return function(a){if(e==null||e(a),s===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function L_e(e,t){const s=x.createContext(t),n=o=>{const{children:i,...l}=o,c=x.useMemo(()=>l,Object.values(l));return r.jsx(s.Provider,{value:c,children:i})};n.displayName=e+"Provider";function a(o){const i=x.useContext(s);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,a]}function bo(e,t=[]){let s=[];function n(o,i){const l=x.createContext(i),c=s.length;s=[...s,i];const u=h=>{var w;const{scope:g,children:v,...y}=h,_=((w=g==null?void 0:g[e])==null?void 0:w[c])||l,j=x.useMemo(()=>y,Object.values(y));return r.jsx(_.Provider,{value:j,children:v})};u.displayName=o+"Provider";function f(h,g){var _;const v=((_=g==null?void 0:g[e])==null?void 0:_[c])||l,y=x.useContext(v);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,f]}const a=()=>{const o=s.map(i=>x.createContext(i));return function(l){const c=(l==null?void 0:l[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,D_e(a,...t)]}function D_e(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(o)[`__scope${u}`];return{...l,...h}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return s.scopeName=t.scopeName,s}function $_e(e){const t=U_e(e),s=x.forwardRef((n,a)=>{const{children:o,...i}=n,l=x.Children.toArray(o),c=l.find(B_e);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function U_e(e){const t=x.forwardRef((s,n)=>{const{children:a,...o}=s;if(x.isValidElement(a)){const i=z_e(a),l=q_e(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var F_e=Symbol("radix.slottable");function B_e(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===F_e}function q_e(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function z_e(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var H_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fs=H_e.reduce((e,t)=>{const s=$_e(`Primitive.${t}`),n=x.forwardRef((a,o)=>{const{asChild:i,...l}=a,c=i?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function HH(e,t){e&&Xh.flushSync(()=>
773e.dispatchEvent(t))}function ol(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...s)=>{var n;return(n=t.current)==null?void 0:n.call(t,...s)},[])}function V_e(e,t=globalThis==null?void 0:globalThis.document){const s=ol(e);x.useEffect(()=>{const n=a=>{a.key==="Escape"&&s(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[s,t])}var G_e="DismissableLayer",JE="dismissableLayer.update",W_e="dismissableLayer.pointerDownOutside",Y_e="dismissableLayer.focusOutside",ID,VH=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),tb=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:l,...c}=e,u=x.useContext(VH),[f,h]=x.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=x.useState({}),y=Vs(t,R=>h(R)),_=Array.from(u.layers),[j]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=_.indexOf(j),k=f?_.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,E=k>=w,T=X_e(R=>{const I=R.target,L=[...u.branches].some(M=>M.contains(I));!E||L||(a==null||a(R),i==null||i(R),R.defaultPrevented||l==null||l())},g),A=Q_e(R=>{const I=R.target;[...u.branches].some(M=>M.contains(I))||(o==null||o(R),i==null||i(R),R.defaultPrevented||l==null||l())},g);return V_e(R=>{k===u.layers.size-1&&(n==null||n(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},g),x.useEffect(()=>{if(f)return s&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ID=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),MD(),()=>{s&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ID)}},[f,g,s,u]),x.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),MD())},[f,u]),x.useEffect(()=>{const R=()=>v({});return document.addEventListener(JE,R),()=>document.removeEventListener(JE,R)},[]),r.jsx(fs.div,{...c,ref:y,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:Lt(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Lt(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Lt(e.onPointerDownCapture,T.onPointerDownCapture)})});tb.displayName=G_e;var K_e="DismissableLayerBranch",J_e=x.forwardRef((e,t)=>{const s=x.useContext(VH),n=x.useRef(null),a=Vs(t,n);return x.useEffect(()=>{const o=n.current;if(o)return s.branches.add(o),()=>{s.branches.delete(o)}},[s.branches]),r.jsx(fs.div,{...e,ref:a})});J_e.displayName=K_e;function X_e(e,t=globalThis==null?void 0:globalThis.document){const s=ol(e),n=x.useRef(!1),a=x.useRef(()=>{});return x.useEffect(()=>{const o=l=>{if(l.target&&!n.current){let c=function(){GH(W_e,s,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,s]),{onPointerDownCapture:()=>n.current=!0}}function Q_e(e,t=globalThis==null?void 0:globalThis.document){const s=ol(e),n=x.useRef(!1);return x.useEffect(()=>{const a=o=>{o.target&&!n.current&&GH(Y_e,s,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,s]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function MD(){const e=new CustomEvent(JE);document.dispatchEvent(e)}function GH(e,t,s,{discrete:n}){const a=s.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&a.addEventListener(e,t,{once:!0}),n?HH(a,o):a.dispatchEvent(o)}var Vn=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},Z_e=D5[" useId ".trim().toString()]||(()=>{}),eje=0;function po(e){const[t,s]=x.useState(Z_e());return Vn(()=>{s(n=>n??String(eje++))},[e]),t?`radix-${t}`:""}const tje=["top","right","bottom","left"],Ad=Math.min,io=Math.max,jj=Math.round,p0=Math.floor,el=e=>({x:e,y:e}
773),sje={left:"right",right:"left",bottom:"top",top:"bottom"},rje={start:"end",end:"start"};function XE(e,t,s){return io(e,Ad(t,s))}function pc(e,t){return typeof e=="function"?e(t):e}function fc(e){return e.split("-")[0]}function lm(e){return e.split("-")[1]}function NR(e){return e==="x"?"y":"x"}function kR(e){return e==="y"?"height":"width"}const nje=new Set(["top","bottom"]);function Ji(e){return nje.has(fc(e))?"y":"x"}function SR(e){return NR(Ji(e))}function aje(e,t,s){s===void 0&&(s=!1);const n=lm(e),a=SR(e),o=kR(a);let i=a==="x"?n===(s?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=wj(i)),[i,wj(i)]}function oje(e){const t=wj(e);return[QE(e),t,QE(t)]}function QE(e){return e.replace(/start|end/g,t=>rje[t])}const OD=["left","right"],LD=["right","left"],ije=["top","bottom"],lje=["bottom","top"];function cje(e,t,s){switch(e){case"top":case"bottom":return s?t?LD:OD:t?OD:LD;case"left":case"right":return t?ije:lje;default:return[]}}function dje(e,t,s,n){const a=lm(e);let o=cje(fc(e),s==="start",n);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(QE)))),o}function wj(e){return e.replace(/left|right|bottom|top/g,t=>sje[t])}function uje(e){return{top:0,right:0,bottom:0,left:0,...e}}function WH(e){return typeof e!="number"?uje(e):{top:e,right:e,bottom:e,left:e}}function Nj(e){const{x:t,y:s,width:n,height:a}=e;return{width:n,height:a,top:s,left:t,right:t+n,bottom:s+a,x:t,y:s}}function DD(e,t,s){let{reference:n,floating:a}=e;const o=Ji(t),i=SR(t),l=kR(i),c=fc(t),u=o==="y",f=n.x+n.width/2-a.width/2,h=n.y+n.height/2-a.height/2,g=n[l]/2-a[l]/2;let v;switch(c){case"top":v={x:f,y:n.y-a.height};break;case"bottom":v={x:f,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:h};break;case"left":v={x:n.x-a.width,y:h};break;default:v={x:n.x,y:n.y}}switch(lm(t)){case"start":v[i]-=g*(s&&u?-1:1);break;case"end":v[i]+=g*(s&&u?-1:1);break}return v}const pje=async(e,t,s)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=s,l=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:h}=DD(u,n,c),g=n,v={},y=0;for(let _=0;_<l.length;_++){const{name:j,fn:w}=l[_],{x:k,y:S,data:E,reset:T}=await w({x:f,y:h,initialPlacement:n,placement:g,strategy:a,middlewareData:v,rects:u,platform:i,elements:{reference:e,floating:t}});f=k??f,h=S??h,v={...v,[j]:{...v[j],...E}},T&&y<=50&&(y++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(u=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:f,y:h}=DD(u,g,c)),_=-1)}return{x:f,y:h,placement:g,strategy:a,middlewareData:v}};async function vv(e,t){var s;t===void 0&&(t={});const{x:n,y:a,platform:o,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=pc(t,e),y=WH(v),j=l[g?h==="floating"?"reference":"floating":h],w=Nj(await o.getClippingRect({element:(s=await(o.isElement==null?void 0:o.isElement(j)))==null||s?j:j.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:f,strategy:c})),k=h==="floating"?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),E=await(o.isElement==null?void 0:o.isElement(S))?await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1}:{x:1,y:1},T=Nj(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:S,strategy:c}):k);return{top:(w.top-T.top+y.top)/E.y,bottom:(T.bottom-w.bottom+y.bottom)/E.y,left:(w.left-T.left+y.left)/E.x,right:(T.right-w.right+y.right)/E.x}}const fje=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:n,placement:a,rects:o,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:f=0}=pc(e,t)||{};if(u==null)return{};const h=WH(f),g={x:s,y:n},v=SR(a),y=kR(v),_=await i.getDimensions(u),j=v==="y",w=j?"top":"left",k=j?"bottom":"right",S=j?"clientHeight":"clientWidth",E=o.reference[y]+o.reference[v]-g[v]-o.floating[y],T=g[v]-o.reference[v],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let R=A?A[S]:0;(!R||!await(i.isElement==null?void 0:i.isElement(A)))&&(R=l.floating[S]||o.floating[y]);const I=E/2-T/2,L=R/2-_[y]/2-1,M=Ad(h[w],L),O=Ad(h[k],L),z=M,X=R-_[y]-O,W=R/2-_[y]/2+I,K=XE(z,W,X),q=!c.arrow&&lm(a)!=null&&W!==K&&o.reference[y]/2-(W<z?M:O)-_[y]/2<0,J=q?W<z?W-z:W-X:0;return{[v]:g[v]+J,data:{[v]:K,centerOffset:W-K-J,...q&&{alignmentOffset:J}},reset:q}}}),hje=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:_=!0,...j}=pc(e,t);if((s=o.arrow)!=null&&s.alignmentOffset)return{};const w=fc(a),k=Ji(l),S=fc(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(u.floating)),T=g||(S||!_?[wj(l)]:oje(l)),A=y!=="none";!g&&A&&T.push(...dje(l,_,y,E));const R=[l,...T],I=await vv(t,j),L=[];let M=((n=o.flip)==null?void 0:n.overflows)||[];if(f&&L.push(I[w]),h){const W=aje(a,i,E);L.push(I[W[0]],I[W[1]])}if(M=[...M,{placement:a,overflows:L}],!L.every(W=>W<=0)){var O,z;const W=(((O=o.flip)==null?void 0:O.index)||0)+1,K=R[W];if(K&&(!(h==="alignment"?k!==Ji(K):!1)||M.every(F=>Ji(F.placement)===k?F.overflows[0]>0:!0)))return{data:{index:W,overflows:M},reset:{placement:K}
773};let q=(z=M.filter(J=>J.overflows[0]<=0).sort((J,F)=>J.overflows[1]-F.overflows[1])[0])==null?void 0:z.placement;if(!q)switch(v){case"bestFit":{var X;const J=(X=M.filter(F=>{if(A){const V=Ji(F.placement);return V===k||V==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(V=>V>0).reduce((V,$)=>V+$,0)]).sort((F,V)=>F[1]-V[1])[0])==null?void 0:X[0];J&&(q=J);break}case"initialPlacement":q=l;break}if(a!==q)return{reset:{placement:q}}}return{}}}};function $D(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function UD(e){return tje.some(t=>e[t]>=0)}const mje=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s}=t,{strategy:n="referenceHidden",...a}=pc(e,t);switch(n){case"referenceHidden":{const o=await vv(t,{...a,elementContext:"reference"}),i=$D(o,s.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:UD(i)}}}case"escaped":{const o=await vv(t,{...a,altBoundary:!0}),i=$D(o,s.floating);return{data:{escapedOffsets:i,escaped:UD(i)}}}default:return{}}}}},YH=new Set(["left","top"]);async function gje(e,t){const{placement:s,platform:n,elements:a}=e,o=await(n.isRTL==null?void 0:n.isRTL(a.floating)),i=fc(s),l=lm(s),c=Ji(s)==="y",u=YH.has(i)?-1:1,f=o&&c?-1:1,h=pc(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(v=l==="end"?y*-1:y),c?{x:v*f,y:g*u}:{x:g*u,y:v*f}}const xje=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,n;const{x:a,y:o,placement:i,middlewareData:l}=t,c=await gje(t,e);return i===((s=l.offset)==null?void 0:s.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},vje=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:j=>{let{x:w,y:k}=j;return{x:w,y:k}}},...c}=pc(e,t),u={x:s,y:n},f=await vv(t,c),h=Ji(fc(a)),g=NR(h);let v=u[g],y=u[h];if(o){const j=g==="y"?"top":"left",w=g==="y"?"bottom":"right",k=v+f[j],S=v-f[w];v=XE(k,v,S)}if(i){const j=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=y+f[j],S=y-f[w];y=XE(k,y,S)}const _=l.fn({...t,[g]:v,[h]:y});return{..._,data:{x:_.x-s,y:_.y-n,enabled:{[g]:o,[h]:i}}}}}},bje=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=pc(e,t),f={x:s,y:n},h=Ji(a),g=NR(h);let v=f[g],y=f[h];const _=pc(l,t),j=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const S=g==="y"?"height":"width",E=o.reference[g]-o.floating[S]+j.mainAxis,T=o.reference[g]+o.reference[S]-j.mainAxis;v<E?v=E:v>T&&(v=T)}if(u){var w,k;const S=g==="y"?"width":"height",E=YH.has(fc(a)),T=o.reference[h]-o.floating[S]+(E&&((w=i.offset)==null?void 0:w[h])||0)+(E?0:j.crossAxis),A=o.reference[h]+o.reference[S]+(E?0:((k=i.offset)==null?void 0:k[h])||0)-(E?j.crossAxis:0);y<T?y=T:y>A&&(y=A)}return{[g]:v,[h]:y}}}},yje=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,n;const{placement:a,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...u}=pc(e,t),f=await vv(t,u),h=fc(a),g=lm(a),v=Ji(a)==="y",{width:y,height:_}=o.floating;let j,w;h==="top"||h==="bottom"?(j=h,w=g===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=h,j=g==="end"?"top":"bottom");const k=_-f.top-f.bottom,S=y-f.left-f.right,E=Ad(_-f[j],k),T=Ad(y-f[w],S),A=!t.middlewareData.shift;let R=E,I=T;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(I=S),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(R=k),A&&!g){const M=io(f.left,0),O=io(f.right,0),z=io(f.top,0),X=io(f.bottom,0);v?I=y-2*(M!==0||O!==0?M+O:io(f.left,f.right)):R=_-2*(z!==0||X!==0?z+X:io(f.top,f.bottom))}await c({...t,availableWidth:I,availableHeight:R});const L=await i.getDimensions(l.floating);return y!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function Dw(){return typeof window<"u"}function cm(e){return KH(e)?(e.nodeName||"").toLowerCase():"#document"}function fo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cl(e){var t;return(t=(KH(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function KH(e){return Dw()?e instanceof Node||e instanceof fo(e).Node:!1}function mi(e){return Dw()?e instanceof Element||e instanceof fo(e).Element:!1}function il(e){return Dw()?e instanceof HTMLElement||e instanceof fo(e).HTMLElement:!1}function FD(e){return!Dw()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof fo(e).ShadowRoot}const _je=new Set(["inline","contents"]);
773function sb(e){const{overflow:t,overflowX:s,overflowY:n,display:a}=gi(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+s)&&!_je.has(a)}const jje=new Set(["table","td","th"]);function wje(e){return jje.has(cm(e))}const Nje=[":popover-open",":modal"];function $w(e){return Nje.some(t=>{try{return e.matches(t)}catch{return!1}})}const kje=["transform","translate","scale","rotate","perspective"],Sje=["transform","translate","scale","rotate","perspective","filter"],Cje=["paint","layout","strict","content"];function CR(e){const t=ER(),s=mi(e)?gi(e):e;return kje.some(n=>s[n]?s[n]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!t&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!t&&(s.filter?s.filter!=="none":!1)||Sje.some(n=>(s.willChange||"").includes(n))||Cje.some(n=>(s.contain||"").includes(n))}function Eje(e){let t=Pd(e);for(;il(t)&&!Eh(t);){if(CR(t))return t;if($w(t))return null;t=Pd(t)}return null}function ER(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Tje=new Set(["html","body","#document"]);function Eh(e){return Tje.has(cm(e))}function gi(e){return fo(e).getComputedStyle(e)}function Uw(e){return mi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pd(e){if(cm(e)==="html")return e;const t=e.assignedSlot||e.parentNode||FD(e)&&e.host||cl(e);return FD(t)?t.host:t}function JH(e){const t=Pd(e);return Eh(t)?e.ownerDocument?e.ownerDocument.body:e.body:il(t)&&sb(t)?t:JH(t)}function bv(e,t,s){var n;t===void 0&&(t=[]),s===void 0&&(s=!0);const a=JH(e),o=a===((n=e.ownerDocument)==null?void 0:n.body),i=fo(a);if(o){const l=ZE(i);return t.concat(i,i.visualViewport||[],sb(a)?a:[],l&&s?bv(l):[])}return t.concat(a,bv(a,[],s))}function ZE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function XH(e){const t=gi(e);let s=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=il(e),o=a?e.offsetWidth:s,i=a?e.offsetHeight:n,l=jj(s)!==o||jj(n)!==i;return l&&(s=o,n=i),{width:s,height:n,$:l}}function TR(e){return mi(e)?e:e.contextElement}function rh(e){const t=TR(e);if(!il(t))return el(1);const s=t.getBoundingClientRect(),{width:n,height:a,$:o}=XH(t);let i=(o?jj(s.width):s.width)/n,l=(o?jj(s.height):s.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Rje=el(0);function QH(e){const t=fo(e);return!ER()||!t.visualViewport?Rje:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Aje(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==fo(e)?!1:t}function hp(e,t,s,n){t===void 0&&(t=!1),s===void 0&&(s=!1);const a=e.getBoundingClientRect(),o=TR(e);let i=el(1);t&&(n?mi(n)&&(i=rh(n)):i=rh(e));const l=Aje(o,s,n)?QH(o):el(0);let c=(a.left+l.x)/i.x,u=(a.top+l.y)/i.y,f=a.width/i.x,h=a.height/i.y;if(o){const g=fo(o),v=n&&mi(n)?fo(n):n;let y=g,_=ZE(y);for(;_&&n&&v!==y;){const j=rh(_),w=_.getBoundingClientRect(),k=gi(_),S=w.left+(_.clientLeft+parseFloat(k.paddingLeft))*j.x,E=w.top+(_.clientTop+parseFloat(k.paddingTop))*j.y;c*=j.x,u*=j.y,f*=j.x,h*=j.y,c+=S,u+=E,y=fo(_),_=ZE(y)}}return Nj({width:f,height:h,x:c,y:u})}function Fw(e,t){const s=Uw(e).scrollLeft;return t?t.left+s:hp(cl(e)).left+s}function ZH(e,t){const s=e.getBoundingClientRect(),n=s.left+t.scrollLeft-Fw(e,s),a=s.top+t.scrollTop;return{x:n,y:a}}function Pje(e){let{elements:t,rect:s,offsetParent:n,strategy:a}=e;const o=a==="fixed",i=cl(n),l=t?$w(t.floating):!1;if(n===i||l&&o)return s;let c={scrollLeft:0,scrollTop:0},u=el(1);const f=el(0),h=il(n);if((h||!h&&!o)&&((cm(n)!=="body"||sb(i))&&(c=Uw(n)),il(n))){const v=hp(n);u=rh(n),f.x=v.x+n.clientLeft,f.y=v.y+n.clientTop}const g=i&&!h&&!o?ZH(i,c):el(0);return{width:s.width*u.x,height:s.height*u.y,x:s.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:s.y*u.y-c.scrollTop*u.y+f.y+g.y}}function Ije(e){return Array.from(e.getClientRects())}function Mje(e){const t=cl(e),s=Uw(e),n=e.ownerDocument.body,a=io(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=io(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-s.scrollLeft+Fw(e);const l=-s.scrollTop;return gi(n).direction==="rtl"&&(i+=io(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:l}}const BD=25;
773function Oje(e,t){const s=fo(e),n=cl(e),a=s.visualViewport;let o=n.clientWidth,i=n.clientHeight,l=0,c=0;if(a){o=a.width,i=a.height;const f=ER();(!f||f&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const u=Fw(n);if(u<=0){const f=n.ownerDocument,h=f.body,g=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(n.clientWidth-h.clientWidth-v);y<=BD&&(o-=y)}else u<=BD&&(o+=u);return{width:o,height:i,x:l,y:c}}const Lje=new Set(["absolute","fixed"]);function Dje(e,t){const s=hp(e,!0,t==="fixed"),n=s.top+e.clientTop,a=s.left+e.clientLeft,o=il(e)?rh(e):el(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,u=n*o.y;return{width:i,height:l,x:c,y:u}}function qD(e,t,s){let n;if(t==="viewport")n=Oje(e,s);else if(t==="document")n=Mje(cl(e));else if(mi(t))n=Dje(t,s);else{const a=QH(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Nj(n)}function e9(e,t){const s=Pd(e);return s===t||!mi(s)||Eh(s)?!1:gi(s).position==="fixed"||e9(s,t)}function $je(e,t){const s=t.get(e);if(s)return s;let n=bv(e,[],!1).filter(l=>mi(l)&&cm(l)!=="body"),a=null;const o=gi(e).position==="fixed";let i=o?Pd(e):e;for(;mi(i)&&!Eh(i);){const l=gi(i),c=CR(i);!c&&l.position==="fixed"&&(a=null),(o?!c&&!a:!c&&l.position==="static"&&!!a&&Lje.has(a.position)||sb(i)&&!c&&e9(e,i))?n=n.filter(f=>f!==i):a=l,i=Pd(i)}return t.set(e,n),n}function Uje(e){let{element:t,boundary:s,rootBoundary:n,strategy:a}=e;const i=[...s==="clippingAncestors"?$w(t)?[]:$je(t,this._c):[].concat(s),n],l=i[0],c=i.reduce((u,f)=>{const h=qD(t,f,a);return u.top=io(h.top,u.top),u.right=Ad(h.right,u.right),u.bottom=Ad(h.bottom,u.bottom),u.left=io(h.left,u.left),u},qD(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Fje(e){const{width:t,height:s}=XH(e);return{width:t,height:s}}function Bje(e,t,s){const n=il(t),a=cl(t),o=s==="fixed",i=hp(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=el(0);function u(){c.x=Fw(a)}if(n||!n&&!o)if((cm(t)!=="body"||sb(a))&&(l=Uw(t)),n){const v=hp(t,!0,o,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else a&&u();o&&!n&&a&&u();const f=a&&!n&&!o?ZH(a,l):el(0),h=i.left+l.scrollLeft-c.x-f.x,g=i.top+l.scrollTop-c.y-f.y;return{x:h,y:g,width:i.width,height:i.height}}function YS(e){return gi(e).position==="static"}function zD(e,t){if(!il(e)||gi(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return cl(e)===s&&(s=s.ownerDocument.body),s}function t9(e,t){const s=fo(e);if($w(e))return s;if(!il(e)){let a=Pd(e);for(;a&&!Eh(a);){if(mi(a)&&!YS(a))return a;a=Pd(a)}return s}let n=zD(e,t);for(;n&&wje(n)&&YS(n);)n=zD(n,t);return n&&Eh(n)&&YS(n)&&!CR(n)?s:n||Eje(e)||s}const qje=async function(e){const t=this.getOffsetParent||t9,s=this.getDimensions,n=await s(e.floating);return{reference:Bje(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function zje(e){return gi(e).direction==="rtl"}const Hje={convertOffsetParentRelativeRectToViewportRelativeRect:Pje,getDocumentElement:cl,getClippingRect:Uje,getOffsetParent:t9,getElementRects:qje,getClientRects:Ije,getDimensions:Fje,getScale:rh,isElement:mi,isRTL:zje};function s9(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vje(e,t){let s=null,n;const a=cl(e);function o(){var l;clearTimeout(n),(l=s)==null||l.disconnect(),s=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:f,top:h,width:g,height:v}=u;if(l||t(),!g||!v)return;const y=p0(h),_=p0(a.clientWidth-(f+g)),j=p0(a.clientHeight-(h+v)),w=p0(f),S={rootMargin:-y+"px "+-_+"px "+-j+"px "+-w+"px",threshold:io(0,Ad(1,c))||1};let E=!0;function T(A){const R=A[0].intersectionRatio;if(R!==c){if(!E)return i();R?i(!1,R):n=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!s9(u,e.getBoundingClientRect())&&i(),E=!1}try{s=new IntersectionObserver(T,{...S,root:a.ownerDocument})}catch{s=new IntersectionObserver(T,S)}s.observe(e)}return i(!0),o}function Gje(e,t,s,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=TR(e),f=a||o?[...u?bv(u):[],...bv(t)]:[];f.forEach(w=>{a&&w.addEventListener("scroll",s,{passive:!0}),o&&w.addEventListener("resize",s)});const h=u&&l?Vje(u,s):null;let g=-1,v=null;i&&(v=new ResizeObserver(w=>{let[k]=w;k&&k.target===u&&v&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var S;(S=v)==null||S.observe(t)})),s()}),u&&!c&&v.observe(u),v.observe(t));let y,_=c?hp(e):null;c&&j();function j(){const w=hp(e);_&&!s9(_,w)&&s(),_=w,y=requestAnimationFrame(j)}return s(),()=>{var w;f.forEach(k=>{a&&k.removeEventListener("scroll",s),o&&k.removeEventListener("resize",s)}),h==null||h(),(w=v)==null||w.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const Wje=xje,Yje=vje,Kje=hje,Jje=yje,Xje=mje,HD=fje,Qje=bje,Zje=(e,t,s)=>{const n=new Map,a={platform:Hje,...s},o={...a.platform,_c:n};return pje(e,t,{...a,platform:o})};var ewe=typeof document<"u",twe=function(){},b_=ewe?x.useLayoutEffect:twe;function kj(e,t){if(e===t)return!0;
773if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(n=s;n--!==0;)if(!kj(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),s=a.length,s!==Object.keys(t).length)return!1;for(n=s;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=s;n--!==0;){const o=a[n];if(!(o==="_owner"&&e.$$typeof)&&!kj(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function r9(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VD(e,t){const s=r9(e);return Math.round(t*s)/s}function KS(e){const t=x.useRef(e);return b_(()=>{t.current=e}),t}function swe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[f,h]=x.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=x.useState(n);kj(g,n)||v(n);const[y,_]=x.useState(null),[j,w]=x.useState(null),k=x.useCallback(F=>{F!==A.current&&(A.current=F,_(F))},[]),S=x.useCallback(F=>{F!==R.current&&(R.current=F,w(F))},[]),E=o||y,T=i||j,A=x.useRef(null),R=x.useRef(null),I=x.useRef(f),L=c!=null,M=KS(c),O=KS(a),z=KS(u),X=x.useCallback(()=>{if(!A.current||!R.current)return;const F={placement:t,strategy:s,middleware:g};O.current&&(F.platform=O.current),Zje(A.current,R.current,F).then(V=>{const $={...V,isPositioned:z.current!==!1};W.current&&!kj(I.current,$)&&(I.current=$,Xh.flushSync(()=>{h($)}))})},[g,t,s,O,z]);b_(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[u]);const W=x.useRef(!1);b_(()=>(W.current=!0,()=>{W.current=!1}),[]),b_(()=>{if(E&&(A.current=E),T&&(R.current=T),E&&T){if(M.current)return M.current(E,T,X);X()}},[E,T,X,M,L]);const K=x.useMemo(()=>({reference:A,floating:R,setReference:k,setFloating:S}),[k,S]),q=x.useMemo(()=>({reference:E,floating:T}),[E,T]),J=x.useMemo(()=>{const F={position:s,left:0,top:0};if(!q.floating)return F;const V=VD(q.floating,f.x),$=VD(q.floating,f.y);return l?{...F,transform:"translate("+V+"px, "+$+"px)",...r9(q.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:V,top:$}},[s,l,q.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:X,refs:K,elements:q,floatingStyles:J}),[f,X,K,q,J])}const rwe=e=>{function t(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:e,fn(s){const{element:n,padding:a}=typeof e=="function"?e(s):e;return n&&t(n)?n.current!=null?HD({element:n.current,padding:a}).fn(s):{}:n?HD({element:n,padding:a}).fn(s):{}}}},nwe=(e,t)=>({...Wje(e),options:[e,t]}),awe=(e,t)=>({...Yje(e),options:[e,t]}),owe=(e,t)=>({...Qje(e),options:[e,t]}),iwe=(e,t)=>({...Kje(e),options:[e,t]}),lwe=(e,t)=>({...Jje(e),options:[e,t]}),cwe=(e,t)=>({...Xje(e),options:[e,t]}),dwe=(e,t)=>({...rwe(e),options:[e,t]});var uwe="Arrow",n9=x.forwardRef((e,t)=>{const{children:s,width:n=10,height:a=5,...o}=e;return r.jsx(fs.svg,{...o,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?s:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});n9.displayName=uwe;var pwe=n9;function fwe(e){const[t,s]=x.useState(void 0);return Vn(()=>{if(e){s({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let i,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;s({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else s(void 0)},[e]),t}var RR="Popper",[a9,dm]=bo(RR),[hwe,o9]=a9(RR),i9=e=>{const{__scopePopper:t,children:s}=e,[n,a]=x.useState(null);return r.jsx(hwe,{scope:t,anchor:n,onAnchorChange:a,children:s})};i9.displayName=RR;var l9="PopperAnchor",c9=x.forwardRef((e,t)=>{const{__scopePopper:s,virtualRef:n,...a}=e,o=o9(l9,s),i=x.useRef(null),l=Vs(t,i),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=(n==null?void 0:n.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),n?null:r.jsx(fs.div,{...a,ref:l})});c9.displayName=l9;var AR="PopperContent",[mwe,gwe]=a9(AR),d9=x.forwardRef((e,t)=>
773{var Q,le,Se,we,Le,xe;const{__scopePopper:s,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:y,..._}=e,j=o9(AR,s),[w,k]=x.useState(null),S=Vs(t,de=>k(de)),[E,T]=x.useState(null),A=fwe(E),R=(A==null?void 0:A.width)??0,I=(A==null?void 0:A.height)??0,L=n+(o!=="center"?"-"+o:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},O=Array.isArray(u)?u:[u],z=O.length>0,X={padding:M,boundary:O.filter(vwe),altBoundary:z},{refs:W,floatingStyles:K,placement:q,isPositioned:J,middlewareData:F}=swe({strategy:"fixed",placement:L,whileElementsMounted:(...de)=>Gje(...de,{animationFrame:v==="always"}),elements:{reference:j.anchor},middleware:[nwe({mainAxis:a+I,alignmentAxis:i}),c&&awe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?owe():void 0,...X}),c&&iwe({...X}),lwe({...X,apply:({elements:de,rects:Me,availableWidth:je,availableHeight:Ae})=>{const{width:Oe,height:Ke}=Me.reference,ut=de.floating.style;ut.setProperty("--radix-popper-available-width",`${je}px`),ut.setProperty("--radix-popper-available-height",`${Ae}px`),ut.setProperty("--radix-popper-anchor-width",`${Oe}px`),ut.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),E&&dwe({element:E,padding:l}),bwe({arrowWidth:R,arrowHeight:I}),g&&cwe({strategy:"referenceHidden",...X})]}),[V,$]=f9(q),B=ol(y);Vn(()=>{J&&(B==null||B())},[J,B]);const ae=(Q=F.arrow)==null?void 0:Q.x,H=(le=F.arrow)==null?void 0:le.y,U=((Se=F.arrow)==null?void 0:Se.centerOffset)!==0,[oe,fe]=x.useState();return Vn(()=>{w&&fe(window.getComputedStyle(w).zIndex)},[w]),r.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:J?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(we=F.transformOrigin)==null?void 0:we.x,(Le=F.transformOrigin)==null?void 0:Le.y].join(" "),...((xe=F.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(mwe,{scope:s,placedSide:V,onArrowChange:T,arrowX:ae,arrowY:H,shouldHideArrow:U,children:r.jsx(fs.div,{"data-side":V,"data-align":$,..._,ref:S,style:{..._.style,animation:J?void 0:"none"}})})})});d9.displayName=AR;var u9="PopperArrow",xwe={top:"bottom",right:"left",bottom:"top",left:"right"},p9=x.forwardRef(function(t,s){const{__scopePopper:n,...a}=t,o=gwe(u9,n),i=xwe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(pwe,{...a,ref:s,style:{...a.style,display:"block"}})})});p9.displayName=u9;function vwe(e){return e!==null}var bwe=e=>({name:"transformOrigin",options:e,fn(t){var j,w,k;const{placement:s,rects:n,middlewareData:a}=t,i=((j=a.arrow)==null?void 0:j.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=f9(s),h={start:"0%",center:"50%",end:"100%"}[f],g=(((w=a.arrow)==null?void 0:w.x)??0)+l/2,v=(((k=a.arrow)==null?void 0:k.y)??0)+c/2;let y="",_="";return u==="bottom"?(y=i?h:`${g}px`,_=`${-c}px`):u==="top"?(y=i?h:`${g}px`,_=`${n.floating.height+c}px`):u==="right"?(y=`${-c}px`,_=i?h:`${v}px`):u==="left"&&(y=`${n.floating.width+c}px`,_=i?h:`${v}px`),{data:{x:y,y:_}}}});function f9(e){const[t,s="center"]=e.split("-");return[t,s]}var PR=i9,IR=c9,MR=d9,OR=p9,ywe="Portal",rb=x.forwardRef((e,t)=>{var l;const{container:s,...n}=e,[a,o]=x.useState(!1);Vn(()=>o(!0),[]);const i=s||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?MB.createPortal(r.jsx(fs.div,{...n,ref:t}),i):null});rb.displayName=ywe;function _we(e,t){return x.useReducer((s,n)=>t[s][n]??s,e)}var Xo=e=>{const{present:t,children:s}=e,n=jwe(t),a=typeof s=="function"?s({present:n.isPresent}):x.Children.only(s),o=Vs(n.ref,wwe(a));return typeof s=="function"||n.isPresent?x.cloneElement(a,{ref:o}):null};Xo.displayName="Presence";function jwe(e){const[t,s]=x.useState(),n=x.useRef(null),a=x.useRef(e),o=x.useRef("none"),i=e?"mounted":"unmounted",[l,c]=_we(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=f0(n.current);o.current=l==="mounted"?u:"none"},[l]),Vn(()=>{const u=n.current,f=a.current;if(f!==e){const g=o.current,v=f0(u);e?c("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Vn(()=>
773{if(t){let u;const f=t.ownerDocument.defaultView??window,h=v=>{const _=f0(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&_&&(c("ANIMATION_END"),!a.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},g=v=>{v.target===t&&(o.current=f0(n.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{n.current=u?getComputedStyle(u):null,s(u)},[])}}function f0(e){return(e==null?void 0:e.animationName)||"none"}function wwe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var Nwe=Symbol("radix.slottable");function kwe(e){const t=({children:s})=>r.jsx(r.Fragment,{children:s});return t.displayName=`${e}.Slottable`,t.__radixId=Nwe,t}var Swe=D5[" useInsertionEffect ".trim().toString()]||Vn;function go({prop:e,defaultProp:t,onChange:s=()=>{},caller:n}){const[a,o,i]=Cwe({defaultProp:t,onChange:s}),l=e!==void 0,c=l?e:a;{const f=x.useRef(e!==void 0);x.useEffect(()=>{const h=f.current;h!==l&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,n])}const u=x.useCallback(f=>{var h;if(l){const g=Ewe(f)?f(e):f;g!==e&&((h=i.current)==null||h.call(i,g))}else o(f)},[l,e,o,i]);return[c,u]}function Cwe({defaultProp:e,onChange:t}){const[s,n]=x.useState(e),a=x.useRef(s),o=x.useRef(t);return Swe(()=>{o.current=t},[t]),x.useEffect(()=>{var i;a.current!==s&&((i=o.current)==null||i.call(o,s),a.current=s)},[s,a]),[s,n,o]}function Ewe(e){return typeof e=="function"}var h9=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"}),Twe="VisuallyHidden",m9=x.forwardRef((e,t)=>r.jsx(fs.span,{...e,ref:t,style:{...h9,...e.style}}));m9.displayName=Twe;var Rwe=m9,[Bw,MOe]=bo("Tooltip",[dm]),qw=dm(),g9="TooltipProvider",Awe=700,e5="tooltip.open",[Pwe,LR]=Bw(g9),x9=e=>{const{__scopeTooltip:t,delayDuration:s=Awe,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=e,i=x.useRef(!0),l=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),r.jsx(Pwe,{scope:t,isOpenDelayedRef:i,delayDuration:s,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(u=>{l.current=u},[]),disableHoverableContent:a,children:o})};x9.displayName=g9;var yv="Tooltip",[Iwe,nb]=Bw(yv),v9=e=>{const{__scopeTooltip:t,children:s,open:n,defaultOpen:a,onOpenChange:o,disableHoverableContent:i,delayDuration:l}=e,c=LR(yv,e.__scopeTooltip),u=qw(t),[f,h]=x.useState(null),g=po(),v=x.useRef(0),y=i??c.disableHoverableContent,_=l??c.delayDuration,j=x.useRef(!1),[w,k]=go({prop:n,defaultProp:a??!1,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(e5))):c.onClose(),o==null||o(R)},caller:yv}),S=x.useMemo(()=>w?j.current?"delayed-open":"instant-open":"closed",[w]),E=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,j.current=!1,k(!0)},[k]),T=x.useCallback(()=>{window.clearTimeout(v.current),v.current=0,k(!1)},[k]),A=x.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{j.current=!0,k(!0),v.current=0},_)},[_,k]);return x.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),r.jsx(PR,{...u,children:r.jsx(Iwe,{scope:t,contentId:g,open:w,stateAttribute:S,trigger:f,onTriggerChange:h,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?A():E()},[c.isOpenDelayedRef,A,E]),onTriggerLeave:x.useCallback(()=>{y?T():(window.clearTimeout(v.current),v.current=0)},[T,y]),onOpen:E,onClose:T,disableHoverableContent:y,children:s})})};v9.displayName=yv;var t5="TooltipTrigger",b9=x.forwardRef((e,t)=>
773{const{__scopeTooltip:s,...n}=e,a=nb(t5,s),o=LR(t5,s),i=qw(s),l=x.useRef(null),c=Vs(t,l,a.onTriggerChange),u=x.useRef(!1),f=x.useRef(!1),h=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),r.jsx(IR,{asChild:!0,...i,children:r.jsx(fs.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:Lt(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),f.current=!0)}),onPointerLeave:Lt(e.onPointerLeave,()=>{a.onTriggerLeave(),f.current=!1}),onPointerDown:Lt(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Lt(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:Lt(e.onBlur,a.onClose),onClick:Lt(e.onClick,a.onClose)})})});b9.displayName=t5;var DR="TooltipPortal",[Mwe,Owe]=Bw(DR,{forceMount:void 0}),y9=e=>{const{__scopeTooltip:t,forceMount:s,children:n,container:a}=e,o=nb(DR,t);return r.jsx(Mwe,{scope:t,forceMount:s,children:r.jsx(Xo,{present:s||o.open,children:r.jsx(rb,{asChild:!0,container:a,children:n})})})};y9.displayName=DR;var Th="TooltipContent",_9=x.forwardRef((e,t)=>{const s=Owe(Th,e.__scopeTooltip),{forceMount:n=s.forceMount,side:a="top",...o}=e,i=nb(Th,e.__scopeTooltip);return r.jsx(Xo,{present:n||i.open,children:i.disableHoverableContent?r.jsx(j9,{side:a,...o,ref:t}):r.jsx(Lwe,{side:a,...o,ref:t})})}),Lwe=x.forwardRef((e,t)=>{const s=nb(Th,e.__scopeTooltip),n=LR(Th,e.__scopeTooltip),a=x.useRef(null),o=Vs(t,a),[i,l]=x.useState(null),{trigger:c,onClose:u}=s,f=a.current,{onPointerInTransitChange:h}=n,g=x.useCallback(()=>{l(null),h(!1)},[h]),v=x.useCallback((y,_)=>{const j=y.currentTarget,w={x:y.clientX,y:y.clientY},k=Bwe(w,j.getBoundingClientRect()),S=qwe(w,k),E=zwe(_.getBoundingClientRect()),T=Vwe([...S,...E]);l(T),h(!0)},[h]);return x.useEffect(()=>()=>g(),[g]),x.useEffect(()=>{if(c&&f){const y=j=>v(j,f),_=j=>v(j,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",_)}
773}},[c,f,v,g]),x.useEffect(()=>{if(i){const y=_=>{const j=_.target,w={x:_.clientX,y:_.clientY},k=(c==null?void 0:c.contains(j))||(f==null?void 0:f.contains(j)),S=!Hwe(w,i);k?g():S&&(g(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,i,u,g]),r.jsx(j9,{...e,ref:o})}),[Dwe,$we]=Bw(yv,{isInside:!1}),Uwe=kwe("TooltipContent"),j9=x.forwardRef((e,t)=>{const{__scopeTooltip:s,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:i,...l}=e,c=nb(Th,s),u=qw(s),{onClose:f}=c;return x.useEffect(()=>(document.addEventListener(e5,f),()=>document.removeEventListener(e5,f)),[f]),x.useEffect(()=>{if(c.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),r.jsx(tb,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:r.jsxs(MR,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[r.jsx(Uwe,{children:n}),r.jsx(Dwe,{scope:s,isInside:!0,children:r.jsx(Rwe,{id:c.contentId,role:"tooltip",children:a||n})})]})})});_9.displayName=Th;var w9="TooltipArrow",Fwe=x.forwardRef((e,t)=>{const{__scopeTooltip:s,...n}=e,a=qw(s);return $we(w9,s).isInside?null:r.jsx(OR,{...a,...n,ref:t})});Fwe.displayName=w9;function Bwe(e,t){const s=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(s,n,a,o)){case o:return"left";case a:return"right";case s:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function qwe(e,t,s=5){const n=[];switch(t){case"top":n.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":n.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":n.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":n.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s});break}return n}function zwe(e){const{top:t,right:s,bottom:n,left:a}=e;return[{x:a,y:t},{x:s,y:t},{x:s,y:n},{x:a,y:n}]}function Hwe(e,t){const{x:s,y:n}=e;let a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const l=t[o],c=t[i],u=l.x,f=l.y,h=c.x,g=c.y;f>n!=g>n&&s<(h-u)*(n-f)/(g-f)+u&&(a=!a)}return a}function Vwe(e){const t=e.slice();return t.sort((s,n)=>s.x<n.x?-1:s.x>n.x?1:s.y<n.y?-1:s.y>n.y?1:0),Gwe(t)}function Gwe(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const s=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;s.length>=2;){const o=s[s.length-1],i=s[s.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))s.pop();else break}s.push(a)}return s.pop(),t.length===1&&s.length===1&&t[0].x===s[0].x&&t[0].y===s[0].y?t:t.concat(s)}var Wwe=x9,Ywe=v9,Kwe=b9,Jwe=y9,N9=_9;const $R=Wwe,k9=Ywe,S9=Kwe,UR=x.forwardRef(({className:e,sideOffset:t=4,...s},n)=>r.jsx(Jwe,{children:r.jsx(N9,{ref:n,sideOffset:t,className:cs("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 origin-[--radix-tooltip-content-transform-origin]",e),...s})}));UR.displayName=N9.displayName;const FR=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:s,className:cs("w-full caption-bottom text-sm",e),...t})}));FR.displayName="Table";const BR=x.forwardRef(({className:e,...t},s)=>r.jsx("thead",{ref:s,className:cs("[&_tr]:border-b",e),...t}));BR.displayName="TableHeader";const qR=x.forwardRef(({className:e,...t},s)=>r.jsx("tbody",{ref:s,className:cs("[&_tr:last-child]:border-0",e),...t}));qR.displayName="TableBody";const Xwe=x.forwardRef(({className:e,...t},s)=>r.jsx("tfoot",{ref:s,className:cs("bg-slate-900/50 font-medium text-slate-50",e),...t}));Xwe.displayName="TableFooter";const nh=x.forwardRef(({className:e,...t},s)=>r.jsx("tr",{ref:s,className:cs("border-b border-slate-800/70 transition-colors hover:bg-slate-900/30 data-[state=selected]:bg-slate-900/50",e),...t}));nh.displayName="TableRow";const zl=x.forwardRef(({className:e,...t},s)=>r.jsx("th",{ref:s,className:cs("px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-400",e),...t}));zl.displayName="TableHead";const qi=x.forwardRef(({className:e,...t},s)=>r.jsx("td",{ref:s,className:cs("px-4 py-3 align-middle text-sm text-slate-100",e),...t}));qi.displayName="TableCell";const Qwe=x.forwardRef(({className:e,...t},s)=>
773r.jsx("caption",{ref:s,className:cs("mt-4 text-sm text-slate-500",e),...t}));Qwe.displayName="TableCaption";function GD(e,[t,s]){return Math.min(s,Math.max(t,e))}function WD(e){const t=Zwe(e),s=x.forwardRef((n,a)=>{const{children:o,...i}=n,l=x.Children.toArray(o),c=l.find(t1e);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function Zwe(e){const t=x.forwardRef((s,n)=>{const{children:a,...o}=s;if(x.isValidElement(a)){const i=r1e(a),l=s1e(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var e1e=Symbol("radix.slottable");function t1e(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===e1e}function s1e(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function r1e(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}function zw(e){const t=e+"CollectionProvider",[s,n]=bo(t),[a,o]=s(t,{collectionRef:{current:null},itemMap:new Map}),i=_=>{const{scope:j,children:w}=_,k=pe.useRef(null),S=pe.useRef(new Map).current;return r.jsx(a,{scope:j,itemMap:S,collectionRef:k,children:w})};i.displayName=t;const l=e+"CollectionSlot",c=WD(l),u=pe.forwardRef((_,j)=>{const{scope:w,children:k}=_,S=o(l,w),E=Vs(j,S.collectionRef);return r.jsx(c,{ref:E,children:k})});u.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=WD(f),v=pe.forwardRef((_,j)=>{const{scope:w,children:k,...S}=_,E=pe.useRef(null),T=Vs(j,E),A=o(f,w);return pe.useEffect(()=>(A.itemMap.set(E,{ref:E,...S}),()=>void A.itemMap.delete(E))),r.jsx(g,{[h]:"",ref:T,children:k})});v.displayName=f;function y(_){const j=o(e+"CollectionConsumer",_);return pe.useCallback(()=>{const k=j.collectionRef.current;if(!k)return[];const S=Array.from(k.querySelectorAll(`[${h}]`));return Array.from(j.itemMap.values()).sort((A,R)=>S.indexOf(A.ref.current)-S.indexOf(R.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:i,Slot:u,ItemSlot:v},y,n]}var n1e=x.createContext(void 0);function um(e){const t=x.useContext(n1e);return e||t||"ltr"}var JS=0;function zR(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??YD()),document.body.insertAdjacentElement("beforeend",e[1]??YD()),JS++,()=>{JS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),JS--}},[])}function YD(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var XS="focusScope.autoFocusOnMount",QS="focusScope.autoFocusOnUnmount",KD={bubbles:!1,cancelable:!0},a1e="FocusScope",Hw=x.forwardRef((e,t)=>{const{loop:s=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[l,c]=x.useState(null),u=ol(a),f=ol(o),h=x.useRef(null),g=Vs(t,_=>c(_)),v=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(n){let _=function(S){if(v.paused||!l)return;const E=S.target;l.contains(E)?h.current=E:Qc(h.current,{select:!0})},j=function(S){if(v.paused||!l)return;const E=S.relatedTarget;E!==null&&(l.contains(E)||Qc(h.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const T of S)T.removedNodes.length>0&&Qc(l)};document.addEventListener("focusin",_),document.addEventListener("focusout",j);const k=new MutationObserver(w);return l&&k.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",j),k.disconnect()}}},[n,l,v.paused]),x.useEffect(()=>{if(l){XD.add(v);const _=document.activeElement;if(!l.contains(_)){const w=new CustomEvent(XS,KD);l.addEventListener(XS,u),l.dispatchEvent(w),w.defaultPrevented||(o1e(u1e(C9(l)),{select:!0}),document.activeElement===_&&Qc(l))}return()=>{l.removeEventListener(XS,u),setTimeout(()=>{const w=new CustomEvent(QS,KD);l.addEventListener(QS,f),l.dispatchEvent(w),w.defaultPrevented||Qc(_??document.body,{select:!0}),l.removeEventListener(QS,f),XD.remove(v)},0)}}},[l,u,f,v]);const y=x.useCallback(_=>{if(!s&&!n||v.paused)return;const j=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,w=document.activeElement;if(j&&w){const k=_.currentTarget,[S,E]=i1e(k);S&&E?!_.shiftKey&&w===E?(_.preventDefault(),s&&Qc(S,{select:!0})):_.shiftKey&&w===S&&(_.preventDefault(),s&&Qc(E,{select:!0})):w===k&&_.preventDefault()}},[s,n,v.paused]);return r.jsx(fs.div,{tabIndex:-1,...i,ref:g,onKeyDown:y})});Hw.displayName=a1e;function o1e(e,{select:t=!1}={}){const s=document.activeElement;for(const n of e)if(Qc(n,{select:t}),document.activeElement!==s)return}function i1e(e){const t=C9(e),s=JD(t,e),n=JD(t.reverse(),e);return[s,n]}function C9(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function JD(e,t){for(const s of e)if(!l1e(s,{upTo:t}))return s}function l1e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c1e(e){return e instanceof HTMLInputElement&&"select"in e}function Qc(e,{select:t=!1}={}){if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&c1e(e)&&t&&e.select()}}var XD=d1e();function d1e(){let e=[];return{add(t){const s=e[0];t!==s&&(s==null||s.pause()),e=QD(e,t),e.unshift(t)},remove(t){var s;e=QD(e,t),(s=e[0])==null||s.resume()}}}function QD(e,t){const s=[...e],n=s.indexOf(t);return n!==-1&&s.splice(n,1),s}function u1e(e){return e.filter(t=>t.tagName!=="A")}function p1e(e){const t=f1e(e),s=x.forwardRef((n,a)=>{const{children:o,...i}=n,l=x.Children.toArray(o),c=l.find(m1e);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function f1e(e){const t=x.forwardRef((s,n)=>{const{children:a,...o}=s;
773if(x.isValidElement(a)){const i=x1e(a),l=g1e(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var h1e=Symbol("radix.slottable");function m1e(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===h1e}function g1e(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function x1e(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}function v1e(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var b1e=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},wf=new WeakMap,h0=new WeakMap,m0={},ZS=0,E9=function(e){return e&&(e.host||E9(e.parentNode))},y1e=function(e,t){return t.map(function(s){if(e.contains(s))return s;var n=E9(s);return n&&e.contains(n)?n:(console.error("aria-hidden",s,"in not contained inside",e,". Doing nothing"),null)}).filter(function(s){return!!s})},_1e=function(e,t,s,n){var a=y1e(t,Array.isArray(e)?e:[e]);m0[s]||(m0[s]=new WeakMap);var o=m0[s],i=[],l=new Set,c=new Set(a),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};a.forEach(u);var f=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))f(g);else try{var v=g.getAttribute(n),y=v!==null&&v!=="false",_=(wf.get(g)||0)+1,j=(o.get(g)||0)+1;wf.set(g,_),o.set(g,j),i.push(g),_===1&&y&&h0.set(g,!0),j===1&&g.setAttribute(s,"true"),y||g.setAttribute(n,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return f(t),l.clear(),ZS++,function(){i.forEach(function(h){var g=wf.get(h)-1,v=o.get(h)-1;wf.set(h,g),o.set(h,v),g||(h0.has(h)||h.removeAttribute(n),h0.delete(h)),v||h.removeAttribute(s)}),ZS--,ZS||(wf=new WeakMap,wf=new WeakMap,h0=new WeakMap,m0={})}},HR=function(e,t,s){s===void 0&&(s="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=b1e(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),_1e(n,a,s,"aria-hidden")):function(){return null}},Hi=function(){return Hi=Object.assign||function(t){for(var s,n=1,a=arguments.length;n<a;n++){s=arguments[n];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(t[o]=s[o])}return t},Hi.apply(this,arguments)};function T9(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(s[n[a]]=e[n[a]]);return s}function j1e(e,t,s){if(s||arguments.length===2)for(var n=0,a=t.length,o;n<a;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var y_="right-scroll-bar-position",__="width-before-scroll-bar",w1e="with-scroll-bars-hidden",N1e="--removed-body-scroll-bar-size";function e2(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function k1e(e,t){var s=x.useState(function(){return{value:e,callback:t,facade:{get current(){return s.value},set current(n){var a=s.value;a!==n&&(s.value=n,s.callback(n,a))}}}})[0];return s.callback=t,s.facade}var S1e=typeof window<"u"?x.useLayoutEffect:x.useEffect,ZD=new WeakMap;function C1e(e,t){var s=k1e(null,function(n){return e.forEach(function(a){return e2(a,n)})});return S1e(function(){var n=ZD.get(s);if(n){var a=new Set(n),o=new Set(e),i=s.current;a.forEach(function(l){o.has(l)||e2(l,null)}),o.forEach(function(l){a.has(l)||e2(l,i)})}ZD.set(s,e)},[e]),s}function E1e(e){return e}function T1e(e,t){t===void 0&&(t=E1e);var s=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:e},useMedium:function(o){var i=t(o,n);return s.push(i),function(){s=s.filter(function(l){return l!==i})}},assignSyncMedium:function(o){for(n=!0;s.length;){var i=s;
vendor: 10,039 bytes, lines 773-813
773s=[],i.forEach(o)}s={push:function(l){return o(l)},filter:function(){return s}}},assignMedium:function(o){n=!0;var i=[];if(s.length){var l=s;s=[],l.forEach(o),i=s}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),s={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),s}}}};return a}function R1e(e){e===void 0&&(e={});var t=T1e(null);return t.options=Hi({async:!0,ssr:!1},e),t}var R9=function(e){var t=e.sideCar,s=T9(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return x.createElement(n,Hi({},s))};R9.isSideCarExport=!0;function A1e(e,t){return e.useMedium(t),R9}var A9=R1e(),t2=function(){},Vw=x.forwardRef(function(e,t){var s=x.useRef(null),n=x.useState({onScrollCapture:t2,onWheelCapture:t2,onTouchMoveCapture:t2}),a=n[0],o=n[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,h=e.shards,g=e.sideCar,v=e.noRelative,y=e.noIsolation,_=e.inert,j=e.allowPinchZoom,w=e.as,k=w===void 0?"div":w,S=e.gapMode,E=T9(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=g,A=C1e([s,t]),R=Hi(Hi({},E),a);return x.createElement(x.Fragment,null,f&&x.createElement(T,{sideCar:A9,removeScrollBar:u,shards:h,noRelative:v,noIsolation:y,inert:_,setCallbacks:o,allowPinchZoom:!!j,lockRef:s,gapMode:S}),i?x.cloneElement(x.Children.only(l),Hi(Hi({},R),{ref:A})):x.createElement(k,Hi({},R,{className:c,ref:A}),l))});Vw.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Vw.classNames={fullWidth:__,zeroRight:y_};var P1e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function I1e(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=P1e();return t&&e.setAttribute("nonce",t),e}function M1e(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function O1e(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var L1e=function(){var e=0,t=null;return{add:function(s){e==0&&(t=I1e())&&(M1e(t,s),O1e(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},D1e=function(){var e=L1e();return function(t,s){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&s])}},P9=function(){var e=D1e(),t=function(s){var n=s.styles,a=s.dynamic;return e(n,a),null};return t},$1e={left:0,top:0,right:0,gap:0},s2=function(e){return parseInt(e||"",10)||0},U1e=function(e){var t=window.getComputedStyle(document.body),s=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[s2(s),s2(n),s2(a)]},F1e=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $1e;var t=U1e(e),s=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-s+t[2]-t[0])}},B1e=P9(),ah="data-scroll-locked",q1e=function(e,t,s,n){var a=e.left,o=e.top,i=e.right,l=e.gap;return s===void 0&&(s="margin"),` 774 .`.concat(w1e,` { 775 overflow: hidden `).concat(n,`; 776 padding-right: `).concat(l,"px ").concat(n,`; 777 } 778 body[`).concat(ah,`] { 779 overflow: hidden `).concat(n,`; 780 overscroll-behavior: contain; 781 `).concat([t&&"position: relative ".concat(n,";"),s==="margin"&&` 782 padding-left: `.concat(a,`px; 783 padding-top: `).concat(o,`px; 784 padding-right: `).concat(i,`px; 785 margin-left:0; 786 margin-top:0; 787 margin-right: `).concat(l,"px ").concat(n,`; 788 `),s==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),` 789 } 790 791 .`).concat(y_,` { 792 right: `).concat(l,"px ").concat(n,`; 793 } 794 795 .`).concat(__,` { 796 margin-right: `).concat(l,"px ").concat(n,`; 797 } 798 799 .`).concat(y_," .").concat(y_,` { 800 right: 0 `).concat(n,`; 801 } 802 803 .`).concat(__," .").concat(__,` { 804 margin-right: 0 `).concat(n,`; 805 } 806 807 body[`).concat(ah,`] { 808 `).concat(N1e,": ").concat(l,`px; 809 } 810`)},e$=function(){var e=parseInt(document.body.getAttribute(ah)||"0",10);return isFinite(e)?e:0},z1e=function(){x.useEffect(function(){return document.body.setAttribute(ah,(e$()+1).toString()),function(){var e=e$()-1;e<=0?document.body.removeAttribute(ah):document.body.setAttribute(ah,e.toString())}},[])},H1e=function(e){var t=e.noRelative,s=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;z1e();var o=x.useMemo(function(){return F1e(a)},[a]);return x.createElement(B1e,{styles:q1e(o,!t,a,s?"":"!important")})},s5=!1;if(typeof window<"u")try{var g0=Object.defineProperty({},"passive",{get:function(){return s5=!0,!0}});window.addEventListener("test",g0,g0),window.removeEventListener("test",g0,g0)}catch{s5=!1}var Nf=s5?{passive:!1}:!1,V1e=function(e){return e.tagName==="TEXTAREA"},I9=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!V1e(e)&&s[t]==="visible")},G1e=function(e){return I9(e,"overflowY")},W1e=function(e){return I9(e,"overflowX")},t$=function(e,t){var s=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=M9(e,n);if(a){var o=O9(e,n),i=o[1],l=o[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==s.body);return!1},Y1e=function(e){var t=e.scrollTop,s=e.scrollHeight,n=e.clientHeight;return[t,s,n]},K1e=function(e){var t=e.scrollLeft,s=e.scrollWidth,n=e.clientWidth;return[t,s,n]},M9=function(e,t){return e==="v"?G1e(t):W1e(t)},O9=function(e,t){return e==="v"?Y1e(t):K1e(t)},J1e=function(e,t){return e==="h"&&t==="rtl"?-1:1},X1e=function(e,t,s,n,a){var o=J1e(e,window.getComputedStyle(t).direction),i=o*n,l=s.target,c=t.contains(l),u=!1,f=i>0,h=0,g=0;do{if(!l)break;var v=O9(e,l),y=v[0],_=v[1],j=v[2],w=_-j-o*y;(y||w)&&M9(e,l)&&(h+=w,g+=y);var k=l.parentNode;l=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(h)<1||!f&&Math.abs(g)<1)&&(u=!0),u},x0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},s$=function(e){return[e.deltaX,e.deltaY]},r$=function(e){return e&&"current"in e?e.current:e},Q1e=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Z1e=function(e){return` 811 .block-interactivity-`.concat(e,` {pointer-events: none;} 812 .allow-interactivity-`).concat(e,` {pointer-events: all;} 813`)},eNe=0,kf=[];function tNe(e){var t=x.useRef([]),s=x.useRef([0,0]),n=x.useRef(),a=x.useState(eNe++)[0],o=x.useState(P9)[0],i=x.useRef(e);x.useEffect(function(){i.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var _=j1e([e.lockRef.current],(e.shards||[]).map(r$),!0).filter(Boolean);return _.forEach(function(j){return j.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),_.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(_,j){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!i.current.allowPinchZoom;var w=x0(_),k=s.current,S="deltaX"in _?_.deltaX:k[0]-w[0],E="deltaY"in _?_.deltaY:k[1]-w[1],T,A=_.target,R=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in _&&R==="h"&&A.type==="range")return!1;var I=window.getSelection(),L=I&&I.anchorNode,M=L?L===A||L.contains(A):!1;if(M)return!1;var O=t$(R,A);if(!O)return!0;if(O?T=R:(T=R==="v"?"h":"v",O=t$(R,A)),!O)return!1;if(!n.current&&"changedTouches"in _&&(S||E)&&(n.current=T),!T)return!0;var z=n.current||T;return X1e(z,j,_,z==="h"?S:E)},[]),c=x.useCallback(function(_){var j=_;if(!(!kf.length||kf[kf.length-1]!==o)){var w="deltaY"in j?s$(j):x0(j),k=t.current.filter(function(T){return T.name===j.type&&(T.target===j.target||j.target===T.shadowParent)&&Q1e(T.delta,w)})[0];if(k&&k.should){j.cancelable&&j.preventDefault();return}if(!k){var S=(i.current.shards||[]).map(r$).filter(Boolean).filter(function(T){return T.contains(j.target)}),E=S.length>0?l(j,S[0]):!i.current.noIsolation;E&&j.cancelable&&j.preventDefault()}}},[]),u=x.useCallback(function(_,j,w,k){var S={name:_,delta:j,target:w,should:k,shadowParent:sNe(w)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),f=x.useCallback(function(_){s.current=x0(_),n.current=void 0},[]),h=x.useCallback(function(_){u(_.type,s$(_),_.target,l(_,e.lockRef.current))},[]),g=x.useCallback(function(_){u(_.type,x0(_),_.target,l(_,e.lockRef.current))},[]);x.useEffect(function(){return kf.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Nf),document.addEventListener("touchmove",c,Nf),document.addEventListener("touchstart",f,Nf),function(){kf=kf.filter(function(_){return _!==o}),document.removeEventListener("wheel",c,Nf),document.removeEventListener("touchmove",c,Nf),document.removeEventListener("touchstart",f,Nf)}},[]);var v=e.removeScrollBar,y=e.inert;return x.createElement(x.Fragment,null,y?x.createElement(o,{styles:Z1e(a)}):null,v?x.createElement(H1e,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sNe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rNe=A1e(A9,tNe);var Gw=x.forwardRef(function(e,t){return x.createElement(Vw,Hi({},e,{ref:t,sideCar:rNe}))});Gw.classNames=Vw.classNames;var nNe=[" ","Enter","ArrowUp","ArrowDown"],aNe=[" ","Enter"],mp="Select",[Ww,Yw,oNe]=zw(mp),[pm,OOe]=bo(mp,[oNe,dm]),Kw=dm(),[iNe,Bd]=pm(mp),[lNe,cNe]=pm(mp),L9=e=>{const{__scopeSelect:t,children:s,open:n,defaultOpen:a,onOpenChange:o,value:i,defaultValue:l,onValueChange:c,dir:u,name:f,autoComplete:h,disabled:g,required:v,form:y}=e,_=Kw(t),[j,w]=x.useState(null),[k,S]=x.useState(null),[E,T]=x.useState(!1),A=um(u),[R,I]=go({prop:n,defaultProp:a??!1,onChange:o,caller:mp}),[L,M]=go({prop:i,defaultProp:l,onChange:c,caller:mp}
813),O=x.useRef(null),z=j?y||!!j.closest("form"):!0,[X,W]=x.useState(new Set),K=Array.from(X).map(q=>q.props.value).join(";");return r.jsx(PR,{..._,children:r.jsxs(iNe,{required:v,scope:t,trigger:j,onTriggerChange:w,valueNode:k,onValueNodeChange:S,valueNodeHasChildren:E,onValueNodeHasChildrenChange:T,contentId:po(),value:L,onValueChange:M,open:R,onOpenChange:I,dir:A,triggerPointerDownPosRef:O,disabled:g,children:[r.jsx(Ww.Provider,{scope:t,children:r.jsx(lNe,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(q=>{W(J=>new Set(J).add(q))},[]),onNativeOptionRemove:x.useCallback(q=>{W(J=>{const F=new Set(J);return F.delete(q),F})},[]),children:s})}),z?r.jsxs(oV,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:h,value:L,onChange:q=>M(q.target.value),disabled:g,form:y,children:[L===void 0?r.jsx("option",{value:""}):null,Array.from(X)]},K):null]})})};L9.displayName=mp;var D9="SelectTrigger",$9=x.forwardRef((e,t)=>{const{__scopeSelect:s,disabled:n=!1,...a}=e,o=Kw(s),i=Bd(D9,s),l=i.disabled||n,c=Vs(t,i.onTriggerChange),u=Yw(s),f=x.useRef("touch"),[h,g,v]=lV(_=>{const j=u().filter(S=>!S.disabled),w=j.find(S=>S.value===i.value),k=cV(j,_,w);k!==void 0&&i.onValueChange(k.value)}),y=_=>{l||(i.onOpenChange(!0),v()),_&&(i.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return r.jsx(IR,{asChild:!0,...o,children:r.jsx(fs.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":iV(i.value)?"":void 0,...a,ref:c,onClick:Lt(a.onClick,_=>{_.currentTarget.focus(),f.current!=="mouse"&&y(_)}),onPointerDown:Lt(a.onPointerDown,_=>{f.current=_.pointerType;const j=_.target;j.hasPointerCapture(_.pointerId)&&j.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(y(_),_.preventDefault())}),onKeyDown:Lt(a.onKeyDown,_=>{const j=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&g(_.key),!(j&&_.key===" ")&&nNe.includes(_.key)&&(y(),_.preventDefault())})})})});$9.displayName=D9;var U9="SelectValue",F9=x.forwardRef((e,t)=>{const{__scopeSelect:s,className:n,style:a,children:o,placeholder:i="",...l}=e,c=Bd(U9,s),{onValueNodeHasChildrenChange:u}=c,f=o!==void 0,h=Vs(t,c.onValueNodeChange);return Vn(()=>{u(f)},[u,f]),r.jsx(fs.span,{...l,ref:h,style:{pointerEvents:"none"},children:iV(c.value)?r.jsx(r.Fragment,{children:i}):o})});F9.displayName=U9;var dNe="SelectIcon",B9=x.forwardRef((e,t)=>{const{__scopeSelect:s,children:n,...a}=e;return r.jsx(fs.span,{"aria-hidden":!0,...a,ref:t,children:n||"â¼"})});B9.displayName=dNe;var uNe="SelectPortal",q9=e=>r.jsx(rb,{asChild:!0,...e});q9.displayName=uNe;var gp="SelectContent",z9=x.forwardRef((e,t)=>{const s=Bd(gp,e.__scopeSelect),[n,a]=x.useState();if(Vn(()=>{a(new DocumentFragment)},[]),!s.open){const o=n;return o?Xh.createPortal(r.jsx(H9,{scope:e.__scopeSelect,children:r.jsx(Ww.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(V9,{...e,ref:t})});z9.displayName=gp;var ai=10,[H9,qd]=pm(gp),pNe="SelectContentImpl",fNe=p1e("SelectContent.RemoveScroll"),V9=x.forwardRef((e,t)=>{const{__scopeSelect:s,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:_,avoidCollisions:j,...w}=e,k=Bd(gp,s),[S,E]=x.useState(null),[T,A]=x.useState(null),R=Vs(t,Q=>E(Q)),[I,L]=x.useState(null),[M,O]=x.useState(null),z=Yw(s),[X,W]=x.use
813State(!1),K=x.useRef(!1);x.useEffect(()=>{if(S)return HR(S)},[S]),zR();const q=x.useCallback(Q=>{const[le,...Se]=z().map(xe=>xe.ref.current),[we]=Se.slice(-1),Le=document.activeElement;for(const xe of Q)if(xe===Le||(xe==null||xe.scrollIntoView({block:"nearest"}),xe===le&&T&&(T.scrollTop=0),xe===we&&T&&(T.scrollTop=T.scrollHeight),xe==null||xe.focus(),document.activeElement!==Le))return},[z,T]),J=x.useCallback(()=>q([I,S]),[q,I,S]);x.useEffect(()=>{X&&J()},[X,J]);const{onOpenChange:F,triggerPointerDownPosRef:V}=k;x.useEffect(()=>{if(S){let Q={x:0,y:0};const le=we=>{var Le,xe;Q={x:Math.abs(Math.round(we.pageX)-(((Le=V.current)==null?void 0:Le.x)??0)),y:Math.abs(Math.round(we.pageY)-(((xe=V.current)==null?void 0:xe.y)??0))}},Se=we=>{Q.x<=10&&Q.y<=10?we.preventDefault():S.contains(we.target)||F(!1),document.removeEventListener("pointermove",le),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",Se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",Se,{capture:!0})}}},[S,F,V]),x.useEffect(()=>{const Q=()=>F(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[F]);const[$,B]=lV(Q=>{const le=z().filter(Le=>!Le.disabled),Se=le.find(Le=>Le.ref.current===document.activeElement),we=cV(le,Q,Se);we&&setTimeout(()=>we.ref.current.focus())}),ae=x.useCallback((Q,le,Se)=>{const we=!K.current&&!Se;(k.value!==void 0&&k.value===le||we)&&(L(Q),we&&(K.current=!0))},[k.value]),H=x.useCallback(()=>S==null?void 0:S.focus(),[S]),U=x.useCallback((Q,le,Se)=>{const we=!K.current&&!Se;(k.value!==void 0&&k.value===le||we)&&O(Q)},[k.value]),oe=n==="popper"?r5:G9,fe=oe===r5?{side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:_,avoidCollisions:j}:{};return r.jsx(H9,{scope:s,content:S,viewport:T,onViewportChange:A,itemRefCallback:ae,selectedItem:I,onItemLeave:H,itemTextRefCallback:U,focusSelectedItem:J,selectedItemText:M,position:n,isPositioned:X,searchRef:$,children:r.jsx(Gw,{as:fNe,allowPinchZoom:!0,children:r.jsx(Hw,{asChild:!0,trapped:k.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:Lt(a,Q=>{var le;(le=k.trigger)==null||le.focus({preventScroll:!0}),Q.preventDefault()}),children:r.jsx(tb,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>k.onOpenChange(!1),children:r.jsx(oe,{role:"listbox",id:k.contentId,"data-state":k.open?"open":"closed",dir:k.dir,onContextMenu:Q=>Q.preventDefault(),...w,...fe,onPlaced:()=>W(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Lt(w.onKeyDown,Q=>{const le=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!le&&Q.key.length===1&&B(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let we=z().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Le=Q.target,xe=we.indexOf(Le);we=we.slice(xe+1)}setTimeout(()=>q(we)),Q.preventDefault()}})})})})})})});V9.displayName=pNe;var hNe="SelectItemAlignedPosition",G9=x.forwardRef((e,t)=>{const{__scopeSelect:s,onPlaced:n,...a}=e,o=Bd(gp,s),i=qd(gp,s),[l,c]=x.useState(null),[u,f]=x.useState(null),h=Vs(t,R=>
813f(R)),g=Yw(s),v=x.useRef(!1),y=x.useRef(!0),{viewport:_,selectedItem:j,selectedItemText:w,focusSelectedItem:k}=i,S=x.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&_&&j&&w){const R=o.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),L=o.valueNode.getBoundingClientRect(),M=w.getBoundingClientRect();if(o.dir!=="rtl"){const Le=M.left-I.left,xe=L.left-Le,de=R.left-xe,Me=R.width+de,je=Math.max(Me,I.width),Ae=window.innerWidth-ai,Oe=GD(xe,[ai,Math.max(ai,Ae-je)]);l.style.minWidth=Me+"px",l.style.left=Oe+"px"}else{const Le=I.right-M.right,xe=window.innerWidth-L.right-Le,de=window.innerWidth-R.right-xe,Me=R.width+de,je=Math.max(Me,I.width),Ae=window.innerWidth-ai,Oe=GD(xe,[ai,Math.max(ai,Ae-je)]);l.style.minWidth=Me+"px",l.style.right=Oe+"px"}const O=g(),z=window.innerHeight-ai*2,X=_.scrollHeight,W=window.getComputedStyle(u),K=parseInt(W.borderTopWidth,10),q=parseInt(W.paddingTop,10),J=parseInt(W.borderBottomWidth,10),F=parseInt(W.paddingBottom,10),V=K+q+X+F+J,$=Math.min(j.offsetHeight*5,V),B=window.getComputedStyle(_),ae=parseInt(B.paddingTop,10),H=parseInt(B.paddingBottom,10),U=R.top+R.height/2-ai,oe=z-U,fe=j.offsetHeight/2,Q=j.offsetTop+fe,le=K+q+Q,Se=V-le;if(le<=U){const Le=O.length>0&&j===O[O.length-1].ref.current;l.style.bottom="0px";const xe=u.clientHeight-_.offsetTop-_.offsetHeight,de=Math.max(oe,fe+(Le?H:0)+xe+J),Me=le+de;l.style.height=Me+"px"}else{const Le=O.length>0&&j===O[0].ref.current;l.style.top="0px";const de=Math.max(U,K+_.offsetTop+(Le?ae:0)+fe)+Se;l.style.height=de+"px",_.scrollTop=le-U+_.offsetTop}l.style.margin=`${ai}px 0`,l.style.minHeight=$+"px",l.style.maxHeight=z+"px",n==null||n(),requestAnimationFrame(()=>v.current=!0)}},[g,o.trigger,o.valueNode,l,u,_,j,w,o.dir,n]);Vn(()=>S(),[S]);const[E,T]=x.useState();Vn(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const A=x.useCallback(R=>{R&&y.current===!0&&(S(),k==null||k(),y.current=!1)},[S,k]);return r.jsx(gNe,{scope:s,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:A,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:r.jsx(fs.div,{...a,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});G9.displayName=hNe;var mNe="SelectPopperPosition",r5=x.forwardRef((e,t)=>{const{__scopeSelect:s,align:n="start",collisionPadding:a=ai,...o}=e,i=Kw(s);return r.jsx(MR,{...i,...o,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...o.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)"}})});r5.displayName=mNe;var[gNe,VR]=pm(gp,{}),n5="SelectViewport",W9=x.forwardRef((e,t)=>{const{__scopeSelect:s,nonce:n,...a}=e,o=qd(n5,s),i=VR(n5,s),l=Vs(t,o.onViewportChange),c=x.useRef(0);return r.jsxs(r.Fragment,{children:[r.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:n}),r.jsx(Ww.Slot,{scope:s,children:r.jsx(fs.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Lt(a.onScroll,u=>{const f=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&h){const v=Math.abs(c.current-f.scrollTop);if(v>0){const y=window.innerHeight-ai*2,_=parseFloat(h.style.minHeight),j=parseFloat(h.style.height),w=Math.max(_,j);if(w<y){const k=w+v,S=Math.min(y,k),E=k-S;h.style.height=S+"px",h.style.bottom==="0px"&&(f.scrollTop=E>0?E:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});W9.displayName=n5;var Y9="SelectGroup",[xNe,vNe]=pm(Y9),bNe=x.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=po();return r.jsx(xNe,{scope:s,id:a,children:r.jsx(fs.div,{role:"group","aria-labelledby":a,...n,ref:t})})});
813bNe.displayName=Y9;var K9="SelectLabel",J9=x.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=vNe(K9,s);return r.jsx(fs.div,{id:a.id,...n,ref:t})});J9.displayName=K9;var Sj="SelectItem",[yNe,X9]=pm(Sj),Q9=x.forwardRef((e,t)=>{const{__scopeSelect:s,value:n,disabled:a=!1,textValue:o,...i}=e,l=Bd(Sj,s),c=qd(Sj,s),u=l.value===n,[f,h]=x.useState(o??""),[g,v]=x.useState(!1),y=Vs(t,k=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,k,n,a)}),_=po(),j=x.useRef("touch"),w=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(yNe,{scope:s,value:n,disabled:a,textId:_,isSelected:u,onItemTextChange:x.useCallback(k=>{h(S=>S||((k==null?void 0:k.textContent)??"").trim())},[]),children:r.jsx(Ww.ItemSlot,{scope:s,value:n,disabled:a,textValue:f,children:r.jsx(fs.div,{role:"option","aria-labelledby":_,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:y,onFocus:Lt(i.onFocus,()=>v(!0)),onBlur:Lt(i.onBlur,()=>v(!1)),onClick:Lt(i.onClick,()=>{j.current!=="mouse"&&w()}),onPointerUp:Lt(i.onPointerUp,()=>{j.current==="mouse"&&w()}),onPointerDown:Lt(i.onPointerDown,k=>{j.current=k.pointerType}),onPointerMove:Lt(i.onPointerMove,k=>{var S;j.current=k.pointerType,a?(S=c.onItemLeave)==null||S.call(c):j.current==="mouse"&&k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Lt(i.onPointerLeave,k=>{var S;k.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:Lt(i.onKeyDown,k=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&k.key===" "||(aNe.includes(k.key)&&w(),k.key===" "&&k.preventDefault())})})})})});Q9.displayName=Sj;var px="SelectItemText",Z9=x.forwardRef((e,t)=>{const{__scopeSelect:s,className:n,style:a,...o}=e,i=Bd(px,s),l=qd(px,s),c=X9(px,s),u=cNe(px,s),[f,h]=x.useState(null),g=Vs(t,w=>h(w),c.onItemTextChange,w=>{var k;return(k=l.itemTextRefCallback)==null?void 0:k.call(l,w,c.value,c.disabled)}),v=f==null?void 0:f.textContent,y=x.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:_,onNativeOptionRemove:j}=u;return Vn(()=>(_(y),()=>j(y)),[_,j,y]),r.jsxs(r.Fragment,{children:[r.jsx(fs.span,{id:c.textId,...o,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Xh.createPortal(o.children,i.valueNode):null]})});Z9.displayName=px;var eV="SelectItemIndicator",tV=x.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e;return X9(eV,s).isSelected?r.jsx(fs.span,{"aria-hidden":!0,...n,ref:t}):null});tV.displayName=eV;var a5="SelectScrollUpButton",sV=x.forwardRef((e,t)=>{const s=qd(a5,e.__scopeSelect),n=VR(a5,e.__scopeSelect),[a,o]=x.useState(!1),i=Vs(t,n.onScrollButtonChange);return Vn(()=>{if(s.viewport&&s.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=s.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[s.viewport,s.isPositioned]),a?r.jsx(nV,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=s;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});sV.displayName=a5;var o5="SelectScrollDownButton",rV=x.forwardRef((e,t)=>{const s=qd(o5,e.__scopeSelect),n=VR(o5,e.__scopeSelect),[a,o]=x.useState(!1),i=Vs(t,n.onScrollButtonChange);return Vn(()=>{if(s.viewport&&s.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<u;o(f)};const c=s.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[s.viewport,s.isPositioned]),a?r.jsx(nV,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=s;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});rV.displayName=o5;var nV=x.forwardRef((e,t)=>{const{__scopeSelect:s,onAutoScroll:n,...a}=e,o=qd("SelectScrollButton",s),i=x.useRef(null),l=Yw(s),c=x.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Vn(()=>{var f;const u=l().find(h=>h.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),r.jsx(fs.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Lt(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:Lt(a.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:Lt(a.onPointerLeave,()=>{c()})})}),_Ne="SelectSeparator",aV=x.forwardRef((e,t)=>
813{const{__scopeSelect:s,...n}=e;return r.jsx(fs.div,{"aria-hidden":!0,...n,ref:t})});aV.displayName=_Ne;var i5="SelectArrow",jNe=x.forwardRef((e,t)=>{const{__scopeSelect:s,...n}=e,a=Kw(s),o=Bd(i5,s),i=qd(i5,s);return o.open&&i.position==="popper"?r.jsx(OR,{...a,...n,ref:t}):null});jNe.displayName=i5;var wNe="SelectBubbleInput",oV=x.forwardRef(({__scopeSelect:e,value:t,...s},n)=>{const a=x.useRef(null),o=Vs(n,a),i=v1e(t);return x.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(h)}},[i,t]),r.jsx(fs.select,{...s,style:{...h9,...s.style},ref:o,defaultValue:t})});oV.displayName=wNe;function iV(e){return e===""||e===void 0}function lV(e){const t=ol(e),s=x.useRef(""),n=x.useRef(0),a=x.useCallback(i=>{const l=s.current+i;t(l),function c(u){s.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),o=x.useCallback(()=>{s.current="",window.clearTimeout(n.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(n.current),[]),[s,a,o]}function cV(e,t,s){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=s?e.indexOf(s):-1;let i=NNe(e,Math.max(o,0));a.length===1&&(i=i.filter(u=>u!==s));const c=i.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==s?c:void 0}function NNe(e,t){return e.map((s,n)=>e[(t+n)%e.length])}var kNe=L9,dV=$9,SNe=F9,CNe=B9,ENe=q9,uV=z9,TNe=W9,pV=J9,fV=Q9,RNe=Z9,ANe=tV,hV=sV,mV=rV,gV=aV;const xi=kNe,vi=SNe,Wo=x.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(dV,{ref:n,className:cs("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 data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...s,children:[t,r.jsx(CNe,{asChild:!0,children:r.jsx(sr,{className:"h-4 w-4 opacity-50"})})]}));Wo.displayName=dV.displayName;const xV=x.forwardRef(({className:e,...t},s)=>r.jsx(hV,{ref:s,className:cs("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(cd,{className:"h-4 w-4"})}));xV.displayName=hV.displayName;const vV=x.forwardRef(({className:e,...t},s)=>r.jsx(mV,{ref:s,className:cs("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(sr,{className:"h-4 w-4"})}));vV.displayName=mV.displayName;const Yo=x.forwardRef(({className:e,children:t,position:s="popper",...n},a)=>r.jsx(ENe,{children:r.jsxs(uV,{ref:a,className:cs("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-default)] 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 origin-[--radix-select-content-transform-origin]",s==="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",e),position:s,...n,children:[r.jsx(xV,{}),r.jsx(TNe,{className:cs("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(vV,{})]})}));Yo.displayName=uV.displayName;const PNe=x.forwardRef(({className:e,...t},s)=>r.jsx(pV,{ref:s,className:cs("px-2 py-1.5 text-sm font-semibold",e),...t}));PNe.displayName=pV.displayName;const yr=x.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(fV,{ref:n,className:cs("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-[var(--color-bg-hover)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(ANe,{children:r.jsx(ts,{className:"h-4 w-4"})})}),r.jsx(RNe,{children:t})]}));yr.displayName=fV.displayName;const INe=x.forwardRef(({className:e,...t},s)=>r.jsx(gV,{ref:s,className:cs("-mx-1 my-1 h-px bg-muted",e),...t}));INe.displayName=gV.displayName;/** 814 * table-core 815 * 816 * Copyright (c) TanStack 817 * 818 * This source code is licensed under the MIT license found in the 819 * LICENSE.md file in the root directory of this source tree. 820 * 821 * @license MIT 822 */function pd(e,t){return typeof e=="function"?e(t):e}function xo(e,t){return s=>{t.setState(n=>({...n,[e]:pd(s,n[e])}))}}function Jw(e){return e instanceof Function}function MNe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function ONe(e,t){const s=[],n=a=>{a.forEach(o=>{s.push(o);const i=t(o);i!=null&&i.length&&n(i)})};return n(e),s}function as(e,t,s){let n=[],a;return o=>{let i;s.key&&s.debug&&(i=Date.now());const l=e(o);if(!(l.length!==n.length||l.some((f,h)=>n[h]!==f)))return a;n=l;let u;if(s.key&&s.debug&&(u=Date.now()),a=t(...l),s==null||s.onChange==null||s.onChange(a),s.key&&s.debug&&s!=null&&s.debug()){const f=Math.round((Date.now()-i)*100)/100,h=Math.round((Date.now()-u)*100)/100,g=h/16,v=(y,_)=>{for(y=String(y);y.length<_;)y=" "+y;return y};console.info(`%câ± ${v(h,5)} /${v(f,5)} ms`,` 823 font-size: .6rem; 824 font-weight: bold; 825 color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,s==null?void 0:s.key)}return a}}function os(e,t,s,n){return{debug:()=>{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[t]},key:!1,onChange:n}}function LNe(e,t,s,n){const a=()=>{var i;return(i=o.getValue())!=null?i:e.options.renderFallbackValue},o={id:`${t.id}_${s.id}`,row:t,column:s,getValue:()=>t.getValue(n),renderValue:a,getContext:as(()=>[e,s,t,o],(i,l,c,u)=>({table:i,column:l,row:c,cell:u,getValue:u.getValue,renderValue:u.renderValue}),os(e.options,"debugCells"))};
825return e._features.forEach(i=>{i.createCell==null||i.createCell(o,s,t,e)},{}),o}function DNe(e,t,s,n){var a,o;const l={...e._getDefaultColumnDef(),...t},c=l.accessorKey;let u=(a=(o=l.id)!=null?o:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?a:typeof l.header=="string"?l.header:void 0,f;if(l.accessorFn?f=l.accessorFn:c&&(c.includes(".")?f=g=>{let v=g;for(const _ of c.split(".")){var y;v=(y=v)==null?void 0:y[_]}return v}:f=g=>g[l.accessorKey]),!u)throw new Error;let h={id:`${String(u)}`,accessorFn:f,parent:n,depth:s,columnDef:l,columns:[],getFlatColumns:as(()=>[!0],()=>{var g;return[h,...(g=h.columns)==null?void 0:g.flatMap(v=>v.getFlatColumns())]},os(e.options,"debugColumns")),getLeafColumns:as(()=>[e._getOrderColumnsFn()],g=>{var v;if((v=h.columns)!=null&&v.length){let y=h.columns.flatMap(_=>_.getLeafColumns());return g(y)}return[h]},os(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(h,e);return h}const Qn="debugHeaders";function n$(e,t,s){var n;let o={id:(n=s.id)!=null?n:t.id,column:t,index:s.index,isPlaceholder:!!s.isPlaceholder,placeholderId:s.placeholderId,depth:s.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],l=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(l),i.push(c)};return l(o),i},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(o,e)}),o}const $Ne={createTable:e=>{e.getHeaderGroups=as(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,s,n,a)=>{var o,i;const l=(o=n==null?void 0:n.map(h=>s.find(g=>g.id===h)).filter(Boolean))!=null?o:[],c=(i=a==null?void 0:a.map(h=>s.find(g=>g.id===h)).filter(Boolean))!=null?i:[],u=s.filter(h=>!(n!=null&&n.includes(h.id))&&!(a!=null&&a.includes(h.id)));return v0(t,[...l,...u,...c],e)},os(e.options,Qn)),e.getCenterHeaderGroups=as(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,s,n,a)=>(s=s.filter(o=>!(n!=null&&n.includes(o.id))&&!(a!=null&&a.includes(o.id))),v0(t,s,e,"center")),os(e.options,Qn)),e.getLeftHeaderGroups=as(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,s,n)=>{var a;const o=(a=n==null?void 0:n.map(i=>s.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return v0(t,o,e,"left")},os(e.options,Qn)),e.getRightHeaderGroups=as(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,s,n)=>{var a;const o=(a=n==null?void 0:n.map(i=>s.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return v0(t,o,e,"right")},os(e.options,Qn)),e.getFooterGroups=as(()=>[e.getHeaderGroups()],t=>[...t].reverse(),os(e.options,Qn)),e.getLeftFooterGroups=as(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),os(e.options,Qn)),e.getCenterFooterGroups=as(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),os(e.options,Qn)),e.getRightFooterGroups=as(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),os(e.options,Qn)),e.getFlatHeaders=as(()=>[e.getHeaderGroups()],t=>t.map(s=>s.headers).flat(),os(e.options,Qn)),e.getLeftFlatHeaders=as(()=>[e.getLeftHeaderGroups()],t=>t.map(s=>s.headers).flat(),os(e.options,Qn)),e.getCenterFlatHeaders=as(()=>[e.getCenterHeaderGroups()],t=>t.map(s=>s.headers).flat(),os(e.options,Qn)),e.getRightFlatHeaders=as(()=>[e.getRightHeaderGroups()],t=>t.map(s=>s.headers).flat(),os(e.options,Qn)),e.getCenterLeafHeaders=as(()=>[e.getCenterFlatHeaders()],t=>t.filter(s=>{var n;return!((n=s.subHeaders)!=null&&n.length)}),os(e.options,Qn)),e.getLeftLeafHeaders=as(()=>[e.getLeftFlatHeaders()],t=>t.filter(s=>{var n;return!((n=s.subHeaders)!=null&&n.length)}),os(e.options,Qn)),e.getRightLeafHeaders=as(()=>[e.getRightFlatHeaders()],t=>t.filter(s=>{var n;return!((n=s.subHeaders)!=null&&n.length)}),os(e.options,Qn)),e.getLeafHeaders=as(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,s,n)=>{var a,o,i,l,c,u;return[...(a=(o=t[0])==null?void 0:o.headers)!=null?a:[],...(i=(l=s[0])==null?void 0:l.headers)!=null?i:[],...(c=(u=n[0])==null?void 0:u.headers)!=null?c:[]].map(f=>f.getLeafHeaders()).flat()},os(e.options,Qn))}};function v0(e,t,s,n){var a,o;let i=0;const l=function(g,v){v===void 0&&(v=1),i=Math.max(i,v),g.filter(y=>
825y.getIsVisible()).forEach(y=>{var _;(_=y.columns)!=null&&_.length&&l(y.columns,v+1)},0)};l(e);let c=[];const u=(g,v)=>{const y={depth:v,id:[n,`${v}`].filter(Boolean).join("_"),headers:[]},_=[];g.forEach(j=>{const w=[..._].reverse()[0],k=j.column.depth===y.depth;let S,E=!1;if(k&&j.column.parent?S=j.column.parent:(S=j.column,E=!0),w&&(w==null?void 0:w.column)===S)w.subHeaders.push(j);else{const T=n$(s,S,{id:[n,v,S.id,j==null?void 0:j.id].filter(Boolean).join("_"),isPlaceholder:E,placeholderId:E?`${_.filter(A=>A.column===S).length}`:void 0,depth:v,index:_.length});T.subHeaders.push(j),_.push(T)}y.headers.push(j),j.headerGroup=y}),c.push(y),v>0&&u(_,v-1)},f=t.map((g,v)=>n$(s,g,{depth:i,index:v}));u(f,i-1),c.reverse();const h=g=>g.filter(y=>y.column.getIsVisible()).map(y=>{let _=0,j=0,w=[0];y.subHeaders&&y.subHeaders.length?(w=[],h(y.subHeaders).forEach(S=>{let{colSpan:E,rowSpan:T}=S;_+=E,w.push(T)})):_=1;const k=Math.min(...w);return j=j+k,y.colSpan=_,y.rowSpan=j,{colSpan:_,rowSpan:j}});return h((a=(o=c[0])==null?void 0:o.headers)!=null?a:[]),c}const GR=(e,t,s,n,a,o,i)=>{let l={id:t,index:n,original:s,depth:a,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(l._valuesCache.hasOwnProperty(c))return l._valuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return l._valuesCache[c]=u.accessorFn(l.original,n),l._valuesCache[c]},getUniqueValues:c=>{if(l._uniqueValuesCache.hasOwnProperty(c))return l._uniqueValuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[c]=u.columnDef.getUniqueValues(l.original,n),l._uniqueValuesCache[c]):(l._uniqueValuesCache[c]=[l.getValue(c)],l._uniqueValuesCache[c])},renderValue:c=>{var u;return(u=l.getValue(c))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ONe(l.subRows,c=>c.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let c=[],u=l;for(;;){const f=u.getParentRow();if(!f)break;c.push(f),u=f}return c.reverse()},getAllCells:as(()=>[e.getAllLeafColumns()],c=>c.map(u=>LNe(e,l,u,u.id)),os(e.options,"debugRows")),_getAllCellsByColumnId:as(()=>[l.getAllCells()],c=>c.reduce((u,f)=>(u[f.column.id]=f,u),{}),os(e.options,"debugRows"))};for(let c=0;c<e._features.length;c++){const u=e._features[c];u==null||u.createRow==null||u.createRow(l,e)}return l},UNe={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.i
825d),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},bV=(e,t,s)=>{var n,a;const o=s==null||(n=s.toString())==null?void 0:n.toLowerCase();return!!(!((a=e.getValue(t))==null||(a=a.toString())==null||(a=a.toLowerCase())==null)&&a.includes(o))};bV.autoRemove=e=>fi(e);const yV=(e,t,s)=>{var n;return!!(!((n=e.getValue(t))==null||(n=n.toString())==null)&&n.includes(s))};yV.autoRemove=e=>fi(e);const _V=(e,t,s)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(s==null?void 0:s.toLowerCase())};_V.autoRemove=e=>fi(e);const jV=(e,t,s)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(s)};jV.autoRemove=e=>fi(e);const wV=(e,t,s)=>!s.some(n=>{var a;return!((a=e.getValue(t))!=null&&a.includes(n))});wV.autoRemove=e=>fi(e)||!(e!=null&&e.length);const NV=(e,t,s)=>s.some(n=>{var a;return(a=e.getValue(t))==null?void 0:a.includes(n)});NV.autoRemove=e=>fi(e)||!(e!=null&&e.length);const kV=(e,t,s)=>e.getValue(t)===s;kV.autoRemove=e=>fi(e);const SV=(e,t,s)=>e.getValue(t)==s;SV.autoRemove=e=>fi(e);const WR=(e,t,s)=>{let[n,a]=s;const o=e.getValue(t);return o>=n&&o<=a};WR.resolveFilterValue=e=>{let[t,s]=e,n=typeof t!="number"?parseFloat(t):t,a=typeof s!="number"?parseFloat(s):s,o=t===null||Number.isNaN(n)?-1/0:n,i=s===null||Number.isNaN(a)?1/0:a;if(o>i){const l=o;o=i,i=l}return[o,i]};WR.autoRemove=e=>fi(e)||fi(e[0])&&fi(e[1]);const Hl={includesString:bV,includesStringSensitive:yV,equalsString:_V,arrIncludes:jV,arrIncludesAll:wV,arrIncludesSome:NV,equals:kV,weakEquals:SV,inNumberRange:WR};function fi(e){return e==null||e===""}const FNe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:xo("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const s=t.getCoreRowModel().flatRows[0],n=s==null?void 0:s.getValue(e.id);return typeof n=="string"?Hl.includesString:typeof n=="number"?Hl.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?Hl.equals:Array.isArray(n)?Hl.arrIncludes:Hl.weakEquals},e.getFilterFn=()=>{var s,n;return Jw(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(s=(n=t.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?s:Hl[e.columnDef.filterFn]},e.getCanFilter=()=>{var s,n,a;return((s=e.columnDef.enableColumnFilter)!=null?s:!0)&&((n=t.options.enableColumnFilters)!=null?n:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var s;return(s=t.getState().columnFilters)==null||(s=s.find(n=>n.id===e.id))==null?void 0:s.value},e.getFilterIndex=()=>{var s,n;return(s=(n=t.getState().columnFilters)==null?void 0:n.findIndex(a=>a.id===e.id))!=null?s:-1},e.setFilterValue=s=>{t.setColumnFilters(n=>{const a=e.getFilterFn(),o=n==null?void 0:n.find(f=>f.id===e.id),i=pd(s,o?o.value:void 0);if(a$(a,i,e)){var l;return(l=n==null?void 0:n.filter(f=>f.id!==e.id))!=null?l:[]}const c={id:e.id,value:i};if(o){var u;return(u=n==null?void 0:n.map(f=>f.id===e.id?c:f))!=null?u:[]}return n!=null&&n.length?[...n,c]:[c]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const s=e.getAllLeafColumns(),n=a=>{var o;return(o=pd(t,a))==null?void 0:o.filter(i=>{const l=s.find(c=>c.id===i.id);if(l){const c=l.getFilterFn();if(a$(c,i.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=t=>{var s,n;e.setColumnFilters(t?[]:(s=(n=e.initialState)==null?void 0:n.columnFilters)!=null?s:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};
825function a$(e,t,s){return(e&&e.autoRemove?e.autoRemove(t,s):!1)||typeof t>"u"||typeof t=="string"&&!t}const BNe=(e,t,s)=>s.reduce((n,a)=>{const o=a.getValue(e);return n+(typeof o=="number"?o:0)},0),qNe=(e,t,s)=>{let n;return s.forEach(a=>{const o=a.getValue(e);o!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}),n},zNe=(e,t,s)=>{let n;return s.forEach(a=>{const o=a.getValue(e);o!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}),n},HNe=(e,t,s)=>{let n,a;return s.forEach(o=>{const i=o.getValue(e);i!=null&&(n===void 0?i>=i&&(n=a=i):(n>i&&(n=i),a<i&&(a=i)))}),[n,a]},VNe=(e,t)=>{let s=0,n=0;if(t.forEach(a=>{let o=a.getValue(e);o!=null&&(o=+o)>=o&&(++s,n+=o)}),s)return n/s},GNe=(e,t)=>{if(!t.length)return;const s=t.map(o=>o.getValue(e));if(!MNe(s))return;if(s.length===1)return s[0];const n=Math.floor(s.length/2),a=s.sort((o,i)=>o-i);return s.length%2!==0?a[n]:(a[n-1]+a[n])/2},WNe=(e,t)=>Array.from(new Set(t.map(s=>s.getValue(e))).values()),YNe=(e,t)=>new Set(t.map(s=>s.getValue(e))).size,KNe=(e,t)=>t.length,r2={sum:BNe,min:qNe,max:zNe,extent:HNe,mean:VNe,median:GNe,unique:WNe,uniqueCount:YNe,count:KNe},JNe={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,s;return(t=(s=e.getValue())==null||s.toString==null?void 0:s.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:xo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(s=>s!=null&&s.includes(e.id)?s.filter(n=>n!==e.id):[...s??[],e.id])},e.getCanGroup=()=>{var s,n;return((s=e.columnDef.enableGrouping)!=null?s:!0)&&((n=t.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var s;return(s=t.getState().grouping)==null?void 0:s.includes(e.id)},e.getGroupedIndex=()=>{var s;return(s=t.getState().grouping)==null?void 0:s.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const s=e.getCanGroup();return()=>{s&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const s=t.getCoreRowModel().flatRows[0],n=s==null?void 0:s.getValue(e.id);if(typeof n=="number")return r2.sum;if(Object.prototype.toString.call(n)==="[object Date]")return r2.extent},e.getAggregationFn=()=>{var s,n;if(!e)throw new Error;return Jw(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(s=(n=t.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?s:r2[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var s,n;e.setGrouping(t?[]:(s=(n=e.initialState)==null?void 0:n.grouping)!=null?s:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=s=>{if(e._groupingValuesCache.hasOwnProperty(s))return e._groupingValuesCache[s];const n=t.getColumn(s);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[s]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[s]):e.getValue(s)},e._groupingValuesCache={}},createCell:(e,t,s,n)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===s.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=s.subRows)!=null&&a.length)}}};function XNe(e,t,s){if(!(t!=null&&t.length)||!s)return e;const n=e.filter(o=>!t.includes(o.id));return s==="remove"?n:[...t.map(o=>e.find(i=>i.id===o)).filter(Boolean),...n]}const QNe={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:xo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=as(s=>[Mx(t,s)],s=>s.findIndex(n=>n.id===e.id),os(t.options,"debugColumns")),e.getIsFirstColumn=s=>{var n;return((n=Mx(t,s)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=s=>{var n;const a=Mx(t,s);return((n=a[a.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var s;e.setColumnOrder(t?[]:(s=e.initialState.columnOrder)!=null?s:[])},e._getOrderColumnsFn=as(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,s,n)=>a=>{let o=[];if(!(t!=null&&t.length))o=a;else{const i=[...t],l=[...a];for(;l.length&&i.length;){const c=i.shift(),u=l.findIndex(f=>f.id===c);u>-1&&o.push(l.splice(u,1)[0])}o=[...o,...l]}return XNe(o,s,n)},os(e.options,"debugTable"))}},n2=()=>
825({left:[],right:[]}),ZNe={getInitialState:e=>({columnPinning:n2(),...e}),getDefaultOptions:e=>({onColumnPinningChange:xo("columnPinning",e)}),createColumn:(e,t)=>{e.pin=s=>{const n=e.getLeafColumns().map(a=>a.id).filter(Boolean);t.setColumnPinning(a=>{var o,i;if(s==="right"){var l,c;return{left:((l=a==null?void 0:a.left)!=null?l:[]).filter(h=>!(n!=null&&n.includes(h))),right:[...((c=a==null?void 0:a.right)!=null?c:[]).filter(h=>!(n!=null&&n.includes(h))),...n]}}if(s==="left"){var u,f;return{left:[...((u=a==null?void 0:a.left)!=null?u:[]).filter(h=>!(n!=null&&n.includes(h))),...n],right:((f=a==null?void 0:a.right)!=null?f:[]).filter(h=>!(n!=null&&n.includes(h)))}}return{left:((o=a==null?void 0:a.left)!=null?o:[]).filter(h=>!(n!=null&&n.includes(h))),right:((i=a==null?void 0:a.right)!=null?i:[]).filter(h=>!(n!=null&&n.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var a,o,i;return((a=n.columnDef.enablePinning)!=null?a:!0)&&((o=(i=t.options.enableColumnPinning)!=null?i:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const s=e.getLeafColumns().map(l=>l.id),{left:n,right:a}=t.getState().columnPinning,o=s.some(l=>n==null?void 0:n.includes(l)),i=s.some(l=>a==null?void 0:a.includes(l));return o?"left":i?"right":!1},e.getPinnedIndex=()=>{var s,n;const a=e.getIsPinned();return a?(s=(n=t.getState().columnPinning)==null||(n=n[a])==null?void 0:n.indexOf(e.id))!=null?s:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=as(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(s,n,a)=>{const o=[...n??[],...a??[]];return s.filter(i=>!o.includes(i.column.id))},os(t.options,"debugRows")),e.getLeftVisibleCells=as(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(s,n)=>(n??[]).map(o=>s.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),os(t.options,"debugRows")),e.getRightVisibleCells=as(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(s,n)=>(n??[]).map(o=>s.find(i=>i.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),os(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var s,n;return e.setColumnPinning(t?n2():(s=(n=e.initialState)==null?void 0:n.columnPinning)!=null?s:n2())},e.getIsSomeColumnsPinned=t=>{var s;const n=e.getState().columnPinning;if(!t){var a,o;return!!((a=n.left)!=null&&a.length||(o=n.right)!=null&&o.length)}return!!((s=n[t])!=null&&s.length)},e.getLeftLeafColumns=as(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,s)=>(s??[]).map(n=>t.find(a=>a.id===n)).filter(Boolean),os(e.options,"debugColumns")),e.getRightLeafColumns=as(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,s)=>(s??[]).map(n=>t.find(a=>a.id===n)).filter(Boolean),os(e.options,"debugColumns")),e.getCenterLeafColumns=as(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,s,n)=>{const a=[...s??[],...n??[]];return t.filter(o=>!a.includes(o.id))},os(e.options,"debugColumns"))}};function eke(e){return e||(typeof document<"u"?document:null)}const b0={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},a2=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),tke={getDefaultColumnDef:()=>b0,getInitialState:e=>({columnSizing:{},columnSizingInfo:a2(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xo("columnSizing",e),onColumnSizingInfoChange:xo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var s,n,a;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((s=e.columnDef.minSize)!=null?s:b0.minSize,(n=o??e.columnDef.size)!=null?n:b0.size),(a=e.columnDef.maxSize)!=null?a:b0.maxSize)},e.getStart=as(s=>[s,Mx(t,s),t.getState().columnSizing],(s,n)=>n.slice(0,e.getIndex(s)).reduce((a,o)=>a+o.getSize(),0),os(t.options,"debugColumns")),e.getAfter=as(s=>[s,Mx(t,s),t.getState().columnSizing],(s,n)=>n.slice(e.getIndex(s)+1).reduce((a,o)=>a+o.getSize(),0),os(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(s=>{let{[e.id]:n,...a}=s;return a})},e.getCanResize=()=>{var s,n;return((s=e.columnDef.enableResizing)!=null?s:!0)&&((n=t.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let s=0;const n=a=>
825{if(a.subHeaders.length)a.subHeaders.forEach(n);else{var o;s+=(o=a.column.getSize())!=null?o:0}};return n(e),s},e.getStart=()=>{if(e.index>0){const s=e.headerGroup.headers[e.index-1];return s.getStart()+s.getSize()}return 0},e.getResizeHandler=s=>{const n=t.getColumn(e.column.id),a=n==null?void 0:n.getCanResize();return o=>{if(!n||!a||(o.persist==null||o.persist(),o2(o)&&o.touches&&o.touches.length>1))return;const i=e.getSize(),l=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[n.id,n.getSize()]],c=o2(o)?Math.round(o.touches[0].clientX):o.clientX,u={},f=(w,k)=>{typeof k=="number"&&(t.setColumnSizingInfo(S=>{var E,T;const A=t.options.columnResizeDirection==="rtl"?-1:1,R=(k-((E=S==null?void 0:S.startOffset)!=null?E:0))*A,I=Math.max(R/((T=S==null?void 0:S.startSize)!=null?T:0),-.999999);return S.columnSizingStart.forEach(L=>{let[M,O]=L;u[M]=Math.round(Math.max(O+O*I,0)*100)/100}),{...S,deltaOffset:R,deltaPercentage:I}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(S=>({...S,...u})))},h=w=>f("move",w),g=w=>{f("end",w),t.setColumnSizingInfo(k=>({...k,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},v=eke(s),y={moveHandler:w=>h(w.clientX),upHandler:w=>{v==null||v.removeEventListener("mousemove",y.moveHandler),v==null||v.removeEventListener("mouseup",y.upHandler),g(w.clientX)}},_={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),h(w.touches[0].clientX),!1),upHandler:w=>{var k;v==null||v.removeEventListener("touchmove",_.moveHandler),v==null||v.removeEventListener("touchend",_.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),g((k=w.touches[0])==null?void 0:k.clientX)}},j=ske()?{passive:!1}:!1;o2(o)?(v==null||v.addEventListener("touchmove",_.moveHandler,j),v==null||v.addEventListener("touchend",_.upHandler,j)):(v==null||v.addEventListener("mousemove",y.moveHandler,j),v==null||v.addEventListener("mouseup",y.upHandler,j)),t.setColumnSizingInfo(w=>({...w,startOffset:c,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var s;e.setColumnSizing(t?{}:(s=e.initialState.columnSizing)!=null?s:{})},e.resetHeaderSizeInfo=t=>{var s;e.setColumnSizingInfo(t?a2():(s=e.initialState.columnSizingInfo)!=null?s:a2())},e.getTotalSize=()=>{var t,s;return(t=(s=e.getHeaderGroups()[0])==null?void 0:s.headers.reduce((n,a)=>n+a.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,s;return(t=(s=e.getLeftHeaderGroups()[0])==null?void 0:s.headers.reduce((n,a)=>n+a.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,s;return(t=(s=e.getCenterHeaderGroups()[0])==null?void 0:s.headers.reduce((n,a)=>n+a.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,s;return(t=(s=e.getRightHeaderGroups()[0])==null?void 0:s.headers.reduce((n,a)=>n+a.getSize(),0))!=null?t:0}}};let y0=null;function ske(){if(typeof y0=="boolean")return y0;let e=!1;try{const t={get passive(){return e=!0,!1}},s=()=>{};window.addEventListener("test",s,t),window.removeEventListener("test",s)}catch{e=!1}return y0=e,y0}function o2(e){return e.type==="touchstart"}const rke={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:xo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=s=>{e.getCanHide()&&t.setColumnVisibility(n=>({...n,[e.id]:s??!e.getIsVisible()}))},e.getIsVisible=()=>{var s,n;const a=e.columns;return(s=a.length?a.some(o=>o.getIsVisible()):(n=t.getState().columnVisibility)==null?void 0:n[e.id])!=null?s:!0},e.getCanHide=()=>{var s,n;return((s=e.columnDef.enableHiding)!=null?s:!0)&&((n=t.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>s=>{e.toggleVisibility==null||e.toggleVisibility(s.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=as(()=>[e.getAllCells(),t.getState().columnVisibility],s=>s.filter(n=>n.column.getIsVisible()),os(t.options,"debugRows")),e.getVisibleCells=as(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(s,n,a)=>[...s,...n,...a],os(t.options,"debugRows"))},createTable:e=>{const t=(s,n)=>as(()=>[n(),n().filter(a=>a.getIsVisible()).map(a=>a.id).join("_")],a=>a.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),os(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=s=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(s),e.resetColumnVisibility=s=>{var n;e.setColumnVisibility(s?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=s=>{var n;s=(n=s)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,o)=>({...a,[o.id]:s||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(s=>!(s.getIsVisible!=null&&s.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(s=>s.getIsVisible==null?void 0:s.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>s=>{var n;e.toggleAllColumnsVisible((n=s.target)==null?void 0:n.checked)}}};function Mx(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const nke={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>
825{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},ake={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:xo("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var s;const n=(s=e.getCoreRowModel().flatRows[0])==null||(s=s._getAllCellsByColumnId()[t.id])==null?void 0:s.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var s,n,a,o;return((s=e.columnDef.enableGlobalFilter)!=null?s:!0)&&((n=t.options.enableGlobalFilter)!=null?n:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Hl.includesString,e.getGlobalFilterFn=()=>{var t,s;const{globalFilterFn:n}=e.options;return Jw(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(s=e.options.filterFns)==null?void 0:s[n])!=null?t:Hl[n]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},oke={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:xo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,s=!1;e._autoResetExpanded=()=>{var n,a;if(!t){e._queue(()=>{t=!0});return}if((n=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(s)return;s=!0,e._queue(()=>{e.resetExpanded(),s=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var a,o;e.setExpanded(n?{}:(a=(o=e.initialState)==null?void 0:o.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const i=o.split(".");n=Math.max(n,i.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=s=>{t.setExpanded(n=>{var a;const o=n===!0?!0:!!(n!=null&&n[e.id]);let i={};if(n===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{i[l]=!0}):i=n,s=(a=s)!=null?a:!o,!o&&s)return{...i,[e.id]:!0};if(o&&!s){const{[e.id]:l,...c}=i;return c}return n})},e.getIsExpanded=()=>{var s;const n=t.getState().expanded;return!!((s=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?s:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var s,n,a;return(s=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?s:((n=t.options.enableExpanding)!=null?n:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let s=!0,n=e;for(;s&&n.parentId;)n=t.getRow(n.parentId,!0),s=n.getIsExpanded();return s},e.getToggleExpandedHandler=()=>{const s=e.getCanExpand();return()=>{s&&e.toggleExpanded()}}}},l5=0,c5=10,i2=()=>({pageIndex:l5,pageSize:c5}),ike={getInitialState:e=>({...e,pagination:{...i2(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:xo("pagination",e)}),createTable:e=>{let t=!1,s=!1;e._autoResetPageIndex=()=>{var n,a;if(!t){e._queue(()=>{t=!0});return}if((n=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(s)return;s=!0,e._queue(()=>{e.resetPageIndex(),s=!1})}},e.setPagination=n=>{const a=o=>pd(n,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=n=>{var a;
825e.setPagination(n?i2():(a=e.initialState.pagination)!=null?a:i2())},e.setPageIndex=n=>{e.setPagination(a=>{let o=pd(n,a.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...a,pageIndex:o}})},e.resetPageIndex=n=>{var a,o;e.setPageIndex(n?l5:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?a:l5)},e.resetPageSize=n=>{var a,o;e.setPageSize(n?c5:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?a:c5)},e.setPageSize=n=>{e.setPagination(a=>{const o=Math.max(1,pd(n,a.pageSize)),i=a.pageSize*a.pageIndex,l=Math.floor(i/o);return{...a,pageIndex:l,pageSize:o}})},e.setPageCount=n=>e.setPagination(a=>{var o;let i=pd(n,(o=e.options.pageCount)!=null?o:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...a,pageCount:i}}),e.getPageOptions=as(()=>[e.getPageCount()],n=>{let a=[];return n&&n>0&&(a=[...new Array(n)].fill(null).map((o,i)=>i)),a},os(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:n<a-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},l2=()=>({top:[],bottom:[]}),lke={getInitialState:e=>({rowPinning:l2(),...e}),getDefaultOptions:e=>({onRowPinningChange:xo("rowPinning",e)}),createRow:(e,t)=>{e.pin=(s,n,a)=>{const o=n?e.getLeafRows().map(c=>{let{id:u}=c;return u}):[],i=a?e.getParentRows().map(c=>{let{id:u}=c;return u}):[],l=new Set([...i,e.id,...o]);t.setRowPinning(c=>{var u,f;if(s==="bottom"){var h,g;return{top:((h=c==null?void 0:c.top)!=null?h:[]).filter(_=>!(l!=null&&l.has(_))),bottom:[...((g=c==null?void 0:c.bottom)!=null?g:[]).filter(_=>!(l!=null&&l.has(_))),...Array.from(l)]}}if(s==="top"){var v,y;return{top:[...((v=c==null?void 0:c.top)!=null?v:[]).filter(_=>!(l!=null&&l.has(_))),...Array.from(l)],bottom:((y=c==null?void 0:c.bottom)!=null?y:[]).filter(_=>!(l!=null&&l.has(_)))}}return{top:((u=c==null?void 0:c.top)!=null?u:[]).filter(_=>!(l!=null&&l.has(_))),bottom:((f=c==null?void 0:c.bottom)!=null?f:[]).filter(_=>!(l!=null&&l.has(_)))}})},e.getCanPin=()=>{var s;const{enableRowPinning:n,enablePinning:a}=t.options;return typeof n=="function"?n(e):(s=n??a)!=null?s:!0},e.getIsPinned=()=>{const s=[e.id],{top:n,bottom:a}=t.getState().rowPinning,o=s.some(l=>n==null?void 0:n.includes(l)),i=s.some(l=>a==null?void 0:a.includes(l));return o?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var s,n;const a=e.getIsPinned();if(!a)return-1;const o=(s=a==="top"?t.getTopRows():t.getBottomRows())==null?void 0:s.map(i=>{let{id:l}=i;return l});return(n=o==null?void 0:o.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var s,n;return e.setRowPinning(t?l2():(s=(n=e.initialState)==null?void 0:n.rowPinning)!=null?s:l2())},e.getIsSomeRowsPinned=t=>{var s;const n=e.getState().rowPinning;if(!t){var a,o;return!!((a=n.top)!=null&&a.length||(o=n.bottom)!=null&&o.length)}return!!((s=n[t])!=null&&s.length)},e._getPinnedRows=(t,s,n)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(s??[]).map(i=>{const l=e.getRow(i,!0);return l.getIsAllParentsExpanded()?l:null}):(s??[]).map(i=>t.find(l=>l.id===i))).filter(Boolean).map(i=>({...i,position:n}))},e.getTopRows=as(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,s)=>e._getPinnedRows(t,s,"top"),os(e.options,"debugRows")),e.getBottomRows=as(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,s)=>e._getPinnedRows(t,s,"bottom"),os(e.options,"debugRows")),e.getCenterRows=as(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,s,n)=>
825{const a=new Set([...s??[],...n??[]]);return t.filter(o=>!a.has(o.id))},os(e.options,"debugRows"))}},cke={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:xo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var s;return e.setRowSelection(t?{}:(s=e.initialState.rowSelection)!=null?s:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(s=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const n={...s},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(o=>{o.getCanSelect()&&(n[o.id]=!0)}):a.forEach(o=>{delete n[o.id]}),n})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(s=>{const n=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),a={...s};return e.getRowModel().rows.forEach(o=>{d5(a,o.id,n,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=as(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,s)=>Object.keys(t).length?c2(e,s):{rows:[],flatRows:[],rowsById:{}},os(e.options,"debugTable")),e.getFilteredSelectedRowModel=as(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,s)=>Object.keys(t).length?c2(e,s):{rows:[],flatRows:[],rowsById:{}},os(e.options,"debugTable")),e.getGroupedSelectedRowModel=as(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,s)=>Object.keys(t).length?c2(e,s):{rows:[],flatRows:[],rowsById:{}},os(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:s}=e.getState();let n=!!(t.length&&Object.keys(s).length);return n&&t.some(a=>a.getCanSelect()&&!s[a.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:s}=e.getState();let n=!!t.length;return n&&t.some(a=>!s[a.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var t;const s=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return s>0&&s<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(s=>s.getCanSelect()).some(s=>s.getIsSelected()||s.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(s,n)=>{const a=e.getIsSelected();t.setRowSelection(o=>{var i;if(s=typeof s<"u"?s:!a,e.getCanSelect()&&a===s)return o;const l={...o};return d5(l,e.id,s,(i=n==null?void 0:n.selectChildren)!=null?i:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:s}=t.getState();return YR(e,s)},e.getIsSomeSelected=()=>{const{rowSelection:s}=t.getState();return u5(e,s)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:s}=t.getState();return u5(e,s)==="all"},e.getCanSelect=()=>{var s;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(s=t.options.enableRowSelection)!=null?s:!0},e.getCanSelectSubRows=()=>{var s;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(s=t.options.enableSubRowSelection)!=null?s:!0},e.getCanMultiSelect=()=>{var s;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(s=t.options.enableMultiRowSelection)!=null?s:!0},e.getToggleSelectedHandler=()=>{const s=e.getCanSelect();return n=>{var a;s&&e.toggleSelected((a=n.target)==null?void 0:a.checked)}}}},d5=(e,t,s,n,a)=>{var o;const i=a.getRow(t,!0);s?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[t]=!0)):delete e[t],n&&(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>d5(e,l.id,s,n,a))};function c2(e,t){const s=e.getState().rowSelection,n=[],a={},o=function(i,l){return i.map(c=>{var u;const f=YR(c,s);if(f&&(n.push(c),a[c.id]=c),(u=c.subRows)!=null&&u.length&&(c={...c,subRows:o(c.subRows)}),f)return c}).filter(Boolean)};return{rows:o(t.rows),flatRows:n,rowsById:a}}function YR(e,t){var s;return(s=t[e.id])!=null?s:!1}function u5(e,t,s){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let a=!0,o=!1;return e.subRows.forEach(i=>
825{if(!(o&&!a)&&(i.getCanSelect()&&(YR(i,t)?o=!0:a=!1),i.subRows&&i.subRows.length)){const l=u5(i,t);l==="all"?o=!0:(l==="some"&&(o=!0),a=!1)}}),a?"all":o?"some":!1}const p5=/([0-9]+)/gm,dke=(e,t,s)=>CV(Id(e.getValue(s)).toLowerCase(),Id(t.getValue(s)).toLowerCase()),uke=(e,t,s)=>CV(Id(e.getValue(s)),Id(t.getValue(s))),pke=(e,t,s)=>KR(Id(e.getValue(s)).toLowerCase(),Id(t.getValue(s)).toLowerCase()),fke=(e,t,s)=>KR(Id(e.getValue(s)),Id(t.getValue(s))),hke=(e,t,s)=>{const n=e.getValue(s),a=t.getValue(s);return n>a?1:n<a?-1:0},mke=(e,t,s)=>KR(e.getValue(s),t.getValue(s));function KR(e,t){return e===t?0:e>t?1:-1}function Id(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function CV(e,t){const s=e.split(p5).filter(Boolean),n=t.split(p5).filter(Boolean);for(;s.length&&n.length;){const a=s.shift(),o=n.shift(),i=parseInt(a,10),l=parseInt(o,10),c=[i,l].sort();if(isNaN(c[0])){if(a>o)return 1;if(o>a)return-1;continue}if(isNaN(c[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}return s.length-n.length}const Fg={alphanumeric:dke,alphanumericCaseSensitive:uke,text:pke,textCaseSensitive:fke,datetime:hke,basic:mke},gke={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:xo("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const s=t.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const a of s){const o=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Fg.datetime;if(typeof o=="string"&&(n=!0,o.split(p5).length>1))return Fg.alphanumeric}return n?Fg.text:Fg.basic},e.getAutoSortDir=()=>{const s=t.getFilteredRowModel().flatRows[0];return typeof(s==null?void 0:s.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var s,n;if(!e)throw new Error;return Jw(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(s=(n=t.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?s:Fg[e.columnDef.sortingFn]},e.toggleSorting=(s,n)=>{const a=e.getNextSortingOrder(),o=typeof s<"u"&&s!==null;t.setSorting(i=>{const l=i==null?void 0:i.find(v=>v.id===e.id),c=i==null?void 0:i.findIndex(v=>v.id===e.id);let u=[],f,h=o?s:a==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&n?l?f="toggle":f="add":i!=null&&i.length&&c!==i.length-1?f="replace":l?f="toggle":f="replace",f==="toggle"&&(o||a||(f="remove")),f==="add"){var g;u=[...i,{id:e.id,desc:h}],u.splice(0,u.length-((g=t.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=i.map(v=>v.id===e.id?{...v,desc:h}:v):f==="remove"?u=i.filter(v=>v.id!==e.id):u=[{id:e.id,desc:h}];return u})},e.getFirstSortDir=()=>{var s,n;return((s=(n=e.columnDef.sortDescFirst)!=null?n:t.options.sortDescFirst)!=null?s:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=s=>{var n,a;const o=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==o&&((n=t.options.enableSortingRemoval)==null||n)&&(!(s&&(a=t.options.enableMultiRemove)!=null)||a)?!1:i==="desc"?"asc":"desc":o},e.getCanSort=()=>{var s,n;return((s=e.columnDef.enableSorting)!=null?s:!0)&&((n=t.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var s,n;return(s=(n=e.columnDef.enableMultiSort)!=null?n:t.options.enableMultiSort)!=null?s:!!e.accessorFn},e.getIsSorted=()=>{var s;const n=(s=t.getState().sorting)==null?void 0:s.find(a=>a.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var s,n;return(s=(n=t.getState().sorting)==null?void 0:n.findIndex(a=>a.id===e.id))!=null?s:-1},e.clearSorting=()=>{t.setSorting(s=>s!=null&&s.length?s.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const s=e.getCanSort();return n=>{s&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var s,n;e.setSorting(t?[]:(s=(n=e.initialState)==null?void 0:n.sorting)!=null?s:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},xke=[$Ne,rke,QNe,ZNe,UNe,FNe,nke,ake,gke,JNe,oke,ike,lke,cke,tke];function vke(e){var t,s;const n=[...xke,...(t=e._features)!=null?t:[]];let a={_features:n};const o=a._features.reduce((g,v)=>Object.assign(g,v.getDefaultOptions==null?void 0:v.getDefaultOptions(a)),{}),i=g=>a.options.mergeOptions?a.options.mergeOptions(o,g):{...o,...g};let c={...{},...(s=e.initialState)!=null?s:{}};
825a._features.forEach(g=>{var v;c=(v=g.getInitialState==null?void 0:g.getInitialState(c))!=null?v:c});const u=[];let f=!1;const h={_features:n,options:{...o,...e},initialState:c,_queue:g=>{u.push(g),f||(f=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();f=!1}).catch(v=>setTimeout(()=>{throw v})))},reset:()=>{a.setState(a.initialState)},setOptions:g=>{const v=pd(g,a.options);a.options=i(v)},getState:()=>a.options.state,setState:g=>{a.options.onStateChange==null||a.options.onStateChange(g)},_getRowId:(g,v,y)=>{var _;return(_=a.options.getRowId==null?void 0:a.options.getRowId(g,v,y))!=null?_:`${y?[y.id,v].join("."):v}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(g,v)=>{let y=(v?a.getPrePaginationRowModel():a.getRowModel()).rowsById[g];if(!y&&(y=a.getCoreRowModel().rowsById[g],!y))throw new Error;return y},_getDefaultColumnDef:as(()=>[a.options.defaultColumn],g=>{var v;return g=(v=g)!=null?v:{},{header:y=>{const _=y.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:y=>{var _,j;return(_=(j=y.renderValue())==null||j.toString==null?void 0:j.toString())!=null?_:null},...a._features.reduce((y,_)=>Object.assign(y,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...g}},os(e,"debugColumns")),_getColumnDefs:()=>a.options.columns,getAllColumns:as(()=>[a._getColumnDefs()],g=>{const v=function(y,_,j){return j===void 0&&(j=0),y.map(w=>{const k=DNe(a,w,j,_),S=w;return k.columns=S.columns?v(S.columns,k,j+1):[],k})};return v(g)},os(e,"debugColumns")),getAllFlatColumns:as(()=>[a.getAllColumns()],g=>g.flatMap(v=>v.getFlatColumns()),os(e,"debugColumns")),_getAllFlatColumnsById:as(()=>[a.getAllFlatColumns()],g=>g.reduce((v,y)=>(v[y.id]=y,v),{}),os(e,"debugColumns")),getAllLeafColumns:as(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(g,v)=>{let y=g.flatMap(_=>_.getLeafColumns());return v(y)},os(e,"debugColumns")),getColumn:g=>a._getAllFlatColumnsById()[g]};Object.assign(a,h);for(let g=0;g<a._features.length;g++){const v=a._features[g];v==null||v.createTable==null||v.createTable(a)}return a}function bke(){return e=>as(()=>[e.options.data],t=>{const s={rows:[],flatRows:[],rowsById:{}},n=function(a,o,i){o===void 0&&(o=0);const l=[];for(let u=0;u<a.length;u++){const f=GR(e,e._getRowId(a[u],u,i),a[u],u,o,void 0,i==null?void 0:i.id);if(s.flatRows.push(f),s.rowsById[f.id]=f,l.push(f),e.options.getSubRows){var c;f.originalSubRows=e.options.getSubRows(a[u],u),(c=f.originalSubRows)!=null&&c.length&&(f.subRows=n(f.originalSubRows,o+1,f))}}return l};return s.rows=n(t),s},os(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function yke(e){const t=[],s=n=>{var a;t.push(n),(a=n.subRows)!=null&&a.length&&n.getIsExpanded()&&n.subRows.forEach(s)};return e.rows.forEach(s),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function _ke(e,t,s){return s.options.filterFromLeafRows?jke(e,t,s):wke(e,t,s)}function jke(e,t,s){var n;const a=[],o={},i=(n=s.options.maxLeafRowFilterDepth)!=null?n:100,l=function(c,u){u===void 0&&(u=0);const f=[];for(let g=0;g<c.length;g++){var h;let v=c[g];const y=GR(s,v.id,v.original,v.index,v.depth,void 0,v.parentId);if(y.columnFilters=v.columnFilters,(h=v.subRows)!=null&&h.length&&u<i){if(y.subRows=l(v.subRows,u+1),v=y,t(v)&&!y.subRows.length){f.push(v),o[v.id]=v,a.push(v);continue}if(t(v)||y.subRows.length){f.push(v),o[v.id]=v,a.push(v);continue}}else v=y,t(v)&&(f.push(v),o[v.id]=v,a.push(v))}return f};return{rows:l(e),flatRows:a,rowsById:o}}function wke(e,t,s){var n;const a=[],o={},i=(n=s.options.maxLeafRowFilterDepth)!=null?n:100,l=function(c,u){u===void 0&&(u=0);const f=[];for(let g=0;g<c.length;g++){let v=c[g];if(t(v)){var h;if((h=v.subRows)!=null&&h.length&&u<i){const _=GR(s,v.id,v.original,v.index,v.depth,void 0,v.parentId);_.subRows=l(v.subRows,u+1),v=_}f.push(v),a.push(v),o[v.id]=v}}return f};return{rows:l(e),flatRows:a,rowsById:o}}function Nke(){return e=>as(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,s,n)=>{if(!t.rows.length||!(s!=null&&s.length)&&!n){for(let g=0;g<t.flatRows.length;g++)t.flatRows[g].columnFilters={},t.flatRows[g].columnFiltersMeta={};return t}const a=[],o=[];
825(s??[]).forEach(g=>{var v;const y=e.getColumn(g.id);if(!y)return;const _=y.getFilterFn();_&&a.push({id:g.id,filterFn:_,resolvedValue:(v=_.resolveFilterValue==null?void 0:_.resolveFilterValue(g.value))!=null?v:g.value})});const i=(s??[]).map(g=>g.id),l=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());n&&l&&c.length&&(i.push("__global__"),c.forEach(g=>{var v;o.push({id:g.id,filterFn:l,resolvedValue:(v=l.resolveFilterValue==null?void 0:l.resolveFilterValue(n))!=null?v:n})}));let u,f;for(let g=0;g<t.flatRows.length;g++){const v=t.flatRows[g];if(v.columnFilters={},a.length)for(let y=0;y<a.length;y++){u=a[y];const _=u.id;v.columnFilters[_]=u.filterFn(v,_,u.resolvedValue,j=>{v.columnFiltersMeta[_]=j})}if(o.length){for(let y=0;y<o.length;y++){f=o[y];const _=f.id;if(f.filterFn(v,_,f.resolvedValue,j=>{v.columnFiltersMeta[_]=j})){v.columnFilters.__global__=!0;break}}v.columnFilters.__global__!==!0&&(v.columnFilters.__global__=!1)}}const h=g=>{for(let v=0;v<i.length;v++)if(g.columnFilters[i[v]]===!1)return!1;return!0};return _ke(t.rows,h,e)},os(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function kke(e){return t=>as(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(s,n)=>{if(!n.rows.length)return n;const{pageSize:a,pageIndex:o}=s;let{rows:i,flatRows:l,rowsById:c}=n;const u=a*o,f=u+a;i=i.slice(u,f);let h;t.options.paginateExpandedRows?h={rows:i,flatRows:l,rowsById:c}:h=yke({rows:i,flatRows:l,rowsById:c}),h.flatRows=[];const g=v=>{h.flatRows.push(v),v.subRows.length&&v.subRows.forEach(g)};return h.rows.forEach(g),h},os(t.options,"debugTable"))}function Ske(){return e=>as(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,s)=>{if(!s.rows.length||!(t!=null&&t.length))return s;const n=e.getState().sorting,a=[],o=n.filter(c=>{var u;return(u=e.getColumn(c.id))==null?void 0:u.getCanSort()}),i={};o.forEach(c=>{const u=e.getColumn(c.id);u&&(i[c.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=c=>{const u=c.map(f=>({...f}));return u.sort((f,h)=>{for(let v=0;v<o.length;v+=1){var g;const y=o[v],_=i[y.id],j=_.sortUndefined,w=(g=y==null?void 0:y.desc)!=null?g:!1;let k=0;if(j){const S=f.getValue(y.id),E=h.getValue(y.id),T=S===void 0,A=E===void 0;if(T||A){if(j==="first")return T?-1:1;if(j==="last")return T?1:-1;k=T&&A?0:T?j:-j}}if(k===0&&(k=_.sortingFn(f,h,y.id)),k!==0)return w&&(k*=-1),_.invertSorting&&(k*=-1),k}return f.index-h.index}),u.forEach(f=>{var h;a.push(f),(h=f.subRows)!=null&&h.length&&(f.subRows=l(f.subRows))}),u};return{rows:l(s.rows),flatRows:a,rowsById:s.rowsById}},os(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** 826 * react-table 827 * 828 * Copyright (c) TanStack 829 * 830 * This source code is licensed under the MIT license found in the 831 * LICENSE.md file in the root directory of this source tree. 832 * 833 * @license MIT 834 */function o$(e,t){return e?Cke(e)?x.createElement(e,t):e:null}function Cke(e){return Eke(e)||typeof e=="function"||Tke(e)}function Eke(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Tke(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Rke(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[s]=x.useState(()=>({current:vke(t)})),[n,a]=x.useState(()=>s.current.initialState);return s.current.setOptions(o=>({...o,...e,state:{...n,...e.state},onStateChange:i=>{a(i),e.onStateChange==null||e.onStateChange(i)}})),s.current}function f5(e,t,s){const n=`${t}s`;return e===1?`${e.toLocaleString()} ${t}`:`${e.toLocaleString()} ${n}`}function Ake({id:e}){const[t,s]=x.useState(!1),n=x.useCallback(a=>{a.stopPropagation(),navigator.clipboard.writeText(e),s(!0),it.success("ID copied to clipboard"),setTimeout(()=>s(!1),2e3)},[e]);return r.jsxs(k9,{children:[r.jsx(S9,{asChild:!0,children:r.jsxs("button",{onClick:n,className:"font-mono text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] flex items-center gap-1.5 group cursor-pointer",children:[r.jsxs("span",{children:[e.slice(0,8),"..."]}),t?r.jsx(ts,{className:"w-3 h-3 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}),r.jsx(UR,{children:r.jsx("p",{children:t?"Copied!":"Click to copy full ID"})})]})}function _0({column:e,title:t}){return e.getCanSort()?r.jsxs(ht,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>
834e.toggleSorting(e.getIsSorted()==="asc"),children:[r.jsx("span",{children:t}),e.getIsSorted()==="desc"?r.jsx(Lf,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?r.jsx(Df,{className:"ml-2 h-4 w-4"}):r.jsx(Ou,{className:"ml-2 h-4 w-4"})]}):r.jsx("span",{children:t})}function Pke({table:e,totalRecords:t}){const s=e.getFilteredRowModel().rows.length,n=s!==t;return r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 px-4 py-3 border-t border-[var(--color-border-default)]",children:[r.jsx("div",{className:"text-sm text-[var(--color-fg-muted)]",children:n?`${f5(s,"record")} (filtered from ${t.toLocaleString()})`:f5(t,"record")}),r.jsxs("div",{className:"flex items-center gap-3 sm:gap-6 lg:gap-8",children:[r.jsxs("div",{className:"hidden sm:flex items-center space-x-2",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-muted)]",children:"Rows per page"}),r.jsxs(xi,{value:String(e.getState().pagination.pageSize),onValueChange:a=>e.setPageSize(Number(a)),children:[r.jsx(Wo,{className:"h-8 w-[70px] bg-[var(--color-bg-card)] border-[var(--color-border-strong)] text-[var(--color-fg-default)] text-sm",children:r.jsx(vi,{})}),r.jsx(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-strong)]",children:[10,20,30,50,100].map(a=>r.jsx(yr,{value:String(a),className:"text-[var(--color-fg-default)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:a},a))})]})]}),r.jsxs("div",{className:"text-sm font-medium text-[var(--color-fg-muted)] whitespace-nowrap",children:["Page ",e.getState().pagination.pageIndex+1," of"," ",e.getPageCount()||1]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"hidden h-8 w-8 p-0 lg:flex border-[var(--color-border-strong)] text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] disabled:opacity-50",children:[r.jsx("span",{className:"sr-only",children:"Go to first page"}),r.jsx(xpe,{className:"h-4 w-4"})]}),r.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"h-8 w-8 p-0 border-[var(--color-border-strong)] text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] disabled:opacity-50",children:[r.jsx("span",{className:"sr-only",children:"Go to previous page"}),r.jsx(JC,{className:"h-4 w-4"})]}),r.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"h-8 w-8 p-0 border-[var(--color-border-strong)] text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] disabled:opacity-50",children:[r.jsx("span",{className:"sr-only",children:"Go to next page"}),r.jsx(Hn,{className:"h-4 w-4"})]}),r.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"hidden h-8 w-8 p-0 lg:flex border-[var(--color-border-strong)] text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] disabled:opacity-50",children:[r.jsx("span",{className:"sr-only",children:"Go to last page"}),r.jsx(bpe,{className:"h-4 w-4"})]})]})]})]})}function Ike({onDismiss:e}){return r.jsxs("div",{className:"flex items-start sm:items-center justify-between gap-2 px-4 py-3 text-sm text-[var(--color-fg-muted)] bg-[var(--color-bg-alt)] border-t border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"flex items-start sm:items-center gap-2",children:[r.jsx(Sq,{className:"w-4 h-4 shrink-0 mt-0.5 sm:mt-0 text-[var(--color-semantic-warning)]/70"}),r.jsxs("span",{children:["Tip: Use"," ",r.jsx(dt,{to:"/prompts",className:"text-indigo-400 hover:text-indigo-300 underline",children:"LLM Prompts"})," ","to generate test data or build an app against this collection."]})]}),r.jsx("button",{onClick:e,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition p-1 shrink-0","aria-label":"Dismiss tip",children:r.jsx(Ir,{className:"w-4 h-4"})})]})}function i$(e){const t=["title","name","label","subject","email"];for(const n of t){const a=e.find(o=>o.name.toLowerCase()===n);if(a)return a.name}const s=e.find(n=>n.type==="string");return(s==null?void 0:s.name)||null}function Mke({name:e,type:t,value:s,onChange:n}){if(t==="boolean")return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-muted)]",children:e}),r.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:!!s,onChange:o=>n(e,o.target.checked),className:"w-4 h-4 rounded border-[var(--color-border-strong)] bg-[var(--color-bg-alt)] text-[var(--color-accent-blue)] focu
834s:ring-[var(--color-accent-blue)]"}),r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:s?"true":"false"})]})]});if(t==="number")return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-muted)]",children:e}),r.jsx("input",{type:"number",value:s??"",onChange:o=>n(e,o.target.value===""?0:Number(o.target.value)),className:"w-full rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-blue)]"})]});if(t==="object"||Array.isArray(s)){const o=typeof s=="string"?s:JSON.stringify(s??null,null,2);return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-muted)]",children:e}),r.jsx("textarea",{value:o,onChange:i=>{try{const l=JSON.parse(i.target.value);n(e,l)}catch{n(e,i.target.value)}},rows:4,className:"w-full rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] font-mono focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-blue)] resize-y"})]})}const a=typeof s=="string"&&s.length>80;return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-muted)]",children:e}),a?r.jsx("textarea",{value:s??"",onChange:o=>n(e,o.target.value),rows:3,className:"w-full rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-blue)] resize-y"}):r.jsx("input",{type:"text",value:s??"",onChange:o=>n(e,o.target.value),className:"w-full rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-blue)]"})]})}function Oke({columns:e=4,rows:t=4}){return r.jsx("div",{className:"rounded-lg sm:rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-[var(--color-bg-alt)]",children:r.jsx("tr",{children:Array.from({length:e}).map((s,n)=>r.jsx("th",{className:"px-4 py-3 text-left",children:r.jsx("div",{className:"h-3 w-16 bg-[var(--color-bg-active)] rounded animate-pulse"})},n))})}),r.jsx("tbody",{children:Array.from({length:t}).map((s,n)=>r.jsx("tr",{className:"border-t border-[var(--color-border-default)]",children:Array.from({length:e}).map((a,o)=>r.jsx("td",{className:"px-4 py-3",children:r.jsx("div",{className:"h-3 bg-[var(--color-bg-active)] rounded animate-pulse",style:{width:o===0?"80px":`${60+Math.random()*80}px`}})},o))},n))})]})})})}function l$({record:e,effectiveFields:t,mode:s,saving:n,onSave:a,onClose:o}){const i=s==="edit",l=x.useMemo(()=>{if(i&&(e!=null&&e.data_json))return{...e.data_json};if(t){const E={};for(const T of t)T.type==="number"?E[T.name]=0:T.type==="boolean"?E[T.name]=!1:T.type==="object"?E[T.name]={}:E[T.name]="";return E}return{}},[e,t,i]),[c,u]=x.useState(l),[f,h]=x.useState(JSON.stringify(l,null,2)),[g,v]=x.useState(!1);x.useEffect(()=>{g||h(JSON.stringify(c,null,2))},[c,g]);const y=(E,T)=>{u(A=>({...A,[E]:T}))},_=E=>{h(E);try{const T=JSON.parse(E);u(T)}catch{}},j=()=>{if(g){try{const T=JSON.parse(f);a(T)}catch{it.error("Invalid JSON - please fix syntax errors first")}return}const E={};for(const[T,A]of Object.entries(c)){if(typeof A=="string"){const R=A.trim();if(R.startsWith("{")&&R.endsWith("}")||R.startsWith("[")&&R.endsWith("]"))try{E[T]=JSON.parse(R);continue}catch{}}E[T]=A}a(E)},w=t||Object.keys(c).map(E=>({name:E,type:typeof c[E]})),k=i$(t||w),S=k&&c[k]?String(c[k]):null;return r.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-2xl sm:mx-4 rounded-t-2xl sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl max-h-[85vh] sm:max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-6 py-4 border-b border-[var(--color-border-default)]",children:[r.jsx("div",{className:"min-w-0",children:i&&S?r.jsxs(r.Fragment,{children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] truncate",children:S}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] font-mono mt-0.5",children:e==null?void 0:e.id})]}):r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:i?"Edit Record":"Create Record"})}),r.jsx("button",{type:"button",onClick:o,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition shrink-0",children:r.jsx(Ir,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"px-4 sm:px-6 py-4 overflow-auto flex-1 space-y-4",children:[i&&e&&r.jsxs("div",{className:"flex items-center gap-4 text-xs text-[var(--color-fg-muted)] pb-2 border-b border-[var(--color-border-default)]",children:[r.jsxs("span",{children:["Created ",new Date(e.created_at).toLocaleDateString()]}),r.jsxs("span",{children:["Updated ",new Date(e.updated_at).toLocaleDateString()]}),e.app_user_email&&r.jsxs("span",{children:["User: ",e.app_user_email]})]}),w.length>0?r.jsx("div",{className:"space-y-3",children:w.map(E=>r.jsx(Mke,{name:E.name,type:E.type,value:c[E.name],onChange:y},E.name))}):r.jsx("div",{className:"text-sm text-[var(--color-fg-muted)]",children:"No schema detected. Use the JSON editor below."}),r.jsxs("details",{open:g||w.length===0,onToggle:E=>{const T=E.target.open;v(T),T&&h(JSON.stringify(c,null,2))},children:[r.jsxs("summary",{className:"flex items-center gap-1.5 cursor-pointer text-xs font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] select-none py-1",children:[r.jsx(sr,{className:"w-3.5 h-3.5 transition-transform [details:not([open])_&]:-rotate-90"}),"Edit as JSON"]}),r.jsxs("div",{className:"mt-2",children:[r.jsx("div",{className:"flex items-center justify-end mb-1",children:r.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>{try{const E=JSON.parse(f);h(JSON.stringify(E,null,2)),it.success("JSON formatted")}catch{it.error("Invalid JSON")}},className:"h-7 px-2 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",children:[r.jsx(Eu,{className:"w-3.5 h-3.5 mr-1.5"}),"Format"]})}),r.jsx(s_e,{value:f,onChange:_,rows:10})]})]})]}),r.jsxs("div",{className:"flex items-center justify-end gap-3 px-4 sm:px-6 py-4 border-t border-[var(--color-border-default)]",children:[r.jsx(ht,{variant:"outline",onClick:o,className:"border-[var(--color-border-strong)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]",children:"Cancel"}),r.jsx(ht,{onClick:j,disabled:n,className:"bg-[var(--color-accent-blue)] hover:brightness-110 text-white",children:n?i?"Saving...":"Creating...":i?"Save Changes":"Create Record"})]})]})})}function Lke(){Mn("Data");const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),[n,a]=Wa(),[o,i]=x.useState([]),[l,c]=x.useState(!1),[u,f]=x.use
834State(null),[h,g]=x.useState([]),[v,y]=x.useState([]),[_,j]=x.useState({}),[w,k]=x.useState(""),[S,E]=x.useState([]),[T,A]=x.useState([]),[R,I]=x.useState(()=>{const he=n.get("projectId");return he&&!Number.isNaN(Number(he))?Number(he):null}),[L,M]=x.useState(()=>n.get("collection")||""),[O,z]=x.useState(null),X="reqres_env_preference",[W,K]=x.useState(()=>{if(typeof window>"u")return"prod";const he=n.get("env");if(he==="dev"||he==="prod")return he;try{const ke=localStorage.getItem(X);if(ke==="dev"||ke==="prod")return ke}catch{}return"prod"}),[q,J]=x.useState(null),[F,V]=x.useState(!1),[$,B]=x.useState(null),[ae,H]=x.useState(!1),[U,oe]=x.useState(!1),[fe,Q]=x.useState(null),[le,Se]=x.useState(!1),we=x.useRef(null),Le=x.useRef(!!n.get("collection")),xe=Mt.dark,de=Fd.dark,Me=he=>{K(he),M(""),z(null),i([]),f(null),Le.current=!1;try{localStorage.setItem(X,he)}catch{}},je=x.useMemo(()=>{if(!(O!=null&&O.schema))return null;const he=O.schema;if(he.properties&&typeof he.properties=="object")return Object.keys(he.properties);if(typeof he=="object"&&!Array.isArray(he)){const ke=["type","required","additionalProperties","$schema","title","description"];return Object.keys(he).filter(Ve=>!ke.includes(Ve))}return null},[O==null?void 0:O.schema]),Ae=x.useMemo(()=>{if(o.length===0)return null;const he=new Map;for(const at of o)if(!(!at.data_json||typeof at.data_json!="object"))for(const[Pt,Ct]of Object.entries(at.data_json)){const St=he.get(Pt);St?St.count++:he.set(Pt,{type:typeof Ct,count:1})}const ke=Math.max(1,o.length*.3),Ve=Array.from(he.entries()).filter(([,at])=>at.count>=ke).map(([at,Pt])=>({name:at,type:Pt.type}));return Ve.length>0?Ve:null},[o]),Oe=x.useMemo(()=>je?je.map(he=>({name:he,type:"string"})):Ae,[je,Ae]),Ke=x.useMemo(()=>o.some(he=>he.app_user_id),[o]),ut=x.useMemo(()=>{const he=[{accessorKey:"id",header:({column:ke})=>r.jsx(_0,{column:ke,title:"ID"}),cell:({row:ke})=>r.jsx(Ake,{id:ke.getValue("id")}),size:120}];return Oe&&Oe.length>0?Oe.forEach((ke,Ve)=>{he.push({id:`data_${ke.name}`,accessorFn:at=>{var Pt;return(Pt=at.data_json)==null?void 0:Pt[ke.name]},header:ke.name.charAt(0).toUpperCase()+ke.name.slice(1),cell:({row:at,getValue:Pt})=>{const Ct=Pt();if(Ct!=null&&Ct!=="")return typeof Ct=="object"?r.jsx(FS,{json:JSON.stringify(Ct),maxLength:50}):r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:String(Ct)});if(Ve===0){const St=at.original.data_json;if(St&&typeof St=="object"&&!Oe.some(It=>St[It.name]!==null&&St[It.name]!==void 0&&St[It.name]!=="")&&Object.keys(St).length>0)return r.jsx(FS,{json:JSON.stringify(St),maxLength:60})}return null},enableSorting:!1})}):he.push({accessorKey:"data_json",header:"Data",cell:({row:ke})=>{const Ve=ke.getValue("data_json"),at=JSON.stringify(Ve);return r.jsx(FS,{json:at,maxLength:80})},enableSorting:!1}),Ke&&he.push({accessorKey:"app_user_email",header:({column:ke})=>r.jsx(_0,{column:ke,title:"User"}),cell:({row:ke})=>{const Ve=ke.getValue("app_user_email"),at=ke.original.app_user_id;return Ve?r.jsx("span",{className:"text-xs text-[var(--color-fg-secondary)]",children:Ve}):at?r.jsxs("span",{className:"font-mono text-xs text-[var(--color-fg-muted)]",children:[at.slice(0,8),"..."]}):null},size:180}),he.push({accessorKey:"created_at",header:({column:ke})=>r.jsx(_0,{column:ke,title:"Created"}),cell:({row:ke})=>r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:new Date(ke.getValue("created_at")).toLocaleDateString()}),size:100}),he.push({accessorKey:"updated_at",header:({column:ke})=>r.jsx(_0,{column:ke,title:"Updated"}),cell:({row:ke})=>r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:new Date(ke.getValue("updated_at")).toLocaleDateString()}),size:100}),he.push({id:"actions",header:()=>r.jsx("span",{className:"sr-only",children:"Actions"}),cell:({row:ke})=>{const Ve=ke.original;return r.jsxs("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",children:[r.jsx("button",{onClick:()=>ve(Ve),title:"Edit",className:"p-1 rounded text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",children:r.jsx(Ufe,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>gt(Ve.id),title:"Delete",disabled:$===Ve.id,className:"p-1 rounded text-[var(--color-fg-muted)] hover:text-[var(--color-semantic-danger)] hover:bg-[var(--color-bg-hover)] transition disabled:opacity-50",children:r.jsx(nl,{className:"w-3.5 h-3.5"})})]})},size:70}),he},[Oe,Ke,$]),De=Rke({data:o,columns:ut,getCoreRowModel:bke(),getPaginationRowModel:kke(),getSortedRowModel:Ske(),getFilteredRowModel:Nke(),onSortingChange:g,onColumnFiltersChange:y,onColumnVisibilityChange:j,onGlobalFilterChange:k,state:{sorting:h,columnFilters:v,columnVisibility:_,globalFilter:w},initialState:{pagination:{pageSize:20}}}),ct=async()=>{var he;try{const ke=await Ue(s);if(!ke)return;const at=((he=(await ue.get("/projects",{authToken:ke})).data)==null?void 0:he.projects)||[];E(at),!R&&at.length>0&&I(at[0].id)}catch(ke){console.error("Failed to fetch projects:",ke)}},rt=async()=>
834{if(!R){A([]);return}try{const he=await Ue(s);if(!he)return;const ke=new URLSearchParams;ke.set("project_id",String(R));const Ve=await ue.get(`/data-explorer/collections?${ke}`,{authToken:he,env:W,headers:{"X-Reqres-Env":W}});A(Ve.data.data||[])}catch(he){console.error("Failed to fetch collections:",he)}},mt=async()=>{if(!R||!L){z(null);return}if(T.length>0&&!T.some(he=>he.slug===L)){z(null),M("");return}try{const he=await Ue(s);if(!he)return;const ke=new URLSearchParams;ke.set("project_id",String(R));const Ve=await ue.get(`/data-explorer/collections/${L}?${ke}`,{authToken:he,env:W,headers:{"X-Reqres-Env":W}});z(Ve.data.data||null)}catch(he){console.error("Failed to fetch collection details:",he),z(null),he instanceof yt&&he.status===404&&(M(""),i([]))}},vt=async()=>{if(!R){i([]),f("Select a project to view records.");return}if(!L){i([]),f("Select a collection to view records.");return}if(T.length>0&&!T.some(he=>he.slug===L)){i([]),M("");return}c(!0),f(null);try{const he=await Ue(s);if(!he){f("Please sign in to continue");return}const ke=new URLSearchParams({limit:"500",env:W});ke.append("project_id",String(R));const Pt=((await ue.get(`/data-explorer/collections/${L}/records?${ke}`,{authToken:he,env:W,headers:{"X-Reqres-Env":W}})).data.data||[]).map(Ct=>({id:Ct.id,data_json:Ct.data,created_at:Ct.created_at,updated_at:Ct.updated_at,app_user_id:Ct.app_user_id??null,app_user_email:Ct.app_user_email??null,deleted_at:Ct.deleted_at,collection_name:Ct.collection_name,collection_slug:Ct.collection_slug,project_id:Ct.project_id??R,project_name:Ct.project_name??null}));i(Pt)}catch(he){console.error("Error fetching records:",he),he instanceof yt&&he.status===404?(M(""),i([])):he instanceof yt?f(`Failed to fetch records: ${he.message}`):f("Failed to fetch records")}finally{c(!1)}},gt=async he=>{if(confirm("Delete this record? This cannot be undone.")){B(he);try{const ke=await Ue(s);if(!ke){it.error("Please sign in");return}const Ve=new URLSearchParams;R&&Ve.append("project_id",String(R)),await ue.delete(`/data-explorer/collections/${L}/records/${he}?${Ve}`,{authToken:ke,env:W,headers:{"X-Reqres-Env":W}}),Z.track("record_deleted",{collection:L,project_id:R}),it.success("Record deleted"),vt()}catch(ke){console.error("Failed to delete record:",ke),Z.track("record_delete_failed",{collection:L,project_id:R}),it.error(ke instanceof yt?ke.message:"Failed to delete record")}finally{B(null)}}};x.useEffect(()=>{const he=new URLSearchParams(n);let ke=!1;R?he.get("projectId")!==String(R)&&(he.set("projectId",String(R)),ke=!0):he.has("projectId")&&(he.delete("projectId"),ke=!0),L?he.get("collection")!==L&&(he.set("collection",L),ke=!0):he.has("collection")&&(he.delete("collection"),ke=!0),he.get("env")!==W&&(he.set("env",W),ke=!0),ke&&a(he)},[R,L,W,n,a]),x.useEffect(()=>{t&&e&&ct()},[t,e]),x.useEffect(()=>{t&&e&&R&&(rt(),we.current!==null&&we.current!==R&&(M(""),Le.current=!1),we.current=R)},[t,e,R,W]),x.useEffect(()=>{T.length>0&&!L&&!Le.current&&M(T[0].slug)},[T,L]),x.useEffect(()=>{(async()=>{var ke,Ve,at;if(!R){Q(null);return}try{const Pt=await Ue(s);if(!Pt)return;const St=(await ue.get(`/projects/${R}`,{authToken:Pt})).data,Xt=(St==null?void 0:St.environment_keys)||{},It=((ke=Xt==null?void 0:Xt.prod)==null?void 0:ke.private)||((Ve=St==null?void 0:St.project)==null?void 0:Ve.api_key)||(St==null?void 0:St.api_key)||null,ee=((at=Xt==null?void 0:Xt.dev)==null?void 0:at.private)||null;Q(W==="dev"&&ee||It)}catch(Pt){console.error("Failed to fetch project API key:",Pt),Q(null)}})()},[s,R,W]),x.useEffect(()=>{t&&e&&R&&L&&(mt(),vt())},[t,e,R,L,W]);const Be=S.find(he=>he.id===R),ve=he=>{J(he)},be=async he=>{if(!(!q||!L)){V(!0);try{const ke=await Ue(s);if(!ke&&!fe){it.error("Please sign in or ensure project has API key");return}const Ve=new URLSearchParams;R&&Ve.append("project_id",String(R)),await ue.put(`/api/collections/${L}/records/${q.id}?${Ve}`,{data:he},{authToken:ke||void 0,headers:{"Content-Type":"application/json","X-Reqres-Env":W,...fe?{"x-api-key":fe}:{}},env:W}),it.success("Record updated"),J(null),vt()}catch(ke){console.error("Failed to update record:",ke),it.error(ke instanceof yt?ke.message:"Failed to update record")}finally{V(!1)}}},nt=async he=>{if(!(!L||!R)){oe(!0);try{const ke=await Ue(s);if(!ke&&!fe){it.error("Please sign in or ensure project has API key");return}const Ve=new URLSearchParams;Ve.append("project_id",String(R)),await ue.post(`/api/collections/${L}/records?${Ve}`,{data:he},{authToken:ke||void 0,headers:{"Content-Type":"application/json","X-Reqres-Env":W,...fe?{"x-api-key":fe}:{}},env:W}),it.success("Record created"),H(!1),vt()}catch(ke){console.error("Failed to create record:",ke),Z.track("record_create_failed",{collection:L,project_id:R}),it.error(ke instanceof yt?ke.message:"Failed to create record")}finally{oe(!1)}}};if(!t)return r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-8",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading..."})});if(!e)return r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-8 text-center text-semantic-danger",children:"You must be signed in to view data."});const Ze=!le&&L&&o.length<3&&!l;return r.jsx($R,{children:r.jsxs("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-2 sm:py-8 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"min-w-0",children:O?r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-[var(--color-fg-default)]",children:O.name}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:[f5(o.length,"record")," in ",(Be==null?void 0:Be.name)||"project"," · ",W," environment"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-[var(--color-fg-default)]",children:"Data"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:"Select a collection to browse your records."})]})}),r.jsxs(dt,{to:`/collections${R?`?projectId=${R}`:""}`,className:"inline-flex items-center gap-1.5 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition shrink-0 whitespace-nowrap",children:[r.jsx(ja,{className:"w-3.5 h-3.5"}),r.jsx("span",{className:"hidden sm:inline",children:"Manage Collections"})]})]}),r.jsx("div",{className:`${xe}`,children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-[160px]",children:r.jsxs(xi,{value:R?String(R):"",onValueChange:he=>{const ke=he?Number(he):null;if(ke!==R){M(""),z(null),A([]),i([]),f(null);const Ve=new URLSearchParams(n);Ve.delete("collection"),ke?Ve.set("projectId",String(ke)):Ve.delete("projectId"),a(Ve)}I(ke)},children:[r.jsx(Wo,{className:"w-full h-9 bg-[var(--color-bg-card)] border-[var(--color-border-strong)] text-[var(--color-fg-default)] text-sm",children:r.jsx(vi,{placeholder:"Project"})}),r.jsx(Yo,{className:"w-[var(--radix-select-trigger-width)] bg-[var(--color-bg-card)] border-[var(--color-border-strong)]",children:S.map(he=>r.jsx(yr,{value:String(he.id),className:"text-[var(--color-fg-default)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:r.jsx("span",{className:"block truncate",children:he.name})},he.id))})]})}),r.jsxs("div",{className:"min-w-[160px]",children:[r.jsxs(xi,{value:L,onValueChange:M,disabled:!R||T.length===0,children:[r.jsx(Wo,{className:"w-full h-9 bg-[var(--color-bg-card)] border-[var(--color-border-strong)] text-[var(--color-fg-default)] disabled:opacity-50 text-sm",children:r.jsx(vi,{placeholder:"Collection"})}),r.jsx(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-strong)]",children:T.map(he=>r.jsx(yr,{value:he.slug,className:"text-[var(--color-fg-default)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:he.name},he.id))})]}),T.length===0&&R&&r.jsxs(dt,{to:"/collections",className:"text-xs text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)] transition flex items-center gap-1 mt-1",children:[r.jsx(ca,{className:"h-3 w-3"}),"Create a Collection"]})]}),r.jsx("div",{className:"inline-flex rounded-md border border-[var(--color-border-default)] overflow-hidden h-9",children:["prod","dev"].map(he=>r.jsx("button",{type:"button",onClick:()=>Me(he),className:`px-3 text-xs font-medium uppercase transition ${W===he?"bg-[var(--color-accent-blue)] text-white":"bg-transparent text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:he},he))}),r.jsx("div",{className:"flex-1 min-w-[160px]",children:r.jsxs("div",{className:"relative",children:[r.jsx(_h,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-fg-muted)]"}),r.jsx(id,{type:"text",placeholder:"Filter records...",value:w??"",onChange:he=>k(he.target.value),className:`${de} pl-9 w-full h-9`})]})}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>vt(),disabled:!L||l,className:"h-9 border-[var(--color-border-strong)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]",children:[r.jsx(bw,{className:`w-4 h-4 mr-1.5 ${l?"animate-spin":""}`}),"Refresh"]}),r.jsxs(ht,{size:"sm",onClick:()=>H(!0),disabled:!L,className:"h-9 bg-[var(--color-accent-blue)] hover:brightness-110 text-white",children:[r.jsx(ca,{className:"w-4 h-4 mr-1.5"}),"Create Record"]})]})]})}),u&&!l&&r.jsx("div",{className:"rounded-lg border border-[var(--color-semantic-warning)]/40 bg-[var(--color-semantic-warning-bg)] px-4 py-3 text-sm text-[var(--color-semantic-warning)]",children:u}),l&&r.jsx(Oke,{columns:Oe?Oe.length+3:4,rows:4}),!l&&!u&&L&&o.length===0&&r.jsxs("div",{className:`${xe} text-center py-12`,children:[r.jsx(Rn,{className:"w-12 h-12 text-[var(--color-fg-faint)] mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"No records yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1 mb-4",children:"This collection is empty. Create your first record to get started."}),r.jsxs("div",{className:"flex items-center justify-center gap-3",children:[r.jsxs(ht,{onClick:()=>H(!0),className:"bg-[var(--color-accent-blue)] hover:brightness-110 text-white",children:[r.jsx(ca,{className:"w-4 h-4 mr-1.5"}),"Create Record"]}),r.jsx(dt,{to:`/console${R?`?project_id=${R}`:""}`,children:r.jsx(ht,{variant:"outline",children:"Try in Console"})})]})]}),!l&&o.length>0&&r.jsxs("div",{className:"rounded-lg sm:rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] overflow-hidden",children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(FR,{children:[r.jsx(BR,{className:"bg-[var(--color-bg-alt)]",children:De.getHeaderGroups().map(he=>r.jsx(nh,{children:he.headers.map(ke=>r.jsx(zl,{style:{width:ke.getSize()!==150?ke.getSize():void 0},children:ke.isPlaceholder?null:o$(ke.column.columnDef.header,ke.getContext())},ke.id))},he.id))}),r.jsx(qR,{children:De.getRowModel().rows.length?De.getRowModel().rows.map(he=>r.jsx(nh,{"data-state":he.getIsSelected()&&"selected",className:"group hover:bg-[var(--color-bg-hover)] cursor-pointer",onClick:()=>ve(he.original),children:he.getVisibleCells().map(ke=>r.jsx(qi,{onClick:Ve=>{(ke.column.id==="actions"||ke.column.id==="id")&&Ve.stopPropagation()},children:o$(ke.column.columnDef.cell,ke.getContext())},ke.id))},he.id)):r.jsx(nh,{children:r.jsx(qi,{colSpan:ut.length,className:"h-24 text-center",children:"No results."})})})]})}),Ze&&r.jsx(Ike,{onDismiss:()=>Se(!0)}),r.jsx(Pke,{table:De,totalRecords:o.length})]}),q&&r.jsx(l$,{record:q,effectiveFields:Oe,mode:"edit",saving:F,onSave:be,onClose:()=>J(null)}),ae&&r.jsx(l$,{record:null,effectiveFields:Oe,mode:"create",saving:U,onSave:nt,onClose:()=>H(!1)})]})})}var d2="rovingFocusGroup.onEntryFocus",Dke={bubbles:!1,cancelable:!0},ab="RovingFocusGroup",[h5,EV,$ke]=zw(ab),[Uke,fm]=bo(ab,[$ke]),[Fke,Bke]=Uke(ab),TV=x.forwardRef((e,t)=>
834r.jsx(h5.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(h5.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(qke,{...e,ref:t})})}));TV.displayName=ab;var qke=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,orientation:n,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...h}=e,g=x.useRef(null),v=Vs(t,g),y=um(o),[_,j]=go({prop:i,defaultProp:l??null,onChange:c,caller:ab}),[w,k]=x.useState(!1),S=ol(u),E=EV(s),T=x.useRef(!1),[A,R]=x.useState(0);return x.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(d2,S),()=>I.removeEventListener(d2,S)},[S]),r.jsx(Fke,{scope:s,orientation:n,dir:y,loop:a,currentTabStopId:_,onItemFocus:x.useCallback(I=>j(I),[j]),onItemShiftTab:x.useCallback(()=>k(!0),[]),onFocusableItemAdd:x.useCallback(()=>R(I=>I+1),[]),onFocusableItemRemove:x.useCallback(()=>R(I=>I-1),[]),children:r.jsx(fs.div,{tabIndex:w||A===0?-1:0,"data-orientation":n,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Lt(e.onMouseDown,()=>{T.current=!0}),onFocus:Lt(e.onFocus,I=>{const L=!T.current;if(I.target===I.currentTarget&&L&&!w){const M=new CustomEvent(d2,Dke);if(I.currentTarget.dispatchEvent(M),!M.defaultPrevented){const O=E().filter(q=>q.focusable),z=O.find(q=>q.active),X=O.find(q=>q.id===_),K=[z,X,...O].filter(Boolean).map(q=>q.ref.current);PV(K,f)}}T.current=!1}),onBlur:Lt(e.onBlur,()=>k(!1))})})}),RV="RovingFocusGroupItem",AV=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,focusable:n=!0,active:a=!1,tabStopId:o,children:i,...l}=e,c=po(),u=o||c,f=Bke(RV,s),h=f.currentTabStopId===u,g=EV(s),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:_}=f;return x.useEffect(()=>{if(n)return v(),()=>y()}
834,[n,v,y]),r.jsx(h5.ItemSlot,{scope:s,id:u,focusable:n,active:a,children:r.jsx(fs.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Lt(e.onMouseDown,j=>{n?f.onItemFocus(u):j.preventDefault()}),onFocus:Lt(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:Lt(e.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){f.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const w=Vke(j,f.orientation,f.dir);if(w!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let S=g().filter(E=>E.focusable).map(E=>E.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const E=S.indexOf(j.currentTarget);S=f.loop?Gke(S,E+1):S.slice(E+1)}setTimeout(()=>PV(S))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:_!=null}):i})})});AV.displayName=RV;var zke={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hke(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vke(e,t,s){const n=Hke(e.key,s);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return zke[n]}function PV(e,t=!1){const s=document.activeElement;for(const n of e)if(n===s||(n.focus({preventScroll:t}),document.activeElement!==s))return}function Gke(e,t){return e.map((s,n)=>e[(t+n)%e.length])}var JR=TV,XR=AV;function Wke(e){const t=Yke(e),s=x.forwardRef((n,a)=>{const{children:o,...i}=n,l=x.Children.toArray(o),c=l.find(Jke);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function Yke(e){const t=x.forwardRef((s,n)=>{const{children:a,...o}=s;if(x.isValidElement(a)){const i=Qke(a),l=Xke(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kke=Symbol("radix.slottable");function Jke(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Kke}function Xke(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function Qke(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var m5=["Enter"," "],Zke=["ArrowDown","PageUp","Home"],IV=["ArrowUp","PageDown","End"],eSe=[...Zke,...IV],tSe={ltr:[...m5,"ArrowRight"],rtl:[...m5,"ArrowLeft"]},sSe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ob="Menu",[_v,rSe,nSe]=zw(ob),[Ap,MV]=bo(ob,[nSe,dm,fm]),Xw=dm(),OV=fm(),[aSe,Pp]=Ap(ob),[oSe,ib]=Ap(ob),LV=e=>{const{__scopeMenu:t,open:s=!1,children:n,dir:a,onOpenChange:o,modal:i=!0}=e,l=Xw(t),[c,u]=x.useState(null),f=x.useRef(!1),h=ol(o),g=um(a);return x.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),r.jsx(PR,{...l,children:r.jsx(aSe,{scope:t,open:s,onOpenChange:h,content:c,onContentChange:u,children:r.jsx(oSe,{scope:t,onClose:x.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:i,children:n})})})};LV.displayName=ob;var iSe="MenuAnchor",QR=x.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e,a=Xw(s);return r.jsx(IR,{...a,...n,ref:t})});QR.displayName=iSe;var ZR="MenuPortal",[lSe,DV]=Ap(ZR,{forceMount:void 0}),$V=e=>{const{__scopeMenu:t,forceMount:s,children:n,container:a}=e,o=Pp(ZR,t);return r.jsx(lSe,{scope:t,forceMount:s,children:r.jsx(Xo,{present:s||o.open,children:r.jsx(rb,{asChild:!0,container:a,children:n})})})};$V.displayName=ZR;var zo="MenuContent",[cSe,eA]=Ap(zo),UV=x.forwardRef((e,t)=>
834{const s=DV(zo,e.__scopeMenu),{forceMount:n=s.forceMount,...a}=e,o=Pp(zo,e.__scopeMenu),i=ib(zo,e.__scopeMenu);return r.jsx(_v.Provider,{scope:e.__scopeMenu,children:r.jsx(Xo,{present:n||o.open,children:r.jsx(_v.Slot,{scope:e.__scopeMenu,children:i.modal?r.jsx(dSe,{...a,ref:t}):r.jsx(uSe,{...a,ref:t})})})})}),dSe=x.forwardRef((e,t)=>{const s=Pp(zo,e.__scopeMenu),n=x.useRef(null),a=Vs(t,n);return x.useEffect(()=>{const o=n.current;if(o)return HR(o)},[]),r.jsx(tA,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:Lt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),uSe=x.forwardRef((e,t)=>{const s=Pp(zo,e.__scopeMenu);return r.jsx(tA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),pSe=Wke("MenuContent.ScrollLock"),tA=x.forwardRef((e,t)=>{const{__scopeMenu:s,loop:n=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:y,..._}=e,j=Pp(zo,s),w=ib(zo,s),k=Xw(s),S=OV(s),E=rSe(s),[T,A]=x.useState(null),R=x.useRef(null),I=Vs(t,R,j.onContentChange),L=x.useRef(0),M=x.useRef(""),O=x.useRef(0),z=x.useRef(null),X=x.useRef("right"),W=x.useRef(0),K=y?Gw:x.Fragment,q=y?{as:pSe,allowPinchZoom:!0}:void 0,J=V=>{var Q,le;const $=M.current+V,B=E().filter(Se=>!Se.disabled),ae=document.activeElement,H=(Q=B.find(Se=>Se.ref.current===ae))==null?void 0:Q.textValue,U=B.map(Se=>Se.textValue),oe=NSe(U,$,H),fe=(le=B.find(Se=>Se.textValue===oe))==null?void 0:le.ref.current;(function Se(we){M.current=we,window.clearTimeout(L.current),we!==""&&(L.current=window.setTimeout(()=>Se(""),1e3))})($),fe&&setTimeout(()=>fe.focus())};x.useEffect(()=>()=>window.clearTimeout(L.current),[]),zR();const F=x.useCallback(V=>{var B,ae;return X.current===((B=z.current)==null?void 0:B.side)&&SSe(V,(ae=z.current)==null?void 0:ae.area)},[]);return r.jsx(cSe,{scope:s,searchRef:M,onItemEnter:x.useCallback(V=>{F(V)&&V.preventDefault()},[F]),onItemLeave:x.useCallback(V=>{var $;F(V)||(($=R.current)==null||$.focus(),A(null))},[F]),onTriggerLeave:x.useCallback(V=>{F(V)&&V.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:x.useCallback(V=>{z.current=V},[]),children:r.jsx(K,{...q,children:r.jsx(Hw,{asChild:!0,trapped:a,onMountAutoFocus:Lt(o,V=>{var $;V.preventDefault(),($=R.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:r.jsx(tb,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:r.jsx(JR,{asChild:!0,...S,dir:w.dir,orientation:"vertical",loop:n,currentTabStopId:T,onCurrentTabStopIdChange:A,onEntryFocus:Lt(c,V=>{w.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(MR,{role:"menu","aria-orientation":"vertical","data-state":t7(j.open),"data-radix-menu-content":"",dir:w.dir,...k,..._,ref:I,style:{outline:"none",..._.style},onKeyDown:Lt(_.onKeyDown,V=>{const B=V.target.closest("[data-radix-menu-content]")===V.currentTarget,ae=V.ctrlKey||V.altKey||V.metaKey,H=V.key.length===1;B&&(V.key==="Tab"&&V.preventDefault(),!ae&&H&&J(V.key));const U=R.current;if(V.target!==U||!eSe.includes(V.key))return;V.preventDefault();const fe=E().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);IV.includes(V.key)&&fe.reverse(),jSe(fe)}),onBlur:Lt(e.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(L.current),M.current="")}),onPointerMove:Lt(e.onPointerMove,jv(V=>{const $=V.target,B=W.current!==V.clientX;if(V.currentTarget.contains($)&&B){const ae=V.clientX>W.current?"right":"left";X.current=ae,W.current=V.clientX}}))})})})})})})});UV.displayName=zo;var fSe="MenuGroup",sA=x.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx(fs.div,{role:"group",...n,ref:t})});sA.displayName=fSe;var hSe="MenuLabel",FV=x.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx(fs.div,{...n,ref:t})});FV.displayName=hSe;var Cj="MenuItem",c$="menu.itemSelect",Qw=x.forwardRef((e,t)=>
834{const{disabled:s=!1,onSelect:n,...a}=e,o=x.useRef(null),i=ib(Cj,e.__scopeMenu),l=eA(Cj,e.__scopeMenu),c=Vs(t,o),u=x.useRef(!1),f=()=>{const h=o.current;if(!s&&h){const g=new CustomEvent(c$,{bubbles:!0,cancelable:!0});h.addEventListener(c$,v=>n==null?void 0:n(v),{once:!0}),HH(h,g),g.defaultPrevented?u.current=!1:i.onClose()}};return r.jsx(BV,{...a,ref:c,disabled:s,onClick:Lt(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),u.current=!0},onPointerUp:Lt(e.onPointerUp,h=>{var g;u.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Lt(e.onKeyDown,h=>{const g=l.searchRef.current!=="";s||g&&h.key===" "||m5.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Qw.displayName=Cj;var BV=x.forwardRef((e,t)=>{const{__scopeMenu:s,disabled:n=!1,textValue:a,...o}=e,i=eA(Cj,s),l=OV(s),c=x.useRef(null),u=Vs(t,c),[f,h]=x.useState(!1),[g,v]=x.useState("");return x.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[o.children]),r.jsx(_v.ItemSlot,{scope:s,disabled:n,textValue:a??g,children:r.jsx(XR,{asChild:!0,...l,focusable:!n,children:r.jsx(fs.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:Lt(e.onPointerMove,jv(y=>{n?i.onItemLeave(y):(i.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Lt(e.onPointerLeave,jv(y=>i.onItemLeave(y))),onFocus:Lt(e.onFocus,()=>h(!0)),onBlur:Lt(e.onBlur,()=>h(!1))})})})}),mSe="MenuCheckboxItem",qV=x.forwardRef((e,t)=>{const{checked:s=!1,onCheckedChange:n,...a}=e;return r.jsx(WV,{scope:e.__scopeMenu,checked:s,children:r.jsx(Qw,{role:"menuitemcheckbox","aria-checked":Ej(s)?"mixed":s,...a,ref:t,"data-state":nA(s),onSelect:Lt(a.onSelect,()=>n==null?void 0:n(Ej(s)?!0:!s),{checkForDefaultPrevented:!1})})})});qV.displayName=mSe;var zV="MenuRadioGroup",[gSe,xSe]=Ap(zV,{value:void 0,onValueChange:()=>{}}),HV=x.forwardRef((e,t)=>{const{value:s,onValueChange:n,...a}=e,o=ol(n);return r.jsx(gSe,{scope:e.__scopeMenu,value:s,onValueChange:o,children:r.jsx(sA,{...a,ref:t})})});HV.displayName=zV;var VV="MenuRadioItem",GV=x.forwardRef((e,t)=>{const{value:s,...n}=e,a=xSe(VV,e.__scopeMenu),o=s===a.value;return r.jsx(WV,{scope:e.__scopeMenu,checked:o,children:r.jsx(Qw,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":nA(o),onSelect:Lt(n.onSelect,()=>{var i;return(i=a.onValueChange)==null?void 0:i.call(a,s)},{checkForDefaultPrevented:!1})})})});GV.displayName=VV;var rA="MenuItemIndicator",[WV,vSe]=Ap(rA,{checked:!1}),YV=x.forwardRef((e,t)=>{const{__scopeMenu:s,forceMount:n,...a}=e,o=vSe(rA,s);return r.jsx(Xo,{present:n||Ej(o.checked)||o.checked===!0,children:r.jsx(fs.span,{...a,ref:t,"data-state":nA(o.checked)})})});YV.displayName=rA;var bSe="MenuSeparator",KV=x.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e;return r.jsx(fs.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});KV.displayName=bSe;var ySe="MenuArrow",JV=x.forwardRef((e,t)=>{const{__scopeMenu:s,...n}=e,a=Xw(s);return r.jsx(OR,{...a,...n,ref:t})});JV.displayName=ySe;var _Se="MenuSub",[LOe,XV]=Ap(_Se),fx="MenuSubTrigger",QV=x.forwardRef((e,t)=>{const s=Pp(fx,e.__scopeMenu),n=ib(fx,e.__scopeMenu),a=XV(fx,e.__scopeMenu),o=eA(fx,e.__scopeMenu),i=x.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},f=x.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return x.useEffect(()=>f,[f]),x.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),r.jsx(QR,{asChild:!0,...u,children:r.jsx(BV,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":a.contentId,"data-state":t7(s.open),...e,ref:hc(t,a.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),s.open||s.onOpenChange(!0))},onPointerMove:Lt(e.onPointerMove,jv(h=>{o.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!s.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{s.onOpenChange(!0),f()},100))})),onPointerLeave:Lt(e.onPointerLeave,jv(h=>{var v,y;f();const g=(v=s.content)==null?void 0:v.getBoundingClientRect();if(g){const _=(y=s.content)==null?void 0:y.dataset.side,j=_==="right",w=j?-5:5,k=g[j?"left":"right"],S=g[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:h.clientX+w,y:h.clientY},{x:k,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:k,y:g.bottom}],side:_}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>
834o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(h),h.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Lt(e.onKeyDown,h=>{var v;const g=o.searchRef.current!=="";e.disabled||g&&h.key===" "||tSe[n.dir].includes(h.key)&&(s.onOpenChange(!0),(v=s.content)==null||v.focus(),h.preventDefault())})})})});QV.displayName=fx;var ZV="MenuSubContent",e7=x.forwardRef((e,t)=>{const s=DV(zo,e.__scopeMenu),{forceMount:n=s.forceMount,...a}=e,o=Pp(zo,e.__scopeMenu),i=ib(zo,e.__scopeMenu),l=XV(ZV,e.__scopeMenu),c=x.useRef(null),u=Vs(t,c);return r.jsx(_v.Provider,{scope:e.__scopeMenu,children:r.jsx(Xo,{present:n||o.open,children:r.jsx(_v.Slot,{scope:e.__scopeMenu,children:r.jsx(tA,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;i.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Lt(e.onFocusOutside,f=>{f.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Lt(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:Lt(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=sSe[i.dir].includes(f.key);h&&g&&(o.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});e7.displayName=ZV;function t7(e){return e?"open":"closed"}function Ej(e){return e==="indeterminate"}function nA(e){return Ej(e)?"indeterminate":e?"checked":"unchecked"}function jSe(e){const t=document.activeElement;for(const s of e)if(s===t||(s.focus(),document.activeElement!==t))return}function wSe(e,t){return e.map((s,n)=>e[(t+n)%e.length])}function NSe(e,t,s){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=s?e.indexOf(s):-1;let i=wSe(e,Math.max(o,0));a.length===1&&(i=i.filter(u=>u!==s));const c=i.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return c!==s?c:void 0}function kSe(e,t){const{x:s,y:n}=e;let a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const l=t[o],c=t[i],u=l.x,f=l.y,h=c.x,g=c.y;f>n!=g>n&&s<(h-u)*(n-f)/(g-f)+u&&(a=!a)}return a}function SSe(e,t){if(!t)return!1;const s={x:e.clientX,y:e.clientY};return kSe(s,t)}function jv(e){return t=>t.pointerType==="mouse"?e(t):void 0}var CSe=LV,ESe=QR,TSe=$V,RSe=UV,ASe=sA,PSe=FV,ISe=Qw,MSe=qV,OSe=HV,LSe=GV,DSe=YV,$Se=KV,USe=JV,FSe=QV,BSe=e7,Zw="DropdownMenu",[qSe,DOe]=bo(Zw,[MV]),Sa=MV(),[zSe,s7]=qSe(Zw),r7=e=>{const{__scopeDropdownMenu:t,children:s,dir:n,open:a,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=Sa(t),u=x.useRef(null),[f,h]=go({prop:a,defaultProp:o??!1,onChange:i,caller:Zw});return r.jsx(zSe,{scope:t,triggerId:po(),triggerRef:u,contentId:po(),open:f,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(g=>!g),[h]),modal:l,children:r.jsx(CSe,{...c,open:f,onOpenChange:h,dir:n,modal:l,children:s})})};r7.displayName=Zw;var n7="DropdownMenuTrigger",a7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,disabled:n=!1,...a}=e,o=s7(n7,s),i=Sa(s);return r.jsx(ESe,{asChild:!0,...i,children:r.jsx(fs.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:hc(t,o.triggerRef),onPointerDown:Lt(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:Lt(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});a7.displayName=n7;var HSe="DropdownMenuPortal",o7=e=>{const{__scopeDropdownMenu:t,...s}=e,n=Sa(t);return r.jsx(TSe,{...n,...s})};o7.displayName=HSe;var i7="DropdownMenuContent",l7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=s7(i7,s),o=Sa(s),i=x.useRef(!1);return r.jsx(RSe,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...n,ref:t,onCloseAutoFocus:Lt(e.onCloseAutoFocus,l=>{var c;i.current||(c=a.triggerRef.current)==null||c.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:Lt(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!a.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});l7.displayName=i7;var VSe="DropdownMenuGroup",GSe=x.forwardRef((e,t)=>
834{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(ASe,{...a,...n,ref:t})});GSe.displayName=VSe;var WSe="DropdownMenuLabel",c7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(PSe,{...a,...n,ref:t})});c7.displayName=WSe;var YSe="DropdownMenuItem",d7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(ISe,{...a,...n,ref:t})});d7.displayName=YSe;var KSe="DropdownMenuCheckboxItem",u7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(MSe,{...a,...n,ref:t})});u7.displayName=KSe;var JSe="DropdownMenuRadioGroup",XSe=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(OSe,{...a,...n,ref:t})});XSe.displayName=JSe;var QSe="DropdownMenuRadioItem",p7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(LSe,{...a,...n,ref:t})});p7.displayName=QSe;var ZSe="DropdownMenuItemIndicator",f7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(DSe,{...a,...n,ref:t})});f7.displayName=ZSe;var e2e="DropdownMenuSeparator",h7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx($Se,{...a,...n,ref:t})});h7.displayName=e2e;var t2e="DropdownMenuArrow",s2e=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(USe,{...a,...n,ref:t})});s2e.displayName=t2e;var r2e="DropdownMenuSubTrigger",m7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(FSe,{...a,...n,ref:t})});m7.displayName=r2e;var n2e="DropdownMenuSubContent",g7=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:s,...n}=e,a=Sa(s);return r.jsx(BSe,{...a,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});g7.displayName=n2e;var a2e=r7,o2e=a7,i2e=o7,x7=l7,v7=c7,b7=d7,y7=u7,_7=p7,j7=f7,w7=h7,N7=m7,k7=g7;const d$=a2e,u$=o2e,l2e=x.forwardRef(({className:e,inset:t,children:s,...n},a)=>r.jsxs(N7,{ref:a,className:cs("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n,children:[s,r.jsx(Hn,{className:"ml-auto"})]}));l2e.displayName=N7.displayName;const c2e=x.forwardRef(({className:e,...t},s)=>r.jsx(k7,{ref:s,className:cs("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));c2e.displayName=k7.displayName;const g5=x.forwardRef(({className:e,sideOffset:t=4,...s},n)=>r.jsx(i2e,{children:r.jsx(x7,{ref:n,sideOffset:t,className:cs("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...s})}));g5.displayName=x7.displayName;const Au=x.forwardRef(({className:e,inset:t,...s},n)=>r.jsx(b7,{ref:n,className:cs("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...s}));Au.displayName=b7.displayName;const d2e=x.forwardRef(({className:e,children:t,checked:s,...n},a)=>r.jsxs(y7,{ref:a,className:cs("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(j7,{children:r.jsx(ts,{className:"h-4 w-4"})})}),t]}));d2e.displayName=y7.displayName;const u2e=x.forwardRef(({className:e,children:t,...s},n)=>r.jsxs(_7,{ref:n,className:cs("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(j7,{children:r.jsx(Spe,{className:"h-2 w-2 fill-current"})})}),t]}));u2e.displayName=_7.displayName;const p2e=x.forwardRef(({className:e,inset:t,...s},n)=>r.jsx(v7,{ref:n,className:cs("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));p2e.displayName=v7.displayName;const x5=x.forwardRef(({className:e,...t},s)=>r.jsx(w7,{ref:s,className:cs("-mx-1 my-1 h-px bg-muted",e),...t}));x5.displayName=w7.displayName;function e1({label:e="Project",onSelect:t,initialProjectId:s=null,includeAllOption:n=!0,autoSelectFirst:a=!0,onProjectsLoaded:o,variant:i="card"}){var k,S,E,T;const{getToken:l}=zt(),[c,u]=x.useState([]),[f,h]=x.useState(s),[g,v]=x.useState(!0),y=x.useRef(!1);x.useEffect(()=>{(async()=>{try{v(!0);const R=await Ue(l);if(!R)return;const L=(await ue.get("/projects",{authToken:R})).data.projects||[];u(L),o==null||o(L)}catch(R){console.error("Failed to load projects for context bar",R),o==null||o([])}finally{v(!1)}})()},[l]),x.useEffect(()=>{var A;if(!c.length){s===null&&f!==null&&(h(null),t==null||t(null)),y.current=!1;return}if(s!==null){f!==s&&h(s),y.current||t==null||t(s),y.current=!0;return}if(!a){y.current=!0,f!==null&&(h(null),t==null||t(null));return}if(!y.current&&f===null){const R=((A=c[0])==null?void 0:A.id)??null;R!==null&&(h(R),t==null||t(R)),y.current=!0}},[a,s,t,c,f]);const _=A=>{const R=A==="__all__"?null:Number(A);y.current=!0,h(R),t==null||t(R)},j=i==="inline"?"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)]":"rounded-md border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)]",w=r.jsxs(xi,{value:(f==null?void 0:f.toString())??"__all__",onValueChange:_,disabled:g||c.length===0,children:[r.jsx(Wo,{className:j,children:r.jsx(vi,{placeholder:c.length===0?"N
834o projects":"All projects"})}),r.jsx(Yo,{className:"w-[var(--radix-select-trigger-width)] bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:c.length===0?r.jsx(yr,{value:"__none__",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"No projects"}):r.jsxs(r.Fragment,{children:[n&&r.jsx(yr,{value:"__all__",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"All projects"}),c.map(A=>r.jsx(yr,{value:A.id.toString(),className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:r.jsxs("span",{className:"block truncate",children:[A.name," /",A.slug]})},A.id))]})})]});return!g&&c.length===0?i==="inline"?r.jsxs("div",{className:"flex flex-col gap-1 min-w-[240px]",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:"No projects yet."}),r.jsx(dt,{className:Jt.primaryEmphasis,to:"/projects",children:"+ Create project"})]})]}):r.jsxs("div",{className:"w-full rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-4 py-3 flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Create a project to continue."}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Collections, logs, and data explorer features are scoped to a project."})]}),r.jsx(dt,{className:Jt.primaryEmphasis,to:"/projects",children:"+ Create project"})]}):i==="inline"?r.jsxs("div",{className:"flex flex-col gap-1 min-w-[240px]",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),w,f!==null&&r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)] flex items-center gap-2",children:(k=c.find(A=>A.id===f))!=null&&k.organization_name?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-indigo-100 dark:bg-indigo-500/10 text-indigo-700 dark:text-indigo-200 px-2 py-1 border border-indigo-300 dark:border-indigo-500/20",children:["Org: ",(S=c.find(A=>A.id===f))==null?void 0:S.organization_name]}):r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Personal project"})})]}):r.jsxs("div",{className:"w-full rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-4 py-3 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsxs("div",{className:"flex flex-col gap-1 flex-1",children:[w,f!==null&&r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)] flex items-center gap-2",children:(E=c.find(A=>A.id===f))!=null&&E.organization_name?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-indigo-100 dark:bg-indigo-500/10 text-indigo-700 dark:text-indigo-200 px-2 py-1 border border-indigo-300 dark:border-indigo-500/20",children:["Org: ",(T=c.find(A=>A.id===f))==null?void 0:T.organization_name]}):r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Personal project"})})]})]})}function Vt({code:e,language:t="typescript",title:s,className:n,showCopy:a=!0,variants:o,defaultVariantId:i,readMoreHref:l,readMoreLabel:c}){var S;const{theme:u}=Sp(),[f,h]=x.useState(null),[g,v]=x.useState(!1),y=x.useMemo(()=>o&&o.length>0?o.map(E=>({...E,id:E.id||E.label||E.language})):e?[{id:t||"code",label:t||"code",language:t||"typescript",code:e}]:[],[o,e,t]),[_,j]=x.useState(i||((S=y[0])==null?void 0:S.id)||"");x.useEffect(()=>{if(!y.length)return;if(!y.some(T=>T.id===_)){const T=y.find(A=>A.id===i);j((T==null?void 0:T.id)||y[0].id)}},[y,_,i]);const w=y.find(E=>E.id===_)||y[0];x.useEffect(()=>{if(!w)return;let E=!0;return h(null),(async()=>{try{const T=await Zv(w.code,{lang:w.language,theme:u==="light"?"vitesse-light":"vitesse-dark"});E&&h(T)}catch(T){console.error("Highlighting failed",T)}})(),()=>{E=!1}},[w,u]);const k=async()=>
834{if(w)try{await navigator.clipboard.writeText(w.code),Z.track("code_sample_copied",{variant:w.id,language:w.language}),v(!0),setTimeout(()=>v(!1),1200)}catch(E){console.error("Copy failed",E)}};return r.jsxs("div",{className:rv("code-sample",n),children:[r.jsxs("div",{className:"code-sample__header",children:[r.jsxs("div",{className:"code-sample__meta",children:[s&&r.jsx("span",{className:"code-sample__title",children:s}),y.length>1?r.jsx("div",{className:"code-sample__tabs",children:y.map(E=>r.jsx("button",{type:"button",className:rv("code-sample__tab",E.id===(w==null?void 0:w.id)&&"is-active"),onClick:()=>j(E.id),children:E.label},E.id))}):w&&r.jsx("span",{className:"code-sample__lang",children:w.label||w.language})]}),r.jsxs("div",{className:"code-sample__actions",children:[l&&r.jsx("a",{className:"code-sample__read-more",href:l,children:c||"Read more"}),a&&w&&r.jsxs("button",{type:"button",className:"code-sample__copy",onClick:k,children:[r.jsx(is,{className:"w-3.5 h-3.5"}),g?"Copied":"Copy"]})]})]}),r.jsx("div",{className:"code-sample__body",dangerouslySetInnerHTML:{__html:Rp(f||`<pre class="fallback">${((w==null?void 0:w.code)||"").replace(/</g,"<").replace(/>/g,">")}</pre>`)}})]})}function S7(e){if(!e)return null;if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return typeof e=="object"?e:null}function p$(e,t=4){const s=S7(e);if(!s||s.type!=="object"||!s.properties)return null;const n=Object.entries(s.properties).map(([i,l])=>{const c=(l==null?void 0:l.type)||"any";return`${i}: ${c}`});if(n.length===0)return null;const a=Math.max(0,n.length-t);return{display:n.slice(0,t).join(" · "),overflow:a}}function f2e(e,t,s){const n=`${t}s`;return e===1?`${e} ${t}`:`${e} ${n}`}function h2e(){Mn("Collections");const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),[n,a]=Wa(),o=un(),[i,l]=x.useState([]),[c,u]=x.useState(!1),[f,h]=x.useState(null),[g,v]=x.useState(()=>{const G=n.get("projectId");return G&&!Number.isNaN(Number(G))?Number(G):null}),[y,_]=x.useState(null),[,j]=x.useState(null),[w,k]=x.useState(!0),S="reqres_env_preference",E="reqres_collections_view_mode",[T,A]=x.useState(()=>{if(typeof window>"u")return"prod";const G=n.get("env");if(G==="dev"||G==="prod")return G;try{const ge=localStorage.getItem(S);if(ge==="dev"||ge==="prod")return ge}catch{}return"prod"}),[R,I]=x.useState(()=>{if(typeof window>"u")return"list";try{const G=localStorage.getItem(E);if(G==="grid"||G==="list")return G}catch{}return"list"}
834),[L,M]=x.useState(""),[O,z]=x.useState(!1),[X,W]=x.useState(""),[K,q]=x.useState(""),[J,F]=x.useState("private"),[V,$]=x.useState(""),[B,ae]=x.useState(!1),[H,U]=x.useState(null),[oe,fe]=x.useState(null),[Q,le]=x.useState(""),[Se,we]=x.useState(""),[Le,xe]=x.useState("private"),[de,Me]=x.useState(""),[je,Ae]=x.useState(!1),[Oe,Ke]=x.useState(null),[ut,De]=x.useState(null),[ct,rt]=x.useState(null),[mt,vt]=x.useState(null),[gt,Be]=x.useState(!1),[ve,be]=x.useState(null),[nt,Ze]=x.useState(!1),[he,ke]=x.useState(!1),Ve=Mt.dark,at=Jt.primary,Pt=Jt.secondary,Ct=Fd.dark,St=G=>{A(G);try{localStorage.setItem(S,G)}catch{}const ge=new URLSearchParams(n);ge.set("env",G),a(ge)},Xt=async()=>{try{u(!0),h(null);const G=await Ue(s);if(!G){h("Please sign in to continue");return}const ge=new URLSearchParams;g&&ge.set("project_id",String(g));const Gt=((await ue.get(`/data-explorer/collections?${ge}`,{authToken:G,env:T,headers:{"X-Reqres-Env":T}})).data.data||[]).map(es=>{const ls=S7(es==null?void 0:es.schema);return ls?{...es,schema:ls}:es});l(Gt),Z.setUserProperties({collections_count:Gt.length})}catch(G){console.error("Error fetching collections:",G),h("Failed to fetch collections")}finally{u(!1)}},It=async()=>{var G,ge,ze;if(!X.trim()){U("Name is required");return}try{ae(!0),U(null);const Gt=await Ue(s);if(!Gt&&!y){U("Please sign in or provide a project API key");return}const es={name:X.trim(),visibility:J};if(K.trim()&&(es.slug=K.trim()),g&&(es.project_id=g),V.trim())try{es.schema=JSON.parse(V)}catch{U("Schema must be valid JSON");return}const ls=await ue.post("/api/collections",es,{authToken:Gt||void 0,env:T,headers:{"Content-Type":"application/json",...y?{"x-api-key":y}:{},"X-Reqres-Env":T}}),pr=((G=ls.data)==null?void 0:G.slug)||((ze=(ge=ls.data)==null?void 0:ge.data)==null?void 0:ze.slug)||es.slug||X.trim().toLowerCase().replace(/\s+/g,"-"),et=es.schema||null;Z.track("collection_created",{env:T,project_id:g,collection_slug:pr}),Z.activationMilestone({milestone:"collection_created",project_id:g??void 0});const ye=X.trim();W(""),q(""),$(""),F("private"),z(!1),await Xt(),vt({name:ye,slug:pr,schema:et}),be(null),ke(!1),Z.track("collection_ready_drawer_shown",{collection_slug:pr,project_id:g})}catch(Gt){console.error("Failed to create collection",Gt),Z.track("collection_create_failed",{project_id:g,error:Gt instanceof yt?Gt.message:"unknown"});const es=Gt instanceof yt?Gt.message:"Could not create collection";U(es),it.error(es)}finally{ae(!1)}},ee=()=>{vt(null),be(null),ke(!1)},We=G=>`https://reqres.in/api/collections/${G}/records`,wt=(G,ge)=>{const ze=We(G);return[{id:"curl",label:"cURL",language:"bash",code:`curl -H "${ge?`x-api-key: ${ge}`:"x-api-key: YOUR_API_KEY"}" \\ 835 ${ze}`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const res = await fetch("${ze}", { 836 headers: { "x-api-key": "${ge||"YOUR_API_KEY"}" } 837}); 838const data = await res.json(); 839console.log(data);`},{id:"python",label:"Python",language:"python",code:`import requests 840 841res = requests.get("${ze}", 842 headers={"x-api-key": "${ge||"YOUR_API_KEY"}"}) 843print(res.json())`}]},_t=async G=>{if(y){Be(!0),be(null);try{const ge=await ue.get(`/api/collections/${G}/records`,{env:T,headers:{"x-api-key":y,"X-Reqres-Env":T}});be({status:ge.status,body:JSON.stringify(ge.data,null,2)}),Z.track("collection_ready_test_request",{collection_slug:G,project_id:g,status:ge.status})}catch(ge){be({status:ge instanceof yt?ge.status:0,body:ge instanceof yt?JSON.stringify(ge.data,null,2):ge.message})}finally{Be(!1)}}},Ee=async(G,ge)=>{if(y){Ze(!0);try{const ze=await Ue(s),Gt=He(ge);for(const es of Gt)await ue.post(`/api/collections/${G}/records`,{data:es},{authToken:ze||void 0,env:T,headers:{"Content-Type":"application/json","x-api-key":y,"X-Reqres-Env":T}});ke(!0),it.success(`Added ${Gt.length} sample records to "${G}".`),Z.track("collection_ready_seed_data",{collection_slug:G,project_id:g,records_count:Gt.length}),await Xt()}catch(ze){const Gt=ze instanceof yt?ze.message:"Failed to add sample data";it.error(Gt)}finally{Ze(!1)}}},He=G=>{if(G!=null&&G.properties||(G==null?void 0:G.type)==="object"&&(G!=null&&G.properties)){const ge=G.properties,ze=[],Gt={string:["Hello World","Sample item","Test entry","Demo record","Example data"],number:[1,2,3,42,100],boolean:[!0,!1,
843!0,!0,!1],integer:[1,2,3,4,5]};for(let es=0;es<5;es++){const ls={};for(const[pr,et]of Object.entries(ge)){const ye=(et==null?void 0:et.type)||"string",Qe=Gt[ye]||Gt.string;ls[pr]=Qe[es%Qe.length]}ze.push(ls)}return ze}return[{title:"First item",completed:!1,priority:1},{title:"Second item",completed:!0,priority:2},{title:"Third item",completed:!1,priority:3},{title:"Fourth item",completed:!1,priority:1},{title:"Fifth item",completed:!0,priority:2}]},ie=G=>{fe(G),le(G.name||""),we(G.slug||""),xe(G.visibility||"private"),Me(G.schema?JSON.stringify(G.schema,null,2):""),Ke(null)},Ce=()=>{fe(null),le(""),we(""),xe("private"),Me(""),Ke(null)},Ye=async()=>{if(oe)try{Ae(!0),Ke(null);const G=await Ue(s);if(!G&&!y){Ke("Please sign in or provide a project API key");return}const ge={name:Q.trim(),visibility:Le};if(Se.trim()&&(ge.slug=Se.trim()),de.trim())try{ge.schema=JSON.parse(de)}catch{Ke("Schema must be valid JSON");return}const ze=new URLSearchParams;g&&ze.append("project_id",String(g)),await ue.put(`/api/collections/${oe.slug}${ze.toString()?`?${ze}`:""}`,ge,{authToken:G||void 0,headers:{"Content-Type":"application/json",...y?{"x-api-key":y}:{}}}),it.success("Collection updated successfully."),Ce(),await Xt()}catch(G){console.error("Failed to update collection",G);const ge=G instanceof yt?G.message:"Could not update collection";Ke(ge),it.error(ge)}finally{Ae(!1)}},Pe=async G=>{if(confirm(`Delete "${G.name}"? This cannot be undone.`))try{De(G.slug);const ge=await Ue(s);if(!ge&&!y){it.error("Please sign in or provide a project API key.");return}const ze=new URLSearchParams;g&&ze.append("project_id",String(g)),await ue.delete(`/api/collections/${G.slug}${ze.toString()?`?${ze}`:""}`,{authToken:ge||void 0,env:T,headers:{...y?{"x-api-key":y}:{},"X-Reqres-Env":T}}),Z.track("collection_deleted",{collection_slug:G.slug,project_id:g}),it.success("Collection deleted."),await Xt()}catch(ge){console.error("Failed to delete collection",ge),Z.track("collection_delete_failed",{collection_slug:G.slug,project_id:g}),it.error("Failed to delete collection.")}finally{De(null)}},Ge=G=>`/api/collections/${G}/records`,Nt=async(G,ge)=>{ge==null||ge.stopPropagation();try{const ze=Ge(G);await navigator.clipboard.writeText(ze),rt(G),Z.track("copied_endpoint",{collection_slug:G}),it.success("Endpoint copied"),setTimeout(()=>rt(null),2e3)}catch{it.error("Failed to copy")}},Tt=G=>{I(G);try{localStorage.setItem(E,G)}catch{}},ss=x.useCallback(G=>{const ge=new URLSearchParams;g&&ge.set("projectId",String(g)),ge.set("collection",G),ge.set("env",T),o(`/data-explorer?${ge.toString()}`)},[o,g,T]),Zt=i.length>=5;x.useEffect(()=>{(async()=>{var ge,ze,Gt,es;if(!g){_(null),j(null);return}try{const ls=await Ue(s);if(!ls)return;const et=(await ue.get(`/projects/${g}`,{authToken:ls})).data,ye=(et==null?void 0:et.environment_keys)||{},Qe=((ge=ye==null?void 0:ye.prod)==null?void 0:ge.private)||((ze=et==null?void 0:et.project)==null?void 0:ze.api_key)||(et==null?void 0:et.api_key)||null,ne=((Gt=ye==null?void 0:ye.dev)==null?void 0:Gt.private)||null;_(T==="dev"&&ne||Qe),j(((es=et==null?void 0:et.project)==null?void 0:es.name)||(et==null?void 0:et.name)||null)}catch(ls){console.error("Failed to fetch project api key",ls),_(null),j(null)}})()},[s,g,T]),x.useEffect(()=>{!t||!e||w!==!1&&Xt()},[t,e,g,T,w]),x.useEffect(()=>{const G=new URLSearchParams(n);let ge=!1;G.get("env")!==T&&(G.set("env",T),ge=!0),g&&G.get("projectId")!==String(g)&&(G.set("projectId",String(g)),ge=!0),ge&&a(G)},[T,g,n,a]);const re=x.useMemo(()=>{if(!L.trim())return i;const G=L.toLowerCase();return i.filter(ge=>ge.name.toLowerCase().includes(G)||ge.slug.toLowerCase().includes(G))},[i,L]);return t?e?r.jsx($R,{children:r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8 space-y-6",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Collections"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Manage your data collections. Create schemas, configure visibility, and organize your backend data."})]}),r.jsx("div",{className:`${Ve} space-y-4`,children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[r.jsx(e1,{label:"Project",initialProjectId:g,autoSelectFirst:!0,variant:"inline",onProjectsLoaded:G=>k(G.length>0),onSelect:G=>{v(G);const ge=new URLSearchParams(n);G?ge.set("projectId",String(G)):ge.delete("projectId"),a(ge)}}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Environment"}),r.jsx("div",{className:"inline-flex rounded-full border border-[var(--color-border-default)] overflow-hidden",children:["prod","dev"].map(G=>r.jsx("button",{type:"button",onClick:()=>St(G),className:`px-3 py-1 text-xs font-semibold uppercase tracking-wide transition ${T===G?"bg-indigo-500/80 text-white":"bg-transparent text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:G},G))})]})]}),r.jsxs("button",{type:"button",className:at,onClick:()=>z(!0),disabled:!g,children:[r.jsx(ca,{className:"w-4 h-4 mr-1"}),"Create collection"]})]})}),Zt&&r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_h,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--color-fg-muted)]"}),r.jsx(id,{type:"text",placeholder:"Search collections...",value:L,onChange:G=>M(G.target.value),className:`${Ct} pl-9`})]}),r.jsxs("div",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-0.5",children:[r.jsxs("button",{type:"button",onClick:()=>Tt("grid"),className:`flex items-center gap-1 rounded-full px-3 py-1 text-[11px] transition ${R==="grid"?"bg-indigo-500 text-white":"text-[var(--color-fg-default)]"}`,children:[r.jsx(gfe,{className:"h-4 w-4"}),"Grid"]}),r.jsxs("button",{type:"button",onClick:()=>Tt("list"),className:`flex items-center gap-1 rounded-full px-3 py-1 text-[11px] transition ${R==="list"?"bg-indigo-500 text-white":"text-[var(--color-fg-default)]"}`,children:[r.jsx(_fe,{className:"h-4 w-4"}),"List"]})]})]}),f&&!c&&r.jsx("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/30 bg-[var(--color-semantic-danger-bg)] px-4 py-3 text-sm text-[var(--color-semantic-danger)]",children:f}),c&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading collections..."})}),!c&&!f&&g&&i.length===0&&r.jsxs("div",{className:`${Ve} text-center py-12 space-y-4`,children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-indigo-500/10 border border-indigo-400/20 flex items-center justify-center",children:r.jsx(Rn,{className:"w-8 h-8 text-indigo-300"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"No collections yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1 max-w-md mx-auto",children:"Collections store your app data with optional schemas. Create your first collection to start storing records."})]}),r.jsxs("button",{type:"button",className:at,onClick:()=>z(!0),children:[r.jsx(ca,{className:"w-4 h-4 mr-1"}),"Create your first collection"]})]}),!c&&!w&&r.jsxs("div",{className:`${Ve} text-center py-12 space-y-4`,children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-[var(--color-bg-hover)] flex items-center justify-center",children:r.jsx(Rn,{className:"w-8 h-8 text-[var(--color-fg-muted)]"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"No projects yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:"Create a project to start building collections."})]})]}),!c&&re.length>0&&R==="grid"&&r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:re.map(G=>{const ge=p$(G.schema);return r.jsxs("div",{onClick:()=>ss(G.slug),className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 space-y-3 hover:border-[var(--color-border-strong)] hover:bg-[var(--color-bg-alt)] hover:shadow-lg hover:-translate-y-0.5 transition-all cursor-pointer group",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.jsx("h3",{className:"text-base font-semibold text-[var(--color-fg-default)] truncate",children:G.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium shrink-0 ${G.visibility==="public"?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/20":"bg-[var(--color-bg-hover)] text-[var(--color-fg-secondary)] border border-[var(--color-border-default)]"}`,children:G.visibility||"private"})]}),r.jsxs(d$,{children:[r.jsx(u$,{asChild:!0,children:r.jsx("button",{type:"button",onClick:ze=>ze.stopPropagation(),className:"p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition opacity-0 group-hover:opacity-100",children:r.jsx(ov,{className:"w-4 h-4"})})}),r.jsxs(g5,{align:"end",className:"w-[180px]",children:[r.jsxs(Au,{onClick:ze=>{ze.stopPropagation(),ie(G)},children:[r.jsx(XC,{className:"mr-2 h-4 w-4"}),"Settings"]}),r.jsxs(Au,{onClick:ze=>Nt(G.slug,ze),children:[r.jsx(is,{className:"mr-2 h-4 w-4"}),"Copy endpoint"]}),r.jsx(x5,{}),r.jsxs(Au,{onClick:ze=>{ze.stopPropagation(),Pe(G)},disabled:ut===G.slug,className:"text-[var(--color-semantic-danger)] focus:text-[var(--color-semantic-danger)]",children:[r.jsx(nl,{className:"mr-2 h-4 w-4"}),"Delete collection"]})]})]})]}),!g&&G.project_name&&r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:G.project_name}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-[var(--color-fg-muted)] bg-[var(--color-bg-hover)] px-2 py-1 rounded font-mono truncate flex-1",children:Ge(G.slug)}),r.jsxs(k9,{children:[r.jsx(S9,{asChild:!0,children:r.jsx("button",{type:"button",onClick:ze=>Nt(G.slug,ze),className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition shrink-0",children:ct===G.slug?r.jsx(ts,{className:"w-3.5 h-3.5 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"w-3.5 h-3.5"})})}),r.jsx(UR,{children:"Copy endpoint"})]})]}),ge&&r.jsxs("div",{className:"text-xs text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"font-mono",children:ge.display}),ge.overflow>0&&r.jsxs("span",{className:"text-[var(--color-fg-faint)] ml-1",children:["+",ge.overflow," more"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--color-fg-muted)] pt-1",children:[r.jsx("span",{children:f2e(G.record_count??0,"record")}),G.created_at&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"·"}),r.jsxs("span",{children:["Created ",new Date(G.created_at).toLocaleDateString()]})]})]})]},G.id)})}),!c&&re.length>0&&R==="list"&&r.jsx("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] overflow-hidden",children:r.jsxs(FR,{children:[r.jsx(BR,{children:r.jsxs(nh,{className:"hover:bg-transparent border-[var(--color-border-default)]",children:[r.jsx(zl,{className:"w-[200px]",children:"Collection"}),r.jsx(zl,{className:"hidden md:table-cell",children:"Schema"}),r.jsx(zl,{className:"w-[90px] text-right",children:"Records"}),!g&&r.jsx(zl,{className:"hidden sm:table-cell",children:"Project"}),r.jsx(zl,{className:"hidden lg:table-cell",children:"Endpoint"}),r.jsx(zl,{className:"hidden sm:table-cell w-[110px]",children:"Created"}),r.jsx(zl,{className:"w-[60px]"})]})}),r.jsx(qR,{children:re.map(G=>{const ge=p$(G.schema,3);return r.jsxs(nh,{onClick:()=>ss(G.slug),className:"cursor-pointer hover:bg-[var(--color-bg-hover)] border-[var(--color-border-secondary)] group",children:[r.jsx(qi,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[var(--color-fg-default)] truncate",children:G.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium ${G.visibility==="public"?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/20":"bg-[var(--color-bg-hover)] text-[var(--color-fg-muted)] border border-[var(--color-border-secondary)]"}`,children:G.visibility||"private"})]})}),r.jsx(qi,{className:"hidden md:table-cell",children:ge?r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)] font-mono",children:[ge.display,ge.overflow>0&&r.jsxs("span",{className:"text-[var(--color-fg-faint)] ml-1",children:["+",ge.overflow]})]}):r.jsx("span",{className:"text-xs text-[var(--color-fg-faint)]",children:"-"})}),r.jsx(qi,{className:"text-right text-[var(--color-fg-secondary)]",children:G.record_count??0}),!g&&r.jsx(qi,{className:"hidden sm:table-cell",children:r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:G.project_name||"-"})}),r.jsx(qi,{className:"hidden lg:table-cell",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-[var(--color-fg-muted)] bg-[var(--color-bg-hover)] px-1.5 py-0.5 rounded font-mono truncate max-w-[220px]",children:Ge(G.slug)}),r.jsx("button",{type:"button",onClick:ze=>Nt(G.slug,ze),className:"text-[var(--color-fg-faint)] hover:text-[var(--color-fg-secondary)] transition opacity-0 group-hover:opacity-100",children:ct===G.slug?r.jsx(ts,{className:"w-3.5 h-3.5 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"w-3.5 h-3.5"})})]})}),r.jsx(qi,{className:"hidden sm:table-cell text-[var(--color-fg-muted)] text-xs",children:G.created_at?new Date(G.created_at).toLocaleDateString():"-"}),r.jsx(qi,{children:r.jsxs(d$,{children:[r.jsx(u$,{asChild:!0,children:r.jsx("button",{type:"button",onClick:ze=>ze.stopPropagation(),className:"p-1.5 rounded-md text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",children:r.jsx(ov,{className:"w-4 h-4"})})}),r.jsxs(g5,{align:"end",className:"w-[180px]",children:[r.jsxs(Au,{onClick:ze=>{ze.stopPropagation(),ie(G)},children:[r.jsx(XC,{className:"mr-2 h-4 w-4"}),"Settings"]}),r.jsxs(Au,{onClick:ze=>Nt(G.slug,ze),children:[r.jsx(is,{className:"mr-2 h-4 w-4"}),"Copy endpoint"]}),r.jsx(x5,{}),r.jsxs(Au,{onClick:ze=>{ze.stopPropagation(),Pe(G)},disabled:ut===G.slug,className:"text-[var(--color-semantic-danger)] focus:text-[var(--color-semantic-danger)]",children:[r.jsx(nl,{className:"mr-2 h-4 w-4"}),"Delete collection"]})]})]})})]},G.id)})})]})}),O&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-lg mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-border-default)]",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Create Collection"}),r.jsx("button",{type:"button",onClick:()=>{z(!1),U(null)},className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:r.jsx(Ir,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"px-6 py-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Name *"}),r.jsx(id,{value:X,onChange:G=>W(G.target.value),placeholder:"e.g., Todos, Users, Posts",className:Ct})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Slug"}),r.jsx(id,{value:K,onChange:G=>q(G.target.value),placeholder:"e.g., todos (auto-generated if empty)",className:Ct}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-faint)]",children:["Used in API paths: /collections/",K||"your-slug","/records"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-m
843edium text-[var(--color-fg-secondary)]",children:"Visibility"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button",onClick:()=>F("private"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium transition ${J==="private"?"bg-indigo-500 text-white":"bg-[var(--color-bg-hover)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-active)]"}`,children:"Private"}),r.jsx("button",{type:"button",onClick:()=>F("public"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium transition ${J==="public"?"bg-emerald-500 text-white":"bg-[var(--color-bg-hover)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-active)]"}`,children:"Public"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Schema (optional JSON)"}),r.jsx("textarea",{value:V,onChange:G=>$(G.target.value),placeholder:'{ "type": "object", "properties": { "title": { "type": "string" } } }',rows:4,className:`${Ct} w-full font-mono text-xs resize-none`})]}),H&&r.jsx("div",{className:"text-xs text-[var(--color-semantic-danger)]",children:H})]}),r.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-[var(--color-border-default)]",children:[r.jsx("button",{type:"button",className:Pt,onClick:()=>{z(!1),U(null)},children:"Cancel"}),r.jsx("button",{type:"button",className:at,onClick:It,disabled:B||!X.trim(),children:B?"Creating...":"Create Collection"})]})]})}),oe&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-lg mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-border-default)]",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Edit Collection"}),r.jsx("button",{type:"button",onClick:Ce,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:r.jsx(Ir,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"px-6 py-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Name"}),r.jsx(id,{value:Q,onChange:G=>le(G.target.value),className:Ct})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Slug"}),r.jsx(id,{value:Se,onChange:G=>we(G.target.value),className:Ct})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Visibility"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button",onClick:()=>xe("private"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium transition ${Le==="private"?"bg-indigo-500 text-white":"bg-[var(--color-bg-hover)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-active)]"}`,children:"Private"}),r.jsx("button",{type:"button",onClick:()=>xe("public"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium transition ${Le==="public"?"bg-emerald-500 text-white":"bg-[var(--color-bg-hover)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-active)]"}`,children:"Public"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Schema (JSON)"}),r.jsx("textarea",{value:de,onChange:G=>Me(G.target.value),rows:6,className:`${Ct} w-full font-mono text-xs resize-none`})]}),Oe&&r.jsx("div",{className:"text-xs text-[var(--color-semantic-danger)]",children:Oe})]}),r.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-[var(--color-border-default)]",children:[r.jsx("button",{type:"button",className:Pt,onClick:Ce,children:"Cancel"}),r.jsx("button",{type:"button",className:at,onClick:Ye,disabled:je,children:je?"Saving...":"Save Changes"})]})]})}),mt&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-xl mx-4 mb-4 sm:mb-0 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-emerald-500/10 flex items-center justify-center",children:r.jsx(ts,{className:"w-4 h-4 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Your collection is ready"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:r.jsx("span",{className:"font-mono",children:mt.name})})]})]}),r.jsx("button",{type:"button",onClick:ee,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:r.jsx(Ir,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"px-6 py-5 space-y-5",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Your API endpoint"}),r.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-[var(--color-bg-hover)] px-3 py-2.5 font-mono text-xs text-[var(--color-fg-default)]",children:[r.jsx("span",{className:"flex-1 truncate",children:We(mt.slug)}),r.jsx("button",{type:"button",className:"shrink-0 text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:()=>{navigator.clipboard.writeText(We(mt.slug)),it.success("Endpoint copied")},children:r.jsx(is,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Fetch your data"}),r.jsx(Vt,{variants:wt(mt.slug,y),defaultVariantId:"curl",title:"GET records"})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("button",{type:"button",className:`${at} w-full flex items-center justify-center gap-2`,onClick:()=>_t(mt.slug),disabled:gt||!y,children:[r.jsx(cp,{className:"w-3.5 h-3.5"}),gt?"Sending...":"Send test request"]}),he?r.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-xs text-emerald-500 py-2",children:[r.jsx(ts,{className:"w-3.5 h-3.5"}),"Sample records added"]}):r.jsxs("button",{type:"button",className:`${Pt} w-full flex items-center justify-center gap-2`,onClick:()=>Ee(mt.slug,mt.schema),disabled:nt||!y,children:[r.jsx(rr,{className:"w-3.5 h-3.5"}),nt?"Adding records...":"Add 5 sample records"]})]}),ve&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("span",{className:`text-xs font-medium ${ve.status>=200&&ve.status<300?"text-emerald-500":"text-[var(--color-semantic-danger)]"}`,children:[ve.status>=200&&ve.status<300?"Success":"Error"," ",ve.status]})}),r.jsx(Vt,{code:ve.body,language:"json",title:"Response"})]}),r.jsxs("div",{className:"border-t border-[var(--color-border-default)] pt-4 space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-[var(--color-fg-secondary)]",children:"Next steps"}),r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("button",{type:"button",className:"flex items-center gap-2 text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition text-left",onClick:()=>{ee(),o(`/data-explorer?projectId=${g}&collection=${mt.slug}&env=${T}`),Z.track("collection_ready_navigate",{destination:"data_explorer",collection_slug:mt.slug})},children:[r.jsx(Rn,{className:"w-3.5 h-3.5 shrink-0"}
843),"Open in Data Explorer",r.jsx(Kt,{className:"w-3 h-3 ml-auto"})]}),r.jsxs("button",{type:"button",className:"flex items-center gap-2 text-xs text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition text-left",onClick:()=>{ee(),o(`/console${g?`?project_id=${g}`:""}`),Z.track("console_entered_from_collection_created",{collection_slug:mt.slug})},children:[r.jsx(ja,{className:"w-3.5 h-3.5 shrink-0"}),"Try in Project Console",r.jsx(Kt,{className:"w-3 h-3 ml-auto"})]})]})]})]}),r.jsx("div",{className:"flex items-center justify-end px-6 py-4 border-t border-[var(--color-border-default)]",children:r.jsx("button",{type:"button",className:Pt,onClick:ee,children:"Done"})})]})})]})}):r.jsx("div",{className:"max-w-6xl mx-auto px-6 py-8",children:r.jsx("div",{className:"text-center text-semantic-danger",children:"You must be signed in to view collections."})}):r.jsx("div",{className:"max-w-6xl mx-auto px-6 py-8",children:r.jsx("div",{className:"text-center",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading..."})})})}const Ht=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Nr("w-full max-w-full overflow-hidden rounded-2xl border border-border bg-background-card text-foreground shadow-sm",e),...t}));Ht.displayName="Card";const C7=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Nr("flex flex-col space-y-1.5 p-6",e),...t}));C7.displayName="CardHeader";const E7=x.forwardRef(({className:e,...t},s)=>r.jsx("h3",{ref:s,className:Nr("text-xl font-semibold leading-none tracking-tight text-foreground",e),...t}));E7.displayName="CardTitle";const T7=x.forwardRef(({className:e,...t},s)=>r.jsx("p",{ref:s,className:Nr("text-sm text-foreground-secondary",e),...t}));T7.displayName="CardDescription";const R7=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Nr("p-6 pt-0",e),...t}));R7.displayName="CardContent";const m2e=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:Nr("flex items-center p-6 pt-0",e),...t}));m2e.displayName="CardFooter";const Is=x.forwardRef(({className:e,type:t,...s},n)=>r.jsx("input",{type:t,className:Nr("w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2.5 text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] shadow-sm outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500/80 disabled:opacity-60 disabled:cursor-not-allowed",e),ref:n,...s}));Is.displayName="Input";const g2e=rm("inline-flex items-center rounded-full 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-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-alt)]/80",secondary:"border-transparent bg-[var(--color-bg-card)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-card)]/80",destructive:"border-transparent bg-[var(--color-semantic-danger)] text-white hover:bg-[var(--color-semantic-danger)]/80",success:"border-transparent bg-[var(--color-semantic-success)] text-white hover:bg-[var(--color-semantic-success)]/80",warning:"border-transparent bg-[var(--color-semantic-warning)] text-white hover:bg-[var(--color-semantic-warning)]/80",info:"border-transparent bg-[var(--color-semantic-info)] text-white hover:bg-[var(--color-semantic-info)]/80",outline:"text-[var(--color-fg-default)] border-[var(--color-border-default)]"}},defaultVariants:{variant:"default"}});function ui({className:e,variant:t,...s}){return r.jsx("div",{className:Nr(g2e({variant:t}),e),...s})}const x2e=x.forwardRef(({icon:e,label:t,value:s,helper:n,trend:a,className:o,...i},l)=>r.jsx("div",{ref:l,className:Nr("rounded-2xl border border-border bg-background-card p-7 md:p-8 shadow-sm hover:shadow-md transition-shadow duration-200",o),...i,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[e&&r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-background-alt",children:e}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-foreground-muted",children:t}),r.jsx("p",{className:"mt-2 text-2xl font-semibold text-foreground tabular-nums",children:s}),n&&r.jsx("p",{className:"mt-1 text-xs text-foreground-secondary",children:n})]})]}),a&&r.jsxs("div",{className:"text-right",children:[r.jsxs("div",{className:Nr("text-sm font-medium",a.positive?"text-semantic-success":"text-semantic-danger"),children:[a.positive?"+":"",a.value,"%"]}),r.jsx("div",{className:"text-xs text-foreground-muted",children:a.label})]})]})}));x2e.displayName="StatTile";
843const v2e=x.forwardRef(({title:e,subtitle:t,actions:s,breadcrumbs:n,className:a,...o},i)=>r.jsxs("div",{ref:i,className:Nr("w-full max-w-full space-y-4",a),...o,children:[n&&r.jsx("nav",{className:"flex","aria-label":"Breadcrumb",children:n}),r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-h1",children:e}),t&&r.jsx("p",{className:"text-body-lg",children:t})]}),s&&s.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-3 sm:flex-nowrap sm:justify-end",children:s.map((l,c)=>r.jsx(x.Fragment,{children:l},c))})]})]}));v2e.displayName="PageHeader";const b2e=x.forwardRef(({title:e,description:t,actions:s,children:n,className:a,...o},i)=>r.jsxs("section",{ref:i,className:Nr("w-full max-w-full space-y-8 p-4 sm:space-y-12 sm:p-6",a),...o,children:[(e||t||s)&&r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[e&&r.jsx("h2",{className:"text-h2",children:e}),t&&r.jsx("p",{className:"text-body text-muted",children:t})]}),s&&s.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-3 sm:flex-nowrap sm:justify-end",children:s.map((l,c)=>r.jsx(x.Fragment,{children:l},c))})]}),n]}));b2e.displayName="Section";const Hu=x.forwardRef(({code:e,language:t,title:s,showCopyButton:n=!0,className:a,...o},i)=>r.jsx("div",{ref:i,className:Nr("rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-code)] overflow-hidden",a),...o,children:r.jsx(Vt,{code:e,language:t||"text",title:s,showCopy:n,className:"!border-none !bg-transparent"})}));Hu.displayName="CodeBlock";const u2="rr_api_keys_mode_v1";function y2e(){var It;Mn("API keys");const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),[n,a]=x.useState([]),[o,i]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(null),[h,g]=x.useState(!1),[v,y]=x.useState(null),[_,j]=x.useState(null),[w,k]=x.useState(!1),[S,E]=x.useState(!1),[T,A]=x.useState(!1),[R,I]=x.useState(null),[L,M]=x.useState(null),[O,z]=x.useState([]),[X,W]=x.use
843State(null),[K,q]=x.useState(!1),[J,F]=x.useState(()=>{if(typeof window>"u")return null;const ee=localStorage.getItem(u2);return ee==="classic"||ee==="project"?ee:null}),[V,$]=x.useState(null),[B,ae]=x.useState("prod"),[H,U]=x.useState({public:!1,manage:!1}),[oe,fe]=x.useState({public:!1,manage:!1}),[Q,le]=x.useState(!1),[Se,we]=x.useState(!1),Le=x.useRef(null),xe=O.find(ee=>ee.id===V)||O[0],de=(xe==null?void 0:xe.id)??null,Me=L||((It=n[0])==null?void 0:It.api_key)||"YOUR_API_KEY",{stats:je}=Aw({projectId:de,env:B,enabled:!0}),[Ae,Oe]=x.useState(null),[Ke,ut]=x.useState({keyName:"",permissions:"read_write"}),De=(o==null?void 0:o.subscriptionTier)==="free",ct=(je==null?void 0:je.tier)==="free"?"Upgrade for more requests":"View plan limits",rt=(je==null?void 0:je.tier)==="free"?"/upgrade?source=limit_warning":"/billing",mt=J||(K&&O.length>0?"project":"classic"),vt=async()=>{c(!0),f(null);try{const ee=await Ue(s);if(!ee){f("Please sign in to continue");return}const We=await ue.get("/api-keys",{authToken:ee});a(Array.isArray(We.data)?We.data:[])}catch(ee){console.error("Error fetching API keys:",ee),ee instanceof yt?f(`Failed to fetch API keys: ${ee.message}`):f("Failed to fetch API keys")}finally{c(!1)}},gt=async()=>{try{const ee=await Ue(s);if(!ee)return;const We=await ue.get("/projects",{authToken:ee});z(We.data.projects||[])}catch(ee){console.error("Error fetching project keys:",ee)}finally{q(!0)}},Be=async()=>{try{const ee=await Ue(s);if(!ee)return;const We=await ue.get("/api-keys/stats",{authToken:ee});i(We.data.stats),Z.setUserProperties({requests_30d:We.data.stats.requestsMade,request_limit:We.data.stats.requestLimit,objects_stored:We.data.stats.objectsStored,subscription_tier:We.data.stats.subscriptionTier})}catch(ee){console.error("Error fetching stats:",ee)}},ve=async()=>{var ee,We,wt;if(j(null),E(!0),(o==null?void 0:o.subscriptionTier)==="free"&&n.length>=1){j(r.jsxs(r.Fragment,{children:["Free workspaces can create 1 API key. ",r.jsx(dt,{to:"/upgrade?source=limit_hit&highlight=dev",className:"underline hover:text-red-300 transition",children:"Upgrade to add more keys and permissions"}),"."]})),E(!1);return}if(!Ke.keyName.trim()){j("API key name is required"),E(!1);return}try{const _t=await Ue(s);if(!_t){j("Please sign in to continue");return}const Ee=await ue.post("/api-keys",Ke,{authToken:_t}),He=Ee.data.apiKey;Z.track("api_key_created",{key_type:He!=null&&He.project_id?"project_manage":mt==="classic"?"classic":"workspace"}),Z.setUserProperties({has_api_key:!0}),ut({keyName:"",permissions:"read_write"}),k(!0),M(Ee.data.apiKey.api_key),await vt()}catch(_t){console.error("Error creating API key:",_t),_t instanceof yt&&Z.track("request_failed",{surface:"api_keys",status_code:_t.status,error_code:((ee=_t.data)==null?void 0:ee.error)||void 0,path:window.location.pathname});let Ee="Could not create an API key. Check your workspace limits and try again, or contact support if this keeps happening.";if(_t instanceof yt){const He=(We=_t.data)==null?void 0:We.error;He==="account_inactive"?Ee="Your account is still being set up. Try refreshing the page - if the issue persists, contact support and we'll get it sorted.":He==="plan_limit"?Ee="Your current plan doesn't include this action. Upgrade to unlock it.":Ee=((wt=_t.message)==null?void 0:wt.trim())||Ee}j(Ee),Oe({type:"error",message:Ee})}finally{E(!1)}},be=async()=>{if(v){j(null),A(!0);try{const ee=await Ue(s);if(!ee){j("Please sign in to continue");return}await ue.put(`/api-keys/${v.id}`,Ke,{authToken:ee}),y(null),ut({keyName:"",permissions:"read_write"}),Oe({type:"success",message:"API key updated successfully! â¨"}),await vt()}catch(ee){console.error("Error updating API key:",ee),j("Failed to update API key"),Oe({type:"error",message:"Failed to update API key"})}finally{A(!1)}}},nt=async ee=>{if(confirm("Are you sure you want to delete this API key? This action cannot be undone.")){I(ee);try{const We=await Ue(s);if(!We){Oe({type:"error",message:"Please sign in to continue"});return}await ue.delete(`/api-keys/${ee}`,{authToken:We}),Z.track("api_key_deleted",{key_id:ee}),Oe({type:"success",message:"API key deleted successfully! ðï¸"}),await vt()}catch(We){console.error("Error deleting API key:",We),Z.track("api_key_delete_failed",{key_id:ee}),Oe({type:"error",message:"Failed to delete API key"})}finally{I(null)}}},Ze=async(ee,We,wt)=>{try{await navigator.clipboard.writeText(ee),Oe({type:"success",message:`${We} copied to clipboard! ð`}),wt&&Z.track(wt.name,wt.props)}catch{Oe({type:"error",message:"Failed to copy to clipboard"})}},he=async ee=>{var wt;if(confirm("Rotate this project's public/manage keys? Existing deployments will need the new values.")){W(ee);try{const _t=await Ue(s);if(!_t){Oe({type:"error",message:"Please sign in to rotate project keys."}),W(null);return}const Ee=await ue.post(`/projects/${ee}/regenerate-key`,{},{authToken:_t});Z.track("api_key_created",{key_type:"project_public"}),Z.track("api_key_created",{key_type:"project_manage"}),z(He=>He.map(ie=>ie.id===ee?{...ie,api_key:Ee.data.api_key,public_api_key:Ee.data.public_api_key}:ie)),Oe({type:"success",message:"Project keys rotated. Update your environments."})}catch(_t){console.error("Error regenerating project keys:",_t),_t instanceof yt&&Z.track("request_failed",{surface:"api_keys",status_code:_t.status,error_code:((wt=_t.data)==null?void 0:wt.error)||void 0,path:window.location.pathname}),Oe({type:"error",message:"Failed to regenerate project keys"})}finally{W(null)}}},ke=ee=>{y(ee),ut({keyName:ee.key_name,permissions:ee.permissions})},Ve=ee=>{F(ee),Z.track("api_keys_mode_changed",{mode:ee}),typeof window<"u"&&localStorage.setItem(u2,ee)},at=()=>{J!=="classic"&&Ve("classic"),g(!0),y(null),k(!1),j(null),Z.track("api_key_create_clicked",{mode:"classic"}),setTimeout(()=>{if(!Le.current)return;const ee=Le.current.getBoundingClientRect(),We=window.scrollY+ee.top-80;window.scrollTo({top:We,behavior:"smooth"})},0)},Pt=ee=>{$(ee),U({public:!1,manage:!1}),fe({public:!1,manage:!1})},Ct=(ee,We)=>{U(wt=>({...wt,[ee]:We})),We&&Z.track("project_key_revealed",{key_type:ee})},St=ee=>ee?`${ee.slice(0,6)}â¢â¢â¢â¢${ee.slice(-4)}`:"Not generated yet",Xt=ee=>
843{if(!xe)return null;const We=ee==="public",wt=We?xe.public_api_key:xe.api_key,_t=`x-api-key: ${wt||(We?"pub_...":"pro_...")}`,Ee=H[ee],He=ee==="public"?`fetch('https://reqres.in/api/app-users/login', { 844 method: 'POST', 845 headers: { 846 'content-type': 'application/json', 847 'x-api-key': '${wt||"<public_key>"}' 848 }, 849 body: JSON.stringify({ email: '[email protected]' }) 850});`:`curl -X POST https://reqres.in/api/collections/:slug/records \\ 851 -H "x-api-key: ${wt||"<manage_key>"}" \\ 852 -H "X-Reqres-Env: ${B==="prod"?"production":"development"}" \\ 853 -d '{"title":"Example"}'`;return r.jsxs(Ht,{className:"p-5 surface-card border border-[var(--color-border-default)] space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-[11px] uppercase tracking-wide ${We?"bg-[var(--color-semantic-success)]/10 border border-[var(--color-semantic-success)]/30 text-[var(--color-semantic-success)]":"bg-[var(--color-semantic-warning)]/10 border border-[var(--color-semantic-warning)]/30 text-[var(--color-semantic-warning)]"}`,children:We?"Browser-safe":"Server/admin"}),r.jsx("p",{className:"text-sm font-semibold text-foreground",children:We?"Public key":"Manage key"})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:We?"Use for GETs and to start magic links.":"Use for schema changes and admin writes."})]}),r.jsxs("div",{className:"flex flex-col gap-2 items-end",children:[r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)]",children:"Header"}),r.jsxs("div",{className:"inline-flex items-center gap-2",children:[r.jsx("span",{className:"mono text-sm bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] px-3 py-1 rounded-lg",children:Ee&&wt?wt:St(wt)}),r.jsx(ht,{variant:"outline",size:"sm",onClick:()=>Ze(_t,"API header",{name:"project_key_copied",props:{key_type:ee}}),className:"px-3 py-1 text-xs",children:"Copy header"}),wt?Ee?r.jsx(ht,{variant:"ghost",size:"icon",onClick:()=>Ct(ee,!1),className:"w-8 h-8",children:r.jsx(bh,{className:"w-4 h-4"})}):r.jsx(ht,{variant:"ghost",size:"icon",onClick:()=>Ct(ee,!0),className:"w-8 h-8",children:r.jsx(za,{className:"w-4 h-4"})}):null]})]})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)]",children:wt?"Active":"Not generated yet"}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>fe(ie=>({...ie,[ee]:!ie[ee]})),className:"px-2 py-1 text-xs",children:oe[ee]?"Hide example":"Show example"})]}),oe[ee]&&r.jsx(Vt,{title:We?"Start login":"Owner write",language:ee==="public"?"ts":"bash",code:He,readMoreHref:"/documentation?section=projects"})]},ee)};return x.useEffect(()=>{t&&e&&(vt(),Be(),gt())},[t,e]),x.useEffect(()=>{K&&(!J||J==="project"&&O.length===0)&&F(O.length>0?"project":"classic")},[J,K,O.length]),x.useEffect(()=>{!J||typeof window>"u"||localStorage.setItem(u2,J)},[J]),x.useEffect(()=>{O.length>0&&!V&&$(O[0].id)},[O,V]),x.useEffect(()=>{U({public:!1,manage:!1}),fe({public:!1,manage:!1})},[V]),t?e?r.jsxs("div",{className:"container-stripe py-12 space-y-8",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-h1",children:"API keys"}),r.jsx("p",{className:"text-lg text-[var(--color-fg-secondary)] max-w-3xl",children:O.length>0?"Your project keys are below. Copy the header value to authenticate requests.":"Create a project to get scoped API keys, or grab a classic key for quick demos."})]}),(o==null?void 0:o.subscriptionTier)==="agent_developer"&&r.jsx(Ht,{className:"p-4 border border-[var(--color-accent-purple)]/30 bg-[var(--color-accent-purple)]/[0.04]",children:r.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[r.jsxs("div",{className:"text-sm text-[var(--color-fg-default)]",children:["You're on the ",r.jsx("strong",{children:"Agent Developer"})," plan - your"," ",r.jsx("code",{children:"x-agent-id"})," key for ",r.jsx("code",{children:"/agent/v1/*"})," lives on its own page."]}),r.jsx(dt,{to:"/agents",className:"inline-flex items-center gap-1 rounded-md border border-[var(--color-accent-purple)]/40 bg-[var(--color-accent-purple)]/[0.08] px-3 py-1.5 text-sm font-medium text-[var(--color-accent-purple)] hover:bg-[var(--color-accent-purple)]/[0.14] transition-colors",children:"Manage agent key â"})]})}),je&&je.limit!==null&&(je.used>0||n.length>0)?r.jsx(uR,{label:"Project usage",used:je.used,limit:je.limit,resetAt:je.resetAt,ctaLabel:ct,ctaHref:rt,ctaSource:je.tier==="free"?"limit_warning":void 0,surface:"api_keys",tier:je.tier}):null,Ae&&r.jsx(eb,{type:Ae.type,message:Ae.message,onClose:()=>Oe(null)}),u&&r.jsx(Ht,{className:"p-4 border border-semantic-danger/30 bg-semantic-danger/5",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-semantic-danger text-sm",children:u}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>f(null),children:"Dismiss"})]})}),mt==="classic"?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ht,{className:"p-6 md:p-8 surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Classic API key"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-2xl",children:"Use ReqRes for demos, teaching, and automation - no project required. Grab a key and hit the classic API endpoints in seconds."}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Works with Postman · Bruno · cURL"}),De&&r.jsxs("p",{className:"text-xs text-[var(--color-semantic-warning)]",children:["Free workspaces can create 1 key."," ",r.jsx(dt,{to:"/upgrade?source=limit_warning&highlight=dev&reason=key_limit",className:"underline hover:text-[var(--color-fg-default)] transition",children:"Upgrade to add more"}),"."]})]}),r.jsxs(ht,{onClick:at,className:"flex items-center justify-center gap-2 rounded-xl bg-indigo-500 px-6 py-3 font-medium text-white transition hover:bg-indigo-600",children:[r.jsx(ca,{className:"h-5 w-5"}),"Create free API key"]})]})}),(h||v)&&r.jsx(Ht,{ref:Le,className:"p-6 surface-card elevation-1 border border-[var(--color-border-default)]",children:w&&!v?r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-emerald-500/10",children:r.jsx(Sx,{className:"h-5 w-5 text-emerald-500"})}),r.jsx("div",{className:"flex-1",children:r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"API key created - find it in your key list below."})}),r.jsx(ht,{variant:"outline",onClick:()=>{g(!1),k(!1)},className:"px-4 py-2 text-sm shrink-0",children:"Dismiss"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"text-2xl",children:"ð"}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:v?"Edit API key":"Create API key"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Keep it quick: name your key and set the minimum permissions."})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-sm font-medium text-[var(--color-fg-default)]",children:"Key Name"}),r.jsx(id,{type:"text",value:Ke.keyName,onChange:ee=>ut({...Ke,keyName:ee.target.value}),placeholder:"e.g. Demo key for QA run",className:"w-full px-4 py-3 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] rounded-lg text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)]",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-sm font-medium text-[var(--color-fg-default)]",children:"Permissions"}),r.jsxs(xi,{value:De?"read_only":Ke.permissions,onValueChange:ee=>ut({...Ke,permissions:ee}),disabled:De,children:[r.jsx(Wo,{className:"w-full px-4 py-3 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] rounded-lg text-[var(--color-fg-default)]",children:r.jsx(vi,{})}),r.jsxs(Yo,{children:[r.jsx(yr,{value:"read_only",children:"Read only (safest)"}),!De&&r.jsxs(r.Fragment,{children:[r.jsx(yr,{value:"read_write",children:"Read & write"}),r.jsx(yr,{value:"manage",children:"Manage (full access)"})]})]})]}),r.jsx("div",{className:"p-3 bg-[var(--color-semantic-warning-bg)] border border-[var(--color-semantic-warning)]/30 rounded-lg",children:r.jsx("p",{className:"text-xs text-[var(--color-semantic-warning)]",children:De?r.jsxs(r.Fragment,{children:["Free workspaces are limited to read-only keys. ",r.jsx(dt,{to:"/upgrade?source=limit_warning&highlight=dev&reason=write_keys",className:"underline hover:text-[var(--color-fg-default)] transition",children:"Upgrade for write access"}),"."]}
853):Ke.permissions==="manage"?"Manage keys have full access. Keep them server-side.":Ke.permissions==="read_write"?"Read/write keys can create and update data.":"Read-only keys are best for client demos."})})]}),_&&r.jsx("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:r.jsx("p",{className:"text-sm text-red-400",children:_})}),r.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[r.jsx(ht,{onClick:v?be:ve,disabled:S||T,className:"bg-indigo-500 text-white hover:bg-indigo-600 px-5 py-3 rounded-lg font-medium flex items-center gap-2",children:S||T?r.jsxs(r.Fragment,{children:[r.jsx(bs,{size:"sm",variant:"dots"}),v?"Updating...":"Creating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ca,{className:"w-4 h-4"}),v?"Update key":"Create key"]})}),r.jsx(ht,{variant:"outline",onClick:()=>{g(!1),y(null),ut({keyName:"",permissions:"read_write"}),j(null)},disabled:S||T,className:"px-5 py-3",children:"Cancel"})]})]})]})}),r.jsx(Vt,{title:"cURL",language:"bash",code:`curl -H "x-api-key: ${Me}" https://reqres.in/api/users?page=2`,readMoreHref:"/documentation"}),r.jsx("div",{className:"rounded-xl border border-[var(--color-accent-purple)]/20 bg-[var(--color-accent-purple)]/5 px-4 py-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(rr,{className:"h-5 w-5 text-[var(--color-accent-purple)] mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"What's next?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-0.5",children:"Build an app or generate a full test suite using AI prompts tailored to your API key."})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(dt,{to:"/prompts",className:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-500 transition shrink-0",children:[r.jsx(rr,{className:"h-3.5 w-3.5"}
853),"Browse LLM Prompts â"]}),r.jsx(dt,{to:"/data-explorer",className:"inline-flex items-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1.5 text-xs font-medium text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] transition shrink-0",children:"Create a collection â"})]})]})}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 border border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Your API keys"}),r.jsx("h3",{className:"text-xl font-semibold text-foreground",children:"Workspace keys"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Read-only by default. Copy and go - no deep docs needed here."})]}),r.jsxs("div",{className:"text-sm text-[var(--color-fg-muted)]",children:[n.length," ",n.length===1?"key":"keys"]})]}),l?r.jsx("div",{className:"p-8 text-center",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading keys..."})}):n.length===0?r.jsx("div",{className:"p-6 text-center",children:r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No keys yet."})}):r.jsx("div",{className:"mt-4 divide-y divide-[var(--color-border-default)] border border-[var(--color-border-default)] rounded-xl",children:n.map(ee=>r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-3 px-4 py-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-foreground",children:ee.key_name}),r.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)] bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] px-2 py-0.5 rounded",children:ee.permissions==="manage"?"Manage":ee.permissions==="read_write"?"Read & Write":"Read Only"})]}),r.jsxs("div",{className:"text-xs text-[var(--color-fg-muted)]",children:["Created"," ",new Date(ee.created_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"mono text-sm bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] px-3 py-1 rounded",children:L===ee.api_key?ee.api_key:"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢"}),r.jsx(ht,{variant:"outline",size:"sm",onClick:()=>Ze(ee.api_key,"API key",{name:"api_key_copied",props:{key_type:"workspace"}}),className:"px-3 py-1 text-xs",children:r.jsx(is,{className:"w-4 h-4"})}),L===ee.api_key?r.jsx(ht,{variant:"ghost",size:"icon",onClick:()=>M(null),className:"w-8 h-8",children:r.jsx(bh,{className:"w-4 h-4"})}):r.jsx(ht,{variant:"ghost",size:"icon",onClick:()=>M(ee.api_key),className:"w-8 h-8",children:r.jsx(za,{className:"w-4 h-4"})}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>{ke(ee),g(!0)},className:"px-3 py-1 text-xs",children:"Edit"}),r.jsx(ht,{variant:"destructive",size:"sm",onClick:()=>nt(ee.id),disabled:R===ee.id,className:"px-3 py-1 text-xs",children:R===ee.id?r.jsx(bs,{size:"sm",variant:"dots"}):"Delete"})]})]},ee.id))})]}),n.length>0&&r.jsxs(Ht,{className:"p-5 surface-card elevation-1 border border-[var(--color-border-default)]",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)] mb-3",children:"Authentication modes"}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--color-fg-default)]",children:[r.jsx(iv,{className:"w-4 h-4 text-[var(--color-semantic-success)]"}),"x-api-key header"]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Use for /api/* endpoints: users, collections (admin), app-users login."}),r.jsx("code",{className:"block text-[11px] mono px-2 py-1 rounded bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",children:"x-api-key: your_key_here"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--color-fg-default)]",children:[r.jsx(Sx,{className:"w-4 h-4 text-[var(--color-semantic-warning)]"}),"Bearer session token"]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Use for /app/* endpoints: user-scoped data reads and writes."}),r.jsx("code",{className:"block text-[11px] mono px-2 py-1 rounded bg-[var(--color-bg-code)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",children:"Authorization: Bearer session_token"})]})]}),r.jsxs("p",{className:"mt-3 text-xs text-[var(--color-fg-muted)]",children:["Common mistake: using x-api-key on /app/* paths returns 401."," ",r.jsx("a",{href:"/docs#authentication",className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)] underline",children:"See auth docs"})]})]}),n.length>0&&r.jsxs(Ht,{className:"p-4 surface-card elevation-1 border border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Automation tips"}),r.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Optional"})]}),r.jsx("button",{type:"button",onClick:()=>le(ee=>!ee),className:"text-sm text-[var(--color-accent-blue)] hover:text-white",children:Q?"Hide":"Show"})]}),Q&&r.jsxs("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-fg-muted)] list-disc list-inside",children:[r.jsx("li",{children:"Avoid sending empty `x-api-key` headers."}),r.jsx("li",{children:"Add small delays between bursts to prevent 429."}),r.jsx("li",{children:"Keep retries idempotent; prefer GET for quick checks."}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] underline",href:"/blog/qa-testing",children:"QA testing guide"})})]})]})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ht,{className:"p-5 surface-card elevation-1 border border-[var(--color-border-default)]",children:r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Project lane"}),r.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Project API keys"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-2xl",children:"Keys scoped to your data, users, logs, and environments."})]}),O.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center",children:[r.jsxs(xi,{value:(V==null?void 0:V.toString())??"",onValueChange:ee=>Pt(Number(ee)),children:[r.jsx(Wo,{className:"px-3 py-2 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] rounded-lg text-sm text-foreground max-w-[200px]",children:r.jsx(vi,{})}),r.jsx(Yo,{children:O.map(ee=>r.jsx(yr,{value:ee.id.toString(),children:ee.name},ee.id))})]}),r.jsx("div",{className:"inline-flex items-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-1 gap-1",children:["prod","dev"].map(ee=>r.jsx("button",{type:"button",onClick:()=>ae(ee),className:`px-3 py-1.5 rounded-md text-sm ${B===ee?"bg-indigo-500 text-white":"text-[var(--color-fg-default)] hover:bg-[var(--color-bg-code)]"}`,children:ee==="prod"?"Prod":"Dev"},ee))})]})]})}),O.length===0?r.jsxs(Ht,{className:"p-6 surface-card elevation-1 border border-[var(--color-border-default)] text-center space-y-3",children:[r.jsx("div",{className:"text-4xl",children:"ð¦"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No projects yet. Create a project to get a public/manage key pair."}),r.jsx("div",{className:"flex justify-center",children:r.jsx(ht,{onClick:()=>window.location.href="/projects",className:"bg-indigo-500 text-white hover:bg-indigo-600 px-5 py-3 rounded-lg font-medium",children:"Create a project"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[Xt("public"),Xt("manage")]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 border border-[var(--color-border-default)]",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)] mb-3",children:"Auth modes"}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[r.jsx(iv,{className:"w-4 h-4 text-[var(--color-semantic-success)]"}),"Public key"]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Browser reads + start magic links."})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[r.jsx(Ep,{className:"w-4 h-4 text-[var(--color-semantic-warning)]"}
853),"Manage key"]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Admin/setup writes. Keep server-side with"," ",r.jsxs("code",{className:"mono px-1 py-0.5 rounded bg-[var(--color-bg-code)] border border-[var(--color-border-default)]",children:["X-Reqres-Env:"," ",B==="prod"?"production":"development"]}),"."]})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[r.jsx(Sx,{className:"w-4 h-4 text-[var(--color-semantic-success)]"}),"Session token"]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Authorization: Bearer <session_token> for user-scoped data."})]})]})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 border border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Project key actions"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Secondary actions, tucked away until needed."})]}),r.jsx("button",{type:"button",onClick:()=>we(ee=>!ee),className:"text-sm text-[var(--color-accent-blue)] hover:text-white",children:Se?"Hide":"Show"})]}),Se&&xe&&r.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Rotate keys"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Cuts over both public and manage keys. Update deployments after rotating."}),r.jsx(ht,{variant:"outline",size:"sm",onClick:()=>he(xe.id),disabled:X===xe.id,className:"px-3 py-2 text-sm",children:X===xe.id?"Rotatingâ¦":"Rotate now"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Project metadata"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(ht,{variant:"outline",size:"sm",onClick:()=>Ze(String(xe.id),"Project ID",{name:"project_key_copied",props:{key_type:"project_id"}}),className:"px-3 py-2 text-xs",children:"Copy ID"}),r.jsx(ht,{variant:"outline",size:"sm",onClick:()=>Ze(xe.slug,"Project slug",{name:"project_key_copied",props:{key_type:"project_slug"}}),className:"px-3 py-2 text-xs",children:"Copy slug"}),r.jsx("a",{href:"/documentation?section=projects",className:"px-3 py-2 text-xs rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-accent-blue)] hover:text-white inline-flex items-center",children:"API docs"})]})]})]}),r.jsxs("div",{className:"mt-3 text-xs text-[var(--color-fg-muted)]",children:["See real flow:"," ",r.jsx("a",{href:"/apps/notes",className:"text-[var(--color-accent-blue)] underline",children:"Notes app"})]})]})]})]}),mt==="project"&&r.jsx("div",{className:"border-t border-[var(--color-border-default)] pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Need a quick standalone key?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Classic keys work without a project - great for demos, Postman, or cURL."})]}),r.jsxs(ht,{variant:"outline",onClick:at,className:"flex items-center gap-2 shrink-0",children:[r.jsx(ca,{className:"h-4 w-4"}),"Create classic key"]})]})})]}):r.jsx("div",{className:"container-stripe py-10",children:r.jsx("div",{className:"text-center text-semantic-danger",children:"You must be signed in to access API key management."})}):r.jsx("div",{className:"container-stripe py-10",children:r.jsx("div",{className:"text-center",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading..."})})})}var t1="Collapsible",[_2e,A7]=bo(t1),[j2e,aA]=_2e(t1),P7=x.forwardRef((e,t)=>
853{const{__scopeCollapsible:s,open:n,defaultOpen:a,disabled:o,onOpenChange:i,...l}=e,[c,u]=go({prop:n,defaultProp:a??!1,onChange:i,caller:t1});return r.jsx(j2e,{scope:s,disabled:o,contentId:po(),open:c,onOpenToggle:x.useCallback(()=>u(f=>!f),[u]),children:r.jsx(fs.div,{"data-state":iA(c),"data-disabled":o?"":void 0,...l,ref:t})})});P7.displayName=t1;var I7="CollapsibleTrigger",M7=x.forwardRef((e,t)=>{const{__scopeCollapsible:s,...n}=e,a=aA(I7,s);return r.jsx(fs.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":iA(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:t,onClick:Lt(e.onClick,a.onOpenToggle)})});M7.displayName=I7;var oA="CollapsibleContent",O7=x.forwardRef((e,t)=>{const{forceMount:s,...n}=e,a=aA(oA,e.__scopeCollapsible);return r.jsx(Xo,{present:s||a.open,children:({present:o})=>r.jsx(w2e,{...n,ref:t,present:o})})});O7.displayName=oA;var w2e=x.forwardRef((e,t)=>{const{__scopeCollapsible:s,present:n,children:a,...o}=e,i=aA(oA,s),[l,c]=x.useState(n),u=x.useRef(null),f=Vs(t,u),h=x.useRef(0),g=h.current,v=x.useRef(0),y=v.current,_=i.open||l,j=x.useRef(_),w=x.useRef(void 0);return x.useEffect(()=>{const k=requestAnimationFrame(()=>j.current=!1);return()=>cancelAnimationFrame(k)},[]),Vn(()=>{const k=u.current;if(k){w.current=w.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const S=k.getBoundingClientRect();h.current=S.height,v.current=S.width,j.current||(k.style.transitionDuration=w.current.transitionDuration,k.style.animationName=w.current.animationName),c(n)}},[i.open,n]),r.jsx(fs.div,{"data-state":iA(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!_,...o,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:_&&a})});function iA(e){return e?"open":"closed"}var N2e=P7,k2e=M7,S2e=O7,_i="Accordion",C2e=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[lA,E2e,T2e]=zw(_i),[s1,$Oe]=bo(_i,[T2e,A7]),cA=A7(),L7=pe.forwardRef((e,t)=>{const{type:s,...n}=e,a=n,o=n;return r.jsx(lA.Provider,{scope:e.__scopeAccordion,children:s==="multiple"?r.jsx(I2e,{...o,ref:t}):r.jsx(P2e,{...a,ref:t})})});L7.displayName=_i;var[D7,R2e]=s1(_i),[$7,A2e]=s1(_i,{collapsible:!1}),P2e=pe.forwardRef((e,t)=>{const{value:s,defaultValue:n,onValueChange:a=()=>{},collapsible:o=!1,...i}=e,[l,c]=go({prop:s,defaultProp:n??"",onChange:a,caller:_i});return r.jsx(D7,{scope:e.__scopeAccordion,value:pe.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:pe.useCallback(()=>o&&c(""),[o,c]),children:r.jsx($7,{scope:e.__scopeAccordion,collapsible:o,children:r.jsx(U7,{...i,ref:t})})})}),I2e=pe.forwardRef((e,t)=>{const{value:s,defaultValue:n,onValueChange:a=()=>{},...o}=e,[i,l]=go({prop:s,defaultProp:n??[],onChange:a,caller:_i}),c=pe.useCallback(f=>l((h=[])=>[...h,f]),[l]),u=pe.useCallback(f=>l((h=[])=>h.filter(g=>g!==f)),[l]);return r.jsx(D7,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:r.jsx($7,{scope:e.__scopeAccordion,collapsible:!0,children:r.jsx(U7,{...o,ref:t})})})}),[M2e,r1]=s1(_i),U7=pe.forwardRef((e,t)=>{const{__scopeAccordion:s,disabled:n,dir:a,orientation:o="vertical",...i}=e,l=pe.useRef(null),c=Vs(l,t),u=E2e(s),h=um(a)==="ltr",g=Lt(e.onKeyDown,v=>{var I;if(!C2e.includes(v.key))return;const y=v.target,_=u().filter(L=>{var M;return!((M=L.ref.current)!=null&&M.disabled)}),j=_.findIndex(L=>L.ref.current===y),w=_.length;if(j===-1)return;v.preventDefault();let k=j;const S=0,E=w-1,T=()=>{k=j+1,k>E&&(k=S)},A=()=>{k=j-1,k<S&&(k=E)};switch(v.key){case"Home":k=S;break;case"End":k=E;break;case"ArrowRight":o==="horizontal"&&(h?T():A());break;case"ArrowDown":o==="vertical"&&T();break;case"ArrowLeft":o==="horizontal"&&(h?A():T());break;case"ArrowUp":o==="vertical"&&A();break}const R=k%w;(I=_[R].ref.current)==null||I.focus()});return r.jsx(M2e,{scope:s,disabled:n,direction:a,orientation:o,children:r.jsx(lA.Slot,{scope:s,children:r.jsx(fs.div,{...i,"data-orientation":o,ref:c,onKeyDown:n?void 0:g})})})}),Tj="AccordionItem",[O2e,dA]=s1(Tj),F7=pe.forwardRef((e,t)=>
853{const{__scopeAccordion:s,value:n,...a}=e,o=r1(Tj,s),i=R2e(Tj,s),l=cA(s),c=po(),u=n&&i.value.includes(n)||!1,f=o.disabled||e.disabled;return r.jsx(O2e,{scope:s,open:u,disabled:f,triggerId:c,children:r.jsx(N2e,{"data-orientation":o.orientation,"data-state":G7(u),...l,...a,ref:t,disabled:f,open:u,onOpenChange:h=>{h?i.onItemOpen(n):i.onItemClose(n)}})})});F7.displayName=Tj;var B7="AccordionHeader",q7=pe.forwardRef((e,t)=>{const{__scopeAccordion:s,...n}=e,a=r1(_i,s),o=dA(B7,s);return r.jsx(fs.h3,{"data-orientation":a.orientation,"data-state":G7(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});q7.displayName=B7;var v5="AccordionTrigger",z7=pe.forwardRef((e,t)=>{const{__scopeAccordion:s,...n}=e,a=r1(_i,s),o=dA(v5,s),i=A2e(v5,s),l=cA(s);return r.jsx(lA.ItemSlot,{scope:s,children:r.jsx(k2e,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":a.orientation,id:o.triggerId,...l,...n,ref:t})})});z7.displayName=v5;var H7="AccordionContent",V7=pe.forwardRef((e,t)=>{const{__scopeAccordion:s,...n}=e,a=r1(_i,s),o=dA(H7,s),i=cA(s);return r.jsx(S2e,{role:"region","aria-labelledby":o.triggerId,"data-orientation":a.orientation,...i,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});V7.displayName=H7;function G7(e){return e?"open":"closed"}var W7=L7,Y7=F7,K7=q7,uA=z7,pA=V7;const J7=W7,Ox=x.forwardRef(({className:e,...t},s)=>r.jsx(Y7,{ref:s,className:Nr("border border-[var(--color-border-default)] rounded-xl px-3",e),...t}));Ox.displayName="AccordionItem";const Lx=x.forwardRef(({className:e,children:t,...s},n)=>r.jsx(K7,{className:"flex",children:r.jsxs(uA,{ref:n,className:Nr("flex flex-1 items-center justify-between py-3 text-left text-sm font-medium text-[var(--color-fg-default)] transition hover:text-[var(--color-fg-default)] [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,r.jsx("svg",{className:"h-4 w-4 shrink-0 text-[var(--color-fg-muted)] transition-transform duration-200",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,d:"m6 9 6 6 6-6"})})]})}));Lx.displayName="AccordionTrigger";const Dx=x.forwardRef(({className:e,children:t,...s},n)=>r.jsx(pA,{ref:n,className:Nr("overflow-hidden text-sm text-[var(--color-fg-muted)] data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:r.jsx("div",{className:"pb-4 pt-0",children:t})}));Dx.displayName="AccordionContent";const Rh={baseCurrencySymbol:"$",baseCurrencyCode:"USD",minimumDecimalDigits:2,maximumDecimalDigits:2,showDecimal:!1,localizePricing:!0,isOriginalDisplay:!1,currencyDisplay:"symbol"},L2e=new Set(["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"]);function f$(e){return Math.max(0,Math.min(2,Math.round(e)))}function D2e(e,t,s){if(L2e.has(e.toUpperCase()))return{minimumFractionDigits:0,maximumFractionDigits:0};const n=f$(t),a=Math.max(n,f$(s));return{minimumFractionDigits:n,maximumFractionDigits:a}}function $2e({amount:e,currency:t,locale:s="en-US",formatStyle:n="standard",currencyDisplay:a="symbol",minimumFractionDigits:o=2,maximumFractionDigits:i=2}){const{minimumFractionDigits:l,maximumFractionDigits:c}=D2e(t,o,i),u=new Intl.NumberFormat(s,{style:"currency",currency:t,notation:n==="compact"?"compact":"standard",currencyDisplay:a,minimumFractionDigits:l,maximumFractionDigits:c}).formatToParts(e);let f="",h="",g="",v="",y="";for(const _ of u)f+=_.value,_.type==="integer"?h+=_.value:_.type==="fraction"?g=_.value:_.type==="decimal"?v=_.value:_.type==="group"&&(y=_.value,h+=_.value);return{formatted:f,integer:h,decimal:g,decimalSeparator:v,thousandsSeparator:y}}function U2e(e,t,s=Rh){let n=e;const a={...Rh,...s};t.discountPercentage&&!a.isOriginalDisplay&&(n*=1-parseFloat(t.discountPercentage)/100),a.localizePricing&&t.baseCurrencyConversionRate&&t.currencyCode!==a.baseCurrencyCode&&(n*=parseFloat(t.baseCurrencyConversionRate));
853const{formatted:o,integer:i,decimal:l,decimalSeparator:c,thousandsSeparator:u}=$2e({amount:n,currency:a.localizePricing?t.currencyCode:a.baseCurrencyCode,locale:a.localizePricing?t.pricingLocale:"en-US",currencyDisplay:a.currencyDisplay,formatStyle:"standard",minimumFractionDigits:a.showDecimal?a.minimumDecimalDigits:0,maximumFractionDigits:a.showDecimal?a.maximumDecimalDigits:0});return{price:n,formatted:o,integer:i,decimal:l,decimalSeparator:c,thousandsSeparator:u}}const F2e={data:null,loading:!0,error:null,baseCurrencyCode:Rh.baseCurrencyCode,baseCurrencySymbol:Rh.baseCurrencySymbol,environment:"production"},n1=x.createContext(F2e),fA=x.memo(({backgroundColor:e,fontColor:t,borderRadius:s,fontSize:n,noStyles:a,addCloseIcon:o,className:i="",onClose:l})=>{const{data:c,loading:u,error:f}=x.useContext(n1),h=x.useMemo(()=>({...c==null?void 0:c.bar,...e!==void 0&&{backgroundColor:e},...t!==void 0&&{fontColor:t},...s!==void 0&&{borderRadius:s},...n!==void 0&&{fontSize:n},...a!==void 0&&{noStyles:a},...o!==void 0&&{addCloseIcon:o}}),[c==null?void 0:c.bar,e,t,s,n,a,o]),g=x.useCallback(j=>j.noStyles?"":` 854 .parity-banner { 855 background-color: ${j.backgroundColor}; 856 color: ${j.fontColor}; 857 border-radius: ${j.borderRadius}; 858 font-size: ${j.fontSize}; 859 padding: 20px 10px; 860 text-align: center; 861 position: relative; 862 } 863 864 ${j.addCloseIcon?` 865 .parity-banner-close-btn { 866 width: 1rem; 867 height: 1rem; 868 border: 0; 869 opacity: .5; 870 background-color: transparent; 871 color: currentColor; 872 position: absolute; 873 top: 1rem; 874 right: 1rem; 875 padding: 0; 876 cursor: pointer; 877 } 878 .parity-banner-close-btn:hover { 879 opacity: 1; 880 } 881 `:""} 882 883 .parity-banner.parity-banner-has-logo { 884 padding-left: 120px; 885 } 886 .parity-banner.parity-banner-hide-close-btn .parity-banner-close-btn { 887 display: none; 888 } 889 `,[]);x.useEffect(()=>{if(!(c!=null&&c.bar))return;const j="parity-deals-banner-styles";let w=document.getElementById(j);return w||(w=document.createElement("style"),w.id=j,document.head.appendChild(w)),w.innerText=g(h),document.body.classList.add("pd-has-parity-banner"),()=>{w&&document.head.contains(w)&&document.head.removeChild(w),document.body.classList.remove("pd-has-parity-banner")}},[c==null?void 0:c.bar,h,g,c==null?void 0:c.discountPercentage]);const v=x.useCallback(()=>{const j=document.querySelector(".parity-banner");j!=null&&j.parentNode&&j.parentNode.removeChild(j),l==null||l()},[l]);if(u||f||!c||!(c!=null&&c.bar))return null;let y="parity-banner ";c.messageText||(y+="parity-banner-hide-close-btn");const _=[y,i].filter(Boolean).join(" ");return r.jsxs("div",{className:_,"data-testid":"parity-banner",children:[r.jsx("div",{className:"parity-banner-inner",dangerouslySetInnerHTML:{__html:c.messageText||c.message}}),h.addCloseIcon&&c.messageText&&r.jsx("button",{className:"parity-banner-close-btn",onClick:v,"aria-label":"Close banner","data-testid":"parity-banner-close",children:r.jsx("svg",{viewBox:"0 0 24 24",focusable:"false","aria-hidden":"true",children:r.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,
88911.823a.25.25,0,0,1,0,.354Z"})})})]})});fA.displayName="Banner";const B2e="https://api.paritydeals.com/api/v1/deals/discount/",q2e="https://sandboxapi.paritydeals.com/api/v1/deals/discount/",z2e=({children:e,config:t={},productId:s,pdIdentifier:n,environment:a="production",baseCurrencyCode:o=Rh.baseCurrencyCode,baseCurrencySymbol:i=Rh.baseCurrencySymbol})=>{const[l,c]=x.useState(null),[u,f]=x.useState(!0),[h,g]=x.useState(null),{apiUrl:v=a==="sandbox"?q2e:B2e,onError:y,maxRetries:_=3,timeout:j=5e3}=t,w=x.useCallback(S=>{console.error("ParityDeals Error:",S),g("Oops! Something went wrong. Please email [email protected]"),y&&y(new Error(S))},[y]);x.useEffect(()=>{let S=!0,E=0,T;function A(){const R=new XMLHttpRequest,I=new URLSearchParams;s&&I.append("product_id",s),n&&I.append("pd_identifier",n),o&&I.append("base_currency_code",o),I.append("url",window.location.href);const L=I.toString();R.open("GET",`${v}?${L}`,!0),R.setRequestHeader("Accept","application/json"),R.setRequestHeader("X-Requested-With","XMLHttpRequest"),R.onload=function(){if(S)if(this.status>=200&&this.status<400)try{const M=JSON.parse(this.response);c(M),f(!1)}catch(M){w("Invalid response format"),console.error("ParityDeals Error:",M),f(!1)}else E<_?(E++,setTimeout(A,Math.min(1e3*Math.pow(2,E),5e3))):(w("HTTP Error: "+this.status),f(!1))},R.onerror=function(){S&&(E<_?(E++,setTimeout(A,Math.min(1e3*Math.pow(2,E),5e3))):(w("Network error"),f(!1)))},R.ontimeout=function(){S&&(E<_?(E++,setTimeout(A,Math.min(1e3*Math.pow(2,E),5e3))):(w("Request timeout"),f(!1)))},R.timeout=j;try{R.send(),T=window.setTimeout(()=>{R.readyState!==4&&(R.abort(),S&&E>=_&&(w("Request timeout"),f(!1)))},j)}
889catch(M){if(!S)return;w("Request failed"),console.error("ParityDeals Error:",M),f(!1)}}return A(),()=>{S=!1,T&&window.clearTimeout(T)}},[v,j,_,w,t.apiUrl,s,n,o]);const k=pe.useMemo(()=>({data:l,loading:u,error:h,environment:a,baseCurrencyCode:o,baseCurrencySymbol:i}),[l,u,h,a,o,i]);return r.jsx(n1.Provider,{value:k,children:e})},h$=({price:e,className:t,localizePricing:s=!0})=>{const{data:n,baseCurrencyCode:a}=x.useContext(n1),o=x.useMemo(()=>n?U2e(e,n,{baseCurrencyCode:a,localizePricing:s}).integer:e.toString().split(".")[0],[n,e,a,s]);return r.jsx("span",{className:t,children:o})},m$=({className:e,localizePricing:t=!0})=>{const{data:s,baseCurrencySymbol:n}=x.useContext(n1);return r.jsx("span",{className:e,"data-pd-currency-symbol":!0,children:t&&(s==null?void 0:s.currencySymbol)||n})};function hA({children:e}){return r.jsx(z2e,{productId:"promo_e1609af1fedf4710bedd08e2753e80fd",children:e})}const j0=e=>e.split(/[\s_]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "),p2=(e,t)=>{if(e==null)return null;const s=(t||"USD").toUpperCase();try{return new Intl.NumberFormat("en-US",{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e/100)}catch{return`$${(e/100).toFixed(2)}`}},Bg=e=>{var s;if(!e)return null;const t=typeof e=="string"?new Date(e):e;return Number.isNaN((s=t==null?void 0:t.getTime)==null?void 0:s.call(t))?null:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})},H2e=e=>e==null?"Included":typeof e=="number"?e.toLocaleString():String(e),f2=e=>{var l,c,u,f;if(!e)return"UNKNOWN";const t=((c=(l=e.status)==null?void 0:l.toLowerCase)==null?void 0:c.call(l))||"",s=(f=(u=e.subscriptionTier)==null?void 0:u.toLowerCase)==null?void 0:f.call(u),n=!!(e.stripeSubscriptionId||e.apiKey||e.canManageBilling||e.hasPaid);if(s==="free"||!n&&!e.hasPaid)return"FREE";if(["past_due","incomplete","incomplete_expired"].includes(t))return"PAST_DUE";if(t==="unpaid")return"UNPAID";if(t==="trialing")return"TRIALING";const o=e.cancelAtPeriodEnd===!0,i=e.currentPeriodEnd&&new Date(e.currentPeriodEnd).getTime()>Date.now();return o||t==="canceled"&&i?"CANCELED_ACTIVE":t==="active"||e.isActive||e.hasPaid?"ACTIVE":"UNKNOWN"};function V2e(){var B,ae,H,U,oe,fe,Q,le;const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),[n,a]=x.useState(null),[o,i]=x.useState(!1),[l,c]=x.useState(!1),[u,f]=x.useState(null),[h,g]=x.useState(null),v=x.useRef(!1),y={hasPaid:!1,paymentMethod:"free",subscriptionTier:"free",status:"free",isActive:!1,canManageBilling:!1},_=async(Se={})=>{Se.silent||i(!0),f(null);try{const we=Se.authToken??await Ue(s);if(!we)return f("Please sign in to manage your subscription"),a(null),null;const xe=(await Td.getPaymentStatus({authToken:we})).data;return a(xe),xe}catch(we){if(console.error("Error fetching payment status:",we),we instanceof yt&&(we.status===404||we.status===401))return a(y),f(null),y;const Le=we instanceof yt&&typeof we.data=="object"&&we.data!==null?we.data.error||we.data.message:null,xe=Le?`Failed to fetch payment status: ${Le}`:"Failed to fetch payment status";return f(xe),a(y),y}finally{Se.silent||i(!1)}},j=async(Se="manage")=>{c(!0);try{const we=await Ue(s);if(!we){g({type:"error",message:"Please sign in to manage your subscription"});return}const Le=n??await _({authToken:we,silent:!0});if(!Le){g({type:"error",message:"Unable to determine billing status."});return}const xe=f2(Le),de=(Le.canManageBilling??!0)||!!(Le.stripeSubscriptionId||Le.apiKey||Le.hasPaid);if(xe==="FREE"){g({type:"info",message:"Free workspaces do not have billing. Upgrade to manage a subscription."});return}if(!de){g({type:"error",message:Le.billingBlockReason||"No billing subscription found for this account."});return}if(!Le.apiKey){g({type:"error",message:"Billing portal unavailable for this account. Please contact support."});return}Z.track("billing_manage_clicked",{intent:Se,tier:Le.subscriptionTier??"unknown",billingState:xe});const Me=await Cx.createPortalSession(Le.apiKey,{authToken:we});window.location.href=Me.data.url}catch(we){if(console.error("Error opening Stripe portal:",we),we instanceof yt){const Le=typeof we.data=="object"&&we.data!==null?we.data.error||we.data.message:null;g({type:"error",message:Le?`Failed to open billing portal: ${Le}`:`Failed to open billing portal: ${we.message}`})}else g({type:"error",message:"Failed to open billing portal"})}finally{c(!1)}},w=()=>{Z.track("billing_upgrade_clicked",{tier:(n==null?void 0:n.subscriptionTier)??"free",b
889illingState:f2(n)}),window.location.href="/upgrade"},k=(n==null?void 0:n.isActive)??!1,S=((n==null?void 0:n.canManageBilling)??(n==null?void 0:n.hasPaid)??!1)||!!(n!=null&&n.stripeSubscriptionId||n!=null&&n.apiKey),E=f2(n),T=((B=n==null?void 0:n.plan)==null?void 0:B.code)||(n==null?void 0:n.subscriptionTier)||(k?"pro":"free"),A=T?j0(T):E==="FREE"?"Free":"Current plan",R=p2(n==null?void 0:n.planAmount,n==null?void 0:n.planCurrency),I=n!=null&&n.planInterval?j0(n.planInterval):null,L=((ae=n==null?void 0:n.plan)==null?void 0:ae.limits)||{},M=Bg((n==null?void 0:n.nextInvoiceDate)??(n==null?void 0:n.currentPeriodEnd)??((H=n==null?void 0:n.plan)==null?void 0:H.period_end)),O=p2((n==null?void 0:n.nextInvoiceAmount)??(n==null?void 0:n.planAmount),(n==null?void 0:n.nextInvoiceCurrency)??(n==null?void 0:n.planCurrency)),z=Bg(n==null?void 0:n.currentPeriodStart),X=Bg(n==null?void 0:n.currentPeriodEnd)||Bg((U=n==null?void 0:n.plan)==null?void 0:U.period_end),W=(n==null?void 0:n.cancelAtPeriodEnd)===!0,K=Bg(n==null?void 0:n.lastInvoiceDate),q=p2(n==null?void 0:n.lastInvoiceAmount,(n==null?void 0:n.lastInvoiceCurrency)??(n==null?void 0:n.planCurrency)),J=n!=null&&n.lastInvoiceStatus?j0(n.lastInvoiceStatus.replace(/_/g," ")):null,F=((fe=(oe=n==null?void 0:n.subscriptionTier)==null?void 0:oe.toLowerCase)==null?void 0:fe.call(oe))==="premium",V=E==="FREE"||!F;if(x.useEffect(()=>{t&&e&&_()},[t,e]),x.useEffect(()=>{!n||!e||v.current||(v.current=!0,Z.track("billing_page_viewed",{tier:n.subscriptionTier??"free",billingState:E,status:n.status??"unknown"}))},[n,E,e]),!t)return r.jsx("div",{className:"container-stripe py-10",children:r.jsx("div",{className:"text-center",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading..."})})});if(!e)return r.jsx("div",{className:"container-stripe py-10",children:r.jsx("div",{className:"text-center text-semantic-danger",children:"You must be signed in to access billing."})});const $=(()=>{const Se=E==="CANCELED_ACTIVE"?X?`Access until ${X}`:"Access stays active until the current period ends.":M?`Renews on ${M}`:"Next invoice not scheduled yet";switch(E){case"FREE":return{title:"Free plan",body:"You can upgrade any time to unlock persistence, longer logs, and higher limits.",badge:{label:"Free",variant:"secondary"},icon:rr,tone:"bg-indigo-100 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-200 border-indigo-200 dark:border-indigo-400/20",cta:{label:"View plans",action:w,intent:"upgrade"}};case"ACTIVE":return{title:`${A} plan`,body:"Your subscription is active. Manage billing, invoices, and payment method below.",detail:Se,badge:{label:"Active",variant:"success"},icon:yd,tone:"bg-emerald-100 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-200 border-emerald-200 dark:border-emerald-400/20",cta:{label:"Manage subscription",action:()=>j("manage"),intent:"portal",hint:"Opens Stripe",showPortalActions:!0}};case"CANCELED_ACTIVE":return{title:`${A} plan - cancels at end of period`,body:"You'll keep access through the current period. You can renew any time.",detail:Se,badge:{label:W&&X?`Cancels on ${X}`:"Cancels soon",variant:"warning"},icon:nv,tone:"bg-amber-100 dark:bg-amber-500/10 text-amber-600 dark:text-amber-200 border-amber-200 dark:border-amber-400/20",cta:{label:"Manage subscription",action:()=>j("manage"),intent:"portal",hint:"Opens Stripe",showPortalActions:!0}};case"PAST_DUE":return{title:"Payment issue",body:"We couldn't process your last payment. Update your payment method to restore access.",detail:O&&M?`Pending invoice ${O} on ${M}`:void 0,badge:{label:"Past due",variant:"warning"},icon:ohe,tone:"bg-amber-100 dark:bg-amber-500/10 text-amber-700 dark:text-amber-100 border-amber-200 dark:border-amber-400/20",cta:{label:"Update payment method",action:()=>j("update"),intent:"portal",hint:"Opens Stripe",showPortalActions:!0},secondary:{label:"Contact support",href:"mailto:[email protected]"}};case"UNPAID":return{title:"Payment issue",body:"Your subscription is unpaid. Update your payment method to regain access.",badge:{label:"Unpaid",variant:"destructive"}
889,icon:lr,tone:"bg-rose-100 dark:bg-rose-500/10 text-rose-600 dark:text-rose-200 border-rose-200 dark:border-rose-400/20",cta:{label:"Update payment method",action:()=>j("update"),intent:"portal",hint:"Opens Stripe",showPortalActions:!0},secondary:{label:"Contact support",href:"mailto:[email protected]"}};case"TRIALING":return{title:`${A} trial`,body:"Your trial is active. Add a payment method to continue without interruption.",detail:Se,badge:{label:"Trial",variant:"info"},icon:kq,tone:"bg-blue-100 dark:bg-blue-500/10 text-blue-700 dark:text-blue-100 border-blue-200 dark:border-blue-400/20",cta:{label:"Manage subscription",action:()=>j("manage"),intent:"portal",hint:"Opens Stripe",showPortalActions:!0}};default:return{title:"Billing status unavailable",body:"We could not load your billing details. Retry or contact support.",badge:{label:"Unknown",variant:"secondary"},icon:lr,tone:"bg-[var(--color-bg-alt)] text-[var(--color-fg-secondary)] border-[var(--color-border-default)]",cta:{label:"Retry",action:()=>_(),intent:"retry"},secondary:{label:"Contact support",href:"mailto:[email protected]"}}}})();return r.jsx(hA,{children:r.jsxs("div",{className:"container-stripe py-10 space-y-6",children:[r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Billing"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Manage your plan, invoices, and payment method."})]}),V&&E!=="PAST_DUE"&&E!=="UNPAID"&&r.jsx(ht,{onClick:w,variant:"secondary",size:"lg",className:"w-full sm:w-auto gap-2",iconLeft:r.jsx(rr,{className:"w-4 h-4"}),iconRight:r.jsx(Kt,{className:"w-4 h-4"}),children:"Upgrade"})]}),E==="FREE"&&r.jsx(fA,{backgroundColor:"var(--color-bg-card)",fontColor:"var(--color-fg-default)",borderRadius:"12px",fontSize:"14px",addCloseIcon:!0}),h&&r.jsx(eb,{type:h.type,message:h.message,onClose:()=>g(null)}),u&&r.jsx(Ht,{className:"p-4 border border-semantic-danger/30 bg-semantic-danger/5",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-semantic-danger text-sm",children:u}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>f(null),children:"Dismiss"})]})}),o?r.jsx("div",{children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading billing information..."})}):r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)]",children:[r.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`h-10 w-10 rounded-xl flex items-center justify-center border ${$.tone}`,children:r.jsx($.icon,{className:"w-5 h-5"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{variant:$.badge.variant,className:"capitalize",children:$.badge.label}),E!=="FREE"&&R&&I&&r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[R,"/",I.toLowerCase()]})]}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:$.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:$.body}),$.detail&&r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:$.detail})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[$.cta&&r.jsx(ht,{onClick:$.cta.action,size:"lg",className:"justify-center",disabled:l&&$.cta.intent==="portal",iconLeft:$.cta.intent==="portal"?r.jsx(zi,{className:"w-4 h-4"}):void 0,children:l&&$.cta.intent==="portal"?r.jsx(bs,{size:"sm",variant:"dots",text:"Opening..."}):$.cta.label}),((Q=$.cta)==null?void 0:Q.hint)&&r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)] text-center",children:$.cta.hint}),$.secondary&&r.jsx("a",{className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",href:$.secondary.href,children:$.secondary.label})]})]}),((le=$.cta)==null?void 0:le.showPortalActions)&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-[var(--color-border-default)] flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(zi,{className:"w-3 h-3","aria-hidden":"true"}
889),"Update card"]}),r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(bw,{className:"w-3 h-3","aria-hidden":"true"}),"Change plan"]}),r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Nq,{className:"w-3 h-3","aria-hidden":"true"}),"Cancel"]}),r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(nc,{className:"w-3 h-3","aria-hidden":"true"}),"View invoices"]})]})]}),E==="ACTIVE"&&r.jsxs("div",{className:"px-1 text-xs text-[var(--color-fg-muted)] leading-relaxed",children:["Just want to cancel? Click ",r.jsx("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:"Manage subscription"})," above, then ",r.jsx("span",{className:"font-medium text-[var(--color-fg-secondary)]",children:"Cancel plan"})," in Stripe. Need help?"," ",r.jsx("a",{className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] underline underline-offset-2",href:"mailto:[email protected]",children:"[email protected]"})]}),r.jsxs(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)]",children:[r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{variant:"outline",className:"text-xs",children:"Plan & limits"}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:j0(T)})]}),r.jsxs("div",{className:"flex flex-wrap items-baseline gap-2 text-[var(--color-fg-default)]",children:[r.jsx("span",{className:"text-xl font-semibold",children:A}),r.jsx("span",{className:"text-sm text-[var(--color-fg-muted)]",children:R&&I?`${R}/${I.toLowerCase()}`:E==="FREE"?"Free":"Billing not set"})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:E==="FREE"?"Upgrade to unlock persistence, longer logs, and higher limits.":W?X?`Access until ${X}; will not renew unless you update billing.`:"Cancels at period end.":M?`Renews on ${M}`:"Next invoice not scheduled yet."})]}),V&&r.jsx(ht,{onClick:w,variant:"secondary",size:"lg",className:"w-full sm:w-auto gap-2",iconLeft:r.jsx(rr,{className:"w-4 h-4"}),iconRight:r.jsx(Kt,{className:"w-4 h-4"}),children:"View plans"})]}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 mt-4",children:[{label:"Requests/day",value:L.requests_per_day??"Varies by plan"},{label:"Collections",value:L.collections??"Included"},{label:"Records",value:L.records??"Included"},{label:"App users",value:L.app_users??"Included"},{label:"Logs retention",value:L.logs_retention_days?`${L.logs_retention_days} days`:"Plan dependent"},{label:"API keys",value:L.api_keys??L.api_keys_allowed??L.keys??"Included"}].map(Se=>r.jsx(G2e,{label:Se.label,value:Se.value},Se.label))})]}),E==="FREE"?r.jsx(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Billing details"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No billing history yet. Start a paid plan to access invoices and receipts."})]}),r.jsxs(ht,{onClick:w,variant:"secondary",size:"lg",className:"gap-2",children:[r.jsx(rr,{className:"w-4 h-4"}),"Upgrade"]})]})}):r.jsxs(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)]",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Billing details"}),(n==null?void 0:n.stripeSubscriptionId)&&r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)] font-mono",children:n.stripeSubscriptionId})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4 mt-4",children:[r.jsx(w0,{title:"Current plan",icon:r.
889jsx(zi,{className:"w-4 h-4"}),value:R&&I?`${A} · ${R}/${I.toLowerCase()}`:A,helper:W?X?`Active until ${X}`:"Cancels at period end":I?`Billing: ${I}`:void 0}),r.jsx(w0,{title:"Current period",icon:r.jsx(nv,{className:"w-4 h-4"}),value:z&&X?`${z} â ${X}`:X?`Through ${X}`:"Not scheduled yet",helper:E==="CANCELED_ACTIVE"?"Cancels at period end":void 0}),r.jsx(w0,{title:"Next invoice",icon:r.jsx(Hfe,{className:"w-4 h-4"}),value:O||"Not scheduled yet",helper:M?`Next charge on ${M}`:"We will email you when the next invoice is ready."}),r.jsx(w0,{title:"Last payment",icon:r.jsx(spe,{className:"w-4 h-4"}),value:q||"No payment on file",helper:K?`Recorded on ${K}`:"Nothing to download yet.",badge:J})]})]}),r.jsxs(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Invoices"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"View and download invoices in the billing portal."})]}),S?r.jsx(ht,{onClick:()=>j("invoices"),variant:"outline",size:"lg",className:"gap-2",disabled:l,iconLeft:r.jsx(nc,{className:"w-4 h-4"}),children:l?r.jsx(bs,{size:"sm",variant:"dots",text:"Opening..."}):"Open invoices"}):r.jsx(ht,{onClick:w,variant:"secondary",size:"lg",className:"gap-2",iconLeft:r.jsx(rr,{className:"w-4 h-4"}),children:"Upgrade to access"})]}),!R&&E==="FREE"?r.jsx("div",{className:"mt-3 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3 text-sm text-[var(--color-fg-muted)]",children:"No invoices yet. Start a paid plan to generate receipts and invoices."}):r.jsxs("div",{className:"mt-4 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3 flex flex-wrap items-center justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Last invoice"}),r.jsx("p",{className:"text-[var(--color-fg-default)] font-medium",children:K||"Not issued yet"})]}),r.jsxs("div",{className:"space-y-0.5 text-right",children:[r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Amount"}),r.jsx("p",{className:"text-[var(--color-fg-default)] font-medium",children:q||O||"Pending"})]}),J&&r.jsx(ui,{variant:J==="Paid"?"success":"warning",children:J})]})]}),r.jsxs(Ht,{className:"p-5 sm:p-6 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Billing FAQ"}),r.jsx(ui,{variant:"outline",className:"text-xs",children:"Quick answers"})]}),r.jsxs(J7,{type:"single",collapsible:!0,className:"mt-3 space-y-2",children:[r.jsxs(Ox,{value:"access",children:[r.jsx(Lx,{className:"text-sm",children:"If I cancel, do I lose access immediately?"}),r.jsxs(Dx,{className:"text-sm text-[var(--color-fg-muted)]",children:["No. Access stays active until the current period ends"," ",X?`(${X})`:"",". You can renew any time in the portal."]})]}),r.jsxs(Ox,{value:"payments",children:[r.jsx(Lx,{className:"text-sm",children:"Why did my payment fail?"}),r.jsx(Dx,{className:"text-sm text-[var(--color-fg-muted)]",children:"Payments can fail due to expired cards or bank declines. Update your payment method in the billing portal and we'll retry automatically. If it keeps failing, contact support."})]}),r.jsxs(Ox,{value:"invoices",children:[r.jsx(Lx,{className:"text-sm",children:"Where are my invoices?"}),r.jsx(Dx,{className:"text-sm text-[var(--color-fg-muted)]",children:"All invoices live in the Stripe billing portal. Use âOpen invoicesâ to view or download them anytime."})]})]})]})]})]})})}function G2e({label:e,value:t}){return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)] text-xs",children:e}),r.jsx("div",{className:"text-base font-semibold text-[var(--color-fg-default)]",children:H2e(t)})]})}function w0({title:e,value:t,helper:s,icon:n,badge:a}){return r.jsxs("div",{className:"p-4 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] h-full space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-secondary)]",children:[n,r.jsx("span",{className:"text-sm font-medium",children:e})]}),r.jsxs("div",{className:"text-[var(--color-fg-default)] space-y-1",children:[r.jsxs("div",{className:"font-semibold flex items-center gap-2",children:[r.jsx("span",{children:t}),a&&r.jsx(ui,{variant:a.toLowerCase()==="paid"?"success":"secondary",children:a})]}),s&&r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:s})]})]})}function tl({className:e,...t}){return r.jsx("div",{"data-slot":"card",className:cs("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}const mA=rm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border border-gray-300 bg-white text-gray-900 shadow-xs hover:bg-gray-50 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-100 dark:hover:bg-gray-700",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function zs({className:e,variant:t,size:s,asChild:n=!1,...a}){const o=n?yq:"button";return r.jsx(o,{"data-slot":"button",className:cs(mA({variant:t,size:s,className:e})),...a}
889)}const W2e=rm("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 $u({className:e,variant:t,...s}){return r.jsx("div",{className:cs(W2e({variant:t}),e),...s})}const Y2e=rm("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),X7=x.forwardRef(({className:e,variant:t,...s},n)=>r.jsx("div",{ref:n,role:"alert",className:cs(Y2e({variant:t}),e),...s}));X7.displayName="Alert";const Q7=x.forwardRef(({className:e,...t},s)=>r.jsx("h5",{ref:s,className:cs("mb-1 font-medium leading-none tracking-tight",e),...t}));Q7.displayName="AlertTitle";const Z7=x.forwardRef(({className:e,...t},s)=>r.jsx("div",{ref:s,className:cs("text-sm [&_p]:leading-relaxed",e),...t}));Z7.displayName="AlertDescription";var eG="Toggle",tG=x.forwardRef((e,t)=>
889{const{pressed:s,defaultPressed:n,onPressedChange:a,...o}=e,[i,l]=go({prop:s,onChange:a,defaultProp:n??!1,caller:eG});return r.jsx(fs.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:Lt(e.onClick,()=>{e.disabled||l(!i)})})});tG.displayName=eG;var zd="ToggleGroup",[sG,UOe]=bo(zd,[fm]),rG=fm(),gA=pe.forwardRef((e,t)=>{const{type:s,...n}=e;if(s==="single"){const a=n;return r.jsx(K2e,{...a,ref:t})}if(s==="multiple"){const a=n;return r.jsx(J2e,{...a,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${zd}\``)});gA.displayName=zd;var[nG,aG]=sG(zd),K2e=pe.forwardRef((e,t)=>{const{value:s,defaultValue:n,onValueChange:a=()=>{},...o}=e,[i,l]=go({prop:s,defaultProp:n??"",onChange:a,caller:zd});return r.jsx(nG,{scope:e.__scopeToggleGroup,type:"single",value:pe.useMemo(()=>i?[i]:[],[i]),onItemActivate:l,onItemDeactivate:pe.useCallback(()=>l(""),[l]),children:r.jsx(oG,{...o,ref:t})})}),J2e=pe.forwardRef((e,t)=>{const{value:s,defaultValue:n,onValueChange:a=()=>{},...o}=e,[i,l]=go({prop:s,defaultProp:n??[],onChange:a,caller:zd}),c=pe.useCallback(f=>l((h=[])=>[...h,f]),[l]),u=pe.useCallback(f=>l((h=[])=>h.filter(g=>g!==f)),[l]);return r.jsx(nG,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:c,onItemDeactivate:u,children:r.jsx(oG,{...o,ref:t})})});gA.displayName=zd;var[X2e,Q2e]=sG(zd),oG=pe.forwardRef((e,t)=>{const{__scopeToggleGroup:s,disabled:n=!1,rovingFocus:a=!0,orientation:o,dir:i,loop:l=!0,...c}=e,u=rG(s),f=um(i),h={role:"group",dir:f,...c};return r.jsx(X2e,{scope:s,rovingFocus:a,disabled:n,children:a?r.jsx(JR,{asChild:!0,...u,orientation:o,dir:f,loop:l,children:r.jsx(fs.div,{...h,ref:t})}):r.jsx(fs.div,{...h,ref:t})})}),Rj="ToggleGroupItem",iG=pe.forwardRef((e,t)=>{const s=aG(Rj,e.__scopeToggleGroup),n=Q2e(Rj,e.__scopeToggleGroup),a=rG(e.__scopeToggleGroup),o=s.value.includes(e.value),i=n.disabled||e.disabled,l={...e,pressed:o,disabled:i},c=pe.useRef(null);return n.rovingFocus?r.jsx(XR,{asChild:!0,...a,focusable:!i,active:o,ref:c,children:r.jsx(g$,{...l,ref:t})}):r.jsx(g$,{...l,ref:t})});iG.displayName=Rj;var g$=pe.forwardRef((e,t)=>{const{__scopeToggleGroup:s,value:n,...a}=e,o=aG(Rj,s),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},l=o.type==="single"?i:void 0;return r.jsx(tG,{...l,...a,ref:t,onPressedChange:c=>{c?o.onItemActivate(n):o.onItemDeactivate(n)}})}),lG=gA,cG=iG;const Z2e=rm("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),dG=x.createContext({size:"default",variant:"default"}),uG=x.forwardRef(({className:e,variant:t,size:s,children:n,...a},o)=>r.jsx(lG,{ref:o,className:cs("flex items-center justify-center gap-1",e),...a,children:r.jsx(dG.Provider,{value:{variant:t,size:s},children:n})}));uG.displayName=lG.displayName;const b5=x.forwardRef(({className:e,children:t,variant:s,size:n,...a},o)=>{const i=x.useContext(dG);return r.jsx(cG,{ref:o,className:cs(Z2e({variant:i.variant||s,size:i.size||n}),e),...a,children:t})});b5.displayName=cG.displayName;const pG=W7,xA=x.forwardRef(({className:e,...t},s)=>r.jsx(Y7,{ref:s,className:cs("border-b last:border-b-0",e),...t}));xA.displayName="AccordionItem";const vA=x.forwardRef(({className:e,children:t,...s},n)=>r.jsx(K7,{className:"flex",children:r.jsxs(uA,{ref:n,className:cs("flex flex-1 items-center justify-between py-4 text-left text-sm font-medium transition-all hover:text-foreground data-[state=open]:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,r.jsx(sr,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));vA.displayName=uA.displayName;const bA=x.forwardRef(({className:e,children:t,...s},n)=>r.jsx(pA,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...s,children:r.jsx("div",{className:cs("pb-4 pt-0 text-muted-foreground",e),children:t})}));bA.displayName=pA.displayName;const eCe="buy_btn_1RHkSFFwjyisBAsvyRa1Amc1",tCe="buy_btn_1RwNkNFwjyisBAsvPwhFSwzu",sCe="buy_btn_1RpmxTFwjyisBAsvK8lN0247",rCe="buy_btn_1RwNkxFwjyisBAsvD7LjgyRR",nCe="price_1SeaAvFwjyisBAsvIyKTc3D1",aCe="price_1SeaAvFwjyisBAsvUfDtPyob",oCe="price_1SeaAwFwjyisBAsvyDnXh2Hj",iCe="price_1SeaAxFwjyisBAsvXIlSmeTg",lCe="price_1SeaAyFwjyisBAsv5woCVfTZ",cCe="price_1SeaAyFwjyisBAsvqR5oC4DH",dCe="price_1SeaAzFwjyisBAsvBmFDZGvT",uCe="price_1SeaAzFwjyisBAsvWD65RJlT",pCe=void 0,fCe=void 0,hCe=void 0,m
889Ce=void 0,gCe="price_1TGg9UFwjyisBAsvud92nqgw",xCe="price_1TGg9UFwjyisBAsvQpUagocQ",vCe="price_1T5S3jFwjyisBAsv7kxae0tg",bCe="price_1T5S3kFwjyisBAsvLYOKeAtK",yCe="price_1T5S3lFwjyisBAsvMxOlhkjp",_Ce="price_1T5S3lFwjyisBAsvvk5gDCnt",jCe="price_1T5S3mFwjyisBAsvHWTlRmvZ",wCe="price_1T5S3nFwjyisBAsvul9qor9M",xp=[{tier:"free",label:"Free",monthlyPriceCents:0,yearlyPriceCents:0,isPublic:!0,isLegacy:!1,sortOrder:0,tagline:"For prototypes, learning REST, and QA",features:["250 requests/day","3 collections + 10 app users","100 stored records","1 day log retention"],aliases:["free"],requestsPerDay:250,collections:3,storedRecords:100,appUsers:10,logsRetentionDays:1,customEndpoints:"Mock only",automations:"-",supportLevel:"Community"},{tier:"lite",label:"Lite",monthlyPriceCents:500,yearlyPriceCents:4800,stripeMonthlyPriceId:gCe,stripeYearlyPriceId:xCe,isPublic:!0,isLegacy:!1,sortOrder:.5,tagline:"The commercial licence. Use ReqRes at work without breaking CI.",features:["Commercial use licence, cleared for work and CI","10,000 requests/day (40x the free tier)","Annual option: $48/year on one invoice, 2 months free","Priority email support","Plus: 3 collections, 10 app users, 100 records","Permanent access, no trial expiry"],aliases:["lite"],requestsPerDay:1e4,collections:3,storedRecords:100,appUsers:10,logsRetentionDays:1,customEndpoints:"Mock only",automations:"-",supportLevel:"Priority",pppEnabled:!0},{tier:"dev",label:"Dev",badge:"Most Popular",monthlyPriceCents:1200,yearlyPriceCents:11520,stripeMonthlyPriceId:nCe,stripeYearlyPriceId:aCe,isPublic:!0,isLegacy:!1,sortOrder:1,tagline:"For building out MVPs and QA suites",features:["20,000 requests/day with project + app tokens","5 collections & 5,000 stored records","200 app users (magic links + session tokens)","7-day logs retention + Data Explorer","10 persisted custom endpoints + automations"],aliases:["dev","developer"],requestsPerDay:2e4,collections:5,storedRecords:5e3,appUsers:200,logsRetentionDays:7,customEndpoints:10,automations:"Collection triggers",supportLevel:"Email"},{tier:"pro",label:"Pro",monthlyPriceCents:2900,yearlyPriceCents:27840,stripeMonthlyPriceId:oCe,stripeYearlyPriceId:iCe,isPublic:!0,isLegacy:!1,sortOrder:2,tagline:"Production-ready for frontend devs and QA teams",features:["50,000 requests/day + request logging","20 collections & 50,000 stored records","1,000 app users with scoped tokens","30-day logs retention + Data Explorer","100 custom endpoints + webhooks/automations","Multiple API keys per project"],aliases:["pro"],requestsPerDay:5e4,collections:20,storedRecords:5e4,appUsers:1e3,logsRetentionDays:30,customEndpoints:100,automations:"Collection triggers + webhooks",supportLevel:"Priority email"},{tier:"agent_developer",label:"Agent Developer",badge:"New",monthlyPriceCents:4900,yearlyPriceCents:47040,stripeMonthlyPriceId:pCe,stripeYearlyPriceId:fCe,isPublic:!0,isLegacy:!1,sortOrder:2.5,tagline:"For AI coding agents and automations",features:["10M requests/month (333,333/day) to /agent/v1/*","All 15 failure scenarios unlocked (free tier has 3)","Issued x-agent-id key for the higher cap","Usage dashboard at app.reqres.in/agents","Dev plan quotas on the main ReqRes BaaS product"],aliases:["agent_developer","agent-developer","agent"],requestsPerDay:333333,collections:20,storedRecords:5e4,appUsers:1e3,logsRetentionDays:30,customEndpoints:100,automations:"Collection triggers + webhooks",supportLevel:"Priority email support"},{tier:"agent_platform",label:"Agent Platform",badge:"Contact sales",displayPrice:"Custom",stripeMonthlyPriceId:hCe,stripeYearlyPriceId:mCe,isPublic:!0,isLegacy:!1,contactOnly:!0,sortOrder:2.6,tagline:"For AI coding tool companies",features:["Everything in Agent Developer","100M+ requests/month, custom cap","Private namespace with isolated rate-limit tenancy","Custom SLA and invoicing"],aliases:["agent_platform","agent-platform"]},{tier:"team",label:"Team",monthlyPriceCents:7900,yearlyPriceCents:75840,stripeMonthlyPriceId:lCe,stripeYearlyPriceId:cCe,isPublic:!0,isLegacy:!1,sortOrder:3,tagline:"For collaboration and shared QA environments",features:["100,000 requests/day + org projects","50 collections & 250,000 stored records","5,000 app users with project isolation","60-day logs retention + query builder","500 custom endpoints + advanced automations","Priority support + shared Slack channel","ð 1 classroom (50 students)"],aliases:["team"],requestsPerDay:1e5,collections:50,storedRecords:25e4,appUsers:5e3,logsRetentionDays:60,customEndpoints:500,automations:"Advanced routing + automations",supp
889ortLevel:"Priority + Slack"},{tier:"scale",label:"Scale",monthlyPriceCents:19900,yearlyPriceCents:191040,stripeMonthlyPriceId:dCe,stripeYearlyPriceId:uCe,isPublic:!0,isLegacy:!1,sortOrder:4,tagline:"For high traffic apps and production teams",features:["500,000 requests/day with observability","100 collections & 1,000,000 stored records","25,000 app users across teams","90-day logs retention + audit trails","2,000 custom endpoints + automations","Dedicated onboarding + architecture guidance","ð 5 classrooms (150 students each)"],aliases:["scale"],requestsPerDay:5e5,collections:100,storedRecords:1e6,appUsers:25e3,logsRetentionDays:90,customEndpoints:2e3,automations:"Advanced automations + webhooks",supportLevel:"Dedicated CSM"},{tier:"enterprise",label:"Enterprise",monthlyPriceCents:void 0,yearlyPriceCents:void 0,isPublic:!0,isLegacy:!1,sortOrder:5,tagline:"For custom requirements",features:["Custom throughput, storage, and region placement","SAML/SSO, audit logging, and RBAC","Premium automations and routing","White-glove onboarding and migration support","Dedicated support with uptime SLAs","Solution design + integration help","ð 20 classrooms (500 students each)"],aliases:["enterprise"],contactOnly:!0,displayPrice:"Contact",requestsPerDay:"Custom",collections:"Custom",storedRecords:"Custom",appUsers:"Custom",logsRetentionDays:"Custom",customEndpoints:"Custom",automations:"Custom",supportLevel:"Enterprise SLA"},{tier:"legacy-pro",label:"Legacy Pro",monthlyPriceCents:900,yearlyPriceCents:9e3,stripeMonthlyPriceId:eCe,stripeYearlyPriceId:tCe,isPublic:!1,isLegacy:!0,sortOrder:100,tagline:"Grandfathered",badge:"Legacy",features:["5,000 requests/day","20 collections with schema + visibility","10,000 stored records (1MB each)","Up to 500 app users (magic links + session tokens)","30-day logs retention with Data Explorer","100 persisted custom endpoints","Automations/webhooks on collection events","Multiple API keys & request logging"],aliases:["pro","legacy-pro"],requestsPerDay:5e3,collections:20,storedRecords:1e4,appUsers:500,logsRetentionDays:30,customEndpoints:100,automations:"Collection triggers",supportLevel:"Priority"},{tier:"legacy-premium",label:"Legacy Premium",monthlyPriceCents:1900,yearlyPriceCents:19e3,stripeMonthlyPriceId:sCe,stripeYearlyPriceId:rCe,isPublic:!1,isLegacy:!0,sortOrder:101,tagline:"Grandfathered",badge:"Legacy",features:["20,000 requests/day","50 collections, 50,000 stored records (5MB each)","2,000 app users with magic links","90-day logs retention + advanced analytics","1,000 persisted custom endpoints","Automations/webhooks with higher throughput","Unlimited API keys & org projects","Priority support + SLA"],aliases:["premium","legacy-premium"],requestsPerDay:2e4,collections:50,storedRecords:5e4,appUsers:2e3,logsRetentionDays:90,customEndpoints:1e3,automations:"Collection triggers + higher throughput",supportLevel:"Priority + SLA"},{tier:"classroom",label:"Classroom",badge:"Edu",monthlyPriceCents:4900,yearlyPriceCents:47040,stripeMonthlyPriceId:vCe,stripeYearlyPriceId:bCe,isPublic:!0,isLegacy:!1,isClassroom:!0,sortOrder:50,tagline:"For instructors and course creators",features:["1 classroom project with student isolation","Up to 50 student seats with API keys","2,000 requests/day (shared pool)","10 collections + 10,000 stored records","7-day log retention","Exercise templates + instructor dashboard","Bulk data reset between cohorts"],aliases:["classroom"],requestsPerDay:2e3,collections:10,storedRecords:1e4,appUsers:50,logsRetentionDays:7,customEndpoints:10,automations:"Collection triggers",supportLevel:"Email"},{tier:"classroom_pro",label:"Classroom Pro",badge:"Edu",monthlyPriceCents:9900,yearlyPriceCents:95040,stripeMonthlyPriceId:yCe,stripeYearlyPriceId:_Ce,isPublic:!0,isLegacy:!1,isClassroom:!0,sortOrder:51,tagline:"For bootcamps and multi-course instructors",features:["Up to 5 classroom projects","Up to 150 student seats per classroom","7,000 requests/day (shared pool)","20 collections + 50,000 stored records","30-day log retention","All exercise templates + CSV activity export","Instructor dashboard + bulk reset"],aliases:["classroom_pro","classroom-pro"],requestsPerDay:7e3,collections:20,storedRecords:5e4,appUsers:150,logsRetentionDays:30,customEndpoints:50,automations:"Collection triggers + webhooks",supp
889ortLevel:"Priority email"},{tier:"institute",label:"Institute",badge:"Edu",monthlyPriceCents:24900,yearlyPriceCents:249e3,stripeMonthlyPriceId:jCe,stripeYearlyPriceId:wCe,isPublic:!0,isLegacy:!1,isClassroom:!0,sortOrder:52,tagline:"For training academies and universities",features:["Up to 20 classroom projects","Up to 500 student seats per classroom","Unlimited requests/day","50 collections + 250,000 stored records","90-day log retention","Up to 10 instructors + invoice billing","CSV export + instructor dashboard"],aliases:["institute"],requestsPerDay:"Unlimited",collections:50,storedRecords:25e4,appUsers:500,logsRetentionDays:90,customEndpoints:100,automations:"Advanced automations",supportLevel:"Priority + invoice billing"}],Vc=(e,t)=>{const n={requestsPerDay:"requests_per_day",storedRecords:"records",appUsers:"app_users",logsRetentionDays:"logs_retention_days",customEndpoints:"custom_endpoints"}[t];return(e==null?void 0:e[t])??(n?e==null?void 0:e[n]:void 0)};function NCe(e){const t=(e==null?void 0:e.limits)||{},s=xp.find(n=>n.tier===e.code);return{tier:e.code,label:e.label||e.name||e.code,monthlyPriceCents:e.monthlyPriceCents===null?void 0:e.monthlyPriceCents,yearlyPriceCents:e.yearlyPriceCents===null?void 0:e.yearlyPriceCents,stripeMonthlyPriceId:e.stripeMonthlyPriceId||void 0,stripeYearlyPriceId:e.stripeYearlyPriceId||void 0,displayPrice:e.displayPrice||void 0,isPublic:!!e.isPublic,isLegacy:!!e.isLegacy,sortOrder:e.sortOrder??0,tagline:e.tagline||void 0,badge:e.badge||void 0,features:Array.isArray(e.features)?e.features:[],aliases:Array.isArray(e.aliases)?e.aliases:[],contactOnly:!!e.contactOnly,isClassroom:!!e.isClassroom,requestsPerDay:Vc(t,"requestsPerDay"),collections:Vc(t,"collections"),storedRecords:Vc(t,"storedRecords"),appUsers:Vc(t,"appUsers"),logsRetentionDays:Vc(t,"logsRetentionDays"),customEndpoints:Vc(t,"customEndpoints"),automations:Vc(t,"automations")??(s==null?void 0:s.automations),supportLevel:Vc(t,"supportLevel")??(s==null?void 0:s.supportLevel)}}async function kCe(){var e;try{const t=await ue.get("/public/plans"),s=Array.isArray((e=t.data)==null?void 0:e.plans)?t.data.plans.map(NCe):[];return s.length===0?y5():s.filter(n=>n.isPublic&&!n.isClassroom).sort((n,a)=>n.sortOrder-a.sortOrder)}catch(t){return console.warn("Falling back to local plan config:",t),y5()}}function y5(){return xp.filter(e=>e.isPublic&&!e.isClassroom).sort((e,t)=>e.sortOrder-t.sortOrder)}async function SCe(){var e;try{const s=(e=(await ue.get("/public/plans")).data)==null?void 0:e.welcomeDiscount;return s&&s.enabled?s:null}catch{return null}}async function CCe(){var e,t;try{return!!((t=(e=(await ue.get("/public/plans")).data)==null?void 0:e.commercialNudge)!=null&&t.enabled)}catch{return!1}}async function ECe(){var e,t;try{return!!((t=(e=(await ue.get("/public/plans")).data)==null?void 0:e.maturationNudge)!=null&&t.enabled)}catch{return!1}}function Sf(){return xp.filter(e=>e.isPublic&&e.isClassroom).sort((e,t)=>e.sortOrder-t.sortOrder)}function TCe(e){if(e)return xp.find(t=>t.stripeMonthlyPriceId===e||t.stripeYearlyPriceId===e)}function RCe(e){if(!e)return;const t=e.toLowerCase(),s=xp.find(n=>n.tier===t);return s||xp.find(n=>(n.aliases||[]).includes(t))}function ACe(e){if(e==null)return;const t=typeof e=="string"?Number(e):e;if(!(typeof t!="number"||Number.isNaN(t)))return xp.find(s=>s.monthlyPriceCents===t||s.yearlyPriceCents===t)}function fG(e){var l,c,u,f;if(!e)return;const t=((l=e==null?void 0:e.plan)==null?void 0:l.price_id)||((c=e==null?void 0:e.plan)==null?void 0:c.stripe_price_id)||(e==null?void 0:e.stripePriceId),s=TCe(t);if(s)return s;const n=(e==null?void 0:e.subscriptionTier)||((u=e==null?void 0:e.plan)==null?void 0:u.code),a=RCe(n);if(a)return a;const o=(e==null?void 0:e.planAmount)??((f=e==null?void 0:e.plan)==null?void 0:f.amount)??(e==null?void 0:e.currentPlanAmount)??(e==null?void 0:e.amount),i=ACe(o);if(i)return i}const _5="rr_pending_plan",PCe=30*60*1e3;function ICe(e,t){if(!(typeof window>"u"))try{const s={plan:e,source:t,timestamp:Date.now()};sessionStorage.setItem(_5,JSON.stringify(s))}catch{}}function MCe(){if(typeof window>"u")return null;try{const e=sessionStorage.getItem(_5);if(!e)return null;const t=JSON.parse(e);return sessionStorage.removeItem(_5),Date.now()-t.timestamp>PCe?null:t}catch{return null}}function hG(e){try{const t=new URLSearchParams(e),s=t.get("plan"),n=t.get("source")||void 0;if(!s)return null;const a=["free","lite","dev","pro","agent_developer","agent_platform","team","scale","enterprise","classroom","classroom_pro","institute"],o=s.toLowerCase().replace(/-/g,"_").replace(/^agent$/,"agent_developer");return a.includes(o)?{plan:o,source:n}:null}catch{return null}}
889const N0={monthlyRequests:"150M+",foundedYear:2014},OCe={projects:0,collections:0,records:0,apiKeys:0,recentRequests:0,lastLogAt:null,hitsLimit:!1};function LCe(e,t){return t==="rate_limit"||t==="approaching_limit"?"qa_tester":e.collections>0||e.records>0?"baas_builder":e.recentRequests>50&&e.collections===0&&e.records===0||e.projects>0&&e.collections===0&&e.recentRequests>50?"qa_tester":"new_user"}const _u=["free","lite","dev","pro","agent_developer","agent_platform","team"],Aj=[{key:"api_requests",label:"A test API for work and CI",plans:["free","lite"],mostPopular:"lite",accent:"indigo"},{key:"build_app",label:"To build an app",plans:["free","dev","pro"],mostPopular:"dev",accent:"indigo"},{key:"team_production",label:"Team or production use",plans:["pro","team"],mostPopular:"team",accent:"indigo"},{key:"ai_agents",label:"For AI coding agents",plans:["agent_developer","agent_platform"],mostPopular:"agent_developer",accent:"emerald"}],x$=Aj.reduce((e,t)=>({...e,[t.key]:t}),{}),v$={request_limit:{headline:"You're approaching your daily request limit.",sub:"gives you 5x more API requests per day, plus 7 day log retention."},collection_limit:{headline:"You hit your free collections limit.",sub:"raises your collection limit so you can keep building."},record_limit:{headline:"You hit your free records limit.",sub:"gives you 5,000 records, 50x the free tier."},app_user_limit:{headline:"You hit your free app user limit.",sub:"supports up to 200 app users with magic link auth."},key_limit:{headline:"Free workspaces include one API key.",sub:"unlocks multiple keys per project."},write_keys:{headline:"Free workspaces get read only API keys.",sub:"unlocks write access so your app can create and update data."},second_project:{headline:"Free accounts include one project.",sub:"unlocks unlimited projects, each with their own keys and data."},momentum:{headline:"Your project is growing fast.",sub:"gives you 50x more records and 5x more API requests."},auth_adoption:{headline:"You just added your first app user.",sub:"supports up to 200 app users with magic link auth."}};function k0(e){if(!e)return"build_app";for(const t of Aj)if(t.plans.includes(e))return t.key;return"build_app"}function DCe(e){if(!e)return null;const t=e.toLowerCase();return t==="rate_limit"||t==="rate_limit_email"||t==="approaching_limit"||t.startsWith("legacy_")||t==="api_docs"||t==="landing"?"api_requests":t==="collection_limit"||t==="record_limit"||t==="app_user_limit"||t==="payload_gate"||t.startsWith("aha")||t==="dashboard"?"build_app":t==="teams_page"||t.startsWith("team_")?"team_production":t.startsWith("agent")||t==="ai_agents"?"ai_agents":null}function $Ce(e){if(!e||typeof e!="object")return null;const t=e,s=t.publicMetadata??{},n=t.unsafeMetadata??{};return s.persona_role??n.persona_role??null}function UCe(e){if(!e)return null;const t=e.toLowerCase();return["qa","qa_engineer","tester","testing","sdet","educator","teacher"].includes(t)||["exploring","learning","student","hobbyist","personal_project"].includes(t)?"api_requests":["building_app","developer","solo_dev","startup","production","frontend_dev","frontend","frontend_developer"].includes(t)?"build_app":["team_lead","qa_lead","engineering_manager"].includes(t)?"team_production":null}function FCe(e){return e.collections>0||e.records>0?"build_app":e.recentRequests>100&&e.collections===0?"api_requests":null}const mG="rr_upgrade_lane";function BCe(){if(typeof window>"u")return null;try{const e=sessionStorage.getItem(mG);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.audience?t:null}catch{return null}}function Cf(e,t){if(!(typeof window>"u"))try{sessionStorage.setItem(mG,JSON.stringify({audience:e,method:t,ts:Date.now()}))}catch{}}const h2={usage_bar_browse:{headline:"You're hitting your limits.",subtext:"Upgrade to keep building without interruption."},trial_expired:{headline:"Your trial is over - but your project isn't.",subtext:"Pick a plan and carry on where you left off."},api_keys:{headline:"Ready to use your own API key?",subtext:"That's a paid feature. Here's what you unlock."},sidebar:{headline:"See what's waiting for you.",subtext:"Everything you need to build a real backend."},rate_limit:{headline:"You've hit the request ceiling.",subtext:"Lite ($5/mo) gives you 10,000 requests/day with a commercial use license."},approaching_limit:{headline:"You're close to your daily request limit.",subtext:"Lite ($5/mo) gives you 10,000 requests/day. Building a backend? See Dev."},limit_hit:{headline:"You've hit your daily request limit.",subtext:"Lite ($5/mo) gives you 10,000 requests/day. Building a backend? See Dev."},limit_warning:{headline:"You've used {used} of {limit} requests today.",subtext:"Lite gives you 10,000 requests/day with commercial use, for $5/mo."},payload_gate:{headline:"Want to see full request payloads?",subtext:"Upgrade for payload logging, longer retention, and more."},teams_page:{headline:"Give your team a shared API backend.",subtext:"Shared endpoints, org-level projects, and 100,000 requests/day."}},b$={free:"Trying it out",lite:"QA & test automation",dev:"Solo developers",pro:"Serious projects",agent_developer:"AI coding agents",agent_platform:"AI coding tool companies",team:"Small teams",scale:"High-volume apps",enterprise:"Custom needs",classroom:"Instructors & bootcamps",classroom_pro:"Multi-course instructors",institute:"Universities & academies"},qCe=["classroom","classrooms_","educator","education"],y$=[{id:"trial-end",question:"What happens at the end of my trial?",answer:"Your data is preserved and you move to the free plan (250 requests/day). Nothing is deleted. Upgrade anytime for higher limits."},{id:"credit-card",question:"Do I need a credit card for the free tier?",answer:"No. Sign up with
889just an email. You only need a card when you upgrade to a paid plan."},{id:"cancel",question:"Can I downgrade or cancel later?",answer:"Yes, any time - no questions, no dark patterns. You can downgrade, pause, or cancel from your account settings. Your data stays intact."},{id:"classic-vs-collections",question:"What's the difference between the Classic API and collections?",answer:"The Classic API (/api/users, /api/products, etc.) is the original ReqRes - fixed, read-only endpoints you can call without an account. Collections are your own private backend: custom endpoints, real persistent data, custom schemas, and auth. Free users get 3 collections; paid plans unlock more and raise the limits. If you've been using ReqRes for years without an account, the Classic API still works exactly as it always has."},{id:"what-counts",question:"What counts as a request?",answer:"Any HTTP request to your collection endpoints - GET, POST, PUT, PATCH, DELETE. Preflight OPTIONS requests and requests to the Classic API do not count toward your daily limit. If a request fails due to a server error on our side, it won't count either."},{id:"data-private",question:"Is my data private?",answer:"Yes. Your collection data - records, endpoints, schemas - is private to your account. Other users cannot see or access it. Classic API responses are shared and read-only by design, but anything you store in a collection belongs only to you."},{id:"limits",question:"What if I go over my plan limits?",answer:"Requests over your daily limit will return a 429 response until the limit resets at midnight UTC. We don't charge overages or cut off your account - you just hit a wall until the next day. If you're consistently hitting limits, it's a sign to upgrade."},{id:"ci-cd",question:"Can I use ReqRes for automated testing / CI/CD?",answer:"Yes, and it's one of the best use cases. Your collection endpoints are stable URLs with consistent behaviour - ideal for integration tests, contract tests, and pipeline fixtures. Use your API key as an environment variable and you're good to go. The Dev plan and above include enough requests/day to handle most CI pipelines comfortably."},{id:"education-plans",question:"Do you have plans for educators or coding bootcamps?",answer:'Yes. ReqRes has dedicated Education plans designed for instructors running classes or bootcamps. Each student gets their own isolated API key and environment, and instructors get a dashboard to manage the whole cohort. Scroll up and click "View Education plans" to see pricing.'},{id:"no-collections",question:"Do I need collections/projects if I just want the demo API?",answer:"No. The Classic API (/api/users, /api/products, etc.) is free forever and requires no account. Collections are for when you need a real, persistent backend with your own data - that's a paid feature, but the classic endpoints aren't going anywhere."}],zCe={free:ln,dev:rr,pro:Zu,team:Zu,scale:Wi,enterprise:Wi,"legacy-pro":Wi,"legacy-premium":Wi},HCe={free:"Get started",dev:"Build & demo safely",pro:"Ship to real users",agent_developer:"Production sandbox for your agent",agent_platform:"Infrastructure for agent tool companies",team:"Scale with your team",scale:"Built for throughput",enterprise:"Custom-fit for you",classroom:"Teach with real APIs",classroom_pro:"Run a bootcamp",institute:"Power your program","legacy-pro":"Ship to real users","legacy-premium":"Operate with confidence"},VCe={free:"Free is great for learning, demos, and classic endpoints.",dev:"Keep persistence, logs, and auth safe while you build.",pro:"Production-ready with payload logs and higher limits.",agent_developer:"Deterministic replay, 15 failure scenarios, MCP server access.",agent_platform:"Private namespace, 99.9% SLA, per-customer observability.",team:"Seat-based access, org projects, and shared support.",scale:"Higher throughput with observability baked in.",enterprise:"Custom terms, SSO, and SLAs.",classroom:"For instructors and course creators.",classroom_pro:"For bootcamps and multi-course instructors.",institute:"For training academies and universities.","legacy-pro":"Grandfathered access with data and logs.","legacy-premium":"Grandfathered access with higher throughput."},GCe=e=>
889e==null?"-":typeof e=="number"?e.toLocaleString():e,Ml=(e,t)=>{const s=e[t];switch(t){case"logsRetentionDays":return typeof s=="number"?`${s} day${s===1?"":"s"}`:s??"-";case"customEndpoints":return typeof s=="number"?s.toLocaleString():s??"-";case"automations":return s==="-"?"Not included":s??"Not included";default:return GCe(s)??"-"}},qg=e=>{if(e==null)return"-";const t=e/100;return`$${t%1===0?t.toFixed(0):t.toFixed(2)}`},WCe=(e,t,s)=>t>0?"team":s!=null&&s.isLegacy?s.tier:e.collections>0||e.records>0||e.recentRequests>800||e.hitsLimit?"pro":"dev";function YCe(){var ye,Qe,ne;Mn("Upgrade");const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),n=Wr(),a=un(),{isTrial:o,daysRemaining:i,expired:l}=Pw(),[c,u]=x.useState(null),[f,h]=x.useState("monthly"),g=x.useRef(!1),[v,y]=x.useState("build_app"),[_,j]=x.useState(null),[w,k]=x.useState(null),[S,E]=x.useState(()=>y5()),[T,A]=x.useState(null),[R,I]=x.useState(OCe),[L,M]=x.useState(!1),[O,z]=x.useState(!1),[X,W]=x.useState(!1),[K,q]=x.useState([]),[J,F]=x.useState(!1),[V,$]=x.useState(null),B=x.useRef(!1),ae=x.useRef(!1),H=x.useRef(null),U=x.useMemo(()=>{const P=new URLSearchParams(n.search).get("source")||"nav";return["nav","banner","limit","limit_warning","limit_hit","payload_gate","email","usage_bar_","trial_banner_","trial_pill","teams_page","rate_limit","approaching_limit","classrooms_","classroom","educator","education","prompt","write_heavy","agents_dashboard","landing"].some(me=>P===me||P.startsWith(me))?P:"nav"},[n.search]),oe=x.useMemo(()=>new URLSearchParams(n.search).get("used"),[n.search]),fe=x.useMemo(()=>new URLSearchParams(n.search).get("limit"),[n.search]),Q=x.useMemo(()=>new URLSearchParams(n.search).get("reason"),[n.search]),le=x.useMemo(()=>{const P=hG(n.search);if(P!=null&&P.plan)return P;const te=new URLSearchParams(n.search).get("highlight");return te?{plan:te,source:"highlight"}:P},[n.search]),[Se,we]=x.useState(null),Le=x.useRef(!1);x.useEffect(()=>{if(Le.current)return;if(le!=null&&le.plan){if(we(le.plan),y(k0(le.plan)),_u.includes(le.plan)||z(!0),["classroom","classroom_pro","institute"].includes(le.plan)){const te=Sf();E(me=>{const Te=new Set(me.map(st=>st.tier));return[...me,...te.filter(st=>!Te.has(st.tier))]})}Le.current=!0;return}const P=MCe();
889if(P!=null&&P.plan){if(we(P.plan),y(k0(P.plan)),_u.includes(P.plan)||z(!0),["classroom","classroom_pro","institute"].includes(P.plan)){const te=Sf();E(me=>{const Te=new Set(me.map(st=>st.tier));return[...me,...te.filter(st=>!Te.has(st.tier))]})}Z.track("pending_plan_restored",{plan:P.plan,source:P.source}),Le.current=!0}},[le]),x.useEffect(()=>{if(!Se)return;const P=setTimeout(()=>{const te=document.querySelector(`[data-plan-tier="${Se}"]`);te&&te.scrollIntoView({behavior:"smooth",block:"center"})},150);return()=>clearTimeout(P)},[Se,O]);const{status:xe}=_w(),de=x.useMemo(()=>(xe==null?void 0:xe.persona_role)??$Ce(e),[xe,e]),[Me,je]=x.useState(!1),Ae=x.useRef(!1),[Oe,Ke]=x.useState(!1);x.useEffect(()=>{if(L)return;const P=setTimeout(()=>Ke(!0),4e3);return()=>clearTimeout(P)},[L]),x.useEffect(()=>{if(Ae.current)return;if(Le.current&&(le!=null&&le.plan)){Cf(k0(le.plan),"plan_param"),Z.track("upgrade_lane_assigned",{lane:k0(le.plan),detection_method:"plan_param",source:U}),Ae.current=!0;return}const P=BCe();if(P!=null&&P.audience){y(P.audience),Ae.current=!0;return}const te=DCe(U);if(te){y(te),Cf(te,"source"),Z.track("upgrade_lane_assigned",{lane:te,detection_method:"source",source:U}),Ae.current=!0;return}const me=UCe(de);if(me){y(me),Cf(me,"persona"),Z.track("upgrade_lane_assigned",{lane:me,detection_method:"persona",source:U}),Ae.current=!0;return}if(!L&&!Oe)return;const Te=L?FCe(R):null;if(Te){y(Te),Cf(Te,"behavioral"),Z.track("upgrade_lane_assigned",{lane:Te,detection_method:"behavioral",source:U}),Ae.current=!0;return}je(!0),Z.track("upgrade_chooser_shown",{source:U})},[L,Oe,U,R,de,le]);const ut=P=>{y(P),Cf(P,"asked"),Z.track("upgrade_lane_assigned",{lane:P,detection_method:"asked",source:U}),je(!1),Ae.current=!0},De=x.useRef(new Set);x.useEffect(()=>{if(Me)return;const P=x$[v];P&&P.plans.includes("lite")&&(De.current.has(v)||(De.current.add(v),Z.track("lite_upsell_shown",{surface:`upgrade_page_${v}`,source:U})))},[v,Me,U]);const ct=!0,rt=x.useRef(!1),mt=ct&&v==="api_requests"&&!Me;x.useEffect(()=>{mt&&(rt.current||(rt.current=!0,Z.track("pack_offer_shown",{surface:"upgrade_page_api_requests",source:U})))},[mt,U]);const vt=x.useMemo(()=>{var st;if(!ct)return"#";const P="https://buy.stripe.com/4gMbJ15NUaDy5qi6xzdMI04",te=new URLSearchParams,me=(st=e==null?void 0:e.primaryEmailAddress)==null?void 0:st.emailAddress;me&&te.set("prefilled_email",me);const Te=te.toString();return Te?`${P}?${Te}`:P},[ct,e]),gt=x.useMemo(()=>S.some(P=>P.tier!=="free"&&!P.contactOnly&&!!P.stripeYearlyPriceId),[S]),Be=x.useMemo(()=>fG(c),[c]),ve=x.useMemo(()=>Be!=null&&Be.isLegacy?Be:null,[Be]),be=x.useMemo(()=>ve?[...S,ve]:S,[ve,S]),nt=x.useMemo(()=>{const P=new Map;return be.forEach(te=>P.set(te.tier,te)),P},[be]),Ze=((ye=e==null?void 0:e.organizationMemberships)==null?void 0:ye.length)??0,he=x.useMemo(()=>WCe(R,Ze,Be),[Be,Ze,R]),ke=x.useMemo(()=>be.filter(P=>_u.includes(P.tier)),[be]),Ve=x.useMemo(()=>be.filter(P=>!_u.includes(P.tier)&&!P.isLegacy),[be]),at=x.useMemo(()=>be.filter(P=>P.isLegacy&&!_u.includes(P.tier)),[be]),Pt=x.useMemo(()=>{const P=[...ke];return O&&P.push(...Ve),at.forEach(te=>{P.some(me=>me.tier===te.tier)||P.push(te)}),Be&&!P.some(te=>te.tier===Be.tier)&&P.push(Be),P},[Ve,ke,Be,at,O]),Ct=x.useMemo(()=>{const P=Te=>Te==="agent_developer"||Te==="agent_platform",te=(O?be:be.filter(Te=>_u.includes(Te.tier))).filter(Te=>!P(Te.tier));if(!te.some(Te=>Te.isClassroom)){const st=Sf().find(xt=>xt.tier==="classroom");if(st){const xt=te.findIndex(Rt=>Rt.tier==="team"),Et=xt>=0?xt+1:te.length,rs=[...te];return rs.splice(Et,0,st),rs}}return te},[be,O]),St=x.useMemo(()=>L?LCe(R,U):"new_user",[L,R,U]),Xt=x.useMemo(()=>{if(l)return{headline:"You're on the free plan",subtext:R.collections>0||R.records>0?`Your ${R.collections} collection${R.collections!==1?"s":""} and ${R.records} record${R.records!==1?"s":""} are safe. You have 250 requests/day. Upgrade for more.`:"You have 250 requests/day. Upgrade for higher limits and full platform access."};if(o&&i!==void 0&&i<=7){const Te=R.collections>0||R.records>0;return{headline:`Your trial ends in ${i} day${i===1?"":"s"}`,subtext:Te?`You've built ${R.collections} collection${R.collections!==1?"s":""} with ${R.records} record${R.records!==1?"s":""}. Upgrade to keep them live.`:"Upgrade to keep building without interruption."}}if(R.hitsLimit||U.includes("limit")||U.includes("rate"))return{headline:"You've outgrown the free tier",subtext:"Lite ($5/mo) gives you 10,000 requests/day with a commercial use license. Need a real backend? See Dev."};const P=h2[U],te=P?void 0:Object.keys(h2).find(Te=>U.startsWith(Te)),me=P??(te?h2[te]:void 0);return me?oe&&fe?{headline:me.headline.replace("{used}
889",Number(oe).toLocaleString()).replace("{limit}",Number(fe).toLocaleString()),subtext:me.subtext}:me.headline.includes("{used}")?{headline:"You're getting close to your limits.",subtext:me.subtext}:me:c!=null&&c.hasPaid&&(c!=null&&c.subscriptionTier)&&c.subscriptionTier!=="free"?{headline:`You're on ${(Be==null?void 0:Be.label)||c.subscriptionTier}`,subtext:"Manage your subscription or compare what other plans offer."}:{headline:"Build a real backend - collections, auth, logs, and more requests",subtext:"You're on Free (250 requests/day). Choose the plan that fits your workflow."}},[U,l,o,i,oe,fe,R,c,Be]),It=x.useMemo(()=>qCe.some(P=>U===P||U.startsWith(P)),[U]),ee=It||(le==null?void 0:le.plan)&&["classroom","classroom_pro","institute"].includes(le.plan),We=x.useRef(!1);x.useEffect(()=>{if(!It||We.current)return;We.current=!0,z(!0);const P=Sf();E(te=>{const me=new Set(te.map(Te=>Te.tier));return[...te,...P.filter(Te=>!me.has(Te.tier))]})},[It]),x.useEffect(()=>{let P=!1;return(async()=>{try{const me=await kCe();if(!P&&me.length>0)if(ee){const Te=Sf(),st=new Set(me.map(xt=>xt.tier));E([...me,...Te.filter(xt=>!st.has(xt.tier))])}else E(me)}catch(me){console.error("Failed to load plan catalog, using fallback:",me)}})(),SCe().then(me=>{P||A(me)}).catch(()=>{}),()=>{P=!0}},[ee]);const wt=async()=>{if(!(!e||!t))try{const P=await Ue(s);if(!P)return;const te=await Td.getPaymentStatus({authToken:P});u(te.data)}catch(P){console.error("Failed to fetch payment status:",P)}};x.useEffect(()=>{wt()},[e,t]),x.useEffect(()=>{if(!e||!t)return;let P=!1;return(async()=>{var te;try{const me=await Ue(s);if(!me||P)return;const Te=await ue.get("/api/agent-keys",{authToken:me});if(P)return;const st=((te=Te.data)==null?void 0:te.data)||[];W(st.some(xt=>xt.tier==="agent_developer"||xt.tier==="agent_platform"))}catch{}})(),()=>{P=!0}},[e,t,s]);const _t=["team","scale","enterprise"],Ee=(ne=(Qe=c==null?void 0:c.plan)==null?void 0:Qe.code)==null?void 0:ne.toLowerCase(),He=Ee?_t.includes(Ee):!1;x.useEffect(()=>{if(!e||!t||!He)return;let P=!1;return(async()=>{var me;try{const Te=await Ue(s);if(!Te||P)return;const st=await ue.get("/organizations",{authToken:Te});P||q(((me=st.data)==null?void 0:me.data)||[])}catch{P||q([])}})(),()=>{P=!0}},[e,t,s,He]),x.useEffect(()=>{if(!e||!t){M(!0);return}let P=!1;return(async()=>{var me,Te,st,xt,Et,rs,Rt;try{const xs=await Ue(s);if(!xs){M(!0);return}const[jt,qs,Xr,pn,Gn]=await Promise.allSettled([ue.get("/projects?limit=5",{authToken:xs}),ue.get("/api-keys/stats",{authToken:xs}),ue.get("/api-keys",{authToken:xs}),ue.get("/logs?limit=20",{authToken:xs}),ue.get("/resource-stats",{authToken:xs})]),Zs=jt.status==="fulfilled"?((me=jt.value.data)==null?void 0:me.projects)||[]:[],Cr=Gn.status==="fulfilled"?Gn.value.data:null,Wn=(Cr==null?void 0:Cr.collections)??0,Hd=(Cr==null?void 0:Cr.records)??0;let gm=pn.status==="fulfilled"?((xt=(st=(Te=pn.value.data)==null?void 0:Te.data)==null?void 0:st[0])==null?void 0:xt.created_at)??null:null;const dl=Xr.status==="fulfilled"?Array.isArray(Xr.value.data)?Xr.value.data.length:Array.isArray((Et=Xr.value.data)==null?void 0:Et.apiKeys)?Xr.value.data.apiKeys.length:0:0,On=qs.status==="fulfilled"?(rs=qs.value.data)==null?void 0:rs.stats:null,Qo=typeof(On==null?void 0:On.requestsMade)=="number"?On.requestsMade:pn.status==="fulfilled"?(((Rt=pn.value.data)==null?void 0:Rt.data)||[]).length:0,Vd=typeof(On==null?void 0:On.requestUsagePercent)=="number"&&On.requestUsagePercent>=95;P||I({projects:Zs.length,collections:Wn,records:Hd,apiKeys:dl,recentRequests:Qo,lastLogAt:gm||null,hitsLimit:!!Vd})}catch(xs){console.error("Failed to load usage snapshot for upgrade:",xs)}finally{P||M(!0)}})(),()=>{P=!0}},[s,t,e]),x.useEffect(()=>{if(B.current||!t||!L)return;let P;try{P=localStorage.getItem("rr_dashboard_stage")||void 0}catch{}const te=e!=null&&e.createdAt?Math.round((Date.now()-new Date(e.createdAt).getTime())/(1e3*60*60*24)):void 0;Z.track("upgrade_viewed",{source:U,segment:St,stage:P,has_starter_project:R.projects>0,second_project_exists:R.projects>=2,days_since_signup:te}),B.current=!0},[t,U,L,St,e==null?void 0:e.createdAt,R.projects]);const ie=x.useRef(!1),Ce=x.useRef(Date.now()),Ye=x.useRef(0),Pe=x.useRef(!1),Ge=x.useRef(null);x.useEffect(()=>{const P=()=>{const te=document.documentElement,me=te.scrollHeight-te.clientHeight;if(me>0){const Te=Math.round(te.scrollTop/me*100);Te>Ye.current&&(Ye.current=Math.min(100,Te))}!Pe.current&&Ge.current&&Ge.current.getBoundingClientRect().top<window.innerHeight*.85&&(Pe.current=!0)};return P(),window.addEventListener("scroll",P,{passive:!0}),()=>window.removeEventListener("scroll",P)},[]),x.useEffect(()=>(Ce.current=Date.now(),ie.current=!1,()=>{if(B.current&&!ie.current){const P=Math.round((Date.now()-Ce.current)/1e3);Z.track("upgrade_page_abandoned",{source:U,time_on_page_seconds:P,
889saw_plans:Pe.current,max_scroll_pct:Ye.current})}}),[U]);const Nt=(c==null?void 0:c.hasPaid)&&(c==null?void 0:c.subscriptionTier)&&c.subscriptionTier!=="free",Tt=x.useRef(!1);x.useEffect(()=>{Tt.current||Nt||!Q||!Se||v$[Q]&&(Tt.current=!0,Z.track("reason_banner_shown",{reason:Q,plan:Se,source:U}))},[Nt,Q,Se,U]);const ss=async(P,te)=>{var st,xt,Et,rs;if(Nt&&!(P==="agent_developer"||P==="agent_platform")){window.location.href="/billing";return}if(_t.includes(P.toLowerCase())&&K.length>0)if(K.length===1){await Zt(K[0].id,P,te);return}else{$({plan:P,interval:te}),F(!0);return}try{j(`${P}-${te}`);const Rt=await Ue(s);if(!Rt){k("Please sign in to upgrade.");return}ie.current=!0,Z.track("checkout_started",{plan_code:P,interval:te,source:U});try{sessionStorage.setItem("rr_checkout_context",JSON.stringify({plan_code:P,billing_interval:te,source:U,started_at:new Date().toISOString()}))}catch{}const jt=(st=(await Td.createCheckoutSession({plan:P,interval:te,source:U,authToken:Rt})).data)==null?void 0:st.url;jt?window.location.href=jt:k("Unable to start checkout. Please try again.")}catch(Rt){console.error("Failed to start checkout:",Rt),Rt instanceof yt?(Z.track("request_failed",{surface:"upgrade",status_code:Rt.status,error_code:((xt=Rt.data)==null?void 0:xt.error)||void 0,path:n.pathname}),Rt.status===409&&((Et=Rt.data)==null?void 0:Et.error)==="already_subscribed"?k("You already have an active subscription. To change your plan, use the billing portal in Settings."):k(((rs=Rt.data)==null?void 0:rs.message)||Rt.message||"Unable to start checkout.")):k(Rt instanceof Error?Rt.message:"Unable to start checkout.")}finally{j(null)}},Zt=async(P,te,me)=>{var Te,st,xt;try{j(`${te}-${me}`),F(!1),$(null);const Et=await Ue(s);if(!Et){k("Please sign in to upgrade.");return}Z.track("checkout_started",{plan_code:te,interval:me,source:U,organization_id:P,billing_type:"organization"});try{sessionStorage.setItem("rr_checkout_context",JSON.stringify({plan_code:te,billing_interval:me,source:U,organization_id:P,started_at:new Date().toISOString()}))}catch{}const Rt=(Te=(await lv.createCheckoutSession({organization_id:P,plan:te,interval:me,authToken:Et})).data)==null?void 0:Te.url;Rt?window.location.href=Rt:k("Unable to start checkout. Please try again.")}catch(Et){console.error("Failed to start org checkout:",Et),Et instanceof yt?((st=Et.data)==null?void 0:st.error)==="already_subscribed"?k("This organization already has an active subscription. Manage it from the organization settings."):k(((xt=Et.data)==null?void 0:xt.message)||Et.message):k("Unable to start checkout. Please try again.")}finally{j(null)}},re=P=>{P&&(k(null),g.current=!0,h(P),Z.track("billing_cycle_changed",{interval:P}))},G=P=>{Z.track("upgrade_plan_selected",{plan_code:P.tier,interval:f,lane:v,source:U}),P.tier==="lite"&&Z.track("lite_upsell_clicked",{surface:`upgrade_page_${v}`,source:U,destination:"checkout"}),ss(P.tier,f)},ge=()=>{const P=!O;z(P),P&&!ae.current&&(Z.track("upgrade_more_plans_opened"),ae.current=!0)},ze=[{key:"requestsPerDay",label:"Requests/day"},{key:"collections",label:"Collections"},{key:"storedRecords",label:"Records in your backend"},{key:"appUsers",label:"Magic link auth users"},{key:"logsRetentionDays",label:"Logs retention"},{key:"customEndpoints",label:"Custom API endpoints"},{key:"automations",label:"Webhooks & automation"},{key:"supportLevel",label:"Support"}],Gt=P=>Be?P.tier===Be.tier?!0:Be.isLegacy||P.isLegacy?!1:(Be.aliases||[]).includes(P.tier)||(P.aliases||[]).includes(Be.tier):!1,es=P=>{const te=Gt(P),me=he===P.tier,Te=Se===P.tier&&!te,st=zCe[P.tier]||Zu,xt=P.tier==="free",Et=f==="annual"?P.yearlyPriceCents:P.monthlyPriceCents,rs=f==="annual"?!!P.stripeYearlyPriceId:!!P.stripeMonthlyPriceId,Rt=f==="annual"&&typeof P.monthlyPriceCents=="number"&&typeof P.yearlyPriceCents=="number"?P.monthlyPriceCents*12:null,xs=P.displayPrice??qg(Et),jt=!P.displayPrice&&Et!==void 0,qs=!!T&&f==="monthly"&&T.appliesTo.includes(P.tier)&&!xt&&!te,pn=xt?[{title:"Free is great for...",description:"Learning, demos, and classic endpoints.",icon:rr},{title:"Free doesn't include...",description:St==="qa_tester"?"More than 250 requests/day, extended log retention, or persistent data.":St==="new_user"?"More than 250 requests/day, persistent collections, or production-ready auth.":"Persistence, longer logs, or app-user flows.",icon:Qu}]:St==="qa_tester"?[{title:`${Ml(P,"requestsPerDay")} requests/day`,description:"No more 429s breaking your tests",icon:Dr},{title:"Reliable for CI/CD",description:"Consistent endpoints, no rate limit interruptions",icon:Qu},{title:"Logs stay useful",description:`${Ml(P,"logsRetentionDays")} retention`,icon:za}]:[{title:"Persistent collections",description:`${Ml(P,"collections")} with scoped keys`,icon:Qu},{title:"Logs stay useful",description:P.tier==="pro"?`${Ml(P,"logsRetentionDays")} + payloads`:`${Ml(P,"logsRetentionDays")} (payloads on Pro)`,icon:za}
889,{title:"App users & sessions",description:`${Ml(P,"appUsers")} included`,icon:ln}],Gn=[{label:"Requests/day",value:Ml(P,"requestsPerDay")},{label:"Stored records",value:Ml(P,"storedRecords")},{label:"Automations",value:P.automations==="-"?"Not included":P.automations??"Not included"},{label:"Support",value:P.supportLevel??"-"}];return r.jsxs(tl,{"data-plan-tier":P.tier,className:`relative overflow-visible p-6 surface-card elevation-1 border border-[var(--color-border-default)] ${me||Te?"ring-1 ring-[var(--color-accent-blue)]/50 shadow-[0_20px_60px_rgba(85,97,255,0.18)]":""} ${te?"border-[var(--color-border-strong)]":""}`,children:[(me||Te||P.badge||P.isLegacy)&&r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Te&&!me&&r.jsx($u,{className:"bg-[var(--color-accent-blue)]/15 text-[var(--color-fg-default)] border-[var(--color-accent-blue)]/40",children:"Selected for you"}),me&&!Te&&r.jsx($u,{className:"bg-[var(--color-accent-blue)]/15 text-[var(--color-fg-default)] border-[var(--color-accent-blue)]/40",children:"Recommended"}),P.badge&&!me&&!Te&&r.jsx($u,{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-[var(--color-accent-blue)] text-white border-transparent whitespace-nowrap text-xs px-6 py-1 shadow-md",children:P.badge}),P.isLegacy&&r.jsx($u,{className:"bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border-[var(--color-border-default)]",children:"Legacy"})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"w-12 h-12 rounded-xl bg-[var(--color-bg-card)] border border-[var(--color-border-default)] flex items-center justify-center text-[var(--color-fg-default)]",children:[st===ln&&r.jsx(ln,{className:"w-6 h-6"}),st===Zu&&r.jsx(Zu,{className:"w-6 h-6"}),st===Wi&&r.jsx(Wi,{className:"w-6 h-6"}),st===rr&&r.jsx(rr,{className:"w-6 h-6"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:P.label}),r.jsx("h3",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:HCe[P.tier]||"Operate with confidence"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:VCe[P.tier]||P.tagline||"Built for your team."})]})]}),r.jsxs("div",{className:"text-right space-y-1",children:[r.jsx("div",{className:"text-3xl font-bold text-[var(--color-fg-default)]",...P.pppEnabled&&typeof Et=="number"?{"data-pd-price":String(Et/100)}:{},children:xs}),jt&&r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["/",f==="monthly"?"month":"year"]}),Rt&&f==="annual"&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] line-through",children:qg(Rt)}),qs&&T&&r.jsx("p",{className:"text-xs font-medium text-[var(--color-semantic-success)] whitespace-nowrap",children:T.label}),te&&r.jsx($u,{className:"bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] border-[var(--color-border-strong)] whitespace-nowrap text-xs",children:"Your plan"})]})]}),r.jsx("ul",{className:"mt-4 space-y-2.5",children:pn.map(Zs=>{const Cr=Zs.icon;return r.jsxs("li",{className:"flex items-start gap-3 px-1",children:[r.jsx(Cr,{className:"w-4 h-4 text-[var(--color-semantic-success)] mt-0.5 shrink-0"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:Zs.title}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:Zs.description})]})]},Zs.title)})}),!xt&&r.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:Gn.map(Zs=>r.jsxs("span",{className:"text-xs rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2 py-1 text-[var(--color-fg-secondary)]",children:[r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:[Zs.label,":"]})," ",r.jsx("span",{className:"text-[var(--color-fg-default)]",children:Zs.value})]},Zs.label))}
889),r.jsx("div",{className:"mt-6",children:P.contactOnly?te?r.jsxs(zs,{variant:"outline",className:"w-full bg-[var(--color-bg-alt)] border-[var(--color-border-strong)] text-[var(--color-fg-muted)]",children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Current Plan"]}):r.jsxs(zs,{className:"w-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] cursor-pointer",onClick:()=>window.location.href="mailto:[email protected]",children:[r.jsx(yh,{className:"w-4 h-4 mr-2"}),"Talk to sales"]}):P.tier==="free"?te?r.jsxs(zs,{variant:"outline",className:"w-full bg-[var(--color-bg-alt)] border-[var(--color-border-strong)] text-[var(--color-fg-muted)]",children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Current Plan"]}):r.jsx("div",{className:"space-y-3",children:!e||!t?r.jsx(Xf,{mode:"modal",children:r.jsxs(zs,{className:"w-full bg-[var(--color-accent-blue)] text-white hover:brightness-110",onClick:()=>Z.track("signup_started",{path:n.pathname}),children:[r.jsx(rr,{className:"w-4 h-4 mr-2"})," Get Started Free",r.jsx(Kt,{className:"w-4 h-4 ml-2"})]})}):l||o&&i<=3?r.jsx(zs,{className:"w-full bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] shadow-[0_12px_30px_rgba(85,97,255,0.35)]",onClick:()=>{const Zs=nt.get("dev");Zs&&G(Zs)},children:"Upgrade to Dev"}):r.jsx(zs,{className:"w-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",onClick:()=>window.location.href="/dashboard",children:"Continue with Free Plan"})}):te?r.jsxs(zs,{variant:"outline",className:"w-full bg-[var(--color-bg-alt)] border-[var(--color-border-strong)] text-[var(--color-fg-muted)] curs
889or-default",children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Current Plan"]}):P.tier==="agent_developer"&&X?r.jsxs(zs,{variant:"outline",className:"w-full",onClick:()=>a("/agents"),children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Manage at /agents"]}):P.contactOnly?r.jsx(zs,{variant:"outline",className:"w-full",onClick:()=>{window.location.href=P.tier==="agent_platform"?"mailto:[email protected]?subject=Agent%20Platform%20enquiry":"mailto:[email protected]"},children:"Talk to sales"}):P.tier==="agent_developer"&&!rs?r.jsx(zs,{variant:"outline",className:"w-full",onClick:()=>{window.location.href="mailto:[email protected]?subject=Agent%20Developer%20enquiry"},children:"Talk to sales"}):r.jsx(zs,{className:"w-full bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] shadow-[0_12px_30px_rgba(85,97,255,0.35)]",onClick:()=>G(P),disabled:_===`${P.tier}-${f}`||!rs,children:_===`${P.tier}-${f}`?"Starting checkout...":P.tier==="agent_developer"?Nt?"Add Agent Developer":`Subscribe to ${P.label}`:Nt?"Manage plan":rs?`Upgrade to ${P.label}`:f==="annual"?"Annual price not configured":"Pricing not configured"})})]},P.tier)},ls=nt.get("dev"),pr=f==="annual"?ls==null?void 0:ls.yearlyPriceCents:ls==null?void 0:ls.monthlyPriceCents,et=pr?`$${Math.round(pr/100)}/${f==="annual"?"yr":"mo"}`:"$12/mo";return r.jsxs(hA,{children:[Me&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[rgba(0,0,0,0.65)] backdrop-blur-sm px-4",role:"dialog","aria-modal":"true","aria-label":"What brings you here?",children:r.jsxs("div",{className:"w-full max-w-2xl rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-8 shadow-2xl",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)] mb-3",children:"One quick question"}),r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)] mb-2",children:"What brings you to upgrade?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mb-6",children:"We'll show you the right plans first."}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Aj.filter(P=>P.key!=="ai_agents").map(P=>r.jsxs("button",{type:"button",onClick:()=>ut(P.key),className:"text-left rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 hover:border-indigo-500/40 hover:bg-indigo-500/5 transition-all cursor-pointer",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-1",children:P.label}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:[P.key==="api_requests"&&"Higher rate limits + commercial use for the mock API.",P.key==="build_app"&&"Collections, records, app users â build a real backend.",P.key==="team_production"&&"Shared projects, org billing, higher volume."]})]},P.key))}),r.jsx("button",{type:"button",onClick:()=>ut("build_app"),className:"mt-5 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition-colors cursor-pointer",children:"Just show me everything â"})]})}),r.jsxs("div",{className:"min-h-screen bg-[var(--color-bg-default)]",children:[(()=>{if(Nt||!Q||!Se)return null;const P=v$[Q],te=S.find(Te=>Te.tier===Se)??ls;if(!P||!te)return null;const me=te.displayPrice||(te.monthlyPriceCents!=null?`$${Math.round(te.monthlyPriceCents/100)}/mo`:"");return r.jsx("div",{className:"border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-5 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-[15px] font-semibold text-[var(--color-fg-default)]",children:P.headline}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:[te.label," (",me,") ",P.sub]})]}),r.jsx(zs,{className:"bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] text-[15px] font-medium px-6 py-3 rounded-lg whitespace-nowrap",onClick:()=>G(te),disabled:_!==null,children:_?"Starting checkout...":`Upgrade to ${te.label} - ${me}`})]})})})(),r.jsxs("div",{className:"border-b border-[var(--color-border-default)] bg-[var(--color-bg-default)]",children:[r.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-16 md:py-24 text-center space-y-6",children:[r.jsx("p",{className:"text-[12px] uppercase tracking-[0.08em] text-[var(--color-fg-faint)] font-medium",children:Nt?`You're on ${(Be==null?void 0:Be.label)||(c==null?void 0:c.subscriptionTier)||"a paid plan"}`:o&&i!==void 0&&i<=14?`Free trial - ${i} day${i===1?"":"s"} left`:l?"Your trial has ended":`You're on Free (${(Be==null?void 0:Be.requestsPerDay)||250} req/day)`}),r.jsx("h1",{className:"text-[44px] md:text-[48px] font-medium tracking-[-0.02em] leading-[1.15] text-[var(--color-fg-default)]",children:Xt.headline.includes(` 890`)?Xt.headline.split(` 891`).map((P,te)=>r.jsxs("span",{children:[te>0&&r.jsx("br",{}),P]},te)):Xt.headline}),r.jsx("p",{className:"text-[16px] md:text-[17px] text-[var(--color-fg-muted)] leading-[1.5] max-w-[420px] mx-auto",children:Xt.subtext}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 pt-2",children:[e?r.jsxs(zs,{size:"lg",className:"bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] shadow-[0_12px_30px_rgba(85,97,255,0.35)] text-[15px] font-medium px-7 py-3 rounded-lg",onClick:()=>{ls&&G(ls)},disabled:_!==null,children:[_?"Starting checkout...":Nt?"Manage your plan":`Upgrade to Dev - ${et}`,!_&&r.jsx(Kt,{className:"w-4 h-4 ml-2"})]}):r.jsx(Xf,{mode:"modal",children:r.jsxs(zs,{size:"lg",className:"bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] shadow-[0_12px_30px_rgba(85,97,255,0.35)] text-[15px] font-medium px-7 py-3 rounded-lg",onClick:()=>Z.track("signup_started",{path:n.pathname}),children:["Get Started Free ",r.jsx(Kt,{className:"w-4 h-4 ml-2"})]})}),r.jsx("button",{type:"button",onClick:()=>{var P;return(P=document.getElementById("plan-cards"))==null?void 0:P.scrollIntoView({behavior:"smooth"})},className:"text-[15px] font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] px-7 py-3 rounded-lg border border-[var(--color-border-default)] bg-transparent transition-colors",children:"Compare plans"})]}),r.jsxs("p",{className:"text-[13px] text-[var(--color-fg-faint)] pt-1",children:["Serving ",N0.monthlyRequests," requests/month since ",N0.foundedYear]})]}),!Nt&&(()=>{const P=["lite","dev","pro"].map(te=>
891nt.get(te)).filter(Boolean);return P.length===0?null:r.jsx("div",{className:"mx-auto max-w-3xl px-4 pb-10",children:r.jsx("div",{className:"grid grid-cols-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] overflow-hidden",children:P.map(te=>{const me=f==="annual"?te.yearlyPriceCents:te.monthlyPriceCents,Te=te.tier==="dev",st={lite:"For testing and QA",dev:"Collections and auth",pro:"Full platform"};return r.jsxs("button",{type:"button",onClick:()=>G(te),className:`relative p-4 md:p-5 text-center transition-colors hover:bg-[var(--color-bg-hover)] cursor-pointer ${Te?"border-x border-indigo-500/30 bg-indigo-500/[0.04]":""}`,children:[r.jsxs("p",{className:`text-[11px] uppercase tracking-[0.06em] font-semibold mb-1 ${Te?"text-indigo-400":"text-[var(--color-fg-faint)]"}`,children:[te.label," - ",qg(me)]}),r.jsxs("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:[typeof te.requestsPerDay=="number"?te.requestsPerDay.toLocaleString():te.requestsPerDay," req/day"]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-0.5",children:st[te.tier]||""})]},te.tier)})})})})()]}),r.jsxs("div",{className:"container-stripe py-16 space-y-12",children:[(w||(Be==null?void 0:Be.isLegacy))&&r.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[w&&r.jsxs(X7,{variant:"destructive",className:"border-[var(--color-semantic-danger)]/40 bg-[var(--color-semantic-danger-bg)] text-[var(--color-semantic-danger)]",children:[r.jsx(Q7,{className:"text-[var(--color-semantic-danger)]",children:"Payment issue"}),r.jsxs(Z7,{className:"flex flex-col gap-2 text-[var(--color-semantic-danger)] sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("span",{children:w}),r.jsx(zs,{size:"sm",variant:"destructive",className:"bg-[var(--color-semantic-danger)]/80 hover:bg-[var(--color-semantic-danger)]",onClick:()=>k(null),children:"Dismiss"})]})]}),(Be==null?void 0:Be.isLegacy)&&r.jsxs("div",{className:"p-4 bg-[var(--color-bg-code)] border border-[var(--color-border-default)] rounded-xl text-sm text-[var(--color-fg-default)] space-y-1",children:[r.jsxs("div",{className:"font-semibold flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] text-[11px] uppercase tracking-wide",children:"Legacy"}),"You're on a legacy plan. You can stay here or move to the new tiers for higher limits."]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Legacy plans stay hidden from new customers but remain active for your account."})]})]}),!(c!=null&&c.hasPaid)&&r.jsxs("div",{className:"mx-auto max-w-xl parity-override",children:[r.jsx("style",{children:".parity-override .parity-banner-logo { display: none !important; } .parity-override .parity-banner-inner { padding-left: 0 !important; padding-right: 0 !important; text-align: center !important; }"}),r.jsx(fA,{backgroundColor:"var(--color-bg-card)",fontColor:"var(--color-fg-default)",borderRadius:"12px",fontSize:"13px",addCloseIcon:!1})]}),r.jsxs("div",{className:"flex flex-col items-center gap-3",children:[r.jsxs(uG,{type:"single",value:f,onValueChange:re,className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-1 shadow-sm",children:[r.jsx(b5,{value:"monthly",className:"rounded-full px-4 py-2 text-sm text-[var(--color-fg-default)] data-[state=on]:bg-[var(--color-accent-blue)] data-[state=on]:text-white",children:"Monthly"}),r.jsx(b5,{value:"annual",disabled:!gt,className:"rounded-full px-4 py-2 text-sm data-[state=on]:bg-[var(--color-accent-blue)] data-[state=on]:text-white text-[var(--color-fg-default)]",children:"Annual"})]}),r.jsx("p",{className:"text-xs text-[var(--color-semantic-success)]",children:"Save 20% on annual billing"})]}),r.jsx("div",{className:"mx-auto max-w-5xl",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)] mr-1",children:"I need:"}),Aj.map(P=>{const te=v===P.key,me=P.accent==="emerald"?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-indigo-500/40 bg-indigo-500/10 text-indigo-300";return r.jsx("button",{type:"button","aria-pressed":te,onClick:()=>
891{if(v===P.key)return;const st=v;y(P.key),Cf(P.key,"manual"),Z.track("upgrade_need_selected",{need:P.key,plans:P.plans}),Z.track("upgrade_lane_switched",{from_lane:st,to_lane:P.key,source:U})},className:`rounded-full px-3.5 py-1.5 text-xs font-medium border transition-all ${te?me:"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] hover:border-[var(--color-border-strong)] hover:text-[var(--color-fg-secondary)]"}`,children:P.label},P.key)})]})}),r.jsx("div",{ref:Ge,id:"plan-cards",className:"mx-auto max-w-5xl grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 scroll-mt-24",children:(()=>{const P=x$[v],te=new Set(P.plans);return P.plans.map(Te=>Pt.find(st=>st.tier===Te)).filter(Te=>!!Te&&te.has(Te.tier)).map(Te=>{const st=Gt(Te),xt=P.mostPopular===Te.tier,Et=Te.tier==="free",rs=f==="annual"?Te.yearlyPriceCents:Te.monthlyPriceCents,Rt=f==="annual"?!!Te.stripeYearlyPriceId:!!Te.stripeMonthlyPriceId,xs=Te.displayPrice??qg(rs),jt=Te.features.slice(0,3),qs=P.accent==="emerald",Xr=qs?"border-emerald-500/60 bg-[var(--color-bg-card)] shadow-[0_20px_60px_rgba(16,185,129,0.15)] scale-[1.02] ring-1 ring-emerald-500/30":"border-[var(--color-accent-blue)]/60 bg-[var(--color-bg-card)] shadow-[0_20px_60px_rgba(85,97,255,0.12)] scale-[1.02]";return r.jsxs("div",{"data-plan-tier":Te.tier,className:`relative flex flex-col rounded-2xl border p-5 transition-all duration-200 ${xt?Xr:"border-[var(--color-border-default)] bg-[var(--color-bg-alt)]"}`,children:[xt&&r.jsx("span",{className:`absolute -top-3 left-1/2 -translate-x-1/2 px-2 py-0.5 rounded-full text-[9px] font-medium uppercase tracking-wider text-white ${qs?"bg-emerald-500":"bg-[var(--color-accent-blue)]"}`,children:"Most popular"}),r.jsxs("div",{className:"space-y-1 mb-4",children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:Te.label}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:b$[Te.tier]||Te.tagline||""}),r.jsxs("div",{className:"flex items-baseline gap-1",children:[r.jsx("span",{className:"text-3xl font-bold text-[var(--color-fg-default)]",children:xs}),!Te.displayPrice&&rs!==void 0&&r.jsxs("span",{className:"text-sm text-[var(--color-fg-muted)]",children:["/",f==="monthly"?"mo":"yr"]})]})]}),r.jsx("ul",{className:"space-y-2 mb-6 flex-1",children:jt.map(pn=>r.jsxs("li",{className:"flex items-start gap-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(ts,{className:"w-4 h-4 text-[var(--color-semantic-success)] mt-0.5 shrink-0"}),r.jsx("span",{children:pn})]},pn))}
891),Te.contactOnly?r.jsxs(zs,{className:"w-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",onClick:()=>window.location.href="mailto:[email protected]",children:[r.jsx(yh,{className:"w-4 h-4 mr-2"}),"Talk to sales"]}):st?r.jsxs(zs,{variant:"outline",className:"w-full bg-[var(--color-bg-alt)] border-[var(--color-border-strong)] text-[var(--color-fg-muted)]",children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Current Plan"]}):Et?!e||!t?r.jsx(Xf,{mode:"modal",children:r.jsx(zs,{className:"w-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",onClick:()=>Z.track("signup_started",{path:n.pathname}),children:"Get Started Free"})}):r.jsx(zs,{className:"w-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)]",onClick:()=>window.location.href="/dashboard",children:"Continue with Free"}):Te.tier==="agent_developer"&&X?r.jsxs(zs,{variant:"outline",className:"w-full",onClick:()=>a("/agents"),children:[r.jsx(ts,{className:"w-4 h-4 mr-2"})," Manage at /agents"]}):Te.contactOnly?r.jsx(zs,{variant:"outline",className:"w-full",onClick:()=>{window.location.href=Te.tier==="agent_platform"?"mailto:[email protected]?subject=Agent%20Platform%20enquiry":"mailto:[email protected]"},children:"Talk to sales"}):Te.tier==="agent_developer"&&!Rt?r.jsx(zs,{variant:"outline",className:"w-full",onClick:()=>{window.location.href="mailto:[email protected]?subject=Agent%20Developer%20enquiry"},children:"Talk to sales"}):r.jsx(zs,{className:`w-full ${xt?qs?"bg-emerald-500 text-white hover:bg-emerald-400 shadow-[0_12px_30px_rgba(16,185,129,0.35)]":"bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)] shadow-[0_12px_30px_rgba(85,97,255,0.35)]":"bg-[var(--color-bg-card)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] hover:border-[var(--color-accent-blue)]/40"}`,onClick:()=>G(Te),disabled:_===`${Te.tier}-${f}`||!Rt,children:_===`${Te.tier}-${f}`?"Starting checkout...":Te.tier==="agent_developer"?Nt?"Add Agent Developer":`Subscribe to ${Te.label}`:Nt?"Manage plan":Rt?`Upgrade to ${Te.label}`:f==="annual"?"Annual price not configured":"Pricing not configured"})]},Te.tier)})})()}),mt&&r.jsxs("div",{className:"mx-auto max-w-md mt-2",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("span",{className:"flex-1 border-t border-[var(--color-border-default)]"}),r.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--color-fg-faint)]",children:"or"}),r.jsx("span",{className:"flex-1 border-t border-[var(--color-border-default)]"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 text-center",children:[r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-1",children:"Just need a one-shot allowance?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-4",children:"$5 = 10,000 requests. No subscription. No expiry."}),r.jsxs("a",{href:vt,target:"_blank",rel:"noopener noreferrer",onClick:()=>{Z.track("pack_offer_clicked",{surface:"upgrade_page_api_requests",source:U,destination:"stripe_payment_link"})},className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-bg-card)] px-4 py-2 text-xs font-medium text-[var(--color-fg-default)] hover:bg-[var(--color-bg-alt)] transition-colors cursor-pointer",children:["Buy 10K credits",r.jsx("span",{"aria-hidden":"true",children:"â"})]})]})]}),r.jsxs("p",{className:"text-center text-xs text-[var(--color-fg-faint)]",children:["Serving ",N0.monthlyRequests," API requests/month since ",N0.foundedYear,". Cancel anytime."]}),r.jsxs("div",{className:"mx-auto max-w-lg text-center space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-[var(--color-fg-muted)]",children:"What happens if I don't upgrade?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)] leading-relaxed",children:l?"Your data is preserved. You're on the free plan (250 req/day). Upgrade for higher limits.":"Your data stays safe. After the trial, you'll be on the free plan (250 req/day). Upgrade anytime for more."})]}),!It&&r.jsx("div",{className:"mx-auto max-w-5xl",children:r.jsxs("button",{type:"button",onClick:()=>
891{if(!O){z(!0);const P=Sf();E(te=>{const me=new Set(te.map(Te=>Te.tier));return[...te,...P.filter(Te=>!me.has(Te.tier))]})}Z.track("education_callout_clicked",{source:U}),setTimeout(()=>{var P;(P=H.current)==null||P.scrollIntoView({behavior:"smooth",block:"start"})},100)},className:"w-full flex items-start sm:items-center gap-4 p-4 rounded-xl border border-teal-500/20 bg-teal-500/5 text-left transition-colors hover:bg-teal-500/10 group",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-teal-500/10 flex items-center justify-center shrink-0",children:r.jsx(lp,{className:"w-5 h-5 text-teal-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Teaching a class or running a bootcamp?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] mt-0.5",children:"ReqRes has dedicated Education plans with per-student API key isolation and instructor dashboards."})]}),r.jsxs("span",{className:"text-sm text-teal-400 whitespace-nowrap shrink-0 group-hover:underline",children:["View Education plans ",r.jsx(Kt,{className:"w-3.5 h-3.5 inline ml-1"})]})]})}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsxs(zs,{variant:"outline",className:"border-[var(--color-border-default)] text-[var(--color-fg-default)] bg-[var(--color-bg-alt)]",onClick:ge,children:[O?"Hide advanced plans":"Show advanced plans",r.jsx(Kt,{className:`w-4 h-4 ml-2 transition-transform ${O?"rotate-90":""}`})]}),!O&&he==="team"&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Team is recommended for org workspaces."})]}),O&&r.jsx("div",{ref:H,className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Pt.filter(P=>!_u.includes(P.tier)).map(es)}),r.jsxs("details",{className:"mx-auto max-w-5xl group",children:[r.jsxs("summary",{className:"flex items-center justify-center gap-2 cursor-pointer text-sm font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition-colors py-2 list-none [&::-webkit-details-marker]:hidden",children:[r.jsx(sr,{className:"h-4 w-4 transition-transform group-open:rotate-180"}),"Compare all plans"]}),r.jsx("div",{className:"mt-4 overflow-x-auto rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] animate-fade-in",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"sticky top-0 bg-[var(--color-bg-card)] text-left p-4 text-[var(--color-fg-muted)] font-medium border-b border-[var(--color-border-default)]",children:"Â "}),Ct.map(P=>{const te=P.tier==="dev",me=P.isClassroom;return r.jsxs("th",{className:`sticky top-0 p-4 text-center font-medium border-b border-[var(--color-border-default)] ${te?"bg-[var(--color-accent-blue)]/5 text-[var(--color-accent-blue)] border-l border-r border-[var(--color-accent-blue)]/20":me?"bg-teal-500/5 text-teal-400 border-l border-r border-teal-500/20":"bg-[var(--color-bg-card)] text-[var(--color-fg-muted)]"}`,children:[P.isClassroom?"Education":P.label,te&&r.jsx("span",{className:"ml-2 inline-block px-2 py-0.5 rounded-full text-[10px] font-medium uppercase tracking-wider bg-[var(--color-accent-blue)] text-white",children:"Popular"}),me&&r.jsx("span",{className:"ml-2 inline-block px-2 py-0.5 rounded-full text-[10px] font-medium uppercase tracking-wider bg-teal-500 text-white",children:"Edu"})]},`head-${P.tier}`)})]})}),r.jsxs("tbody",{children:[r.jsxs("tr",{children:[r.jsx("td",{className:"p-4 text-[var(--color-fg-secondary)] font-medium border-b border-[var(--color-border-default)]",children:"Best for"}),Ct.map(P=>{const te=P.tier==="dev",me=P.isClassroom;return r.jsx("td",{className:`p-4 text-center border-b border-[var(--color-border-default)] ${te?"bg-[var(--color-accent-blue)]/5 border-l border-r border-[var(--color-accent-blue)]/20 text-[var(--color-fg-default)] font-medium":me?"bg-teal-500/5 border-l border-r border-teal-500/20 text-[var(--color-fg-default)] font-medium":"text-[var(--color-fg-secondary)]"}
891`,children:b$[P.tier]||"-"},`bestfor-${P.tier}`)})]}),r.jsxs("tr",{children:[r.jsx("td",{className:"p-4 text-[var(--color-fg-secondary)] font-medium border-b border-[var(--color-border-default)]",children:"Price"}),Ct.map(P=>{const te=P.tier==="dev",me=P.isClassroom,Te=f==="annual"?P.yearlyPriceCents:P.monthlyPriceCents;return r.jsxs("td",{className:`p-4 text-center border-b border-[var(--color-border-default)] ${te?"bg-[var(--color-accent-blue)]/5 border-l border-r border-[var(--color-accent-blue)]/20 text-[var(--color-fg-default)] font-semibold":me?"bg-teal-500/5 border-l border-r border-teal-500/20 text-[var(--color-fg-default)] font-semibold":"text-[var(--color-fg-default)]"}`,children:[P.displayPrice??qg(Te),!P.displayPrice&&Te!==void 0&&r.jsxs("span",{className:"text-[var(--color-fg-muted)] font-normal",children:["/",f==="monthly"?"mo":"yr"]})]},`price-${P.tier}`)})]}),ze.map((P,te)=>r.jsxs("tr",{className:te%2===0?"bg-[var(--color-bg-default)]/30":"",children:[r.jsx("td",{className:"p-4 text-[var(--color-fg-secondary)] border-b border-[var(--color-border-default)]",children:P.label}),Ct.map(me=>{const Te=me.tier==="dev",st=me.isClassroom;let xt=Ml(me,P.key);return st&&P.key==="appUsers"&&(xt=`${me.appUsers} students`),r.jsx("td",{className:`p-4 text-center border-b border-[var(--color-border-default)] ${Te?"bg-[var(--color-accent-blue)]/5 border-l border-r border-[var(--color-accent-blue)]/20 text-[var(--color-fg-default)]":st?"bg-teal-500/5 border-l border-r border-teal-500/20 text-[var(--color-fg-default)]":"text-[var(--color-fg-secondary)]"}`,children:xt},`${P.label}-${me.tier}`)})]},P.label))]})]})}),r.jsxs("p",{className:"mt-3 text-center text-xs text-[var(--color-fg-muted)]",children:["Agent sandbox plans are compared on the"," ",r.jsx("a",{href:"/for/ai-agents",target:"_blank",rel:"noreferrer",className:"text-[var(--color-accent-blue)] hover:underline",children:"AI Agents page"}),"."]})]}),r.jsxs("div",{className:"mx-auto max-w-3xl space-y-6",children:[r.jsx("div",{className:"border-t border-[var(--color-border-default)] pt-8",children:r.jsx("h3",{className:"text-2xl font-semibold text-[var(--color-fg-default)] tracking-tight",children:"Common questions"})}),r.jsx(pG,{type:"single",collapsible:!0,className:"space-y-2",children:y$.map(P=>r.jsxs(xA,{value:P.id,className:"border border-[var(--color-border-default)] rounded-xl bg-[var(--color-bg-alt)] transition-colors hover:bg-[var(--color-bg-alt)]/80",children:[r.jsx(vA,{className:"px-5 py-4 text-[var(--color-fg-default)] text-[15px] font-medium",children:P.question}),r.jsx(bA,{className:"px-5 pb-5 pt-0",children:r.jsx("div",{className:"border-l-2 border-[var(--color-accent-blue)]/30 pl-4 text-[14px] leading-relaxed text-[var(--color-fg-secondary)]",children:P.answer})})]},P.id))})]}),r.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:y$.map(P=>({"@type":"Question",name:P.question,acceptedAnswer:{"@type":"Answer",text:P.answer}}))})}}),J&&V&&r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:[r.jsx("div",{className:"absolute inset-0",onClick:()=>{F(!1),$(null)},"aria-hidden":"true"}),r.jsxs("div",{className:"relative w-full max-w-md mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-xl",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-2",children:"Select an organization"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mb-4",children:"Team plans are billed per organization. Select which team to subscribe."}),r.jsx("div",{className:"space-y-2",children:K.map(P=>r.jsx("button",{onClick:()=>Zt(P.id,V.plan,V.interval),className:"w-full text-left p-4 rounded-xl border border-[var(--color-border-default)]/80 bg-[var(--color-bg-card)]/70 hover:border-[var(--color-accent-purple)]/50 hover:bg-[var(--color-accent-purple)]/10 transition",children:r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:P.name})},P.id))}),r.jsx("div",{className:"flex justify-end gap-3 mt-4 pt-4 border-t border-[var(--color-border-default)]",children:r.jsx(zs,{variant:"outline",className:"border-[var(--color-border-default)] text-[var(--color-fg-default)]",onClick:()=>{F(!1),$(null)},children:"Cancel"})})]})]})]})]})]})}function KCe(){const{user:e}=_r(),{getToken:t}=zt(),[s,n]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[c,u]=x.useState(!1),[f,h]=x.useState(!1),[g,v]=x.useState(""),[y,_]=x.useState(""),[j,w]=x.useState(null),[k,S]=x.useState(!1);x.useEffect(()=>{var A,R;if((R=(A=e==null?void 0:e.emailAddresses)==null?void 0:A[0])!=null&&R.emailAddress){const I=e.emailAddresses[0].emailAddress;n(I),(async()=>{try{const O=(await Cx.getProKey(I)).data;sessionStorage.setItem("reqres_api_key",O.api_key),o(O.api_key),l(`â Your Pro API Key: 892 893${O.api_key}`)}catch{const O=sessionStorage.getItem("reqres_api_key");O&&(o(O),l(`â Your Pro API Key: 894 895${O}`))}})()}S(!0)},[e]),x.useEffect(()=>{var A,R;if(!((R=(A=e==null?void 0:e.emailAddresses)==null?void 0:A[0])!=null&&R.emailAddress)){const I=sessionStorage.getItem("reqres_api_key");I&&(o(I),l(`â Your Pro API Key: 896 897${I}`))}},[e]);const E=async A=>
897{if(A.preventDefault(),!!s.trim()){u(!0),l("Loadingâ¦");try{const I=(await Cx.getProKey(s.trim())).data;sessionStorage.setItem("reqres_api_key",I.api_key),o(I.api_key),l(`â Your Pro API Key: 898 899${I.api_key}`),w({type:"success",message:"API key retrieved successfully! ð"})}catch(R){R instanceof Error?l(`â ${R.message}`):l("â Network error â try again"),w({type:"error",message:"Failed to retrieve API key. Please try again."})}finally{u(!1)}}},T=async()=>{if(a){h(!0),v(""),_("");try{const A=await Ue(t);if(!A){v("Please sign in to manage billing.");return}const I=(await Cx.createPortalSession(a,{authToken:A})).data;_(I.url),window.location.href=I.url,w({type:"success",message:"Redirecting to billing portal... ð"})}catch(A){v(`Cannot open portal: ${A instanceof Error?A.message:"Unknown error"}`),w({type:"error",message:"Failed to open billing portal. Please try again."})}finally{h(!1)}}};return r.jsx("div",{className:"container-stripe py-10",children:k?e?r.jsxs("div",{className:"max-w-2xl mx-auto stack-8",children:[j&&r.jsx(eb,{type:j.type,message:j.message,onClose:()=>w(null)}),r.jsx(tl,{className:"p-8 surface-card elevation-1",children:r.jsxs("div",{className:"stack-8",children:[r.jsxs("div",{className:"stack-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Your Pro API Key"}),r.jsx("p",{className:"text-foreground-secondary",children:"Enter the e-mail you used at checkout to retrieve your API key:"}),r.jsxs("form",{onSubmit:E,className:"stack-4",children:[r.jsx(id,{type:"email",value:s,onChange:A=>n(A.target.value),placeholder:"[email protected]",required:!0,disabled:c}),r.jsx(zs,{type:"submit",disabled:c,children:c?r.jsx(bs,{size:"sm",variant:"dots",text:"Loading..."}):"Get My Key"})]}),i&&r.jsx("div",{className:"bg-background-alt border border-border rounded-lg p-4",children:r.jsx(Vt,{title:"API key",language:"text",code:i,readMoreHref:"/documentation?section=projects"})})]}),a&&r.jsxs(r.Fragment,{children:[r.jsx("hr",{className:"border-border"}),r.jsxs("div",{className:"stack-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Billing & subscription"}),r.jsx("p",{className:"text-foreground-secondary",children:"You can update your card, download invoices or cancel anytime."}),r.jsx(zs,{onClick:T,disabled:f,size:"lg",children:f?r.jsx(bs,{size:"sm",variant:"dots",text:"Loading..."}):"Open billing portal â"}),y&&r.jsxs("p",{className:"text-foreground-secondary",children:["If nothing happens,"," ",r.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:text-accent-purple underline",children:"click here"}),"."]}),g&&r.jsx(tl,{className:"p-4 border border-semantic-danger/30 bg-semantic-danger/5",children:r.jsx("span",{className:"text-semantic-danger text-sm",children:g})})]})]})]})}),r.jsxs("div",{className:"text-center text-foreground-secondary",children:["Need help?"," ",r.jsx("a",{href:"/faq",className:"text-accent-blue hover:text-accent-purple underline",children:"FAQ"})," ","â¢"," ",r.jsx("a",{href:"mailto:[email protected]",className:"text-accent-blue hover:text-accent-purple underline",children:"Contact Support"})]})]}):r.jsx("div",{className:"text-center text-semantic-danger",children:"You must be signed in to manage your subscription."}):r.jsx("div",{className:"text-center",children:r.jsx(bs,{size:"lg",variant:"spinner",text:"Loading..."})})})}function JCe(){return r.jsxs("div",{className:"container-stripe py-10",children:[r.jsx(tl,{className:"p-8 surface-card elevation-1 max-w-2xl mx-auto",children:r.jsxs("div",{className:"text-center stack-6",children:[r.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Create your API key"}),r.jsxs("p",{className:"text-body max-w-xl mx-auto",children:["ReqRes now requires a workspace API key for all requests. Create one in the dashboard and use it via the ",r.jsx("code",{children:"x-api-key"})," header. Keys are free to generate-upgrade when you need Pro or Premium limits."]}),r.jsx("div",{className:"bg-background-alt border border-border rounded-lg p-4",children:r.jsx(Vt,{title:"API key header",language:"ts",code:`fetch('https://reqres.in/api/users', { 900 headers: { 'x-api-key': 'YOUR_API_KEY' } 901});`,readMoreHref:"/documentation?section=projects"})}),r.jsxs("div",{className:"text-center stack-4",children:[r.jsx("p",{className:"text-foreground",children:"Need higher limits or persistence? Upgrade to Pro or Premium from your workspace."}),r.jsx(zs,{asChild:!0,children:r.jsx("a",{href:"/upgrade",children:"Go Pro â"})})]})]})}),r.jsxs("div",{className:"text-center mt-6 text-foreground-secondary",children:["Need help getting started?"," ",r.jsx("a",{href:"/faq",className:"text-accent-blue hover:text-accent-purple underline",children:"FAQ"})," ","â¢"," ",r.jsx("a",{href:"mailto:[email protected]",className:"text-accent-blue hover:text-accent-purple underline",children:"Contact Support"})]})]})}function XCe(){Mn("Upgrade complete");const e=un(),[t]=Wa(),{getToken:s}=zt(),{isLoaded:n,user:a}=_r(),o=x.useRef(!1),[i,l]=x.useState(null),[c,u]=x.useState(!1),[f,h]=x.useState(!1),[g,v]=x.useState(null),[y,_]=x.useState(null),j=g==="team";x.useEffect(()=>{if(o.current||!n||!a)return;let k=null;try{const E=sessionStorage.getItem("rr_checkout_context");E&&(k=JSON.parse(E)),sessionStorage.removeItem("rr_checkout_context")}catch{}k!=null&&k.plan_code&&v(String(k.plan_code).toLowerCase());const S=t.get("session_id");Z.track("checkout_completed",{plan_code:(k==null?void 0:k.plan_code)||"unknown",interval:k==null?void 0:k.billing_interval,source:k==null?void 0:k.source,...S?{stripe_session_id:S}:{}}),o.current=!0},[n,a]),x.useEffect(()=>{let k=!1;return(async()=>{var S,E;try{const T=await Ue(s);if(!T||k)return;const[A,R]=await Promise.all([ue.get("/api-keys",{authToken:T}),ue.get("/projects?limit=1",{authToken:T})]);if(k||(A.data&&A.data.length>0&&l(A.data[0].api_key),(((S=R.data)==null?void 0:S.projects)||[]).length>0&&h(!0),!j))return;for(let L=0;L<4;L++){if(k)return;try{const M=await ue.get("/organizations",{authToken:T}),O=Array.isArray(M.data)?M.data:((E=M.data)==null?void 0:E.data)||[];
901if(O.length>0){_(O[0]);return}}catch{}await new Promise(M=>setTimeout(M,1500))}}catch{}})(),()=>{k=!0}},[s,j]);const w=x.useCallback(async()=>{if(i)try{await navigator.clipboard.writeText(i),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[i]);return r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)] flex items-center justify-center px-4 py-12",children:r.jsxs("div",{className:"max-w-2xl w-full space-y-8",children:[r.jsxs("div",{className:"space-y-3 text-center",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx($u,{className:"bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)] border-[var(--color-semantic-success)]/40",children:"Checkout complete"})}),r.jsx("h1",{className:"text-4xl font-bold text-[var(--color-fg-default)]",children:"Youâre all set!"}),r.jsx("p",{className:"text-lg text-[var(--color-fg-secondary)] max-w-xl mx-auto",children:"Your subscription is active. Letâs get your first project up and running."})]}),r.jsx(tl,{className:"p-6 bg-[var(--color-bg-card)] border border-[var(--color-border-default)] shadow-lg",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--color-semantic-success-bg)] border border-[var(--color-semantic-success)]/40 flex items-center justify-center text-[var(--color-semantic-success)] shrink-0",children:r.jsx(Or,{className:"w-5 h-5"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)]",children:"Subscription activated"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"A receipt has been sent to your email."})]})]})}),j?r.jsx(tl,{className:"p-8 bg-[var(--color-bg-card)] border border-[var(--color-border-default)] shadow-lg",children:r.jsxs("div",{className:"space-y-5 text-center",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-emerald-500/20 to-indigo-500/20 border border-emerald-500/30 flex items-center justify-center",children:r.jsx(Tq,{className:"w-6 h-6 text-emerald-400"})})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:y?`Your team is ready: ${y.name||"Your team"}`:"Next step: Invite your team"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-md mx-auto",children:y?"We created your organisation. Invite teammates by email. They get their own login, share your projects, and one invoice covers everyone.":"Set up your organisation in 30 seconds. Invite teammates by email so they share your projects."})]}),r.jsxs(zs,{size:"lg",className:"bg-[var(--color-accent-blue)] hover:brightness-110 text-white shadow-lg px-8",onClick:()=>
901{Z.track("post_checkout_cta_clicked",{cta:y?"invite_team":"create_org"}),e("/organizations")},children:[y?"Invite teammates":"Set up your organisation",r.jsx(Kt,{className:"w-4 h-4 ml-2"})]})]})}):r.jsx(tl,{className:"p-8 bg-[var(--color-bg-card)] border border-[var(--color-border-default)] shadow-lg",children:r.jsxs("div",{className:"space-y-5 text-center",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-indigo-500/20 to-purple-500/20 border border-indigo-500/30 flex items-center justify-center",children:r.jsx(Wfe,{className:"w-6 h-6 text-indigo-400"})})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:f?"Your project is ready":"Next step: Create your first project"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-md mx-auto",children:f?"You already have a project with sample data. Head to the dashboard to explore it and start building.":"A project gives you API endpoints, collections, and sample data. Set one up manually or let AI generate everything from a description."})]}),r.jsxs(zs,{size:"lg",className:"bg-[var(--color-accent-blue)] hover:brightness-110 text-white shadow-lg px-8",onClick:()=>{Z.track("post_checkout_cta_clicked",{cta:f?"explore_project":"create_project"}),e("/dashboard")},children:[f?"Go to your project":"Create your first project",r.jsx(Kt,{className:"w-4 h-4 ml-2"})]})]})}),i&&r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsx(_d,{className:"w-4 h-4 text-[var(--color-fg-muted)] shrink-0"}),r.jsx("span",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Your API key:"}),r.jsx("code",{className:"flex-1 text-xs font-mono text-[var(--color-fg-default)] truncate",children:i}),r.jsx(zs,{variant:"ghost",size:"sm",className:"shrink-0 h-7 w-7 p-0",onClick:w,children:c?r.jsx(ts,{className:"w-3.5 h-3.5"}):r.jsx(is,{className:"w-3.5 h-3.5"})})]}),r.jsxs("div",{className:"flex items-center justify-center gap-6 text-sm",children:[r.jsx("button",{type:"button",onClick:()=>{Z.track("post_checkout_cta_clicked",{cta:"playground"}),e("/playground?path=/api/users&method=GET")},className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition",children:"Try the Playground"}),r.jsx("span",{className:"text-[var(--color-border-default)]",children:"·"}),r.jsx("button",{type:"button",onClick:()=>{Z.track("post_checkout_cta_clicked",{cta:"documentation"}),e("/documentation")},className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] transition",children:"View Documentation"})]})]})})}function QCe(){const e=un(),[t]=Wa(),{isLoaded:s,user:n}=_r(),a=x.useRef(!1);return x.useEffect(()=>{if(a.current||!s||!n)return;let o=null;try{const l=sessionStorage.getItem("rr_checkout_context");l&&(o=JSON.parse(l)),sessionStorage.removeItem("rr_checkout_context")}catch{}const i=t.get("session_id");Z.track("org_checkout_completed",{plan_code:(o==null?void 0:o.plan_code)||"team",interval:o==null?void 0:o.billing_interval,organization_id:o==null?void 0:o.organization_id,source:o==null?void 0:o.source,...i?{stripe_session_id:i}:{}}),a.current=!0},[s,n]),r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)] flex items-center justify-center px-4 py-12",children:r.jsxs("div",{className:"max-w-3xl w-full space-y-8 text-center",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx($u,{className:"bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)] border-[var(--color-semantic-success)]/40",children:"Team plan activated"})}),r.jsx("h1",{className:"text-4xl font-bold text-[var(--color-fg-default)]",children:"Your team is ready!"}),r.jsx("p",{className:"text-lg text-[var(--color-fg-secondary)] max-w-2xl mx-auto",children:"Your organization now has team-tier access. Start inviting teammates and collaborating with shared projects, logs, and API keys."})]}),r.jsx(tl,{className:"p-8 bg-[var(--color-bg-card)] border border-[var(--color-border-default)] shadow-lg",children:r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsx("div",{className:"w-14 h-14 roun
901ded-full bg-[var(--color-semantic-success-bg)] border border-[var(--color-semantic-success)]/40 flex items-center justify-center text-[var(--color-semantic-success)]",children:r.jsx(Or,{className:"w-7 h-7"})}),r.jsxs("div",{className:"space-y-1 text-[var(--color-fg-default)]",children:[r.jsx("p",{className:"text-lg font-semibold",children:"Team subscription active"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"A receipt has been sent to your email. Your team members will now have access to 100,000 requests/day and all team features."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full justify-center",children:[r.jsxs(zs,{className:"bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)]",onClick:()=>e("/organizations"),children:[r.jsx(ln,{className:"w-4 h-4 mr-2"}),"Manage team"]}),r.jsx(zs,{variant:"outline",className:"border-[var(--color-border-default)] text-base",onClick:()=>e("/dashboard"),children:"Go to dashboard"})]})]})}),r.jsxs("div",{className:"text-sm text-[var(--color-fg-muted)] space-y-2",children:[r.jsx("p",{children:"Next steps:"}),r.jsxs("ul",{className:"space-y-1",children:[r.jsx("li",{children:"Invite team members via email"}),r.jsx("li",{children:"Create shared projects for your team"}),r.jsx("li",{children:"View usage across all team members"})]})]})]})})}function ZCe(){Mn("Thanks for your purchase");const[e]=Wa(),t=e.get("session_id");return x.useEffect(()=>{Z.track("pack_purchase_landed",{stripe_session_id:t||null})},[t]),r.jsxs("div",{className:"mx-auto max-w-md py-16 px-6 text-center",children:[r.jsx("div",{"aria-hidden":"true",className:"mx-auto mb-6 flex h-12 w-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-400",children:r.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})}),r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)] mb-3",children:"You're all set"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] mb-3 leading-relaxed",children:"Got your $5. 10,000 request credits are being added to your account manually â usually within a few hours, always within 24."}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-8 leading-relaxed",children:"You'll get a confirmation email once they're active. Your existing free tier (250 requests/day) still works in the meantime."}),r.jsxs(dt,{to:"/",className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-strong)] bg-[var(--color-bg-card)] px-4 py-2 text-xs font-medium text-[var(--color-fg-default)] hover:bg-[var(--color-bg-alt)] transition-colors",children:["Back to dashboard",r.jsx("span",{"aria-hidden":"true",children:"â"})]}),r.jsx("p",{className:"mt-12 text-[11px] text-[var(--color-fg-faint)]",children:"Questions? Reply to your Stripe receipt or email [email protected]."})]})}const j5={"landing-1":`<svg 902 class="absolute inset-0 h-full w-full -translate-y-12 md:-translate-y-16"
903 viewBox="0 0 1440 820" 904 fill="none" 905 xmlns="http://www.w3.org/2000/svg" 906 aria-hidden="true" 907 > 908 <defs> 909 <!-- soft vignette mask so the art fades at edges --> 910 <radialGradient 911 id="rrHeroMask" 912 cx="0" 913 cy="0" 914 r="1" 915 gradientUnits="userSpaceOnUse" 916 gradientTransform="translate(720 180) rotate(90) scale(520 920)" 917 > 918 <stop stop-color="#FFFFFF" stop-opacity="0.22" /> 919 <stop 920 offset="0.55" 921 stop-color="#FFFFFF" 922 stop-opacity="0.10" 923 /> 924 <stop 925 offset="1" 926 stop-color="#FFFFFF" 927 stop-opacity="0" 928 /> 929 </radialGradient> 930 931 <!-- subtle indigo glow --> 932 <radialGradient 933 id="rrHeroGlow" 934 cx="0" 935 cy="0" 936 r="1" 937 gradientUnits="userSpaceOnUse" 938 gradientTransform="translate(980 240) rotate(120) scale(520 420)" 939 > 940 <stop stop-color="#5a45ff" stop-opacity="0.16" /> 941 <stop 942 offset="1" 943 stop-color="#5a45ff" 944 stop-opacity="0" 945 /> 946 </radialGradient> 947 948 <!-- stroke gradients --> 949 <linearGradient 950 id="rrHeroStroke" 951 x1="260" 952 y1="180" 953 x2="1180" 954 y2="520" 955 gradientUnits="userSpaceOnUse" 956 > 957 <stop stop-color="#FFFFFF" stop-opacity="0" /> 958 <stop 959 offset="0.45" 960 stop-color="#FFFFFF" 961 stop-opacity="0.14" 962 /> 963 <stop 964 offset="1" 965 stop-color="#FFFFFF" 966 stop-opacity="0" 967 /> 968 </linearGradient> 969 970 <linearGradient 971 id="rrHeroAccent" 972 x1="420" 973 y1="240" 974 x2="1220" 975 y2="520" 976 gradientUnits="userSpaceOnUse" 977 > 978 <stop stop-color="#5a45ff" stop-opacity="0" /> 979 <stop 980 offset="0.5" 981 stop-color="#5a45ff" 982 stop-opacity="0.6" 983 /> 984 <stop 985 offset="1" 986 stop-color="#5a45ff" 987 stop-opacity="0" 988 /> 989 </linearGradient> 990 </defs> 991 992 <!-- indigo glow blob --> 993 <rect 994 width="1440" 995 height="760" 996 fill="url(#rrHeroGlow)" 997 opacity="1" 998 /> 999 1000 <!-- flow lines group, masked by radial gradient --> 1001 <g opacity="0.95"> 1002 <!-- faint base arcs --> 1003 <path 1004 d="M120 520 C 360 220, 620 220, 860 520" 1005 stroke="url(#rrHeroStroke)" 1006 stroke-width="2" 1007 stroke-linecap="round" 1008 opacity="0.55" 1009 /> 1010 <path 1011 d="M260 600 C 520 280, 760 280, 1120 560"
1012 stroke="url(#rrHeroStroke)" 1013 stroke-width="2" 1014 stroke-linecap="round" 1015 opacity="0.45" 1016 /> 1017 <path 1018 d="M80 340 C 360 120, 840 120, 1320 360" 1019 stroke="url(#rrHeroStroke)" 1020 stroke-width="2" 1021 stroke-linecap="round" 1022 opacity="0.35" 1023 /> 1024 1025 <!-- animated dashed accent arcs --> 1026 <path 1027 class="rr-hero-dash" 1028 d="M140 520 C 380 235, 640 235, 900 520" 1029 stroke="url(#rrHeroAccent)" 1030 stroke-width="3" 1031 stroke-linecap="round" 1032 stroke-dasharray="7 10" 1033 opacity="0.9" 1034 /> 1035 1036 <path 1037 class="rr-hero-dash rr-hero-dash-slow" 1038 d="M220 600 C 520 300, 760 300, 1100 560" 1039 stroke="url(#rrHeroAccent)" 1040 stroke-width="3" 1041 stroke-linecap="round" 1042 stroke-dasharray="6 12" 1043 opacity="0.55" 1044 /> 1045 1046 <!-- subtle âtickâ marks (Linear-ish) --> 1047 <g opacity="0.18"> 1048 <path 1049 d="M560 250 l-20 10" 1050 stroke="rgba(255,255,255,0.7)" 1051 stroke-width="2" 1052 stroke-linecap="round" 1053 /> 1054 <path 1055 d="M610 230 l-18 12" 1056 stroke="rgba(255,255,255,0.7)" 1057 stroke-width="2" 1058 stroke-linecap="round" 1059 /> 1060 <path 1061 d="M660 215 l-16 14" 1062 stroke="rgba(255,255,255,0.7)" 1063 stroke-width="2" 1064 stroke-linecap="round" 1065 /> 1066 <path 1067 d="M710 208 l-14 15" 1068 stroke="rgba(255,255,255,0.7)" 1069 stroke-width="2" 1070 stroke-linecap="round" 1071 /> 1072 <path 1073 d="M760 206 l-12 16" 1074 stroke="rgba(255,255,255,0.7)" 1075 stroke-width="2" 1076 stroke-linecap="round" 1077 /> 1078 <path 1079 d="M810 210 l-10 17" 1080 stroke="rgba(255,255,255,0.7)" 1081 stroke-width="2" 1082 stroke-linecap="round" 1083 /> 1084 </g> 1085 1086 <!-- a single pulse dot (optional) --> 1087 <circle 1088 class="rr-hero-pulse" 1089 cx="900" 1090 cy="520" 1091 r="4.5" 1092 fill="rgba(90,69,255,0.9)" 1093 opacity="0.35" 1094 /> 1095 </g> 1096 1097 <!-- vignette mask overlay --> 1098 <rect 1099 width="1440" 1100 height="760" 1101 fill="url(#rrHeroMask)" 1102 opacity="0.75" 1103 /> 1104 </svg>`,"landing-2":`<svg
1105 viewBox="0 0 520 360" 1106 fill="none" 1107 xmlns="http://www.w3.org/2000/svg" 1108 aria-hidden="true" 1109 class="absolute -right-12 -bottom-10 w-[420px] opacity-60" 1110 > 1111 <defs> 1112 <linearGradient 1113 id="rrA_bg" 1114 x1="60" 1115 y1="40" 1116 x2="460" 1117 y2="320" 1118 gradientUnits="userSpaceOnUse" 1119 > 1120 <stop stop-color="rgba(255,255,255,0.06)" /> 1121 <stop 1122 offset="1" 1123 stop-color="rgba(255,255,255,0.01)" 1124 /> 1125 </linearGradient> 1126 1127 <linearGradient 1128 id="rrA_edge" 1129 x1="120" 1130 y1="70" 1131 x2="420" 1132 y2="280" 1133 gradientUnits="userSpaceOnUse" 1134 > 1135 <stop stop-color="rgba(90,69,255,0.55)" /> 1136 <stop 1137 offset="1" 1138 stop-color="rgba(90,69,255,0.00)" 1139 /> 1140 </linearGradient> 1141 1142 <filter 1143 id="rrA_softShadow" 1144 x="-20%" 1145 y="-20%" 1146 width="140%" 1147 height="140%" 1148 > 1149 <feDropShadow 1150 dx="0" 1151 dy="18" 1152 stdDeviation="18" 1153 flood-color="rgba(0,0,0,0.55)" 1154 /> 1155 </filter> 1156 1157 <filter 1158 id="rrA_blur" 1159 x="-20%" 1160 y="-20%" 1161 width="140%" 1162 height="140%" 1163 > 1164 <feGaussianBlur stdDeviation="0.35" /> 1165 </filter> 1166 1167 <radialGradient 1168 id="rrA_glow" 1169 cx="0" 1170 cy="0" 1171 r="1" 1172 gradientUnits="userSpaceOnUse" 1173 gradientTransform="translate(360 140) rotate(120) scale(220 180)" 1174 > 1175 <stop stop-color="rgba(90,69,255,0.20)" /> 1176 <stop 1177 offset="1" 1178 stop-color="rgba(90,69,255,0.00)" 1179 /> 1180 </radialGradient> 1181 </defs> 1182 1183 <!-- ambient glow --> 1184 <path 1185 d="M0 0H520V360H0Z" 1186 fill="url(#rrA_glow)" 1187 opacity="0.9" 1188 /> 1189 1190 <!-- stacked panels --> 1191 <g filter="url(#rrA_softShadow)" opacity="0.95">
1192 <g filter="url(#rrA_blur)"> 1193 <path 1194 d="M140 88C140 74.745 150.745 64 164 64H418C431.255 64 442 74.745 442 88V132C442 145.255 431.255 156 418 156H164C150.745 156 140 145.255 140 132V88Z" 1195 fill="url(#rrA_bg)" 1196 stroke="rgba(255,255,255,0.10)" 1197 /> 1198 <path 1199 d="M124 132C124 118.745 134.745 108 148 108H402C415.255 108 426 118.745 426 132V176C426 189.255 415.255 200 402 200H148C134.745 200 124 189.255 124 176V132Z" 1200 fill="rgba(255,255,255,0.03)" 1201 stroke="rgba(255,255,255,0.09)" 1202 /> 1203 <path 1204 d="M108 176C108 162.745 118.745 152 132 152H386C399.255 152 410 162.745 410 176V220C410 233.255 399.255 244 386 244H132C118.745 244 108 233.255 108 220V176Z" 1205 fill="rgba(255,255,255,0.025)" 1206 stroke="rgba(255,255,255,0.08)" 1207 /> 1208 <path 1209 d="M92 220C92 206.745 102.745 196 116 196H370C383.255 196 394 206.745 394 220V264C394 277.255 383.255 288 370 288H116C102.745 288 92 277.255 92 264V220Z" 1210 fill="rgba(255,255,255,0.02)" 1211 stroke="rgba(255,255,255,0.07)" 1212 /> 1213 1214 <!-- subtle inner divider lines --> 1215 <g opacity="0.35"> 1216 <path 1217 d="M162 90H420" 1218 stroke="rgba(255,255,255,0.10)" 1219 /> 1220 <path 1221 d="M146 134H404" 1222 stroke="rgba(255,255,255,0.10)" 1223 /> 1224 <path 1225 d="M130 178H388" 1226 stroke="rgba(255,255,255,0.10)" 1227 /> 1228 <path 1229 d="M114 222H372" 1230 stroke="rgba(255,255,255,0.10)" 1231 /> 1232 </g> 1233 1234 <!-- accent edge stroke --> 1235 <path 1236 class="rr-shimmer" 1237 d="M156 74H410C425.464 74 438 86.536 438 102V118" 1238 stroke="url(#rrA_edge)" 1239 stroke-width="2" 1240 stroke-linecap="round" 1241 opacity="0.9" 1242 /> 1243 </g> 1244 </g> 1245 </svg>`,"landing-3":`<svg
1246 viewBox="0 0 520 360" 1247 fill="none" 1248 xmlns="http://www.w3.org/2000/svg" 1249 aria-hidden="true" 1250 class="absolute -right-12 -bottom-10 w-[420px] opacity-60" 1251 > 1252 <defs> 1253 <radialGradient 1254 id="rrB_glow" 1255 cx="0" 1256 cy="0" 1257 r="1" 1258 gradientUnits="userSpaceOnUse" 1259 gradientTransform="translate(260 180) rotate(90) scale(230 260)" 1260 > 1261 <stop stop-color="rgba(90,69,255,0.16)" /> 1262 <stop 1263 offset="1" 1264 stop-color="rgba(90,69,255,0)" 1265 /> 1266 </radialGradient> 1267 1268 <linearGradient 1269 id="rrB_arc" 1270 x1="90" 1271 y1="250" 1272 x2="430" 1273 y2="250" 1274 gradientUnits="userSpaceOnUse" 1275 > 1276 <stop stop-color="rgba(90,69,255,0.00)" /> 1277 <stop 1278 offset="0.45" 1279 stop-color="rgba(90,69,255,0.65)" 1280 /> 1281 <stop 1282 offset="1" 1283 stop-color="rgba(90,69,255,0.00)" 1284 /> 1285 </linearGradient> 1286 1287 <filter 1288 id="rrB_soft" 1289 x="-20%" 1290 y="-20%" 1291 width="140%" 1292 height="140%" 1293 > 1294 <feGaussianBlur stdDeviation="0.35" /> 1295 </filter> 1296 </defs> 1297 1298 <path 1299 d="M0 0H520V360H0Z" 1300 fill="url(#rrB_glow)" 1301 opacity="0.8" 1302 /> 1303 1304 <!-- faint guide arc --> 1305 <path 1306 d="M92 252C142 124 378 124 428 252" 1307 stroke="rgba(255,255,255,0.06)" 1308 stroke-width="2" 1309 stroke-linecap="round" 1310 opacity="0.7" 1311 /> 1312 1313 <!-- main dashed arc (animate dashoffset for subtle motion) --> 1314 <path 1315 class="rr-dash" 1316 d="M92 252C142 124 378 124 428 252" 1317 stroke="url(#rrB_arc)" 1318 stroke-width="3" 1319 stroke-linecap="round" 1320 stroke-dasharray="7 10" 1321 opacity="0.95" 1322 filter="url(#rrB_soft)" 1323 /> 1324 1325 <!-- tick marks along arc --> 1326 <g opacity="0.35"> 1327 <!-- left ticks --> 1328 <path 1329 d="M136 222l-22 10" 1330 stroke="rgba(255,255,255,0.12)" 1331 stroke-width="2" 1332 stroke-linecap="round" 1333 /> 1334 <path 1335 d="M170 196l-20 12" 1336 stroke="rgba(255,255,255,0.12)" 1337 stroke-width="2" 1338 stroke-linecap="round" 1339 /> 1340 <path 1341 d="M208 172l-18 14" 1342 stroke="rgba(255,255,255,0.12)" 1343 stroke-width="2" 1344 stroke-linecap="round" 1345 /> 1346 <!-- right ticks --> 1347 <path 1348 d="M384 222l22 10" 1349 stroke="rgba(255,255,255,0.12)" 1350 stroke-width="2" 1351 stroke-linecap="round" 1352 /> 1353 <path 1354 d="M350 196l20 12" 1355 stroke="rgba(255,255,255,0.12)" 1356 stroke-width="2" 1357 stroke-linecap="round" 1358 /> 1359 <path 1360 d="M312 172l18 14" 1361 stroke="rgba(255,255,255,0.12)" 1362 stroke-width="2" 1363 stroke-linecap="round" 1364 /> 1365 </g> 1366 1367 <!-- latency âchipâ (no text; keep it abstract) --> 1368 <g opacity="0.95"> 1369 <rect 1370 x="232" 1371 y="138" 1372 width="56" 1373 height="40" 1374 rx="14" 1375 fill="rgba(255,255,255,0.04)" 1376 stroke="rgba(255,255,255,0.10)" 1377 /> 1378 <path 1379 d="M246 158h28" 1380 stroke="rgba(255,255,255,0.22)" 1381 stroke-width="2" 1382 stroke-linecap="round" 1383 /> 1384 <path 1385 d="M246 166h18" 1386 stroke="rgba(255,255,255,0.16)" 1387 stroke-width="2" 1388 stroke-linecap="round" 1389 /> 1390 </g> 1391 </svg>`,"landing-4":`<svg
1392 viewBox="0 0 520 360" 1393 fill="none" 1394 xmlns="http://www.w3.org/2000/svg" 1395 aria-hidden="true" 1396 class="absolute -right-12 -bottom-10 w-[420px] opacity-60" 1397 > 1398 <defs> 1399 <radialGradient 1400 id="rrC_glow" 1401 cx="0" 1402 cy="0" 1403 r="1" 1404 gradientUnits="userSpaceOnUse" 1405 gradientTransform="translate(300 170) rotate(120) scale(260 200)" 1406 > 1407 <stop stop-color="rgba(90,69,255,0.18)" /> 1408 <stop 1409 offset="1" 1410 stop-color="rgba(90,69,255,0)" 1411 /> 1412 </radialGradient> 1413 1414 <linearGradient 1415 id="rrC_line" 1416 x1="140" 1417 y1="180" 1418 x2="390" 1419 y2="180" 1420 gradientUnits="userSpaceOnUse" 1421 > 1422 <stop stop-color="rgba(90,69,255,0.12)" /> 1423 <stop 1424 offset="0.5" 1425 stop-color="rgba(90,69,255,0.55)" 1426 /> 1427 <stop 1428 offset="1" 1429 stop-color="rgba(90,69,255,0.12)" 1430 /> 1431 </linearGradient> 1432 1433 <filter 1434 id="rrC_soft" 1435 x="-20%" 1436 y="-20%" 1437 width="140%" 1438 height="140%" 1439 > 1440 <feGaussianBlur stdDeviation="0.35" /> 1441 </filter> 1442 </defs> 1443 1444 <path 1445 d="M0 0H520V360H0Z" 1446 fill="url(#rrC_glow)" 1447 opacity="0.85" 1448 /> 1449 1450 <!-- connective diamond (soft) --> 1451 <g filter="url(#rrC_soft)" opacity="0.8"> 1452 <path 1453 d="M260 110L360 180L260 250L160 180L260 110Z" 1454 stroke="rgba(255,255,255,0.07)" 1455 stroke-width="2" 1456 fill="rgba(255,255,255,0.01)" 1457 /> 1458 </g> 1459 1460 <!-- connection lines --> 1461 <path 1462 d="M180 180H220" 1463 stroke="url(#rrC_line)" 1464 stroke-width="3" 1465 stroke-linecap="round" 1466 /> 1467 <path 1468 d="M300 180H340" 1469 stroke="url(#rrC_line)" 1470 stroke-width="3" 1471 stroke-linecap="round" 1472 /> 1473 <path 1474 d="M260 128V150" 1475 stroke="url(#rrC_line)" 1476 stroke-width="3" 1477 stroke-linecap="round" 1478 /> 1479 <path 1480 d="M260 210V232"
1481 stroke="url(#rrC_line)" 1482 stroke-width="3" 1483 stroke-linecap="round" 1484 /> 1485 1486 <!-- nodes (no labels) --> 1487 <g opacity="0.98"> 1488 <rect 1489 x="120" 1490 y="156" 1491 width="86" 1492 height="48" 1493 rx="16" 1494 fill="rgba(255,255,255,0.04)" 1495 stroke="rgba(255,255,255,0.10)" 1496 /> 1497 <rect 1498 x="206" 1499 y="86" 1500 width="108" 1501 height="52" 1502 rx="18" 1503 fill="rgba(255,255,255,0.04)" 1504 stroke="rgba(255,255,255,0.10)" 1505 /> 1506 <rect 1507 x="206" 1508 y="222" 1509 width="108" 1510 height="52" 1511 rx="18" 1512 fill="rgba(255,255,255,0.04)" 1513 stroke="rgba(255,255,255,0.10)" 1514 /> 1515 <rect 1516 x="334" 1517 y="156" 1518 width="86" 1519 height="48" 1520 rx="16" 1521 fill="rgba(255,255,255,0.04)" 1522 stroke="rgba(255,255,255,0.10)" 1523 /> 1524 </g> 1525 1526 <!-- inner âglyphâ lines to hint meaning without text --> 1527 <g opacity="0.25"> 1528 <path 1529 d="M140 178h46" 1530 stroke="rgba(255,255,255,0.35)" 1531 stroke-width="2" 1532 stroke-linecap="round" 1533 /> 1534 <path 1535 d="M232 112h56" 1536 stroke="rgba(255,255,255,0.35)" 1537 stroke-width="2" 1538 stroke-linecap="round" 1539 /> 1540 <path 1541 d="M232 246h56" 1542 stroke="rgba(255,255,255,0.35)" 1543 stroke-width="2" 1544 stroke-linecap="round" 1545 /> 1546 <path 1547 d="M354 178h46" 1548 stroke="rgba(255,255,255,0.35)" 1549 stroke-width="2" 1550 stroke-linecap="round" 1551 /> 1552 </g> 1553 1554 <!-- pulse dot (animate along path via CSS if desired) --> 1555 <circle 1556 class="rr-pulse" 1557 cx="220" 1558 cy="180" 1559 r="4.5" 1560 fill="rgba(90,69,255,0.9)" 1561 opacity="0.9" 1562 /> 1563 </svg>`,"landing-5":`<svg 1564 class="rr-tagline-underline absolute left-1/2 -translate-x-1/2 bottom-2" 1565 width="420" 1566 height="24"
1567 viewBox="0 0 420 24" 1568 fill="none" 1569 aria-hidden="true" 1570 > 1571 <defs> 1572 <linearGradient 1573 id="rrHttpGlow" 1574 x1="0" 1575 y1="0" 1576 x2="420" 1577 y2="0" 1578 > 1579 <stop offset="0%" stop-color="rgba(90,69,255,0)" /> 1580 <stop 1581 offset="50%" 1582 stop-color="rgba(90,69,255,0.75)" 1583 /> 1584 <stop 1585 offset="100%" 1586 stop-color="rgba(90,69,255,0)" 1587 /> 1588 </linearGradient> 1589 </defs> 1590 <path 1591 class="rr-http-dash" 1592 d="M10 12 H410" 1593 stroke="url(#rrHttpGlow)" 1594 stroke-width="2" 1595 stroke-linecap="round" 1596 stroke-dasharray="40 380" 1597 /> 1598 </svg>`,"landing-6":`<svg 1599 class="absolute -right-16 -bottom-14 w-[480px] opacity-55"
1600 viewBox="0 0 520 360" 1601 fill="none" 1602 xmlns="http://www.w3.org/2000/svg" 1603 aria-hidden="true" 1604 > 1605 <defs> 1606 <radialGradient 1607 id="rrPGlow" 1608 cx="0" 1609 cy="0" 1610 r="1" 1611 gradientUnits="userSpaceOnUse" 1612 gradientTransform="translate(330 120) rotate(120) scale(260 220)" 1613 > 1614 <stop stop-color="rgba(90,69,255,0.18)" /> 1615 <stop 1616 offset="1" 1617 stop-color="rgba(90,69,255,0)" 1618 /> 1619 </radialGradient> 1620 <linearGradient 1621 id="rrPFrame" 1622 x1="140" 1623 y1="80" 1624 x2="440" 1625 y2="280" 1626 gradientUnits="userSpaceOnUse" 1627 > 1628 <stop stop-color="rgba(255,255,255,0.06)" /> 1629 <stop 1630 offset="1" 1631 stop-color="rgba(255,255,255,0.015)" 1632 /> 1633 </linearGradient> 1634 </defs> 1635 1636 <rect 1637 width="520" 1638 height="360" 1639 fill="url(#rrPGlow)" 1640 opacity="0.9" 1641 /> 1642 1643 <!-- layered âenvironmentsâ --> 1644 <g opacity="0.95"> 1645 <rect 1646 x="190" 1647 y="80" 1648 width="250" 1649 height="160" 1650 rx="22" 1651 fill="url(#rrPFrame)" 1652 stroke="rgba(255,255,255,0.10)" 1653 /> 1654 <rect 1655 x="160" 1656 y="110" 1657 width="250" 1658 height="160" 1659 rx="22" 1660 fill="rgba(255,255,255,0.03)" 1661 stroke="rgba(255,255,255,0.09)" 1662 /> 1663 <rect 1664 x="130" 1665 y="140" 1666 width="250" 1667 height="160" 1668 rx="22" 1669 fill="rgba(255,255,255,0.02)" 1670 stroke="rgba(255,255,255,0.08)" 1671 /> 1672 </g> 1673 1674 <!-- âkey ringâ motif --> 1675 <g opacity="0.7"> 1676 <circle 1677 cx="175" 1678 cy="115" 1679 r="28" 1680 fill="rgba(255,255,255,0.02)" 1681 stroke="rgba(255,255,255,0.10)" 1682 stroke-width="2" 1683 /> 1684 <circle 1685 class="rr-shimmer" 1686 cx="175" 1687 cy="115" 1688 r="16" 1689 fill="none" 1690 stroke="rgba(90,69,255,0.55)" 1691 stroke-width="3" 1692 opacity="0.55" 1693 /> 1694 <path 1695 d="M195 130 L220 155" 1696 stroke="rgba(255,255,255,0.10)" 1697 stroke-width="3" 1698 stroke-linecap="round" 1699 /> 1700 <path 1701 d="M220 155 l18 0" 1702 stroke="rgba(255,255,255,0.08)" 1703 stroke-width="3" 1704 stroke-linecap="round" 1705 /> 1706 </g> 1707 </svg>`,"landing-7":`<svg 1708 class="absolute -right-16 -bottom-16 w-[480px] opacity-55"
1709 viewBox="0 0 520 360" 1710 fill="none" 1711 xmlns="http://www.w3.org/2000/svg" 1712 aria-hidden="true" 1713 > 1714 <defs> 1715 <radialGradient 1716 id="rrCGlow" 1717 cx="0" 1718 cy="0" 1719 r="1" 1720 gradientUnits="userSpaceOnUse" 1721 gradientTransform="translate(340 160) rotate(120) scale(260 240)" 1722 > 1723 <stop stop-color="rgba(90,69,255,0.16)" /> 1724 <stop 1725 offset="1" 1726 stop-color="rgba(90,69,255,0)" 1727 /> 1728 </radialGradient> 1729 <linearGradient 1730 id="rrCStroke" 1731 x1="150" 1732 y1="120" 1733 x2="410" 1734 y2="260" 1735 gradientUnits="userSpaceOnUse" 1736 > 1737 <stop stop-color="rgba(255,255,255,0.10)" /> 1738 <stop 1739 offset="1" 1740 stop-color="rgba(255,255,255,0.05)" 1741 /> 1742 </linearGradient> 1743 <linearGradient 1744 id="rrCRoute" 1745 x1="70" 1746 y1="255" 1747 x2="480" 1748 y2="255" 1749 gradientUnits="userSpaceOnUse" 1750 > 1751 <stop stop-color="rgba(90,69,255,0)" /> 1752 <stop 1753 offset="0.55" 1754 stop-color="rgba(90,69,255,0.65)" 1755 /> 1756 <stop 1757 offset="1" 1758 stop-color="rgba(90,69,255,0)" 1759 /> 1760 </linearGradient> 1761 </defs> 1762 1763 <rect 1764 width="520" 1765 height="360" 1766 fill="url(#rrCGlow)" 1767 opacity="0.9" 1768 /> 1769 1770 <!-- database cylinder --> 1771 <g opacity="0.88"> 1772 <ellipse 1773 cx="310" 1774 cy="132" 1775 rx="120" 1776 ry="28" 1777 fill="rgba(255,255,255,0.02)" 1778 stroke="rgba(255,255,255,0.10)" 1779 stroke-width="2" 1780 /> 1781 <path 1782 d="M190 132V220c0 18 54 32 120 32s120-14 120-32v-88" 1783 stroke="url(#rrCStroke)" 1784 stroke-width="2" 1785 fill="rgba(255,255,255,0.01)" 1786 /> 1787 <ellipse 1788 cx="310" 1789 cy="220" 1790 rx="120" 1791 ry="28" 1792 fill="rgba(255,255,255,0.015)" 1793 stroke="rgba(255,255,255,0.08)" 1794 stroke-width="2" 1795 /> 1796 <ellipse 1797 cx="310" 1798 cy="170" 1799 rx="104" 1800 ry="24" 1801 fill="none" 1802 stroke="rgba(255,255,255,0.07)" 1803 stroke-width="2" 1804 opacity="0.7" 1805 /> 1806 </g> 1807 1808 <!-- endpoint ârailâ --> 1809 <g opacity="0.8"> 1810 <path 1811 d="M80 270H470" 1812 stroke="rgba(255,255,255,0.06)" 1813 stroke-width="2" 1814 stroke-linecap="round" 1815 /> 1816 <path
1817 class="rr-dash" 1818 d="M80 270H470" 1819 stroke="url(#rrCRoute)" 1820 stroke-width="3" 1821 stroke-linecap="round" 1822 stroke-dasharray="7 14" 1823 opacity="0.75" 1824 /> 1825 <circle 1826 cx="120" 1827 cy="270" 1828 r="5" 1829 fill="rgba(255,255,255,0.18)" 1830 /> 1831 <circle 1832 cx="430" 1833 cy="270" 1834 r="5" 1835 fill="rgba(255,255,255,0.18)" 1836 /> 1837 </g> 1838 1839 <circle 1840 class="rr-pulse" 1841 cx="430" 1842 cy="270" 1843 r="5" 1844 fill="rgba(90,69,255,0.95)" 1845 opacity="0.18" 1846 /> 1847 </svg>`,"landing-8":`<svg 1848 class="absolute -right-14 -bottom-14 w-[460px] opacity-55"
1849 viewBox="0 0 520 360" 1850 fill="none" 1851 xmlns="http://www.w3.org/2000/svg" 1852 aria-hidden="true" 1853 > 1854 <defs> 1855 <radialGradient 1856 id="rrUGlow" 1857 cx="0" 1858 cy="0" 1859 r="1" 1860 gradientUnits="userSpaceOnUse" 1861 gradientTransform="translate(320 150) rotate(120) scale(250 220)" 1862 > 1863 <stop stop-color="rgba(90,69,255,0.18)" /> 1864 <stop 1865 offset="1" 1866 stop-color="rgba(90,69,255,0)" 1867 /> 1868 </radialGradient> 1869 <linearGradient 1870 id="rrULine" 1871 x1="140" 1872 y1="180" 1873 x2="420" 1874 y2="180" 1875 gradientUnits="userSpaceOnUse" 1876 > 1877 <stop stop-color="rgba(90,69,255,0.10)" /> 1878 <stop 1879 offset="0.5" 1880 stop-color="rgba(90,69,255,0.55)" 1881 /> 1882 <stop 1883 offset="1" 1884 stop-color="rgba(90,69,255,0.10)" 1885 /> 1886 </linearGradient> 1887 </defs> 1888 1889 <rect 1890 width="520" 1891 height="360" 1892 fill="url(#rrUGlow)" 1893 opacity="0.9" 1894 /> 1895 1896 <!-- token diamond --> 1897 <path 1898 d="M260 110L360 180L260 250L160 180L260 110Z" 1899 fill="rgba(255,255,255,0.01)" 1900 stroke="rgba(255,255,255,0.08)" 1901 stroke-width="2" 1902 opacity="0.85" 1903 /> 1904 1905 <!-- connections --> 1906 <g opacity="0.85"> 1907 <path 1908 d="M180 180H225" 1909 stroke="url(#rrULine)" 1910 stroke-width="3" 1911 stroke-linecap="round" 1912 /> 1913 <path 1914 d="M295 180H340" 1915 stroke="url(#rrULine)" 1916 stroke-width="3" 1917 stroke-linecap="round" 1918 /> 1919 <path 1920 d="M260 130V150" 1921 stroke="url(#rrULine)" 1922 stroke-width="3" 1923 stroke-linecap="round" 1924 /> 1925 <path 1926 d="M260 210V230" 1927 stroke="url(#rrULine)" 1928 stroke-width="3" 1929 stroke-linecap="round" 1930 /> 1931 </g> 1932 1933 <!-- nodes --> 1934 <g opacity="0.98"> 1935 <rect 1936 x="120" 1937 y="156" 1938 width="86" 1939 height="48" 1940 rx="16" 1941 fill="rgba(255,255,255,0.04)" 1942 stroke="rgba(255,255,255,0.10)" 1943 /> 1944 <rect 1945 x="216" 1946 y="86" 1947 width="88" 1948 height="52" 1949 rx="18" 1950 fill="rgba(255,255,255,0.04)" 1951 stroke="rgba(255,255,255,0.10)" 1952 /> 1953 <rect 1954 x="216" 1955 y="222" 1956 width="88" 1957 height="52" 1958 rx="18" 1959 fill="rgba(255,255,255,0.04)" 1960 stroke="rgba(255,255,255,0.10)" 1961 /> 1962 <rect 1963 x="334" 1964 y="156" 1965 width="86" 1966 height="48" 1967 rx="16" 1968 fill="rgba(255,255,255,0.04)" 1969 stroke="rgba(255,255,255,0.10)" 1970 /> 1971 </g> 1972 1973 <!-- subtle moving pulse dot --> 1974 <circle
1975 class="rr-pulse" 1976 cx="260" 1977 cy="130" 1978 r="5" 1979 fill="rgba(90,69,255,0.95)" 1980 opacity="0.18" 1981 /> 1982 </svg>`,"landing-9":`<svg 1983 class="absolute -right-14 -bottom-14 w-[460px] opacity-55" 1984 viewBox="0 0 520 360" 1985 fill="none" 1986 xmlns="http://www.w3.org/2000/svg" 1987 aria-hidden="true" 1988 > 1989 <defs> 1990 <radialGradient 1991 id="rrLGlow" 1992 cx="0" 1993 cy="0" 1994 r="1" 1995 gradientUnits="userSpaceOnUse" 1996 gradientTransform="translate(320 150) rotate(120) scale(250 220)" 1997 > 1998 <stop stop-color="rgba(90,69,255,0.16)" /> 1999 <stop 2000 offset="1" 2001 stop-color="rgba(90,69,255,0)" 2002 /> 2003 </radialGradient> 2004 <linearGradient 2005 id="rrLAccent" 2006 x1="150" 2007 y1="120" 2008 x2="440" 2009 y2="250" 2010 gradientUnits="userSpaceOnUse" 2011 > 2012 <stop stop-color="rgba(90,69,255,0)" /> 2013 <stop 2014 offset="0.5" 2015 stop-color="rgba(90,69,255,0.65)" 2016 /> 2017 <stop 2018 offset="1" 2019 stop-color="rgba(90,69,255,0)" 2020 /> 2021 </linearGradient> 2022 </defs> 2023 2024 <rect 2025 width="520" 2026 height="360" 2027 fill="url(#rrLGlow)" 2028 opacity="0.9" 2029 /> 2030 2031 <!-- log rows --> 2032 <g opacity="0.95"> 2033 <rect 2034 x="140" 2035 y="120" 2036 width="300" 2037 height="40" 2038 rx="16" 2039 fill="rgba(255,255,255,0.03)" 2040 stroke="rgba(255,255,255,0.10)" 2041 /> 2042 <rect 2043 x="140" 2044 y="172" 2045 width="300" 2046 height="40" 2047 rx="16" 2048 fill="rgba(255,255,255,0.02)" 2049 stroke="rgba(255,255,255,0.09)" 2050 /> 2051 <rect 2052 x="140" 2053 y="224" 2054 width="300" 2055 height="40" 2056 rx="16" 2057 fill="rgba(255,255,255,0.02)" 2058 stroke="rgba(255,255,255,0.08)" 2059 /> 2060 </g> 2061 2062 <!-- left âevent ticksâ --> 2063 <g opacity="0.25"> 2064 <rect 2065 x="158" 2066 y="136" 2067 width="120" 2068 height="6" 2069 rx="3" 2070 fill="rgba(255,255,255,0.35)" 2071 /> 2072 <rect 2073 x="158" 2074 y="188" 2075 width="160" 2076 height="6" 2077 rx="3" 2078 fill="rgba(255,255,255,0.25)" 2079 /> 2080 <rect 2081 x="158" 2082 y="240" 2083 width="140" 2084 height="6" 2085 rx="3" 2086 fill="rgba(255,255,255,0.22)" 2087 /> 2088 </g> 2089 2090 <!-- status pills --> 2091 <g opacity="0.9"> 2092 <rect 2093 x="388" 2094 y="132" 2095 width="42" 2096 height="16" 2097 rx="8" 2098 fill="rgba(34,197,94,0.14)" 2099 stroke="rgba(34,197,94,0.25)" 2100 /> 2101 <rect 2102 x="388" 2103 y="184" 2104 width="42" 2105 height="16" 2106 rx="8" 2107 fill="rgba(34,197,94,0.10)" 2108 stroke="rgba(34,197,94,0.20)" 2109 /> 2110 <rect 2111 x="388" 2112 y="236" 2113 width="42" 2114 height="16" 2115 rx="8" 2116 fill="rgba(234,179,8,0.10)" 2117 stroke="rgba(234,179,8,0.22)" 2118 /> 2119 </g> 2120 2121 <!-- animated accent stroke --> 2122 <path
2123 class="rr-dash" 2124 d="M150 276H440" 2125 stroke="url(#rrLAccent)" 2126 stroke-width="3" 2127 stroke-linecap="round" 2128 stroke-dasharray="7 14" 2129 opacity="0.55" 2130 /> 2131 </svg>`,"landing-10":`<svg 2132 class="absolute inset-0 h-full w-full" 2133 viewBox="0 0 1400 260" 2134 fill="none" 2135 xmlns="http://www.w3.org/2000/svg" 2136 aria-hidden="true" 2137 > 2138 <defs> 2139 <linearGradient 2140 id="rrLifeStroke" 2141 x1="0" 2142 y1="0" 2143 x2="1400" 2144 y2="0" 2145 gradientUnits="userSpaceOnUse" 2146 > 2147 <stop stop-color="rgba(255,255,255,0)" /> 2148 <stop 2149 offset="0.2" 2150 stop-color="rgba(255,255,255,0.10)" 2151 /> 2152 <stop 2153 offset="0.8" 2154 stop-color="rgba(255,255,255,0.10)" 2155 /> 2156 <stop 2157 offset="1" 2158 stop-color="rgba(255,255,255,0)" 2159 /> 2160 </linearGradient> 2161 2162 <linearGradient 2163 id="rrLifeAccent" 2164 x1="0" 2165 y1="0" 2166 x2="1400" 2167 y2="0" 2168 gradientUnits="userSpaceOnUse" 2169 > 2170 <stop stop-color="rgba(90,69,255,0)" /> 2171 <stop 2172 offset="0.5" 2173 stop-color="rgba(90,69,255,0.55)" 2174 /> 2175 <stop 2176 offset="1" 2177 stop-color="rgba(90,69,255,0)" 2178 /> 2179 </linearGradient> 2180 2181 <radialGradient 2182 id="rrLifeGlow" 2183 cx="0" 2184 cy="0" 2185 r="1" 2186 gradientUnits="userSpaceOnUse" 2187 gradientTransform="translate(700 120) rotate(90) scale(120 680)" 2188 > 2189 <stop stop-color="rgba(90,69,255,0.18)" /> 2190 <stop 2191 offset="1" 2192 stop-color="rgba(90,69,255,0)" 2193 /> 2194 </radialGradient> 2195 </defs> 2196 2197 <rect 2198 width="1400" 2199 height="260" 2200 fill="url(#rrLifeGlow)" 2201 opacity="0.85" 2202 /> 2203 2204 <!-- base line --> 2205 <path 2206 d="M80 130 C 260 60, 440 60, 620 130 S 980 200, 1320 130" 2207 stroke="url(#rrLifeStroke)" 2208 stroke-width="2" 2209 stroke-linecap="round" 2210 opacity="0.55" 2211 /> 2212 2213 <!-- animated dashed accent --> 2214 <path
2215 class="rr-life-dash" 2216 d="M80 130 C 260 60, 440 60, 620 130 S 980 200, 1320 130" 2217 stroke="url(#rrLifeAccent)" 2218 stroke-width="3" 2219 stroke-linecap="round" 2220 stroke-dasharray="7 12" 2221 opacity="0.7" 2222 /> 2223 2224 <!-- node dots (roughly aligned behind the 6 cards) --> 2225 <g opacity="0.6"> 2226 <circle 2227 class="rr-life-node" 2228 cx="160" 2229 cy="118" 2230 r="5" 2231 fill="rgba(90,69,255,0.55)" 2232 /> 2233 <circle 2234 class="rr-life-node" 2235 cx="360" 2236 cy="84" 2237 r="5" 2238 fill="rgba(90,69,255,0.55)" 2239 /> 2240 <circle 2241 class="rr-life-node" 2242 cx="560" 2243 cy="108" 2244 r="5" 2245 fill="rgba(90,69,255,0.55)" 2246 /> 2247 <circle 2248 class="rr-life-node" 2249 cx="760" 2250 cy="152" 2251 r="5" 2252 fill="rgba(90,69,255,0.55)" 2253 /> 2254 <circle 2255 class="rr-life-node" 2256 cx="980" 2257 cy="178" 2258 r="5" 2259 fill="rgba(90,69,255,0.55)" 2260 /> 2261 <circle 2262 class="rr-life-node" 2263 cx="1200" 2264 cy="146" 2265 r="5" 2266 fill="rgba(90,69,255,0.55)" 2267 /> 2268 </g> 2269 </svg>`,"landing-11":`<svg 2270 class="absolute -right-12 -bottom-10 w-[440px] opacity-60"
2271 viewBox="0 0 520 360" 2272 fill="none" 2273 xmlns="http://www.w3.org/2000/svg" 2274 aria-hidden="true" 2275 > 2276 <defs> 2277 <radialGradient 2278 id="ucFlowGlow" 2279 cx="0" 2280 cy="0" 2281 r="1" 2282 gradientUnits="userSpaceOnUse" 2283 gradientTransform="translate(340 140) rotate(120) scale(260 220)" 2284 > 2285 <stop 2286 stop-color="rgba(90,69,255,0.18)" 2287 /> 2288 <stop 2289 offset="1" 2290 stop-color="rgba(90,69,255,0)" 2291 /> 2292 </radialGradient> 2293 <linearGradient 2294 id="ucFlowLine" 2295 x1="120" 2296 y1="110" 2297 x2="420" 2298 y2="250" 2299 gradientUnits="userSpaceOnUse" 2300 > 2301 <stop 2302 stop-color="rgba(90,69,255,0.10)" 2303 /> 2304 <stop 2305 offset="0.5" 2306 stop-color="rgba(90,69,255,0.55)" 2307 /> 2308 <stop 2309 offset="1" 2310 stop-color="rgba(90,69,255,0.10)" 2311 /> 2312 </linearGradient> 2313 </defs> 2314 2315 <rect 2316 width="520" 2317 height="360" 2318 fill="url(#ucFlowGlow)" 2319 opacity="0.9" 2320 /> 2321 2322 <g opacity="0.75"> 2323 <path 2324 d="M140 190 C 210 120, 250 120, 300 170" 2325 stroke="url(#ucFlowLine)" 2326 stroke-width="3" 2327 stroke-linecap="round" 2328 /> 2329 <path 2330 d="M140 190 C 210 260, 250 260, 300 210" 2331 stroke="url(#ucFlowLine)" 2332 stroke-width="3" 2333 stroke-linecap="round" 2334 /> 2335 <path 2336 d="M300 170 C 350 140, 380 140, 420 170" 2337 stroke="url(#ucFlowLine)" 2338 stroke-width="3" 2339 stroke-linecap="round" 2340 /> 2341 <path 2342 d="M300 210 C 350 240, 380 240, 420 210" 2343 stroke="url(#ucFlowLine)" 2344 stroke-width="3" 2345 stroke-linecap="round" 2346 /> 2347 <path 2348 d="M300 170 L300 210" 2349 stroke="rgba(255,255,255,0.10)" 2350 stroke-width="2" 2351 stroke-linecap="round" 2352 /> 2353 </g> 2354 2355 <g opacity="0.95"> 2356 <circle 2357 cx="140" 2358 cy="190" 2359 r="18" 2360 fill="rgba(255,255,255,0.04)" 2361 stroke="rgba(255,255,255,0.12)" 2362 stroke-width="2" 2363 /> 2364 <circle 2365 cx="300" 2366 cy="170" 2367 r="18" 2368 fill="rgba(255,255,255,0.04)" 2369 stroke="rgba(255,255,255,0.12)" 2370 stroke-width="2" 2371 /> 2372 <circle 2373 cx="300" 2374 cy="210" 2375 r="18" 2376 fill="rgba(255,255,255,0.04)" 2377 stroke="rgba(255,255,255,0.12)" 2378 stroke-width="2" 2379 /> 2380 <circle 2381 cx="420" 2382 cy="170" 2383 r="18" 2384 fill="rgba(255,255,255,0.04)" 2385 stroke="rgba(255,255,255,0.12)" 2386 stroke-width="2" 2387 /> 2388 <circle 2389 cx="420" 2390 cy="210" 2391 r="18" 2392 fill="rgba(255,255,255,0.04)" 2393 stroke="rgba(255,255,255,0.12)" 2394 stroke-width="2" 2395 /> 2396 </g> 2397 </svg>`,"landing-12":`<svg 2398 class="absolute -right-12 -bottom-12 w-[460px] opacity-60"
2399 viewBox="0 0 520 360" 2400 fill="none" 2401 xmlns="http://www.w3.org/2000/svg" 2402 aria-hidden="true" 2403 > 2404 <defs> 2405 <radialGradient 2406 id="ucQaGlow" 2407 cx="0" 2408 cy="0" 2409 r="1" 2410 gradientUnits="userSpaceOnUse" 2411 gradientTransform="translate(270 170) rotate(90) scale(260 300)" 2412 > 2413 <stop 2414 stop-color="rgba(90,69,255,0.16)" 2415 /> 2416 <stop 2417 offset="1" 2418 stop-color="rgba(90,69,255,0)" 2419 /> 2420 </radialGradient> 2421 <linearGradient 2422 id="ucQaArc" 2423 x1="80" 2424 y1="240" 2425 x2="440" 2426 y2="240" 2427 gradientUnits="userSpaceOnUse" 2428 > 2429 <stop stop-color="rgba(90,69,255,0)" /> 2430 <stop 2431 offset="0.5" 2432 stop-color="rgba(90,69,255,0.70)" 2433 /> 2434 <stop 2435 offset="1" 2436 stop-color="rgba(90,69,255,0)" 2437 /> 2438 </linearGradient> 2439 </defs> 2440 2441 <rect 2442 width="520" 2443 height="360" 2444 fill="url(#ucQaGlow)" 2445 opacity="0.9" 2446 /> 2447 2448 <path 2449 d="M90 260 C150 120, 370 120, 430 260" 2450 stroke="rgba(255,255,255,0.06)" 2451 stroke-width="2" 2452 stroke-linecap="round" 2453 opacity="0.7" 2454 /> 2455 <path 2456 class="rr-dash" 2457 d="M90 260 C150 120, 370 120, 430 260" 2458 stroke="url(#ucQaArc)" 2459 stroke-width="3" 2460 stroke-linecap="round" 2461 stroke-dasharray="7 12" 2462 opacity="0.85" 2463 /> 2464 <g opacity="0.18"> 2465 <path 2466 d="M140 230l-24 10" 2467 stroke="rgba(255,255,255,0.8)" 2468 stroke-width="2" 2469 stroke-linecap="round" 2470 /> 2471 <path 2472 d="M190 195l-22 12" 2473 stroke="rgba(255,255,255,0.8)" 2474 stroke-width="2" 2475 stroke-linecap="round" 2476 /> 2477 <path 2478 d="M240 170l-20 14" 2479 stroke="rgba(255,255,255,0.8)" 2480 stroke-width="2" 2481 stroke-linecap="round" 2482 /> 2483 <path 2484 d="M280 165l-18 15" 2485 stroke="rgba(255,255,255,0.8)" 2486 stroke-width="2" 2487 stroke-linecap="round" 2488 /> 2489 <path 2490 d="M330 185l-16 14" 2491 stroke="rgba(255,255,255,0.8)" 2492 stroke-width="2" 2493 stroke-linecap="round" 2494 /> 2495 <path 2496 d="M380 220l-14 12" 2497 stroke="rgba(255,255,255,0.8)" 2498 stroke-width="2" 2499 stroke-linecap="round" 2500 /> 2501 </g> 2502 2503 <g opacity="0.22"> 2504 <circle 2505 cx="90" 2506 cy="260" 2507 r="6" 2508 fill="rgba(255,255,255,0.35)" 2509 /> 2510 <circle 2511 cx="430" 2512 cy="260" 2513 r="6" 2514 fill="rgba(255,255,255,0.35)" 2515 /> 2516 <circle 2517 cx="260" 2518 cy="145" 2519 r="6" 2520 fill="rgba(255,255,255,0.28)" 2521 /> 2522 </g> 2523 </svg>`,"landing-13":`<svg 2524 class="absolute -right-16 -bottom-14 w-[460px] opacity-60"
2525 viewBox="0 0 520 360" 2526 fill="none" 2527 xmlns="http://www.w3.org/2000/svg" 2528 aria-hidden="true" 2529 > 2530 <defs> 2531 <linearGradient 2532 id="ucDemoPanel" 2533 x1="80" 2534 y1="70" 2535 x2="420" 2536 y2="300" 2537 gradientUnits="userSpaceOnUse" 2538 > 2539 <stop 2540 stop-color="rgba(255,255,255,0.06)" 2541 /> 2542 <stop 2543 offset="1" 2544 stop-color="rgba(255,255,255,0.015)" 2545 /> 2546 </linearGradient> 2547 <radialGradient 2548 id="ucDemoGlow" 2549 cx="0" 2550 cy="0" 2551 r="1" 2552 gradientUnits="userSpaceOnUse" 2553 gradientTransform="translate(320 130) rotate(120) scale(240 220)" 2554 > 2555 <stop 2556 stop-color="rgba(90,69,255,0.16)" 2557 /> 2558 <stop 2559 offset="1" 2560 stop-color="rgba(90,69,255,0)" 2561 /> 2562 </radialGradient> 2563 </defs> 2564 2565 <rect 2566 width="520" 2567 height="360" 2568 fill="url(#ucDemoGlow)" 2569 opacity="0.9" 2570 /> 2571 2572 <g opacity="0.95"> 2573 <path 2574 d="M156 88c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H182c-15 0-26-12-26-26V88Z" 2575 fill="url(#ucDemoPanel)" 2576 stroke="rgba(255,255,255,0.10)" 2577 /> 2578 <path 2579 d="M132 128c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H158c-15 0-26-12-26-26v-58Z" 2580 fill="rgba(255,255,255,0.03)" 2581 stroke="rgba(255,255,255,0.09)" 2582 /> 2583 <path 2584 d="M108 168c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H134c-15 0-26-12-26-26v-58Z" 2585 fill="rgba(255,255,255,0.02)" 2586 stroke="rgba(255,255,255,0.08)" 2587 /> 2588 </g> 2589 2590 <path 2591 d="M150 72h212c22 0 40 18 40 40v10" 2592 stroke="rgba(90,69,255,0.55)" 2593 stroke-width="2" 2594 stroke-linecap="round" 2595 opacity="0.75" 2596 /> 2597 </svg>`,"landing-14":`<svg 2598 class="absolute -right-14 -bottom-14 w-[460px] opacity-55"
2599 viewBox="0 0 520 360" 2600 fill="none" 2601 xmlns="http://www.w3.org/2000/svg" 2602 aria-hidden="true" 2603 > 2604 <defs> 2605 <radialGradient 2606 id="ucEduGlow" 2607 cx="0" 2608 cy="0" 2609 r="1" 2610 gradientUnits="userSpaceOnUse" 2611 gradientTransform="translate(300 170) rotate(120) scale(250 240)" 2612 > 2613 <stop 2614 stop-color="rgba(90,69,255,0.14)" 2615 /> 2616 <stop 2617 offset="1" 2618 stop-color="rgba(90,69,255,0)" 2619 /> 2620 </radialGradient> 2621 </defs> 2622 2623 <rect 2624 width="520" 2625 height="360" 2626 fill="url(#ucEduGlow)" 2627 opacity="0.95" 2628 /> 2629 2630 <g opacity="0.12"> 2631 <path 2632 d="M90 90H430" 2633 stroke="rgba(255,255,255,0.8)" 2634 /> 2635 <path 2636 d="M90 130H430" 2637 stroke="rgba(255,255,255,0.8)" 2638 /> 2639 <path 2640 d="M90 170H430" 2641 stroke="rgba(255,255,255,0.8)" 2642 /> 2643 <path 2644 d="M90 210H430" 2645 stroke="rgba(255,255,255,0.8)" 2646 /> 2647 <path 2648 d="M90 250H430" 2649 stroke="rgba(255,255,255,0.8)" 2650 /> 2651 2652 <path 2653 d="M120 70V290" 2654 stroke="rgba(255,255,255,0.8)" 2655 /> 2656 <path 2657 d="M200 70V290" 2658 stroke="rgba(255,255,255,0.8)" 2659 /> 2660 <path 2661 d="M280 70V290" 2662 stroke="rgba(255,255,255,0.8)" 2663 /> 2664 <path 2665 d="M360 70V290" 2666 stroke="rgba(255,255,255,0.8)" 2667 /> 2668 </g> 2669 2670 <g opacity="0.6"> 2671 <path 2672 d="M170 115c-18 0-26 8-26 22v6c0 14-8 22-26 22" 2673 stroke="rgba(90,69,255,0.55)" 2674 stroke-width="3" 2675 stroke-linecap="round" 2676 stroke-linejoin="round" 2677 /> 2678 <path 2679 d="M170 245c-18 0-26-8-26-22v-6c0-14-8-22-26-22" 2680 stroke="rgba(90,69,255,0.55)" 2681 stroke-width="3" 2682 stroke-linecap="round" 2683 stroke-linejoin="round" 2684 /> 2685 2686 <path 2687 d="M350 115c18 0 26 8 26 22v6c0 14 8 22 26 22" 2688 stroke="rgba(90,69,255,0.40)" 2689 stroke-width="3" 2690 stroke-linecap="round" 2691 stroke-linejoin="round" 2692 /> 2693 <path 2694 d="M350 245c18 0 26-8 26-22v-6c0-14 8-22 26-22" 2695 stroke="rgba(90,69,255,0.40)" 2696 stroke-width="3" 2697 stroke-linecap="round" 2698 stroke-linejoin="round" 2699 /> 2700 </g> 2701 2702 <circle 2703 cx="260" 2704 cy="170" 2705 r="5" 2706 fill="rgba(90,69,255,0.9)" 2707 opacity="0.18" 2708 /> 2709 </svg>`,"landing-15":`<svg 2710 class="absolute -right-14 -bottom-12 w-[440px] opacity-55"
2711 viewBox="0 0 520 360" 2712 fill="none" 2713 xmlns="http://www.w3.org/2000/svg" 2714 aria-hidden="true" 2715 > 2716 <defs> 2717 <radialGradient 2718 id="fdEdgeGlow" 2719 cx="0" 2720 cy="0" 2721 r="1" 2722 gradientUnits="userSpaceOnUse" 2723 gradientTransform="translate(320 150) rotate(120) scale(260 230)" 2724 > 2725 <stop 2726 stop-color="rgba(90,69,255,0.16)" 2727 /> 2728 <stop 2729 offset="1" 2730 stop-color="rgba(90,69,255,0)" 2731 /> 2732 </radialGradient> 2733 <linearGradient 2734 id="fdEdgeArc" 2735 x1="90" 2736 y1="250" 2737 x2="430" 2738 y2="250" 2739 gradientUnits="userSpaceOnUse" 2740 > 2741 <stop stop-color="rgba(90,69,255,0)" /> 2742 <stop 2743 offset="0.5" 2744 stop-color="rgba(90,69,255,0.65)" 2745 /> 2746 <stop 2747 offset="1" 2748 stop-color="rgba(90,69,255,0)" 2749 /> 2750 </linearGradient> 2751 </defs> 2752 2753 <rect 2754 width="520" 2755 height="360" 2756 fill="url(#fdEdgeGlow)" 2757 opacity="0.9" 2758 /> 2759 2760 <path 2761 d="M90 250 C150 120, 370 120, 430 250" 2762 stroke="rgba(255,255,255,0.06)" 2763 stroke-width="2" 2764 stroke-linecap="round" 2765 opacity="0.7" 2766 /> 2767 2768 <path 2769 class="rr-dash" 2770 d="M90 250 C150 120, 370 120, 430 250" 2771 stroke="url(#fdEdgeArc)" 2772 stroke-width="3" 2773 stroke-linecap="round" 2774 stroke-dasharray="7 12" 2775 opacity="0.85" 2776 /> 2777 2778 <g opacity="0.16"> 2779 <path 2780 d="M190 210l-20 12" 2781 stroke="rgba(255,255,255,0.8)" 2782 stroke-width="2" 2783 stroke-linecap="round" 2784 /> 2785 <path 2786 d="M240 185l-18 14" 2787 stroke="rgba(255,255,255,0.8)" 2788 stroke-width="2" 2789 stroke-linecap="round" 2790 /> 2791 <path 2792 d="M280 178l-16 15" 2793 stroke="rgba(255,255,255,0.8)" 2794 stroke-width="2" 2795 stroke-linecap="round" 2796 /> 2797 <path 2798 d="M330 192l-14 14" 2799 stroke="rgba(255,255,255,0.8)" 2800 stroke-width="2" 2801 stroke-linecap="round" 2802 /> 2803 </g> 2804 </svg>`,"landing-16":`<svg 2805 class="absolute -right-16 -bottom-14 w-[460px] opacity-55"
2806 viewBox="0 0 520 360" 2807 fill="none" 2808 xmlns="http://www.w3.org/2000/svg" 2809 aria-hidden="true" 2810 > 2811 <defs> 2812 <radialGradient 2813 id="fdDbGlow" 2814 cx="0" 2815 cy="0" 2816 r="1" 2817 gradientUnits="userSpaceOnUse" 2818 gradientTransform="translate(320 160) rotate(120) scale(250 240)" 2819 > 2820 <stop 2821 stop-color="rgba(90,69,255,0.14)" 2822 /> 2823 <stop 2824 offset="1" 2825 stop-color="rgba(90,69,255,0)" 2826 /> 2827 </radialGradient> 2828 <linearGradient 2829 id="fdDbStroke" 2830 x1="170" 2831 y1="120" 2832 x2="390" 2833 y2="260" 2834 gradientUnits="userSpaceOnUse" 2835 > 2836 <stop 2837 stop-color="rgba(255,255,255,0.10)" 2838 /> 2839 <stop 2840 offset="1" 2841 stop-color="rgba(255,255,255,0.05)" 2842 /> 2843 </linearGradient> 2844 </defs> 2845 2846 <rect 2847 width="520" 2848 height="360" 2849 fill="url(#fdDbGlow)" 2850 opacity="0.9" 2851 /> 2852 2853 <g opacity="0.85"> 2854 <ellipse 2855 cx="260" 2856 cy="120" 2857 rx="140" 2858 ry="34" 2859 fill="rgba(255,255,255,0.02)" 2860 stroke="rgba(255,255,255,0.10)" 2861 stroke-width="2" 2862 /> 2863 <path 2864 d="M120 120V235c0 20 63 36 140 36s140-16 140-36V120" 2865 stroke="url(#fdDbStroke)" 2866 stroke-width="2" 2867 fill="rgba(255,255,255,0.01)" 2868 /> 2869 <ellipse 2870 cx="260" 2871 cy="235" 2872 rx="140" 2873 ry="34" 2874 fill="rgba(255,255,255,0.015)" 2875 stroke="rgba(255,255,255,0.08)" 2876 stroke-width="2" 2877 /> 2878 2879 <ellipse 2880 cx="260" 2881 cy="158" 2882 rx="120" 2883 ry="28" 2884 fill="none" 2885 stroke="rgba(255,255,255,0.07)" 2886 stroke-width="2" 2887 opacity="0.75" 2888 /> 2889 <ellipse 2890 cx="260" 2891 cy="196" 2892 rx="120" 2893 ry="28" 2894 fill="none" 2895 stroke="rgba(255,255,255,0.06)" 2896 stroke-width="2" 2897 opacity="0.65" 2898 /> 2899 </g> 2900 2901 <path 2902 d="M150 120c20 18 74 30 110 30" 2903 stroke="rgba(90,69,255,0.55)" 2904 stroke-width="3" 2905 stroke-linecap="round" 2906 opacity="0.6" 2907 /> 2908 </svg>`,"landing-17":`<svg 2909 class="absolute -right-14 -bottom-14 w-[440px] opacity-55"
2910 viewBox="0 0 520 360" 2911 fill="none" 2912 xmlns="http://www.w3.org/2000/svg" 2913 aria-hidden="true" 2914 > 2915 <defs> 2916 <radialGradient 2917 id="fdSecGlow" 2918 cx="0" 2919 cy="0" 2920 r="1" 2921 gradientUnits="userSpaceOnUse" 2922 gradientTransform="translate(320 150) rotate(120) scale(240 220)" 2923 > 2924 <stop 2925 stop-color="rgba(90,69,255,0.14)" 2926 /> 2927 <stop 2928 offset="1" 2929 stop-color="rgba(90,69,255,0)" 2930 /> 2931 </radialGradient> 2932 </defs> 2933 2934 <rect 2935 width="520" 2936 height="360" 2937 fill="url(#fdSecGlow)" 2938 opacity="0.9" 2939 /> 2940 2941 <path 2942 d="M260 92c52 0 96 22 120 34v78c0 60-42 100-120 132-78-32-120-72-120-132V126c24-12 68-34 120-34Z" 2943 fill="rgba(255,255,255,0.015)" 2944 stroke="rgba(255,255,255,0.10)" 2945 stroke-width="2" 2946 opacity="0.9" 2947 /> 2948 2949 <g opacity="0.16"> 2950 <path 2951 d="M170 160H350" 2952 stroke="rgba(255,255,255,0.8)" 2953 /> 2954 <path 2955 d="M162 200H358" 2956 stroke="rgba(255,255,255,0.8)" 2957 /> 2958 <path 2959 d="M180 240H340" 2960 stroke="rgba(255,255,255,0.8)" 2961 /> 2962 2963 <path 2964 d="M210 128V286" 2965 stroke="rgba(255,255,255,0.8)" 2966 /> 2967 <path 2968 d="M260 120V300" 2969 stroke="rgba(255,255,255,0.8)" 2970 /> 2971 <path 2972 d="M310 128V286" 2973 stroke="rgba(255,255,255,0.8)" 2974 /> 2975 </g> 2976 2977 <g opacity="0.4"> 2978 <rect 2979 x="236" 2980 y="188" 2981 width="48" 2982 height="44" 2983 rx="14" 2984 fill="rgba(255,255,255,0.03)" 2985 stroke="rgba(255,255,255,0.10)" 2986 /> 2987 <path 2988 d="M248 188v-10c0-10 8-18 18-18s18 8 18 18v10" 2989 stroke="rgba(90,69,255,0.55)" 2990 stroke-width="3" 2991 stroke-linecap="round" 2992 /> 2993 </g> 2994 </svg>`,"landing-18":`<svg 2995 class="absolute -right-10 -top-10 h-[320px] w-[420px] opacity-60"
2996 viewBox="0 0 420 320" 2997 fill="none" 2998 xmlns="http://www.w3.org/2000/svg" 2999 aria-hidden="true" 3000 > 3001 <defs> 3002 <radialGradient 3003 id="rrProGlow" 3004 cx="0" 3005 cy="0" 3006 r="1" 3007 gradientUnits="userSpaceOnUse" 3008 gradientTransform="translate(260 130) rotate(120) scale(220 200)" 3009 > 3010 <stop stop-color="rgba(90,69,255,0.30)" /> 3011 <stop 3012 offset="1" 3013 stop-color="rgba(90,69,255,0)" 3014 /> 3015 </radialGradient> 3016 <linearGradient 3017 id="rrProArc" 3018 x1="60" 3019 y1="170" 3020 x2="360" 3021 y2="170" 3022 gradientUnits="userSpaceOnUse" 3023 > 3024 <stop stop-color="rgba(90,69,255,0)" /> 3025 <stop 3026 offset="0.5" 3027 stop-color="rgba(90,69,255,0.75)" 3028 /> 3029 <stop 3030 offset="1" 3031 stop-color="rgba(90,69,255,0)" 3032 /> 3033 </linearGradient> 3034 </defs> 3035 3036 <rect 3037 width="420" 3038 height="320" 3039 fill="url(#rrProGlow)" 3040 opacity="0.9" 3041 /> 3042 3043 <path 3044 d="M60 210 C120 90, 300 90, 360 210" 3045 stroke="rgba(255,255,255,0.08)" 3046 stroke-width="2" 3047 stroke-linecap="round" 3048 opacity="0.6" 3049 /> 3050 3051 <path 3052 class="rr-pro-dash" 3053 d="M60 210 C120 90, 300 90, 360 210" 3054 stroke="url(#rrProArc)" 3055 stroke-width="3" 3056 stroke-linecap="round" 3057 stroke-dasharray="7 12" 3058 opacity="0.85" 3059 /> 3060 3061 <g opacity="0.25"> 3062 <circle 3063 cx="60" 3064 cy="210" 3065 r="5" 3066 fill="rgba(255,255,255,0.35)" 3067 /> 3068 <circle 3069 cx="360" 3070 cy="210" 3071 r="5" 3072 fill="rgba(255,255,255,0.35)" 3073 /> 3074 <circle 3075 cx="210" 3076 cy="108" 3077 r="5" 3078 fill="rgba(255,255,255,0.28)" 3079 /> 3080 </g> 3081 </svg>`,"landing-19":`<svg 3082 class="absolute inset-0 h-full w-full"
3083 viewBox="0 0 1400 420" 3084 fill="none" 3085 xmlns="http://www.w3.org/2000/svg" 3086 aria-hidden="true" 3087 > 3088 <defs> 3089 <radialGradient 3090 id="rrFooterGlow" 3091 cx="0" 3092 cy="0" 3093 r="1" 3094 gradientUnits="userSpaceOnUse" 3095 gradientTransform="translate(1020 150) rotate(120) scale(560 440)" 3096 > 3097 <stop stop-color="rgba(90,69,255,0.20)" /> 3098 <stop 3099 offset="1" 3100 stop-color="rgba(90,69,255,0)" 3101 /> 3102 </radialGradient> 3103 3104 <linearGradient 3105 id="rrFooterStroke" 3106 x1="240" 3107 y1="120" 3108 x2="1200" 3109 y2="320" 3110 gradientUnits="userSpaceOnUse" 3111 > 3112 <stop stop-color="rgba(255,255,255,0.00)" /> 3113 <stop 3114 offset="0.45" 3115 stop-color="rgba(255,255,255,0.12)" 3116 /> 3117 <stop 3118 offset="1" 3119 stop-color="rgba(255,255,255,0.00)" 3120 /> 3121 </linearGradient> 3122 3123 <linearGradient 3124 id="rrFooterAccent" 3125 x1="320" 3126 y1="160" 3127 x2="1240" 3128 y2="340" 3129 gradientUnits="userSpaceOnUse" 3130 > 3131 <stop stop-color="rgba(90,69,255,0.00)" /> 3132 <stop 3133 offset="0.5" 3134 stop-color="rgba(90,69,255,0.70)" 3135 /> 3136 <stop 3137 offset="1" 3138 stop-color="rgba(90,69,255,0.00)" 3139 /> 3140 </linearGradient> 3141 3142 <!-- mask to keep edges quiet --> 3143 <radialGradient 3144 id="rrFooterMask" 3145 cx="0" 3146 cy="0" 3147 r="1" 3148 gradientUnits="userSpaceOnUse" 3149 gradientTransform="translate(700 210) rotate(90) scale(220 720)" 3150 > 3151 <stop stop-color="rgba(255,255,255,0.22)" /> 3152 <stop 3153 offset="0.65" 3154 stop-color="rgba(255,255,255,0.10)" 3155 /> 3156 <stop 3157 offset="1" 3158 stop-color="rgba(255,255,255,0.00)" 3159 /> 3160 </radialGradient> 3161 </defs> 3162 3163 <!-- glow wash --> 3164 <rect 3165 width="1400" 3166 height="420" 3167 fill="url(#rrFooterGlow)" 3168 opacity="0.9" 3169 /> 3170 3171 <!-- base lines --> 3172 <g opacity="0.85"> 3173 <path 3174 d="M140 290 C 360 110, 640 110, 860 290"
3175 stroke="url(#rrFooterStroke)" 3176 stroke-width="2" 3177 stroke-linecap="round" 3178 opacity="0.55" 3179 /> 3180 <path 3181 d="M240 330 C 520 140, 780 140, 1180 300" 3182 stroke="url(#rrFooterStroke)" 3183 stroke-width="2" 3184 stroke-linecap="round" 3185 opacity="0.40" 3186 /> 3187 <path 3188 d="M160 180 C 420 60, 980 70, 1280 210" 3189 stroke="url(#rrFooterStroke)" 3190 stroke-width="2" 3191 stroke-linecap="round" 3192 opacity="0.35" 3193 /> 3194 </g> 3195 3196 <!-- animated dashed accent --> 3197 <path 3198 class="rr-footer-dash" 3199 d="M140 290 C 360 110, 640 110, 860 290" 3200 stroke="url(#rrFooterAccent)" 3201 stroke-width="3" 3202 stroke-linecap="round" 3203 stroke-dasharray="7 12" 3204 opacity="0.9" 3205 /> 3206 3207 <path 3208 class="rr-footer-dash rr-footer-dash-slow" 3209 d="M240 330 C 520 140, 780 140, 1180 300" 3210 stroke="url(#rrFooterAccent)" 3211 stroke-width="3" 3212 stroke-linecap="round" 3213 stroke-dasharray="6 14" 3214 opacity="0.55" 3215 /> 3216 3217 <!-- faint nodes --> 3218 <g opacity="0.22"> 3219 <circle 3220 cx="140" 3221 cy="290" 3222 r="6" 3223 fill="rgba(255,255,255,0.22)" 3224 /> 3225 <circle 3226 cx="860" 3227 cy="290" 3228 r="6" 3229 fill="rgba(255,255,255,0.22)" 3230 /> 3231 <circle 3232 cx="1180" 3233 cy="300" 3234 r="6" 3235 fill="rgba(255,255,255,0.18)" 3236 /> 3237 <circle 3238 cx="240" 3239 cy="330" 3240 r="6" 3241 fill="rgba(255,255,255,0.18)" 3242 /> 3243 <circle 3244 cx="1280" 3245 cy="210" 3246 r="6" 3247 fill="rgba(255,255,255,0.12)" 3248 /> 3249 </g> 3250 3251 <!-- one subtle pulse dot (breathing) --> 3252 <circle 3253 class="rr-footer-pulse" 3254 cx="860" 3255 cy="290" 3256 r="5" 3257 fill="rgba(90,69,255,0.95)" 3258 opacity="0.25" 3259 /> 3260 3261 <!-- edge mask --> 3262 <rect 3263 width="1400" 3264 height="420" 3265 fill="url(#rrFooterMask)" 3266 opacity="0.9" 3267 /> 3268 </svg>`},w5={"tess-flow":`<svg class="absolute -right-12 -bottom-10 w-[440px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3269 <defs> 3270 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3271 <stop stop-color="rgba(90,69,255,0.14)"/> 3272 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3273 </radialGradient> 3274 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3275 <stop stop-color="rgba(90,69,255,0.10)"/> 3276 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3277 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3278 </linearGradient> 3279 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3280 <stop stop-color="rgba(90,69,255,0)"/> 3281 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3282 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3283 </linearGradient> 3284 </defs> 3285 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3286 <g opacity="0.78">
3287 <path d="M140 190 C 210 120, 250 120, 300 170" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M140 190 C 210 260, 250 260, 300 210" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M300 170 C 350 140, 380 140, 420 170" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M300 210 C 350 240, 380 240, 420 210" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M300 170 L300 210" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M230 130 C 255 130, 275 140, 300 170" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/><path d="M230 250 C 255 250, 275 240, 300 210" stroke="url(#tLine)" stroke-width="2.2" stroke-linecap="round"/> 3288 </g> 3289 <g opacity="0.96"> 3290 <circle cx="140" cy="190" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/><circle cx="300" cy="170" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/><circle cx="300" cy="210" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/><circle cx="420" cy="170" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/><circle cx="420" cy="210" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3291 </g> 3292 <circle class="tess-pulse" cx="300" cy="170" r="5" fill="#5A45FF" opacity="0.22"/> 3293</svg>`,"tess-arc":`<svg class="absolute -right-12 -bottom-12 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3294 <defs> 3295 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3296 <stop stop-color="rgba(90,69,255,0.14)"/> 3297 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3298 </radialGradient> 3299 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3300 <stop stop-color="rgba(90,69,255,0.10)"/> 3301 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3302 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3303 </linearGradient> 3304 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3305 <stop stop-color="rgba(90,69,255,0)"/> 3306 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3307 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3308 </linearGradient> 3309 </defs> 3310 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3311 <path d="M90 260 C150 120, 370 120, 430 260" 3312 stroke="rgba(255,255,255,0.06)" stroke-width="2" stroke-linecap="round" opacity="0.7"/> 3313 <path class="tess-dash" 3314 d="M90 260 C150 120, 370 120, 430 260" 3315 stroke="url(#tArc)" stroke-width="3" stroke-linecap="round" 3316 stroke-dasharray="7 12" opacity="0.85"/> 3317 <g opacity="0.18"> 3318 <path d="M140 230l-24 10" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3319 <path d="M190 195l-22 12" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3320 <path d="M240 170l-20 14" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3321 <path d="M280 165l-18 15" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3322 <path d="M330 185l-16 14" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3323 <path d="M380 220l-14 12" stroke="rgba(255,255,255,0.8)" stroke-width="2" stroke-linecap="round"/> 3324 </g> 3325 <g opacity="0.22"> 3326 <circle cx="90" cy="260" r="6" fill="rgba(255,255,255,0.35)"/> 3327 <circle cx="430" cy="260" r="6" fill="rgba(255,255,255,0.35)"/> 3328 <circle cx="260" cy="145" r="6" fill="rgba(255,255,255,0.28)"/> 3329 </g> 3330</svg>`,"tess-stack":`<svg class="absolute -right-16 -bottom-14 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3331 <defs> 3332 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3333 <stop stop-color="rgba(90,69,255,0.14)"/> 3334 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3335 </radialGradient> 3336 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3337 <stop stop-color="rgba(90,69,255,0.10)"/> 3338 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3339 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3340 </linearGradient> 3341 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3342 <stop stop-color="rgba(90,69,255,0)"/> 3343 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3344 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3345 </linearGradient> 3346 </defs> 3347 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3348 <g class="tess-float" opacity="0.95"><rect x="212" y="56" width="250" height="150" rx="22" 3349 fill="rgba(255,255,255,0.030)" stroke="rgba(255,255,255,0.100)"/><rect x="186" y="84" width="250" height="150" rx="22" 3350 fill="rgba(255,255,255,0.040)" stroke="rgba(255,255,255,0.090)"/><rect x="160" y="112" width="250" height="150" rx="22" 3351 fill="rgba(255,255,255,0.050)" stroke="rgba(255,255,255,0.080)"/><rect x="134" y="140" width="250" height="150" rx="22" 3352 fill="rgba(255,255,255,0.060)" stroke="rgba(255,255,255,0.070)"/><rect x="108" y="168" width="250" height="150" rx="22" 3353 fill="rgba(255,255,255,0.070)" stroke="rgba(255,255,255,0.060)"/></g> 3354 <path class="tess-dash" 3355 d="M150 286h230"
3356 stroke="url(#tLine)" stroke-width="1.8000000000000003" stroke-linecap="round" 3357 stroke-dasharray="10 12" opacity="0.55"/> 3358 <path class="tess-shimmer" 3359 d="M150 120h212c22 0 40 18 40 40v10" 3360 stroke="#5A45FF" stroke-width="2.2" stroke-linecap="round" opacity="0.55"/> 3361</svg>`,"tess-stream":`<svg class="absolute -right-14 -bottom-14 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3362 <defs> 3363 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3364 <stop stop-color="rgba(90,69,255,0.14)"/> 3365 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3366 </radialGradient> 3367 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3368 <stop stop-color="rgba(90,69,255,0.10)"/> 3369 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3370 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3371 </linearGradient> 3372 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3373 <stop stop-color="rgba(90,69,255,0)"/> 3374 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3375 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3376 </linearGradient> 3377 </defs> 3378 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3379 <g class="tess-float" opacity="0.98"> 3380 <rect x="140" y="120" width="300" height="38" rx="16" fill="rgba(255,255,255,0.030)" stroke="rgba(255,255,255,0.100)"/> 3381 <rect class="tess-shimmer" x="158" y="134" width="120" height="6" rx="3" fill="rgba(255,255,255,0.30)" opacity="0.28"/> 3382 <rect class="" x="388" y="131" width="42" height="16" rx="8" fill="rgba(34,197,94,0.12)" stroke="rgba(34,197,94,0.22)"/> 3383 <rect x="140" y="166" width="300" height="38" rx="16" fill="rgba(255,255,255,0.028)" stroke="rgba(255,255,255,0.090)"/> 3384 <rect class="tess-shimmer" x="158" y="180" width="156" height="6" rx="3" fill="rgba(255,255,255,0.30)" opacity="0.26"/> 3385 <rect class="" x="388" y="177" width="42" height="16" rx="8" fill="rgba(34,197,94,0.12)" stroke="rgba(34,197,94,0.22)"/> 3386 <rect x="140" y="212" width="300" height="38" rx="16" fill="rgba(255,255,255,0.026)" stroke="rgba(255,255,255,0.080)"/> 3387 <rect class="tess-shimmer" x="158" y="226" width="192" height="6" rx="3" fill="rgba(255,255,255,0.30)" opacity="0.24"/> 3388 <rect class="" x="388" y="223" width="42" height="16" rx="8" fill="rgba(34,197,94,0.12)" stroke="rgba(34,197,94,0.22)"/> 3389 <rect x="140" y="258" width="300" height="38" rx="16" fill="rgba(255,255,255,0.024)" stroke="rgba(255,255,255,0.070)"/> 3390 <rect class="tess-shimmer" x="158" y="272" width="120" height="6" rx="3" fill="rgba(255,255,255,0.30)" opacity="0.22"/> 3391 <rect class="" x="388" y="269" width="42" height="16" rx="8" fill="rgba(34,197,94,0.12)" stroke="rgba(34,197,94,0.22)"/> 3392 <rect x="140" y="304" width="300" height="38" rx="16" fill="rgba(255,255,255,0.022)" stroke="rgba(255,255,255,0.070)"/> 3393 <rect class="tess-shimmer" x="158" y="318" width="156" height="6" rx="3" fill="rgba(255,255,255,0.30)" opacity="0.20"/> 3394 <rect class="tess-pulse" x="388" y="315" width="42" height="16" rx="8" fill="rgba(234,179,8,0.10)" stroke="rgba(234,179,8,0.22)"/> 3395 </g> 3396 <path class="tess-dash" d="M150 298H440" stroke="url(#tArc)" stroke-width="3" stroke-linecap="round" stroke-dasharray="7 12" opacity="0.55"/> 3397</svg>`,"tess-lifecycle":`<svg class="absolute -right-14 -bottom-12 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3398 <defs> 3399 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3400 <stop stop-color="rgba(90,69,255,0.14)"/> 3401 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3402 </radialGradient> 3403 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3404 <stop stop-color="rgba(90,69,255,0.10)"/> 3405 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3406 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3407 </linearGradient> 3408 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3409 <stop stop-color="rgba(90,69,255,0)"/> 3410 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3411 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3412 </linearGradient> 3413 <linearGradient id="tLife" x1="120" y1="180" x2="440" y2="180" gradientUnits="userSpaceOnUse"> 3414 <stop stop-color="rgba(255,255,255,0)"/> 3415 <stop offset="0.5" stop-color="rgba(255,255,255,0.12)"/> 3416 <stop offset="1" stop-color="rgba(255,255,255,0)"/> 3417 </linearGradient> 3418 </defs> 3419 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/>
3420 <path d="M120 180H440" stroke="url(#tLife)" stroke-width="2.2" opacity="0.65" stroke-linecap="round"/> 3421 <path class="tess-dash" d="M120 180H440" stroke="url(#tArc)" stroke-width="3" opacity="0.65" stroke-linecap="round" stroke-dasharray="40 200"/> 3422 <g opacity="0.95"><circle cx="140" cy="180" r="7" fill="rgba(255,255,255,0.03)" stroke="rgba(255,255,255,0.10)"/> 3423 <circle cx="140" cy="180" r="3" fill="rgba(255,255,255,0.20)" opacity="0.35"/><circle cx="210" cy="180" r="7" fill="rgba(255,255,255,0.03)" stroke="rgba(255,255,255,0.10)"/> 3424 <circle cx="210" cy="180" r="3" fill="rgba(255,255,255,0.20)" opacity="0.35"/><circle cx="280" cy="180" r="7" fill="rgba(255,255,255,0.03)" stroke="rgba(255,255,255,0.10)"/> 3425 <circle cx="280" cy="180" r="3" fill="rgba(255,255,255,0.20)" opacity="0.35"/><circle cx="350" cy="180" r="7" fill="rgba(255,255,255,0.03)" stroke="rgba(255,255,255,0.10)"/> 3426 <circle cx="350" cy="180" r="3" fill="rgba(255,255,255,0.20)" opacity="0.35"/><circle cx="420" cy="180" r="7" fill="rgba(255,255,255,0.03)" stroke="rgba(255,255,255,0.10)"/> 3427 <circle cx="420" cy="180" r="3" fill="rgba(255,255,255,0.20)" opacity="0.35"/></g> 3428 <circle class="tess-pulse" cx="120" cy="180" r="5" fill="#5A45FF" opacity="0.22"/> 3429</svg>`,"tess-pulse":`<svg class="absolute -right-12 -bottom-12 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3430 <defs> 3431 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3432 <stop stop-color="rgba(90,69,255,0.14)"/> 3433 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3434 </radialGradient> 3435 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3436 <stop stop-color="rgba(90,69,255,0.10)"/> 3437 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3438 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3439 </linearGradient> 3440 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3441 <stop stop-color="rgba(90,69,255,0)"/> 3442 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3443 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3444 </linearGradient> 3445 </defs> 3446 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3447 <g opacity="0.95"><circle cx="300" cy="180" r="46" fill="none" stroke="rgba(255,255,255,0.100)" stroke-width="1.6" stroke-dasharray="12 18" /><circle class="tess-dash" cx="300" cy="180" r="70" fill="none" stroke="rgba(255,255,255,0.088)" stroke-width="1.6" /><circle cx="300" cy="180" r="94" fill="none" stroke="rgba(255,255,255,0.076)" stroke-width="1.6" stroke-dasharray="16 26" /><circle cx="300" cy="180" r="118" fill="none" stroke="rgba(255,255,255,0.064)" stroke-width="1.6" /></g> 3448 <g opacity="0.95"> 3449 <circle cx="300" cy="180" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3450 <circle class="tess-pulse" cx="300" cy="180" r="6" fill="#5A45FF" opacity="0.22"/> 3451 </g> 3452 <path class="tess-shimmer" 3453 d="M190 220 C 240 130, 360 130, 410 220" 3454 stroke="#5A45FF" stroke-width="2.2" stroke-linecap="round" opacity="0.52"/> 3455</svg>`,"tess-mesh":`<svg class="absolute -right-14 -bottom-12 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3456 <defs> 3457 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3458 <stop stop-color="rgba(90,69,255,0.14)"/> 3459 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3460 </radialGradient> 3461 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3462 <stop stop-color="rgba(90,69,255,0.10)"/> 3463 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3464 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3465 </linearGradient> 3466 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3467 <stop stop-color="rgba(90,69,255,0)"/> 3468 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3469 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3470 </linearGradient> 3471 </defs> 3472 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3473 <g opacity="0.95"><line x1="170" y1="220" x2="240" y2="140" stroke="rgba(255,255,255,0.10)" stroke-width="1.6" stroke-linecap="round" opacity="0.55" /><line x1="240" y1="140" x2="320" y2="170" stroke="rgba(255,255,255,0.10)" stroke-width="1.6" stroke-linecap="round" opacity="0.55" />
3473<line x1="320" y1="170" x2="390" y2="120" stroke="rgba(255,255,255,0.10)" stroke-width="1.6" stroke-linecap="round" opacity="0.55" /><line x1="390" y1="120" x2="420" y2="210" stroke="rgba(255,255,255,0.10)" stroke-width="1.6" stroke-linecap="round" opacity="0.55" /><line x1="170" y1="220" x2="320" y2="170" stroke="url(#tArc)" stroke-width="3.0" stroke-linecap="round" opacity="0.75" stroke-dasharray="7 12" /><line x1="240" y1="140" x2="420" y2="210" stroke="rgba(255,255,255,0.10)" stroke-width="1.6" stroke-linecap="round" opacity="0.55" /></g> 3474 <g opacity="0.95"> 3475 <circle cx="170" cy="220" r="14" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3476 <circle cx="170" cy="220" r="4" fill="rgba(255,255,255,0.22)" opacity="0.35"/> 3477 <circle cx="240" cy="140" r="14" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3478 <circle cx="240" cy="140" r="4" fill="rgba(255,255,255,0.22)" opacity="0.35"/> 3479 <circle cx="320" cy="170" r="18" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3480 <circle cx="320" cy="170" r="4" fill="rgba(255,255,255,0.22)" opacity="0.35"/> 3481 <circle cx="390" cy="120" r="14" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3482 <circle cx="390" cy="120" r="4" fill="rgba(255,255,255,0.22)" opacity="0.35"/> 3483 <circle cx="420" cy="210" r="14" fill="rgba(255,255,255,0.04)" stroke="rgba(255,255,255,0.12)" stroke-width="2"/> 3484 <circle cx="420" cy="210" r="4" fill="rgba(255,255,255,0.22)" opacity="0.35"/> 3485 <circle class="tess-pulse" cx="320" cy="170" r="6" fill="#5A45FF" opacity="0.20"/> 3486 </g> 3487</svg>`,"tess-trace":`<svg class="absolute -right-14 -bottom-14 w-[460px]" style="opacity:0.58" viewBox="0 0 520 360" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> 3488 <defs> 3489 <radialGradient id="tGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(340 140) rotate(120) scale(260 220)"> 3490 <stop stop-color="rgba(90,69,255,0.14)"/> 3491 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3492 </radialGradient> 3493 <linearGradient id="tLine" x1="120" y1="110" x2="420" y2="250" gradientUnits="userSpaceOnUse"> 3494 <stop stop-color="rgba(90,69,255,0.10)"/> 3495 <stop offset="0.5" stop-color="rgba(90,69,255,0.55)"/> 3496 <stop offset="1" stop-color="rgba(90,69,255,0.10)"/> 3497 </linearGradient> 3498 <linearGradient id="tArc" x1="90" y1="240" x2="430" y2="240" gradientUnits="userSpaceOnUse"> 3499 <stop stop-color="rgba(90,69,255,0)"/> 3500 <stop offset="0.5" stop-color="rgba(90,69,255,0.70)"/> 3501 <stop offset="1" stop-color="rgba(90,69,255,0)"/> 3502 </linearGradient> 3503 </defs> 3504 <rect width="520" height="360" fill="url(#tGlow)" opacity="0.95"/> 3505 <path d="M110 260 C 190 140, 260 120, 320 180 S 420 300, 470 140" stroke="rgba(255,255,255,0.08)" stroke-width="2.0" stroke-linecap="round" opacity="0.75"/> 3506 <path class="tess-dash" d="M110 260 C 190 140, 260 120, 320 180 S 420 300, 470 140" stroke="url(#tArc)" stroke-width="3.1" stroke-linecap="round" stroke-dasharray="18 120" opacity="0.7"/> 3507 <g opacity="0.35"> 3508 <circle cx="110" cy="250" r="6" fill="rgba(255,255,255,0.30)"/> 3509 <circle cx="470" cy="140" r="6" fill="rgba(255,255,255,0.30)"/> 3510 </g> 3511 <circle class="tess-pulse" cx="330" cy="190" r="6" fill="#5A45FF" opacity="0.18"/> 3512</svg>`},eEe=Object.keys(w5),tEe=Object.keys(j5),gG=[...tEe,...eEe];function sEe({className:e="",primaryAccent:t="rgba(126,225,255,0.65)",secondaryAccent:s="rgba(90,69,255,0.9)",strokeStart:n="rgba(126,225,255,0.45)",strokeEnd:a="rgba(90,69,255,0.65)",variant:o="ribbon"}){const i=x.useId(),l=`${i}-stroke`,c=`${i}-accent`,u=()=>r.jsxs(r.Fragment,{children:[r.jsxs("g",{opacity:"0.55",children:[r.jsx("path",{d:"M120 250 C 360 120, 640 120, 920 250",
3512stroke:`url(#${l})`,strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M200 310 C 480 160, 760 160, 1100 300",stroke:`url(#${l})`,strokeWidth:"2",strokeLinecap:"round",opacity:"0.55"})]}),r.jsx("path",{className:"ambient-diagram-dash",d:"M140 270 C 380 130, 660 130, 940 270",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 12",opacity:"0.85"}),r.jsx("path",{className:"ambient-diagram-dash ambient-diagram-dash-slow",d:"M220 320 C 500 170, 780 170, 1120 310",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"6 14",opacity:"0.55"}),r.jsxs("g",{opacity:"0.22",children:[r.jsx("circle",{cx:"140",cy:"270",r:"6",fill:"rgba(255,255,255,0.22)"}),r.jsx("circle",{cx:"940",cy:"270",r:"6",fill:"rgba(255,255,255,0.22)"}),r.jsx("circle",{cx:"1120",cy:"310",r:"6",fill:"rgba(255,255,255,0.16)"})]}),r.jsx("circle",{className:"ambient-diagram-pulse",cx:"940",cy:"270",r:"5",fill:"rgba(90,69,255,0.95)",opacity:"0.25"})]}),f=()=>r.jsxs(r.Fragment,{children:[r.jsxs("g",{opacity:"0.6",children:[r.jsx("path",{d:"M80 180 C 240 120, 420 160, 620 140 C 840 120, 980 220, 1140 180",stroke:`url(#${l})`,strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M60 240 C 260 200, 420 240, 660 210 C 840 190, 980 260, 1150 230",stroke:`url(#${l})`,strokeWidth:"2",strokeLinecap:"round",opacity:"0.7"})]}),r.jsx("path",{className:"ambient-diagram-dash",d:"M120 210 C 320 170, 520 210, 740 180 C 940 150, 1080 200, 1180 180",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"8 10",opacity:"0.9"}),r.jsxs("g",{opacity:"0.28",children:[r.jsx("circle",{cx:"160",cy:"200",r:"5",fill:"rgba(255,255,255,0.22)"}),r.jsx("circle",{cx:"520",cy:"210",r:"5",fill:"rgba(255,255,255,0.18)"}),r.jsx("circle",{cx:"920",cy:"190",r:"6",fill:"rgba(255,255,255,0.22)"}),r.jsx("circle",{cx:"1140",cy:"180",r:"6",fill:"rgba(255,255,255,0.18)"})]}),r.jsx("circle",{className:"ambient-diagram-pulse",cx:"740",cy:"180",r:"5",fill:"rgba(90,69,255,0.95)",opacity:"0.25"})]}),h=()=>r.jsxs(r.Fragment,{children:[r.jsxs("g",{opacity:"0.3",children:[[80,200,320,440,560,680,800,920,1040].map(_=>r.jsx("line",{x1:_,y1:80,x2:_,y2:340,stroke:`url(#${l})`,strokeWidth:"1.5"},`v-${_}`)),[120,200,280,360,440,520,600,680,760].map(_=>r.jsx("line",{x1:80,y1:_,x2:1120,y2:_,stroke:`url(#${l})`,strokeWidth:"1.5"},`h-${_}`))]}),r.jsx("path",{className:"ambient-diagram-dash",d:"M140 320 C 420 260, 620 200, 960 220",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"10 12",opacity:"0.9"}),r.jsx("path",{className:"ambient-diagram-dash ambient-diagram-dash-slow",d:"M200 140 C 420 200, 720 240, 1040 180",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"8 16",opacity:"0.7"}),r.jsxs("g",{opacity:"0.3",children:[r.jsx("circle",{cx:"200",cy:"200",r:"6",fill:"rgba(255,255,255,0.2)"}),r.jsx("circle",{cx:"560",cy:"240",r:"6",fill:"rgba(255,255,255,0.18)"}),r.jsx("circle",{cx:"880",cy:"180",r:"6",fill:"rgba(255,255,255,0.22)"}),r.jsx("circle",{cx:"1040",cy:"220",r:"6",fill:"rgba(255,255,255,0.16)"})]}),r.jsx("circle",{className:"ambient-diagram-pulse",cx:"560",cy:"240",r:"5",fill:"rgba(90,69,255,0.95)",opacity:"0.25"})]}),g=()=>r.jsxs(r.Fragment,{children:[r.jsxs("g",{opacity:"0.5",children:[r.jsx("circle",{cx:"620",cy:"210",r:"160",stroke:`url(#${l})`,strokeWidth:"2"}),r.jsx("circle",{cx:"620",cy:"210",r:"220",stroke:`url(#${l})`,strokeWidth:"1.5",opacity:"0.6"}),r.jsx("circle",{cx:"620",cy:"210",r:"280",stroke:`url(#${l})`,strokeWidth:"1.5",opacity:"0.35"})]}),r.jsx("path",{className:"ambient-diagram-dash",d:"M380 210 C 520 60, 780 60, 920 210 C 780 360, 520 360, 380 210 Z",stroke:`url(#${c})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"9 12",fill:"none",opacity:"0.85"}),r.jsxs("g",{opacity:"0.28",children:[r.jsx("circle",{cx:"620",cy:"210",r:"8",fill:"rgba(255,255,255,0.24)"}),r.jsx("circle",{cx:"440",cy:"210",r:"6",fill:"rgba(255,255,255,0.2)"}),r.jsx("circle",{cx:"800",cy:"210",r:"6",fill:"rgba(255,255,255,0.2)"}),r.jsx("circle",{cx:"620",cy:"60",r:"5",fill:"rgba(255,255,255,0.16)"}),r.jsx("circle",{cx:"620",cy:"360",r:"5",fill:"rgba(255,255,255,0.16)"})]}),r.jsx("circle",{className:"ambient-diagram-pulse",cx:"800",cy:"210",r:"6",fill:"rgba(90,69,255,0.95)",opacity:"0.25"})]}),v=_=>{const j=i.replace(/:/g,""),w=_.replace(/id="([^"]+)"/g,(k,S)=>`id="${j}-${S}"`).replace(/url\(#([^)]+)\)/g,(k,S)=>`url(#${j}-${S})`).replace(/href="#([^"]+)"/g,(k,S)=>`href="#${j}-${S}"`).replace(/xlink:href="#([^"]+)"/g,(k,S)=>`xlink:href="#${j}-${S}"`);return r.jsx("div",{className:`ambient-diagram-raw ${e}`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Rp(w)}})},y=()=>{switch(o){case"wave":return f();case"grid":return h();case"orbit":return g();case"ribbon":default:return u()}};return o in j5?v(j5[o]):o in w5?v(w5[o]):r.jsxs("svg",{className:`ambient-diagram-svg ${e}`,viewBox:"0 0 1200 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:l,x1:"160",y1:"80",x2:"960",y2:"340",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:n}),r.jsx("stop",{offset:"1",stopColor:a})]}),r.jsxs("linearGradient",{id:c,x1:"0",y1:"0",x2:"1200",y2:"0",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:t}),r.jsx("stop",{offset:"1",stopColor:s})]})]}),y()]})}function a1({heading:e="Get started with ReqRes and ship today.",subheading:t="Create your free account to generate keys, send magic links, and wire up your UI in minutes.",eyebrow:s="Ready to build?",ctaLabel:n="Get Started",className:a="",ambientVariant:o}){const{isSignedIn:i,isLoaded:l}=zt(),c=Wr(),u=x.useMemo(()=>
3512{if(o)return o;const f=["ribbon","wave","grid","orbit",...gG],h=Math.floor(Math.random()*f.length);return f[h]},[o]);return!l||i?null:r.jsx("div",{className:`mt-6 ${a}`,children:r.jsxs("div",{className:"relative mx-auto max-w-6xl overflow-hidden rounded-3xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-card)] px-6 py-7 text-[var(--color-fg-default)] shadow-[0_25px_70px_rgba(15,23,42,0.55)] sm:px-8 sm:py-8",children:[r.jsx(sEe,{className:"pointer-events-none absolute inset-0 opacity-70",variant:u}),r.jsxs("div",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:s}),r.jsx("h3",{className:"text-2xl font-semibold leading-tight sm:text-3xl",children:e}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-2xl",children:t})]}),r.jsx(Xf,{mode:"modal",children:r.jsx("button",{type:"button",className:"inline-flex items-center justify-center rounded-full bg-white px-5 py-3 text-sm font-semibold text-indigo-700 shadow-lg shadow-indigo-900/40 transition hover:-translate-y-[2px] hover:shadow-indigo-900/60",onClick:()=>Z.track("signup_started",{path:c.pathname}),children:n})})]})]})})}const rEe=[{endpoint:"POST /api/app-users/login",privateAllowed:!0,publicAllowed:!1,sessionAllowed:!1,note:"Send magic link"},{endpoint:"POST /api/app-users/verify",privateAllowed:!1,publicAllowed:!1,sessionAllowed:!1,note:"Exchange token â session_token"},{endpoint:"GET /api/collections/:slug/records?project_id=...",privateAllowed:!0,publicAllowed:!1,sessionAllowed:!1,note:"Server/admin read or write"},{endpoint:"GET /app/collections/:slug/records",privateAllowed:!1,publicAllowed:!0,sessionAllowed:!0,note:"Browser read with public key or session_token"}];function nEe(){return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[r.jsxs(Ht,{className:"p-4 surface-card elevation-1 border border-indigo-500/30",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-indigo-200",children:"Private API key"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-default)] mt-1",children:["Header: ",r.jsx("code",{className:"font-mono text-[11px]",children:"x-api-key"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Server/admin use only. Full read/write for collections, logs, and custom endpoints."})]}),r.jsxs(Ht,{className:"p-4 surface-card elevation-1 border border-emerald-500/30",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-emerald-200",children:"Public API key"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-default)] mt-1",children:["Header: ",r.jsx("code",{className:"font-mono text-[11px]",children:"x-api-key"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Browser-safe, read-only. Use for GET /app/collections/:slug/records and to start login."})]}),r.jsxs(Ht,{className:"p-4 surface-card elevation-1 border border-amber-500/30",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-amber-200",children:"Session token"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-default)] mt-1",children:["Header:"," ",r.jsx("code",{className:"font-mono text-[11px]",children:"Authorization: Bearer <session_token>"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Issued after verify. Read/write collections on behalf of the logged-in app user."})]})]}),r.jsx(Ht,{className:"p-4 surface-card elevation-1",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-left text-[11px] text-[var(--color-fg-default)]",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[var(--color-fg-muted)] uppercase tracking-[0.14em]",children:[r.jsx("th",{className:"py-2 font-semibold",children:"Endpoint"}),r.jsx("th",{className:"py-2 font-semibold text-center",children:"Private"}),r.jsx("th",{className:"py-2 font-semibold text-center",children:"Public"}),r.jsx("th",{className:"py-2 font-semibold text-center",children:"Session"}),r.jsx("th",{className:"py-2 font-semibold",children:"Notes"})]})}),r.jsx("tbody",{className:"divide-y divide-[var(--color-border-default)]",children:rEe.map(e=>r.jsxs("tr",{className:"align-top",children:[r.jsx("td",{className:"py-2 pr-2 font-mono text-[11px] text-[var(--color-fg-default)]",children:e.endpoint}),r.jsx("td",{className:"py-2 text-center",children:e.privateAllowed?"â ":"-"}),r.jsx("td",{className:"py-2 text-center",children:e.publicAllowed?"â ":"-"}),r.jsx("td",{className:"py-2 text-center",children:e.sessionAllowed?"â ":"-"}),r.jsx("td",{className:"py-2 text-[var(--color-fg-muted)]",children:e.note})]},e.endpoint))})]})})})]})}function aEe(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;try{return JSON.parse(t)}catch{return t}}return e}}function Pj(e){return typeof e=="number"?e:`"${e}"`}function oEe(e,t){const s=" ".repeat(t);return e.split(` 3513`).map(n=>n&&`${s}${n}`).join(` 3514`)}function iEe(e,t=2){const s=Object.entries(e);if(!s.length)return"{}";if(s.length===1){const[i,l]=s[0];return`{ '${i}': '${l}' }`}const n=" ".repeat(t+2),a=" ".repeat(t);return`{ 3515${s.map(([i,l])=>`${n}'${i}': '${l}',`).join(` 3516`)} 3517${a}}`}function xG(e,t){const s=typeof e=="string"?JSON.stringify(e):JSON.stringify(e,null,2);return oEe(`const payload = ${s};`,t)}function lEe(e){const t=[`curl -X ${e.method} \\`];
3517if(Object.entries(e.headers).forEach(([s,n])=>{t.push(` -H "${s}: ${n}" \\`)}),e.body!==void 0){const s=typeof e.body=="string"?e.body:JSON.stringify(e.body);t.push(` -d '${s}' \\`)}return t.push(` ${e.url}`),t.join(` 3518`)}function vG(e,t){const s=" ".repeat(t),n=[],a=e.body!==void 0;if((e.method!=="GET"||a)&&n.push(`${s}method: '${e.method}',`),Object.keys(e.headers).length&&n.push(`${s}headers: ${iEe(e.headers,t)},`),a){const o=typeof e.body!="string";n.push(`${s}body: ${o?"JSON.stringify(payload)":"payload"},`)}return n}function cEe(e){const t=e.body,s=t!==void 0,n=[];s&&t!==void 0&&n.push(xG(t,0),"");const a=vG(e,2),o=a.length?`, { 3519${a.join(` 3520`)} 3521}`:"";return n.push(`const response = await fetch('${e.url}'${o});`),n.push("const data = await response.json();"),n.push("console.log(data);"),n.join(` 3522`)}function dEe(e){const t=e.body,n=t!==void 0&&t!==void 0?`${xG(t,6)} 3523 3524`:"",a=vG(e,8),o=" ".repeat(6),i=a.length?`, { 3525${a.join(` 3526`)} 3527${o}}`:"";return`import { useEffect, useState } from 'react'; 3528 3529export function ${e.name||"ExampleRequest"}() { 3530 const [data, setData] = useState(null); 3531 3532 useEffect(() => { 3533 const fetchData = async () => { 3534${n}${o}const response = await fetch('${e.url}'${i}); 3535${o}const json = await response.json(); 3536${o}setData(json); 3537 }; 3538 3539 fetchData(); 3540 }, []); 3541 3542 return <pre>{JSON.stringify(data, null, 2)}</pre>; 3543} 3544`}function $r(e){const t=aEe(e.body),s={...e.headers||{}};t&&!s["Content-Type"]&&(s["Content-Type"]="application/json");const n={url:e.url,method:(e.method||"GET").toUpperCase(),headers:s,body:t,name:e.name};return[{id:"curl",label:"cURL",language:"bash",code:lEe(n)},{id:"javascript",label:"JavaScript",language:"javascript",code:cEe(n)},{id:"react",label:"React",language:"tsx",code:dEe(n)}]}function uEe(...e){if(!e.length)return[];const[t,...s]=e;return t.map(n=>{const a=s.map(o=>{var i;return(i=o.find(l=>l.id===n.id))==null?void 0:i.code}).filter(Boolean);return{...n,code:[n.code,...a].join(` 3545 3546`)}})}function lb(e){return e&&typeof e=="object"?{projectId:e.id??"YOUR_PROJECT_ID",projectSlug:e.slug??"YOUR_PROJECT_SLUG"}:e==null?{projectId:"YOUR_PROJECT_ID",projectSlug:"YOUR_PROJECT_SLUG"}:{projectId:e,projectSlug:"YOUR_PROJECT_SLUG"}}function yA(e,t){const{projectId:s,projectSlug:n}=lb(e),a=e&&typeof e=="object"?e.id:e,o=e&&typeof e=="object"&&"slug"in e?e.slug:void 0,i=[];return a!=null&&`${a}`!=""?i.push(`project_id=${s}`):o!=null&&`${o}`!=""?i.push(`project_slug=${n}`):s!=null&&i.push(`project_id=${s}`),t&&i.push(t),i.length?`?${i.join("&")}`:""}function Ij(e){const{projectId:t,projectSlug:s}=lb(e),n={email:"[email protected]",project_slug:s,...t?{project_id:t}:{}};return $r({url:"https://reqres.in/api/app-users/login",method:"POST",headers:{"Content-Type":"application/json","x-api-key":"<public_api_key>"},body:n,name:"SendMagicLink"})}function o1(){return $r({url:"https://reqres.in/api/app-users/verify",method:"POST",headers:{"Content-Type":"application/json"},body:{token:"<magic_link_token>"},name:"VerifyMagicLink"})}function bG(e){const{projectId:t,projectSlug:s}=lb(e),n="https://reqres.in/api/app-users/login",a="https://reqres.in/api/app-users/verify",o=JSON.stringify({email:"[email protected]",project_slug:s,...t?{project_id:t}:{}}),i=Pj(s),l=t!==void 0?Pj(t):null,c=l&&l!=="''"?`{ email: '[email protected]', project_slug: ${i}, project_id: ${l} }`:`{ email: '[email protected]', project_slug: ${i} }`;return[{id:"curl",label:"cURL",language:"bash",code:`curl -X POST \\ 3547 -H "Content-Type: application/json" \\ 3548 -H "x-api-key: <public_api_key>" \\ 3549 -d '${o}' \\ 3550 ${n} 3551 3552curl -X POST \\ 3553 -H "Content-Type: application/json" \\ 3554 -d '{ "token": "<magic_link_token>" }' \\ 3555 ${a}`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const login = await fetch('${n}', { 3556 method: 'POST', 3557 headers: { 'Content-Type': 'application/json' }, 3558 body: JSON.stringify(${c}), 3559}); 3560const { token } = await login.json(); 3561 3562const verify = await fetch('${a}', { 3563 method: 'POST', 3564 headers: { 'Content-Type': 'application/json' }, 3565 body: JSON.stringify({ token }), 3566}); 3567const verified = await verify.json(); 3568console.log(verified);`},{id:"react",label:"React",language:"tsx",code:`import { useEffect, useState } from 'react'; 3569 3570export function AppUserAuth() { 3571 const [session, setSession] = useState(null); 3572 3573 useEffect(() => { 3574 const run = async () => { 3575const login = await fetch('${n}', { 3576 method: 'POST', 3577 headers: { 'Content-Type': 'application/json', 'x-api-key': '<public_api_key>' }, 3578 body: JSON.stringify(${c}), 3579}); 3580const { token } = await login.json(); 3581 3582const verify = await fetch('${a}', { 3583 method: 'POST', 3584 headers: { 'Content-Type': 'application/json' }, 3585 body: JSON.stringify({ token }), 3586}); 3587 const sessionResponse = await verify.json(); 3588 setSession(sessionResponse); 3589 }; 3590 3591 run(); 3592 }, []); 3593 3594 return <pre>{JSON.stringify(session, null, 2)}</pre>; 3595} 3596`}]}function yG(e){return $r({url:`https://reqres.in/app/collections/${e||"<collection_slug>"}/records`,method:"GET",headers:{Authorization:"Bearer <app_session_token>"},name:"FetchUserRecords"})}function pEe(){return $r({url:"https://reqres.in/api/app-users/me",method:"GET",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"},name:"GetCurrentAppUser"})}function fEe(e){return $r({url:"https://reqres.in/api/app-users?project_id=YOUR_PROJECT_ID",method:"GET",headers:{"x-api-key":"YOUR_API_KEY"},name:"ListProjectAppUsers"})}function hEe(e){return $r({url:"https://reqres.in/api/projects/YOUR_PROJECT_ID/app-users/total",method:"GET",headers:{"x-api-key":"YOUR_API_KEY"},name:"GetProjectAppUsersTotal"})}function _$(e){const t=e.api_key||"YOUR_API_KEY",s=e.name||"Articles",n=e.slug||"articles",a=e.slug||"YOUR_PROJECT_SLUG",o=e.visibility||"public";return $r({url:"https://reqres.in/api/collections",method:"POST",headers:{"x-api-key":t},body:{name:s,slug:n,project_slug:a,...e.id?{project_id:e.id}:{},visibility:o},name:"CreateCollection"})}function j$(e="<collection_slug>"){return $r({url:`https://reqres.in/app/collections/${e}/records`,method:"POST",headers:{Authorization:"Bearer <app_session_token>"},body:{data:{title:"Hello from ReqRes"}},name:"CreateUserRecord"})}function mEe(e={}){const t=e.apiKey||"YOUR_API_KEY",s=e.slug||"YOUR_PROJECT_SLUG",n=e.path||"todos";return $r({url:`https://reqres.in/api/custom/${s}/${n}`,method:"GET",headers:{"x-api-key":t},name:"ProjectScopedRequest"})}function N5(e={}){const t=e.apiKey||"YOUR_API_KEY",s=e.slug||"orders",n=e.data||'{ "data": { "total": 42, "status": "placed" } }',a=yA({id:e.projectId,slug:e.projectSlug});return $r({url:`https://reqres.in/api/collections/${s}/records${a}`,method:"POST",headers:{"x-api-key":t},body:n,name:"CreateCollectionRecord"})}function _A(e="orders"){return $r({url:`https://reqres.in/app/collections/${e}/records`,method:"GET",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"},name:"FetchAppCollection"})}function gEe(e="todos"){return $r({url:`https://reqres.in/api/collections/${e}/records`,method:"GET",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN","Content-Type":"application/json"},name:"ListTodos"})}function xEe(e="todos"){return $r({url:`https://reqres.in/api/collections/${e}/records`,method:"POST",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN","Content-Type":"application/json"},body:{title:"Ship onboarding",completed:!1,created_at:"<iso_timestamp>",updated_at:"<iso_timestamp>"},name:"CreateTodo"})}function vEe(e="todos"){return $r({url:`https://reqres.in/api/collections/${e}/records/<record_id>`,method:"PATCH",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN","Content-Type":"application/json"},body:{completed:!0,updated_at:"<iso_timestamp>"},name:"ToggleTodo"})}function bEe(e="todos"){return $r({url:`https://reqres.in/api/collections/${e}/records/<record_id>`,method:"DELETE",headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"},name:"DeleteTodo"})}function _G(e={}){const t=e.apiKey||"YOUR_API_KEY",s=e.slug||"<collection_slug>",n=e.query||"",a=yA({id:e.projectId,slug:e.projectSlug},n);return $r({url:`https://reqres.in/api/collections/${s}/records${a}`,method:"GET",headers:{"x-api-key":t},name:"FetchCollectionRecords"})}function yEe(e="",t="products"){const s="YOUR_API_KEY",a=`https://reqres.in/api/custom/${e?`${e}/${t}`:t}`,o=$r({url:a,method:"POST",headers:{"x-api-key":s},body:{name:"Camera",price:199},name:"CreatePersistedRecord"}),i=$r({url:a,method:"GET",headers:{"x-api-key":s},name:"FetchPersistedRecords"});return uEe(o,i)}function k5(e={}){const t=e.apiKey||"YOUR_API_KEY",s=e.limit||20,n=yA({id:e.projectId,slug:e.projectSlug},`limit=${s}`);return $r({url:`https://reqres.in/logs${n}`,method:"GET",headers:{"x-api-key":t},name:"FetchLogs"})}function w$(e={}){const t=e.apiKey||"YOUR_API_KEY",{projectId:s,projectSlug:n}=lb({id:e.projectId,slug:e.projectSlug}),a=e.sourceId||"<collection_slug>",o=e.sourceType||"collection",i=e.event||"record.created";return $r({url:"https://reqres.in/triggers",method:"POST",headers:{"x-api-key":t},body:{project_slug:n,...s?{project_id:s}:{},source_type:o,source_id:a,event:i,action_type:"webhook",action_config:{url:"https://example.com/webhook"}},name:"CreateAutomationTrigger"})}function S5(e={}){const t=e.apiKey||"YOUR_API_KEY",n=`https://reqres.in/api/custom/${e.slug||"<slug>"}`,a=e.limit??1e3,o=e.remaining??999,i=e.reset??60;return[{id:"curl",label:"cURL",language:"bash",code:`curl -I \\ 3597 -H "x-api-key: ${t}" \\ 3598 ${n} 3599 3600# Response headers: 3601# x-ratelimit-limit: ${a} 3602# x-ratelimit-remaining: ${o} 3603# x-ratelimit-reset: ${i}`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const response = await fetch('${n}', { 3604 method: 'GET', 3605 headers: { 'x-api-key': '${t}' }, 3606}); 3607 3608const limit = response.headers.get('x-ratelimit-limit') || '${a}'; 3609const remaining = response.headers.get('x-ratelimit-remaining') || '${o}'; 3610const reset = response.headers.get('x-ratelimit-reset') || '${i}'; 3611 3612console.log({ limit, remaining, reset });`},{id:"react",label:"React",language:"tsx",code:`import { useEffect, useState } from 'react'; 3613 3614export function RateLimitStatus() { 3615 const [limits, setLimits] = useState({ limit: null, remaining: null, reset: null }); 3616 3617 useEffect(() => { 3618 const load = async () => { 3619 const response = await fetch('${n}', { 3620 headers: { 'x-api-key': '${t}' }, 3621 }); 3622 3623 setLimits({ 3624 limit: response.headers.get('x-ratelimit-limit') || '${a}', 3625 remaining: response.headers.get('x-ratelimit-remaining') || '${o}', 3626 reset: response.headers.get('x-ratelimit-reset') || '${i}', 3627 }); 3628 }; 3629 3630 load(); 3631 }, []); 3632 3633 return <pre>{JSON.stringify(limits, null, 2)}</pre>; 3634} 3635`}]}function jG(e,t="orders"){const{projectId:s,projectSlug:n}=lb(e),a="https://reqres.in/api/app-users/login",o="https://reqres.in/api/app-users/verify",i=`https://reqres.in/app/collections/${t}/records`,l=JSON.stringify({email:"[email protected]",project_slug:n,...s?{project_id:s}:{}}),c=Pj(n),u=s!==void 0?Pj(s):null,f=u&&u!=="''"?`{ email: '[email protected]', project_slug: ${c}, project_id: ${u} }`:`{ email: '[email protected]', project_slug: ${c} }`;return[{id:"curl",label:"cURL",language:"bash",code:`curl -X POST \\ 3636 -H "Content-Type: application/json" \\ 3637 -d '${l}' \\ 3638 ${a} 3639 3640curl -X POST \\ 3641 -H "Content-Type: application/json" \\ 3642 -d '{ "token": "<magic_link_token>" }' \\ 3643 ${o} 3644 3645curl -X GET \\ 3646 -H "Authorization: Bearer YOUR_SESSION_TOKEN" \\ 3647 ${i}`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const login = await fetch('${a}', { 3648 method: 'POST', 3649 headers: { 'Content-Type': 'application/json' }, 3650 body: JSON.stringify(${f}), 3651}); 3652const { token } = await login.json(); 3653 3654const verify = await fetch('${o}', { 3655 method: 'POST', 3656 headers: { 'Content-Type': 'application/json' }, 3657 body: JSON.stringify({ token }), 3658}); 3659const { session_token } = await verify.json(); 3660 3661const recordsResponse = await fetch('${i}', { 3662 headers: { Authorization: 'Bearer ' + session_token }, 3663}); 3664const records = await recordsResponse.json(); 3665console.log(records);`},{id:"react",label:"React",language:"tsx",code:`import { useEffect, useState } from 'react'; 3666 3667export function AppUserFlow() { 3668 const [records, setRecords] = useState(null); 3669 3670 useEffect(() => { 3671 const run = async () => { 3672 const login = await fetch('${a}', { 3673 method: 'POST', 3674 headers: { 'Content-Type': 'application/json' }, 3675 body: JSON.stringify(${f}), 3676 }); 3677 const { token } = await login.json(); 3678 3679 const verify = await fetch('${o}', { 3680 method: 'POST', 3681 headers: { 'Content-Type': 'application/json' }, 3682 body: JSON.stringify({ token }), 3683 }); 3684 const { session_token } = await verify.json(); 3685 3686 const recordsResponse = await fetch('${i}', { 3687 headers: { Authorization: 'Bearer ' + session_token }, 3688 }); 3689 const data = await recordsResponse.json(); 3690 setRecords(data); 3691 }; 3692 3693 run(); 3694 }, []); 3695 3696 return <pre>
3696{JSON.stringify(records, null, 2)}</pre>; 3697} 3698`}]}function _Ee(e="orders"){return[{id:"javascript",label:"Next.js API Route",language:"javascript",code:`// pages/api/orders.js 3699export default async function handler(req, res) { 3700 const response = await fetch('${`https://reqres.in${`/api/collections/${e}/records`}`}', { 3701 method: req.method || 'GET', 3702 headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.REQRES_API_KEY }, 3703 body: req.method !== 'GET' ? JSON.stringify(req.body || {}) : undefined, 3704 }); 3705 const data = await response.json(); 3706 res.status(response.status).json(data); 3707}`}]}function jEe(e="orders"){return[{id:"javascript",label:"Vanilla JS",language:"javascript",code:`fetch('${`https://reqres.in/api/collections/${e}/records`}', { 3708 headers: { 'x-api-key': 'YOUR_API_KEY' }, 3709}) 3710 .then(res => res.json()) 3711 .then(console.log) 3712 .catch(console.error);`}]}function wEe(e="orders"){return[{id:"javascript",label:"Cypress",language:"javascript",code:`cy.request({ 3713 method: 'GET', 3714 url: '${`https://reqres.in/api/collections/${e}/records`}', 3715 headers: { 'x-api-key': Cypress.env('REQRES_API_KEY') || 'YOUR_API_KEY' } 3716}).then((response) => { 3717 expect(response.status).to.eq(200); 3718});`}]}function NEe(e="orders"){return[{id:"javascript",label:"Playwright",language:"javascript",code:`import { test, expect, request } from '@playwright/test'; 3719 3720test('fetch records', async () => { 3721 const api = await request.newContext(); 3722 const response = await api.get('${`https://reqres.in/api/collections/${e}/records`}', { 3723 headers: { 'x-api-key': process.env.REQRES_API_KEY || 'YOUR_API_KEY' }, 3724 }); 3725 expect(response.ok()).toBeTruthy(); 3726 const data = await response.json(); 3727 console.log(data); 3728});`}]}function kEe(e="books",t="book_id",s=101){const n=JSON.stringify({[t]:s}),a=encodeURIComponent(n),o=`https://reqres.in/api/collections/${e}/records?project_id=<project_id>&data_contains=${a}`;return $r({url:o,method:"GET",headers:{"x-api-key":"YOUR_API_KEY"},name:"FilterRecordsByData"})}function SEe(e="books"){const t=JSON.stringify({author:"F. Scott Fitzgerald",status:"published"}),s=encodeURIComponent(t),n=`https://reqres.in/api/collections/${e}/records?project_id=<project_id>&data_contains=${s}`;return $r({url:n,method:"GET",headers:{"x-api-key":"YOUR_API_KEY"},name:"FilterRecordsByMultipleFields"})}function CEe(e={}){const t=e.apiKey||"YOUR_API_KEY",s=e.name||"Books",n=e.slug||"books";return $r({url:"https://reqres.in/api/collections",method:"POST",headers:{"x-api-key":t},body:{name:s,slug:n,project_id:e.projectId||"YOUR_PROJECT_ID",visibility:"private",schema:{type:"object",properties:{book_id:{type:"number"},title:{type:"string"},author:{type:"string"},status:{type:"string",enum:["draft","published"]}},required:["book_id","title"]}},name:"CreateCollectionWithSchema"})}function EEe(){return JSON.stringify({id:"abc-123-def-456",collection_id:"<collection_id>",project_id:"YOUR_PROJECT_ID",app_user_id:"<app_user_id>",created_at:"2025-01-30T10:00:00Z",updated_at:"2025-01-30T10:00:00Z",data:{book_id:101,title:"The Great Gatsby",author:"F. Scott Fitzgerald",status:"published"}},null,2)}const TEe={GET:"text-sky-200 bg-sky-500/10 border-sky-500/30",POST:"text-emerald-200 bg-emerald-500/10 border-emerald-500/30",PUT:"text-amber-200 bg-amber-500/10 border-amber-500/30",PATCH:"text-amber-200 bg-amber-500/10 border-amber-500/30",DELETE:"text-rose-200 bg-rose-500/10 border-rose-500/30"},REe={"Project API key":"text-indigo-200 bg-indigo-500/10 border-indigo-500/30","App user Bearer token":"text-amber-200 bg-amber-500/10 border-amber-500/30",Public:"text-[var(--color-fg-default)] bg-[var(--color-bg-alt)] border-[var(--color-border-default)]"},AEe=e=>typeof e=="string"?e:JSON.stringify(e,null,2);function PEe({method:e}){return r.jsx("span",{className:`inline-flex items-center rounded-md border px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide ${TEe[e]}`,children:e})}function IEe({auth:e}){return r.jsx("span",{className:`inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium ${REe[e]}`,children:e})}function Uu({title:e,value:t}){return t===void 0?null:r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:e}),r.jsx("pre",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-3 py-2 text-[11px] text-[var(--color-fg-default)] overflow-auto",children:AEe(t)})]})}function qn({label:e="Show code",defaultOpen:t=!1,...s}){const[n,a]=x.useState(t),o=["max-h-[340px] overflow-auto",s.className].filter(
3728Boolean).join(" ");return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:s.title||"Code"}),r.jsx("button",{type:"button",className:`text-xs px-3 py-1 rounded-md border transition ${n?"border-[#5561FF]/60 bg-[#5561FF]/10 text-[var(--color-fg-default)]":"border-[var(--color-border-default)] text-[var(--color-fg-secondary)] hover:border-[#5561FF]/60"}`,onClick:()=>a(i=>!i),children:n?"Hide code":e})]}),n&&r.jsx("div",{className:"mt-3",children:r.jsx(Vt,{...s,className:o})})]})}function MEe({endpoint:e}){var o,i;const t=(o=e.responses)==null?void 0:o[0],s=(i=e.responses)==null?void 0:i[1],[n,a]=x.useState(!1);return r.jsx(Ht,{className:"surface-card elevation-1 hover:elevation-2 transition-all duration-150",children:r.jsxs("div",{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(PEe,{method:e.method}),r.jsx("code",{className:"rounded-md bg-[var(--color-bg-code)] px-2.5 py-1 text-[12px] text-[var(--color-fg-default)] border border-[var(--color-border-secondary)]",children:e.path}),r.jsx(IEe,{auth:e.auth})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:e.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] leading-relaxed",children:e.description})]}),e.notes&&e.notes.length>0&&r.jsx("ul",{className:"list-disc pl-5 text-[11px] text-[var(--color-fg-muted)] space-y-1",children:e.notes.map(l=>r.jsx("li",{children:l},l))})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.request&&r.jsxs("div",{className:"space-y-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:"Request"}),r.jsx(Uu,{title:"Headers",value:e.request.headers}),r.jsx(Uu,{title:"Query",value:e.request.query}),r.jsx(Uu,{title:"Payload",value:e.request.body})]}),t&&r.jsxs("div",{className:"space-y-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3",children:[r.jsxs("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:["Response ",t.status,t.description?` · ${t.description}`:""]}),r.jsx(Uu,{title:"Body",value:t.body}),s&&r.jsx(Uu,{title:`Alt response ${s.status}${s.description?` · ${s.description}`:""}`,value:s.body})]})]}),e.variants&&e.variants.length>0&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:"Code"}),r.jsxs("button",{type:"button",className:`text-[11px] px-3 py-1 rounded-md border transition ${n?"border-[#5561FF]/50 bg-[#5561FF]/10 text-[var(--color-fg-default)]":"border-[var(--color-border-default)] text-[var(--color-fg-secondary)] hover:border-[#5561FF]/50"}`,onClick:()=>a(l=>!l),children:[n?"Hide":"Show"," code"]})]}),n&&r.jsx(Vt,{title:"Code",variants:e.variants,className:"mt-1"})]})]})})}const zg=[{id:"projects",title:"Projects",summary:"Project slug + API key scope every custom endpoint call."},{id:"app-users",title:"App Users",summary:"Email login codes â verify â session tokens for end-user authenticated calls."},{id:"collections",title:"Collections",summary:"Schema-backed data for your project; works with admin keys and app tokens."},{id:"custom-endpoints",title:"Custom endpoints",summary:"Blueprint or bespoke endpoints under /api/custom/<path> (project key scoped)."},{id:"logs",title:"Logs",summary:"Inspect every request with project_id filters."},{id:"automations",title:"Automations",summary:"Webhook triggers fired on collection events."},{id:"platform",title:"Platform & limits",summary:"Rate limits and headers across the platform."}
3728],m2=[{id:"api-key",title:"Where is my API key?",preview:"Project and manage keys live in API Keys.",anchor:"api-key-location",parentSection:"auth-sessions"},{id:"key-types",title:"Public key vs Manage key vs Session token",preview:"Which header to send and when.",anchor:"key-types",parentSection:"auth-sessions"},{id:"401",title:"Getting a 401? (Missing Authorization)",preview:"Use Authorization: Bearer YOUR_SESSION_TOKEN instead of x-api-key.",anchor:"error-401",parentSection:"error-codes"},{id:"403",title:"Getting a 403 or blocked by Cloudflare?",preview:"Rotate the key, avoid empty headers, and retry.",anchor:"error-403",parentSection:"error-codes"},{id:"429",title:"Getting a 429? (Rate limits & retry-after)",preview:"Back off and respect Retry-After before retrying.",anchor:"error-429",parentSection:"error-codes"},{id:"collection-first-record",title:"Create a collection + write your first record",preview:"Create slug then POST with x-api-key or session token.",anchor:"collections-first-write",parentSection:"collections-reference"},{id:"record-ids",title:"How do record IDs work?",preview:"System UUID vs your custom fields in data.",anchor:"record-structure",parentSection:"collections-reference"},{id:"filter-records",title:"Filter records by data fields",preview:"Use data_contains with JSON to query by your fields.",anchor:"record-filtering",parentSection:"collections-reference"},{id:"schema-validation",title:"Add schema validation to a collection",preview:"Enforce structure with JSON Schema on writes.",anchor:"collection-schema",parentSection:"collections-reference"}],OEe=[{id:"error-401",title:"401 - Missing Authorization",summary:"You used x-api-key but the endpoint needs a session token from the login-code flow.",fix:"Exchange the email code at /api/app-users/verify and send Authorization: Bearer YOUR_SESSION_TOKEN.",variants:_A("orders"),extra:r.jsx(qn,{title:"Verify token",variants:o1(),label:"See verify request"})},{id:"error-403",title:"403 - Blocked / invalid key",summary:"Invalid or revoked key, or a WAF block from empty headers.",fix:"Regenerate the project key in API Keys and ensure every header has a value.",variants:[{id:"curl",label:"curl",language:"bash",code:`curl -H "x-api-key: YOUR_API_KEY" \\ 3729 -H "Content-Type: application/json" \\ 3730 https://reqres.in/api/collections/orders/records?project_id=YOUR_PROJECT_ID`}]},{id:"error-429",title:"429 - Rate limited",summary:"Too many requests too quickly.",fix:"Read Retry-After, wait, and retry with small jitter.",variants:[{id:"javascript",label:"JavaScript",language:"javascript",code:`async function callWithBackoff(url, opts) { 3731 const res = await fetch(url, opts); 3732 if (res.status !== 429) return res; 3733 const retryAfter = Number(res.headers.get('retry-after') || 1); 3734 await new Promise(r => setTimeout(r, (retryAfter + 0.5) * 1000)); 3735 return callWithBackoff(url, opts); 3736}`}]},{id:"error-400",title:"400 - Missing env header",summary:"Some project endpoints need X-Reqres-Env: prod|dev.",fix:"Send X-Reqres-Env: prod (or dev) with your project key.",variants:[{id:"curl",label:"curl",language:"bash",code:`curl -X POST https://reqres.in/api/collections/todos/records?project_id=YOUR_PROJECT_ID \\ 3737 -H "x-api-key: YOUR_API_KEY" \\ 3738 -H "X-Reqres-Env: prod" \\ 3739 -H "Content-Type: application/json" \\ 3740 -d '{ "data": { "title": "Prod write" } }'`}]}],LEe=[{id:"curl",label:"curl",language:"bash",code:'curl -H "x-api-key: YOUR_KEY" https://reqres.in/api/users?page=2'}];function DEe(){Mn("Docs");const[e,t]=x.useState(new Set(["error-codes"])),[s,n]=x.useState(""),[a,o]=x.useState([]),[i,l]=Wa(),c=i.get("section"),u=x.useRef({});x.useEffect(()=>{Z.track("documentation_viewed")},[]);const f=O=>z=>{z&&(u.current[O]=z)},h=O=>{var W,K;const z=u.current[O];if(!z)return;const X=(K=(W=window.matchMedia)==null?void 0:W.call(window,"(prefers-reduced-motion: reduce)"))==null?void 0:K.matches;z.scrollIntoView({behavior:X?"auto":"smooth",block:"start"})};x.useEffect(()=>{var W;if(!c)return;const O=(W=m2.find(K=>K.anchor===c))==null?void 0:W.parentSection,z=zg.find(K=>K.id===c);t(K=>{const q=new Set(K);return z&&q.add("api-reference"),O&&q.add(O),q.add(c),q}),z&&o([z.id]);const X=window.requestAnimationFrame(()=>h(c));return()=>window.cancelAnimationFrame(X)},[c]);const g=s.trim().toLowerCase(),v=O=>!g||O.toLowerCase().includes(g),y=O=>{t(z=>{const X=new Set(z);return X.has(O)?X.delete(O):X.add(O),X})},_=x.useMemo(()=>[{id:"projects-scope",objectId:"projects",title:"Project-scoped request",method:"GET",path:"/api/custom/<path>",auth:"Project API key",description:"Call any custom endpoint for a project using the x-api-key header; optional project_slug prefix is trimmed if present.",request:{headers:{"x-api-key":"YOUR_API_KEY"}},responses:[{status:200,body:{data:[{id:1,title:"Hello from ReqRes"}]}}],variants:mEe(),notes:["Use server-side requests to keep the project key secret."]},{id:"app-users-login",objectId:"app-users",title:"Send login code (email)",method:"POST",path:"/api/app-users/login",auth:"Project API key",description:"Send a one-time login code to the supplied email for this project.",request:{headers:{"Content-Type":"application/json","x-api-key":"<public_project_api_key>"},body:{email:"[email protected]",project_id:"YOUR_PROJECT_ID"}},responses:[{status:200,body:{data:{sent:!0,expires_in_minutes:15,message:"Magic code sent"}}},{status:429,description:"Limit reached",body:{error:"app_user_limit_reached",message:"Upgrade your plan"}}],variants:Ij(),notes:["Uses the Public project key; safe from the browser.","In MAGIC_LINK_TEST_MODE (no email), the token is returned in the response for testing."]},{id:"app-users-verify",objectId:"app-users",title:"Verify login code",method:"POST",path:"/api/app-users/verify",auth:"Public",de
3740scription:"Exchange the emailed code for a session_token bound to the project.",request:{headers:{"Content-Type":"application/json"},body:{token:"<login_code>"}},responses:[{status:200,body:{session_token:"YOUR_SESSION_TOKEN",app_user:{id:"YOUR_APP_USER_ID",email:"[email protected]",status:"active"}}},{status:400,description:"Expired or already used token",body:{error:"invalid_token",message:"Token expired"}}],variants:o1(),notes:["Store the session_token to call /app/collections and /api/app-users/me."]},{id:"app-users-me",objectId:"app-users",title:"Get current app user",method:"GET",path:"/api/app-users/me",auth:"App user Bearer token",description:"Use the session_token to fetch the active app user plus metadata.",request:{headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"}},responses:[{status:200,body:{id:"YOUR_APP_USER_ID",email:"[email protected]",project_id:"YOUR_PROJECT_ID",status:"active",metadata:{plan:"pro"}}},{status:401,description:"Missing/expired session",body:{error:"invalid_session",message:"Session token is expired"}}],variants:pEe(),notes:["Does not return profile; use admin GET /api/app-users/<id> for profile fields."]},{id:"app-users-list",objectId:"app-users",title:"List app users (admin)",method:"GET",path:"/api/app-users?project_id=YOUR_PROJECT_ID",auth:"Project API key",description:"Admin view of app users for a project. Supports pagination, filters, and includes metadata/profile fields.",request:{headers:{"x-api-key":"YOUR_API_KEY"},query:{project_id:"YOUR_PROJECT_ID",limit:50}},responses:[{status:200,body:{data:[{id:"YOUR_APP_USER_ID",email:"[email protected]",status:"active",metadata:{plan:"pro"}},{id:"<app_user_id_2>",email:"[email protected]",status:"pending",profile:{name:"Demo User"}}]}}],variants:fEe(),notes:["Returns metadata and profile for each app user in the project scope.","Use query params like limit and email to filter results."]},{id:"app-users-total",objectId:"app-users",title:"Count app users",method:"GET",path:"/api/projects/YOUR_PROJECT_ID/app-users/total",auth:"Project API key",description:"Return the total number of app users for a project. Accepts public or manage project keys.",request:{headers:{"x-api-key":"<public_project_api_key>"}},responses:[{status:200,body:{total:42}}],variants:hEe(),notes:["Counts app users for the resolved environment (prod/dev).","Set X-Reqres-Env to switch environments when needed."]},{id:"app-users-get",objectId:"app-users",title:"Get app user (admin)",method:"GET",path:"/api/app-users/YOUR_APP_USER_ID",auth:"Project API key",description:"Admin fetch of a single app user. Returns metadata and profile when present.",request:{headers:{"x-api-key":"YOUR_API_KEY"},query:{project_id:"YOUR_PROJECT_ID"}},responses:[{status:200,body:{data:{id:"YOUR_APP_USER_ID",email:"[email protected]",status:"active",project_id:"YOUR_PROJECT_ID",metadata:{plan:"pro"},profile:{locale:"en-GB"}}}},{status:404,body:{error:"App user not found"}}],notes:["Use project_id to scope to the right project; profile is only returned here."]},{id:"app-users-update",objectId:"app-users",title:"Update app user (admin)",method:"PUT",path:"/api/app-users/YOUR_APP_USER_ID",auth:"Project API key",description:"Update email, status, metadata, or profile for an app user.",request:{headers:{"x-api-key":"YOUR_API_KEY","Content-Type":"application/json"},body:{email:"[email protected]",status:"active",metadata:{role:"beta"},profile:{locale:"en-GB",avatar:"https://example.com/avatar.png"}}},responses:[{status:200,body:{data:{id:"YOUR_APP_USER_ID",email:"[email protected]",status:"active",metadata:{role:"beta"},profile:{locale:"en-GB",avatar:"https://example.com/avatar.png"}}}},{status:400,description:"Validation error",body:{error:"metadata must be an object"}}],notes:["profile accepts any JSON object; /api/app-users/me does not return profile today."]},{id:"collections-create",objectId:"collections",title:"Create a collection",method:"POST",path:"/api/collections",auth:"Project API key",description:"Define a new collection with slug, visibility, and optional schema.",request:{headers:{"x-api-key":"YOUR_API_KEY"},body:{name:"Orders",slug:"orders",project_id:"YOUR_PROJECT_ID",visibility:"private",schema:{type:"object",properties:{total:{type:"number"}}}}},responses:[{status:201,body:{id:"<collection_id>",slug:"orders",visibility:"private",schema:{type:"object"}}}],variants:_$({api_key:"YOUR_API_KEY",id:"YOUR_PROJECT_ID",name:"Orders",slug:"orders",visibility:"private"}),notes:["Project API keys already scope the request; include project_id only when using a user/multi key. /api/collections ignores project_slug."]},{id:"collections-admin-create-record",objectId:"collections",title:"Create record (admin key)",method:"POST",path:"/api/collections/<slug>/records?project_id=YOUR_PROJECT_ID",auth:"Project API key",description:"Admin write into any collection with project scoping.",request:{headers:{"x-api-key":"YOUR_API_KEY"},body:{data:{total:42,status:"placed"}},query:{project_id:"YOUR_PROJECT_ID"}},responses:[{status:201,body:{id:"YOUR_RECORD_ID",collection:"orders",data:{total:42,status:"placed"}}}],variants:N5({apiKey:"YOUR_API_KEY",slug:"orders",projectId:"YOUR_PROJECT_ID"}),notes:["Project API keys already include project context-omit project_id for project-scoped keys. /api/collections does not read project_slug."]},{id:"collections-admin-list-records",objectId:"collections",title:"List records (admin key)",method:"GET",path:"/api/collections/<slug>/records?project_id=YOUR_PROJECT_ID",auth:"Project API key",description:"Admin read with optional filtering and pagination.",request:{headers:{"x-api-key":"YOUR_API_KEY"},query:{project_id:"YOUR_PROJECT_ID",limit:25}},responses:[{status:200,body:{data:[{id:"YOUR_RECORD_ID",data:{total:42,status:"placed"}}],pagination:{limit:25,offset:0}}}],variants:_G({apiKey:"YOUR_API_KEY",slug:"orders",projectId:"YOUR_PROJECT_ID"}),notes:["If you are using a user/multi API key, send project_id. With a project-scoped key you can skip project_id; project_slug is ignored on this route."]},{id:"collections-app-read",objectId:"collections",title:"Read records (app user)",method:"GET",path:"/app/collections/<slug>/records",auth:"App user Bearer token",description:"End-user read. Records are automatically scoped to the session token and project. Public key GETs only return rows without an app_user_id.",request:{headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"}},responses:[{status:200,body:{data:[{id:"YOUR_RECORD_ID",data:{total:42,status:"placed"}}]}}],notes:["GET only for public keys. When using x-api-key with the project public key, only records with app_user_id = null are returned."],variants:_A("orders")},{id:"collections-app-create",objectId:"collections",title:"Create record (app user)",method:"POST",path:"/app/collections/<slug>/records",auth:"App user Bearer token",description:"End-user write. Data is tied to the logged-in app user.",request:{headers:{Authorization:"Bearer YOUR_SESSION_TOKEN"},body:{data:{title:"Hello from ReqRes"}}},responses:[{status:201,body:{id:"YOUR_RECORD_ID",data:{title:"Hello from ReqRes"},app_user_id:"YOUR_APP_USER_ID"}},{status:403,description:"Collection not public",body:{error:"forbidden",message:"Collection is private"}}],variants:j$("orders")},{id:"custom-endpoints",objectId:"custom-endpoints",title:"Custom endpoint (persisted optional)",method:"POST",path:"/api/custom/<path>",auth:"Project API key",description:"Attach template endpoints or build your own under /api/custom. Toggle persistence to ship quickly.",request:{headers:{"x-api-key":"YOUR_API_KEY"},body:{name:"Camera",price:199}},responses:[{status:200,body:{id:123,name:"Camera",price:199}}],variants:yEe("<project_slug>","products"),notes:["Project slug prefix is optional; requests still require the correct project key.","Use any HTTP method;
3740 persisted endpoints show up in Data Explorer."]},{id:"logs-list",objectId:"logs",title:"Fetch request logs",method:"GET",path:"/logs?project_id=YOUR_PROJECT_ID&limit=<n>",auth:"Project API key",description:"Pull recent request/response summaries for monitoring or debugging.",request:{headers:{"x-api-key":"YOUR_API_KEY"},query:{project_id:"YOUR_PROJECT_ID",limit:20}},responses:[{status:200,body:{data:[{id:1,method:"GET",path:"/app/collections/orders/records",status:200},{id:2,method:"POST",path:"/api/app-users/login",status:200}]}}],variants:k5()},{id:"automations-trigger",objectId:"automations",title:"Create a webhook trigger",method:"POST",path:"/triggers",auth:"Project API key",description:"Fire a webhook when a record is created in a collection.",request:{headers:{"x-api-key":"YOUR_API_KEY"},body:{project_id:"YOUR_PROJECT_ID",source_type:"collection",source_id:"<collection_slug>",event:"record.created",action_type:"webhook",action_config:{url:"https://example.com/webhook"}}},responses:[{status:201,body:{id:"<trigger_id>",event:"record.created",status:"active",action_type:"webhook"}}],variants:w$()},{id:"rate-limits",objectId:"platform",title:"Rate limit headers",method:"GET",path:"/api/custom/<path>",auth:"Project API key",description:"All endpoints return standard rate limit headers so you can throttle gracefully.",request:{headers:{"x-api-key":"YOUR_API_KEY"}},responses:[{status:"200 + headers",body:{"x-ratelimit-limit":1e3,"x-ratelimit-remaining":999,"x-ratelimit-reset":60}}],variants:S5(),notes:["Headers: x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset (seconds)."]}],[]),j=x.useMemo(()=>zg.reduce((O,z)=>(O[z.id]=z,O),{}),[]),w=x.useMemo(()=>_.filter(O=>{var W;return a.length===0||a.includes(O.objectId)?g?`${O.title} ${O.path} ${O.description} ${O.method} ${O.auth} ${((W=j[O.objectId])==null?void 0:W.title)||""}`.toLowerCase().includes(g):!0:!1}),[_,g,a,j]),k=x.useMemo(()=>w.reduce((O,z)=>(O[z.objectId]=O[z.objectId]||[],O[z.objectId].push(z),O),{}),[w]),S=zg.filter(O=>{var z;return a.length?a.includes(O.id):(z=k[O.id])==null?void 0:z.length}),E=[{id:"error-codes",title:"Error codes & fixes",summary:"Fast fixes for 401/403/429 and environment headers.",keywords:["errors","401","403","429","env","cloudflare","retry"],content:r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Diagnose the common blockers in under a minute. Jump from the cards above or open a fix below."}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:OEe.map(O=>r.jsxs(Ht,{id:O.id,ref:f(O.id),className:"p-5 surface-card elevation-1 space-y-3 border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:O.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] leading-relaxed",children:O.summary}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:O.fix})]}),O.variants&&r.jsx(qn,{title:"Fix snippet",variants:O.variants,label:"Show snippet"}),O.extra]},O.id))})]})},{id:"auth-sessions",title:"Auth & sessions",summary:"Keys vs session tokens, login flow, and API key location.",badge:"Popular",keywords:["auth","api key","session token","public key","manage key","login","magic link"],content:r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{id:"api-key-location",ref:f("api-key-location"),className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-5 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-semibold",children:"API keys live under API Keys"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Each project ships with a Manage key (server/admin) and a Public key (browser GET). Rotate or create keys on the API Keys page."})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(ht,{variant:"outline",size:"sm",asChild:!0,className:"border-[#5561FF] text-[var(--color-fg-default)] hover:bg-[#5561FF]/10",children:r.jsx("a",{href:"/api-keys",children:"Open API Keys"})}),r.jsx(ht,{variant:"ghost",size:"sm",asChild:!0,className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",children:r.jsx("a",{href:"/getting-started",children:"Getting started"})})]})]}),r.jsxs("div",{id:"key-types",ref:f("key-types"),className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Keys vs tokens"}),r.jsx("span",{className:"rounded-full border border-[#5561FF]/40 bg-[#5561FF]/10 px-3 py-1 text-[11px] text-[var(--color-fg-default)]",children:"Popular"})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Manage key (server) for admin writes, Public key for safe browser reads, session_token for end-user calls after verify."}),r.jsx(nEe,{})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs(Ht,{className:"p-5 surface-card elevation-1",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-2",children:"Project API key"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Admin-only operations: create projects, collections, automations, fetch logs, and call custom endpoints. Keep this on the server."}),r.jsx(Uu,{title:"Header",value:{"x-api-key":"YOUR_API_KEY"}})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-2",children:"App user session token"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Returned from ",r.jsx("code",{children:"/api/app-users/verify"}),". Use it for"," ",r.jsx("code",{children:"/app/collections"})," and ",r.jsx("code",{children:"/api/app-users/me"}),"."]}),r.jsx(Uu,{title:"Header",value:{Authorization:"Bearer YOUR_SESSION_TOKEN"}})]})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-3",children:[r.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Login code â session token"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Fast path to avoid 401s"})]}),r.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/app-users/login"})," with email + project_id using your public project key."]}),r.jsx("li",{children:"User receives a one-time code (or returned in test mode)."}),r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/app-users/verify"})," with the code â returns"," ",r.jsx("code",{children:"session_token"}),"."]}),r.jsxs("li",{children:["Use ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})," on"," ",r.jsx("code",{children:"/app/collections"})," calls."]})]}),r.jsx(qn,{title:"Exchange login code for session_token",variants:jG(void 0,"orders"),label:"See flow code"})]})]})},{id:"collections-reference",title:"Collections API",summary:"Create collections, then write/read with keys or session tokens.",badge:"Popular",keywords:["collections","records","project","create","write","read","app user","filter","data_contains","schema","id","primary key"],content:r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{id:"collections-first-write",ref:f("collections-first-write"),className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4 space-y-2",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-semibold",children:"Create a collection + first record"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Create the slug, write with your project key, then let app users read/write with their session_token."}),r.jsxs("ul",{className:"list-disc pl-5 text-xs text-[var(--color-fg-muted)] space-y-1",children:[r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/collections"})," with name + slug."]}),r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/collections/:slug/records"})," with",r.jsx("code",{children:"x-api-key"})," (add project_id if needed)."]}),r.jsxs("li",{children:["End-users call ",r.jsx("code",{children:"/app/collections/:slug/records"})," with"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"}),"."]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(qn,{title:"Create a collection",variants:_$({api_key:"YOUR_API_KEY",id:"YOUR_PROJECT_ID",name:"Orders",slug:"orders",visibility:"private"}),label:"Show create example"}),r.jsx(qn,{title:"Write first record",variants:N5({apiKey:"YOUR_API_KEY",slug:"orders",projectId:"YOUR_PROJECT_ID"}),label:"Show write example"})]}
3740),r.jsxs("div",{id:"record-structure",ref:f("record-structure"),className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Record structure"}),r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"System ID vs your data fields"})]}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Every record gets an auto-generated ",r.jsx("code",{children:"id"})," (UUID). Your custom fields live inside the ",r.jsx("code",{children:"data"})," object. Use the system ",r.jsx("code",{children:"id"})," for updates and deletes; use your own fields (like ",r.jsx("code",{children:"book_id"}),") as business identifiers."]}),r.jsx("pre",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-4 py-3 text-[12px] text-[var(--color-fg-default)] overflow-auto",children:EEe()}),r.jsxs("ul",{className:"list-disc pl-5 text-xs text-[var(--color-fg-muted)] space-y-1",children:[r.jsxs("li",{children:[r.jsx("code",{children:"id"})," - System-generated UUID, used for"," ",r.jsx("code",{children:"GET/PUT/DELETE /records/:id"})]}),r.jsxs("li",{children:[r.jsx("code",{children:"data"})," - Your custom JSON object with any fields you need"]}),r.jsxs("li",{children:[r.jsx("code",{children:"app_user_id"})," - Set automatically when using session tokens"]})]})]}),r.jsxs("div",{id:"record-filtering",ref:f("record-filtering"),className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Filtering records"}),r.jsxs("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:["Query by data fields with ",r.jsx("code",{children:"data_contains"})]})]}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Use the ",r.jsx("code",{children:"data_contains"})," query parameter to filter records by fields inside ",r.jsx("code",{children:"data"}),". Pass a URL-encoded JSON object."]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(qn,{title:"Filter by single field",variants:kEe("books","book_id",101),label:"Show filter example",defaultOpen:!0}),r.jsx(qn,{title:"Filter by multiple fields",variants:SEe("books"),label:"Show multi-filter example"})]}),r.jsx("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/5 p-3",children:r.jsxs("p",{className:"text-xs text-amber-200",children:[r.jsx("strong",{children:"Note:"})," The filter uses JSON containment (",r.jsx("code",{children:"@>"}),"), so the record's ",r.jsx("code",{children:"data"})," must contain all specified fields. Other query params:"," ",r.jsx("code",{children:"search"})," (text search), ",r.jsx("code",{children:"created_after"}),","," ",r.jsx("code",{children:"created_before"}),", ",r.jsx("code",{children:"page"}),","," ",r.jsx("code",{children:"limit"}),", ",r.jsx("code",{children:"order"}),"."]})})]}),r.jsxs("div",{id:"collection-schema",ref:f("collection-schema"),className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Schema validation"}),r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Enforce structure with JSON Schema"})]}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Attach a JSON Schema to your collection to validate record data on every write. Invalid payloads are rejected with a ",r.jsx("code",{children:"400"})," ","error."]}),r.jsx(qn,{title:"Create collection with schema",variants:CEe({apiKey:"YOUR_API_KEY",projectId:"YOUR_PROJECT_ID",name:"Books",slug:"books"}),label:"Show schema example",defaultOpen:!0}),r.jsxs("ul",{className:"list-disc pl-5 text-xs text-[var(--color-fg-muted)] space-y-1",children:[r.jsxs("li",{children:["Use ",r.jsx("code",{children:"required"})," to enforce mandatory fields"]}),r.jsxs("li",{children:["Use ",r.jsx("code",{children:"enum"})," to restrict values (e.g., status: draft | published)"]}),r.jsx("li",{children:"Schema is optional - omit it for flexible/schemaless collections"}),r.jsxs("li",{children:["Update schema via ",r.jsx("code",{children:"PUT /api/collections/:slug"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-2",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"App user reads/writes"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Tie rows to the logged-in app user with session_token; public keys only return rows without an app_user_id."}
3740),r.jsx(qn,{title:"App user write",variants:j$("orders"),label:"Show app user example"})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-2",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Environments"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Every project has prod + dev. Send"," ",r.jsx("code",{children:"X-Reqres-Env: dev"})," to test safely; prod is the default. Missing the header on dev routes returns a 400."]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Tip: pin dev keys in CI and add the header; for prod remove the header or set ",r.jsx("code",{children:"prod"}),"."]})]})]})]})},{id:"logs-reference",title:"Logs API",summary:"Inspect every request with project filters.",keywords:["logs","debug","requests","monitoring"],content:r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Debug traffic or tests by pulling recent requests. Filter by project_id and limit."}),r.jsx(qn,{title:"Fetch request logs",variants:k5(),label:"Show logs snippet"})]})},{id:"automations-reference",title:"Automations API",summary:"Webhook triggers on collection events.",keywords:["automations","webhook","triggers","record.created"],content:r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Fire webhooks when records change. Create triggers with your project key and collection slug."}),r.jsx(qn,{title:"Create a webhook trigger",variants:w$(),label:"Show automation snippet"})]})},{id:"rate-limits",title:"Rate limits & reliability",summary:"Headers, retries, and plan expectations.",keywords:["rate limit","429","retry","headers","reliability"],content:r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"All endpoints return standard headers so you can throttle on the client. Combine with the 429 backoff example above."}),r.jsx(qn,{title:"Rate limit headers",variants:S5(),label:"Show headers"})]})},{id:"frameworks-qa",title:"Frameworks & QA snippets",summary:"Postman/Bruno/Cypress usage and ready-to-run snippets.",keywords:["QA","Cypress","Playwright","Next.js","Bruno","Postman"],content:r.jsxs("div",{id:"qa-snippets",ref:f("qa-snippets"),className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Predictable JSON and logs make automation easy. Avoid empty headers and add tiny delays to steer clear of 429s."}),r.jsxs("ul",{className:"list-disc pl-5 text-xs text-[var(--color-fg-muted)] space-y-1",children:[r.jsx("li",{children:"Avoid empty headers (can trigger WAF)."}),r.jsx("li",{children:"Use small delays or respect Retry-After to avoid 429s."})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-3",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Next.js API route"}),r.jsx(qn,{title:"Next.js",variants:_Ee("orders"),label:"Show Next.js snippet"})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-3",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Vanilla fetch"}),r.jsx(qn,{title:"fetch()",variants:jEe("orders"),label:"Show browser snippet"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-3",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Cypress"}),r.jsx(qn,{title:"Cypress test",variants:wEe("orders"),label:"Show Cypress snippet"})]}),r.jsxs(Ht,{className:"p-5 surface-card elevation-1 space-y-3",children:[r.jsx("h4",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Playwright"}),r.jsx(qn,{title:"Playwright request",variants:NEe("orders"),label:"Show Playwright snippet"})]})]})]})},{id:"api-reference",title:"Endpoint reference",summary:"Filterable list of every object and path.",ke
3740ywords:["reference","endpoints","paths","projects","collections"],content:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 space-y-3",children:[r.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-secondary)] text-sm",children:[r.jsx(VT,{className:"w-4 h-4"}),r.jsx("span",{children:"Filter by object or search any path"})]}),r.jsxs("div",{className:"relative w-full lg:w-96",children:[r.jsx(_h,{className:"w-4 h-4 text-[var(--color-fg-muted)] absolute left-3 top-3"}),r.jsx(Is,{value:s,onChange:O=>n(O.target.value),placeholder:"Search endpoints, paths, or descriptions",className:"pl-9 bg-[var(--color-bg-code)] border-[var(--color-border-default)]"})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",className:`rounded-md border px-3 py-1 text-xs font-medium transition ${a.length===0?"border-indigo-500/50 bg-indigo-500/10 text-indigo-100":"border-[var(--color-border-default)] bg-[var(--color-bg-code)] text-[var(--color-fg-default)] hover:border-indigo-500/40"}`,onClick:()=>o([]),children:"All objects"}),zg.map(O=>{const z=a.includes(O.id);return r.jsx("button",{type:"button",className:`rounded-md border px-3 py-1 text-xs font-medium transition ${z?"border-indigo-500/50 bg-indigo-500/10 text-indigo-100":"border-[var(--color-border-default)] bg-[var(--color-bg-code)] text-[var(--color-fg-default)] hover:border-indigo-500/40"}`,onClick:()=>o(X=>X.includes(O.id)?X.filter(W=>W!==O.id):[...X,O.id]),children:O.title},O.id)})]}),r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Showing ",w.length," of ",_.length," ","endpoints"]})]}),S.length===0&&r.jsx(Ht,{className:"p-6 surface-card elevation-1",children:r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"No endpoints match this filter. Clear filters to see everything."})}),S.map(O=>{const z=k[O.id]||[],X=z.length>0;return r.jsxs("div",{id:O.id,ref:f(O.id),className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-faint)]",children:O.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:O.summary})]}),r.jsxs("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-3 py-1 text-[11px] text-[var(--color-fg-secondary)]",children:[z.length," endpoint",z.length===1?"":"s"]})]}),X?r.jsx("div",{className:"grid grid-cols-1 gap-4",children:z.map(W=>r.jsx(MEe,{endpoint:W},W.id))}):r.jsx(Ht,{className:"p-4 surface-card elevation-1",children:r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"No endpoints in this object match the search."})})]},O.id)})]})}],T=E.filter(O=>v(`${O.title} ${O.summary} ${(O.keywords||[]).join(" ")}`)),A=g?T:E,R=m2.filter(O=>v(`${O.title} ${O.preview}`)),I=R.length>0||A.length>0,L=(O,z)=>{t(X=>{const W=new Set(X);return z&&W.add(z),E.some(K=>K.id===O)&&W.add(O),W}),window.requestAnimationFrame(()=>h(O))},M=O=>{const z=new URLSearchParams(i);z.set("section",O),l(z,{replace:!0}),t(X=>new Set(X).add(O)),h(O)};return r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)]",children:r.jsxs("div",{className:"container-stripe py-16",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h1",{className:"text-4xl font-bold text-[var(--color-fg-default)] mb-4",children:"Documentation"}),r.jsx("p",{className:"text-xl text-[var(--color-fg-secondary)] max-w-2xl mx-auto",children:"Quick answers, working examples, and API reference."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[r.jsx("div",{className:"lg:col-span-1",children:r.jsxs(Ht,{className:"p-6 surface-card elevation-1 sticky top-8",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-4",children:"Contents"}),r.jsxs("nav",{className:"space-y-2",children:[A.map(O=>r.jsxs("button",{className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors ${e.has(O.id)?"bg-[#5561FF]/10 text-[#5561FF]":"text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-card)]"}`,onClick:()=>M(O.id),children:[e.has(O.id)?r.jsx(sr,{className:"w-4 h-4"}):r.jsx(Hn,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:O.title})]},O.id)),g&&A.length===0&&r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)] px-3",children:"No sections match this search."}),r.jsx("div",{className:"pt-3 border-t border-[var(--color-border-default)]",children:zg.map(O=>r.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-card)] text-sm",onClick:()=>M(O.id),children:[r.jsx(Hn,{className:"w-4 h-4"}),O.title]},O.id))})]})]})}),r.jsx("div",{className:"lg:col-span-3",children:r.jsxs("div",{className:"space-y-8",children:[r.jsx(Ht,{className:"p-6 surface-card elevation-1",children:r.jsxs("div",{className:"flex flex-col gap-5",children:[r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-faint)]",children:"Docs Home"}),r.jsx("h2",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Documentation"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Qu
3740ick answers, working examples, and API reference."})]}),r.jsxs("div",{className:"w-full md:w-[420px] relative",children:[r.jsx(_h,{className:"w-4 h-4 text-[var(--color-fg-muted)] absolute left-3 top-3"}),r.jsx(Is,{value:s,onChange:O=>n(O.target.value),placeholder:"Search docs (auth, api keys, 401, logs, collections...)",className:"pl-9 bg-[var(--color-bg-code)] border-[var(--color-border-default)]"}),s&&r.jsx("button",{type:"button",className:"absolute right-2 top-2 text-[11px] px-3 py-1 rounded-md border border-[var(--color-border-default)] text-[var(--color-fg-default)] hover:border-[#5561FF]/60 hover:text-[var(--color-fg-default)]",onClick:()=>n(""),children:"Clear"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:"Most common questions"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Showing ",R.length," of"," ",m2.length]})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:R.map(O=>r.jsxs("button",{type:"button",className:"text-left rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4 hover:border-[#5561FF]/50 transition group",onClick:()=>L(O.anchor,O.parentSection),children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)] mb-1",children:O.title}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:O.preview}),r.jsxs("span",{className:"text-[11px] text-[#5561FF] inline-flex items-center gap-1",children:["Jump",r.jsx(Hn,{className:"w-3 h-3"})]})]},O.id))}),g&&!I&&r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)]",children:"No results - try 'api key', '401', 'logs', 'collection'."})]})]})}),r.jsx(Ht,{className:"p-6 surface-card elevation-1",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-faint)]",children:"Pick your path"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Three lanes for the most common ReqRes workflows."})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4 space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Quickstart (Projects)"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Create a project, add a collection, log in with magic links, write per-user records."})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(ht,{asChild:!0,size:"sm",variant:"primary",children:r.jsx("a",{href:"/examples/notes-app",children:"Open Notes example"})}),r.jsx(ht,{asChild:!0,size:"sm",variant:"ghost",className:"text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",children:r.jsx("a",{href:"/getting-started",children:"Getting started"})})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] pt-1",children:["See complete apps built on ReqRes:"," ",r.jsx("a",{href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Task Manager"})," · ",r.jsx("a",{href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Waitlist App"})]})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4 space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Classic API key (Legacy)"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Use a free API key for classic ReqRes endpoints (demos, teaching, quick tests)."})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:r.jsx(ht,{asChild:!0,size:"sm",variant:"outline",children:r.jsx("a",{href:"/api-keys",children:"Go to API Keys"})})}),r.jsx(qn,{title:"Classic curl",variants:LEe,label:"Show curl"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-4 space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Automation & QA"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Postman/Bruno/Cypress/Playwright usage, predictable JSON, logs for debugging."})]}),r.jsxs("ul",{className:"list-disc pl-5 text-xs text-[var(--color-fg-muted)] space-y-1",children:[r.jsx("li",{children:"Avoid empty headers (can trigger WAF)"}),r.jsx("li",{children:"Use small delays to avoid 429s"})]}),r.jsx(ht,{size:"sm",variant:"primary",className:"w-fit",onClick:()=>L("qa-snippets","frameworks-qa"),children:"QA snippets"})]})]})]})}),A.length===0&&g&&R.length>0&&r.jsx(Ht,{className:"p-6 surface-card elevation-1",children:r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"No reference sections match this search. Try a different keyword or clear the search."})}),A.map(O=>r.jsxs(Ht,{id:O.id,ref:f(O.id),className:"surface-card elevation-1 hover:elevation-2 transition-all duration-200",children:[r.jsx("div",{className:"p-6 cursor-pointer",onClick:()=>y(O.id),children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:O.title}),O.badge&&r.jsx("span",{className:"rounded-full border border-[#5561FF]/50 bg-[#5561FF]/10 px-2.5 py-1 text-[11px] font-semibold text-[var(--color-fg-default)]",children:O.badge})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:O.summary})]}),e.has(O.id)?r.jsx(sr,{className:"w-5 h-5 text-[var(--color-fg-muted)]"}):r.jsx(Hn,{className:"w-5 h-5 text-[var(--color-fg-muted)]"})]})}),e.has(O.id)&&r.jsx("div",{className:"px-6 pb-6 border-t border-[var(--color-border-default)]",children:O.content})]},O.id))]})})]}),r.jsx(a1,{className:"mt-16"}),r.jsx("div",{className:"mt-16 text-center",children:r.jsxs(Ht,{className:"p-8 surface-card elevation-1",children:[r.jsx("h3",{className:"text-2xl font-semibold text-[var(--color-fg-default)] mb-4",children:"Need More Help?"}),r.jsx("p",{className:"text-[var(--color-fg-secondary)] mb-6",children:"Can't find what you're looking for? We're here to help."}),r.jsx("div",{className:"flex flex-wrap gap-4 justify-center",children:r.jsx(ht,{variant:"outline",asChild:!0,className:"bg-transparent text-[var(--color-fg-default)] border-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] flex items-center",children:r.jsxs("a",{href:"mailto:[email protected]",className:"flex items-center",children:[r.jsx(ja,{className:"w-4 h-4 mr-2"}),"Contact Support"]})})})]})})]})})}var i1="Tabs",[$Ee,FOe]=bo(i1,[fm]),wG=fm(),[UEe,jA]=$Ee(i1),NG=x.forwardRef((e,t)=>
3740{const{__scopeTabs:s,value:n,onValueChange:a,defaultValue:o,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,f=um(l),[h,g]=go({prop:n,onChange:a,defaultProp:o??"",caller:i1});return r.jsx(UEe,{scope:s,baseId:po(),value:h,onValueChange:g,orientation:i,dir:f,activationMode:c,children:r.jsx(fs.div,{dir:f,"data-orientation":i,...u,ref:t})})});NG.displayName=i1;var kG="TabsList",SG=x.forwardRef((e,t)=>{const{__scopeTabs:s,loop:n=!0,...a}=e,o=jA(kG,s),i=wG(s);return r.jsx(JR,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:r.jsx(fs.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});SG.displayName=kG;var CG="TabsTrigger",EG=x.forwardRef((e,t)=>{const{__scopeTabs:s,value:n,disabled:a=!1,...o}=e,i=jA(CG,s),l=wG(s),c=AG(i.baseId,n),u=PG(i.baseId,n),f=n===i.value;return r.jsx(XR,{asChild:!0,...l,focusable:!a,active:f,children:r.jsx(fs.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...o,ref:t,onMouseDown:Lt(e.onMouseDown,h=>{!a&&h.button===0&&h.ctrlKey===!1?i.onValueChange(n):h.preventDefault()}),onKeyDown:Lt(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(n)}),onFocus:Lt(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!a&&h&&i.onValueChange(n)})})})});EG.displayName=CG;var TG="TabsContent",RG=x.forwardRef((e,t)=>{const{__scopeTabs:s,value:n,forceMount:a,children:o,...i}=e,l=jA(TG,s),c=AG(l.baseId,n),u=PG(l.baseId,n),f=n===l.value,h=x.useRef(f);return x.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),r.jsx(Xo,{present:a||f,children:({present:g})=>r.jsx(fs.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&o})})});RG.displayName=TG;function AG(e,t){return`${e}-trigger-${t}`}function PG(e,t){return`${e}-content-${t}`}var FEe=NG,IG=SG,MG=EG,OG=RG;const BEe=FEe,LG=x.forwardRef(({className:e,...t},s)=>r.jsx(IG,{ref:s,className:cs("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));LG.displayName=IG.displayName;const DG=x.forwardRef(({className:e,...t},s)=>r.jsx(MG,{ref:s,className:cs("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));DG.displayName=MG.displayName;const $G=x.forwardRef(({className:e,...t},s)=>r.jsx(OG,{ref:s,className:cs("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));$G.displayName=OG.displayName;const qEe={GET:"text-sky-200 bg-sky-500/10 border-sky-500/30",POST:"text-emerald-200 bg-emerald-500/10 border-emerald-500/30",PUT:"text-amber-200 bg-amber-500/10 border-amber-500/30",DELETE:"text-rose-200 bg-rose-500/10 border-rose-500/30"};function zEe({method:e}){return r.jsx("span",{className:`inline-flex items-center rounded-md border px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide ${qEe[e]}`,children:e})}function N$({label:e,method:t,url:s,headers:n,requestBodyExample:a,responseBodyExample:o,notes:i,className:l=""}){return r.jsx(Ht,{className:`surface-card elevation-1 border border-[var(--color-border-default)] ${l}`,children:r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx("div",{className:"flex items-start justify-between gap-3",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:e}),r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1 text-[12px] text-[var(--color-fg-default)]",children:[r.jsx(zEe,{method:t}),r.jsx("span",{className:"font-mono break-all",children:s})]})]})}),n&&Object.keys(n).length>0?r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:"Headers"}),r.jsx("div",{className:"rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[11px] text-[var(--color-fg-default)] space-y-0.5",children:Object.entries(n).map(([c,u])=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"font-mono text-[var(--color-fg-secondary)]",children:[c,":"]}),r.jsx("span",{className:"font-mono text-[var(--color-fg-default)] break-all",children:u})]},c))})]}):null,a?r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:"Request"}),r.jsx(Hu,{code:a,language:"json"})]}):null,o?r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:"Response"}),r.jsx(Hu,{code:o,language:"json"})]}):null,i?r.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--color-fg-muted)]",children:i}):null]})})}const Hg="https://reqres.in",g2="things",ju=e=>JSON.stringify(e,null,2),k$={login:{label:"Login (Public key)",method:"POST",url:`${Hg}/api/app-users/login`,headers:{"x-api-key":"<public_project_api_key>","content-type":"application/json"},requestBodyExample:ju({email:"[email protected]",project_id:"<project_id>"}),responseBodyExample:ju({data:{sent:!0,expires_in_minutes:15,message:"Magic code sent"}}),notes:"Emails a one-time verification code (no link) to the supplied address; safe to start from the browser with your Public project key. In test mode (no email), the token is returned in the response."},verify:{label:"Verify (no key)",method:"POST",url:`${Hg}/api/app-users/verify`,headers:{"content-type":"application/json"},requestBodyExample:ju({token:"<magic_link_token>"}),responseBodyExample:ju({session_token:"<session_token>",app_user:{id:"<app_user_id>",email:"[email protected]"}}),notes:"No API key needed. Exchange the magic link token for a session_token."},collectionsPublic:(e=g2,t="<public_project_api_key>")=>({label:"Collections (Public key)",method:"GET",url:`${Hg}/app/collections/${e}/records`,headers:{"x-api-key":t},responseBodyExample:ju({data:[{id:"<record_id>",data:{title:"Hello world"}}]}),notes:"Browser-safe, read-only. Returns rows with app_user_id = null."}),collectionsSession:(e=g2)=>({label:"Collections (Session token)",method:"GET",url:`${Hg}/app/collections/${e}/records`,headers:{Authorization:"Bearer <session_token>"},responseBodyExample:ju({data:[{id:"<record_id>",data:{title:"Hello world"}}]}),notes:"Logged-in app user context; rows are scoped to the session token."}),collectionsAdmin:(e=g2,t="<project_id>")=>({label:"Collections (Private key)",method:"GET",url:`${Hg}/api/collections/${e}/records?project_id=${t}`,headers:{"x-api-key":"<private_project_api_key>"},responseBodyExample:ju({data:[{id:"<record_id>",data:{title:"Hello world"}}]}),notes:"Server-side admin read/write using the Private project key."})};function HEe(){Mn("FAQ");
3740const[e,t]=x.useState("all"),s=[{id:"all",name:"All Questions"},{id:"platform",name:"Platform"},{id:"projects",name:"Projects & Keys"},{id:"collections",name:"Collections & API"},{id:"app-users",name:"App users"},{id:"observability",name:"Data & Logs"},{id:"billing",name:"Billing & Limits"}],n=[{id:"what-is-new",question:"Is ReqRes a mock API or a real backend now?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"ReqRes now centers around projects with authenticated app users and collections. You can still hit the classic fake-data endpoints, but the new flow adds project keys, app-session tokens, Data Explorer, logs, and automations so you can ship production apps."}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsx("li",{children:"Projects: your own slug, project key, and organization scope"}),r.jsx("li",{children:"Collections: structured data served to app users via session tokens"}),r.jsx("li",{children:"App users: magic-link login and project-scoped session tokens"}),r.jsx("li",{children:"Observability: per-project logs plus Data Explorer for collections and legacy persisted endpoints"})]})]}),category:"platform"},{id:"llm-guides",question:"Where can I find the LLM prompt guides?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"We keep two ready-to-use prompt guides for agents and copilots. Use the plain text version for quick copy/paste or the JSON feed if your tooling prefers structured content."}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[r.jsxs("a",{href:"/LLM.txt",target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:text-accent-purple inline-flex items-center gap-2",children:[r.jsx(ja,{className:"w-4 h-4"}),"LLM Guide (text)"]}),r.jsxs("a",{href:"/LLM.json",target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:text-accent-purple inline-flex items-center gap-2",children:[r.jsx(ja,{className:"w-4 h-4"}),"LLM Guide (JSON)"]})]})]}),category:"platform"},{id:"qa-automation",question:"Can I use ReqRes for QA and automated testing?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Yes. ReqRes APIs are predictable for Postman, Cypress, Playwright, and CI. Use project keys for admin calls and session tokens for per-user scenarios; logs make auth or permission issues obvious."}),r.jsx(Vt,{title:"Cypress example",variants:[{id:"javascript",label:"Cypress",language:"javascript",code:`cy.request({ 3741 method: 'GET', 3742 url: 'https://reqres.in/api/collections/orders/records', 3743 headers: { 'x-api-key': 'YOUR_API_KEY' } 3744}).then((response) => { 3745 expect(response.status).to.eq(200); 3746});`}]})]}),category:"observability"},{id:"classroom",question:"Can I use ReqRes in a classroom or bootcamp?",answer:r.jsx("div",{className:"space-y-2",children:r.jsx("p",{children:"Yes. Students learn REST and HTTP quickly with JSON collections, magic links, and session tokens-no databases or servers to set up. Everything is reachable with fetch()."})}),category:"platform"},{id:"projects-and-keys",question:"How do projects, orgs, and API keys work together?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Create a project (name + slug) and grab its project key. Everything you deploy-collections, app users, custom endpoints, triggers-is scoped to that project. If you belong to an organization, the project still keeps its own slug and key."}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsxs("li",{children:["Admin calls use ",r.jsx("code",{children:"x-api-key: <project_key>"})]}),r.jsxs("li",{children:["Base URL for custom endpoints:"," ",r.jsx("code",{children:"/api/custom/<path>"})," (project slug prefix optional)"]}),r.jsxs("li",{children:["Base URL for admin collections: ",r.jsx("code",{children:"/api/collections"})]}),r.jsx("li",{children:"Never ship project keys to browsers-use app-session tokens for client calls"})]})]}),category:"projects"},{id:"public-vs-private",question:"When should I use the Public API key vs the Private API key?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Private = server/admin (full access). Public = browser-safe, read-only (great for demos and classrooms)."}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Private key"}),": ",r.jsx("code",{children:"/api/app-users/login"}),", admin collections CRUD, logs, automations. Keep on the server."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public key"}),": browser GETs to"," ",r.jsx("code",{children:"/app/collections/:slug/records"})," or starting"," ",r.jsx("code",{children:"/api/app-users/login"}),". Read-only."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Session token"}),":"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})," for logged-in users."]})]}),r.jsx("a",{className:"text-accent-blue hover:text-accent-purple text-sm",href:"/documentation?section=auth-modes",children:"See the auth modes table â"})]}),category:"projects"},{id:"user-vs-project-keys",question:"What is the difference between user API keys and project API keys?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["User keys represent ",r.jsx("em",{children:"you"}),"; project keys represent a single project."]}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsx("li",{children:"User keys inherit your personal access to every project you can see. Use them for quick local tests only."}),r.jsx("li",{children:"Project keys are scoped to one project and are the right choice for CI, servers, and automations."}),r.jsx("li",{children:"Rotate project keys per service/env without breaking other projects. Never share user keys."}),r.jsx("li",{children:"Both keys stay server-side; browsers should use app-session tokens instead."})]})]}),category:"projects"},{id:"admin-vs-app",question:"When should I use project keys vs app-session tokens?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Use project keys for admin work; use app-session tokens for end-user traffic."}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Project key"}),": ",r.jsx("code",{children:"/api/collections"}),","," ",r.jsx("code",{children:"/api/custom/<path>"}),", ",r.jsx("code",{children:"/api/app-users"}),", ",r.jsx("code",{children:"/triggers"})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Session token"}),":"," ",r.jsx("code",{children:"/app/collections/:slug/records"}),","," ",r.jsx("code",{children:"/api/app-users/me"})]}),r.jsx("li",{children:"Session tokens are project-scoped and expire-refresh by re-verifying the login code"})]})]}),category:"collections"},{id:"api-cheatsheet",question:"What URL, headers, and responses should I expect?",answer:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/50 bg-background-card/90 p-3 text-xs leading-relaxed",children:[r.jsx("p",{className:"font-semibold text-foreground",children:"Login (send code)"}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap font-mono text-[11px] text-foreground-secondary",children:`POST https://reqres.in/api/app-users/login 3747Headers: x-api-key: <public_project_api_key>, content-type: application/json 3748Body: { "email": "[email protected]", "project_id": "<project_id>" } 3749Response: { "data": { "sent": true, "expires_in_minutes": 15, "message": "Magic code sent" } }`})]}),r.jsxs("div",{className:"rounded-lg border border-border/50 bg-background-card/90 p-3 text-xs leading-relaxed",children:[r.jsx("p",{className:"font-semibold text-foreground",children:"Verify token â session"}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap font-mono text-[11px] text-foreground-secondary",children:`POST https://reqres.in/api/app-users/verify 3750Headers: content-type: application/json 3751Body: { "token": "<login_code>" } 3752Response: { "session_token": "<session_token>", "app_user": { "id": "<id>" } }`})]}),r.jsxs("div",{className:"rounded-lg border border-border/50 bg-background-card/90 p-3 text-xs leading-relaxed space-y-1",children:[r.jsx("p",{className:"font-semibold text-foreground",children:"Collections"}),r.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground-secondary",children:`GET https://reqres.in/app/collections/<slug>/records 3753Headers: Authorization: Bearer <session_token> 3754Response: { "data": [ { "id": "<record_id>", "data": { ... } } ] }`}),r.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground-secondary",children:`POST https://reqres.in/api/collections/<slug>/records?project_id=<project_id> 3755Headers: x-api-key: <project_key>, content-type: application/json 3756Body: { "data": { "title": "Hello" } } 3757Response: { "id": "<record_id>", "data": { "title": "Hello" } }`})]})]}),category:"collections"},{id:"app-user-flow",question:"How do magic links and session tokens work?",answer:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/app-users/login"})," with email +"," ",r.jsx("code",{children:"project_id"})," using your project key."]}),r.jsx("li",{children:"We email a magic token to the user."}),r.jsxs("li",{children:["POST ",r.jsx("code",{children:"/api/app-users/verify"})," with that token â receive"," ",r.jsx("code",{children:"session_token"})," and user info."]}),r.jsxs("li",{children:["Call ",r.jsx("code",{children:"/app/collections/:slug/records"})," or"," ",r.jsx("code",{children:"/api/app-users/me"})," with"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"}),"."]})]}
3757),r.jsx(Vt,{title:"App user login â verify",variants:bG(),readMoreHref:"/documentation?section=app-users"})]}),category:"app-users"},{id:"seed-app-users",question:"Can I pre-create or block app users?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["Yes. Use the admin endpoint ",r.jsx("code",{children:"/api/app-users"})," with a project key to seed users by email and project_id."]}),r.jsxs("p",{className:"text-body",children:["Each plan has an app-user cap; hitting the limit returns"," ",r.jsx("code",{children:"app_user_limit_reached"}),". You can also resend magic links with ",r.jsx("code",{children:"/api/app-users/login"})," anytime."]})]}),category:"app-users"},{id:"collections-access",question:"How do collections handle schema, visibility, and access?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["Collections are created at ",r.jsx("code",{children:"/api/collections"})," with a project key. You can provide an optional JSON schema and choose"," ",r.jsx("em",{children:"private"})," (admin-only) or ",r.jsx("em",{children:"public"})," (readable by session tokens) visibility."]}),r.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-body",children:[r.jsxs("li",{children:["Admin CRUD: ",r.jsx("code",{children:"/api/collections/:slug/records"})," with"," ",r.jsx("code",{children:"x-api-key"})]}),r.jsxs("li",{children:["App access: ",r.jsx("code",{children:"/app/collections/:slug/records"})," with"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})]}),r.jsxs("li",{children:["Records carry ",r.jsx("code",{children:"project_id"})," and (when applicable)"," ",r.jsx("code",{children:"app_user_id"})," automatically"]})]})]}),category:"collections"},{id:"react-collection-read",question:"How do I read a collection from my React app?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Use the Public project key for read-only browser calls, or a session token for user-scoped data."}),r.jsx(N$,{...k$.collectionsPublic()}),r.jsxs("p",{className:"text-body",children:["Want per-user rows? Swap the header for"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"}),". See Getting Started â Quickstart for frontend devs."]})]}),category:"collections"},{id:"legacy-endpoints",question:"What about my existing custom endpoints and persisted data?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["They still live under"," ",r.jsx("code",{children:"/api/custom/<project_slug>/..."}),' and use project keys. In Data Explorer, choose the "Endpoint data (legacy)" view to search and edit records created by persisted custom endpoints.']}),r.jsx("p",{children:"New projects can keep using templates or custom endpoints; collections are recommended for authenticated app data going forward."})]}),category:"platform"},{id:"logged-in-call",question:"How do I call ReqRes on behalf of a logged-in user?",answer:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{className:"text-body",children:["Flow: Private key â ",r.jsx("code",{children:"/api/app-users/login"})," â magic_link_token â ",r.jsx("code",{children:"/api/app-users/verify"})," (no key) â session_token â Bearer calls to collections."]}),r.jsx(N$,{...k$.collectionsSession()}),r.jsx("a",{className:"text-accent-blue hover:text-accent-purple text-sm",href:"/documentation?section=api-call-crib",children:"Copy the login/verify snippets â"})]}),category:"app-users"},{id:"data-logs",question:"Where do I inspect data and request logs?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["Open Data Explorer for project-scoped data: switch between Endpoint data and Collections. Use Logs to see recent requests (method, path, status) per project or call"," ",r.jsx("code",{children:"/logs?project_id=<id>&limit=50"})," with your project key."]}),r.jsx(Vt,{title:"Fetch recent logs",variants:k5(),readMoreHref:"/documentation?section=logs"})]}),category:"observability"},{id:"rate-limits",question:"How are limits applied?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Limits are per API key. Free = classic API with starter throughput; Pro unlocks collections, app users, automations, and higher limits; Premium increases throughput, storage, and log retention. Check headers for live limits:"}),r.jsx(Vt,{title:"Rate limit headers",variants:S5({remaining:995}
3757),readMoreHref:"/documentation?section=platform"}),r.jsx("p",{children:"HTTP 429 means you hit the limit; consider backoff or upgrading."})]}),category:"billing"},{id:"billing",question:"How does billing and plan switching work?",answer:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{children:"Billing runs through Stripe. Upgrades are immediate and prorated; downgrades take effect on the next renewal. You can update payment methods or cancel anytime from Billing or the customer portal."}),r.jsx("p",{className:"text-body",children:"If you run into a hard limit (collections, app users, or storage), the API returns a descriptive error; upgrading lifts those caps right away."})]}),category:"billing"}],a=o=>o==="all"?n:n.filter(i=>i.category===o);return r.jsxs("div",{className:"container-stripe py-10 stack-8",children:[r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("h1",{className:"text-3xl font-semibold text-foreground",children:"Frequently Asked Questions"}),r.jsx("p",{className:"text-body mt-4",children:"Find answers to common questions about ReqRes API Platform"})]}),r.jsxs(BEe,{value:e,onValueChange:t,className:"w-full space-y-6",children:[r.jsx(LG,{className:"mx-auto w-fit flex flex-wrap items-center justify-center gap-1.5 rounded-full bg-[var(--color-bg-alt)]/70 px-2 py-1 shadow-[0_12px_30px_-24px_var(--color-shadow)] ring-1 ring-border/50",children:s.map(o=>r.jsxs(DG,{value:o.id,className:"flex items-center gap-2 rounded-full border border-transparent px-3 py-1 text-xs font-medium text-foreground/80 transition-colors data-[state=active]:border-[var(--color-border-default)] data-[state=active]:bg-[var(--color-bg-card)] data-[state=active]:text-foreground data-[state=active]:shadow-sm hover:border-border/60",children:[o.name,r.jsx("span",{className:"inline-flex items-center justify-center rounded-full border border-border/50 bg-[var(--color-bg-alt)] px-2 py-[2px] text-[10px] font-semibold text-foreground/70 data-[state=active]:border-[var(--color-border-default)] data-[state=active]:text-foreground",children:a(o.id).length})]},o.id))}),s.map(o=>{const i=a(o.id);return r.jsx($G,{value:o.id,className:"mx-auto max-w-6xl space-y-4 px-1 sm:px-2",children:i.length===0?r.jsxs(tl,{className:"p-8 surface-card elevation-1 text-center",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"No questions found"}),r.jsx("p",{className:"text-foreground-secondary mt-2",children:"Try selecting a different category or contact our support team."})]}):r.jsx(pG,{type:"multiple",className:"space-y-3",children:i.map(l=>r.jsxs(xA,{value:l.id,className:"overflow-hidden rounded-xl border border-border/40 bg-background-card/90 px-1 shadow-[0_12px_32px_-22px_rgba(0,0,0,0.6)] backdrop-blur-sm",children:[r.jsx(vA,{className:"px-4 md:px-6 text-foreground py-3",children:r.jsx("span",{className:"text-sm md:text-base font-semibold",children:l.question})}),r.jsx(bA,{className:"px-4 md:px-6 pb-6 text-sm leading-relaxed text-foreground-secondary",children:r.jsx("div",{className:"space-y-3",children:l.answer})})]},l.id))})},o.id)})]}),r.jsxs(tl,{className:"p-8 surface-card elevation-1 text-center",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Still have questions?"}),r.jsx("p",{className:"text-foreground-secondary mt-2",children:"Can't find what you're looking for? Our support team is here to help."}),r.jsxs("div",{className:"flex items-center justify-center gap-4 mt-4",children:[r.jsxs("a",{href:"/docs",className:"text-accent-blue hover:text-accent-purple flex items-center gap-2",children:[r.jsx(ja,{className:"w-4 h-4"}),"Documentation"]}),r.jsxs("a",{href:"mailto:[email protected]",className:"text-accent-blue hover:text-accent-purple flex items-center gap-2",children:[r.jsx(ja,{className:"w-4 h-4"}),"Contact Support"]}),r.jsxs("a",{href:"https://github.com/reqres",className:"text-accent-blue hover:text-accent-purple flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ja,{className:"w-4 h-4"}),"GitHub"]})]})]})]})}const hm=()=>{const e=x.useRef(!1);return{copyToClipboard:x.useCallback(async(s,n)=>{if(e.current)return!1;e.current=!0;try{return await navigator.clipboard.writeText(s),setTimeout(()=>{e.current=!1},100),!0}catch(a){return console.error("Failed to copy to clipboard:",a),prompt("C
3757opy this text:",s),e.current=!1,!1}},[]),showToast:!1,toastMessage:"",closeToast:()=>{},ClipboardToast:()=>null}};function VEe({template:e,isOpen:t,onClose:s,onDeploy:n}){const[a,o]=x.useState(""),[i,l]=x.useState(""),[c,u]=x.useState(""),[f,h]=x.useState(!1),[g,v]=x.useState(null),[y,_]=x.useState({checking:!1,available:null,suggestions:[]});x.useEffect(()=>{if(!c||c.length<3){_({checking:!1,available:null,suggestions:[]});return}const w=setTimeout(async()=>{_(k=>({...k,checking:!0}));try{const S=(await ue.get(`/projects/check-slug?slug=${encodeURIComponent(c)}`)).data;_({checking:!1,available:S.available,suggestions:S.suggestions||[]})}catch(k){console.error("Error checking slug availability:",k),_({checking:!1,available:null,suggestions:[]})}},500);return()=>clearTimeout(w)},[c]),x.useEffect(()=>{e&&(o(`${e.name}`),l(e.description),u(e.name.toLowerCase().replace(/[^a-z0-9]/g,"-")))},[e]);const j=async()=>{var w;if(e){h(!0),v(null);try{const S=(await ue.get(`/templates/${e.id}`)).data,E={name:a,description:i,template_id:e.id,slug:c||void 0,endpoints:S.endpoints,config:{...S.config,sample_data_quantities:((w=S.config)==null?void 0:w.sample_data_quantities)||{}}};await n(E),s()}catch(k){console.error("Error deploying template:",k),k instanceof yt?v(k.message):v("Failed to deploy template. Please try again.")}finally{h(!1)}}};return!t||!e?null:r.jsx("div",{className:"modal-overlay",onClick:s,children:r.jsxs("div",{className:"modal-content",onClick:w=>w.stopPropagation(),children:[r.jsxs("div",{className:"modal-header",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-3xl",children:e.icon}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-semibold tracking-tight text-[var(--color-fg-default)]",children:["Deploy ",e.name]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:"Set up your new API project"})]})]}),r.jsx("button",{className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] text-2xl font-light transition-colors p-2 hover:bg-[var(--color-bg-hover)] rounded-lg",onClick:s,children:"Ã"})]}),r.jsxs("div",{className:"modal-body space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"projectName",className:"block text-sm font-medium text-[var(--color-fg-default)]",children:"Project Name"}),r.jsx("input",{id:"projectName",type:"text",value:a,onChange:w=>o(w.target.value),placeholder:"Enter project name",className:"w-full px-4 py-3 bg-[var(--color-bg-hover)] border border-[var(--color-border-secondary)] rounded-lg text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent transition-all"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-[var(--color-fg-default)]",children:"Description"}),r.jsx("textarea",{id:"description",value:i,onChange:w=>l(w.target.value),placeholder:"Enter project description",className:"w-full px-4 py-3 bg-[var(--color-bg-hover)] border border-[var(--color-border-secondary)] rounded-lg text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent transition-all resize-none",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"customSlug",className:"block text-sm font-medium text-[var(--color-fg-default)]",children:"Project Slug (optional)"}),r.jsxs("div",{className:"flex items-center bg-[var(--color-bg-hover)] border border-[var(--color-border-secondary)] rounded-lg overflow-hidden focus-within:ring-2 focus-within:ring-[#5561FF] focus-within:border-transparent transition-all",children:[r.jsx("span",{className:"px-4 py-3 text-[var(--color-fg-muted)] text-sm bg-[var(--color-bg-alt)] border-r border-[var(--color-border-secondary)] whitespace-nowrap",children:"reqres.in/projects/"}),r.jsx("input",{id:"customSlug",type:"text",value:c,onChange:w=>u(w.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:"your-project-name",className:`flex-1 px-4 py-3 bg-transparent text-[var(--color-fg-default)] placeholder-[var(--color-fg-muted)] focus:outline-none ${y.available===!1?"text-red-400":y.available===!0?"text-green-400":""}`}),y.checking&&r.jsxs("div",{className:"px-4 py-3 text-[var(--color-fg-muted)] text-sm flex items-center gap-2",children:[r.jsx(bs,{size:"sm"}),"Checking..."]})]}),r.jsxs("div",{className:"space-y-2",children:[y.available===!0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-400",children:[r.jsx("span",{children:"â
"}),r.jsx("span",{children:"This slug is available!"})]}),y.available===!1&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-400",children:[r.jsx("span",{children:"â"}),r.jsx("span",{children:"This slug is already taken"})]}),y.suggestions.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Try one of these:"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:y.suggestions.map((w,k)=>r.jsx("button",{type:"button",className:"px-3 py-1 text-xs bg-[var(--color-border-secondary)] text-[var(--color-fg-default)] rounded-md hover:bg-[var(--color-bg-active)] transition-colors",onClick:()=>u(w),children:w},k))})]})]}),y.available===null&&c&&r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Leave empty to auto-generate from project name"})]})]}),g&&r.jsx("div",{className:"p-4 bg-[var(--color-semantic-danger-bg)] border border-[var(--color-semantic-danger)]/20 rounded-lg",children:r.jsx("p",{className:"text-sm text-[var(--color-semantic-danger)]",children:g})})]}),r.jsxs("div",{className:"modal-footer",children:[r.jsx(ht,{variant:"outline",onClick:s,disabled:f,className:"px-6 py-3",children:"Cancel"}),r.jsx(ht,{onClick:j,disabled:f||!a.trim()||y.available===!1,className:"bg-[#5561FF] text-white hover:bg-[#4A52E8] px-6 py-3 rounded-xl font-medium transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md flex items-center gap-2",children:f?r.jsxs(r.Fragment,{children:[r.jsx(bs,{size:"sm"}),"Deploying..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Dr,{className:"w-4 h-4"}),"Deploy Template"]})})]})]})})}function GEe(){var Le,xe;const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),{copyToClipboard:n,ClipboardToast:a}
3757=hm(),[o,i]=Wa(),[l,c]=x.useState([]),[u,f]=x.useState([]),[h,g]=x.useState(!1),[v,y]=x.useState(null),[_,j]=x.useState(()=>o.get("category")||""),[w,k]=x.useState(""),[S,E]=x.useState(!1),[T,A]=x.useState(null),[R,I]=x.useState(!1),[L,M]=x.useState(void 0),[O,z]=x.useState(null),[X,W]=x.useState(!1),[K,q]=x.useState(null),J=Mt.dark,F=Jt.primary,V=Jt.secondary,$=Fd.dark,B=async()=>{g(!0),y(null);try{const de=new URLSearchParams;_&&de.append("category",_),S&&de.append("featured","true"),de.append("limit","50");const Me=await ue.get(`/templates?${de.toString()}`);c(Me.data.templates)}catch(de){console.error("Error fetching templates:",de),de instanceof yt?y(de.message):y("Failed to fetch templates")}finally{g(!1)}},ae=async()=>{try{const de=await ue.get("/templates/categories");f(de.data)}catch(de){console.error("Error fetching categories:",de)}};x.useEffect(()=>{B(),ae()},[_,S]);const H=x.useRef(!1);x.useEffect(()=>{if(H.current||u.length===0)return;const de=o.get("category");if(!de){H.current=!0;return}const Me=u.find(je=>je.category.toLowerCase()===de.toLowerCase());Me&&(j(Me.category),Me.category!==de&&i({category:Me.category})),H.current=!0},[u,o,i]);const U=l.filter(de=>{if(w){const Me=w.toLowerCase();return de.name.toLowerCase().includes(Me)||de.description.toLowerCase().includes(Me)||de.category.toLowerCase().includes(Me)}return!0}),oe=async de=>{var Me;if(!e){q({type:"error",message:"Please sign in to deploy templates"}),it.error("Please sign in to deploy templates.");return}M(de.name),Z.templateDeployStarted(de.template_id,de.name,de.slug);try{const je=await Ue(s);if(!je){q({type:"error",message:"Please sign in to deploy templates"});return}const Ae=await ue.post("/projects",de,{authToken:je});Z.templateDeploySuccess(de.template_id,de.name,de.slug,Ae.data.id),Z.track("project_created",{template_used:!0,creation_method:"template"}),q({type:"success",message:`Project "${de.name||"Unknown"}" deployed successfully! Your API is now live.`}),it.success(`Project "${de.name||"Unknown"}" deployed successfully.`),setTimeout(()=>{window.location.href="/projects"},2e3)}catch(je){console.error("Error deploying project:",je),je instanceof yt&&Z.track("request_failed",{surface:"other",status_code:je.status,error_code:((Me=je.data)==null?void 0:Me.error)||void 0,path:window.location.pathname}),Z.templateDeployFailed(de.template_id,de.name,je instanceof yt?je.message:"Unknown error"),je instanceof yt?(q({type:"error",message:je.message}),it.error(je.message)):(q({type:"error",message:"Failed to deploy project. Please try again."}),it.error("Failed to deploy project. Please try again."))}finally{M(void 0)}},fe=de=>{A(de),I(!0)},Q=()=>{I(!1),A(null)},le=de=>{z(de),W(!0),Z.templatePreview(de.id,de.name,de.category)},Se=()=>{W(!1),z(null)},we=de=>({ecommerce:"E-commerce",social:"Social Media",productivity:"Productivity",content:"Content Management",general:"General"})[de]||de;return t?r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8 space-y-6 text-left",children:[r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Project Templates"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Deploy projects preloaded with collections, app-user auth, logging, and automations. Custom endpoints are deprecated."})]}),r.jsx("div",{className:"w-full sm:w-auto",children:r.jsxs("a",{href:"/projects",className:V,children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"View Projects"]})})]}),r.jsx(Ht,{className:`${J}`,children:r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(_h,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--color-fg-muted)]"}),r.jsx("input",{type:"text",placeholder:"Search templates...",value:w,onChange:de=>{k(de.target.value),de.target.value.length>2&&Z.searchPerformed(de.target.value,U.length,"template_gallery")},className:`${$} w-full pl-10`})]}),r.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center",children:[r.jsxs("select",{value:_,onCh
3757ange:de=>{const Me=de.target.value;j(Me),i(Me?{category:Me}:{})},className:`${$} w-full sm:w-auto sm:min-w-[200px]`,children:[r.jsx("option",{value:"",children:"All Categories"}),u.map(de=>r.jsxs("option",{value:de.category,children:[we(de.category)," (",de.count,")"]},de.category))]}),r.jsx("button",{type:"button",onClick:()=>E(!S),className:S?F:V,children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx(Zu,{className:"h-4 w-4 flex-shrink-0"}),"Featured Only"]})})]})]})}),h?r.jsx(Ht,{className:"p-12 surface-card elevation-1 text-center",children:r.jsx(bs,{text:"Loading templates...",className:"flex-col gap-3 text-body text-muted",textClassName:"text-lg text-body text-muted"})}):v?r.jsxs(Ht,{className:"p-12 surface-card elevation-1 text-center",children:[r.jsx("p",{className:"text-body text-semantic-danger mb-6 text-lg",children:v}),r.jsx(ht,{variant:"outline",onClick:B,className:"px-6 py-3",children:"Try Again"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 max-w-full",children:U.map(de=>{var Me,je,Ae;return r.jsxs(Ht,{className:`${J} hover:border-[var(--color-border-strong)] transition-all duration-200 group h-full flex flex-col w-full max-w-full overflow-hidden`,children:[r.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[r.jsx("div",{className:"text-4xl flex-shrink-0",children:de.icon}),r.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] leading-tight mb-2 truncate",children:de.name}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsx("span",{className:"px-3 py-1 rounded-full text-[11px] font-medium bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border border-[var(--color-border-default)] whitespace-nowrap",children:we(de.category)}),de.is_featured&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-yellow-300 font-medium whitespace-nowrap",children:[r.jsx(Zu,{className:"w-3 h-3"})," Featured"]})]})]})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] leading-relaxed mb-4",children:de.description}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:(je=(Me=de.config)==null?void 0:Me.features)==null?void 0:je.map((Oe,Ke)=>r.jsx("span",{className:"px-2.5 py-1 bg-[var(--color-bg-alt)] text-[11px] text-[var(--color-fg-default)] rounded-lg border border-[var(--color-border-default)] whitespace-nowrap",children:Oe},Ke))}),r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--color-fg-muted)] mb-4",children:[r.jsxs("div",{className:"inline-flex items-center gap-1 min-w-0",children:[r.jsx(ln,{className:"w-3 h-3 flex-shrink-0"}),r.jsxs("span",{className:"truncate",children:[de.usage_count," uses"]})]}),r.jsxs("div",{className:"inline-flex items-center gap-1 min-w-0",children:[r.jsx(Cp,{className:"w-3 h-3 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:((Ae=de.config)==null?void 0:Ae.difficulty)||"Beginner"})]})]}),r.jsxs("div",{className:"flex gap-2 mt-auto pt-4",children:[r.jsxs("button",{type:"button",onClick:()=>le(de),className:`${V} flex-1 justify-center text-xs min-w-0`,children:[r.jsx(za,{className:"w-3 h-3 mr-1 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:"Preview"})]}),r.jsxs("button",{type:"button",onClick:async()=>{const Oe=`${window.location.origin}/templates/${de.id}`;await n(Oe,`Template "${de.name}" link copied!`),Z.shareClicked("template",de.id.toString())},className:`${V} flex-1 justify-center text-xs min-w-0`,children:[r.jsx(nhe,{className:"w-3 h-3 mr-1 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:"Share"})]}),r.jsx("button",{type:"button",onClick:()=>fe(de),disabled:L===de.name,className:`${F} flex-1 justify-center text-xs min-w-0 disabled:opacity-60`,children:L===de.name?r.jsxs(r.Fragment,{children:[r.jsx(bs,{size:"sm"}),r.jsx("span",{className:"truncate ml-1",children:"Deploying..."})]}):r.jsxs(r.Fragment,{children:[r.jsx(Dr,{className:"w-3 h-3 mr-1 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:"Deploy"})]})})]})]},de.id)})}),U.length===0&&!h&&r.jsxs(Ht,{className:`${J} text-center`,children:[r.jsx("div",{className:"text-6xl mb-6",children:"ð"}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:"No templates found"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] mb-4",children:"Try adjusting your search or filters"}),r.jsx("button",{type:"button",onClick:()=>{k(""),j(""),E(!1),i({})},className:V,children:"Clear Filters"})]}),r.jsx(VEe,{template:T,isOpen:R,onClose:Q,onDeploy:oe}),X&&O&&r.jsx("div",{className:"modal-overlay",onClick:Se,children:r.jsxs("div",{className:"modal-content",onClick:de=>de.stopPropagation(),children:[r.jsxs("div",{className:"modal-header",children:[r.jsxs("h2",{children:["Template Preview: ",O.name]}),r.jsx("button",{className:"modal-close",onClick:Se,children:"Ã"})]}),r.jsx("div",{className:"modal-body",children:r.jsxs("div",{className:"preview-content",children:[r.jsxs("div",{className:"template-info",children:[r.jsx("div",{className:"template-icon-large",children:O.icon}),r.jsx("h3",{children:O.name}),r.jsx("p",{className:"template-description",children:O.description}),r.jsxs("div",{className:"template-meta",children:[r.jsx("span",{className:"category-badge",children:we(O.category)}),O.is_featured&&r.jsx("span",{className:"featured-badge",children:"â Featured"})]})]}),r.jsxs("div",{className:"endpoints-preview",children:[r.jsx("h4",{children:"Included Endpoints"}),r.jsx("div",{className:"endpoints-list",children:O.endpoints&&O.endpoints.length>0?O.endpoints.map((de,Me)=>r.jsxs("div",{className:"endpoint-item",children:[r.jsx("span",{className:`method-badge method-${de.method.toLowerCase()}`,children:de.method}),r.jsx("span",{className:"endpoint-path",children:de.path}
3757),r.jsx("span",{className:"endpoint-name",children:de.name})]},Me)):r.jsx("div",{className:"no-endpoints",children:r.jsx("p",{children:"No endpoints defined for this template."})})})]}),r.jsxs("div",{className:"features-preview",children:[r.jsx("h4",{children:"Features"}),r.jsx("div",{className:"features-list",children:((xe=(Le=O.config)==null?void 0:Le.features)==null?void 0:xe.length)>0?O.config.features.map((de,Me)=>r.jsx("span",{className:"feature-tag",children:de},Me)):r.jsx("div",{className:"leading-relaxed text-[var(--color-fg-muted)]",children:"No features specified for this template."})})]})]})}),r.jsxs("div",{className:"modal-footer",children:[r.jsx(ht,{variant:"outline",onClick:Se,children:"Close"}),r.jsxs(ht,{onClick:()=>{Se(),fe(O)},children:[r.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Deploy This Template"]})]})]})}),K&&r.jsx(eb,{type:K.type,message:K.message,onClose:()=>q(null)}),r.jsx(a,{})]}):r.jsx(bs,{})}const x2="reqres_getting_started_collapsed",UG='curl -H "x-api-key: <your_api_key>" https://reqres.in/api/users?page=2',WEe=6,YEe=[{q:"Is ReqRes a mock API or a real backend?",a:"ReqRes ships persistent projects with keys, collections, app users, logs, and automations. Start as a prototype and keep the same calls in production."},{q:"Do I need to manage servers or a database?",a:"No. Collections store JSON and are accessed over HTTPS. We host storage, auth, and logging so you stay inside your UI."},{q:"What key should I use where?",a:"Public key â safe in the browser for reads and starting logins. Private key â server/admin for schema and owner writes. Session token â user context for reads/writes scoped to that user."},{q:"How do I see my data?",a:"Use the Data Explorer to browse collections, filter records, and inspect logs for every request."}],KEe=[{id:"qa",label:"QA & testing"},{id:"frontend",label:"Frontend app"},{id:"educator",label:"Education"}];function FG(e){if(!e||e.length===0)return;const t=e.find(s=>s.id==="javascript"||s.language==="javascript")||e.find(s=>s.id==="react"||s.language==="tsx")||e[0];if(t)return{...t,id:t.id||"javascript",label:t.label||"JavaScript",language:t.language==="tsx"?"typescript":t.language}}function BG({projectId:e,progress:t}){return[{id:1,title:"Generate with AI",description:"Describe your app to an LLM and paste the prompt from our prompts page. It will scaffold a project, collection, and working code.",icon:rr,emphasis:!0,actionLabel:"Browse LLM Prompts",actionHref:e?`/prompts?projectId=${e}`:"/prompts",meta:"AI-first",status:t.hasCollection?"done":"pending"},{id:2,title:"Collection CRUD",description:"Your AI-generated code already calls collection endpoints. Open Data Explorer to inspect and edit records.",icon:Rn,actionLabel:"Open Data Explorer",actionHref:e?`/data-explorer?projectId=${e}`:"/projects",meta:"Collections",status:t.hasCollection?"done":"pending",docSection:"collections"},{id:3,title:"Add app-user auth (optional)",description:"Invite a user with magic links so data is scoped per person.",icon:WT,actionLabel:"App users",actionHref:e?`/app-users?projectId=${e}`:"/app-users",meta:"Optional",status:t.hasAppUser?"done":"pending",docSection:"app-users"},{id:4,title:"View logs",description:"Every request is logged. Use logs to debug and verify your integration.",icon:nc,actionLabel:"View logs",actionHref:"/logs",status:t.requestMade?"done":"pending"}]}function JEe({projectId:e,progress:t,isReady:s}){const n=s?"Open Data Explorer":"Create project",a=e?`/data-explorer?projectId=${e}`:"/projects",o=!!t.requestMade;return[{id:1,title:"Create API key",description:"Generate a classic API key for fast, predictable test data.",icon:_d,actionLabel:"Get API key",actionHref:"/api-keys",meta:"Classic key",status:o?"done":"pending"},{id:2,title:"Call a classic endpoint",description:"Copy the curl request to /api/users and confirm the response.",icon:mo,code:[{id:"curl",label:"curl",language:"bash",code:UG}],meta:"First request",status:o?"done":"pending"},{id:3,title:"Create project + collection (optional)",description:"Use projects when you need persistent fixtures or multi-user data.",icon:Rn,actionLabel:n,actionHref:a,meta:"Optional",status:t.hasCollection?"done":"pending"},{id:4,title:"View logs",description:"Verify every request and response as you test.",icon:nc,actionLabel:"View logs",actionHref:"/logs",status:o?"done":"pending"}]}const XEe=`curl -X POST -H "x-api-key: <your_api_key>" -H "Content-Type: application/json" \\ 3758 -d '{"name":"Jane","job":"teacher"}' \\ 3759 https://reqres.in/api/users`;function QEe({progress:e}){const t=!!e.requestMade;return[{id:1,title:"Get a free API key",description:"Classic keys work well for demos, worksheets, and classroom labs.",icon:_d,actionLabel:"Get API key",actionHref:"/api-keys",meta:"Classic key",status:t?"done":"pending"}
3759,{id:2,title:"Try the basics",description:"Send a GET to /api/users and a POST to /api/users to see predictable responses.",icon:mo,code:[{id:"get",label:"GET",language:"bash",code:UG},{id:"post",label:"POST",language:"bash",code:XEe}],meta:"First request",status:t?"done":"pending"},{id:3,title:"Create your own data (optional)",description:"Create a project and collection for custom fixtures your learners can use.",icon:Rn,actionLabel:"Create project",actionHref:"/projects",meta:"Optional",status:e.hasCollection?"done":"pending"},{id:4,title:"View logs",description:"Show learners the request/response log for every call they make.",icon:nc,actionLabel:"View logs",actionHref:"/logs",status:t?"done":"pending"}]}function ZEe({track:e,project:t,projectName:s,projectId:n,progress:a,isReady:o}){return e==="qa"?JEe({projectId:n,progress:a,isReady:o}):e==="educator"?QEe({progress:a}):BG({projectId:n,progress:a})}function e5e({progress:e={},steps:t,track:s}){const n=!!e.requestMade,a=s==="qa"?[{title:"Key",done:n},{title:"First request",done:n},{title:"Logs",done:n}]:s==="educator"?[{title:"Key",done:n},{title:"Basics",done:n},{title:"Data",done:!!e.hasCollection},{title:"Logs",done:n}]:[{title:"Generate",done:!!e.hasCollection},{title:"Data",done:!!e.hasCollection},{title:"Auth",done:!!e.hasAppUser||!!e.appUserLoggedIn},{title:"Ship!",done:!!e.collectionDataFetched||!!e.recordCreated||!!e.requestMade}],o=a.filter(f=>f.done).length,i=Math.min(100,Math.max(WEe,o/a.length*100)),l=a.findIndex(f=>!f.done),c=l===-1?a.length-1:l,u=t.find(f=>f.status!=="done")||t[t.length-1];return{stages:a,percent:i,activeIndex:c,nextStep:u}}function t5e(e,t){var s,n;if(!t.length)return null;if(e==="frontend"){const a=t.find(o=>o.emphasis&&o.status!=="done")||t.find(o=>o.emphasis);return(a==null?void 0:a.id)||((s=t.find(o=>o.status!=="done"))==null?void 0:s.id)||t[0].id}return(e==="qa"||e==="educator")&&((n=t.find(a=>a.id===2))==null?void 0:n.id)||t[0].id}function qG({project:e,className:t="",initialCollapsed:s,expandSignal:n,primaryButtonClass:a=Jt.primary,secondaryButtonClass:o=Jt.secondary,textCtaClass:i=od.ctaDark,codeBlockClass:l=ud.dark,showJourneyBar:c=!0,progress:u={}}){var ae,H;const{ClipboardToast:f}=hm(),h=(e==null?void 0:e.name)||"your project",g=e==null?void 0:e.id,v=!!(e!=null&&e.id),y=s??(!!v&&(!!u.hasCollection||!!u.hasAppUser||!!u.recordCreated||!!u.collectionDataFetched||!!u.requestMade)),[_,j]=x.useState(()=>{if(typeof window>"u")return y??!1;const U=window.localStorage.getItem(x2);return U==="true"||U==="false"?U==="true":y??!1}),[w,k]=x.useState(null);x.useEffect(()=>{if(typeof window>"u")return;if(s!==void 0){j(s);return}const U=window.localStorage.getItem(x2);if(U==="true"||U==="false"){j(U==="true");return}j(y??!1)},[s,y]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(x2,String(_))},[_]),x.useEffect(()=>{n!==void 0&&j(!1)},[n]);const{status:S}=_w(),E=KT(S,{hasCollections:!!u.hasCollection}),[T,A]=x.useState(()=>K_()),[R,I]=x.useState(null),L=x.useRef(null);x.useEffect(()=>Pq(()=>{A(K_())}),[]);const M=T??E,O=x.useMemo(()=>ZEe({track:M,project:e,projectName:h,projectId:g,progress:u,isReady:v}),[M,v,e,g,h,u]),z=x.useMemo(()=>BG({projectId:g,progress:u}),[v,e,g,h,u]),X=e5e({progress:u,steps:O,track:M}),W=O.filter(U=>U.status==="done").length,K=O.length,q=FG(jG(g?{id:g,slug:e==null?void 0:e.slug}:void 0)),J=x.useMemo(()=>{if(M==="qa")return{headline:"Test APIs fast (without standing up a backend)",subhead:"Grab a classic key, send a request, and verify logs in minutes.",helper:"Fast key â predictable data â logs you can trust.",primaryCta:{label:"Get a free API key",href:"/api-keys"},secondaryCta:{label:"Send a test request",href:"/examples/notes-app"}};if(M==="educator")return{headline:"Teach APIs with predictable data",subhead:"Use the classic key and endpoints for demos, labs, and lessons.",helper:"Key â examples â classroom-ready handoff.",primaryCta:{label:"Get a free API key",href:"/api-keys"},secondaryCta:{label:"Open classic API console",href:"/documentation"}};const U=g?`/data-explorer?projectId=${g}`:"/projects";return{headline:"Ship a client-only app with real users",subhead:`Projects give ${h} app users, sessions, and per-user CRUD.`,helper:"Create a project â add a collection â invite a user â write data as them.",primaryCta:{label:g?"Open Data Explorer":"Create project",href:U},secondaryCta:{label:"Open Notes example",href:Ha}}},[M,g,h]),F=J.primaryCta,V=J.secondaryCta,$=((ae=X.nextStep)==null?void 0:ae.actionHref)||F.href,B=((H=X.nextStep)==null?void 0:H.actionLabel)||F.label;return x.useEffect(()=>{L.current!==M&&(k(t5e(M,O)),I(null),L.current=M)},[M,O]),_?r.jsx("section",{className:`max-w-6xl mx-auto rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-6 py-4 md:px-8 md:py-4 shadow-[0_18px_45px_var(--color-shadow)] ${t}`,children:r.jsxs("div",{className:"space-y-3 md:space-y-4",children:[c?r.jsx(C$,{stages:X.stages,percent:X.percent,activeIndex:X.activeIndex}):null,r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-3 md:gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[11px] font-semibold tracking-[0.16em] uppercase text-[var(--color-fg-muted)]",children:"GETTING STARTED"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] md:text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("span",{className:"font-medium text-[var(--color-fg-default)]",children:[W,"/",K," steps done"]}),r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] px-3 py-1",children:[r.jsx("span",{className:"text-[11px] font-medium text-[var(--color-fg-muted)]",children:"Next:"}),r.jsx(dt,{to:$,className:"inline-flex items-center gap-1 text-[11px] font-semibold text-[var(--color-accent-purple)] hover:text-[var(--color-accent-purple-hover)]",children:B})]})]}),r.jsx("div",{className:"relative h-1.5 w-full rounded-full bg-[var(--color-bg-alt)] overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 bg-[var(--color-accent-blue)] transition-[width] duration-700 ease-out",style:{width:`${X.percent}%`}})})]}),r.jsx("button",{type:"button",className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",onClick:()=>j(!1),"aria-label":"Expand getting started",children:r.jsx(sr,{className:"w-4 h-4"})})]})]})}):r.jsxs("section",{className:`max-w-6xl mx-auto rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-6 py-6 md:px-8 md:py-7 shadow-[0_18px_45px_var(--color-shadow)] ${t}`,children:[c?r.jsx(C$,{stages:X.stages,percent:X.percent,activeIndex:X.activeIndex}):null,r.jsxs("div",{className:"mt-4 flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[11px] font-semibold tracking-[0.16em] uppercase text-[var(--color-fg-muted)]",children:"GETTING STARTED"}),r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:J.headline}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:J.subhead}),J.helper&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:J.helper})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)] text-right",children:"Choose a track that matches what you need today."}),r.jsx("div",{className:"inline-flex items-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-1 text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:KEe.map(U=>r.jsx("button",{type:"button",className:`rounded-md px-3 py-1.5 transition ${M===U.id?"bg-[var(--color-bg-hover)] text-[var(--color-fg-default)] shadow":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)]"}`,onClick:()=>{ZC(U.id),A(U.id)},"aria-pressed":M===U.id,children:U.label},U.id))}),r.jsxs("div",{className:"flex items-center gap-2",children:[V&&r.jsx(dt,{className:`${i} text-xs md:text-sm`,to:V.href,children:V.label}),r.jsx(dt,{className:`${a} text-xs md:text-sm`,to:F.href,children:F.label}),r.jsx("button",{type:"button",className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",onClick:()=>j(!0),"aria-label":"Collapse getting started",children:r.jsx(cd,{className:"w-4 h-4"})})]})]})]}),r.jsx("div",{className:"mt-6 space-y-3",children:O.map(U=>r.jsx(S$,{step:U,codeBlockClass:l,secondaryButtonClass:o,open:w===U.id,onToggle:()=>k(oe=>oe===U.id?null:U.id)},U.id))}),M==="qa"?r.jsxs("details",{className:"mt-6 group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("summary",{className:"flex cursor-pointer items-center justify-between px-4 py-3 text-sm font-medium text-[var(--color-fg-default)]",children:[r.jsx("span",{children:"See advanced / frontend flow"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)] group-open:hidden",children:"Show"}),r.jsx("span",{className:"hidden text-[11px] text-[var(--color-fg-secondary)] group-open:inline",children:"Hide"})]}),r.jsx("div",{className:"border-t border-[var(--color-border-default)] px-4 py-4 space-y-3",children:z.map(U=>r.jsx(S$,{step:U,codeBlockClass:l,secondaryButtonClass:o,open:R===U.id,onToggle:()=>I(oe=>oe===U.id?null:U.id)},`advanced-${U.id}`))})]}):null,M==="educator"?r.jsxs("div",{className:"mt-4 text-xs text-[var(--color-fg-muted)]",children:["Need auth lessons?"," ",r.jsx("button",{type:"button",className:`${i} text-xs`,onClick:()=>{ZC("frontend"),A("frontend")},children:"Switch to Frontend app track."})]}):null,M==="frontend"?r.jsxs("details",{className:"mt-8 group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("summary",{className:"flex cursor-pointer items-center justify-between px-4 py-3 text-sm font-medium text-[var(--color-fg-default)]",children:[r.jsx("span",{children:"Advanced reference"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)] group-open:hidden",children:"Show"}),r.jsx("span",{className:"hidden text-[11px] text-[var(--color-fg-secondary)] group-open:inline",children:"Hide"})]}),r.jsxs("div",{className:"border-t border-[var(--color-border-default)] px-4 py-4 space-y-4",children:[r.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Keys"}),r.jsx("p",{className:"text-[12px] text-[var(--color-fg-muted)]",children:"Public key for browser reads + magic link start. Private key for admin CRUD. Session token for per-user reads and writes."})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"API crib"}),r.jsx("p",{className:"text-[12px] text-[var(--color-fg-muted)]",children:"POST /api/app-users/login â POST /api/app-users/verify â GET/POST /app/collections/:slug/records with Authorization: Bearer session_token."})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Docs & edge cases"}),r.jsx("p",{className:"text-[12px] text-[var(--color-fg-muted)]",children:"Rate limits, automations, and error codes live in the docs. Only open them when you need to unblock a step."})]})]}),q?r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Full flow (JavaScript)"}),r.jsx(dt,{className:i,to:"/documentation",children:"View docs"})]}),r.jsx(Vt,{className:l,variants:[q],readMoreHref:"/documentation?section=api-call-crib",readMoreLabel:"More crib notes"})]}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"FAQ"}),r.jsx("div",{className:"space-y-2",children:YEe.map(U=>r.jsxs("details",{className:"group rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsxs("summary",{className:"flex cursor-pointer items-center justify-between text-sm text-[var(--color-fg-default)]",children:[r.jsx("span",{children:U.q}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)] group-open:hidden",children:"Show"}),r.jsx("span",{className:"hidden text-[11px] text-[var(--color-fg-secondary)] group-open:inline",children:"Hide"})]}),r.jsx("p",{className:"mt-2 text-sm text-[var(--color-fg-secondary)]",children:U.a}
3759)]},U.q))})]})]})]}):null,M!=="frontend"&&r.jsx("div",{className:"mt-6 rounded-xl border border-[var(--color-border-secondary)] bg-[var(--color-bg-card)] px-4 py-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(rr,{className:"h-5 w-5 text-[var(--color-accent-purple)] mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:M==="educator"?"Generate lesson material with AI":"Build with AI"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] mt-0.5",children:M==="educator"?"Use our LLM prompts to create example apps and exercises for your class.":"Copy a prompt into your favourite AI tool to start building apps or test suites against your ReqRes backend."})]})]}),r.jsx(dt,{to:g?`/prompts?projectId=${g}`:"/prompts",className:`${a} text-xs shrink-0`,children:"Browse LLM Prompts â"})]})}),M==="frontend"&&r.jsxs("div",{className:"mt-4 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Prefer to learn by example?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Start with a real notes app instead of docs."})]}),r.jsx(dt,{className:`${a} text-xs shrink-0`,to:Ha,children:"Open Notes example"})]}),r.jsx("div",{className:"mt-4 pt-4 border-t border-[var(--color-border-secondary)]",children:r.jsxs("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:["Need inspiration? See complete apps built on ReqRes:"," ",r.jsx("a",{href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Task Manager"})," · ",r.jsx("a",{href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",className:"text-indigo-400 hover:text-indigo-300 transition",children:"Waitlist App"})]})}),r.jsx(f,{})]})}function S$({step:e,codeBlockClass:t,secondaryButtonClass:s,open:n,onToggle:a}){const o=e.icon,i=FG(e.code),l=e.emphasis?"border-[var(--color-accent-blue)]/30 bg-[var(--color-bg-card)] shadow-[0_8px_30px_var(--color-shadow-light)]":"border-[var(--color-border-default)] bg-[var(--color-bg-card)]",c=e.emphasis?"bg-[var(--color-bg-alt)] border-[var(--color-border-secondary)] text-[var(--color-accent-blue)]":"bg-[var(--color-bg-alt)] border-[var(--color-border-secondary)] text-[var(--color-accent-purple)]";return r.jsxs("div",{className:`rounded-xl border p-4 md:p-4.5 shadow-sm transition hover:bg-[var(--color-bg-hover)] ${l}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`flex h-9 w-9 items-center justify-center rounded-full border ${c}`,children:r.jsx(o,{className:"w-4 h-4"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-[11px] font-semibold tracking-[0.18em] uppercase text-[var(--color-fg-secondary)]",children:["Step ",e.id]}),e.meta&&r.jsx("span",{className:"inline-flex items-center rounded-full bg-[var(--color-bg-card)] border border-[var(--color-border-default)] px-2 py-0.5 text-[11px] text-[var(--color-fg-secondary)]",children:e.meta}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:e.title}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] leading-relaxed",children:e.description}),e.note&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:e.note}),e.actionHref&&e.actionLabel&&r.jsx(dt,{className:`${s} text-[11px] md:text-xs px-3 py-1.5 inline-flex items-center justify-center`,to:e.actionHref,children:e.actionLabel}),e.hint&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:e.hint})]})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-[11px] font-medium ${e.status==="done"?"bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)] border border-[var(--color-semantic-success)]/30":"bg-[var(--color-bg-alt)] text-[var(--color-accent-purple)] border border-[var(--color-accent-purple)]/30"}`,children:e.status==="done"?"Done":"Next"}),i&&r.jsx("button",{type:"button",onClick:a,className:"text-[11px] font-semibold text-[var(--color-accent-purple)] hover:text-[var(--color-accent-purple-hover)]",children:n?"Hide code":"View code"})]})]}),i&&n?r.jsx("div",{className:"mt-3",children:r.jsx(Vt,{className:t,variants:[i],readMoreHref:e.docSection?`/documentation?section=${e.docSection}`:void 0})}):null]})}function C$({stages:e,percent:t,activeIndex:s}){const[n,a]=x.useState(!1),o=Math.min(100,Math.max(6,t)),i=e.length>1?Math.min(100,Math.max(0,s/(e.length-1)*100)):0;x.useEffect(()=>{const u=setTimeout(()=>a(!0),600);return()=>clearTimeout(u)},[]);const l=n?o:0,c=n?i:0;return r.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-[var(--color-accent-blue)]/40 bg-[var(--color-bg-card)] px-4 py-3 shadow-[0_14px_38px_var(--color-shadow)]",children:[r.jsx("div",{"aria-hidden":!0,
3759className:"pointer-events-none absolute inset-0 bg-[var(--color-accent-blue)]/10 blur-3xl opacity-90"}),r.jsxs("div",{className:"relative flex items-center justify-between text-[11px] uppercase tracking-[0.16em] text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"font-semibold text-[var(--color-fg-default)]",children:"Launch path"}),r.jsxs("span",{className:"flex items-center gap-2 text-[10px] font-medium text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"inline-flex h-2 w-2 rounded-full bg-emerald-400 animate-pulse"}),Math.round(o),"% ready"]})]}),r.jsxs("div",{className:"relative mt-3 h-3 w-full overflow-hidden rounded-full bg-[var(--color-bg-alt)]",children:[r.jsx("div",{className:"absolute inset-0 bg-[var(--color-accent-blue)]/20 opacity-70"}),r.jsx("div",{className:`h-full bg-[var(--color-accent-blue)] ${n?"animate-[pulse_3s_ease-in-out_infinite]":""} transition-[width] duration-700 ease-out`,style:{width:`${l}%`}}),r.jsx("div",{className:"absolute top-1/2 h-5 w-5 -translate-y-1/2 -translate-x-1/2 rounded-full border border-[var(--color-accent-purple)]/40 bg-[var(--color-bg-card)] shadow-[0_0_0_8px_var(--color-shadow)] transition-all duration-500",style:{left:`${c}%`},children:r.jsx("div",{className:"absolute inset-1 rounded-full bg-gradient-to-br from-indigo-400 to-emerald-300"})})]}),r.jsx("div",{className:"relative mt-3 flex items-center gap-2",children:e.map((u,f)=>{const h=u.done?"done":f===s?"active":"idle",g="flex-1 text-center rounded-full border px-2 py-1 text-[11px] font-medium transition shadow-sm",v=h==="done"?"border-[var(--color-semantic-success)]/40 bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)]":h==="active"?"border-[var(--color-accent-purple)]/50 bg-[var(--color-accent-purple)]/10 text-[var(--color-fg-default)] shadow-[0_8px_22px_var(--color-shadow)]":"border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-secondary)]";return r.jsx("div",{className:`${g} ${v}`,children:u.title},u.title)})})]})}function s5e(){const{getToken:e,isLoaded:t,isSignedIn:s}=zt(),[n,a]=x.useState(null),[o,i]=x.useState(),[l,c]=x.useState(!0),[u,f]=x.useState(null);return x.useEffect(()=>{if(!t)return;let h=!0;return(async()=>{var v,y,_,j,w,k,S,E;try{if(c(!0),f(null),!s)throw new yt("Please sign in to view onboarding.",401);const T=await Ue(e);if(!T)throw new yt("Please sign in to view onboarding.",401);const[A,R]=await Promise.all([ue.get("/projects?limit=5",{authToken:T}),ue.get("/logs?limit=10",{authToken:T})]),I=((y=(v=A.data)==null?void 0:v.projects)==null?void 0:y[0])||null;let L,M,O=[],z=[];if(I)try{const[W,K,q,J]=await Promise.all([ue.get(`/data-explorer/collections?project_id=${I.id}`,{authToken:T}),ue.get(`/logs?project_id=${I.id}&limit=20`,{authToken:T}),ue.get(`/data-explorer/stats?project_id=${I.id}`,{authToken:T}),ue.get(`/api/app-users?project_id=${I.id}&limit=5`,{authToken:T})]);L=(((_=W.data)==null?void 0:_.data)||[]).length??0,z=((j=K.data)==null?void 0:j.data)||[],M=((k=(w=q.data)==null?void 0:w.stats)==null?void 0:k.totalDataItems)??null,O=((S=J.data)==null?void 0:S.data)||[]}catch(W){console.warn("Failed to load project onboarding data",W)}const X=yw({hasProject:!!I,collectionCount:L,totalDataItems:M,appUsers:O,projectLogs:z,logs:((E=R.data)==null?void 0:E.data)||[]});if(!h)return;a(I),i(X)}catch(T){if(console.error("Failed to load getting started context",T),!h)return;T instanceof yt?(f(T.message),T.status===401&&(a(null),i(void 0))):f("We could not load your project context. You can still follow the steps below.")}finally{h&&c(!1)}})(),()=>{h=!1}},[e,t,s]),r.jsx("div",{className:"px-4 py-6 md:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 md:p-7 shadow-[0_18px_45px_var(--color-shadow)] space-y-3",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Ship in minutes, not weeks."}),r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-end md:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl md:text-3xl font-semibold text-[var(--color-fg-default)]",children:"Getting started"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-3xl",children:"Ship a real, authenticated backend for your frontend without building servers or databases. Follow the launch path below to see the single next step."}),u&&r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300/90",children:u})]}),r.jsx("div",{className:"mt-2 flex flex-wrap gap-3 md:justify-end",children:r.jsx(dt,{className:`${Jt.primaryEmphasis} text-sm px-4 py-2`,to:"/dashboard",children:"Open dashboard"})})]})]}),l&&r.jsx(bs,{size:"sm",text:"Loading your project context...",className:"justify-start text-[var(--color-fg-secondary)]",textClassName:"text-sm text-[var(--color-fg-secondary)] animate-pulse"}),r.jsx(qG,{project:n,progress:o||{},className:"mt-2",initialCollapsed:!1}),r.jsx(a1,{})]})})}const Vg={"product-grid":`import React, { useState, useEffect } from 'react'; 3760 3761interface Product { 3762 id: number; 3763 name: string; 3764 price: number; 3765 description: string; 3766 category: string; 3767 image: string; 3768} 3769 3770export function ProductGrid() { 3771 const [products, setProducts] = useState<Product[]>([]); 3772 const [loading, setLoading] = useState(true); 3773 const [searchTerm, setSearchTerm] = useState(''); 3774 const [selectedCategory, setSelectedCategory] = useState('all'); 3775 3776 useEffect(() => { 3777 fetchProducts(); 3778 }, []); 3779 3780 const fetchProducts = async () => { 3781 try { 3782 const response = await fetch('https://reqres.in/api/custom/your-project/products'); 3783 const data = await response.json(); 3784 setProducts(data.data); 3785 } catch (error) { 3786 console.error('Failed to fetch products:', error); 3787 } finally {
3788 setLoading(false); 3789 } 3790 }; 3791 3792 const filteredProducts = products.filter(product => { 3793 const matchesSearch = product.name.toLowerCase().includes(searchTerm.toLowerCase()); 3794 const matchesCategory = selectedCategory === 'all' || product.category === selectedCategory; 3795 return matchesSearch && matchesCategory; 3796 }); 3797 3798 if (loading) { 3799 return ( 3800 <div className="flex items-center justify-center min-h-64"> 3801 <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div> 3802 </div> 3803 ); 3804 } 3805 3806 return ( 3807 <div className="max-w-6xl mx-auto p-6"> 3808 {/* Search and Filter */} 3809 <div className="mb-8 space-y-4"> 3810 <input 3811 type="text" 3812 placeholder="Search products..." 3813 value={searchTerm} 3814 onChange={(e) => setSearchTerm(e.target.value)} 3815 className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent" 3816 /> 3817 <select 3818 value={selectedCategory} 3819 onChange={(e) => setSelectedCategory(e.target.value)} 3820 className="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" 3821 > 3822 <option value="all">All Categories</option> 3823 <option value="Electronics">Electronics</option> 3824 <option value="Clothing">Clothing</option> 3825 <option value="Books">Books</option> 3826 </select> 3827 </div> 3828 3829 {/* Product Grid */} 3830 <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6"> 3831 {filteredProducts.map((product) => ( 3832 <div key={product.id} className="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow"> 3833 <img 3834 src={product.image} 3835 alt={product.name} 3836 className="w-full h-48 object-cover" 3837 /> 3838 <div className="p-4"> 3839 <h3 className="text-lg font-semibold text-gray-900">{product.name}</h3> 3840 <p className="text-gray-600 text-sm mt-1">{product.description}</p> 3841 <div className="flex justify-between items-center mt-4"> 3842 <span className="text-2xl font-bold text-green-600">\${product.price}</span> 3843 <button className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition-colors"> 3844 Add to Cart 3845 </button> 3846 </div> 3847 </div> 3848 </div> 3849 ))} 3850 </div> 3851 </div> 3852 ); 3853}`,"shopping-cart":`import React, { useState, useEffect } from 'react'; 3854 3855interface CartItem { 3856 id: number; 3857 name: string; 3858 price: number; 3859 quantity: number; 3860 image: string; 3861} 3862 3863export function ShoppingCart() { 3864 const [cart, setCart] = useState<CartItem[]>([]); 3865 const [loading, setLoading] = useState(false); 3866 3867 // Load cart from localStorage on mount 3868 useEffect(() => { 3869 const savedCart = localStorage.getItem('shopping-cart'); 3870 if (savedCart) { 3871 setCart(JSON.parse(savedCart)); 3872 } 3873 }, []); 3874 3875 // Save cart to localStorage whenever it changes 3876 useEffect(() => { 3877 localStorage.setItem('shopping-cart', JSON.stringify(cart)); 3878 }, [cart]); 3879 3880 const addToCart = (product: Omit<CartItem, 'quantity'>) => { 3881 setCart(prev => { 3882 const existing = prev.find(item => item.id === product.id); 3883 if (existing) { 3884 return prev.map(item => 3885 item.id === product.id 3886 ? { ...item, quantity: item.quantity + 1 } 3887 : item 3888 ); 3889 } 3890 return [...prev, { ...product, quantity: 1 }]; 3891 }); 3892 }; 3893 3894 const updateQuantity = (productId: number, quantity: number) => { 3895 if (quantity <= 0) { 3896 removeFromCart(productId); 3897 return; 3898 } 3899 3900 setCart(prev => 3901 prev.map(item => 3902 item.id === productId 3903 ? { ...item, quantity } 3904 : item 3905 ) 3906 ); 3907 }; 3908 3909 const removeFromCart = (productId: number) => { 3910 setCart(prev => prev.filter(item => item.id !== productId)); 3911 }; 3912 3913 const getTotal = () => { 3914 return cart.reduce((sum, item) => sum + (item.price * item.quantity), 0); 3915 }; 3916 3917 const checkout = async () => { 3918 if (cart.length === 0) return; 3919
3920 setLoading(true); 3921 try { 3922 const orderData = { 3923 items: cart.map(item => ({ 3924 product_id: item.id, 3925 quantity: item.quantity, 3926 price: item.price 3927 })), 3928 total: getTotal() 3929 }; 3930 3931 const response = await fetch('https://reqres.in/api/custom/your-project/orders', { 3932 method: 'POST', 3933 headers: { 3934 'Content-Type': 'application/json', 3935 'x-api-key': 'your-api-key' 3936 }, 3937 body: JSON.stringify(orderData) 3938 }); 3939 3940 if (response.ok) { 3941 // Clear cart after successful checkout 3942 setCart([]); 3943 localStorage.removeItem('shopping-cart'); 3944 alert('Order placed successfully!'); 3945 } 3946 } catch (error) { 3947 console.error('Checkout failed:', error); 3948 alert('Checkout failed. Please try again.'); 3949 } finally { 3950 setLoading(false); 3951 } 3952 }; 3953 3954 return ( 3955 <div className="max-w-4xl mx-auto p-6"> 3956 <h2 className="text-2xl font-bold mb-6">Shopping Cart</h2> 3957 3958 {cart.length === 0 ? ( 3959 <div className="text-center py-12"> 3960 <p className="text-gray-500 text-lg">Your cart is empty</p> 3961 <p className="text-gray-400">Add some products to get started!</p> 3962 </div> 3963 ) : ( 3964 <> 3965 <div className="space-y-4"> 3966 {cart.map(item => ( 3967 <div key={item.id} className="flex items-center space-x-4 bg-white p-4 rounded-lg shadow"> 3968 <img 3969 src={item.image} 3970 alt={item.name} 3971 className="w-16 h-16 object-cover rounded" 3972 /> 3973 <div className="flex-1"> 3974 <h3 className="font-semibold">{item.name}</h3> 3975 <p className="text-gray-600">\${item.price}</p> 3976 </div> 3977 <div className="flex items-center space-x-2"> 3978 <button 3979 onClick={() => updateQuantity(item.id, item.quantity - 1)} 3980 className="w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300" 3981 > 3982 - 3983 </button> 3984 <span className="w-8 text-center">{item.quantity}</span> 3985 <button 3986 onClick={() => updateQuantity(item.id, item.quantity + 1)} 3987 className="w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300" 3988 > 3989 + 3990 </button> 3991 </div> 3992 <div className="text-right"> 3993 <p className="font-semibold">\${(item.price * item.quantity).toFixed(2)}</p> 3994 <button 3995 onClick={() => removeFromCart(item.id)} 3996 className="text-red-500 text-sm hover:text-red-700" 3997 > 3998 Remove 3999 </button> 4000 </div> 4001 </div> 4002 ))} 4003 </div> 4004 4005 <div className="mt-8 bg-white p-6 rounded-lg shadow"> 4006 <div className="flex justify-between items-center mb-4"> 4007 <span className="text-lg font-semibold">Total:</span> 4008 <span className="text-2xl font-bold text-green-600">\${getTotal().toFixed(2)}</span> 4009 </div> 4010 <button 4011 onClick={checkout} 4012 disabled={loading} 4013 className="w-full bg-green-500 text-white py-3 rounded-lg hover:bg-green-600 disabled:opacity-50" 4014 > 4015 {loading ? 'Processing...' : 'Checkout'} 4016 </button> 4017 </div> 4018 </> 4019 )} 4020 </div> 4021 ); 4022}`,"real-time-feed":`import React, { useState, useEffect, useRef, useCallback } from 'react'; 4023import { useInView } from 'react-intersection-observer'; 4024 4025interface Post { 4026 id: number; 4027 user_id: number; 4028 content: string; 4029 image?: string; 4030 likes: number; 4031 comments: number; 4032 created_at: string; 4033 user: { 4034 name: string; 4035 avatar: string; 4036 }; 4037} 4038 4039export function SocialFeed() { 4040 const [posts, setPosts] = useState<Post[]>([]); 4041 const [loading, setLoading] = useState(false); 4042 const [hasMore, setHasMore] = useState(true); 4043 const [page, setPage] = useState(1); 4044 const [ref, inView] = useInView(); 4045 4046 const fetchPosts = useCallback(async (pageNum: number) => { 4047 try {
4048 setLoading(true); 4049 const response = await fetch( 4050 \`https://reqres.in/api/custom/your-project/posts?page=\${pageNum}&limit=10\` 4051 ); 4052 const data = await response.json(); 4053 4054 if (pageNum === 1) { 4055 setPosts(data.data); 4056 } else { 4057 setPosts(prev => [...prev, ...data.data]); 4058 } 4059 4060 setHasMore(data.data.length === 10); 4061 } catch (error) { 4062 console.error('Failed to fetch posts:', error); 4063 } finally { 4064 setLoading(false); 4065 } 4066 }, []); 4067 4068 useEffect(() => { 4069 fetchPosts(1); 4070 }, [fetchPosts]); 4071 4072 useEffect(() => { 4073 if (inView && hasMore && !loading) { 4074 setPage(prev => prev + 1); 4075 fetchPosts(page + 1); 4076 } 4077 }, [inView, hasMore, loading, fetchPosts, page]); 4078 4079 const handleLike = async (postId: number) => { 4080 try { 4081 await fetch(\`https://reqres.in/api/custom/your-project/posts/\${postId}/like\`, { 4082 method: 'POST', 4083 headers: { 4084 'Content-Type': 'application/json', 4085 'x-api-key': 'your-api-key' 4086 } 4087 }); 4088 4089 setPosts(prev => 4090 prev.map(post => 4091 post.id === postId 4092 ? { ...post, likes: post.likes + 1 } 4093 : post 4094 ) 4095 ); 4096 } catch (error) { 4097 console.error('Failed to like post:', error); 4098 } 4099 }; 4100 4101 const formatTimeAgo = (dateString: string) => { 4102 const date = new Date(dateString); 4103 const now = new Date(); 4104 const diffInMinutes = Math.floor((now.getTime() - date.getTime()) / (1000 * 60)); 4105 4106 if (diffInMinutes < 60) return \`\${diffInMinutes}m ago\`; 4107 if (diffInMinutes < 1440) return \`\${Math.floor(diffInMinutes / 60)}h ago\`; 4108 return \`\${Math.floor(diffInMinutes / 1440)}d ago\`; 4109 }; 4110 4111 return ( 4112 <div className="max-w-2xl mx-auto p-4"> 4113 <h2 className="text-2xl font-bold mb-6">Social Feed</h2> 4114 4115 <div className="space-y-6"> 4116 {posts.map(post => ( 4117 <div key={post.id} className="bg-white rounded-lg shadow-md p-6"> 4118 <div className="flex items-center space-x-3 mb-4"> 4119 <img 4120 src={post.user.avatar} 4121 alt={post.user.name} 4122 className="w-10 h-10 rounded-full" 4123 /> 4124 <div> 4125 <h3 className="font-semibold">{post.user.name}</h3> 4126 <p className="text-gray-500 text-sm">{formatTimeAgo(post.created_at)}</p> 4127 </div> 4128 </div> 4129 4130 <p className="text-gray-800 mb-4">{post.content}</p> 4131 4132 {post.image && ( 4133 <img 4134 src={post.image} 4135 alt="Post" 4136 className="w-full rounded-lg mb-4" 4137 /> 4138 )} 4139 4140 <div className="flex items-center space-x-6"> 4141 <button 4142 onClick={() => handleLike(post.id)} 4143 className="flex items-center space-x-2 text-gray-500 hover:text-red-500" 4144 > 4145 <span>â¤ï¸</span> 4146 <span>{post.likes}</span> 4147 </button> 4148 <button className="flex items-center space-x-2 text-gray-500 hover:text-blue-500"> 4149 <span>ð¬</span> 4150 <span>{post.comments}</span> 4151 </button> 4152 </div> 4153 </div> 4154 ))} 4155 </div> 4156 4157 {hasMore && ( 4158 <div ref={ref} className="text-center py-4"> 4159 {loading ? ( 4160 <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"></div> 4161 ) : ( 4162 <p className="text-gray-500">Loading more posts...</p> 4163 )} 4164 </div> 4165 )} 4166 4167 {!hasMore && posts.length > 0 && ( 4168 <div className="text-center py-4"> 4169 <p className="text-gray-500">No more posts to load</p> 4170 </div> 4171 )} 4172 </div> 4173 ); 4174}`,"dashboard-charts":`import React, { useState, useEffect } from 'react'; 4175import { 4176 LineChart, 4177 Line, 4178 BarChart, 4179 Bar, 4180 PieChart, 4181 Pie, 4182 Cell, 4183 XAxis, 4184 YAxis, 4185 CartesianGrid, 4186 Tooltip, 4187 Legend, 4188 ResponsiveContainer 4189} from 'recharts'; 4190import { format, subDays } from 'date-fns'; 4191 4192interface AnalyticsData { 4193 sales: Array<{ 4194 date: string; 4195 amount: number; 4196 orders: number; 4197 }>; 4198 categories: Array<{ 4199 name: string; 4200 value: number; 4201 color: string; 4202 }>; 4203 topProducts: Array<{ 4204 name: string; 4205 sales: number; 4206 }>; 4207} 4208 4209const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884D8']; 4210 4211export function Dashboard() { 4212 const [data, setData] = useState<AnalyticsData | null>(null); 4213 const [loading, setLoading] = useState(true); 4214 const [timeRange, setTimeRange] = useState('7d'); 4215 4216 useEffect(() => { 4217 fetchAnalytics(); 4218 }, [timeRange]); 4219 4220 const fetchAnalytics = async () => { 4221 try {
4222 setLoading(true); 4223 const response = await fetch( 4224 \`https://reqres.in/api/custom/your-project/analytics?range=\${timeRange}\` 4225 ); 4226 const analyticsData = await response.json(); 4227 setData(analyticsData.data); 4228 } catch (error) { 4229 console.error('Failed to fetch analytics:', error); 4230 } finally { 4231 setLoading(false); 4232 } 4233 }; 4234 4235 if (loading) { 4236 return ( 4237 <div className="flex items-center justify-center min-h-64"> 4238 <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div> 4239 </div> 4240 ); 4241 } 4242 4243 if (!data) { 4244 return <div className="text-center py-8">No data available</div>; 4245 } 4246 4247 return ( 4248 <div className="max-w-7xl mx-auto p-6"> 4249 <div className="flex justify-between items-center mb-8"> 4250 <h1 className="text-3xl font-bold">Dashboard</h1> 4251 <select 4252 value={timeRange} 4253 onChange={(e) => setTimeRange(e.target.value)} 4254 className="px-4 py-2 border border-gray-300 rounded-lg" 4255 > 4256 <option value="7d">Last 7 days</option> 4257 <option value="30d">Last 30 days</option> 4258 <option value="90d">Last 90 days</option> 4259 </select> 4260 </div> 4261 4262 <div className="grid grid-cols-1 lg:grid-cols-2 gap-8"> 4263 {/* Sales Trend Chart */} 4264 <div className="bg-white p-6 rounded-lg shadow-md"> 4265 <h3 className="text-xl font-semibold mb-4">Sales Trend</h3> 4266 <ResponsiveContainer width="100%" height={300}> 4267 <LineChart data={data.sales}> 4268 <CartesianGrid strokeDasharray="3 3" /> 4269 <XAxis 4270 dataKey="date" 4271 tickFormatter={(value) => format(new Date(value), 'MMM dd')} 4272 /> 4273 <YAxis /> 4274 <Tooltip 4275 labelFormatter={(value) => format(new Date(value), 'MMM dd, yyyy')} 4276 /> 4277 <Legend /> 4278 <Line 4279 type="monotone" 4280 dataKey="amount" 4281 stroke="#8884d8" 4282 strokeWidth={2} 4283 name="Sales Amount" 4284 /> 4285 <Line 4286 type="monotone" 4287 dataKey="orders" 4288 stroke="#82ca9d" 4289 strokeWidth={2} 4290 name="Number of Orders" 4291 /> 4292 </LineChart> 4293 </ResponsiveContainer> 4294 </div> 4295 4296 {/* Category Distribution */} 4297 <div className="bg-white p-6 rounded-lg shadow-md"> 4298 <h3 className="text-xl font-semibold mb-4">Sales by Category</h3> 4299 <ResponsiveContainer width="100%" height={300}> 4300 <PieChart> 4301 <Pie 4302 data={data.categories} 4303 cx="50%" 4304 cy="50%" 4305 labelLine={false} 4306 label={({ name, percent }) => \`\${name} \${(percent * 100).toFixed(0)}%\`} 4307 outerRadius={80} 4308 fill="#8884d8" 4309 dataKey="value" 4310 > 4311 {data.categories.map((entry, index) => ( 4312 <Cell key={\`cell-\${index}\`} fill={entry.color} /> 4313 ))} 4314 </Pie> 4315 <Tooltip /> 4316 </PieChart> 4317 </ResponsiveContainer> 4318 </div> 4319 4320 {/* Top Products */} 4321 <div className="bg-white p-6 rounded-lg shadow-md lg:col-span-2"> 4322 <h3 className="text-xl font-semibold mb-4">Top Selling Products</h3> 4323 <ResponsiveContainer width="100%" height={300}> 4324 <BarChart data={data.topProducts}> 4325 <CartesianGrid strokeDasharray="3 3" /> 4326 <XAxis dataKey="name" /> 4327 <YAxis /> 4328 <Tooltip /> 4329 <Bar dataKey="sales" fill="#8884d8" /> 4330 </BarChart> 4331 </ResponsiveContainer> 4332 </div> 4333 </div> 4334 4335 {/* Summary Cards */} 4336 <div className="grid grid-cols-1 md:grid-cols-4 gap-6 mt-8"> 4337 <div className="bg-white p-6 rounded-lg shadow-md"> 4338 <h4 className="text-gray-500 text-sm">Total Sales</h4> 4339 <p className="text-2xl font-bold text-green-600"> 4340 \${data.sales.reduce((sum, day) =>
4340 sum + day.amount, 0).toLocaleString()} 4341 </p> 4342 </div> 4343 <div className="bg-white p-6 rounded-lg shadow-md"> 4344 <h4 className="text-gray-500 text-sm">Total Orders</h4> 4345 <p className="text-2xl font-bold text-blue-600"> 4346 {data.sales.reduce((sum, day) => sum + day.orders, 0)} 4347 </p> 4348 </div> 4349 <div className="bg-white p-6 rounded-lg shadow-md"> 4350 <h4 className="text-gray-500 text-sm">Average Order Value</h4> 4351 <p className="text-2xl font-bold text-purple-600"> 4352 \${( 4353 data.sales.reduce((sum, day) => sum + day.amount, 0) / 4354 data.sales.reduce((sum, day) => sum + day.orders, 0) 4355 ).toFixed(2)} 4356 </p> 4357 </div> 4358 <div className="bg-white p-6 rounded-lg shadow-md"> 4359 <h4 className="text-gray-500 text-sm">Categories</h4> 4360 <p className="text-2xl font-bold text-orange-600"> 4361 {data.categories.length} 4362 </p> 4363 </div> 4364 </div> 4365 </div> 4366 ); 4367}`,"mobile-app":`import React, { useState, useEffect } from 'react'; 4368import { 4369 View, 4370 Text, 4371 FlatList, 4372 Image, 4373 TouchableOpacity, 4374 StyleSheet, 4375 RefreshControl, 4376 Alert, 4377 ActivityIndicator, 4378} from 'react-native'; 4379import AsyncStorage from '@react-native-async-storage/async-storage'; 4380 4381interface Product { 4382 id: number; 4383 name: string; 4384 price: number; 4385 description: string; 4386 image: string; 4387 category: string; 4388} 4389 4390export default function ProductList() { 4391 const [products, setProducts] = useState<Product[]>([]); 4392 const [loading, setLoading] = useState(true); 4393 const [refreshing, setRefreshing] = useState(false); 4394 const [offline, setOffline] = useState(false); 4395 4396 const API_BASE_URL = 'https://reqres.in/api/custom/your-project'; 4397 const API_KEY = 'your-api-key'; 4398 4399 const fetchProducts = async (isRefresh = false) => { 4400 try { 4401 setOffline(false); 4402 const response = await fetch(\`\${API_BASE_URL}/products\`, { 4403 headers: { 4404 'x-api-key': API_KEY, 4405 'Content-Type': 'application/json', 4406 }, 4407 }); 4408 4409 if (!response.ok) { 4410 throw new Error('Network response was not ok'); 4411 } 4412 4413 const data = await response.json(); 4414 setProducts(data.data); 4415 4416 // Cache the data for offline use 4417 await AsyncStorage.setItem('cached_products', JSON.stringify(data.data)); 4418 } catch (error) { 4419 console.error('Failed to fetch products:', error); 4420 setOffline(true); 4421 4422 // Load cached data if available 4423 try { 4424 const cachedData = await AsyncStorage.getItem('cached_products'); 4425 if (cachedData) { 4426 setProducts(JSON.parse(cachedData)); 4427 } 4428 } catch (cacheError) { 4429 console.error('Failed to load cached data:', cacheError); 4430 } 4431 } finally { 4432 setLoading(false); 4433 setRefreshing(false); 4434 } 4435 }; 4436 4437 useEffect(() => { 4438 fetchProducts(); 4439 }, []); 4440 4441 const onRefresh = () => { 4442 setRefreshing(true); 4443 fetchProducts(true); 4444 }; 4445 4446 const addToCart = async (product: Product) => { 4447 try { 4448 // Get current cart from storage 4449 const cartData = await AsyncStorage.getItem('shopping_cart'); 4450 const cart = cartData ? JSON.parse(cartData) : []; 4451 4452 // Check if product already in cart 4453 const existingIndex = cart.findIndex((item: any) => item.id === product.id); 4454 4455 if (existingIndex >= 0) { 4456 // Update quantity 4457 cart[existingIndex].quantity += 1; 4458 } else { 4459 // Add new item 4460 cart.push({ ...product, quantity: 1 }); 4461 } 4462 4463 // Save updated cart 4464 await AsyncStorage.setItem('shopping_cart', JSON.stringify(cart)); 4465 4466 Alert.alert('Success', 'Product added to cart!'); 4467 } catch (error) { 4468 Alert.alert('Error', 'Failed to add product to cart'); 4469 } 4470 }; 4471 4472 const renderProduct = ({ item }: { item: Product }) => ( 4473 <View style={styles.productCard}> 4474 <Image source={{ uri: item.image }} style={styles.productImage} /> 4475 <View style={styles.productInfo}> 4476 <Text style={styles.productName}>{item.name}</Text> 4477 <Text style={styles.productDescription} numberOfLines={2}> 4478 {item.description} 4479 </Text> 4480 <Text style={styles.productPrice}>\${item.price}</Text> 4481 <TouchableOpacity 4482 style={styles.addButton} 4483 onPress={() => addToCart(item)} 4484 > 4485 <Text style={styles.buttonText}>Add to Cart</Text> 4486 </TouchableOpacity> 4487 </View> 4488 </View> 4489 ); 4490 4491 if (loading) { 4492 return ( 4493 <View style={styles.loadingContainer}> 4494 <ActivityIndicator size="large" color="#007AFF" /> 4495 <Text style={styles.loadingText}>Loading products...</Text> 4496 </View> 4497 ); 4498 } 4499 4500 return ( 4501 <View style={styles.container}> 4502 {offline && ( 4503 <View style={styles.offlineBanner}> 4504 <Text style={styles.offlineText}> 4505 You're offline. Showing cached data. 4506 </Text> 4507 </View> 4508 ) 4509 4510 <FlatList 4511 data={products} 4512 renderItem={renderProduct} 4513 keyExtractor={(item) => item.id.toString()} 4514 numColumns={2} 4515 contentContainerStyle={styles.listContainer} 4516 refreshControl={ 4517 <RefreshControl refreshing={refreshing} onRefresh={onRefresh} /> 4518 } 4519 ListEmptyComponent={ 4520 <View style={styles.emptyContainer}> 4521 <Text style={styles.emptyText}>No products available</Text> 4522 </View> 4523 } 4524 /> 4525 </View> 4526 ); 4527} 4528 4529const styles = StyleSheet.create({ 4530 container: { 4531 flex: 1, 4532 backgroundColor: '#f5f5f5', 4533 }, 4534 offlineBanner: {
4535 backgroundColor: '#FF9500', 4536 padding: 10, 4537 alignItems: 'center', 4538 }, 4539 offlineText: { 4540 color: 'white', 4541 fontWeight: '600', 4542 }, 4543 loadingContainer: { 4544 flex: 1, 4545 justifyContent: 'center', 4546 alignItems: 'center', 4547 }, 4548 loadingText: { 4549 marginTop: 10, 4550 fontSize: 16, 4551 color: '#666', 4552 }, 4553 listContainer: { 4554 padding: 10, 4555 }, 4556 productCard: { 4557 flex: 1, 4558 margin: 5, 4559 backgroundColor: 'white', 4560 borderRadius: 10, 4561 shadowColor: '#000', 4562 shadowOffset: { width: 0, height: 2 }, 4563 shadowOpacity: 0.1, 4564 shadowRadius: 4, 4565 elevation: 3, 4566 }, 4567 productImage: { 4568 width: '100%', 4569 height: 150, 4570 borderTopLeftRadius: 10, 4571 borderTopRightRadius: 10, 4572 }, 4573 productInfo: { 4574 padding: 10, 4575 }, 4576 productName: { 4577 fontSize: 16, 4578 fontWeight: 'bold', 4579 marginBottom: 5, 4580 }, 4581 productDescription: { 4582 fontSize: 14, 4583 color: '#666', 4584 marginBottom: 5, 4585 }, 4586 productPrice: { 4587 fontSize: 18, 4588 fontWeight: 'bold', 4589 color: '#007AFF', 4590 marginBottom: 10, 4591 }, 4592 addButton: { 4593 backgroundColor: '#007AFF', 4594 padding: 10, 4595 borderRadius: 5, 4596 alignItems: 'center', 4597 }, 4598 buttonText: { 4599 color: 'white', 4600 fontWeight: '600', 4601 }, 4602 emptyContainer: { 4603 flex: 1, 4604 justifyContent: 'center', 4605 alignItems: 'center', 4606 paddingVertical: 50, 4607 }, 4608 emptyText: { 4609 fontSize: 16, 4610 color: '#666', 4611 }, 4612});`},E$=[{id:"product-grid",title:"Product Grid with Search",description:"A responsive product grid with search and category filtering",category:"React",difficulty:"Beginner",tags:["E-commerce","Search","Filtering"],icon:"ðï¸",codeExample:Vg["product-grid"],language:"TypeScript",apiEndpoint:"/products",features:["Responsive grid layout","Search functionality","Category filtering","Loading states"],estimatedTime:"15 min",dependencies:["react","tailwindcss"],useCase:"Prototype e-commerce product listings"},{id:"shopping-cart",title:"Shopping Cart with Local Storage",description:"Persistent shopping cart with localStorage and checkout functionality",category:"React",difficulty:"Intermediate",tags:["E-commerce","Cart","LocalStorage"],icon:"ð",codeExample:Vg["shopping-cart"],language:"TypeScript",apiEndpoint:"/orders",features:["Local storage persistence","Quantity management","Checkout process","Error handling"],estimatedTime:"25 min",dependencies:["react","tailwindcss"],useCase:"Build shopping cart functionality"},{id:"real-time-feed",title:"Real-time Social Feed",description:"Infinite scroll social feed with real-time updates and interactions",category:"React",difficulty:"Advanced",tags:["Social","Infinite Scroll","Real-time"],icon:"ð±",codeExample:Vg["real-time-feed"],language:"TypeScript",apiEndpoint:"/posts",features:["Infinite scroll","Real-time updates","Like functionality","Time formatting"],estimatedTime:"35 min",dependencies:["react","react-intersection-observer"],useCase:"Create social media feed components"},{id:"dashboard-charts",title:"Dashboard with Charts",description:"Analytics dashboard with interactive charts and data visualization",category:"React",difficulty:"Advanced",tags:["Analytics","Charts","Dashboard"],icon:"ð",codeExample:Vg["dashboard-charts"],language:"TypeScript",apiEndpoint:"/analytics",features:["Interactive charts","Data visualization","Time range filtering","Summary cards"],estimatedTime:"45 min",dependencies:["react","recharts","date-fns"],useCase:"Build analytics dashboards"},{id:"mobile-app",title:"React Native Mobile App",description:"Cross-platform mobile app with offline support and caching",category:"Mobile",difficulty:"Intermediate",tags:["Mobile","Offline","Caching"],icon:"ð±",codeExample:Vg["mobile-app"],language:"TypeScript",apiEndpoint:"/products",features:["Offline support","Pull-to-refresh","Local caching","Error handling"],estimatedTime:"30 min",dependencies:["react-native","@react-native-async-storage/async-storage"],useCase:"Create mobile app prototypes"}];function r5e(){const[e,t]=x.useState(""),[s,n]=x.useState("all"),[a,o]=x.useState("all"),[i,l]=x.useState(null),c=Mt.dark,u=hi.pill,f=hi.tag,h=E$.filter(j=>{const w=j.title.toLowerCase().includes(e.toLowerCase())||j.description.toLowerCase().includes(e.toLowerCase())||j.tags.some(E=>E.toLowerCase().includes(e.toLowerCase())),k=s==="all"||j.category===s,S=a==="all"||j.difficulty===a;return w&&k&&S}),g=async j=>{try{await navigator.clipboard.writeText(j)}catch(w){console.error("Failed to copy text: ",w)}},v=j=>{l(i===j?null:j)},y=["all",...Array.from(new Set(E$.map(j=>j.category)))],_=["all","Beginner","Intermediate","Advanced"];return r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8 space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Frontend Recipes"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Ready-to-use code examples for building UIs with ReqRes backends. Copy, customize, and integrate into your projects."})]}),r.jsx(Ht,{className:c,children:r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Filters"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Search by keyword, category, or difficulty."})]}),r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:w-2/3",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-[var(--color-bg-alt)] rounded-md border border-[var(--color-border-default)] px-3 py-2 flex-1",children:[r.jsx(_h,{className:"w-4 h-4 text-[var(--color-fg-muted)]"}),r.jsx(Is,{type:"text",placeholder:"Search recipes...",value:e,onCh
4612ange:j=>t(j.target.value),className:"bg-transparent border-0 text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus-visible:ring-0 focus-visible:border-0"})]}),r.jsx("select",{value:s,onChange:j=>n(j.target.value),className:"rounded-md border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] focus-visible:ring-indigo-500 focus-visible:border-[var(--color-border-secondary)]",children:y.map(j=>r.jsx("option",{value:j,children:j==="all"?"All Categories":j},j))}),r.jsx("select",{value:a,onChange:j=>o(j.target.value),className:"rounded-md border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] focus-visible:ring-indigo-500 focus-visible:border-[var(--color-border-secondary)]",children:_.map(j=>r.jsx("option",{value:j,children:j==="all"?"All Difficulty Levels":j},j))})]})]})}),r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:h.map(j=>{var w;return r.jsxs(Ht,{className:`${c} space-y-4`,children:[r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"text-3xl",children:j.icon}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:u,children:[r.jsx(Vl,{className:"w-3 h-3 mr-1"}),j.language]}),r.jsxs("span",{className:u,children:[r.jsx(VT,{className:"w-3 h-3 mr-1"}),j.category]}),r.jsxs("span",{className:u,children:[r.jsx(za,{className:"w-3 h-3 mr-1"}),j.difficulty]}),r.jsxs("span",{className:u,children:[r.jsx(Cp,{className:"w-3 h-3 mr-1"}),j.estimatedTime]})]}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:j.title}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:j.description}),r.jsx("div",{className:"flex flex-wrap gap-2",children:j.tags.map(k=>r.jsx("span",{className:f,children:k},k))})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:"API Endpoint"}),r.jsxs("button",{className:"inline-flex items-center gap-1 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>g(j.apiEndpoint),children:[r.jsx(is,{className:"w-3 h-3"})," Copy"]})]}),r.jsx(Vt,{title:"Endpoint",language:"text",code:j.apiEndpoint,readMoreHref:"/documentation?section=custom-endpoints"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)]",children:"Key features"}),r.jsx("ul",{className:"space-y-1 text-xs text-[var(--color-fg-secondary)]",children:j.features.slice(0,3).map(k=>r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Dr,{className:"w-3 h-3 text-indigo-400"}),k]},k))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs font-medium text-[var(--color-fg-default)]",children:"Code Example"}),r.jsxs("button",{className:"inline-flex items-center gap-1 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>g(j.codeExample),children:[r.jsx(is,{className:"w-3 h-3"})," Copy"]})]}),r.jsx(Vt,{title:`${j.language||"Code"} example`,language:((w=j.language)==null?void 0:w.toLowerCase())||"ts",code:i===j.id?j.codeExample:`${j.codeExample.slice(0,260)}...`,readMoreHref:"/documentation?section=custom-endpoints"}),r.jsxs("button",{className:"inline-flex items-center gap-1 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>v(j.id),children:[i===j.id?"Hide":"Preview"," code",r.jsx(za,{className:"w-3 h-3"})]})]})]},j.id)})}),h.length===0&&r.jsxs(Ht,{className:`${c} text-center space-y-2`,children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"No recipes found"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Adjust filters or search to find relevant examples."})]})]})}
4612function n5e(){const[e,t]=x.useState({name:"",email:"",company:"",role:"",teamSize:"",message:""}),[s,n]=x.useState(!1),[a,o]=x.useState("idle"),i=f=>{const{name:h,value:g}=f.target;t(v=>({...v,[h]:g}))},l=async f=>{f.preventDefault(),n(!0),o("idle");try{(await fetch("/enterprise-inquiry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok?(o("success"),t({name:"",email:"",company:"",role:"",teamSize:"",message:""}),Z.track("enterprise_inquiry",{role:e.role,team_size:e.teamSize})):o("error")}catch(h){console.error("Error submitting form:",h),o("error")}finally{n(!1)}},c=[{icon:r.jsx(Qu,{className:"w-6 h-6"}),title:"Enterprise Security",description:"SOC 2 compliance, SSO integration, and advanced security controls",items:["SOC 2 Type II","SSO Integration","Advanced Access Controls","Audit Logging"]},{icon:r.jsx(ln,{className:"w-6 h-6"}),title:"Dedicated Support",description:"24/7 priority support with dedicated account management",items:["24/7 Priority Support","Dedicated Account Manager","Phone Support","SLA Guarantees"]},{icon:r.jsx(Dr,{className:"w-6 h-6"}),title:"Custom Limits",description:"Unlimited requests, custom rate limits, and SLA guarantees",items:["Unlimited Requests","Custom Rate Limits","99.9% Uptime SLA","Priority Processing"]},{icon:r.jsx(XC,{className:"w-6 h-6"}),title:"Custom Integrations",description:"White-label solutions and custom API integrations",items:["White-label Solutions","Custom Integrations","API Customization","Branded Interfaces"]},{icon:r.jsx(Y_,{className:"w-6 h-6"}),title:"Advanced Analytics",description:"Detailed usage analytics and custom reporting dashboards",items:["Custom Dashboards","Advanced Metrics","Real-time Analytics","Custom Reports"]},{icon:r.jsx(iv,{className:"w-6 h-6"}),title:"Global Infrastructure",description:"Multi-region deployment with 99.9% uptime guarantee",items:["Multi-region Deployment","99.9% Uptime SLA","Global CDN","Edge Computing"]}],u=["Unlimited API requests","Custom rate limits","Dedicated infrastructure","24/7 priority support","SLA guarantees","Custom integrations","White-label solutions","Advanced analytics"];return a==="success"?r.jsx("div",{className:"min-h-screen bg-[#0B0B10]",children:r.jsx("div",{className:"container-stripe py-16",children:r.jsxs(Ht,{className:"max-w-2xl mx-auto p-12 text-center surface-card elevation-1",children:[r.jsx("div",{className:"w-16 h-16 bg-[#10B981]/20 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(yd,{className:"w-8 h-8 text-[#10B981]"})}),r.jsx("h1",{className:"text-3xl font-bold text-[#E7E8EA] mb-4",children:"Thank you for your interest!"}),r.jsx("p",{className:"text-lg text-[#D1D5DB] mb-8",children:"Our enterprise team will get back to you within 24 hours to discuss your specific needs and provide a custom quote."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsx(ht,{asChild:!0,variant:"outline",children:r.jsx("a",{href:"/dashboard",children:"Go to Dashboard"})}),r.jsx(ht,{asChild:!0,children:r.jsx("a",{href:"/upgrade",children:"View Plans"})})]})]})})}):r.jsx("div",{className:"min-h-screen bg-[#0B0B10]",children:r.jsxs("div",{className:"container-stripe py-16",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-[#5561FF] to-[#4F46E5] rounded-2xl flex items-center justify-center mx-auto mb-6",children:r.jsx(KC,{className:"w-10 h-10 text-white"})}),r.jsx("h1",{className:"text-4xl font-bold text-[#E7E8EA] mb-4",children:"Enterprise Solutions"}),r.jsx("p",{className:"text-xl text-[#D1D5DB] max-w-3xl mx-auto",children:"Scale your API development with ReqRes Enterprise. Custom solutions, dedicated support, and enterprise-grade security for your team."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-16",children:c.map((f,h)=>r.jsxs(Ht,{className:"p-8 surface-card elevation-1 hover:elevation-2 transition-all duration-300 group",children:[r.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#5561FF] to-[#4F46E5] rounded-xl flex items-center justify-center mb-6 text-white group-hover:scale-110 transition-transform duration-300",children:f.icon}),r.jsx("h3",{className:"text-xl font-semibold text-[#E7E8EA] mb-3",children:f.title}),r.jsx("p",{className:"text-[#D1D5DB] mb-4",children:f.description}),r.jsx("ul",{className:"space-y-2",children:f.items.map((g,v)=>r.jsxs("li",{className:"flex items-center text-sm text-[#D1D5DB]",children:[r.jsx(yd,{className:"w-4 h-4 text-[#10B981] mr-2 flex-shrink-0"}),g]},v))})]},h))}),r.jsxs(Ht,{className:"p-12 surface-card elevation-1 mb-16",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold text-[#E7E8EA] mb-4",children:"Custom Enterprise Pricing"}),r.jsx("p",{className:"text-lg text-[#D1D5DB] max-w-2xl mx-auto",children:"Get a custom quote tailored to your team's specific needs and usage patterns."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:u.map((f,h)=>r.jsxs("div",{className:"flex items-center p-4 bg-[#0E0F14] rounded-lg border border-[#1C1E26]",children:[r.jsx(yd,{className:"w-5 h-5 text-[#10B981] mr-3 flex-shrink-0"}),r.jsx("span",{className:"text-[#D1D5DB]",children:f})]},h))})]}),r.jsxs(Ht,{className:"p-12 surface-card elevation-1",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold text-[#E7E8EA] mb-4",children:"Ready to Scale?"}),r.jsx("p",{className:"text-lg text-[#D1D5DB] max-w-2xl mx-auto",children:"Get in touch with our enterprise team to discu
4612ss your specific needs and get a custom quote."})]}),r.jsxs("form",{onSubmit:l,className:"max-w-2xl mx-auto space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"company",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Company Name *"}),r.jsx("input",{type:"text",id:"company",name:"company",value:e.company,onChange:i,required:!0,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent",placeholder:"Your company name"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Work Email *"}),r.jsx("input",{type:"email",id:"email",name:"email",value:e.email,onChange:i,required:!0,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent",placeholder:"[email protected]"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Your Name *"}),r.jsx("input",{type:"text",id:"name",name:"name",value:e.name,onChange:i,required:!0,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent",placeholder:"Your full name"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"role",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Role"}),r.jsxs("select",{id:"role",name:"role",value:e.role,onChange:i,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent",children:[r.jsx("option",{value:"",children:"Select your role"}),r.jsx("option",{value:"cto",children:"CTO"}),r.jsx("option",{value:"vp-engineering",children:"VP Engineering"}),r.jsx("option",{value:"engineering-manager",children:"Engineering Manager"}),r.jsx("option",{value:"developer",children:"Developer"}),r.jsx("option",{value:"other",children:"Other"})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"teamSize",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Team Size"}),r.jsxs("select",{id:"teamSize",name:"teamSize",value:e.teamSize,onChange:i,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent",children:[r.jsx("option",{value:"",children:"Select team size"}),r.jsx("option",{value:"1-10",children:"1-10 developers"}),r.jsx("option",{value:"11-50",children:"11-50 developers"}),r.jsx("option",{value:"51-200",children:"51-200 developers"}),r.jsx("option",{value:"200+",children:"200+ developers"})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"message",className:"block text-sm font-medium text-[#E7E8EA] mb-2",children:"Tell us about your needs"}),r.jsx("textarea",{id:"message",name:"message",value:e.message,onChange:i,rows:4,className:"w-full px-4 py-3 bg-[#0E0F14] border border-[#1C1E26] rounded-lg text-[#E7E8EA] focus:outline-none focus:ring-2 focus:ring-[#5561FF] focus:border-transparent resize-vertical",placeholder:"Describe your API requirements, expected usage, and any specific features you need..."})]}),a==="error"&&r.jsx("div",{className:"p-4 bg-red-500/10 border border-red-500/20 rounded-lg",children:r.jsx("p",{className:"text-red-400 text-sm",children:"There was an error submitting your request. Please try again."})}),r.jsx(ht,{type:"submit",disabled:s,className:"w-full flex items-center justify-center",children:s?"Sending...":r.jsxs(r.Fragment,{children:["Get Enterprise Quote",r.jsx(Kt,{className:"w-4 h-4 ml-2"})]})})]})]})]})})}const a5e=[],o5e=({announcements:e=a5e,className:t=""})=>{const[s,n]=x.useState([]),[a,o]=x.useState(new Set),[i,l]=x.useState(!1);x.useEffect(()=>{const v=localStorage.getItem("announcements_dismissed");let y=new Set;if(v)try{const w=JSON.parse(v);y=new Set(w)}
4612catch(w){console.error("Error parsing dismissed announcements:",w),y=new Set}o(y);const _=new Date,j=e.filter(w=>!(y.has(w.id)||w.startDate&&new Date(w.startDate)>_||w.endDate&&new Date(w.endDate)<_));n(j.slice(0,1)),l(!0)},[e]);const c=v=>{const y=new Set(a);y.add(v),o(y),localStorage.setItem("announcements_dismissed",JSON.stringify([...y])),n(_=>_.filter(j=>j.id!==v))},u=v=>{const y=JSON.parse(localStorage.getItem("announcements_clicked")||"[]");y.includes(v.id)||(y.push(v.id),localStorage.setItem("announcements_clicked",JSON.stringify(y))),v.ctaUrl&&(v.ctaTarget==="_blank"?window.open(v.ctaUrl,"_blank","noopener,noreferrer"):window.location.href=v.ctaUrl)},f=v=>{switch(v){case"promo":return"from-indigo-500 via-purple-500 to-sky-400";case"success":return"from-emerald-400 to-cyan-400";case"warning":return"from-amber-400 to-orange-500";case"info":default:return"from-sky-400 to-indigo-400"}},h=v=>{switch(v){case"promo":return"Launch";case"success":return"Update";case"warning":return"Heads up";case"info":default:return"Note"}},g=v=>{const y="w-4 h-4 text-white";switch(v){case"promo":return r.jsx(rr,{className:y});case"success":return r.jsx(oS,{className:y});case"warning":return r.jsx(oS,{className:y});case"info":default:return r.jsx(oS,{className:y})}};return!i||s.length===0?null:r.jsx("div",{className:`w-full px-3 sm:px-4 mt-2 sm:mt-3 ${t}`,children:s.map(v=>{const y=f(v.type);return r.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40",children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-2 -top-1 w-32 h-20 opacity-[0.12]",viewBox:"0 0 240 100",fill:"none",children:[r.jsx("polygon",{points:"75,5 101,20 101,50 75,65 49,50 49,20",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"49",y1:"20",x2:"75",y2:"35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"101",y1:"20",x2:"75",y2:"35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"75",y1:"35",x2:"75",y2:"65",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"165,20 191,35 191,65 165,80 139,65 139,35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"139",y1:"35",x2:"165",y2:"50",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"191",y1:"35",x2:"165",y2:"50",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"165",y1:"50",x2:"165",y2:"80",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"101",y1:"35",x2:"139",y2:"35",stroke:"#d4d4c8",strokeWidth:.75,strokeDasharray:"4 3"})]}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4 py-4 sm:py-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4",children:[r.jsxs("span",{className:"inline-flex items-center gap-2 self-start rounded-full bg-[var(--color-bg-alt)] px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-secondary)] ring-1 ring-[var(--color-border-default)]",children:[r.jsx("span",{className:`h-2 w-2 rounded-full bg-gradient-to-r ${y} shadow-[0_0_0_2px_rgba(255,255,255,0.08)]`}),h(v.type)]}),r.jsxs("div",{className:"flex items-start gap-3 sm:items-center",children:[r.jsx("div",{className:"grid h-9 w-9 place-items-center rounded-xl bg-[var(--color-bg-alt)] ring-1 ring-[var(--color-border-default)]",children:g(v.type)}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm sm:text-base font-semibold leading-tight text-[var(--color-fg-default)]",children:v.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] leading-relaxed",children:v.message})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 sm:justify-end",children:[v.ctaText&&v.ctaUrl&&r.jsx(ht,{variant:"ghost",size:"sm",className:"w-full sm:w-auto border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] hover:-translate-y-px focus:ring-[var(--color-border-secondary)]",onClick:()=>u(v),iconRight:r.jsx(Kt,{className:"w-3 h-3"}),children:v.ctaText}),v.dismissible&&r.jsx("button",{onClick:()=>c(v.id),className:"flex h-9 w-9 items-center justify-center rounded-lg border border-[var(--color-border-default)] text-[var(--color-fg-secondary)] transition hover:-translate-y-
4612px hover:bg-[var(--color-bg-alt)] hover:text-[var(--color-fg-default)]",children:r.jsx(Ir,{className:"w-4 h-4"})})]})]})]},v.id)})})},S0={projects:0,collections:0,records:0,appUsers:0,loading:!0};function wA({enabled:e=!0}={}){const{getToken:t}=zt(),{user:s,isLoaded:n}=_r(),[a,o]=x.useState(S0),i=x.useCallback(async()=>{var l;if(!e||!s||!n){o({...S0,loading:!1});return}try{o(v=>({...v,loading:!0}));const c=await Ue(t);if(!c){o({...S0,loading:!1});return}const[u,f]=await Promise.allSettled([ue.get("/projects?limit=50",{authToken:c}),ue.get("/resource-stats",{authToken:c})]),h=u.status==="fulfilled"?((l=u.value.data)==null?void 0:l.projects)||[]:[],g=f.status==="fulfilled"?f.value.data:null;o({projects:h.length,collections:(g==null?void 0:g.collections)??0,records:(g==null?void 0:g.records)??0,appUsers:(g==null?void 0:g.appUsers)??0,loading:!1})}catch{o({...S0,loading:!1})}},[e,t,n,s]);return x.useEffect(()=>{i()},[i]),{...a,refresh:i}}function NA(){const{getToken:e}=zt(),{user:t,isLoaded:s}=_r(),[n,a]=x.useState(null),o=x.useCallback(async()=>{if(!s||!t){a(null);return}try{const i=await Ue(e);if(!i){a(null);return}const l=await ue.get("/clerk/payment-status",{authToken:i}),c=fG(l.data);a(c??null)}catch{a(null)}},[t,s,e]);return x.useEffect(()=>{o()},[o]),n}const v2="trial_banner_dismissed_session";function i5e(e,t){return e?"expired":t<=3?"urgent":t<=7?"warning":"info"}function l5e({daysRemaining:e,onUpgradeClick:t,onDismiss:s}){return r.jsx("div",{className:"w-full px-3 sm:px-4 mt-1",children:r.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)]/40 px-3 py-1.5",children:[r.jsx(Cp,{className:"w-3 h-3 text-amber-400/70 shrink-0"}),r.jsxs("span",{className:"flex-1 text-[11px] text-[var(--color-fg-muted)]",children:[e," days left in trial"]}),r.jsx(dt,{to:"/upgrade?source=trial_pill&plan=dev",onClick:t,className:"shrink-0 text-[11px] text-[var(--color-fg-faint)] hover:text-[var(--color-fg-secondary)] transition-colors",children:"Upgrade"}),r.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors","aria-label":"Dismiss",children:r.jsx(Ir,{className:"w-3 h-3"})})]})})}const c5e=()=>{const{isTrial:e,daysRemaining:t,expired:s,loading:n,isGrandfathered:a,isPaid:o}=Pw(),{projects:i,collections:l,records:c,loading:u}=wA(),f=NA(),h=Aw({enabled:!0}),[g,v]=x.useState(()=>typeof window>"u"?!1:sessionStorage.getItem(v2)==="true"),y=i5e(s,t),_=i>0||l>0||c>0,j=(()=>{var M,O;if((M=h.stats)!=null&&M.used&&((O=h.stats)!=null&&O.limit)&&h.stats.limit>0&&h.stats.used/h.stats.limit>=.95)return!0;if(f){const z=typeof f.collections=="number"?f.collections:0;if(z>0&&l/z>=.95)return!0;const X=typeof f.storedRecords=="number"?f.storedRecords:0;if(X>0&&c/X>=.95)return!0}return!1})(),w=y==="info"||y==="warning";if(x.useEffect(()=>{!n&&e&&!(w&&g)&&Z.track("trial_banner_shown",{days_remaining:t,urgency:y,expired:s,has_activity:_})},[n,e,g,t,y,s,w,_]),n||u||a||o||!e||!s&&j||w&&g)return null;if(y==="info")return _?r.jsx(l5e,{daysRemaining:t,onUpgradeClick:()=>{Z.track("trial_upgrade_clicked",{days_remaining:t,urgency:"info",source:"trial_pill"}),Z.upgradeClicked("trial_pill","free")},onDismiss:()=>{v(!0),sessionStorage.setItem(v2,"true"),Z.track("trial_banner_dismissed",{days_remaining:t})}}):null;const k=()=>{v(!0),sessionStorage.setItem(v2,"true"),Z.track("trial_banner_dismissed",{days_remaining:t})},S=()=>{Z.track("trial_upgrade_clicked",{days_remaining:t,urgency:y,source:"trial_banner"}),Z.upgradeClicked("trial_banner","free")},E={expired:"border-[var(--color-accent-blue)]/20",urgent:"border-[var(--color-accent-blue)]/30",warning:"border-[var(--color-accent-blue)]/20"},T=()=>s?"Your trial has ended":t===0?"Your trial ends today":t===1?"1 day left on your trial":t<=3?`${t} days left - upgrade to keep building`:`${t} days left on your trial`,A=()=>s?"Your data is safe. You're on the free plan (250 req/day)":t<=3?"Your collections and data are preserved either way":"Upgrade anytime to lock in your setup",R=Cp,I="text-[var(--color-accent-blue)]",L={expired:"bg-[var(--color-accent-blue)]/10 ring-[var(--color-accent-blue)]/15",urgent:"bg-[var(--color-accent-blue)]/15 ring-[var(--color-accent-blue)]/25",warning:"bg-[var(--color-accent-blue)]/10 ring-[var(--color-accent-blue)]/15"};return r.jsx("div",{className:"w-full px-3 sm:px-4 mt-2 sm:mt-3",role:"status","aria-live":"polite",children:r.jsxs("div",{className:`relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40 ${E[y]}`,children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-2 -top-1 w-28 h-18 opacity-[0.12]",viewBox:"0 0 240 135",fill:"none",children:[r.jsx("polygon",{points:"120,0 185,20 120,40 55,20",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"120,45 185,65 120,85 55,65",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"120,90 185,110 120,130 55,110",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"55",y1:"20",x2:"55",y2:"110",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"120",y1:"40",x2:"120",y2:"130",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"185",y1:"20",x2:"185",y2:"110",stroke:"#d4d4c8",strokeWidth:.75})]}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4 py-3 sm:py-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`grid h-9 w-9 place-items-center rounded-xl ${L[y]} ring-1`,children:r.jsx(R,{className:`w-4 h-4 ${I}`})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:T()}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:A()})]})]}),r.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[r.jsxs(dt,{to:`/upgrade?source=trial_banner_${y}&plan=dev`,onClick:S,className:"inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-semibold transition-colors shadow-sm bg-[var(--color-accent-blue)] text-white hover:brightness-110",children:[s?"Upgrade":t<=3?"Keep building":"See plans",r.jsx(Kt,{className:"w-4 h-4"})]}),w&&r.jsx("button",{onClick:k,className:"p-2 rounded-lg text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-hover)] transition-colors","aria-label":"Dismiss banner",children:r.jsx(Ir,{className:"w-4 h-4"})})]})]})]})})},d5e=new Set(["gmail.com","yahoo.com","hotmail.com","outlook.com","icloud.com","proton.me","protonmail.com","aol.com","live.com","msn.com","googlemail.com","ymail.com","qq.com","163.com","126.com","yandex.ru","mail.ru","gmx.com","zoho.com","fastmail.com"]),T$="rr_commercial_nudge_dism
4612issed";function u5e(){const{user:e,isLoaded:t}=_r(),[s,n]=x.useState(""),[a,o]=x.useState(!1),[i,l]=x.useState("idle");if(x.useEffect(()=>{var y,_;if(!t||!e||localStorage.getItem(T$))return;const f=(_=(y=e.primaryEmailAddress)==null?void 0:y.emailAddress)==null?void 0:_.toLowerCase();if(!f)return;const h=f.split("@")[1]||"";if(!(h&&!d5e.has(h)&&!h.includes(".edu")&&!h.includes(".ac.")))return;let v=!0;return CCe().then(j=>{v&&j&&(n(h),o(!0))}),()=>{v=!1}},[t,e]),!a)return null;const c=()=>{localStorage.setItem(T$,"1"),o(!1)},u=async()=>{l("sending");try{await ue.post("/api/commercial/interest",{}),l("done")}catch{l("error")}};return r.jsxs("div",{className:"mx-4 mt-3 rounded-lg border border-border bg-muted/60 px-4 py-3 sm:mx-6 lg:mx-8",children:[i==="done"?r.jsx("p",{className:"text-sm text-foreground",children:"Thanks. I'll email you about a commercial licence shortly."}):r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("p",{className:"text-sm text-foreground",children:["Using ReqRes at ",r.jsx("strong",{children:s}),"? Company and production use should be on a commercial licence (from £495/yr, 20% off year one). Want me to sort it?"]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsx("button",{type:"button",onClick:u,disabled:i==="sending",className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-60",children:i==="sending"?"Sendingâ¦":"I'm interested"}),r.jsx("a",{href:"https://reqres.in/commercial?src=dashboard-nudge",target:"_blank",rel:"noreferrer",className:"text-sm text-muted-foreground hover:text-foreground",children:"Details"}),r.jsx("button",{type:"button",onClick:c,"aria-label":"Dismiss",className:"px-1 text-lg leading-none text-muted-foreground hover:text-foreground",children:"Ã"})]})]}),i==="error"&&r.jsx("p",{className:"mt-2 text-xs text-red-500",children:"Could not send just now. Email [email protected] and I'll sort it."})]})}const p5e=new Set(["gmail.com","yahoo.com","hotmail.com","outlook.com","icloud.com","proton.me","protonmail.com","aol.com","live.com","msn.com","googlemail.com","ymail.com","qq.com","163.com","126.com","yandex.ru","mail.ru","gmx.com","zoho.com","fastmail.com","hotmail.co.uk","outlook.es","yahoo.co.in","naver.com","foxmail.com"]),R$="rr_maturation_nudge_dismissed",f5e=20;function h5e(){var _,j;const{user:e,isLoaded:t}=_r(),s=NA(),{records:n,collections:a,loading:o}=wA(),i=un(),[l,c]=x.useState(!1),[u,f]=x.useState(()=>!!localStorage.getItem(R$));if(x.useEffect(()=>{let w=!0;return ECe().then(k=>{w&&c(k)}),()=>{w=!1}},[]),!l||u||!t||!e||o||s&&s.tier&&s.tier!=="free")return null;const g=(((j=(_=e.primaryEmailAddress)==null?void 0:_.emailAddress)==null?void 0:j.toLowerCase())||"").split("@")[1]||"";if(!g||!p5e.has(g)||(n||0)<f5e)return null;const v=()=>{localStorage.setItem(R$,"1"),f(!0)},y=()=>i("/upgrade?source=maturation_nudge&plan=lite&highlight=lite");return r.jsx("div",{className:"mx-4 mt-3 rounded-lg border border-border bg-muted/60 px-4 py-3 sm:mx-6 lg:mx-8",children:r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("p",{className:"text-sm text-foreground",children:["Your project has ",r.jsx("strong",{children:n.toLocaleString()})," records across"," ",a," ",a===1?"collection":"collections",". On the free tier this data can be reset. Keep it permanent and lift the limits with Lite."," ",r.jsx("strong",{children:"Your first 3 months are half price."})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsx("button",{type:"button",onClick:y,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:opacity-90",children:"Keep my project"}),r.jsx("button",{type:"button",onClick:v,"aria-label":"Dismiss",className:"px-1 text-lg leading-none text-muted-foreground hover:text-foreground",children:"Ã"})]})]})})}const A$="rr_trial_blocker_dismissed",m5e=()=>{const{expired:e,isTrial:t,loading:s,isGrandfathered:n,isPaid:a}=Pw(),o=Wr(),i=un(),l=!s&&!n&&!a&&t&&e,{projects:c,collections:u,records:f,loading:h}=wA({enabled:l}),[g,v]=x.useState(()=>{try{return localStorage.getItem(A$)==="true"}catch{return!1}});x.useEffect(()=>{!s&&t&&e&&!g&&Z.track("trial_expired_blocker_shown",{})},[s,t,e,g]);const y=o.pathname==="/upgrade"||o.pathname==="/billing";if(!l||y||g)return null;const _=()=>{v(!0);try{localStorage.setItem(A$,"true")}catch{}Z.track("trial_expired_blocker_dismissed",{})},j=E=>{Z.track("trial_expired_upgrade_clicked",{source:"blocker",plan:E}),i(`/upgrade?source=trial_expired_blocker&plan=${E}`)},w=!h&&(c>1||u>1||f>5),S=!h&&(c>0||u>0||f>0)?`You have ${c} project${c!==1?"s":""}${u>0?`, ${u} collection${u!==1?"s":""}`:""}${f>
46120?`, and ${f.toLocaleString()} record${f!==1?"s":""}`:""}. Everything is saved.`:"Your sample project is still here.";return r.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:r.jsx("div",{className:"max-w-md mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-8 shadow-2xl",children:r.jsxs("div",{className:"flex flex-col items-center text-center space-y-5",children:[r.jsx(Ep,{className:"w-8 h-8 text-indigo-400/60"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:"Your trial has ended"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] leading-relaxed",children:"Your data is safe. You're on the free plan with 250 requests/day. Upgrade for more."})]}),!h&&r.jsx("p",{className:"text-xs text-[var(--color-fg-faint)] leading-relaxed",children:S}),r.jsx("div",{className:"w-full space-y-3 pt-1",children:w?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>j("dev"),className:"w-full inline-flex items-center justify-center gap-2 rounded-lg bg-indigo-500 px-5 py-3 text-sm font-semibold text-white hover:bg-indigo-400 transition-colors",children:["Upgrade to Dev - $12/month",r.jsx(Kt,{className:"w-4 h-4"})]}),r.jsx("button",{onClick:()=>j("lite"),className:"w-full text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors py-1",children:"Just need more requests? Lite - $5/month"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>j("lite"),className:"w-full inline-flex items-center justify-center gap-2 rounded-lg bg-indigo-500 px-5 py-3 text-sm font-semibold text-white hover:bg-indigo-400 transition-colors",children:["Get Lite - $5/month",r.jsx(Kt,{className:"w-4 h-4"})]}),r.jsx("button",{onClick:()=>j("dev"),className:"w-full text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors py-1",children:"Need collections and auth? Dev - $12/month"})]})}),r.jsx("button",{onClick:_,className:"text-xs text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors pt-1",children:"Continue on free plan"})]})})})},g5e={slug:"todo-app",title:"Build a Real Todo App Backend With ReqRes (No Servers Needed)",description:"Turn your UI-only todo app into a fully authenticated, persistent experience using ReqRes collections and magic-link auth. No servers, no database setup-just fetch().",tagline:"Ship a production-ready backend straight from the browser.",meta:[{label:"Audience",value:"Frontend devs comfortable with fetch()"},{label:"Time",value:"20 minutes end-to-end"},{label:"What you get",value:"Project + collection + magic-link auth + logs"}],topics:["Create your backend project","Add a todos collection with schema validation","Send and verify magic links for auth","Scope data per user with session tokens","Wire up CRUD from your UI","Debug with built-in logs","Add optional automations"],prerequisites:["You already have a Todo UI built (React, Vue, Svelte, or vanilla JS).","You can make fetch() calls."],sections:[{id:"create-project",title:"Create Your Backend (Project)",summary:"Projects scope your endpoints, keys, and data.",content:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("ol",{className:"list-decimal space-y-2 pl-5 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("li",{children:["Log into ReqRes and click ",r.jsx("strong",{children:"Create Project"}),"."]}),r.jsxs("li",{children:["Name it something like ",r.jsx("code",{children:"todo-app"}),"."]}),r.jsx("li",{children:"Note the two key pieces of info at the top of the page."})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 shadow-lg shadow-black/30",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-secondary)]",children:"Keep these handy"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-sm text-[var(--color-fg-default)]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Base URL"})," â where your API lives (use this for every fetch())."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public project key"})," â browser-safe; use it for GETs and for sending magic links."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Manage project key"})," â keep server-side; use it to verify magic-link tokens and for owner writes."]})]})]})]})},{id:"create-collection",title:"Create the todos Collection (Your JSON database)",summary:"Schema-backed JSON keeps your UI data clean and validated.",content:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("ol",{className:"list-decimal space-y-2 pl-5 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("li",{children:["Open"," ",r.jsx("strong",{children:"Data Explorer â Collections â Create Collection"}),"."]}),r.jsxs("li",{children:["Name it ",r.jsx("code",{children:"todos"}),"."]}),r.jsx("li",{children:"Add this simple schema to validate inputs and power nicer forms:"})]}),r.jsx(Vt,{title:"Recommended schema",language:"json",code:`{ 4613 "title": "string", 4614 "completed": "boolean", 4615 "created_at": "string", 4616 "updated_at": "string" 4617}`}),r.jsxs("ul",{className:"space-y-1 rounded-xl border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success-bg)] p-4 text-sm text-[var(--color-fg-default)]",children:[r.jsx("li",{children:"Validation on every write"}),r.jsx("li",{children:"Cleaner client-side data"}
4617),r.jsx("li",{children:"Better forms in Data Explorer"})]})]})},{id:"magic-links",title:"Add App Users via Magic Links",summary:"Every todo should belong to a signed-in user.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-2 pl-5",children:[r.jsxs("li",{children:["Open ",r.jsx("strong",{children:"App Users"})," in the dashboard."]}),r.jsx("li",{children:"Enter your email (or a test user's email) and send a magic link."}),r.jsxs("li",{children:["Clicking the link returns a one-time ",r.jsx("code",{children:"token"}),"."]}),r.jsx("li",{children:"Your frontend exchanges that token for a session token."})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] p-4 text-xs text-[var(--color-fg-default)]",children:[r.jsx("p",{className:"font-semibold uppercase tracking-[0.14em]",children:"Keys vs tokens"}),r.jsx("p",{className:"mt-1",children:"Project keys are admin-level. Session tokens are per-app-user and only expose that user's data."})]})]})},{id:"exchange-token",title:"Exchange Magic-Link Token â Session Token",summary:"Two calls: send magic link, then verify & store the session token.",content:r.jsxs("div",{className:"space-y-4",children:[r.jsx(Vt,{title:"Send & verify (API calls)",variants:bG()}),r.jsx(Vt,{title:"Handle the login redirect in your UI",language:"typescript",code:`// e.g. /login?token=abc123 4618const params = new URLSearchParams(window.location.search); 4619const token = params.get('token'); 4620 4621if (token) { 4622 const verify = await fetch('https://reqres.in/api/app-users/verify', { 4623 method: 'POST', 4624 headers: { 'Content-Type': 'application/json' }, 4625 body: JSON.stringify({ token }), 4626 }); 4627 4628 const { session_token } = await verify.json(); 4629 localStorage.setItem('REQRES_SESSION_TOKEN', session_token); 4630}`}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)]",children:"Authenticate future requests"}),r.jsxs("p",{className:"mt-2",children:["Add ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})," to every call from your UI. That scopes results to the logged-in app user-no server needed."]})]})]})},{id:"read-todos",title:"Read Todos (GET)",summary:"Pull only the signed-in user's todos with their session token.",content:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-xs text-[var(--color-fg-default)]",children:[r.jsx("p",{className:"font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Env"}),r.jsx("p",{className:"mt-1",children:"VITE_API_URL=https://reqres.in/api/collections/todos"})]}),r.jsx(Vt,{title:"Data loader",language:"typescript",code:`const API_URL = import.meta.env.VITE_API_URL || 'https://reqres.in/api/collections/todos'; 4631const sessionToken = localStorage.getItem('REQRES_SESSION_TOKEN'); 4632 4633const res = await fetch(\`\${API_URL}/records\`, { 4634 headers: { 4635 Authorization: \`Bearer \${sessionToken}\`, 4636 'Content-Type': 'application/json', 4637 }, 4638}); 4639 4640const { data } = await res.json(); 4641setTodos(data.map((record: any) => ({ id: record.id, ...record.data })));`}),r.jsx(Vt,{title:"Raw request (cURL / JS / React)",variants:gEe()})]})},{id:"create-todo",title:"Create a Todo (POST)",summary:"Write todos directly from the client; schema validation runs server-side.",content:r.jsxs("div",{className:"space-y-3",children:[r.jsx(Vt,{title:"Create",variants:xEe()}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["After creation, refetch ",r.jsx("code",{children:"/records"})," or optimistically add the new item to state."]})]})},{id:"toggle-todo",title:"Toggle a Todo (PATCH)",summary:"Flip completion and update timestamps.",content:r.jsxs("div",{className:"space-y-3",children:[r.jsx(Vt,{title:"Toggle",variants:vEe()}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:["Send the new ",r.jsx("code",{children:"completed"})," value and bump"," ",r.jsx("code",{children:"updated_at"}),"."]})]})}
4641,{id:"delete-todo",title:"Delete a Todo (DELETE)",summary:"Remove the record for this user only.",content:r.jsx(Vt,{title:"Delete",variants:bEe()})},{id:"debugging",title:"Debug with Logs",summary:"Every request is logged-perfect for client-only workflows.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-1 pl-5",children:[r.jsxs("li",{children:["Go to ",r.jsx("strong",{children:"Logs"})," in the ReqRes sidebar."]}),r.jsx("li",{children:"Filter by your project."}),r.jsx("li",{children:"Check invalid tokens, wrong paths, or malformed JSON."})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Logs include request body, response, status, user, IP, latency, and timestamp."})]})},{id:"automations",title:"Optional: Add Automations",summary:"Fire webhooks when todos change.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-1 pl-5",children:[r.jsxs("li",{children:["Open ",r.jsx("strong",{children:"Automations â New Trigger"}),"."]}),r.jsxs("li",{children:["Event: ",r.jsx("code",{children:"record.created"})," on ",r.jsx("code",{children:"todos"}),"."]}),r.jsx("li",{children:"Action: webhook â Slack, Zapier, n8n, internal backend, etc."})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"You now have fully automated workflows on every todo creation."})]})},{id:"ship",title:"Ship Your App",summary:"Deploy anywhere; keep the same fetch() calls.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"Your UI is now backed by real collections, real auth, real persistence, and real logs."}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Deploy config"}),r.jsx("p",{className:"mt-1 font-mono text-[12px] text-[var(--color-fg-default)]",children:"VITE_API_URL=https://reqres.in/api/collections/todos"})]}),r.jsx("p",{children:"Deploy to Vercel, Netlify, or your static host. No backend servers required."})]})}],nextSteps:[{label:"Add user profiles via metadata",href:"/app-users"},{label:"Add filters/pagination",href:"/data-explorer"},{label:"Wire Slack automation for new todos",href:"/automations"},{label:"Try an LLM-built UI â connect this backend",href:"/getting-started"}]},x5e={slug:"notes-app",title:"Build a Real Notes App Backend With ReqRes (Multi-user, No Servers)",description:"Back your per-user notes UI with ReqRes collections, session tokens, and zero custom servers. Each app user only sees their own notes, while you keep private keys safely on the server.",tagline:"Per-user notes with session-token CRUD in minutes.",meta:[{label:"Audience",value:"React/Next/Vite devs + QA validating auth"},{label:"Time",value:"20-25 minutes"},{label:"What you get",value:"Project + notes collection + scoped CRUD"}],topics:["Create a project and schema-backed notes collection","Log in app users with magic links using the Private API key","Mint per-user session tokens","Create, list, edit, and delete notes from the frontend","Keep writes scoped to the signed-in user","Inspect data in the Data Explorer"],prerequisites:["You have a notes UI (React/Next/Vite/SPA) to wire up.","You can make fetch() calls and store tokens client-side."],sections:[{id:"overview",title:"Overview",summary:"Ship a multi-user notes backend with browser-only CRUD.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"We'll power a per-user notes app where each logged-in user only sees their own notes. Your frontend can be React, Next.js, Vite, or anything that can call fetch()."}),r.jsx("p",{children:"No servers to stand up-ReqRes handles auth, storage, validation, and scoping."}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Auth keys you'll juggle"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-[var(--color-fg-default)]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Private API key"})," (server/admin only) - full read/write; send magic links from a backend or CLI."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public API key"})," (browser-safe) - read-only; use for shared or read-only views."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Session token"})," - returned after verify; use in"," ",r.jsx("code",{children:"Authorization"})," from the frontend to scope notes to the logged-in user."]})]})]})]})},{id:"notes-collection",title:"Step 1 â Create a Project and a notes Collection",summary:"Define the JSON shape for each note.",content:r.jsxs("div",{className:"space-y-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-2 pl-5",children:[r.jsx("li",{children:"Create a new ReqRes project (this scopes keys, collections, and logs)."}),r.jsx("li",{children:"Open Data Explorer â Collections â Create Collection."}),r.jsxs("li",{children:["Name it ",r.jsx("code",{children:"notes"})," and add simple fields for your UI."]})]}),r.jsx(Vt,{title:"Recommended fields",language:"json",code:`{ 4642 "title": "string", 4643 "body": "string", 4644 "user_id": "string", 4645 "updated_at": "string" 4646}`}),r.jsxs("p",{children:["Each record lives under ",r.jsx("code",{children:"data"})," in the API response. The schema enforces the shape on every write and powers friendlier forms in the dashboard."]})]})}
4646,{id:"login-verify",title:"Step 2 â Login & Verify to get a Session Token",summary:"Private API key for login, no key for verify, session token for the UI.",content:r.jsxs("div",{className:"space-y-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("p",{children:["Run login from a server/serverless function with your"," ",r.jsx("strong",{children:"Private API key"}),", then verify the magic_link_token client-side to mint a ",r.jsx("code",{children:"session_token"})," for that user."]}),r.jsx(Vt,{title:"Login + verify flow",variants:[{id:"curl",label:"cURL",language:"bash",code:`curl -X POST \\ 4647 -H "Content-Type: application/json" \\ 4648 -H "x-api-key: <private_project_api_key>" \\ 4649 -d '{ "email": "[email protected]" }' \\ 4650 https://reqres.in/api/app-users/login 4651 4652curl -X POST \\ 4653 -H "Content-Type: application/json" \\ 4654 -d '{ "token": "<magic_link_token>" }' \\ 4655 https://reqres.in/api/app-users/verify`},{id:"typescript",label:"TypeScript (server â client)",language:"typescript",code:`// Server/CLI: keep the Private API key out of the browser 4656const PRIVATE_KEY = process.env.REQRES_PRIVATE_KEY!; 4657 4658export async function startLogin(email: string) { 4659 const res = await fetch('https://reqres.in/api/app-users/login', { 4660 method: 'POST', 4661 headers: { 4662 'Content-Type': 'application/json', 4663 'x-api-key': PRIVATE_KEY, 4664 }, 4665 body: JSON.stringify({ email }), 4666 }); 4667 return res.json(); // { magic_link_token } 4668} 4669 4670// Browser: exchange the token for a session_token 4671export async function verifyMagicLink(token: string) { 4672 const res = await fetch('https://reqres.in/api/app-users/verify', { 4673 method: 'POST', 4674 headers: { 'Content-Type': 'application/json' }, 4675 body: JSON.stringify({ token }), 4676 }); 4677 return res.json(); // { session_token, app_user } 4678}`}]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] p-4 text-xs text-[var(--color-fg-default)]",children:[r.jsx("p",{className:"font-semibold uppercase tracking-[0.14em]",children:"Key hygiene"}),r.jsxs("p",{className:"mt-1",children:["Private API key stays on the server. The browser only ever sees the ",r.jsx("code",{children:"session_token"})," or the Public API key for read-only views."]})]})]})},{id:"create-notes",title:"Step 3 â Create Notes from the Frontend (session token)",summary:"Use the app user's session token to write their notes.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Minimal createNote helper",language:"typescript",code:`type NoteInput = { title: string; body: string; userId: string }; 4679 4680export async function createNote(sessionToken: string, note: NoteInput) { 4681 const res = await fetch('https://reqres.in/app/collections/notes/records', { 4682 method: 'POST', 4683 headers: { 4684 Authorization: \`Bearer \${sessionToken}\`, 4685 'Content-Type': 'application/json', 4686 }, 4687 body: JSON.stringify({ 4688 data: { 4689 title: note.title, 4690 body: note.body, 4691 user_id: note.userId, 4692 updated_at: new Date().toISOString(), 4693 }, 4694 }), 4695 }); 4696 4697 if (!res.ok) throw new Error('Unable to save note'); 4698 return res.json(); 4699}`}),r.jsxs("p",{children:["Pass ",r.jsx("code",{children:"app_user.id"})," from the verify response as"," ",r.jsx("code",{children:"userId"})," so every note is scoped to that user automatically."]})]})},{id:"list-notes",title:"Step 4 â List Notes for the Logged-in User",summary:"Query with the session token; only their notes come back.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"React NotesList",language:"tsx",code:`import { useEffect, useState } from 'react'; 4700 4701type Note = { id: string; title: string; body: string; updated_at?: string }; 4702 4703export function NotesList({ sessionToken }: { sessionToken: string }) { 4704 const [notes, setNotes] = useState<Note[]>([]); 4705 4706 useEffect(() => { 4707 if (!sessionToken) return; 4708 const load = async () => { 4709 const res = await fetch('https://reqres.in/app/collections/notes/records', { 4710 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4711 }); 4712 const json = await res.json(); 4713 const items = 4714 (json.data || []).map((record: any) => ({ id: record.id, ...record.data })) || []; 4715 setNotes(items); 4716 }; 4717 load(); 4718 }, [sessionToken]); 4719 4720 return ( 4721 <ul className="space-y-2"> 4722 {notes.map((note) => ( 4723 <li key={note.id} className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-3 py-2"> 4724 <div className="flex items-center justify-between"> 4725 <strong>{note.title}</strong>
4726 <span className="text-xs text-[var(--color-fg-muted)]">{note.updated_at}</span> 4727 </div> 4728 <p className="text-[var(--color-fg-secondary)]">{note.body}</p> 4729 </li> 4730 ))} 4731 </ul> 4732 ); 4733}`}),r.jsxs("p",{children:["The ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})," header scopes the GET to the logged-in user-no filters required."]})]})},{id:"edit-delete",title:"Step 5 â Edit and Delete Notes",summary:"Session tokens keep writes and deletes scoped.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Update + delete helpers",language:"typescript",code:`export async function updateNote( 4734 sessionToken: string, 4735 id: string, 4736 updates: Partial<{ title: string; body: string }> 4737) { 4738 return fetch(\`https://reqres.in/app/collections/notes/records/\${id}\`, { 4739 method: 'PATCH', 4740 headers: { 4741 Authorization: \`Bearer \${sessionToken}\`, 4742 'Content-Type': 'application/json', 4743 }, 4744 body: JSON.stringify({ 4745 data: { 4746 ...updates, 4747 updated_at: new Date().toISOString(), 4748 }, 4749 }), 4750 }); 4751} 4752 4753export async function deleteNote(sessionToken: string, id: string) { 4754 return fetch(\`https://reqres.in/app/collections/notes/records/\${id}\`, { 4755 method: 'DELETE', 4756 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4757 }); 4758}`}),r.jsx("p",{children:"Because the session token belongs to one app user, updates and deletes stay locked to their records."})]})},{id:"inspect-data",title:"Step 6 â Inspect Data in the Data Explorer",summary:"See every note and confirm user scoping.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-1 pl-5",children:[r.jsx("li",{children:"Open Data Explorer â Collections â notes."}),r.jsxs("li",{children:["Filter by ",r.jsx("code",{children:"user_id"})," to confirm isolation per user."]}),r.jsxs("li",{children:["View raw JSON to verify ",r.jsx("code",{children:"title"}),", ",r.jsx("code",{children:"body"}),", and"," ",r.jsx("code",{children:"updated_at"}),"."]})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"All writes and reads are logged-perfect for QA to validate auth headers and payloads."})]})},{id:"next-steps",title:"Next steps",summary:"Polish and extend your notes experience.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ul",{className:"list-disc space-y-1 pl-5",children:[r.jsx("li",{children:"Add tags or pinned notes to the schema."}),r.jsx("li",{children:"Add search/filtering in the frontend."}),r.jsxs("li",{children:["Use the ",r.jsx("strong",{children:"Public API key"}),' for a read-only "public notes" board if you need it.']})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 text-sm",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)]",children:"Keep building"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-[var(--color-fg-secondary)]",children:[r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/getting-started",children:"Getting Started guide"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/documentation",children:"API docs"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/guides/todo-app",children:"Todo app backend guide"})})]})]})]})}],nextSteps:[{label:"Try the Todo app guide",href:"/guides/todo-app"},{label:"Explore the API docs",href:"/documentation"},{label:"Start a new project in Getting Started",href:"/getting-started"}]},v5e={slug:"event-tracker",title:"Build a Simple Event Tracker Backend (Frontend Analytics, No Servers)",description:"Capture page views, clicks, and custom events straight from your frontend into a ReqRes collection. No dedicated backend-just one helper and the right auth headers.",tagline:"Ship lightweight frontend anal
4758ytics without standing up infra.",meta:[{label:"Audience",value:"Frontend devs & QA logging client events"},{label:"Time",value:"15-20 minutes"},{label:"What you get",value:"Events collection + auth patterns + viewer"}],topics:["Create an events collection that accepts arbitrary metadata","Choose between session-token writes or Private key writes","Send events from React with one helper","Use Public API key for read-only dashboards","Inspect rows in the Data Explorer","Plan production hardening (webhooks, workers, extra fields)"],prerequisites:["You can add a small helper to your React/Next/Vite/SPA codebase.","You know where to store env vars for Private/Public API keys."],sections:[{id:"overview",title:"Overview",summary:"Track frontend events in minutes with scoped auth.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"Perfect for quick analytics, debugging, QA trails, and prototypes-log page views, clicks, and custom events into ReqRes without provisioning servers."}),r.jsx("p",{children:"Use session tokens for user-specific tracking or keep things admin-scoped behind a tiny backend."}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Auth model"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-[var(--color-fg-default)]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Private API key"})," - server-only writes if you prefer to log centrally or enrich events."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public API key"})," - browser-safe and"," ",r.jsx("em",{children:"read-only"}),"; perfect for dashboards, not writes."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Session token"})," - from login/verify; lets the frontend write events on behalf of a user."]})]})]})]})},{id:"events-collection",title:"Step 1 â Create a Project and an events Collection",summary:"Store flexible event payloads with optional user context.",content:r.jsxs("div",{className:"space-y-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-2 pl-5",children:[r.jsx("li",{children:"Create a ReqRes project for this tracker."}),r.jsx("li",{children:"Open Data Explorer â Collections â Create Collection."}),r.jsxs("li",{children:["Name it ",r.jsx("code",{children:"events"})," and use these fields."]})]}),r.jsx(Vt,{title:"Suggested schema",language:"json",code:`{ 4759 "event_name": "string", 4760 "user_id": "string?", 4761 "metadata": "object", 4762 "timestamp": "string" 4763}`}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("code",{children:"metadata"})," can hold anything: ",r.jsx("code",{children:"path"}),","," ",r.jsx("code",{children:"button_id"}),", ",r.jsx("code",{children:"plan"}),", ",r.jsx("code",{children:"feature_flag"}),", or debug details."]})]})},{id:"auth-strategy",title:"Step 2 â Decide How You'll Authenticate Event Writes",summary:"Pick between per-user session tokens or backend-admin writes.",content:r.jsx("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:r.jsxs("ul",{className:"list-disc space-y-2 pl-5",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"User-specific tracking"})," â use"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"})," from the login/verify flow. Events stay tied to that app_user."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Project-level tracking"})," â post via a small backend/serverless endpoint with the"," ",r.jsx("strong",{children:"Private API key"})," in ",r.jsx("code",{children:"x-api-key"}),"."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public API key"})," is read-only; reserve it for dashboards, filters, and QA queries."]})]})})},{id:"log-events",title:"Step 3 â Log Events from the Frontend (session token example)",summary:"One helper for every event type.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"trackEvent helper",language:"typescript",code:`type EventMetadata = Record<string, unknown>; 4764 4765export async function trackEvent( 4766 sessionToken: string, 4767 eventName: string, 4768 metadata: EventMetadata = {}, 4769 userId?: string 4770) { 4771 const res = await fetch('https://reqres.in/app/collections/events/records', { 4772 method: 'POST', 4773 headers: { 4774 Authorization: \`Bearer \${sessionToken}\`, 4775 'Content-Type': 'application/json', 4776 }, 4777 body: JSON.stringify({ 4778 data: { 4779 event_name: eventName, 4780 user_id: userId, 4781 metadata, 4782 timestamp: new Date().toISOString(), 4783 }, 4784 }), 4785 }); 4786 4787 if (!res.ok) throw new Error('Event failed to log'); 4788 return res.json(); 4789} 4790 4791// Usage 4792trackEvent(sessionToken, 'page_view', { path: location.pathname }, appUser.id); 4793trackEvent(sessionToken, 'button_click', { buttonId: 'signup' }, appUser.id);`}),r.jsxs("p",{children:["Store ",r.jsx("code",{children:"session_token"})," after verify and pass it into this helper anywhere in your app."]})]})},{id:"view-explorer",title:"Step 4 â View Events in the Data Explorer",summary:"Verify payloads and metadata in real time.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-1 pl-5",children:[r.jsx("li",{children:"Open Data Explorer â Collections â events."}),r.jsxs("li",{children:["Filter by ",r.jsx("code",{children:"event_name"})," to isolate a flow."]}),r.jsxs("li",{children:["Click any row to inspect the raw ",r.jsx("code",{children:"metadata"})," JSON and timestamps."]})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"The Logs view also captures every request with headers and status-useful for QA and debugging."})]})},{id:"events-table",title:"Step 5 â Build a Simple Events Table (read-only)",summary:"Render recent events using the Public API key.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"EventsTable (public read)",language:"tsx",code:`import { useEffect, useState } from 'react'; 4794 4795type EventRecord = { id: string; event_name: string; timestamp: string; metadata?: Record<string, unknown> }; 4796 4797export function EventsTable({ publicKey }: { publicKey: string }) { 4798 const [events, setEvents] = useState<EventRecord[]>([]); 4799 4800 useEffect(() => { 4801 const load = async () => { 4802 const res = await fetch('https://reqres.in/app/collections/events/records', { 4803 headers: { 'x-api-key': publicKey }, 4804 }); 4805 const json = await res.json(); 4806 const rows = 4807 (json.data || []).map((record: any) => ({ 4808 id: record.id, 4809 event_name: record.data.event_name, 4810 timestamp: record.data.timestamp, 4811 metadata: record.data.metadata, 4812 })) || []; 4813 setEvents(rows); 4814 }; 4815 load(); 4816 }, [publicKey]); 4817 4818 return ( 4819 <table className="w-full text-sm"> 4820 <thead> 4821 <tr className="text-left text-[var(--color-fg-muted)]"> 4822 <th className="py-2">Event</th> 4823 <th className="py-2">Timestamp</th> 4824 <th className="py-2">Metadata</th> 4825 </tr> 4826 </thead> 4827 <tbody> 4828 {events.map((event) => (
4829 <tr key={event.id} className="border-t border-[var(--color-border-default)]"> 4830 <td className="py-2 text-[var(--color-fg-default)]">{event.event_name}</td> 4831 <td className="py-2 text-[var(--color-fg-secondary)]">{event.timestamp}</td> 4832 <td className="py-2 text-[var(--color-fg-muted)]"> 4833 <code className="rounded bg-[var(--color-bg-hover)] px-2 py-1 text-xs"> 4834 {JSON.stringify(event.metadata || {})} 4835 </code> 4836 </td> 4837 </tr> 4838 ))} 4839 </tbody> 4840 </table> 4841 ); 4842}`}),r.jsxs("p",{children:["The ",r.jsx("code",{children:"x-api-key"})," header uses the"," ",r.jsx("strong",{children:"Public API key"}),", so it's safe in the browser and read-only by design."]})]})},{id:"production-ideas",title:"Step 6 â Ideas for Production",summary:"Level up your tracking pipeline.",content:r.jsxs("ul",{className:"list-disc space-y-1 pl-5 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("li",{children:"Send events from a backend or worker with the Private key for stricter control."}),r.jsxs("li",{children:["Add fields like ",r.jsx("code",{children:"session_id"}),", ",r.jsx("code",{children:"experiment_id"}),", or ",r.jsx("code",{children:"feature_flag"}),"."]}),r.jsx("li",{children:"Use Automations/Webhooks to forward events to your main analytics stack later."})]})},{id:"next-steps",title:"Next steps",summary:"Keep iterating or reuse the pattern elsewhere.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"Reuse this events pattern for QA logs, feature flag auditing, or custom metrics."}),r.jsxs("ul",{className:"list-disc space-y-1 pl-5",children:[r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/guides/todo-app",children:"Todo app backend guide"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:Ha,children:"Notes app backend guide"})}),r.jsxs("li",{children:[r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/getting-started",children:"Getting Started"})," ","and"," ",r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/documentation",children:"API docs"}),"."]})]})]})}],nextSteps:[{label:"Check the Todo app guide",href:"/guides/todo-app"},{label:"Read the Notes backend guide",href:Ha},{label:"Open the API docs",href:"/documentation"}]},b5e={slug:"connect-ui-to-real-backend",title:"Make Your LLM-Built UI Real With ReqRes (Perfect for âVibe Codersâ)",description:"Take the auto-generated UI from ChatGPT/Claude/Cursor and turn it into a real, working app backend - no servers, no databases, no infrastructure.",tagline:"If your AI-made UI looks good but does nothing, this wires it up.",meta:[{label:"Audience",value:"Vibe coders, hackathon builders, QA trying flows"},{label:"Time",value:"15-20 minutes"},{label:"What you get",value:"Project + collection + session-token CRUD template"}],topics:["Create a collection that matches your generated UI","Log in with Private key, verify, and get a session token","Swap mock arrays for real fetch() calls","POST from forms, PATCH/DELETE from buttons","Optional: Public key for read-only dashboards","Debug everything in Data Explorer"],prerequisites:["A UI from ChatGPT/Claude/Cursor/Replit (form, table, list-anything).","A ReqRes account + project.","Basic familiarity with fetch() in React/Next/Vite."],sections:[{id:"why-this",title:"Why this guide exists",summary:"Your AI-made UI looks great-but it doesn't save yet.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"AI now designs beautiful UIs in minutes. But the buttons don't save, forms don't persist, and lists don't show real data. ReqRes fixes that in one sitting."}),r.jsx("p",{children:"Today we'll take your generated UI and connect it to a real backend without standing up servers."}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Mental model"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-[var(--color-fg-default)]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Private API key"})," (server/CLI only) - full read/write, used for login."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Public API key"})," (browser-safe) - read-only for dashboards/demos."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Session token"})," - returned after verify; put it in ",r.jsx("code",{children:"Authorization"})," from your UI to read/write per app user."]})]})]})]})},{id:"requirements",title:"What you need",summary:"Low-bar checklist for vibe coders.",content:r.jsxs("ul",{className:"list-disc space-y-2 pl-5 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("li",{children:"A generated UI from ChatGPT/Claude/Cursor (form, list, table, dashboard-anything)."}),r.jsx("li",{children:"A ReqRes account + project."}),r.jsx("li",{children:"Optional: Node/Vite/Next setup to run your frontend locally."})]})},{id:"create-collection",title:"Step 1 â Create your backend collection",summary:"Match your UI's data model.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{children:"Pick the object your UI renders (tasks, contacts, products, notes-anything)."}),r.jsx("p",{children:"Create a collection in ReqRes with fields that match:"}),r.jsx(Vt,{title:"Example collection (tasks)",language:"json",code:`{ 4843 "title": "string", 4844 "is_done": "boolean" 4845}`}),r.jsx("div",{className:"rounded-lg border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success-bg)] p-3 text-sm text-[var(--color-fg-default)]",children:"You can add or remove fields later. ReqRes is intentionally flexible for prototyping."})]})},{id:"login-session",title:"Step 2 â Log in + get a session token (server/CLI)",summary:"Private key to
4845send magic link, verify to mint session_token.",content:r.jsxs("div",{className:"space-y-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("p",{children:["Run login from a backend/CLI with your"," ",r.jsx("strong",{children:"Private API key"}),", then verify the token to get a"," ",r.jsx("code",{children:"session_token"}),". That token powers every fetch from your UI."]}),r.jsx(Vt,{title:"Login + verify",variants:[{id:"curl",label:"cURL",language:"bash",code:`curl -X POST \\ 4846 -H "Content-Type: application/json" \\ 4847 -H "x-api-key: <private_project_api_key>" \\ 4848 -d '{ "email": "[email protected]" }' \\ 4849 https://reqres.in/api/app-users/login 4850 4851curl -X POST \\ 4852 -H "Content-Type: application/json" \\ 4853 -d '{ "token": "<magic_link_token>" }' \\ 4854 https://reqres.in/api/app-users/verify`},{id:"node",label:"Node (server/CLI)",language:"javascript",code:`const PRIVATE_KEY = process.env.REQRES_PRIVATE_KEY; 4855 4856async function login(email) { 4857 const res = await fetch('https://reqres.in/api/app-users/login', { 4858 method: 'POST', 4859 headers: { 4860 'Content-Type': 'application/json', 4861 'x-api-key': PRIVATE_KEY, 4862 }, 4863 body: JSON.stringify({ email }), 4864 }); 4865 return res.json(); // { magic_link_token } 4866} 4867 4868async function verify(token) { 4869 const res = await fetch('https://reqres.in/api/app-users/verify', { 4870 method: 'POST', 4871 headers: { 'Content-Type': 'application/json' }, 4872 body: JSON.stringify({ token }), 4873 }); 4874 return res.json(); // { session_token, app_user } 4875}`}]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] p-3 text-xs text-[var(--color-fg-default)]",children:["Keep the Private key off the client. The browser only needs the"," ",r.jsx("code",{children:"session_token"})," (per user) or the Public key for read-only lists."]})]})},{id:"replace-mock",title:"Step 3 â Replace mock data with real queries",summary:"Swap your hardcoded arrays for fetch() calls.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Before â after",language:"typescript",code:`// Before: mock data 4876const tasks = [ 4877 { id: 1, title: 'Buy milk', is_done: false }, 4878]; 4879 4880// After: real fetch from ReqRes 4881const res = await fetch('https://reqres.in/app/collections/tasks/records', { 4882 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4883}); 4884const { data } = await res.json(); 4885const tasks = (data || []).map((record: any) => ({ id: record.id, ...record.data }));`}),r.jsxs("p",{children:["Replace ",r.jsx("em",{children:"any"})," mock array with a ReqRes collection fetch. Responses come back as"," ",r.jsx("code",{children:"{ data: [{ id, data: { ...fields } }] }"}),"."]})]})},{id:"make-form-save",title:"Step 4 â Make your form actually save",summary:"Swap console.log for a real POST.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Create from your form",language:"typescript",code:`await fetch('https://reqres.in/app/collections/tasks/records', { 4886 method: 'POST', 4887 headers: { 4888 'content-type': 'application/json', 4889 Authorization: \`Bearer \${sessionToken}\`, 4890 }, 4891 body: JSON.stringify({ 4892 data: { title: newTask, is_done: false }, 4893 }), 4894}); 4895// then refetch tasks or append to state`}),r.jsx("p",{children:"Hook this into your existing form submit handler. Same UI, now it persists."})]})},{id:"update-delete",title:"Step 5 â Update & delete from your generated UI",summary:"Wire edit/delete buttons to PATCH and DELETE.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Edit + delete",language:"typescript",code:`// Edit 4896await fetch(\`https://reqres.in/app/collections/tasks/records/\${id}\`, { 4897 method: 'PATCH', 4898 headers: { 4899 'content-type': 'application/json', 4900 Authorization: \`Bearer \${sessionToken}\`, 4901 }, 4902 body: JSON.stringify({ data: { title: updatedTitle, is_done } }), 4903}); 4904 4905// Delete 4906await fetch(\`https://reqres.in/app/collections/tasks/records/\${id}\`, { 4907 method: 'DELETE', 4908 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4909});`}),r.jsx("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 text-xs text-[var(--color-fg-secondary)]",children:"Yes-even if your UI is messy, inconsistent, or slightly cursed, you wire it up exactly the same way."})]})},{id:"public-read",title:"Step 6 â Optional: Use Public API key for read-only lists",summary:"Browser-safe, perfect for dashboards and demos.",content:r.jsxs("div",{className:"space-y-3 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx(Vt,{title:"Read-only fetch",language:"typescript",code:`const res = await fetch('https://reqres.in/app/collections/tasks/records', { 4910 headers: { 'x-api-key': '<public_project_api_key>' }, 4911}); 4912const { data } = await res.json();`}),r.jsx("p",{children:"Public key is read-only. Great for marketing dashboards or shared demos."})]})}
4912,{id:"explorer",title:"Step 7 â Check your data in Data Explorer",summary:"Verify everything instantly.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ol",{className:"list-decimal space-y-1 pl-5",children:[r.jsx("li",{children:"Open Data Explorer â Collections â your collection."}),r.jsx("li",{children:"See every create/update/delete instantly."}),r.jsx("li",{children:"Use this to QA payloads and confirm fields."})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Logs capture headers, status, and body-helpful if something feels off."})]})},{id:"full-example",title:"Example: Minimal React component",summary:"Paste this into your generated UI and swap the markup as needed.",content:r.jsx(Vt,{title:"Tasks widget (fetch + create + delete)",language:"tsx",code:`import { useEffect, useState } from 'react'; 4913 4914type Task = { id: string; title: string; is_done: boolean }; 4915 4916export function TasksWidget({ sessionToken }: { sessionToken: string }) { 4917 const [tasks, setTasks] = useState<Task[]>([]); 4918 const [title, setTitle] = useState(''); 4919 4920 const load = async () => { 4921 const res = await fetch('https://reqres.in/app/collections/tasks/records', { 4922 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4923 }); 4924 const json = await res.json(); 4925 const rows = (json.data || []).map((r: any) => ({ id: r.id, ...r.data })); 4926 setTasks(rows); 4927 }; 4928 4929 useEffect(() => { 4930 if (sessionToken) load(); 4931 }, [sessionToken]); 4932 4933 const createTask = async () => { 4934 await fetch('https://reqres.in/app/collections/tasks/records', { 4935 method: 'POST', 4936 headers: { 4937 'content-type': 'application/json', 4938 Authorization: \`Bearer \${sessionToken}\`, 4939 }, 4940 body: JSON.stringify({ data: { title, is_done: false } }), 4941 }); 4942 setTitle(''); 4943 load(); 4944 }; 4945 4946 const remove = async (id: string) => { 4947 await fetch(\`https://reqres.in/app/collections/tasks/records/\${id}\`, { 4948 method: 'DELETE', 4949 headers: { Authorization: \`Bearer \${sessionToken}\` }, 4950 }); 4951 load(); 4952 }; 4953 4954 return ( 4955 <div className="space-y-3"> 4956 <div className="flex gap-2"> 4957 <input value={title} onChange={(e) => setTitle(e.target.value)} className="flex-1 rounded border px-2 py-1" /> 4958 <button onClick={createTask} className="rounded bg-sky-600 px-3 py-1 text-white">Add</button> 4959 </div> 4960 <ul className="space-y-2"> 4961 {tasks.map((task) => ( 4962 <li key={task.id} className="flex items-center justify-between rounded border border-[var(--color-border-default)] px-3 py-2"> 4963 <span>{task.title}</span> 4964 <button onClick={() => remove(task.id)} className="text-xs text-[var(--color-semantic-danger)] hover:text-[var(--color-fg-default)]">Delete</button> 4965 </li> 4966 ))} 4967 </ul> 4968 </div> 4969 ); 4970}`})},{id:"pitfalls",title:"Common pitfalls",summary:"Quick fixes for the usual hiccups.",content:r.jsxs("ul",{className:"list-disc space-y-1 pl-5 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("li",{children:["âMy UI is fine but nothing is savingâ â add"," ",r.jsx("code",{children:"Authorization: Bearer <session_token>"}),"."]}),r.jsx("li",{children:"â401 errorsâ â wrong key or missing Bearer header (don't use Public key for writes)."}),r.jsx("li",{children:"âUI shows no itemsâ â the collection is empty; create one record first."}),r.jsxs("li",{children:["âData looks weirdâ â log the full API response to see"," ",r.jsx("code",{children:"data"})," and ",r.jsx("code",{children:"id"})," fields."]})]})},{id:"next-steps",title:"Next steps",summary:"Keep the vibe going.",content:r.jsxs("div",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsxs("ul",{className:"list-disc space-y-1 pl-5",children:[r.jsx("li",{children:"Add more fields (tags, priority, assignee)."}),r.jsx("li",{children:"Invite app users and scope data per user with session tokens."}),r.jsx("li",{children:"Trigger Automations or webhooks when data changes."}),r.jsx("li",{children:"Explore Templates or try a notes/recipe/habit/CRM list."})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsx("p",{className:"font-semibold text-[var(--color-fg-default)]",children:"More to explore"}),r.jsxs("ul",{className:"mt-2 space-y-1 text-[var(--color-fg-secondary)]",children:[r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/guides/todo-app",children:"Todo app backend guide"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:Ha,children:"Notes app backend guide"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/guides/event-tracker",children:"Event tracker backend guide"})}),r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:"/getting-started",children:"Getting Started"})})]})]})]})}],nextSteps:[{label:"Wire a todo UI",href:"/guides/todo-app"},{label:"Add per-user notes",href:Ha},{label:"Log frontend events",href:"/guides/event-tracker"}]},kA=[g5e,x5e,v5e,b5e],y5e=kA.reduce((e,t)=>
4970(e[t.slug]=t,e),{}),P$=kA[0];function _5e({label:e,value:t}){return r.jsxs("div",{className:"flex flex-col rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-3 text-xs text-[var(--color-fg-secondary)] shadow-md shadow-black/30 backdrop-blur",children:[r.jsx("span",{className:"font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:e}),r.jsx("span",{className:"mt-1 text-sm text-[var(--color-fg-default)]",children:t})]})}function j5e({section:e,index:t}){return r.jsxs("section",{id:e.id,className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-[0_18px_45px_var(--color-shadow)]",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-b from-sky-500/80 to-indigo-600 text-base font-semibold text-white shadow-lg shadow-sky-800/40",children:t+1}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-accent-blue)]",children:["Step ",t+1]}),r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:e.title})]})]}),e.summary&&r.jsx("p",{className:"mt-2 text-sm text-[var(--color-fg-secondary)]",children:e.summary}),r.jsx("div",{className:"mt-4 space-y-4",children:e.content})]})}function w5e(){const{slug:e}=Kv(),t=e?y5e[e]:void 0,{isSignedIn:s,isLoaded:n}=zt(),a=n&&!s;return x.useEffect(()=>{t&&Z.track("guide_viewed",{guide_slug:t.slug})},[t]),t?r.jsxs("div",{className:"px-4 py-6 md:px-6 lg:px-8",children:[r.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs(dt,{className:"flex items-center gap-1 hover:text-[var(--color-fg-default)]",to:"/guides",children:[r.jsx(cn,{className:"h-3 w-3"}),"Back to guides"]}),r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"â¢"}),r.jsx("span",{className:"rounded-full border border-[var(--color-accent-blue)]/30 bg-[var(--color-accent-blue)]/10 px-3 py-1 font-semibold uppercase tracking-[0.16em] text-[var(--color-accent-blue)]",children:"Guide"}),r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"/"}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:t.slug})]}),r.jsx("div",{className:"rounded-3xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-[0_25px_80px_var(--color-shadow)] sm:p-8",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-[var(--color-accent-blue)]",children:[r.jsx(rr,{className:"h-4 w-4 text-amber-400"}),t.tagline||"Frontend-only backend in minutes"]}),r.jsx("h1",{className:"text-2xl font-semibold leading-snug text-[var(--color-fg-default)] sm:text-3xl",children:t.title}),r.jsx("p",{className:"max-w-4xl text-sm text-[var(--color-fg-secondary)] sm:text-base",children:t.description})]}),t.meta&&t.meta.length>0&&r.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:t.meta.map(o=>r.jsx(_5e,{label:o.label,value:o.value},o.label))}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 lg:col-span-2",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"What we'll cover"}),r.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:t.topics.map(o=>r.jsxs("div",{className:"flex items-start gap-2 text-sm text-[var(--color-fg-default)]",children:[r.jsx(Or,{className:"mt-0.5 h-4 w-4 text-[var(--color-semantic-success)]"}),r.jsx("span",{children:o})]},o))})]}),r.jsxs("div",{className:"rounded-2xl border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] p-4",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-semantic-warning)]",children:"Prerequisites"}),r.jsx("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-fg-default)]",children:t.prerequisites.map(o=>r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx(nv,{className:"mt-0.5 h-4 w-4 text-[var(--color-semantic-warning)]"}),r.jsx("span",{children:o})]},o))})]})]})]})}),r.jsxs("div",{className:"grid gap-5 lg:grid-cols-[1fr,280px]",children:[r.jsx("div",{className:"space-y-4",children:t.sections.map((o,i)=>r.jsx(j5e,{section:o,index:i},o.id))}),r.jsxs("aside",{className:"hidden h-fit space-y-3 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 shadow-lg shadow-[var(--color-shadow)] lg:block",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Jump to section"}),r.jsx("nav",{className:"mt-2 space-y-2",children:t.sections.map(o=>r.jsx("a",{href:`#${o.id}`,className:"block rounded-lg px-3 py-2 text-sm text-[var(--color-fg-secondary)] transition hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)]",children:o.title},o.id))}),t.nextSteps&&t.nextSteps.length>0&&r.jsxs("div",{className:"mt-4 space-y-2 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Next steps"}),r.jsx("ul",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:t.nextSteps.map(o=>r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:o.href,children:o.label})},o.label))})]})]})]}),t.nextSteps&&t.nextSteps.length>0&&r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-lg shadow-[var(--color-shadow)] lg:hidden",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Next steps"}),r.jsx("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-fg-secondary)]",children:t.nextSteps.map(o=>r.jsx("li",{children:r.jsx("a",{className:"text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)]",href:o.href,children:o.label})},o.label))})]})]}),a&&r.jsx(a1,{heading:t.slug==="todo-app"?"Get started with ReqRes and ship this todo backend today.":void 0,subheading:t.slug==="todo-app"?"Create your free account to generate keys, send magic links, and wire up your UI in minutes.":void 0})]}):P$?r.jsx(sv,{to:`/guides/${P$.slug}`,replace:!0}):r.jsx(sv,{to:"/",replace:!0})}const N5e={"todo-app":{title:"Todo app backend",description:"Add magic links, session tokens, and real persistence to your todo UI.",eyebrow:"Auth + CRUD"},"notes-app":{title:"Notes app backend",description:"Per-user notes with session-token CRUD-no servers to run.",eyebrow:"Multi-user"},"event-tracker":{title:"Event tracker backend",description:"Log frontend anal
4970ytics events and query them with the Public API key.",eyebrow:"Analytics"},"connect-ui-to-real-backend":{title:"LLM-built UI â real backend",description:"Turn your AI-generated UI into a working app with session-token CRUD.",eyebrow:"Vibe coders"}};function k5e(){return r.jsx("div",{className:"px-4 py-6 md:px-6 lg:px-8",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6",children:[r.jsxs("div",{className:"rounded-3xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-[0_25px_80px_var(--color-shadow)] sm:p-8",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-[var(--color-accent-blue)]",children:[r.jsx(rr,{className:"h-4 w-4 text-amber-400"}),"Hands-on guides"]}),r.jsx("h1",{className:"mt-2 text-2xl font-semibold leading-snug text-[var(--color-fg-default)] sm:text-3xl",children:"Build with ReqRes faster"}),r.jsxs("p",{className:"mt-2 max-w-3xl text-sm text-[var(--color-fg-secondary)] sm:text-base",children:["Pick a guided path for your frontend or QA flow. Every guide uses the same auth model: ",r.jsx("strong",{children:"Private API key"})," ","(server/admin), ",r.jsx("strong",{children:"Public API key"})," (browser read-only), and ",r.jsx("strong",{children:"session tokens"})," for logged-in app users."]})]}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:kA.map(e=>{const t=N5e[e.slug]||{title:e.title,description:e.description},s=e.slug==="notes-app"?Ha:`/guides/${e.slug}`;return r.jsx(dt,{to:s,className:"group block h-full",children:r.jsxs(Ht,{className:"h-full border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-lg shadow-[var(--color-shadow)] transition hover:border-[var(--color-border-hover)]",children:[r.jsxs(C7,{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(bd,{className:"h-4 w-4 text-[var(--color-accent-blue)]"}),t.eyebrow||"Guide"]}),r.jsx(Kt,{className:"h-4 w-4 text-[var(--color-fg-muted)] transition group-hover:translate-x-1 group-hover:text-[var(--color-fg-default)]"})]}),r.jsx(E7,{className:"text-lg text-[var(--color-fg-default)]",children:t.title}),r.jsx(T7,{className:"text-[var(--color-fg-secondary)]",children:t.description})]}),r.jsx(R7,{className:"pt-0",children:r.jsx("div",{className:"mt-3 space-y-2",children:e.topics.slice(0,3).map(n=>r.jsxs("div",{className:"flex items-start gap-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"mt-1 h-1.5 w-1.5 rounded-full bg-[var(--color-accent-blue)]"}),r.jsx("span",{children:n})]},n))})})]})},e.slug)})}),r.jsx(dt,{to:"/prompts",className:"group block",children:r.jsx("div",{className:"rounded-xl border border-[var(--color-accent-purple)]/20 bg-[var(--color-accent-purple)]/5 px-5 py-5 transition hover:border-[var(--color-accent-purple)]/30 hover:bg-[var(--color-accent-purple)]/10",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(rr,{className:"h-5 w-5 text-[var(--color-accent-purple)] mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Prefer AI-generated code?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:"Copy a prompt into ChatGPT, Claude, or Cursor to generate a full app or Playwright test suite against your ReqRes project."})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-[var(--color-accent-purple)] group-hover:text-[var(--color-fg-default)] transition shrink-0",children:[r.jsx(rr,{className:"h-4 w-4"}),"Browse LLM Prompts",r.jsx(Kt,{className:"h-4 w-4 transition group-hover:translate-x-1"})]})]})})}),r.jsx(a1,{heading:"Build your next backend without running a server.",subheading:"Create a free account to get keys, send magic links, and wire your UI in minutes."})]})})}function S5e(){return r.jsx("div",{className:"text-center",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 leading-tight",children:["Turn your"," ",r.jsx("span",{className:"bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"UI screenshot into a working backend"})]}),r.jsx("p",{className:"mt-6 text-xl text-gray-600 max-w-3xl mx-auto leading-relaxed",children:"Upload a screenshot of your Figma design or any UI mockup. Our AI analyzes the interface and generates working API endpoints with realistic data - ready to deploy in seconds."}),r.jsxs("div",{className:"mt-12 relative bg-white rounded-2xl shadow-2xl border border-gray-100 p-8 mb-12 overflow-hidden max-w-7xl mx-auto",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/50 via-purple-50/30 to-pink-50/50"}),r.jsxs("div",{className:"relative grid grid-cols-1 md:grid-cols-5 ga
4970p-2 items-center",children:[r.jsxs("div",{className:"demo-step text-center",children:[r.jsxs("div",{className:"demo-mockup relative mx-auto mb-4 w-40 h-28 bg-gradient-to-br from-gray-100 to-gray-200 rounded-lg border-2 border-dashed border-gray-300 flex items-center justify-center shadow-lg transform hover:scale-105 transition-transform duration-500",children:[r.jsxs("div",{className:"absolute inset-2 bg-white rounded flex flex-col",children:[r.jsx("div",{className:"h-6 bg-gradient-to-r from-blue-500 to-purple-500 rounded-t flex items-center px-2",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-2 h-2 bg-white/30 rounded-full"}),r.jsx("div",{className:"w-2 h-2 bg-white/30 rounded-full"}),r.jsx("div",{className:"w-2 h-2 bg-white/30 rounded-full"})]})}),r.jsxs("div",{className:"flex-1 p-2 space-y-1",children:[r.jsx("div",{className:"h-2 bg-gray-200 rounded w-3/4"}),r.jsx("div",{className:"h-2 bg-gray-200 rounded w-1/2"}),r.jsx("div",{className:"h-3 bg-blue-200 rounded w-2/3 mt-2"})]})]}),r.jsx("div",{className:"upload-pulse absolute inset-0 border-2 border-blue-400 rounded-lg animate-ping opacity-30"})]}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Upload Screenshot"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Drop a screenshot of your Figma design or any UI mockup"})]}),r.jsx("div",{className:"flex justify-center",children:r.jsxs("div",{className:"api-arrow flex items-center",children:[r.jsx("div",{className:"w-6 h-0.5 bg-gradient-to-r from-purple-400 to-pink-400 animate-pulse"}),r.jsx("div",{className:"w-0 h-0 border-l-8 border-l-pink-400 border-t-4 border-t-transparent border-b-4 border-b-transparent animate-pulse"})]})}),r.jsxs("div",{className:"demo-step text-center",children:[r.jsxs("div",{className:"ai-brain relative mx-auto mb-4 w-20 h-20 bg-gradient-to-br from-purple-500 to-pink-500 rounded-full flex items-center justify-center shadow-lg",children:[r.jsx(Dr,{className:"w-8 h-8 text-white animate-pulse"}),r.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-purple-300 animate-spin opacity-30"}),r.jsx("div",{className:"absolute -inset-2 rounded-full border-2 border-pink-300 animate-ping opacity-20"})]}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"AI Vision Analysis"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Computer vision identifies UI components, forms, and data patterns"})]}),r.jsx("div",{className:"flex justify-center",children:r.jsxs("div",{className:"api-arrow flex items-center",children:[r.jsx("div",{className:"w-6 h-0.5 bg-gradient-to-r from-pink-400 to-blue-400 animate-pulse"}),r.jsx("div",{className:"w-0 h-0 border-l-8 border-l-blue-400 border-t-4 border-t-transparent border-b-4 border-b-transparent animate-pulse"})]})}),r.jsxs("div",{className:"demo-step text-center",children:[r.jsxs("div",{className:"api-output relative mx-auto mb-4 w-40 h-28 bg-gradient-to-br from-green-500 to-blue-500 rounded-lg shadow-lg overflow-hidden transform hover:scale-105 transition-transform duration-500",children:[r.jsx("div",{className:"absolute inset-0 bg-black/10"}),r.jsxs("div",{className:"relative p-3 text-white text-xs font-mono",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full animate-pulse"}),r.jsx("span",{children:"API Ready"})]}),r.jsxs("div",{className:"space-y-1 opacity-80",children:[r.jsx("div",{children:"POST /auth/login"}),r.jsx("div",{children:"GET /auth/me"}),r.jsx("div",{children:"POST /users"}),r.jsx("div",{children:"GET /dashboard"})]}),r.jsx("div",{className:"absolute bottom-2 right-2 text-green-300",children:r.jsx(Vl,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"absolute inset-0 border-2 border-green-300 rounded-lg animate-pulse opacity-40"})]}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Working API"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Ready-to-use endpoints with data"})]})]}),r.jsxs("div",{className:"floating-particles absolute inset-0 pointer-events-none",children:[r.jsx("div",{className:"particle absolute top-1/4 left-1/4 w-2 h-2 bg-blue-400 rounded-full animate-bounce"}),r.jsx("div",{className:"particle absolute top-3/4 right-1/4 w-1 h-1 bg-purple-400 rounded-full animate-pulse"}),r.jsx("div",{className:"particle absolute bottom-1/4 left-3/4 w-1.5 h-1.5 bg-pink-400 rounded-full animate-ping"})]})]})]})})}function C5e({content:e,className:t=""}){const[s,n]=x.useState(!1);return r.jsxs("div",{className:`relative inline-block ${t}`,children:[r.jsx("button",{type:"button",className:"text-gray-400 hover:text-gray-600 focus:outline-none",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:r.jsx(wq,{className:"w-4 h-4"})}),s&&r.jsx("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 z-10",children:r.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 max-w-xs whitespace-normal shadow-lg",children:[e,r.jsx("div",{className:"absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-900"})]})})]})}function E5e({onSubmit:e,isLoading:t}){const[s,n]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(null),[c,u]=x.useState(""),[f,h]=x.useState(!1),[g,v]=x.useState({}),y=x.useRef(null);x.useEffect(()=>{const I=L=>{const{figmaFileKey:M,userNotes:O}=L.detail;n(M),u(O)};return window.addEventListener("figma-example",I),()=>window.removeEventListener("figma-example",I)},[]);const _=()=>{const I={};return!s.trim()&&!a.trim()&&!i&&(I.source="Please provide either a Figma file key or upload an image/PDF"),s.trim()&&!s.match(/^[a-zA-Z0-9]+$/)&&(I.figmaFileKey="Figma file key should contain only letters and numbers"),c.length>2e3&&(I.userNotes="Notes must be less than 2000 characters"),v(I),Object.keys(I).length===0},j=I=>{if(I.preventDefault(),!_()||t)return;const L={...s.trim()&&{figmaFileKey:s.trim()},...a.trim()&&{uploadUrl:a.trim()},...i&&{imageData:i},...c.trim()&&{userNotes:c.trim()}};console.log("ð Uploader: Form submission request:",L),console.log("ð Uploader: Validation passed, submitting request"),e(L)},w=x.useCallback(I=>{I.preventDefault(),I.stopPropagation(),I.type==="dragenter"||I.type==="dragover"?h(!0):I.type==="dragleave"&&h(!1)},[]),k=x.useCallback(I=>{I.preventDefault(),I.stopPropagation(),h(!1),I.dataTransfer.files&&I.dataTransfer.files[0]&&E(I.dataTransfer.files[0])},[]),S=I=>{I.target.files&&I.target.files[0]&&E(I.target.files[0])},E=async I=>{if(v({}),!["image/png","image/jpeg","image/jpg","application/pdf"].includes(I.type)){v({upload:`Unsupported file type: ${I.type}. Please upload a PNG, JPEG, or PDF file.`});return}if(I.size>5*1024*1024){v({upload:"File size must be less than 5MB. Large images may cause processing delays. Try compressing your image first."});return}try{const M=await new Promise((z,X)=>{const W=new FileReader;W.onload=()=>{const q=W.result.split(",")[1];z(q)}
4970,W.onerror=X,W.readAsDataURL(I)}),O=M.length*.75/(1024*1024);if(console.log(`ð Image converted to base64: ${O.toFixed(2)}MB`),O>8){v({upload:`Converted image is too large (${O.toFixed(1)}MB). Please use a smaller image or compress it.`});return}l({base64:M,mimeType:I.type}),o(""),n(""),v({})}catch(M){console.error("File processing error:",M),v({upload:"Failed to process file. Please try again with a different image or check that the file is not corrupted."})}},T=()=>{o(""),l(null),y.current&&(y.current.value="")},A=()=>i?`uploaded-file.${i.mimeType.split("/")[1]}`:a?a.split("/").pop()||"uploaded-file":"",R=()=>!!(a||i);return r.jsx("form",{onSubmit:j,className:"space-y-6",children:r.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(RO,{className:"w-5 h-5 text-blue-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Upload UI Screenshot"}),r.jsx(C5e,{content:"Upload a screenshot of your Figma design, mockup, or wireframe. Our AI analyzes the visual elements to generate APIs."})]}),R()?r.jsx("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nc,{className:"w-5 h-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-900",children:A()})]}),r.jsx("button",{type:"button",onClick:T,className:"text-sm text-green-700 hover:text-green-900 underline",disabled:t,children:"Remove"})]})}):r.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-8 text-center transition-colors ${f?"border-blue-400 bg-blue-50":"border-gray-300 hover:border-gray-400"}`,onDragEnter:w,onDragLeave:w,onDragOver:w,onDrop:k,children:[r.jsx("input",{ref:y,type:"file",accept:"image/*,application/pdf",onChange:S,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:t}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-lg bg-blue-50 flex items-center justify-center",children:r.jsx(RO,{className:"w-8 h-8 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-lg font-medium text-gray-900",children:"Drop your UI screenshot here or click to upload"}),r.jsx("p",{className:"text-sm text-muted mt-1",children:"Export a PNG from Figma, Sketch, or any design tool"}),r.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"PNG, JPEG, or PDF up to 5MB"})]})]})]}),g.upload&&r.jsxs("p",{className:"text-sm text-red-600 flex items-center gap-1",children:[r.jsx(lr,{className:"w-4 h-4"}),g.upload]})]})}),r.jsxs("div",{className:"mt-6",children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Additional Notes (Optional)"}),r.jsx("textarea",{value:c,onChange:I=>u(I.target.value),placeholder:"Describe the UI in your screenshot, intended functionality, or specific API requirements...",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",disabled:t}),r.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted",children:[r.jsx("span",{children:"Help the AI understand your screenshot and requirements better"}),r.jsxs("span",{children:[c.length,"/2000"]})]}),g.userNotes&&r.jsxs("p",{className:"mt-1 text-sm text-red-600 flex items-center gap-1",children:[r.jsx(lr,{className:"w-4 h-4"}),g.userNotes]})]}),g.source&&r.jsx("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-md",children:r.jsxs("p",{className:"text-sm text-red-800 flex items-center gap-1",children:[r.jsx(lr,{className:"w-4 h-4"}),g.source]})}),r.jsx("div",{className:"mt-6 flex justify-center",children:r.jsx("button",{type:"submit",disabled:t||!s.trim()&&!R(),className:"px-8 py-3 bg-[#5561FF] text-white font-medium rounded-lg hover:bg-[#4A52E8] focus:outline-none focus:ring-2 focus:ring-[#5561FF]/50 focus:ring-offset-2 disabled:opacity-70 disabled:bg-gray-600 disabled:text-gray-300 disabled:cursor-not-allowed transition-colors",children:t?"Generating Proposal...":"Generate API Proposal"})})]})})}function Gc(e,t){Z.track(e,t)}const Jl={ingestSubmit:(e,t)=>
4970{Gc("figma_ingest_submit",{source:e,...t})},proposalReady:(e,t)=>{Gc("figma_proposal_ready",{routesCount:e,collections:[],hasOpenApi:!1,...t})},makeApiClick:(e,t)=>{Gc("figma_make_api_click",{routesCount:e,userTier:t})},makeApiSuccess:(e,t,s)=>{Gc("figma_make_api_success",{routesCreated:e,baseUrl:t,hasDocsUrl:s})},makeApiError:(e,t)=>{Gc("figma_make_api_error",{error:e,userTier:t})},copyCurl:(e,t)=>{Gc("figma_copy_curl",{route:e,method:t})},copyOpenApi:e=>{Gc("figma_copy_openapi",{routesCount:e})},viewSchema:(e,t)=>{Gc("figma_view_schema",{route:e,schemaType:t})}};function T5e({isOpen:e,onClose:t,route:s,type:n,data:a}){if(!e||!s||!n||!a)return null;const o=async c=>{try{await navigator.clipboard.writeText(c)}catch(u){console.error("Failed to copy: ",u)}},i=()=>{const c=JSON.stringify(a,null,2),u=new Blob([c],{type:"application/json"}),f=URL.createObjectURL(u),h=document.createElement("a");h.href=f,h.download=`${s.collection}-${s.method.toLowerCase()}-${n}-schema.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(f)},l=(c,u=[],f=0)=>{if(!c||typeof c!="object")return r.jsx("div",{className:"text-gray-600 text-sm",children:"No schema available"});const h=f*16;return c.type==="object"&&c.properties?r.jsx("div",{style:{marginLeft:`${h}px`},children:Object.entries(c.properties).map(([g,v])=>{var y;return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-mono text-sm text-blue-600 font-medium",children:g}),r.jsxs("span",{className:"text-xs text-gray-500",children:[v.type||"any",((y=c.required)==null?void 0:y.includes(g))&&r.jsx("span",{className:"ml-1 text-red-500",children:"*"})]})]}),v.description&&r.jsx("div",{className:"text-xs text-gray-500 ml-2 mt-1",children:v.description}),v.type==="object"&&v.properties&&r.jsx("div",{className:"ml-4 mt-1",children:l(v,[...u,g],f+1)}),v.type==="array"&&v.items&&r.jsxs("div",{className:"ml-4 mt-1",children:[r.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Array items:"}),l(v.items,[...u,g,"[]"],f+1)]})]},g)})}):c.type==="array"&&c.items?r.jsxs("div",{style:{marginLeft:`${h}px`},children:[r.jsx("div",{className:"text-sm text-gray-600 mb-2",children:"Array of:"}),l(c.items,[...u,"[]"],f)]}):r.jsxs("div",{style:{marginLeft:`${h}px`},className:"text-sm text-gray-600",children:["Type: ",c.type||"any",c.format&&` (${c.format})`,c.description&&r.jsx("div",{className:"text-xs text-gray-500 mt-1",children:c.description})]})};return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-40",onClick:t}),r.jsxs("div",{className:"fixed right-0 top-0 h-full w-full max-w-2xl bg-white shadow-xl z-50 overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 bg-gray-50",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:[n==="request"?"Request":"Response"," Schema"]}),r.jsxs("p",{className:"text-sm text-gray-600",children:[s.method," ",s.path," ⢠",s.collection]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>o(JSON.stringify(a,null,2)),className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Copy JSON",children:r.jsx(is,{className:"w-4 h-4"})}),r.jsx("button",{onClick:i,className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",title:"Download JSON",children:r.jsx(av,{className:"w-4 h-4"})}),r.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",children:r.jsx(Ir,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsxs("div",{className:"h-full flex",children:[r.jsx("div",{className:"w-1/2 border-r border-gray-200 overflow-y-auto",children:r.jsxs("div",{className:"p-4",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-3",children:"Structure"}),r.jsx("div",{className:"space-y-2",children:l(a)})]})}),r.jsx("div",{className:"w-1/2 overflow-y-auto",children:r.jsxs("div",{className:"p-4",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-3",children:"JSON Schema"}),r.jsx("pre",{className:"text-xs font-mono bg-gray-50 p-4 rounded-lg overflow-x-auto",children:JSON.stringify(a,null,2)})]})})]})}),r.jsx("div",{className:"border-t border-gray-200 p-4 bg-gray-50",children:r.jsxs("div",{className:"text-xs text-gray-500",children:["This schema defines the structure for ",n==="request"?"incoming requests":"API responses",".",a.required&&a.required.length>0&&r.jsxs("span",{className:"ml-1",children:["Fields marked with ",r.jsx("span",{className:"text-red-500",children:"*"})," are required."]})]})})]})]})}function R5e({proposal:e}){const[t,s]=x.useState(new Set),[n,a]=x.useState({}),[o,i]=x.useState({isOpen:!1}),l=_=>{const j=new Set(t);j.has(_)?(j.delete(_),a(w=>{const{[_]:k,...S}=w;return S})):j.add(_),s(j)},c=(_,j)=>{a(w=>{var k;return{...w,[_]:{...w[_],[j]:!((k=w[_])!=null&&k[j])}}})},u=_=>{switch(_){case"GET":return"bg-blue-100 text-blue-800";case"POST":return"bg-green-100 text-green-800";
4970case"PUT":return"bg-orange-100 text-orange-800";case"PATCH":return"bg-yellow-100 text-yellow-800";case"DELETE":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},f=async _=>{try{await navigator.clipboard.writeText(_)}catch(j){console.error("Failed to copy text: ",j)}},h=_=>{var w;let j=`curl -X ${_.method}`;return _.requestSchema&&_.method!=="GET"&&(j+=` \\ 4971 -H "Content-Type: application/json"`,(w=_.examples)!=null&&w.request&&(j+=` \\ 4972 -d '${JSON.stringify(_.examples.request,null,2)}'`)),j+=` \\ 4973 "https://reqres.in${_.path}"`,j},g=_=>{const j=h(_);f(j),Jl.copyCurl(_.path,_.method)},v=()=>{e.openapi&&(f(e.openapi),Jl.copyOpenApi(e.routes.length))},y=(_,j)=>{const w=j==="request"?_.requestSchema:_.responseSchema;w&&(i({isOpen:!0,route:_,type:j,data:w}),Jl.viewSchema(_.path,j))};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"bg-gradient-to-r from-gray-50 to-gray-25 px-6 py-4 border-b border-gray-100",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-base font-semibold text-gray-900",children:[e.routes.length," endpoint",e.routes.length!==1?"s":""," proposed"]}),r.jsx("span",{className:"px-3 py-1 text-sm font-medium text-blue-700 bg-blue-50 rounded-full border border-blue-100",children:"Ready to deploy"})]}),e.openapi&&r.jsxs("button",{onClick:v,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-blue-700 bg-white border border-blue-200 rounded-lg hover:bg-blue-50 hover:border-blue-300 transition-all duration-200 shadow-sm hover:shadow-md",children:[r.jsx(is,{className:"w-4 h-4"}),"Copy OpenAPI"]})]})}),r.jsx("div",{className:"divide-y divide-gray-100",children:e.routes.map((_,j)=>{var w,k,S,E,T,A,R,I,L;return r.jsxs("div",{className:"bg-white hover:bg-gray-50 transition-colors duration-200",children:[r.jsxs("div",{className:"px-6 py-5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[r.jsx("button",{onClick:()=>l(j),className:"p-2 hover:bg-gray-100 rounded-lg transition-colors duration-200",children:t.has(j)?r.jsx(sr,{className:"w-4 h-4 text-gray-600"}):r.jsx(Hn,{className:"w-4 h-4 text-gray-600"})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded-md ${u(_.method)}`,children:_.method}),r.jsx("code",{className:"text-sm font-mono text-gray-900 bg-gray-50 px-2 py-1 rounded",children:_.path})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[r.jsx("span",{className:"bg-gray-100 px-2 py-1 rounded font-mono",children:_.collection}),_.stateful&&r.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Rn,{className:"w-3 h-3"}),"Stateful"]}),_.paging&&r.jsxs("span",{className:"flex items-center gap-1 text-blue-600",children:[r.jsx(VT,{className:"w-3 h-3"}),"Paging"]}),_.filters&&_.filters.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-purple-600",children:[r.jsx(Ou,{className:"w-3 h-3"}),"Filterable"]}),_.errorProfiles&&_.errorProfiles.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-orange-600",children:[r.jsx(Dr,{className:"w-3 h-3"}),"Chaos"]})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("button",{onClick:()=>g(_),className:"flex items-center gap-1 px-2 py-1 text-xs text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded",title:"Copy cURL",children:[r.jsx(is,{className:"w-3 h-3"}),"cURL"]})})]}),r.jsx("div",{className:"mt-2 ml-9 text-sm text-gray-600 text-left",children:_.description})]}),t.has(j)&&r.jsxs("div",{className:"px-6 pb-4 ml-9 space-y-4 bg-gray-50 border-t border-gray-200",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-500 text-xs uppercase tracking-wide",children:"Collection"}),r.jsx("div",{className:"font-medium",children:_.collection||"N/A"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-500 text-xs uppercase tracking-wide",children:"Stateful"}),r.jsx("div",{className:`font-medium ${_.stateful?"text-green-600":"text-gray-600"}`,children:_.stateful?"Yes":"No"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-500 text-xs uppercase tracking-wide",children:"Paging"}),r.jsx("div",{className:`font-medium ${_.paging?"text-blue-600":"text-gray-600"}`,children:_.paging?"Enabled":"Disabled"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-500 text-xs uppercase tracking-wide",children:"Filters"}),r.jsx("div",{className:"font-medium",children:((w=_.filters)==null?void 0:w.length)||0})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[_.requestSchema&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>c(j,"requestSchema"),className:"flex items-center gap-2 text-sm font-medium text-gray-700 hover:text-gray-900 mb-2",children:[(k=n[j])!=null&&k.requestSchema?r.jsx(sr,{className:"w-4 h-4"}):r.jsx(Hn,{className:"w-4 h-4"}),"Request Schema",r.jsx("button",{onClick:M=>{M.stopPropagation(),y(_,"request")},className:"ml-auto p-1 text-gray-400 hover:text-gray-600",title:"View in detail",children:r.jsx(za,{className:"w-3 h-3"})})]}),((S=n[j])==null?void 0:S.requestSchema)&&r.jsx("pre",{className:"text-xs bg-white border border-gray-200 rounded p-3 overflow-x-auto",children:JSON.stringify(_.requestSchema,null,2)})]}),_.responseSchema&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>c(j,"responseSchema"),className:"flex items-center gap-2 text-sm font-medium text-gray-700 hover:text-gray-900 mb-2",children:[(E=n[j])!=null&&E.responseSchema?r.jsx(sr,{className:"w-4 h-4"}):r.jsx(Hn,{className:"w-4 h-4"}),"Response Schema",r.jsx("button",{onClick:M=>{M.stopPropagation(),y(_,"response")},className:"ml-auto p-1 text-gray-400 hover:text-gray-600",title:"View in detail",children:r.jsx(za,{className:"w-3 h-3"})})]}),((T=n[j])==null?void 0:T.responseSchema)&&r.jsx("pre",{className:"text-xs bg-white border border-gray-200 rounded p-3 overflow-x-auto",children:JSON.stringify(_.responseSchema,null,2)})]})]}),_.examples&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>c(j,"examples"),className:"flex items-center gap-2 text-sm font-medium text-gray-700 hover:text-gray-900 mb-2",children:[(A=n[j])!=null&&A.examples?r.jsx(sr,{className:"w-4 h-4"}):r.jsx(Hn,{className:"w-4 h-4"}),"Examples"]}),((R=n[j])==null?void 0:R.examples)&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[_.examples.request&&r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-medium text-gray-500 mb-1",children:"Request"}),r.jsx("pre",{className:"text-xs bg-white border border-gray-200 rounded p-3 overflow-x-auto",children:JSON.stringify(_.examples.request,null,2)})]}),_.examples.response&&r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-medium text-gray-500 mb-1",children:"Response"}),r.jsx("pre",{className:"text-xs bg-white border border-gray-200 rounded p-3 overflow-x-auto",children:JSON.stringify(_.examples.response,null,2)})]})]})]}),_.errorProfiles&&_.errorProfiles.length>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>c(j,"errorProfiles"),className:"flex items-center gap-2 text-sm font-medium text-gray-700 hover:text-gray-900 mb-2",children:[(I=n[j])!=null&&I.errorProfiles?r.jsx(sr,{className:"w-4 h-4"}):r.jsx(Hn,{className:"w-4 h-4"}),"Error Profiles (",_.errorProfiles.length,")"]}),((L=n[j])==null?void 0:L.errorProfiles)&&r.jsx("div",{className:"space-y-2",children:_.errorProfiles.map((M,O)=>r.jsxs("div",{className:"bg-white border border-gray-200 rounded p-3",children:[r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsx("span",{className:`px-2 py-1 rounded font-medium ${M.code>=500?"bg-red-100 text-red-800":"bg-orange-100 text-orange-800"}`,children:M.code}),r.jsxs("span",{className:"text-gray-600",children:[(M.probability*100).toFixed(1),"% chance"]}),M.latencyMs&&r.jsxs("span",{className:"text-gray-600",children:["+",M.latencyMs,"ms delay"]})]}),M.description&&r.jsx("div",{className:"mt-1 text-xs text-gray-500",children:M.description})]},O))})]}),r.jsxs("div",{className:"text-xs text-gray-500 space-y-1",children:[_.filters&&_.filters.length>0&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Filters:"}
4973)," ",_.filters.join(", ")]}),_.sortable&&_.sortable.length>0&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Sortable:"})," ",_.sortable.join(", ")]})]})]})]},j)})})]}),r.jsx(T5e,{isOpen:o.isOpen,onClose:()=>i({isOpen:!1}),route:o.route,type:o.type,data:o.data})]})}const A5e="reqres-dev-ui",SA=e=>({"x-api-key":e||A5e});async function P5e(e,t){return(await ue.post("/api/figma/ingest",e,{authToken:t,headers:SA(t)})).data}async function I5e(e,t){return(await ue.post("/api/figma/create",e,{authToken:t,headers:SA(t)})).data}async function M5e(e){return(await ue.get("/api/figma/usage",{authToken:e,headers:SA(e)})).data}function O5e({proposal:e,isOpen:t,onClose:s}){const{getToken:n,isSignedIn:a}=zt(),{user:o,isLoaded:i}=_r(),[l,c]=x.useState(!1),[u,f]=x.useState(null),[h,g]=x.useState(null),[v,y]=x.useState(null),[_,j]=x.useState(null),w=(_==null?void 0:_.subscriptionTier)==="pro"||(_==null?void 0:_.subscriptionTier)==="premium",k=async()=>{if(!(!o||!i||!a))try{const A=await n();if(!A)return;const R=await Td.getPaymentStatus({authToken:A||void 0});j(R.data)}catch(A){console.error("Failed to fetch payment status:",A)}};x.useEffect(()=>{t&&a&&k()},[t,a,o,i]);const S=async()=>{if(!a){g("Please sign in to create APIs");return}if(!w){g("Pro or Premium subscription required to deploy APIs");return}c(!0),g(null);try{const A=await n();if(!A)throw new Error("Failed to get authentication token");const R=await I5e({proposal:e},A);f(R),Jl.makeApiSuccess(R.routesCreated,R.baseUrl,!!R.docsUrl)}catch(A){console.error("Failed to create API:",A),g(A.message||"Failed to create API"),Jl.makeApiError(A.message||"Unknown error",w?"pro":"free")}finally{c(!1)}},E=async(A,R)=>{try{await navigator.clipboard.writeText(A),y(R),setTimeout(()=>y(null),2e3)}catch(I){console.error("Failed to copy:",I)}},T=()=>{var M;if(!u||!e)return"";const A=(M=u.details)==null?void 0:M.find(O=>O.success);if(!A)return"";const[R,I]=A.route.split(" "),L=I.replace("/","");return R==="GET"?`// Fetch data from your new API 4974const response = await fetch('${u.baseUrl}/${L}') 4975const data = await response.json() 4976console.log('Data:', data)`:R==="POST"?`// Create new data 4977const response = await fetch('${u.baseUrl}/${L}', { 4978 method: 'POST', 4979 headers: { 'Content-Type': 'application/json' }, 4980 body: JSON.stringify({ 4981 // Add your data here based on the endpoint 4982 example: 'value' 4983 }) 4984}) 4985const result = await response.json() 4986console.log('Created:', result)`:R==="PUT"||R==="PATCH"?`// Update data 4987const response = await fetch('${u.baseUrl}/${L}/123', { 4988 method: '${R}', 4989 headers: { 'Content-Type': 'application/json' }, 4990 body: JSON.stringify({ 4991 // Add your update data here 4992 example: 'updated value' 4993 }) 4994}) 4995const result = await response.json() 4996console.log('Updated:', result)`:R==="DELETE"?`// Delete data 4997const response = await fetch('${u.baseUrl}/${L}/123', { 4998 method: 'DELETE' 4999}) 5000console.log('Deleted:', response.status === 204 ? 'Success' : 'Failed')`:`// Use your new API endpoint 5001const response = await fetch('${u.baseUrl}${I}', { 5002 method: '${R}', 5003 headers: { 'Content-Type': 'application/json' } 5004}) 5005const result = await response.json() 5006console.log('Result:', result)`};return t?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50",onClick:s}),r.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:u?"ð API Created Successfully!":"Create Your API"}),r.jsx("button",{onClick:s,className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded",children:r.jsx(Ir,{className:"w-5 h-5"})})]}),r.jsx("div",{className:"overflow-y-auto max-h-[calc(90vh-80px)]",children:a?_===null?r.jsxs("div",{className:"p-6 text-center",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-blue-100 rounded-full flex items-center justify-center",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Checking subscription status..."}),r.jsx("p",{className:"text-gray-600",children:"Please wait while we verify your account."})]}):w?u?r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx(ts,{className:"w-8 h-8 text-green-600"})}),r.jsxs("p",{className:"text-gray-600",children:["Successfully created ",u.routesCreated," endpoint",u.routesCreated!==1?"s":"","from your design! Your API is now live and ready to use."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Base URL"}),r.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[r.jsx("code",{className:"flex-1 text-sm font-mono text-gray-900",children:u.baseUrl}),r.jsx("button",{onClick:()=>E(u.baseUrl,"baseUrl"),className:"p-1 text-gray-400 hover:text-gray-600",title:"Copy",children:v==="baseUrl"?r.jsx(ts,{className:"w-4 h-4 text-green-600"}):r.jsx(is,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>window.open(u.baseUrl,"_blank"),className:"p-1 text-gray-400 hover:text-gray-600",title:"Open",children:r.jsx(ja,{className:"w-4 h-4"})})]})]}),u.projectSlug&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Project Slug"}),r.jsxs("div",{className:"flex items-center gap-2 bg-green-50 border border-green-200 rounded-lg p-3",children:[r.jsx("code",{className:"flex-1 text-sm font-mono text-gray-900",children:u.projectSlug}),r.jsx("button",{onClick:()=>E(u.projectSlug,"projectSlug"),className:"p-1 text-gray-400 hover:text-gray-600",title:"Copy",children:v==="projectSlug"?r.jsx(ts,{className:"w-4 h-4 text-green-600"}):r.jsx(is,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>window.open("/custom-endpoints","_blank"),className:"p-1 text-gray-400 hover:text-gray-600",title:"Open Project",children:r.jsx(ja,{className:"w-4 h-4"})})]})]}),u.docsUrl&&r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"API Documentation"}),r.jsxs("div",{className:"flex items-center gap-2 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[r.jsx("code",{className:"flex-1 text-sm font-mono text-gray-900",children:u.docsUrl}),r.jsx("button",{onClick:()=>E(u.docsUrl,"docsUrl"),className:"p-1 text-gray-400 hover:text-gray-600",title:"Copy",children:v==="docsUrl"?r.jsx(ts,{className:"w-4 h-4 text-green-600"}):r.jsx(is,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>window.open(u.docsUrl,"_blank"),title:"Open",children:r.jsx(ja,{className:"w-4 h-4"})})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Qu
5006ickstart Code"}),r.jsxs("div",{className:"relative",children:[r.jsx("pre",{className:"bg-gray-900 text-left text-gray-100 text-xs p-4 rounded-lg overflow-x-auto",children:T()}),r.jsx("button",{onClick:()=>E(T(),"quickstart"),className:"absolute top-2 right-2 p-1 text-gray-400 hover:text-gray-200",title:"Copy",children:v==="quickstart"?r.jsx(ts,{className:"w-4 h-4 text-green-400"}):r.jsx(is,{className:"w-4 h-4"})})]})]}),u.details&&u.details.some(A=>!A.success)&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Details"}),r.jsx("div",{className:"space-y-2",children:u.details.map((A,R)=>r.jsxs("div",{className:`flex items-center gap-2 text-xs p-2 rounded ${A.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:[A.success?r.jsx(ts,{className:"w-3 h-3"}):r.jsx(Ir,{className:"w-3 h-3"}),r.jsx("span",{className:"font-mono",children:A.route}),!A.success&&A.error&&r.jsx("span",{className:"ml-auto text-red-600",children:A.error})]},R))})]})]}),r.jsxs("div",{className:"flex gap-3 pt-6 mt-6 border-t border-gray-200",children:[r.jsx("button",{onClick:s,className:"flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50",children:"Close"}),r.jsx("button",{onClick:()=>{window.location.href="/custom-endpoints"},className:"flex-1 px-4 py-2 bg-[#5561FF] text-white rounded-lg hover:bg-[#4A52E8]",children:u.projectUrl?"View Project":"View Endpoints"})]})]}):h?r.jsxs("div",{className:"p-6 text-center",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full flex items-center justify-center",children:r.jsx(Ir,{className:"w-8 h-8 text-red-600"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Failed to Create API"}),r.jsx("p",{className:"text-red-600 mb-6",children:h}),r.jsx("button",{onClick:()=>{g(null),S()},className:"px-4 py-2 bg-red-600 text-white font-medium rounded-lg hover:bg-red-700",children:"Try Again"})]}):r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"text-center mb-6",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-blue-100 rounded-full flex items-center justify-center",children:r.jsx(Dr,{className:"w-8 h-8 text-blue-600"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Ready to Create Your API"}),r.jsxs("p",{className:"text-gray-600",children:["This will create ",e.routes.length," endpoint",e.routes.length!==1?"s":""," with full CE/DP compatibility."]})]}),r.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 mb-6",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"What you'll get:"}),r.jsxs("ul",{className:"space-y-1 text-sm text-gray-600",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ts,{className:"w-4 h-4 text-green-500"}),"Live API endpoints with your custom data"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ts,{className:"w-4 h-4 text-green-500"}),"Data persistence and statefulness"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ts,{className:"w-4 h-4 text-green-500"}),"Pagination, filtering, and sorting"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ts,{className:"w-4 h-4 text-green-500"}),"OpenAPI documentation"]}),e.routes.some(A=>{var R;return(R=A.errorProfiles)==null?void 0:R.length})&&r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ts,{className:"w-4 h-4 text-green-500"}),"Chaos engineering simulation"]})]})]}),r.jsx("button",{onClick:S,disabled:l,className:"w-full px-6 py-3 bg-[#5561FF] text-white font-medium rounded-lg hover:bg-[#4A52E8] disabled:opacity-70 disabled:bg-gray-600 disabled:text-gray-300 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:l?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Creating API..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Dr,{className:"w-4 h-4"}),"Create API Now"]})})]}):r.jsxs("div",{className:"p-6 text-center",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gradient-to-br from-orange-400 to-pink-500 rounded-full flex items-center justify-center",children:r.jsx(Wi,{className:"w-8 h-8 text-white"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Upgrade to Pro or Premium to Deploy APIs"}),r.jsx("p",{className:"text-gray-600 mb-6",children:"You can generate API proposals for free, but deploying live APIs requires a Pro or Premium subscription:"}),r.jsxs("div",{className:"text-left space-y-3 mb-6 max-w-md mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ts,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700",children:"Unlimited custom endpoints"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ts,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700",children:"Data persistence & statefulness"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ts,{className:"w-5 h-5 text-green-500"}
5006),r.jsx("span",{className:"text-sm text-gray-700",children:"Chaos engineering & error profiles"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ts,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700",children:"Team collaboration"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ts,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700",children:"Priority support"})]})]}),r.jsx("button",{onClick:()=>{window.open("https://app.reqres.in/upgrade","_blank")},className:"px-6 py-2 bg-gradient-to-r from-orange-500 to-pink-500 text-white font-medium rounded-lg hover:from-orange-600 hover:to-pink-600",children:"Upgrade to Pro or Premium"})]}):r.jsxs("div",{className:"p-6 text-center",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-blue-100 rounded-full flex items-center justify-center",children:r.jsx(Wi,{className:"w-8 h-8 text-blue-600"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Sign in to Create APIs"}),r.jsx("p",{className:"text-gray-600 mb-6",children:"You need an account to create and deploy your custom API endpoints."}),r.jsx(ip,{mode:"modal",fallbackRedirectUrl:window.location.pathname,children:r.jsx("button",{className:"px-6 py-2 bg-[#5561FF] text-white font-medium rounded-lg hover:bg-[#4A52E8]",children:"Sign In to Continue"})})]})})]})})]}):null}function L5e({onUsageUpdate:e}){const{getToken:t,isSignedIn:s}=zt(),[n,a]=x.useState(null),[o,i]=x.useState(!1),[l,c]=x.useState(null),u=async(v=0)=>{if(s){i(!0),c(null);try{const y=await Ue(t);if(!y){if(v<2){console.log("No token available, retrying in 1 second...",v),setTimeout(()=>u(v+1),1e3);return}throw new Error("Failed to get authentication token")}const _=await M5e(y);a(_),e==null||e(_.can_generate)}catch(y){if(console.error("Error fetching usage:",y),y instanceof Error&&y.message.includes("401")&&v<1){console.log("401 error but signed in, retrying..."),setTimeout(()=>u(v+1),1e3);return}y instanceof Error&&y.message.includes("401")?c("Authentication failed. Please try again."):c(y instanceof Error?y.message:"Failed to fetch usage")}finally{i(!1)}}};if(x.useEffect(()=>{if(s){const v=setTimeout(()=>{u()},100);return()=>clearTimeout(v)}else a(null),c(null)},[s]),x.useEffect(()=>{const v=()=>{!document.hidden&&s&&u()};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)},[s]),!s)return null;if(o)return r.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),r.jsx("span",{className:"text-sm text-blue-700",children:"Checking usage..."})]})});if(l)return r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"text-red-600",children:"â ï¸"}),r.jsx("span",{className:"text-sm text-red-700",children:l})]}),r.jsx("button",{onClick:()=>u(),className:"text-sm text-red-700 underline hover:text-red-900 transition-colors",disabled:o,children:o?"Retrying...":"Try again"})]});if(!n)return null;const f=n.used/n.limit*100,h=n.remaining<=1,g=n.remaining===0;return r.jsxs("div",{className:`border rounded-lg p-4 mb-6 ${g?"bg-red-50 border-red-200":h?"bg-yellow-50 border-yellow-200":"bg-green-50 border-green-200"}`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Y_,{className:`w-4 h-4 ${g?"text-red-600":h?"text-yellow-600":"text-green-600"}`}),r.jsx("span",{className:`text-sm font-medium ${g?"text-red-700":h?"text-yellow-700":"text-green-700"}`,children:"API Proposals Today"})]}),r.jsxs("span",{className:`text-sm font-medium ${g?"text-red-700":h?"text-yellow-700":"text-green-700"}`,children:[n.used," / ",n.limit]})]}),r.jsx("div",{className:"mb-3",children:r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${g?"bg-red-500":h?"bg-yellow-500":"bg-green-500"}`,style:{width:`${Math.min(f,100)}%`}})})}),r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cp,{className:`w-3 h-3 ${g?"text-red-500":h?"text-yellow-500":"text-green-500"}`}),r.jsxs("span",{className:`${g?"text-red-600":h?"text-yellow-600":"text-green-600"}`,children:["Resets ",n.reset_time]})]}),g?r.jsx("span",{className:"text-red-600 font-medium",children:"Limit reached"}):h?r.jsxs("span",{className:"text-yellow-600 font-medium",children:[n.remaining," left"]}):r.jsxs("span",{className:"text-green-600",children:[n.remaining," remaining"]})]}),g&&r.jsx("div",{className:"mt-3 pt-3 border-t border-red-200",children:r.jsxs("p",{className:"text-xs text-red-600",children:["You've reached your daily limit. Wait until tomorrow or"," ",r.jsx("button",{onClick:()=>window.open("/upgrade","_blank"),className:"underline hover:no-underline font-medium",children:"upgrade to Premium"})," ","for higher limits."]})})]})}function D5e({feedback:e,onRetry:t}){return e.quality==="good"?null:r.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx(lr,{className:"w-6 h-6 text-yellow-600"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-medium text-yellow-800 mb
5006-2",children:"Screenshot Quality Issue"}),e.reason&&r.jsx("p",{className:"text-yellow-700 mb-4",children:e.reason}),e.suggestions&&e.suggestions.length>0&&r.jsxs("div",{className:"mb-4",children:[r.jsxs("h4",{className:"text-sm font-medium text-yellow-800 mb-2 flex items-center gap-2",children:[r.jsx(Sq,{className:"w-4 h-4"}),"How to improve your screenshot:"]}),r.jsx("ul",{className:"space-y-2",children:e.suggestions.map((s,n)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm text-yellow-700",children:[r.jsx("span",{className:"text-yellow-600 mt-0.5",children:"â¢"}),s]},n))})]}),e.example_good_screenshots&&e.example_good_screenshots.length>0&&r.jsxs("div",{className:"mb-4",children:[r.jsxs("h4",{className:"text-sm font-medium text-yellow-800 mb-2 flex items-center gap-2",children:[r.jsx(cpe,{className:"w-4 h-4"}),"Examples of good screenshots:"]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:e.example_good_screenshots.map((s,n)=>r.jsx("div",{className:"bg-yellow-100 border border-yellow-300 rounded px-3 py-2 text-sm text-yellow-800",children:s},n))})]}),r.jsxs("div",{className:"flex items-center gap-3 pt-3 border-t border-yellow-200",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-yellow-700",children:[r.jsx(yd,{className:"w-4 h-4"}),r.jsx("span",{children:"Take a new screenshot with more UI elements visible"})]}),t&&r.jsx("button",{onClick:t,className:"ml-auto px-4 py-2 bg-yellow-600 text-white text-sm font-medium rounded-lg hover:bg-yellow-700 transition-colors",children:"Try Again"})]})]})]})})}function $5e(){const{getToken:e,isSignedIn:t}=zt(),[s,n]=x.useState(null),[a,o]=x.useState(null),[i,l]=x.useState(!1),[c,u]=x.useState(null),[f,h]=x.useState(!1),[g,v]=x.useState(!0),y=async w=>{var k;if(!g){u("Daily limit reached. Please wait until tomorrow or upgrade for higher limits.");return}l(!0),u(null),console.log("ð FigmaPage: Starting ingest with request:",w),console.log("ð FigmaPage: User signed in:",t);try{const S=Date.now();Jl.ingestSubmit(w.figmaFileKey?"figma":"image",{figmaFileKey:w.figmaFileKey,uploadUrl:w.uploadUrl,userNotesLength:(k=w.userNotes)==null?void 0:k.length});let E;t&&(E=await e()||void 0,console.log("ð FigmaPage: Got auth token:",!!E)),console.log("ð FigmaPage: Calling ingestFigmaDesign API...");const T=await P5e(w,E),A=Date.now()-S;Jl.proposalReady(T.proposal.routes.length,{collections:[...new Set(T.proposal.routes.map(R=>R.collection))],hasOpenApi:!!T.proposal.openapi,processingTime:A}),n(T.proposal),o(T),T.cached&&console.log("ð¯ Cache hit! Response served from cache:",T.cacheStats)}catch(S){console.error("Figma ingest failed:",S),console.log("ð FigmaPage: Error details:",{message:S.message,status:S.status,data:S.data,stack:S.stack}),u(S.message||"Failed to generate API proposal"),Jl.makeApiError(S.message||"Unknown error",t?"pro":"free")}finally{l(!1)}},_=()=>{s&&(Jl.makeApiClick(s.routes.length,t?"pro":"free"),h(!0))},j=()=>{n(null),o(null),u(null),h(!1)};return r.jsx("div",{className:"ui-page min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 relative overflow-hidden rounded-lg mb-8",children:r.jsxs("div",{className:"container mx-auto px-4 py-8 relative z-10 max-w-none",children:[r.jsx(S5e,{}),r.jsx(Gi,{children:r.jsx("div",{className:"max-w-6xl mx-auto mt-12",children:r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute -top-8 -left-8 w-20 h-20 bg-gradient-to-br from-pink-400 to-purple-500 rounded-full opacity-20 animate-pulse"}),r.jsx("div",{className:"absolute -top-4 -right-12 w-16 h-16 bg-gradient-to-br from-blue-400 to-cyan-500 rounded-full opacity-20 animate-pulse delay-1000"}),r.jsxs("h1",{className:"text-5xl md:text-6xl font-bold bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600 bg-clip-text text-transparent mb-6",children:["Screenshot to API",r.jsx("br",{}),r.jsx("span",{className:"text-4xl md:text-5xl",children:"in Seconds"})]})]}),r.jsx("p",{className:"text-xl text-muted mb-8 max-w-2xl mx-auto leading-relaxed",children:"Upload a screenshot of your Figma design or any UI mockup. Our AI vision analyzes the interface and generates working APIs instantly."}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 mb-12",children:[r.jsxs("div",{className:"feature-card bg-white/60 backdrop-blur-sm rounded-xl p-6 border border-white/20 shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[r.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-500 rounded-lg flex items-center justify-center mb-4 mx-auto",children:r.jsx(Dr,{className:"w-6 h-6 text-white"})}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Vision AI"}),r.jsx("p",{className:"text-sm text-muted",children:"Advanced computer vision analyzes screenshots and identifies API patterns"})]}),r.jsxs("div",{className:"feature-card bg-white/60 backdrop-blur-sm rounded-xl p-6 border border-white/20 shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[r.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-500 to-pink-500 rounded-lg flex items-center justify-center mb-4 mx-auto",children:r.jsx(Rn,{className:"w-6 h-6 text-white"})}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Data Persistence"}),r.jsx("p",{className:"text-sm text-muted",children:"Your APIs include real data storage and CRUD operations"})]}),r.jsxs("div",{className:"feature-card bg-white/60 backdrop-blur-sm rounded-xl p-6 border border-white/20 shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[r.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-pink-500 to-blue-500 rounded-lg flex items-center justify-center mb-4 mx-auto",children:r.jsx(WT,{className:"w-6 h-6 text-white"})}),r.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Screenshot-First"}),r.jsx("p",{className:"text-sm text-muted",children:"Built for designers - just export a PNG and get working APIs"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 to-purple-600 rounded-2xl blur opacity-20 animate-pulse"}),r.jsxs("div",{className:"relative bg-white rounded-2xl border border-gray-200 shadow-xl p-8",children:[r.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[r.jsx(Ep,{className:"w-6 h-6 text-blue-600"}),r.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Ready to Transform Your Designs?"})]}),r.jsx("p",{className:"text-muted mb-8 max-w-md mx-auto",children:"Join thousands of designers who are shipping faster with AI-generated APIs"}),r.jsx(ip,{mode:"modal",fallbackRedirectUrl:"/ui",children:r.jsxs("button",{className:"group relative px-8 py-4 bg-gradient-to-r from-blue-600 to-purple-600 text-white font-semibold rounded-xl hover:from-blue-700 hover:to-purple-700 transition-all duration-300 transform hover:scale-105 shadow-lg hover:shadow-xl",children:[r.jsxs("span",{className:"relative z-10 flex items-center gap-2",children:["Sign In to Start Creating",r.jsx(Dr,{className:"w-5 h-5 group-hover:animate-pulse"})]}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-600 to-pink-600 rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})}),r.jsx("p",{className:"text-sm text-muted mt-4",children:"Free to try ⢠Pro to deploy ⢠No credit card required"})]})]})]})})}),r.jsxs(vd,{children:[!s&&!i&&r.jsxs("div",{className:"max-w-4xl mx-auto mt-12",children:[r.jsx(L5e,{onUsageUpdate:v}),r.jsx(E5e,{onSubmit:y,isLoading:i||!g})]}),i&&r.jsx("div",{className:"max-w-4xl mx-auto mt-12 text-center",children:r.jsxs("div",{className:"inline-flex items-center gap-3 bg-white rounded-lg px-6 py-4 shadow-sm border border-gray-200",children:[r.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent roun
5006ded-full"}),r.jsxs("div",{className:"text-left",children:[r.jsx("span",{className:"text-gray-700 font-medium",children:"Analyzing your screenshot..."}),r.jsx("p",{className:"text-sm text-muted mt-1",children:"This may take 10-30 seconds depending on image complexity"})]})]})}),c&&r.jsx("div",{className:"max-w-4xl mx-auto mt-8",children:r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("svg",{className:"w-5 h-5 text-red-600",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),r.jsx("h3",{className:"font-medium text-red-900",children:"Error"})]}),r.jsx("p",{className:"mt-2 text-red-800",children:c}),r.jsx("button",{onClick:j,className:"mt-3 text-sm text-red-700 underline hover:text-red-900",children:"Try again"})]})}),s&&r.jsxs("div",{className:"max-w-4xl mx-auto mt-12",children:[r.jsxs("div",{className:"bg-white rounded-xl shadow-lg border border-gray-100 overflow-hidden",children:[r.jsx("div",{className:"px-8 py-6 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-gray-25",children:r.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6",children:[r.jsxs("div",{className:"flex-1 max-w-2xl",children:[r.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-3",children:"Generated API Proposal"}),r.jsx("p",{className:"text-base text-muted leading-relaxed",children:s.summary}),(a==null?void 0:a.cached)&&r.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm text-blue-600 bg-blue-50 px-3 py-2 rounded-full border border-blue-100",children:[r.jsx("span",{className:"w-2 h-2 bg-blue-500 rounded-full animate-pulse"}),"Served from cache",a.cacheStats&&r.jsxs("span",{className:"text-blue-500 font-medium",children:["(used ",a.cacheStats.requestCount," times)"]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 lg:flex-col lg:w-auto",children:[r.jsx("button",{onClick:j,className:"px-6 py-3 text-sm font-semibold text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 hover:border-gray-300 transition-all duration-200 shadow-sm hover:shadow-md",children:"Start Over"}),r.jsx("button",{onClick:_,className:"px-6 py-3 text-sm font-semibold text-white bg-gradient-to-r from-blue-600 to-blue-700 border border-transparent rounded-lg hover:from-blue-700 hover:to-blue-800 disabled:from-gray-400 disabled:to-gray-500 disabled:cursor-not-allowed transition-all duration-200 shadow-sm hover:shadow-md transform hover:-translate-y-0.5",disabled:!s.routes||s.routes.length===0,children:"Make This API"})]})]})}),s.routes&&s.routes.length>0?r.jsx(R5e,{proposal:s}):r.jsx("div",{className:"text-center py-8 text-gray-500",children:r.jsx("p",{children:"No endpoints were generated from this screenshot."})})]}),s.screenshot_feedback&&s.screenshot_feedback.quality==="poor"&&r.jsx(D5e,{feedback:s.screenshot_feedback,onRetry:j})]}),f&&s&&r.jsx(O5e,{proposal:s,isOpen:f,onClose:()=>h(!1)})]})]})})}const Gg="https://reqres.in",Wg="reqres_session_token",C0="reqres_session_email",E0="reqres_demo_notes",U5e=`const res = await fetch('https://reqres.in/api/app-users/login', { 5007 method: 'POST', 5008 headers: { 5009 'Content-Type': 'application/json', 5010 'x-api-key': '<public_api_key>', 5011 }, 5012 body: JSON.stringify({ email, project_id }), 5013}); 5014const { token } = await res.json();`,F5e=`const res = await fetch('https://reqres.in/api/app-users/verify', { 5015 method: 'POST', 5016 headers: { 'Content-Type': 'application/json' }, 5017 body: JSON.stringify({ token }), 5018}); 5019const { data } = await res.json(); 5020localStorage.setItem('reqres_session_token', data.session_token);`,B5e=`const session = localStorage.getItem('reqres_session_token'); 5021const base = 'https://reqres.in/app/collections/${Ex}/records'; 5022 5023const list = await fetch(base, { headers: { Authorization: \`Bearer \${session}\` } }); 5024const { data } = await list.json(); 5025 5026await fetch(base, { 5027 method: 'POST', 5028 headers: { 5029 Authorization: \`Bearer \${session}\`, 5030 'Content-Type': 'application/json', 5031 }, 5032 body: JSON.stringify({ data: { title: 'Hello', body: 'Saved via session token' } }), 5033}); 5034 5035await fetch(\`\${base}/<note_id>\`, { 5036 method: 'DELETE', 5037 headers: { Authorization: \`Bearer \${session}\` }, 5038});`,q5e=`POST /api/app-users/login 5039- Content-Type: application/json 5040- x-api-key: <public_api_key> 5041 5042POST /api/app-users/verify 5043- Content-Type: application/json 5044 5045/app/collections/${Ex}/records 5046- Authorization: Bearer <session_token> 5047- Content-Type: application/json (for writes)`,z5e=`{ 5048 "title": "string", 5049 "body": "string", 5050 "created_at": "string" 5051}`,H5e={title:"string",body:"string",created_at:"string"},b2=ip;function I$(){const{getToken:e}=zt(),{user:t,isLoaded:s}=_r(),n=Wr(),[a,o]=x.useState(null),[i,l]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState(!0),[g,v]=x.useState(null),[y,_]=x.useState(null),[j,w]=x.useState(null),[k,S]=x.useState(!1),[E,T]=x.useState(!1),[A,R]=x.useState(Ex),[I,L]=x.useState(""),[M,O]=x.use
5051State(""),[z,X]=x.useState(""),[W,K]=x.useState(()=>localStorage.getItem(Wg)),[q,J]=x.useState(()=>localStorage.getItem(C0)),[F,V]=x.useState([]),[$,B]=x.useState(!1),[ae,H]=x.useState(null),[U,oe]=x.useState(!1),[fe,Q]=x.useState(null),le=x.useRef(null),Se=x.useRef(null),[we,Le]=x.useState(null),[xe,de]=x.useState(null),[Me,je]=x.useState(null),[Ae,Oe]=x.useState(null),[Ke,ut]=x.useState(""),[De,ct]=x.useState(""),[rt,mt]=x.useState(!1),[vt,gt]=x.useState(!1),[Be,ve]=x.useState(!1),be=!!(a!=null&&a.id&&i),nt=n.pathname===Ha,Ze=!!W,he=x.useMemo(()=>`${n.pathname}${n.search}`,[n.pathname,n.search]),ke=q||(Ze?"App user session":""),Ve=x.useCallback(()=>{try{const Ee=localStorage.getItem(E0);return Ee?JSON.parse(Ee):[]}catch{return[]}},[]);x.useEffect(()=>{if(!s)return;if(!t){h(!1),o(null),l(null);return}(async()=>{var He,ie;try{h(!0),v(null);const Ce=await Ue(e);if(!Ce){v("Sign in to load your project.");return}const Pe=(He=(await ue.get("/projects?limit=1",{authToken:Ce})).data.projects)==null?void 0:He[0];if(!Pe){v("Create a project to run the live example.");return}o(Pe),l(Pe.public_api_key||null),Pe.public_api_key||v("Add a Public API key to send magic links from this page.");try{const Ge=await ue.get(`/projects/${Pe.id}`,{authToken:Ce});Ge.data&&(o(Ge.data),Ge.data.public_api_key&&!Pe.public_api_key&&l(Ge.data.public_api_key))}catch(Ge){console.warn("Could not load full project details",Ge)}try{const Tt=(((ie=(await ue.get(`/data-explorer/collections?project_id=${Pe.id}`,{authToken:Ce})).data)==null?void 0:ie.data)||[]).some(ss=>(ss.slug||ss.name||"").toLowerCase()===A.toLowerCase());u(Tt)}catch{u(null)}}catch(Ce){console.error("Failed to load project context",Ce),v("Unable to load your project details right now.")}finally{h(!1)}})()},[A,e,s,t]),x.useEffect(()=>{vt||!s||(Z.track("notes_example_opened",{mode:be?"live":"demo",project_id:(a==null?void 0:a.id)??null,has_public_key:!!i}),gt(!0))},[vt,s,be,a,i]);const at=x.useCallback(async()=>{var Ee,He;try{S(!0),w(null),_("Creating a ReqRes project with keysâ¦");const ie=await Ue(e);if(!ie)return _(null),w("Sign in to create a project and run this live."),null;const Ce=`notes-${Math.random().toString(36).slice(2,7)}`,Ye=await ue.post("/projects",{name:"Notes app backend",slug:Ce},{authToken:ie}),Pe=Ye.data.project||((Ee=Ye.data.data)==null?void 0:Ee.project)||null,Nt=((He=(await ue.get("/projects?limit=1",{authToken:ie})).data.projects)==null?void 0:He[0])||null,Tt=Pe!=null&&Pe.api_key?Pe:Pe||Nt;return o(Tt),l((Tt==null?void 0:Tt.public_api_key)||null),u(null),_("Project ready. Next: add the notes collection."),Tt!=null&&Tt.id&&Z.track("project_created",{template_used:!0,creation_method:"template"}),Tt}catch(ie){return console.error("Failed to create project",ie),_(null),w(ie instanceof Error?ie.message:"Could not create project"),null}finally{S(!1)}},[e]),Pt=x.useCallback(async Ee=>{const He=Ee||a;if(!(He!=null&&He.id))return w("Create a project first to add a collection."),!1;if(!He.api_key)return w("Add a Private API key to this project to create collections."),!1;try{T(!0),w(null),_("Creating notes collectionâ¦");const ie=await Ue(e);return ie?(await ue.post("/api/collections",{name:"Notes",slug:A||Ex,project_id:He.id,visibility:"private",schema:
5051H5e},{authToken:ie,headers:{"x-api-key":He.api_key}}),u(!0),_("Notes collection created. Ready to run the flow."),Z.track("collection_created",{env:be?"prod":"dev"}),!0):(_(null),w("Sign in to add the notes collection."),!1)}catch(ie){console.error("Failed to create notes collection",ie),_(null);const Ce=ie instanceof Error&&(ie.message==="api_key_required"||ie.message.includes("api_key_required"))?"Add your Private API key to create the notes collection.":ie instanceof Error?ie.message:"Could not create notes collection";return w(Ce),!1}finally{T(!1)}},[A,e,a]),Ct=x.useCallback(async Ee=>{if(!Ee){V([]);return}if(!be){const He=Ve();V(He),H(null);return}try{B(!0),H(null);const He=await fetch(`${Gg}/app/collections/${A}/records`,{headers:{Authorization:`Bearer ${Ee}`}}),ie=await He.text(),Ce=ie?JSON.parse(ie):{};if(!He.ok)throw new Error(`[${He.status}] ${(Ce==null?void 0:Ce.error)||(Ce==null?void 0:Ce.message)||"Unable to load notes"}`);const Ye=Array.isArray(Ce.data)?Ce.data.map(Pe=>{var Ge;return{id:Pe.id||((Ge=crypto.randomUUID)==null?void 0:Ge.call(crypto))||String(Date.now()),...Pe.data||{}}}):[];V(Ye)}catch(He){console.error("Failed to fetch notes",He),H(He instanceof Error?He.message:"Could not load notes")}finally{B(!1)}},[A,Ve,be]);x.useEffect(()=>{if(!W){V(be?[]:Ve());return}Ct(W)},[Ct,Ve,be,W]);const St=x.useCallback(async()=>{w(null),_(null);const Ee=a||await at();Ee&&(!c&&!await Pt(Ee)||_("Notes backend created! Scroll down to try the live example."))},[Pt,at,c,a]),Xt=()=>{var Ee;le.current&&le.current.scrollIntoView({behavior:"smooth",block:"start"}),(Ee=Se.current)==null||Ee.focus()},It=async()=>{var Ee,He;if(!I.trim()){je("Enter an email to send a magic link.");return}if(je(null),Le(null),!be){const ie="demo-magic-token";X(ie),O(ie),Le("Demo mode: token generated. Paste below to verify.");return}if(!i||!(a!=null&&a.id)){je("Add a project with a Public API key to start login.");return}try{Le("Sending magic linkâ¦");const ie=await fetch(`${Gg}/api/app-users/login`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify({email:I.trim(),project_id:a.id})}),Ce=await ie.text(),Ye=Ce?JSON.parse(Ce):{};if(!ie.ok)throw new Error(`[${ie.status}] ${(Ye==null?void 0:Ye.error)||(Ye==null?void 0:Ye.message)||"Login failed"}`);const Pe=((Ee=Ye==null?void 0:Ye.data)==null?void 0:Ee.token)||((He=Ye==null?void 0:Ye.data)==null?void 0:He.magic_link_token)||(Ye==null?void 0:Ye.magic_link_token)||(Ye==null?void 0:Ye.token)||"";X(Pe),Z.track("app_user_invited",{env:be?"prod":"dev",invite_method:"magic_link"}),Pe?(O(Pe),Le("Magic link token ready. Paste below to verify.")):Le("Magic link sent. Paste the token once it arrives.")}catch(ie){console.error("Login failed",ie),je(ie instanceof Error?ie.message:"Could not send magic link"),Le(null)}},ee=async()=>{var Ee,He,ie;if(!M.trim()){Oe("Paste the magic link token to mint a session.");return}if(Oe(null),de(null),!be){const Ce="demo-session-token";localStorage.setItem(Wg,Ce),localStorage.setItem(C0,I||"[email protected]"),K(Ce),J(I||"[email protected]"),de("Demo session stored locally."),Ct(Ce),Z.track("session_token_verified",{env:"dev"});return}try{de("Verifying tokenâ¦");const Ce=await fetch(`${Gg}/api/app-users/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:M.trim()})}),Ye=await Ce.text(),Pe=Ye?JSON.parse(Ye):{};if(!Ce.ok)throw new Error(`[${Ce.status}] ${(Pe==null?void 0:Pe.error)||(Pe==null?void 0:Pe.message)||"Verify failed"}`);const Ge=((Ee=Pe==null?void 0:Pe.data)==null?void 0:Ee.session_token)||(Pe==null?void 0:Pe.session_token);if(!Ge)throw new Error("No session_token returned. Double-check the token.");const Nt=((ie=(He=Pe==null?void 0:Pe.data)==null?void 0:He.app_user)==null?void 0:ie.email)||I||q||"";localStorage.setItem(Wg,Ge),Nt&&localStorage.setItem(C0,Nt),K(Ge),J(Nt||null),de("Session token stored. Requests are now scoped to this user."),Ct(Ge),Z.track("session_token_verified",{env:be?"prod":"dev"})}catch(Ce){console.error("Verify failed",Ce),Oe(Ce instanceof Error?Ce.message:"Could not verify token"),de(null)}},We=async()=>{var Ee,He,ie,Ce;if(!Ke.trim()){H("Add a title for the note.");return}if(!W){H("Verify a session token first.");return}if(H(null),!be){const Ye=[{id:((Ee=crypto.randomUUID)==null?void 0:Ee.call(crypto))||String(Date.now()),title:Ke.trim(),body:De.trim(),created_at:new Date().toISOString()},...F];localStorage.setItem(E0,JSON.stringify(Ye)),V(Ye),ut(""),ct(""),Be||(Z.track("record_created",{env:"dev",write_mode:"app_user",payload_empty:!1}),ve(!0));return}try{oe(!0);const Ye=await fetch(`${Gg}/app/collections/${A}/records`,{method:"POST",headers:{Authorization:`Bearer ${W}`,"Content-Type":"application/json"},body:JSON.stringify({data:{title:Ke.trim(),body:De.trim(),created_at:new Date().toISOString()}})}),Pe=await Ye.text(),Ge=Pe?JSON.parse(Pe):{};if(!Ye.ok)throw new Error(`[${Ye.status}] ${(Ge==null?void 0:Ge.error)||(Ge==null?void 0:Ge.message)||"Save failed"}`);const Nt={id:((He=Ge==null?void 0:Ge.data)==null?void 0:He.id)||((ie=crypto.randomUUID)==null?void 0:ie.call(crypto))||String(Date.now()),...((Ce=Ge==null?void 0:Ge.data)==null?void 0:Ce.data)||{}};V(Tt=>[Nt,...Tt]),ut(""),ct(""),Be||(Z.track("record_created",{env:be?"prod":"dev",write_mode:"app_user",payload_empty:!1}),ve(!0))}catch(Ye){console.error("Create note failed",Ye),H(Ye instanceof Error?Ye.message:"Could not save note")}finally{oe(!1)}},wt=async Ee=>{if(H(null),!W){H("Verify a session token first.");return}if(!be){const He=F.filter(ie=>ie.id!==Ee);localStorage.setItem(E0,JSON.stringify(He)),V(He);return}try{Q(Ee);const He=await fetch(`${Gg}/app/collections/${A}/records/${Ee}`,{method:"DELETE",headers:{Authorization:`Bearer ${W}`}});if(!He.ok){const ie=await He.text();throw new Error(`[${He.status}] ${ie||"Delete failed"}`)}V(ie=>ie.filter(Ce=>Ce.id!==Ee))}catch(He){console.error("Delete note failed",He),H(He instanceof Error?He.message:"Could not delete note")}finally{Q(null)}},_t=()=>{Z.track("notes_example_logout",{live_mode:be}),localStorage.removeItem(Wg),localStorage.removeItem(C0),be||localStorage.removeItem(E0),K(null),J(null),X(""),O(""),
5051V(be?[]:Ve())};return r.jsx("div",{className:"px-4 py-6 md:px-6 lg:px-8",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-secondary)]",children:[r.jsx(cn,{className:"h-3 w-3"}),r.jsx("span",{children:"Examples"}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"/"}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:"Notes app backend"})]}),r.jsxs("section",{className:"rounded-3xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-lg sm:p-8 space-y-4",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-[var(--color-accent-blue)]",children:[r.jsx(rr,{className:"h-4 w-4 text-[var(--color-semantic-warning)]"}),"Notes app backend (ReqRes)"]}),r.jsx("h1",{className:"text-2xl font-semibold leading-snug text-[var(--color-fg-default)] sm:text-3xl",children:"Magic-link auth + per-user CRUD from fetch()"}),r.jsx("p",{className:"max-w-3xl text-sm text-[var(--color-fg-default)] sm:text-base",children:"Send a magic link with your Public API key, verify to mint a session token, then use that token to create, list, and delete notes scoped to that app user."}),r.jsx("p",{className:"text-xs text-[var(--color-semantic-success)] sm:text-sm",children:"This page is a real app, not a demo. Every request uses your project's keys and data."})]}),r.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[r.jsx(vd,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ht,{onClick:a&&c?void 0:St,loading:k||E,disabled:!!(a&&c),size:"lg",className:a&&c?"opacity-50 line-through cursor-default":"",children:a&&c?r.jsxs(r.Fragment,{children:[r.jsx(Or,{className:"h-4 w-4 mr-1.5"}),"Notes backend created"]}):a?"Add notes collection to project":"Create project + notes collection"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:a&&c?"Scroll down to try the live example.":a?"Adds a notes collection to your project.":"Creates a project with a notes collection."})]})}),r.jsx(Gi,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(b2,{mode:"modal",afterSignInUrl:he,afterSignUpUrl:he,children:r.jsx(ht,{size:"lg",children:"Sign up to run this example"})}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:"Create a free project, then we'll scaffold the notes backend here."})]})}),r.jsx(ht,{asChild:!0,variant:"secondary",size:"lg",children:r.jsx("a",{href:"/dashboard",children:"Open dashboard"})}),r.jsx(ht,{asChild:!0,variant:"ghost",size:"lg",children:r.jsx("a",{href:"/documentation?section=app-users",children:"View docs"})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success-bg)] px-3 py-1 text-[var(--color-semantic-success)]",children:[r.jsx(Qu,{className:"h-3.5 w-3.5"}),be?"Live with your project keys":"Demo mode (local-only until project exists)"]}),a&&r.jsxs("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-3 py-1 text-[var(--color-fg-default)]",children:["Project: ",a.name]}),c===!1&&r.jsxs("span",{className:"rounded-full border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] px-3 py-1 text-[var(--color-semantic-warning)]",children:["Add a ",r.jsx("code",{className:"font-mono text-[11px]",children:"notes"})," ","collection to see real records."]}),g&&r.jsx("span",{className:"text-[var(--color-semantic-warning)]",children:g}),f&&!g&&r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:"Loading your project keysâ¦"})]})]}),r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-lg shadow-[var(--color-shadow)] space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"Before you start"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Setup checklist"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:"Skip the 404: create a project + notes collection, then run the flow."})]}),r.jsxs("div",{className:"text-right text-xs text-[var(--color-fg-secondary)]",children:[y&&r.jsx("p",{className:"text-[var(--color-semantic-success)]",children:y}),j&&r.jsxs("p",{className:"flex items-center justify-end gap-1 text-[var(--color-semantic-warning)]",children:[r.jsx(lr,{className:"h-3.5 w-3.5"}),j]})]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--color-fg-default)]",children:[a!=null&&a.id?r.jsx(Or,{className:"h-4 w-4 text-[var(--color-semantic-success)]"}):r.jsx(lr,{className:"h-4 w-4 text-[var(--color-semantic-warning)]"}),r.jsx("span",{children:"Project"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:a!=null&&a.id?`Project: ${a.name}`:"No project yet. Create one to store keys and collections."})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 text-xs text-[var(--color-fg-secondary)]",children:[r.jsx(vd,{children:a!=null&&a.id?r.jsx("span",{className:"rounded-full border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success-bg)] px-2 py-1 text-[var(--color-semantic-success)]",children:"Ready"}):r.jsx(ht,{onClick:at,loading:k,size:"sm",children:"Create project now"})}),r.jsx(Gi,{children:r.jsx(b2,{mode:"modal",afterSignInUrl:he,afterSignUpUrl:he,children:r.jsx(ht,{size:"sm",children:"Sign in to create"})})})]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--color-fg-default)]",children:[c?r.jsx(Or,{className:"h-4 w-4 text-[var(--color-semantic-success)]"}):r.jsx(lr,{className:"h-4 w-4 text-[var(--color-semantic-warning)]"}),r.jsx("span",{children:"Notes collection"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:c?"notes collection exists - CRUD calls will succeed.":"Create a notes collection (needs your Private API key) to avoid the 404 on first fetch."})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs(vd,{children:[c?r.jsx(ht,{size:"sm",variant:"ghost",onClick:Xt,children:"Write first note"}):r.jsx(ht,{onClick:()=>Pt(),loading:E,size:"sm",variant:"secondary",children:"Create notes collection"}),!c&&(a==null?void 0:a.id)&&r.jsx("a",{className:"text-[11px] text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] underline",href:`/data-explorer?projectId=${a.id}&tab=collections`,children:"Or open Data Explorer"})]}),r.jsx(Gi,{children:r.jsx(b2,{mode:"modal",afterSignInUrl:he,afterSignUpUrl:he,children:r.jsx(ht,{size:"sm",variant:"secondary",children:"Sign in to add"})})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-[1.1fr,1.2fr]",children:[r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-lg shadow-[var(--color-shadow)] space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"1) Login + verify"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Send magic link, mint session"}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:["Uses Public API key for login, verify returns the session token. Session token is stored in localStorage (",r.jsx("code",{className:"font-mono text-[11px] text-[var(--color-fg-default)]",children:Wg}),")."]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-0.5",children:"Login: Public key (x-api-key)"}),r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-0.5",children:"Verify: no key â session_token"})]})]}),r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-1 text-[11px] text-[var(--color-fg-secondary)]",children:be?"Live":"Demo"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"block text-xs font-medium text-[var(--color-fg-secondary)]",children:["Email to send login link",r.jsx(Is,{value:
5051I,onChange:Ee=>L(Ee.target.value),placeholder:"[email protected]",className:"mt-1 bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-default)]"})]}),r.jsx(ht,{onClick:It,loading:we==="Sending magic linkâ¦",className:"w-full",children:be?"Send magic link":"Generate demo magic token"}),we&&r.jsx("p",{className:"text-xs text-[var(--color-semantic-success)]",children:we}),Me&&r.jsx("p",{className:"text-xs text-[var(--color-semantic-warning)]",children:Me})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"block text-xs font-medium text-[var(--color-fg-secondary)]",children:["Magic link token",r.jsx(Is,{value:M,onChange:Ee=>O(Ee.target.value),placeholder:"Paste magic_link_token",className:"mt-1 bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-default)]"})]}),z&&r.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"font-mono break-all",children:z}),r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-1 text-[11px] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-active)]",onClick:async()=>{try{await navigator.clipboard.writeText(z)}catch(Ee){console.error("Copy failed",Ee)}},children:[r.jsx(is,{className:"h-3 w-3"}),"Copy token"]})]}),r.jsx(ht,{onClick:ee,loading:xe==="Verifying tokenâ¦",variant:"secondary",className:"w-full",children:"Verify token â store session"}),xe&&r.jsx("p",{className:"text-xs text-[var(--color-semantic-success)]",children:xe}),Ae&&r.jsx("p",{className:"text-xs text-[var(--color-semantic-warning)]",children:Ae})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-semibold text-[var(--color-fg-default)]",children:"Session"}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(ht,{variant:"ghost",size:"sm",onClick:_t,iconLeft:r.jsx(bw,{className:"h-3.5 w-3.5"}),children:"Logout / reset"})})]}),W?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"rounded-full bg-[var(--color-semantic-success-bg)] px-2 py-1 text-[11px] text-[var(--color-semantic-success)]",children:"Session active"}),q&&r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-1 text-[11px] text-[var(--color-fg-default)]",children:q})]}),r.jsx("p",{className:"font-mono break-all text-[11px] text-[var(--color-fg-default)]",children:W})]}):r.jsx("p",{className:"text-[var(--color-fg-secondary)]",children:"Verify a token to mint a session."})]})]}),r.jsxs("section",{className:`rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-lg shadow-[var(--color-shadow)] space-y-4 ${Ze?"ring-2 ring-[var(--color-semantic-success)]/30":""}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"2) Your app (logged in as this user)"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Notes scoped to this session token"}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:["Reads and writes call"," ",r.jsxs("code",{className:"font-mono text-[11px]",children:["/app/collections/",A,"/records"]})," ","with"," ",r.jsx("code",{className:"font-mono text-[11px]",children:"Authorization: Bearer <session_token>"}),"."]})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1",children:[r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-1 text-[11px] text-[var(--color-fg-secondary)]",children:"UI only - fetch under the hood"}),Ze&&r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success-bg)] px-3 py-1 text-[11px] text-[var(--color-semantic-success)]",children:[r.jsx("span",{className:"grid h-6 w-6 place-items-center rounded-full bg-[var(--color-semantic-success-bg)] text-xs font-semibold text-[var(--color-semantic-success)]",children:ke.slice(0,1).toUpperCase()}),"Requests are scoped to ",ke||"this app user"]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[1.2fr,0.8fr]",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"font-semibold text-[var(--color-fg-default)]",children:"Collection slug"}),r.jsx(Is,{value:A,onChange:Ee=>R(Ee.target.value||Ex),className:"bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-default)]"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",ref:le,children:[r.jsxs("label",{className:"block text-xs font-medium text-[var(--color-fg-secondary)]",children:["Note title",r.jsx(Is,{value:Ke,onChange:Ee=>ut(Ee.target.value),ref:Se,placeholder:"Launch checklist",className:"mt-1 bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-default)]"})]}),r.jsxs("label",{className:"block text-xs font-medium text-[var(--color-fg-secondary)]",children:["Body (optional)",r.jsx("textarea",{value:De,onChange:Ee=>ct(Ee.target.value),rows:3,className:"mt-1 w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)]",placeholder:"What should this app user do next?"})]}),r.jsx(ht,{onClick:We,loading:U,className:"w-full",children:"Create note with session token"}),ae&&r.jsx("p",{className:"text-xs text-[var(--color-semantic-warning)]",children:ae})]})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-[var(--color-fg-default)]",children:["Notes (",F.length,")"]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:"Refresh page to prove persistence"})]}),$&&r.jsx("p",{className:"text-[var(--color-fg-secondary)]",children:"Loading notesâ¦"}),!$&&F.length===0&&r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"No notes yet. Create one with your session token."}),r.jsx("div",{className:"space-y-2",children:F.map(Ee=>r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] p-3 text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("div",{className:"font-semibold text-sm",children:Ee.title}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>wt(Ee.id),loading:fe===Ee.id,children:"Delete"})]}),Ee.body&&r.jsx("p",{className:"mt-1 text-sm text-[var(--color-fg-default)]",children:Ee.body}),Ee.created_at&&r.jsxs("p",{className:"mt-1 text-[11px] text-[var(--color-fg-secondary)]",children:["Created ",new Date(Ee.created_at).toLocaleStr
5051ing()]})]},Ee.id))})]})]})]})]}),r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 shadow-lg shadow-[var(--color-shadow)] space-y-5",children:[r.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:"How it works"}),r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Three calls, one session token"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Keep code hidden until you need it. Copy-ready examples use fetch() only."})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ht,{variant:"ghost",size:"sm",asChild:!0,iconLeft:r.jsx(bd,{className:"h-4 w-4"}),children:r.jsx("a",{href:"/documentation?section=app-users",children:"Docs"})}),r.jsx(ht,{variant:"secondary",size:"sm",onClick:()=>mt(Ee=>!Ee),children:rt?"Hide code":"Show code"})]})]}),r.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[{title:"Send magic link",copy:"POST /api/app-users/login with Public API key. Returns magic_link_token for this email."},{title:"Verify â session token",copy:"POST /api/app-users/verify (no key). Store session_token in localStorage."},{title:"CRUD with Bearer",copy:"GET/POST/DELETE /app/collections/notes/records with Authorization: Bearer <session_token>."}].map(Ee=>r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-default)]",children:[r.jsx(Or,{className:"h-4 w-4 text-[var(--color-semantic-success)]"}),r.jsx("span",{className:"text-sm font-semibold",children:Ee.title})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)]",children:Ee.copy})]},Ee.title))}),rt&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[r.jsx(Vt,{title:"1) Send magic link (Public key)",language:"javascript",code:U5e}),r.jsx(Vt,{title:"2) Verify token â session",language:"javascript",code:F5e}),r.jsx(Vt,{title:"3) Session-token CRUD",language:"javascript",code:B5e})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[r.jsx(Vt,{title:"Headers you need",language:"text",code:q5e}),r.jsx(Vt,{title:"Recommended schema",language:"json",code:z5e})]})]})]}),!nt&&r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ofe,{className:"h-4 w-4"}),r.jsx("span",{children:"Prefer to learn by example? This is the canonical Notes app flow."})]}),r.jsx(ht,{asChild:!0,variant:"primary",size:"sm",children:r.jsx("a",{href:Ha,children:"Open Notes example"})})]})]})})}const T0=ip,M$="https://reqres.in",y2="rr_playground_api_key_v1",V5e=500,G5e=new Set(["localhost","127.0.0.1","0.0.0.0"]),Bn="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-0",W5e="inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-secondary)] transition-colors hover:border-[var(--color-border-strong)] hover:text-[var(--color-fg-default)] disabled:cursor-not-allowed disabled:opacity-60",_2="inline-flex items-center justify-center px-3 py-2 text-xs font-medium text-[var(--color-fg-secondary)] transition-colors hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-fg-default)] disabled:opacity-60",j2=(e="",t="")=>({id:Math.random().toString(36).slice(2,10),key:e,value:t}),Y5e=e=>{const t=new URLSearchParams;return e.forEach(s=>{const n=s.key.trim();n&&t.append(n,s.value)}),t.toString()},K5e=()=>typeof window>"u"?M$:G5e.has(window.location.hostname)?"http://localhost:8000":M$,w2=e=>{const t=e.trim();if(!t)return"/api/users";if(/^https?:\/\//i.test(t))try{return new URL(t).pathname||"/api/users"}catch{return t}return t.startsWith("/")?t:`/${t}`},R0=e=>e==="POST"||e==="PUT"||e==="PATCH",N2=(e,t)=>
5051e?t?e:e.length<=8?"********":`${e.slice(0,4)}...${e.slice(-4)}`:"Not set",O$=e=>{const t=e.split("?")[0];return t.startsWith("/api/users")?"users":t.startsWith("/api/unknown")?"resources":t.startsWith("/api/register")?"register":t.startsWith("/api/login")?"login":t.startsWith("/api/")?"generic":"other"},L$=e=>e.replace(/[^\x00-\xFF]/g,""),J5e=(e,t,s,n,a)=>{const o={};return e&&(o["x-api-key"]=e),a&&s&&n.trim()&&(o["Content-Type"]=n.trim()),t.forEach(i=>{const l=L$(i.key.trim());if(!l)return;const c=l.toLowerCase();c==="x-api-key"||c==="content-type"||(o[l]=L$(i.value))}),o},X5e=e=>{const t=e.trim()||"products";return[{id:"read",label:"Read",presets:[{id:"list-users",label:"List users",method:"GET",path:"/api/users",queryParams:[["page","2"]]},{id:"single-user",label:"Single user",method:"GET",path:"/api/users/2"},{id:"list-resources",label:"List resources",method:"GET",path:"/api/unknown"},{id:"generic-resource",label:"Generic resource",method:"GET",path:`/api/${t}`,queryParams:[["page","1"]]}]},{id:"create-auth",label:"Create + Auth",presets:[{id:"register-success",label:"Register (success)",method:"POST",path:"/api/register",body:'{"email": "[email protected]", "password": "pistol"}'},{id:"login-success",label:"Login (success)",method:"POST",path:"/api/login",body:'{"email": "[email protected]", "password": "cityslicka"}'}]},{id:"update",label:"Update",presets:[{id:"update-user",label:"Update user",method:"PUT",path:"/api/users/2",body:'{"name": "morpheus", "job": "zion resident"}'}]},{id:"delete",label:"Delete",presets:[{id:"delete-user",label:"Delete user",method:"DELETE",path:"/api/users/2"}]}]},Q5e=e=>{const t=e.trim();if(!t)return{bodyText:"",bodyJson:null};try{const s=JSON.parse(t);return{bodyText:t,bodyJson:s}}catch{return{bodyText:t,bodyJson:null}}},Z5e=e=>{if(!e)return null;const t=Math.max(0,Date.now()-e);if(t<6e4)return"Verified just now";const s=Math.floor(t/6e4);return s<60?`Verified ${s}m ago`:`Verified ${Math.floor(s/60)}h ago`},eTe=e=>{if(!e)return"0 B";const t=typeof TextEncoder<"u"?new TextEncoder().encode(e).length:e.length;if(t<1024)return`${t} B`;const s=t/1024;return s<1024?`${s.toFixed(1)} KB`:`${(s/1024).toFixed(1)} MB`},k2=e=>e.replace(/'/g,"'\\''"),tTe=e=>{const t=[`curl -X ${e.method} '${k2(e.url)}'`];return Object.entries(e.headers).forEach(([s,n])=>{t.push(`-H '${k2(`${s}: ${n}`)}'`)}),e.bodyText&&t.push(`-d '${k2(e.bodyText)}'`),t.join(" ")},sTe=e=>{const t=[];return t.push(`method: '${e.method}'`),Object.keys(e.headers).length&&t.push(`headers: ${JSON.stringify(e.headers,null,2)}`),e.bodyText&&(e.bodyJson?t.push(`body: JSON.stringify(${JSON.stringify(e.bodyJson,null,2)})`):t.push(`body: ${JSON.stringify(e.bodyText)}`)),`await fetch(${JSON.stringify(e.url)}, { 5052 ${t.join(`, 5053 `)} 5054});`};function rTe(){Mn("API Playground");const[e]=Wa(),{user:t,isLoaded:s}=_r(),{getToken:n,isSignedIn:a}=zt(),{copyToClipboard:o,ClipboardToast:i}=hm(),l=x.useRef(null),c=x.useRef(null),u=x.useRef(null),[f,h]=x.useState(()=>{if(typeof window>"u")return"";try{return sessionStorage.getItem(y2)||""}catch{return""}}),[g,v]=x.useState(!1),[y,_]=x.useState(""),[j,w]=x.useState([]),[k,S]=x.useState(!1),[E,T]=x.useState(null),[A,R]=x.useState(!1),[I,L]=x.useState(null),[M,O]=x.useState(null),[z,X]=x.useState(()=>{const ye=e.get("path"),Qe=e.get("method");return{method:Qe&&["GET","POST","PUT","PATCH","DELETE"].includes(Qe.toUpperCase())?Qe.toUpperCase():"GET",path:ye?w2(ye):"/api/users",queryParams:[],headers:[],body:""}}),[W,K]=x.useState(!0),[q,J]=x.useState("application/json"),[F,V]=x.useState(null),[$,B]=x.useState(null),[ae,H]=x.useState(!1),[U,oe]=x.useState(null),[fe,Q]=x.useState(null),[le,Se]=x.useState(!1),[we,Le]=x.useState(!1),[xe,de]=x.useState(null),[Me,je]=x.useState(!1),[Ae,Oe]=x.useState(!1),[Ke,ut]=x.useState(!1),[De,ct]=x.useState(!1),[rt,mt]=x.useState("products"),[vt,gt]=x.useState(!0),[Be,ve]=x.useState(!1),[be,nt]=x.useState(!1),Ze=x.useRef(0),he=x.useRef(null);x.useEffect(()=>{const ye=e.get("path"),Qe=e.get("method");if(!ye&&!Qe)return;const ne=["GET","POST","PUT","PATCH","DELETE"];X(P=>({...P,...ye?{path:w2(ye)}:{},...Qe&&ne.includes(Qe.toUpperCase())?{method:Qe.toUpperCase()}:{}}))},[e]),x.useEffect(()=>{Z.track("playground_viewed")},[]),x.useEffect(()=>{if(typeof window>"u")return;const ye=window.matchMedia("(prefers-reduced-motion: reduce)"),Qe=()=>nt(ye.matches);return Qe(),typeof ye.addEventListener=="function"?(ye.addEventListener("change",Qe),()=>ye.removeEventListener("change",Qe)):(ye.addListener(Qe),()=>ye.removeListener(Qe))},[]),x.useEffect(()=>{if(!f.trim()){O(null);return}O(Date.now())},[f]),x.useEffect(()=>{if(!(typeof window>"u"))try{const ye=f.trim();ye?sessionStorage.setItem(y2,ye):sessionStorage.removeItem(y2)}catch{}},[f]),x.useEffect(()=>{if(!s||!t){w([]);return}let ye=!0;return(async()=>{var ne;S(!0),T(null);try{const P=await Ue(n);if(!P){ye&&T("Sign in to load API keys.");return}const te=await ue.get("/api-keys",{authToken:P}),me=Array.isArray(te.data)?te.data:((ne=te.data)==null?void 0:ne.data)||[];ye&&w(me)}catch{ye&&T("Unable to load API keys right now.")}finally{ye&&S(!1)}})(),()=>{ye=!1}},[n,s,t]),x.useEffect(()=>{if(!R0(z.method)){V(null);return}if(!z.body.trim()){V(null);return}try{JSON.parse(z.body),V(null)}catch(ye){const Qe=ye instanceof Error?ye.message:"Invalid JSON body.";V(Qe)}},[z.body,z.method]);const ke=x.useMemo(()=>j.filter(ye=>ye.project_id==null),[j]),Ve=x.useMemo(()=>ke.filter(ye=>ye.is_active!==!1),[ke]),at=x.useMemo(()=>Ve.find(Qe=>Qe.permissions==="read_only")||Ve[0]||null,[Ve]),Pt=x.useMemo(()=>f.trim().length>0,[f]),Ct=x.useMemo(()=>ke.some(ye=>ye.is_active===!1),[ke]);x.useEffect(()=>{f.trim()||at&&(h(at.api_key),_(String(at.id)))},[at]),x.useEffect(()=>{const ye=f.trim();if(!ye){y&&_("");return}if(y)return;const Qe=Ve.find(ne=>ne.api_key===ye);Qe&&_(String(Qe.id))},[Ve,f,y]);const St=x.useMemo(()=>{var ye;return t?((ye=t.primaryEmailAddress)==null?void 0:ye.emailAddress)||t.username||t.firstName||"Signed in":"Signed out"},[t]),Xt=x.useMemo(()=>Y5e(z.queryParams),[z.queryParams]),It=x.useMemo(()=>w2(z.path),[z.path]),ee=x.useMemo(()=>K5e(),[]),We=x.useMemo(()=>{const ye=Xt?`?${Xt}`:"";return`${ee}${It}${ye}`},[It,Xt,ee]),wt=x.useMemo(()=>X5e(rt),[rt]),_t=x.useMemo(()=>U?U.status>=200&&U.status<300?"success":U.status>=400&&U.status<500?"warning":U.status>=500?"destructive":U.status>=300?"info":"secondary":"secondary",[U]),Ee=x.useMemo(()=>U?U.isJson&&U.bodyJson!==null?JSON.stringify(U.bodyJson,null,2):U.bodyText||"":"",[U]),He=x.useMemo(()=>{var ye;return(ye=U==null?void 0:U.headers)!=null&&ye.length?U.headers.map(([Qe,ne])=>`${Qe}: ${ne}`).join(` 5055`):""},[U]),ie=x.useMemo(()=>
5055Z5e(M),[M]),Ce=x.useMemo(()=>z.queryParams.length,[z.queryParams.length]),Ye=x.useMemo(()=>z.headers.filter(ye=>ye.key.trim()).length,[z.headers]),Pe=x.useMemo(()=>U?eTe(U.bodyText||""):null,[U]),Ge=x.useMemo(()=>U!=null&&U.endedAt?new Date(U.endedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):null,[U]),Nt=!!(U&&(U.status>=400||U.status===0)),Tt=!!(U&&U.isJson&&U.bodyJson!==null),ss=x.useMemo(()=>U?U.status===401||U.status===403?"Check your x-api-key. Need a free key? Generate one above.":U.status===429?"Rate limited. Slow down or upgrade for higher limits.":!U.isJson&&U.bodyText?"This endpoint returned non-JSON. The classic API returns JSON for standard routes.":null:null,[U]),Zt=ye=>{const Qe=(ye.queryParams||[]).map(([ne,P])=>j2(ne,P));X(ne=>({...ne,method:ye.method,path:ye.path,queryParams:Qe,body:ye.body||""})),de(ye.id),je(Qe.length>0)},re=()=>{X(ye=>({...ye,queryParams:[...ye.queryParams,j2()]})),je(!0)},G=()=>{X(ye=>({...ye,headers:[...ye.headers,j2()]})),Oe(!0)},ge=()=>{if(z.body.trim())try{const ye=JSON.parse(z.body);X(Qe=>({...Qe,body:JSON.stringify(ye,null,2)})),V(null)}catch(ye){const Qe=ye instanceof Error?ye.message:"Invalid JSON body.";V(Qe)}},ze=()=>{var ye,Qe;(ye=l.current)==null||ye.focus(),(Qe=l.current)==null||Qe.select()},Gt=()=>{at&&(h(at.api_key),_(String(at.id)),B(null))},es=async()=>{var ye;if(!(!t||A)){if(at){h(at.api_key),_(String(at.id));return}L(null),R(!0);try{const Qe=await Ue(n);if(!Qe){L("Sign in to generate a free key.");return}const P=(ye=(await ue.post("/api-keys",{keyName:"API Playground key",permissions:"read_only"},{authToken:Qe})).data)==null?void 0:ye.apiKey;P!=null&&P.api_key?(w(te=>[P,...te]),h(P.api_key),P.id&&_(String(P.id))):L("Key created but unavailable. Open API keys to view it.")}catch{L("Unable to create a free key right now.")}finally{R(!1)}}},ls=()=>
5055{if(at){Gt();return}es()},pr=async()=>{if(le)return;B(null),H(!1);const ye=f.trim();if(F){B("Fix the JSON body before sending.");return}if(!ye){B(a?"Add an API key above to send requests.":"Sign in or paste a key to send requests.");return}const Qe=Date.now();if(Qe-Ze.current<V5e){B("Please wait a moment before sending again.");return}Ze.current=Qe;const ne=O$(It);Z.track("playground_request_sent",{method:z.method,endpoint_category:ne}),Se(!0);const P=Date.now(),te=performance.now(),me=R0(z.method),Te=J5e(ye,z.headers,W,q,me),st=me?Q5e(z.body):null,xt=me&&(st==null?void 0:st.bodyText)||"";Q({method:z.method,url:We,path:It,queryParams:z.queryParams,headers:Te,bodyText:xt||void 0,bodyJson:(st==null?void 0:st.bodyJson)||void 0});try{const Et=await fetch(We,{method:z.method,headers:Te,body:xt||void 0}),rs=Math.round(performance.now()-te),Rt=Date.now(),xs=await Et.text();let jt=null,qs=!1;if(xs)try{jt=JSON.parse(xs),qs=!0}catch{jt=null}const Xr={status:Et.status,statusText:Et.statusText||"Response received",headers:Array.from(Et.headers.entries()),bodyText:xs,bodyJson:jt,durationMs:rs,startedAt:P,endedAt:Rt,isJson:qs};oe(Xr),setTimeout(()=>{var pn;(pn=he.current)==null||pn.scrollIntoView({behavior:"smooth",block:"start"})},50),Et.status>=200&&Et.status<300?(Le(!0),O(Date.now()),Z.track("playground_request_succeeded",{method:z.method,endpoint_category:ne,status_code:Et.status,status_group:"2xx",path:It,has_api_key:!!ye})):(Z.track("playground_request_failed",{method:z.method,endpoint_category:ne,status_code:Et.status,status_group:`${Math.floor(Et.status/100)}xx`,path:It,has_api_key:!!ye,api_key_included_in_request:!!Te["x-api-key"],error_message:Et.statusText||void 0}),Et.status===401||Et.status===403?B("Authentication failed - check that your API key is valid and has the right permissions."):Et.status===404?B("Endpoint not found - check the path is correct."):Et.status>=500&&B(`Server error (${Et.status}). Try again in a moment.`))}catch(Et){const rs=Math.round(performance.now()-te),Rt=Date.now(),xs=Et instanceof Error?Et.message:"Unknown network error";oe({status:0,statusText:"Network error",headers:[],bodyText:"",bodyJson:null,durationMs:rs,startedAt:P,endedAt:Rt,isJson:!1}),setTimeout(()=>{var qs;(qs=he.current)==null||qs.scrollIntoView({behavior:"smooth",block:"start"})},50),Z.track("playground_request_failed",{method:z.method,endpoint_category:ne,status_code:0,status_group:"network",path:It,has_api_key:!!ye,api_key_included_in_request:!!Te["x-api-key"],error_message:xs}),(Et instanceof TypeError||/failed to fetch|networkerror/i.test(xs))&&a?(H(!0),B("Couldn't reach the API - this is usually an ad blocker or browser extension blocking the request. Retry via our proxy to work around it.")):B("Network error - the request could not reach the server. Check your connection and that the endpoint URL is correct.")}finally{Se(!1)}},et=async()=>{if(le)return;const ye=fe;if(!ye){B("Nothing to retry yet. Send a request first.");return}if(!a){B("Sign in to retry via our proxy.");return}const Qe=O$(ye.path);B(null),H(!1),Se(!0);const ne=Date.now(),P=performance.now();try{const te=await Ue(n);if(!te){B("Sign in to retry via our proxy."),Se(!1);return}const me=await ue.post("/playground-proxy",{method:ye.method,url:ye.url,headers:ye.headers,body:ye.bodyText||null},{authToken:te}),Te=Math.round(performance.now()-P),st=Date.now(),xt=me.data,Et=(xt==null?void 0:xt.body)??"";let rs=null,Rt=!1;if(Et)try{rs=JSON.parse(Et),Rt=!0}catch{rs=null}oe({status:(xt==null?void 0:xt.status)??0,statusText:(xt==null?void 0:xt.statusText)||"Response received",headers:(xt==null?void 0:xt.headers)??[],bodyText:Et,bodyJson:rs,durationMs:Te,startedAt:ne,endedAt:st,isJson:Rt}),setTimeout(()=>{var qs;(qs=he.current)==null||qs.scrollIntoView({behavior:"smooth",block:"start"})},50);const xs=(xt==null?void 0:xt.status)??0,jt=xs>=100?`${Math.floor(xs/100)}xx`:"network";Z.track("playground_request_proxied",{method:ye.method,endpoint_category:Qe,status_code:xs,status_group:jt,path:ye.path,trigger:"manual_retry_after_block"}),xs>=200&&xs<300&&Le(!0)}catch(te){const me=te instanceof Error?te.message:"Proxy request failed";B(`Retrying via proxy failed (${me}). If this keeps happening, copy the curl command and run it locally.`),Z.track("playground_request_failed",{method:ye.method,endpoint_category:Qe,status_code:0,status_group:"proxy_error",path:ye.path,has_api_key:!!(ye.headers||{})["x-api-key"],api_key_included_in_request:!!(ye.headers||{})["x-api-key"],error_message:me})}finally{Se(!1)}};return x.useEffect(()=>{const ye=Qe=>{var te;if(!(Qe.metaKey||Qe.ctrlKey))return;const P=Qe.key.toLowerCase();if(P==="k"){Qe.preventDefault(),(te=c.current)==null||te.focus();return}if(P==="enter"){if(!u.current)return;const me=document.activeElement;me&&u.current.contains(me)&&(Qe.preventDefault(),pr())}};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[pr]),r.jsxs("div",{className:"px-4 py-6 md:px-6 lg:px-8",children:[r.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6",children:[r.jsxs(Ht,{className:"surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 md:p-8 space-y-3",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-[var(--color-fg-muted)]",children:"Classic endpoints"}),r.jsx("h1",{className:"text-2xl md:text-3xl font-semibold text-[var(--color-fg-default)]",children:"API Playground"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-3xl",children:"Practice GET/POST/PUT/DELETE against ReqRes classic endpoints - right from your browser."}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] max-w-3xl",children:"Requires an API key (free) to keep the public API stable and abuse-resistant."})]}),r.jsx(Gi,{children:r.jsx(Ht,{className:"surface-card elevation-1 border border-indigo-500/20 bg-gradient-to-br from-indigo-500/[0.08] via-[#0F1118] to-[#0F1118] p-5 md:p-6",children:r.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-2 max-w-xl",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-emerald-400/30 bg-emerald-500/10 px-2.5 py-0.5 text-[11px] font-medium text-emerald-200",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"}),"Free tier available"]})}),r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Sign in to unlock the full playground"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] leading-relaxed",children:"Get a free API key instantly, save your keys across sessions, and send requests to the classic ReqRes endpoints. No credit card required."}),r.jsxs("ul",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-indigo-400",children:"â"})," Free API key"]}),r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-indigo-400",children:"â"})," Saved keys"]}),r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-indigo-400",children:"â"})," Request history"]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(T0,{mode:"modal",afterSignInUrl:"/playground",afterSignUpUrl:"/playground",children:r.jsx(ht,{variant:"primary",size:"md",className:"h-10",children:"Sign in to get started"})}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)] text-center sm:text-left",children:"or paste a key below"})]})]})})}),r.jsx("div",{children:r.jsx(Ht,{className:"surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 md:p-5",children:r.jsx("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Auth bar"}),Pt?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-emerald-400/30 bg-emerald-500/10 px-3 py-1 text-[11px] font-medium text-emerald-100",children:[r.jsx("span",{className:`h-1.5 w-1.5 rounded-full bg-emerald-400 ${be?"":"animate-pulse"}`,"aria-hidden":"true"}),r.jsx("span",{children:"Key loaded"})]}),ie&&r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]/45",children:ie})]}):r.jsx(ui,{variant:"secondary",children:"No key"})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Is,{ref:l,type:g?"text":"password",value:f,onChange:ye=>{h(ye.target.value),y&&_("")},"aria-label":"API key",placeholder:"free_user_xxxxx",className:"pr-12",disabled:le}),r.jsx("button",{type:"button",onClick:()=>v(ye=>!ye),className:`absolute right-2 top-1/2 -translate-y-1/2 p-2 ${W5e} ${Bn}`,"aria-label":g?"Hide API key":"Show API key",title:g?"Hide API key":"Show API key",disabled:le,children:g?r.jsx(bh,{className:"h-4 w-4"}):r.jsx(za,{className:"h-4 w-4"})})]}),Pt?null:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Gi,{children:r.jsx(T0,{mode:"modal",afterSignInUrl:"/playground",afterSignUpUrl:"/playground",children:r.jsx(ht,{variant:"primary",size:"md",className:"h-9",disabled:le,children:"Use free key"})})}),r.jsx(vd,{children:r.jsx(ht,{variant:"primary",size:"md",className:"h-9",onClick:ls,loading:A,disabled:le,children:"Use free key"})}),r.jsx(ht,{variant:"secondary",size:"md",className:"h-9",onClick:ze,disabled:le,children:"Paste key"})]})]}),Ve.length>0&&r.jsxs("div",{className:"flex flex-col gap-1 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"Saved keys"}),r.jsxs(xi,{value:y||"__none__",onValueChange:ye=>{const Qe=ye==="__none__"?"":ye;if(_(Qe),!Qe){h("");return}const ne=Ve.find(P=>String(P.id)===Qe);ne&&(h(ne.api_key),B(null))},disabled:le,children:[r.jsx(Wo,{className:"rounded-md border border-[var(--color-border-default)]/80 bg-[var(--color-bg-alt)]/80 px-3 py-2 text-xs text-[var(--color-fg-default)] h-auto",children:r.jsx(vi,{placeholder:"Select a key"})}),r.jsxs(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:[r.jsx(yr,{value:"__none__",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"Select a key"}),Ve.map(ye=>r.jsxs(yr,{value:String(ye.id),className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:[(ye.key_name||"Classic key").slice(0,32)," · ",N2(ye.api_key,!1)]},ye.id))]})]})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]/45",children:"Stored in session only."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:St}),k&&r.jsx("span",{children:"Loading keys..."}),E&&r.jsx("span",{className:"text-amber-300",children:E}),I&&r.jsx("span",{className:"text-amber-300",children:I}),a&&!k&&Ve.length===0&&Ct&&r.jsx("span",{className:"text-amber-300",children:"Your classic key is inactive. Regenerate it in API Keys."})]})]})})})}),r.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[r.jsxs(Ht,{ref:u,className:"surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 md:p-6 space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Request builder"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Pick a preset or craft a request from scratch."})]}),r.jsx(ui,{variant:"outline",children:"Classic API"})]}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"w-full sm:w-28 shrink-0",children:[r.jsx("label",{className:"sr-only",htmlFor:"playground-method",children:"Method"}),r.jsxs(xi,{value:z.method,onValueChange:ye=>X(Qe=>({...Qe,method:ye})),disabled:le,children:[r.jsx(Wo,{className:"h-10 w-full rounded-lg border border-[var(--color-border-default)]/80 bg-[var(--color-bg-alt)]/80 px-3 text-sm font-medium text-[var(--color-fg-default)]",children:r.jsx(vi,{})}),r.jsxs(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:[r.jsx(yr,{value:"GET",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"GET"}),r.jsx(yr,{value:"POST",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"POST"}),r.jsx(yr,{value:"PUT",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"PUT"}),r.jsx(yr,{value:"PATCH",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"PATCH"}),r.jsx(yr,{value:"DELETE",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"DELETE"})]})]})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"sr-only",htmlFor:"playground-path",children:"Path"}),r.jsx(Is,{id:"playground-path",ref:c,value:z.path,onChange:ye=>X(Qe=>({...Qe,path:ye.target.value})),placeholder:"/api/users",className:"h-10",disabled:le})]}),r.jsx(ht,{size:"md",onClick:pr,loading:le,disabled:le||!!F,className:"h-10 w-full sm:w-36 shrink-0",children:"Send request"})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)] font-mono truncate",title:We,children:We}),$&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("p",{className:"text-xs text-amber-300",children:$}),ae&&r.jsx("button",{type:"button",onClick:et,disabled:le,className:"inline-flex items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 py-1 text-[11px] font-semibold text-[var(--color-fg-default)] hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)] transition disabled:opacity-50",children:"Retry via proxy â"})]}),!Pt&&r.jsx(vd,{children:r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:'Add a key above to send requests - click "Use free key" to get started.'})}),!Pt&&r.jsx(Gi,{children:r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx(T0,{mode:"modal",afterSignInUrl:"/playground",afterSignUpUrl:"/playground",children:r.jsx("button",{className:"text-indigo-400 hover:text-indigo-300 underline underline-offset-2",children:"Sign in"})})," ","for a free API key, or paste an existing key above."]})})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Presets"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:[z.method," ",It]})]}),r.jsx("div",{className:"space-y-3",children:wt.map(ye=>r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"text-[11px] uppercase tracking-[0.2em] text-[var(--color-fg-muted)]",children:ye.label}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[ye.presets.map(Qe=>r.jsx("button",{type:"button",onClick:()=>Zt(Qe),disabled:le,"aria-pressed":xe===Qe.id,className:`rounded-lg border px-3 py-1.5 text-xs transition ${Bn} ${xe===Qe.id?"border-indigo-400/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_18px_r
5055gba(99,102,241,0.25)]":"border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-secondary)] hover:border-[var(--color-border-strong)] hover:bg-[var(--color-bg-hover)]"} disabled:cursor-not-allowed disabled:opacity-60`,children:Qe.label},Qe.id)),ye.id==="read"&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:"/api/"}),r.jsx("input",{value:rt,onChange:Qe=>mt(Qe.target.value||""),"aria-label":"Generic resource",disabled:le,className:`w-24 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 py-1 text-xs text-[var(--color-fg-default)] ${Bn}`,placeholder:"products"})]})]})]},ye.id))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",onClick:()=>je(ye=>!ye),"aria-expanded":Me,disabled:le,className:`flex w-full items-center gap-3 px-4 text-left ${Bn} ${Me?"py-3":"py-2"} disabled:cursor-not-allowed disabled:opacity-60`,children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Query params"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Add key/value pairs to build query strings."})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[!Me&&r.jsxs("span",{children:[Ce," param",Ce===1?"":"s"]}),Me?r.jsx(cd,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}):r.jsx(sr,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]})]}),Me&&r.jsxs("div",{className:"space-y-3 border-t border-[var(--color-border-default)] px-4 pb-4 pt-3",children:[z.queryParams.map(ye=>r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-2",children:[r.jsx(Is,{value:ye.key,disabled:le,onChange:Qe=>X(ne=>({...ne,queryParams:ne.queryParams.map(P=>P.id===ye.id?{...P,key:Qe.target.value}:P)})),placeholder:"page"}),r.jsx(Is,{value:ye.value,disabled:le,onChange:Qe=>X(ne=>({...ne,queryParams:ne.queryParams.map(P=>P.id===ye.id?{...P,value:Qe.target.value}:P)})),placeholder:"2"}),r.jsx("button",{type:"button",onClick:()=>X(Qe=>({...Qe,queryParams:Qe.queryParams.filter(ne=>ne.id!==ye.id)})),disabled:le,"aria-label":"Remove query param",className:`rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 text-xs text-[var(--color-fg-secondary)] ${Bn} disabled:cursor-not-allowed disabled:opacity-60`,children:"Remove"})]},ye.id)),r.jsx(ht,{variant:"secondary",size:"sm",onClick:re,iconLeft:r.jsx(ca,{className:"h-3.5 w-3.5"}),disabled:le,children:"Add param"})]})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",onClick:()=>Oe(ye=>!ye),"aria-expanded":Ae,disabled:le,className:`flex w-full items-center gap-3 px-4 text-left ${Bn} ${Ae?"py-3":"py-2"} disabled:cursor-not-allowed disabled:opacity-60`,children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Headers"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"x-api-key auto-injected"})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[!Ae&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"x-api-key injected"}),r.jsx("span",{children:"â¢"}),r.jsxs("span",{children:[Ye," custom"]})]}),Ae?r.jsx(cd,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}):r.jsx(sr,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]})]}),Ae&&r.jsxs("div",{className:"space-y-3 border-t border-[var(--color-border-default)] px-4 pb-4 pt-3",children:[r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-2",children:[r.jsx(Is,{value:"x-api-key",readOnly:!0}),r.jsx(Is,{value:N2(f.trim(),g),readOnly:!0,className:"font-mono"}),r.jsx("span",{className:"self-center text-[11px] text-[var(--color-fg-muted)]",children:"Auto"})]}),R0(z.method)&&r.jsxs("div",{className:"grid grid-cols-[auto_1fr_1fr] items-center gap-2",children:[r.jsx("input",{type:"checkbox",checked:W,onChange:()=>K(ye=>!ye),disabled:le,"aria-label":"Toggle Content-Type header",className:`h-4 w-4 roun
5055ded border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-indigo-500 ${Bn}`}),r.jsx(Is,{value:"Content-Type",readOnly:!0}),r.jsx(Is,{value:q,onChange:ye=>J(ye.target.value),disabled:!W||le})]}),z.headers.map(ye=>r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-2",children:[r.jsx(Is,{value:ye.key,disabled:le,onChange:Qe=>X(ne=>({...ne,headers:ne.headers.map(P=>P.id===ye.id?{...P,key:Qe.target.value}:P)})),placeholder:"Header"}),r.jsx(Is,{value:ye.value,disabled:le,onChange:Qe=>X(ne=>({...ne,headers:ne.headers.map(P=>P.id===ye.id?{...P,value:Qe.target.value}:P)})),placeholder:"Value"}),r.jsx("button",{type:"button",onClick:()=>X(Qe=>({...Qe,headers:Qe.headers.filter(ne=>ne.id!==ye.id)})),disabled:le,"aria-label":"Remove header",className:`rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 text-xs text-[var(--color-fg-secondary)] ${Bn} disabled:cursor-not-allowed disabled:opacity-60`,children:"Remove"})]},ye.id)),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ht,{variant:"secondary",size:"sm",onClick:G,iconLeft:r.jsx(ca,{className:"h-3.5 w-3.5"}),disabled:le,children:"Add header"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Don't paste secrets."})]})]})]}),R0(z.method)&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:"JSON body"}),r.jsx("button",{type:"button",onClick:ge,disabled:le,className:`rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-3 py-1.5 text-xs text-[var(--color-fg-secondary)] ${Bn} disabled:cursor-not-allowed disabled:opacity-60`,children:"Prettify"})]}),r.jsx("textarea",{value:z.body,onChange:ye=>X(Qe=>({...Qe,body:ye.target.value})),rows:8,placeholder:'{"name": "morpheus"}',disabled:le,className:`${Fd.dark} font-mono text-xs leading-relaxed`,spellCheck:!1}),F&&r.jsx("p",{className:"text-xs text-amber-300",children:F})]})]}),r.jsxs(Ht,{ref:he,className:"surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 md:p-6 space-y-6 lg:sticky lg:top-20 lg:self-start lg:max-h-[calc(100vh-6rem)] lg:overflow-y-auto scroll-mt-20",children:[r.jsx("div",{className:"flex items-start justify-between gap-4",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Response viewer"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Inspect status, headers, and payload."})]})}),!U&&!le&&r.jsxs("div",{className:"rounded-xl border border-dashed border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-6 text-center",children:[r.jsx(vd,{children:r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Send a request to see status, headers, and JSON."})}),r.jsx(Gi,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Sign in to send requests and see live responses"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"You'll get a free API key instantly - no credit card required"}),r.jsx(T0,{mode:"modal",afterSignInUrl:"/playground",afterSignUpUrl:"/playground",children:r.jsx(ht,{variant:"secondary",size:"sm",children:"Sign in to try it"})})]})})]}),le&&!U&&r.jsx("div",{className:`rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 ${be?"":"animate-pulse"}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"h-3 w-1/3 rounded-full bg-[var(--color-border-default)]"}),r.jsx("div",{className:"h-3 w-10/12 rounded-full bg-[var(--color-border-default)]"}),r.jsx("div",{className:"h-3 w-7/12 rounded-full bg-[var(--color-border-default)]"})]})}),U&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[fe&&r.jsx(ui,{variant:"outline",className:"font-mono",children:fe.method}),r.jsx(ui,{variant:_t,children:U.status||"No status"}),U.statusText&&r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:U.statusText}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"â¢"}),r.jsxs("span",{children:["Latency ",U.durationMs," ms"]}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"â¢"}),r.jsxs("span",{children:["Size ",Pe]}),Ge&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"â¢"}),r.jsxs("span",{children:["At ",Ge]}
5055)]})]}),Nt&&r.jsx("div",{className:"rounded-xl border border-rose-400/30 bg-rose-500/10 px-4 py-3 text-xs text-rose-100",children:r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("p",{className:"font-semibold",children:["Error ",U.status||"Network"]}),r.jsx("p",{className:"text-rose-200/80",children:ss||(U.status===0?"Network error. Check your connection and try again.":"Request failed. Check the details and try again.")})]}),r.jsx("button",{type:"button",onClick:()=>{o(JSON.stringify({status:U.status,statusText:U.statusText,body:U.bodyText},null,2),"Error details copied"),Z.track("playground_copied",{type:"error_details"})},className:`rounded-md border border-rose-300/30 bg-rose-500/10 px-2.5 py-1 text-[11px] text-rose-100 transition hover:bg-rose-500/20 ${Bn}`,children:"Copy error details"})]})}),!Nt&&ss&&r.jsx("div",{className:"rounded-xl border border-amber-400/30 bg-amber-500/10 px-4 py-3 text-xs text-amber-200",children:ss}),fe&&r.jsxs("div",{className:"inline-flex overflow-hidden rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-xs",children:[r.jsx("button",{type:"button",onClick:()=>{o(tTe(fe),"cURL snippet copied"),Z.track("playground_copied",{type:"curl"})},className:`h-9 border-r border-[var(--color-border-default)] px-3 ${_2} ${Bn}`,children:"Copy cURL"}),r.jsx("button",{type:"button",onClick:()=>{o(sTe(fe),"Fetch snippet copied"),Z.track("playground_copied",{type:"fetch"})},className:`h-9 border-r border-[var(--color-border-default)] px-3 ${_2} ${Bn}`,children:"Copy fetch"}),r.jsx("button",{type:"button",onClick:()=>{Tt&&(o(JSON.stringify(U.bodyJson,null,2),"Response JSON copied"),Z.track("playground_copied",{type:"json"}))},disabled:!Tt,className:`h-9 px-3 ${_2} ${Bn} disabled:cursor-not-allowed disabled:text-[var(--color-fg-muted)]`,children:"Copy JSON"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Response body"}),r.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("button",{type:"button",onClick:()=>gt(ye=>!ye),"aria-pressed":vt,"aria-label":"Toggle response wrapping",className:`rounded-md border px-2 py-1 transition ${Bn} ${vt?"border-indigo-400/50 bg-indigo-500/15 text-indigo-100":"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,children:"Wrap"}),r.jsx("button",{type:"button",onClick:()=>ve(ye=>!ye),"aria-pressed":Be,"aria-label":"Toggle response expansion",className:`rounded-md border px-2 py-1 transition ${Bn} ${Be?"border-indigo-400/50 bg-indigo-500/15 text-indigo-100":"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,children:"Expand"})]})]}),le?r.jsx("div",{className:`rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 ${be?"":"animate-pulse"}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"h-3 w-1/2 rounded-full bg-[var(--color-border-default)]"}),r.jsx("div",{className:"h-3 w-11/12 rounded-full bg-[var(--color-border-default)]"}),r.jsx("div",{className:"h-3 w-8/12 rounded-full bg-[var(--color-border-default)]"})]})}):r.jsx(Hu,{code:Ee||"No response body",language:U.isJson?"json":"text",showCopyButton:!1,className:`border-[var(--color-border-default)] bg-[var(--color-bg-code)] ${vt?"[&_.code-sample__body_pre]:whitespace-pre-wrap":"[&_.code-sample__body_pre]:whitespace-pre"} ${Be?"[&_.code-sample__body_pre]:max-h-[520px]":"[&_.code-sample__body_pre]:max-h-[320px]"} [&_.code-sample__body_pre]:overflow-auto [&_.code-sample__body_pre]:text-[12.5px] [&_.code-sample__body_pre]:leading-relaxed [&_.code-sample__body_pre]:p-4`})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",onClick:()=>ut(ye=>!ye),"aria-expanded":Ke,className:`flex w-full items-center justify-between px-4 text-left ${Bn} ${Ke?"py-3":"py-2"}`,children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Response headers"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:U.headers.length?`${U.headers.length} header(s)`:"Collapsed by default"})]}),Ke?r.jsx(cd,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}):r.jsx(sr,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]}),Ke&&r.jsx("div",{className:"border-t border-[var(--color-border-default)] px-4 pb-4 pt-3",children:r.jsx(Hu,{code:He||"No headers",language:"text",showCopyButton:!1,className:"[&_.code-sample__body_pre]:max-h-[240px] [&_.code-sample__body_pre]:overflow-auto [&_.code-sample__body_pre]:text-[12px] [&_.code-sample__body_pre]:leading-relaxed [&_.code-sample__body_pre]:p-3"})})]}),fe&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",onClick:()=>ct(ye=>!ye),"aria-expanded":De,className:`flex w-full items-center justify-between px-4 text-left ${Bn} ${De?"py-3":"py-2"}`,children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Request details"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"URL, headers, and body snapshot"})]}),De?r.jsx(cd,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}):r.jsx(sr,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]}),De&&r.jsxs("div",{className:"space-y-3 border-t border-[var(--color-border-default)] px-4 pb-4 pt-3 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"URL"}),r.jsx("div",{className:"break-all text-[var(--color-fg-secondary)]",children:fe.url})]}),fe.queryParams.length>0&&r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Query params"}),r.jsx("div",{className:"mt-1 space-y-1",children:fe.queryParams.map(ye=>r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:ye.ke
5055y||"(empty)"}),ye.value&&r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["= ",ye.value]})]},ye.id))})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Headers"}),r.jsx(Hu,{code:JSON.stringify(Object.entries(fe.headers).reduce((ye,[Qe,ne])=>(Qe.toLowerCase()==="x-api-key"?ye[Qe]=N2(ne,g):ye[Qe]=ne,ye),{}),null,2),language:"json",showCopyButton:!1,className:"[&_.code-sample__body_pre]:max-h-[200px] [&_.code-sample__body_pre]:overflow-auto [&_.code-sample__body_pre]:text-[12px] [&_.code-sample__body_pre]:leading-relaxed [&_.code-sample__body_pre]:p-3"})]}),fe.bodyText&&r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Body"}),r.jsx(Hu,{code:fe.bodyJson?JSON.stringify(fe.bodyJson,null,2):fe.bodyText,language:fe.bodyJson?"json":"text",showCopyButton:!1,className:"[&_.code-sample__body_pre]:max-h-[200px] [&_.code-sample__body_pre]:overflow-auto [&_.code-sample__body_pre]:text-[12px] [&_.code-sample__body_pre]:leading-relaxed [&_.code-sample__body_pre]:p-3"})]})]})]})]})]})]}),we&&r.jsx(Ht,{className:"surface-card elevation-1 border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 md:p-6",children:r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Ready for real persistence + auth?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Projects add collections, app users (magic links), logs, and automations."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(ht,{asChild:!0,size:"md",children:r.jsx(dt,{to:"/projects",children:"Create a project"})}),r.jsx(ht,{asChild:!0,variant:"secondary",size:"md",children:r.jsx(dt,{to:"/examples/notes-app",children:"Open Notes example"})})]})]})})]}),r.jsx(i,{})]})}const S2=e=>e.replace(/'/g,"'\\''");function nTe(e){const t=[`curl -X ${e.method} '${S2(e.url)}'`];return Object.entries(e.headers).forEach(([s,n])=>{t.push(` -H '${S2(`${s}: ${n}`)}'`)}),e.bodyText&&t.push(` -d '${S2(e.bodyText)}'`),t.join(` \\ 5056`)}function aTe(e){const t=[];if(t.push(`method: '${e.method}'`),Object.keys(e.headers).length){const s=Object.entries(e.headers).map(([n,a])=>` '${n}': '${a}'`).join(`, 5057`);t.push(`headers: { 5058${s} 5059 }`)}return e.bodyText&&(e.bodyJson?t.push(`body: JSON.stringify(${JSON.stringify(e.bodyJson,null,2).split(` 5060`).map((s,n)=>n===0?s:" "+s).join(` 5061`)})`):t.push(`body: ${JSON.stringify(e.bodyText)}`)),`const response = await fetch('${e.url}', { 5062 ${t.join(`, 5063 `)} 5064}); 5065const data = await response.json();`}function oTe(e){return e>=200&&e<300?"success":e>=400&&e<500?"warning":e>=500?"destructive":e>=300?"info":"secondary"}function iTe(e){if(!e)return"0 B";const t=typeof TextEncoder<"u"?new TextEncoder().encode(e).length:e.length;if(t<1024)return`${t} B`;const s=t/1024;return s<1024?`${s.toFixed(1)} KB`:`${(s/1024).toFixed(1)} MB`}const zG={GET:"text-emerald-400 bg-emerald-400/10 border-emerald-400/20",POST:"text-blue-400 bg-blue-400/10 border-blue-400/20",PUT:"text-amber-400 bg-amber-400/10 border-amber-400/20",PATCH:"text-orange-400 bg-orange-400/10 border-orange-400/20",DELETE:"text-rose-400 bg-rose-400/10 border-rose-400/20"};function lTe({endpoints:e,selectedId:t,onSelect:s}){const n=x.useMemo(()=>{const l=new Map;for(const c of e)l.has(c.group)||l.set(c.group,{label:c.groupLabel,endpoints:[]}),l.get(c.group).endpoints.push(c);return Array.from(l.entries())},[e]),[a,o]=x.useState(()=>new Set),i=l=>{o(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u})};return e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center px-4",children:[r.jsx(Rn,{className:"h-6 w-6 text-[var(--color-fg-faint)] mb-2"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"No collections yet"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-1",children:"Create a collection to see endpoints here"}),r.jsx(dt,{to:"/collections",className:"mt-3 text-[11px] font-medium text-indigo-400 hover:text-indigo-300 transition-colors",children:"Go to Collections â"})]}):r.jsx("nav",{className:"space-y-0.5 py-1",children:n.map(([l,c])=>{const u=a.has(l);return r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>i(l),className:"flex items-center gap-1.5 w-full px-3 py-2 text-[11px] font-semibold uppercase tracking-wider text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors",children:[r.jsx(Hn,{className:`h-3 w-3 transition-transform duration-200 ${u?"":"rotate-90"}`}),c.label,r.jsx("span",{className:"ml-auto text-[10px] font-normal normal-case tracking-normal opacity-60",children:c.endpoints.length})]}),!u&&r.jsx("div",{className:"space-y-px pl-2",children:c.endpoints.map(f=>{const h=t===f.id;return r.jsxs("button",{type:"button",onClick:()=>s(f),className:`flex items-center gap-2 w-full rounded-md px-3 py-1.5 text-left transition-all duration-150 group ${h?"bg-indigo-500/10 border border-indigo-500/20":"border border-transparent hover:bg-[var(--color-bg-hover)]"}`,children:[r.jsx("span",{className:`inline-flex items-center justify-center w-[42px] shrink-0 rounded text-[10px] font-bold tracking-tight py-0.5 border ${zG[f.method]}`,children:f.method}),r.jsx("span",{className:`text-xs truncate ${h?"text-[var(--color-fg-default)]":"text-[var(--color-fg-secondary)]"}`,children:f.label}),f.needsRecordId&&r.jsx(lr,{className:"h-3 w-3 text-amber-400/60 shrink-0 ml-auto"})]},f.id)})})]},l)})})}const cTe=500;function dTe({endpoint:e,apiKey:t,environment:s,availableRecordIds:n=[],onResponse:a,onRequestBuilt:o,onError:i,onLoadingChange:l}){const[c,u]=x.useState(""),[f,h]=x.useState(null),[g,v]=x.useState(!1),[y,_]=x.useState(!1),[j,w]=x.useState(null),k=x.useRef(0),S=x.useRef(null);x.useEffect(()=>{if(!e)return;const M=e.defaultBody?JSON.stringify(e.defaultBody,null,2):"";u(M),h(null),v(!1),w(null)},[e==null?void 0:e.id]),x.useEffect(()=>{if(!c.trim()){h(null);return}try{JSON.parse(c),h(null)}catch(M){h(M instanceof Error?M.message:"Invalid JSON")}},[c]),x.useEffect(()=>{S.current&&g&&(S.current.style.height="auto",S.current.style.height=`${Math.min(S.current.scrollHeight,240)}px`)},[c,g]);const E=(e==null?void 0:e.method)==="POST"||(e==null?void 0:e.method)==="PUT"||(e==null?void 0:e.method)==="PATCH",T=!!(e!=null&&e.collectionSlug)&&n.length>1,A=e?!j||!e.collectionSlug?e.path:e.path.replace(/\/records\/[^?/]+/,`/records/${j}`):"",R=e?`${$s}${A}`:"",I=x.useCallback(()=>
5065{if(!e)return null;const M={"x-api-key":t,"X-Reqres-Env":s};E&&(M["Content-Type"]="application/json");let O,z;if(E&&c.trim()){z=c.trim();try{O=JSON.parse(z)}catch{}}return{method:e.method,url:R,headers:M,bodyText:z,bodyJson:O}},[e,t,s,E,c,R]);x.useEffect(()=>{const M=I();M&&o(M)},[I]);const L=x.useCallback(async()=>{if(y||!e)return;if(f){i("Fix the JSON body before sending.");return}if(!t){i("No API key found for this project. Go to Projects to check your API keys.");return}const M=Date.now();if(M-k.current<cTe)return;k.current=M,_(!0),l(!0),i(""),Z.track("console_request_sent",{endpoint_id:e.id,method:e.method,collection:e.group});const O={"x-api-key":t,"X-Reqres-Env":s};E&&(O["Content-Type"]="application/json");const z=performance.now();try{const X=await fetch(R,{method:e.method,headers:O,body:E&&c.trim()?c.trim():void 0}),W=Math.round(performance.now()-z),K=await X.text();let q=null,J=!1;if(K)try{q=JSON.parse(K),J=!0}catch{}a({status:X.status,statusText:X.statusText||(X.ok?"OK":"Error"),headers:Array.from(X.headers.entries()),bodyText:K,bodyJson:q,durationMs:W,isJson:J})}catch(X){i(X instanceof Error?X.message:"Network error - check your connection.")}finally{_(!1),l(!1)}},[y,e,f,t,s,E,c,R,a,i,l]);return e?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-0 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-code)] overflow-hidden",children:[r.jsx("div",{className:`flex items-center justify-center px-3 py-2.5 text-[11px] font-bold tracking-tight border-r border-[var(--color-border-default)] shrink-0 ${zG[e.method]}`,children:e.method}),r.jsx("div",{className:"flex-1 px-3 py-2.5 text-xs font-mono text-[var(--color-fg-secondary)] truncate select-all",title:R,children:R}),r.jsxs("button",{type:"button",onClick:L,disabled:y||!!f,className:`flex items-center gap-2 px-4 py-2.5 text-xs font-semibold text-white shrink-0 transition-all duration-200 ${y?"bg-indigo-500/50 cursor-wait":"bg-indigo-500 hover:bg-indigo-400 active:scale-[0.97]"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[y?r.jsx("div",{className:"h-3.5 w-3.5 rounded-full border-2 border-white/30 border-t-white animate-spin"}):r.jsx(cp,{className:"h-3.5 w-3.5"}),y?"Sending...":"Send"]})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)]",children:e.description}),T&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-[11px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wider",children:"Record"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map((M,O)=>{const z=j===M||!j&&O===0;return r.jsx("button",{type:"button",onClick:()=>{w(M),Z.track("console_record_selected",{collection:e==null?void 0:e.group})},className:`px-2 py-1 rounded text-[11px] font-mono transition-all duration-150 border ${z?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":"border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)] hover:border-[var(--color-border-strong)] hover:text-[var(--color-fg-secondary)]"}`,title:M,children:M.length>12?`${M.slice(0,8)}...`:M},M)})})]}),e.needsRecordId&&n.length===0&&r.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-amber-500/15 bg-amber-500/5 px-3 py-2 text-xs text-amber-300/90",children:[r.jsx(lr,{className:"h-3.5 w-3.5 shrink-0"}),"No records in this collection yet. Use ",r.jsx("span",{className:"font-medium",children:"Create record"})," in the sidebar first, or hit ",r.jsx("span",{className:"font-medium",children:"List records"})," to load existing IDs."]}),E&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[11px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wider",children:"Request body"}),r.jsxs("button",{type:"button",onClick:()=>v(M=>!M),className:"flex items-center gap-1 text-[11px] text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors",children:[g?r.jsx(za,{className:"h-3 w-3"}):r.jsx(Cq,{className:"h-3 w-3"}),g?"Preview":"Edit"]})]}),g?r.jsx("textarea",{ref:S,value:c,onChange:M=>u(M.target.value),spellCheck:!1,className:"w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-3 py-2.5 text-xs font-mono text-[var(--color-fg-secondary)] outline-none resize-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500/80 min-h-[140px]"}):c?r.jsx("div",{onClick:()=>v(!0),className:"cursor-text rounded-md hover:ring-1 hover:ring-[var(--color-border-strong)] transition-all",children:r.jsx(aa,{json:c,className:"min-h-[140px] max-h-56 text-xs"})}):r.jsx("button",{type:"button",onClick:()=>v(!0),className:"w-full text-left rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-3 py-2.5 text-xs font-mono text-[var(--color-fg-faint)] italic hover:border-[var(--color-border-strong)] transition-colors cursor-text",children:"Click to add a request body"}),f&&r.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] text-rose-400",children:[r.jsx(lr,{className:"h-3 w-3"}),f]})]})]}):r.jsx("div",{className:"flex items-center justify-center py-16 text-sm text-[var(--color-fg-faint)]",children:"Select an endpoint from the sidebar"})}function uTe(e){return e===401||e===403?"Check your API key. It may be missing, expired, or lack the required permissions.":e===404?"Endpoint not found. Check the collection slug and record ID.":e===429?"Rate limited. Wait a moment or upgrade for higher limits.":e===409?"Conflict. A resource with this name may already exist.":e>=500?"Server error. This is usually temporary - try again.":null}function pTe({response:e,loading:t,error:s}){var u;const[n,a]=x.useState(!1);if(t)return r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--color-fg-muted)]",children:[r.jsx("div",{className:"h-4 w-4 roun
5065ded-full border-2 border-indigo-400 border-t-transparent animate-spin"}),"Sending request..."]})});if(s)return r.jsx("div",{className:"rounded-lg border border-rose-500/20 bg-rose-500/5 p-4 animate-fade-in",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(lr,{className:"h-4 w-4 text-rose-400 mt-0.5 shrink-0"}),r.jsx("div",{className:"text-sm text-rose-300",children:s})]})});if(!e)return r.jsx("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:r.jsxs("div",{className:"text-[var(--color-fg-faint)] text-sm",children:["Pick an endpoint and hit ",r.jsx("span",{className:"font-medium text-[var(--color-fg-muted)]",children:"Send"})," to see the response"]})});const o=oTe(e.status),i=uTe(e.status),l=e.isJson&&e.bodyJson!==null?JSON.stringify(e.bodyJson,null,2):e.bodyText||"",c=e.isJson&&e.bodyJson&&typeof e.bodyJson=="object"&&Array.isArray((u=e.bodyJson)==null?void 0:u.data)?e.bodyJson.data.length:null;return r.jsxs("div",{className:"space-y-3 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs(ui,{variant:o,className:"text-xs font-mono tabular-nums",children:[e.status," ",e.statusText]}),c!==null&&r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[c," record",c!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto text-[11px] text-[var(--color-fg-faint)]",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Cp,{className:"h-3 w-3"}),e.durationMs,"ms"]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(ife,{className:"h-3 w-3"}),iTe(e.bodyText)]})]})]}),i&&r.jsx("div",{className:"rounded-md border border-amber-500/15 bg-amber-500/5 px-3 py-2 text-xs text-amber-300/90",children:i}),l?r.jsx(aa,{json:l,className:"max-h-[400px] text-xs [&_pre]:!scroll-m-0"}):e.status>=200&&e.status<300?r.jsxs("div",{className:"rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-code)] px-4 py-3 text-xs text-[var(--color-fg-muted)]",children:["No response body (",e.status," ",e.statusText,")"]}):null,e.headers.length>0&&r.jsxs("button",{type:"button",onClick:()=>a(f=>!f),className:"flex items-center gap-1.5 text-[11px] text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors",children:[r.jsx(sr,{className:`h-3 w-3 transition-transform duration-200 ${n?"rotate-180":""}`}),"Response headers (",e.headers.length,")"]}),n&&r.jsx("div",{className:"animate-slide-up",children:r.jsx(Go,{code:e.headers.map(([f,h])=>`${f}: ${h}`).join(` 5066`),language:"bash",className:"max-h-40 text-[11px]"})})]})}function fTe({request:e,apiKey:t}){const[s,n]=x.useState(!1),[a,o]=x.useState("curl"),[i,l]=x.useState(null);if(!e)return null;const c=nTe(e),u=aTe(e),f=a==="curl"?c:u,h=(v,y)=>{navigator.clipboard.writeText(v).then(()=>{l(y),setTimeout(()=>l(null),2e3),Z.track("console_snippet_copied",{snippet_type:y==="key"?"api_key":y==="code"?a:y})}).catch(()=>{})},g=t?`${t.slice(0,6)}...${t.slice(-4)}`:"Not set";return r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>n(v=>!v),className:"flex items-center justify-between w-full px-4 py-3 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(mo,{className:"h-3.5 w-3.5"}),"Snippets & Keys"]}),r.jsx(sr,{className:`h-3.5 w-3.5 transition-transform duration-200 ${s?"rotate-180":""}`})]}),s&&r.jsxs("div",{className:"px-4 pb-4 space-y-3 animate-slide-up",children:[r.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--color-bg-code)] border border-[var(--color-border-default)] px-3 py-2",children:[r.jsx(_d,{className:"h-3.5 w-3.5 text-[var(--color-fg-faint)] shrink-0"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)] font-mono flex-1 truncate",children:g}),r.jsx("button",{type:"button",onClick:()=>h(t,"key"),className:"text-[var(--color-fg-faint)] hover:text-[var(--color-fg-default)] transition-colors shrink-0",children:i==="key"?r.jsx(ts,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(is,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"flex items-center gap-1 border-b border-[var(--color-border-default)]",children:[r.jsxs("button",{type:"button",onClick:()=>o("curl"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors border-b-2 -mb-px ${a==="curl"?"border-indigo-400 text-[var(--color-fg-default)]":"border-transparent text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)]"}`,children:[r.jsx(mo,{className:"h-3 w-3"}),"cURL"]}),r.jsxs("button",{type:"button",onClick:()=>o("js"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors border-b-2 -mb-px ${a==="js"?"border-indigo-400 text-[var(--color-fg-default)]":"border-transparent text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)]"}`,children:[r.jsx(nm,{className:"h-3 w-3"}),"JavaScript"]}),r.jsx("button",{type:"button",onClick:()=>h(f,"code"),className:"ml-auto flex items-center gap-1.5 px-2 py-1.5 text-[11px] text-[var(--color-fg-faint)] hover:text-[var(--color-fg-default)] transition-colors",children:i==="code"?r.jsxs(r.Fragment,{children:[r.jsx(ts,{className:"h-3 w-3 text-emerald-400"})," Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(is,{className:"h-3 w-3"})," Copy"]})})]}),r.jsx(Go,{code:f,language:a==="curl"?"bash":"javascript",className:"max-h-48 text-[11px]"})]})]})}function hTe(e){if(!e||typeof e!="object")return"example";switch(e.type||"string"){case"number":case"integer":return 1;case"boolean":return!0;case"array":return[];case"object":return{};default:return"example"}}
5066function mTe(e,t,s){const n=[];for(const a of t){const o=a.slug,i=s[o],l=(i==null?void 0:i.id)||":id",c=a.schema&&typeof a.schema=="object"?a.schema:{},u=Object.fromEntries(Object.entries(c).map(([g,v])=>{var y;return[g,((y=i==null?void 0:i.data)==null?void 0:y[g])??hTe(v)]})),h=Object.keys(u).length>0?{data:u}:{data:{key:"value"}};n.push({id:`${o}-list`,group:o,groupLabel:a.name,label:"List records",method:"GET",path:`/api/collections/${o}/records?project_id=${e}`,description:`Fetch all records from ${a.name}`}),n.push({id:`${o}-get`,group:o,groupLabel:a.name,label:"Get record",method:"GET",path:`/api/collections/${o}/records/${l}?project_id=${e}`,description:"Fetch a single record by ID",needsRecordId:!i,collectionSlug:o}),n.push({id:`${o}-create`,group:o,groupLabel:a.name,label:"Create record",method:"POST",path:`/api/collections/${o}/records?project_id=${e}`,defaultBody:h,description:`Add a new record to ${a.name}`}),n.push({id:`${o}-update`,group:o,groupLabel:a.name,label:"Update record",method:"PUT",path:`/api/collections/${o}/records/${l}?project_id=${e}`,defaultBody:h,description:"Update an existing record",needsRecordId:!i,collectionSlug:o}),n.push({id:`${o}-delete`,group:o,groupLabel:a.name,label:"Delete record",method:"DELETE",path:`/api/collections/${o}/records/${l}?project_id=${e}`,description:"Soft-delete a record",needsRecordId:!i,collectionSlug:o})}return n.push({id:"collections-list",group:"_collections",groupLabel:"Collections",label:"List collections",method:"GET",path:`/api/collections?project_id=${e}`,description:"List all collections in this project"}),n}function D$({icon:e,label:t,value:s,copyable:n}){const[a,o]=x.useState(!1),i=()=>{navigator.clipboard.writeText(s).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)}).catch(()=>{})};return r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e,r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:t}),r.jsx("span",{className:"font-mono text-[var(--color-fg-secondary)]",children:s}),n&&r.jsx("button",{type:"button",onClick:i,className:"text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)] transition-colors",children:a?r.jsx(ts,{className:"h-3 w-3 text-emerald-400"}):r.jsx(is,{className:"h-3 w-3"})})]})}function gTe(){Mn("Project Console");const{getToken:e,isLoaded:t,isSignedIn:s}=zt(),[n]=Wa(),[a,o]=x.useState([]),[i,l]=x.useState(null),[c,u]=x.useState([]),[f,h]=x.useState({}),[g,v]=x.useState({}),[y,_]=x.useState(""),[j,w]=x.useState("prod"),[k,S]=x.useState(!0),[E,T]=x.useState(!1),[A,R]=x.useState(null),[I,L]=x.useState(null),[M,O]=x.useState(null),[z,X]=x.useState(!1),[W,K]=x.useState(null),[q,J]=x.useState(!1),F=x.useMemo(()=>a.find(H=>H.id===i)??null,[a,i]),V=x.useMemo(()=>i?mTe(i,c,f):[],[i,c,f]);x.useEffect(()=>{if(!t)return;let H=!0;return(async()=>{var U;try{const oe=await Ue(e);if(!oe||!H)return;const Q=((U=(await ue.get("/projects",{authToken:oe})).data)==null?void 0:U.projects)??[];if(!H)return;o(Q);const le=n.get("project_id"),Se=le?Number(le):null;Se&&Q.some(we=>we.id===Se)?l(Se):Q.length>0&&l(Q[0].id)}catch(oe){console.error("Failed to load projects",oe)}finally{H&&S(!1)}})(),()=>{H=!1}},[e,t,n]),x.useEffect(()=>{if(!i||!t)return;let H=!0;return T(!0),u([]),h({}),R(null),L(null),(async()=>{try{if(!await Ue(e)||!H)return;const oe=a.find(Le=>Le.id===i),fe=(oe==null?void 0:oe.api_key)||"",Q=await fetch(`${$s}/api/collections?project_id=${i}`,{headers:{"x-api-key":fe,"X-Reqres-Env":j}});if(!Q.ok||!H){T(!1);return}const le=await Q.json(),Se=Array.isArray(le==null?void 0:le.data)?le.data:Array.isArray(le)?le:[];if(!H)return;u(Se),_(fe);const we={};if(await Promise.all(Se.map(async Le=>{try{const xe=await fetch(`${$s}/api/collections/${Le.slug}/records?project_id=${i}&limit=1`,{headers:{"x-api-key":fe,"X-Reqres-Env":j}});if(xe.ok){const de=await xe.json(),Me=Array.isArray(de==null?void 0:de.data)?de.data:[];we[Le.slug]=Me[0]?{id:Me[0].id,data:Me[0].data||{}}:null}else we[Le.slug]=null}catch{we[Le.slug]=null}})),!H)return;h(we),Z.track("console_viewed",{project_id:i,collections:Se.length})}catch(U){console.error("Failed to load collections",U)}finally{H&&T(!1)}})(),()=>{H=!1}},[i,t,e,a,j]),x.useEffect(()=>{V.length>0&&!A&&R(V[0])},[V,A]);const $=x.useCallback(H=>{R(H),L(null),K(null),J(!1),Z.track("console_endpoint_selected",{endpoint_id:H.id,method:H.method,group:H.group})},[]),B=x.useCallback(H=>{var U;if(L(H),K(null),H.status>=200&&H.status<300&&(A!=null&&A.group)&&A.group!=="_collections"){const oe=H.bodyJson,fe=A.group;if(A.id.endsWith("-list")){const Q=Array.isArray(oe==null?void 0:oe.data)?oe.data:[],le=Q.map(Se=>
5066Se.id).filter(Boolean);if(le.length>0){v(we=>({...we,[fe]:le}));const Se=Q[0];Se!=null&&Se.id&&h(we=>({...we,[fe]:{id:Se.id,data:Se.data||{}}}))}}else if(A.id.endsWith("-create")){const Q=((U=oe==null?void 0:oe.data)==null?void 0:U.id)||(oe==null?void 0:oe.id);Q&&(v(le=>{const Se=le[fe]||[];return{...le,[fe]:[Q,...Se]}}),h(le=>{var Se,we;return(Se=le[fe])!=null&&Se.id?le:{...le,[fe]:{id:Q,data:((we=oe==null?void 0:oe.data)==null?void 0:we.data)||(oe==null?void 0:oe.data)||{}}}}))}}Z.track(H.status>=200&&H.status<300?"console_request_succeeded":"console_request_failed",{endpoint_id:A==null?void 0:A.id,method:A==null?void 0:A.method,status:H.status,latency_ms:H.durationMs})},[A]),ae=x.useCallback(H=>{l(H),Z.track("console_project_selected",{project_id:H})},[]);return k?r.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--color-fg-muted)]",children:[r.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-indigo-400 border-t-transparent animate-spin"}),"Loading projects..."]})}):t&&!s?r.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] text-center px-4",children:[r.jsx(Nfe,{className:"h-8 w-8 text-[var(--color-fg-faint)] mb-3"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Sign in to use the console"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1 max-w-sm",children:"The Project Console lets you explore your API interactively. Sign in to get started."})]}):a.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] text-center px-4",children:[r.jsx(Dr,{className:"h-8 w-8 text-[var(--color-fg-faint)] mb-3"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"No projects yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1 max-w-sm",children:"Create a project to start exploring your API here."}),r.jsx(dt,{to:"/projects",className:"mt-4 inline-flex items-center gap-1.5 rounded-md bg-indigo-500 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-400 transition",children:"Go to Projects"})]}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 max-w-7xl",children:[r.jsx(Dr,{className:"h-4 w-4 text-indigo-400 shrink-0"}),r.jsx("span",{className:"text-xs font-medium text-[var(--color-fg-muted)] shrink-0",children:"Project"}),a.length===1?r.jsx("span",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:F==null?void 0:F.name}):r.jsxs("div",{className:"relative",children:[r.jsx("select",{value:i??"",onChange:H=>ae(Number(H.target.value)),className:"appearance-none rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] pl-3 pr-7 py-1.5 text-sm font-medium text-[var(--color-fg-default)] outline-none focus:border-indigo-500 cursor-pointer",children:a.map(H=>r.jsx("option",{value:H.id,children:H.name},H.id))}),r.jsx(sr,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3 w-3 text-[var(--color-fg-faint)] pointer-events-none"})]}),r.jsx("div",{className:"flex items-center gap-0 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] ml-auto",children:["prod","dev"].map(H=>r.jsxs("button",{type:"button",onClick:()=>{w(H),Z.track("console_environment_changed",{environment:H})},className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium transition-colors ${j===H?"bg-[var(--color-bg-hover)] text-[var(--color-fg-default)]":"text-[var(--color-fg-faint)] hover:text-[var(--color-fg-muted)]"}`,children:[H==="prod"?r.jsx(Afe,{className:"h-3 w-3"}):r.jsx(nm,{className:"h-3 w-3"}),H]},H))}),r.jsxs("button",{type:"button",onClick:()=>J(H=>!H),className:"lg:hidden flex items-center gap-1 px-2 py-1.5 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-xs text-[var(--color-fg-secondary)]",children:["Endpoints",r.jsx(sr,{className:`h-3 w-3 transition-transform ${q?"rotate-180":""}`})]})]}),F&&r.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 max-w-7xl text-[11px] text-[var(--color-fg-faint)] flex-wrap",children:[r.jsx(D$,{icon:r.jsx(iv,{className:"h-3 w-3"}),label:"Base URL",value:`${$s}/api`,copyable:!0}),r.jsx(D$,{icon:r.jsx(Rn,{className:"h-3 w-3"}),label:"Collections",value:String(c.length)}),r.jsxs("span",{className:"text-[var(--color-fg-faint)]/80",children:["Project ID ",F.id]})]})]}),r.jsxs("div",{className:"flex flex-1 min-h-0",children:[r.jsx("div",{className:`${q?"block":"hidden"} lg:block w-full lg:w-[260px] shrink-0 border-r border-[var(--color-border-default)] bg-[var(--color-bg-default)] overflow-y-auto`,children:E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-4 w-4 roun
5066ded-full border-2 border-indigo-400 border-t-transparent animate-spin"})}):r.jsx(lTe,{endpoints:V,selectedId:(A==null?void 0:A.id)??null,onSelect:$})}),r.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 md:p-5 space-y-4 max-w-5xl",children:[r.jsx(dTe,{endpoint:A,apiKey:y,environment:j,availableRecordIds:A!=null&&A.collectionSlug?g[A.collectionSlug]??[]:[],onResponse:B,onRequestBuilt:O,onError:H=>K(H||null),onLoadingChange:X}),(I||z||W)&&r.jsx("div",{className:"border-t border-[var(--color-border-default)]"}),r.jsx(pTe,{response:I,loading:z,error:W}),M&&r.jsx("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] overflow-hidden",children:r.jsx(fTe,{request:M,apiKey:y})})]})})]})]})}const $$=e=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),xTe=["cosmic","ember","pixel","orbit","mint","drift","cocoa","velvet","electric","paper","sonic","neon","quiet","shadow","amber","lunar"],vTe=["crown","coffee","stack","circuit","cloud","forge","stream","grove","cabin","lane","valley","bay","quill","pulse","garden","studio"];function $x(e){return e[Math.floor(Math.random()*e.length)]}function C2(e){const t=$$(e)||"project",s=$x(xTe),n=$x(vTe);return $$(`${t}-${s}-${n}`)}const U$=["flow","arc","stack","shield"],bTe=["ribbon","wave","grid","orbit"],yTe=gG.filter(e=>e.startsWith("tess")),E2=[...bTe,...yTe];function _Te({variant:e}){const t=x.useId();if(e==="flow"){const n=`projFlowGlow-${t}`,a=`projFlowLine-${t}`;return r.jsxs("div",{className:"rr-ambient-bg","aria-hidden":"true",children:[r.jsxs("svg",{className:"rr-ambient-svg -right-14 -bottom-10 w-[440px]",viewBox:"0 0 520 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsxs("defs",{children:[r.jsxs("radialGradient",{id:n,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(340 140) rotate(120) scale(260 220)",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0.18)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0)"})]}),r.jsxs("linearGradient",{id:a,x1:"120",y1:"110",x2:"420",y2:"250",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0.1)"}),r.jsx("stop",{offset:"0.5",stopColor:"rgba(90,69,255,0.55)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0.1)"})]})]}),r.jsx("rect",{width:"520",height:"360",fill:`url(#${n})`,opacity:"0.9"}),r.jsxs("g",{opacity:"0.75",children:[r.jsx("path",{d:"M140 190 C 210 120, 250 120, 300 170",stroke:`url(#${a})`,strokeWidth:"3",strokeLinecap:"round"}),r.jsx("path",{d:"M140 190 C 210 260, 250 260, 300 210",stroke:`url(#${a})`,strokeWidth:"3",strokeLinecap:"round"}),r.jsx("path",{d:"M300 170 C 350 140, 380 140, 420 170",stroke:`url(#${a})`,strokeWidth:"3",strokeLinecap:"round"}),r.jsx("path",{d:"M300 210 C 350 240, 380 240, 420 210",stroke:`url(#${a})`,strokeWidth:"3",strokeLinecap:"round"}),r.jsx("path",{d:"M300 170 L300 210",stroke:"rgba(255,255,255,0.1)",strokeWidth:"2",strokeLinecap:"round"})]}),r.jsxs("g",{opacity:"0.95",children:[r.jsx("circle",{cx:"140",cy:"190",r:"18",fill:"rgba(255,255,255,0.04)",stroke:"rgba(255,255,255,0.12)",strokeWidth:"2"}),r.jsx("circle",{cx:"300",cy:"170",r:"18",fill:"rgba(255,255,255,0.04)",stroke:"rgba(255,255,255,0.12)",strokeWidth:"2"}),r.jsx("circle",{cx:"300",cy:"210",r:"18",fill:"rgba(255,255,255,0.04)",stroke:"rgba(255,255,255,0.12)",strokeWidth:"2"}),r.jsx("circle",{cx:"420",cy:"170",r:"18",fill:"rgba(255,255,255,0.04)",stroke:"rgba(255,255,255,0.12)",strokeWidth:"2"}),r.jsx("circle",{cx:"420",cy:"210",r:"18",fill:"rgba(255,255,255,0.04)",stroke:"rgba(255,255,255,0.12)",strokeWidth:"2"})]}),r.jsx("circle",{className:"rr-pulse",cx:"300",cy:"170",r:"5",fill:"rgba(90,69,255,0.95)",opacity:"0.25"})]}),r.jsx("div",{className:"rr-ambient-vignette"})]})}if(e==="arc"){const n=`projArcGlow-${t}`,a=`projArcStroke-${t}`;return r.jsxs("div",{className:"rr-ambient-bg","aria-hidden":"true",children:[r.jsxs("svg",{className:"rr-ambient-svg -right-12 -bottom-14 w-[460px]",viewBox:"0 0 520 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsxs("defs",{children:[r.jsxs("radialGradient",{id:n,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(270 170) rotate(90) scale(260 300)",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0.16)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0)"})]}),r.jsxs("linearGradient",{id:a,x1:"80",y1:"240",x2:"440",y2:"240",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0)"}),r.jsx("stop",{offset:"0.5",stopColor:"rgba(90,69,255,0.7)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0)"})]})]}),r.jsx("rect",{width:"520",height:"360",fill:`url(#${n})`,opacity:"0.9"}),r.jsx("path",{d:"M90 260 C150 120, 370 120, 430 260",stroke:"rgba(255,255,255,0.06)",strokeWidth:"2",strokeLinecap:"round",opacity:"0.7"}),r.jsx("path",{className:"rr-dash",d:"M90 260 C150 120, 370 120, 430 260",stroke:`url(#${a})`,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"7 12",opacity:"0.85"}),r.jsxs("g",{opacity:"0.18",children:[r.jsx("path",{d:"M140 230l-24 10",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M190 195l-22 12",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M240 170l-20 14",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M280 165l-18 15",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M330 185l-16 14",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"}),r.jsx("path",{d:"M380 220l-14 12",stroke:"rgba(255,255,255,0.8)",strokeWidth:"2",strokeLinecap:"round"})]}),r.jsxs("g",{opacity:"0.22",children:[r.jsx("circle",{cx:"90",cy:"260",r:"6",fill:"rgba(255,255,255,0.35)"}),r.jsx("circle",{cx:"430",cy:"260",r:"6",fill:"rgba(255,255,255,0.35)"}),r.jsx("circle",{cx:"260",cy:"145",r:"6",fill:"rgba(255,255,255,0.28)"})]})]}),r.jsx("div",{className:"rr-ambient-vignette"})]})}if(e==="stack"){const n=`projStackGlow-${t}`,a=`projStackPanel-${t}`;return r.jsxs("div",{className:"rr-ambient-bg","aria-hidden":"true",children:[r.jsxs("svg",{className:"rr-ambient-svg -right-16 -bottom-14 w-[460px]",viewBox:"0 0 520 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:a,x1:"80",y1:"70",x2:"420",y2:"300",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"rgba(255,255,255,0.06)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(255,255,255,0.015)"})]}),r.jsxs("radialGradient",{id:n,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(320 130) rotate(120) scale(240 220)",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0.16)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0)"})]})]}),r.jsx("rect",{width:"520",height:"360",fill:`url(#${n})`,opacity:"0.9"}),r.jsxs("g",{opacity:"0.95",children:[r.jsx("path",{d:"M156 88c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H182c-15 0-26-12-26-26V88Z",fill:`url(#${a})`,stroke:"rgba(255,255,255,0.1)"}),r.jsx("path",{d:"M132 128c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H158c-15 0-26-12-26-26v-58Z",fill:"rgba(255,255,255,0.03)",stroke:"rgba(255,255,255,0.09)"}),r.jsx("path",{d:"M108 168c0-14 11-26 26-26h212c14 0 26 12 26 26v58c0 14-12 26-26 26H134c-15 0-26-12-26-26v-58Z",fill:"rgba(255,255,255,0.02)",stroke:"rgba(255,255,255,0.08)"})]}),r.jsx("path",{className:"rr-shimmer",d:"M150 72h212c22 0 40 18 40 40v10",stroke:"rgba(90,69,255,0.55)",strokeWidth:"2",strokeLinecap:"round",opacity:"0.75"})]}),r.jsx("div",{className:"rr-ambient-vignette"})]})}const s=`projShieldGlow-${t}`;return r.jsxs("div",{className:"rr-ambient-bg","aria-hidden":"true",children:[r.jsxs("svg",{className:"rr-ambient-svg -right-14 -bottom-14 w-[440px]",viewBox:"0 0 520 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("defs",{children:r.jsxs("radialGradient",{id:s,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(320 150) rotate(120) scale(240 220)",children:[r.jsx("stop",{stopColor:"rgba(90,69,255,0.14)"}),r.jsx("stop",{offset:"1",stopColor:"rgba(90,69,255,0)"})]})}),r.jsx("rect",{width:"520",height:"360",fill:`url(#${s})`,opacity:"0.9"}),r.jsx("path",{d:"M260 92c52 0 96 22 120 34v78c0 60-42 100-120 132-78-32-120-72-120-132V126c24-12 68-34
5066120-34Z",fill:"rgba(255,255,255,0.015)",stroke:"rgba(255,255,255,0.1)",strokeWidth:"2",opacity:"0.9"}),r.jsxs("g",{opacity:"0.16",children:[r.jsx("path",{d:"M170 160H350",stroke:"rgba(255,255,255,0.8)"}),r.jsx("path",{d:"M162 200H358",stroke:"rgba(255,255,255,0.8)"}),r.jsx("path",{d:"M180 240H340",stroke:"rgba(255,255,255,0.8)"}),r.jsx("path",{d:"M210 128V286",stroke:"rgba(255,255,255,0.8)"}),r.jsx("path",{d:"M260 120V300",stroke:"rgba(255,255,255,0.8)"}),r.jsx("path",{d:"M310 128V286",stroke:"rgba(255,255,255,0.8)"})]}),r.jsxs("g",{opacity:"0.4",children:[r.jsx("rect",{x:"236",y:"188",width:"48",height:"44",rx:"14",fill:"rgba(255,255,255,0.03)",stroke:"rgba(255,255,255,0.1)"}),r.jsx("path",{d:"M248 188v-10c0-10 8-18 18-18s18 8 18 18v10",stroke:"rgba(90,69,255,0.55)",strokeWidth:"3",strokeLinecap:"round"})]})]}),r.jsx("div",{className:"rr-ambient-vignette"})]})}function jTe(){Mn("Projects");const{getToken:e}=zt(),[t,s]=x.useState([]),[n,a]=x.useState(!1),[o,i]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(""),[h,g]=x.useState(""),[v,y]=x.useState(()=>$x(E2)),[_,j]=x.useState(null),[w,k]=x.useState(!1),[S,E]=x.useState(!1),[T,A]=x.useState(!1),[R,I]=x.useState({}
5066),[L,M]=x.useState(null),[O,z]=x.useState(null),[X,W]=x.useState(null),[K,q]=x.useState(null),J=un(),F=`${Mt.dark} h-full min-h-[200px] flex flex-col justify-between`,V="projects-card-hover group relative overflow-hidden rounded-lg sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 sm:p-5 md:p-6 min-h-[180px] sm:min-h-[220px] flex flex-col gap-4 cursor-pointer",$=Jt.primaryEmphasis,B=Jt.secondaryEmphasis,ae=xe=>{if(!xe)return null;const de=new Date(xe);return Number.isNaN(de.getTime())?null:de.toLocaleDateString(void 0,{month:"short",day:"numeric"})},H=xe=>xe===null?"Activity unavailable":xe===0?"0 requests (24h)":`${xe} ${xe===1?"request":"requests"} (24h)`,U=(xe,de)=>xe===0?"Next: add a collection":(xe??0)>0&&(de??0)===0?"Next: send a test request":null;x.useEffect(()=>{(async()=>{try{a(!0),i(null);const de=await Ue(e);if(!de){i("Please sign in to continue");return}const je=(await ue.get("/projects",{authToken:de})).data.projects||[];s(je),Z.setUserProperties({projects_count:je.length}),k(!1)}catch(de){console.error("Failed to load projects",de),i("Could not load projects")}finally{a(!1)}})()},[e]),x.useEffect(()=>{Z.setUserProperties({projects_count:t.length})},[t.length]),x.useEffect(()=>{if(t.length===0){I({});return}(async()=>{try{const de=await Ue(e);if(!de)return;const Me=await Promise.all(t.map(async je=>{var Ae,Oe,Ke,ut;try{const[De,ct,rt]=await Promise.all([ue.get(`/data-explorer/collections?project_id=${je.id}`,{authToken:de}),ue.get(`/api/app-users?project_id=${je.id}&limit=10`,{authToken:de}),ue.get(`/logs?project_id=${je.id}&limit=10`,{authToken:de})]),mt=(((Ae=De.data)==null?void 0:Ae.data)||[]).length??0,vt=(((Oe=ct.data)==null?void 0:Oe.data)||[]).length??0,gt=((Ke=rt.data)==null?void 0:Ke.data)||[],Be=Date.now(),ve=gt.filter(nt=>(nt==null?void 0:nt.created_at)&&Be-new Date(nt.created_at).getTime()<=864e5).length,be=((ut=gt[0])==null?void 0:ut.created_at)||null;return[je.id,{collections:mt,appUsers:vt,logs24h:ve,lastLogAt:be}]}catch(De){return console.warn("Project meta fetch failed",je.id,De),[je.id,{collections:null,appUsers:null,logs24h:null,lastLogAt:null}]}}));I(Object.fromEntries(Me))}catch(de){console.warn("Project meta fetch failed",de)}})()},[t,e]),x.useEffect(()=>{if(K===null)return;const xe=de=>{const Me=de.target;Me!=null&&Me.closest("[data-project-menu-button]")||Me!=null&&Me.closest("[data-project-menu-panel]")||q(null)};return document.addEventListener("mousedown",xe),()=>document.removeEventListener("mousedown",xe)},[K]);const oe=async()=>{var de,Me;const xe=/^[a-zA-Z0-9_\-\s]+$/;try{c(!0),j(null);const je=await Ue(e);if(!je){j("Please sign in to create a project."),it.error("Please sign in to create a project.");return}const Ae=u.trim();let Oe=h.trim();if(!Ae){j("Name and slug are required.");return}if(!xe.test(Ae)){j("Name can only include letters, numbers, spaces, hyphens, and underscores.");return}if(Ae.length<3||Ae.length>100){j("Name must be between 3 and 100 characters.");return}Oe||(Oe=C2(Ae),g(Oe),E(!1));const Ke=v||$x(E2);await ue.post("/projects",{name:Ae,slug:Oe,icon_variant:Ke},{authToken:je,headers:{"Content-Type":"application/json"}}),Z.track("project_created",{template_used:!1,is_second_project:t.length===1,creation_method:"manual"}),f(""),g(""),E(!1),y($x(E2));const De=(await ue.get("/projects",{authToken:je})).data.projects||[];s(De),Z.setUserProperties({projects_count:De.length}),k(!1),it.success("Project created successfully.")}catch(je){console.error("Failed to create project",je),je instanceof yt&&Z.track("request_failed",{surface:"other",status_code:je.status,error_code:((de=je.data)==null?void 0:de.error)||void 0,path:window.location.pathname});const Ae=je instanceof Error?je.message.toLowerCase():"";let Oe="Could not create project. Please try again.";je instanceof yt&&(((Me=je.data)==null?void 0:Me.error)==="project_limit_reached"||Ae.includes("project limit"))?(j(r.jsxs("span",{children:["You've hit the project limit for your plan. Please delete a project or"," ",r.jsx(dt,{to:"/upgrade",className:"text-indigo-300 underline",children:"upgrade"})," ","to create more."]})),Oe="Project limit reached for your plan."):j("Could not create project. Please try again."),it.error(Oe)}finally{c(!1)}},fe=async xe=>{if(confirm("Delete this project? This removes its keys, collections, app users, logs, and automations."))try{W(xe);const de=await Ue(e);if(!de){it.error("Please sign in to delete a project.");return}await ue.delete(`/projects/${xe}`,{authToken:de}),s(Me=>Me.filter(je=>je.id!==xe)),Z.track("project_deleted",{project_id:xe,surface:"projects_list"}),it.success("Project deleted.")}catch(de){console.error("Failed to delete project",de),Z.track("project_delete_failed",{project_id:xe}),it.error("Could not delete project.")}finally{W(null)}},Q=async xe=>{try{await navigator.clipboard.writeText(String(xe)),M(xe),Z.track("copied_project_id",{project_id:xe}),it.success("Project ID copied"),setTimeout(()=>{M(de=>de===xe?null:de)},1200)}catch(de){console.error("Failed to copy project id",de),it.error("Could not copy project ID")}},le=async(xe,de)=>{try{await navigator.clipboard.writeText(de),z(xe),Z.track("copied_project_slug",{project_id:xe,slug:de}
5066),it.success("Project slug copied"),setTimeout(()=>{z(Me=>Me===xe?null:Me)},1200)}catch(Me){console.error("Failed to copy project slug",Me),it.error("Could not copy project slug")}},Se=()=>{k(!1),j(null),A(!1)},we=()=>w?r.jsxs("div",{className:"fixed inset-0 z-40 flex items-center justify-center px-4 py-6",children:[r.jsx("div",{className:"absolute inset-0 bg-[var(--color-overlay)] backdrop-blur-sm",onClick:Se}),r.jsx("div",{className:"relative w-full max-w-xl rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl",children:r.jsxs("form",{className:"p-6 md:p-7 space-y-5",onSubmit:xe=>{xe.preventDefault(),oe()},children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Create project"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Give your project a name to get started."})]}),r.jsx("button",{type:"button",className:"text-xs font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:Se,children:"Close"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)] mb-1 block",children:"Name"}),r.jsx(Is,{value:u,onChange:xe=>{const de=xe.target.value;f(de),S||g(C2(de))},placeholder:"My project",className:"rounded-md bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] h-11 px-3 w-full text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus-visible:ring-indigo-500 focus-visible:border-indigo-500"}),!T&&r.jsx("button",{type:"button",className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition",onClick:()=>A(!0),children:"Edit slug"})]}),T&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)] mb-1 block",children:"Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Is,{value:h,onChange:xe=>{const de=xe.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-");g(de),E(!0)},placeholder:"my-project",className:"rounded-md bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] h-11 px-3 w-full text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus-visible:ring-indigo-500 focus-visible:border-indigo-500"}),r.jsx("button",{type:"button",className:"text-xs px-3 py-2 rounded-md bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",onClick:()=>{const xe=C2(u||"project");g(xe),E(!1)},children:"Shuffle"})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1",children:[r.jsx("button",{type:"button",className:"text-xs font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",onClick:Se,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:l,className:`${$} h-11 px-4 text-sm`,children:l?"Creating...":"Create project"})]}),_&&r.jsx("div",{className:"text-xs text-[var(--color-fg-default)] bg-[var(--color-semantic-danger-bg)] border border-[var(--color-semantic-danger)]/30 rounded-md px-3 py-2",children:_})]})})]}):null;if(n)return r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-10",children:r.jsx("div",{className:`${F} items-center justify-center text-[var(--color-fg-secondary)]`,children:r.jsx(bs,{text:"Loading projects...",className:"flex-col text-[var(--color-fg-secondary)]",textClassName:"text-sm text-[var(--color-fg-secondary)] animate-pulse"})})});if(o)return r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-10",children:r.jsx("div",{className:`${F} text-sm text-[var(--color-fg-secondary)]`,children:o})});const Le=t.length>0;return r.jsxs("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-6 space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-[var(--color-fg-default)]",children:"Projects"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Each project is a complete backend: collections, users, logs, automations."})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("button",{type:"button",className:`${$} h-10 sm:h-11 px-4 text-sm whitespace-nowrap`,onClick:()=>k(!0),children:"Create project"}),Le&&r.jsxs(r.Fragment,{children:[r.jsx(dt,{className:`${B} h-10 sm:h-11 px-4 text-sm whitespace-nowrap`,to:"/templates",title:"Start with CRUD patterns, demo data, or example schemas.",children:"Create from template"}),r.jsx(dt,{className:"inline-flex h-10 sm:h-11 items-center justify-center rounded-md border border-[var(--color-border-default)] bg-transparent px-4 text-xs font-medium text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition whitespace-nowrap",to:"/data-explorer",children:"Open Data Explorer"})]})]})]}),Le&&r.jsxs("div",{className:"rounded-lg sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 md:p-5 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"hidden sm:flex h-10 w-10 shrink-0 rounded-full border border-[var(--color-border-default)] bg-indigo-500/15 text-indigo-400 items-center justify-center text-[11px] font-semibold uppercase tracking-[0.08em]",children:"Try"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Want a working example?"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Open the Notes sample to see collections, users, and logs prefilled."})]})]}),r.jsx(dt,{to:Ha,className:`${B} h-10 px-4 text-xs whitespace-nowrap self-start sm:self-auto shrink-0`,children:"Open Notes app"})]}),Le?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:t.map((xe,de)=>{var ke;const Me=U$[de%U$.length],je=R[xe.id],Ae=je===void 0,Oe=(je==null?void 0:je.collections)===null||(je==null?void 0:je.collections)===void 0?null:je.collections,Ke=(je==null?void 0:je.appUsers)===null||(je==null?void 0:je.appUsers)===void 0?null:je.appUsers,ut=(je==null?void 0:je.logs24h)===null||(je==null?void 0:je.logs24h)===void 0?null:je.logs24h,De=Oe===null?"Collections -":`${Oe} ${Oe===1?"collection":"collections"}`,ct=Ke===null?"App users -":`${Ke} ${Ke===1?"app user":"app users"}`,rt=Ae?"Loading statsâ¦":H(ut),mt=(Oe??0)>0,vt=je?U(Oe,ut):null,gt=ae(je==null?void 0:je.lastLogAt),Be=ae(xe.created_at),ve=gt?`Last active ${gt}`:Be?`Created ${Be}`:null,be=(((ke=xe.description)==null?void 0:ke.length)??0)>120,nt=xe.description&&!be,Ze=!!xe.template_name||!!xe.description&&be,he=je===void 0?null:mt?{label:"View logs",to:`/logs?projectId=${xe.id}`}:{label:"Add collection",to:`/data-explorer?projectId=${xe.id}&tab=collections`};return r.jsxs("div",{className:V,role:"button",tabIndex:0,onClick:()=>J(`/projects/${xe.id}`),onKeyDown:Ve=>{(Ve.key==="Enter"||Ve.key===" ")&&(Ve.preventDefault(),J(`/projects/${xe.id}`))},children:[r.jsx(_Te,{variant:Me}),r.jsxs("div",{className:"rr-ambient-content relative flex flex-col gap-4 flex-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("div",{className:"flex items-start gap-3 min-w-0",children:r.jsxs("div",{className:"min-w-0 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("p",{className:"text-base font-semibold text-[var(--color-fg-default)] truncate",children:xe.name}),xe.organization_name&&r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2 py-0.5 text-[10px] font-medium text-[var(--color-fg-default)]",children:xe.organization_name}),Ze&&r.jsx("span",{className:"inline-flex items-center rounded-full border border-indigo-400/30 bg-indigo-500/10 px-2 py-0.5 text-[10px] font-medium text-indigo-100",children:"Auto-generated"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"font-mono text-[var(--color-fg-muted)] truncate",children:["/",xe.slug]}),ve&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"â¢"}),r.jsx("span",{children:ve})]})]}),nt&&r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] truncate",children:xe.description})]})}),r.jsxs("div",{className:"relative shrink-0",children:[r.jsxs("button",{type:"button","data-
5066project-menu-button":!0,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",onClick:Ve=>{Ve.stopPropagation(),q(at=>at===xe.id?null:xe.id)},children:[r.jsx(ov,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Project actions"})]}),K===xe.id&&r.jsxs("div",{"data-project-menu-panel":!0,className:"absolute right-0 mt-2 z-20 w-52 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-2 shadow-xl",children:[r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-xs text-left text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:Ve=>{Ve.stopPropagation(),Q(xe.id),q(null)},children:["Copy project ID",r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:L===xe.id?"Copied":""})]}),r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-xs text-left text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:Ve=>{Ve.stopPropagation(),le(xe.id,xe.slug),q(null)},children:["Copy slug",r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:O===xe.id?"Copied":""})]}),r.jsx("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:Ve=>{Ve.stopPropagation(),q(null),J(`/projects/${xe.id}`)},children:"View keys"}),r.jsx("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)]",onClick:Ve=>{Ve.stopPropagation(),q(null),fe(xe.id)},disabled:X===xe.id,children:X===xe.id?"Deletingâ¦":"Delete project"})]})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px]",children:[r.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1 text-[var(--color-fg-default)]",children:De}),r.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1 text-[var(--color-fg-default)]",children:ct}),r.jsx("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1 text-[var(--color-fg-default)]",children:rt})]}),vt&&r.jsx("div",{className:"inline-flex w-fit items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[12px] text-[var(--color-fg-default)]",children:vt}),r.jsxs("div",{className:"mt-auto pt-1 flex items-center justify-end gap-2",children:[(he==null?void 0:he.label)&&r.jsx(dt,{className:`${B}
5066 h-10 px-4 text-xs`,to:he.to,onClick:Ve=>Ve.stopPropagation(),children:he.label}),r.jsx(dt,{className:`${$} h-10 px-4 text-xs`,to:`/projects/${xe.id}`,onClick:Ve=>Ve.stopPropagation(),children:"Open"})]})]})]},xe.id)})}):r.jsxs("div",{className:"space-y-10",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-lg sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)]",children:[r.jsxs("div",{className:"absolute inset-0 pointer-events-none","aria-hidden":"true",children:[r.jsxs("svg",{className:"absolute inset-0 w-full h-full",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("defs",{children:r.jsx("pattern",{id:"grid-dots",width:"24",height:"24",patternUnits:"userSpaceOnUse",children:r.jsx("circle",{cx:"2",cy:"2",r:"1",fill:"rgba(255,255,255,0.06)"})})}),r.jsx("rect",{width:"100%",height:"100%",fill:"url(#grid-dots)"})]}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[400px] h-[400px] bg-indigo-500/10 rounded-full blur-[100px]"})]}),r.jsxs("div",{className:"relative px-5 sm:px-6 py-12 sm:py-16 md:py-20 flex flex-col items-center text-center",children:[r.jsx("div",{className:"mb-6 flex h-16 w-16 items-center justify-center rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsx(Ype,{className:"h-8 w-8 text-[var(--color-fg-muted)]"})}),r.jsx("h2",{className:"text-xl font-semibold text-[var(--color-fg-default)] mb-2",children:"No projects yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-md mb-6",children:"Create your first project to get started with collections, users, and request logs."}),r.jsxs("div",{className:"flex flex-col items-center gap-3",children:[r.jsx("button",{type:"button",className:`${$} h-11 px-6 text-sm`,onClick:()=>k(!0),children:"Create project"}),r.jsx(dt,{to:"/templates",className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-secondary)] transition",children:"or start from a template"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-secondary)]",children:"Quick starts"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs(dt,{to:"/templates?category=productivity",className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-secondary)] transition",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsx(Dr,{className:"h-5 w-5 text-amber-400"})}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)] group-hover:text-[var(--color-fg-default)] transition",children:"Productivity"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Task lists, notes, and workflow templates."})]}),r.jsxs(dt,{to:"/templates?category=ecommerce",className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-secondary)] transition",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsx(Rn,{className:"h-5 w-5 text-indigo-400"})}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)] group-hover:text-[var(--color-fg-default)] transition",children:"E-commerce"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Products, carts, and order management."})]}),r.jsxs(dt,{to:"/templates?category=social",className:"group rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-secondary)] transition",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsx(ln,{className:"h-5 w-5 text-emerald-400"})}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)] group-hover:text-[var(--color-fg-default)] transition",children:"Social Media"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Posts, comments, and user interactions."})]})]})]})]}),we()]})}const F$=e=>e>=500?"error":e>=400?"warn":"success",B$=e=>e==="success"?"bg-emerald-100 dark:bg-emerald-500/10 text-emerald-700 dark:text-emerald-600 dark:text-emerald-200 border border-emerald-200 dark:border-emerald-400/10":e==="warn"?"bg-amber-100 dar
5066k:bg-amber-500/10 text-amber-700 dark:text-amber-600 dark:text-amber-200 border border-amber-200 dark:border-amber-400/10":"bg-rose-100 dark:bg-rose-500/10 text-rose-700 dark:text-rose-200 border border-rose-200 dark:border-rose-400/10",q$=e=>e<=10?"bg-emerald-100 dark:bg-emerald-500/10 text-emerald-700 dark:text-emerald-600 dark:text-emerald-200 border border-emerald-200 dark:border-emerald-400/10":e<=50?"bg-amber-100 dark:bg-amber-500/10 text-amber-700 dark:text-amber-600 dark:text-amber-200 border border-amber-200 dark:border-amber-400/10":"bg-rose-100 dark:bg-rose-500/10 text-rose-700 dark:text-rose-200 border border-rose-200 dark:border-rose-400/10",wTe=e=>e==="success"?"hover:bg-emerald-500/5":e==="warn"?"hover:bg-amber-500/5":"hover:bg-rose-500/5",z$=e=>[401,403,422].includes(Number(e||0)),H$=e=>{if(!e)return"-";const[t]=e.split("?");return t.replace(/^\/api\/(v1\/)?collections\//,"/").replace(/^\/api\/(v1\/)?/,"/").replace(/\/records\//,"/records/").replace(/\/records\/[^/]+/,"/records/:id")},T2=e=>{const[t]=(e||"").split("?");return t.replace(/\/[0-9a-fA-F-]{8,}($|\/)/g,"/:id$1")},NTe=e=>e.app_user_email?e.app_user_email:e.app_user_id?e.app_user_id:e.api_key_id?"Admin key":"Unauthenticated",kTe=e=>e.app_user_id||e.app_user_email?"bg-indigo-100 dark:bg-indigo-500/10 text-indigo-700 dark:text-indigo-100 border border-indigo-200 dark:border-indigo-400/20":e.api_key_id?"bg-[var(--color-bg-alt)] text-[var(--color-fg-secondary)] border border-[var(--color-border-default)]":"bg-[var(--color-bg-code)] text-[var(--color-fg-muted)] border border-[var(--color-border-default)]",V$=e=>{if(e.event)return e.event;const t=e.path||"";return(e.method==="POST"||e.method==="PUT")&&/records/.test(t)?"record.created":(e.method==="PATCH"||e.method==="PUT")&&/records/.test(t)?"record.updated":e.method==="DELETE"&&/records/.test(t)?"record.deleted":"record.read"},STe=e=>{if(!e)return null;const t=e.match(/\/records\/([^/?]+)/);return t?t[1]:null},CTe=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),ETe=e=>{var o;const s=`${typeof window<"u"&&((o=window==null?void 0:window.location)!=null&&o.origin)?window.location.origin:""}${e.path||""}`,n=[];e.api_key_id&&n.push('-H "Authorization: Bearer <project_key>"'),n.push('-H "Content-Type: application/json"');const a=e.request_body&&e.request_body!=="-"?`-d '${e.request_body}'`:"";return[`curl -X ${e.method||"GET"}`,n.join(" "),`'${s}'`,a].filter(Boolean).join(" ")},TTe=e=>e.status>=400||e.method!=="GET"||/\/api\/app-users|\/collections/.test(e.path||""),RTe=e=>{const t=e.path||"",s=e.status,n=t.startsWith("/app/"),a=t.startsWith("/api/");if(s===401){if(n)return{title:"Missing or invalid Bearer token",hint:"/app/* endpoints require an app user session token.",steps:["Log in app user: POST /api/app-users/login with email","Verify and get token: POST /api/app-users/verify","Add header: Authorization: Bearer <session_token>"],exampleCurl:`curl -H "Authorization: Bearer YOUR_SESSION_TOKEN" ${window.location.origin}${t}`,docsUrl:"/docs#app-user-authentication"};if(a)return{title:"Missing or invalid API key",hint:"/api/* endpoints require an x-api-key header.",steps:["Get your API key from the API Keys page","Add header: x-api-key: <your_project_key>","Use manage key for write operations, public key for reads"],exampleCurl:`curl -H "x-api-key: YOUR_API_KEY" ${window.location.origin}${t}`,docsUrl:"/docs#authentication"}}if(s===400&&t.includes("/collections")&&!t.includes("X-Reqres-Env"))return{title:"Missing environment header",hint:"Collection endpoints require X-Reqres-Env header (prod or dev).",steps:["Add header: X-Reqres-Env: prod (or dev)","Or use an environment-scoped API key"],exampleCurl:`curl -H "x-api-key: YOUR_KEY" -H "X-Reqres-Env: prod" ${window.location.origin}${t}`,docsUrl:"/docs#environments"};if(s===403)return{title:"Insufficient permissions",hint:"Your API key may not have the required permissions for this operation.",steps:["Check your key type: public (read), read_write, or manage","Use a manage key for delete operations","Verify the key belongs to the correct project"],docsUrl:"/docs#api-key-permissions"};if(s===404){if(t==="/app/"||t==="/app")return{title:"Invalid endpoint",hint:"/app root is not a valid endpoint. Use /app/collections instead.",steps:["GET /app/me - Get current app user info","G
5066ET /app/collections - List collections","GET /app/collections/:slug/records - List records"],docsUrl:"/docs#app-endpoints"};if(t.includes("/collections/"))return{title:"Collection or record not found",hint:"The collection slug or record ID may be incorrect.",steps:["List collections: GET /api/collections","Verify the slug matches exactly (case-sensitive)","Check you're using the correct environment (prod/dev)"],docsUrl:"/docs#collections"}}return s===429?{title:"Rate limited",hint:"Too many requests. Implement backoff and retry.",steps:["Wait for the Retry-After period","Implement exponential backoff in your client","Consider upgrading for higher limits"],docsUrl:"/docs#rate-limits"}:null},G$=e=>{let t=0;return e.status>=500?t+=6:e.status>=400&&(t+=4),e.method!=="GET"&&(t+=2),/\/api\/app-users|\/collections/.test(e.path||"")&&(t+=1),e.status===304&&(t-=3),t};function ATe(){Mn("Logs");const{getToken:e}=zt(),[t,s]=x.useState([]),[n,a]=x.useState(!1),[o,i]=x.useState(null),[l,c]=x.useState(""),[u,f]=x.useState(""),[h,g]=x.useState(""),[v,y]=Wa(),_=v.get("projectId"),[j,w]=x.useState(_&&!Number.isNaN(Number(_))?Number(_):null),[k,S]=x.useState(""),[E,T]=x.useState(""),[A,R]=x.useState({page:1,limit:50,total:0,pages:1}),[I,L]=x.useState(null),[M,O]=x.useState(null),[z,X]=x.useState(null),[W,K]=x.useState({}),{stats:q}=Aw({projectId:j,enabled:!0}),[J,F]=x.useState(!1),[V,$]=x.useState(!1),[B,ae]=x.useState("none"),[H,U]=x.useState(!1),[oe,fe]=x.useState(!0),[Q,le]=x.useState("request"),Se=x.useRef(!1),[we,Le]=x.useState(null),[xe,de]=x.useState("idle"),[Me,je]=x.useState(null),Ae=Mt.dark,Oe=Jt.primary,Ke=Jt.secondary,ut=Fd.dark,De=async(ie=1,Ce)=>{var Ye;try{a(!0),i(null);const Pe=await Ue(e),Ge=new URLSearchParams,Nt=(Ce==null?void 0:Ce.pathPrefix)??l,Tt=(Ce==null?void 0:Ce.status)??u,ss=(Ce==null?void 0:Ce.since)??h,Zt=(Ce==null?void 0:Ce.method)??k,re=(Ce==null?void 0:Ce.collectionId)??E,G=(Ce==null?void 0:Ce.projectId)??j;Nt&&Ge.set("path_prefix",Nt),Tt&&Ge.set("status",Tt),ss&&Ge.set("since",ss),Zt&&Ge.set("method",Zt),re&&Ge.set("collection_id",re),G&&Ge.set("project_id",String(G)),Ge.set("page",ie.toString());const ge=await ue.get(`/logs?${Ge}`,{authToken:Pe});if(s(ge.data.data||[]),ge.data.pagination&&R({page:ge.data.pagination.page,limit:ge.data.pagination.limit,total:ge.data.pagination.total,pages:ge.data.pagination.pages}),L(ge.data.retention?`Logs limited to ${new Date(ge.data.retention).toLocaleDateString()} onward based on plan.`:null),!Se.current){const ze=!!(Tt||Nt||Zt||re);Z.track("logs_viewed",{env:"prod",project_scoped:!!G,filters_used:ze}),Se.current=!0}}catch(Pe){console.error("Failed to load logs",Pe),Pe instanceof yt&&Z.track("request_failed",{surface:"logs",status_code:Pe.status,error_code:((Ye=Pe.data)==null?void 0:Ye.error)||void 0,path:window.location.pathname}),i("Could not load logs")}finally{a(!1)}};x.useEffect(()=>{De(1)},[j]),x.useEffect(()=>{const ie=v.get("projectId");ie&&!Number.isNaN(Number(ie))&&w(Number(ie))},[v]),x.useEffect(()=>{(async()=>{var Ce,Ye;try{const Pe=await Ue(e);if(!Pe)return;const Nt=((Ye=(Ce=(await ue.get("/clerk/payment-status",{authToken:Pe})).data)==null?void 0:Ce.plan)==null?void 0:Ye.limits)||{};K(Nt)}catch{}})()},[e]),x.useEffect(()=>{(async()=>{var Ce,Ye,Pe;try{const Ge=await Ue(e);if(!Ge)return;const Nt=await ue.get("/api-keys",{authToken:Ge}),Tt=Array.isArray(Nt.data)?Nt.data:(Ce=Nt.data)==null?void 0:Ce.data;if(Array.isArray(Tt)){const ss=((Ye=Tt.find(Zt=>(Zt==null?void 0:Zt.permissions)==="read_only"&&(Zt==null?void 0:Zt.api_key)))==null?void 0:Ye.api_key)||((Pe=Tt[0])==null?void 0:Pe.api_key)||null;Le(ss)}}catch(Ge){console.warn("API key fetch failed for logs",Ge)}})()},[e]);const[ct,rt]=x.useState(null),[mt,vt]=x.useState(null);x.useEffect(()=>{if(!j){rt(null),vt(null);return}(async()=>{var Ce;try{const Ye=await Ue(e);if(!Ye)return;const Ge=(Ce=(await ue.get("/projects?limit=100",{authToken:Ye})).data.projects)==null?void 0:Ce.find(Nt=>Nt.id===j);Ge&&(rt(Ge.public_api_key||null),vt(Ge.slug||null))}catch(Ye){console.warn("Project key fetch failed",Ye)}})()},[e,j]);const gt=async()=>{const ie=ct||we;if(!ie){je("Add a Public or read-only API key first.");return}de("loading"),je(null);try{const Ce=await fetch(ve,{headers:{"Content-Type":"application/json","x-api-key":ie}}),Ye=await Ce.text();let Pe=null;try{Pe=Ye?JSON.parse(Ye):null}catch{Pe=Ye||null}if(!Ce.ok){const Ge=(Pe==null?void 0:Pe.error)||(Pe==null?void 0:Pe.message)||`Request failed with status ${Ce.status}`;throw new Error(Ge)}de("success"),it.success("Request sent. Check logs in a moment."),Z.logsEmptyCtaClicked({project_id:j,cta_type:"send_test"}),setTimeout(()=>De(1),1e3)}catch(Ce){const Ye=(Ce==null?void 0:Ce.message)||(Ce instanceof Error?Ce.message:"Request failed unexpectedly");je(Ye),de("error"),it.error(Ye)}},Be=ct||we||"<your_api_key>",ve="https://reqres.in/api/users?page=2",be=()=>{const ie=`curl -H "x-api-key: ${Be}" ${ve}`;navigator.clipboard.writeText(ie),it.success("cURL copied to clipboard"),Z.logsEmptyCtaClicked({project_id:j,cta_type:"copy_curl"})},nt=()=>{const ie=`fetch('${ve}', { 5067 headers: { 'x-api-key': '${Be}' } 5068}) 5069 .then(res => res.json()) 5070 .then(data => console.log(data));`;navigator.clipboard.writeText(ie),it.success("fetch() copied to clipboard"),Z.logsEmptyCtaClicked({project_id:j,cta_type:"copy_fetch"})}
5070,Ze=async ie=>{const Ce=ie.id??ie.request_id,Ye=Ce==null?void 0:Ce.toString().trim();if(!Ye){X("Log detail unavailable: missing log id."),F(!0),O(ie);return}try{X(null),$(!0),O(ie),F(!0);const Pe=await Ue(e),Ge=await ue.get(`/logs/${Ye}`,{authToken:Pe});O(Ge.data.data),le("request"),Z.track("logs_row_viewed",{log_id:Ye,project_id:Ge.data.data.project_id??null,status:Ge.data.data.status})}catch(Pe){console.error("Failed to load log detail",Pe),X("Could not load log detail")}finally{$(!1)}},he=()=>{O(null),X(null),F(!1),$(!1)},ke=x.useMemo(()=>!!(l||u||h||k||E||B!=="none"||!oe),[E,oe,k,l,B,h,u]),Ve=x.useMemo(()=>{const ie=Date.now();return t.filter(Ce=>{if(oe&&Ce.status===304||B==="errors"&&Ce.status<400||B==="writes"&&!["POST","PUT","PATCH","DELETE"].includes(Ce.method)||B==="auth"&&![401,403].includes(Number(Ce.status||0))||B==="rateLimits"&&Number(Ce.status)!==429)return!1;if(B==="recent"){const Ye=new Date(Ce.created_at).getTime();if(Number.isFinite(Ye)&&ie-Ye>15*60*1e3)return!1}return!0})},[oe,t,B]),at=x.useMemo(()=>{const ie=oe&&!ke,Ce=[...Ve];return ie?Ce.sort((Ye,Pe)=>{const Ge=G$(Pe)-G$(Ye);return Ge!==0?Ge:new Date(Pe.created_at).getTime()-new Date(Ye.created_at).getTime()}):Ce.sort((Ye,Pe)=>new Date(Pe.created_at).getTime()-new Date(Ye.created_at).getTime())},[oe,Ve,ke]),Pt=x.useMemo(()=>{if(!h)return Date.now()-24*60*60*1e3;const ie=new Date(h).getTime();return Number.isFinite(ie)?ie:null},[h]),Ct=x.useMemo(()=>t.filter(ie=>{if(!Pt)return!0;const Ce=new Date(ie.created_at).getTime();return Number.isFinite(Ce)?Ce>=Pt:!0}),[Pt,t]),St=x.useMemo(()=>{let ie=0,Ce=0,Ye=0;const Pe=[];Ct.forEach(Zt=>{Zt.status>=400&&(ie+=1),[401,403].includes(Number(Zt.status||0))&&(Ce+=1),Number(Zt.status)===429&&(Ye+=1),Number.isFinite(Zt.latency_ms)&&Pe.push(Zt.latency_ms)});const Ge=[...Pe].sort((Zt,re)=>Zt-re),Nt=Math.max(0,Math.floor(Ge.length*.95)-1),Tt=Ge[Nt]||0,ss=Ge.length?Math.round(Ge.reduce((Zt,re)=>Zt+re,0)/Ge.length):0;return{total:Ct.length,errors:ie,authIssues:Ce,rateLimits:Ye,latency:Tt||ss||0,latencyLabel:Ge.length>=10?"Slowest p95":"Avg latency",windowLabel:h?"current filter window":"last 24h sample"}},[Ct,h]),Xt=x.useMemo(()=>{const ie=new Map;return at.forEach(Ce=>{const Ye=T2(Ce.path);ie.set(Ye,(ie.get(Ye)||0)+1)}),ie},[at]),It=M?STe(M.path):null,ee=x.useMemo(()=>{if(!M)return null;const ie=new URLSearchParams;return M.project_id&&ie.set("projectId",String(M.project_id)),M.collection_id&&ie.set("collection_id",String(M.collection_id)),ie.toString()?`/data-explorer?${ie.toString()}`:"/data-explorer"},[M]),We=x.useMemo(()=>{if(!M)return"/logs";const ie=new URLSearchParams,Ce=T2(M.path||"").replace("/:id","");return Ce&&ie.set("path_prefix",Ce),M.project_id&&ie.set("projectId",String(M.project_id)),ie.toString()?`/logs?${ie.toString()}`:"/logs"},[M]),wt=x.useMemo(()=>{const ie=(W==null?void 0:W.logs_payloads)??(W==null?void 0:W.log_payloads)??(W==null?void 0:W.payload_logs)??(W==null?void 0:W.payloads_in_logs);return ie===void 0?!0:!!ie},[W]),_t=B==="errors"?"Errors":B==="writes"?"Writes":B==="auth"?"Auth issues":B==="recent"?"Last 15 minutes":B==="rateLimits"?"Rate limits":null,Ee=(q==null?void 0:q.tier)==="free"?"Upgrade for more requests":"View plan limits",He=(q==null?void 0:q.tier)==="free"?"/upgrade?source=limit_warning":"/billing";return r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8 space-y-6",children:[r.jsx(e1,{label:"Project scope",initialProjectId:j,onSelect:ie=>{w(ie);const Ce=new URLSearchParams(v);ie?Ce.set("projectId",String(ie)):Ce.delete("projectId"),y(Ce)}}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Logs"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Inspect traffic, auth issues, and errors across your projects."})]}),q&&q.limit!==null?r.jsx(uR,{label:"Project usage",used:q.used,limit:q.limit,resetAt:q.resetAt,ctaLabel:Ee,ctaHref:He,ctaSource:q.tier==="free"?"limit_warning":void 0,surface:"logs",tier:q.tier}):null,r.jsxs("div",{className:`${Ae} space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs uppercase tracking-[0.08em] text-[var(--color-fg-muted)]",children:"Insights"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Based on ",St.windowLabel," (current page)"]})]}),r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["High-signal view ",oe?"on":"off"]})]}
5070),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Total requests"}),r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:St.total})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Errors"}),r.jsx("p",{className:"text-lg font-semibold text-rose-600 dark:text-rose-100",children:St.errors})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Auth issues"}),r.jsx("p",{className:"text-lg font-semibold text-amber-600 dark:text-amber-100",children:St.authIssues})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Rate limits"}),r.jsx("p",{className:"text-lg font-semibold text-blue-600 dark:text-blue-100",children:St.rateLimits})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:St.latencyLabel}),r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:St.latency?`${St.latency} ms`:"-"})]})]})]}),r.jsxs("div",{className:`${Ae} space-y-4`,children:[r.jsxs("div",{className:"flex flex-wrap gap-2 text-[11px]",children:[r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-rose-400/60 hover:bg-rose-500/10 transition",onClick:()=>{ae("errors"),fe(!0),Z.track("logs_quick_filter_clicked",{filter:"errors"})},children:"Errors"}),r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-amber-300/60 hover:bg-amber-500/10 transition",onClick:()=>{ae("auth"),fe(!0),Z.track("logs_quick_filter_clicked",{filter:"auth"})},children:"Auth issues"}),r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-blue-400/60 hover:bg-blue-500/10 transition",onClick:()=>{ae("rateLimits"),fe(!0),Z.track("logs_quick_filter_clicked",{filter:"rate_limits"})},children:"Rate limits"}),r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-emerald-300/60 hover:bg-emerald-500/10 transition",onClick:()=>{ae("writes"),fe(!0),Z.track("logs_quick_filter_clicked",{filter:"writes"})},children:"Writes"}),r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-emerald-300/60 hover:bg-emerald-500/10 transition",onClick:()=>{const ie=new Date(Date.now()-9e5).toISOString().slice(0,16);g(ie),ae("recent"),fe(!0),Z.track("logs_quick_filter_clicked",{filter:"last_15_minutes"}),De(1,{since:ie})},children:"Last 15 minutes"}),r.jsx("button",{type:"button",className:"px-3 py-1.5 rounded-full border border-[var(--color-border-default)] bg-transparent text-[var(--color-fg-secondary)] hover:border-[var(--color-fg-muted)] transition",onClick:()=>{ae("none"),fe(!1),g(""),Z.track("logs_quick_filter_clicked",{filter:"show_all"}),De(1,{since:""})},children:"Show all"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsx("button",{type:"button",className:"w-full text-left",onClick:()=>U(ie=>!ie),children:r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Filters"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Path, status, method, collection, time"})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:H?"Hide":"Show"})]})}),H&&r.jsxs("div",{className:"p-4 grid gap-3 md:grid-cols-4 md:items-end",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)]",children:"Path prefix"}
5070),r.jsx(Is,{placeholder:"e.g. /api/custom",value:l,onChange:ie=>c(ie.target.value),className:ut})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)]",children:"Method"}),r.jsxs(xi,{value:k||"__any__",onValueChange:ie=>S(ie==="__any__"?"":ie),children:[r.jsx(Wo,{className:`${ut} w-full`,children:r.jsx(vi,{placeholder:"Any"})}),r.jsxs(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:[r.jsx(yr,{value:"__any__",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"Any"}),r.jsx(yr,{value:"GET",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"GET"}),r.jsx(yr,{value:"POST",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"POST"}),r.jsx(yr,{value:"PUT",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"PUT"}),r.jsx(yr,{value:"PATCH",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"PATCH"}),r.jsx(yr,{value:"DELETE",className:"text-[var(--color-fg-secondary)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:"DELETE"})]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)]",children:"Status"}),r.jsx(Is,{placeholder:"e.g. 200",value:u,onChange:ie=>f(ie.target.value),className:ut})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)]",children:"Collection ID"}),r.jsx(Is,{placeholder:"collection uuid",value:E,onChange:ie=>T(ie.target.value),className:ut})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-[var(--color-fg-muted)]",children:"Since"}),r.jsx(Is,{type:"datetime-local",placeholder:"Since",value:h,onChange:ie=>g(ie.target.value),className:ut})]}),r.jsxs("div",{className:"md:col-span-4 flex gap-2 md:justify-end",children:[r.jsx("button",{type:"button",onClick:()=>De(1),className:`${Oe} w-full md:w-auto`,children:"Apply"}),r.jsx("button",{type:"button",className:`${Ke} w-full md:w-auto`,onClick:()=>{c(""),f(""),g(""),S(""),T(""),ae("none"),fe(!0),De(1,{pathPrefix:"",status:"",since:"",method:"",collectionId:""})},children:"Reset"})]})]})]})]}),n&&r.jsx("div",{className:`${Ae} flex items-center justify-center`,children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading logs..."})}),I&&r.jsx("div",{className:`${Ae} text-xs text-[var(--color-fg-secondary)]`,children:I}),W&&Object.keys(W).length>0&&r.jsxs("div",{className:`${Ae} text-xs text-[var(--color-fg-secondary)]`,children:["Plan limits: requests/day ",W.requests_per_day??"-",", logs retention ",W.logs_retention_days??"-"," days."]}),o&&r.jsx("div",{className:`${Ae} text-sm text-[var(--color-fg-secondary)]`,children:o}),!n&&!o&&r.jsxs("div",{className:`${Ae} overflow-x-auto`,children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-3 py-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"flex-1 min-w-[200px]",children:["Showing ",at.length," of ",t.length," on this page",_t?` · ${_t}`:"",oe?" · High-signal (304 GETs hidden)":" · Showing all"]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",className:`${Ke} text-[11px]`,onClick:()=>{fe(!oe),oe&&Z.track("logs_quick_filter_clicked",{filter:"show_all"})},children:oe?"Show all":"High-signal view"}),B!=="none"&&r.jsx("button",{type:"button",className:`${Ke} text-[11px]`,onClick:()=>{ae("none"),fe(!0),g(""),De(1,{since:""})},children:"Clear preset"})]})]}),r.jsxs("table",{className:"min-w-full text-xs text-[var(--color-fg-secondary)]",children:[r.jsx("thead",{className:"text-left text-xs text-[var(--color-fg-muted)]",children:r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 px-3 font-medium",children:"Request"}),r.jsx("th",{className:"py-2 px-3 font-medium",children:"Status"}),r.jsx("th",{className:"py-2 px-3 font-medium",children:"Latency"}),r.jsx("th",{className:"py-2 px-3 font-medium",children:"Time"}),r.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"View"})]})}),r.jsx("tbody",{className:"divide-y divide-[var(--color-border-default)]",children:at.map(ie=>
5070{const Ce=F$(ie.status),Ye=q$(ie.latency_ms||0),Pe=H$(ie.path),Ge=Xt.get(T2(ie.path))||0,Nt=NTe(ie),Tt=Number(ie.status)===304;return r.jsxs("tr",{className:`transition ${wTe(Ce)} ${Tt?"opacity-60":""}`,children:[r.jsx("td",{className:"py-3 px-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"rounded px-2 py-1 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] text-2xs font-mono uppercase",children:ie.method}),r.jsxs("div",{className:"space-y-1 min-w-0",children:[r.jsx("div",{className:"font-mono text-sm text-[var(--color-fg-default)] truncate",title:ie.path,children:Pe}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"inline-flex items-center rounded-full bg-[var(--color-bg-alt)] px-2 py-0.5",children:V$(ie)}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] ${kTe(ie)}`,children:Nt}),z$(ie.status)&&r.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/40 bg-amber-500/10 px-2 py-0.5 text-amber-600 dark:text-amber-100",children:"Auth hint"}),Ge>1&&r.jsxs("span",{className:"inline-flex items-center rounded-full bg-[var(--color-bg-alt)] px-2 py-0.5",children:["Ã",Ge," similar"]}),TTe(ie)&&!Tt&&r.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-500/10 px-2 py-0.5 text-emerald-600 dark:text-emerald-100",children:"Signal"})]})]})]})}),r.jsx("td",{className:"py-3 px-3",children:r.jsxs("span",{className:`rounded px-2 py-1 text-2xs ${B$(Ce)} ${Tt?"text-[10px] opacity-80":""}`,children:[ie.status,Number(ie.status)===429&&r.jsx("span",{className:"ml-1 text-blue-600 dark:text-blue-100",children:"Rate limit"}),z$(ie.status)&&r.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-100",children:"Auth"})]})}),r.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:r.jsxs("span",{className:`inline-flex items-center rounded px-2 py-1 text-2xs ${Ye}`,children:[ie.latency_ms||0," ms"]})}),r.jsxs("td",{className:"py-3 px-3 whitespace-nowrap",children:[r.jsx("div",{className:"text-sm text-[var(--color-fg-default)]",children:CTe(ie.created_at)}),r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:new Date(ie.created_at).toLocaleDateString()})]}),r.jsx("td",{className:"py-3 px-3 text-right",children:r.jsx("button",{type:"button",className:`${Ke} text-xs`,onClick:()=>Ze(ie),children:"View"})})]},ie.id)})})]}),at.length===0&&r.jsxs("div",{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("div",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"No logs yet"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-md mx-auto",children:"Send your first request to see it appear here. Use the button below or copy a snippet."})]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[r.jsx("button",{type:"button",onClick:gt,disabled:!we||xe==="loading",className:`${Oe} px-4 py-2`,children:xe==="loading"?"Sending...":"Send test request"}),r.jsx("button",{type:"button",onClick:be,className:`${Ke} px-4 py-2`,children:"Copy cURL"}),r.jsx("button",{type:"button",onClick:nt,className:`${Ke} px-4 py-2`,children:"Copy fetch()"})]}),xe==="success"&&r.jsx("div",{className:"text-center text-sm text-emerald-600 dark:text-emerald-200",children:"Request sent. Logs will appear shortly."}),Me&&r.jsx("div",{className:"text-center text-sm text-amber-600 dark:text-amber-200",children:Me}),!we&&r.jsxs("div",{className:"text-center text-xs text-[var(--color-fg-muted)]",children:[r.jsx("a",{href:"/api-keys",className:"text-indigo-600 dark:text-indigo-300 hover:text-indigo-200 underline",children:"Create an API key"})," ","to send a test request from this page."]}),r.jsxs("div",{className:"border-t border-[var(--color-border-default)] pt-4 space-y-2",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] text-center",children:"Example code:"}),r.jsx("div",{className:"max-w-lg mx-auto",children:r.jsx(Go,{code:`curl -H "x-api-key: ${Be}" \\ 5071 ${ve}`,language:"bash",className:"text-[11px]"})})]}),r.jsxs("details",{className:"border-t border-[var(--color-border-default)] pt-4 max-w-md mx-auto",children:[r.jsx("summary",{className:"text-xs text-[var(--color-fg-muted)] curs
5071or-pointer hover:text-[var(--color-fg-muted)]",children:"Common mistakes to avoid"}),r.jsxs("div",{className:"mt-3 space-y-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsxs("div",{className:"flex gap-2 items-start p-2 rounded bg-[var(--color-bg-alt)] border border-[var(--color-border-default)]",children:[r.jsx("span",{className:"text-amber-600 dark:text-amber-400 font-mono shrink-0",children:"401"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:"/app/* endpoints"})," need"," ",r.jsx("code",{className:"text-emerald-600 dark:text-emerald-300",children:"Authorization: Bearer session_token"})]})]}),r.jsxs("div",{className:"flex gap-2 items-start p-2 rounded bg-[var(--color-bg-alt)] border border-[var(--color-border-default)]",children:[r.jsx("span",{className:"text-amber-600 dark:text-amber-400 font-mono shrink-0",children:"401"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:"/api/* endpoints"})," need"," ",r.jsx("code",{className:"text-emerald-600 dark:text-emerald-300",children:"x-api-key: your_key"})]})]})]})]})]}),A.pages>1&&r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-xs text-[var(--color-fg-secondary)]",children:[r.jsx("button",{type:"button",className:`${Ke} disabled:opacity-50`,disabled:A.page<=1,onClick:()=>De(A.page-1),children:"Prev"}),r.jsxs("span",{children:["Page ",A.page," of ",A.pages," (",A.total," ","total)"]}),r.jsx("button",{type:"button",className:`${Ke} disabled:opacity-50`,disabled:A.page>=A.pages,onClick:()=>De(A.page+1),children:"Next"})]})]}),J&&M&&r.jsx("div",{className:"fixed inset-0 z-40 flex items-start justify-end bg-[var(--color-overlay)] backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-xl h-full bg-[var(--color-bg-card)] border-l border-[var(--color-border-default)] shadow-xl shadow-2xl overflow-y-auto p-8 pt-20 space-y-5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[r.jsx("span",{className:"rounded px-2 py-1 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)] font-mono uppercase",children:M.method}),r.jsxs("span",{className:`rounded px-2 py-1 text-2xs ${B$(F$(M.status))}`,children:["Status ",M.status]}),r.jsxs("span",{className:`rounded px-2 py-1 text-2xs ${q$(M.latency_ms||0)}`,children:[M.latency_ms||0," ms"]}),M.request_id&&r.jsx("span",{className:"rounded px-2 py-1 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)]",children:M.request_id})]}),r.jsx("div",{className:"text-sm font-semibold text-[var(--color-fg-default)] break-words",children:H$(M.path)}),r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:[new Date(M.created_at).toLocaleString(),M.project_name?` · ${M.project_name}`:""]}),(()=>{var Ye;const ie=RTe(M);if(!ie)return null;const Ce=(Ye=M.path)!=null&&Ye.startsWith("/app/")?"app":"api";return Z.track("logs_fix_suggestion_shown",{status_code:M.status,path_type:Ce,suggestion_type:ie.title}),r.jsxs("div",{className:"rounded-lg border border-amber-400/30 bg-amber-500/10 p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-600 dark:text-amber-200",children:[r.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/50 bg-amber-500/10 px-2 py-0.5 text-[11px]",children:"Fix this"}),ie.title]}),r.jsx("p",{className:"text-[11px] text-amber-600 dark:text-amber-100/80",children:ie.hint}),r.jsx("ul",{className:"text-[11px] text-amber-600 dark:text-amber-100/70 space-y-1 list-disc list-inside",children:ie.steps.map((Pe,Ge)=>r.jsx("li",{children:Pe},Ge))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[ie.exampleCurl&&r.jsx("button",{type:"button",className:"text-[11px] text-amber-600 dark:text-amber-300 hover:text-amber-600 dark:text-amber-200 underline",onClick:()=>{navigator.clipboard.writeText(ie.exampleCurl||""),it.success("Corrected curl copied"),Z.track("logs_fix_copy_clicked",{cta_type:"corrected_curl",status_code:M.status})},children:"Copy corrected curl"}),ie.docsUrl&&r.jsx("a",{href:ie.docsUrl,className:"text-[11px] text-amber-600 dar
5071k:text-amber-300 hover:text-amber-600 dark:text-amber-200 underline",onClick:()=>{Z.track("logs_fix_copy_clicked",{cta_type:"view_docs",status_code:M.status})},children:"View docs"}),M.status===401&&Ce==="app"&&r.jsx("a",{href:"/app-users",className:"text-[11px] text-amber-600 dark:text-amber-300 hover:text-amber-600 dark:text-amber-200 underline",onClick:()=>{Z.track("logs_fix_copy_clicked",{cta_type:"go_to_app_users",status_code:M.status})},children:"Go to App Users â"})]})]})})()]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button",className:`${Ke} text-xs`,onClick:()=>void navigator.clipboard.writeText(ETe(M)),children:"Copy as curl"}),r.jsx("button",{type:"button",className:Ke,onClick:he,children:"Close"})]})]}),z&&r.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:z}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:[M.request_id&&r.jsx("button",{type:"button",className:`${Ke} text-xs`,onClick:()=>{navigator.clipboard.writeText(M.request_id||""),Z.track("copied_request_id",{source:"logs"})},children:"Copy request_id"}),r.jsx("button",{type:"button",className:`${Ke} text-xs`,onClick:()=>{navigator.clipboard.writeText(M.path||""),Z.track("copied_log_path",{source:"logs"})},children:"Copy path"})]}),r.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--color-border-default)] pb-2 text-xs",children:[r.jsx("button",{type:"button",className:`px-3 py-2 rounded ${Q==="request"?"bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border border-[var(--color-border-default)]":"text-[var(--color-fg-muted)]"}`,onClick:()=>le("request"),children:"Request"}),r.jsx("button",{type:"button",className:`px-3 py-2 rounded ${Q==="response"?"bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border border-[var(--color-border-default)]":"text-[var(--color-fg-muted)]"}`,onClick:()=>le("response"),children:"Response"}),r.jsx("button",{type:"button",className:`px-3 py-2 rounded ${Q==="meta"?"bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border border-[var(--color-border-default)]":"text-[var(--color-fg-muted)]"}`,onClick:()=>le("meta"),children:"Meta"})]}),V&&r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)]",children:"Loading details..."}),Q==="request"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Headers"}),r.jsx("div",{className:"rounded border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 text-[11px] text-[var(--color-fg-secondary)]",children:M.request_headers?Object.entries(M.request_headers).map(([ie,Ce])=>r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:[ie,":"]}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:Ce})]},ie)):"No headers captured for this request."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs font-semibold text-[var(--color-fg-secondary)]",children:"Request body"}),r.jsxs("div",{className:"relative",children:[r.jsx(Vt,{title:"Request body",language:"json",code:M.request_body||"-",readMoreHref:"/documentation?section=logs"}),!wt&&r.jsxs("div",{className:"absolute inset-0 rounded-lg bg-[var(--color-bg-card)]/90 backdrop-blur-sm flex flex-col items-center justify-center text-center p-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:"Payload inspection is available on Pro. Upgrade to debug faster."}),r.jsx("a",{href:"/upgrade",className:`${Oe} mt-3`,onClick:()=>Z.track("logs_upgrade_clicked_from_payload_gate"),children:"Upgrade"})]})]})]})]}),Q==="response"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Headers"}),r.jsx("div",{className:"rounded border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 text-[11px] text-[var(--color-fg-secondary)]",children:M.response_headers?Object.entries(M.response_headers).map(([ie,Ce])=>r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:[ie,":"]}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:Ce})]},ie)):"No response headers captured."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs font-semibold text-[var(--color-fg-secondary)]",children:"Response body"}),r.jsxs("div",{className:"relative",children:[r.jsx(Vt,{title:"Response body",language:"json",code:M.response_body||"-",readMoreHref:"/documentation?section=logs"}),!wt&&r.jsxs("div",{className:"absolute inset-0 rounded-lg bg-[var(--color-bg-card)]/90 backdrop-blur-sm flex flex-col items-center justify-center text-center p-4",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:"Payload inspection is available on Pro. Upgrade to debug faster."}),r.jsx("a",{href:"/upgrade",className:`${Oe} mt-3`,onClick:()=>Z.track("logs_upgrade_clicked_from_payload_gate"),children:"Upgrade"})]})]})]})]}),Q==="meta"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-xs text-[var(--color-fg-secondary)]",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Project"}),r.jsx("div",{children:M.project_name?M.project_name:M.project_id||"-"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Endpoint / Collection"}),r.jsxs("div",{children:[M.endpoint_id?`Endpoint ${M.endpoint_id}`:"-"," ","·"," ",M.collection_slug||M.collection_name?M.collection_slug||M.collection_name:M.collection_id?`Collection ${M.collection_id}`:"-"]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"API key"}),r.jsx("div",{children:M.api_key_id?`Key ${M.api_key_id}`:"-"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"App user"}),r.jsx("div",{children:M.app_user_email||M.app_user_id||"-"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"IP"}),r.jsx("div",{children:M.ip||"-"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"User agent"}),r.jsx("div",{className:"break-words",children:M.user_agent||"-"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Event"}),r.jsx("div",{children:V$(M)})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs font-semibold text-[var(--color-fg-secondary)]",children:"Qu
5071ick actions"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[ee&&r.jsx("a",{href:ee,className:`${Ke} text-xs`,target:"_blank",rel:"noreferrer",children:"Open collection"}),It&&r.jsx("a",{href:ee?`${ee}${ee.includes("?")?"&":"?"}record_id=${It}`:M.path||"#",className:`${Ke} text-xs`,target:"_blank",rel:"noreferrer",children:"View record"}),r.jsx("a",{href:We,className:`${Ke} text-xs`,target:"_blank",rel:"noreferrer",children:"View similar logs"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs font-semibold text-[var(--color-fg-secondary)]",children:"Automations / triggers"}),M.triggered_automations&&M.triggered_automations.length>0?r.jsx("div",{className:"space-y-2",children:M.triggered_automations.map((ie,Ce)=>r.jsxs("div",{className:"rounded border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 text-xs text-[var(--color-fg-secondary)]",children:[r.jsx("div",{className:"font-semibold",children:ie.name||ie.type||"Automation"}),r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:ie.target||"-"}),r.jsx("div",{className:"mt-2 inline-flex items-center gap-2 text-[10px]",children:r.jsx("span",{className:"rounded px-2 py-1 bg-[var(--color-bg-alt)] border border-[var(--color-border-default)]",children:ie.status??"Status unknown"})})]},Ce))}):r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)]",children:"No automations were attached to this request."})]})]})]})})]})}const Ah=Mt.dark,HG=Jt.primary,C5=Jt.secondary,CA=od.ctaDark,PTe=ud.dark,ITe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,MTe=new Set(["active","pending"]),OTe="00000000-0000-0000-0000-000000000000";function LTe(){var ct,rt,mt,vt,gt;const{id:e}=Kv(),{getToken:t}=zt(),[s,n]=x.useState(null);Mn((s==null?void 0:s.name)||"Project");const[a,o]=x.useState("prod"),[i,l]=x.useState(!0),[c,u]=x.useState(null),[f,h]=x.useState([]),[g,v]=x.useState([]),[y,_]=x.useState(0),[j,w]=x.useState([]),[k,S]=x.useState([]),[E,T]=x.useState(null),[A,R]=x.useState(null),[I,L]=x.useState(!1),[M,O]=x.useState(null);x.useEffect(()=>{try{const Be=localStorage.getItem("reqres_env_preference");(Be==="dev"||Be==="prod")&&o(Be)}catch{}},[]);const z=x.useCallback(Be=>{o(Be);try{localStorage.setItem("reqres_env_preference",Be)}catch{}},[]),X=x.useCallback(async()=>{var Be,ve,be,nt,Ze,he,ke,Ve,at,Pt,Ct,St,Xt;if(e)try{l(!0),u(null);const It=await Ue(t);if(!It){u("Please sign in to view this project.");return}const We=(await ue.get(`/projects/${e}`,{authToken:It})).data,wt=We.environment_keys||{},_t=((Be=wt.prod)==null?void 0:Be.private)||We.api_key,Ee=((ve=wt.dev)==null?void 0:ve.private)||null,He=a==="dev"&&Ee||_t,ie={"X-Reqres-Env":a,...He?{"x-api-key":He}:{}},Ce=new Date(Date.now()-24*60*60*1e3).toISOString(),[Ye,Pe,Ge,Nt,Tt,ss]=await Promise.all([ue.get(`/api/app-users?project_id=${e}&limit=10`,{authToken:It,env:a,headers:He?{"x-api-key":He,"X-Reqres-Env":a}:{"X-Reqres-Env":a}}).catch(G=>(console.warn("App users fetch failed",G),{data:{data:[]}})),ue.get(`/logs?project_id=${e}&limit=10`,{authToken:It,env:a,headers:ie}).catch(G=>(console.warn("Logs fetch failed",G),{data:{data:[]}})),ue.get(`/data-explorer/collections?project_id=${e}`,{authToken:It,env:a,headers:{"X-Reqres-Env":a}}).catch(G=>(console.warn("Collections fetch failed",G),{data:{data:[]}})),ue.get(`/data-explorer/stats?project_id=${e}`,{authToken:It,env:a,headers:{"X-Reqres-Env":a}}).catch(G=>(console.warn("Stats fetch failed",G),{data:{stats:null}})),ue.get(`/triggers?project_id=${e}&limit=5`,{authToken:It,env:a,headers:{"X-Reqres-Env":a}}).catch(G=>(console.warn("Automations fetch failed",G),{data:{data:[]}})),ue.get(`/logs?project_id=${e}&limit=1&since=${encodeURIComponent(Ce)}`,{authToken:It,env:a,headers:ie}).catch(G=>(console.warn("Logs count fetch failed",G),{data:{data:[],pagination:{total:0}}}))]);n(We),h(((be=Ye==null?void 0:Ye.data)==null?void 0:be.data)||[]),v(((nt=Pe==null?void 0:Pe.data)==null?void 0:nt.data)||[]);const Zt=typeof((he=(Ze=ss==null?void 0:ss.data)==null?void 0:Ze.pagination)==null?void 0:he.total)=="number"?ss.data.pagination.total:Number((Ve=(ke=ss==null?void 0:ss.data)==null?void 0:ke.pagination)==null?void 0:Ve.total)||(((at=Pe==null?void 0:Pe.data)==null?void 0:at.data)||[]).length;_(Zt);const re=((Pt=Ge==null?void 0:Ge.data)==null?void 0:Pt.data)||[];w(re),T(re.length??0),R(((St=(Ct=Nt==null?void 0:Nt.data)==null?void 0:Ct.stats)==null?void 0:St.totalDataItems)??null),S(((Xt=Tt==null?void 0:Tt.data)==null?void 0:Xt.data)||[])}catch(It){console.error("Failed to load project",It),u("Could not load project")}finally{l(!1)}},[a,t,e]);x.useEffect(()=>{X()},[X]);const W=((ct=j[0])==null?void 0:ct.slug)||"todos",K=x.useMemo(()=>
5071{if(!s)return g;const Be=g.filter(be=>be.project_id!==void 0&&Number(be.project_id)===Number(s.id));if(Be.length)return Be;const ve=s.slug;return ve?g.filter(be=>{var nt;return(nt=be.path)==null?void 0:nt.includes(ve)}):g},[g,s]),q=x.useMemo(()=>f.filter(Be=>ITe.test(Be.email||"")&&MTe.has(Be.status)),[f]),J=(E||0)>0,F=J?K:[],V=x.useMemo(()=>[...F].sort((Be,ve)=>new Date(ve.created_at).getTime()-new Date(Be.created_at).getTime()),[F]),$=x.useMemo(()=>XTe(V),[V]),B=V[0],H=(typeof A=="number"?A:j.reduce((Be,ve)=>Be+(ve.record_count||0),0))>0,U=q.length>0,oe=F.length>0,fe=j.slice(0,4),Q=q.slice(0,3),le=yw({hasProject:!!s,collectionCount:E,totalDataItems:A,appUsers:q,projectLogs:F}),Se=(s==null?void 0:s.environment_keys)||{},we=((rt=Se.prod)==null?void 0:rt.private)||(s==null?void 0:s.api_key)||"",Le=((mt=Se.prod)==null?void 0:mt.public)||(s==null?void 0:s.public_api_key)||"",xe=((vt=Se.dev)==null?void 0:vt.private)||"",de=((gt=Se.dev)==null?void 0:gt.public)||"",Me=a==="dev"&&xe||we,je=a==="dev"&&de||Le,Ae=x.useMemo(()=>{if(!s)return[];const Be=W;return[{key:"create",label:"Create record (admin)",variants:N5({apiKey:Me||s.api_key,slug:Be,projectId:s.id})},{key:"list",label:"List records (admin)",variants:_G({apiKey:Me||s.api_key,slug:Be,projectId:s.id})},{key:"app",label:"Fetch as app user",variants:_A(Be)}]},[Me,W,s]),Oe=s?VTe({projectId:s.id,collectionCount:E||0,hasRecords:H,hasAppUsers:U,hasLogs:oe,primaryCollectionSlug:W}):null,Ke=s&&Oe?[Oe.label!=="View logs"?{label:"View logs",href:`/logs?projectId=${s.id}`}:null,Oe.label!=="API keys"?{label:"API keys",href:"/api-keys"}:null].filter(Be=>!!Be):[],ut=x.useCallback(async()=>{var Be,ve;if(e&&confirm("Delete this project (all collections, records, app users, and automations)? This cannot be undone. If you just want a fresh start, you can restore a free starter project from the dashboard afterwards."))try{L(!0),O(null);const be=await Ue(t);if(!be){O("Please sign in to delete this project."),L(!1);return}await ue.delete(`/projects/${e}`,{authToken:be}),Z.track("project_deleted",{project_id:e,is_starter:((Be=s==null?void 0:s.config)==null?void 0:Be.is_starter)===!0||((ve=s==null?void 0:s.config)==null?void 0:ve.is_starter)==="true",surface:"project_settings"}),window.location.href="/projects"}catch(be){console.error("Failed to delete project",be),O("Failed to delete project.")}finally{L(!1)}},[t,e,s]),De=x.useCallback(async()=>{if(!e)throw new Error("Missing project id.");const Be=await Ue(t);if(!Be)throw new Error("Please sign in to rotate keys.");const ve=await ue.post(`/projects/${e}/regenerate-key`,{},{authToken:Be});return n(ve.data),ve.data},[t,e]);return i?r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-8",children:r.jsx("div",{className:`${Ah} flex items-center justify-center`,children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading projectâ¦"})})}):c||!s?r.jsx("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 py-8",children:r.jsx("div",{className:`${Ah} text-sm text-[var(--color-fg-secondary)]`,children:c||"Project not found"})}):r.jsx($R,{delayDuration:120,children:r.jsxs("div",{className:"max-w-6xl mx-auto px-0 sm:px-6 pt-2 sm:pt-8 pb-8 space-y-10",children:[r.jsx(DTe,{project:s,environment:a,onEnvChange:z,deleting:I,deleteError:M,onDelete:ut}),Oe&&r.jsx($Te,{environment:a,nextStep:Oe,secondaryLinks:Ke}),r.jsx(UTe,{project:s,environment:a,onRegenerateKeys:De,activePublicKey:je,activePrivateKey:Me}),r.jsx(FTe,{projectId:s.id,environment:a,requestsLast24h:y,appUserCount:q.length,collectionCount:E,automations:k,recentUsersPreview:Q,lastRequest:B,appUserIssue:$}),r.jsx(BTe,{project:s,recentCollections:fe,appUsers:q,visibleLogs:F,hasCollections:J,automations:k}),r.jsx(qTe,{project:s,primaryCollectionSlug:W,quickstartExamples:Ae,activePrivateKey:Me,progress:le})]})})}function DTe({project:e,environment:t,onEnvChange:s,deleting:n,deleteError:a,onDelete:o}){const[i,l]=x.useState(!1),[c,u]=x.useState(!1),[f,h]=x.useState(!1);return x.useEffect(()=>{if(!i)return;const g=v=>{const y=v.target;y!=null&&y.closest("[data-project-menu]")||l(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),r.jsx("div",{className:"rounded-lg sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-3 sm:px-4 py-3 md:px-5 md:py-4 shadow-sm",children:r.jsxs("div",{className:"flex flex-col gap-2 sm:gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 sm:hidden",children:[r.jsxs(dt,{to:"/projects",className:`${C5} inline-flex items-center gap-1.5 text-sm`,children:[r.jsx(JC,{className:"w-4 h-4"}),"Back"]}),r.jsx("h1",{className:"text-base font-semibold text-[var(--color-fg-default)] truncate min-w-0",children:e.name}
5071),r.jsxs("div",{className:"relative shrink-0","data-project-menu":!0,children:[r.jsxs("button",{type:"button",className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>l(g=>!g),children:[r.jsx(ov,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Project options"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-11 w-48 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-2 shadow-2xl z-20",children:[r.jsxs("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>fd(String(e.id),u),children:["Copy project ID",c&&r.jsx("span",{className:"ml-2 text-[11px] text-[var(--color-fg-muted)]",children:"Copied"})]}),r.jsxs("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>fd(e.slug,h),children:["Copy slug",f&&r.jsx("span",{className:"ml-2 text-[11px] text-[var(--color-fg-muted)]",children:"Copied"})]}),r.jsx("button",{type:"button",className:"mt-1 w-full rounded-lg px-3 py-2 text-left text-xs font-semibold text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] disabled:opacity-60",onClick:()=>{l(!1),o()},disabled:n,children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx(nl,{className:"w-3.5 h-3.5"}),n?"Deletingâ¦":"Delete project"]})})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2 sm:hidden",children:[r.jsx(W$,{value:t,onChange:s,className:"bg-[var(--color-bg-alt)]"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Data + keys isolated per env"})]}),r.jsxs("div",{className:"hidden sm:grid gap-3 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] md:items-center",children:[r.jsx("div",{className:"flex items-center gap-3 md:justify-self-start",children:r.jsxs(dt,{to:"/projects",className:`${C5} inline-flex items-center gap-2 text-sm`,children:[r.jsx(JC,{className:"w-4 h-4"}),"Back to Projects"]})}),r.jsx("div",{className:"flex justify-center md:justify-self-center",children:r.jsx("div",{className:"inline-flex items-center gap-3 rounded-full bg-[var(--color-bg-alt)] px-3 py-1.5 max-w-full min-w-0",children:r.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[r.jsx("h1",{className:"text-lg font-semibold text-[var(--color-fg-default)] truncate",children:e.name}),r.jsxs("span",{className:"font-mono text-xs text-[var(--color-fg-muted)] shrink-0",children:["/",e.slug]})]})})}),r.jsxs("div",{className:"flex items-start gap-2 md:justify-self-end","data-project-menu":!0,children:[r.jsxs("div",{className:"flex flex-col items-end gap-1",children:[r.jsx(W$,{value:t,onChange:s,className:"bg-[var(--color-bg-alt)]"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Data + keys are isolated per env"})]}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",className:"inline-flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>l(g=>!g),children:[r.jsx(ov,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Project options"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-12 w-48 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-2 shadow-2xl z-20",children:[r.jsxs("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>fd(String(e.id),u),children:["Copy project ID",c&&r.jsx("span",{className:"ml-2 text-[11px] text-[var(--color-fg-muted)]",children:"Copied"})]}),r.jsxs("button",{type:"button",className:"w-full rounded-lg px-3 py-2 text-left text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",onClick:()=>fd(e.slug,h),children:["Copy slug",f&&r.jsx("span",{className:"ml-2 text-[11px] text-[var(--color-fg-muted)]",children:"Copied"})]}),r.jsx("button",{type:"button",className:"mt-1 w-full rounded-lg px-3 py-2 text-left text-xs font-semibold text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] disabled:opacity-60",onClick:()=>{l(!1),o()},disabled:n,children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx(nl,{className:"w-3.5 h-3.5"}),n?"Deletingâ¦":"Delete project"]})})]})]})]})]}),a&&r.jsx("span",{className:"text-[11px] text-[var(--color-semantic-danger)] text-right",children:a})]})})}
5071function $Te({environment:e,nextStep:t,secondaryLinks:s}){return r.jsxs("section",{className:"relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-[var(--color-border-default)]/40 px-4 sm:px-5 py-4 md:px-6 md:py-5 flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-2 -top-1 w-28 h-18 opacity-[0.12]",viewBox:"0 0 240 120",fill:"none",children:[r.jsx("polygon",{points:"65,20 160,10 160,90 65,100",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"65,20 160,10 175,17 80,27",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"160,10 175,17 175,97 160,90",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"80",y1:"42",x2:"145",y2:"37",stroke:"#d4d4c8",strokeWidth:.75,opacity:"0.5"}),r.jsx("line",{x1:"80",y1:"55",x2:"135",y2:"50",stroke:"#d4d4c8",strokeWidth:.75,opacity:"0.5"}),r.jsx("line",{x1:"80",y1:"68",x2:"120",y2:"64",stroke:"#d4d4c8",strokeWidth:.75,opacity:"0.5"})]}),r.jsx("div",{className:"relative z-[1] flex items-center gap-3",children:r.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wide",children:[r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1 text-[var(--color-fg-muted)]",children:"Next step"}),r.jsxs("span",{className:"rounded-full border border-[var(--color-semantic-success)]/30 bg-[var(--color-semantic-success)]/10 px-3 py-1 text-[var(--color-semantic-success)]",children:[e.toUpperCase()," env"]})]})}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] md:text-base md:flex-1 md:px-4",children:t.body}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 md:justify-end",children:[r.jsx(dt,{className:HG,to:t.href,children:t.label}),s.map(n=>r.jsx(dt,{to:n.href,className:"text-[12px] font-medium text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] underline-offset-2 hover:underline transition",children:n.label},n.label))]})]})}function UTe({project:e,environment:t,onRegenerateKeys:s,activePublicKey:n,activePrivateKey:a}){const[o,i]=x.useState(!1),[l,c]=x.useState(!1),[u,f]=x.useState(!1),[h,g]=x.useState(!1),[v,y]=x.useState(!1),[_,j]=x.useState(!1),[w,k]=x.useState(null),[S,E]=x.useState(null),[T,A]=x.useState(!1),R=async()=>{if(confirm("Rotate this project's manage/public keys? Existing deployments using the old keys will need updates."))try{j(!0),k(null),E(null);const M=await s();i(!0),c(!1),f(!1),g(!1),y(!1),k(M.message||"New project keys generated. Update your environments.")}catch(M){console.error("Failed to regenerate project keys",M),E((M==null?void 0:M.message)||"Failed to regenerate keys")}finally{j(!1)}},I=[a,n].filter(Boolean).length;return r.jsxs("section",{className:`${Ah} p-4 sm:p-5 md:p-6 space-y-5`,children:[r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[r.jsx("div",{className:"flex items-start gap-3 min-w-0",children:r.jsxs("div",{className:"space-y-1.5 min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-[var(--color-fg-default)] break-all",children:e.name}),e.organization_name&&r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-indigo-400/40 bg-indigo-500/10 px-3 py-1 text-xs font-medium text-indigo-100",children:["Org: ",e.organization_name]}),r.jsxs("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2 sm:px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-default)]",children:[t.toUpperCase()," env"]}),r.jsxs(dt,{to:`/console?project_id=${e.id}`,className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-500/30 bg-indigo-500/10 px-3 py-1 text-xs font-medium text-indigo-300 hover:bg-indigo-500/20 hover:border-indigo-500/40 transition-all",children:[r.jsx(mo,{className:"h-3.5 w-3.5"}),"Open Console"]})]}),r.jsxs("p",{className:"font-mono text-sm text-[var(--color-fg-muted)]",children:["/",e.slug]}),e.description&&r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] max-w-3xl leading-relaxed",children:e.description})]})}),r.jsxs("div",{className:"text-right space-y-1",children:[r.jsx("p",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Keys ready"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-default)]",children:[I||0," active key",I===1?"":"s"," in this env"]})]})]}),r.jsxs("div",{className:"rounded-xl sm:rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] w-full",children:[r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 sm:gap-3 px-3 sm:px-5 py-3 sm:py-4 text-left",onClick:()=>A(M=>!M),children:[r.jsxs("div",{className:"space-y-0.5 min-w-0",children:[r.jsxs("p",{className:"text-sm sm:text-base font-semibold text-[var(--color-fg-default)]",children:["Access, API keys",r.jsx("span",{className:"hidden sm:inline",children:" & credentials"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] truncate",children:"Keys for this environment (Public + Manage)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-default)]",children:t.toUpperCase()}),r.jsx(sr,{className:`h-4 w-4 text-[var(--color-fg-muted)] transition-transform ${T?"rotate-180":""}`})]})]}),T&&r.jsxs("div",{className:"border-t border-[var(--color-border-default)] px-3 sm:px-5 py-4 sm:py-5 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1.5",children:"Public key = safe for browser reads"}),r.jsx("span",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1.5",children:"Manage key = server/admin only"}),r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1.5",children:["Headers use ",r.jsx("code",{className:"text-[var(--color-semantic-warning)]",children:"x-api-key"})]})]}),r.jsxs("div",{className:"grid gap-3 w-full lg:grid-cols-2",children:[n&&r.jsxs("div",{className:"inline-flex flex-col gap-2 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 sm:px-4 py-3 h-full",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("span",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Public (browser safe)"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"For app reads + login flow"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>fd(`x-api-key: ${n}`,f),children:[r.jsx(is,{className:"w-3 h-3"}),u?"Copied":"Copy header"]}),r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>fd(n,y),children:[r.jsx(is,{className:"w-3 h-3"}),v?"Copied":"Copy key"]})]})]}),r.jsx("div",{className:"font-mono text-[12px] text-[var(--color-fg-default)] break-all",children:Y$(n)})]}),a&&r.jsxs("div",{className:"inline-flex flex-col gap-2 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 sm:px-4 py-3 h-full",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("span",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Manage (server/admin)"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Writes, rotations, and admin-only calls"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>i(!o),children:o?r.jsxs(r.Fragment,{children:[r.jsx(bh,{className:"w-3 h-3"})," Hide"]}):r.jsxs(r.Fragment,{children:[r.jsx(za,{className:"w-3 h-3"})," Reveal"]})}),r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>fd(`x-api-key: ${a}`,c),children:[r.jsx(is,{className:"w-3 h-3"}),l?"Copied":"Copy header"]}),r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:()=>fd(a,g),children:[r.jsx(is,{className:"w-3 h-3"}),h?"Copied":"Copy key"]}),r.jsx("button",{type:"button",className:"inline-flex items-center gap-1 whitespace-nowrap text-[11px] font-medium text-[var(--color-semantic-warning)] hover:text-[var(--color-semantic-warning)] disabled:opacity-60 cursor-pointer",disabled:_,onClick:R,children:_?"Rotatingâ¦":"Regenerate"})]})]}),r.jsx("div",{className:"font-mono text-[12px] text-[var(--color-fg-default)] break-all",children:o?a:Y$(a)})]})]}),(w||S)&&r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:[w&&r.jsx("span",{className:"text-[var(--color-semantic-success)]",children:w}),S&&r.jsx("span",{className:"text-[var(--color-semantic-danger)]",children:S})]})]})]})]})}function FTe({projectId:e,environment:t,requestsLast24h:s,recentUsersPreview:n,appUserCount:a,collectionCount:o,automations:i,lastRequest:l,appUserIssue:c}){var h;const u=[{title:"Requests (24h)",value:s,description:s?"In the last day":"No calls yet"}
5071,{title:"App users",value:a,description:a?((h=n[0])==null?void 0:h.email)||"Active users":"Invite one to test"},{title:"Collections",value:o??0,description:o&&o>0?"Schemas live":"Add a collection"},{title:"Automations",value:i.length,description:i.length?"Triggers live":"Create when ready"}],f=u.every(g=>g.value===0);return r.jsxs("section",{className:`${Ah} p-4 sm:p-5 md:p-6 space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:["Health",r.jsx("span",{className:"hidden sm:inline",children:" (this environment)"})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:[t.toUpperCase()," snapshot"]})]}),r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-default)]",children:t.toUpperCase()})]}),l&&r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Last request: ",new Date(l.created_at).toLocaleString()]}),f?r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:u.map(g=>r.jsx(WTe,{title:g.title,value:g.value,description:g.description},g.title))}):r.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:u.map(g=>r.jsx(GTe,{title:g.title,value:g.value,description:g.description},g.title))}),c&&r.jsx("div",{className:"rounded-xl border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] px-4 py-3 text-[var(--color-fg-default)]",children:r.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--color-semantic-warning)]",children:"App user needs help"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-default)]",children:["App user"," ",r.jsx("span",{className:"font-mono",title:c.appUserId,children:JTe(c.appUserId)})," ","hit ",c.errorCount," errors in the last"," ",c.totalCount," requests.",c.samplePath&&r.jsxs(r.Fragment,{children:[" ","Recent error:"," ",c.sampleMethod?`${c.sampleMethod} `:"",c.samplePath,c.sampleStatus?` (${c.sampleStatus})`:"","."]}
5071),c.hasZeroUuid&&r.jsxs(r.Fragment,{children:[" ","Looks like a placeholder record id (00000000...). Use the id returned from create."]})]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-semantic-warning)]",children:["Last seen ",new Date(c.lastSeen).toLocaleString()]})]}),r.jsx(dt,{className:"text-xs font-semibold text-[var(--color-semantic-warning)] hover:text-[var(--color-fg-default)]",to:`/logs?projectId=${e}`,children:"View logs"})]})})]})}function BTe({project:e,recentCollections:t,appUsers:s,visibleLogs:n,hasCollections:a,automations:o}){return r.jsxs("section",{className:`${Ah} p-4 sm:p-5 md:p-6 space-y-4`,children:[r.jsx("div",{className:"flex items-center justify-between gap-3",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Your backend"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Core surfaces for this environment."})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsx(A0,{title:"Data",description:a?"Collections + records":"No collections yet",actionLabel:a?"Open Data Explorer":"Create collection",actionHref:`/data-explorer?projectId=${e.id}`,children:t.length>0?r.jsx("div",{className:"flex flex-wrap gap-2",children:t.slice(0,3).map(i=>r.jsxs("span",{className:"rounded-full bg-[var(--color-bg-hover)] px-3 py-1 text-2xs font-medium text-[var(--color-fg-default)]",children:["/",i.slug||i.name||"collection"]},i.id))}):r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Start with a simple todos schema."})}),r.jsx(A0,{title:"Logs",description:n.length>0?"Recent API calls":a?"Send a test request":"Create a collection to log requests",actionLabel:"View logs",actionHref:`/logs?projectId=${e.id}`,children:n.length>0?r.jsx("div",{className:"space-y-2",children:n.slice(0,2).map(i=>r.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 sm:px-3 py-2 text-xs text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(j_,{method:i.method}),r.jsx("span",{className:"font-mono text-[11px] text-[var(--color-fg-default)] truncate",children:i.path})]}),r.jsx("span",{className:"text-2xs text-[var(--color-fg-muted)] shrink-0",children:new Date(i.created_at).toLocaleTimeString()})]},i.id))}):r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Nothing logged yet."})}),r.jsx(A0,{title:"App users",description:s.length?"Magic-link users":"No app users invited",actionLabel:"Manage users",actionHref:`/app-users?projectId=${e.id}`,children:s.length===0?r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Invite one to preview the app flow."}):r.jsx("div",{className:"space-y-2",children:s.slice(0,3).map(i=>r.jsxs("div",{className:"flex items-center justify-between rounded border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-3 py-2 text-xs text-[var(--color-fg-default)]",children:[r.jsx(dt,{to:`/app-users/${encodeURIComponent(i.id)}?projectId=${e.id}`,className:"font-medium text-[var(--color-fg-default)] hover:text-[var(--color-fg-default)]",children:i.email}),r.jsx("span",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:i.status})]},i.id))})}),r.jsx(A0,{title:"Automations",description:o.length?"Webhooks + triggers":"No automations yet",actionLabel:o.length?"Manage triggers":"Create trigger",actionHref:`/automations?projectId=${e.id}`,children:o.length===0?r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Add webhooks when you need them."}):r.jsx("div",{className:"space-y-2",children:o.slice(0,3).map(i=>r.jsxs("div",{className:"flex items-center justify-between rounded border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-3 py-2 text-xs text-[var(--color-fg-default)]",children:[r.jsx("span",{children:i.event||"Record event"}),r.jsx("span",{className:"text-2xs uppercase tracking-wide text-[var(--color-semantic-success)]",children:i.is_active===!1?"Paused":"Active"})]},i.id))})})]}),!a&&r.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-3 text-xs text-[var(--color-fg-default)]",children:[r.jsx("span",{children:"Want a working example? Spin up the Notes app backend."}),r.jsx(dt,{className:CA,to:Ha,children:"Open example"})]})]})}function A0({title:e,description:t,actionLabel:s,actionHref:n,children:a}){return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 sm:p-4 flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"space-y-0.5 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:e}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:t})]}),r.jsx(dt,{className:"text-[12px] font-semibold text-[var(--color-accent-blue)] hover:text-[var(--color-fg-default)] shrink-0 whitespace-nowrap",to:n,children:s})]}),a]})}function qTe({project:e,primaryCollectionSlug:t,quickstartExamples:s,activePrivateKey:n,progress:a}){const[o,i]=x.useState(!1);return r.jsxs("section",{className:`${Ah} p-4 sm:p-5 md:p-6 space-y-4`,children:[r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between text-left",onClick:()=>i(l=>!l),children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Snippets & integration"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Copy/paste examples when you need them."})]}),o?r.jsx(cd,{className:"w-5 h-5 text-[var(--color-fg-secondary)]"}):r.jsx(sr,{className:"w-5 h-5 text-[var(--color-fg-secondary)]"})]}),o&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(qG,{project:e,className:"max-w-none mx-0",codeBlockClass:PTe,primaryButtonClass:HG,secondaryButtonClass:C5,textCtaClass:CA,progress:a,initialCollapsed:!0}),r.jsx(zTe,{primaryCollectionSlug:t}),r.jsx(HTe,{project:e,primaryCollectionSlug:t,quickstartExamples:s,activePrivateKey:n})]})]})}function zTe({primaryCollectionSlug:e}){return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"API call crib"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"URLs and responses for the core flow."})]}),r.jsx(dt,{className:CA,to:"/documentation",children:"Docs"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(j_,{method:"POST"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Login (x-api-key)"})]}),r.jsx("p",{className:"font-mono text-[11px] text-[var(--color-fg-default)] break-words",children:"https://reqres.in/api/app-users/login"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Headers: x-api-key, JSON body"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-semantic-success)]",children:["â ",'{ token: "<magic_link_token>", expires_in_minutes: 15 }']})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(j_,{method:"POST"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Verify (no key)"})]}),r.jsx("p",{className:"font-mono text-[11px] text-[var(--color-fg-default)] break-words",children:"https://reqres.in/api/app-users/verify"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Headers: content-type: application/json"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-semantic-success)]",children:["â ",'{ session_token: "<session_token>", app_user: { id, email } }']})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(j_,{method:"GET"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--color-fg-muted)]",children:"Collections (Bearer)"})]}),r.jsxs("p",{className:"font-mono text-[11px] text-[var(--color-fg-default)] break-words",children:["https://reqres.in/app/collections/",e||"<slug>","/records"]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Headers: Authorization: Bearer <session_token>"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-semantic-success)]",children:["â ","{ data: [{ id, data: { ... } }] }"]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Admin writes: /api/collections/:slug/records with x-api-key."})]})]})]})}function HTe({project:e,primaryCollectionSlug:t,quickstartExamples:s,activePrivateKey:n}){const[a,o]=x.useState(!1),[i,l]=x.useState(null),[c,u]=x.useState(null),f=s.find(h=>h.key===i)||s[0];return x.useEffect(()=>{s.length&&!i&&l(s[0].key)},[i,s]),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 space-y-3",children:[r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between text-left",onClick:()=>o(h=>!h),children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Developer quickstart"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Code stays hidden until you open it."})]}),a?r.jsx(cd,{className:"w-5 h-5 text-[var(--color-fg-secondary)]"}):r.jsx(sr,{className:"w-5 h-5 text-[var(--color-fg-secondary)]"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 text-2xs text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 sm:px-3 py-1.5 font-mono text-[11px] text-[var(--color-fg-default)] break-all",children:["Admin: ",r.jsx("span",{className:"hidden sm:inline",children:"https://reqres.in"}),"/api/collections"]}),r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 sm:px-3 py-1.5 font-mono text-[11px] text-[var(--color-fg-default)] break-all",children:["App: ",r.jsx("span",{className:"hidden sm:inline",children:"https://reqres.in"}),"/app/collections/",t,"/records"]}),r.jsx("span",{children:"Use x-api-key for admin calls; Bearer app-session for /app/collections."})]}),a&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.length===0?r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:"Add a project to see quickstart snippets."}):s.map(h=>r.jsx("button",{type:"button",className:`rounded-md px-3 py-1.5 text-2xs font-medium transition ${(f==null?void 0:f.key)===h.key?"bg-[var(--color-bg-hover)] text-[var(--color-fg-default)]":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,onClick:()=>l(h.key),children:h.label},h.key))}),f?r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Sample request"}),r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-xs font-medium text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)]",onClick:async()=>{const h=KTe(f.variants);h&&(await navigator.clipboard.writeText(h),u(e.id),setTimeout(()=>u(null),1200))},children:[r.jsx(is,{className:"w-3 h-3"}),c===e.id?"Copied":"Copy"]})]}),r.jsx(Vt,{title:f.label,variants:f.variants,className:"max-h-64 overflow-auto",readMoreHref:"/documentation?section=collections"})]}):r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"No quickstart available yet. Create a collection to unlock snippets."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Implementation examples"}),r.jsx("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 md:p-5 space-y-4",children:r.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 flex flex-col gap-3 h-full",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"App
5071Users"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Magic link â verify â session token."})]}),r.jsx("span",{className:"text-2xs text-[var(--color-fg-muted)]",children:"Auth workflow"})]}),r.jsx(YTe,{tabs:[{key:"login",label:"Login",variants:Ij(e.id)},{key:"verify",label:"Verify",variants:o1()},{key:"collections",label:"Call collections",variants:yG(t)}],className:"flex-1"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 flex flex-col gap-3 h-full",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Starter auth kit (React)"})}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Handles login, verify, session storage."}),r.jsx(Vt,{title:"React auth starter",language:"tsx",code:QTe(e,n),className:"flex-1 max-h-64 overflow-auto",readMoreHref:"/documentation?section=app-users"})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 flex flex-col gap-3 h-full",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"ReqRes UI helper (JS)"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Import `reqresAuth` to drive app-user auth and inject Authorization headers."}),r.jsx(Vt,{title:"Helper usage",language:"ts",code:ZTe(e,n),className:"flex-1 max-h-64 overflow-auto",readMoreHref:"/documentation?section=app-users"})]})]})})]})]})]})}function VTe({projectId:e,collectionCount:t,hasRecords:s,hasAppUsers:n,hasLogs:a,primaryCollectionSlug:o}){return t===0?{label:"Create collection",href:`/data-explorer?projectId=${e}`,body:"Define your first collection to unlock requests, users, and logs."}:s?n?a?{label:"Open Data Explorer",href:`/data-explorer?projectId=${e}`,body:"Review collections, records, and schema updates in one place."}:{label:"View logs",href:`/logs?projectId=${e}`,body:"Send a test request and confirm it lands in logs."}:{label:"Invite app user",href:`/app-users?projectId=${e}`,body:"Send a magic link and verify the app-user session flow."}:{label:"Create first record",href:`/console?project_id=${e}`,body:"Use the Project Console to create a record and try every endpoint."}}function W$({value:e,onChange:t,className:s}){return r.jsx("div",{className:`inline-flex rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-card)] overflow-hidden shadow-inner ${s||""}`,children:["prod","dev"].map(n=>r.jsx("button",{type:"button",onClick:()=>t(n),className:`px-4 py-2 text-[11px] font-semibold uppercase tracking-wide transition ${e===n?"bg-[var(--color-accent-blue)] text-white shadow":"bg-transparent text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:n},n))})}function GTe({title:e,value:t,description:s}){return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 sm:p-4 space-y-1.5",children:[r.jsx("p",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsx("p",{className:"text-2xl sm:text-3xl font-semibold text-[var(--color-fg-default)]",children:t}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:s})]})}function WTe({title:e,value:t,description:s}){return r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("span",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:t}),r.jsxs("div",{className:"flex flex-col leading-tight",children:[r.jsx("span",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:s})]})]})}function YTe({tabs:e,className:t}){var o;const[s,n]=x.useState((o=e[0])==null?void 0:o.key);x.useEffect(()=>{e.length&&!e.find(i=>i.key===s)&&n(e[0].key)},[e,s]);const a=e.find(i=>i.key===s);return a?r.jsxs("div",{className:`rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-2 ${t||""}`,children:[r.jsx("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-border-default)] px-2 pb-2",children:e.map(i=>r.jsx("button",{type:"button",className:`rounded-md px-3 py-1.5 text-2xs font-medium transition ${i.key===s?"bg-[var(--color-bg-hover)] text-[var(--color-fg-default)]":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,onClick:()=>n(i.key),children:i.label},i.key))}),r.jsx(Vt,{title:a.label,variants:a.variants,className:"max-h-72 overflow-auto",readMoreHref:a.key==="collections"?"/documentation?section=collections":"/documentation?section=app-users"})]}):null}function j_({method:e}){var n;const t=((n=e==null?void 0:e.toUpperCase)==null?void 0:n.call(e))||"",s=t==="GET"?"text-[var(--color-semantic-success)] bg-[var(--color-semantic-success-bg)]":t==="POST"?"text-[var(--color-semantic-info)] bg-[var(--color-semantic-info-bg)]":t==="PUT"?"text-[var(--color-semantic-warning)] bg-[var(--color-semantic-warning-bg)]":t==="DELETE"?"text-[var(--color-semantic-danger)] bg-[var(--color-semantic-danger-bg)]":"text-[var(--color-fg-default)] bg-[var(--color-bg-hover)]";return r.jsx("span",{className:`rounded px-2 py-1 text-2xs font-semibold uppercase tracking-wide ${s} border border-[var(--color-border-default)]`,children:t})}function KTe(e,t="curl"){var s;return!e||e.length===0?"":((s=e.find(n=>n.id===t))==null?void 0:s.code)||e[0].code}async function fd(e,t){e&&(await navigator.clipboard.writeText(e),t(!0),setTimeout(()=>t(!1),1200))}function Y$(e){return e?e.length<=8?e:`${e.slice(0,4)}â¢â¢â¢â¢${e.slice(-4)}`:""}function JTe(e){return e?e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`:""}function K$(e){if(!e)return"";const[t]=e.split("?");return t.replace(/\/records\/[0-9a-fA-F-]{8,}/g,"/records/:id").replace(/\/records[0-9a-fA-F-]{8,}/g,"/records/:id").replace(/\/[0-9a-fA-F-]{8,}/g,"/:id")}function XTe(e){var l,c,u;if(!e.length)return null;const t=new Map;e.forEach(f=>{var v;const h=f.app_user_id;if(!h)return;const g=t.get(h)||{total:0,errors:0,lastSeen:f.created_at,lastError:void 0,pathCounts:new Map,hasZeroUu
5071id:!1};if(g.total+=1,g.lastSeen||(g.lastSeen=f.created_at),f.status>=400){g.errors+=1,g.lastError||(g.lastError=f);const y=K$(f.path||"");y&&g.pathCounts.set(y,(g.pathCounts.get(y)||0)+1)}(v=f.path)!=null&&v.includes(OTe)&&(g.hasZeroUuid=!0),t.set(h,g)});let s=null,n=null;if(t.forEach((f,h)=>{f.errors<3||(f.total?f.errors/f.total:0)<.6||(!n||f.errors>n.errors||f.errors===n.errors&&new Date(f.lastSeen).getTime()>new Date(n.lastSeen).getTime())&&(s=h,n=f)}),!s||!n)return null;const a=n;let o="",i=0;return a.pathCounts.forEach((f,h)=>{f>i&&(i=f,o=h)}),{appUserId:s,errorCount:a.errors,totalCount:a.total,lastSeen:a.lastSeen,samplePath:o||K$(((l=a.lastError)==null?void 0:l.path)||""),sampleMethod:(c=a.lastError)==null?void 0:c.method,sampleStatus:(u=a.lastError)==null?void 0:u.status,hasZeroUuid:a.hasZeroUuid}}function QTe(e,t){const s="https://reqres.in",n=t||e.api_key||"your_project_key";return`import { useState, useEffect } from 'react'; 5072import { reqresAuth } from '@reqres/auth'; 5073 5074export function UseAppUserAuth() { 5075 const [email, setEmail] = useState(''); 5076 const [session, setSession] = useState(reqresAuth.getSession()); 5077 const [tokenInput, setTokenInput] = useState(''); 5078 5079 useEffect(() => { 5080 setSession(reqresAuth.getSession()); 5081 }, []); 5082 5083 const login = async () => { 5084 await reqresAuth.login({ 5085 apiBase: '${s}', 5086 projectId: ${e.id}, 5087 projectKey: '${n}', 5088 email, 5089 }); 5090 alert('Magic link sent. Paste the token when it arrives.'); 5091 }; 5092 5093 const verify = async () => { 5094 const sess = await reqresAuth.verify({ apiBase: '${s}', token: tokenInput }); 5095 setSession(sess); 5096 }; 5097 5098 const createRecord = async () => { 5099 // Uses the app-session token; the record is automatically scoped to this app user. 5100 await reqresAuth.fetchWithSession({ 5101 url: '${s}/app/collections/<slug>/records', 5102 method: 'POST', 5103 body: { data: { title: 'Hello from UI' } }, 5104 }); 5105 alert('Record created!'); 5106 }; 5107 5108 return ( 5109 <div> 5110 {session ? ( 5111 <div> 5112 <p>Signed in as {session.email}</p> 5113 <button onClick={createRecord}>Create record</button> 5114 <button onClick={() => { reqresAuth.clearSession(); setSession(null); }}>Log out</button> 5115 </div> 5116 ) : ( 5117 <div> 5118 <input placeholder="email" value={email} onChange={(e) => setEmail(e.target.value)} /> 5119 <button onClick={login}>Send magic link</button> 5120 <input placeholder="magic token" value={tokenInput} onChange={(e) => setTokenInput(e.target.value)} /> 5121 <button onClick={verify}>Verify token</button> 5122 </div> 5123 )} 5124 </div> 5125 ); 5126} 5127`}function ZTe(e,t){const s="https://reqres.in",n=t||e.api_key||"your_project_key";return`import { reqresAuth } from '@reqres/auth'; 5128 5129// Send magic link 5130await reqresAuth.login({ 5131 apiBase: '${s}', 5132 projectId: ${e.id}, 5133 projectKey: '${n}', 5134 email: '[email protected]', 5135}); 5136 5137// Verify token -> session_token stored automatically 5138await reqresAuth.verify({ apiBase: '${s}', token: '<magic_token>' }); 5139 5140// Authenticated fetch with Bearer app-session 5141const records = await reqresAuth.fetchWithSession({ 5142 url: '${s}/app/collections/<slug>/records', 5143 method: 'GET', 5144}); 5145`}function eRe(e){const t=tRe(e),s=x.forwardRef((n,a)=>{const{children:o,...i}=n,l=x.Children.toArray(o),c=l.find(rRe);if(c){const u=c.props.children,f=l.map(h=>h===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:h);return r.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return r.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function tRe(e){const t=x.forwardRef((s,n)=>{const{children:a,...o}=s;if(x.isValidElement(a)){const i=aRe(a),l=nRe(o,a.props);return a.type!==x.Fragment&&(l.ref=n?hc(n,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sRe=Symbol("radix.slottable");function rRe(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sRe}function nRe(e,t){const s={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}
5145:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function aRe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var l1="Dialog",[VG,GG]=bo(l1),[oRe,ji]=VG(l1),WG=e=>{const{__scopeDialog:t,children:s,open:n,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,l=x.useRef(null),c=x.useRef(null),[u,f]=go({prop:n,defaultProp:a??!1,onChange:o,caller:l1});return r.jsx(oRe,{scope:t,triggerRef:l,contentRef:c,contentId:po(),titleId:po(),descriptionId:po(),open:u,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(h=>!h),[f]),modal:i,children:s})};WG.displayName=l1;var YG="DialogTrigger",KG=x.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=ji(YG,s),o=Vs(t,a.triggerRef);return r.jsx(fs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":RA(a.open),...n,ref:o,onClick:Lt(e.onClick,a.onOpenToggle)})});
5145KG.displayName=YG;var EA="DialogPortal",[iRe,JG]=VG(EA,{forceMount:void 0}),XG=e=>{const{__scopeDialog:t,forceMount:s,children:n,container:a}=e,o=ji(EA,t);return r.jsx(iRe,{scope:t,forceMount:s,children:x.Children.map(n,i=>r.jsx(Xo,{present:s||o.open,children:r.jsx(rb,{asChild:!0,container:a,children:i})}))})};XG.displayName=EA;var Mj="DialogOverlay",QG=x.forwardRef((e,t)=>{const s=JG(Mj,e.__scopeDialog),{forceMount:n=s.forceMount,...a}=e,o=ji(Mj,e.__scopeDialog);return o.modal?r.jsx(Xo,{present:n||o.open,children:r.jsx(cRe,{...a,ref:t})}):null});QG.displayName=Mj;var lRe=eRe("DialogOverlay.RemoveScroll"),cRe=x.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=ji(Mj,s);return r.jsx(Gw,{as:lRe,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(fs.div,{"data-state":RA(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),vp="DialogContent",ZG=x.forwardRef((e,t)=>{const s=JG(vp,e.__scopeDialog),{forceMount:n=s.forceMount,...a}=e,o=ji(vp,e.__scopeDialog);return r.jsx(Xo,{present:n||o.open,children:o.modal?r.jsx(dRe,{...a,ref:t}):r.jsx(uRe,{...a,ref:t})})});ZG.displayName=vp;var dRe=x.forwardRef((e,t)=>{const s=ji(vp,e.__scopeDialog),n=x.useRef(null),a=Vs(t,s.contentRef,n);return x.useEffect(()=>{const o=n.current;if(o)return HR(o)},[]),r.jsx(eW,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Lt(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=s.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Lt(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&o.preventDefault()}),onFocusOutside:Lt(e.onFocusOutside,o=>o.preventDefault())})}),uRe=x.forwardRef((e,t)=>{const s=ji(vp,e.__scopeDialog),n=x.useRef(!1),a=x.useRef(!1);return r.jsx(eW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(l=s.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=o.target;((u=s.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),eW=x.forwardRef((e,t)=>{const{__scopeDialog:s,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,l=ji(vp,s),c=x.useRef(null),u=Vs(t,c);return zR(),r.jsxs(r.Fragment,{children:[r.jsx(Hw,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(tb,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":RA(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(fRe,{titleId:l.titleId}),r.jsx(mRe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),TA="DialogTitle",tW=x.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=ji(TA,s);return r.jsx(fs.h2,{id:a.titleId,...n,ref:t})});tW.displayName=TA;var sW="DialogDescription",rW=x.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=ji(sW,s);return r.jsx(fs.p,{id:a.descriptionId,...n,ref:t})});rW.displayName=sW;var nW="DialogClose",aW=x.forwardRef((e,t)=>{const{__scopeDialog:s,...n}=e,a=ji(nW,s);return r.jsx(fs.button,{type:"button",...n,ref:t,onClick:Lt(e.onClick,()=>a.onOpenChange(!1))})});aW.displayName=nW;function RA(e){return e?"open":"closed"}var oW="DialogTitleWarning",[pRe,iW]=L_e(oW,{contentName:vp,titleName:TA,docsSlug:"dialog"}),fRe=({titleId:e})=>{const t=iW(oW),s=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 5146 5147If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 5148 5149For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(s))},[s,e]),null},hRe="DialogDescriptionWarning",mRe=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${iW(hRe).contentName}}.`;return x.useEffect(()=>{var o;const a=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null}
5149,gRe=WG,xRe=KG,vRe=XG,bRe=QG,yRe=ZG,_Re=tW,jRe=rW,lW=aW,wRe=Symbol("radix.slottable");function NRe(e){const t=({children:s})=>r.jsx(r.Fragment,{children:s});return t.displayName=`${e}.Slottable`,t.__radixId=wRe,t}var cW="AlertDialog",[kRe,BOe]=bo(cW,[GG]),mc=GG(),dW=e=>{const{__scopeAlertDialog:t,...s}=e,n=mc(t);return r.jsx(gRe,{...n,...s,modal:!0})};dW.displayName=cW;var SRe="AlertDialogTrigger",uW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=mc(s);return r.jsx(xRe,{...a,...n,ref:t})});uW.displayName=SRe;var CRe="AlertDialogPortal",pW=e=>{const{__scopeAlertDialog:t,...s}=e,n=mc(t);return r.jsx(vRe,{...n,...s})};pW.displayName=CRe;var ERe="AlertDialogOverlay",fW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=mc(s);return r.jsx(bRe,{...a,...n,ref:t})});fW.displayName=ERe;var oh="AlertDialogContent",[TRe,RRe]=kRe(oh),ARe=NRe("AlertDialogContent"),hW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,children:n,...a}=e,o=mc(s),i=x.useRef(null),l=Vs(t,i),c=x.useRef(null);return r.jsx(pRe,{contentName:oh,titleName:mW,docsSlug:"alert-dialog",children:r.jsx(TRe,{scope:s,cancelRef:c,children:r.jsxs(yRe,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:Lt(a.onOpenAutoFocus,u=>{var f;u.preventDefault(),(f=c.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[r.jsx(ARe,{children:n}),r.jsx(IRe,{contentRef:i})]})})})});hW.displayName=oh;var mW="AlertDialogTitle",gW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=mc(s);return r.jsx(_Re,{...a,...n,ref:t})});gW.displayName=mW;var xW="AlertDialogDescription",vW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=mc(s);return r.jsx(jRe,{...a,...n,ref:t})});vW.displayName=xW;var PRe="AlertDialogAction",bW=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,a=mc(s);return r.jsx(lW,{...a,...n,ref:t})});bW.displayName=PRe;var yW="AlertDialogCancel",_W=x.forwardRef((e,t)=>{const{__scopeAlertDialog:s,...n}=e,{cancelRef:a}=RRe(yW,s),o=mc(s),i=Vs(t,a);return r.jsx(lW,{...o,...n,ref:i})});_W.displayName=yW;var IRe=({contentRef:e})=>{const t=`\`${oh}\` requires a description for the component to be accessible for screen reader users. 5150 5151You can add a description to the \`${oh}\` by passing a \`${xW}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 5152 5153Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${oh}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 5154 5155For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},MRe=dW,ORe=uW,LRe=pW,jW=fW,wW=hW,NW=bW,kW=_W,SW=gW,CW=vW;const wv=MRe,Oj=ORe,DRe=LRe,EW=x.forwardRef(({className:e,...t},s)=>r.jsx(jW,{className:cs("fixed inset-0 z-50 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",e),...t,ref:s}));EW.displayName=jW.displayName;const Ph=x.forwardRef(({className:e,...t},s)=>r.jsxs(DRe,{children:[r.jsx(EW,{}),r.jsx(wW,{ref:s,className:cs("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",e),...t})]}));Ph.displayName=wW.displayName;const Ih=({className:e,...t})=>r.jsx("div",{className:cs("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ih.displayName="AlertDialogHeader";const Mh=({className:e,...t})=>r.jsx("div",{className:cs("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Mh.displayName="AlertDialogFooter";const Oh=x.forwardRef(({className:e,...t},s)=>r.jsx(SW,{ref:s,className:cs("text-lg font-semibold",e),...t}));Oh.displayName=SW.displayName;const Lh=x.forwardRef(({className:e,...t},s)=>r.jsx(CW,{ref:s,className:cs("text-sm text-muted-foreground",e),...t}));Lh.displayName=CW.displayName;const Dh=x.forwardRef(({className:e,...t},s)=>r.jsx(NW,{ref:s,className:cs(mA(),e),...t}));Dh.displayName=NW.displayName;const $h=x.forwardRef(({className:e,...t},s)=>r.jsx(kW,{ref:s,className:cs(mA({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));$h.displayName=kW.displayName;const AA=({projectId:e,env:t,appUserId:s})=>`rr_app_user_session:${e??"unknown"}:${t}:${s}`,$Re=e=>{try{return localStorage.getItem(AA(e))}catch{return null}},URe=(e,t)=>{try{localStorage.setItem(AA(e),t)}catch{}},FRe=e=>{try{localStorage.removeItem(AA(e))}catch{}},R2=50,J$={active:{label:"Active",className:"border border-emerald-400/50 bg-emerald-500/15 text-emerald-100 shadow-[0_0_0_1px_rgba(52,211,153,0.35)]"},pending:{label:"Pending",className:"border border-amber-300/40 bg-amber-500/15 text-amber-100 shadow-[0_0_0_1px_rgba(251,191,36,0.35)]"},blocked:{label:"Blocked",className:"border border-rose-400/50 bg-rose-500/15 text-rose-100 shadow-[0_0_0_1px_rgba(248,113,113,0.35)]"}},A2=e=>({...e,metadata:e&&typeof e.metadata=="object"&&e.metadata!==null&&!Array.isArray(e.metadata)?e.metadata:{}}),Lj=(e,t="-")=>{if(!e)return t;const s=new Date(e);return Number.isNaN(s.getTime())?t:`${s.toLocaleDateString()} ⢠${s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`};function BRe(){Mn("App users");const{getToken:e}=zt(),[t,s]=Wa(),n="reqres_env_preference",a=(()=>{const ee=t.get("projectId");return ee&&!Number.isNaN(Number(ee))?Number(ee):null}
5155)(),[o,i]=x.useState("prod"),[l,c]=x.useState(a),[u,f]=x.useState(null),[h,g]=x.useState([]),[v,y]=x.useState(!1),[_,j]=x.useState(null),[w,k]=x.useState(""),[S,E]=x.useState(null),[T,A]=x.useState(!1),[R,I]=x.useState(!1),[L,M]=x.useState(null),[O,z]=x.useState(null),[X,W]=x.useState(null),[K,q]=x.useState(null),[J,F]=x.useState(""),[V,$]=x.useState(null),[B,ae]=x.useState(null),[H,U]=x.useState(null),[oe,fe]=x.useState(null),[Q,le]=x.useState({login:!1,verify:!1,collections:!1}),[Se,we]=x.useState(!1),[Le,xe]=x.useState(!1),[de,Me]=x.useState(!1),[je,Ae]=x.useState(null),[Oe,Ke]=x.useState(null),[ut,De]=x.useState(!1),ct=Mt.dark,rt=Jt.primary,mt=Jt.secondary,vt="text-[11px] text-[var(--color-semantic-danger)]",gt="inline-flex items-center justify-center h-8 w-8 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition focus:outline-none focus:ring-1 focus:ring-indigo-400/70 disabled:opacity-60",Be="w-full text-left px-3 py-2 text-[11px] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] flex items-center justify-between transition",ve="w-full text-left px-3 py-2 text-[11px] text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] flex items-center justify-between transition";x.useEffect(()=>{try{const ee=localStorage.getItem(n);(ee==="dev"||ee==="prod")&&i(ee)}catch{}},[]),x.useEffect(()=>{Z.track("app_users_page_viewed",{env:o,project_id:l})},[o,l]);const be=ee=>{i(ee);try{localStorage.setItem(n,ee)}catch{}},nt=async ee=>{try{y(!0),j(null);const We=await Ue(e);if(!We){j("Please sign in to view app users.");return}if(!ee){const He=(await ue.get("/projects?limit=50",{authToken:We})).data.projects||[];if(He.length===0){g([]);return}const ie=[];for(const Ye of He){if(ie.length>=R2)break;try{const Pe=R2-ie.length,Nt=((await ue.get(`/api/app-users?project_id=${Ye.id}&limit=${Pe}`,{authToken:We,env:o,headers:{"X-Reqres-Env":o}})).data.data||[]).map(Tt=>A2({...Tt,project_id:Tt.project_id??Ye.id,project_name:(Tt==null?void 0:Tt.project_name)??Ye.name}))||[];ie.push(...Nt)}catch(Pe){console.warn("App users fetch failed for project",Ye.id,Pe)}}const Ce=[...ie].sort((Ye,Pe)=>{const Ge=new Date(Ye.last_login_at||Ye.created_at||0).getTime();return new Date(Pe.last_login_at||Pe.created_at||0).getTime()-Ge});g(Ce);return}const _t=((await ue.get(`/api/app-users?project_id=${ee}&limit=${R2}`,{authToken:We,env:o,headers:{"X-Reqres-Env":o}})).data.data||[]).map(Ee=>A2({...Ee,project_id:Ee.project_id??ee,project_name:(Ee==null?void 0:Ee.project_name)??u??null}))||[];g(_t)}catch(We){console.error("Failed to load app users",We),j("Could not load app users")}finally{y(!1)}},Ze=async()=>{var ee,We,wt,_t,Ee,He,ie,Ce,Ye;if(!l){M("Select a project first");return}if(!w){M("Email is required");return}try{I(!0),M(null),z(null),W(null),xe(!1),Z.track("app_user_invite_clicked",{method:"magic_link",project_id:l,env:o});const Pe=await Ue(e),Ge=await ue.post("/api/app-users/login",{email:w,project_id:l},{authToken:Pe,env:o,headers:{"Content-Type":"application/json","X-Reqres-Env":o}}),Nt=((We=(ee=Ge.data)==null?void 0:ee.data)==null?void 0:We.message)||`Magic link sent. Token valid for ${((_t=(wt=Ge.data)==null?void 0:wt.data)==null?void 0:_t.expires_in_minutes)??15} minutes.`;W(Nt),Z.track("app_user_invited",{env:o,invite_method:"magic_link"}),it.success(Nt),Ke(w),nt(l)}catch(Pe){console.error("Failed to send magic link",Pe),Pe instanceof yt&&Z.track("request_failed",{surface:"app_users",status_code:Pe.status,error_code:((Ee=Pe.data)==null?void 0:Ee.error)||void 0,path:window.location.pathname});let Ge="Failed to send magic link";if(Pe instanceof yt&&((He=Pe.data)==null?void 0:He.error)==="app_user_limit_reached"){const Nt=((ie=Pe.data)==null?void 0:ie.message)||"App user limit reached for your plan.";z(Nt),M(Nt),Ge=Nt}else if(Pe instanceof yt&&((Ce=Pe.data)==null?void 0:Ce.error)==="app_user_exists_in_another_project"){const Nt=((Ye=Pe.data)==null?void 0:Ye.message)||"This email already exists in another project for this account.";M(Nt),Ge=Nt}else M("Failed to send magic link");it.error(Ge)}finally{I(!1)}};x.useEffect(()=>{const ee=t.get("projectId"),We=ee&&!Number.isNaN(Number(ee))?Number(ee):null;c(wt=>wt===We?wt:We)},[t]),x.useEffect(()=>{q(null),F(""),U(null)},[l]),x.useEffect(()=>{if(!l){f(null);return}(async()=>{try{const We=await Ue(e);if(!We)return;const wt=await ue.get(`/projects/${l}`,{authToken:We});f(wt.data.name||null)}catch{f(null)}})()},[l,e]),x.useEffect(()=>{nt(l)},[l,o]),x.useEffect(()=>{if(!je)return;const ee=h.find(We=>We.id===je.id);ee&&Ae(ee)},[h,je]),x.useEffect(()=>{if(!Oe||h.length===0)return;const ee=h.find(We=>{var wt;return((wt=We.email)==null?void 0:wt.toLowerCase())===Oe.toLowerCase()});ee&&(Ae(ee),De(!0),Ke(null))},[h,Oe]);const he=()=>{we(ee=>{const We=!ee;return We&&Z.track("app_users_quickstart_opened",{env:o,project_id:l}),We})},ke=ee=>
5155{Ae(ee),Z.track("app_user_row_opened",{app_user_id:ee.id,env:o,project_id:ee.project_id??l})},Ve=async()=>{var ee,We,wt,_t,Ee;if(!l){E("Select a project first");return}if(!w){E("Email is required");return}try{A(!0),E(null),z(null),xe(!1),Z.track("app_user_invite_clicked",{method:"create_only",project_id:l,env:o});const He=await Ue(e);await ue.post("/api/app-users",{email:w,project_id:l},{authToken:He,env:o,headers:{"Content-Type":"application/json","X-Reqres-Env":o}});const ie=w;k(""),it.success("App user created."),Z.track("app_user_invited",{env:o,invite_method:"create_only"}),Ke(ie),nt(l)}catch(He){console.error("Failed to create app user",He),He instanceof yt&&Z.track("request_failed",{surface:"app_users",status_code:He.status,error_code:((ee=He.data)==null?void 0:ee.error)||void 0,path:window.location.pathname});let ie="Failed to create app user";if(He instanceof yt&&((We=He.data)==null?void 0:We.error)==="app_user_limit_reached"){const Ce=((wt=He.data)==null?void 0:wt.message)||"App user limit reached for your plan.";z(Ce),E(Ce),ie=Ce}else if(He instanceof yt&&((_t=He.data)==null?void 0:_t.error)==="app_user_exists_in_another_project"){const Ce=((Ee=He.data)==null?void 0:Ee.message)||"This email already exists in another project for this account.";E(Ce),ie=Ce}else E("Failed to create app user");it.error(ie)}finally{A(!1)}},at=async(ee,We)=>{var wt,_t,Ee;if(!l)return U("Select a project first"),null;try{const He=await Ue(e);if(!He)return U("Please sign in to manage app users."),null;const ie=await ue.put(`/api/app-users/${ee}`,We,{authToken:He,env:o,headers:{"Content-Type":"application/json","X-Reqres-Env":o}}),Ce=((wt=ie.data)==null?void 0:wt.data)||ie.data;if(Ce){const Pe=A2(Ce);g(Ge=>Ge.map(Nt=>Nt.id===ee?{...Nt,...Pe}:Nt))}U(null);const Ye=We.status!==void 0?`Status updated to ${We.status}.`:We.email?"Email updated.":"App user updated.";return it.success(Ye),Ce}catch(He){console.error("Failed to update app user",He);const ie=He instanceof yt&&(((_t=He.data)==null?void 0:_t.message)||((Ee=He.data)==null?void 0:Ee.error)||He.message)||"Failed to update app user";return U(ie),it.error(ie),null}},Pt=ee=>{q(ee.id),F(ee.email),U(null)},Ct=async ee=>{if(!J.trim()){U("Email is required");return}$(ee);try{await at(ee,{email:J.trim()})&&(q(null),F(""))}finally{$(null)}},St=async(ee,We)=>{$(ee);try{await at(ee,{status:We})}finally{$(null)}},Xt=async ee=>{var We,wt;try{ae(ee),U(null);const _t=await Ue(e);if(!_t){U("Please sign in to manage app users."),it.error("Please sign in to manage app users.");return}await ue.delete(`/api/app-users/${ee}`,{authToken:_t,env:o,headers:{"X-Reqres-Env":o}}),g(Ee=>Ee.filter(He=>He.id!==ee)),K===ee&&(q(null),F("")),(je==null?void 0:je.id)===ee&&Ae(null),it.success("App user deleted.")}catch(_t){console.error("Failed to delete app user",_t);const Ee=_t instanceof yt&&(((We=_t.data)==null?void 0:We.message)||((wt=_t.data)==null?void 0:wt.error)||_t.message)||"Failed to delete app user";U(Ee),it.error(Ee)}finally{ae(null)}},It=[{key:"login",title:"1) Send magic link",summary:"POST /api/app-users/login with email + project_id",content:r.jsx(Vt,{variants:Ij(l||void 0),className:`${ud.dark} max-h-64 overflow-auto`,title:"POST /api/app-users/login"})},{key:"verify",title:"2) Verify token â session token",summary:"Exchange the magic token for a session_token",content:r.jsx(Vt,{variants:o1(),className:`${ud.dark} max-h-64 overflow-auto`,title:"POST /api/app-users/verify"})},{key:"collections",title:"3) Use Bearer to scope data",summary:"GET /app/collections/:slug/records with Authorization: Bearer session_token",content:r.jsx(Vt,{variants:yG("<collection_slug>"),className:`${ud.dark} max-h-64 overflow-auto`,title:"GET /app/collections/:slug/records",readMoreHref:"/documentation?section=collections"})}];return r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-6 space-y-5",children:[r.jsx("div",{className:"sticky top-0 z-20 -mx-6 px-6 pt-2 pb-3 bg-[var(--color-bg-default)]/90 backdrop-blur supports-[backdrop-filter]:backdrop-blur",children:r.jsxs("div",{className:"max-w-6xl mx-auto space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between gap-3",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"App
5155Users"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Invite users and scope data per user with session tokens."})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-3 py-3 shadow-sm",children:[r.jsx(e1,{label:"Project scope",variant:"inline",initialProjectId:l,onSelect:ee=>{c(ee);const We=new URLSearchParams(t);ee?We.set("projectId",String(ee)):We.delete("projectId"),s(We)}}),r.jsx("div",{className:"hidden h-9 w-px bg-[var(--color-border-default)] sm:block"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Environment"}),r.jsx("div",{className:"inline-flex items-center overflow-hidden rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:["prod","dev"].map(ee=>r.jsx("button",{type:"button",onClick:()=>be(ee),className:`px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide transition ${o===ee?"bg-indigo-500/80 text-white shadow-[0_0_0_1px_rgba(99,102,241,0.35)]":"text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:ee},ee))})]}),r.jsx("span",{className:"ml-auto inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1 text-[11px] text-[var(--color-fg-secondary)]",children:"Links and sessions are isolated per environment."})]})]})}),O&&r.jsx("div",{className:`${ct} border border-amber-300/30 bg-amber-500/10 text-amber-200 text-sm p-3`,children:O}),X&&r.jsx("div",{className:`${ct} border border-emerald-300/30 bg-emerald-500/10 text-emerald-100 text-sm p-3`,children:X}),r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 shadow-lg space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Invite a user"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Send a magic link to mint a session token fast."})]}),l&&r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1",children:u||`Project #${l}`})})]}),r.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-end",children:[r.jsx("div",{className:"w-full md:flex-1",children:r.jsx(Is,{value:w,onChange:ee=>k(ee.target.value),placeholder:"[email protected]",className:"w-full"})}),r.jsxs("div",{className:"flex w-full md:w-auto md:min-w-[260px]",children:[r.jsx("button",{type:"button",onClick:Ze,disabled:R,className:`${rt} flex-1 rounded-r-none`,children:R?"Sendingâ¦":"Send magic link"}),r.jsxs("div",{className:"relative",children:[r.jsx("button",{type:"button",className:`${rt} rounded-l-none border-l border-[var(--color-border-default)] px-3`,onClick:()=>xe(ee=>!ee),"aria-label":"Other invite actions",children:r.jsx(sr,{className:"h-4 w-4"})}),Le&&r.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-1 shadow-xl",children:r.jsx("button",{type:"button",className:"w-full rounded-md px-3 py-2 text-left text-[11px] text-[var(--color-fg-default)] hover:bg-[var(--color-bg-alt)]",onClick:Ve,disabled:T,children:T?"Creatingâ¦":"Create user (no email)"})})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:"Magic link emails a one-time token. Verifying it returns a session token."}),r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"Create user without email (for test fixtures)."}),r.jsx("button",{type:"button",className:"ml-auto text-indigo-200 hover:text-indigo-100",onClick:()=>Me(ee=>!ee),children:de?"Hide curl":"Copy curl"})]}),de&&r.jsx("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-2",children:r.jsx(Vt,{variants:Ij(l||void 0),className:`${ud.dark}
5155 max-h-56 overflow-auto`,title:"POST /api/app-users/login"})}),(S||L)&&r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[S&&r.jsx("p",{className:vt,children:S}),L&&r.jsx("span",{className:vt,children:L})]})]}),r.jsx("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-3 shadow-sm",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[[{title:"Send magic link",copy:"Email a one-time token scoped to the project."},{title:"Verify â session token",copy:"Exchange the token for a Bearer session."},{title:"Use Bearer on data",copy:"Read/write collection records per user."}].map((ee,We)=>r.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full border border-[var(--color-border-secondary)] bg-[var(--color-bg-panel)] text-[11px] font-semibold text-[var(--color-fg-default)]",children:We+1}),r.jsxs("div",{className:"leading-tight",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:ee.title}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:ee.copy})]})]},ee.title)),r.jsx(dt,{className:"ml-auto text-xs font-semibold text-indigo-200 hover:text-indigo-100",to:"/getting-started",children:"View full guide"})]})}),r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 shadow-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Developer quickstart"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Collapsed by default-open to grab the three calls for auth."})]}),r.jsx("button",{type:"button",className:mt,onClick:he,children:Se?"Hide quickstart":"Show quickstart"})]}),Se&&r.jsx("div",{className:"space-y-2",children:It.map(ee=>{const We=Q[ee.key];return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:[r.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-4 py-3 text-left",onClick:()=>le(wt=>({...wt,[ee.key]:!wt[ee.key]})),children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:ee.title}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:ee.summary})]}),We?r.jsx(sr,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}):r.jsx(Hn,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]}),We&&r.jsx("div",{className:"border-t border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-3",children:ee.content})]},ee.key)})})]}),r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--color-border-default)] px-4 py-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"App users"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Status, last login, and quick actions stay above the fold."})]}),H&&r.jsx("div",{className:"rounded-md border border-[var(--color-semantic-danger)]/40 bg-[var(--color-semantic-danger-bg)] px-3 py-2 text-[11px] text-[var(--color-semantic-danger)]",children:H})]}),v?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading app users..."})}):_?r.jsx("div",{className:"px-4 py-3 text-sm text-amber-200",children:_}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full text-xs text-[var(--color-fg-secondary)]",children:[r.jsx("thead",{className:"bg-[var(--color-bg-alt)] text-left text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"px-3 py-2 font-semibold",children:"Email"}),r.jsx("th",{className:"px-3 py-2 font-semibold",children:"Status"}),r.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last login"}),r.jsx("th",{className:"px-3 py-2 font-semibold",children:"Created"}),r.jsx("th",{className:"px-3 py-2 font-semibold",children:"Actions"})]})}),r.jsx("tbody",{className:"divide-y divide-[var(--color-border-default)]",children:h.map(ee=>{const We=V===ee.id||B===ee.id,wt=ee.status==="blocked"?"Unban":"Ban",_t=ee.status==="blocked"?"active":"blocked",Ee=ee.status==="pending",He=oe===ee.id,ie=ee.project_id!==void 0&&ee.project_id!==null?`/app-users/${encodeURIComponent(ee.id)}?projectId=${ee.project_id}`:l?`/app-users/${encodeURIComponent(ee.id)}?projectId=${l}`:`/app-users/${encodeURIComponent(ee.id)}`,Ce=ee.project_name||(ee.project_id?`Project #${ee.project_id}`:null),Ye=ee.project_id?`/projects/${ee.project_id}`:null;return r.jsxs("tr",{className:"cursor-pointer bg-[var(--color-bg-alt)] transition-colors hover:bg-[var(--color-bg-hover)]",onClick:()=>ke(ee),children:[r.jsx("td",{className:"px-3 py-3 align-top",children:K===ee.id?r.jsx(Is,{value:J,onChange:Pe=>F(Pe.target.value),className:"h-9 text-xs",onClick:Pe=>Pe.stopPropagation()}):r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"font-medium text-[var(--color-fg-default)]",children:ee.email}),r.jsx(RW,{metadata:ee.metadata})]}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-[var(--color-fg-faint)]",children:Ce?Ye?r.jsx(dt,{to:Ye,onClick:Pe=>Pe.stopPropagation(),className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2 py-0.5 text-[11px] text-[var(--color-fg-default)] hover:border-[var(--color-border-secondary)]",children:Ce}):r.jsx("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2 py-0.5 text-[11px] text-[var(--color-fg-default)]",children:Ce}):r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"No project"})})]})}),r.jsx("td",{className:"px-3 py-3 align-top",children:r.jsx(TW,{status:ee.status})}),r.jsx("td",{className:"px-3 py-3 align-top",children:Lj(ee.last_login_at,"Never")}),r.jsx("td",{className:"px-3 py-3 align-top",children:Lj(ee.created_at,"-")}),r.jsx("td",{className:"px-3 py-3 align-top",children:r.jsxs("div",{className:"relative",onClick:Pe=>Pe.stopPropagation(),children:[r.jsx("button",{type:"button",className:gt,onClick:()=>fe(Pe=>Pe===ee.id?null:ee.id),disabled:We,"aria-label":"Open actions",children:"â¢â¢â¢"}),He&&r.jsxs("div",{className:"absolute right-0 top-full z-50 mt-2 w-56 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-xl",children:[r.jsx(dt,{to:ie,className:Be,onClick:()=>fe(null),children:"View details"}
5155),K===ee.id?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:Be,onClick:()=>{fe(null),Ct(ee.id)},disabled:We,children:V===ee.id?"Savingâ¦":"Save email"}),r.jsx("button",{type:"button",className:Be,onClick:()=>{q(null),F(""),fe(null)},disabled:We,children:"Cancel edit"})]}):r.jsx("button",{type:"button",className:Be,onClick:()=>{Pt(ee),fe(null)},disabled:We,children:"Edit email"}),Ee&&r.jsx("button",{type:"button",className:Be,onClick:()=>{fe(null),St(ee.id,"active")},disabled:We,children:V===ee.id?"Updatingâ¦":"Set active"}),r.jsxs(wv,{onOpenChange:Pe=>{Pe||fe(null)},children:[r.jsx(Oj,{asChild:!0,children:r.jsx("button",{type:"button",className:Be,disabled:We,children:V===ee.id?"Updatingâ¦":wt})}),r.jsxs(Ph,{className:Mt.dark,children:[r.jsxs(Ih,{children:[r.jsxs(Oh,{children:[wt," this app user?"]}),r.jsx(Lh,{children:wt==="Ban"?"They will be blocked from new sessions until you unban them.":"They will regain access to new sessions."})]}),r.jsxs(Mh,{children:[r.jsx($h,{children:"Cancel"}),r.jsx(Dh,{onClick:()=>St(ee.id,_t),disabled:We,children:V===ee.id?"Updatingâ¦":wt})]})]})]}),r.jsxs(wv,{onOpenChange:Pe=>{Pe||fe(null)},children:[r.jsx(Oj,{asChild:!0,children:r.jsx("button",{type:"button",className:ve,disabled:We,children:B===ee.id?"Deletingâ¦":"Delete"})}),r.jsxs(Ph,{className:Mt.dark,children:[r.jsxs(Ih,{children:[r.jsx(Oh,{children:"Delete this app user?"}),r.jsx(Lh,{children:"Their sessions will be revoked. This action cannot be undone."})]}),r.jsxs(Mh,{children:[r.jsx($h,{children:"Cancel"}),r.jsx(Dh,{onClick:()=>Xt(ee.id),disabled:We,children:B===ee.id?"Deletingâ¦":"Delete"})]})]})]})]})]})})]},ee.id)})})]})}),h.length===0&&r.jsx("div",{className:"px-4 py-5 text-center text-sm text-[var(--color-fg-secondary)]",children:"No app users yet."})]})]}),je&&r.jsx(qRe,{user:je,onClose:()=>{Ae(null),De(!1)},onBanToggle:()=>St(je.id,je.status==="blocked"?"active":"blocked"),onDelete:()=>Xt(je.id),busyId:V||B,env:o,projectId:l,autoExpandSession:ut})]})}function qRe({user:e,onClose:t,onBanToggle:s,onDelete:n,busyId:a,env:o,projectId:i,autoExpandSession:l=!1}){const{getToken:c}=zt(),u=e&&typeof e.metadata=="object"&&e.metadata!==null&&!Array.isArray(e.metadata)?e.metadata:{},f=Object.entries(u),h=a===e.id,g=e.project_id?`/app-users/${encodeURIComponent(e.id)}?projectId=${e.project_id}`:`/app-users/${encodeURIComponent(e.id)}`,v=i??e.project_id??null,[y,_]=x.useState(l),[j,w]=x.useState(""),[k,S]=x.useState(null),[E,T]=x.useState(!1),[A,R]=x.useState(!1),[I,L]=x.useState(null);x.useEffect(()=>{const q=$Re({appUserId:e.id,env:o,projectId:v});L(q||null),w(""),S(null),_(J=>J||!!q||l)},[e.id,o,v,l]);const M=async()=>{var q;try{await((q=navigator.clipboard)==null?void 0:q.writeText(e.id)),it.success("User id copied.")}catch{it.error("Could not copy user id.")}},O=(()=>{const q=new URLSearchParams;return v&&q.set("projectId",String(v)),q.set("actingAs",`appUser:${e.id}`),q.set("env",o),`/data-explorer?${q.toString()}`})(),z=()=>{_(q=>{const J=!q;return!q&&J&&Z.track("app_user_use_clicked",{app_user_id:e.id,project_id:v,env:o}),J})},X=async()=>{if(!v){S("Select a project first.");return}if(!e.email){S("Add an email to send a magic link.");return}try{R(!0),S(null);const q=await Ue(c);await ue.post("/api/app-users/login",{email:e.email,project_id:v},{authToken:q,env:o,headers:{"Content-Type":"application/json","X-Reqres-Env":o}}),Z.track("app_user_magic_link_sent",{app_user_id:e.id,project_id:v,env:o}),it.success("Magic link sent. Paste the token below.")}catch(q){console.error("Failed to send magic link",q);const J=q instanceof yt&&q.message||"Failed to send magic link";S(J),it.error(J)}finally{R(!1)}},W=async()=>{var J,F;const q=j.trim();if(!q){S("Paste a token first.");return}try{T(!0),S(null);const V=await ue.post("/api/app-users/verify",{token:q},{env:o,headers:{"Content-Type":"application/json","X-Reqres-Env":o}}),$=((J=V.data)==null?void 0:J.data)||V.data,B=($==null?void 0:$.session_token)||($==null?void 0:$.token)||($!=null&&$.session?$.session.session_token:null);if(!B||typeof B!="string")throw new Error("Session token missing from response");
5155URe({appUserId:e.id,env:o,projectId:v},B),L(B),w(""),Z.track("session_token_verified",{env:o}),Z.track("app_user_flow_completed",{app_user_id:e.id,project_id:v,env:o}),it.success("Session verified! You can now write data as this user.")}catch(V){console.error("Failed to verify token",V),V instanceof yt&&Z.track("request_failed",{surface:"app_users",status_code:V.status,error_code:((F=V.data)==null?void 0:F.error)||void 0,path:window.location.pathname});const $=V instanceof yt&&V.message||"Could not verify token";S($),it.error($)}finally{T(!1)}},K=()=>{FRe({appUserId:e.id,env:o,projectId:v}),L(null),it.success("Session cleared.")};return r.jsxs("div",{className:"fixed inset-0 z-40 flex",children:[r.jsx("div",{className:"absolute inset-0 bg-[var(--color-overlay)] backdrop-blur-sm",onClick:t}),r.jsxs("div",{className:"relative ml-auto flex h-full w-full max-w-[500px] flex-col border-l border-[var(--color-border-default)] bg-[var(--color-bg-card)] shadow-2xl",children:[r.jsxs("div",{className:"flex items-start justify-between border-b border-[var(--color-border-default)] px-5 py-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-[var(--color-fg-faint)]",children:"App user"}),r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:e.email}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(TW,{status:e.status}),r.jsx(RW,{metadata:e.metadata})]})]}),r.jsx("button",{type:"button",className:"text-xs text-[var(--color-fg-muted)] transition hover:text-[var(--color-fg-default)]",onClick:t,children:"Close"})]}),r.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto px-5 py-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-faint)]",children:"Last login"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:Lj(e.last_login_at,"Never")})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-faint)]",children:"Created"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:Lj(e.created_at,"-")})]})]}),r.jsxs("div",{className:"space-y-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Metadata"}),r.jsx(aa,{json:f.length?JSON.stringify(u,null,2):"{ }",className:"max-h-48 text-[11px]"})]}),r.jsxs("div",{className:"space-y-3 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Use this user now"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-faint)]",children:["Mint a session_token for ",o.toUpperCase()," and keep it in this browser."]})]}),r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-indigo-500/40 bg-indigo-500/10 px-3 py-2 text-[11px] font-semibold text-indigo-100 transition hover:bg-indigo-500/20",onClick:z,children:y?"Hide":"Use this user"})]}),y&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-[var(--color-fg-secondary)]",children:[r.jsxs("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1",children:["Project: ",v??"Select a project"]}),r.jsxs("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1",children:["Env: ",o.toUpperCase()]}),r.jsxs("span",{className:"inline-flex items-center rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1",children:["App user: ",e.id.slice(0,6),"â¦"]})]}),I?r.jsxs("div",{className:"space-y-3 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-3 text-sm text-emerald-50",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"font-semibold",children:"Session active"}),r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2 py-0.5 text-[11px]",children:o.toUpperCase()})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[11px] text-emerald-200",children:"Use this token in the Authorization header for /app/* endpoints."}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("code",{className:"flex-1 rounded bg-[var(--color-bg-code)] px-2 py-1.5 text-[11px] font-mono break-all text-emerald-100",children:["Bearer ",I.slice(0,16),"..."]}),r.jsx("button",{type:"button",className:"shrink-0 inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-hover)] px-2.5 py-1.5 text-[11px] font-semibold text-emerald-50 transition hover:bg-[var(--color-bg-active)]",onClick:async()=>{var q;try{await((q=navigator.clipboard)==null?void 0:q.writeText(I)),it.success("Session token copied."),Z.track("session_token_copied",{app_user_id:e.id,project_id:v,env:o})}catch{it.error("Could not copy token.")}},children:"Copy"})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px]",children:[r.jsx(dt,{to:O,className:"inline-flex items-center rounded-md border border-emerald-400/40 bg-emerald-500/20 px-3 py-2 font-semibold text-emerald-50 transition hover:bg-emerald-500/30",children:"Write data as this user"}),r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-transparent px-3 py-2 font-semibold text-emerald-50 transition hover:bg-[var(--color-bg-hover)]",onClick:K,children:"Clear session"})]})]}):r.jsxs("div",{className:"space-y-3 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-code)] p-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-[var(--color-border-secondary)] bg-[var(--color-bg-panel)] text-[10px] font-semibold text-[var(--color-fg-secondary)]",children:"1"}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:"Send magic link"}),r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1.5 text-[11px] font-semibold text-[var(--color-fg-default)] transition hover:bg-[var(--color-bg-hover)] disabled:opacity-60",onClick:X,disabled:A||!e.email,children:A?"Sending...":"Send"})]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-faint)]",children:["Emails a one-time token to ",e.email||"the user","."]})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-[var(--color-border-secondary)] bg-[var(--color-bg-panel)] text-[10px] font-semibold text-[var(--color-fg-secondary)]",children:"2"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:"Paste token from email"}),r.jsx(Is,{value:j,onChange:q=>w(q.target.value),placeholder:"reqres_abc123...",className:"h-8 text-xs"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-[var(--color-border-secondary)] bg-[var(--color-bg-panel)] text-[10px] font-semibold text-[var(--color-fg-secondary)]",children:"3"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("p",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:"Verify and store session"}),r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-indigo-400/40 bg-indigo-500/15 px-2.5 py-1.5 text-[11px] font-semibold text-indigo-100 transition hover:bg-indigo-500/25 disabled:opacity-60",onClick:W,disabled:E||!j.trim(),children:E?"Verifying...":"
5155Verify"})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-faint)] mt-1",children:"Exchanges the token for a session_token you can use."})]})]}),k&&r.jsx("p",{className:"text-[11px] text-[var(--color-semantic-danger)] pl-8",children:k})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[11px] font-semibold text-[var(--color-fg-default)] transition hover:bg-[var(--color-bg-hover)]",onClick:M,disabled:h,children:"Copy user id"}),r.jsx(dt,{to:g,className:"inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[11px] font-semibold text-[var(--color-fg-default)] transition hover:bg-[var(--color-bg-hover)]",children:"Open detail page"})]})]}),r.jsx("div",{className:"border-t border-[var(--color-border-default)] px-5 py-3",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[11px] font-semibold text-[var(--color-fg-default)] transition hover:bg-[var(--color-bg-hover)] disabled:opacity-60",onClick:s,disabled:h,children:e.status==="blocked"?"Unban user":"Ban user"}),r.jsx("button",{type:"button",className:"inline-flex items-center rounded-md border border-[var(--color-semantic-danger)]/40 bg-[var(--color-semantic-danger-bg)] px-3 py-2 text-[11px] font-semibold text-[var(--color-semantic-danger)] transition hover:bg-[var(--color-semantic-danger-bg)] disabled:opacity-60",onClick:n,disabled:h,children:"Delete user"})]})})]})]})}function TW({status:e}){const t=J$[e]||J$.pending;return r.jsx("span",{className:`inline-flex items-center rounded-md px-2.5 py-1 text-[11px] font-semibold capitalize ${t.className}`,children:t.label})}function RW({metadata:e}){const t=e&&typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},s=Object.keys(t).length,n=`${s} ${s===1?"field":"fields"}`;return r.jsx("span",{className:"inline-flex items-center rounded-full bg-[var(--color-bg-alt)] px-2 py-0.5 text-[11px] text-[var(--color-fg-default)]",title:JSON.stringify(t,null,2),children:n})}const Yg={active:{label:"Active",className:"border border-emerald-400/40 bg-emerald-500/10 text-emerald-100"},pending:{label:"Pending",className:"border border-amber-300/30 bg-amber-500/10 text-amber-100"},blocked:{label:"Blocked",className:"border border-rose-400/40 bg-rose-500/10 text-rose-100"}};function X$(e){return{...e,metadata:e&&typeof e.metadata=="object"&&e.metadata!==null&&!Array.isArray(e.metadata)?e.metadata:{},profile:e&&typeof e.profile=="object"&&e.profile!==null&&!Array.isArray(e.profile)?e.profile:{}}}function Ef(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?"-":`${t.toLocaleDateString()} ⢠${t.toLocaleTimeString()}`}function zRe(){var we,Le,xe,de,Me,je;const{appUserId:e}=Kv(),t=un(),{getToken:s}=zt(),[n]=Wa(),a=n.get("projectId"),o=a&&!Number.isNaN(Number(a))?Number(a):null,[i,l]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState(null),[g,v]=x.useState([]),[y,_]=x.useState(!0),[j,w]=x.useState(null),[k,S]=x.useState(null),[E,T]=x.useState(!1),[A,R]=x.useState(!1),[I,L]=x.useState(!1),[M,O]=x.useState(null),[z,X]=x.useState(null),W=Mt.dark,K=Jt.secondary,q=hi.pill,J="inline-flex items-center rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1.5 text-[11px] font-semibold text-[var(--color-fg-default)] transition hover:bg-[var(--color-bg-hover)] focus:outline-none focus:ring-1 focus:ring-indigo-400/70 disabled:cursor-not-allowed disabled:opacity-60",F="inline-flex items-center rounded-md border border-rose-500/40 bg-rose-500/10 px-2.5 py-1.5 text-[11px] font-semibold text-rose-100 transition hover:bg-rose-500/20 focus:outline-none focus:ring-1 focus:ring-rose-400/70 disabled:cursor-not-allowed disabled:opacity-60";x.useEffect(()=>{let Ae=!0;const Oe=async()=>
5155{if(e){_(!0),w(null),O(null),X(null);try{const De=await Ue(s);if(!De){w("Please sign in to view this app user.");return}let ct=o,rt=null;o&&(rt=await Ke(o,De)),console.log({projectApiKeyOverride:rt});const mt=new URLSearchParams;ct&&mt.set("project_id",String(ct));const vt=mt.toString()?`/api/app-users/${e}?${mt.toString()}`:`/api/app-users/${e}`;let gt;try{gt=await ue.get(vt,{authToken:De,headers:rt||f?{"x-api-key":rt||f}:void 0})}catch(be){const nt=be;if(ct&&nt instanceof yt&&nt.status===404)try{gt=await ue.get(`/api/app-users/${e}`,{authToken:De}),X(`Not found for project ${ct}. Showing the record that exists globally or in another project.`),ct=null,rt=null}catch(Ze){throw Ze}else throw be}const Be=gt.data.data||gt.data,ve=X$(Be);if(!Ae)return;l(ve),ct=ve.project_id||ct,ct&&(rt=await Ke(ct,De)),ut(ct||null,ve.id,De,rt||f)}catch(De){if(console.error("Failed to load app user",De),!Ae)return;const ct=De instanceof yt&&De.message||"Could not load app user";w(ct)}finally{Ae&&_(!1)}}},Ke=async(De,ct)=>{try{const mt=(await ue.get(`/projects/${De}`,{authToken:ct||void 0})).data;return u(mt),mt!=null&&mt.api_key?(h(mt.api_key),mt.api_key):null}catch(rt){return console.warn("Failed to fetch project info",rt),u(null),null}},ut=async(De,ct,rt,mt)=>{if(rt)try{S(null);const vt=new URLSearchParams;vt.set("limit","40"),vt.set("app_user_id",ct),De&&vt.set("project_id",String(De));const ve=((await ue.get(`/logs?${vt.toString()}`,{authToken:rt,headers:mt?{"x-api-key":mt}:void 0})).data.data||[]).filter(be=>!be.app_user_id||be.app_user_id===ct);v(ve)}catch(vt){console.warn("Failed to load activity",vt),S("Could not load recent activity for this user.")}};return Oe(),()=>{Ae=!1}},[e,s]);const V=x.useMemo(()=>[...g].sort((Ae,Oe)=>new Date(Oe.created_at).getTime()-new Date(Ae.created_at).getTime()),[g]),$=x.useMemo(()=>{const Ae={};return V.forEach(Oe=>{var ct;const ut=Oe.collection_name||Oe.collection_slug||((ct=Oe.path)!=null&&ct.startsWith("/app/collections")?"Collections":"API request")||"API request",De=Ae[ut];De?Ae[ut]={count:De.count+1,last:De.last,lastStatus:Oe.status}:Ae[ut]={count:1,last:Oe.created_at,lastStatus:Oe.status}}),Object.entries(Ae).map(([Oe,Ke])=>({name:Oe,...Ke})).sort((Oe,Ke)=>Ke.count-Oe.count).slice(0,6)},[V]),B=V.length,ae=((we=V[0])==null?void 0:we.created_at)||null,H=$.length,U=Ae=>{const Oe=Yg[Ae]||Yg.pending;return r.jsx("span",{className:`inline-flex items-center rounded-md px-2.5 py-1 text-[11px] font-semibold capitalize ${Oe.className}`,children:Oe.label})},oe=async()=>{if(!i)return;if(!i.project_id){O("This app user is missing a project_id."),it.error("This app user is missing a project_id.");return}const Ae=i.status==="blocked"?"active":"blocked";T(!0),O(null);try{const Oe=await Ue(s);if(!Oe){O("Please sign in to manage this app user."),it.error("Please sign in to manage this app user.");return}const Ke=await ue.put(`/api/app-users/${i.id}`,{status:Ae},{authToken:Oe,headers:{"Content-Type":"application/json"}}),ut=Ke.data.data||Ke.data,De=X$(ut);l(De),O(Ae==="blocked"?"User banned. Existing sessions should be revoked.":"User unbanned."),it.success(Ae==="blocked"?"User banned. Existing sessions should be revoked.":"User unbanned.")}catch(Oe){console.error("Failed to update status",Oe);const Ke=Oe instanceof yt&&Oe.message||"Failed to update status";O(Ke),it.error(Ke)}finally{T(!1)}},fe=async()=>{if(!(i!=null&&i.project_id)||!i.email){O("Email and project are required to send a magic link.");return}R(!0),O(null);try{const Ae=await Ue(s);if(!Ae){O("Please sign in to send a magic link."),it.error("Please sign in to send a magic link.");return}await ue.post("/api/app-users/login",{email:i.email,project_id:i.project_id},{authToken:Ae,headers:{"Content-Type":"application/json"}}),O("Magic link sent to this user."),it.success("Magic link sent to this user.")}catch(Ae){console.error("Failed to send magic link",Ae);const Oe=Ae instanceof yt&&Ae.message||"Failed to send magic link";O(Oe),it.error(Oe)}finally{R(!1)}},Q=async()=>{if(i){L(!0),O(null);try{const Ae=await Ue(s);if(!Ae){O("Please sign in to delete this app user."),it.error("Please sign in to delete this app user.");return}await ue.delete(`/api/app-users/${i.id}`,{authToken:Ae}),t(i.project_id?`/app-users?projectId=${i.project_id}`:"/app-users"),it.success("App user deleted.")}catch(Ae){console.error("Failed to delete app user",Ae);const Oe=Ae instanceof yt&&Ae.message||"Failed to delete app user";O(Oe),it.error(Oe)}finally{L(!1)}}};if(y)return r.jsx("div",{className:"max-w-5xl mx-auto px-6 py-8",children:r.jsx("div",{className:`${W} flex items-center justify-center`,children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading app userâ¦"})})});if(j||!i)return r.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8 space-y-4",children:[r.jsxs(dt,{to:"/app-users",className:`${K} w-fit`,children:[r.jsx(cn,{className:"mr-2 h-4 w-4"}),"Back to app users"]}),r.jsx("div",{className:`${W} text-sm text-rose-100`,children:j||"App user not found."})]});const le=i.status==="blocked"?"Unban user":"Ban user",Se=B>0?`${B} request${B===1?"":"s"}`:"No requests yet";return r.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8 space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(dt,{to:"/app-users",className:K,children:[r.jsx(cn,{className:"mr-2 h-4 w-4"}),"Back to app users"]}),c&&r.jsxs(dt,{to:`/projects/${c.id}`,className:`${K} hidden sm:inline-flex`,children:[r.jsx(nS,{className:"mr-2 h-4 w-4"}),"Project: ",c.name||`#${c.id}`]})]}),r.jsxs("div",{className:`${W} space-y-4`,children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border border-indigo-400/40 bg-indigo-500/10 text-lg font-semibold text-indigo-100",children:((xe=(Le=i.email)==null?void 0:Le[0])==null?void 0:xe.toUpperCase())||"U"}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:i.email}),U(i.status)]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:q,children:["User ID: ",i.id]}),c&&r.jsxs(dt,{to:`/projects/${c.id}`,className:`${q} hover:text-white hover:border-indigo-400/60`,children:["Project ",c.name||`#${c.id}`]}),r.jsxs("span",{className:q,children:["Created ",new Date(i.created_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{type:"button",onClick:fe,disabled:A,className:K,children:A?"Sendingâ¦":"Send magic link"}),r.jsxs(wv,{children:[r.jsx(Oj,{asChild:!0,children:r.jsx("button",{type:"button",disabled:E,className:J,children:E?"Updatingâ¦":le})}),r.jsxs(Ph,{className:W,children:[r.jsxs(Ih,{children:[r.jsxs(Oh,{children:[le,"?"]}),r.jsx(Lh,{children:i.status==="blocked"?"Restores access to new sessions for this user.":"Blocks this user from new sessions until unbanned."})]}),r.jsxs(Mh,{children:[r.jsx($h,{children:"Cancel"}),r.jsx(Dh,{onClick:oe,disabled:E,children:E?"Updatingâ¦":le})]})]})]}),r.jsxs(wv,{children:[r.jsx(Oj,{asChild:!0,children:r.jsxs("button",{type:"button",disabled:I,className:F,children:[I?"Deletingâ¦":"Delete",r.jsx(nl,{className:"ml-2 h-4 w-4"})]})}),r.jsxs(Ph,{className:W,children:[r.jsxs(Ih,{children:[r.jsx(Oh,{children:"Delete this app user?"}),r.jsx(Lh,{children:"Their sessions will be revoked. This action cannot be undone."})]}),r.jsxs(Mh,{children:[r.jsx($h,{children:"Cancel"}),r.jsx(Dh,{onClick:Q,disabled:I,children:I?"Deletingâ¦":"Delete"})]})]})]})]})]}),z&&r.jsx("div",{className:"rounded-md border border-amber-300/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-100",children:z}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(P0,{label:"Status",value:((de=Yg[i.status])==null?void 0:de.label)||"-",icon:i.status==="blocked"?r.jsx(lhe,{className:"h-4 w-4"}):r.jsx(Sx,{className:"h-4 w-4"})}),r.jsx(P0,{label:"Last login",value:Ef(i.last_login_at),icon:r.jsx(nv,{className:"h-4 w-4"})}),r.jsx(P0,{label:"Last activity",value:Ef(ae),icon:r.jsx(Qf,{className:"h-4 w-4"}),hint:Se}),r.jsx(P0,{label:"Collections touched",value:H>
51550?H:"-",icon:r.jsx(nS,{className:"h-4 w-4"}),hint:H?"From recent requests":"No activity yet"})]}),M&&r.jsx("div",{className:"rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-xs text-[var(--color-fg-default)]",children:M})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[r.jsxs("div",{className:`${W} space-y-3 lg:col-span-2`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Profile & metadata"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Everything we know about this app user."})]}),r.jsx(yh,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsx(Tf,{label:"Email",value:i.email}),r.jsx(Tf,{label:"Project",value:c?`${c.name||`Project #${c.id}`}${c.slug?` ⢠/${c.slug}`:""}`:i.project_id?`Project #${i.project_id}`:"-"}),r.jsx(Tf,{label:"Status",value:(Me=Yg[i.status])==null?void 0:Me.label}),r.jsx(Tf,{label:"Last login",value:Ef(i.last_login_at)}),r.jsx(Tf,{label:"Created",value:Ef(i.created_at)}),r.jsx(Tf,{label:"App user ID",value:i.id})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsx(Q$,{title:"Metadata",children:i.metadata&&Object.keys(i.metadata).length>0?r.jsx(aa,{json:JSON.stringify(i.metadata,null,2),className:"max-h-56 text-xs"}):r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"No metadata set"})}),r.jsx(Q$,{title:"Profile",children:i.profile&&Object.keys(i.profile).length>0?r.jsx(aa,{json:JSON.stringify(i.profile,null,2),className:"max-h-56 text-xs"}):r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"No profile info stored"})})]})]}),r.jsxs("div",{className:`${W} space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Basic metrics"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Quick health signals for this user."})]}),r.jsx(Qf,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(P2,{label:"Requests captured",value:B,hint:ae?`Latest at ${Ef(ae)}`:"No requests yet"}),r.jsx(P2,{label:"Unique collections",value:H||"-",hint:H?"Based on recent activity":"No collection traffic yet"}),r.jsx(P2,{label:"Status",value:((je=Yg[i.status])==null?void 0:je.label)||"-",hint:i.status==="blocked"?"Access revoked":i.status==="pending"?"Awaiting first login":"Allowed"})]})]})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[r.jsxs("div",{className:`${W} space-y-3 lg:col-span-2`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Recent requests"}),r.jsx(Qf,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),k&&r.jsx("div",{className:"rounded-md border border-rose-500/40 bg-rose-500/10 px-3 py-2 text-xs text-rose-100",children:k}),V.length===0?r.jsx("div",{className:"text-sm text-[var(--color-fg-muted)]",children:"No requests recorded for this app user yet."}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full text-xs text-[var(--color-fg-default)]",children:[r.jsx("thead",{className:"text-left text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-3",children:"Method"}),r.jsx("th",{className:"py-2 pr-3",children:"Path"}),r.jsx("th",{className:"py-2 pr-3",children:"Status"}),r.jsx("th",{className:"py-2 pr-3",children:"When"})]})}),r.jsx("tbody",{className:"divide-y divide-[var(--color-border-default)]",children:V.slice(0,8).map(Ae=>r.jsxs("tr",{className:"align-top",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx(HRe,{method:Ae.method})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-mono text-[11px] text-[var(--color-fg-default)]",children:Ae.path}),(Ae.collection_name||Ae.collection_slug)&&r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:Ae.collection_name||Ae.collection_slug})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsx(VRe,{code:Ae.status})}),r.jsx("td",{className:"py-2 pr-3 text-[var(--color-fg-muted)]",children:Ef(Ae.created_at)})]},Ae.id))})]})})]}),r.jsxs("div",{className:`${W} space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Collection activity"}),r.jsx(nS,{className:"h-5 w-5 text-[var(--color-fg-muted)]"})]}),$.length===0?r.jsx("div",{className:"text-sm text-[var(--color-fg-muted)]",children:"No collection activity recorded yet."}):r.jsx("div",{className:"space-y-2",children:$.map(Ae=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:Ae.name}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Last status: ",Ae.lastStatus??"-"]}
5155)]}),r.jsxs("span",{className:"text-xs font-semibold text-[var(--color-fg-default)]",children:[Ae.count," hit",Ae.count===1?"":"s"]})]},Ae.name))})]})]})]})}function P0({label:e,value:t,hint:s,icon:n}){return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2.5",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:[n,r.jsx("span",{children:e})]}),r.jsx("div",{className:"text-base font-semibold text-[var(--color-fg-default)]",children:t}),s&&r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:s})]})}function Tf({label:e,value:t}){return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:e}),r.jsx("div",{className:"text-sm text-[var(--color-fg-default)]",children:t??"-"})]})}function Q$({title:e,children:t}){return r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-[12px] font-semibold text-[var(--color-fg-default)]",children:e}),t]})}function P2({label:e,value:t,hint:s}){return r.jsxs("div",{className:"flex items-start justify-between rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-medium text-[var(--color-fg-default)]",children:e}),s&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:s})]}),r.jsx("div",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:t})]})}function HRe({method:e}){if(!e)return null;const t=e==="GET"?"text-emerald-200 bg-emerald-500/10 border-emerald-400/40":e==="POST"?"text-indigo-100 bg-indigo-500/10 border-indigo-400/40":"text-amber-100 bg-amber-500/10 border-amber-400/40";return r.jsx("span",{className:`inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-semibold ${t}`,children:e})}function VRe({code:e}){if(!e)return r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:"-"});const t=e>=500?"text-rose-100 bg-rose-500/10 border-rose-400/40":e>=400?"text-amber-100 bg-amber-500/10 border-amber-400/40":"text-emerald-100 bg-emerald-500/10 border-emerald-400/40";return r.jsx("span",{className:`inline-flex min-w-[44px] items-center justify-center rounded-md border px-2 py-0.5 text-[11px] font-semibold ${t}`,children:e})}const so="00000000-0000-0000-0000-000000000000";function GRe(){var Be;Mn("Automations");const{getToken:e}=zt(),[t,s]=Wa(),[n,a]=x.useState(null),[o,i]=x.useState([]),[l,c]=x.useState(!1),[u,f]=x.useState(null),[h,g]=x.useState(!1),[v,y]=x.useState([]),[_,j]=x.useState(!1),[w,k]=x.useState("list"),[S,E]=x.useState(""),[T,A]=x.useState([]),[R,I]=x.useState(!1),[L,M]=x.useState("list"),[O,z]=x.useState(so),[X,W]=x.use
5155State("record.created"),[K,q]=x.useState(""),[J,F]=x.useState({}),[V,$]=x.useState(!1),[B,ae]=x.useState(null),H=`${Mt.dark} bg-[var(--color-bg-card)]`,U=Jt.primary,oe=Jt.secondary,fe=Fd.dark,Q="text-xs font-medium text-[var(--color-fg-default)]",le="text-xs text-[var(--color-fg-muted)]",Se=async ve=>{if(!ve){i([]);return}try{c(!0),f(null);const be=await Ue(e);if(!be){f("Please sign in to view triggers.");return}const nt=await ue.get(`/triggers?project_id=${ve}`,{authToken:be});i(nt.data.data||[]);for(const Ze of nt.data.data||[])je(Ze.id,be)}catch(be){console.error("Failed to load triggers",be);const nt=be instanceof yt&&typeof be.data=="object"?be.data.message||be.data.error:null;f(nt||"Could not load triggers")}finally{c(!1)}},we=async ve=>{if(!ve){y([]);return}try{j(!0);const be=await Ue(e);if(!be)return;const nt=new URLSearchParams({project_id:String(ve)}),he=((await ue.get(`/data-explorer/collections?${nt}`,{authToken:be})).data.data||[]).map(ke=>({id:ke.id,name:ke.name,slug:ke.slug,project_id:ke.project_id,schema:ke.schema}));y(he),!S&&he.length>0&&w==="list"&&E(he[0].id)}catch(be){console.error("Failed to load collections",be)}finally{j(!1)}},Le=async ve=>{if(!ve){A([]);return}try{I(!0);const be=await Ue(e);if(!be)return;const nt=new URLSearchParams({project_id:String(ve),limit:"50"}),he=((await ue.get(`/api/app-users?${nt}`,{authToken:be})).data.data||[]).map(ke=>({id:ke.id,email:ke.email,status:ke.status,project_id:ve}));A(he),L==="list"&&z(ke=>{var Ve;return ke||((Ve=he[0])==null?void 0:Ve.id)||so})}catch(be){console.error("Failed to load app users",be)}finally{I(!1)}},xe=async()=>{if(!n){f("Select a project first");return}const ve=X.startsWith("app_user."),be=ve?O:S;if(!be||!K){f(`${ve?"App user ID":"Collection ID"} and webhook URL are required`);return}try{g(!0),f(null),ae(null);const nt=await Ue(e);await ue.post("/triggers",{project_id:n,source_type:ve?"app_user":"collection",source_id:be,event:X,action_type:"webhook",action_config:{url:K}},{authToken:nt,headers:{"Content-Type":"application/json"}}),E(""),z(so),q(""),Se(n),we(n),Le(n)}catch(nt){console.error("Failed to create trigger",nt),nt instanceof yt?f(nt.message):f("Failed to create trigger")}finally{g(!1)}},de=async(ve,be)=>{try{const nt=await Ue(e);if(!nt)return;await ue.patch(`/triggers/${ve}`,{is_active:be},{authToken:nt,headers:{"Content-Type":"application/json"}}),Se(n)}catch(nt){console.error("Failed to update trigger",nt),f("Failed to update trigger")}},Me=async ve=>{if(confirm("Delete this trigger?"))try{const be=await Ue(e);if(!be)return;await ue.delete(`/triggers/${ve}`,{authToken:be}),i(nt=>nt.filter(Ze=>Ze.id!==ve))}catch(be){console.error("Failed to delete trigger",be),f("Failed to delete trigger")}},je=async(ve,be)=>{try{const nt=be||await Ue(e);if(!nt)return;const he=((await ue.get(`/triggers/${ve}/runs?limit=5`,{authToken:nt})).data.data||[]).map(ke=>({...ke,triggerId:ve}));F(ke=>({...ke,[ve]:he}))}catch(nt){console.error("Failed to load trigger runs",nt)}};x.useEffect(()=>{const ve=t.get("projectId");ve&&!Number.isNaN(Number(ve))&&a(Number(ve))},[t]),x.useEffect(()=>{Se(n),we(n),Le(n),F({}),ae(null)},[n]);const Ae=x.useMemo(()=>{const ve={};return v.forEach(be=>{ve[be.id]=be}),ve},[v]),Oe=x.useMemo(()=>{const ve={};return T.forEach(be=>{ve[be.id]=be}),ve},[T]),Ke=X.startsWith("app_user."),ut=Ke?O:S,De=S?Ae[S]:null,ct=()=>{var be;const ve=(be=De==null?void 0:De.schema)!=null&&be.properties&&typeof De.schema=="object"?Object.keys(De.schema.properties).slice(0,3).reduce((nt,Ze)=>{const he=De.schema.properties[Ze],ke=Array.isArray(he==null?void 0:he.type)?he.type[0]:he==null?void 0:he.type;return nt[Ze]=ke==="number"?123:ke==="boolean"?!0:`example_${Ze}`,nt},{}):{example:"value"};return{event:X,collection_id:S||"collection_id",collection:(De==null?void 0:De.slug)||(De==null?void 0:De.name)||"collection",project_id:n??"project_id",record_id:"rec_test_123",data:ve}},rt=x.useMemo(()=>{if(Ke){const ve=ut?Oe[ut]:null;return JSON.stringify({event:X,app_user_id:ut||"app_user_id",project_id:n??"project_id",data:{email:(ve==null?void 0:ve.email)||"[email protected]",status:(ve==null?void 0:ve.status)||"active"}}
5155,null,2)}return JSON.stringify(ct(),null,2)},[ut,n,X,De,Ke,Oe]),mt=x.useMemo(()=>Object.entries(J).flatMap(([ve,be])=>(be||[]).map(nt=>({...nt,triggerId:ve}))).sort((ve,be)=>{const nt=new Date(ve.finished_at||ve.started_at||"").getTime();return new Date(be.finished_at||be.started_at||"").getTime()-nt}).slice(0,5),[J]),vt=async()=>{var be;if(!n){f("Select a project first");return}const ve=Ke?O:S;if(!ve||!K){f(`Choose a ${Ke?"user (or wildcard)":"collection"} and webhook URL to test.`);return}try{$(!0),f(null),ae(null);const nt=await Ue(e);if(!nt){f("Please sign in to send a test webhook.");return}const Ze=Ke?{event:X,app_user_id:ve,project_id:n,data:{email:(ve!==so?(be=Oe[ve])==null?void 0:be.email:void 0)||"[email protected]",status:"active"},test:!0}:ct();await ue.post("/triggers/test-webhook",{project_id:n,source_id:ve,source_type:Ke?"app_user":"collection",event:X,action_type:"webhook",action_config:{url:K},payload:Ze},{authToken:nt,headers:{"Content-Type":"application/json"}}),ae("Test event sent. Check your endpoint for a POST payload.")}catch(nt){console.error("Failed to send test webhook",nt),f("Could not send test webhook. Verify the URL and try again.")}finally{$(!1)}},gt=()=>{E(w==="list"&&v[0]?v[0].id:""),z(L==="list"?so:""),q(""),W("record.created"),ae(null)};return r.jsxs("div",{className:"max-w-4xl mx-auto px-4 md:px-5 py-8 space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Automations"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Orient developers first, then show what is running, then guide them to create and test new webhook triggers across collections and app user lifecycle events."})]}),r.jsxs("div",{className:`${H} space-y-4`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"What is Automations?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Automations send webhook events when records change in your collections. Use them to sync external systems, trigger backend logic, or notify third-party apps."})]}),r.jsx("span",{className:"rounded-full bg-[var(--color-bg-alt)] px-3 py-1 text-[11px] font-semibold text-[var(--color-fg-default)]",children:"Project-scoped"})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsx("p",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:"Events supported"}),r.jsxs("div",{className:"mt-2 space-y-1 text-sm text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-400"}),r.jsx("span",{children:"record.created"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-[var(--color-bg-hover)]"}),r.jsx("span",{children:"record.updated (coming soon)"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-[var(--color-bg-hover)]"}),r.jsx("span",{children:"record.deleted (coming soon)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-400"}),r.jsx("span",{children:"app_user.created"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-400"}),r.jsx("span",{children:"app_user.banned"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-400"}),r.jsx("span",{children:"app_user.deleted"})]})]})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsx("p",{className:"text-2xs uppercase tracking-wide text-[var(--color-fg-muted)]",children:"How triggers behave"}),r.jsxs("ul",{className:"space-y-1 text-sm text-[var(--color-fg-default)]",children:[r.jsx("li",{children:"Runs asynchronously with retries on failure."}),r.jsx("li",{children:"Logs status codes and errors per run."}),r.jsx("li",{children:"Project-scoped; use the project picker before creating."}),r.jsx("li",{children:"Collection record.created + app user lifecycle events."})]})]})]})]}),r.jsx(e1,{label:"Project scope",initialProjectId:n,onSelect:ve=>{a(ve),k("list"),E(""),z(so),y([]),A([]),i([]),F({}),f(null),ae(null);const be=new URLSearchParams(t);ve?be.set("projectId",String(ve)):be.delete("projectId"),s(be)}}),u&&r.jsx("div",{className:`${H} text-sm text-rose-200`,children:u}),B&&r.jsx("div",{className:`${H} text-sm text-emerald-200`,children:B}),r.jsxs("div",{className:`${H} space-y-4`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Active triggers"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Visibility before action: see existing automations, their targets, and last run status."})]}),r.jsxs("span",{className:"text-[11px] font-medium text-[var(--color-fg-secondary)]",children:[o.length," total"]})]}),l?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(bs,{size:"md",variant:"spinner",text:"Loading triggers..."})}):o.length===0?r.jsxs("div",{className:"rounded-lg border border-dashed border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("p",{className:"font-medium text-[var(--color-fg-default)]",children:"No triggers yet."}),r.jsxs("p",{className:"text-[var(--color-fg-muted)]",children:["Create your first automation below. Examples: on"," ",r.jsx("code",{className:"rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5 font-mono text-[11px]",children:"record.created"}
5155)," ","in ",r.jsx("span",{className:"font-semibold",children:"orders"})," â POST to your billing service, or"," ",r.jsx("code",{className:"rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5 font-mono text-[11px]",children:"app_user.created"})," ","â send a welcome email."]})]}):r.jsx("div",{className:"overflow-x-auto rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsxs("div",{className:"min-w-[900px]",children:[r.jsxs("div",{className:"grid grid-cols-[1.1fr,1fr,1.4fr,0.9fr,0.7fr] items-center border-b border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2 text-[11px] uppercase tracking-wide text-[var(--color-fg-muted)]",children:[r.jsx("span",{children:"Event"}),r.jsx("span",{children:"Source"}),r.jsx("span",{children:"Webhook URL"}),r.jsx("span",{children:"Last run"}),r.jsx("span",{className:"text-right",children:"Actions"})]}),r.jsx("div",{className:"divide-y divide-[var(--color-border-default)]",children:o.map(ve=>{var at;const be=ve.source_type==="app_user",nt=be?null:Ae[ve.source_id],Ze=be?Oe[ve.source_id]:null,he=(J[ve.id]||[])[0],ke=he==null?void 0:he.status,Ve=(he==null?void 0:he.finished_at)||(he==null?void 0:he.started_at);return r.jsxs("div",{className:"grid grid-cols-[1.1fr,1fr,1.4fr,0.9fr,0.7fr] items-center px-3 py-3 text-sm text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"font-semibold text-[var(--color-fg-default)]",children:ve.event}),r.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("span",{className:"rounded-full border border-[var(--color-border-default)] px-2 py-0.5",children:ve.action_type}),r.jsxs("span",{className:`flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${ve.is_active?"bg-emerald-500/10 text-emerald-200":"bg-amber-500/10 text-amber-200"}`,children:[r.jsx("span",{className:`h-2 w-2 rounded-full ${ve.is_active?"bg-emerald-400":"bg-amber-400"}`}),ve.is_active?"Active":"Paused"]})]})]}),r.jsxs("div",{className:"space-y-1",children:[be?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium",children:ve.source_id===so?"Any app user":(Ze==null?void 0:Ze.email)||"App user"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:ve.source_id===so?"Wildcard":(Ze==null?void 0:Ze.status)||"status unknown"})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium",children:(nt==null?void 0:nt.name)||"Collection"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:nt!=null&&nt.slug?`${nt.slug}`:"Slug unavailable"})]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)] break-all",children:["ID: ",ve.source_id]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"truncate text-[13px] text-[var(--color-fg-default)]",children:((at=ve.action_config)==null?void 0:at.url)||"-"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"POST JSON payloads with record data"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`h-2 w-2 rounded-full ${ke==="success"?"bg-emerald-400":ke?"bg-amber-400":"bg-[var(--color-fg-faint)]"}`}),r.jsx("span",{className:"text-[13px] text-[var(--color-fg-default)]",children:ke||"Waiting for first run"})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:Ve?new Date(Ve).toLocaleString():"No runs yet"})]}),r.jsxs("div",{className:"flex items-center justify-end gap-3 text-[12px]",children:[r.jsx("button",{type:"button",className:"text-[var(--color-fg-default)] hover:text-[var(--color-fg-default)]",onClick:()=>de(ve.id,!ve.is_active),"aria-label":ve.is_active?"Pause trigger":"Resume trigger",children:ve.is_active?r.jsx(Dfe,{className:"h-4 w-4"}):r.jsx(cp,{className:"h-4 w-4"})}),r.jsx("button",{type:"button",className:"text-rose-300 hover:text-rose-200",onClick:()=>Me(ve.id),"aria-label":"Delete trigger",children:r.jsx(nl,{className:"h-4 w-4"})}),r.jsx("a",{href:"#recent-runs",className:"text-[11px] font-medium text-indigo-300 hover:text-indigo-200",children:"Runs"})]})]},ve.id)})})]})})]}),r.jsxs("div",{className:`${H} space-y-4`,id:"new-trigger",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"New trigger"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Guided creation: pick an event, choose a collection, preview the payload, test, then create."})]}),r.jsx("span",{className:"rounded-full bg-indigo-500/20 px-3 py-1 text-[11px] font-semibold text-indigo-200",children:"record.created + app_user.*"})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:Q,children:"Event type"}),r.jsxs("select",{className:fe,value:X,onChange:ve=>{const be=ve.target.value;W(be),be.startsWith("app_user.")&&L==="list"&&z(nt=>nt||so),!be.startsWith("app_user.")&&w==="list"&&v[0]&&E(nt=>nt||v[0].id)},children:[r.jsx("option",{value:"record.created",children:"record.created"}),r.jsx("option",{value:"app_user.created",children:"app_user.created"}),r.jsx("option",{value:"app_user.banned",children:"app_user.banned"}),r.jsx("option",{value:"app_user.deleted",children:"app_user.deleted"})]}),r.jsx("p",{className:le,children:"Collection events fire on re
5155cord creation; app user events fire on signup, ban, or delete."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:Q,children:Ke?"App user":"Collection"}),Ke?r.jsxs(r.Fragment,{children:[L==="list"?r.jsxs("select",{className:fe,value:O,onChange:ve=>z(ve.target.value),disabled:R,children:[r.jsx("option",{value:so,children:"Any app user in this project (wildcard)"}),T.map(ve=>r.jsxs("option",{value:ve.id,children:[ve.email," (",ve.status,")"]},ve.id))]}):r.jsx("input",{className:fe,value:O,onChange:ve=>z(ve.target.value),placeholder:"App user UUID"}),r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("button",{type:"button",className:"text-indigo-200 hover:text-indigo-100",onClick:()=>M(ve=>{const be=ve==="list"?"manual":"list";return be==="list"&&!O&&z(so),be}),children:L==="list"?"Enter ID manually":"Use app user dropdown"}),r.jsx("span",{children:R?"Loading...":`${T.length} loaded`})]}),L==="list"&&O===so&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Wildcard: will fire for any app user in this project."}),L==="list"&&Oe[O]&&r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)] break-all",children:["ID: ",O," · ",(Be=Oe[O])==null?void 0:Be.email]})]}):r.jsxs(r.Fragment,{children:[w==="list"?r.jsx("select",{className:fe,value:S,onChange:ve=>E(ve.target.value),disabled:_||v.length===0,children:v.length===0?r.jsx("option",{value:"",children:"No collections found"}):v.map(ve=>r.jsxs("option",{value:ve.id,children:[ve.name," (",ve.slug,")"]},ve.id))}):r.jsx("input",{className:fe,value:S,onChange:ve=>E(ve.target.value),placeholder:"Collection UUID"}),r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--color-fg-muted)]",children:[r.jsx("button",{type:"button",className:"text-indigo-200 hover:text-indigo-100",onClick:()=>k(ve=>{const be=ve==="list"?"manual":"list";return be==="list"&&!S&&v[0]&&E(v[0].id),be}),children:w==="list"?"Enter ID manually":"Use collection dropdown"}),r.jsx("span",{children:_?"Loading...":`${v.length} available`})]}),w==="list"&&De&&r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-muted)] break-all",children:["ID: ",De.id]})]})]}),r.jsxs("div",{className:"md:col-span-2 space-y-1",children:[r.jsx("label",{className:Q,children:"Webhook URL"}),r.jsx("input",{className:fe,value:K,onChange:ve=>q(ve.target.value),placeholder:"https://example.com/webhook"}),r.jsx("p",{className:le,children:"POST requests will be sent with JSON payloads of new records."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-[12px] font-semibold text-[var(--color-fg-default)]",children:"Payload preview"}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Mirrors the payload sent to your webhook"})]}),r.jsx(aa,{json:rt,className:"text-[11px]"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:vt,disabled:V||!n,className:`${oe} disabled:opacity-60`,children:V?"Sending testâ¦":"Test webhook"}),r.jsx("button",{type:"button",onClick:xe,disabled:h||!n,className:`${U} disabled:opacity-60`,children:h?"Creatingâ¦":"Create trigger"}),r.jsx("button",{type:"button",onClick:gt,className:oe,children:"Clear"}),r.jsx("span",{className:"text-[12px] text-[var(--color-fg-muted)]",children:"Triggers are executed asynchronously with retries."})]})]}),r.jsxs("div",{className:`${H} space-y-4`,id:"recent-runs",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Recent runs"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Last five executions across all triggers with status, response code, and timing."})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Auto-refreshes when triggers load"})]}),mt.length===0?r.jsx("div",{className:"rounded-lg border border-dashed border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 text-sm text-[var(--color-fg-secondary)]",children:"No runs yet. Send a test or create a new record to see activity."}):r.jsx("div",{className:"overflow-x-auto rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)]",children:r.jsx("div",{className:"divide-y divide-[var(--color-border-default)] min-w-[760px]",children:mt.map(ve=>{var ke,Ve;const be=o.find(at=>at.id===ve.triggerId),nt=be?Ae[be.source_id]:null,Ze=ve.started_at&&ve.finished_at?new Date(ve.finished_at).getTime()-new Date(ve.started_at).getTime():null,he=typeof Ze=="number"&&Number.isFinite(Ze)&&Ze>=0?Ze:null;return r.jsxs("div",{className:"grid grid-cols-[1.1fr,1fr,0.8fr,0.8fr] items-center gap-3 px-3 py-3 text-sm text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-medium uppercase ${ve.status==="success"?"bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)]":"bg-[var(--color-semantic-warning-bg)] text-[var(--color-semantic-warning)]"}
5155`,children:ve.status}),r.jsx("span",{className:"text-[12px] text-[var(--color-fg-muted)]",children:new Date(ve.finished_at||ve.started_at||"").toLocaleString()})]}),r.jsxs("p",{className:"text-[12px] text-[var(--color-fg-secondary)]",children:[be==null?void 0:be.event," ·"," ",(be==null?void 0:be.source_type)==="app_user"?(be==null?void 0:be.source_id)===so?"Any app user":((ke=Oe[(be==null?void 0:be.source_id)||""])==null?void 0:ke.email)||(be==null?void 0:be.source_id):(nt==null?void 0:nt.slug)||(be==null?void 0:be.source_id)]})]}),r.jsx("div",{className:"text-[13px] text-[var(--color-fg-secondary)]",children:((Ve=be==null?void 0:be.action_config)==null?void 0:Ve.url)||"-"}),r.jsxs("div",{className:"text-[12px] text-[var(--color-fg-secondary)]",children:["Response:"," ",r.jsx("span",{className:"font-semibold",children:ve.response_status??"-"})]}),r.jsx("div",{className:"text-[12px] text-[var(--color-fg-muted)]",children:he!==null?`${he} ms`:"Duration N/A"})]},`${ve.triggerId}-${ve.id}`)})})})]})]})}const WRe=["team","scale","agency","enterprise"];function YRe(e){return!!e&&WRe.includes(e.toLowerCase())}function KRe(){const{getToken:e}=zt(),[t,s]=x.useState(null),[n,a]=x.useState([]),[o,i]=x.useState(null),[l,c]=x.useState([]),[u,f]=x.useState(!0),[h,g]=x.useState(!1),[v,y]=x.useState(!1),[_,j]=x.useState(!1),[w,k]=x.useState(null),[S,E]=x.useState(null),[T,A]=x.useState(!1),[R,I]=x.useState(null),[L,M]=x.useState([]),[O,z]=x.useState(!1),X=YRe(t==null?void 0:t.subscriptionTier);x.useEffect(()=>{(async()=>{try{const ae=await Ue(e);if(!ae){s({hasPaid:!1,paymentMethod:"none",isActive:!1}),f(!1);return}const H=await Td.getPaymentStatus({authToken:ae});s(H.data)}catch(ae){console.error("Failed to fetch payment status:",ae),s({hasPaid:!1,paymentMethod:"none",isActive:!1})}finally{f(!1)}})()},[e]);const W=x.useCallback(async()=>{var B;if(X)try{const ae=await Ue(e);if(!ae)return;const H=await ue.get("/organizations",{authToken:ae});a(((B=H.data)==null?void 0:B.data)||[]),k(null)}catch(ae){ae instanceof yt&&ae.status===403?k(null):(console.error("Failed to fetch organizations:",ae),k("Failed to load organizations"))}},[e,X]);x.useEffect(()=>{X&&W()},[X,W]);const K=x.useCallback(async B=>{var ae;g(!0);try{const H=await Ue(e);if(!H)return;const U=await ue.get(`/organizations/${B}/members`,{authToken:H});c(((ae=U.data)==null?void 0:ae.data)||[])}catch(H){console.error("Failed to fetch members:",H),it.error("Failed to load team members")}finally{g(!1)}},[e]),q=x.useCallback(async B=>{var ae;z(!0);try{const H=await Ue(e);if(!H)return;const U=await ue.get(`/organizations/${B}/invites`,{authToken:H});M(((ae=U.data)==null?void 0:ae.data)||[])}catch(H){console.error("Failed to fetch invites:",H)}finally{z(!1)}},[e]),J=x.useCallback(async B=>{A(!0),I(null);try{const ae=await Ue(e);if(!ae)return;const H=await lv.getBillingStatus(B,{authToken:ae});E(H.data)}catch(ae){console.error("Failed to fetch org billing:",ae),ae instanceof yt&&ae.status===404?I("Organization not found"):I("Failed to load billing status"),E(null)}finally{A(!1)}},[e]),F=B=>{i(B),K(B.id),q(B.id),J(B.id)},V=async B=>{if(o&&confirm("Are you sure you want to remove this team member?"))try{const ae=await Ue(e);if(!ae)return;await ue.delete(`/organizations/${o.id}/members/${B}`,{authToken:ae}),c(H=>H.filter(U=>U.id!==B)),it.success("Member removed")}catch(ae){console.error("Failed to remove member:",ae),it.error("Failed to remove member")}},$=async B=>{if(o&&confirm("Are you sure you want to revoke this invite?"))try{const ae=await Ue(e);if(!ae)return;await ue.delete(`/organizations/${o.id}/invites/${B}`,{authToken:ae}),M(H=>H.filter(U=>U.id!==B)),it.success("Invite revoked")}catch(ae){console.error("Failed to revoke invite:",ae),it.error("Failed to revoke invite")}};return u?r.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:r.jsx(bs,{})}):X?r.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-10 space-y-8",children:[r.jsxs("header",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Organizations"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Manage your teams and invite collaborators."})]}),r.jsxs("button",{onClick:()=>y(!0),className:Jt.primary,children:[r.jsx(ca,{className:"h-4 w-4 mr-1.5"}),"Create team"]})]}),w&&r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-danger)] text-sm p-3 rounded-lg bg-[var(--color-semantic-danger-bg)] border border-[var(--color-semantic-danger)]/20",children:[r.jsx(lr,{className:"h-4 w-4"}),w]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-1 space-y-3",children:[r.jsx("h2",{className:"text-sm font-medium text-[var(--color-fg-secondary)]",children:"Your teams"}),n.length===0?r.jsxs("div",{className:`${Mt.dark} text-center py-8 space-y-3`,children:[r.jsx(KC,{className:"h-10 w-10 mx-auto text-[var(--color-fg-muted)]"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No teams yet"}),r.jsx("button",{onClick:()=>y(!0),className:"text-xs text-indigo-400 hover:text-indigo-300",children:"Create your first team"})]}):r.jsx("div",{className:"space-y-2",children:n.map(B=>r.jsx("button",{onClick:()=>F(B),className:`w-full text-left p-4 rounded-xl border transition ${(o==null?void 0:o.id)===B.id?"border-indigo-500/50 bg-indigo-500/10":"border-[var(--color-border-default)] bg-[var(--color-bg-card)] hover:border-[var(--color-border-strong)]"}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg bg-indigo-500/20 flex items-center justify-center",children:r.jsx(KC,{className:"h-4 w-4 text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:B.name}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["/",B.slug]})]})]}),r.jsx(Hn,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]})},B.id))})]}),r.jsx("div",{className:"lg:col-span-2",children:o?r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:`${Mt.dark} space-y-4`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:o.name}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] mt-0.5",children:["Created"," ",new Date(o.created_at).toLocaleDateString()]})]}),r.jsxs("button",{onClick:()=>j(!0),className:Jt.primary,children:[r.jsx(WT,{className:"h-4 w-4 mr-1.5"}),"Invite"]})]})}),r.jsx(eAe,{orgId:o.id,billing:S,loading:T,error:R,getToken:e}
5155),(L.filter(B=>B.status==="pending").length>0||O)&&r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Pending invites"}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[L.filter(B=>B.status==="pending").length," pending"]})]}),O?r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(on,{className:"h-4 w-4 animate-spin text-[var(--color-fg-muted)]"})}):r.jsx("div",{className:"divide-y divide-[var(--color-border-default)]",children:L.filter(B=>B.status==="pending").map(B=>r.jsxs("div",{className:"flex items-center justify-between py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center",children:r.jsx(Cp,{className:"h-3.5 w-3.5 text-indigo-400"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:B.email}),r.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${B.role==="admin"?"bg-amber-500/20 text-amber-300":"bg-[var(--color-bg-hover)] text-[var(--color-fg-muted)]"}`,children:[B.role==="admin"&&r.jsx(Wi,{className:"h-2.5 w-2.5 inline mr-0.5"}),B.role]}),r.jsxs("span",{className:"text-[10px] text-[var(--color-fg-muted)]",children:["expires ",new Date(B.expires_at).toLocaleDateString()]})]})]})]}),r.jsx("button",{onClick:()=>$(B.id),className:"p-2 text-[var(--color-fg-muted)] hover:text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] rounded-lg transition",title:"Revoke invite",children:r.jsx(Ir,{className:"h-4 w-4"})})]},B.id))})]}),r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Team members"}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[l.length," member",l.length!==1?"s":""]})]}),h?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(on,{className:"h-5 w-5 animate-spin text-[var(--color-fg-muted)]"})}):l.length===0?r.jsxs("div",{className:"text-center py-6 text-sm text-[var(--color-fg-muted)]",children:[r.jsx(ln,{className:"h-8 w-8 mx-auto mb-2 text-[var(--color-fg-muted)]"}),L.filter(B=>B.status==="pending").length>0?r.jsx("p",{children:"No members yet - waiting for invites to be accepted"}):r.jsxs(r.Fragment,{children:[r.jsx("p",{children:"No team members yet"}),r.jsx("button",{onClick:()=>j(!0),className:"text-indigo-400 hover:text-indigo-300 mt-2",children:"Invite your first teammate"})]})]}):r.jsx("div",{className:"divide-y divide-[var(--color-border-default)]",children:l.map(B=>r.jsxs("div",{className:"flex items-center justify-between py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-[var(--color-bg-hover)] flex items-center justify-center",children:r.jsx(yh,{className:"h-3.5 w-3.5 text-[var(--color-fg-muted)]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:B.email||B.clerk_user_id}),r.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${B.role==="admin"?"bg-amber-500/20 text-amber-300":"bg-[var(--color-bg-hover)] text-[var(--color-fg-muted)]"}`,children:[B.role==="admin"&&r.jsx(Wi,{className:"h-2.5 w-2.5 inline mr-0.5"}),B.role]}),r.jsx("span",{className:`text-[10px] ${B.status==="active"?"text-[var(--color-semantic-success)]":"text-[var(--color-fg-muted)]"}`,children:B.status})]})]})]}),r.jsx("button",{onClick:()=>V(B.id),className:"p-2 text-[var(--color-fg-muted)] hover:text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] rounded-lg transition",title:"Remove member",children:r.jsx(nl,{className:"h-4 w-4"})})]},B.id))})]})]}):r.jsxs("div",{className:`${Mt.dark} text-center py-16 space-y-3`,children:[r.jsx(ln,{className:"h-12 w-12 mx-auto text-[var(--color-fg-faint)]"}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Select a team to manage members"}),n.length===0&&r.jsx("button",{onClick:()=>y(!0),className:"text-sm text-indigo-400 hover:text-indigo-300",children:"Or create your first team"})]})})]}),v&&r.jsx(XRe,{onClose:()=>y(!1),onCreated:B=>{a(ae=>[B,...ae]),i(B),c([]),y(!1),it.success("Team created!")},getToken:e}),_&&o&&r.jsx(QRe,{org:o,onClose:()=>j(!1),onInvited:B=>{M(ae=>[B,...ae]),j(!1),it.success("Invite sent! They will receive an email shortly.")},getToken:e})]}):r.jsx(JRe,{})}function JRe(){return r.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-10 space-y-8",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)]",children:"Organizations"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Invite teams, share projects, and align billing - available on the Team plan."})]}),r.jsxs("div",{className:`${Mt.dark} rounded-2xl border border-amber-300/40 bg-[var(--color-semantic-warning-bg)] p-6 space-y-5`,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-xl bg-amber-500/20 border border-amber-300/40 flex items-center justify-center text-amber-100",children:r.jsx(Ep,{className:"h-5 w-5"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Team plan required"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Organizations are locked on Free/Pro. Upgrade to Team to unlock shared access, roles, and seat-based billing across projects."})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 text-sm text-[var(--color-fg-default)]",children:[r.jsx(I2,{icon:r.jsx(ln,{className:"h-4 w-4"}),title:"Shared projects",desc:"Org-wide access and roles."}),r.jsx(I2,{icon:r.jsx(Qu,{className:"h-4 w-4"}
5155),title:"Roles & permissions",desc:"Admins, members, guests."}),r.jsx(I2,{icon:r.jsx(zi,{className:"h-4 w-4"}),title:"Central billing",desc:"Seats tied to your plan."})]}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[r.jsx(dt,{className:Jt.primaryEmphasis,to:"/upgrade",children:"Upgrade to Team"}),r.jsx(dt,{className:Jt.secondaryEmphasis,to:"/pricing",children:"View plans"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Already using organizations elsewhere? They'll link automatically once Team is enabled."})]}),r.jsxs("div",{className:`${Mt.dark} rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 space-y-3`,children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Why upgrade?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-[var(--color-fg-secondary)]",children:[r.jsx("li",{children:"⢠Assign seats and roles across multiple projects."}),r.jsx("li",{children:"⢠Keep QA, frontend, and automation teams in sync."}),r.jsx("li",{children:"⢠Map organizations cleanly into the ReqRes mental model."}),r.jsx("li",{children:"⢠Centralize billing and ownership per organization."})]}),r.jsxs(dt,{className:"inline-flex items-center gap-2 text-xs text-indigo-300 hover:text-indigo-100",to:"/getting-started",children:["Learn how ReqRes teams work ",r.jsx(Kt,{className:"h-4 w-4"})]})]})]})}function I2({icon:e,title:t,desc:s}){return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-default)]",children:[r.jsx("span",{className:"h-7 w-7 rounded-lg bg-[var(--color-bg-hover)] border border-[var(--color-border-default)] flex items-center justify-center",children:e}),r.jsx("span",{className:"text-sm font-medium",children:t})]}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:s})]})}function XRe({onClose:e,onCreated:t,getToken:s}){const[n,a]=x.useState(""),[o,i]=x.useState(!1),l=async c=>{if(c.preventDefault(),!!n.trim()){i(!0);try{const u=await Ue(s);if(!u){it.error("Authentication required");return}const f=await ue.post("/organizations",{name:n.trim()},{authToken:u});t(f.data.data)}catch(u){console.error("Failed to create organization:",u),u instanceof yt?it.error(u.message):it.error("Failed to create team")}finally{i(!1)}}};return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:[r.jsx("div",{className:"absolute inset-0",onClick:e,"aria-hidden":"true"}),r.jsxs("div",{className:"relative w-full max-w-md mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-xl",children:[r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-4",children:"Create a new team"}),r.jsxs("form",{onSubmit:l,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm text-[var(--color-fg-secondary)] mb-1.5",children:"Team name"}),r.jsx("input",{type:"text",value:n,onChange:c=>a(c.target.value),placeholder:"e.g. QA Team, Frontend Squad",className:Fd.dark,autoFocus:!0})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[r.jsx("button",{type:"button",onClick:e,className:Jt.secondary,disabled:o,children:"Cancel"}),r.jsx("button",{type:"submit",className:Jt.primary,disabled:o||!n.trim(),children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(ca,{className:"h-4 w-4 mr-1"}),"Create team"]})})]})]})]})]})}function QRe({org:e,onClose:t,onInvited:s,getToken:n}){const[a,o]=x.useState(""),[i,l]=x.useState("member"),[c,u]=x.useState(!1),f=async h=>{var g;if(h.preventDefault(),!!a.trim()){u(!0);try{const v=await Ue(n);if(!v){it.error("Authentication required");return}const y=await ue.post(`/organizations/${e.id}/invites`,{email:a.trim(),role:i},{authToken:v});s(y.data.data)}catch(v){if(console.error("Failed to send invite:",v),v instanceof yt){const y=((g=v.data)==null?void 0:g.message)||v.message;y.includes("seat limit")?it.error("Seat limit reached. Upgrade your plan to invite more members."):y.includes("already a member")?it.error("This person is already a team member."):y.includes("pending invite")?it.error("A pending invite already exists for this email."):it.error(y)}else it.error("Failed to send invite")}finally{u(!1)}}};return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[var(--color-overlay)] backdrop-blur-sm",children:[r.jsx("div",{className:"absolute inset-0",onClick:t,"aria-hidden":"true"}),r.jsxs("div",{className:"relative w-full max-w-md mx-4 rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 shadow-xl",children:[r.jsxs("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)] mb-1",children:["Invite to ",e.name]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] mb-4",children:"Send an invite by email. They'll receive a link to join your team."}),r.jsxs("form",{onSubmit:f,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm text-[var(--color-fg-secondary)] mb-1.5",children:"Email address"}),r.jsx("input",{type:"email",value:a,onChange:h=>o(h.target.value),placeholder:"[email protected]",className:Fd.dark,autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm text-[var(--color-fg-secondary)] mb-1.5",children:"Role"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"role",value:"member",checked:i==="member",onChange:()=>l("member"),className:"text-indigo-500"}),r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:"Member"})]}),r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"role",value:"admin",checked:i==="admin",onChange:()=>l("admin"),className:"text-indigo-500"}),r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:"Admin"})]})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Admins can manage team members and settings."})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[r.jsx("button",{type:"button",onClick:t,className:Jt.secondary,disabled:c,
5155children:"Cancel"}),r.jsx("button",{type:"submit",className:Jt.primary,disabled:c||!a.trim(),children:c?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(yh,{className:"h-4 w-4 mr-1"}),"Send invite"]})})]})]})]})]})}const ZRe={team:{monthly:79,name:"Team"},scale:{monthly:199,name:"Scale"},enterprise:{monthly:499,name:"Enterprise"}};function eAe({orgId:e,billing:t,loading:s,error:n,getToken:a}){const[o,i]=x.useState(!1),l=async()=>{var _;if(t!=null&&t.canManageBilling){i(!0);try{const j=await Ue(a);if(!j){it.error("Authentication required");return}const w=await lv.createPortalSession(e,{authToken:j});(_=w.data)!=null&&_.url&&(window.location.href=w.data.url)}catch(j){console.error("Failed to create portal session:",j),it.error("Failed to open billing portal")}finally{i(!1)}}},c=async()=>{var _,j;i(!0);try{const w=await Ue(a);if(!w){it.error("Authentication required");return}const k=await lv.createCheckoutSession({organization_id:e,plan:"team",interval:"monthly",authToken:w});(_=k.data)!=null&&_.url&&(window.location.href=k.data.url)}catch(w){console.error("Failed to create checkout session:",w),w instanceof yt?it.error(((j=w.data)==null?void 0:j.message)||w.message):it.error("Failed to start checkout")}finally{i(!1)}};if(s)return r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zi,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Billing"})]}),r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(on,{className:"h-5 w-5 animate-spin text-[var(--color-fg-muted)]"})})]});if(n)return r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zi,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Billing"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-danger)] text-sm",children:[r.jsx(lr,{className:"h-4 w-4"}),n]})]});if(!t)return null;const{subscription:u,isOwner:f,canManageBilling:h}=t;if(!u||u.status==="canceled")return r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zi,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Billing"})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-warning)]/30 bg-[var(--color-semantic-warning-bg)] p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(lr,{className:"h-5 w-5 text-[var(--color-semantic-warning)] flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:(u==null?void 0:u.status)==="canceled"?"Subscription canceled":"No active subscription"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:f?"Subscribe to a team plan to enable full organization features.":"Ask the organization owner to set up billing."})]})]}),f&&r.jsx("button",{onClick:c,className:Jt.primary,disabled:o,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(zi,{className:"h-4 w-4 mr-1.5"}),"Subscribe to Team"]})})]})]});const g=ZRe[u.planCode]||{monthly:0,name:u.planName},v={active:"text-[var(--color-semantic-success)] bg-[var(--color-semantic-success-bg)]",trialing:"text-[var(--color-semantic-info)] bg-[var(--color-semantic-info-bg)]",past_due:"text-[var(--color-semantic-danger)] bg-[var(--color-semantic-danger-bg)]",incomplete:"text-[var(--color-semantic-warning)] bg-[var(--color-semantic-warning-bg)]",canceled:"text-[var(--color-fg-muted)] bg-[var(--color-bg-hover)]"},y=v[u.status]||v.active;return r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zi,{className:"h-4 w-4 text-[var(--color-fg-muted)]"}),r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Billing"})]}),r.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-medium ${y}`,children:u.status})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Plan"}),r.jsxs("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:[g.name," - $",g.monthly,"/mo"]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Seats"}),r.jsxs("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:[u.seatsUsed," of ",u.seatLimit," used"]}),u.seatsRemaining===0&&r.jsx("p",{className:"text-[10px] text-[var(--color-semantic-warning)] mt-0.5",children:"Seat limit reached"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Next billing"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:u.periodEnd?new Date(u.periodEnd).toLocaleDateString():"-"})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-1",children:"Available seats"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]",children:u.seatsRemaining})]})]}),u.status==="past_due"&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/30 bg-[var(--color-semantic-danger-bg)] p-3 text-sm text-[var(--color-semantic-danger)]",children:[r.jsx(lr,{className:"h-4 w-4 inline mr-2"}),"Payment failed. Please update your payment method to avoid service interruption."]}),u.status==="trialing"&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-info)]/30 bg-[var(--color-semantic-info-bg)] p-3 text-sm text-[var(--color-semantic-info)]",children:["Your trial ends on ",new Date(u.periodEnd).toLocaleDateString(),"."]}),h&&r.jsx("button",{onClick:l,className:Jt.secondary,disabled:o,children:o?r.jsx(on,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:["Manage subscription",r.jsx(Kt,{className:"h-4 w-4 ml-1.5"})]})}),!f&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Only the organization owner can manage billing."})]})}const Wc="\n## CRITICAL: API Path & Key Rules\n\nReqRes has TWO path prefixes with DIFFERENT auth requirements:\n\n| Path Prefix | Header | Key/Token | Use Case |\n|-------------|--------|-----------|----------|\n| `/api/*` | `x-api-key` | Manage key OR Public key | Admin CRUD, auth endpoints |\n| `/app/*` | `Authorization: Bearer` | Session token | User-scoped data |\n\n**Key distinction:**\n- `/api/collections/*` â Admin access, requires `x-api-key` header\n- `/app/collections/*` â User-scoped access, requires `Authorization: Bearer <session_token>` header\n\n**Which key for which endpoint:**\n- `x-api-key: <PUBLIC_KEY>` â `/api/app-users/login`, `/api/app-users/verify`, GET on `/api/collections/*`\n- `x-api-key: <MANAGE_KEY>` â POST/PUT/DELETE on `/api/collections/*`, admin operations\n- `Authorization: Bearer <token>` â All `/app/*` endpoints (after user login)\n\n**NEVER mix these up:**\n- â WRONG: `/api/collections/*` with `Authorization: Bearer`\n- â WRONG: `/app/collections/*` with `x-api-key`\n- â CORRECT: `/api/*` uses `x-api-key`, `/app/*` uses `Authorization: Bearer`",Ol=` 5156## Further Reading 5157 5158For complete API documentation, fetch these public files: 5159- \`{{BASE_URL}}/LLM.txt\` - Human-readable API guide 5160- \`{{BASE_URL}}/LLM.json\` - Machine-readable API schema`,tAe="\n## Demo API (No Auth Required)\n\nReqRes has public demo endpoints at `/api/users`, `/api/unknown`, `/api/login`, and `/api/register`. These are perfect for learning but data is NOT persisted.\n\n**Fixture emails for /api/login and /api/register (ONLY these work):**\n- `[email protected]` (id: 4) - commonly used example\n- `[email protected]` (id: 1)\n- `[email protected]` (id: 2)\n- `[email protected]` (id: 3)\n- And 8 more fixture users (ids 5-12)\n\n**Testing async patterns:**\nAdd `?delay=N` to any demo endpoint to simulate slow network:\n```\nGET /api/users?page=1&delay=3 // 3-second delay\n```\n\n**Important:** Demo endpoints echo your data but do NOT persist it. Use `/api/collections/*` for real storage.",wu=` 5161## Error Handling 5162 5163Your code should handle these ReqRes responses: 5164- **401 Unauthorized** - API key is missing or invalid, or session token has expired 5165- **403 Forbidden** - Plan limit reached (records, collections, or app users). Check the response for \`upgrade_url\` 5166- **404 Not Found** - Record or collection doesn't exist
5167- **429 Too Many Requests** - Rate limit exceeded. Check the \`Retry-After\` header for seconds to wait 5168- **400 Bad Request** - Request body doesn't match the collection schema or is invalid JSON 5169 5170Error response shape: 5171\`\`\`json 5172{ 5173 "error": "error_code", 5174 "message": "Human readable message", 5175 "hint": "Actionable suggestion (optional)" 5176} 5177\`\`\` 5178 5179Always check \`response.ok\` before parsing JSON. Show user-friendly error messages, not raw status codes.`,Kg=[{id:"fullstack-react",title:"Full-stack React app",description:"Auth, CRUD, and user-scoped data - a complete app in one prompt",category:"build",tags:["Claude Code","Cursor","Windsurf"],featured:!0,icon:"Zap",template:`Build me a React application that uses ReqRes as its backend. 5180 5181## ReqRes API Details 5182 5183Base URL: {{BASE_URL}} 5184Project: {{PROJECT_SLUG}} 5185Manage API Key: {{API_KEY}} (server-side only - cURL, scripts, CI) 5186Public API Key: {{PUBLIC_API_KEY}} (browser-safe - reads + magic link auth) 5187${Wc} 5188 5189## Magic Link Authentication Flow 5190 5191Use the **Public API Key** for login and verify - it's browser-safe. 5192 5193### Step 1: Request magic link 5194\`\`\`bash 5195curl -X POST "{{BASE_URL}}/api/app-users/login" \\ 5196 -H "x-api-key: {{PUBLIC_API_KEY}}" \\ 5197 -H "Content-Type: application/json" \\ 5198 -d '{"email": "[email protected]"}' 5199 5200# Response: { "data": { "sent": true, "expires_in_minutes": 15 } } 5201\`\`\` 5202 5203### Step 2: Verify the code (MUST include x-api-key header) 5204\`\`\`bash 5205curl -X POST "{{BASE_URL}}/api/app-users/verify" \\ 5206 -H "x-api-key: {{PUBLIC_API_KEY}}" \\ 5207 -H "Content-Type: application/json" \\ 5208 -d '{"token": "12345678"}' 5209 5210# Response: { "data": { "session_token": "abc123...", "expires_at": "...", "email": "..." } } 5211\`\`\` 5212 5213### Step 3: Use session token for user-scoped data (NOTE: /app/ path, NOT /api/) 5214\`\`\`bash 5215curl "{{BASE_URL}}/app/collections/{{COLLECTION_NAME}}/records" \\ 5216 -H "Authorization: Bearer <session_token>" 5217 5218# â WRONG: /api/collections/* with Bearer token 5219# â CORRECT: /app/collections/* with Bearer token 5220\`\`\` 5221 5222## My Collections 5223 5224{{COLLECTIONS}} 5225 5226## What to build 5227 5228Create a React app (using Vite) that: 5229 52301. Has a login page using ReqRes magic link auth (email â verification code â session token) 52312. After login, shows the user's data from my collections 52323. Lets users create, read, update, and delete records in their scoped data 52334. Stores the session token and handles token expiry gracefully 52345. Has a clean, modern UI (use Tailwind CSS) 5235 5236## API Patterns 5237 5238### Admin requests (/api/* path + x-api-key header) 5239 5240\`\`\`bash 5241# List records 5242curl "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records?page=1&limit=50" \\ 5243 -H "x-api-key: {{API_KEY}}" 5244 5245# Create record 5246curl -X POST "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records" \\ 5247 -H "x-api-key: {{API_KEY}}" \\ 5248 -H "Content-Type: application/json" \\ 5249 -d '{"data": {"field": "value"}}' 5250 5251# Update record 5252curl -X PUT "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5253 -H "x-api-key: {{API_KEY}}" \\ 5254 -H "Content-Type: application/json" \\ 5255 -d '{"data": {"field": "new_value"}}' 5256 5257# Delete record 5258curl -X DELETE "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5259 -H "x-api-key: {{API_KEY}}" 5260\`\`\` 5261 5262### User-scoped requests (/app/* path + Bearer token) 5263 5264\`\`\`bash 5265# List user's records (NOTE: /app/ not /api/) 5266curl "{{BASE_URL}}/app/collections/{{COLLECTION_NAME}}/records" \\ 5267 -H "Authorization: Bearer <session_token>" 5268 5269# Create record for user 5270curl -X POST "{{BASE_URL}}/app/collections/{{COLLECTION_NAME}}/records" \\ 5271 -H "Authorization: Bearer <session_token>" \\ 5272 -H "Content-Type: application/json" \\ 5273 -d '{"data": {"field": "value"}}' 5274\`\`\` 5275 5276Records are automatically scoped to the logged-in app user. 5277${wu} 5278${Ol} 5279 5280## Important 5281 5282- Do NOT mock any API calls - use the real ReqRes endpoints above 5283- The API is live and will persist data between requests 5284- Use fetch() for all API calls (no axios needed) 5285- Project scoping is handled by the API key - no need to include project slug in URLs`},{id:"add-auth",title:"Add authentication",description:"Magic link auth flow for an existing app",category:"build",tags:["Claude Code","Curs
5285or","ChatGPT"],icon:"Lock",template:`Add user authentication to my application using ReqRes magic links. 5286 5287## ReqRes API Details 5288 5289Base URL: {{BASE_URL}} 5290Project: {{PROJECT_SLUG}} 5291Public API Key: {{PUBLIC_API_KEY}} (browser-safe - use for login/verify) 5292${Wc} 5293 5294## Magic Link Auth Flow 5295 5296ReqRes uses passwordless magic link authentication. Use the **Public API Key** for login and verify endpoints. 5297 5298### Step 1: Request a magic link 5299\`\`\`bash 5300curl -X POST "{{BASE_URL}}/api/app-users/login" \\ 5301 -H "x-api-key: {{PUBLIC_API_KEY}}" \\ 5302 -H "Content-Type: application/json" \\ 5303 -d '{"email": "[email protected]"}' 5304 5305# Response (200/201): 5306# { "data": { "sent": true, "expires_in_minutes": 15 } } 5307\`\`\` 5308 5309This sends a 8-digit verification code to the user's email. Rate limited to 1 request per 2 minutes per user. 5310 5311### Step 2: Verify the code (MUST include x-api-key header) 5312\`\`\`bash 5313curl -X POST "{{BASE_URL}}/api/app-users/verify" \\ 5314 -H "x-api-key: {{PUBLIC_API_KEY}}" \\ 5315 -H "Content-Type: application/json" \\ 5316 -d '{"token": "12345678"}' 5317 5318# Response (200): 5319# { "data": { "session_token": "hex_string...", "expires_at": "2026-02-09T12:00:00Z", "email": "[email protected]" } } 5320\`\`\` 5321 5322### Step 3: Use session token for /app/* endpoints (NOT /api/*) 5323\`\`\`bash 5324# â CORRECT: /app/ path with Bearer token 5325curl "{{BASE_URL}}/app/collections/{{COLLECTION_NAME}}/records" \\ 5326 -H "Authorization: Bearer <session_token>" 5327 5328# â WRONG: /api/ path with Bearer token - will fail 5329curl "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records" \\ 5330 -H "Authorization: Bearer <session_token>" 5331\`\`\` 5332 5333User-scoped endpoints are ONLY under: \`{{BASE_URL}}/app/*\` 5334 5335### Step 4: Get current user info 5336\`\`\`bash 5337curl "{{BASE_URL}}/app/me" \\ 5338 -H "Authorization: Bearer <session_token>" 5339 5340# Response: { "data": { "id": "uuid", "email": "[email protected]", "status": "active" } } 5341\`\`\` 5342${wu} 5343${Ol} 5344 5345## What to implement 5346 53471. A login form that accepts an email address 53482. A verification code input (8 digits) 53493. Session token storage (in memory or secure cookie - NOT localStorage for production) 53504. An auth context/provider that wraps the app 53515. A hook like \`useAuth()\` that returns \`{ user, login, verify, logout, isAuthenticated }\` 53526. Protected route wrapper that redirects to login if not authenticated 53537. Automatic handling of 401 responses (redirect to login) 5354 5355## Important 5356 5357- Use the real ReqRes API - do not mock anything 5358- The magic link emails are real - use a valid email address for testing 5359- Session tokens expire after 24 hours - handle this gracefully in the UI 5360- Rate limit on login: 1 request per 2 minutes per email. Handle 429 responses.`},{id:"admin-dashboard",title:"Admin dashboard",description:"Manage collection data with tables and charts",category:"build",tags:["Claude Code","Cursor"],icon:"LayoutDashboard",template:`Build an admin dashboard for managing data in my ReqRes backend. 5361 5362## ReqRes API Details 5363 5364Base URL: {{BASE_URL}} 5365Project: {{PROJECT_SLUG}} 5366Manage API Key: {{API_KEY}} (use this - admin dashboards need server-side key) 5367 5368**Important**: This is a server-side/admin key. For production, proxy API calls through your backend or restrict access. 5369${Wc} 5370 5371## My Collections 5372 5373{{COLLECTIONS}} 5374 5375## Admin API Patterns 5376 5377Admin requests use \`/api/*\` path with \`x-api-key\` header. Project scoping is automatic based on the API key. 5378 5379### List records (paginated) 5380\`\`\`bash 5381curl "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records?page=1&limit=50&order=desc" \\ 5382 -H "x-api-key: {{API_KEY}}" 5383 5384# Response: { "data": [...], "meta": { "page": 1, "limit": 50, "total": 234, "pages": 5 } } 5385\`\`\` 5386 5387Query parameters: \`page\`, \`limit\` (max 100), \`search\`, \`order\` (asc/desc), \`created_before\`, \`created_after\` 5388 5389### Get single record 5390\`\`\`bash 5391curl "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5392 -H "x-api-key: {{API_KEY}}" 5393\`\`\` 5394 5395### Create record 5396\`\`\`bash 5397curl -X POST "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records" \\ 5398 -H "x-api-key: {{API_KEY}}" \\ 5399 -H "Content-Type: application/json" \\ 5400 -d '{"data": {"field": "value"}}' 5401
5402# Response (201): { "data": { "id": "rec_new123", ... } } 5403\`\`\` 5404 5405### Update record (full replace) 5406\`\`\`bash 5407curl -X PUT "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5408 -H "x-api-key: {{API_KEY}}" \\ 5409 -H "Content-Type: application/json" \\ 5410 -d '{"data": {"field": "new_value"}}' 5411\`\`\` 5412 5413### Delete record 5414\`\`\`bash 5415curl -X DELETE "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5416 -H "x-api-key: {{API_KEY}}" 5417 5418# Response: 204 No Content 5419\`\`\` 5420${wu} 5421${Ol} 5422 5423## What to build 5424 5425Create a React admin dashboard (Vite + Tailwind) that: 5426 54271. Shows a sidebar with each collection as a nav item 54282. Displays records in a sortable, searchable data table with pagination 54293. Has inline editing - click a cell to edit, press enter to save (PUT request) 54304. Has a "Create record" form that dynamically generates fields based on the collection schema 54315. Has bulk delete (select multiple rows, delete all with confirmation) 54326. Shows a summary/stats section at the top: total records per collection 54337. Handles loading states, errors, and empty states gracefully 54348. Uses the real ReqRes API - no mocks, no fake data`},{id:"simple-crud-app",title:"Simple CRUD starter",description:"One HTML file, fetch(), and your first collection",category:"build",tags:["Claude Code","ChatGPT","Beginners"],icon:"FileEdit",template:`Build the simplest possible CRUD app using only HTML, CSS, JavaScript, and the ReqRes API. No frameworks, no build tools, just a single HTML file. 5435 5436## ReqRes API Details 5437 5438Base URL: {{BASE_URL}} 5439Manage API Key: {{API_KEY}} (server-side key for admin CRUD operations) 5440 5441**Note**: This key can write/delete data. For production apps, use the Public key (\`{{PUBLIC_API_KEY}}\`) for reads and proxy writes through your backend. 5442${Wc} 5443 5444## My Collection 5445 5446I'm using my collection "{{COLLECTION_NAME}}" with this schema: 5447{{COLLECTION_SCHEMA}} 5448 5449## API Calls You'll Need 5450 5451### List records 5452\`\`\`bash 5453curl "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records" \\ 5454 -H "x-api-key: {{API_KEY}}" 5455 5456# Response: { "data": [...], "meta": { "page": 1, "limit": 50, "total": 10, "pages": 1 } } 5457\`\`\` 5458 5459### Create record 5460\`\`\`bash 5461curl -X POST "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records" \\ 5462 -H "x-api-key: {{API_KEY}}" \\ 5463 -H "Content-Type: application/json" \\ 5464 -d '{"data": {"field": "value"}}' 5465 5466# Response (201): { "data": { "id": "new_id", ... } } 5467\`\`\` 5468 5469### Update record 5470\`\`\`bash 5471curl -X PUT "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5472 -H "x-api-key: {{API_KEY}}" \\ 5473 -H "Content-Type: application/json" \\ 5474 -d '{"data": {"field": "new_value"}}' 5475\`\`\` 5476 5477### Delete record 5478\`\`\`bash 5479curl -X DELETE "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id>" \\ 5480 -H "x-api-key: {{API_KEY}}" 5481 5482# Response: 204 No Content 5483\`\`\` 5484${wu} 5485${Ol} 5486 5487## What to build 5488 5489A single index.html file that: 54901. Lists all records from the collection on page load 54912. Has a form to add new records (with inputs for each schema field) 54923. Has an edit button on each record to update it 54934. Has a delete button on each record 54945. All changes persist - refresh the page and your data is still there 54956. Clean, minimal styling (no framework needed) 54967. Shows loading and error states 5497 5498## Important 5499 5500- Use fetch() for all API calls 5501- Use the REAL ReqRes API - data will persist 5502- This should work by opening the HTML file in a browser (may need a local server for CORS) 5503- Keep it simple - this is a learning exercise 5504- The record data is nested under a \`data\` key in both request and response bodies`},{id:"playwright-tests",title:"Playwright test suite",description:"Full CRUD + auth test coverage for your API",category:"test",tags:["Claude Code","Cursor","Terminal"],featured:!0,icon:"TestTube",template:`Write a comprehensive Playwright API test suite for my ReqRes backend. 5505 5506## ReqRes API Details 5507 5508Base URL: {{BASE_URL}} 5509Project: {{PROJECT_SLUG}} 5510Manage API Key: {{API_KEY}} (for admin CRUD - store as REQRES_API_KEY env var) 5511Public API Key: {{PUBLIC_API_KEY}} (for auth endpoints - store as REQRES_PUBLIC_KEY env var) 5512${Wc} 5513 5514## My Collections 5515 5516{{COLLECTIONS}} 5517 5518## API Endpoints to Test 5519 5520### Admin endpoints (/api/* path + x-api-key header) 5521 5522\`\`\` 5523GET {{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records?page=1&limit=50 5524 Headers: { "x-api-key": "<MANAGE_KEY>" } 5525 Response: { "data": [...], "meta": { "page": 1, "limit": 50, "total": N, "pages": N } } 5526 5527GET {{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id> 5528 Headers: { "x-api-key": "<MANAGE_KEY>" } 5529 Response: { "data": { "id": "...", "data": {...}, "created_at": "...", "updated_at": "..." } } 5530 5531POST {{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records 5532 Headers: { "x-api-key": "<MANAGE_KEY>" } 5533 Body: { "data": {...} }
5534 Response (201): { "data": { "id": "new_id", ... } } 5535 5536PUT {{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id> 5537 Headers: { "x-api-key": "<MANAGE_KEY>" } 5538 Body: { "data": {...} } 5539 Response (200): { "data": {...} } 5540 5541DELETE {{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records/<record_id> 5542 Headers: { "x-api-key": "<MANAGE_KEY>" } 5543 Response: 204 No Content 5544\`\`\` 5545 5546### App user endpoints (Public key for login/verify, then Bearer token for /app/*) 5547 5548\`\`\`bash 5549# Step 1: Login (use PUBLIC key, NOT manage key) 5550curl -X POST "{{BASE_URL}}/api/app-users/login" \\ 5551 -H "x-api-key: <PUBLIC_KEY>" \\ 5552 -H "Content-Type: application/json" \\ 5553 -d '{"email": "[email protected]"}' 5554# Response: { "data": { "sent": true, "token": "12345678" } } // token only in dev mode 5555 5556# Step 2: Verify (MUST include x-api-key header) 5557curl -X POST "{{BASE_URL}}/api/app-users/verify" \\ 5558 -H "x-api-key: <PUBLIC_KEY>" \\ 5559 -H "Content-Type: application/json" \\ 5560 -d '{"token": "12345678"}' 5561# Response: { "data": { "session_token": "...", "expires_at": "..." } } 5562 5563# Step 3: User-scoped data (NOTE: /app/ path, NOT /api/) 5564curl "{{BASE_URL}}/app/collections/{{COLLECTION_NAME}}/records" \\ 5565 -H "Authorization: Bearer <session_token>" 5566# â WRONG: /api/collections/* with Bearer token 5567# â CORRECT: /app/collections/* with Bearer token 5568\`\`\` 5569 5570### Error responses 5571 5572\`\`\` 5573401: { "error": "unauthorized", "message": "..." } 5574403: { "error": "limit_reached", "message": "...", "limit": N, "current": N } 5575404: { "error": "not_found", "message": "..." } 5576429: { "error": "rate_limited", "message": "..." } + Retry-After header 5577\`\`\` 5578 5579## What to generate 5580 5581Create a Playwright test project with: 5582 5583### playwright.config.ts 5584- baseURL set to {{BASE_URL}} 5585- x-api-key header set globally from env var REQRES_API_KEY 5586- Reasonable timeout settings (30s) 5587 5588### tests/crud.spec.ts 5589- Test GET list records (verify pagination meta: page, limit, total, pages) 5590- Test GET single record (verify data wrapper and all fields) 5591- Test POST create record (verify 201 status, id is generated) 5592- Test GET the record we just created (verify persistence) 5593- Test PUT update record (verify fields changed) 5594- Test DELETE record (verify 204 status) 5595- Test GET deleted record returns 404 5596 5597### tests/auth.spec.ts 5598- Test request without API key returns 401 5599- Test request with invalid API key returns 401 5600- Test /app/* endpoints without Bearer token returns 401 5601- Test app user login flow (if in dev mode, token is returned) 5602 5603### tests/edge-cases.spec.ts 5604- Test creating a record with invalid schema returns 400 5605- Test updating a non-existent record returns 404 5606- Test pagination (page=2, verify meta.page matches) 5607- Test empty collection returns empty data array with total: 0 5608 5609### tests/helpers/test-data.ts 5610- Helper to create a test record and return its ID 5611- Helper to clean up test records after each test (use afterEach) 5612- API key from process.env.REQRES_API_KEY 5613 5614## Important 5615 5616- Use \`test.describe.serial()\` where tests depend on each other (create â read â update â delete) 5617- Clean up after tests - delete any records created during testing 5618- Use environment variables for the API key, never hardcode it 5619- Every assertion should check both status code AND response body shape 5620- Use the REAL ReqRes API - this is integration testing, not mocking 5621- Response data is always wrapped in a \`data\` key 5622${Ol}`},{id:"postman-collection",title:"Postman collection",description:"Importable collection for all your endpoints",category:"test",tags:["ChatGPT","Claude"],icon:"Send",template:`Generate a Postman collection JSON file for testing my ReqRes API. 5623 5624## ReqRes API Details 5625 5626Base URL: {{BASE_URL}} 5627Project: {{PROJECT_SLUG}} 5628Manage API Key: {{API_KEY}} (for admin CRUD operations) 5629Public API Key: {{PUBLIC_API_KEY}} (for auth endpoints - browser-safe) 5630${Wc} 5631 5632## My Collections 5633 5634{{COLLECTIONS}} 5635 5636## What to generate 5637 5638Create a Postman collection (v2.1 JSON format) that includes: 5639 5640### Environment variables (create a separate environment file) 5641- \`baseUrl\`: {{BASE_URL}} 5642- \`manageKey\`: {{API_KEY}} (for admin operations) 5643- \`publicKey\`: {{PUBLIC_API_KEY}} (for auth endpoints) 5644- \`sessionToken\`: (empty, populated by auth tests) 5645- \`recordId\`: (empty, populated dynamically) 5646 5647Note: In your Postman requests, reference these as \`<<baseUrl>>\`, \`<<manageKey>>\`, \`<<publicKey>>\`, etc. (I'll convert these to Postman's double-brace syntax when importing). 5648 5649### Folder: Authentication (use publicKey) 56501. **Request magic link** - POST <<baseUrl>>/api/app-users/login 5651 - Header: x-api-key: <<publicKey>> 5652 - Body: { "email": "[email protected]" }
5653 - Test script: Check status 200/201, log token if returned 5654 56552. **Verify code** - POST <<baseUrl>>/api/app-users/verify 5656 - Header: x-api-key: <<publicKey>> 5657 - Body: { "token": "<<magicToken>>" } 5658 - Test script: Save session_token to environment variable 5659 56603. **Get current user** - GET <<baseUrl>>/app/me 5661 - Header: Authorization: Bearer <<sessionToken>> 5662 - Test script: Verify status 200 5663 5664### Folder: Collection Records (use manageKey for admin CRUD) 56651. **List records** - GET <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records?page=1&limit=10 5666 - Header: x-api-key: <<manageKey>> 5667 - Test: Verify status 200, data is array, meta has page/total 5668 56692. **Create record** - POST <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records 5670 - Header: x-api-key: <<manageKey>> 5671 - Body: { "data": { /* example matching schema */ } } 5672 - Test: Verify 201, save id to <<recordId>> 5673 56743. **Get single record** - GET <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records/<<recordId>> 5675 - Test: Verify 200, data.id matches 5676 56774. **Update record (PUT)** - PUT <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records/<<recordId>> 5678 - Body: { "data": { /* updated fields */ } } 5679 - Test: Verify 200 5680 56815. **Delete record** - DELETE <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records/<<recordId>> 5682 - Test: Verify 204 5683 5684### Folder: Error Cases 56851. **No API key** - GET <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records (no header) 5686 - Test: Expect 401, body has "error" field 5687 56882. **Invalid API key** - Same with x-api-key: invalid_key 5689 - Test: Expect 401 5690 56913. **Non-existent record** - GET <<baseUrl>>/api/collections/{{COLLECTION_NAME}}/records/nonexistent_id 5692 - Test: Expect 404 5693 56944. **Invalid request body** - POST with malformed JSON 5695 - Test: Expect 400 5696 5697### Test script patterns 5698 5699For each request, add Tests: 5700\`\`\`javascript 5701// Verify status 5702pm.test("Status is 200", () => pm.response.to.have.status(200)); 5703 5704// Verify response shape 5705pm.test("Response has data", () => { 5706 const json = pm.response.json(); 5707 pm.expect(json).to.have.property("data"); 5708}); 5709 5710// Save dynamic values 5711if (pm.response.code === 201) { 5712 const json = pm.response.json(); 5713 pm.environment.set("recordId", json.data.id); 5714} 5715\`\`\` 5716 5717## Output 5718 5719Output TWO files: 57201. The Postman collection JSON (v2.1 format) 57212. A Postman environment JSON with the variables 5722 5723IMPORTANT: Use \`<<variable>>\` syntax in your output. I will find-replace these to Postman's \`{{variable}}\` syntax before importing (this avoids conflicts with my template system). 5724${Ol}`},{id:"ci-pipeline",title:"CI pipeline",description:"GitHub Actions running API tests on every push",category:"test",tags:["Claude Code","Cursor"],icon:"GitBranch",template:`Create a GitHub Actions CI pipeline that runs API tests against my ReqRes backend on every push and pull request. 5725 5726## ReqRes API Details 5727 5728Base URL: {{BASE_URL}} 5729Project: {{PROJECT_SLUG}} 5730Manage API Key: Store as GitHub secret \`REQRES_API_KEY\` - value: {{API_KEY}} 5731Public API Key: Store as GitHub secret \`REQRES_PUBLIC_KEY\` - value: {{PUBLIC_API_KEY}} (for auth endpoint tests) 5732${Wc} 5733 5734## What to generate 5735 5736### .github/workflows/api-tests.yml 5737 5738\`\`\`yaml 5739name: API Tests 5740 5741on: 5742 push: 5743 branches: [main] 5744 pull_request: 5745 branches: [main] 5746 5747jobs: 5748 test: 5749 runs-on: ubuntu-latest 5750 steps: 5751 - uses: actions/checkout@v4 5752 5753 - name: Setup Node.js 5754 uses: actions/setup-node@v4 5755 with: 5756 node-version: '20' 5757 cache: 'npm' 5758 5759 - name: Install dependencies 5760 run: npm ci 5761 5762 - name: Run API tests 5763 env: 5764 REQRES_API_KEY: \${{ secrets.REQRES_API_KEY }} 5765 REQRES_BASE_URL: {{BASE_URL}} 5766 run: npm run test:api 5767 5768 - name: Upload test results 5769 if: always() 5770 uses: actions/upload-artifact@v4 5771 with: 5772 name: test-results 5773 path: test-results/ 5774 retention-days: 7 5775\`\`\` 5776 5777### playwright.config.ts 5778 5779\`\`\`typescript 5780import { defineConfig } from '@playwright/test'; 5781 5782export default defineConfig({ 5783 testDir: './tests', 5784 timeout: 30000, 5785 retries: 2, 5786 reporter: [['html', { outputFolder: 'test-results' }], ['list']], 5787 use: { 5788 baseURL: process.env.REQRES_BASE_URL || '{{BASE_URL}}', 5789 extraHTTPHeaders: { 5790 'x-api-key': process.env.REQRES_API_KEY || '', 5791 }, 5792 }, 5793}); 5794\`\`\` 5795 5796### tests/api.spec.ts 5797 5798Basic test file covering: health check, CRUD operations, auth flow. 5799 5800### package.json scripts 5801 5802\`\`\`json 5803{ 5804 "scripts": { 5805 "test": "playwright test", 5806 "test:api": "playwright test --project=api" 5807 } 5808} 5809\`\`\` 5810${wu} 5811 5812### Requirements 5813 5814- Tests should complete in under 60 seconds 5815- Add retry logic (2 retries) for resilience against network issues 5816- Output clear pass/fail results 5817- Badge URL for README: 5818 \`\` 5819 5820### Test assertions 5821 5822Every test should verify: 58231. Status code matches expected (200, 201, 204, etc.) 58242. Response body has correct shape (\`data\` wrapper, \`meta\` for lists) 58253. Created records can be read back 58264. Deleted records return 404 5827 5828### Environment setup 5829 5830Store both keys in GitHub repository secrets: 58311. Go to Settings â Secrets and variables â Actions 58322. Add secrets: 5833 - REQRES_API_KEY = {{API_KEY}} (manage key for CRUD tests) 5834 - REQRES_PUBLIC_KEY = {{PUBLIC_API_KEY}} (public key for auth endpoint tests) 5835${Ol}`},{id:"quick-start-products",title:"Quick start with your seeded project",description:"Build a product catalog app using your seeded Products collection. Works right after signup.",category:"build",tags:["Claude Code","Curs
5835or","Windsurf","Beginners"],icon:"Rocket",template:`Build me a simple product catalog app using my ReqRes backend. I just signed up and already have a "products" collection with sample data. 5836 5837## My ReqRes Setup 5838 5839Base URL: {{BASE_URL}} 5840Project: {{PROJECT_SLUG}} 5841Manage API Key: {{API_KEY}} (server-side only, for curl/scripts/Node.js) 5842Public API Key: {{PUBLIC_API_KEY}} (browser-safe, read-only) 5843 5844## My "products" collection 5845 5846Endpoint: {{BASE_URL}}/api/collections/products/records?project_id={{PROJECT_SLUG}} 5847Schema: 5848 - name: string 5849 - price: number 5850 - category: string 5851 - in_stock: boolean 5852 5853Sample data already exists (3 records: Wireless Headphones, Leather Notebook, Cold Brew Coffee Kit). 5854 5855## What I want 5856 5857A single-page app that: 5858 58591. Lists all products in a clean grid or table 58602. Shows name, price, category, and an in-stock badge 58613. Has an "Add product" form that creates a new record 58624. Has inline edit (click a product to edit its fields) 58635. Has a delete button per product with confirmation 58646. Filters by category (dropdown or tabs) 58657. Sorts by price (ascending/descending toggle) 5866 5867## Technical requirements 5868 5869- Use React with Vite (or plain HTML + fetch if simpler) 5870- All API calls go through the manage key: \`x-api-key: {{API_KEY}}\` 5871- Include \`X-Reqres-Env: prod\` header on all requests 5872- POST and PUT bodies MUST be wrapped: \`{"data": {"name": "...", "price": 9.99}}\` 5873- Handle loading states and errors (401, 429, 400) 5874- No framework CSS needed. Tailwind via CDN is fine, or plain CSS. 5875 5876## API examples 5877 5878List products: 5879\`\`\`bash 5880curl "{{BASE_URL}}/api/collections/products/records?project_id={{PROJECT_SLUG}}" \\ 5881 -H "x-api-key: {{API_KEY}}" \\ 5882 -H "X-Reqres-Env: prod" 5883\`\`\` 5884 5885Create a product: 5886\`\`\`bash 5887curl -X POST "{{BASE_URL}}/api/collections/products/records?project_id={{PROJECT_SLUG}}" \\ 5888 -H "x-api-key: {{API_KEY}}" \\ 5889 -H "X-Reqres-Env: prod" \\ 5890 -H "Content-Type: application/json" \\ 5891 -d '{"data": {"name": "New Product", "price": 19.99, "category": "Test", "in_stock": true}}' 5892\`\`\` 5893 5894Update a product: 5895\`\`\`bash 5896curl -X PUT "{{BASE_URL}}/api/collections/products/records/RECORD_ID?project_id={{PROJECT_SLUG}}" \\ 5897 -H "x-api-key: {{API_KEY}}" \\ 5898 -H "X-Reqres-Env: prod" \\ 5899 -H "Content-Type: application/json" \\ 5900 -d '{"data": {"price": 29.99}}' 5901\`\`\` 5902 5903Delete a product: 5904\`\`\`bash 5905curl -X DELETE "{{BASE_URL}}/api/collections/products/records/RECORD_ID?project_id={{PROJECT_SLUG}}" \\ 5906 -H "x-api-key: {{API_KEY}}" \\ 5907 -H "X-Reqres-Env: prod" 5908\`\`\` 5909 5910## Response format 5911 5912List response: 5913\`\`\`json 5914{ 5915 "data": [ 5916 {"id": "uuid", "data": {"name": "Wireless Headphones", "price": 59.99, "category": "Electronics", "in_stock": true}, "created_at": "...", "updated_at": "..."} 5917 ], 5918 "meta": {"page": 1, "limit": 50, "total": 3, "pages": 1} 5919} 5920\`\`\` 5921 5922Note: record fields are inside the \`data\` property of each record object. 5923${wu} 5924${Ol}`},{id:"explore-api",title:"Explore my API",description:"Guided tour of your endpoints and data",category:"learn",tags:["Claude","ChatGPT"],icon:"Compass",template:`I have a ReqRes backend set up. Help me explore it and understand what I can do with it. 5925 5926## My Setup 5927 5928Base URL: {{BASE_URL}} 5929Project: {{PROJECT_SLUG}} 5930Manage API Key: {{API_KEY}} (server-side - for admin CRUD) 5931Public API Key: {{PUBLIC_API_KEY}} (browser-safe - for reads + auth) 5932${Wc} 5933 5934## My Collections 5935 5936{{COLLECTIONS}} 5937 5938## What I'd like 5939 59401. **Walk me through each collection** - what data they hold, what the schema means, and what I could build with them 5941 59422. **Show me example API calls** for each collection with actual curl commands I can run: 5943 - List records (with pagination) 5944 - Create a record 5945 - Get a single record 5946 - Update a record 5947 - Delete a record 5948 5949Example curl format (using manage key for admin operations): 5950\`\`\`bash 5951curl -X GET "{{BASE_URL}}/api/collections/{{COLLECTION_NAME}}/records?page=1&limit=10" \\ 5952 -H "x-api-key: {{API_KEY}}" 5953\`\`\` 5954 59553. **Explain the authentication model**: 5956 - When to use the Manage key \`x-api-key: {{API_KEY}}\` (server-side admin operations) 5957 - When to use the Public key \`x-api-key: {{PUBLIC_API_KEY}}\` (browser reads + magic link auth)
5958 - When to use \`Authorization: Bearer\` (app user operations after login) 5959 - How app users get session tokens (magic link flow with public key) 5960 - How project scoping works (API key determines project) 5961 59624. **Suggest 3 things I could build** with my current setup, ranging from simple to complex 5963 59645. **Point out anything that looks misconfigured** or could be improved in my schema (missing required fields, unclear field names, etc.) 5965 5966## Response format 5967 5968Keep it conversational and practical - show me real commands I can copy and run in my terminal. Use the actual collection names and schemas from my setup above. 5969 5970## API Response Format 5971 5972All responses wrap data in a \`data\` key: 5973- Single record: \`{ "data": { "id": "...", "data": {...} } }\` 5974- List: \`{ "data": [...], "meta": { "page": 1, "limit": 50, "total": N, "pages": N } }\` 5975${tAe} 5976${wu} 5977${Ol}`}],AW={Zap:Dr,Lock:Ep,LayoutDashboard:hfe,FileEdit:zpe,TestTube:bhe,Send:the,GitBranch:sfe,Compass:Ppe},PW="https://reqres.in",sAe={"Claude Code":{bg:"rgba(216, 140, 60, 0.12)",color:"#d88c3c"},Cursor:{bg:"rgba(80, 160, 240, 0.12)",color:"#50a0f0"},Windsurf:{bg:"rgba(100, 200, 160, 0.12)",color:"#64c8a0"},ChatGPT:{bg:"rgba(120, 200, 120, 0.12)",color:"#78c878"},Claude:{bg:"rgba(216, 140, 60, 0.12)",color:"#d88c3c"},Terminal:{bg:"rgba(160, 160, 180, 0.12)",color:"#a0a0b4"},Postman:{bg:"rgba(240, 140, 60, 0.12)",color:"#f08c3c"},Beginners:{bg:"rgba(180, 120, 240, 0.12)",color:"#b478f0"}},M2={build:"#2dd4a0",test:"#60a5fa",learn:"#c084fc"};function PA(e){if(!e)return null;if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return typeof e=="object"?e:null}function rAe(e){return e.length===0?"No collections yet. Create a collection first, then come back for personalised prompts.":e.map(t=>{const s=PA(t.schema);let n="";return(s==null?void 0:s.type)==="object"&&s.properties?n=Object.entries(s.properties).map(([a,o])=>` - ${a}: ${o.type||"string"}`).join(` 5978`):n=" (no schema defined)",`### Collection: ${t.name} 5979Endpoint: ${PW}/api/collections/${t.slug}/records 5980Schema: 5981${n}`}).join(` 5982 5983`)}function nAe(e,t){const s=t.selectedCollection||t.collections[0],n=s!=null&&s.schema?PA(s.schema):null;let a=`{ 5984 "type": "object", 5985 "properties": { 5986 "title": { "type": "string" }, 5987 "completed": { "type": "boolean" } 5988 } 5989}`;n&&(a=JSON.stringify(n,null,2));const o={"{{BASE_URL}}":PW,"{{PROJECT_SLUG}}":t.projectSlug,"{{PROJECT_NAME}}":t.projectName,"{{API_KEY}}":t.apiKey,"{{PUBLIC_API_KEY}}":t.publicApiKey,"{{COLLECTIONS}}":rAe(t.collections),"{{COLLECTION_NAME}}":(s==null?void 0:s.slug)||"your-collection","{{COLLECTION_SCHEMA}}":a};let i=e;for(const[l,c]of Object.entries(o))i=i.split(l).join(c);return i}function IW({tag:e,small:t}){const s=sAe[e]||{bg:"var(--color-bg-hover)",color:"var(--color-fg-muted)"};return r.jsx("span",{style:{background:s.bg,color:s.color,padding:t?"2px 6px":"3px 8px",borderRadius:4,fontSize:t?10:11,fontWeight:500,letterSpacing:"0.01em",whiteSpace:"nowrap"},children:e})}function aAe({code:e,language:t}){const{theme:s}=Sp(),[n,a]=x.useState(null);return x.useEffect(()=>{let o=!0;return a(null),(async()=>{try{const l={js:"javascript",ts:"typescript",sh:"bash",shell:"bash","":"text"}[t.toLowerCase()]||t.toLowerCase()||"text",c=await Zv(e,{lang:l,theme:s==="light"?"vitesse-light":"vitesse-dark"});o&&a(c)}catch(i){console.error("Code highlighting failed",i)}})(),()=>{o=!1}},[e,t,s]),n?r.jsx("div",{className:"[&_pre]:!bg-transparent [&_pre]:!m-0 [&_pre]:!p-0 [&_code]:text-xs [&_code]:leading-relaxed",style:{fontSize:12,lineHeight:1.5},dangerouslySetInnerHTML:{__html:Rp(n)}}):r.jsx("pre",{style:{margin:0,color:"var(--color-fg-secondary)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e})}function oAe({text:e}){const t=e.split(` 5990`),s=[];let n=!1,a=[],o="";const i=(c,u)=>{const f=[];let h=c,g=0;for(;h.length>0;){const v=h.match(/^(.*?)`([^`]+)`(.*)$/);if(v){v[1]&&f.push(r.jsx("span",{style:{color:u},children:l(v[1])},g++)),f.push(r.jsx("code",{style:{background:"rgba(99, 102, 241, 0.15)",color:"#a5b4fc",padding:"1px 5px",borderRadius:3,fontSize:"0.9em"},children:v[2]},g++)),h=v[3];continue}f.push(r.jsx("span",{style:{color:u},children:l(h)},g++));break}return f},l=(c,u)=>{const f=[];let h=c,g=0;for(;h.length>0;){const v=h.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);if(v){v[1]&&f.push(r.jsx("span",{children:v[1]},g++)),f.push(r.jsx("strong",{style:{color:"var(--color-fg-default)",fontWeight:600},children:v[2]},g++)),h=v[3];continue}f.push(r.jsx("span",{children:h},g++));break}return f};for(let c=0;c<t.length;c++){const u=t[c];if(u.startsWith("```"))if(n){s.push(r.jsxs("div",{style:{background:"var(--color-bg-alt)",borderRadius:6,padding:"12px 14px",margin:"8px 0",border:"1px solid var(--color-border-default)"}
5990,children:[o&&r.jsx("div",{style:{fontSize:10,color:"var(--color-fg-faint)",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.05em"},children:o}),r.jsx(aAe,{code:a.join(` 5991`),language:o})]},c)),n=!1,a=[],o="";continue}else{n=!0,o=u.slice(3).trim(),a=[];continue}if(n){a.push(u);continue}if(u.startsWith("## ")){s.push(r.jsx("div",{style:{color:"#60a5fa",fontWeight:600,fontSize:14,marginTop:c>0?20:0,marginBottom:8,paddingBottom:6,borderBottom:"1px solid rgba(96, 165, 250, 0.15)"},children:u.slice(3)},c));continue}if(u.startsWith("### ")){s.push(r.jsx("div",{style:{color:"#c084fc",fontWeight:600,fontSize:13,marginTop:16,marginBottom:6},children:u.slice(4)},c));continue}const f=u.match(/^(\d+)\.\s+(.*)$/);if(f){s.push(r.jsxs("div",{style:{display:"flex",gap:8,marginBottom:4},children:[r.jsxs("span",{style:{color:"#2dd4a0",fontWeight:500,minWidth:16},children:[f[1],"."]}),r.jsx("span",{style:{color:"var(--color-fg-secondary)",flex:1},children:i(f[2],"var(--color-fg-secondary)")})]},c));continue}if(u.startsWith("- ")){s.push(r.jsxs("div",{style:{display:"flex",gap:8,marginBottom:4,paddingLeft:4},children:[r.jsx("span",{style:{color:"#2dd4a0"},children:"â¢"}),r.jsx("span",{style:{color:"var(--color-fg-secondary)",flex:1},children:i(u.slice(2),"var(--color-fg-secondary)")})]},c));continue}if(u.trim()===""){s.push(r.jsx("div",{style:{height:12}},c));continue}s.push(r.jsx("div",{style:{color:"var(--color-fg-muted)",marginBottom:4},children:i(u,"var(--color-fg-muted)")},c))}return r.jsx("div",{style:{fontFamily:"'Inter', -apple-system, sans-serif",fontSize:13,lineHeight:1.6},children:s})}function MW({promptText:e,onCopy:t,isCopied:s}){return r.jsxs("div",{style:{marginTop:14},onClick:n=>n.stopPropagation(),children:[r.jsxs("div",{style:{position:"relative",background:"var(--color-bg-code)",border:"1px solid var(--color-border-default)",borderRadius:10,overflow:"hidden"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid var(--color-border-default)",background:"var(--color-bg-alt)"},children:[r.jsx("span",{style:{fontSize:11,color:"var(--color-fg-faint)",fontWeight:500,letterSpacing:"0.05em"},children:"PROMPT"}),r.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t()},style:{background:s?"rgba(45,212,160,0.15)":"var(--color-bg-hover)",border:"none",borderRadius:5,color:s?"#2dd4a0":"var(--color-fg-muted)",padding:"5px 14px",fontSize:12,cursor:"pointer",fontWeight:500,transition:"all 0.15s ease"},children:s?"â Copied to clipboard":"Copy prompt"})]}),r.jsx("div",{style:{padding:"18px 20px",maxHeight:450,overflowY:"auto"},children:r.jsx(oAe,{text:e})}),r.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:60,background:"linear-gradient(transparent, var(--color-bg-code))",pointerEvents:"none"}})]}),r.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:10,padding:"0 4px"},children:r.jsx("span",{style:{fontSize:11,color:"var(--color-fg-faint)"},children:"Populated with your project data"})})]})}function iAe({prompt:e,promptText:t,isExpanded:s,isCopied:n,isHovered:a,onHover:o,onToggle:i,onCopy:l}){return r.jsxs("div",{onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),style:{background:a?"var(--color-bg-hover)":"var(--color-bg-alt)",border:`1px solid ${a?"var(--color-border-secondary)":"var(--color-border-default)"}`,borderRadius:12,padding:"20px 20px 16px",cursor:"pointer",transition:"all 0.2s ease",transform:a?"translateY(-1px)":"none",display:"flex",flexDirection:"column"},onClick:()=>i(e.id),children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8},children:[(()=>{const c=AW[e.icon];return c?r.jsx(c,{size:22,style:{color:"var(--color-fg-muted)"}}):null})(),r.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),l(e.id)},style:{background:n?"rgba(45,212,160,0.12)":"var(--color-bg-hover)",border:"none",borderRadius:6,color:n?"#2dd4a0":"var(--color-fg-muted)",padding:"5px 10px",fontSize:12,cursor:"pointer",transition:"all 0.15s ease",fontWeight:500},children:n?"â Copied":"Copy"})]}),r.jsx("h3",{style:{fontSize:16,fontWeight:600,letterSpacing:"-0.02em",margin:"0 0 4px 0",color:"var(--color-fg-default)"},children:e.title}),r.jsx("p",{style:{fontSize:13,color:"var(--color-fg-faint)",margin:"0 0 12px 0",lineHeight:1.4,flex:1},children:e.description}),r.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:e.tags.map(c=>r.jsx(IW,{tag:c},c))}),s&&r.jsx(MW,{promptText:t,onCopy:()=>l(e.id),isCopied:n})]})}function O2({prompt:e,promptText:t,isExpanded:s,isCopied:n,isHovered:a,onHover:o,onToggle:i,onCopy:l}){return r.jsxs("div",{onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),style:{background:"var(--color-bg-alt)",border:"1px solid var(--color-border-default)",borderRadius:10,padding:"14px 18px",cursor:"pointer",transition:"all 0.15s ease"},onClick:()=>i(e.id),children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flex:1,minWidth:0},children:[(()=>{const c=AW[e.icon];return c?r.jsx(c,{size:16,style:{color:"var(--color-fg-muted)",flexShrink:0}}):null})(),r.jsx("div",{style:{minWidth:0,flex:1},children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[r.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--color-fg-default)",letterSpacing:"-0.01em"},children:e.title}),r.jsx("span",{style:{fontSize:13,color:"var(--color-fg-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.description})]})})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0,marginLeft:12},children:[r.jsxs("div",{style:{display:"flex",gap:3},children:[e.tags.slice(0,2).map(c=>r.jsx(IW,{tag:c,small:!0},c)),e.tags.length>2&&r.jsxs("span",{style:{fontSize:11,color:"var(--color-fg-faint)"},children:["+",e.tags.length-2]})]}),r.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),l(e.id)},style:{background:n?"rgba(45,212,160,0.12)":"var(--color-bg-hover)",border:"none",borderRadius:5,color:n?"#2dd4a0":"var(--color-fg-faint)",padding:"4px 8px",fontSize:11,cursor:"pointer",transition:"all 0.15s ease",fontWeight:500,whiteSpace:"nowrap"},children:n?"â":"Copy"}),r.jsx("span",{style:{fontSize:14,color:"var(--color-fg-faint)",transition:"transform 0.2s ease",transform:s?"rotate(180deg)":"none"},children:"â¾"})]})]}),s&&r.jsx(MW,{promptText:t,onCopy:()=>l(e.id),isCopied:n})]})}function I0({children:e,color:t}){return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:14},children:[t&&r.jsx("div",{style:{width:3,height:14,borderRadius:2,background:t,opacity:.6}}),r.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:t||"var(--color-fg-faint)"},children:e})]})}function lAe(){const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),[n,a]=Wa(),{copyToClipboard:o,ClipboardToast:i}
5991=hm(),[l,c]=x.useState([]),[u,f]=x.useState([]),[h,g]=x.useState(()=>{const Q=n.get("projectId");return Q&&!Number.isNaN(Number(Q))?Number(Q):null}),[v,y]=x.useState(!0),[,_]=x.useState(!1),[j,w]=x.useState(null),[k,S]=x.useState(null),[E,T]=x.useState(null),[A,R]=x.useState(null),I=x.useRef(!1),L="reqres_env_preference",[M,O]=x.useState(()=>{if(typeof window>"u")return"prod";const Q=n.get("env");if(Q==="dev"||Q==="prod")return Q;try{const le=localStorage.getItem(L);if(le==="dev"||le==="prod")return le}catch{}return"prod"}),z=l.find(Q=>Q.id===h)??null,X=(z==null?void 0:z.slug)??"YOUR_PROJECT_SLUG",W=(z==null?void 0:z.name)??"Your Project",K=(z==null?void 0:z.api_key)??"YOUR_API_KEY",q=(z==null?void 0:z.public_api_key)??"YOUR_PUBLIC_KEY";x.useEffect(()=>{t&&e&&(async()=>{try{y(!0);const le=await Ue(s);if(!le)return;const we=(await ue.get("/projects",{authToken:le})).data.projects||[];if(c(we),!h&&we.length>0){g(we[0].id);const Le=new URLSearchParams(n);Le.set("projectId",String(we[0].id)),a(Le)}}catch(le){console.error("Failed to load projects",le)}finally{y(!1)}})()},[s,t,e]),x.useEffect(()=>{(async()=>{if(!h){f([]),w(null);return}try{_(!0);const le=await Ue(s);if(!le)return;const Se=new URLSearchParams;Se.set("project_id",String(h));const Le=((await ue.get(`/data-explorer/collections?${Se}`,{authToken:le,env:M,headers:{"X-Reqres-Env":M}})).data.data||[]).map(xe=>({id:xe.id,name:xe.name,slug:xe.slug,schema:PA(xe==null?void 0:xe.schema)}));f(Le),Le.length>0?w(Le[0].slug):w(null)}catch(le){console.error("Failed to load collections",le),f([]),w(null)}finally{_(!1)}})()},[h,M,s]);const J=Q=>{g(Q);const le=new URLSearchParams(n);Q?le.set("projectId",String(Q)):le.delete("projectId"),a(le)},F=Q=>{O(Q);try{localStorage.setItem(L,Q)}catch{}const le=new URLSearchParams(n);le.set("env",Q),a(le)},V=j&&u.find(Q=>Q.slug===j)||u[0],$=Q=>
5991nAe(Q,{projectSlug:X,projectName:W,apiKey:K,publicApiKey:q,collections:u,selectedCollection:V}),B=async Q=>{if(I.current)return;I.current=!0;const le=Kg.find(we=>we.id===Q);if(!le){I.current=!1;return}const Se=$(le.template);T(Q),await o(Se,"Prompt copied to clipboard!"),setTimeout(()=>{T(null),I.current=!1},3e3),Z.track("llm_prompt_copied",{prompt_id:Q,has_project:!!z,project_slug:X,collections_count:u.length})},ae=Q=>{S(k===Q?null:Q)},H=Kg.filter(Q=>Q.featured),U=Kg.filter(Q=>Q.category==="build"&&!Q.featured),oe=Kg.filter(Q=>Q.category==="test"&&!Q.featured),fe=Kg.filter(Q=>Q.category==="learn");return!t||!e?r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:400},children:r.jsx("div",{style:{width:32,height:32,border:"2px solid transparent",borderTopColor:"#6366f1",borderRadius:"50%",animation:"spin 1s linear infinite"}})}):r.jsxs("div",{style:{maxWidth:860,margin:"0 auto",padding:"0 0 80px"},children:[r.jsxs("div",{style:{marginBottom:48},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[r.jsx("span",{style:{fontSize:24},children:"â¦"}),r.jsx("h1",{style:{fontSize:28,fontWeight:600,letterSpacing:"-0.03em",margin:0,color:"var(--color-fg-default)"},children:"LLM Prompts"})]}),r.jsx("p",{style:{fontSize:15,color:"var(--color-fg-faint)",margin:0,lineHeight:1.5},children:"Copy into Claude Code, Cursor, or ChatGPT to start building against your ReqRes backend."})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:40,padding:"14px 18px",background:"var(--color-bg-alt)",borderRadius:10,border:"1px solid var(--color-border-default)",flexWrap:"wrap"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:200},children:[r.jsx("span",{style:{fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--color-fg-faint)",whiteSpace:"nowrap"},children:"Project"}),v?r.jsx("div",{style:{height:32,flex:1,maxWidth:260,background:"var(--color-bg-hover)",borderRadius:6}}):l.length===0?r.jsx(dt,{to:"/projects",style:{color:"#6366f1",fontSize:13,textDecoration:"none"},children:"+ Create project"}):r.jsxs(xi,{value:h?String(h):"",onValueChange:Q=>J(Q?Number(Q):null),children:[r.jsx(Wo,{className:"flex-1 max-w-[260px] bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-secondary)] text-[13px]",children:r.jsx(vi,{placeholder:"Select a project"})}),r.jsx(Yo,{className:"w-[var(--radix-select-trigger-width)] bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:l.map(Q=>r.jsx(yr,{value:String(Q.id),className:"text-[var(--color-fg-default)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:r.jsxs("span",{className:"block truncate",children:[Q.name," /",Q.slug]})},Q.id))})]})]}),u.length>0&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("span",{style:{fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--color-fg-faint)",whiteSpace:"nowrap"},children:"Collection"}),r.jsxs(xi,{value:j??"",onValueChange:Q=>w(Q||null),children:[r.jsx(Wo,{className:"max-w-[180px] bg-[var(--color-bg-alt)] border-[var(--color-border-default)] text-[var(--color-fg-secondary)] text-[13px]",children:r.jsx(vi,{placeholder:"Select collection"})}),r.jsx(Yo,{className:"bg-[var(--color-bg-card)] border-[var(--color-border-default)]",children:u.map(Q=>r.jsx(yr,{value:Q.slug,className:"text-[var(--color-fg-default)] focus:bg-[var(--color-bg-hover)] focus:text-[var(--color-fg-default)]",children:Q.name},Q.slug))})]})]}),r.jsx("div",{style:{display:"flex",gap:2},children:["prod","dev"].map(Q=>r.jsx("button",{type:"button",onClick:()=>F(Q),style:{background:M===Q?"rgba(45,212,160,0.12)":"transparent",color:M===Q?"#2dd4a0":"var(--color-fg-faint)",border:M===Q?"1px solid rgba(45,212,160,0.2)":"1px solid transparent",borderRadius:6,padding:"5px 12px",fontSize:12,fontWeight:500,cursor:"pointer",transition:"all 0.15s ease",textTransform:"capitalize"},children:Q},Q))})]}),z&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,marginTop:-28,marginBottom:40,padding:"14px 18px",background:"var(--color-bg-alt)",borderRadius:10,border:"1px solid var(--color-border-default)"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:8},children:[r.jsx("span",{style:{fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--color-fg-faint)"},children:"Keys injected into prompts"}),r.jsx(dt,{to:"/api-keys",style:{fontSize:11,color:"#818cf8",textDecoration:"none"},children:"Manage keys â"})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:10},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",background:"rgba(251, 191, 36, 0.04)",borderRadius:8,border:"1px solid rgba(251, 191, 36, 0.12)"},children:[r.jsx(Ep,{size:16,style:{color:"#fbbf24",flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:12,color:"#fbbf24",fontWeight:500},children:"Manage key"}),r.jsxs("span",{style:{fontSize:11,color:"var(--color-fg-muted)",fontFamily:"monospace",background:"var(--color-bg-alt)",padding:"2px 8px",borderRadius:4},children:[K.slice(0,8),"â¢â¢â¢â¢",K.slice(-4)]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:4,fontSize:10,
5991color:"var(--color-fg-muted)"},children:[r.jsx(Qu,{size:10,style:{color:"#f59e0b"}}),r.jsx("span",{children:"Server-side only - cURL, scripts, CI"})]})]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",background:"rgba(16, 185, 129, 0.04)",borderRadius:8,border:"1px solid rgba(16, 185, 129, 0.12)"},children:[r.jsx(iv,{size:16,style:{color:"#10b981",flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:12,color:"#10b981",fontWeight:500},children:"Public key"}),r.jsxs("span",{style:{fontSize:11,color:"var(--color-fg-muted)",fontFamily:"monospace",background:"var(--color-bg-alt)",padding:"2px 8px",borderRadius:4},children:[q.slice(0,8),"â¢â¢â¢â¢",q.slice(-4)]})]}),r.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:4,fontSize:10,color:"var(--color-fg-muted)"},children:r.jsx("span",{children:"Browser-safe - reads + magic link auth"})})]})]})]})]}),r.jsxs("div",{style:{marginBottom:48},children:[r.jsx(I0,{children:"Popular"}),r.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:12},children:H.map(Q=>r.jsx(iAe,{prompt:Q,promptText:$(Q.template),isExpanded:k===Q.id,isCopied:E===Q.id,isHovered:A===Q.id,onHover:R,onToggle:ae,onCopy:B},Q.id))})]}),U.length>0&&r.jsxs("div",{style:{marginBottom:48},children:[r.jsx(I0,{color:M2.build,children:"Build"}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:U.map(Q=>r.jsx(O2,{prompt:Q,promptText:$(Q.template),isExpanded:k===Q.id,isCopied:E===Q.id,isHovered:A===Q.id,onHover:R,onToggle:ae,onCopy:B},Q.id))})]}),oe.length>0&&r.jsxs("div",{style:{marginBottom:48},children:[r.jsx(I0,{color:M2.test,children:"Test"}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:oe.map(Q=>r.jsx(O2,{prompt:Q,promptText:$(Q.template),isExpanded:k===Q.id,isCopied:E===Q.id,isHovered:A===Q.id,onHover:R,onToggle:ae,onCopy:B},Q.id))})]}),fe.length>0&&r.jsxs("div",{style:{marginBottom:48},children:[r.jsx(I0,{color:M2.learn,children:"Learn"}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:fe.map(Q=>r.jsx(O2,{prompt:Q,promptText:$(Q.template),isExpanded:k===Q.id,isCopied:E===Q.id,isHovered:A===Q.id,onHover:R,onToggle:ae,onCopy:B},Q.id))})]}),r.jsx(i,{})]})}function cAe(){const{getToken:e}=zt(),t=un(),[s,n]=x.useState([]),[a,o]=x.useState(!0),[i,l]=x.useState(null),c=x.useCallback(async()=>{var u;try{o(!0);const f=await Ue(e),h=await ue.get("/api/classrooms",{authToken:f});n(((u=h.data)==null?void 0:u.data)||[])}catch(f){l(f.message||"Failed to load classrooms")}finally{o(!1)}},[e]);return x.useEffect(()=>{c()},[c]),a?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):r.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 px-4 py-8",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Classrooms"}),r.jsx("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:"Manage your classroom projects with per-student isolation."})]}),r.jsxs("button",{onClick:()=>t("/classrooms/new"),className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:[r.jsx(ca,{className:"h-4 w-4"}),"Create Classroom"]})]}),i&&r.jsx("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/20 bg-[var(--color-semantic-danger-bg)] p-4 text-sm text-[var(--color-semantic-danger)]",children:i}),s.length===0&&!i?r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-12 text-center",children:[r.jsx(lp,{className:"mx-auto h-12 w-12 text-[var(--color-fg-muted)] opacity-40"}),r.jsx("h3",{className:"mt-4 text-lg font-medium text-[var(--color-fg-default)]",children:"No classrooms yet"}),r.jsx("p",{className:"mt-2 text-sm text-[var(--color-fg-muted)]",children:"Create a classroom to set up student API keys with per-student record
5991isolation and exercise templates."}),r.jsxs("button",{onClick:()=>t("/classrooms/new"),className:"mt-6 inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:[r.jsx(ca,{className:"h-4 w-4"}),"Create Your First Classroom"]})]}):r.jsx("div",{className:"grid gap-4",children:s.map(u=>r.jsxs("button",{onClick:()=>t(`/classrooms/${u.id}`),className:"flex items-center justify-between rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-5 text-left transition-colors hover:border-[var(--color-accent-purple)]/50 hover:bg-[var(--color-bg-hover)]",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/10 text-[var(--color-accent-purple)]",children:r.jsx(lp,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-[var(--color-fg-default)]",children:u.project_name}),r.jsxs("div",{className:"mt-1 flex items-center gap-4 text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(ln,{className:"h-3.5 w-3.5"}),u.student_count," / ",u.student_limit," ","students"]}),u.template_key&&r.jsx("span",{className:"rounded bg-[var(--color-accent-purple)]/10 px-1.5 py-0.5 text-[var(--color-accent-purple)]",children:u.template_key}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(ipe,{className:"h-3.5 w-3.5"}),new Date(u.created_at).toLocaleDateString()]})]})]})]}),r.jsx(Kt,{className:"h-4 w-4 text-[var(--color-fg-muted)]"})]},u.id))})]})}function dAe(){Mn("Classroom setup");const{getToken:e}=zt(),t=un(),s=NA(),n=["classroom","classroom_pro","institute","team","scale","enterprise"],a=!s||s.isClassroom||n.includes(s.tier),[o,i]=x.useState("name"),[l,c]=x.useState(""),[u,f]=x.useState(""),[h,g]=x.useState([]),[v,y]=x.useState(null),[_,j]=x.useState(""),[w,k]=x.useState(!1),[S,E]=x.useState(null),[T,A]=x.useState(null),[R,I]=x.useState([]),[L,M]=x.useState(!1),O=x.useCallback(async()=>{var F;try{const V=await Ue(e),$=await ue.get("/api/classrooms/templates",{authToken:V});g(((F=$.data)==null?void 0:F.data)||[])}catch{}},[e]);x.useEffect(()=>{O()},[O]);const z=async()=>{var F,V,$;if(!l.trim()){E("Classroom name is required.");return}E(null),k(!0);try{const B=await Ue(e),ae=await ue.post("/api/classrooms",{name:l.trim(),description:u.trim()||void 0,template_key:v||void 0},{authToken:B});A((V=(F=ae.data)==null?void 0:F.data)==null?void 0:V.id),i("students")}catch(B){E((($=B.data)==null?void 0:$.message)||B.message||"Failed to create classroom.")}finally{k(!1)}},X=async()=>{var V,$;if(!T)return;const F=_.split(` 5992`).map(B=>B.trim()).filter(Boolean);if(F.length===0){E("Add at least one student (one per line).");return}E(null),k(!0);try{const B=F.map(U=>{const oe=U.includes("@");return{label:U,email:oe?U:void 0}}),ae=await Ue(e),H=await ue.post(`/api/classrooms/${T}/students`,{students:B},{authToken:ae});I(((V=H.data)==null?void 0:V.data)||[]),i("done")}catch(B){E((($=B.data)==null?void 0:$.message)||B.message||"Failed to create students.")}finally{k(!1)}},W=()=>{const F=R.map(V=>`${V.label} ${V.api_key}`).join(` 5993`);navigator.clipboard.writeText(F),M(!0),setTimeout(()=>M(!1),2e3)},K=()=>{const F="Label,API Key,Email",V=R.map(U=>`"${U.label}","${U.api_key}","${U.email}"`).join(` 5994`),$=`${F} 5995${V}`,B=new Blob([$],{type:"text/csv"}),ae=URL.createObjectURL(B),H=document.createElement("a");H.href=ae,H.download="student-api-keys.csv",H.click(),URL.revokeObjectURL(ae)},q=[{key:"name",label:"Name"},{key:"template",label:"Template"},{key:"students",label:"Students"},{key:"done",label:"Done"}],J=q.findIndex(F=>F.key===o);return r.jsxs("div",{className:"mx-auto max-w-2xl space-y-8 px-4 py-8",children:[r.jsxs("button",{onClick:()=>t("/classrooms"),className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors",children:[r.jsx(cn,{className:"h-4 w-4"}),"Back to Classrooms"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Create a Classroom"}),r.jsx("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:"Set up a project with per-student API keys and record isolation."})]}),a&&r.jsx("div",{className:"flex items-center gap-2",children:q.map((F,V)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-full text-xs font-medium ${V<J?"bg-indigo-600 text-white":V===J?"bg-[var(--color-accent-purple)]/15 text-[var(--color-accent-purple)] ring-2 ring-[var(--color-accent-purple)]":"bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)]"}`,children:V<J?r.jsx(Or,{className:"h-4 w-4"}):V+1}),r.jsx("span",{className:`text-xs ${V===J?"font-medium text-[var(--color-fg-default)]":"text-[var(--color-fg-muted)]"}`,children:F.label}),V<q.length-1&&r.jsx("div",{className:"h-px w-8 bg-[var(--color-border-default)]"})]},F.key))}),S&&r.jsx("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/20 bg-[var(--color-semantic-danger-bg)] p-3 text-sm text-[var(--color-semantic-danger)]",children:S}),o==="name"&&!a?r.jsx(hA,{children:r.jsxs("div",{className:"rounded-2xl border border-[var(--color-accent-purple)]/20 bg-[var(--color-accent-purple)]/5 p-6 space-y-4 text-center",children:[r.jsx(lp,{className:"mx-auto h-10 w-10 text-[var(--color-accent-purple)]"}),r.jsx("h2",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Classrooms need a Team plan or higher"}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-muted)] max-w-md mx-auto",children:["Each student gets their own API key and isolated data space. Classrooms are included on Team
5995(",r.jsx(m$,{}),r.jsx(h$,{price:79}),"/mo), Scale, and Enterprise plans, or on dedicated Classroom plans starting at ",r.jsx(m$,{}),r.jsx(h$,{price:49}),"/mo."]}),r.jsx("div",{className:"pt-2",children:r.jsxs("button",{onClick:()=>t("/upgrade?plan=classroom&source=classrooms_setup"),className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-5 py-2.5 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:["View Classroom Plans",r.jsx(Kt,{className:"h-4 w-4"})]})})]})}):null,o==="name"&&a&&r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-default)]",children:[r.jsx(lp,{className:"h-5 w-5 text-[var(--color-accent-purple)]"}),r.jsx("h2",{className:"font-medium",children:"Name your classroom"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-[var(--color-fg-default)] mb-1",children:"Classroom name"}),r.jsx("input",{type:"text",value:l,onChange:F=>c(F.target.value),placeholder:"e.g. API Testing Bootcamp - March 2026",className:"w-full rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus:border-[var(--color-accent-purple)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-purple)]",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-[var(--color-fg-default)] mb-1",children:"Description (optional)"}),r.jsx("input",{type:"text",value:u,onChange:F=>f(F.target.value),placeholder:"e.g. 8-week QA testing course for beginners",className:"w-full rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus:border-[var(--color-accent-purple)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-purple)]"})]}),r.jsx("div",{className:"flex justify-end",children:r.jsxs("button",{onClick:()=>{if(!l.trim()){E("Classroom name is required.");return}E(null),i("template")},className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:["Next",r.jsx(Kt,{className:"h-4 w-4"})]})})]}),o==="template"&&r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-default)]",children:[r.jsx(bd,{className:"h-5 w-5 text-[var(--color-accent-purple)]"}),r.jsx("h2",{className:"font-medium",children:"Choose an exercise template"})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Templates pre-fill collections with sample data and exercise instructions. You can modify everything after creation."}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("button",{onClick:()=>y(null),className:`rounded-xl border p-4 text-left transition-colors ${v===null?"border-[var(--color-accent-purple)] bg-[var(--color-accent-purple)]/10 ring-1 ring-[var(--color-accent-purple)]":"border-[var(--color-border-default)] hover:border-[var(--color-accent-purple)]/50"}`,children:[r.jsx("div",{className:"font-medium text-sm text-[var(--color-fg-default)]",children:"Start blank"}),r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)] mt-0.5",children:"Students practice with the built-in classic API (/api/users)"})]}),h.map(F=>r.jsxs("button",{onClick:()=>y(F.key),className:`rounded-xl border p-4 text-left transition-colors ${v===F.key?"border-[var(--color-accent-purple)] bg-[var(--color-accent-purple)]/10 ring-1 ring-[var(--color-accent-purple)]":"border-[var(--color-border-default)] hover:border-[var(--color-accent-purple)]/50"}`,children:[r.jsx("div",{className:"font-medium text-sm text-[var(--color-fg-default)]",children:F.name}),r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)] mt-0.5",children:F.description}),r.jsx("div",{className:"mt-2 flex gap-2 flex-wrap",children:F.collections.map(V=>r.jsxs("span",{className:"rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5 text-xs text-[var(--color-fg-muted)]",children:[V.name,"
5995(",V.record_count," records)"]},V.slug))})]},F.key))]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsxs("button",{onClick:()=>i("name"),className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors",children:[r.jsx(cn,{className:"h-4 w-4"}),"Back"]}),r.jsxs("button",{onClick:z,disabled:w,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors disabled:opacity-50",children:[w?"Creating...":"Create Classroom",!w&&r.jsx(Kt,{className:"h-4 w-4"})]})]})]}),o==="students"&&r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-fg-default)]",children:[r.jsx(ln,{className:"h-5 w-5 text-[var(--color-accent-purple)]"}),r.jsx("h2",{className:"font-medium",children:"Add students"})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Enter student names or email addresses, one per line. Each student gets their own API key with isolated record space."}),r.jsx("textarea",{value:_,onChange:F=>j(F.target.value),placeholder:`Student 1 5996Student 2 5997[email protected] 5998...`,rows:10,className:"w-full rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm font-mono text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus:border-[var(--color-accent-purple)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-purple)]",autoFocus:!0}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:[_.split(` 5999`).filter(F=>F.trim()).length," student",_.split(` 6000`).filter(F=>F.trim()).length===1?"":"s"," ","entered"]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("button",{onClick:()=>t(`/classrooms/${T}`),className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors",children:"Skip for now"}),r.jsx("button",{onClick:X,disabled:w,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors disabled:opacity-50",children:w?"Generating keys...":"Generate API Keys"})]})]}),o==="done"&&r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[var(--color-semantic-success)]",children:[r.jsx(Or,{className:"h-5 w-5"}),r.jsxs("h2",{className:"font-medium text-[var(--color-fg-default)]",children:["Classroom created with ",R.length," student",R.length===1?"":"s"]})]}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Distribute these API keys to your students. Each key provides isolated access to the classroom project."}),r.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border border-[var(--color-border-default)]",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"sticky top-0 bg-[var(--color-bg-alt)]",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)]",children:"Student"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)]",children:"API Key"})]})}),r.jsx("tbody",{children:R.map(F=>r.jsxs("tr",{className:"border-t border-[var(--color-border-default)]",children:[r.jsx("td",{className:"px-3 py-2 text-[var(--color-fg-default)]",children:F.label}),r.jsx("td",{className:"px-3 py-2 font-mono text-xs text-[var(--color-fg-muted)]",children:F.api_key})]},F.id))})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:W,className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsx(is,{className:"h-4 w-4"}),L?"Copied!":"Copy All"]}),r.jsxs("button",{onClick:K,className:"inline-flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsx(av,{className:"h-4 w-4"}),"Download CSV"]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsxs("button",{onClick:()=>t(`/classrooms/${T}`),className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:["Go to Classroom",r.jsx(Kt,{className:"h-4 w-4"})]})})]})]})}function uAe(){var Gt,es,ls,pr,et,ye,Qe;const{id:e}=Kv(),{getToken:t}=zt(),s=un(),[n,a]=x.useState(null),[o,i]=x.useState([]),[l,c]=x.useState([]),[u,f]=x.use
6000State(null),[h,g]=x.useState(!0),[v,y]=x.useState(null),[_,j]=x.useState("students"),[w,k]=x.useState({}),[S,E]=x.useState(!1),[T,A]=x.useState(""),[R,I]=x.useState(!1),[L,M]=x.useState(!1),[O,z]=x.useState(!1),[X,W]=x.useState(null),[K,q]=x.useState(null),[J,F]=x.useState(null),[V,$]=x.useState(!1),[B,ae]=x.useState(!1),[H,U]=x.useState(null),[oe,fe]=x.useState(null),[Q,le]=x.useState("label"),[Se,we]=x.useState("asc"),[Le,xe]=x.useState(null),[de,Me]=x.useState(null),[je,Ae]=x.useState([]),[Oe,Ke]=x.useState(!1),[ut,De]=x.useState(!1),[ct,rt]=x.useState([]),[mt,vt]=x.useState(null),[gt,Be]=x.useState([]),[ve,be]=x.useState(!1),[nt,Ze]=x.useState(null),he=async(ne,P)=>{var Te;const te=(Te=o.find(st=>st.is_active))==null?void 0:Te.api_key;if(!te)return;fe(ne),U(null);const me=performance.now();try{const st=await fetch(P,{headers:{"x-api-key":te}}),xt=await st.json();U({step:ne,status:st.status,statusText:st.statusText,data:xt,latency:Math.round(performance.now()-me)})}catch{U({step:ne,status:0,statusText:"Network error",data:null,latency:Math.round(performance.now()-me)})}finally{fe(null)}},ke=async ne=>{var P;if(mt===ne){vt(null),Be([]),Ze(null);return}vt(ne),Be([]),Ze(null),be(!0);try{const te=await Ue(t),me=await ue.get(`/api/classrooms/${e}/students/${ne}/logs`,{authToken:te});Be(((P=me.data)==null?void 0:P.data)||[])}catch{Be([])}finally{be(!1)}},Ve=x.useCallback(async()=>{var ne,P,te,me;if(e)try{const Te=await Ue(t),[st,xt]=await Promise.all([ue.get(`/api/classrooms/${e}`,{authToken:Te}),ue.get(`/api/classrooms/${e}/students`,{authToken:Te})]),Et=((ne=st.data)==null?void 0:ne.data)||null;a(Et),i(((P=xt.data)==null?void 0:P.data)||[]);try{const rs=await ue.get(`/api/classrooms/${e}/collections`,{authToken:Te});Ae(((te=rs.data)==null?void 0:te.data)||[])}catch{}if(Et!=null&&Et.template_key)try{const rs=await ue.get(`/api/classrooms/templates/${Et.template_key}`,{authToken:Te});q(((me=rs.data)==null?void 0:me.data)||null)}catch{}}catch(Te){y(Te.message||"Failed to load classroom")}finally{g(!1)}},[e,t]),at=x.useCallback(async()=>{var ne,P,te,me;if(e)try{const Te=await Ue(t),st=await ue.get(`/api/classrooms/${e}/activity`,{authToken:Te});c(((P=(ne=st.data)==null?void 0:ne.data)==null?void 0:P.students)||[]),f(((me=(te=st.data)==null?void 0:te.data)==null?void 0:me.summary)||null),Me(new Date)}catch{}},[e,t]);x.useEffect(()=>{Ve()},[Ve]),x.useEffect(()=>{_==="activity"?at():xe(null)},[_,at]),x.useEffect(()=>{if(_!=="activity")return;const ne=setInterval(()=>{at()},3e4);return()=>clearInterval(ne)},[_,at]);const[,Pt]=x.useState(0);x.useEffect(()=>{if(_!=="activity"||!de)return;const ne=setInterval(()=>Pt(P=>P+1),1e4);return()=>clearInterval(ne)},[_,de]),x.useEffect(()=>{if(J!==null||!n||o.length===0)return;const ne=`classroom_getting_started_${n.id}`,P=localStorage.getItem(ne);if(P!==null){F(P==="open");return}const te=o.some(me=>me.request_count>0);F(!te)},[n,o,J]);const Ct=async ne=>{if(w[ne]){k(P=>{const te={...P};return delete te[ne],te});return}try{const P=await Ue(t),te=await ue.get(`/api/classrooms/${e}/student-key/${ne}`,{authToken:P});k(me=>{var Te,st;return{...me,[ne]:((st=(Te=te.data)==null?void 0:Te.data)==null?void 0:st.api_key)||""}})}catch{}},St=(ne,P)=>{navigator.clipboard.writeText(ne),W(P),setTimeout(()=>W(null),2e3)},Xt=async(ne,P)=>{try{const te=await Ue(t);await ue.patch(`/api/classrooms/${e}/students/${ne}`,{is_active:!P},{authToken:te}),i(me=>me.map(Te=>Te.id===ne?{...Te,is_active:!P}:Te))}catch{}},It=async ne=>{try{const P=await Ue(t);await ue.delete(`/api/classrooms/${e}/students/${ne}`,{authToken:P}),i(te=>te.filter(me=>me.id!==ne))}catch{}},ee=async()=>{var P;if(!e)return;const ne=T.split(` 6001`).map(te=>te.trim()).filter(Boolean);if(ne.length!==0){I(!0);try{const te=ne.map(Te=>({label:Te,email:Te.includes("@")?Te:void 0})),me=await Ue(t);await ue.post(`/api/classrooms/${e}/students`,{students:te},{authToken:me}),A(""),E(!1),Ve()}catch(te){y(((P=te.data)==null?void 0:P.message)||te.message||"Failed to add students.")}finally{I(!1)}}},We=async()=>{var ne;if(e){M(!0);try{const P=await Ue(t);await ue.post(`/api/classrooms/${e}/reset`,{},{authToken:P}),z(!1),Ve()}catch(P){y(((ne=P.data)==null?void 0:ne.message)||P.message||"Failed to reset classroom.")}finally{M(!1)}}},wt=async()=>{try{const ne=await Ue(t),te=await(await fetch(`${ue.get.length,""}https://reqres.in/api/classrooms/${e}/export`,{headers:{Authorization:`Bearer ${ne}`}})).blob(),me=URL.createObjectURL(te),Te=document.createElement("a");Te.href=me,Te.download="classroom-activity.csv",Te.click(),URL.revokeObjectURL(me)}catch{}};if(h)return r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[var(--color-accent-purple)] border-t-transparent"})});const _t=je.length>0,Ee=((Gt=je[0])==null?void 0:Gt.slug)||((es=K==null?void 0:K.collections[0])==null?void 0:es.slug),He=_t&&o.some(ne=>ne.is_active),ie=async ne=>{var P,te;if(e){De(!0);try{const me=await Ue(t),Te=await ue.post(`/api/classrooms/${e}/apply-template`,{template_key:ne},{authToken:me});q(((P=Te.data)==null?void 0:P.data)||null),Ke(!1);const st=await ue.get(`/api/classrooms/${e}/collections`,{authToken:me});Ae(((te=st.data)==null?void 0:te.data)||[]),n&&a({...n,template_key:ne})}catch(me){console.error("Failed to apply template:",me)}finally{De(!1)}}},Ce=async()=>{var ne;if(Ke(!0),ct.length===0)try{const P=await Ue(t),te=await ue.get("/api/classrooms/templates",{authToken:P});rt(((ne=te.data)==null?void 0:ne.data)||[])}catch{}};function Ye(ne){return ne.requests_7d>=5&&ne.requests_7d>0&&ne.errors_7d/ne.requests_7d>.3?"struggling":ne.request_count===0?"not_started":(ne.last_active_at?Date.now()-new Date(ne.last_active_at).getTime()<2*60*60*1e3:!1)?ne.requests_7d<=5?"getting_started":"active":"idle"}function Pe(ne){if(!ne)return"-";const P=Math.max(0,Date.now()-new Date(ne).getTime()),te=Math.floor(P/6e4);if(te<1)return"just now";if(te<60)return`${te}m ago`;const me=Math.floor(te/60);if(me<24)return`${me}h ago`;const Te=Math.floor(me/24);return Te<=7?`${Te}d ago`:new Date(ne).toLocaleDateString()}function Ge(){if(!de)return"";const ne=Math.floor((Date.now()-de.getTime())/1e3);return ne<5?"just now":ne<60?`${ne}s ago`:`${Math.floor(ne/60)}m ago`}const Nt=((ls=K==null?void 0:K.exercises)==null?void 0:ls.length)??0,Tt=!!K&&Nt>0,ss=l.filter(ne=>ne.requests_7d>=5&&ne.requests_7d>0&&ne.errors_7d/ne.requests_7d>.3),Zt=l.filter(ne=>ne.request_count===0),re=Tt&&l.length>0?l.reduce((ne,P)=>
6001ne+P.unique_method_endpoints,0)/l.length:0;function G(ne){Q===ne?we(P=>P==="asc"?"desc":"asc"):(le(ne),we(ne==="label"?"asc":"desc"))}const ge=(()=>{let ne=[...l];return Le==="need_help"?ne=ne.filter(P=>P.requests_7d>=5&&P.requests_7d>0&&P.errors_7d/P.requests_7d>.3):Le==="not_started"&&(ne=ne.filter(P=>P.request_count===0)),ne.sort((P,te)=>{let me=0;switch(Q){case"label":me=P.label.localeCompare(te.label);break;case"requests_7d":me=P.requests_7d-te.requests_7d;break;case"errors_7d":{const Te=P.requests_7d>0?P.errors_7d/P.requests_7d:-1,st=te.requests_7d>0?te.errors_7d/te.requests_7d:-1;me=Te-st;break}case"unique_method_endpoints":me=P.unique_method_endpoints-te.unique_method_endpoints;break;case"last_active_at":{const Te=P.last_active_at?new Date(P.last_active_at).getTime():0,st=te.last_active_at?new Date(te.last_active_at).getTime():0;me=Te-st;break}default:me=0}return Se==="asc"?me:-me}),ne})(),ze={not_started:{label:"Not started",variant:"default"},getting_started:{label:"Getting started",variant:"info"},active:{label:"Active",variant:"success"},idle:{label:"Idle",variant:"warning"},struggling:{label:"Needs help",variant:"destructive"}};return n?r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 px-4 py-8",children:[r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>s("/classrooms"),className:"inline-flex items-center gap-1 text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition-colors mb-4",children:[r.jsx(cn,{className:"h-4 w-4"}),"All Classrooms"]}),r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/10 text-[var(--color-accent-purple)]",children:r.jsx(lp,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:n.project_name}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--color-fg-muted)] mt-0.5",children:[r.jsxs("span",{children:[n.student_count," / ",n.student_limit," students"]}),n.template_key&&r.jsxs("button",{onClick:()=>$(!V),className:"inline-flex items-center gap-1 rounded bg-[var(--color-accent-purple)]/10 px-1.5 py-0.5 text-[var(--color-accent-purple)] hover:bg-[var(--color-accent-purple)]/20 transition-colors cursor-pointer",children:[(K==null?void 0:K.name)||n.template_key,r.jsx(sr,{className:`w-3 h-3 transition-transform ${V?"rotate-180":""}`})]})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:wt,className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] px-3 py-1.5 text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsx(av,{className:"h-3.5 w-3.5"}),"Export CSV"]}),r.jsxs("button",{onClick:()=>z(!0),className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-semantic-danger)]/20 px-3 py-1.5 text-xs text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)] transition-colors",children:[r.jsx(Kfe,{className:"h-3.5 w-3.5"}),"Reset Data"]})]})]})]}),V&&K&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-accent-purple)]/20 bg-[var(--color-accent-purple)]/5 p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:K.name}),r.jsx("p",{className:"mt-0.5 text-xs text-[var(--color-fg-muted)]",children:K.description})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide",children:"Collections"}),K.collections.map(ne=>{var P;return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:ne.name}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:[ne.record_count," records"]})]}),((P=ne.schema)==null?void 0:P.properties)&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:Object.entries(ne.schema.properties).map(([te,me])=>r.jsxs("span",{className:"rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--color-fg-muted)]",children:[te,": ",me.type]},te))})]},ne.slug)})]}),K.exercises.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide",children:"Exercises"}),r.jsx("ol",{className:"list-decimal list-inside space-y-1 text-xs text-[var(--color-fg-default)]",children:K.exercises.map((ne,P)=>r.jsx("li",{children:ne},P))})]})]}),v&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/20 bg-[var(--color-semantic-danger-bg)] p-3 text-sm text-[var(--color-semantic-danger)]",children:[v,r.jsx("button",{onClick:()=>y(null),className:"ml-2 underline",children:"Dismiss"})]}),O&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-semantic-danger)]/20 bg-[var(--color-semantic-danger-bg)] p-4",children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-semantic-danger)]",children:"Reset all classroom data?"}),r.jsx("p",{className:"mt-1 text-xs text-[var(--color-semantic-danger)]/80",children:"This will delete all student records and re-seed from the template. Student API keys will remain active. This cannot be undone."}),r.jsxs("div",{className:"mt-3 flex gap-2",children:[r.jsx("button",{onClick:We,disabled:L,className:"rounded-lg bg-red-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-red-700 disabled:opacity-50",children:L?"Resetting...":"Yes, Reset"}),r.jsx("button",{onClick:()=>z(!1),className:"rounded-lg border border-[var(--color-border-default)] px-3 py-1.5 text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",children:"Cancel"})]})]}),r.jsxs("div",{className:"flex gap-1 border-b border-[var(--color-border-default)]",children:[r.jsxs("button",{onClick:()=>j("students"),className:`inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${_==="students"?"border-[var(--color-accent-purple)] text-[var(--color-accent-purple)]":"border-transparent text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,children:[r.jsx(ln,{className:"h-4 w-4"}),"Students (",o.length,")"]}),r.jsxs("button",{onClick:()=>j("activity"),className:`inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${_==="activity"?"border-[var(--color-accent-purple)] text-[var(--color-accent-purple)]":"border-transparent text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,children:[r.jsx(Y_,{className:"h-4 w-4"}),"Activity"]})]}),_==="students"&&r.jsxs("div",{className:"space-y-4",children:[o.length>0&&J!==null&&r.jsx(J7,{type:"single",collapsible:!0,value:J?"getting-started":"",onValueChange:ne=>{const P=ne==="getting-started";F(P),n&&localStorage.setItem(`classroom_getting_started_${n.id}`,P?"open":"closed")},children:r.jsxs(Ox,{value:"getting-started",children:[r.jsx(Lx,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bd,{className:"h-4 w-4 text-[var(--color-accent-purple)]"}),r.jsx("span",{children:"Get your students started"})]})}),r.jsx(Dx,{children:r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/15 text-[10px] font-bold text-[var(--color-accent-purple)]",children:"1"}),r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Share API keys with students"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] ml-7",children:"Each student has a unique API key that isolates their data. Copy all keys below and distribute them to your students (e.g. via email, LMS, or handout)."}),r.jsxs("div",{className:"ml-7 flex gap-2",children:[r.jsxs("button",{onClick:()=>{const ne=o.filter(P=>P.is_active).map(P=>`${P.label} ${P.api_key}`).join(` 6002`);navigator.clipboard.writeText(ne),ae(!0),setTimeout(()=>ae(!1),2e3)},className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsx(is,{className:"h-3 w-3"}),B?"Copied!":"Copy All Keys"]}),r.jsxs("button",{onClick:wt,className:"inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[r.jsx(av,{className:"h-3 w-3"}),"Download CSV"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/15 text-[10px] font-bold text-[var(--color-accent-purple)]",children:"2"}),r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Warm up with a simple request"})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] ml-7",children:["Every request needs the student's API key in the"," ",r.jsx("code",{className:"rounded bg-[var(--color-bg-alt)] px-1 py-0.5 font-mono text-[10px]",children:"x-api-key"})," header."," ","Start with the built-in sample data:"]}),r.jsxs("div",{className:"ml-7",children:[r.jsx(Vt,{variants:[{id:"curl",label:"curl",language:"bash",code:`curl -H "x-api-key: YOUR_STUDENT_API_KEY" \\ 6003 ${$s}/api/users?page=1`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const res = await fetch( 6004 '${$s}/api/users?page=1', 6005 { 6006 headers: { 6007 'x-api-key': 'YOUR_STUDENT_API_KEY', 6008 }, 6009 } 6010); 6011const data = await res.json(); 6012console.log(data);`}]}),o.some(ne=>ne.is_active)&&r.jsxs("div",{className:"mt-2 space-y-2",children:[r.jsxs("button",{type:"button",onClick:()=>he(2,`${$s}/api/users?page=1`),disabled:oe!==null,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:[r.jsx(cp,{className:"h-3 w-3"}),oe===2?"Sending...":"Try it"," - using ",(pr=o.find(ne=>ne.is_active))==null?void 0:pr.label,"'s key"]}
6012),(H==null?void 0:H.step)===2&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsxs("span",{className:H.status>=200&&H.status<300?"text-[var(--color-semantic-success)]":"text-[var(--color-semantic-danger)]",children:[H.status>=200&&H.status<300?r.jsx(ts,{className:"h-3.5 w-3.5 inline mr-1"}):r.jsx(lr,{className:"h-3.5 w-3.5 inline mr-1"}),H.status," ",H.statusText]}),r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["· ",H.latency,"ms"]})]}),r.jsx("div",{className:"max-h-64 overflow-auto rounded text-xs",children:r.jsx(aa,{json:JSON.stringify(H.data,null,2)})})]})]})]})]}),Ee?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/15 text-[10px] font-bold text-[var(--color-accent-purple)]",children:"3"}),r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Access classroom collections"})]}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)] ml-7",children:["Students share the seed data for reading. When they create, update, or delete records, those changes are scoped to them - they can't affect each other's work."," ","Here's an example using the ",r.jsx("strong",{children:((et=je[0])==null?void 0:et.name)||((ye=K==null?void 0:K.collections[0])==null?void 0:ye.name)||Ee})," collection:"]}),r.jsxs("div",{className:"ml-7",children:[r.jsx(Vt,{variants:[{id:"curl",label:"curl",language:"bash",code:`curl -H "x-api-key: YOUR_STUDENT_API_KEY" \\ 6013 ${$s}/api/collections/${Ee}/records`},{id:"javascript",label:"JavaScript",language:"javascript",code:`const res = await fetch( 6014 '${$s}/api/collections/${Ee}/records', 6015 { 6016 headers: { 6017 'x-api-key': 'YOUR_STUDENT_API_KEY', 6018 }, 6019 } 6020); 6021const data = await res.json(); 6022console.log(data);`}]}),He&&r.jsxs("div",{className:"mt-2 space-y-2",children:[r.jsxs("button",{type:"button",onClick:()=>he(3,`${$s}/api/collections/${Ee}/records`),disabled:oe!==null,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:[r.jsx(cp,{className:"h-3 w-3"}),oe===3?"Sending...":"Try it"," - using ",(Qe=o.find(ne=>ne.is_active))==null?void 0:Qe.label,"'s key"]}),r.jsx("p",{className:"text-[10px] text-[var(--color-fg-muted)]",children:"Requests made here will appear in the Activity tab for the student whose key is used."}),(H==null?void 0:H.step)===3&&r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsxs("span",{className:H.status>=200&&H.status<300?"text-[var(--color-semantic-success)]":"text-[var(--color-semantic-danger)]",children:[H.status>=200&&H.status<300?r.jsx(ts,{className:"h-3.5 w-3.5 inline mr-1"}):r.jsx(lr,{className:"h-3.5 w-3.5 inline mr-1"}),H.status," ",H.statusText]}),r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:["· ",H.latency,"ms"]})]}),r.jsx("div",{className:"max-h-64 overflow-auto rounded text-xs",children:r.jsx(aa,{json:JSON.stringify(H.data,null,2)})})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/15 text-[10px] font-bold text-[var(--color-accent-purple)]",children:"4"}),r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:K?"Work through exercises":"Try common operations"})]}),K&&K.exercises.length>0?r.jsx("ol",{className:"ml-7 list-decimal list-inside space-y-1 text-xs text-[var(--color-fg-default)]",children:K.exercises.map((ne,P)=>r.jsx("li",{children:ne},P))}):r.jsxs("ul",{className:"ml-7 space-y-1 text-xs text-[var(--color-fg-default)]",children:[r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"rounded bg-[var(--color-semantic-success)]/15 px-1 py-0.5 font-mono text-[10px] text-[var(--color-semantic-success)]",children:"GET"}),"List records from a collection"]}),r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"rounded bg-[var(--color-semantic-info)]/15 px-1 py-0.5 font-mono text-[10px] text-[var(--color-semantic-info)]",children:"POST"}),"Create a new record"]}),r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"rounded bg-[var(--color-semantic-warning)]/15 px-1 py-0.5 font-mono text-[10px] text-[var(--color-semantic-warning)]",children:"PATCH"}),"Update an existing record"]}),r.jsxs("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"rounded bg-[var(--color-semantic-danger)]/15 px-1 py-0.5 font-mono text-[10px] text-[var(--color-semantic-danger)]",children:"DELETE"}),"Delete a record"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[var(--color-accent-purple)]/15 text-[10px] font-bold text-[var(--color-accent-purple)]",children:"3"}),r.jsx("h4",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Add an exercise template"})]}),r.jsxs("div",{className:"ml-7 space-y-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Students can already practice with the classic API above. Want to give them structured exercises with custom collections?"}),r.jsxs("button",{type:"button",onClick:Ce,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700 transition-colors",children:[r.jsx(bd,{className:"h-3 w-3"}),"Choose a template"]}),Oe&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h5",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Choose a template"}),r.jsx("button",{type:"button",onClick:()=>Ke(!1),className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",children:"Cancel"})]}),ct.length===0?r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Loading templates..."}):r.jsx("div",{className:"space-y-2",children:ct.map(ne=>r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] p-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:ne.name}),r.jsx("button",{type:"button",onClick:()=>ie(ne.key),disabled:ut,className:"rounded-md bg-indigo-600 px-2.5 py-1 text-xs font-medium text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:ut?"Applying...":"Use this"})]}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:ne.description}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-[var(--color-fg-muted)]",children:[ne.collections.map(P=>r.jsxs("span",{className:"rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5",children:[P.name," (",P.record_count," records)"]},P.slug)),ne.exercises.length>0&&r.jsxs("span",{className:"rounded bg-[var(--color-accent-purple)]/10 px-1.5 py-0.5 text-[var(--color-accent-purple)]",children:[ne.exercises.length," exercises"]})]})]},ne.key))})]})]})]})]})})]})}),r.jsx("div",{className:"flex justify-end",children:r.jsxs("button",{onClick:()=>E(!S),className:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700 transition-colors",children:[r.jsx(ca,{className:"h-3.5 w-3.5"}),"Add Students"]})}),S&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4 space-y-3",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Enter student names or emails, one per line."}),r.jsx("textarea",{value:T,onChange:ne=>A(ne.target.value),rows:5,placeholder:"Student name or email, one per line",className:"w-full rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)] px-3 py-2 text-sm font-mono text-[var(--color-fg-default)] placeholder:text-[var(--color-fg-muted)] focus:border-[var(--color-accent-purple)] focu
6022s:outline-none focus:ring-1 focus:ring-[var(--color-accent-purple)]",autoFocus:!0}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{E(!1),A("")},className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",children:"Cancel"}),r.jsx("button",{onClick:ee,disabled:R,className:"rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:R?"Adding...":"Generate Keys"})]})]}),o.length===0?r.jsx("p",{className:"text-center text-sm text-[var(--color-fg-muted)] py-8",children:'No students yet. Click "Add Students" to generate API keys.'}):r.jsx("div",{className:"overflow-hidden rounded-xl border border-[var(--color-border-default)]",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-[var(--color-bg-alt)]",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)]",children:"Student"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)]",children:"API Key"}),r.jsx("th",{className:"px-3 py-2 text-right font-medium text-[var(--color-fg-muted)]",children:"Requests"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)]",children:"Last Active"}),r.jsx("th",{className:"px-3 py-2 text-right font-medium text-[var(--color-fg-muted)]",children:"Actions"})]})}),r.jsx("tbody",{children:o.map(ne=>r.jsxs("tr",{className:`border-t border-[var(--color-border-default)] ${ne.is_active?"":"opacity-50"}`,children:[r.jsxs("td",{className:"px-3 py-2",children:[r.jsx("div",{className:"font-medium text-[var(--color-fg-default)]",children:ne.label}),!ne.is_active&&r.jsx("span",{className:"text-xs text-[var(--color-semantic-danger)]",children:"Deactivated"})]}),r.jsx("td",{className:"px-3 py-2 font-mono text-xs text-[var(--color-fg-muted)]",children:w[ne.id]||ne.api_key_preview}),r.jsx("td",{className:"px-3 py-2 text-right text-[var(--color-fg-muted)]",children:ne.request_count.toLocaleString()}),r.jsx("td",{className:"px-3 py-2 text-[var(--color-fg-muted)]",children:ne.last_active_at?new Date(ne.last_active_at).toLocaleDateString():"Never"}),r.jsx("td",{className:"px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx("button",{onClick:()=>Ct(ne.id),className:"rounded p-1 text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",title:w[ne.id]?"Hide key":"Show key",children:w[ne.id]?r.jsx(bh,{className:"h-3.5 w-3.5"}):r.jsx(za,{className:"h-3.5 w-3.5"})}),r.jsxs("button",{onClick:()=>St(ne.api_key,ne.id),className:"relative rounded p-1 text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",title:"Copy API key",children:[r.jsx(is,{className:"h-3.5 w-3.5"}),X===ne.id&&r.jsx("span",{className:"absolute mt-6 -ml-4 rounded bg-black/75 px-1.5 py-0.5 text-[10px] text-white whitespace-nowrap",children:"Copied"})]}),r.jsx("button",{onClick:()=>Xt(ne.id,ne.is_active),className:"rounded p-1 text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)]",title:ne.is_active?"Deactivate":"Reactivate",children:ne.is_active?r.jsx(Che,{className:"h-3.5 w-3.5"}):r.jsx(Nhe,{className:"h-3.5 w-3.5"})}),r.jsx("button",{onClick:()=>It(ne.id),className:"rounded p-1 text-[var(--color-semantic-danger)]/60 hover:text-[var(--color-semantic-danger)] hover:bg-[var(--color-semantic-danger-bg)]",title:"Remove student",children:r.jsx(nl,{className:"h-3.5 w-3.5"})})]})})]},ne.id))})]})})]}),_==="activity"&&r.jsxs("div",{className:"space-y-4",children:[u&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2",children:[r.jsx("span",{className:"text-[10px] text-[var(--color-fg-muted)]",children:de&&`Updated ${Ge()}`}),r.jsxs("button",{onClick:at,className:"inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] hover:bg-[var(--color-bg-alt)] transition-colors",title:"Refresh activity",children:[r.jsx(bw,{className:"h-3 w-3"}),"Refresh"]})]}),r.jsxs("div",{className:`grid gap-4 ${Tt?"grid-cols-3":"grid-cols-2"}`,children:[Tt&&r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-4",children:[r.jsxs("div",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:["~",Math.round(re)," / ",Nt]}),r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Avg Exercise Progress"})]}),r.jsxs("button",{onClick:()=>xe(Le==="need_help"?null:"need_help"),className:`rounded-xl border p-4 text-left transition-colors ${Le==="need_help"?"border-[var(--color-semantic-danger)]/40 bg-[var(--color-semantic-danger-bg)]":"border-[var(--color-border-default)] bg-[var(--color-bg-card)] hover:border-[var(--color-semantic-danger)]/20"}`,children:[r.jsx("div",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:ss.length}),r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Need Help"})]}),r.jsxs("button",{onClick:()=>xe(Le==="not_started"?null:"not_started"),className:`rounded-xl border p-4 text-left transition-colors ${Le==="not_started"?"border-[var(--color-semantic-warning)]/40 bg-[var(--color-semantic-warning-bg)]":"border-[var(--color-border-default)] bg-[var(--color-bg-card)] hover:border-[var(--color-semantic-warning)]/20"}`,children:[r.jsx("div",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:Zt.length}),r.jsx("div",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:"Not Started"})]})]}),Le&&r.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-[var(--color-fg-muted)]",children:["Showing: ",Le==="need_help"?"students needing help":"students not started",r.jsx("button",{onClick:()=>xe(null),className:"underline hover:text-[var(--color-fg-default)]",children:"Clear filter"})]})]}),l.length===0?r.jsxs("div",{className:"rounded-xl border border-dashed border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6 text-center space-y-3",children:[r.jsx(Y_,{className:"mx-auto h-8 w-8 text-[var(--color-fg-muted)] opacity-40"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"No activity yet"}),r.jsx("p",{className:"mt-1 text-xs text-[var(--color-fg-muted)]",children:"Once students start making API requests, you'll see:"})]}),r.jsxs("ul",{className:"mx-auto max-w-xs space-y-1.5 text-left text-xs text-[var(--color-fg-muted)]",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Or,{className:"h-3 w-3 shrink-0"}
6022),"Student status and exercise progress"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Or,{className:"h-3 w-3 shrink-0"}),"Request counts and error rates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Or,{className:"h-3 w-3 shrink-0"}),"Who needs help and who hasn't started"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Or,{className:"h-3 w-3 shrink-0"}),"Live activity timestamps"]})]})]}):r.jsx("div",{className:"overflow-hidden rounded-xl border border-[var(--color-border-default)]",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-[var(--color-bg-alt)]",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)] cursor-pointer select-none",onClick:()=>G("label"),children:r.jsxs("span",{className:"inline-flex items-center gap-1",children:["Student",Q==="label"?Se==="asc"?r.jsx(Df,{className:"h-3 w-3"}):r.jsx(Lf,{className:"h-3 w-3"}):r.jsx(Ou,{className:"h-3 w-3 opacity-30"})]})}),r.jsx("th",{className:"px-3 py-2 text-right font-medium text-[var(--color-fg-muted)] curs
6022or-pointer select-none",onClick:()=>G("requests_7d"),children:r.jsxs("span",{className:"inline-flex items-center justify-end gap-1",children:["Requests (7d)",Q==="requests_7d"?Se==="asc"?r.jsx(Df,{className:"h-3 w-3"}):r.jsx(Lf,{className:"h-3 w-3"}):r.jsx(Ou,{className:"h-3 w-3 opacity-30"})]})}),r.jsx("th",{className:"px-3 py-2 text-right font-medium text-[var(--color-fg-muted)] cursor-pointer select-none",onClick:()=>G("errors_7d"),children:r.jsxs("span",{className:"inline-flex items-center justify-end gap-1",children:["Error Rate",Q==="errors_7d"?Se==="asc"?r.jsx(Df,{className:"h-3 w-3"}):r.jsx(Lf,{className:"h-3 w-3"}):r.jsx(Ou,{className:"h-3 w-3 opacity-30"})]})}),Tt&&r.jsx("th",{className:"px-3 py-2 text-right font-medium text-[var(--color-fg-muted)] cursor-pointer select-none",onClick:()=>G("unique_method_endpoints"),children:r.jsxs("span",{className:"inline-flex items-center justify-end gap-1",children:["Exercises",Q==="unique_method_endpoints"?Se==="asc"?r.jsx(Df,{className:"h-3 w-3"}):r.jsx(Lf,{className:"h-3 w-3"}):r.jsx(Ou,{className:"h-3 w-3 opacity-30"})]})}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-[var(--color-fg-muted)] curs
6022or-pointer select-none",onClick:()=>G("last_active_at"),children:r.jsxs("span",{className:"inline-flex items-center gap-1",children:["Last Active",Q==="last_active_at"?Se==="asc"?r.jsx(Df,{className:"h-3 w-3"}):r.jsx(Lf,{className:"h-3 w-3"}):r.jsx(Ou,{className:"h-3 w-3 opacity-30"})]})})]})}),r.jsx("tbody",{children:ge.map(ne=>{const P=Ye(ne),{label:te,variant:me}=ze[P],Te=ne.requests_7d>0?ne.errors_7d/ne.requests_7d:0,st=Math.round(Te*100),xt=ne.requests_7d===0?"":st<=10?"bg-[var(--color-semantic-success-bg)] text-[var(--color-semantic-success)]":st<=30?"bg-[var(--color-semantic-warning-bg)] text-[var(--color-semantic-warning)]":"bg-[var(--color-semantic-danger-bg)] text-[var(--color-semantic-danger)]",Et=ne.unique_method_endpoints,rs=Et===0?"text-[var(--color-fg-muted)]":Et>=7?"text-[var(--color-semantic-success)] font-medium":Et>=4?"text-[var(--color-semantic-info)]":"text-[var(--color-fg-default)]",Rt=mt===ne.student_id,xs=Tt?5:4;return r.jsxs(x.Fragment,{children:[r.jsxs("tr",{className:`border-t border-[var(--color-border-default)] cursor-pointer hover:bg-[var(--color-bg-alt)]/50 transition-colors ${P==="not_started"?"bg-[var(--color-semantic-warning-bg)]/50":""} ${Rt?"bg-[var(--color-bg-alt)]/50":""}`,onClick:()=>ke(ne.student_id),children:[r.jsxs("td",{className:"px-3 py-2",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Rt?r.jsx(sr,{className:"h-3 w-3 text-[var(--color-fg-muted)]"}):r.jsx(Hn,{className:"h-3 w-3 text-[var(--color-fg-muted)]"}),r.jsx("span",{className:"font-medium text-[var(--color-fg-default)]",children:ne.label})]}),r.jsx(ui,{variant:me,className:"ml-2 text-[10px] px-1.5 py-0",children:te})]}),r.jsx("td",{className:"px-3 py-2 text-right text-[var(--color-fg-muted)]",children:ne.requests_7d}),r.jsx("td",{className:"px-3 py-2 text-right",children:ne.requests_7d===0?r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"-"}):r.jsxs("span",{className:`inline-block rounded px-1.5 py-0.5 text-xs ${xt}`,children:[ne.errors_7d," / ",ne.requests_7d," (",st,"%)"]})}),Tt&&r.jsx("td",{className:"px-3 py-2 text-right",children:r.jsx("span",{className:rs,children:Et===0?"-":`~${Et}/${Nt}`})}),r.jsx("td",{className:"px-3 py-2 text-[var(--color-fg-muted)]",children:ne.last_active_at?Pe(ne.last_active_at):"Never"})]}),Rt&&r.jsx("tr",{children:r.jsx("td",{colSpan:xs,className:"p-0",children:r.jsx("div",{className:"bg-[var(--color-bg-alt)] border-t border-[var(--color-border-default)] px-4 py-3",children:ve?r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Loading requests..."}):gt.length===0?r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"No requests yet"}):r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[10px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:"Recent requests"}),gt.map(jt=>{const qs=nt===jt.id,pn={GET:"bg-[var(--color-semantic-success)]/15 text-[var(--color-semantic-success)]",POST:"bg-[var(--color-semantic-info)]/15 text-[var(--color-semantic-info)]",PUT:"bg-[var(--color-accent-purple)]/15 text-[var(--color-accent-purple)]",PATCH:"bg-[var(--color-semantic-warning)]/15 text-[var(--color-semantic-warning)]",DELETE:"bg-[var(--color-semantic-danger)]/15 text-[var(--color-semantic-danger)]"}[jt.method.toUpperCase()]||"bg-[var(--color-bg-alt)] text-[var(--color-fg-muted)]",Gn=jt.status>=400?"text-[var(--color-semantic-danger)] font-medium":jt.status>=200&&jt.status<300?"text-[var(--color-semantic-success)]":"text-[var(--color-fg-muted)]";return r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:Zs=>{Zs.stopPropagation(),Ze(qs?null:jt.id)},className:`w-full flex items-center gap-3 rounded-md px-2.5 py-1.5 text-xs hover:bg-[var(--color-bg-card)] transition-colors text-left ${qs?"bg-[var(--color-bg-card)]":""}`,children:[r.jsx("span",{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold ${pn}`,children:jt.method.toUpperCase()}),r.jsxs("span",{className:"text-[var(--color-fg-default)] font-mono truncate flex-1",title:jt.path+(jt.query_string?`?${jt.query_string}`:""),children:[jt.path,jt.query_string?`?${jt.query_string}`:""]}),r.jsx("span",{className:`font-mono ${Gn}`,children:jt.status}),r.jsxs("span",{className:"text-[var(--color-fg-muted)] tabular-nums",children:[jt.latency_ms,"ms"]}),r.jsx("span",{className:"text-[var(--color-fg-muted)] whitespace-nowrap",children:Pe(jt.created_at)})]}),qs&&r.jsxs("div",{className:"ml-2 mt-1 mb-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-3 space-y-3",onClick:Zs=>Zs.stopPropagation(),children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-1.5",children:"Request headers"}),r.jsx("div",{className:"rounded border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-2.5 text-[11px]",children:jt.request_headers&&Object.keys(jt.request_headers).length>0?Object.entries(jt.request_headers).map(([Zs,Cr])=>r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("span",{className:"text-[var(--color-fg-muted)] shrink-0",children:[Zs,":"]}),r.jsx("span",{className:"text-[var(--color-fg-secondary)] break-all",children:Cr})]},Zs)):r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"No headers captured"})})]}),jt.request_body&&jt.request_body!=="-"&&r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-1.5",children:"Request body"}),r.jsx(aa,{json:(()=>{try{return JSON.stringify(JSON.parse(jt.request_body),null,2)}catch{return jt.request_body}})(),className:"max-h-48 text-[11px]"})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-[10px] font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-1.5",children:["Response ",r.jsx("span",{className:Gn,children:jt.status})]}),jt.response_body&&jt.response_body!=="-"?r.jsx(aa,{json:(()=>{try{return JSON.stringify(JSON.parse(jt.response_body),null,2)}catch{return jt.response_body}})(),className:"max-h-48 text-[11px]"}):r.jsx("div",{className:"rounded border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-2.5 text-[11px] text-[var(--color-fg-muted)]",children:"No body"})]})]})]},jt.id)})]})})})})]},ne.student_id)})})]})})]})]}):r.jsx("div",{className:"mx-auto max-w-5xl px-4 py-8",children:r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:"Classroom not found."})})}function pAe(e){return e>=500?"text-[var(--color-semantic-danger)]":e>=400?"text-[var(--color-semantic-warning)]":"text-[var(--color-semantic-success)]"}
6022function fAe(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function hAe({keyId:e}){const{getToken:t}=zt(),[s,n]=x.useState([]),[a,o]=x.useState(!0),[i,l]=x.useState(null),[c,u]=x.useState(null),[f,h]=x.useState({}),[g,v]=x.useState(null),[y,_]=x.useState(null),j=x.useCallback(async()=>{var S;try{o(!0),l(null);const E=await Ue(t),T=await ue.get(`/api/agent-keys/${e}/trajectories`,{authToken:E});n(((S=T.data)==null?void 0:S.data)||[])}catch(E){l(E.message||"Failed to load trajectories")}finally{o(!1)}},[t,e]);x.useEffect(()=>{j()},[j]);const w=async S=>{if(c===S){u(null);return}if(u(S),!f[S])try{v(S);const E=await Ue(t),T=await ue.get(`/api/agent-keys/${e}/trajectories/${encodeURIComponent(S)}`,{authToken:E});h(A=>{var R;return{...A,[S]:((R=T.data)==null?void 0:R.data)||[]}})}catch{}finally{v(null)}},k=async S=>{try{_(S);const E=await Ue(t),T=await fetch(`${$s}/api/agent-keys/${e}/trajectories/${encodeURIComponent(S)}/export`,{headers:{Authorization:`Bearer ${E}`}});if(!T.ok)return;const A=await T.blob(),R=URL.createObjectURL(A),I=document.createElement("a");I.href=R,I.download=`trajectory-${S}.jsonl`,document.body.appendChild(I),I.click(),I.remove(),URL.revokeObjectURL(R)}catch{}finally{_(null)}};return r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qfe,{className:"h-4 w-4 text-[var(--color-accent-purple)]"}),r.jsx("h2",{className:"text-base font-medium text-[var(--color-fg-default)]",children:"Trajectories"})]}),r.jsxs("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:["Every call made with your agent key, grouped into runs. Send an"," ",r.jsx("code",{className:"text-xs",children:"X-Agent-Run-Id"})," header to name a run; without it, calls group by a rolling 30 minute window. Export a run as JSONL to replay or diff it."]})]}),r.jsx("button",{type:"button",onClick:j,className:"flex-none rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 py-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]","aria-label":"Refresh trajectories",children:r.jsx(Eq,{className:`h-3.5 w-3.5 ${a?"animate-spin":""}`})})]}),i&&r.jsx("p",{className:"mt-4 text-sm text-[var(--color-semantic-danger)]",children:i}),!a&&!i&&s.length===0&&r.jsxs("div",{className:"mt-4 rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-muted)] p-4 text-sm text-[var(--color-fg-muted)]",children:["No trajectories yet. Make a few requests to"," ",r.jsx("code",{className:"text-xs",children:"/agent/v1/*"})," with your"," ",r.jsx("code",{className:"text-xs",children:"x-agent-id"})," header and they will show up here as a run."]}),s.length>0&&r.jsx("div",{className:"mt-4 space-y-2",children:s.map(S=>{const E=c===S.run_id,T=f[S.run_id]||[];return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-muted)]",children:[r.jsxs("div",{className:"flex items-center gap-3 p-3",children:[r.jsxs("button",{type:"button",onClick:()=>w(S.run_id),className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[E?r.jsx(sr,{className:"h-4 w-4 flex-none text-[var(--color-fg-muted)]"}):r.jsx(Hn,{className:"h-4 w-4 flex-none text-[var(--color-fg-muted)]"}),r.jsx("code",{className:"truncate text-sm font-mono text-[var(--color-fg-default)]",children:S.run_id}),r.jsx("span",{className:"hidden flex-none text-xs text-[var(--color-fg-muted)] sm:inline",children:fAe(S.started_at)}),r.jsxs("span",{className:"flex-none text-xs text-[var(--color-fg-muted)]",children:[S.calls," ",S.calls===1?"call":"calls"]}),S.error_calls>0&&r.jsxs("span",{className:"flex-none rounded bg-[var(--color-semantic-danger-bg)] px-1.5 py-0.5 text-xs text-[var(--color-semantic-danger)]",children:[S.error_calls," err"]})]}),r.jsxs("button",{type:"button",onClick:()=>k(S.run_id),disabled:y===S.run_id,className:"flex flex-none items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 py-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] disabled:opacity-50","aria-label":`Export ${S.run_id} as JSONL`,children:[r.jsx(av,{className:"h-3.5 w-3.5"}),"JSONL"]})]}),E&&r.jsx("div",{className:"border-t border-[var(--color-border-default)] p-3",children:g===S.run_id?r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:"Loading c
6022alls..."}):r.jsx("ol",{className:"space-y-1",children:T.map(A=>r.jsxs("li",{className:"flex items-baseline gap-2 font-mono text-xs",children:[r.jsx("span",{className:"w-10 flex-none text-right text-[var(--color-fg-muted)]",children:A.seq}),r.jsx("span",{className:`w-8 flex-none ${pAe(A.status)}`,children:A.status}),r.jsx("span",{className:"w-12 flex-none text-[var(--color-fg-muted)]",children:A.method}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--color-fg-default)]",children:A.path}),A.scenario&&r.jsx("span",{className:"flex-none text-[var(--color-accent-purple)]",children:A.scenario}),A.seed!=null&&r.jsxs("span",{className:"hidden flex-none text-[var(--color-fg-muted)] sm:inline",children:["seed ",A.seed]}),r.jsx("span",{className:"w-14 flex-none text-right text-[var(--color-fg-muted)]",children:A.latency_ms!=null?`${A.latency_ms}ms`:""})]},A.seq))})})]},S.run_id)})})]})}function mAe(){var T,A,R,I;Mn("ReqRes for Agents");const{getToken:e}=zt(),[t,s]=x.useState([]),[n,a]=x.useState({}),[o,i]=x.useState([]),[l,c]=x.useState(!0),[u,f]=x.useState(null),[h,g]=x.useState({}),[v,y]=x.useState(null),[_,j]=x.useState(null),w=x.useCallback(async()=>{var L;try{c(!0),f(null);const M=await Ue(e),z=((L=(await ue.get("/api/agent-keys",{authToken:M})).data)==null?void 0:L.data)||[];s(z);const X=await Promise.all(z.map(async K=>{var q;try{const J=await ue.get(`/api/agent-keys/${K.id}/usage`,{authToken:M});return[K.id,(q=J.data)==null?void 0:q.data]}catch{return[K.id,null]}})),W={};for(const[K,q]of X)q&&(W[K]=q);a(W)}catch(M){f(M.message||"Failed to load agent keys")}finally{c(!1)}},[e]);x.useEffect(()=>{w()},[w]),x.useEffect(()=>{let L=!1;return(async()=>{try{const M=await fetch(`${$s}/agent/v1/scenarios`);if(!M.ok||L)return;const O=await M.json();if(L)return;i(Array.isArray(O==null?void 0:O.data)?O.data:[])}catch{}})(),()=>{L=!0}},[]);const k=async(L,M)=>{try{await navigator.clipboard.writeText(L),y(M),setTimeout(()=>y(null),1500)}catch{}},S=async L=>{if(window.confirm("Rotate this agent key? The current value will stop working immediately and you will need to update any code using it."))try{j(L);const O=await Ue(e);await ue.post(`/api/agent-keys/${L}/rotate`,null,{authToken:O}),await w()}catch(O){f(O.message||"Failed to rotate key")}finally{j(null)}};if(l)return r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});const E=t.length>0;return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 px-4 py-8",children:[r.jsx("header",{className:"flex items-start justify-between gap-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(YC,{className:"h-6 w-6 text-[var(--color-accent-purple)]"}),r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"ReqRes for Agents"}),r.jsx("span",{className:"rounded bg-[var(--color-accent-purple)]/10 px-2 py-0.5 text-xs font-medium text-[var(--color-accent-purple)]",children:"New"})]}),r.jsxs("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:["A stable HTTP sandbox for AI coding agents. Deterministic fixtures, failure simulators, and a single header (",r.jsx("code",{children:"x-agent-id"}),") that raises your daily rate limit."]})]})}),u&&r.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-[var(--color-semantic-danger)]/20 bg-[var(--color-semantic-danger-bg)] p-4 text-sm text-[var(--color-semantic-danger)]",children:[r.jsx(GT,{className:"mt-0.5 h-4 w-4 flex-none"}),r.jsx("span",{children:u})]}),!E&&r.jsx(bAe,{}),E&&t.map(L=>r.jsx(yAe,{agentKey:L,usage:n[L.id],revealed:h[L.id]||!1,onToggleReveal:()=>g(M=>({...M,[L.id]:!M[L.id]})),onCopy:()=>k(L.agent_key,L.id),copied:v===L.id,onRotate:()=>S(L.id),rotating:_===L.id},L.id)),E&&t[0]&&r.jsx(hAe,{keyId:t[0].id}),r.jsx(_Ae,{agentKey:((T=t[0])==null?void 0:T.agent_key)||null}),r.jsx(gAe,{scenarios:o,agentKey:((A=t[0])==null?void 0:A.agent_key)||null,isAgentDeveloper:((R=t[0])==null?void 0:R.tier)==="agent_developer"}
6022),r.jsx(xAe,{agentKey:((I=t[0])==null?void 0:I.agent_key)||null})]})}function gAe({scenarios:e,agentKey:t,isAgentDeveloper:s}){const[n,a]=x.useState(null);if(e.length===0)return null;const o=l=>{const c=t?` \\ 6023 -H "x-agent-id: ${t}"`:"";return`curl -i https://reqres.in${l.url}${c}`},i=async l=>{try{await navigator.clipboard.writeText(o(l)),a(l.name),setTimeout(()=>a(null),1500)}catch{}};return r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6",children:[r.jsx("div",{className:"flex items-start justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-medium text-[var(--color-fg-default)]",children:"Failure scenarios"}),r.jsxs("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:[e.length," deliberate failures for exercising retry, backoff, and error handling."," ",s?"All unlocked on your plan.":"Free tier has 3 samples; the rest unlock on Agent Developer."," ","Every response sets"," ",r.jsx("code",{className:"text-xs",children:"X-Agent-Sandbox-Intentional"})," - suppress that header in your error reporter."]})]})}),r.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:e.map(l=>{const c=l.requires_paid_tier&&!s;return r.jsxs("div",{className:`rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-muted)] p-4 ${c?"opacity-60":""}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("code",{className:"text-sm font-mono text-[var(--color-fg-default)]",children:l.name}),r.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-mono text-[var(--color-fg-muted)]",children:l.status_code}),l.simulated_delay_ms?r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)]",children:["· ",l.simulated_delay_ms/1e3,"s simulated"]}):null,c?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--color-fg-muted)]",children:[r.jsx(Ep,{className:"h-3 w-3"})," Paid"]}):null]})]}),r.jsx("button",{type:"button",onClick:()=>i(l),className:"flex-none rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2 py-1 text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]","aria-label":`Copy curl for ${l.name}`,children:n===l.name?r.jsx(Or,{className:"h-3.5 w-3.5 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-3.5 w-3.5"})})]}),r.jsx("p",{className:"mt-2 text-xs leading-relaxed text-[var(--color-fg-muted)]",children:l.description})]},l.name)})})]})}function xAe({agentKey:e}){const t=vAe(e);return r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6",children:[r.jsx("h2",{className:"text-base font-medium text-[var(--color-fg-default)]",children:"Kickstart prompt for your LLM"}),r.jsx("p",{className:"mt-1 mb-4 text-sm text-[var(--color-fg-muted)]",children:"Copy this into Claude Code, Cursor, ChatGPT - whatever you build with - then tell it what to build."}),r.jsx(Vt,{language:"markdown",code:t})]})}function vAe(e){return`I'm wiring up code against ReqRes for Agents - a deterministic HTTP sandbox for AI coding agents. 6024 6025Spec (fetch and read first): 6026 https://reqres.in/llm.txt 6027 https://reqres.in/openapi.json 6028 6029Facts to keep in working memory: 6030- Base URL: https://reqres.in/agent/v1 6031${e?`- Auth: use x-agent-id: ${e} on every request. This is my paid Agent Developer key - do not invent or substitute it.`:"- Auth: free tier is open (no header), capped at 100 requests/day per IP. For higher volume, subscribe at https://app.reqres.in/agents to get an x-agent-id: agt_<64 hex> key. Never invent the value - arbitrary strings return 401."} 6032- Endpoints: GET /users, GET /users/:id (?expand=addresses,activity,organizations), POST /auth/login, GET /orders, GET /scenarios/:name, GET /health. 6033- IDs are ULIDs with a type prefix (usr_, ord_, prd_, adr_, act_). 26 chars after the prefix. 6034- Money is always {amount (integer in smallest unit), currency, formatted}. Never a decimal. 6035- Pagination is cursor-based. Pass meta.next_cursor back unchanged. Treat cursors as opaque. 6036- Deterministic: same (seed, cursor, params) â same response. Default seed=42. 6037- /scenarios/:name exposes 15 deliberate failures for exercising retry/backoff/error paths. Every response sets X-Agent-Sandbox-Intentional; suppress that in your error reporter so training runs don't fill your alert queue. 6038${e?"- All 15 failure scenarios are unlocked for my key.":"- Free tier only unlocks 3 of the 15 scenarios (rate-limited, val
6038idation-error, malformed-json); the rest return 403 until upgrade."} 6039 6040Now please: <tell the agent what to do>`}function bAe(){return r.jsx("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-8",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex h-10 w-10 flex-none items-center justify-center rounded-full bg-[var(--color-accent-purple)]/10 text-[var(--color-accent-purple)]",children:r.jsx(rr,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h2",{className:"text-lg font-medium text-[var(--color-fg-default)]",children:"You're on the free tier"}),r.jsxs("p",{className:"mt-2 text-sm text-[var(--color-fg-muted)]",children:["Anyone can call ",r.jsx("code",{children:"/agent/v1/*"})," without a key - 100 requests per IP per day. Subscribe to the Agent Developer plan ($49/month) to get 10M requests/month, access to every failure scenario, and an",r.jsx("code",{className:"mx-1",children:"x-agent-id"})," header that attributes usage to your account."]}),r.jsxs("div",{className:"mt-5 flex items-center gap-3",children:[r.jsx(dt,{to:"/upgrade?plan=agent_developer&source=agents_dashboard",className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors",children:"Upgrade to Agent Developer"}),r.jsx("a",{href:"https://reqres.in/for/ai-agents",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",children:"Learn more â"})]})]})]})})}function yAe({agentKey:e,usage:t,revealed:s,onToggleReveal:n,onCopy:a,copied:o,onRotate:i,rotating:l}){const c=`agt_${"â¢".repeat(24)}${e.agent_key.slice(-4)}`,u=t?Math.min(100,Math.round(t.used_today/t.limit_today*100)):0,f=u>=90?"bg-[var(--color-semantic-danger)]":u>=75?"bg-[var(--color-semantic-warning)]":"bg-[var(--color-accent-purple)]";return r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-base font-medium text-[var(--color-fg-default)]",children:"Your agent key"}),r.jsx("span",{className:"rounded bg-[var(--color-accent-purple)]/10 px-2 py-0.5 text-xs font-medium text-[var(--color-accent-purple)]",children:e.tier==="agent_developer"?"Agent Developer":"Free"})]}),r.jsxs("p",{className:"mt-1 text-xs text-[var(--color-fg-muted)]",children:["Created ",new Date(e.created_at).toLocaleDateString(),". Pass this in the ",r.jsx("code",{children:"x-agent-id"})," header on every call to",r.jsx("code",{className:"mx-1",children:"/agent/v1/*"}),"."]})]}),r.jsxs(ht,{variant:"secondary",size:"sm",onClick:i,disabled:l,children:[r.jsx(Eq,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`}),"Rotate"]})]}),r.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-muted)] px-3 py-2",children:[r.jsx("code",{className:"flex-1 truncate font-mono text-sm text-[var(--color-fg-default)]",children:s?e.agent_key:c}),r.jsx("button",{type:"button",onClick:n,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]","aria-label":s?"Hide key":"Reveal key",children:s?r.jsx(bh,{className:"h-4 w-4"}):r.jsx(za,{className:"h-4 w-4"})}),r.jsx("button",{type:"button",onClick:a,className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]","aria-label":"Copy key",children:o?r.jsx(Or,{className:"h-4 w-4 text-[var(--color-semantic-success)]"}):r.jsx(is,{className:"h-4 w-4"})})]}),t&&r.jsxs("div",{className:"mt-5",children:[r.jsxs("div",{className:"flex items-baseline justify-between text-sm",children:[r.jsx("span",{className:"text-[var(--color-fg-default)]",children:"Today's usage"}),r.jsxs("span",{className:"font-mono text-xs text-[var(--color-fg-muted)]",children:[t.used_today.toLocaleString()," /"," ",t.limit_today.toLocaleStr
6040ing()]})]}),r.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-[var(--color-bg-muted)]",children:r.jsx("div",{className:`h-full transition-all ${f}`,style:{width:`${u}%`}})}),r.jsxs("p",{className:"mt-2 text-xs text-[var(--color-fg-muted)]",children:["Resets at midnight UTC. ",t.remaining_today.toLocaleString()," ","requests remaining today."]})]})]})}function _Ae({agentKey:e}){const t=e?` \\ 6041 -H "x-agent-id: ${e}"`:"",s=e?`curl https://reqres.in/agent/v1/scenarios/timeout \\ 6042 -H "x-agent-id: ${e}"`:`# /scenarios/timeout is gated to Agent Developer. 6043# Try these free-tier scenarios first: 6044curl https://reqres.in/agent/v1/scenarios/rate-limited 6045curl https://reqres.in/agent/v1/scenarios/validation-error 6046curl https://reqres.in/agent/v1/scenarios/malformed-json`;return r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] p-6",children:[r.jsx("h2",{className:"text-base font-medium text-[var(--color-fg-default)]",children:"Get started"}),r.jsxs("p",{className:"mt-1 text-sm text-[var(--color-fg-muted)]",children:["Three endpoints covering the common shapes agents encounter:"," ",r.jsx("code",{children:"/users"}),", ",r.jsx("code",{children:"/orders"}),", ",r.jsx("code",{children:"/auth/login"}),". Plus ",r.jsx("code",{children:"/scenarios/*"})," for testing retry, backoff, and error handling against deliberate failures."]}),r.jsxs("div",{className:"mt-5 space-y-4",children:[r.jsx(Vt,{title:"Fetch a page of users",language:"bash",code:`curl https://reqres.in/agent/v1/users?limit=2${t}`}),r.jsx(Vt,{title:e?"Trigger a 504 timeout":"Trigger a failure (free-tier scenarios)",language:"bash",code:s}),r.jsx(Vt,{title:"Check your rate-limit headroom",language:"bash",code:`curl https://reqres.in/agent/v1/health${t}`})]}),r.jsxs("div",{className:"mt-5 flex items-center gap-4 text-sm",children:[r.jsx("a",{href:"https://reqres.in/for/ai-agents",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--color-accent-purple)] hover:underline",children:"Full documentation â"}),r.jsx("a",{href:"https://reqres.in/llms.txt",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",children:"llms.txt (machine-readable spec)"})]})]})}const Ux="rr_pending_invite";function jAe(e){try{localStorage.setItem(Ux,JSON.stringify({token:e,timestamp:Date.now()}))}catch(t){console.error("Failed to store pending invite:",t)}}function wAe(){try{const e=localStorage.getItem(Ux);if(!e)return null;const{token:t,timestamp:s}=JSON.parse(e);return Date.now()-s>30*60*1e3?(localStorage.removeItem(Ux),null):t}catch{return localStorage.removeItem(Ux),null}}function OW(){try{localStorage.removeItem(Ux)}catch{}}function NAe(){var j,w;const{token:e}=Kv(),t=un(),{isLoaded:s,isSignedIn:n,getToken:a}=zt(),{user:o,isLoaded:i}=_r(),[l,c]=x.useState({status:"loading"}),[u,f]=x.useState(!1),h=(w=(j=o==null?void 0:o.primaryEmailAddress)==null?void 0:j.emailAddress)==null?void 0:w.toLowerCase(),g=s&&i;x.useEffect(()=>{if(!e){c({status:"not_found"});return}async function k(){try{const S=await ue.get(`/invites/${e}`);c({status:"valid",invite:S.data.data})}catch(S){if(S instanceof yt)if(S.status===404)c({status:"not_found"});else if(S.status===410){const E=S.data;(E==null?void 0:E.error)==="invite_expired"?c({status:"expired",message:E.message||"This invite has expired."}):c({status:"used",message:E.message||"This invite is no longer valid."})}else c({status:"error",message:S.message});else c({status:"error",message:"Failed to load invite details."})}}k()},[e]),x.useEffect(()=>{g&&!n&&e&&l.status==="valid"&&jAe(e)},[g,n,e,l.status]);const v=async()=>{if(e){f(!0);try{const k=await Ue(a);if(!k){it.error("Authentication required");return}const S=await ue.post(`/invites/${e}/accept`,{},{authToken:k});OW(),it.success(S.data.message||"Welcome to the team!"),t("/organizations")}catch(k){if(k instanceof yt){const S=k.data;(S==null?void 0:S.error)==="email_mismatch"?it.error(S.message||"Email mismatch"):it.error((S==null?void 0:S.message)||"Failed to accept invite")}else it.error("Failed to accept invite")}finally{f(!1)}}};if(!g||l.status==="loading")return r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)] flex items-center justify-center",children:r.jsx(on,{className:"h-8 w-8 animate-spin text-[var(--color-fg-muted)]"})});if(l.status==="not_found")return r.jsx(M0,{title:"Invite not found",message:"This invite link is invali
6046d or has been removed."});if(l.status==="expired")return r.jsx(M0,{title:"Invite expired",message:l.message});if(l.status==="used")return r.jsx(M0,{title:"Invite already used",message:l.message});if(l.status==="error")return r.jsx(M0,{title:"Something went wrong",message:l.message});const{invite:y}=l,_=h===y.email.toLowerCase();return r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)] py-16 md:py-24",children:r.jsxs("div",{className:"max-w-lg mx-auto px-4 sm:px-6 space-y-8",children:[r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("div",{className:"inline-flex h-16 w-16 items-center justify-center rounded-full bg-indigo-500/10 border border-indigo-500/20",children:r.jsx(ln,{className:"h-8 w-8 text-indigo-400"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"You've been invited to join"}),r.jsx("h1",{className:"text-3xl font-semibold text-[var(--color-fg-default)] tracking-tight",children:y.organizationName})]})]}),r.jsx("div",{className:`${Mt.dark} space-y-4`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(L2,{label:"Invited by",value:y.invitedBy||"A team member"}),r.jsx(L2,{label:"Your email",value:y.email}),r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Role"}),r.jsx("span",{className:"inline-flex items-center rounded-full bg-indigo-500/10 border border-indigo-500/20 px-2 py-0.5 text-xs text-indigo-300",children:y.role})]}),r.jsx(L2,{label:"Expires",value:new Date(y.expiresAt).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]})}),n?_?r.jsxs("div",{className:"space-y-4",children:[r.jsx("button",{onClick:v,disabled:u,className:`${Jt.primary} w-full justify-center`,children:u?r.jsxs(r.Fragment,{children:[r.jsx(on,{className:"h-4 w-4 animate-spin mr-2"}),"Accepting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Or,{className:"h-4 w-4 mr-2"}),"Accept Invite"]})}),r.jsxs("p",{className:"text-xs text-center text-[var(--color-fg-muted)]",children:["Signed in as ",h]})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-xl border border-yellow-500/20 bg-yellow-500/10 p-4",children:r.jsxs("p",{className:"text-sm text-yellow-200",children:["You're signed in as ",r.jsx("strong",{children:h}),", but this invite was sent to"," ",r.jsx("strong",{children:y.email}),"."]})}),r.jsx(ip,{mode:"modal",children:r.jsxs("button",{className:`${Jt.secondary} w-full justify-center`,children:[r.jsx(yh,{className:"h-4 w-4 mr-2"}),"Sign in with ",y.email]})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(ip,{mode:"modal",children:r.jsx("button",{className:`${Jt.primary} w-full justify-center`,children:"Sign in to accept"})}),r.jsx(Xf,{mode:"modal",children:r.jsx("button",{className:`${Jt.secondary} w-full justify-center`,children:"Create an account"})}),r.jsxs("p",{className:"text-xs text-center text-[var(--color-fg-muted)]",children:["Sign in or create an account with ",r.jsx("strong",{className:"text-[var(--color-fg-muted)]",children:y.email})," to accept this invite."]})]}),r.jsx("div",{className:"text-center",children:r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["ReqRes is the frontend-first backend you call with fetch()."," ",r.jsx("a",{href:"https://reqres.in",className:"underline hover:text-[var(--color-fg-muted)]",children:"Learn more"})]})})]})})}function L2({label:e,value:t}){return r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:e}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:t})]})}function M0({title:e,message:t}){const s=un();return r.jsx("div",{className:"min-h-screen bg-[var(--color-bg-default)] py-16 md:py-24",children:r.jsxs("div",{className:"max-w-lg mx-auto px-4 sm:px-6 text-center space-y-6",children:[r.jsx("div",{className:"inline-flex h-16 w-16 items-center justify-center rounded-full bg-[var(--color-semantic-danger-bg)] border border-[var(--color-semantic-danger)]/20",children:r.jsx(lr,{className:"h-8 w-8 text-[var(--color-semantic-danger)]"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:e}),r.jsx("p",{className:"text-[var(--color-fg-muted)]",children:t})]}),r.jsx("div",{className:"pt-4",children:r.jsx("button",{onClick:()=>
6046s("/dashboard"),className:Jt.primary,children:"Go to Dashboard"})})]})})}function kAe(e){if(Array.isArray(e))return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return[]}function SAe(e){let t=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/^### (.+)$/gm,'<h3 class="text-lg font-semibold text-slate-200 mt-6 mb-2">$1</h3>').replace(/^## (.+)$/gm,'<h2 class="text-xl font-semibold text-slate-100 mt-8 mb-3">$1</h2>').replace(/^# (.+)$/gm,'<h1 class="text-2xl font-bold text-slate-100 mt-4 mb-4">$1</h1>').replace(/\*\*(.+?)\*\*/g,'<strong class="text-slate-200">$1</strong>').replace(/_(.+?)_/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-slate-800 px-1.5 py-0.5 rounded text-sm text-slate-300">$1</code>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,(s,n,a)=>{const o=a.trim();return/^https?:\/\//i.test(o)?`<a href="${o.replace(/"/g,""")}" class="text-indigo-400 hover:text-indigo-300 underline" target="_blank" rel="noopener noreferrer">${n}</a>`:n}).replace(/^---$/gm,'<hr class="border-slate-700 my-4" />').replace(/^\d+\. \[ \] (.+)$/gm,'<li class="flex items-start gap-2 text-slate-300"><span class="text-slate-500">[ ]</span><span>$1</span></li>').replace(/^- (.+)$/gm,'<li class="text-slate-300 ml-4">$1</li>');return t=t.replace(/\|(.+)\|/g,s=>{const n=s.split("|").filter(c=>c.trim());if(n.every(c=>c.trim().match(/^[-:]+$/)))return"";const a=n.some(c=>c.includes("Metric")||c.includes("Category")||c.includes("Status")||c.includes("Tier")||c.includes("Count")||c.includes("Value")||c.includes("Method")||c.includes("Path")),o=a?"th":"td",i=a?"px-3 py-2 text-left text-sm font-medium text-slate-400 border-b border-slate-700":"px-3 py-2 text-sm text-slate-300 border-b border-slate-800";return`<tr>${n.map(c=>`<${o} class="${i}">${c.trim()}</${o}>`).join("")}</tr>`}),t=t.replace(/(<tr>[\s\S]*?<\/tr>\s*)+/g,s=>`<table class="w-full border-collapse my-4">${s}</table>`),t=t.split(` 6047 6048`).map(s=>s.startsWith("<")||s.trim()===""?s:`<p class="text-slate-400 mb-2">${s}</p>`).join(` 6049`),t}function CAe(){const{getToken:e}=zt(),[t,s]=x.useState(!0),[n,a]=x.useState(null),[o,i]=x.useState(null),[l,c]=x.useState([]),[u,f]=x.useState(!1),[h,g]=x.useState(null),v=async()=>{try{const E=await Ue(e),T=await ue.get("/admin/briefings/latest",{authToken:E});i(T.data),a(null)}catch(E){(E==null?void 0:E.status)===404?(i(null),a("No briefings found. Generate your first briefing below.")):a("Failed to load briefing")}},y=async()=>{var E;try{const T=await Ue(e),A=await ue.get("/admin/briefings?limit=30",{authToken:T});c(((E=A.data)==null?void 0:E.data)||[])}catch(T){console.error("Failed to load briefing list:",T)}},_=async E=>{try{s(!0);const T=await Ue(e),A=await ue.get(`/admin/briefings/${E}`,{authToken:T});i(A.data),g(E),a(null)}catch{a(`Failed to load briefing for ${E}`)}finally{s(!1)}},j=async()=>{try{f(!0);const E=await Ue(e);await ue.post("/admin/briefings/generate",{},{authToken:E}),await v(),await y()}catch{a("Failed to generate briefing")}finally{f(!1)}};x.useEffect(()=>{(async()=>{s(!0),await Promise.all([v(),y()]),s(!1)})()},[]);const w=E=>{if(!E)return"Unknown date";const T=E.includes("T")?E:`${E}T00:00:00Z`,A=new Date(T);return isNaN(A.getTime())?"Unknown date":A.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"})},k=E=>E>=80?"High":E>=50?"Medium":"Low";if(t)return r.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:r.jsx(bs,{})});const S=o?kAe(o.todos):[];return r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold text-slate-100",children:"Daily Briefings"}),r.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"ReqRes Morning Briefing - metrics and action items"})]}),r.jsx(ht,{onClick:j,disabled:u,className:"bg-indigo-600 hover:bg-indigo-500",children:u?"Generating...":"Generate Now"})]}),n&&r.jsx("div",{className:`${Mt.dark} border-yellow-500/30 bg-yellow-500/10`,children:r.jsx("p",{className:"text-yellow-400",children:n})}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[r.jsxs("div",{className:Mt.dark,children:[r.jsx("h2",{className:"text-sm font-medium text-slate-400 mb-3",children:"History"}),r.jsx("div",{className:"space-y-2 max-h-[600px] overflow-y-auto",children:l.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No briefings yet"}):l.map(E=>
6049r.jsxs("button",{onClick:()=>_(E.date),className:`w-full text-left p-2 rounded-md transition-colors ${h===E.date?"bg-indigo-500/20 border border-indigo-500/30":"hover:bg-slate-800"}`,children:[r.jsx("div",{className:"text-sm text-slate-200",children:w(E.date)}),r.jsx("div",{className:"text-xs text-slate-500 truncate",children:E.summary})]},E.id))})]}),r.jsx("div",{className:"lg:col-span-3 space-y-6",children:o?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:Mt.dark,children:[r.jsx("h2",{className:"text-lg font-medium text-slate-100 mb-2",children:o.title||`Briefing for ${o.date}`}),r.jsx("p",{className:"text-slate-400",children:o.summary}),r.jsxs("div",{className:"mt-4 flex items-center gap-4 text-xs text-slate-500",children:[r.jsxs("span",{children:["Generated in ",o.generation_time_ms,"ms"]}),o.delivery_status&&r.jsxs("span",{className:"capitalize",children:["Delivery: ",o.delivery_status]})]})]}),r.jsxs("div",{className:Mt.dark,children:[r.jsx("h3",{className:"text-md font-medium text-slate-200 mb-4",children:"Today's TODOs"}),S.length===0?r.jsx("p",{className:"text-slate-500",children:"No action items for this briefing"}):r.jsx("ul",{className:"space-y-4",children:S.map((E,T)=>r.jsxs("li",{className:"flex items-start gap-3 p-3 bg-slate-800/50 rounded-lg",children:[r.jsx("input",{type:"checkbox",checked:E.completed||!1,onChange:()=>{},className:"mt-1 rounded border-slate-600 bg-slate-800"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded ${E.priority>=80?"bg-red-500/20 text-red-400":E.priority>=50?"bg-yellow-500/20 text-yellow-400":"bg-slate-500/20 text-slate-400"}`,children:k(E.priority)}),r.jsx("span",{className:"text-xs text-slate-500 capitalize",children:E.category})]}),r.jsx("p",{className:"text-slate-200 font-medium",children:E.text}),E.action&&r.jsx("p",{className:"text-sm text-slate-400 mt-1",children:E.action}),E.link&&r.jsx("a",{href:E.link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-indigo-400 hover:text-indigo-300 mt-2",children:"View details â"})]})]},T))})]}),r.jsxs("div",{className:Mt.dark,children:[r.jsx("h3",{className:"text-md font-medium text-slate-200 mb-4",children:"Full Report"}),r.jsx("div",{className:"max-w-none",dangerouslySetInnerHTML:{__html:Rp(SAe(o.markdown))}})]})]}):r.jsxs("div",{className:`${Mt.dark} text-center`,children:[r.jsx("p",{className:"text-slate-400 mb-4",children:"No briefing available"}),r.jsx(ht,{onClick:j,disabled:u,className:"bg-indigo-600 hover:bg-indigo-500",children:"Generate First Briefing"})]})})]})]})}/*! 6050 * @kurkle/color v0.3.4 6051 * https://github.com/kurkle/color#readme 6052 * (c) 2024 Jukka Kurkela 6053 * Released under the MIT License 6054 */function cb(e){return e+.5|0}const hd=(e,t,s)=>Math.max(Math.min(e,s),t);function hx(e){return hd(cb(e*2.55),0,255)}function kd(e){return hd(cb(e*255),0,255)}function Wl(e){return hd(cb(e/2.55)/100,0,1)}function Z$(e){return hd(cb(e*100),0,100)}const Io={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},E5=[..."0123456789ABCDEF"],EAe=e=>E5[e&15],TAe=e=>E5[(e&240)>>4]+E5[e&15],O0=e=>(e&240)>>4===(e&15),RAe=e=>O0(e.r)&&O0(e.g)&&O0(e.b)&&O0(e.a);function AAe(e){var t=e.length,s;return e[0]==="#"&&(t===4||t===5?s={r:255&Io[e[1]]*17,g:255&Io[e[2]]*17,b:255&Io[e[3]]*17,a:t===5?Io[e[4]]*17:255}:(t===7||t===9)&&(s={r:Io[e[1]]<<4|Io[e[2]],g:Io[e[3]]<<4|Io[e[4]],b:Io[e[5]]<<4|Io[e[6]],a:t===9?Io[e[7]]<<4|Io[e[8]]:255})),s}const PAe=(e,t)=>e<255?t(e):"";function IAe(e){var t=RAe(e)?EAe:TAe;return e?"#"+t(e.r)+t(e.g)+t(e.b)+PAe(e.a,t):void 0}const MAe=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function LW(e,t,s){const n=t*Math.min(s,1-s),a=(o,i=(o+e/30)%12)=>s-n*Math.max(Math.min(i-3,9-i,1),-1);return[a(0),a(8),a(4)]}function OAe(e,t,s){const n=(a,o=(a+e/60)%6)=>s-s*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function LAe(e,t,s){const n=LW(e,1,.5);let a;for(t+s>1&&(a=1/(t+s),t*=a,s*=a),a=0;a<3;a++)n[a]*=1-t-s,n[a]+=t;return n}function DAe(e,t,s,n,a){return e===a?(t-s)/n+(t<s?6:0):t===a?(s-e)/n+2:(e-t)/n+4}function IA(e){const s=e.r/255,n=e.g/255,a=e.b/255,o=Math.max(s,n,a),i=Math.min(s,n,a),l=(o+i)/2;let c,u,f;return o!==i&&(f=o-i,u=l>.5?f/(2-o-i):f/(o+i),c=DAe(s,n,a,f,o),c=c*60+.5),[c|0,u||0,l]}function MA(e,t,s,n){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,s,n)).map(kd)}function OA(e,t,s){return MA(LW,e,t,s)}
6054function $Ae(e,t,s){return MA(LAe,e,t,s)}function UAe(e,t,s){return MA(OAe,e,t,s)}function DW(e){return(e%360+360)%360}function FAe(e){const t=MAe.exec(e);let s=255,n;if(!t)return;t[5]!==n&&(s=t[6]?hx(+t[5]):kd(+t[5]));const a=DW(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?n=$Ae(a,o,i):t[1]==="hsv"?n=UAe(a,o,i):n=OA(a,o,i),{r:n[0],g:n[1],b:n[2],a:s}}function BAe(e,t){var s=IA(e);s[0]=DW(s[0]+t),s=OA(s),e.r=s[0],e.g=s[1],e.b=s[2]}function qAe(e){if(!e)return;const t=IA(e),s=t[0],n=Z$(t[1]),a=Z$(t[2]);return e.a<255?`hsla(${s}, ${n}%, ${a}%, ${Wl(e.a)})`:`hsl(${s}, ${n}%, ${a}%)`}const e6={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},t6={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function zAe(){const e={},t=Object.keys(t6),s=Object.keys(e6);let n,a,o,i,l;for(n=0;n<t.length;n++){for(i=l=t[n],a=0;a<s.length;a++)o=s[a],l=l.replace(o,e6[o]);o=parseInt(t6[i],16),e[l]=[o>>16&255,o>>8&255,o&255]}return e}let L0;function HAe(e){L0||(L0=zAe(),L0.transparent=[0,0,0,0]);const t=L0[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const VAe=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function GAe(e){const t=VAe.exec(e);let s=255,n,a,o;if(t){if(t[7]!==n){const i=+t[7];s=t[8]?hx(i):hd(i*255,0,255)}return n=+t[1],a=+t[3],o=+t[5],n=255&(t[2]?hx(n):hd(n,0,255)),a=255&(t[4]?hx(a):hd(a,0,255)),o=255&(t[6]?hx(o):hd(o,0,255)),{r:n,g:a,b:o,a:s}}}function WAe(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Wl(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const D2=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Rf=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);
6054function YAe(e,t,s){const n=Rf(Wl(e.r)),a=Rf(Wl(e.g)),o=Rf(Wl(e.b));return{r:kd(D2(n+s*(Rf(Wl(t.r))-n))),g:kd(D2(a+s*(Rf(Wl(t.g))-a))),b:kd(D2(o+s*(Rf(Wl(t.b))-o))),a:e.a+s*(t.a-e.a)}}function D0(e,t,s){if(e){let n=IA(e);n[t]=Math.max(0,Math.min(n[t]+n[t]*s,t===0?360:1)),n=OA(n),e.r=n[0],e.g=n[1],e.b=n[2]}}function $W(e,t){return e&&Object.assign(t||{},e)}function s6(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=kd(e[3]))):(t=$W(e,{r:0,g:0,b:0,a:1}),t.a=kd(t.a)),t}function KAe(e){return e.charAt(0)==="r"?GAe(e):FAe(e)}class Nv{constructor(t){if(t instanceof Nv)return t;const s=typeof t;let n;s==="object"?n=s6(t):s==="string"&&(n=AAe(t)||HAe(t)||KAe(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=$W(this._rgb);return t&&(t.a=Wl(t.a)),t}set rgb(t){this._rgb=s6(t)}rgbString(){return this._valid?WAe(this._rgb):void 0}hexString(){return this._valid?IAe(this._rgb):void 0}hslString(){return this._valid?qAe(this._rgb):void 0}mix(t,s){if(t){const n=this.rgb,a=t.rgb;let o;const i=s===o?.5:s,l=2*i-1,c=n.a-a.a,u=((l*c===-1?l:(l+c)/(1+l*c))+1)/2;o=1-u,n.r=255&u*n.r+o*a.r+.5,n.g=255&u*n.g+o*a.g+.5,n.b=255&u*n.b+o*a.b+.5,n.a=i*n.a+(1-i)*a.a,this.rgb=n}return this}interpolate(t,s){return t&&(this._rgb=YAe(this._rgb,t._rgb,s)),this}clone(){return new Nv(this.rgb)}alpha(t){return this._rgb.a=kd(t),this}clearer(t){const s=this._rgb;return s.a*=1-t,this}greyscale(){const t=this._rgb,s=cb(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=s,this}opaquer(t){const s=this._rgb;return s.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return D0(this._rgb,2,t),this}darken(t){return D0(this._rgb,2,-t),this}saturate(t){return D0(this._rgb,1,t),this}desaturate(t){return D0(this._rgb,1,-t),this}rotate(t){return BAe(this._rgb,t),this}}/*! 6055 * Chart.js v4.5.0 6056 * https://www.chartjs.org 6057 * (c) 2025 Chart.js Contributors 6058 * Released under the MIT License 6059 */function Ll(){}const JAe=(()=>{let e=0;return()=>e++})();function nr(e){return e==null}function an(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Ls(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function ua(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Oi(e,t){return ua(e)?e:t}function ks(e,t){return typeof e>"u"?t:e}const XAe=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,UW=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function wr(e,t,s){if(e&&typeof e.call=="function")return e.apply(s,t)}function or(e,t,s,n){let a,o,i;if(an(e))for(o=e.length,a=0;a<o;a++)t.call(s,e[a],a);else if(Ls(e))for(i=Object.keys(e),o=i.length,a=0;a<o;a++)t.call(s,e[i[a]],i[a])}function Dj(e,t){let s,n,a,o;if(!e||!t||e.length!==t.length)return!1;for(s=0,n=e.length;s<n;++s)if(a=e[s],o=t[s],a.datasetIndex!==o.datasetIndex||a.index!==o.index)return!1;return!0}function $j(e){if(an(e))return e.map($j);if(Ls(e)){const t=Object.create(null),s=Object.keys(e),n=s.length;let a=0;for(;a<n;++a)t[s[a]]=$j(e[s[a]]);return t}return e}function FW(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function QAe(e,t,s,n){if(!FW(e))return;const a=t[e],o=s[e];Ls(a)&&Ls(o)?kv(a,o,n):t[e]=$j(o)}function kv(e,t,s){const n=an(t)?t:[t],a=n.length;if(!Ls(e))return e;s=s||{};const o=s.merger||QAe;let i;for(let l=0;l<a;++l){if(i=n[l],!Ls(i))continue;const c=Object.keys(i);for(let u=0,f=c.length;u<f;++u)o(c[u],e,i,s)}return e}function Fx(e,t){return kv(e,t,{merger:ZAe})}function ZAe(e,t,s){if(!FW(e))return;const n=t[e],a=s[e];Ls(n)&&Ls(a)?Fx(n,a):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=$j(a))}const r6={"":e=>e,x:e=>e.x,y:e=>e.y};function ePe(e){const t=e.split("."),s=[];let n="";for(const a of t)n+=a,n.endsWith("\\")?n=n.slice(0,-1)+".":(s.push(n),n="");return s}function tPe(e){const t=ePe(e);return s=>{for(const n of t){if(n==="")break;s=s&&s[n]}return s}}function bp(e,t){return(r6[t]||(r6[t]=tPe(t)))(e)}function LA(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Sv=e=>typeof e<"u",Md=e=>typeof e=="function",n6=(e,t)=>{if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0};function sPe(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const ir=Math.PI,Lr=2*ir,rPe=Lr+ir,Uj=Number.POSITIVE_INFINITY,nPe=ir/180,jn=ir/2,Nu=ir/4,a6=ir*2/3,BW=Math.log10,sl=Math.sign;function Bx(e,t,s){return Math.abs(e-t)<s}function o6(e){const t=Math.round(e);e=Bx(e,t,e/1e3)?t:e;const s=Math.pow(10,Math.floor(BW(e))),n=e/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s}function aPe(e){const t=[],s=Math.sqrt(e);let n;for(n=1;n<s;n++)e%n===0&&(t.push(n),t.push(e/n));
6059return s===(s|0)&&t.push(s),t.sort((a,o)=>a-o).pop(),t}function oPe(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Cv(e){return!oPe(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function iPe(e,t){const s=Math.round(e);return s-t<=e&&s+t>=e}function lPe(e,t,s){let n,a,o;for(n=0,a=e.length;n<a;n++)o=e[n][s],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Xl(e){return e*(ir/180)}function cPe(e){return e*(180/ir)}function i6(e){if(!ua(e))return;let t=1,s=0;for(;Math.round(e*t)/t!==e;)t*=10,s++;return s}function qW(e,t){const s=t.x-e.x,n=t.y-e.y,a=Math.sqrt(s*s+n*n);let o=Math.atan2(n,s);return o<-.5*ir&&(o+=Lr),{angle:o,distance:a}}function T5(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function dPe(e,t){return(e-t+rPe)%Lr-ir}function oo(e){return(e%Lr+Lr)%Lr}function Ev(e,t,s,n){const a=oo(e),o=oo(t),i=oo(s),l=oo(o-a),c=oo(i-a),u=oo(a-o),f=oo(a-i);return a===o||a===i||n&&o===i||l>c&&u<f}function oa(e,t,s){return Math.max(t,Math.min(s,e))}function uPe(e){return oa(e,-32768,32767)}function Ql(e,t,s,n=1e-6){return e>=Math.min(t,s)-n&&e<=Math.max(t,s)+n}function DA(e,t,s){s=s||(i=>e[i]<t);let n=e.length-1,a=0,o;for(;n-a>1;)o=a+n>>1,s(o)?a=o:n=o;return{lo:a,hi:n}}const Vu=(e,t,s,n)=>DA(e,s,n?a=>{const o=e[a][t];return o<s||o===s&&e[a+1][t]===s}:a=>e[a][t]<s),pPe=(e,t,s)=>DA(e,s,n=>e[n][t]>=s);function fPe(e,t,s){let n=0,a=e.length;for(;n<a&&e[n]<t;)n++;for(;a>n&&e[a-1]>s;)a--;return n>0||a<e.length?e.slice(n,a):e}const zW=["push","pop","shift","splice","unshift"];function hPe(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),zW.forEach(s=>{const n="_onData"+LA(s),a=e[s];Object.defineProperty(e,s,{configurable:!0,enumerable:!1,value(...o){const i=a.apply(this,o);return e._chartjs.listeners.forEach(l=>{typeof l[n]=="function"&&l[n](...o)}),i}})})}function l6(e,t){const s=e._chartjs;if(!s)return;const n=s.listeners,a=n.indexOf(t);a!==-1&&n.splice(a,1),!(n.length>0)&&(zW.forEach(o=>{delete e[o]}),delete e._chartjs)}function HW(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const VW=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function GW(e,t){let s=[],n=!1;return function(...a){s=a,n||(n=!0,VW.call(window,()=>{n=!1,e.apply(t,s)}))}}function mPe(e,t){let s;return function(...n){return t?(clearTimeout(s),s=setTimeout(e,t,n)):e.apply(this,n),t}}const $A=e=>e==="start"?"left":e==="end"?"right":"center",ta=(e,t,s)=>e==="start"?t:e==="end"?s:(t+s)/2,gPe=(e,t,s,n)=>e===(n?"left":"right")?s:e==="center"?(t+s)/2:t;function xPe(e,t,s){const n=t.length;let a=0,o=n;if(e._sorted){const{iScale:i,vScale:l,_parsed:c}=e,u=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,f=i.axis,{min:h,max:g,minDefined:v,maxDefined:y}=i.getUserBounds();if(v){if(a=Math.min(Vu(c,f,h).lo,s?n:Vu(t,f,i.getPixelForValue(h)).lo),u){const _=c.slice(0,a+1).reverse().findIndex(j=>!nr(j[l.axis]));a-=Math.max(0,_)}a=oa(a,0,n-1)}if(y){let _=Math.max(Vu(c,i.axis,g,!0).hi+1,s?0:Vu(t,f,i.getPixelForValue(g),!0).hi+1);if(u){const j=c.slice(_-1).findIndex(w=>!nr(w[l.axis]));_+=Math.max(0,j)}o=oa(_,a,n)-a}else o=n-a}return{start:a,count:o}}function vPe(e){const{xScale:t,yScale:s,_scaleRanges:n}=e,a={xmin:t.min,xmax:t.max,ymin:s.min,ymax:s.max};if(!n)return e._scaleRanges=a,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==s.min||n.ymax!==s.max;return Object.assign(n,a),o}const $0=e=>e===0||e===1,c6=(e,t,s)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Lr/s)),d6=(e,t,s)=>Math.pow(2,-10*e)*Math.sin((e-t)*Lr/s)+1,qx={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*jn)+1,easeOutSine:e=>Math.sin(e*jn),easeInOutSine:e=>-.5*(Math.cos(ir*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>$0(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>$0(e)?e:c6(e,.075,.3),easeOutElastic:e=>$0(e)?e:d6(e,.075,.3),easeInOutElastic(e){return $0(e)?e:e<.5?.5*c6(e*2,.1125,.45):.5+.5*d6(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-qx.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?qx.easeInBounce(e*2)*.5:qx.easeOutBounce(e*2-1)*.5+.5};function UA(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function u6(e){return UA(e)?e:new Nv(e)}function $2(e){return UA(e)?e:new Nv(e).saturate(.5).darken(.1).hexString()}const bPe=["x","y","borderWidth","radius","tension"],yPe=["color","borderColor","backgroundColor"];function _Pe(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:yPe},numbers:{type:"number",properties:bPe}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function jPe(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const p6=new Map;function wPe(e,t){t=t||{};const s=e+JSON.stringify(t);let n=p6.get(s);return n||(n=new Intl.NumberFormat(e,t),p6.set(s,n)),n}function FA(e,t,s){return wPe(t,s).format(e)}const NPe={values(e){return an(e)?e:""+e},numeric(e,t,s){if(e===0)return"0";const n=this.chart.options.locale;let a,o=e;if(s.length>1){const u=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(u<1e-4||u>1e15)&&(a="scientific"),o=kPe(e,s)}const i=BW(Math.abs(o)),l=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),c={notation:a,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(c,this.options.ticks.format),FA(e,n,c)}};function kPe(e,t){let s=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(s)>=1&&e!==Math.floor(e)&&(s=e-Math.floor(e)),s}var WW={formatters:NPe};function SPe(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,s)=>s.lineWidth,tickColor:(t,s)=>s.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:WW.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const yp=Object.create(null),R5=Object.create(null);function zx(e,t){if(!t)return e;const s=t.split(".");for(let n=0,a=s.length;n<a;++n){const o=s[n];e=e[o]||(e[o]=Object.create(null))}return e}function U2(e,t,s){return typeof t=="string"?kv(zx(e,t),s):kv(zx(e,""),t)}class CPe{constructor(t,s){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={}
6059,this.hoverBackgroundColor=(n,a)=>$2(a.backgroundColor),this.hoverBorderColor=(n,a)=>$2(a.borderColor),this.hoverColor=(n,a)=>$2(a.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(s)}set(t,s){return U2(this,t,s)}get(t){return zx(this,t)}describe(t,s){return U2(R5,t,s)}override(t,s){return U2(yp,t,s)}route(t,s,n,a){const o=zx(this,t),i=zx(this,n),l="_"+s;Object.defineProperties(o,{[l]:{value:o[s],writable:!0},[s]:{enumerable:!0,get(){const c=this[l],u=i[a];return Ls(c)?Object.assign({},u,c):ks(c,u)},set(c){this[l]=c}}})}apply(t){t.forEach(s=>s(this))}}var Jr=new CPe({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[_Pe,jPe,SPe]);function EPe(e){return!e||nr(e.size)||nr(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function f6(e,t,s,n,a){let o=t[a];return o||(o=t[a]=e.measureText(a).width,s.push(a)),o>n&&(n=o),n}function ku(e,t,s){const n=e.currentDevicePixelRatio,a=s!==0?Math.max(s/2,.5):0;return Math.round((t-a)*n)/n+a}function h6(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function A5(e,t,s,n){YW(e,t,s,n,null)}function YW(e,t,s,n,a){let o,i,l,c,u,f,h,g;const v=t.pointStyle,y=t.rotation,_=t.radius;let j=(y||0)*nPe;if(v&&typeof v=="object"&&(o=v.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(s,n),e.rotate(j),e.drawImage(v,-v.width/2,-v.height/2,v.width,v.height),e.restore();return}if(!(isNaN(_)||_<=0)){switch(e.beginPath(),v){default:a?e.ellipse(s,n,a/2,_,0,0,Lr):e.arc(s,n,_,0,Lr),e.closePath();break;case"triangle":f=a?a/2:_,e.moveTo(s+Math.sin(j)*f,n-Math.cos(j)*_),j+=a6,e.lineTo(s+Math.sin(j)*f,n-Math.cos(j)*_),j+=a6,e.lineTo(s+Math.sin(j)*f,n-Math.cos(j)*_),e.closePath();break;case"rectRounded":u=_*.516,c=_-u,i=Math.cos(j+Nu)*c,h=Math.cos(j+Nu)*(a?a/2-u:c),l=Math.sin(j+Nu)*c,g=Math.sin(j+Nu)*(a?a/2-u:c),e.arc(s-h,n-l,u,j-ir,j-jn),e.arc(s+g,n-i,u,j-jn,j),e.arc(s+h,n+l,u,j,j+jn),e.arc(s-g,n+i,u,j+jn,j+ir),e.closePath();break;case"rect":if(!y){c=Math.SQRT1_2*_,f=a?a/2:c,e.rect(s-f,n-c,2*f,2*c);break}j+=Nu;case"rectRot":h=Math.cos(j)*(a?a/2:_),i=Math.cos(j)*_,l=Math.sin(j)*_,g=Math.sin(j)*(a?a/2:_),e.moveTo(s-h,n-l),e.lineTo(s+g,n-i),e.lineTo(s+h,n+l),e.lineTo(s-g,n+i),e.closePath();break;case"crossRot":j+=Nu;case"cross":h=Math.cos(j)*(a?a/2:_),i=Math.cos(j)*_,l=Math.sin(j)*_,g=Math.sin(j)*(a?a/2:_),e.moveTo(s-h,n-l),e.lineTo(s+h,n+l),e.moveTo(s+g,n-i),e.lineTo(s-g,n+i);break;case"star":h=Math.cos(j)*(a?a/2:_),i=Math.cos(j)*_,l=Math.sin(j)*_,g=Math.sin(j)*(a?a/2:_),e.moveTo(s-h,n-l),e.lineTo(s+h,n+l),e.moveTo(s+g,n-i),e.lineTo(s-g,n+i),j+=Nu,h=Math.cos(j)*(a?a/2:_),i=Math.cos(j)*_,l=Math.sin(j)*_,g=Math.sin(j)*(a?a/2:_),e.moveTo(s-h,n-l),e.lineTo(s+h,n+l),e.moveTo(s+g,n-i),e.lineTo(s-g,n+i);break;case"line":i=a?a/2:Math.cos(j)*_,l=Math.sin(j)*_,e.moveTo(s-i,n-l),e.lineTo(s+i,n+l);break;case"dash":e.moveTo(s,n),e.lineTo(s+Math.cos(j)*(a?a/2:_),n+Math.sin(j)*_);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Tv(e,t,s){return s=s||.5,!t||e&&e.x>t.left-s&&e.x<t.right+s&&e.y>t.top-s&&e.y<t.bottom+s}function c1(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function d1(e){e.restore()}function TPe(e,t,s,n,a){if(!t)return e.lineTo(s.x,s.y);if(a==="middle"){const o=(t.x+s.x)/2;e.lineTo(o,t.y),e.lineTo(o,s.y)}else a==="after"!=!!n?e.lineTo(t.x,s.y):e.lineTo(s.x,t.y);e.lineTo(s.x,s.y)}function RPe(e,t,s,n){if(!t)return e.lineTo(s.x,s.y);e.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?s.cp2x:s.cp1x,n?s.cp2y:s.cp1y,s.x,s.y)}function APe(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),nr(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function PPe(e,t,s,n,a){if(a.strikethrough||a.underline){const o=e.measureText(n),i=t-o.actualBoundingBoxLeft,l=t+o.actualBoundingBoxRight,c=s-o.actualBoundingBoxAscent,u=s+o.actualBoundingBoxDescent,f=a.strikethrough?(c+u)/2:u;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=a.decorationWidth||2,e.moveTo(i,f),e.lineTo(l,f),e.stroke()}}function IPe(e,t){const s=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=s}function Rv(e,t,s,n,a,o={}){const i=an(t)?t:[t],l=o.strokeWidth>0&&o.strokeColor!=="";let c,u;for(e.save(),e.font=a.string,APe(e,o),c=0;c<i.length;++c)u=i[c],o.backdrop&&IPe(e,o.backdrop),l&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),nr(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(u,s,n,o.maxWidth)),e.fillText(u,s,n,o.maxWidth),PPe(e,s,n,u,o),n+=Number(a.lineHeight);
6059e.restore()}function Fj(e,t){const{x:s,y:n,w:a,h:o,radius:i}=t;e.arc(s+i.topLeft,n+i.topLeft,i.topLeft,1.5*ir,ir,!0),e.lineTo(s,n+o-i.bottomLeft),e.arc(s+i.bottomLeft,n+o-i.bottomLeft,i.bottomLeft,ir,jn,!0),e.lineTo(s+a-i.bottomRight,n+o),e.arc(s+a-i.bottomRight,n+o-i.bottomRight,i.bottomRight,jn,0,!0),e.lineTo(s+a,n+i.topRight),e.arc(s+a-i.topRight,n+i.topRight,i.topRight,0,-jn,!0),e.lineTo(s+i.topLeft,n)}const MPe=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,OPe=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function LPe(e,t){const s=(""+e).match(MPe);if(!s||s[1]==="normal")return t*1.2;switch(e=+s[2],s[3]){case"px":return e;case"%":e/=100;break}return t*e}const DPe=e=>+e||0;function BA(e,t){const s={},n=Ls(t),a=n?Object.keys(t):t,o=Ls(e)?n?i=>ks(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of a)s[i]=DPe(o(i));return s}function KW(e){return BA(e,{top:"y",right:"x",bottom:"y",left:"x"})}function ih(e){return BA(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Ko(e){const t=KW(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ia(e,t){e=e||{},t=t||Jr.font;let s=ks(e.size,t.size);typeof s=="string"&&(s=parseInt(s,10));let n=ks(e.style,t.style);n&&!(""+n).match(OPe)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const a={family:ks(e.family,t.family),lineHeight:LPe(ks(e.lineHeight,t.lineHeight),s),size:s,style:n,weight:ks(e.weight,t.weight),string:""};return a.string=EPe(a),a}function U0(e,t,s,n){let a,o,i;for(a=0,o=e.length;a<o;++a)if(i=e[a],i!==void 0&&i!==void 0)return i}function $Pe(e,t,s){const{min:n,max:a}=e,o=UW(t,(a-n)/2),i=(l,c)=>s&&l===0?0:l+c;return{min:i(n,-Math.abs(o)),max:i(a,o)}}function Ip(e,t){return Object.assign(Object.create(e),t)}function qA(e,t=[""],s,n,a=()=>e[0]){const o=s||e;typeof n>"u"&&(n=ZW("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:n,_getTarget:a,override:l=>qA([l,...e],t,o,n)};return new Proxy(i,{deleteProperty(l,c){return delete l[c],delete l._keys,delete e[0][c],!0},get(l,c){return XW(l,c,()=>GPe(c,t,e,l))},getOwnPropertyDescriptor(l,c){return Reflect.getOwnPropertyDescriptor(l._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(l,c){return g6(l).includes(c)},ownKeys(l){return g6(l)},set(l,c,u){const f=l._storage||(l._storage=a());return l[c]=f[c]=u,delete l._keys,!0}})}function Uh(e,t,s,n){const a={_cacheable:!1,_proxy:e,_context:t,_subProxy:s,_stack:new Set,_descriptors:JW(e,n),setContext:o=>Uh(e,o,s,n),override:o=>Uh(e.override(o),t,s,n)};return new Proxy(a,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,l){return XW(o,i,()=>FPe(o,i,l))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,l){return e[i]=l,delete o[i],!0}})}function JW(e,t={scriptable:!0,indexable:!0}){const{_scriptable:s=t.scriptable,_indexable:n=t.indexable,_allKeys:a=t.allKeys}=e;return{allKeys:a,scriptable:s,indexable:n,isScriptable:Md(s)?s:()=>s,isIndexable:Md(n)?n:()=>n}}const UPe=(e,t)=>e?e+LA(t):t,zA=(e,t)=>Ls(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function XW(e,t,s){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const n=s();return e[t]=n,n}function FPe(e,t,s){const{_proxy:n,_context:a,_subProxy:o,_descriptors:i}=e;let l=n[t];return Md(l)&&i.isScriptable(t)&&(l=BPe(t,l,e,s)),an(l)&&l.length&&(l=qPe(t,l,e,i.isIndexable)),zA(t,l)&&(l=Uh(l,a,o&&o[t],i)),l}function BPe(e,t,s,n){const{_proxy:a,_context:o,_subProxy:i,_stack:l}=s;if(l.has(e))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+e);l.add(e);let c=t(o,i||n);return l.delete(e),zA(e,c)&&(c=HA(a._scopes,a,e,c)),c}function qPe(e,t,s,n){const{_proxy:a,_context:o,_subProxy:i,_descriptors:l}=s;if(typeof o.index<"u"&&n(e))return t[o.index%t.length];if(Ls(t[0])){const c=t,u=a._scopes.filter(f=>f!==c);t=[];for(const f of c){const h=HA(u,a,e,f);t.push(Uh(h,o,i&&i[e],l))}}return t}
6059function QW(e,t,s){return Md(e)?e(t,s):e}const zPe=(e,t)=>e===!0?t:typeof e=="string"?bp(t,e):void 0;function HPe(e,t,s,n,a){for(const o of t){const i=zPe(s,o);if(i){e.add(i);const l=QW(i._fallback,s,a);if(typeof l<"u"&&l!==s&&l!==n)return l}else if(i===!1&&typeof n<"u"&&s!==n)return null}return!1}function HA(e,t,s,n){const a=t._rootScopes,o=QW(t._fallback,s,n),i=[...e,...a],l=new Set;l.add(n);let c=m6(l,i,s,o||s,n);return c===null||typeof o<"u"&&o!==s&&(c=m6(l,i,o,c,n),c===null)?!1:qA(Array.from(l),[""],a,o,()=>VPe(t,s,n))}function m6(e,t,s,n,a){for(;s;)s=HPe(e,t,s,n,a);return s}function VPe(e,t,s){const n=e._getTarget();t in n||(n[t]={});const a=n[t];return an(a)&&Ls(s)?s:a||{}}function GPe(e,t,s,n){let a;for(const o of t)if(a=ZW(UPe(o,e),s),typeof a<"u")return zA(e,a)?HA(s,n,e,a):a}function ZW(e,t){for(const s of t){if(!s)continue;const n=s[e];if(typeof n<"u")return n}}function g6(e){let t=e._keys;return t||(t=e._keys=WPe(e._scopes)),t}function WPe(e){const t=new Set;for(const s of e)for(const n of Object.keys(s).filter(a=>!a.startsWith("_")))t.add(n);return Array.from(t)}const YPe=Number.EPSILON||1e-14,Fh=(e,t)=>t<e.length&&!e[t].skip&&e[t],eY=e=>e==="x"?"y":"x";function KPe(e,t,s,n){const a=e.skip?t:e,o=t,i=s.skip?t:s,l=T5(o,a),c=T5(i,o);let u=l/(l+c),f=c/(l+c);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const h=n*u,g=n*f;return{previous:{x:o.x-h*(i.x-a.x),y:o.y-h*(i.y-a.y)},next:{x:o.x+g*(i.x-a.x),y:o.y+g*(i.y-a.y)}}}function JPe(e,t,s){const n=e.length;let a,o,i,l,c,u=Fh(e,0);for(let f=0;f<n-1;++f)if(c=u,u=Fh(e,f+1),!(!c||!u)){if(Bx(t[f],0,YPe)){s[f]=s[f+1]=0;continue}a=s[f]/t[f],o=s[f+1]/t[f],l=Math.pow(a,2)+Math.pow(o,2),!(l<=9)&&(i=3/Math.sqrt(l),s[f]=a*i*t[f],s[f+1]=o*i*t[f])}}function XPe(e,t,s="x"){const n=eY(s),a=e.length;let o,i,l,c=Fh(e,0);for(let u=0;u<a;++u){if(i=l,l=c,c=Fh(e,u+1),!l)continue;const f=l[s],h=l[n];i&&(o=(f-i[s])/3,l[`cp1${s}`]=f-o,l[`cp1${n}`]=h-o*t[u]),c&&(o=(c[s]-f)/3,l[`cp2${s}`]=f+o,l[`cp2${n}`]=h+o*t[u])}}function QPe(e,t="x"){const s=eY(t),n=e.length,a=Array(n).fill(0),o=Array(n);let i,l,c,u=Fh(e,0);for(i=0;i<n;++i)if(l=c,c=u,u=Fh(e,i+1),!!c){if(u){const f=u[t]-c[t];a[i]=f!==0?(u[s]-c[s])/f:0}o[i]=l?u?sl(a[i-1])!==sl(a[i])?0:(a[i-1]+a[i])/2:a[i-1]:a[i]}JPe(e,a,o),XPe(e,o,t)}function F0(e,t,s){return Math.max(Math.min(e,s),t)}function ZPe(e,t){let s,n,a,o,i,l=Tv(e[0],t);for(s=0,n=e.length;s<n;++s)i=o,o=l,l=s<n-1&&Tv(e[s+1],t),o&&(a=e[s],i&&(a.cp1x=F0(a.cp1x,t.left,t.right),a.cp1y=F0(a.cp1y,t.top,t.bottom)),l&&(a.cp2x=F0(a.cp2x,t.left,t.right),a.cp2y=F0(a.cp2y,t.top,t.bottom)))}function eIe(e,t,s,n,a){let o,i,l,c;if(t.spanGaps&&(e=e.filter(u=>!u.skip)),t.cubicInterpolationMode==="monotone")QPe(e,a);else{let u=n?e[e.length-1]:e[0];for(o=0,i=e.length;o<i;++o)l=e[o],c=KPe(u,l,e[Math.min(o+1,i-(n?0:1))%i],t.tension),l.cp1x=c.previous.x,l.cp1y=c.previous.y,l.cp2x=c.next.x,l.cp2y=c.next.y,u=l}t.capBezierPoints&&ZPe(e,s)}function VA(){return typeof window<"u"&&typeof document<"u"}function GA(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Bj(e,t,s){let n;return typeof e=="string"?(n=parseInt(e,10),e.indexOf("%")!==-1&&(n=n/100*t.parentNode[s])):n=e,n}const u1=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function tIe(e,t){return u1(e).getPropertyValue(t)}const sIe=["top","right","bottom","left"];function ep(e,t,s){const n={};s=s?"-"+s:"";for(let a=0;a<4;a++){const o=sIe[a];n[o]=parseFloat(e[t+"-"+o+s])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const rIe=(e,t,s)=>(e>0||t>0)&&(!s||!s.shadowRoot);function nIe(e,t){const s=e.touches,n=s&&s.length?s[0]:e,{offsetX:a,offsetY:o}=n;let i=!1,l,c;if(rIe(a,o,e.target))l=a,c=o;else{const u=t.getBoundingClientRect();l=n.clientX-u.left,c=n.clientY-u.top,i=!0}return{x:l,y:c,box:i}}function Pu(e,t){if("native"in e)return e;const{canvas:s,currentDevicePixelRatio:n}=t,a=u1(s),o=a.boxSizing==="border-box",i=ep(a,"padding"),l=ep(a,"border","width"),{x:c,y:u,box:f}=nIe(e,s),h=i.left+(f&&l.left),g=i.top+(f&&l.top);let{width:v,height:y}=t;return o&&(v-=i.width+l.width,y-=i.height+l.height),{x:Math.round((c-h)/v*s.width/n),y:Math.round((u-g)/y*s.height/n)}}function aIe(e,t,s){let n,a;if(t===void 0||s===void 0){const o=e&&GA(e);
6059if(!o)t=e.clientWidth,s=e.clientHeight;else{const i=o.getBoundingClientRect(),l=u1(o),c=ep(l,"border","width"),u=ep(l,"padding");t=i.width-u.width-c.width,s=i.height-u.height-c.height,n=Bj(l.maxWidth,o,"clientWidth"),a=Bj(l.maxHeight,o,"clientHeight")}}return{width:t,height:s,maxWidth:n||Uj,maxHeight:a||Uj}}const B0=e=>Math.round(e*10)/10;function oIe(e,t,s,n){const a=u1(e),o=ep(a,"margin"),i=Bj(a.maxWidth,e,"clientWidth")||Uj,l=Bj(a.maxHeight,e,"clientHeight")||Uj,c=aIe(e,t,s);let{width:u,height:f}=c;if(a.boxSizing==="content-box"){const g=ep(a,"border","width"),v=ep(a,"padding");u-=v.width+g.width,f-=v.height+g.height}return u=Math.max(0,u-o.width),f=Math.max(0,n?u/n:f-o.height),u=B0(Math.min(u,i,c.maxWidth)),f=B0(Math.min(f,l,c.maxHeight)),u&&!f&&(f=B0(u/2)),(t!==void 0||s!==void 0)&&n&&c.height&&f>c.height&&(f=c.height,u=B0(Math.floor(f*n))),{width:u,height:f}}function x6(e,t,s){const n=t||1,a=Math.floor(e.height*n),o=Math.floor(e.width*n);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const i=e.canvas;return i.style&&(s||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==n||i.height!==a||i.width!==o?(e.currentDevicePixelRatio=n,i.height=a,i.width=o,e.ctx.setTransform(n,0,0,n,0,0),!0):!1}const iIe=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};VA()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function v6(e,t){const s=tIe(e,t),n=s&&s.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Iu(e,t,s,n){return{x:e.x+s*(t.x-e.x),y:e.y+s*(t.y-e.y)}}function lIe(e,t,s,n){return{x:e.x+s*(t.x-e.x),y:n==="middle"?s<.5?e.y:t.y:n==="after"?s<1?e.y:t.y:s>0?t.y:e.y}}function cIe(e,t,s,n){const a={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},i=Iu(e,a,s),l=Iu(a,o,s),c=Iu(o,t,s),u=Iu(i,l,s),f=Iu(l,c,s);return Iu(u,f,s)}const dIe=function(e,t){return{x(s){return e+e+t-s},setWidth(s){t=s},textAlign(s){return s==="center"?s:s==="right"?"left":"right"},xPlus(s,n){return s-n},leftForLtr(s,n){return s-n}}},uIe=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function lh(e,t,s){return e?dIe(t,s):uIe()}function tY(e,t){let s,n;(t==="ltr"||t==="rtl")&&(s=e.canvas.style,n=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",t,"important"),e.prevTextDirection=n)}function sY(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function rY(e){return e==="angle"?{between:Ev,compare:dPe,normalize:oo}:{between:Ql,compare:(t,s)=>t-s,normalize:t=>t}}function b6({start:e,end:t,count:s,loop:n,style:a}){return{start:e%s,end:t%s,loop:n&&(t-e+1)%s===0,style:a}}function pIe(e,t,s){const{property:n,start:a,end:o}=s,{between:i,normalize:l}=rY(n),c=t.length;let{start:u,end:f,loop:h}=e,g,v;if(h){for(u+=c,f+=c,g=0,v=c;g<v&&i(l(t[u%c][n]),a,o);++g)u--,f--;u%=c,f%=c}return f<u&&(f+=c),{start:u,end:f,loop:h,style:e.style}}function nY(e,t,s){if(!s)return[e];const{property:n,start:a,end:o}=s,i=t.length,{compare:l,between:c,normalize:u}=rY(n),{start:f,end:h,loop:g,style:v}=pIe(e,t,s),y=[];let _=!1,j=null,w,k,S;const E=()=>c(a,S,w)&&l(a,S)!==0,T=()=>l(o,w)===0||c(o,S,w),A=()=>_||E(),R=()=>!_||T();for(let I=f,L=f;I<=h;++I)k=t[I%i],!k.skip&&(w=u(k[n]),w!==S&&(_=c(w,a,o),j===null&&A()&&(j=l(w,a)===0?I:L),j!==null&&R()&&(y.push(b6({start:j,end:I,loop:g,count:i,style:v})),j=null),L=I,S=w));return j!==null&&y.push(b6({start:j,end:h,loop:g,count:i,style:v})),y}function aY(e,t){const s=[],n=e.segments;for(let a=0;a<n.length;a++){const o=nY(n[a],e.points,t);o.length&&s.push(...o)}return s}function fIe(e,t,s,n){let a=0,o=t-1;if(s&&!n)for(;a<t&&!e[a].skip;)a++;for(;a<t&&e[a].skip;)a++;for(a%=t,s&&(o+=a);o>a&&e[o%t].skip;)o--;return o%=t,{start:a,end:o}}function hIe(e,t,s,n){const a=e.length,o=[];let i=t,l=e[t],c;for(c=t+1;c<=s;++c){const u=e[c%a];u.skip||u.stop?l.skip||(n=!1,o.push({start:t%a,end:(c-1)%a,loop:n}),t=i=u.stop?c:null):(i=c,l.skip&&(t=c)),l=u}return i!==null&&o.push({start:t%a,end:i%a,loop:n}),o}function mIe(e,t){const s=e.points,n=e.options.spanGaps,a=s.length;if(!a)return[];const o=!!e._loop,{start:i,end:l}=fIe(s,a,o,n);if(n===!0)return y6(e,[{start:i,end:l,loop:o}],s,t);const c=l<i?l+a:l,u=!!e._fullLoop&&i===0&&l===a-1;return y6(e,hIe(s,i,c,u),s,t)}function y6(e,t,s,n){return!n||!n.setContext||!s?t:gIe(e,t,s,n)}function gIe(e,t,s,n){const a=e._chart.getContext(),o=_6(e.options),{_datasetIndex:i,options:{spanGaps:l}}=e,c=s.length,u=[];let f=o,h=t[0].start,g=h;function v(y,_,j,w){const k=l?-1:1;if(y!==_){for(y+=c;s[y%c].skip;)y-=k;for(;s[_%c].skip;)_+=k;
6059y%c!==_%c&&(u.push({start:y%c,end:_%c,loop:j,style:w}),f=w,h=_%c)}}for(const y of t){h=l?h:y.start;let _=s[h%c],j;for(g=h+1;g<=y.end;g++){const w=s[g%c];j=_6(n.setContext(Ip(a,{type:"segment",p0:_,p1:w,p0DataIndex:(g-1)%c,p1DataIndex:g%c,datasetIndex:i}))),xIe(j,f)&&v(h,g-1,y.loop,f),_=w,f=j}h<g-1&&v(h,g-1,y.loop,f)}return u}function _6(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function xIe(e,t){if(!t)return!1;const s=[],n=function(a,o){return UA(o)?(s.includes(o)||s.push(o),s.indexOf(o)):o};return JSON.stringify(e,n)!==JSON.stringify(t,n)}function q0(e,t,s){return e.options.clip?e[s]:t[s]}function vIe(e,t){const{xScale:s,yScale:n}=e;return s&&n?{left:q0(s,t,"left"),right:q0(s,t,"right"),top:q0(n,t,"top"),bottom:q0(n,t,"bottom")}:t}function oY(e,t){const s=t._clip;if(s.disabled)return!1;const n=vIe(t,e.chartArea);return{left:s.left===!1?0:n.left-(s.left===!0?0:s.left),right:s.right===!1?e.width:n.right+(s.right===!0?0:s.right),top:s.top===!1?0:n.top-(s.top===!0?0:s.top),bottom:s.bottom===!1?e.height:n.bottom+(s.bottom===!0?0:s.bottom)}}/*! 6060 * Chart.js v4.5.0 6061 * https://www.chartjs.org 6062 * (c) 2025 Chart.js Contributors 6063 * Released under the MIT License 6064 */class bIe{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,s,n,a){const o=s.listeners[a],i=s.duration;o.forEach(l=>l({chart:t,initial:s.initial,numSteps:i,currentStep:Math.min(n-s.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=VW.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let s=0;this._charts.forEach((n,a)=>
6064{if(!n.running||!n.items.length)return;const o=n.items;let i=o.length-1,l=!1,c;for(;i>=0;--i)c=o[i],c._active?(c._total>n.duration&&(n.duration=c._total),c.tick(t),l=!0):(o[i]=o[o.length-1],o.pop());l&&(a.draw(),this._notify(a,n,t,"progress")),o.length||(n.running=!1,this._notify(a,n,t,"complete"),n.initial=!1),s+=o.length}),this._lastDate=t,s===0&&(this._running=!1)}_getAnims(t){const s=this._charts;let n=s.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},s.set(t,n)),n}listen(t,s,n){this._getAnims(t).listeners[s].push(n)}add(t,s){!s||!s.length||this._getAnims(t).items.push(...s)}has(t){return this._getAnims(t).items.length>0}start(t){const s=this._charts.get(t);s&&(s.running=!0,s.start=Date.now(),s.duration=s.items.reduce((n,a)=>Math.max(n,a._duration),0),this._refresh())}running(t){if(!this._running)return!1;const s=this._charts.get(t);return!(!s||!s.running||!s.items.length)}stop(t){const s=this._charts.get(t);if(!s||!s.items.length)return;const n=s.items;let a=n.length-1;for(;a>=0;--a)n[a].cancel();s.items=[],this._notify(t,s,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Ul=new bIe;const j6="transparent",yIe={boolean(e,t,s){return s>.5?t:e},color(e,t,s){const n=u6(e||j6),a=n.valid&&u6(t||j6);return a&&a.valid?a.mix(n,s).hexString():t},number(e,t,s){return e+(t-e)*s}};class _Ie{constructor(t,s,n,a){const o=s[n];a=U0([t.to,a,o,t.from]);const i=U0([t.from,o,a]);this._active=!0,this._fn=t.fn||yIe[t.type||typeof i],this._easing=qx[t.easing]||qx.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=s,this._prop=n,this._from=i,this._to=a,this._promises=void 0}active(){return this._active}update(t,s,n){if(this._active){this._notify(!1);const a=this._target[this._prop],o=n-this._start,i=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=U0([t.to,s,a,t.from]),this._from=U0([t.from,a,s])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const s=t-this._start,n=this._duration,a=this._prop,o=this._from,i=this._loop,l=this._to;let c;if(this._active=o!==l&&(i||s<n),!this._active){this._target[a]=l,this._notify(!0);return}if(s<0){this._target[a]=o;return}c=s/n%2,c=i&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[a]=this._fn(o,l,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((s,n)=>{t.push({res:s,rej:n})})}_notify(t){const s=t?"res":"rej",n=this._promises||[];for(let a=0;a<n.length;a++)n[a][s]()}}class iY{constructor(t,s){this._chart=t,this._properties=new Map,this.configure(s)}configure(t){if(!Ls(t))return;const s=Object.keys(Jr.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(a=>{const o=t[a];if(!Ls(o))return;const i={};for(const l of s)i[l]=o[l];(an(o.properties)&&o.properties||[a]).forEach(l=>{(l===a||!n.has(l))&&n.set(l,i)})})}_animateOptions(t,s){const n=s.options,a=wIe(t,n);if(!a)return[];const o=this._createAnimations(a,n);return n.$shared&&jIe(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,s){const n=this._properties,a=[],o=t.$animations||(t.$animations={}),i=Object.keys(s),l=Date.now();let c;for(c=i.length-1;c>=0;--c){const u=i[c];if(u.charAt(0)==="$")continue;if(u==="options"){a.push(...this._animateOptions(t,s));continue}const f=s[u];let h=o[u];const g=n.get(u);if(h)if(g&&h.active()){h.update(g,f,l);continue}else h.cancel();if(!g||!g.duration){t[u]=f;continue}o[u]=h=new _Ie(g,t,u,f),a.push(h)}return a}update(t,s){if(this._properties.size===0){Object.assign(t,s);return}const n=this._createAnimations(t,s);if(n.length)return Ul.add(this._chart,n),!0}}function jIe(e,t){const s=[],n=Object.keys(t);for(let a=0;a<n.length;a++){const o=e[n[a]];o&&o.active()&&s.push(o.wait())}return Promise.all(s)}function wIe(e,t){if(!t)return;let s=e.options;if(!s){e.options=t;return}return s.$shared&&(e.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s}function w6(e,t){const s=e&&e.options||{},n=s.reverse,a=s.min===void 0?t:0,o=s.max===void 0?t:0;return{start:n?o:a,end:n?a:o}}function NIe(e,t,s){if(s===!1)return!1;const n=w6(e,s),a=w6(t,s);return{top:a.end,right:n.end,bottom:a.start,left:n.start}}function kIe(e){let t,s,n,a;return Ls(e)?(t=e.top,s=e.right,n=e.bottom,a=e.left):t=s=n=a=e,{top:t,right:s,bottom:n,left:a,disabled:e===!1}}function lY(e,t){const s=[],n=e._getSortedDatasetMetas(t);let a,o;for(a=0,o=n.length;a<o;++a)s.push(n[a].index);return s}function N6(e,t,s,n={}){const a=e.keys,o=n.mode==="single";let i,l,c,u;if(t===null)return;let f=!1;for(i=0,l=a.length;i<l;++i){if(c=+a[i],c===s){if(f=!0,n.all)continue;break}u=e.values[c],ua(u)&&(o||t===0||sl(t)===sl(u))&&(t+=u)}return!f&&!n.all?0:t}function SIe(e,t){const{iScale:s,vScale:n}=t,a=s.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",i=Object.keys(e),l=new Array(i.length);let c,u,f;for(c=0,u=i.length;c<u;++c)f=i[c],l[c]={[a]:f,[o]:e[f]};return l}function F2(e,t){const s=e&&e.options.stacked;return s||s===void 0&&t.stack!==void 0}function CIe(e,t,s){return`${e.id}.${t.id}.${s.stack||s.type}`}function EIe(e){const{min:t,max:s,minDefined:n,maxDefined:a}=e.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:a?s:Number.POSITIVE_INFINITY}}function TIe(e,t,s){const n=e[t]||(e[t]={});return n[s]||(n[s]={})}function k6(e,t,s,n){for(const a of t.getMatchingVisibleMetas(n).reverse()){const o=e[a.index];if(s&&o>0||!s&&o<0)return a.index}return null}function S6(e,t){const{chart:s,_cachedMeta:n}=e,a=s._stacks||(s._stacks={}),{iScale:o,vScale:i,index:l}=n,c=o.axis,u=i.axis,f=CIe(o,i,n),h=t.length;let g;for(let v=0;v<h;++v){const y=t[v],{[c]:_,[u]:j}=y,w=y._stacks||(y._stacks={});g=w[u]=TIe(a,f,_),g[l]=j,g._top=k6(g,i,!0,n.type),g._bottom=k6(g,i,!1,n.type);const k=g._visualValues||(g._visualValues={});k[l]=j}}function B2(e,t){const s=e.scales;return Object.keys(s).filter(n=>s[n].axis===t).shift()}function RIe(e,t){return Ip(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function AIe(e,t,s){return Ip(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:s,index:t,mode:"default",type:"data"})}function Jg(e,t){const s=e.controller.index,n=e.vScale&&e.vScale.axis;
6064if(n){t=t||e._parsed;for(const a of t){const o=a._stacks;if(!o||o[n]===void 0||o[n][s]===void 0)return;delete o[n][s],o[n]._visualValues!==void 0&&o[n]._visualValues[s]!==void 0&&delete o[n]._visualValues[s]}}}const q2=e=>e==="reset"||e==="none",C6=(e,t)=>t?e:Object.assign({},e),PIe=(e,t,s)=>e&&!t.hidden&&t._stacked&&{keys:lY(s,!0),values:null};class tp{constructor(t,s){this.chart=t,this._ctx=t.ctx,this.index=s,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=F2(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Jg(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,s=this._cachedMeta,n=this.getDataset(),a=(h,g,v,y)=>h==="x"?g:h==="r"?y:v,o=s.xAxisID=ks(n.xAxisID,B2(t,"x")),i=s.yAxisID=ks(n.yAxisID,B2(t,"y")),l=s.rAxisID=ks(n.rAxisID,B2(t,"r")),c=s.indexAxis,u=s.iAxisID=a(c,o,i,l),f=s.vAxisID=a(c,i,o,l);s.xScale=this.getScaleForId(o),s.yScale=this.getScaleForId(i),s.rScale=this.getScaleForId(l),s.iScale=this.getScaleForId(u),s.vScale=this.getScaleForId(f)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const s=this._cachedMeta;return t===s.iScale?s.vScale:s.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&l6(this._data,this),t._stacked&&Jg(t)}_dataCheck(){const t=this.getDataset(),s=t.data||(t.data=[]),n=this._data;if(Ls(s)){const a=this._cachedMeta;this._data=SIe(s,a)}else if(n!==s){if(n){l6(n,this);const a=this._cachedMeta;Jg(a),a._parsed=[]}s&&Object.isExtensible(s)&&hPe(s,this),this._syncList=[],this._data=s}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const s=this._cachedMeta,n=this.getDataset();let a=!1;this._dataCheck();const o=s._stacked;s._stacked=F2(s.vScale,s),s.stack!==n.stack&&(a=!0,Jg(s),s.stack=n.stack),this._resyncElements(t),(a||o!==s._stacked)&&(S6(this,s._parsed),s._stacked=F2(s.vScale,s))}configure(){const t=this.chart.config,s=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),s,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,s){const{_cachedMeta:n,_data:a}=this,{iScale:o,_stacked:i}=n,l=o.axis;let c=t===0&&s===a.length?!0:n._sorted,u=t>0&&n._parsed[t-1],f,h,g;if(this._parsing===!1)n._parsed=a,n._sorted=!0,g=a;else{an(a[t])?g=this.parseArrayData(n,a,t,s):Ls(a[t])?g=this.parseObjectData(n,a,t,s):g=this.parsePrimitiveData(n,a,t,s);const v=()=>h[l]===null||u&&h[l]<u[l];for(f=0;f<s;++f)n._parsed[f+t]=h=g[f],c&&(v()&&(c=!1),u=h);n._sorted=c}i&&S6(this,g)}parsePrimitiveData(t,s,n,a){const{iScale:o,vScale:i}=t,l=o.axis,c=i.axis,u=o.getLabels(),f=o===i,h=new Array(a);let g,v,y;for(g=0,v=a;g<v;++g)y=g+n,h[g]={[l]:f||o.parse(u[y],y),[c]:i.parse(s[y],y)};return h}parseArrayData(t,s,n,a){const{xScale:o,yScale:i}=t,l=new Array(a);let c,u,f,h;for(c=0,u=a;c<u;++c)f=c+n,h=s[f],l[c]={x:o.parse(h[0],f),y:i.parse(h[1],f)};return l}parseObjectData(t,s,n,a){const{xScale:o,yScale:i}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,u=new Array(a);let f,h,g,v;for(f=0,h=a;f<h;++f)g=f+n,v=s[g],u[f]={x:o.parse(bp(v,l),g),y:i.parse(bp(v,c),g)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,s,n){const a=this.chart,o=this._cachedMeta,i=s[t.axis],l={keys:lY(a,!0),values:s._stacks[t.axis]._visualValues};return N6(l,i,o.index,{mode:n})}updateRangeFromParsed(t,s,n,a){const o=n[s.axis];let i=o===null?NaN:o;const l=a&&n._stacks[s.axis];a&&l&&(a.values=l,i=N6(a,o,this._cachedMeta.index)),t.min=Math.min(t.min,i),t.max=Math.max(t.max,i)}getMinMax(t,s){const n=this._cachedMeta,a=n._parsed,o=n._sorted&&t===n.iScale,i=a.length,l=this._getOtherScale(t),c=PIe(s,n,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:f,max:h}=EIe(l);let g,v;function y(){v=a[g];const _=v[l.axis];return!ua(v[t.axis])||f>_||h<_}for(g=0;g<i&&!(!y()&&(this.updateRangeFromParsed(u,t,v,c),o));++g);if(o){for(g=i-1;g>=0;--g)if(!y()){this.updateRangeFromParsed(u,t,v,c);break}}return u}getAllParsedValues(t){const s=this._cachedMeta._parsed,n=[];let a,o,i;for(a=0,o=s.length;a<o;++a)i=s[a][t.axis],ua(i)&&n.push(i);return n}getMaxOverflow(){return!1}
6064getLabelAndValue(t){const s=this._cachedMeta,n=s.iScale,a=s.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:a?""+a.getLabelForValue(o[a.axis]):""}}_update(t){const s=this._cachedMeta;this.update(t||"default"),s._clip=kIe(ks(this.options.clip,NIe(s.xScale,s.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,s=this.chart,n=this._cachedMeta,a=n.data||[],o=s.chartArea,i=[],l=this._drawStart||0,c=this._drawCount||a.length-l,u=this.options.drawActiveElementsOnTop;let f;for(n.dataset&&n.dataset.draw(t,o,l,c),f=l;f<l+c;++f){const h=a[f];h.hidden||(h.active&&u?i.push(h):h.draw(t,o))}for(f=0;f<i.length;++f)i[f].draw(t,o)}getStyle(t,s){const n=s?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,s,n){const a=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];o=i.$context||(i.$context=AIe(this.getContext(),t,i)),o.parsed=this.getParsed(t),o.raw=a.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=RIe(this.chart.getContext(),this.index)),o.dataset=a,o.index=o.datasetIndex=this.index;return o.active=!!s,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,s){return this._resolveElementOptions(this.dataElementType.id,s,t)}_resolveElementOptions(t,s="default",n){const a=s==="active",o=this._cachedDataOpts,i=t+"-"+s,l=o[i],c=this.enableOptionSharing&&Sv(n);if(l)return C6(l,c);const u=this.chart.config,f=u.datasetElementScopeKeys(this._type,t),h=a?[`${t}Hover`,"hover",t,""]:[t,""],g=u.getOptionScopes(this.getDataset(),f),v=Object.keys(Jr.elements[t]),y=()=>this.getContext(n,a,s),_=u.resolveNamedOptions(g,v,y,h);return _.$shared&&(_.$shared=c,o[i]=Object.freeze(C6(_,c))),_}_resolveAnimations(t,s,n){const a=this.chart,o=this._cachedDataOpts,i=`animation-${s}`,l=o[i];if(l)return l;let c;if(a.options.animation!==!1){const f=this.chart.config,h=f.datasetAnimationScopeKeys(this._type,s),g=f.getOptionScopes(this.getDataset(),h);c=f.createResolver(g,this.getContext(t,n,s))}const u=new iY(a,c&&c.animations);return c&&c._cacheable&&(o[i]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,s){return!s||q2(t)||this.chart._animationsDisabled}_getSharedOptions(t,s){const n=this.resolveDataElementOptions(t,s),a=this._sharedOptions,o=this.getSharedOptions(n),i=this.includeOptions(s,o)||o!==a;return this.updateSharedOptions(o,s,n),{sharedOptions:o,includeOptions:i}}updateElement(t,s,n,a){q2(a)?Object.assign(t,n):this._resolveAnimations(s,a).update(t,n)}updateSharedOptions(t,s,n){t&&!q2(s)&&this._resolveAnimations(void 0,s).update(t,n)}_setStyle(t,s,n,a){t.active=a;const o=this.getStyle(s,a);this._resolveAnimations(s,n,a).update(t,{options:!a&&this.getSharedOptions(o)||o})}removeHoverStyle(t,s,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,s,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const s=this._data,n=this._cachedMeta.data;for(const[l,c,u]of this._syncList)this[l](c,u);this._syncList=[];const a=n.length,o=s.length,i=Math.min(o,a);i&&this.parse(0,i),o>a?this._insertElements(a,o-a,t):o<a&&this._removeElements(o,a-o)}_insertElements(t,s,n=!0){const a=this._cachedMeta,o=a.data,i=t+s;let l;const c=u=>{for(u.length+=s,l=u.length-1;l>=i;l--)u[l]=u[l-s]};for(c(o),l=t;l<i;++l)o[l]=new this.dataElementType;this._parsing&&c(a._parsed),this.parse(t,s),n&&this.updateElements(o,t,s,"reset")}updateElements(t,s,n,a){}_removeElements(t,s){const n=this._cachedMeta;if(this._parsing){const a=n._parsed.splice(t,s);n._stacked&&Jg(n,a)}n.data.splice(t,s)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[s,n,a]=t;this[s](n,a)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,s){s&&this._sync(["_removeElements",t,s]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Re(tp,"defaults",{}),Re(tp,"datasetElementType",null),Re(tp,"dataElementType",null);function IIe(e,t){if(!e._cache.$bar){const s=e.getMatchingVisibleMetas(t);let n=[];for(let a=0,o=s.length;a<o;a++)n=n.concat(s[a].controller.getAllParsedValues(e));e._cache.$bar=HW(n.sort((a,o)=>a-o))}return e._cache.$bar}function MIe(e){const t=e.iScale,s=IIe(t,e.type);let n=t._length,a,o,i,l;const c=()=>{i===32767||i===-32768||(Sv(l)&&(n=Math.min(n,Math.abs(i-l)||n)),l=i)};for(a=0,o=s.length;a<o;++a)i=t.getPixelForValue(s[a]),c();for(l=void 0,a=0,o=t.ticks.length;a<o;++a)i=t.getPixelForTick(a),c();return n}function OIe(e,t,s,n){const a=s.barThickness;let o,i;return nr(a)?(o=t.min*s.categoryPercentage,i=s.barPercentage):(o=a*n,i=1),{chunk:o/n,ratio:i,start:t.pixels[e]-o/2}}function LIe(e,t,s,n){const a=t.pixels,o=a[e];let i=e>0?a[e-1]:null,l=e<a.length-1?a[e+1]:null;const c=s.categoryPercentage;i===null&&(i=o-(l===null?t.end-t.start:l-o)),l===null&&(l=o+o-i);const u=o-(o-Math.min(i,l))/2*c;return{chunk:Math.abs(l-i)/2*c/n,ratio:s.barPercentage,start:u}}function DIe(e,t,s,n){const a=s.parse(e[0],n),o=s.parse(e[1],n),i=Math.min(a,o),l=Math.max(a,o);let c=i,u=l;Math.abs(i)>Math.abs(l)&&(c=l,u=i),t[s.axis]=u,t._custom={barStart:c,barEnd:u,start:a,end:o,min:i,max:l}}function cY(e,t,s,n){return an(e)?DIe(e,t,s,n):t[s.axis]=s.parse(e,n),t}function E6(e,t,s,n){const a=e.iScale,o=e.vScale,i=a.getLabels(),l=a===o,c=[];let u,f,h,g;for(u=s,f=s+n;u<f;++u)g=t[u],h={},h[a.axis]=l||a.parse(i[u],u),c.push(cY(g,h,o,u));return c}function z2(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function $Ie(e,t,s){return e!==0?sl(e):(t.isHorizontal()?1:-1)*(t.min>=s?1:-1)}function UIe(e){let t,s,n,a,o;return e.horizontal?(t=e.base>e.x,s="left",n="right"):(t=e.base<e.y,s="bottom",n="top"),t?(a="end",o="start"):(a="start",o="end"),{start:s,end:n,reverse:t,top:a,bottom:o}}function FIe(e,t,s,n){let a=t.borderSkipped;const o={};if(!a){e.borderSkipped=o;return}if(a===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:i,end:l,reverse:c,top:u,bottom:f}=UIe(e);a==="middle"&&s&&(e.enableBorderRadius=!0,(s._top||0)===n?a=u:(s._bottom||0)===n?a=f:(o[T6(f,i,l,c)]=!0,a=u)),o[T6(a,i,l,c)]=!0,e.borderSkipped=o}function T6(e,t,s,n){return n?(e=BIe(e,t,s),e=R6(e,s,t)):e=R6(e,t,s),e}function BIe(e,t,s){return e===t?s:e===s?t:e}function R6(e,t,s){return e==="start"?t:e==="end"?s:e}
6064function qIe(e,{inflateAmount:t},s){e.inflateAmount=t==="auto"?s===1?.33:0:t}class w_ extends tp{parsePrimitiveData(t,s,n,a){return E6(t,s,n,a)}parseArrayData(t,s,n,a){return E6(t,s,n,a)}parseObjectData(t,s,n,a){const{iScale:o,vScale:i}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,u=o.axis==="x"?l:c,f=i.axis==="x"?l:c,h=[];let g,v,y,_;for(g=n,v=n+a;g<v;++g)_=s[g],y={},y[o.axis]=o.parse(bp(_,u),g),h.push(cY(bp(_,f),y,i,g));return h}updateRangeFromParsed(t,s,n,a){super.updateRangeFromParsed(t,s,n,a);const o=n._custom;o&&s===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const s=this._cachedMeta,{iScale:n,vScale:a}=s,o=this.getParsed(t),i=o._custom,l=z2(i)?"["+i.start+", "+i.end+"]":""+a.getLabelForValue(o[a.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const s=this._cachedMeta;this.updateElements(s.data,0,s.data.length,t)}updateElements(t,s,n,a){const o=a==="reset",{index:i,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),u=l.isHorizontal(),f=this._getRuler(),{sharedOptions:h,includeOptions:g}=this._getSharedOptions(s,a);for(let v=s;v<s+n;v++){const y=this.getParsed(v),_=o||nr(y[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(v),j=this._calculateBarIndexPixels(v,f),w=(y._stacks||{})[l.axis],k={horizontal:u,base:_.base,enableBorderRadius:!w||z2(y._custom)||i===w._top||i===w._bottom,x:u?_.head:j.center,y:u?j.center:_.head,height:u?j.size:Math.abs(_.size),width:u?Math.abs(_.size):j.size};g&&(k.options=h||this.resolveDataElementOptions(v,t[v].active?"active":a));const S=k.options||t[v].options;FIe(k,S,w,i),qIe(k,S,f.ratio),this.updateElement(t[v],v,k,a)}}_getStacks(t,s){const{iScale:n}=this._cachedMeta,a=n.getMatchingVisibleMetas(this._type).filter(f=>f.controller.options.grouped),o=n.options.stacked,i=[],l=this._cachedMeta.controller.getParsed(s),c=l&&l[n.axis],u=f=>{const h=f._parsed.find(v=>v[n.axis]===c),g=h&&h[f.vScale.axis];if(nr(g)||isNaN(g))return!0};for(const f of a)if(!(s!==void 0&&u(f))&&((o===!1||i.indexOf(f.stack)===-1||o===void 0&&f.stack===void 0)&&i.push(f.stack),f.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,s=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===s).shift()}_getAxis(){const t={},s=this.getFirstScaleIdForIndexAxis();for(const n of this.chart.data.datasets)t[ks(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,s)]=!0;return Object.keys(t)}_getStackIndex(t,s,n){const a=this._getStacks(t,n),o=s!==void 0?a.indexOf(s):-1;return o===-1?a.length-1:o}_getRuler(){const t=this.options,s=this._cachedMeta,n=s.iScale,a=[];let o,i;for(o=0,i=s.data.length;o<i;++o)a.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const l=t.barThickness;return{min:l||MIe(s),pixels:a,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:s,_stacked:n,index:a},options:{base:o,minBarLength:i}}=this,l=o||0,c=this.getParsed(t),u=c._custom,f=z2(u);let h=c[s.axis],g=0,v=n?this.applyStack(s,c,n):h,y,_;v!==h&&(g=v-h,v=h),f&&(h=u.barStart,v=u.barEnd-u.barStart,h!==0&&sl(h)!==sl(u.barEnd)&&(g=0),g+=h);const j=!nr(o)&&!f?o:g;let w=s.getPixelForValue(j);if(this.chart.getDataVisibility(t)?y=s.getPixelForValue(g+v):y=w,_=y-w,Math.abs(_)<i){_=$Ie(_,s,l)*i,h===l&&(w-=_/2);const k=s.getPixelForDecimal(0),S=s.getPixelForDecimal(1),E=Math.min(k,S),T=Math.max(k,S);w=Math.max(Math.min(w,T),E),y=w+_,n&&!f&&(c._stacks[s.axis]._visualValues[a]=s.getValueForPixel(y)-s.getValueForPixel(w))}if(w===s.getPixelForValue(l)){const k=sl(_)*s.getLineWidthForValue(l)/2;w+=k,_-=k}return{size:_,base:w,head:y,center:y+_/2}}_calculateBarIndexPixels(t,s){const n=s.scale,a=this.options,o=a.skipNull,i=ks(a.maxBarThickness,1/0);let l,c;const u=this._getAxisCount();if(s.grouped){const f=o?this._getStackCount(t):s.stackCount,h=a.barThickness==="flex"?LIe(t,s,a,f*u):OIe(t,s,a,f*u),g=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,v=this._getAxis().indexOf(ks(g,this.getFirstScaleIdForIndexAxis())),y=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+v;
6064l=h.start+h.chunk*y+h.chunk/2,c=Math.min(i,h.chunk*h.ratio)}else l=n.getPixelForValue(this.getParsed(t)[n.axis],t),c=Math.min(i,s.min*s.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){const t=this._cachedMeta,s=t.vScale,n=t.data,a=n.length;let o=0;for(;o<a;++o)this.getParsed(o)[s.axis]!==null&&!n[o].hidden&&n[o].draw(this._ctx)}}Re(w_,"id","bar"),Re(w_,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),Re(w_,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function zIe(e,t,s){let n=1,a=1,o=0,i=0;if(t<Lr){const l=e,c=l+t,u=Math.cos(l),f=Math.sin(l),h=Math.cos(c),g=Math.sin(c),v=(S,E,T)=>Ev(S,l,c,!0)?1:Math.max(E,E*s,T,T*s),y=(S,E,T)=>Ev(S,l,c,!0)?-1:Math.min(E,E*s,T,T*s),_=v(0,u,h),j=v(jn,f,g),w=y(ir,u,h),k=y(ir+jn,f,g);n=(_-w)/2,a=(j-k)/2,o=-(_+w)/2,i=-(j+k)/2}return{ratioX:n,ratioY:a,offsetX:o,offsetY:i}}class mx extends tp{constructor(t,s){super(t,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,s){const n=this.getDataset().data,a=this._cachedMeta;if(this._parsing===!1)a._parsed=n;else{let o=c=>+n[c];if(Ls(n[t])){const{key:c="value"}=this._parsing;o=u=>+bp(n[u],c)}let i,l;for(i=t,l=t+s;i<l;++i)a._parsed[i]=o(i)}}_getRotation(){return Xl(this.options.rotation-90)}_getCircumference(){return Xl(this.options.circumference)}_getRotationExtents(){let t=Lr,s=-Lr;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const a=this.chart.getDatasetMeta(n).controller,o=a._getRotation(),i=a._getCircumference();t=Math.min(t,o),s=Math.max(s,o+i)}return{rotation:t,circumference:s-t}}update(t){const s=this.chart,{chartArea:n}=s,a=this._cachedMeta,o=a.data,i=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,l=Math.max((Math.min(n.width,n.height)-i)/2,0),c=Math.min(XAe(this.options.cutout,l),1),u=this._getRingWeight(this.index),{circumference:f,rotation:h}=this._getRotationExtents(),{ratioX:g,ratioY:v,offsetX:y,offsetY:_}=zIe(h,f,c),j=(n.width-i)/g,w=(n.height-i)/v,k=Math.max(Math.min(j,w)/2,0),S=UW(this.options.radius,k),E=Math.max(S*c,0),T=(S-E)/this._getVisibleDatasetWeightTotal();this.offsetX=y*S,this.offsetY=_*S,a.total=this.calculateTotal(),this.outerRadius=S-T*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-T*u,0),this.updateElements(o,0,o.length,t)}_circumference(t,s){const n=this.options,a=this._cachedMeta,o=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||a._parsed[t]===null||a.data[t].hidden?0:this.calculateCircumference(a._parsed[t]*o/Lr)}updateElements(t,s,n,a){const o=a==="reset",i=this.chart,l=i.chartArea,u=i.options.animation,f=(l.left+l.right)/2,h=(l.top+l.bottom)/2,g=o&&u.animateScale,v=g?0:this.innerRadius,y=g?0:this.outerRadius,{sharedOptions:_,includeOptions:j}=this._getSharedOptions(s,a);let w=this._getRotation(),k;for(k=0;k<s;++k)w+=this._circumference(k,o);for(k=s;k<s+n;++k){const S=this._circumference(k,o),E=t[k],T={x:f+this.offsetX,y:h+this.offsetY,startAngle:w,endAngle:w+S,circumference:S,outerRadius:y,innerRadius:v};j&&(T.options=_||this.resolveDataElementOptions(k,E.active?"active":a)),w+=S,this.updateElement(E,k,T,a)}}calculateTotal(){const t=this._cachedMeta,s=t.data;let n=0,a;for(a=0;a<s.length;a++){const o=t._parsed[a];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(a)&&!s[a].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){const s=this._cachedMeta.total;return s>0&&!isNaN(t)?Lr*(Math.abs(t)/s):0}getLabelAndValue(t){const s=this._cachedMeta,n=this.chart,a=n.data.labels||[],o=FA(s._parsed[t],n.options.locale);return{label:a[t]||"",value:o}}getMaxBorderWidth(t){let s=0;const n=this.chart;let a,o,i,l,c;if(!t){for(a=0,o=n.data.datasets.length;a<o;++a)if(n.isDatasetVisible(a)){i=n.getDatasetMeta(a),t=i.data,l=i.controller;break}}if(!t)return 0;for(a=0,o=t.length;a<o;++a)c=l.resolveDataElementOptions(a),c.borderAlign!=="inner"&&(s=Math.max(s,c.borderWidth||0,c.hoverBorderWidth||0));return s}getMaxOffset(t){let s=0;for(let n=0,a=t.length;n<a;++n){const o=this.resolveDataElementOptions(n);s=Math.max(s,o.offset||0,o.hoverOffset||0)}return s}_getRingWeightOffset(t){let s=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(t){return Math.max(ks(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Re(mx,"id","doughnut"),Re(mx,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}}
6064,cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),Re(mx,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Re(mx,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const s=t.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:n,color:a}}=t.legend.options;return s.labels.map((o,i)=>{const c=t.getDatasetMeta(0).controller.getStyle(i);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:a,lineWidth:c.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(i),index:i}})}return[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}});class N_ extends tp{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const s=this._cachedMeta,{dataset:n,data:a=[],_dataset:o}=s,i=this.chart._animationsDisabled;let{start:l,count:c}=xPe(s,a,i);this._drawStart=l,this._drawCount=c,vPe(s)&&(l=0,c=a.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=a;const u=this.resolveDatasetElementOptions(t);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(n,void 0,{animated:!i,options:u},t),this.updateElements(a,l,c,t)}updateElements(t,s,n,a){const o=a==="reset",{iScale:i,vScale:l,_stacked:c,_dataset:u}=this._cachedMeta,{sharedOptions:f,includeOptions:h}=this._getSharedOptions(s,a),g=i.axis,v=l.axis,{spanGaps:y,segment:_}=this.options,j=Cv(y)?y:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||a==="none",k=s+n,S=t.length;let E=s>0&&this.getParsed(s-1);for(let T=0;T<S;++T){const A=t[T],R=w?A:{};if(T<s||T>=k){R.skip=!0;continue}const I=this.getParsed(T),L=nr(I[v]),M=R[g]=i.getPixelForValue(I[g],T),O=R[v]=o||L?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,I,c):I[v],T);R.skip=isNaN(M)||isNaN(O)||L,R.stop=T>0&&Math.abs(I[g]-E[g])>j,_&&(R.parsed=I,R.raw=u.data[T]),h&&(R.options=f||this.resolveDataElementOptions(T,A.active?"active":a)),w||this.updateElement(A,T,R,a),E=I}}getMaxOverflow(){const t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,a=t.data||[];if(!a.length)return n;const o=a[0].size(this.resolveDataElementOptions(0)),i=a[a.length-1].size(this.resolveDataElementOptions(a.length-1));return Math.max(n,o,i)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Re(N_,"id","line"),Re(N_,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Re(N_,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Su(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class WA{constructor(t){Re(this,"options");this.options=t||{}}static override(t){Object.assign(WA.prototype,t)}init(){}formats(){return Su()}parse(){return Su()}format(){return Su()}add(){return Su()}diff(){return Su()}startOf(){return Su()}endOf(){return Su()}}var HIe={_date:WA};function VIe(e,t,s,n){const{controller:a,data:o,_sorted:i}=e,l=a._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(l&&t===l.axis&&t!=="r"&&i&&o.length){const u=l._reversePixels?pPe:Vu;if(n){if(a._sharedOptions){const f=o[0],h=typeof f.getRange=="function"&&f.getRange(t);if(h){const g=u(o,t,s-h),v=u(o,t,s+h);return{lo:g.lo,hi:v.hi}}}}else{const f=u(o,t,s);if(c){const{vScale:h}=a._cachedMeta,{_parsed:g}=e,v=g.slice(0,f.lo+1).reverse().findIndex(_=>!nr(_[h.axis]));f.lo-=Math.max(0,v);const y=g.slice(f.hi).findIndex(_=>!nr(_[h.axis]));f.hi+=Math.max(0,y)}return f}}return{lo:0,hi:o.length-1}}function p1(e,t,s,n,a){const o=e.getSortedVisibleDatasetMetas(),i=s[t];for(let l=0,c=o.length;l<c;++l){const{index:u,data:f}=o[l],{lo:h,hi:g}=VIe(o[l],t,i,a);for(let v=h;v<=g;++v){const y=f[v];y.skip||n(y,u,v)}}}function GIe(e){const t=e.indexOf("x")!==-1,s=e.indexOf("y")!==-1;return function(n,a){const o=t?Math.abs(n.x-a.x):0,i=s?Math.abs(n.y-a.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}function H2(e,t,s,n,a){const o=[];return!a&&!e.isPointInArea(t)||p1(e,s,t,function(l,c,u){!a&&!Tv(l,e.chartArea,0)||l.inRange(t.x,t.y,n)&&o.push({element:l,datasetIndex:c,index:u})},!0),o}function WIe(e,t,s,n){let a=[];function o(i,l,c){const{startAngle:u,endAngle:f}=i.getProps(["startAngle","endAngle"],n),{angle:h}=qW(i,{x:t.x,y:t.y});Ev(h,u,f)&&a.push({element:i,datasetIndex:l,index:c})}return p1(e,s,t,o),a}function YIe(e,t,s,n,a,o){let i=[];const l=GIe(s);let c=Number.POSITIVE_INFINITY;function u(f,h,g){const v=f.inRange(t.x,t.y,a);if(n&&!v)return;const y=f.getCenterPoint(a);if(!(!!o||e.isPointInArea(y))&&!v)return;const j=l(t,y);j<c?(i=[{element:f,datasetIndex:h,index:g}],c=j):j===c&&i.push({element:f,datasetIndex:h,index:g})}return p1(e,s,t,u),i}function V2(e,t,s,n,a,o){return!o&&!e.isPointInArea(t)?[]:s==="r"&&!n?WIe(e,t,s,a):YIe(e,t,s,n,a,o)}function A6(e,t,s,n,a){const o=[],i=s==="x"?"inXRange":"inYRange";let l=!1;return p1(e,s,t,(c,u,f)=>{c[i]&&c[i](t[s],a)&&(o.push({element:c,datasetIndex:u,index:f}),l=l||c.inRange(t.x,t.y,a))}),n&&!l?[]:o}var KIe={modes:{index(e,t,s,n){const a=Pu(t,e),o=s.axis||"x",i=s.includeInvisible||!1,l=s.intersect?H2(e,a,o,n,i):V2(e,a,o,!1,n,i),c=[];
6064return l.length?(e.getSortedVisibleDatasetMetas().forEach(u=>{const f=l[0].index,h=u.data[f];h&&!h.skip&&c.push({element:h,datasetIndex:u.index,index:f})}),c):[]},dataset(e,t,s,n){const a=Pu(t,e),o=s.axis||"xy",i=s.includeInvisible||!1;let l=s.intersect?H2(e,a,o,n,i):V2(e,a,o,!1,n,i);if(l.length>0){const c=l[0].datasetIndex,u=e.getDatasetMeta(c).data;l=[];for(let f=0;f<u.length;++f)l.push({element:u[f],datasetIndex:c,index:f})}return l},point(e,t,s,n){const a=Pu(t,e),o=s.axis||"xy",i=s.includeInvisible||!1;return H2(e,a,o,n,i)},nearest(e,t,s,n){const a=Pu(t,e),o=s.axis||"xy",i=s.includeInvisible||!1;return V2(e,a,o,s.intersect,n,i)},x(e,t,s,n){const a=Pu(t,e);return A6(e,a,"x",s.intersect,n)},y(e,t,s,n){const a=Pu(t,e);return A6(e,a,"y",s.intersect,n)}}};const dY=["left","top","right","bottom"];function Xg(e,t){return e.filter(s=>s.pos===t)}function P6(e,t){return e.filter(s=>dY.indexOf(s.pos)===-1&&s.box.axis===t)}function Qg(e,t){return e.sort((s,n)=>{const a=t?n:s,o=t?s:n;return a.weight===o.weight?a.index-o.index:a.weight-o.weight})}function JIe(e){const t=[];let s,n,a,o,i,l;for(s=0,n=(e||[]).length;s<n;++s)a=e[s],{position:o,options:{stack:i,stackWeight:l=1}}=a,t.push({index:s,box:a,pos:o,horizontal:a.isHorizontal(),weight:a.weight,stack:i&&o+i,stackWeight:l});return t}function XIe(e){const t={};for(const s of e){const{stack:n,pos:a,stackWeight:o}=s;if(!n||!dY.includes(a))continue;const i=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}function QIe(e,t){const s=XIe(e),{vBoxMaxWidth:n,hBoxMaxHeight:a}=t;let o,i,l;for(o=0,i=e.length;o<i;++o){l=e[o];const{fullSize:c}=l.box,u=s[l.stack],f=u&&l.stackWeight/u.weight;l.horizontal?(l.width=f?f*n:c&&t.availableWidth,l.height=a):(l.width=n,l.height=f?f*a:c&&t.availableHeight)}return s}function ZIe(e){const t=JIe(e),s=Qg(t.filter(u=>u.box.fullSize),!0),n=Qg(Xg(t,"left"),!0),a=Qg(Xg(t,"right")),o=Qg(Xg(t,"top"),!0),i=Qg(Xg(t,"bottom")),l=P6(t,"x"),c=P6(t,"y");return{fullSize:s,leftAndTop:n.concat(o),rightAndBottom:a.concat(c).concat(i).concat(l),chartArea:Xg(t,"chartArea"),vertical:n.concat(a).concat(c),horizontal:o.concat(i).concat(l)}}function I6(e,t,s,n){return Math.max(e[s],t[s])+Math.max(e[n],t[n])}function uY(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function e4e(e,t,s,n){const{pos:a,box:o}=s,i=e.maxPadding;if(!Ls(a)){s.size&&(e[a]-=s.size);const h=n[s.stack]||{size:0,count:1};h.size=Math.max(h.size,s.horizontal?o.height:o.width),s.size=h.size/h.count,e[a]+=s.size}o.getPadding&&uY(i,o.getPadding());const l=Math.max(0,t.outerWidth-I6(i,e,"left","right")),c=Math.max(0,t.outerHeight-I6(i,e,"top","bottom")),u=l!==e.w,f=c!==e.h;return e.w=l,e.h=c,s.horizontal?{same:u,other:f}:{same:f,other:u}}function t4e(e){const t=e.maxPadding;function s(n){const a=Math.max(t[n]-e[n],0);return e[n]+=a,a}e.y+=s("top"),e.x+=s("left"),s("right"),s("bottom")}function s4e(e,t){const s=t.maxPadding;function n(a){const o={left:0,top:0,right:0,bottom:0};return a.forEach(i=>{o[i]=Math.max(t[i],s[i])}),o}return n(e?["left","right"]:["top","bottom"])}function gx(e,t,s,n){const a=[];let o,i,l,c,u,f;for(o=0,i=e.length,u=0;o<i;++o){l=e[o],c=l.box,c.update(l.width||t.w,l.height||t.h,s4e(l.horizontal,t));const{same:h,other:g}=e4e(t,s,l,n);u|=h&&a.length,f=f||g,c.fullSize||a.push(l)}return u&&gx(a,t,s,n)||f}function z0(e,t,s,n,a){e.top=s,e.left=t,e.right=t+n,e.bottom=s+a,e.width=n,e.height=a}function M6(e,t,s,n){const a=s.padding;let{x:o,y:i}=t;for(const l of e){const c=l.box,u=n[l.stack]||{placed:0,weight:1},f=l.stackWeight/u.weight||1;if(l.horizontal){const h=t.w*f,g=u.size||c.height;Sv(u.start)&&(i=u.start),c.fullSize?z0(c,a.left,i,s.outerWidth-a.right-a.left,g):z0(c,t.left+u.placed,i,h,g),u.start=i,u.placed+=h,i=c.bottom}else{const h=t.h*f,g=u.size||c.width;Sv(u.start)&&(o=u.start),c.fullSize?z0(c,o,a.top,g,s.outerHeight-a.bottom-a.top):z0(c,o,t.top+u.placed,g,h),u.start=o,u.placed+=h,o=c.right}}t.x=o,t.y=i}var $o={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(s){t.draw(s)}}]},e.boxes.push(t)},removeBox(e,t){const s=e.boxes?e.boxes.indexOf(t):-1;s!==-1&&e.boxes.splice(s,1)},configure(e,t,s){t.fullSize=s.fullSize,t.position=s.position,t.weight=s.weight},update(e,t,s,n){if(!e)return;const a=Ko(e.options.layout.padding),o=Math.max(t-a.width,0),i=Math.max(s-a.height,0),l=ZIe(e.boxes),c=l.vertical,u=l.horizontal;or(e.boxes,_=>{typeof _.beforeLayout=="function"&&_.beforeLayout()});const f=c.reduce((_,j)=>j.box.options&&j.box.options.display===!1?_:_+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:s,padding:a,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/f,hBoxMaxHeight:i/2}),g=Object.assign({},a);uY(g,Ko(n));const v=Object.assign({maxPadding:g,w:o,h:i,x:a.left,y:a.top},a),y=QIe(c.concat(u),h);gx(l.fullSize,v,h,y),gx(c,v,h,y),gx(u,v,h,y)&&gx(c,v,h,y),t4e(v),M6(l.leftAndTop,v,h,y),v.x+=v.w,v.y+=v.h,M6(l.rightAndBottom,v,h,y),e.chartArea={left:v.left,top:v.top,right:v.left+v.w,bottom:v.top+v.h,height:v.h,width:v.w},or(l.chartArea,_=>{const j=_.box;Object.assign(j,e.chartArea),j.update(v.w,v.h,{left:0,top:0,right:0,bottom:0})})}};class pY{acquireContext(t,s){}releaseContext(t){return!1}
6064addEventListener(t,s,n){}removeEventListener(t,s,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,s,n,a){return s=Math.max(0,s||t.width),n=n||t.height,{width:s,height:Math.max(0,a?Math.floor(s/a):n)}}isAttached(t){return!0}updateConfig(t){}}class r4e extends pY{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const k_="$chartjs",n4e={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},O6=e=>e===null||e==="";function a4e(e,t){const s=e.style,n=e.getAttribute("height"),a=e.getAttribute("width");if(e[k_]={initial:{height:n,width:a,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",O6(a)){const o=v6(e,"width");o!==void 0&&(e.width=o)}if(O6(n))if(e.style.height==="")e.height=e.width/(t||2);else{const o=v6(e,"height");o!==void 0&&(e.height=o)}return e}const fY=iIe?{passive:!0}:!1;function o4e(e,t,s){e&&e.addEventListener(t,s,fY)}function i4e(e,t,s){e&&e.canvas&&e.canvas.removeEventListener(t,s,fY)}function l4e(e,t){const s=n4e[e.type]||e.type,{x:n,y:a}=Pu(e,t);return{type:s,chart:t,native:e,x:n!==void 0?n:null,y:a!==void 0?a:null}}function qj(e,t){for(const s of e)if(s===t||s.contains(t))return!0}function c4e(e,t,s){const n=e.canvas,a=new MutationObserver(o=>{let i=!1;for(const l of o)i=i||qj(l.addedNodes,n),i=i&&!qj(l.removedNodes,n);i&&s()});return a.observe(document,{childList:!0,subtree:!0}),a}function d4e(e,t,s){const n=e.canvas,a=new MutationObserver(o=>{let i=!1;for(const l of o)i=i||qj(l.removedNodes,n),i=i&&!qj(l.addedNodes,n);i&&s()});return a.observe(document,{childList:!0,subtree:!0}),a}const Av=new Map;let L6=0;function hY(){const e=window.devicePixelRatio;e!==L6&&(L6=e,Av.forEach((t,s)=>{s.currentDevicePixelRatio!==e&&t()}))}function u4e(e,t){Av.size||window.addEventListener("resize",hY),Av.set(e,t)}function p4e(e){Av.delete(e),Av.size||window.removeEventListener("resize",hY)}function f4e(e,t,s){const n=e.canvas,a=n&&GA(n);if(!a)return;const o=GW((l,c)=>{const u=a.clientWidth;s(l,c),u<a.clientWidth&&s()},window),i=new ResizeObserver(l=>{const c=l[0],u=c.contentRect.width,f=c.contentRect.height;u===0&&f===0||o(u,f)});return i.observe(a),u4e(e,o),i}function G2(e,t,s){s&&s.disconnect(),t==="resize"&&p4e(e)}function h4e(e,t,s){const n=e.canvas,a=GW(o=>{e.ctx!==null&&s(l4e(o,e))},e);return o4e(n,t,a),a}class m4e extends pY{acquireContext(t,s){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(a4e(t,s),n):null}releaseContext(t){const s=t.canvas;if(!s[k_])return!1;const n=s[k_].initial;["height","width"].forEach(o=>{const i=n[o];nr(i)?s.removeAttribute(o):s.setAttribute(o,i)});const a=n.style||{};return Object.keys(a).forEach(o=>{s.style[o]=a[o]}),s.width=s.width,delete s[k_],!0}addEventListener(t,s,n){this.removeEventListener(t,s);const a=t.$proxies||(t.$proxies={}),i={attach:c4e,detach:d4e,resize:f4e}[s]||h4e;a[s]=i(t,s,n)}removeEventListener(t,s){const n=t.$proxies||(t.$proxies={}),a=n[s];if(!a)return;({attach:G2,detach:G2,resize:G2}[s]||i4e)(t,s,a),n[s]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,s,n,a){return oIe(t,s,n,a)}isAttached(t){const s=t&&GA(t);return!!(s&&s.isConnected)}}function g4e(e){return!VA()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?r4e:m4e}var X0;let gc=(X0=class{constructor(){Re(this,"x");Re(this,"y");Re(this,"active",!1);Re(this,"options");Re(this,"$animations")}tooltipPosition(t){const{x:s,y:n}=this.getProps(["x","y"],t);return{x:s,y:n}}hasValue(){return Cv(this.x)&&Cv(this.y)}getProps(t,s){const n=this.$animations;if(!s||!n)return this;const a={};return t.forEach(o=>{a[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),a}},Re(X0,"defaults",{}),Re(X0,"defaultRoutes"),X0);function x4e(e,t){const s=e.options.ticks,n=v4e(e),a=Math.min(s.maxTicksLimit||n,n),o=s.major.enabled?y4e(t):[],i=o.length,l=o[0],c=o[i-1],u=[];if(i>a)return _4e(t,u,o,i/a),u;const f=b4e(o,t,a);if(i>0){let h,g;const v=i>1?Math.round((c-l)/(i-1)):null;for(H0(t,u,f,nr(v)?0:l-v,l),h=0,g=i-1;h<g;h++)H0(t,u,f,o[h],o[h+1]);return H0(t,u,f,c,nr(v)?t.length:c+v),u}return H0(t,u,f),u}function v4e(e){const t=e.options.offset,s=e._tickSize(),n=e._length/s+(t?0:1),a=e._maxLength/s;return Math.floor(Math.min(n,a))}function b4e(e,t,s){const n=j4e(e),a=t.length/s;if(!n)return Math.max(a,1);const o=aPe(n);for(let i=0,l=o.length-1;i<l;i++){const c=o[i];if(c>a)return c}return Math.max(a,1)}function y4e(e){const t=[];let s,n;for(s=0,n=e.length;s<n;s++)e[s].major&&t.push(s);return t}function _4e(e,t,s,n){let a=0,o=s[0],i;for(n=Math.ceil(n),i=0;i<e.length;i++)i===o&&(t.push(e[i]),a++,o=s[a*n])}function H0(e,t,s,n,a){const o=ks(n,0),i=Math.min(ks(a,e.length),e.length);let l=0,c,u,f;for(s=Math.ceil(s),a&&(c=a-n,s=c/Math.floor(c/s)),f=o;f<0;)l++,f=Math.round(o+l*s);for(u=Math.max(o,0);u<i;u++)u===f&&(t.push(e[u]),l++,f=Math.round(o+l*s))}function j4e(e){const t=e.length;let s,n;if(t<2)return!1;for(n=e[0],s=1;s<t;++s)if(e[s]-e[s-1]!==n)return!1;return n}const w4e=e=>
6064e==="left"?"right":e==="right"?"left":e,D6=(e,t,s)=>t==="top"||t==="left"?e[t]+s:e[t]-s,$6=(e,t)=>Math.min(t||e,e);function U6(e,t){const s=[],n=e.length/t,a=e.length;let o=0;for(;o<a;o+=n)s.push(e[Math.floor(o)]);return s}function N4e(e,t,s){const n=e.ticks.length,a=Math.min(t,n-1),o=e._startPixel,i=e._endPixel,l=1e-6;let c=e.getPixelForTick(a),u;if(!(s&&(n===1?u=Math.max(c-o,i-c):t===0?u=(e.getPixelForTick(1)-c)/2:u=(c-e.getPixelForTick(a-1))/2,c+=a<t?u:-u,c<o-l||c>i+l)))return c}function k4e(e,t){or(e,s=>{const n=s.gc,a=n.length/2;let o;if(a>t){for(o=0;o<a;++o)delete s.data[n[o]];n.splice(0,a)}})}function Zg(e){return e.drawTicks?e.tickLength:0}function F6(e,t){if(!e.display)return 0;const s=ia(e.font,t),n=Ko(e.padding);return(an(e.text)?e.text.length:1)*s.lineHeight+n.height}function S4e(e,t){return Ip(e,{scale:t,type:"scale"})}function C4e(e,t,s){return Ip(e,{tick:s,index:t,type:"tick"})}function E4e(e,t,s){let n=$A(e);return(s&&t!=="right"||!s&&t==="right")&&(n=w4e(n)),n}function T4e(e,t,s,n){const{top:a,left:o,bottom:i,right:l,chart:c}=e,{chartArea:u,scales:f}=c;let h=0,g,v,y;const _=i-a,j=l-o;if(e.isHorizontal()){if(v=ta(n,o,l),Ls(s)){const w=Object.keys(s)[0],k=s[w];y=f[w].getPixelForValue(k)+_-t}else s==="center"?y=(u.bottom+u.top)/2+_-t:y=D6(e,s,t);g=l-o}else{if(Ls(s)){const w=Object.keys(s)[0],k=s[w];v=f[w].getPixelForValue(k)-j+t}else s==="center"?v=(u.left+u.right)/2-j+t:v=D6(e,s,t);y=ta(n,i,a),h=s==="left"?-jn:jn}return{titleX:v,titleY:y,maxWidth:g,rotation:h}}class mm extends gc{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,s){return t}getUserBounds(){let{_userMin:t,_userMax:s,_suggestedMin:n,_suggestedMax:a}=this;return t=Oi(t,Number.POSITIVE_INFINITY),s=Oi(s,Number.NEGATIVE_INFINITY),n=Oi(n,Number.POSITIVE_INFINITY),a=Oi(a,Number.NEGATIVE_INFINITY),{min:Oi(t,n),max:Oi(s,a),minDefined:ua(t),maxDefined:ua(s)}}getMinMax(t){let{min:s,max:n,minDefined:a,maxDefined:o}=this.getUserBounds(),i;if(a&&o)return{min:s,max:n};const l=this.getMatchingVisibleMetas();for(let c=0,u=l.length;c<u;++c)i=l[c].controller.getMinMax(this,t),a||(s=Math.min(s,i.min)),o||(n=Math.max(n,i.max));return s=o&&s>n?n:s,n=a&&s>n?s:n,{min:Oi(s,Oi(n,s)),max:Oi(n,Oi(s,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){wr(this.options.beforeUpdate,[this])}update(t,s,n){const{beginAtZero:a,grace:o,ticks:i}=this.options,l=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=s,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=$Pe(this,o,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=l<this.ticks.length;this._convertTicksToLabels(c?U6(this.ticks,l):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||i.source==="auto")&&(this.ticks=x4e(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,s,n;this.isHorizontal()?(s=this.left,n=this.right):(s=this.top,n=this.bottom,t=!t),this._startPixel=s,this._endPixel=n,this._reversePixels=t,this._length=n-s,this._alignToPixels=this.options.alignToPixels}afterUpdate(){wr(this.options.afterUpdate,[this])}beforeSetDimensions(){wr(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){wr(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),wr(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){wr(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const s=this.options.ticks;let n,a,o;for(n=0,a=t.length;n<a;
6064n++)o=t[n],o.label=wr(s.callback,[o.value,n,t],this)}afterTickToLabelConversion(){wr(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){wr(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,s=t.ticks,n=$6(this.ticks.length,t.ticks.maxTicksLimit),a=s.minRotation||0,o=s.maxRotation;let i=a,l,c,u;if(!this._isVisible()||!s.display||a>=o||n<=1||!this.isHorizontal()){this.labelRotation=a;return}const f=this._getLabelSizes(),h=f.widest.width,g=f.highest.height,v=oa(this.chart.width-h,0,this.maxWidth);l=t.offset?this.maxWidth/n:v/(n-1),h+6>l&&(l=v/(n-(t.offset?.5:1)),c=this.maxHeight-Zg(t.grid)-s.padding-F6(t.title,this.chart.options.font),u=Math.sqrt(h*h+g*g),i=cPe(Math.min(Math.asin(oa((f.highest.height+6)/l,-1,1)),Math.asin(oa(c/u,-1,1))-Math.asin(oa(g/u,-1,1)))),i=Math.max(a,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){wr(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){wr(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:s,options:{ticks:n,title:a,grid:o}}=this,i=this._isVisible(),l=this.isHorizontal();if(i){const c=F6(a,s.options.font);if(l?(t.width=this.maxWidth,t.height=Zg(o)+c):(t.height=this.maxHeight,t.width=Zg(o)+c),n.display&&this.ticks.length){const{first:u,last:f,widest:h,highest:g}=this._getLabelSizes(),v=n.padding*2,y=Xl(this.labelRotation),_=Math.cos(y),j=Math.sin(y);if(l){const w=n.mirror?0:j*h.width+_*g.height;t.height=Math.min(this.maxHeight,t.height+w+v)}else{const w=n.mirror?0:_*h.width+j*g.height;t.width=Math.min(this.maxWidth,t.width+w+v)}this._calculatePadding(u,f,j,_)}}this._handleMargins(),l?(this.width=this._length=s.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=s.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,s,n,a){const{ticks:{align:o,padding:i},position:l}=this.options,c=this.labelRotation!==0,u=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const f=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let g=0,v=0;c?u?(g=a*t.width,v=n*s.height):(g=n*t.height,v=a*s.width):o==="start"?v=s.width:o==="end"?g=t.width:o!=="inner"&&(g=t.width/2,v=s.width/2),this.paddingLeft=Math.max((g-f+i)*this.width/(this.width-f),0),this.paddingRight=Math.max((v-h+i)*this.width/(this.width-h),0)}else{let f=s.height/2,h=t.height/2;o==="start"?(f=0,h=t.height):o==="end"&&(f=s.height,h=0),this.paddingTop=f+i,this.paddingBottom=h+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){wr(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:s}=this.options;return s==="top"||s==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let s,n;for(s=0,n=t.length;s<n;s++)nr(t[s].label)&&(t.splice(s,1),n--,s--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const s=this.options.ticks.sampleSize;let n=this.ticks;s<n.length&&(n=U6(n,s)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,s,n){const{ctx:a,_longestTextCache:o}=this,i=[],l=[],c=Math.floor(s/$6(s,n));let u=0,f=0,h,g,v,y,_,j,w,k,S,E,T;for(h=0;h<s;h+=c){if(y=t[h].label,_=this._resolveTickFontOptions(h),a.font=j=_.string,w=o[j]=o[j]||{data:{},gc:[]},k=_.lineHeight,S=E=0,!nr(y)&&!an(y))S=f6(a,w.data,w.gc,S,y),E=k;else if(an(y))for(g=0,v=y.length;g<v;++g)T=y[g],!nr(T)&&!an(T)&&(S=f6(a,w.data,w.gc,S,T),E+=k);i.push(S),l.push(E),u=Math.max(S,u),f=Math.max(E,f)}k4e(o,s);const A=i.indexOf(u),R=l.indexOf(f),I=L=>({width:i[L]||0,height:l[L]||0});return{first:I(0),last:I(s-1),widest:I(A),highest:I(R),widths:i,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,s){return NaN}getValueForPixel(t){}getPixelForTick(t){const s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const s=this._startPixel+t*this._length;return uPe(this._alignToPixels?ku(this.chart,s,0):s)}getDecimalForPixel(t){const s=(t-this._startPixel)/this._length;return this._reversePixels?1-s:s}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:s}=this;return t<0&&s<0?s:t>0&&s>0?t:0}getContext(t){const s=this.ticks||[];if(t>=0&&t<s.length){const n=s[t];return n.$context||(n.$context=C4e(this.getContext(),t,n))}return this.$context||(this.$context=S4e(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,s=Xl(this.labelRotation),n=Math.abs(Math.cos(s)),a=Math.abs(Math.sin(s)),o=this._getLabelSizes(),i=t.autoSkipPadding||0,l=o?o.widest.width+i:0,c=o?o.highest.height+i:0;return this.isHorizontal()?c*n>l*a?l/n:c/a:c*a<l*n?c/n:l/a}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const s=this.axis,n=this.chart,a=this.options,{grid:o,position:i,border:l}=a,c=o.offset,u=this.isHorizontal(),h=this.ticks.length+(c?1:0),g=Zg(o),v=[],y=l.setContext(this.getContext()),_=y.display?y.width:0,j=_/2,w=function(q){return ku(n,q,_)};let k,S,E,T,A,R,I,L,M,O,z,X;if(i==="top")k=w(this.bottom),R=this.bottom-g,L=k-j,O=w(t.top)+j,X=t.bottom;else if(i==="bottom")k=w(this.top),O=t.top,X=w(t.bottom)-j,R=k+j,L=this.top+g;else if(i==="left")k=w(this.right),A=this.right-g,I=k-j,M=w(t.left)+j,z=t.right;else if(i==="right")k=w(this.left),M=t.left,z=w(t.right)-j,A=k+j,I=this.left+g;else if(s==="x"){if(i==="center")k=w((t.top+t.bottom)/2+.5);else if(Ls(i)){const q=Object.keys(i)[0],J=i[q];k=w(this.chart.scales[q].getPixelForValue(J))}O=t.top,X=t.bottom,R=k+j,L=R+g}else if(s==="y"){if(i==="center")k=w((t.left+t.right)/2);else if(Ls(i)){const q=Object.keys(i)[0],J=i[q];k=w(this.chart.scales[q].getPixelForValue(J))}A=k-j,I=A-g,M=t.left,z=t.right}const W=ks(a.ticks.maxTicksLimit,h),K=Math.max(1,Math.ceil(h/W));for(S=0;S<h;S+=K){const q=this.getContext(S),J=o.setContext(q),F=l.setContext(q),V=J.lineWidth,$=J.color,B=F.dash||[],ae=F.dashOffset,H=J.tickWidth,U=J.tickColor,oe
6064=J.tickBorderDash||[],fe=J.tickBorderDashOffset;E=N4e(this,S,c),E!==void 0&&(T=ku(n,E,V),u?A=I=M=z=T:R=L=O=X=T,v.push({tx1:A,ty1:R,tx2:I,ty2:L,x1:M,y1:O,x2:z,y2:X,width:V,color:$,borderDash:B,borderDashOffset:ae,tickWidth:H,tickColor:U,tickBorderDash:oe,tickBorderDashOffset:fe}))}return this._ticksLength=h,this._borderValue=k,v}_computeLabelItems(t){const s=this.axis,n=this.options,{position:a,ticks:o}=n,i=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:u,padding:f,mirror:h}=o,g=Zg(n.grid),v=g+f,y=h?-f:v,_=-Xl(this.labelRotation),j=[];let w,k,S,E,T,A,R,I,L,M,O,z,X="middle";if(a==="top")A=this.bottom-y,R=this._getXAxisLabelAlignment();else if(a==="bottom")A=this.top+y,R=this._getXAxisLabelAlignment();else if(a==="left"){const K=this._getYAxisLabelAlignment(g);R=K.textAlign,T=K.x}else if(a==="right"){const K=this._getYAxisLabelAlignment(g);R=K.textAlign,T=K.x}else if(s==="x"){if(a==="center")A=(t.top+t.bottom)/2+v;else if(Ls(a)){const K=Object.keys(a)[0],q=a[K];A=this.chart.scales[K].getPixelForValue(q)+v}R=this._getXAxisLabelAlignment()}else if(s==="y"){if(a==="center")T=(t.left+t.right)/2-v;else if(Ls(a)){const K=Object.keys(a)[0],q=a[K];T=this.chart.scales[K].getPixelForValue(q)}R=this._getYAxisLabelAlignment(g).textAlign}s==="y"&&(c==="start"?X="top":c==="end"&&(X="bottom"));const W=this._getLabelSizes();for(w=0,k=l.length;w<k;++w){S=l[w],E=S.label;const K=o.setContext(this.getContext(w));I=this.getPixelForTick(w)+o.labelOffset,L=this._resolveTickFontOptions(w),M=L.lineHeight,O=an(E)?E.length:1;const q=O/2,J=K.color,F=K.textStrokeColor,V=K.textStrokeWidth;let $=R;i?(T=I,R==="inner"&&(w===k-1?$=this.options.reverse?"left":"right":w===0?$=this.options.reverse?"right":"left":$="center"),a==="top"?u==="near"||_!==0?z=-O*M+M/2:u==="center"?z=-W.highest.height/2-q*M+M:z=-W.highest.height+M/2:u==="near"||_!==0?z=M/2:u==="center"?z=W.highest.height/2-q*M:z=W.highest.height-O*M,h&&(z*=-1),_!==0&&!K.showLabelBackdrop&&(T+=M/2*Math.sin(_))):(A=I,z=(1-O)*M/2);let B;if(K.showLabelBackdrop){const ae=Ko(K.backdropPadding),H=W.heights[w],U=W.widths[w];let oe=z-ae.top,fe=0-ae.left;switch(X){case"middle":oe-=H/2;break;case"bottom":oe-=H;break}switch(R){case"center":fe-=U/2;break;case"right":fe-=U;break;case"inner":w===k-1?fe-=U:w>0&&(fe-=U/2);break}B={left:fe,top:oe,width:U+ae.width,height:H+ae.height,color:K.backdropColor}}j.push({label:E,font:L,textOffset:z,options:{rotation:_,color:J,strokeColor:F,strokeWidth:V,textAlign:$,textBaseline:X,translation:[T,A],backdrop:B}})}return j}_getXAxisLabelAlignment(){const{position:t,ticks:s}=this.options;if(-Xl(this.labelRotation))return t==="top"?"left":"right";let a="center";return s.align==="start"?a="left":s.align==="end"?a="right":s.align==="inner"&&(a="inner"),a}_getYAxisLabelAlignment(t){const{position:s,ticks:{crossAlign:n,mirror:a,padding:o}}=this.options,i=this._getLabelSizes(),l=t+o,c=i.widest.width;let u,f;return s==="left"?a?(f=this.right+o,n==="near"?u="left":n==="center"?(u="center",f+=c/2):(u="right",f+=c)):(f=this.right-l,n==="near"?u="right":n==="center"?(u="center",f-=c/2):(u="left",f=this.left)):s==="right"?a?(f=this.left+o,n==="near"?u="right":n==="center"?(u="center",f-=c/2):(u="left",f-=c)):(f=this.left+l,n==="near"?u="left":n==="center"?(u="center",f+=c/2):(u="right",f=this.right)):u="right",{textAlign:u,x:f}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,s=this.options.position;if(s==="left"||s==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};
6064if(s==="top"||s==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:s},left:n,top:a,width:o,height:i}=this;s&&(t.save(),t.fillStyle=s,t.fillRect(n,a,o,i),t.restore())}getLineWidthForValue(t){const s=this.options.grid;if(!this._isVisible()||!s.display)return 0;const a=this.ticks.findIndex(o=>o.value===t);return a>=0?s.setContext(this.getContext(a)).lineWidth:0}drawGrid(t){const s=this.options.grid,n=this.ctx,a=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const l=(c,u,f)=>{!f.width||!f.color||(n.save(),n.lineWidth=f.width,n.strokeStyle=f.color,n.setLineDash(f.borderDash||[]),n.lineDashOffset=f.borderDashOffset,n.beginPath(),n.moveTo(c.x,c.y),n.lineTo(u.x,u.y),n.stroke(),n.restore())};if(s.display)for(o=0,i=a.length;o<i;++o){const c=a[o];s.drawOnChartArea&&l({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),s.drawTicks&&l({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:s,options:{border:n,grid:a}}=this,o=n.setContext(this.getContext()),i=n.display?o.width:0;if(!i)return;const l=a.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let u,f,h,g;this.isHorizontal()?(u=ku(t,this.left,i)-i/2,f=ku(t,this.right,l)+l/2,h=g=c):(h=ku(t,this.top,i)-i/2,g=ku(t,this.bottom,l)+l/2,u=f=c),s.save(),s.lineWidth=o.width,s.strokeStyle=o.color,s.beginPath(),s.moveTo(u,h),s.lineTo(f,g),s.stroke(),s.restore()}drawLabels(t){if(!this.options.ticks.display)return;const n=this.ctx,a=this._computeLabelArea();a&&c1(n,a);const o=this.getLabelItems(t);for(const i of o){const l=i.options,c=i.font,u=i.label,f=i.textOffset;Rv(n,u,0,f,c,l)}a&&d1(n)}drawTitle(){const{ctx:t,options:{position:s,title:n,reverse:a}}=this;if(!n.display)return;const o=ia(n.font),i=Ko(n.padding),l=n.align;let c=o.lineHeight/2;s==="bottom"||s==="center"||Ls(s)?(c+=i.bottom,an(n.text)&&(c+=o.lineHeight*(n.text.length-1))):c+=i.top;const{titleX:u,titleY:f,maxWidth:h,rotation:g}=T4e(this,c,s,l);Rv(t,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:g,textAlign:E4e(l,s,a),textBaseline:"middle",translation:[u,f]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,s=t.ticks&&t.ticks.z||0,n=ks(t.grid&&t.grid.z,-1),a=ks(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==mm.prototype.draw?[{z:s,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:s,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const s=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",a=[];let o,i;for(o=0,i=s.length;o<i;++o){const l=s[o];l[n]===this.id&&(!t||l.type===t)&&a.push(l)}return a}_resolveTickFontOptions(t){const s=this.options.ticks.setContext(this.getContext(t));return ia(s.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class V0{constructor(t,s,n){this.type=t,this.scope=s,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const s=Object.getPrototypeOf(t);let n;P4e(s)&&(n=this.register(s));const a=this.items,o=t.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in a||(a[o]=t,R4e(t,i,n),this.override&&Jr.override(t.id,t.overrides)),i}get(t){return this.items[t]}unregister(t){const s=this.items,n=t.id,a=this.scope;n in s&&delete s[n],a&&n in Jr[a]&&(delete Jr[a][n],this.override&&delete yp[n])}}function R4e(e,t,s){const n=kv(Object.create(null),[s?Jr.get(s):{},Jr.get(t),e.defaults]);Jr.set(t,n),e.defaultRoutes&&A4e(t,e.defaultRoutes),e.descriptors&&Jr.describe(t,e.descriptors)}function A4e(e,t){Object.keys(t).forEach(s=>{const n=s.split("."),a=n.pop(),o=[e].concat(n).join("."),i=t[s].split("."),l=i.pop(),c=i.join(".");Jr.route(o,a,c,l)})}function P4e(e){return"id"in e&&"defaults"in e}class I4e{constructor(){this.controllers=new V0(tp,"datasets",!0),this.elements=new V0(gc,"elements"),this.plugins=new V0(Object,"plugins"),this.scales=new V0(mm,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}
6064removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,s,n){[...s].forEach(a=>{const o=n||this._getRegistryForType(a);n||o.isForType(a)||o===this.plugins&&a.id?this._exec(t,o,a):or(a,i=>{const l=n||this._getRegistryForType(i);this._exec(t,l,i)})})}_exec(t,s,n){const a=LA(t);wr(n["before"+a],[],n),s[t](n),wr(n["after"+a],[],n)}_getRegistryForType(t){for(let s=0;s<this._typedRegistries.length;s++){const n=this._typedRegistries[s];if(n.isForType(t))return n}return this.plugins}_get(t,s,n){const a=s.get(t);if(a===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return a}}var Bi=new I4e;class M4e{constructor(){this._init=[]}notify(t,s,n,a){s==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=a?this._descriptors(t).filter(a):this._descriptors(t),i=this._notify(o,t,s,n);return s==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),i}_notify(t,s,n,a){a=a||{};for(const o of t){const i=o.plugin,l=i[n],c=[s,a,o.options];if(wr(l,c,i)===!1&&a.cancelable)return!1}return!0}invalidate(){nr(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const s=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),s}_createDescriptors(t,s){const n=t&&t.config,a=ks(n.options&&n.options.plugins,{}),o=O4e(n);return a===!1&&!s?[]:D4e(t,o,a,s)}_notifyStateChanges(t){const s=this._oldCache||[],n=this._cache,a=(o,i)=>o.filter(l=>!i.some(c=>l.plugin.id===c.plugin.id));this._notify(a(s,n),t,"stop"),this._notify(a(n,s),t,"start")}}function O4e(e){const t={},s=[],n=Object.keys(Bi.plugins.items);for(let o=0;o<n.length;o++)s.push(Bi.getPlugin(n[o]));const a=e.plugins||[];for(let o=0;o<a.length;o++){const i=a[o];s.indexOf(i)===-1&&(s.push(i),t[i.id]=!0)}return{plugins:s,localIds:t}}function L4e(e,t){return!t&&e===!1?null:e===!0?{}:e}function D4e(e,{plugins:t,localIds:s},n,a){const o=[],i=e.getContext();for(const l of t){const c=l.id,u=L4e(n[c],a);u!==null&&o.push({plugin:l,options:$4e(e.config,{plugin:l,local:s[c]},u,i)})}return o}function $4e(e,{plugin:t,local:s},n,a){const o=e.pluginScopeKeys(t),i=e.getOptionScopes(n,o);return s&&t.defaults&&i.push(t.defaults),e.createResolver(i,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function P5(e,t){const s=Jr.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||s.indexAxis||"x"}function U4e(e,t){let s=e;return e==="_index_"?s=t:e==="_value_"&&(s=t==="x"?"y":"x"),s}function F4e(e,t){return e===t?"_index_":"_value_"}function B6(e){if(e==="x"||e==="y"||e==="r")return e}function B4e(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function I5(e,...t){if(B6(e))return e;for(const s of t){const n=s.axis||B4e(s.position)||e.length>1&&B6(e[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function q6(e,t,s){if(s[t+"AxisID"]===e)return{axis:t}}function q4e(e,t){if(t.data&&t.data.datasets){const s=t.data.datasets.filter(n=>n.xAxisID===e||n.yAxisID===e);if(s.length)return q6(e,"x",s[0])||q6(e,"y",s[0])}return{}}function z4e(e,t){const s=yp[e.type]||{scales:{}},n=t.scales||{},a=P5(e.type,t),o=Object.create(null);return Object.keys(n).forEach(i=>{const l=n[i];if(!Ls(l))return console.error(`Invalid scale configuration for scale: ${i}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const c=I5(i,l,q4e(i,e),Jr.scales[l.type]),u=F4e(c,a),f=s.scales||{};o[i]=Fx(Object.create(null),[{axis:c},l,f[c],f[u]])}),e.data.datasets.forEach(i=>{const l=i.type||e.type,c=i.indexAxis||P5(l,t),f=(yp[l]||{}).scales||{};Object.keys(f).forEach(h=>{const g=U4e(h,c),v=i[g+"AxisID"]||g;o[v]=o[v]||Object.create(null),Fx(o[v],[{axis:g},n[v],f[h]])})}),Object.keys(o).forEach(i=>{const l=o[i];Fx(l,[Jr.scales[l.type],Jr.scale])}),o}function mY(e){const t=e.options||(e.options={});t.plugins=ks(t.plugins,{}),t.scales=z4e(e,t)}function gY(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function H4e(e){return e=e||{},e.data=gY(e.data),mY(e),e}const z6=new Map,xY=new Set;function G0(e,t){let s=z6.get(e);return s||(s=t(),z6.set(e,s),xY.add(s)),s}const ex=(e,t,s)=>{const n=bp(t,s);n!==void 0&&e.add(n)};class V4e{constructor(t){this._config=H4e(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gY(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),mY(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return G0(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,s){return G0(`${t}.transition.${s}`,()=>[[`datasets.${t}.transitions.${s}`,`transitions.${s}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,s){return G0(`${t}-${s}`,()=>[[`datasets.${t}.elements.${s}`,`datasets.${t}`,`elements.${s}`,""]])}pluginScopeKeys(t){const s=t.id,n=this.type;return G0(`${n}-plugin-${s}`,()=>[[`plugins.${s}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,s){const n=this._scopeCache;let a=n.get(t);return(!a||s)&&(a=new Map,n.set(t,a)),a}getOptionScopes(t,s,n){const{options:a,type:o}=this,i=this._cachedScopes(t,n),l=i.get(s);if(l)return l;const c=new Set;
6064s.forEach(f=>{t&&(c.add(t),f.forEach(h=>ex(c,t,h))),f.forEach(h=>ex(c,a,h)),f.forEach(h=>ex(c,yp[o]||{},h)),f.forEach(h=>ex(c,Jr,h)),f.forEach(h=>ex(c,R5,h))});const u=Array.from(c);return u.length===0&&u.push(Object.create(null)),xY.has(s)&&i.set(s,u),u}chartOptionScopes(){const{options:t,type:s}=this;return[t,yp[s]||{},Jr.datasets[s]||{},{type:s},Jr,R5]}resolveNamedOptions(t,s,n,a=[""]){const o={$shared:!0},{resolver:i,subPrefixes:l}=H6(this._resolverCache,t,a);let c=i;if(W4e(i,s)){o.$shared=!1,n=Md(n)?n():n;const u=this.createResolver(t,n,l);c=Uh(i,n,u)}for(const u of s)o[u]=c[u];return o}createResolver(t,s,n=[""],a){const{resolver:o}=H6(this._resolverCache,t,n);return Ls(s)?Uh(o,s,void 0,a):o}}function H6(e,t,s){let n=e.get(t);n||(n=new Map,e.set(t,n));const a=s.join();let o=n.get(a);return o||(o={resolver:qA(t,s),subPrefixes:s.filter(l=>!l.toLowerCase().includes("hover"))},n.set(a,o)),o}const G4e=e=>Ls(e)&&Object.getOwnPropertyNames(e).some(t=>Md(e[t]));function W4e(e,t){const{isScriptable:s,isIndexable:n}=JW(e);for(const a of t){const o=s(a),i=n(a),l=(i||o)&&e[a];if(o&&(Md(l)||G4e(l))||i&&an(l))return!0}return!1}var Y4e="4.5.0";const K4e=["top","bottom","left","right","chartArea"];function V6(e,t){return e==="top"||e==="bottom"||K4e.indexOf(e)===-1&&t==="x"}function G6(e,t){return function(s,n){return s[e]===n[e]?s[t]-n[t]:s[e]-n[e]}}function W6(e){const t=e.chart,s=t.options.animation;t.notifyPlugins("afterRender"),wr(s&&s.onComplete,[e],t)}function J4e(e){const t=e.chart,s=t.options.animation;wr(s&&s.onProgress,[e],t)}function vY(e){return VA()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const S_={},Y6=e=>{const t=vY(e);return Object.values(S_).filter(s=>s.canvas===t).pop()};function X4e(e,t,s){const n=Object.keys(e);for(const a of n){const o=+a;if(o>=t){const i=e[a];delete e[a],(s>0||o>t)&&(e[o+s]=i)}}}function Q4e(e,t,s,n){return!s||e.type==="mouseout"?null:n?t:e}var Yc;let db=(Yc=class{static register(...t){Bi.add(...t),K6()}static unregister(...t){Bi.remove(...t),K6()}constructor(t,s){const n=this.config=new V4e(s),a=vY(t),o=Y6(a);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||g4e(a)),this.platform.updateConfig(n);const l=this.platform.acquireContext(a,i.aspectRatio),c=l&&l.canvas,u=c&&c.height,f=c&&c.width;if(this.id=JAe(),this.ctx=l,this.canvas=c,this.width=f,this.height=u,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new M4e,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=mPe(h=>this.update(h),i.resizeDelay||0),this._dataChanges=[],S_[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Ul.listen(this,"complete",W6),Ul.listen(this,"progress",J4e),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:a,_aspectRatio:o}=this;return nr(t)?s&&o?o:a?n/a:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Bi}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():x6(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return h6(this.canvas,this.ctx),this}stop(){return Ul.stop(this),this}resize(t,s){Ul.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s)}_resize(t,s){const n=this.options,a=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(a,t,s,o),l=n.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,x6(this,l,!0)&&(this.notifyPlugins("resize",{size:i}),wr(n.onResize,[this,i],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const s=this.options.scales||{};or(s,(n,a)=>{n.id=a})}buildOrUpdateScales(){const t=this.options,s=t.scales,n=this.scales,a=Object.keys(n).reduce((i,l)=>(i[l]=!1,i),{});let o=[];
6064s&&(o=o.concat(Object.keys(s).map(i=>{const l=s[i],c=I5(i,l),u=c==="r",f=c==="x";return{options:l,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),or(o,i=>{const l=i.options,c=l.id,u=I5(c,l),f=ks(l.type,i.dtype);(l.position===void 0||V6(l.position,u)!==V6(i.dposition))&&(l.position=i.dposition),a[c]=!0;let h=null;if(c in n&&n[c].type===f)h=n[c];else{const g=Bi.getScale(f);h=new g({id:c,type:f,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(l,t)}),or(a,(i,l)=>{i||delete n[l]}),or(n,i=>{$o.configure(this,i,i.options),$o.addBox(this,i)})}_updateMetasets(){const t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((a,o)=>a.index-o.index),n>s){for(let a=s;a<n;++a)this._destroyDatasetMeta(a);t.splice(s,n-s)}this._sortedMetasets=t.slice(0).sort(G6("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:s}}=this;t.length>s.length&&delete this._stacks,t.forEach((n,a)=>{s.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(a)})}buildOrUpdateControllers(){const t=[],s=this.data.datasets;let n,a;for(this._removeUnreferencedMetasets(),n=0,a=s.length;n<a;n++){const o=s[n];let i=this.getDatasetMeta(n);const l=o.type||this.config.type;if(i.type&&i.type!==l&&(this._destroyDatasetMeta(n),i=this.getDatasetMeta(n)),i.type=l,i.indexAxis=o.indexAxis||P5(l,this.options),i.order=o.order||0,i.index=n,i.label=""+o.label,i.visible=this.isDatasetVisible(n),i.controller)i.controller.updateIndex(n),i.controller.linkScales();else{const c=Bi.getController(l),{datasetElementType:u,dataElementType:f}=Jr.datasets[l];Object.assign(c,{dataElementType:Bi.getElement(f),datasetElementType:u&&Bi.getElement(u)}),i.controller=new c(this,n),t.push(i.controller)}}return this._updateMetasets(),t}_resetElements(){or(this.data.datasets,(t,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const s=this.config;s.update();const n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let u=0,f=this.data.datasets.length;u<f;u++){const{controller:h}=this.getDatasetMeta(u),g=!a&&o.indexOf(h)===-1;h.buildOrUpdateElements(g),i=Math.max(+h.getMaxOverflow(),i)}i=this._minPadding=n.layout.autoPadding?i:0,this._updateLayout(i),a||or(o,u=>{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(G6("z","_idx"));const{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){or(this.scales,t=>{$o.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!n6(s,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(const{method:n,start:a,count:o}of s){const i=n==="_removeElements"?-o:o;X4e(t,a,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const s=this.data.datasets.length,n=o=>new Set(t.filter(i=>i[0]===o).map((i,l)=>l+","+i.splice(1).join(","))),a=n(0);for(let o=1;o<s;o++)if(!n6(a,n(o)))return;return Array.from(a).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$o.update(this,this.width,this.height,t);const s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],or(this.boxes,a=>{n&&a.position==="chartArea"||(a.configure&&a.configure(),this._layers.push(...a._layers()))},this),this._layers.forEach((a,o)=>{a._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,Md(t)?t({datasetIndex:s}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,s){const n=this.getDatasetMeta(t),a={meta:n,index:t,mode:s,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",a)!==!1&&(n.controller._update(s),a.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",a))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ul.has(this)?this.attached&&!Ul.running(this)&&Ul.start(this):(this.draw(),W6({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:a}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,a)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const s=this._layers;for(t=0;t<s.length&&s[t].z<=0;++t)s[t].draw(this.chartArea);for(this._drawDatasets();t<s.length;++t)s[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const s=this._sortedMetasets,n=[];let a,o;for(a=0,o=s.length;a<o;++a){const i=s[a];(!t||i.visible)&&n.push(i)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let s=t.length-1;s>=0;--s)this._drawDataset(t[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const s=this.ctx,n={meta:t,index:t.index,cancelable:!0},a=oY(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(a&&c1(s,a),t.controller.draw(),a&&d1(s),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return Tv(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,a){const o=KIe.modes[s];return typeof o=="function"?o(this,t,n,a):[]}getDatasetMeta(t){const s=this.data.datasets[t],n=this._metasets;let a=n.filter(o=>o&&o._dataset===s).pop();return a||(a={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:!1},n.push(a)),a}getContext(){return this.$context||(this.$context=Ip(null,{chart:this,type:"chart"}))}
6064getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const s=this.data.datasets[t];if(!s)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(t,s){const n=this.getDatasetMeta(t);n.hidden=!s}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,s,n){const a=n?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,a);Sv(s)?(o.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),i.update(o,{visible:n}),this.update(l=>l.datasetIndex===t?a:void 0))}hide(t,s){this._updateVisibility(t,s,!1)}show(t,s){this._updateVisibility(t,s,!0)}_destroyDatasetMeta(t){const s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t]}_stop(){let t,s;for(this.stop(),Ul.remove(this),t=0,s=this.data.datasets.length;t<s;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:s}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),h6(t,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete S_[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,s=this.platform,n=(o,i)=>{s.addEventListener(this,o,i),t[o]=i},a=(o,i,l)=>{o.offsetX=i,o.offsetY=l,this._eventHandler(o)};or(this.options.events,o=>n(o,a))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,s=this.platform,n=(c,u)=>{s.addEventListener(this,c,u),t[c]=u},a=(c,u)=>{t[c]&&(s.removeEventListener(this,c,u),delete t[c])},o=(c,u)=>{this.canvas&&this.resize(c,u)};let i;const l=()=>{a("attach",l),this.attached=!0,this.resize(),n("resize",o),n("detach",i)};i=()=>{this.attached=!1,a("resize",o),this._stop(),this._resize(0,0),n("attach",l)},s.isAttached(this.canvas)?l():i()}unbindEvents(){or(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._listeners={},or(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,s,n){const a=n?"set":"remove";let o,i,l,c;for(s==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+a+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){i=t[l];const u=i&&this.getDatasetMeta(i.datasetIndex).controller;u&&u[a+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const s=this._active||[],n=t.map(({datasetIndex:o,index:i})=>{const l=this.getDatasetMeta(o);if(!l)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:l.data[i],index:i}});!Dj(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){const a=this.options.hover,o=(c,u)=>c.filter(f=>!u.some(h=>f.datasetIndex===h.datasetIndex&&f.index===h.index)),i=o(s,t),l=n?t:o(t,s);i.length&&this.updateHoverStyle(i,a.mode,!1),l.length&&a.mode&&this.updateHoverStyle(l,a.mode,!0)}_eventHandler(t,s){const n={event:t,replay:s,cancelable:!0,inChartArea:this.isPointInArea(t)},a=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,a)===!1)return;const o=this._handleEvent(t,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,a),(o||n.changed)&&this.render(),this}_handleEvent(t,s,n){const{_active:a=[],options:o}=this,i=s,l=this._getActiveElements(t,a,n,i),c=sPe(t),u=Q4e(t,this._lastEvent,n,c);n&&(this._lastEvent=null,wr(o.onHover,[t,l,this],this),c&&wr(o.onClick,[t,l,this],this));const f=!Dj(l,a);return(f||s)&&(this._active=l,this._updateHoverStyles(l,a,s)),this._lastEvent=u,f}_getActiveElements(t,s,n,a){if(t.type==="mouseout")return[];if(!n)return s;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,a)}},Re(Yc,"defaults",Jr),Re(Yc,"instances",S_),Re(Yc,"overrides",yp),Re(Yc,"registry",Bi),Re(Yc,"version",Y4e),Re(Yc,"getChart",Y6),Yc);function K6(){return or(db.instances,e=>e._plugins.invalidate())}
6064function Z4e(e,t,s){const{startAngle:n,x:a,y:o,outerRadius:i,innerRadius:l,options:c}=t,{borderWidth:u,borderJoinStyle:f}=c,h=Math.min(u/i,oo(n-s));if(e.beginPath(),e.arc(a,o,i-u/2,n+h/2,s-h/2),l>0){const g=Math.min(u/l,oo(n-s));e.arc(a,o,l+u/2,s-g/2,n+g/2,!0)}else{const g=Math.min(u/2,i*oo(n-s));if(f==="round")e.arc(a,o,g,s-ir/2,n+ir/2,!0);else if(f==="bevel"){const v=2*g*g,y=-v*Math.cos(s+ir/2)+a,_=-v*Math.sin(s+ir/2)+o,j=v*Math.cos(n+ir/2)+a,w=v*Math.sin(n+ir/2)+o;e.lineTo(y,_),e.lineTo(j,w)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function e3e(e,t,s){const{startAngle:n,pixelMargin:a,x:o,y:i,outerRadius:l,innerRadius:c}=t;let u=a/l;e.beginPath(),e.arc(o,i,l,n-u,s+u),c>a?(u=a/c,e.arc(o,i,c,s+u,n-u,!0)):e.arc(o,i,a,s+jn,n-jn),e.closePath(),e.clip()}function t3e(e){return BA(e,["outerStart","outerEnd","innerStart","innerEnd"])}function s3e(e,t,s,n){const a=t3e(e.options.borderRadius),o=(s-t)/2,i=Math.min(o,n*t/2),l=c=>{const u=(s-Math.min(o,c))*n/2;return oa(c,0,Math.min(o,u))};return{outerStart:l(a.outerStart),outerEnd:l(a.outerEnd),innerStart:oa(a.innerStart,0,i),innerEnd:oa(a.innerEnd,0,i)}}function Af(e,t,s,n){return{x:s+e*Math.cos(t),y:n+e*Math.sin(t)}}function zj(e,t,s,n,a,o){const{x:i,y:l,startAngle:c,pixelMargin:u,innerRadius:f}=t,h=Math.max(t.outerRadius+n+s-u,0),g=f>0?f+n+s+u:0;let v=0;const y=a-c;if(n){const K=f>0?f-n:0,q=h>0?h-n:0,J=(K+q)/2,F=J!==0?y*J/(J+n):y;v=(y-F)/2}const _=Math.max(.001,y*h-s/ir)/h,j=(y-_)/2,w=c+j+v,k=a-j-v,{outerStart:S,outerEnd:E,innerStart:T,innerEnd:A}=s3e(t,g,h,k-w),R=h-S,I=h-E,L=w+S/R,M=k-E/I,O=g+T,z=g+A,X=w+T/O,W=k-A/z;if(e.beginPath(),o){const K=(L+M)/2;if(e.arc(i,l,h,L,K),e.arc(i,l,h,K,M),E>0){const V=Af(I,M,i,l);e.arc(V.x,V.y,E,M,k+jn)}const q=Af(z,k,i,l);if(e.lineTo(q.x,q.y),A>0){const V=Af(z,W,i,l);e.arc(V.x,V.y,A,k+jn,W+Math.PI)}const J=(k-A/g+(w+T/g))/2;if(e.arc(i,l,g,k-A/g,J,!0),e.arc(i,l,g,J,w+T/g,!0),T>0){const V=Af(O,X,i,l);e.arc(V.x,V.y,T,X+Math.PI,w-jn)}const F=Af(R,w,i,l);if(e.lineTo(F.x,F.y),S>0){const V=Af(R,L,i,l);e.arc(V.x,V.y,S,w-jn,L)}}else{e.moveTo(i,l);const K=Math.cos(L)*h+i,q=Math.sin(L)*h+l;e.lineTo(K,q);const J=Math.cos(M)*h+i,F=Math.sin(M)*h+l;e.lineTo(J,F)}e.closePath()}function r3e(e,t,s,n,a){const{fullCircles:o,startAngle:i,circumference:l}=t;let c=t.endAngle;if(o){zj(e,t,s,n,c,a);for(let u=0;u<o;++u)e.fill();isNaN(l)||(c=i+(l%Lr||Lr))}return zj(e,t,s,n,c,a),e.fill(),c}function n3e(e,t,s,n,a){const{fullCircles:o,startAngle:i,circumference:l,options:c}=t,{borderWidth:u,borderJoinStyle:f,borderDash:h,borderDashOffset:g,borderRadius:v}=c,y=c.borderAlign==="inner";if(!u)return;e.setLineDash(h||[]),e.lineDashOffset=g,y?(e.lineWidth=u*2,e.lineJoin=f||"round"):(e.lineWidth=u,e.lineJoin=f||"bevel");let _=t.endAngle;if(o){zj(e,t,s,n,_,a);for(let j=0;j<o;++j)e.stroke();isNaN(l)||(_=i+(l%Lr||Lr))}y&&e3e(e,t,_),c.selfJoin&&_-i>=ir&&v===0&&f!=="miter"&&Z4e(e,t,_),o||(zj(e,t,s,n,_,a),e.stroke())}class xx extends gc{constructor(s){super();Re(this,"circumference");Re(this,"endAngle");Re(this,"fullCircles");Re(this,"innerRadius");Re(this,"outerRadius");Re(this,"pixelMargin");Re(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,s&&Object.assign(this,s)}inRange(s,n,a){const o=this.getProps(["x","y"],a),{angle:i,distance:l}=qW(o,{x:s,y:n}),{startAngle:c,endAngle:u,innerRadius:f,outerRadius:h,circumference:g}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],a),v=(this.options.spacing+this.options.borderWidth)/2,y=ks(g,u-c),_=Ev(i,c,u)&&c!==u,j=y>=Lr||_,w=Ql(l,f+v,h+v);return j&&w}getCenterPoint(s){const{x:n,y:a,startAngle:o,endAngle:i,innerRadius:l,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],s),{offset:u,spacing:f}=this.options,h=(o+i)/2,g=(l+c+f+u)/2;return{x:n+Math.cos(h)*g,y:a+Math.sin(h)*g}}tooltipPosition(s){return this.getCenterPoint(s)}draw(s){const{options:n,circumference:a}=this,o=(n.offset||0)/4,i=(n.spacing||0)/2,l=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=a>Lr?Math.floor(a/Lr):0,a===0||this.innerRadius<0||this.outerRadius<0)return;s.save();const c=(this.startAngle+this.endAngle)/2;s.translate(Math.cos(c)*o,Math.sin(c)*o);const u=1-Math.sin(Math.min(ir,a||0)),f=o*u;s.fillStyle=n.backgroundColor,s.strokeStyle=n.borderColor,r3e(s,this,f,i,l),n3e(s,this,f,i,l),s.restore(
6064)}}Re(xx,"id","arc"),Re(xx,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Re(xx,"defaultRoutes",{backgroundColor:"backgroundColor"}),Re(xx,"descriptors",{_scriptable:!0,_indexable:s=>s!=="borderDash"});function bY(e,t,s=t){e.lineCap=ks(s.borderCapStyle,t.borderCapStyle),e.setLineDash(ks(s.borderDash,t.borderDash)),e.lineDashOffset=ks(s.borderDashOffset,t.borderDashOffset),e.lineJoin=ks(s.borderJoinStyle,t.borderJoinStyle),e.lineWidth=ks(s.borderWidth,t.borderWidth),e.strokeStyle=ks(s.borderColor,t.borderColor)}function a3e(e,t,s){e.lineTo(s.x,s.y)}function o3e(e){return e.stepped?TPe:e.tension||e.cubicInterpolationMode==="monotone"?RPe:a3e}function yY(e,t,s={}){const n=e.length,{start:a=0,end:o=n-1}=s,{start:i,end:l}=t,c=Math.max(a,i),u=Math.min(o,l),f=a<i&&o<i||a>l&&o>l;return{count:n,start:c,loop:t.loop,ilen:u<c&&!f?n+u-c:u-c}}function i3e(e,t,s,n){const{points:a,options:o}=t,{count:i,start:l,loop:c,ilen:u}=yY(a,s,n),f=o3e(o);let{move:h=!0,reverse:g}=n||{},v,y,_;for(v=0;v<=u;++v)y=a[(l+(g?u-v:v))%i],!y.skip&&(h?(e.moveTo(y.x,y.y),h=!1):f(e,_,y,g,o.stepped),_=y);return c&&(y=a[(l+(g?u:0))%i],f(e,_,y,g,o.stepped)),!!c}function l3e(e,t,s,n){const a=t.points,{count:o,start:i,ilen:l}=yY(a,s,n),{move:c=!0,reverse:u}=n||{};let f=0,h=0,g,v,y,_,j,w;const k=E=>(i+(u?l-E:E))%o,S=()=>{_!==j&&(e.lineTo(f,j),e.lineTo(f,_),e.lineTo(f,w))};for(c&&(v=a[k(0)],e.moveTo(v.x,v.y)),g=0;g<=l;++g){if(v=a[k(g)],v.skip)continue;const E=v.x,T=v.y,A=E|0;A===y?(T<_?_=T:T>j&&(j=T),f=(h*f+E)/++h):(S(),e.lineTo(E,T),y=A,h=0,_=j=T),w=T}S()}function M5(e){const t=e.options,s=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!s?l3e:i3e}function c3e(e){return e.stepped?lIe:e.tension||e.cubicInterpolationMode==="monotone"?cIe:Iu}function d3e(e,t,s,n){let a=t._path;a||(a=t._path=new Path2D,t.path(a,s,n)&&a.closePath()),bY(e,t.options),e.stroke(a)}function u3e(e,t,s,n){const{segments:a,options:o}=t,i=M5(t);for(const l of a)bY(e,o,l.style),e.beginPath(),i(e,t,l,{start:s,end:s+n-1})&&e.closePath(),e.stroke()}const p3e=typeof Path2D=="function";function f3e(e,t,s,n){p3e&&!t.options.segment?d3e(e,t,s,n):u3e(e,t,s,n)}class md extends gc{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,s){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const a=n.spanGaps?this._loop:this._fullLoop;eIe(this._points,n,t,a,s),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=mIe(this,this.options.segment))}first(){const t=this.segments,s=this.points;return t.length&&s[t[0].start]}last(){const t=this.segments,s=this.points,n=t.length;return n&&s[t[n-1].end]}interpolate(t,s){const n=this.options,a=t[s],o=this.points,i=aY(this,{property:s,start:a,end:a});if(!i.length)return;const l=[],c=c3e(n);let u,f;for(u=0,f=i.length;u<f;++u){const{start:h,end:g}=i[u],v=o[h],y=o[g];if(v===y){l.push(v);continue}const _=Math.abs((a-v[s])/(y[s]-v[s])),j=c(v,y,_,n.stepped);j[s]=t[s],l.push(j)}return l.length===1?l[0]:l}pathSegment(t,s,n){return M5(this)(t,this,s,n)}path(t,s,n){const a=this.segments,o=M5(this);let i=this._loop;s=s||0,n=n||this.points.length-s;for(const l of a)i&=o(t,this,l,{start:s,end:s+n-1});return!!i}draw(t,s,n,a){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),f3e(t,this,n,a),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Re(md,"id","line"),Re(md,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Re(md,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Re(md,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function J6(e,t,s,n){const a=e.options,{[s]:o}=e.getProps([s],n);return Math.abs(t-o)<a.radius+a.hitRadius}class C_ extends gc{constructor(s){super();Re(this,"parsed");Re(this,"skip");Re(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,s&&Object.assign(this,s)}inRange(s,n,a){const o=this.options,{x:i,y:l}=this.getProps(["x","y"],a);return Math.pow(s-i,2)+Math.pow(n-l,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(s,n){return J6(this,s,"x",n)}inYRange(s,n){return J6(this,s,"y",n)}getCenterPoint(s){const{x:n,y:a}=this.getProps(["x","y"],s);return{x:n,y:a}}size(s){s=s||this.options||{};let n=s.radius||0;n=Math.max(n,n&&s.hoverRadius||0);const a=n&&s.borderWidth||0;return(n+a)*2}draw(s,n){const a=this.options;this.skip||a.radius<.1||!Tv(this,n,this.size(a)/2)||(s.strokeStyle=a.borderColor,s.lineWidth=a.borderWidth,s.fillStyle=a.backgroundColor,A5(s,a,this.x,this.y))}getRange(){const s=this.options||{};return s.radius+s.hitRadius}}Re(C_,"id","point"),Re(C_,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Re(C_,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function _Y(e,t){const{x:s,y:n,base:a,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let l,c,u,f,h;return e.horizontal?(h=i/2,l=Math.min(s,a),c=Math.max(s,a),u=n-h,f=n+h):(h=o/2,l=s-h,c=s+h,u=Math.min(n,a),f=Math.max(n,a)),{left:l,top:u,right:c,bottom:f}}function gd(e,t,s,n){return e?0:oa(t,s,n)}function h3e(e,t,s){const n=e.options.borderWidth,a=e.borderSkipped,o=KW(n);return{t:gd(a.top,o.top,0,s),r:gd(a.right,o.right,0,t),b:gd(a.bottom,o.bottom,0,s),l:gd(a.left,o.left,0,t)}}
6064function m3e(e,t,s){const{enableBorderRadius:n}=e.getProps(["enableBorderRadius"]),a=e.options.borderRadius,o=ih(a),i=Math.min(t,s),l=e.borderSkipped,c=n||Ls(a);return{topLeft:gd(!c||l.top||l.left,o.topLeft,0,i),topRight:gd(!c||l.top||l.right,o.topRight,0,i),bottomLeft:gd(!c||l.bottom||l.left,o.bottomLeft,0,i),bottomRight:gd(!c||l.bottom||l.right,o.bottomRight,0,i)}}function g3e(e){const t=_Y(e),s=t.right-t.left,n=t.bottom-t.top,a=h3e(e,s/2,n/2),o=m3e(e,s/2,n/2);return{outer:{x:t.left,y:t.top,w:s,h:n,radius:o},inner:{x:t.left+a.l,y:t.top+a.t,w:s-a.l-a.r,h:n-a.t-a.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(a.t,a.l)),topRight:Math.max(0,o.topRight-Math.max(a.t,a.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(a.b,a.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(a.b,a.r))}}}}function W2(e,t,s,n){const a=t===null,o=s===null,l=e&&!(a&&o)&&_Y(e,n);return l&&(a||Ql(t,l.left,l.right))&&(o||Ql(s,l.top,l.bottom))}function x3e(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function v3e(e,t){e.rect(t.x,t.y,t.w,t.h)}function Y2(e,t,s={}){const n=e.x!==s.x?-t:0,a=e.y!==s.y?-t:0,o=(e.x+e.w!==s.x+s.w?t:0)-n,i=(e.y+e.h!==s.y+s.h?t:0)-a;return{x:e.x+n,y:e.y+a,w:e.w+o,h:e.h+i,radius:e.radius}}class Hx extends gc{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:s,options:{borderColor:n,backgroundColor:a}}=this,{inner:o,outer:i}=g3e(this),l=x3e(i.radius)?Fj:v3e;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),l(t,Y2(i,s,o)),t.clip(),l(t,Y2(o,-s,i)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),l(t,Y2(o,s)),t.fillStyle=a,t.fill(),t.restore()}inRange(t,s,n){return W2(this,t,s,n)}inXRange(t,s){return W2(this,t,null,s)}inYRange(t,s){return W2(this,null,t,s)}getCenterPoint(t){const{x:s,y:n,base:a,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(s+a)/2:s,y:o?n:(n+a)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}Re(Hx,"id","bar"),Re(Hx,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Re(Hx,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function b3e(e,t,s){const n=e.segments,a=e.points,o=t.points,i=[];for(const l of n){let{start:c,end:u}=l;u=f1(c,u,a);const f=O5(s,a[c],a[u],l.loop);if(!t.segments){i.push({source:l,target:f,start:a[c],end:a[u]});continue}const h=aY(t,f);for(const g of h){const v=O5(s,o[g.start],o[g.end],g.loop),y=nY(l,a,v);for(const _ of y)i.push({source:_,target:g,start:{[s]:X6(f,v,"start",Math.max)},end:{[s]:X6(f,v,"end",Math.min)}})}}return i}function O5(e,t,s,n){if(n)return;let a=t[e],o=s[e];return e==="angle"&&(a=oo(a),o=oo(o)),{property:e,start:a,end:o}}function y3e(e,t){const{x:s=null,y:n=null}=e||{},a=t.points,o=[];return t.segments.forEach(({start:i,end:l})=>{l=f1(i,l,a);const c=a[i],u=a[l];n!==null?(o.push({x:c.x,y:n}),o.push({x:u.x,y:n})):s!==null&&(o.push({x:s,y:c.y}),o.push({x:s,y:u.y}))}),o}function f1(e,t,s){for(;t>e;t--){const n=s[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function X6(e,t,s,n){return e&&t?n(e[s],t[s]):e?e[s]:t?t[s]:0}function jY(e,t){let s=[],n=!1;return an(e)?(n=!0,s=e):s=y3e(e,t),s.length?new md({points:s,options:{tension:0},_loop:n,_fullLoop:n}):null}function Q6(e){return e&&e.fill!==!1}function _3e(e,t,s){let a=e[t].fill;const o=[t];let i;if(!s)return a;for(;a!==!1&&o.indexOf(a)===-1;){if(!ua(a))return a;if(i=e[a],!i)return!1;if(i.visible)return a;o.push(a),a=i.fill}return!1}function j3e(e,t,s){const n=S3e(e);if(Ls(n))return isNaN(n.value)?!1:n;let a=parseFloat(n);return ua(a)&&Math.floor(a)===a?w3e(n[0],t,a,s):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function w3e(e,t,s,n){return(e==="-"||e==="+")&&(s=t+s),s===t||s<0||s>=n?!1:s}function N3e(e,t){let s=null;return e==="start"?s=t.bottom:e==="end"?s=t.top:Ls(e)?s=t.getPixelForValue(e.value):t.getBasePixel&&(s=t.getBasePixel()),s}function k3e(e,t,s){let n;return e==="start"?n=s:e==="end"?n=t.options.reverse?t.min:t.max:Ls(e)?n=e.value:n=t.getBaseValue(),n}function S3e(e){const t=e.options,s=t.fill;let n=ks(s&&s.target,s);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function C3e(e){const{scale:t,index:s,line:n}=e,a=[],o=n.segments,i=n.points,l=E3e(t,s);l.push(jY({x:null,y:t.bottom},n));for(let c=0;c<o.length;c++){const u=o[c];for(let f=u.start;f<=u.end;f++)T3e(a,i[f],l)}return new md({points:a,options:{}})}function E3e(e,t){const s=[],n=e.getMatchingVisibleMetas("line");for(let a=0;a<n.length;a++){const o=n[a];if(o.index===t)break;o.hidden||s.unshift(o.dataset)}return s}
6064function T3e(e,t,s){const n=[];for(let a=0;a<s.length;a++){const o=s[a],{first:i,last:l,point:c}=R3e(o,t,"x");if(!(!c||i&&l)){if(i)n.unshift(c);else if(e.push(c),!l)break}}e.push(...n)}function R3e(e,t,s){const n=e.interpolate(t,s);if(!n)return{};const a=n[s],o=e.segments,i=e.points;let l=!1,c=!1;for(let u=0;u<o.length;u++){const f=o[u],h=i[f.start][s],g=i[f.end][s];if(Ql(a,h,g)){l=a===h,c=a===g;break}}return{first:l,last:c,point:n}}class wY{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,s,n){const{x:a,y:o,radius:i}=this;return s=s||{start:0,end:Lr},t.arc(a,o,i,s.end,s.start,!0),!n.bounds}interpolate(t){const{x:s,y:n,radius:a}=this,o=t.angle;return{x:s+Math.cos(o)*a,y:n+Math.sin(o)*a,angle:o}}}function A3e(e){const{chart:t,fill:s,line:n}=e;if(ua(s))return P3e(t,s);if(s==="stack")return C3e(e);if(s==="shape")return!0;const a=I3e(e);return a instanceof wY?a:jY(a,n)}function P3e(e,t){const s=e.getDatasetMeta(t);return s&&e.isDatasetVisible(t)?s.dataset:null}function I3e(e){return(e.scale||{}).getPointPositionForValue?O3e(e):M3e(e)}function M3e(e){const{scale:t={},fill:s}=e,n=N3e(s,t);if(ua(n)){const a=t.isHorizontal();return{x:a?n:null,y:a?null:n}}return null}function O3e(e){const{scale:t,fill:s}=e,n=t.options,a=t.getLabels().length,o=n.reverse?t.max:t.min,i=k3e(s,t,o),l=[];if(n.grid.circular){const c=t.getPointPositionForValue(0,o);return new wY({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(i)})}for(let c=0;c<a;++c)l.push(t.getPointPositionForValue(c,i));return l}function K2(e,t,s){const n=A3e(t),{chart:a,index:o,line:i,scale:l,axis:c}=t,u=i.options,f=u.fill,h=u.backgroundColor,{above:g=h,below:v=h}=f||{},y=a.getDatasetMeta(o),_=oY(a,y);n&&i.points.length&&(c1(e,s),L3e(e,{line:i,target:n,above:g,below:v,area:s,scale:l,axis:c,clip:_}),d1(e))}function L3e(e,t){const{line:s,target:n,above:a,below:o,area:i,scale:l,clip:c}=t,u=s._loop?"angle":t.axis;e.save();let f=o;o!==a&&(u==="x"?(Z6(e,n,i.top),J2(e,{line:s,target:n,color:a,scale:l,property:u,clip:c}),e.restore(),e.save(),Z6(e,n,i.bottom)):u==="y"&&(eU(e,n,i.left),J2(e,{line:s,target:n,color:o,scale:l,property:u,clip:c}),e.restore(),e.save(),eU(e,n,i.right),f=a)),J2(e,{line:s,target:n,color:f,scale:l,property:u,clip:c}),e.restore()}function Z6(e,t,s){const{segments:n,points:a}=t;let o=!0,i=!1;e.beginPath();for(const l of n){const{start:c,end:u}=l,f=a[c],h=a[f1(c,u,a)];o?(e.moveTo(f.x,f.y),o=!1):(e.lineTo(f.x,s),e.lineTo(f.x,f.y)),i=!!t.pathSegment(e,l,{move:i}),i?e.closePath():e.lineTo(h.x,s)}e.lineTo(t.first().x,s),e.closePath(),e.clip()}function eU(e,t,s){const{segments:n,points:a}=t;let o=!0,i=!1;e.beginPath();for(const l of n){const{start:c,end:u}=l,f=a[c],h=a[f1(c,u,a)];o?(e.moveTo(f.x,f.y),o=!1):(e.lineTo(s,f.y),e.lineTo(f.x,f.y)),i=!!t.pathSegment(e,l,{move:i}),i?e.closePath():e.lineTo(s,h.y)}e.lineTo(s,t.first().y),e.closePath(),e.clip()}function J2(e,t){const{line:s,target:n,property:a,color:o,scale:i,clip:l}=t,c=b3e(s,n,a);for(const{source:u,target:f,start:h,end:g}of c){const{style:{backgroundColor:v=o}={}}=u,y=n!==!0;e.save(),e.fillStyle=v,D3e(e,i,l,y&&O5(a,h,g)),e.beginPath();const _=!!s.pathSegment(e,u);let j;if(y){_?e.closePath():tU(e,n,g,a);const w=!!n.pathSegment(e,f,{move:_,reverse:!0});j=_&&w,j||tU(e,n,h,a)}e.closePath(),e.fill(j?"evenodd":"nonzero"),e.restore()}}function D3e(e,t,s,n){const a=t.chart.chartArea,{property:o,start:i,end:l}=n||{};if(o==="x"||o==="y"){let c,u,f,h;o==="x"?(c=i,u=a.top,f=l,h=a.bottom):(c=a.left,u=i,f=a.right,h=l),e.beginPath(),s&&(c=Math.max(c,s.left),f=Math.min(f,s.right),u=Math.max(u,s.top),h=Math.min(h,s.bottom)),e.rect(c,u,f-c,h-u),e.clip()}}function tU(e,t,s,n){const a=t.interpolate(s,n);a&&e.lineTo(a.x,a.y)}var $3e={id:"filler",afterDatasetsUpdate(e,t,s){const n=(e.data.datasets||[]).length,a=[];let o,i,l,c;for(i=0;i<n;++i)o=e.getDatasetMeta(i),l=o.dataset,c=null,l&&l.options&&l instanceof md&&(c={visible:e.isDatasetVisible(i),index:i,fill:j3e(l,i,n),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:l}),o.$filler=c,a.push(c);for(i=0;i<n;++i)c=a[i],!(!c||c.fill===!1)&&(c.fill=_3e(a,i,s.propagate))},beforeDraw(e,t,s){const n=s.drawTime==="beforeDraw",a=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let i=a.length-1;i>=0;--i){const l=a[i].$filler;l&&(l.line.updateControlPoints(o,l.axis),n&&l.fill&&K2(e.ctx,l,o))}},beforeDatasetsDraw(e,t,s){if(s.drawTime!=="beforeDatasetsDraw")return;const n=e.getSortedVisibleDatasetMetas();for(let a=n.length-1;a>=0;--a){const o=n[a].$filler;Q6(o)&&K2(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,s){const n=t.meta.$filler;!Q6(n)||s.drawTime!=="beforeDatasetDraw"||K2(e.ctx,n,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const sU=(e,t)=>{let{boxHeight:s=t,boxWidth:n=t}=e;return e.usePointStyle&&(s=Math.min(s,t),n=e.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:s,itemHeight:Math.max(t,s)}},U3e=(e,t)=>
6064e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class rU extends gc{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,s,n){this.maxWidth=t,this.maxHeight=s,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let s=wr(t.generateLabels,[this.chart],this)||[];t.filter&&(s=s.filter(n=>t.filter(n,this.chart.data))),t.sort&&(s=s.sort((n,a)=>t.sort(n,a,this.chart.data))),this.options.reverse&&s.reverse(),this.legendItems=s}fit(){const{options:t,ctx:s}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,a=ia(n.font),o=a.size,i=this._computeTitleHeight(),{boxWidth:l,itemHeight:c}=sU(n,o);let u,f;s.font=a.string,this.isHorizontal()?(u=this.maxWidth,f=this._fitRows(i,o,l,c)+10):(f=this.maxHeight,u=this._fitCols(i,a,l,c)+10),this.width=Math.min(u,t.maxWidth||this.maxWidth),this.height=Math.min(f,t.maxHeight||this.maxHeight)}_fitRows(t,s,n,a){const{ctx:o,maxWidth:i,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],u=this.lineWidths=[0],f=a+l;let h=t;o.textAlign="left",o.textBaseline="middle";let g=-1,v=-f;return this.legendItems.forEach((y,_)=>{const j=n+s/2+o.measureText(y.text).width;(_===0||u[u.length-1]+j+2*l>i)&&(h+=f,u[u.length-(_>0?0:1)]=0,v+=f,g++),c[_]={left:0,top:v,row:g,width:j,height:a},u[u.length-1]+=j+l}),h}_fitCols(t,s,n,a){const{ctx:o,maxHeight:i,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],u=this.columnSizes=[],f=i-t;let h=l,g=0,v=0,y=0,_=0;return this.legendItems.forEach((j,w)=>{const{itemWidth:k,itemHeight:S}=F3e(n,s,o,j,a);w>0&&v+S+2*l>f&&(h+=g+l,u.push({width:g,height:v}),y+=g+l,_++,g=v=0),c[w]={left:y,top:v,col:_,width:k,height:S},g=Math.max(g,k),v+=S+l}),h+=g,u.push({width:g,height:v}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:s,options:{align:n,labels:{padding:a},rtl:o}}=this,i=lh(o,this.left,this.width);if(this.isHorizontal()){let l=0,c=ta(n,this.left+a,this.right-this.lineWidths[l]);for(const u of s)l!==u.row&&(l=u.row,c=ta(n,this.left+a,this.right-this.lineWidths[l])),u.top+=this.top+t+a,u.left=i.leftForLtr(i.x(c),u.width),c+=u.width+a}else{let l=0,c=ta(n,this.top+t+a,this.bottom-this.columnSizes[l].height);for(const u of s)u.col!==l&&(l=u.col,c=ta(n,this.top+t+a,this.bottom-this.columnSizes[l].height)),u.top=c,u.left+=this.left+a,u.left=i.leftForLtr(i.x(u.left),u.width),c+=u.height+a}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;c1(t,this),this._draw(),d1(t)}}_draw(){const{options:t,columnSizes:s,lineWidths:n,ctx:a}=this,{align:o,labels:i}=t,l=Jr.color,c=lh(t.rtl,this.left,this.width),u=ia(i.font),{padding:f}=i,h=u.size,g=h/2;let v;this.drawTitle(),a.textAlign=c.textAlign("left"),a.textBaseline="middle",a.lineWidth=.5,a.font=u.string;const{boxWidth:y,boxHeight:_,itemHeight:j}=sU(i,h),w=function(A,R,I){if(isNaN(y)||y<=0||isNaN(_)||_<0)return;a.save();const L=ks(I.lineWidth,1);if(a.fillStyle=ks(I.fillStyle,l),a.lineCap=ks(I.lineCap,"butt"),a.lineDashOffset=ks(I.lineDashOffset,0),a.lineJoin=ks(I.lineJoin,"miter"),a.lineWidth=L,a.strokeStyle=ks(I.strokeStyle,l),a.setLineDash(ks(I.lineDash,[])),i.usePointStyle){const M={radius:_*Math.SQRT2/2,pointStyle:I.pointStyle,rotation:I.rotation,borderWidth:L},O=c.xPlus(A,y/2),z=R+g;YW(a,M,O,z,i.pointStyleWidth&&y)}else{const M=R+Math.max((h-_)/2,0),O=c.leftForLtr(A,y),z=ih(I.borderRadius);a.beginPath(),Object.values(z).some(X=>
6064X!==0)?Fj(a,{x:O,y:M,w:y,h:_,radius:z}):a.rect(O,M,y,_),a.fill(),L!==0&&a.stroke()}a.restore()},k=function(A,R,I){Rv(a,I.text,A,R+j/2,u,{strikethrough:I.hidden,textAlign:c.textAlign(I.textAlign)})},S=this.isHorizontal(),E=this._computeTitleHeight();S?v={x:ta(o,this.left+f,this.right-n[0]),y:this.top+f+E,line:0}:v={x:this.left+f,y:ta(o,this.top+E+f,this.bottom-s[0].height),line:0},tY(this.ctx,t.textDirection);const T=j+f;this.legendItems.forEach((A,R)=>{a.strokeStyle=A.fontColor,a.fillStyle=A.fontColor;const I=a.measureText(A.text).width,L=c.textAlign(A.textAlign||(A.textAlign=i.textAlign)),M=y+g+I;let O=v.x,z=v.y;c.setWidth(this.width),S?R>0&&O+M+f>this.right&&(z=v.y+=T,v.line++,O=v.x=ta(o,this.left+f,this.right-n[v.line])):R>0&&z+T>this.bottom&&(O=v.x=O+s[v.line].width+f,v.line++,z=v.y=ta(o,this.top+E+f,this.bottom-s[v.line].height));const X=c.x(O);if(w(X,z,A),O=gPe(L,O+y+g,S?O+M:this.right,t.rtl),k(c.x(O),z,A),S)v.x+=M+f;else if(typeof A.text!="string"){const W=u.lineHeight;v.y+=NY(A,W)+f}else v.y+=T}),sY(this.ctx,t.textDirection)}drawTitle(){const t=this.options,s=t.title,n=ia(s.font),a=Ko(s.padding);if(!s.display)return;const o=lh(t.rtl,this.left,this.width),i=this.ctx,l=s.position,c=n.size/2,u=a.top+c;let f,h=this.left,g=this.width;if(this.isHorizontal())g=Math.max(...this.lineWidths),f=this.top+u,h=ta(t.align,h,this.right-g);else{const y=this.columnSizes.reduce((_,j)=>Math.max(_,j.height),0);f=u+ta(t.align,this.top,this.bottom-y-t.labels.padding-this._computeTitleHeight())}const v=ta(l,h,h+g);i.textAlign=o.textAlign($A(l)),i.textBaseline="middle",i.strokeStyle=s.color,i.fillStyle=s.color,i.font=n.string,Rv(i,s.text,v,f,n)}_computeTitleHeight(){const t=this.options.title,s=ia(t.font),n=Ko(t.padding);return t.display?s.lineHeight+n.height:0}_getLegendItemAt(t,s){let n,a,o;if(Ql(t,this.left,this.right)&&Ql(s,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(a=o[n],Ql(t,a.left,a.left+a.width)&&Ql(s,a.top,a.top+a.height))return this.legendItems[n]}return null}handleEvent(t){const s=this.options;if(!z3e(t.type,s))return;const n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const a=this._hoveredItem,o=U3e(a,n);a&&!o&&wr(s.onLeave,[t,a,this],this),this._hoveredItem=n,n&&!o&&wr(s.onHover,[t,n,this],this)}else n&&wr(s.onClick,[t,n,this],this)}}function F3e(e,t,s,n,a){const o=B3e(n,e,t,s),i=q3e(a,n,t.lineHeight);return{itemWidth:o,itemHeight:i}}function B3e(e,t,s,n){let a=e.text;return a&&typeof a!="string"&&(a=a.reduce((o,i)=>o.length>i.length?o:i)),t+s.size/2+n.measureText(a).width}function q3e(e,t,s){let n=e;return typeof t.text!="string"&&(n=NY(t,s)),n}function NY(e,t){const s=e.text?e.text.length:0;return t*s}function z3e(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var kY={id:"legend",_element:rU,start(e,t,s){const n=e.legend=new rU({ctx:e.ctx,options:s,chart:e});$o.configure(e,n,s),$o.addBox(e,n)},stop(e){$o.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,s){const n=e.legend;$o.configure(e,n,s),n.options=s},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,s){const n=t.datasetIndex,a=s.chart;a.isDatasetVisible(n)?(a.hide(n),t.hidden=!0):(a.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:s,pointStyle:n,textAlign:a,color:o,useBorderRadius:i,borderRadius:l}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const u=c.controller.getStyle(s?0:void 0),f=Ko(u.borderWidth);return{text:t[c.index].label,fillStyle:u.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(f.width+f.height)/4,strokeStyle:u.borderColor,pointStyle:n||u.pointStyle,rotation:u.rotation,textAlign:a||u.textAlign,borderRadius:i&&(l||u.borderRadius),datasetIndex:c.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}}
6064,descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class SY extends gc{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,s){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=s;const a=an(n.text)?n.text.length:1;this._padding=Ko(n.padding);const o=a*ia(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:s,left:n,bottom:a,right:o,options:i}=this,l=i.align;let c=0,u,f,h;return this.isHorizontal()?(f=ta(l,n,o),h=s+t,u=o-n):(i.position==="left"?(f=n+t,h=ta(l,a,s),c=ir*-.5):(f=o-t,h=ta(l,s,a),c=ir*.5),u=a-s),{titleX:f,titleY:h,maxWidth:u,rotation:c}}draw(){const t=this.ctx,s=this.options;if(!s.display)return;const n=ia(s.font),o=n.lineHeight/2+this._padding.top,{titleX:i,titleY:l,maxWidth:c,rotation:u}=this._drawArgs(o);Rv(t,s.text,0,0,n,{color:s.color,maxWidth:c,rotation:u,textAlign:$A(s.align),textBaseline:"middle",translation:[i,l]})}}function H3e(e,t){const s=new SY({ctx:e.ctx,options:t,chart:e});$o.configure(e,s,t),$o.addBox(e,s),e.titleBlock=s}var CY={id:"title",_element:SY,start(e,t,s){H3e(e,s)},stop(e){const t=e.titleBlock;$o.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,s){const n=e.titleBlock;$o.configure(e,n,s),n.options=s},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const vx={average(e){if(!e.length)return!1;let t,s,n=new Set,a=0,o=0;for(t=0,s=e.length;t<s;++t){const l=e[t].element;if(l&&l.hasValue()){const c=l.tooltipPosition();n.add(c.x),a+=c.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((l,c)=>l+c)/n.size,y:a/o}},nearest(e,t){if(!e.length)return!1;let s=t.x,n=t.y,a=Number.POSITIVE_INFINITY,o,i,l;for(o=0,i=e.length;o<i;++o){const c=e[o].element;if(c&&c.hasValue()){const u=c.getCenterPoint(),f=T5(t,u);f<a&&(a=f,l=c)}}if(l){const c=l.tooltipPosition();s=c.x,n=c.y}return{x:s,y:n}}};function Fi(e,t){return t&&(an(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Fl(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(` 6065`)>-1?e.split(` 6066`):e}function V3e(e,t){const{element:s,datasetIndex:n,index:a}=t,o=e.getDatasetMeta(n).controller,{label:i,value:l}=o.getLabelAndValue(a);return{chart:e,label:i,parsed:o.getParsed(a),raw:e.data.datasets[n].data[a],formattedValue:l,dataset:o.getDataset(),dataIndex:a,datasetIndex:n,element:s}}function nU(e,t){const s=e.chart.ctx,{body:n,footer:a,title:o}=e,{boxWidth:i,boxHeight:l}=t,c=ia(t.bodyFont),u=ia(t.titleFont),f=ia(t.footerFont),h=o.length,g=a.length,v=n.length,y=Ko(t.padding);let _=y.height,j=0,w=n.reduce((E,T)=>E+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,h&&(_+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){const E=t.displayColors?Math.max(l,c.lineHeight):c.lineHeight;_+=v*E+(w-v)*c.lineHeight+(w-1)*t.bodySpacing}g&&(_+=t.footerMarginTop+g*f.lineHeight+(g-1)*t.footerSpacing);let k=0;const S=function(E){j=Math.max(j,s.measureText(E).width+k)};return s.save(),s.font=u.string,or(e.title,S),s.font=c.string,or(e.beforeBody.concat(e.afterBody),S),k=t.displayColors?i+2+t.boxPadding:0,or(n,E=>{or(E.before,S),or(E.lines,S),or(E.after,S)}),k=0,s.font=f.string,or(e.footer,S),s.restore(),j+=y.width,{width:j,height:_}}function G3e(e,t){const{y:s,height:n}=t;return s<n/2?"top":s>e.height-n/2?"bottom":"center"}function W3e(e,t,s,n){const{x:a,width:o}=n,i=s.caretSize+s.caretPadding;if(e==="left"&&a+o+i>t.width||e==="right"&&a-o-i<0)return!0}function Y3e(e,t,s,n){const{x:a,width:o}=s,{width:i,chartArea:{left:l,right:c}}=e;let u="center";return n==="center"?u=a<=(l+c)/2?"left":"right":a<=o/2?u="left":a>=i-o/2&&(u="right"),W3e(u,e,t,s)&&(u="center"),u}function aU(e,t,s){const n=s.yAlign||t.yAlign||G3e(e,s);return{xAlign:s.xAlign||t.xAlign||Y3e(e,t,s,n),yAlign:n}}function K3e(e,t){let{x:s,width:n}=e;return t==="right"?s-=n:t==="center"&&(s-=n/2),s}
6066function J3e(e,t,s){let{y:n,height:a}=e;return t==="top"?n+=s:t==="bottom"?n-=a+s:n-=a/2,n}function oU(e,t,s,n){const{caretSize:a,caretPadding:o,cornerRadius:i}=e,{xAlign:l,yAlign:c}=s,u=a+o,{topLeft:f,topRight:h,bottomLeft:g,bottomRight:v}=ih(i);let y=K3e(t,l);const _=J3e(t,c,u);return c==="center"?l==="left"?y+=u:l==="right"&&(y-=u):l==="left"?y-=Math.max(f,g)+a:l==="right"&&(y+=Math.max(h,v)+a),{x:oa(y,0,n.width-t.width),y:oa(_,0,n.height-t.height)}}function W0(e,t,s){const n=Ko(s.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-n.right:e.x+n.left}function iU(e){return Fi([],Fl(e))}function X3e(e,t,s){return Ip(e,{tooltip:t,tooltipItems:s,type:"tooltip"})}function lU(e,t){const s=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return s?e.override(s):e}const EY={beforeTitle:Ll,title(e){if(e.length>0){const t=e[0],s=t.chart.data.labels,n=s?s.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return s[t.dataIndex]}return""},afterTitle:Ll,beforeBody:Ll,beforeLabel:Ll,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const s=e.formattedValue;return nr(s)||(t+=s),t},labelColor(e){const s=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:s.borderColor,backgroundColor:s.backgroundColor,borderWidth:s.borderWidth,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const s=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:s.pointStyle,rotation:s.rotation}},afterLabel:Ll,afterBody:Ll,beforeFooter:Ll,footer:Ll,afterFooter:Ll};function Aa(e,t,s,n){const a=e[t].call(s,n);return typeof a>"u"?EY[t].call(s,n):a}class L5 extends gc{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const s=this.chart,n=this.options.setContext(this.getContext()),a=n.enabled&&s.options.animation&&n.animations,o=new iY(this.chart,a);return a._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=X3e(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){const{callbacks:n}=s,a=Aa(n,"beforeTitle",this,t),o=Aa(n,"title",this,t),i=Aa(n,"afterTitle",this,t);let l=[];return l=Fi(l,Fl(a)),l=Fi(l,Fl(o)),l=Fi(l,Fl(i)),l}getBeforeBody(t,s){return iU(Aa(s.callbacks,"beforeBody",this,t))}getBody(t,s){const{callbacks:n}=s,a=[];return or(t,o=>{const i={before:[],lines:[],after:[]},l=lU(n,o);Fi(i.before,Fl(Aa(l,"beforeLabel",this,o))),Fi(i.lines,Aa(l,"label",this,o)),Fi(i.after,Fl(Aa(l,"afterLabel",this,o))),a.push(i)}),a}getAfterBody(t,s){return iU(Aa(s.callbacks,"afterBody",this,t))}getFooter(t,s){const{callbacks:n}=s,a=Aa(n,"beforeFooter",this,t),o=Aa(n,"footer",this,t),i=Aa(n,"afterFooter",this,t);let l=[];return l=Fi(l,Fl(a)),l=Fi(l,Fl(o)),l=Fi(l,Fl(i)),l}_createItems(t){const s=this._active,n=this.chart.data,a=[],o=[],i=[];let l=[],c,u;for(c=0,u=s.length;c<u;++c)l.push(V3e(this.chart,s[c]));return t.filter&&(l=l.filter((f,h,g)=>t.filter(f,h,g,n))),t.itemSort&&(l=l.sort((f,h)=>t.itemSort(f,h,n))),or(l,f=>{const h=lU(t.callbacks,f);a.push(Aa(h,"labelColor",this,f)),o.push(Aa(h,"labelPointStyle",this,f)),i.push(Aa(h,"labelTextColor",this,f))}),this.labelColors=a,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=l,l}update(t,s){const n=this.options.setContext(this.getContext()),a=this._active;let o,i=[];if(!a.length)this.opacity!==0&&(o={opacity:0}
6066);else{const l=vx[n.position].call(this,a,this._eventPosition);i=this._createItems(n),this.title=this.getTitle(i,n),this.beforeBody=this.getBeforeBody(i,n),this.body=this.getBody(i,n),this.afterBody=this.getAfterBody(i,n),this.footer=this.getFooter(i,n);const c=this._size=nU(this,n),u=Object.assign({},l,c),f=aU(this.chart,n,u),h=oU(n,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,o={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(t,s,n,a){const o=this.getCaretPosition(t,n,a);s.lineTo(o.x1,o.y1),s.lineTo(o.x2,o.y2),s.lineTo(o.x3,o.y3)}getCaretPosition(t,s,n){const{xAlign:a,yAlign:o}=this,{caretSize:i,cornerRadius:l}=n,{topLeft:c,topRight:u,bottomLeft:f,bottomRight:h}=ih(l),{x:g,y:v}=t,{width:y,height:_}=s;let j,w,k,S,E,T;return o==="center"?(E=v+_/2,a==="left"?(j=g,w=j-i,S=E+i,T=E-i):(j=g+y,w=j+i,S=E-i,T=E+i),k=j):(a==="left"?w=g+Math.max(c,f)+i:a==="right"?w=g+y-Math.max(u,h)-i:w=this.caretX,o==="top"?(S=v,E=S-i,j=w-i,k=w+i):(S=v+_,E=S+i,j=w+i,k=w-i),T=S),{x1:j,x2:w,x3:k,y1:S,y2:E,y3:T}}drawTitle(t,s,n){const a=this.title,o=a.length;let i,l,c;if(o){const u=lh(n.rtl,this.x,this.width);for(t.x=W0(this,n.titleAlign,n),s.textAlign=u.textAlign(n.titleAlign),s.textBaseline="middle",i=ia(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=i.string,c=0;c<o;++c)s.fillText(a[c],u.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+l,c+1===o&&(t.y+=n.titleMarginBottom-l)}}_drawColorBox(t,s,n,a,o){const i=this.labelColors[n],l=this.labelPointStyles[n],{boxHeight:c,boxWidth:u}=o,f=ia(o.bodyFont),h=W0(this,"left",o),g=a.x(h),v=c<f.lineHeight?(f.lineHeight-c)/2:0,y=s.y+v;if(o.usePointStyle){const _={radius:Math.min(u,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},j=a.leftForLtr(g,u)+u/2,w=y+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,A5(t,_,j,w),t.strokeStyle=i.borderColor,t.fillStyle=i.backgroundColor,A5(t,_,j,w)}else{t.lineWidth=Ls(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,t.strokeStyle=i.borderColor,t.setLineDash(i.borderDash||[]),t.lineDashOffset=i.borderDashOffset||0;const _=a.leftForLtr(g,u),j=a.leftForLtr(a.xPlus(g,1),u-2),w=ih(i.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Fj(t,{x:_,y,w:u,h:c,radius:w}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Fj(t,{x:j,y:y+1,w:u-2,h:c-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(_,y,u,c),t.strokeRect(_,y,u,c),t.fillStyle=i.backgroundColor,t.fillRect(j,y+1,u-2,c-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,s,n){const{body:a}=this,{bodySpacing:o,bodyAlign:i,displayColors:l,boxHeight:c,boxWidth:u,boxPadding:f}=n,h=ia(n.bodyFont);let g=h.lineHeight,v=0;const y=lh(n.rtl,this.x,this.width),_=function(I){s.fillText(I,y.x(t.x+v),t.y+g/2),t.y+=g+o},j=y.textAlign(i);let w,k,S,E,T,A,R;for(s.textAlign=i,s.textBaseline="middle",s.font=h.string,t.x=W0(this,j,n),s.fillStyle=n.bodyColor,or(this.beforeBody,_),v=l&&j!=="right"?i==="center"?u/2+f:u+2+f:0,E=0,A=a.length;E<A;++E){for(w=a[E],k=this.labelTextColors[E],s.fillStyle=k,or(w.before,_),S=w.lines,l&&S.length&&(this._drawColorBox(s,t,E,y,n),g=Math.max(h.lineHeight,c)),T=0,R=S.length;T<R;++T)_(S[T]),g=h.lineHeight;or(w.after,_)}v=0,g=h.lineHeight,or(this.afterBody,_),t.y-=o}drawFooter(t,s,n){const a=this.footer,o=a.length;let i,l;if(o){const c=lh(n.rtl,this.x,this.width);for(t.x=W0(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=c.textAlign(n.footerAlign),s.textBaseline="middle",i=ia(n.footerFont),s.fillStyle=n.footerColor,s.font=i.string,l=0;l<o;++l)s.fillText(a[l],c.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+n.footerSpacing}}drawBackground(t,s,n,a){const{xAlign:o,yAlign:i}=this,{x:l,y:c}=t,{width:u,height:f}=n,{topLeft:h,topRight:g,bottomLeft:v,bottomRight:y}=ih(a.cornerRadius);s.fillStyle=a.backgroundColor,s.strokeStyle=a.borderColor,s.lineWidth=a.borderWidth,s.beginPath(),s.moveTo(l+h,c),i==="top"&&this.drawCaret(t,s,n,a),s.lineTo(l+u-g,c),s.quadraticCurveTo(l+u,c,l+u,c+g),i==="center"&&o==="right"&&this.drawCaret(t,s,n,a),s.lineTo(l+u,c+f-y),s.quadraticCurveTo(l+u,c+f,l+u-y,c+f),i==="bottom"&&this.drawCaret(t,s,n,a),s.lineTo(l+v,c+f),s.quadraticCurveTo(l,c+f,l,c+f-v),i==="center"&&o==="left"&&this.drawCaret(t,s,n,a),s.lineTo(l,c+h),s.quadraticCurveTo(l,c,l
6066+h,c),s.closePath(),s.fill(),a.borderWidth>0&&s.stroke()}_updateAnimationTarget(t){const s=this.chart,n=this.$animations,a=n&&n.x,o=n&&n.y;if(a||o){const i=vx[t.position].call(this,this._active,this._eventPosition);if(!i)return;const l=this._size=nU(this,t),c=Object.assign({},i,this._size),u=aU(s,t,c),f=oU(t,c,u,s);(a._to!==f.x||o._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=l.width,this.height=l.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(t){const s=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(s);const a={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const i=Ko(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,a,s),tY(t,s.textDirection),o.y+=i.top,this.drawTitle(o,t,s),this.drawBody(o,t,s),this.drawFooter(o,t,s),sY(t,s.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,s){const n=this._active,a=t.map(({datasetIndex:l,index:c})=>{const u=this.chart.getDatasetMeta(l);if(!u)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:u.data[c],index:c}}),o=!Dj(n,a),i=this._positionChanged(a,s);(o||i)&&(this._active=a,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const a=this.options,o=this._active||[],i=this._getActiveElements(t,o,s,n),l=this._positionChanged(i,t),c=s||!Dj(i,o)||l;return c&&(this._active=i,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,s))),c}_getActiveElements(t,s,n,a){const o=this.options;if(t.type==="mouseout")return[];if(!a)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&i.reverse(),i}_positionChanged(t,s){const{caretX:n,caretY:a,options:o}=this,i=vx[o.position].call(this,t,s);return i!==!1&&(n!==i.x||a!==i.y)}}Re(L5,"positioners",vx);var TY={id:"tooltip",_element:L5,positioners:vx,afterInit(e,t,s){s&&(e.tooltip=new L5({chart:e,options:s}))},beforeUpdate(e,t,s){e.tooltip&&e.tooltip.initialize(s)},reset(e,t,s){e.tooltip&&e.tooltip.initialize(s)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const s={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",s)}},afterEvent(e,t){if(e.tooltip){const s=t.replay;e.tooltip.handleEvent(t.event,s,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:EY},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Q3e=(e,t,s,n)=>(typeof t=="string"?(s=e.push(t)-1,n.unshift({index:s,label:t})):isNaN(t)&&(s=null),s);function Z3e(e,t,s,n){const a=e.indexOf(t);if(a===-1)return Q3e(e,t,s,n);const o=e.lastIndexOf(t);return a!==o?s:a}const eMe=(e,t)=>e===null?null:oa(Math.round(e),0,t);function cU(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Hj extends mm{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const s=this._addedLabels;if(s.length){const n=this.getLabels();for(const{index:a,label:o}of s)n[a]===o&&n.splice(a,1);this._addedLabels=[]}super.init(t)}parse(t,s){if(nr(t))return null;const n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:Z3e(n,t,ks(s,t),this._addedLabels),eMe(s,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:s}=this.getUserBounds();let{min:n,max:a}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),s||(a=this.getLabels().length-1)),this.min=n,this.max=a}buildTicks(){const t=this.min,s=this.max,n=this.options.offset,a=[];let o=this.getLabels();o=t===0&&s===o.length-1?o:o.slice(t,s+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let i=t;i<=s;i++)a.push({value:i});return a}getLabelForValue(t){return cU.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Re(Hj,"id","category"),Re(Hj,"defaults",{ticks:{callback:cU}});function tMe(e,t){const s=[],{bounds:a,step:o,min:i,max:l,precision:c,count:u,maxTicks:f,maxDigits:h,includeBounds:g}=e,v=o||1,y=f-1,{min:_,max:j}=t,w=!nr(i),k=!nr(l),S=!nr(u),E=(j-_)/(h+1);let T=o6((j-_)/y/v)*v,A,R,I,L;if(T<1e-14&&!w&&!k)return[{value:_},{value:j}];L=Math.ceil(j/T)-Math.floor(_/T),L>y&&(T=o6(L*T/y/v)*v),nr(c)||(A=Math.pow(10,c),T=Math.ceil(T*A)/A),a==="ticks"?(R=Math.floor(_/T)*T,I=Math.ceil(j/T)*T):(R=_,I=j),w&&k&&o&&iPe((l-i)/o,T/1e3)?(L=Math.round(Math.min((l-i)/T,f)),T=(l-i)/L,R=i,I=l):S?(R=w?i:R,I=k?l:I,L=u-1,T=(I-R)/L):(L=(I-R)/T,Bx(L,Math.round(L),T/1e3)?L=Math.round(L):L=Math.ceil(L));const M=Math.max(i6(T),i6(R));A=Math.pow(10,nr(c)?M:c),R=Math.round(R*A)/A,I=Math.round(I*A)/A;let O=0;for(w&&(g&&R!==i?(s.push({value:i}),R<i&&O++,Bx(Math.round((R+O*T)*A)/A,i,dU(i,E,e))&&O++):R<i&&O++);O<L;++O){const z=Math.round((R+O*T)*A)/A;if(k&&z>l)break;s.push({value:z})}return k&&g&&I!==l?s.length&&Bx(s[s.length-1].value,l,dU(l,E,e))?s[s.length-1].value=l:s.push({value:l}):(!k||I===l)&&s.push({value:I}),s}function dU(e,t,{horizontal:s,minRotation:n}){const a=Xl(n),o=(s?Math.sin(a):Math.cos(a))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class sMe extends mm{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,s){return nr(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:s,maxDefined:n}=this.getUserBounds();let{min:a,max:o}=this;const i=c=>a=s?a:c,l=c=>o=n?o:c;
6066if(t){const c=sl(a),u=sl(o);c<0&&u<0?l(0):c>0&&u>0&&i(0)}if(a===o){let c=o===0?1:Math.abs(o*.05);l(o+c),t||i(a-c)}this.min=a,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:s,stepSize:n}=t,a;return n?(a=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,a>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${a} ticks. Limiting to 1000.`),a=1e3)):(a=this.computeTickLimit(),s=s||11),s&&(a=Math.min(s,a)),a}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,s=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const a={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:s.precision,step:s.stepSize,count:s.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:s.minRotation||0,includeBounds:s.includeBounds!==!1},o=this._range||this,i=tMe(a,o);return t.bounds==="ticks"&&lPe(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let s=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const a=(n-s)/Math.max(t.length-1,1)/2;s-=a,n+=a}this._startValue=s,this._endValue=n,this._valueRange=n-s}getLabelForValue(t){return FA(t,this.chart.options.locale,this.options.ticks.format)}}class Vj extends sMe{determineDataLimits(){const{min:t,max:s}=this.getMinMax(!0);this.min=ua(t)?t:0,this.max=ua(s)?s:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),s=t?this.width:this.height,n=Xl(this.options.ticks.minRotation),a=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(s/Math.min(40,o.lineHeight/a))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Re(Vj,"id","linear"),Re(Vj,"defaults",{ticks:{callback:WW.formatters.numeric}});const h1={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Da=Object.keys(h1);function uU(e,t){return e-t}function pU(e,t){if(nr(t))return null;const s=e._adapter,{parser:n,round:a,isoWeekday:o}=e._parseOpts;let i=t;return typeof n=="function"&&(i=n(i)),ua(i)||(i=typeof n=="string"?s.parse(i,n):s.parse(i)),i===null?null:(a&&(i=a==="week"&&(Cv(o)||o===!0)?s.startOf(i,"isoWeek",o):s.startOf(i,a)),+i)}function fU(e,t,s,n){const a=Da.length;for(let o=Da.indexOf(e);o<a-1;++o){const i=h1[Da[o]],l=i.steps?i.steps:Number.MAX_SAFE_INTEGER;if(i.common&&Math.ceil((s-t)/(l*i.size))<=n)return Da[o]}return Da[a-1]}function rMe(e,t,s,n,a){for(let o=Da.length-1;o>=Da.indexOf(s);o--){const i=Da[o];if(h1[i].common&&e._adapter.diff(a,n,i)>=t-1)return i}return Da[s?Da.indexOf(s):0]}function nMe(e){for(let t=Da.indexOf(e)+1,s=Da.length;t<s;++t)if(h1[Da[t]].common)return Da[t]}function hU(e,t,s){if(!s)e[t]=!0;else if(s.length){const{lo:n,hi:a}=DA(s,t),o=s[n]>=t?s[n]:s[a];e[o]=!0}}function aMe(e,t,s,n){const a=e._adapter,o=+a.startOf(t[0].value,n),i=t[t.length-1].value;let l,c;for(l=o;l<=i;l=+a.add(l,1,n))c=s[l],c>=0&&(t[c].major=!0);return t}function mU(e,t,s){const n=[],a={},o=t.length;let i,l;for(i=0;i<o;++i)l=t[i],a[l]=i,n.push({value:l,major:!1});return o===0||!s?n:aMe(e,n,a,s)}class Gj extends mm{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,s={}){const n=t.time||(t.time={}),a=this._adapter=new HIe._date(t.adapters.date);a.init(s),Fx(n.displayFormats,a.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized}parse(t,s){return t===void 0?null:pU(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,s=this._adapter,n=t.time.unit||"day";let{min:a,max:o,minDefined:i,maxDefined:l}=this.getUserBounds();function c(u){!i&&!isNaN(u.min)&&(a=Math.min(a,u.min)),!l&&!isNaN(u.max)&&(o=Math.max(o,u.max))}
vendor: 4,396 bytes, line 6066
6066(!i||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),a=ua(a)&&!isNaN(a)?a:+s.startOf(Date.now(),n),o=ua(o)&&!isNaN(o)?o:+s.endOf(Date.now(),n)+1,this.min=Math.min(a,o-1),this.max=Math.max(a+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){const t=this.options,s=t.time,n=t.ticks,a=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&a.length&&(this.min=this._userMin||a[0],this.max=this._userMax||a[a.length-1]);const o=this.min,i=this.max,l=fPe(a,o,i);return this._unit=s.unit||(n.autoSkip?fU(s.minUnit,this.min,this.max,this._getLabelCapacity(o)):rMe(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:nMe(this._unit),this.initOffsets(a),t.reverse&&l.reverse(),mU(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let s=0,n=0,a,o;this.options.offset&&t.length&&(a=this.getDecimalForValue(t[0]),t.length===1?s=1-a:s=(this.getDecimalForValue(t[1])-a)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;s=oa(s,0,i),n=oa(n,0,i),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,s=this.min,n=this.max,a=this.options,o=a.time,i=o.unit||fU(o.minUnit,s,n,this._getLabelCapacity(s)),l=ks(a.ticks.stepSize,1),c=i==="week"?o.isoWeekday:!1,u=Cv(c)||c===!0,f={};let h=s,g,v;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":i),t.diff(n,s,i)>1e5*l)throw new Error(s+" and "+n+" are too far apart with stepSize of "+l+" "+i);const y=a.ticks.source==="data"&&this.getDataTimestamps();for(g=h,v=0;g<n;g=+t.add(g,l,i),v++)hU(f,g,y);return(g===n||a.bounds==="ticks"||v===1)&&hU(f,g,y),Object.keys(f).sort(uU).map(_=>+_)}getLabelForValue(t){const s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){const a=this.options.time.displayFormats,o=this._unit,i=s||a[o];return this._adapter.format(t,i)}_tickFormatFunction(t,s,n,a){const o=this.options,i=o.ticks.callback;if(i)return wr(i,[t,s,n],this);const l=o.time.displayFormats,c=this._unit,u=this._majorUnit,f=c&&l[c],h=u&&l[u],g=n[s],v=u&&h&&g&&g.major;return this._adapter.format(t,a||(v?h:f))}generateTickLabels(t){let s,n,a;for(s=0,n=t.length;s<n;++s)a=t[s],a.label=this._tickFormatFunction(a.value,s,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){const s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const s=this.options.ticks,n=this.ctx.measureText(t).width,a=Xl(this.isHorizontal()?s.maxRotation:s.minRotation),o=Math.cos(a),i=Math.sin(a),l=this._resolveTickFontOptions(0).size;return{w:n*o+l*i,h:n*i+l*o}}_getLabelCapacity(t){const s=this.options.time,n=s.displayFormats,a=n[s.unit]||n.millisecond,o=this._tickFormatFunction(t,0,mU(this,[t],this._majorUnit),a),i=this._getLabelSize(o),l=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;const a=this.getMatchingVisibleMetas();if(this._normalized&&a.length)return this._cache.data=a[0].controller.getAllParsedValues(this);for(s=0,n=a.length;s<n;++s)t=t.concat(a[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let s,n;if(t.length)return t;const a=this.getLabels();for(s=0,n=a.length;s<n;++s)t.push(pU(this,a[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return HW(t.sort(uU))}}Re(Gj,"id","time"),Re(Gj,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Y0(e,t,s){let n=0,a=e.length-1,o,i,l,c;s?(t>=e[n].pos&&t<=e[a].pos&&({lo:n,hi:a}=Vu(e,"pos",t)),{pos:o,time:l}=e[n],{pos:i,time:c}=e[a]):(t>=e[n].time&&t<=e[a].time&&({lo:n,hi:a}
6066=Vu(e,"time",t)),{time:o,pos:l}=e[n],{time:i,pos:c}=e[a]);const u=i-o;return u?l+(c-l)*(t-o)/u:l}class gU extends Gj{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),s=this._table=this.buildLookupTable(t);this._minPos=Y0(s,this.min),this._tableRange=Y0(s,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:s,max:n}=this,a=[],o=[];let i,l,c,u,f;for(i=0,l=t.length;i<l;++i)u=t[i],u>=s&&u<=n&&a.push(u);if(a.length<2)return[{time:s,pos:0},{time:n,pos:1}];for(i=0,l=a.length;i<l;++i)f=a[i+1],c=a[i-1],u=a[i],Math.round((f+c)/2)!==u&&o.push({time:u,pos:i/(l-1)});return o}_generate(){const t=this.min,s=this.max;let n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(s)||n.length===1)&&n.push(s),n.sort((a,o)=>a-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const s=this.getDataTimestamps(),n=this.getLabelTimestamps();return s.length&&n.length?t=this.normalize(s.concat(n)):t=s.length?s:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Y0(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return Y0(this._table,n*this._tableRange+this._minPos,!0)}}Re(gU,"id","timeseries"),Re(gU,"defaults",Gj.defaults);const RY="label";function xU(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function oMe(e,t){const s=e.options;s&&t&&Object.assign(s,t)}function AY(e,t){e.labels=t}function PY(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:RY;const n=[];e.datasets=t.map(a=>{const o=e.datasets.find(i=>i[s]===a[s]);return!o||!a.data||n.includes(o)?{...a}:(n.push(o),Object.assign(o,a),o)})}function iMe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RY;const s={labels:[],datasets:[]};return AY(s,e.labels),PY(s,e.datasets,t),s}function lMe(e,t){const{height:s=150,width:n=300,redraw:a=!1,datasetIdKey:o,type:i,data:l,options:c,plugins:u=[],fallbackContent:f,updateMode:h,...g}=e,v=x.useRef(null),y=x.useRef(null),_=()=>{v.current&&(y.current=new db(v.current,{type:i,data:iMe(l,o),options:c&&{...c},plugins:u}),xU(t,y.current))},j=()=>{xU(t,null),y.current&&(y.current.destroy(),y.current=null)};return x.useEffect(()=>{!a&&y.current&&c&&oMe(y.current,c)},[a,c]),x.useEffect(()=>{!a&&y.current&&AY(y.current.config.data,l.labels)},[a,l.labels]),x.useEffect(()=>{!a&&y.current&&l.datasets&&PY(y.current.config.data,l.datasets,o)},[a,l.datasets]),x.useEffect(()=>{y.current&&(a?(j(),setTimeout(_)):y.current.update(h))},[a,c,l.labels,l.datasets,h]),x.useEffect(()=>{y.current&&(j(),setTimeout(_))},[i]),x.useEffect(()=>(_(),()=>j()),[]),pe.createElement("canvas",{ref:v,role:"img",height:s,width:n,...g},f)}const cMe=x.forwardRef(lMe);function YA(e,t){return db.register(t),x.forwardRef((s,n)=>pe.createElement(cMe,{...s,ref:n,type:e}))}const dMe=YA("line",N_),uMe=YA("bar",w_),pMe=YA("doughnut",mx);db.register(xx,Hj,Vj,Hx,CY,TY,kY);const vU={baas_authenticated:"rgb(16, 185, 129)",legacy_authenticated:"rgb(99, 102, 241)",legacy_unauthenticated:"rgb(148, 163, 184)",bot_suspicious:"rgb(239, 68, 68)",other:"rgb(100, 116, 139)"},E_={baas_authenticated:"BaaS (Authenticated)",legacy_authenticated:"Legacy API (Authenticated)",legacy_unauthenticated:"Legacy API (Unauthenticated)",bot_suspicious:"Bot / Suspicious",other:"Other / Unclassified"};function rd(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function Wj(e){return e==null?"-":e<1?`${Math.round(e*60)}min`:e<24?`${e.toFixed(1)}h`:`${(e/24).toFixed(1)}d`}function fMe(e){const t=e==null?"":String(e);return t.includes(",")||t.includes('"')||t.includes(` 6067`)?`"${t.replace(/"/g,'""')}"`:t}function tr(e){return e.map(fMe).join(",")}function hMe(e,t,s,n){var o;const a=[];if(e){const i=e.segments,l=i.total||1;a.push("--- TRAFFIC SEGMENTS ---"),a.push(tr(["Segment","Requests","Percentage"]));for(const[c,u]of Object.entries(E_)){const f=i[c]||0;a.push(tr([u,f,`${(f/l*100).toFixed(1)}%`]))}a.push(""),a.push("--- TOP CONSUMERS ---"),a.push(tr(["Project","Owner","Requests","Errors","Active Days","Top Endpoint","Tier"]));for(const c of e.topConsumers)a.push(tr([c.project_name||c.project_slug||`#${c.project_id}`,c.owner_email||"",c.request_count,c.error_count,c.active_days,c.top_endpoint||"",c.subscription_tier||"free"]));a.push(""),a.push("--- USER AGENT DISTRIBUTION ---"),a.push(tr(["Category","Requests"]));for(const c of e.userAgents)a.push(tr([c.ua_category,c.count]));if(a.push(""),e.geoDistribution.length>0){a.push("--- GEOGRAPHIC DISTRIBUTION ---"),a.push(tr(["Country","Requests"]));for(const c of e.geoDistribution)a.push(tr([c.country_code,c.count]));a.push("")}if(((o=e.otherPaths)==null?void 0:o.length)>0){a.push("--- OTHER / UNCLASSIFIED PATHS ---"),a.push(tr(["Method","Path","Requests"]));for(const c of e.otherPaths)a.push(tr([c.method,c.path,c.count]));a.push("")}}if(t){if(t.rateLimitApproachers.length>0){a.push("--- RATE LIMIT APPROACHERS ---"),a.push(tr(["Email","Tier","Days Near Limit","Avg Daily","Plan Limit"]));for(const i of t.rateLimitApproachers)a.push(tr([i.email||"",i.subscription_tier||"free",i.days_near_limit,Math.round(i.avg_daily_requests),i.plan_limit]));a.push("")}if(t.legacyToBaasExplorers.length>0){a.push("--- LEGACY TO BAAS EXPLORERS ---"),a.push(tr(["Project","Owner","Legacy Requests","BaaS Requests"]));for(const i of t.legacyToBaasExplorers)a.push(tr([i.project_name||i.project_slug||`#${i.project_id}`,i.owner_email||"",i.legacy_requests,i.baas_requests]));a.push("")}if(t.powerFreeUsers.length>0){a.push("--- POWER FREE USERS ---"),a.push(tr(["Email","Requests","Active Days","Collections","Last Active"]));for(const i of t.powerFreeUsers)a.push(tr([i.email||"",i.total_requests,i.active_days,i.collection_count,i.last_active?new Date(i.last_active).toISOString().slice(0,10):""]));a.push("")}if(t.postHeavyUsers.length>0){a.push("--- POST-HEAVY USERS ---"),a.push(tr(["Email","Tier","Total Requests","Writes","Write %"]));for(const i of t.postHeavyUsers)a.push(tr([i.email||"",i.subscription_tier||"free",i.total_requests,i.write_count,`${i.write_pct}%`]));a.push("")}}if(s){const i=s.revenueOpportunity;if(a.push("--- MONETIZATION OPPORTUNITY ---"),a.push(tr(["Metric","Value"])),a.push(tr(["Active free users",i.totalFreeActive])),a.push(tr(["Exceed free limit",i.exceedFreeLimit])),a.push(tr(["Dev tier fit",i.devTierFit])),a.push(tr(["Pro tier fit",i.proTierFit])),a.push(tr(["Total free requests",i.totalFreeRequests])),a.push(tr(["Potential MRR",i.potentialMrrFormatted])),a.push(tr(["Calculation",i.c
6067alculation])),a.push(""),s.cicdDependents.length>0){a.push("--- CI/CD DEPENDENTS ---"),a.push(tr(["Email","Tier","Avg Daily","Active Days","Hour Spread","Pattern"]));for(const l of s.cicdDependents)a.push(tr([l.email||"",l.subscription_tier||"free",l.avg_daily,l.active_days,l.avg_hour_spread,l.pattern_type]));a.push("")}}if(n){a.push("--- ENHANCED CONVERSION FUNNEL ---"),a.push(tr(["Step","Count","Median Time","Fastest Time"]));for(const i of n.steps)a.push(tr([i.label,i.count,Wj(i.medianHours),Wj(i.fastestHours)]));a.push("")}return a.join(` 6068`)}function mMe(e,t){const s=new Date().toISOString().slice(0,10),n=`reqres-traffic-intel-${t}d-${s}.csv`,a=new Blob([e],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}function m1({title:e,subtitle:t}){return r.jsxs("div",{className:"mb-4",children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:e}),t&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-1",children:t})]})}function K0({label:e,value:t,sub:s}){return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:e}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)] mt-1",children:t}),s&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mt-0.5",children:s})]})}function J0({count:e}){return e===0?r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:"0"}):r.jsx("span",{className:"inline-flex items-center justify-center min-w-[20px] h-5 rounded-full bg-indigo-500/20 text-indigo-300 text-xs font-medium px-1.5",children:e})}function gMe({data:e}){var c;if(!e)return null;const t=e.segments,s=Object.keys(E_),n=s.filter(u=>(t[u]||0)>0),a={labels:n.map(u=>E_[u]),datasets:[{data:n.map(u=>t[u]||0),backgroundColor:n.map(u=>vU[u]),borderWidth:0,hoverOffset:4}]},o={responsive:!0,maintainAspectRatio:!1,cutout:"60%",plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(15, 23, 42, 0.9)",titleColor:"#e2e8f0",bodyColor:"#e2e8f0",borderColor:"rgba(51, 65, 85, 0.5)",borderWidth:1,callbacks:{label:u=>`${u.label}: ${rd(u.raw||0)} requests`}}}},i={labels:e.userAgents.map(u=>u.ua_category),datasets:[{label:"Requests",data:e.userAgents.map(u=>u.count),backgroundColor:"rgba(99, 102, 241, 0.6)",borderRadius:4}]},l={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(15, 23, 42, 0.9)",titleColor:"#e2e8f0",bodyColor:"#e2e8f0",borderColor:"rgba(51, 65, 85, 0.5)",borderWidth:1}},scales:{x:{grid:{color:"rgba(51, 65, 85, 0.3)"},ticks:{color:"#64748b"}},y:{grid:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}}}};return r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-4 space-y-6`,children:[r.jsx(m1,{title:"Traffic Decomposition",subtitle:`${rd(t.total)} total requests in the last ${e.days} days`}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx("div",{className:"h-64",children:r.jsx(pMe,{data:a,options:o})}),r.jsx("div",{className:"space-y-3 flex flex-col justify-center",children:s.map(u=>{const f=t[u]||0;if(f===0)return null;const h=t.total>0?(f/t.total*100).toFixed(1):"0";return r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:vU[u]}}),r.jsx("span",{className:"text-sm text-[var(--color-fg-secondary)] flex-1",children:E_[u]}),r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:rd(f)}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-muted)] w-12 text-right",children:[h,"%"]})]},u)})})]}),e.topConsumers.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:"Top Consumers"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Project"}),r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Owner"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Requests"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Errors"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Active Days"}),r.jsx("th",{className:"py-2 font-medium",children:"Top Endpoint"})]})}),r.jsx("tbody",{children:e.topConsumers.map((u,f)=>r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsxs("td",{className:"py-2 pr-4",children:[r.jsx("span",{className:"text-[var(--color-fg-default)] font-medium",children:u.project_name||u.project_slug||`#${u.project_id}`}),u.subscription_tier&&u.subscription_tier!=="free"&&r.jsx("span",{className:"ml-1.5 text-[10px] text-emerald-400 font-medium uppercase",children:u.subscription_tier})]}),r.jsx("td",{className:"py-2 pr-4 text-xs",children:u.owner_email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-right font-medium text-[var(--color-fg-default)]",children:rd(u.request_count)}
6068),r.jsx("td",{className:"py-2 pr-4 text-right",children:r.jsx("span",{className:u.error_count>0?"text-rose-400":"",children:u.error_count})}),r.jsx("td",{className:"py-2 pr-4 text-right",children:u.active_days}),r.jsx("td",{className:"py-2 text-xs font-mono text-[var(--color-fg-muted)]",children:u.top_endpoint||"-"})]},u.project_id??f))})]})})]}),e.userAgents.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:"User Agent Distribution"}),r.jsx("div",{style:{height:Math.max(200,e.userAgents.length*28)},children:r.jsx(uMe,{data:i,options:l})})]}),e.geoDistribution.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:"Geographic Distribution (CF-IPCountry)"}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-2",children:e.geoDistribution.map(u=>r.jsxs("div",{className:"flex items-center justify-between rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-2.5 py-1.5",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:u.country_code}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:rd(u.count)})]},u.country_code))})]}),((c=e.otherPaths)==null?void 0:c.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:'Top "Other" Paths (unclassified traffic)'}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"text-left py-1.5 pr-4 text-xs font-medium text-[var(--color-fg-muted)]",children:"Method"}),r.jsx("th",{className:"text-left py-1.5 pr-4 text-xs font-medium text-[var(--color-fg-muted)]",children:"Path"}),r.jsx("th",{className:"text-right py-1.5 text-xs font-medium text-[var(--color-fg-muted)]",children:"Requests"})]})}),r.jsx("tbody",{children:e.otherPaths.map((u,f)=>r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50",children:[r.jsx("td",{className:"py-1.5 pr-4",children:r.jsx("span",{className:"inline-block rounded bg-[var(--color-bg-alt)] px-1.5 py-0.5 text-xs font-mono text-[var(--color-fg-default)]",children:u.method})}),r.jsx("td",{className:"py-1.5 pr-4 font-mono text-xs text-[var(--color-fg-default)]",children:u.path}),r.jsx("td",{className:"py-1.5 text-right text-xs text-[var(--color-fg-muted)]",children:rd(u.count)})]},f))})]})})]})]})}function xMe({data:e}){const[t,s]=x.useState({rateLimitApproachers:!0,legacyToBaas:!1,powerFree:!1,postHeavy:!1}),n=a=>s(o=>({...o,[a]:!o[a]}));return e?r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-4 space-y-4`,children:[r.jsx(m1,{title:"Intent Signals",subtitle:`Users showing upgrade-intent behaviour in the last ${e.days} days`}),r.jsxs("div",{className:"border border-[var(--color-border-default)] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>n("rateLimitApproachers"),className:"w-full flex items-center justify-between px-4 py-3 text-left hover:bg-[var(--color-bg-hover)]/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Rate Limit Approachers"}),r.jsx(J0,{count:e.rateLimitApproachers.length})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:t.rateLimitApproachers?"â¼":"â¶"})]}),t.rateLimitApproachers&&e.rateLimitApproachers.length>0&&r.jsxs("div",{className:"px-4 pb-3 overflow-x-auto",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:"Users hitting 80%+ of their daily request limit on 3+ days"}),r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Email"}),r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Tier"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Days Near Limit"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Avg Daily"}),r.jsx("th",{className:"py-2 font-medium text-right",children:"Plan Limit"})]})}),r.jsx("tbody",{children:e.rateLimitApproachers.map((a,o)=>{var i;return r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsx("td",{className:"py-2 pr-4 text-[var(--color-fg-default)]",children:a.email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-xs uppercase",children:a.subscription_tier||"free"}),r.jsx("td",{className:"py-2 pr-4 text-right font-medium text-amber-400",children:a.days_near_limit}),r.jsx("td",{className:"py-2 pr-4 text-right",children:Math.round(a.avg_daily_requests).toLocaleStr
6068ing()}),r.jsx("td",{className:"py-2 text-right",children:(i=a.plan_limit)==null?void 0:i.toLocaleString()})]},a.pro_user_id??o)})})]})]}),t.rateLimitApproachers&&e.rateLimitApproachers.length===0&&r.jsx("p",{className:"px-4 pb-3 text-xs text-[var(--color-fg-muted)]",children:"No users near limits in this period."})]}),r.jsxs("div",{className:"border border-[var(--color-border-default)] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>n("legacyToBaas"),className:"w-full flex items-center justify-between px-4 py-3 text-left hover:bg-[var(--color-bg-hover)]/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Legacy â BaaS Explorers"}),r.jsx(J0,{count:e.legacyToBaasExplorers.length})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:t.legacyToBaas?"â¼":"â¶"})]}),t.legacyToBaas&&e.legacyToBaasExplorers.length>0&&r.jsxs("div",{className:"px-4 pb-3 overflow-x-auto",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:"Users who started with /api/users and explored BaaS features"}),r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Project"}),r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Owner"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Legacy Reqs"}),r.jsx("th",{className:"py-2 font-medium text-right",children:"BaaS Reqs"})]})}),r.jsx("tbody",{children:e.legacyToBaasExplorers.map((a,o)=>r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsx("td",{className:"py-2 pr-4 text-[var(--color-fg-default)]",children:a.project_name||a.project_slug||`#${a.project_id}`}),r.jsx("td",{className:"py-2 pr-4 text-xs",children:a.owner_email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-right",children:a.legacy_requests.toLocaleString()}),r.jsx("td",{className:"py-2 text-right font-medium text-emerald-400",children:a.baas_requests.toLocaleString()})]},a.project_id??o))})]})]}),t.legacyToBaas&&e.legacyToBaasExplorers.length===0&&r.jsx("p",{className:"px-4 pb-3 text-xs text-[var(--color-fg-muted)]",children:"No crossover users in this period."})]}),r.jsxs("div",{className:"border border-[var(--color-border-default)] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>n("powerFree"),className:"w-full flex items-center justify-between px-4 py-3 text-left hover:bg-[var(--color-bg-hover)]/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"Power Free Users"}),r.jsx(J0,{count:e.powerFreeUsers.length})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:t.powerFree?"â¼":"â¶"})]}),t.powerFree&&e.powerFreeUsers.length>0&&r.jsxs("div",{className:"px-4 pb-3 overflow-x-auto",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:"Free users with 7+ active days and 100+ requests - highest conversion potential"}),r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Email"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Requests"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Active Days"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Collections"}),r.jsx("th",{className:"py-2 font-medium",children:"Last Active"})]})}),r.jsx("tbody",{children:e.powerFreeUsers.map((a,o)=>r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsx("td",{className:"py-2 pr-4 text-[var(--color-fg-default)]",children:a.email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-right font-medium",children:a.total_requests.toLocaleStr
6068ing()}),r.jsx("td",{className:"py-2 pr-4 text-right",children:a.active_days}),r.jsx("td",{className:"py-2 pr-4 text-right",children:a.collection_count}),r.jsx("td",{className:"py-2 text-xs text-[var(--color-fg-muted)]",children:new Date(a.last_active).toLocaleDateString()})]},a.user_id??o))})]})]}),t.powerFree&&e.powerFreeUsers.length===0&&r.jsx("p",{className:"px-4 pb-3 text-xs text-[var(--color-fg-muted)]",children:"No power free users in this period."})]}),r.jsxs("div",{className:"border border-[var(--color-border-default)] rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>n("postHeavy"),className:"w-full flex items-center justify-between px-4 py-3 text-left hover:bg-[var(--color-bg-hover)]/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)]",children:"POST-Heavy Users"}),r.jsx(J0,{count:e.postHeavyUsers.length})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:t.postHeavy?"â¼":"â¶"})]}),t.postHeavy&&e.postHeavyUsers.length>0&&r.jsxs("div",{className:"px-4 pb-3 overflow-x-auto",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:"Users with 30%+ write operations - trying to use ReqRes as a real backend"}),r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Email"}),r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Tier"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Total Reqs"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Writes"}),r.jsx("th",{className:"py-2 font-medium text-right",children:"Write %"})]})}),r.jsx("tbody",{children:e.postHeavyUsers.map((a,o)=>r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsx("td",{className:"py-2 pr-4 text-[var(--color-fg-default)]",children:a.email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-xs uppercase",children:a.subscription_tier||"free"}),r.jsx("td",{className:"py-2 pr-4 text-right",children:a.total_requests.toLocaleString()}),r.jsx("td",{className:"py-2 pr-4 text-right",children:a.write_count.toLocaleString()}),r.jsxs("td",{className:"py-2 text-right font-medium text-indigo-400",children:[a.write_pct,"%"]})]},a.user_id??o))})]})]}),t.postHeavy&&e.postHeavyUsers.length===0&&r.jsx("p",{className:"px-4 pb-3 text-xs text-[var(--color-fg-muted)]",children:"No POST-heavy users in this period."})]})]}):null}function vMe({data:e}){if(!e)return null;const t=e.revenueOpportunity;return r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-4 space-y-4`,children:[r.jsx(m1,{title:"Monetization Opportunity",subtitle:`Based on ${e.days}-day usage data from free-tier users`}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsx(K0,{label:"Active free users",value:t.totalFreeActive.toLocaleString(),sub:`${rd(t.totalFreeRequests)} requests`}),r.jsx(K0,{label:"Exceed free limit",value:t.exceedFreeLimit.toLocaleString(),sub:`${t.devTierFit} Dev + ${t.proTierFit} Pro fit`}),r.jsx(K0,{label:"Potential MRR",value:t.potentialMrrFormatted,sub:t.calculation}),r.jsx(K0,{label:"Total free requests",value:rd(t.totalFreeRequests),sub:`${e.days}-day period`})]}),e.cicdDependents.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs font-medium text-[var(--color-fg-muted)] uppercase tracking-wide mb-2",children:"CI/CD Dependency Detector"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] mb-2",children:"Users with automated, consistent daily request patterns - enterprise SLA candidates"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm text-left",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-xs text-[var(--color-fg-muted)] border-b border-[var(--color-border-default)]",children:[r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Email"}),r.jsx("th",{className:"py-2 pr-4 font-medium",children:"Tier"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Avg Daily"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Active Days"}),r.jsx("th",{className:"py-2 pr-4 font-medium text-right",children:"Hour Spread"}),r.jsx("th",{className:"py-2 font-medium",children:"Pattern"})]})}),r.jsx("tbody",{children:e.cicdDependents.map((s,n)=>{var a;return r.jsxs("tr",{className:"border-b border-[var(--color-border-default)]/50 text-[var(--color-fg-secondary)]",children:[r.jsx("td",{className:"py-2 pr-4 text-[var(--color-fg-default)]",children:s.email||"-"}),r.jsx("td",{className:"py-2 pr-4 text-xs uppercase",children:s.subscription_tier||"free"}),r.jsx("td",{className:"py-2 pr-4 text-right font-medium",children:(a=s.avg_daily)==null?void 0:a.toLocaleStr
6068ing()}),r.jsx("td",{className:"py-2 pr-4 text-right",children:s.active_days}),r.jsx("td",{className:"py-2 pr-4 text-right",children:s.avg_hour_spread}),r.jsx("td",{className:"py-2",children:r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${s.pattern_type==="likely_cicd"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"}`,children:s.pattern_type==="likely_cicd"?"Likely CI/CD":"Possible CI/CD"})})]},s.user_id??n)})})]})})]})]})}function bMe({data:e}){return e?r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-4 space-y-4`,children:[r.jsx(m1,{title:"Enhanced Conversion Funnel",subtitle:`Median time between steps (${e.period} period, ${e.totalUsers} users)`}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:e.steps.map((t,s)=>{const n=s>0?e.steps[s-1].count:t.count,a=n>0&&s>0?Math.round((n-t.count)/n*100):0;return r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-1",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:t.label}),r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:t.count.toLocaleString()}),a>0&&r.jsxs("p",{className:"text-xs text-rose-400",children:["â",a,"% drop"]}),t.medianHours!=null&&r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:["Median: ",Wj(t.medianHours)]}),t.fastestHours!=null&&r.jsxs("p",{className:"text-xs text-emerald-400",children:["Fastest: ",Wj(t.fastestHours)]})]},t.name)})})]}):null}function yMe(){const{getToken:e}=zt(),[t,s]=x.useState(7),[n,a]=x.useState(!0),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(null),[h,g]=x.useState(null),[v,y]=x.useState(null),_=x.useCallback(async(w=!1)=>{w?i(!0):a(!0);try{const k=await Ue(e);if(!k)return;const[S,E,T,A]=await Promise.allSettled([ue.get(`/admin/traffic/decomposition?days=${t}`,{authToken:k}),ue.get(`/admin/traffic/intent-signals?days=${t}`,{authToken:k}),ue.get(`/admin/traffic/monetization?days=${t}`,{authToken:k}),ue.get(`/admin/traffic/funnel-enhanced?period=${t}d`,{authToken:k})]);if(S.status==="fulfilled"){const R=S.value.data;R.otherPaths=R.otherPaths||[],R.segments&&(R.segments.other=R.segments.other??0),c(R)}E.status==="fulfilled"&&f(E.value.data),T.status==="fulfilled"&&g(T.value.data),A.status==="fulfilled"&&y(A.value.data)}catch(k){console.error("Traffic intel load error:",k)}finally{a(!1),i(!1)}},[t,e]);x.useEffect(()=>{_()},[_]);const j=[7,14,30];return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs uppercase text-[var(--color-fg-muted)]",children:"Admin"}),r.jsx("h1",{className:"text-2xl font-semibold text-[var(--color-fg-default)]",children:"Traffic Intelligence"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"Who is using ReqRes, what they're doing, and when they're ready to pay."})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex items-center gap-1",children:j.map(w=>r.jsxs(ht,{variant:t===w?"primary":"secondary",size:"sm",onClick:()=>s(w),children:[w,"d"]},w))}),r.jsx(ht,{onClick:()=>_(!0),disabled:o,children:o?"Refreshing...":"Refresh"}),r.jsx(ht,{variant:"secondary",size:"sm",disabled:!l&&!u&&!h&&!v,onClick:()=>{const w=hMe(l,u,h,v);mMe(w,t)},children:"Download CSV"}),r.jsx("a",{href:"/admin",className:"text-xs text-indigo-400 hover:text-indigo-300 underline ml-2",children:"Back to Dashboard"})]})]}),n&&!l?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(bs,{})}):r.jsxs(r.Fragment,{children:[r.jsx(gMe,{data:l}),r.jsx(xMe,{data:u}),r.jsx(vMe,{data:h}),r.jsx(bMe,{data:v})]})]})}function IY(e){const n=e.split("@")[0].split(/[._-]/)[0];return n&&n.length>2&&!/^\d+$/.test(n)?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():"there"}function _Me(e){const s=(e.split("@")[1]||"").split(".")[0];return s.charAt(0).toUpperCase()+s.slice(1)}function jMe(e){return!e||e.length===0?"something interesting":e.join(", ")}function wMe(e){var n;const t=IY(e.email),s=e.signals||[];if(s.includes("educator")||e.persona_role==="educator")return{id:"educator",subject:"ReqRes Classrooms - built for instructors like you",body:`Hi${t!=="there"?` ${t}`:""}, 6069 6070I'm Ben, the creator of ReqRes. I noticed you signed up as an educator. 6071 6072We just launched Classrooms - per-student API keys, exercise templates, an instructor dashboard showing who's active and who's stuck. Designed for exactly your use case. 6073 6074Happy to set you up with a free Classroom account if you want to try it with your next cohort. 6075 6076Ben 6077reqres.in/for/educators`};if(s.includes("rate_limit_approacher"))return{id:"rate_limit",subject:"Noticed you're hitting the ReqRes free tier limits",body:`Hi${t!=="there"?` ${t}`:""}, 6078 6079I'm Ben, I built ReqRes. Your usage is getting close to the free tier daily limit - looks like you're building something real. 6080 6081If you need higher limits, the Dev plan is $12/month (and we have regional pricing if you're outside the US/EU). Happy to answer any questions. 6082 6083Ben`};if(s.includes("domain_collection")&&((n=e.collection_names)!=null&&n.length))return{id:"real_builder",subject:"Saw what you're building on ReqRes",body:`Hi${t!=="there"?` ${t}`:""}, 6084 6085I'm Ben, I built ReqRes. I noticed you created a ${jMe(e.collection_names)} backend - looks like you're building something real. 6086 6087How's it going? Anything missing or rough that I could help with? 6088 6089Ben`};if(s.includes("company_email")){const a=_Me(e.email);return{id:"company_email",subject:"Quick question about your ReqRes usage",body:`Hi${t!=="there"?` ${t}`:""}, 6090 6091I'm Ben, the founder of ReqRes. I noticed you signed up with a ${a} email - just curious what you're using it for? 6092 6093If you're evaluating it for a team, happy to walk you through the team features or set up a quick call. 6094 6095Ben`}}return{id:"active_user",subject:"Quick question about your ReqRes usage",body:`Hi${t!=="there"?` ${t}`:""}, 6096 6097I'm Ben, the founder of ReqRes. I noticed you've been actively using the API${e.request_count_7d?` (${e.request_count_7d} requests this week)`:""} - just curious what you're building? 6098 6099Happy to help with anything or answer questions about the paid plans if you need more capacity. 6100 6101Ben`}}function NMe(e){const t=IY(e.email);return{id:"churn_prevention",subject:"Everything okay with ReqRes?",body:`Hi${t!=="there"?` ${t}`:""}, 6102 6103I'm Ben - I noticed your ReqRes usage has dropped off recently. Just wanted to check in. 6104 6105Is there something that's not working, or did your needs change? Either way, no pressure - I just want to make sure you're getting value from the subscription. 6106 6107Happy to hop on a quick call if that's easier. 6108 6109Ben`}}function kMe(e){return{id:"university_cluster",subject:"Are you teaching with ReqRes?",body:`Hi, 6110 6111I'm Ben, the creator of ReqRes. I noticed several signups from ${e}
6111 recently - are you running a class that uses it? 6112 6113We just launched Classrooms, which gives each student their own API key with isolated data, plus an instructor dashboard. Designed specifically for teaching REST APIs without setup hassles. 6114 6115Happy to set up a free classroom for your course. 6116 6117Ben 6118reqres.in/for/educators`}}function SMe(e){return{id:"youtube_creator",subject:"Partnership opportunity - ReqRes Classrooms",body:`Hi ${e}, 6119 6120I'm Ben, the creator of ReqRes. I've seen your tutorials using it - they're great, and they send a lot of students our way. 6121 6122We just launched ReqRes Classrooms, which gives each of your students their own API key with isolated data, plus exercise templates and an instructor dashboard. 6123 6124Would love to set you up with a free Classroom Pro account ($99/month value) - no strings attached. If you find it useful, feel free to mention it in a future video. If not, keep using it free. 6125 6126Let me know and I'll get you set up. 6127 6128Ben 6129reqres.in/for/educators`}}function g1(e){return navigator.clipboard.writeText(e)}const bU={not_contacted:"bg-gray-500/20 text-gray-400",emailed:"bg-blue-500/20 text-blue-400",replied:"bg-green-500/20 text-green-400",converted:"bg-emerald-500/20 text-emerald-300",not_interested:"bg-red-500/20 text-red-400"},CMe={company_email:"Company Email",domain_collection:"Real Builder",request_surge:"10+ Requests",educator:"Educator",rate_limit_approacher:"Near Limit"};function sp(e){return e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"-"}function EMe(e){return Math.floor((Date.now()-new Date(e).getTime())/864e5)}function sn({label:e,value:t,sub:s}){return r.jsxs("div",{className:Mt.dark,children:[r.jsx("div",{className:"text-[11px] text-[var(--color-fg-muted)] uppercase tracking-wider",children:e}),r.jsx("div",{className:"text-2xl font-bold text-[var(--color-fg-default)] mt-1",children:t}),s&&r.jsx("div",{className:"text-[11px] text-[var(--color-fg-secondary)] mt-0.5",children:s})]})}function MY({status:e}){return r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${bU[e]||bU.not_contacted}`,children:e.replace("_"," ")})}function TMe({signal:e}){return r.jsx("span",{className:hi.tag,children:CMe[e]||e})}function RMe({authToken:e}){const[t,s]=x.useState(""),[n,a]=x.useState(null),[o,i]=x.useState(!1),[l,c]=x.useState(""),u=x.useCallback(async()=>{if(!(!t.trim()||!e)){i(!0),c("");try{const f=await ue.get(`/admin/outreach/users/lookup?email=${encodeURIComponent(t.trim())}`,{authToken:e});a(f.data)}catch(f){c(f.status===404?"User not found":"Lookup failed"),a(null)}finally{i(!1)}}},[t,e]);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Is,{value:t,onChange:f=>s(f.target.value),placeholder:"Search by email address...",className:"flex-1",onKeyDown:f=>f.key==="Enter"&&u()}),r.jsx(ht,{onClick:u,disabled:o||!t.trim(),className:Jt.primary,children:o?"Looking up...":"Look up"})]}),l&&r.jsx("div",{className:"text-red-400 text-sm",children:l}),n&&r.jsxs("div",{className:`${Mt.dark} space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-[var(--color-fg-default)]",children:n.user.email}),r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["Signed up ",sp(n.user.created_at)," (",EMe(n.user.created_at),"d ago) · ",n.user.subscription_tier]})]}),r.jsx("div",{className:"flex gap-2",children:n.user.stripe_url&&r.jsx("a",{href:n.user.stripe_url,target:"_blank",rel:"noopener noreferrer",className:Jt.secondary,children:"Stripe"})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase",children:"Persona"}),r.jsx("div",{className:"text-sm text-[var(--color-fg-default)]",children:n.user.persona_role||"-"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase",children:"Goal"}),r.jsx("div",{className:"text-sm text-[var(--color-fg-default)]",children:n.user.persona_goal||"-"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase",children:"Requests (7d / total)"}),r.jsxs("div",{className:"text-sm text-[var(--color-fg-default)]",children:[n.request_count_7d," / ",n.request_count_total]})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase",children:"AI Generations"}),r.jsx("div",{className:"text-sm text-[var(--color-fg-default)]",children:n.ai_generation_count})]})]}),n.projects.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase mb-1",children:["Projects (",n.projects.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:n.projects.map(f=>r.jsx("span",{className:hi.tag,children:f.name},f.id))})]}),n.collections.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase mb-1",children:["Collections (",n.collections.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:n.collections.map(f=>r.jsxs("span",{className:hi.tag,children:[f.name," (",f.record_count," records)"]},f.id))})]}),n.outreach_history.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase mb-1",children:"Outreach History"}),r.jsx("div",{className:"space-y-1",children:n.outreach_history.map(f=>r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-secondary)]",children:[sp(f.created_at)," - ",f.status,f.template_used?` (${f.template_used}
6129)`:"",f.notes?` · ${f.notes}`:""]},f.id))})]})]})]})}function AMe({authToken:e}){const[t,s]=x.useState([]),[n,a]=x.useState(!0),[o,i]=x.useState(null),[l,c]=x.useState(null),[u,f]=x.useState(null);x.useEffect(()=>{e&&ue.get("/admin/outreach/hot-leads?period=30",{authToken:e}).then(y=>s(y.data.leads||[])).catch(()=>{}).finally(()=>a(!1))},[e]);const h=async y=>{const _=wMe({email:y.email,persona_role:y.persona_role,persona_goal:y.persona_goal,collection_names:y.collection_names,request_count_7d:y.request_count_7d,peak_daily_requests:y.peak_daily_requests,email_domain:y.email_domain,signals:y.signals});await g1(`Subject: ${_.subject} 6130 6131${_.body}`),i(y.id),setTimeout(()=>i(null),2e3)},g=async y=>{if(e)try{await ue.post("/admin/outreach/log",{authToken:e,body:JSON.stringify({user_id:y.id,status:"emailed"}),headers:{"Content-Type":"application/json"}}),s(_=>_.map(j=>j.id===y.id?{...j,outreach_status:"emailed"}:j))}catch{}},v=async y=>{if(l===y.id){c(null),f(null);return}if(c(y.id),!!e)try{const _=await ue.get(`/admin/outreach/users/lookup?email=${encodeURIComponent(y.email)}`,{authToken:e});f(_.data)}catch{f(null)}};return n?r.jsx(bs,{}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:[t.length," leads found"]}),t.map(y=>r.jsxs("div",{className:Mt.dark,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm text-[var(--color-fg-default)] truncate",children:y.email}),r.jsx(MY,{status:y.outreach_status})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[y.signals.map(_=>r.jsx(TMe,{signal:_},_)),y.persona_role&&r.jsx("span",{className:"text-[10px] text-[var(--color-fg-muted)]",children:y.persona_role}),y.persona_goal&&r.jsxs("span",{className:"text-[10px] text-[var(--color-fg-muted)]",children:["· ",y.persona_goal]})]}),y.collection_names.length>0&&r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-secondary)] mt-1",children:["Collections: ",y.collection_names.join(", ")]}),r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-muted)] mt-0.5",children:["Signed up ",sp(y.created_at),y.request_count_7d?` · ${y.request_count_7d} requests (7d)`:"",y.peak_daily_requests?` · Peak: ${y.peak_daily_requests}/day`:""]})]}),r.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[r.jsx("button",{onClick:()=>h(y),className:Jt.primary,children:o===y.id?"Copied!":"Draft email"}),y.outreach_status==="not_contacted"&&r.jsx("button",{onClick:()=>g(y),className:Jt.secondary,children:"Mark contacted"}),r.jsx("button",{onClick:()=>v(y),className:Jt.secondary,children:l===y.id?"Close":"Profile"})]})]}),l===y.id&&u&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--color-border-default)]",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-[11px]",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Requests (7d/total): "}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:[u.request_count_7d," / ",u.request_count_total]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Projects: "}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:u.projects.length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"Collections: "}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:u.collections.length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"AI Gens: "}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:u.ai_generation_count})]})]}),u.collections.length>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:u.collections.map(_=>r.jsxs("span",{className:hi.tag,children:[_.name," (",_.record_count,")"]},_.id))}),u.user.stripe_url&&r.jsx("a",{href:u.user.stripe_url,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-indigo-400 hover:text-indigo-300 mt-2 inline-block",children:"Open in Stripe"})]})]},y.id))]})}function PMe({authToken:e}){const[t,s]=x.useState([]),[n,a]=x.useState([]),[o,i]=x.useState([]),[l,c]=x.useState(!0),[u,f]=x.use
6131State(null);x.useEffect(()=>{e&&ue.get("/admin/outreach/classroom-prospects?period=30",{authToken:e}).then(g=>{const v=g.data;s(v.educators||[]),a(v.domainClusters||[]),i(v.classroomCreators||[])}).catch(()=>{}).finally(()=>c(!1))},[e]);const h=async g=>{const v=kMe(g);await g1(`Subject: ${v.subject} 6132 6133${v.body}`),f(g),setTimeout(()=>f(null),2e3)};return l?r.jsx(bs,{}):r.jsxs("div",{className:"space-y-6",children:[n.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:"University Domain Clusters"}),n.map(g=>r.jsxs("div",{className:`${Mt.dark} mb-2`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-sm text-[var(--color-fg-default)]",children:g.domain}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)] ml-2",children:[g.signup_count," signups"]})]}),r.jsx("button",{onClick:()=>h(g.domain),className:Jt.primary,children:u===g.domain?"Copied!":"Draft email"})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[g.users.slice(0,5).map(v=>r.jsx("span",{className:hi.tag,children:v.email},v.id)),g.users.length>5&&r.jsxs("span",{className:"text-[10px] text-[var(--color-fg-muted)]",children:["+",g.users.length-5," more"]})]})]},g.domain))]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:["Self-identified Educators (",t.length,")"]}),t.map(g=>r.jsx("div",{className:`${Mt.dark} mb-2 flex items-center justify-between`,children:r.jsxs("div",{children:[r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:g.email}),r.jsx("span",{className:"text-[10px] text-[var(--color-fg-muted)] ml-2",children:sp(g.created_at)}),g.outreach_status&&r.jsx(MY,{status:g.outreach_status})]})},g.id))]}),o.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:["Classroom Creators (",o.length,")"]}),o.map(g=>r.jsx("div",{className:`${Mt.dark} mb-2 flex items-center justify-between`,children:r.jsxs("div",{children:[r.jsx("span",{className:"text-sm text-[var(--color-fg-default)]",children:g.email}),g.classroom_name&&r.jsxs("span",{className:"text-[10px] text-[var(--color-fg-muted)] ml-2",children:["Classroom: ",g.classroom_name]})]})},g.id))]})]})}function IMe({authToken:e}){const[t,s]=x.useState(null),[n,a]=x.useState(!0),[o,i]=x.useState(null);x.useEffect(()=>{e&&ue.get("/admin/outreach/churn-watch",{authToken:e}).then(u=>s(u.data)).catch(()=>{}).finally(()=>a(!1))},[e]);const l=async u=>{const f=NMe({email:u.email,subscription_tier:u.subscription_tier,previous_7d_requests:u.previous_7d_requests,current_7d_requests:u.current_7d_requests});await g1(`Subject: ${f.subject} 6134 6135${f.body}`),i(u.id),setTimeout(()=>i(null),2e3)};if(n)return r.jsx(bs,{});if(!t)return r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Failed to load churn data"});const c=(u,f)=>r.jsx("div",{className:`${Mt.dark} mb-2`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-[var(--color-fg-default)] truncate",children:u.email}),r.jsx("span",{className:hi.tag,children:u.subscription_tier})]}),r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-muted)] mt-0.5",children:["Subscribed ",sp(u.created_at),u.last_active?` · Last active: ${sp(u.last_active)}`:"",u.lifetime_requests!==void 0?` · ${u.lifetime_requests} lifetime requests`:"",f?` · ${f}`:""]})]}),r.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[r.jsx("button",{onClick:()=>l(u),className:Jt.primary,children:o===u.id?"Copied!":"Retention email"}),u.stripe_customer_id&&r.jsx("a",{href:`https://dashboard.stripe.com/customers/${u.stripe_customer_id}`,target:"_blank",rel:"noopener noreferrer",className:Jt.secondary,children:"Stripe"})]})]})},u.id);return r.jsxs("div",{className:"space-y-6",children:[t.inactivePaid.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-red-400 mb-2",children:["Inactive Paid Users (0 requests in 14d) - ",t.inactivePaid.length]}),t.inactivePaid.map(u=>c(u))]}),t.volumeDrop.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-amber-400 mb-2",children:["Volume Drop (",">","50% decrease) - ",t.volumeDrop.length]}),t.volumeDrop.map(u=>c(u,`${u.previous_7d_requests} â ${u.current_7d_requests} requests (-${u.drop_pct}%)`))]}),t.noCollectionPaid.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-amber-400 mb-2",children:["Paid Users with No Collections - ",t.noCollectionPaid.length]}),t.noCollectionPaid.map(u=>c(u))]}),t.trialExpiring.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-amber-400 mb-2",children:["Trial Expiring in 3 Days - ",t.trialExpiring.length]}),t.trialExpiring.map(u=>c(u,u.trial_expires_at?`Expires: ${sp(u.trial_expires_at)}`:void 0))]}),t.inactivePaid.length===0&&t.volumeDrop.length===0&&t.noCollectionPaid.length===0&&t.trialExpiring.length===0&&r.jsx("div",{className:"text-center text-[var(--color-fg-muted)] py-8",children:"No churn risks detected right now."})]})}function MMe({authToken:e}){const[t,s]=x.useState([]),[n,a]=x.useState(!0),[o,i]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.use
6135State({channel_name:"",channel_url:"",subscribers:"",reqres_video_count:"",total_views:"",referral_code:""});x.useEffect(()=>{e&&ue.get("/admin/outreach/youtube-creators",{authToken:e}).then(v=>{var y;return s(((y=v.data)==null?void 0:y.data)||[])}).catch(()=>{}).finally(()=>a(!1))},[e]);const h=async v=>{const y=SMe(v.channel_name);await g1(`Subject: ${y.subject} 6136 6137${y.body}`),i(v.id),setTimeout(()=>i(null),2e3)},g=async()=>{var v;if(!(!e||!u.channel_name))try{await ue.post("/admin/outreach/youtube-creators",{authToken:e,body:JSON.stringify({channel_name:u.channel_name,channel_url:u.channel_url||null,subscribers:u.subscribers||null,reqres_video_count:parseInt(u.reqres_video_count)||0,total_views:parseInt(u.total_views)||0,referral_code:u.referral_code||null}),headers:{"Content-Type":"application/json"}});const y=await ue.get("/admin/outreach/youtube-creators",{authToken:e});s(((v=y.data)==null?void 0:v.data)||[]),c(!1),f({channel_name:"",channel_url:"",subscribers:"",reqres_video_count:"",total_views:"",referral_code:""})}catch{}};return n?r.jsx(bs,{}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"text-[11px] text-[var(--color-fg-muted)]",children:[t.length," creators tracked"]}),r.jsx("button",{onClick:()=>c(!l),className:Jt.primary,children:l?"Cancel":"Add Creator"})]}),l&&r.jsxs("div",{className:`${Mt.dark} space-y-3`,children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Is,{value:u.channel_name,onChange:v=>f({...u,channel_name:v.target.value}),placeholder:"Channel name *"}),r.jsx(Is,{value:u.channel_url,onChange:v=>f({...u,channel_url:v.target.value}),placeholder:"Channel URL"}),r.jsx(Is,{value:u.subscribers,onChange:v=>f({...u,subscribers:v.target.value}),placeholder:"Subscribers (e.g. 500K)"}),r.jsx(Is,{value:u.reqres_video_count,onChange:v=>f({...u,reqres_video_count:v.target.value}),placeholder:"# ReqRes videos"}),r.jsx(Is,{value:u.total_views,onChange:v=>f({...u,total_views:v.target.value}),placeholder:"Total views"}),r.jsx(Is,{value:u.referral_code,onChange:v=>f({...u,referral_code:v.target.value}),placeholder:"Referral code (e.g. raghav)"})]}),r.jsx("button",{onClick:g,className:Jt.primary,disabled:!u.channel_name,children:"Save"})]}),t.map(v=>{var y;return r.jsx("div",{className:Mt.dark,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm text-[var(--color-fg-default)]",children:v.channel_name}),v.subscribers&&r.jsxs("span",{className:hi.tag,children:[v.subscribers," subs"]}),r.jsx("span",{className:hi.tag,children:v.status})]}),r.jsxs("div",{className:"text-[10px] text-[var(--color-fg-muted)] mt-0.5",children:[v.reqres_video_count," videos · ",(y=v.total_views)==null?void 0:y.toLocaleString()," total views",v.referral_code?` · ref: ${v.referral_code} (${v.signups_from_referral} signups)`:""]})]}),r.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[r.jsx("button",{onClick:()=>h(v),className:Jt.primary,children:o===v.id?"Copied!":"Draft DM"}),v.channel_url&&r.jsx("a",{href:v.channel_url,target:"_blank",rel:"noopener noreferrer",className:Jt.secondary,children:"Channel"})]})]})},v.id)})]})}function OMe({authToken:e}){const[t,s]=x.useState(null),[n,a]=x.useState(!0);return x.useEffect(()=>{e&&ue.get("/admin/outreach/audience-snapshot",{authToken:e}).then(o=>s(o.data)).catch(()=>{}).finally(()=>a(!1))},[e]),n?r.jsx(bs,{}):t?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Last 30 Days"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsx(sn,{label:"Signups",value:t.signups.toLocaleString()}),r.jsx(sn,{label:"Completed Onboarding",value:t.onboarded.toLocaleString(),sub:`${t.onboarding_rate}%`}),r.jsx(sn,{label:"Company Emails",value:t.company_email_signups}),r.jsx(sn,{label:"Churned",value:t.churned_30d})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Active Users (7d)"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[r.jsx(sn,{label:"Made Requests",value:t.active_users_7d}),r.jsx(sn,{label:"10+ Requests",value:t.active_10plus_7d}),r.jsx(sn,{label:"New Domain Collections",value:t.new_domain_collections_7d})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:Mt.dark,children:[r.jsx("h4",{className:"text-[11px] text-[var(--color-fg-muted)] uppercase mb-2",children:"Top Personas"}),t.top_personas.map(o=>r.jsxs("div",{className:"flex justify-between text-sm text-[var(--color-fg-default)] py-0.5",children:[r.jsx("span",{children:o.persona_role}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:o.cnt})]},o.persona_role))]}),r.jsxs("div",{className:Mt.dark,children:[r.jsx("h4",{className:"text-[11px] text-[var(--color-fg-muted)] uppercase mb-2",children:"Top Goals"}),t.top_goals.map(o=>r.jsxs("div",{className:"flex justify-between text-sm text-[var(--color-fg-default)] py-0.5",children:[r.jsx("span",{children:o.persona_goal}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:o.cnt})]},o.persona_goal))]})]})]}):r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Failed to load"})}function LMe({authToken:e}){const[t,s]=x.useState(null),[n,a]=x.useState(!0);if(x.useEffect(()=>{e&&ue.get("/admin/outreach/metrics-that-matter",{authToken:e}).then(i=>s(i.data)).catch(()=>{}).finally(()=>a(!1))},[e]),n)return r.jsx(bs,{});if(!t)return r.jsx("div",{className:"text-[var(--color-fg-muted)]",children:"Failed to load"});const o=t.revenue.target_mrr>0?Math.round(t.revenue.mrr/t.revenue.target_mrr*100*10)/10:0;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Revenue"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsx(sn,{label:"MRR",value:`$${t.revenue.mrr}`,sub:`${o}
6137% of $${t.revenue.target_mrr.toLocaleString()} target`}),r.jsx(sn,{label:"Subscribers",value:t.revenue.subscribers,sub:`Target: ${t.revenue.target_subscribers}`})]}),t.revenue.breakdown.length>0&&r.jsxs("div",{className:`${Mt.dark} mt-3`,children:[r.jsx("div",{className:"text-[10px] text-[var(--color-fg-muted)] uppercase mb-2",children:"Breakdown"}),t.revenue.breakdown.map(i=>r.jsxs("div",{className:"flex justify-between text-sm text-[var(--color-fg-default)] py-0.5",children:[r.jsx("span",{children:i.subscription_tier}),r.jsxs("span",{className:"text-[var(--color-fg-muted)]",children:[i.cnt," x $",i.unit_price," = $",i.cnt*i.unit_price,"/mo"]})]},i.subscription_tier))]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Activation (30d)"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[r.jsx(sn,{label:"Collections 3+ Records",value:t.activation.collections_3plus_records}),r.jsx(sn,{label:"Users 10+ Requests",value:t.activation.users_10plus_requests}),r.jsx(sn,{label:"Domain Collections",value:t.activation.domain_collections})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Pipeline (This Month)"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[r.jsx(sn,{label:"Company Signups",value:t.pipeline.company_signups}),r.jsx(sn,{label:"Educator Signups",value:t.pipeline.educator_signups}),r.jsx(sn,{label:"Contacted",value:t.pipeline.contacted}),r.jsx(sn,{label:"Replied",value:t.pipeline.replied}),r.jsx(sn,{label:"Converted",value:t.pipeline.converted})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-3",children:"Retention"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsx(sn,{label:"7d Retention",value:`${t.retention.retention_rate_7d}%`,sub:`${t.retention.retained} of ${t.retention.active_7d_ago}`}),r.jsx(sn,{label:"Paid Churn (30d)",value:t.retention.paid_churn_30d}),r.jsx(sn,{label:"Zero-Request Paid",value:t.retention.zero_request_paid,sub:"Danger zone"})]})]})]})}const DMe=[{id:"hot-leads",label:"Hot Leads"},{id:"classroom",label:"Classrooms"},{id:"churn",label:"Churn Watch"},{id:"youtube",label:"YouTube"},{id:"audience",label:"Audience"},{id:"metrics",label:"Metrics"}];function $Me(){const{getToken:e}=zt(),[t,s]=x.useState(null),[n,a]=x.useState("hot-leads"),[o,i]=x.useState(null);return x.useEffect(()=>{Ue(e).then(l=>s(l??null))},[e]),x.useEffect(()=>{t&&ue.get("/admin/outreach/stats",{authToken:t}).then(l=>i(l.data)).catch(()=>{})},[t]),r.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h1",{className:"text-xl font-bold text-[var(--color-fg-default)]",children:"Outreach Command Centre"}),r.jsx("a",{href:"/admin",className:"text-[11px] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]",children:"Back to Dashboard"})]}),o&&r.jsxs("div",{className:`${Mt.dark} flex flex-wrap items-center gap-4 text-sm`,children:[r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"This month:"}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:[o.emailed," contacted"]}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:[o.replied," replied"]}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:[o.converted," converted"]}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:"|"}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:["Reply rate: ",o.reply_rate,"%"]}),r.jsxs("span",{className:"text-[var(--color-fg-default)]",children:["Conversion rate: ",o.conversion_rate,"%"]})]}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-sm font-medium text-[var(--color-fg-default)] mb-2",children:"User Lookup"}),r.jsx(RMe,{authToken:t})]}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-1 border-b border-[var(--color-border-default)] mb-4 overflow-x-auto",children:DMe.map(l=>r.jsx("button",{onClick:()=>a(l.id),className:`px-3 py-2 text-sm font-medium border-b-2 transition whitespace-nowrap ${n===l.id?"border-indigo-500 text-indigo-400":"border-transparent text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)]"}`,children:l.label},l.id))}),n==="hot-leads"&&r.jsx(AMe,{authToken:t}),n==="classroom"&&r.jsx(PMe,{authToken:t}),n==="churn"&&r.jsx(IMe,{authToken:t}),n==="youtube"&&r.jsx(MMe,{authToken:t}),n==="audience"&&r.jsx(OMe,{authToken:t}),n==="metrics"&&r.jsx(LMe,{authToken:t})]})]})}db.register(Hj,Vj,C_,md,Hx,CY,TY,kY,$3e);function X2({label:e,value:t,hint:s}){return r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsx("p",{className:"text-[var(--color-fg-muted)] text-xs uppercase tracking-wide",children:e}),r.jsx("p",{className:"text-xl sm:text-2xl font-semibold text-[var(--color-fg-default)]",children:t}),s&&r.jsx("p",{className:"text-xs text-[var(--color-fg-default)]0 mt-1",children:s})]})}function yU(e,t="usd"){const s=t.toUpperCase(),n=s==="GBP"?"en-GB":"en-US";return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:0}).format(e/100)}function UMe({data:e}){if(!e)return r.jsx("div",{className:`${Mt.dark} p-5 border border-[var(--color-border-default)]`,children:r.jsx("p",{className:"text-[var(--color-fg-default)]0 text-sm",children:"Loading revenue data..."})});const t=e.currency||"usd",s={dev:"bg-sky-500",pro:"bg-emerald-500",premium:"bg-violet-500",team
6137:"bg-amber-500",scale:"bg-rose-500",enterprise:"bg-indigo-500","legacy-pro":"bg-slate-500","legacy-premium":"bg-slate-400"},n=Object.entries(e.planDistribution).sort((o,i)=>i[1]-o[1]),a=n.reduce((o,[,i])=>o+i,0);return r.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-emerald-500/20 p-4 sm:p-5",children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-2 -top-1 w-28 h-18 opacity-[0.12]",viewBox:"0 0 240 120",fill:"none",children:[r.jsx("polygon",{points:"50,100 70,90 70,55 50,65",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"50,65 70,55 90,65 70,75",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"90,100 110,90 110,30 90,40",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"90,40 110,30 130,40 110,50",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"130,100 150,90 150,50 130,60",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"130,60 150,50 170,60 150,70",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"170,100 190,90 190,20 170,30",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"170,30 190,20 210,30 190,40",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"30",y1:"110",x2:"220",y2:"70",stroke:"#d4d4c8",strokeWidth:.75,opacity:"0.4"})]}),r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-2xl",children:"ð°"}),r.jsx("h2",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:"Revenue"})]}),r.jsx("span",{className:"text-xs text-[var(--color-semantic-success)] font-medium px-2 py-1 bg-[var(--color-semantic-success)]/10 rounded-full",children:"Live"})]}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("p",{className:"text-3xl sm:text-4xl font-bold text-[var(--color-semantic-success)] tracking-tight",children:[yU(e.mrr,t),r.jsx("span",{className:"text-lg text-[var(--color-fg-muted)] font-normal",children:"/mo"})]}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:[yU(e.arr,t)," ARR"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-5",children:[r.jsxs("div",{className:"bg-[var(--color-bg-alt)] rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] uppercase",children:"Active Paying"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:e.activePayingUsers})]}),r.jsxs("div",{className:"bg-[var(--color-bg-alt)] rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] uppercase",children:"New Today"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-semantic-success)]",children:e.newSubscriptionsToday>0?`+${e.newSubscriptionsToday}`:"0"})]}),r.jsxs("div",{className:"bg-[var(--color-bg-alt)] rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] uppercase",children:"New This Month"}),r.jsx("p",{className:"text-xl font-semibold text-[var(--color-fg-default)]",children:e.newSubscriptionsMonth>0?`+${e.newSubscriptionsMonth}`:"0"})]}),r.jsxs("div",{className:"bg-[var(--color-bg-alt)] rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] uppercase",children:"Churning (30d)"}),r.jsx("p",{className:`text-xl font-semibold ${e.churnedLast30Days>0?"text-[var(--color-semantic-danger)]":"text-[var(--color-fg-default)]"}`,children:e.churnedLast30Days})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)] uppercase mb-2",children:"Plan Distribution"}),r.jsx("div",{className:"flex h-3 rounded-full overflow-hidden bg-[var(--color-bg-alt)] mb-2",children:n.map(([o,i])=>r.jsx("div",{className:`${s[o]||"bg-[var(--color-fg-muted)]"} transition-all`,style:{width:`${i/a*100}%`},title:`${o}: ${i} users`},o))}),r.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:n.map(([o,i])=>r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx("span",{className:`w-2 h-2 rounded-full ${s[o]||"bg-[var(--color-fg-muted)]"}`}),r.jsx("span",{className:"text-[var(--color-fg-secondary)] capitalize",children:o}),r.jsx("span",{className:"text-[var(--color-fg-muted)]",children:i})]},o))})]})]})}function FMe({data:e,period:t,onPeriodChange:s}){var l,c;if(!((l=e==null?void 0:e.stages)!=null&&l.length))return r.jsx("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:r.jsx("p",{className:"text-[var(--color-fg-default)]0 text-sm",children:"Loading funnel data..."})});const n=((c=e.stages[0])==null?void 0:c.count)||1;let a=-1,o=0;for(let u=1;u<e.stages.length;u++){const f=e.stages[u-1].count,h=e.stages[u].count;if(f>0){const g=(f-h)/f*100;g>o&&(o=g,a=u)}}const i=["7d","30d","90d","all"];return r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:"Conversion Funnel"}),r.jsx("div",{className:"flex gap-1 shrink-0",children:i.map(u=>r.jsx("button",{onClick:()=>s(u),className:`px-2 py-1 text-xs rounded ${t===u?"bg-[var(--color-bg-active)] text-[var(--color-fg-default)]":"bg-[var(--color-bg-hover)]/50 text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-active)]/50"}`,children:u},u))})]}),r.jsx("div",{className:"space-y-3",children:e.stages.map((u,f)=>{const h=n>0?u.count/n*100:0,g=f===a,v=f>0?e.stages[f-1].count:u.count,y=v>0&&f>0?Math.round((v-u.count)/v*100):0,j=["bg-slate-600","bg-slate-500","bg-teal-600","bg-teal-500","bg-emerald-500","bg-emerald-400"][f]||"bg-emerald-400";return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-baseline text-xs gap-0.5",children:[r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:u.label}),r.jsxs("div",{className:"flex items-baseline gap-2 sm:gap-3",children:[r.jsxs("span",{className:"text-[var(--color-fg-default)] font-medium",children:[u.count.toLocaleStr
6137ing(),r.jsxs("span",{className:"text-[var(--color-fg-default)]0 font-normal ml-1",children:["(",u.pct,"%)"]})]}),y>0&&r.jsxs("span",{className:`${g?"text-amber-400 font-medium":"text-rose-400/70"}`,children:["â",y,"%"]})]})]}),r.jsx("div",{className:"h-6 bg-[var(--color-bg-hover)] rounded overflow-hidden",children:r.jsx("div",{className:`h-full rounded transition-all ${j} ${g?"ring-2 ring-amber-400 ring-inset":""}`,style:{width:`${Math.max(h,2)}%`}})})]},u.name)})})]})}function BMe({data:e,days:t,onDaysChange:s}){var g,v,y,_;const[n,a]=x.useState("signups");if(!((g=e==null?void 0:e.data)!=null&&g.length))return r.jsx("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:r.jsx("p",{className:"text-[var(--color-fg-default)]0 text-sm",children:"Loading trend data..."})});const o=[{key:"signups",label:"Signups",color:"rgb(99, 102, 241)"},{key:"conversions",label:"Conversions",color:"rgb(16, 185, 129)"},{key:"projects",label:"Projects",color:"rgb(245, 158, 11)"},{key:"requests",label:"Requests",color:"rgb(236, 72, 153)"}],i=[7,14,30,60],l={labels:e.data.map(j=>new Date(j.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})),datasets:[{label:((v=o.find(j=>j.key===n))==null?void 0:v.label)||"Value",data:e.data.map(j=>j[n]),borderColor:((y=o.find(j=>j.key===n))==null?void 0:y.color)||"rgb(99, 102, 241)",backgroundColor:`${((_=o.find(j=>j.key===n))==null?void 0:_.color)||"rgb(99, 102, 241)"}20`,fill:!0,tension:.3,pointRadius:2,pointHoverRadius:5}]},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(15, 23, 42, 0.9)",titleColor:"#e2e8f0",bodyColor:"#e2e8f0",borderColor:"rgba(51, 65, 85, 0.5)",borderWidth:1}},scales:{x:{grid:{color:"rgba(51, 65, 85, 0.3)"},ticks:{color:"#64748b",maxTicksLimit:10}},y:{grid:{color:"rgba(51, 65, 85, 0.3)"},ticks:{color:"#64748b"},beginAtZero:!0}}},u=e.comparison[n],f=u.change>=0?"text-emerald-400":"text-rose-400",h=u.change>=0?"â":"â";return r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 flex-wrap gap-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:"Trends"}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-default)]0 mt-1",children:[u.current.toLocaleString()," this period vs ",u.previous.toLocaleString()," previous",r.jsxs("span",{className:`ml-2 ${f}`,children:[h,Math.abs(u.change),"%"]})]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsx("div",{className:"flex gap-1",children:o.map(j=>r.jsx("button",{onClick:()=>a(j.key),className:`px-2 py-1 text-xs rounded transition-colors ${n===j.key?"bg-[var(--color-bg-active)] text-[var(--color-fg-default)]":"bg-[var(--color-bg-hover)]/50 text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-active)]/50"}`,children:j.label},j.key))}),r.jsx("div",{className:"flex gap-1",children:i.map(j=>r.jsxs("button",{onClick:()=>s(j),className:`px-2 py-1 text-xs rounded transition-colors ${t===j?"bg-[var(--color-bg-active)] text-[var(--color-fg-default)]":"bg-[var(--color-bg-hover)]/50 text-[var(--color-fg-muted)] hover:bg-[var(--color-bg-active)]/50"}`,children:[j,"d"]},j))})]})]}),r.jsx("div",{className:"h-64",children:r.jsx(dMe,{data:l,options:c})})]})}function qMe({data:e}){var s;if(!((s=e==null?void 0:e.cohorts)!=null&&s.length))return r.jsxs("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide mb-3",children:"Weekly Cohorts"}),r.jsx("p",{className:"text-[var(--color-fg-default)]0 text-sm",children:"Loading cohort data..."})]});const t=n=>n>=50?"text-emerald-400":n>=25?"text-amber-400":"text-[var(--color-fg-muted)]";return r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:"Weekly Cohorts"}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-default)]0 mt-1",children:["Avg activation: ",e.averages.activatedPct,"% · Avg conversion: ",e.averages.convertedPct,"%"]})]})}),r.jsx("div",{className:"overflow-x-auto max-h-80",children:r.jsxs("table",{className:"w-full text-sm text-left min-w-[600px]",children:[r.jsx("thead",{className:"text-[var(--color-fg-muted)] sticky top-0 bg-[var(--color-bg-card)]/95 text-xs",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-2 pr-3",children:"Week"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Size"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Activated"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Collection"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"10+ Req"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Active 7d"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Converted"})]})}),r.jsx("tbody",{className:"divide-y divide-slate-800",children:e.cohorts.map(n=>r.jsxs("tr",{className:"text-[var(--color-fg-default)] text-xs",children:[r.jsx("td",{className:"py-2 pr-3",children:new Date(n.week).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),r.jsx("td",{className:"py-2 pr-3 text-right",children:n.cohortSize}),r.jsxs("td",{className:`py-2 pr-3 text-right ${t(n.activatedPct)}`,children:[n.activated," (",n.activatedPct,"%)"]}),r.jsxs("td",{className:`py-2 pr-3 text-right ${t(n.createdCollectionPct)}`,children:[n.createdCollection," (",n.createdCollectionPct,"%)"]}),r.jsxs("td",{className:`py-2 pr-3 text-right ${t(n.sent10RequestsPct)}`,children:[n.sent10Requests," (",n.sent10RequestsPct,"%)"]}),r.jsxs("td",{className:`py-2 pr-3 text-right ${t(n.activeLast7dPct)}`,children:[n.activeLast7d," (",n.activeLast7dPct,"%)"]}),r.jsxs("td",{className:`py-2 pr-3 text-right ${t(n.convertedPct)}`,children:[n.converted," (",n.convertedPct,"%)"]})]},n.week))})]})})]})}function zMe({alerts:e,dismissedIds:t,onDismiss:s,onResolve:n}){const a=e.filter(u=>!t.includes(u.id)),o={urgent:a.filter(u=>u.priority==="urgent"),high:a.filter(u=>u.priority==="high"),medium:a.filter(u=>u.priority==="medium"),low:a.filter(u=>u.priority==="low")},i={urgent:"border-rose-500/40 bg-rose-500/10 text-rose-400",high:"border-amber-500/40 bg-amber-500/10 text-amber-400",medium:"border-sky-500/40 bg-sky-500/10 text-sky-400",low:"border-[var(--color-border-default)] bg-[var(--color-bg-hover)]/50 text-[var(--color-fg-muted)]"},l={urgent:"Urgent",high:"High",medium:"Medium",low:"Low"},c=[...o.urgent,...o.high,...o.medium,...o.low];return c.length===0?r.jsxs("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide mb-3",children:"Smart Triage"}),r.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[r.jsx("span",{className:"text-lg",children:"â"}),r.jsx("span",{className:"text-sm",children:"All clear - no actions needed"})]})]}):r.jsxs("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:[r.jsxs("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide mb-3",children:["Smart Triage",r.jsxs("span",{className:"ml-2 text-xs text-[var(--color-fg-default)]0 font-normal",children:[c.length," alert",c.length!==1?"s":""]})]}),r.jsx("div",{className:"space-y-2 max-h-80 overflow-y-auto",children:c.map(u=>r.jsx("div",{className:`p-3 rounded-lg border ${i[u.priority]}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1",children:r.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded uppercase font-medium ${i[u.priority]}`,children:l[u.priority]})}),r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] break-words",children:u.message}),r.jsx("p",{className:"text-xs text-[var(--color-fg-default)]0 mt-1",children:u.suggested_action})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsx("button",{onClick:()=>s(u.id),className:"px-2 py-1 text-xs bg-[var(--color-bg-active)]/50 text-[var(--color-fg-muted)] rounded hover:bg-[var(--color-bg-active)]",children:"Dismiss"}),r.jsx("button",{onClick:()=>n(u.id),className:"px-2 py-1 text-xs bg-emerald-600/30 text-emerald-400 rounded hover:bg-emerald-600/50",children:"Done"})]})]})},u.id))})]})}function HMe({users:e,formatDateTime:t}){return e.length?r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide mb-3",children:"User Activity Summary"}),r.jsx("div",{className:"overflow-x-auto max-h-80",children:r.jsxs("table",{className:"w-full text-sm text-left min-w-[600px]",children:[r.jsx("thead",{className:"text-[var(--color-fg-muted)] sticky top-0 bg-[var(--color-bg-card)]/95 text-xs",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-2 pr-3",children:"User"}),r.jsx("th",{className:"py-2 pr-3",children:"Plan"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Projects"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Collections"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Req (7d)"}),r.jsx("th",{className:"py-2 pr-3 text-right",children:"Req (30d)"}),r.jsx("th",{className:"py-2 pr-3",children:"Last active"})]})}),r.jsx("tbody",{className:"divide-y divide-slate-800",children:e.map(s=>r.jsxs("tr",{className:"text-[var(--color-fg-default)] text-xs",children:[r.jsxs("td",{className:"py-2 pr-3",children:[r.jsx("span",{className:"truncate max-w-[180px] inline-block",children:s.email}),s.is_trial&&s.trial_days_left!==null&&r.jsxs("span",{className:"ml-1 text-[10px] text-amber-400",children:["(",s.trial_days_left,"d trial)"]})]}),r.jsx("td",{className:"py-2 pr-3",children:r.jsx("span",{className:"px-1.5 py-0.5 bg-[var(--color-bg-hover)] rounded text-[var(--color-fg-secondary)]",children:s.plan||"free"})}),r.jsx("td",{className:"py-2 pr-3 text-right",children:s.projects_count}),r.jsx("td",{className:"py-2 pr-3 text-right",children:s.collections_count}),r.jsx("td",{className:"py-2 pr-3 text-right",children:s.requests_7d.toLocaleStr
6137ing()}),r.jsx("td",{className:"py-2 pr-3 text-right",children:s.requests_30d.toLocaleString()}),r.jsx("td",{className:"py-2 pr-3 text-[var(--color-fg-muted)]",children:s.last_active?t(s.last_active):"Never"})]},s.id))})]})})]}):r.jsxs("div",{className:`${Mt.dark} p-4 border border-[var(--color-border-default)]`,children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide mb-3",children:"User Activity Summary"}),r.jsx("p",{className:"text-[var(--color-fg-default)]0 text-sm",children:"No user activity data available."})]})}function VMe(e,t){if(!e.length)return 0;const s=[...e].sort((a,o)=>a-o),n=Math.ceil(t*s.length)-1;return s[Math.min(s.length-1,Math.max(0,n))]}function GMe(e,t){const s=Date.now(),n=s-60*60*1e3,a=s-2*60*60*1e3,o=e.map(j=>({...j,createdAtMs:new Date(j.created_at).getTime()})),i=o.filter(j=>j.createdAtMs>=n),l=o.filter(j=>j.createdAtMs>=a&&j.createdAtMs<n),c=(t==null?void 0:t.success_rate)??(e.length?e.filter(j=>j.status<400).length/e.length:0),u=Math.max(0,1-(c||0)),f=e.filter(j=>j.status>=400&&j.status<500).length,h=(t==null?void 0:t.server_errors)??e.filter(j=>j.status>=500).length,g=e.length>0?VMe(e.map(j=>j.latency_ms).filter(j=>typeof j=="number"&&!Number.isNaN(j)),.95):(t==null?void 0:t.avg_latency_ms)??0,v=l.length===0?i.length>0?100:0:(i.length-l.length)/l.length*100;let y="healthy";return u>.1||h>10||g>1400?y="incident":(u>.03||h>2||g>900)&&(y="degraded"),{status:y,label:y==="incident"?"Incident":y==="degraded"?"Degraded":"Healthy",requestDelta:v,errorRate:u,p95Latency:g,clientErrors:f,serverErrors:h}}function WMe(e){const t=new Map;return e.forEach(s=>{const n=s.user_email||s.api_key||(s.project_id!==null?`project-${s.project_id}`:"unknown"),a=s.user_email||s.api_key||(s.project_id!==null?`Project ${s.project_id}`:"Unknown actor"),o=new Date(s.created_at).getTime(),l=t.get(n)??{id:n,label:a,plan:s.plan,requestCount:0,errorCount:0,errorRate:0,lastActive:new Date(s.created_at).toISOString(),lastActiveMs:o,firstSeenMs:o,limitHits:0,authFailures:0};l.requestCount+=1,s.status>=400&&(l.errorCount+=1),s.status===429&&(l.limitHits+=1),(s.status===401||s.status===403)&&(l.authFailures+=1),o>l.lastActiveMs&&(l.lastActiveMs=o,l.lastActive=new Date(o).toISOString()),(!l.firstSeenMs||o<l.firstSeenMs)&&(l.firstSeenMs=o),t.set(n,l)}),Array.from(t.values()).map(s=>({...s,errorRate:s.requestCount?s.errorCount/s.requestCount:0,firstSeen:s.firstSeenMs?new Date(s.firstSeenMs).toISOString():void 0})).sort((s,n)=>n.requestCount-s.requestCount).slice(0,5)}function YMe(e,t){const s=new Map;e.forEach(a=>{const o=a.project_id!==null?String(a.project_id):"unknown",i=s.get(o),l=new Date(a.created_at).getTime(),c=i??{id:o,label:a.project_name||(a.project_id!==null?`Project ${a.project_id}`:"Unknown project"),owner:a.owner_email,requests:0,errorRate:0,errorCount:0,lastActivityMs:l,lastActivity:a.created_at,isNew:!1,isPower:!1};c.requests+=1,a.status>=400&&(c.errorCount+=1),(!c.lastActivityMs||l>c.lastActivityMs)&&(c.lastActivityMs=l,c.lastActivity=a.created_at),s.set(o,c)}),t!=null&&t.length&&t.forEach(a=>{const o=a.project_id!==null?String(a.project_id):"unknown",i=s.get(o);i?i.requests=Math.max(i.requests,a.count):s.set(o,{id:o,label:a.project_id!==null?`Project ${a.project_id}`:"Unknown project",owner:null,requests:a.count,errorRate:0,lastActivity:void 0,lastActivityMs:void 0,isNew:!1,isPower:a.count>200,errorCount:0})});const n=Date.now();return Array.from(s.values()).map(a=>{var o;return{...a,isNew:a.lastActivity?n-new Date(a.lastActivity).getTime()<24*60*60*1e3:!1,isPower:a.requests>200||a.requests>.25*(((o=t==null?void 0:t[0])==null?void 0:o.count)??0),errorRate:a.requests?(a.errorCount??0)/a.requests:0}}).sort((a,o)=>o.requests-a.requests)}function KMe(e){const t=[],s=new Set;return e.forEach(n=>{const a=n.created_at,o=`${n.status}-${n.path}-${n.project_id}-${a}`,i=n.user_email||n.api_key||(n.project_id?`Project ${n.project_id}`:"Unknown");if(n.status===429){const l=`${o}-limit`;s.has(l)||(t.push({id:l,title:"User hit request limit",detail:`${i} on ${n.path}`,severity:"warn",timestamp:a,status:"open"}),s.add(l))}if(n.status===401||n.status===403){const l=`${o}-auth`;s.has(l)||(t.push({id:l,title:"Auth failing",detail:`${i} ${n.method} ${n.path} (${n.status})`,severity:"warn",timestamp:a,status:"open"}),s.add(l))}if(n.status>=500){const l=`${o}-5xx`;s.has(l)||(t.push({id:l,title:"Server error spike",detail:`${i} ${n.method} ${n.path} returned ${n.status}`,severity:"critical",timestamp:a,status:"open"}),s.add(l))}if(n.latency_ms&&n.latency_ms>1200){const l=`${o}-latency`;s.has(l)||(t.push({id:l,title:"High latency request",detail:`${i} ${n.method} ${n.path} took ${n.latency_ms}ms`,severity:"info",timestamp:a,status:"open"}),s.add(l))}}),t.sort((n,a)=>new Date(a.timestamp).getTime()-new Date(n.timestamp).getTime())}function JMe(){var Tt,ss,Zt;const{getToken:e}=zt(),[t,s]=x.useState(!1),[n,a]=x.useState([]),[o,i]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.use
6137State(""),[h,g]=x.useState(null),[v,y]=x.useState(null),[_,j]=x.useState(""),[w,k]=x.useState(null),[S,E]=x.useState([]),[T,A]=x.useState(""),[R,I]=x.useState("info"),[L,M]=x.useState(null),[O,z]=x.useState([]),[X,W]=x.useState(!1),[K,q]=x.useState(null),[J,F]=x.useState("24h"),[V,$]=x.useState(null),[B,ae]=x.useState(null),[H,U]=x.useState([]),[oe,fe]=x.useState(null),[Q,le]=x.useState(null),[Se,we]=x.useState(1),Le=re=>re?new Date(re).toLocaleString():"-",[xe,de]=x.useState({}),[Me,je]=x.useState(null),[Ae,Oe]=x.useState("30d"),[Ke,ut]=x.useState([]),[De,ct]=x.useState(()=>{try{return JSON.parse(localStorage.getItem("admin_triage_dismissed")||"[]")}catch{return[]}}),[rt,mt]=x.useState([]),[vt,gt]=x.useState(!1),[Be,ve]=x.useState(null),[be,nt]=x.useState(null),[Ze,he]=x.useState(30),[ke,Ve]=x.useState(null),at=async(re,G)=>{try{const ge=await ue.get(`/admin/trial-users?page=${G}&limit=50`,{authToken:re});U(ge.data.users||[]),fe(ge.data.summary||null),le(ge.data.pagination||null),we(G)}catch(ge){console.warn("Admin trial users failed",ge),U([]),fe(null),le(null)}};x.useEffect(()=>{Pt()},[J]),x.useEffect(()=>{(async()=>{const G=await Ue(e);if(G)try{const ge=await ue.get(`/admin/api/funnel?period=${Ae}`,{authToken:G});je(ge.data)}catch(ge){console.warn("Admin funnel failed",ge)}})()},[Ae]),x.useEffect(()=>{(async()=>{const G=await Ue(e);if(G)try{const ge=await ue.get(`/admin/api/trends?days=${Ze}`,{authToken:G});nt(ge.data)}catch(ge){console.warn("Admin trends failed",ge)}})()},[Ze]);const Pt=async()=>{try{s(!0),i(null),ae(null);const re=await Ue(e);if(!re){i("Sign in with an admin account to view this page.");return}const[G,ge]=await Promise.all([ue.get("/admin/logs?limit=50",{authToken:re}),ue.get("/admin/metrics",{authToken:re})]);a(G.data.data||[]),M(ge.data);try{const ze=await ue.get(`/admin/overview?range=${J}`,{authToken:re});q(ze.data)}catch(ze){console.warn("Admin overview failed",ze)}try{const ze=await ue.get("/admin/recent-activity?limit=100",{authToken:re});$(ze.data)}catch(ze){console.warn("Admin recent activity failed",ze),$(null),ae("Unable to load recent activity right now.")}await at(re,1);try{const ze=await ue.get(`/admin/api/funnel?period=${Ae}`,{authToken:re});je(ze.data)}catch(ze){console.warn("Admin funnel failed",ze),je(null)}try{const ze=await ue.get("/admin/api/triage",{authToken:re});ut(ze.data.alerts||[])}catch(ze){console.warn("Admin triage failed",ze),ut([])}try{const ze=await ue.get("/admin/api/user-activity-summary",{authToken:re});mt(ze.data.users||[])}catch(ze){console.warn("Admin user activity summary failed",ze),mt([])}try{const ze=await ue.get("/admin/api/revenue",{authToken:re});ve(ze.data)}catch(ze){console.warn("Admin revenue failed",ze),ve(null)}try{const ze=await ue.get(`/admin/api/trends?days=${Ze}`,{authToken:re});nt(ze.data)}catch(ze){console.warn("Admin trends failed",ze),nt(null)}try{const ze=await ue.get("/admin/api/cohorts",{authToken:re});Ve(ze.data)}catch(ze){console.warn("Admin cohorts failed",ze),Ve(null)}}catch(re){console.error("Failed to load logs",re),re instanceof yt?re.status===403?i("Admin access denied. Ensure your Clerk user has role=admin and you are using a valid session."):i(re.message||"Unable to fetch metrics right now."):i("Unable to fetch metrics right now.")}finally{s(!1)}},Ct=async()=>{c(!0),await Pt(),c(!1)},St=re=>{if(!re)return"-";const G=JSON.stringify(re);return G.length>120?`${G.slice(0,120)}â¦`:G},Xt=re=>{de(G=>({...G,[re]:!G[re]}))},It=x.useMemo(()=>{if(L){const ze=Math.round((L.success_rate||0)*L.total_requests);return{total:L.total_requests,successCount:ze,successRate:L.success_rate||0,avgLatency:L.avg_latency_ms,serverErrors:L.server_errors,window:L.window_hours}}if(!n.length)return{total:0,successCount:0,successRate:0,avgLatency:0,window:24,serverErrors:0};const re=n.length,G=n.filter(ze=>ze.status<400).length,ge=n.reduce((ze,Gt)=>ze+(Gt.latency_ms||0),0)/re;return{total:re,successCount:G,successRate:G/re,avgLatency:ge,window:24,serverErrors:0}},[n,L]),ee=x.useMemo(()=>{if(K!=null&&K.health){const re=K.health,G=(Number(re.error4xx_pct||0)+Number(re.error5xx_pct||0))/100,ge=G>.1||(re.p95_latency_ms||0)>1400?"incident":G>.04||(re.p95_latency_ms||0)>900?"degraded":"healthy";return{status:ge,label:ge==="incident"?"Incident":ge==="degraded"?"Degraded":"Healthy",requestDelta:re.delta_requests??
61370,errorRate:G,p95Latency:re.p95_latency_ms||0,clientErrors:re.error4xx_pct||0,serverErrors:re.error5xx_pct||0}}return GMe(n,L)},[K==null?void 0:K.health,n,L]),We=x.useMemo(()=>{var re,G;return(G=(re=K==null?void 0:K.users)==null?void 0:re.items)!=null&&G.length?K.users.items.map((ge,ze)=>({id:ge.id||`${ge.label||"actor"}-${ze}`,label:ge.label||ge.email||"Unknown",plan:ge.plan,requestCount:ge.requestCount??ge.reqs??0,errorRate:ge.errorRate??ge.error_rate??0,lastActive:ge.lastActive||ge.last_active||ge.first_seen||new Date().toISOString(),firstSeen:ge.firstSeen||ge.first_seen,limitHits:ge.limitHits??0,authFailures:ge.authFailures??0})):WMe(n)},[K==null?void 0:K.users,n]),wt=x.useMemo(()=>{var re,G;return(G=(re=K==null?void 0:K.projects)==null?void 0:re.items)!=null&&G.length?K.projects.items.map(ge=>({id:String(ge.id??ge.label??"unknown"),label:ge.slug||ge.name||"Unknown project",owner:ge.user_id||ge.owner,requests:ge.requests??ge.reqs??0,errorRate:ge.errorRate??ge.error_rate??0,lastActivity:ge.last_active,isNew:ge.first_seen?Date.now()-new Date(ge.first_seen).getTime()<24*60*60*1e3:!1,isPower:(ge.requests??ge.reqs??0)>200,collectionsCount:ge.collections_count,appUsersCount:ge.app_users_count})):YMe(n,L==null?void 0:L.top_projects)},[K==null?void 0:K.projects,n,L==null?void 0:L.top_projects]),_t=x.useMemo(()=>{var re;return(re=K==null?void 0:K.inbox)!=null&&re.length?K.inbox:KMe(n)},[K==null?void 0:K.inbox,n]),Ee=x.useMemo(()=>{const re=S.map(G=>({id:G.id,title:G.title,detail:`Added ${new Date(G.createdAt).toLocaleString()}`,severity:G.severity,timestamp:G.createdAt,status:G.status==="done"?"resolved":"open"}));return[..._t,...re].sort((G,ge)=>new Date(ge.timestamp).getTime()-new Date(G.timestamp).getTime())},[_t,S]),He=x.useMemo(()=>{const re=u.trim().toLowerCase();return n.filter(G=>h&&G.api_key&&G.api_key===h||re&&G.user_email&&G.user_email.toLowerCase()===re)},[n,h,u]),ie=()=>{if(!T.trim())return;const re={id:crypto.randomUUID(),title:T.trim(),status:"open",severity:R,createdAt:new Date().toISOString()};E(G=>[re,...G]),A("")},Ce=(re,G)=>{E(ge=>ge.map(ze=>ze.id===re?{...ze,status:G}:ze))},Ye=re=>{E(G=>G.filter(ge=>ge.id!==re))},Pe=re=>{z(G=>G.includes(re)?G:[...G,re]),E(G=>G.map(ge=>ge.id===re?{...ge,status:"done"}:ge))},Ge=async re=>{if(re.preventDefault(),y(null),g(null),!u.trim()){y("Enter an email to look up");return}try{const G=await Ue(e),ge=await ue.get(`/admin/pro-key?email=${encodeURIComponent(u.trim())}`,{authToken:G});g(ge.data.api_key)}catch(G){console.error("Lookup failed",G),y(G instanceof yt?G.message:"Could not find a key for that email.")}},Nt=async re=>{var G;if(re.preventDefault(),k(null),!_.trim()){k("Enter a project ID to rotate");return}try{const ge=await Ue(e);if(!ge){k("You must be signed in to rotate a key.");return}const ze=await ue.post(`/admin/projects/${_.trim()}/regenerate-key`,{},{authToken:ge});k(`New API key issued: ${((G=ze.data)==null?void 0:G.api_key)||"updated"}.`)}catch(ge){console.error("Rotation failed",ge),k(ge instanceof yt?ge.message:"Could not rotate project key.")}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs uppercase text-[var(--color-fg-default)]0",children:"Admin mission control"}),r.jsx("h1",{className:"text-xl sm:text-2xl font-semibold text-[var(--color-fg-default)]",children:"ReqRes Ops & Signals"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)] hidden sm:block",children:"Answer: are we healthy, who needs help, and what to do next."})]}),r.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full px-3 py-1 text-xs font-medium self-start sm:self-auto shrink-0 ${ee.status==="incident"?"bg-rose-500/10 text-rose-200 border border-rose-500/40":ee.status==="degraded"?"bg-amber-500/10 text-amber-200 border border-amber-500/30":"bg-emerald-500/10 text-emerald-200 border border-emerald-500/30"}`,children:[r.jsx("span",{className:`h-2 w-2 rounded-full ${ee.status==="incident"?"bg-rose-400":ee.status==="degraded"?"bg-amber-400":"bg-emerald-400"}`}),ee.label,r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)]",children:["ERR ",(ee.errorRate*100).toFixed(1),"% · P95"," ",Math.round(ee.p95Latency),"ms"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("div",{className:"flex items-center gap-1",children:["1h","24h","7d"].map(re=>r.jsx(ht,{variant:J===re?"primary":"secondary",size:"sm",onClick:()=>F(re),children:re},re))}),r.jsx(ht,{onClick:Ct,disabled:l,children:l?"Refreshingâ¦":"Refresh"}),r.jsx("a",{href:"/admin/traffic",className:"text-xs text-indigo-400 hover:text-indigo-300 underline",children:"Traffic Intelligence"}),r.jsx("a",{href:"/admin/outreach",className:"text-xs text-indigo-400 hover:text-indigo-300 underline",children:"Outreach"})]})]}),r.jsx(UMe,{data:Be}),r.jsx(FMe,{data:Me,period:Ae,onPeriodChange:Oe}),r.jsx(BMe,{data:be,days:Ze,onDaysChange:he}),r.jsx(qMe,{data:ke}),r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-4`,children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"Free trial users"}),r.jsx("p",{className:"text-xs sm:text-sm text-[var(--color-fg-muted)]",children:"Users on 14-d
6137ay trial. Active, expired, and converted."})]}),oe&&r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2 sm:gap-3",children:[r.jsxs("div",{className:"text-center px-2 sm:px-3 py-2 rounded-lg bg-emerald-500/10 border border-emerald-500/20",children:[r.jsx("p",{className:"text-base sm:text-lg font-semibold text-emerald-300",children:oe.active}),r.jsx("p",{className:"text-[11px] text-emerald-400/70",children:"Active"})]}),r.jsxs("div",{className:"text-center px-2 sm:px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[r.jsx("p",{className:"text-base sm:text-lg font-semibold text-amber-300",children:oe.expiringThisWeek??0}),r.jsx("p",{className:"text-[11px] text-amber-400/70",children:"Expiring"})]}),r.jsxs("div",{className:"text-center px-2 sm:px-3 py-2 rounded-lg bg-rose-500/10 border border-rose-500/20",children:[r.jsx("p",{className:"text-base sm:text-lg font-semibold text-rose-300",children:oe.expiredNotConverted}),r.jsx("p",{className:"text-[11px] text-rose-400/70",children:"Expired"})]}),r.jsxs("div",{className:"text-center px-2 sm:px-3 py-2 rounded-lg bg-sky-500/10 border border-sky-500/20",children:[r.jsx("p",{className:"text-base sm:text-lg font-semibold text-sky-300",children:oe.converted}),r.jsx("p",{className:"text-[11px] text-sky-400/70",children:"Converted"})]}),r.jsxs("div",{className:"text-center px-2 sm:px-3 py-2 rounded-lg bg-[var(--color-bg-active)]/50 border border-[var(--color-border-default)]/30",children:[r.jsx("p",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:oe.conversionRate!==null&&oe.conversionRate!==void 0?`${oe.conversionRate}%`:"-"}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Conv. rate"})]})]})]}),H.length===0?r.jsx("p",{className:"text-sm text-[var(--color-fg-default)]0",children:"No trial users yet."}):r.jsx("div",{className:"overflow-x-auto max-h-96",children:r.jsxs("table",{className:"w-full text-sm text-left min-w-[700px]",children:[r.jsx("thead",{className:"text-[var(--color-fg-muted)] sticky top-0 bg-[var(--color-bg-card)]/95 text-xs",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-2 pr-3",children:"User"}),r.jsx("th",{className:"py-2 pr-3",children:"Status"}),r.jsx("th",{className:"py-2 pr-3",children:"Trial progress"}),r.jsx("th",{className:"py-2 pr-2 text-center",children:"API Key"}),r.jsx("th",{className:"py-2 pr-2 text-center",children:"Project"}),r.jsx("th",{className:"py-2 pr-2 text-center",children:"Collection"}),r.jsx("th",{className:"py-2 pr-2 text-center",children:"10+ Req"}),r.jsx("th",{className:"py-2 pr-3",children:"Signed up"})]})}),r.jsx("tbody",{className:"divide-y divide-slate-800",children:H.map(re=>{var es,ls,pr,et;const G=re.converted||re.expired?100:Math.max(0,Math.min(100,(14-re.daysRemaining)/14*100)),ge=re.converted?r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-[11px] font-medium bg-sky-500/15 text-sky-200 border border-sky-500/30",children:["â Converted to ",re.subscriptionTier]}):re.expired?r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-[11px] font-medium bg-rose-500/15 text-rose-200 border border-rose-500/30",children:["Expired ",re.daysExpired,"d ago"]}):re.daysRemaining<=3?r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-[11px] font-medium bg-amber-500/15 text-amber-200 border border-amber-500/30",children:[re.daysRemaining,"d left"]}):r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-[11px] font-medium bg-emerald-500/15 text-emerald-200 border border-emerald-500/30",children:[re.daysRemaining,"d left"]}),ze=14-re.daysRemaining,Gt=re.converted?"bg-sky-500":re.expired?"bg-rose-500":ze>=12?"bg-red-500":ze>=8?"bg-amber-500":"bg-emerald-500";return r.jsxs("tr",{className:"text-[var(--color-fg-default)] text-xs",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium truncate max-w-[180px]",children:re.email}),r.jsx("span",{className:"text-[10px] text-[var(--color-fg-default)]0",children:re.onboardingCompleted?"Onboarded":"Not onboarded"})]})}),r.jsx("td",{className:"py-2 pr-3",children:ge}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("div",{className:"w-28",children:[r.jsx("div",{className:"h-2 bg-[var(--color-bg-hover)] rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all ${Gt}`,style:{width:`${G}%`}})}),r.jsx("p",{className:"text-[10px] text-[var(--color-fg-default)]0 mt-1",children:re.converted?"Upgraded":re.expired?`${re.daysExpired}d past expiry`:`Day ${ze+1} of 14`})]})}),r.jsx("td",{className:"py-2 pr-2 text-center",children:(es=re.activation)!=null&&es.has_api_key?r.jsx("span",{className:"text-emerald-400",children:"â"}):r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"-"})}),r.jsx("td",{className:"py-2 pr-2 text-center",children:(ls=re.activation)!=null&&ls.has_project?r.jsx("span",{className:"text-emerald-400",children:"â"}):r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"-"})}),r.jsx("td",{className:"py-2 pr-2 text-center",children:(pr=re.activation)!=null&&pr.has_collection?r.jsx("span",{className:"text-emerald-400",children:"â"}):r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"-"})}),r.jsx("td",{className:"py-2 pr-2 text-center",children:(et=re.activation)!=null&&et.has_10_requests?r.jsx("span",{className:"text-emerald-400",children:"â"}):r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"-"})}),r.jsx("td",{className:"py-2 pr-3 text-[var(--color-fg-muted)] text-[11px]",children:new Date(re.createdAt).toLocaleDateString()})]},re.id)})})]})}),Q&&Q.totalPages>1&&r.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-[var(--color-border-default)]",children:[r.jsxs("p",{className:"text-[12px] text-[var(--color-fg-default)]0",children:["Showing ",(Se-1)*50+1,"â",Math.min(Se*50,Q.totalCount)," of ",Q.totalCount," users"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",disabled:Se<=1,onClick:async()=>{const re=await Ue(e);re&&await at(re,Se-1)},className:"px-3 py-1.5 text-[12px] rounded-lg border border-[var(--color-border-default)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"Previous"}),r.jsxs("span",{className:"text-[12px] text-[var(--color-fg-muted)]",children:["Page ",Se," of ",Q.totalPages]}),r.jsx("button",{type:"button",disabled:!Q.hasMore,onClick:async()=>{const re=await Ue(e);re&&await at(re,Se+1)},className:"px-3 py-1.5 text-[12px] rounded-lg border border-[var(--color-border-default)] text-[var(--color-fg-secondary)] hover:bg-[var(--color-bg-hover)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),r.jsx(zMe,{alerts:Ke,dismissedIds:De,onDismiss:re=>{const G=[...De,re];ct(G),localStorage.setItem("admin_triage_dismissed",JSON.stringify(G))},onResolve:re=>{const G=[...De,re];ct(G),localStorage.setItem("admin_triage_dismissed",JSON.stringify(G));const ge=Ke.find(ze=>ze.id===re);ge&&E(ze=>[...ze,{id:`resolved_${re}_${Date.now()}`,title:`â ${ge.message}`,status:"done",severity:"info",createdAt:new Date().toISOString()}])}}),r.jsxs("div",{className:"grid grid-cols-2 xl:grid-cols-4 gap-2 sm:gap-3",children:[r.jsxs("div",{className:`${Mt.dark} p-3 sm:p-4 border border-[var(--color-border-default)]`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("p",{className:"text-xs uppercase text-[var(--color-fg-muted)]",children:"System health"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:["Last ",(K==null?void 0:K.range_hours)??It.window,"h"]})]}),r.jsx("p",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:ee.label}),r.jsxs("p",{className:"text-sm text-[var(--color-fg-muted)] mt-1",children:[(ee.errorRate*100).toFixed(1),"% errors · P95"," ",Math.round(ee.p95Latency),"ms"]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)] bg-[var(--color-bg-alt)] rounded-full px-2 py-1",children:[Math.round(ee.clientErrors)," 4xx"]}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-muted)] bg-[var(--color-bg-alt)] rounded-full px-2 py-1",children:[Math.round(ee.serverErrors)," 5xx"]})]})]}),r.jsx(X2,{label:"Requests (window)",value:((ss=(Tt=K==null?void 0:K.health)==null?void 0:Tt.requests)==null?void 0:ss.toLocaleStr
6137ing())||It.total.toLocaleString(),hint:K?`vs prev: ${K.health.delta_requests>=0?"â":"â"}${Math.abs(Math.round(K.health.delta_requests))}%`:`Last ${It.window}h`}),r.jsx(X2,{label:"Error rate split",value:K?`${K.health.error4xx_pct.toFixed(1)}% 4xx / ${K.health.error5xx_pct.toFixed(1)}% 5xx`:`${Math.round((ee.errorRate||0)*100)}%`,hint:"Share of requests"}),r.jsx(X2,{label:"P95 latency",value:`${(Zt=K==null?void 0:K.health)!=null&&Zt.p95_latency_ms?Math.round(K.health.p95_latency_ms):Math.round(ee.p95Latency)} ms`,hint:K?`Î ${Math.round(K.health.delta_p95_latency)}%`:"Use to spot regressions fast"})]}),o&&r.jsx("div",{className:`${Mt.dark} border border-rose-500/30 p-4 text-rose-100`,children:o}),t&&r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(bs,{size:"md",text:"Loading admin signals..."})}),r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-sm font-semibold text-[var(--color-fg-default)] uppercase tracking-wide",children:"Activity Summary"}),(V==null?void 0:V.persona_stack)&&r.jsxs("span",{className:"text-xs text-[var(--color-fg-default)]0",children:["Persona: ",V.persona_stack.with_persona_stack,"/",V.persona_stack.onboarded_total," captured"]})]}),B&&r.jsx("p",{className:"text-sm text-rose-300",children:B}),!V&&!B?r.jsx("div",{className:"py-4 flex justify-center",children:r.jsx(bs,{size:"sm",text:"Loading activity..."})}):V?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 space-y-2 h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Projects created"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[Math.min(V.projects.length,V.limit)," ","shown"]})]}),r.jsx("ul",{className:"space-y-2 max-h-64 overflow-auto pr-2",children:V.projects.length===0?r.jsx("li",{className:"text-sm text-[var(--color-fg-default)]0",children:"No projects yet."}):V.projects.slice(0,V.limit).map(re=>r.jsxs("li",{className:"flex items-start justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.name||"Untitled project"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.owner_email||"Owner unknown"," · #",re.id]})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0 whitespace-nowrap",children:Le(re.created_at)})]},`proj-${re.id}`))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 space-y-2 h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Collections created"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[Math.min(V.collections.length,V.limit)," ","shown"]})]}),r.jsx("ul",{className:"space-y-2 max-h-64 overflow-auto pr-2",children:V.collections.length===0?r.jsx("li",{className:"text-sm text-[var(--color-fg-default)]0",children:"No collections yet."}):V.collections.slice(0,V.limit).map(re=>r.jsxs("li",{className:"flex items-start justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.name||"Untitled collection"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.project_name||"Project unknown",re.environment_key?` · ${re.environment_key}`:""]})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0 whitespace-nowrap",children:Le(re.created_at)})]},`col-${re.id}`))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 space-y-2 h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Collection records"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[Math.min(V.collection_records.length,V.limit)," ","shown"]})]}),r.jsx("ul",{className:"space-y-2 max-h-64 overflow-auto pr-2",children:V.collection_records.length===0?r.jsx("li",{className:"text-sm text-[var(--color-fg-default)]0",children:"No records yet."}):V.collection_records.slice(0,V.limit).map(re=>r.jsxs("li",{className:"space-y-2 rounded-lg border border-[var(--color-border-default)]/60 bg-[var(--color-bg-default)]/40 p-3 text-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.collection_name||"Collection unknown"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.project_name||"Project unknown",re.environment_key?` · ${re.environment_key}`:""]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:["Payload preview: ",St(re.data)]})]}),r.jsxs("div",{className:"text-right space-y-1",children:[r.jsx("span",{className:"block text-[11px] text-[var(--color-fg-default)]0 whitespace-nowrap",children:Le(re.created_at)}),re.data&&r.jsx(ht,{variant:"secondary",size:"sm",onClick:()=>
6137Xt(re.id),children:xe[re.id]?"Collapse":"Expand"})]})]}),re.data&&xe[re.id]&&r.jsx("pre",{className:`${ud.dark} text-xs overflow-auto max-h-48`,children:JSON.stringify(re.data,null,2)})]},`record-${re.id}`))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 space-y-2 h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"API keys created"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[Math.min(V.api_keys.length,V.limit)," ","shown"]})]}),r.jsx("ul",{className:"space-y-2 max-h-64 overflow-auto pr-2",children:V.api_keys.length===0?r.jsx("li",{className:"text-sm text-[var(--color-fg-default)]0",children:"No API keys yet."}):V.api_keys.slice(0,V.limit).map(re=>r.jsxs("li",{className:"flex items-start justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.key_name}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.permissions.replace(/_/g," ")," ·"," ",re.user_email||"Unknown user"]})]}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0 whitespace-nowrap",children:Le(re.created_at)})]},`key-${re.id}`))})]}),r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 space-y-2 h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Onboarded users"}),r.jsxs("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[Math.min(V.onboarded_users.length,V.limit)," ","shown"]})]}),r.jsx("ul",{className:"space-y-2 max-h-64 overflow-auto pr-2",children:V.onboarded_users.length===0?r.jsx("li",{className:"text-sm text-[var(--color-fg-default)]0",children:"No onboarded users yet."}):V.onboarded_users.slice(0,V.limit).map(re=>r.jsxs("li",{className:"flex items-start justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.email||"Unknown email"}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.persona_goal||"Goal?"," ·"," ",re.persona_role||"Role?"," ·"," ",re.subscription_tier||"tier?"]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:["Stack: ",re.persona_stack?"Provided":"-"]})]}),r.jsx("div",{className:"text-right text-[11px] text-[var(--color-fg-default)]0 whitespace-nowrap",children:r.jsx("p",{children:Le(re.onboarding_completed_at)})})]},`user-${re.id}`))})]})]}):r.jsx("div",{className:"py-4 text-sm text-rose-300",children:B||"Unable to load recent activity."})]}),r.jsx(HMe,{users:rt,formatDateTime:Le}),r.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-3 xl:col-span-2`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"User activity radar"}),r.jsx("p",{className:"text-xs sm:text-sm text-[var(--color-fg-muted)]",children:"Top actors by request volume, with attention flags."})]}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-default)]0",children:["Last ",(L==null?void 0:L.window_hours)??24,"h"]})]}),We.length===0?r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No recent actors detected."}):r.jsx("div",{className:"space-y-3",children:We.map(re=>{const ge=[re.firstSeen&&Date.now()-new Date(re.firstSeen).getTime()<864e5?"New":null,re.limitHits?"Hit limits":null,re.errorRate>.12?"High errors":null].filter(Boolean);return r.jsxs("div",{className:"rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 p-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-3",children:[r.jsxs("div",{className:"space-y-1 min-w-0",children:[r.jsx("p",{className:"text-[var(--color-fg-default)] font-medium truncate",children:re.label}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-muted)]",children:[re.plan||"Plan unknown"," · Last active"," ",new Date(re.lastActive).toLocaleStr
6137ing()]}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:ge.length===0?r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0 bg-[var(--color-bg-alt)] px-2 py-1 rounded-full",children:"Steady"}):ge.map(ze=>r.jsx("span",{className:"text-[11px] text-amber-200 bg-amber-500/10 px-2 py-1 rounded-full border border-amber-500/30",children:ze},ze))})]}),r.jsxs("div",{className:"flex sm:flex-col sm:text-right gap-3 sm:gap-1 sm:min-w-[140px] shrink-0 text-xs sm:text-sm",children:[r.jsxs("p",{className:"text-[var(--color-fg-default)]",children:[re.requestCount.toLocaleString()," req"]}),r.jsxs("p",{className:`text-xs ${re.errorRate>.12?"text-rose-200":"text-emerald-200"}`,children:[Math.round((re.errorRate||0)*100),"% errors"]}),r.jsxs("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:[re.limitHits," limits · ",re.authFailures," auth fails"]})]})]},re.id)})})]}),r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"Events & actions"}),r.jsx("span",{className:"text-xs text-[var(--color-fg-default)]0",children:"Triage first"})]}),Ee.length===0?r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No alerts right now."}):r.jsx("ul",{className:"space-y-2",children:Ee.slice(0,8).map(re=>{const G=O.includes(re.id)||re.status==="resolved",ge=re.severity==="critical"?"bg-rose-500/15 text-rose-100 border border-rose-500/30":re.severity==="warn"?"bg-amber-500/15 text-amber-100 border border-amber-500/30":"bg-sky-500/10 text-sky-100 border border-sky-500/20";return r.jsxs("li",{className:`rounded-lg p-3 border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/60 flex items-start gap-3 ${G?"opacity-75":""}`,children:[r.jsx("span",{className:`text-[11px] px-2 py-1 rounded-full ${ge}`,children:re.severity}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("p",{className:"text-sm text-[var(--color-fg-default)] font-medium",children:re.title}),re.detail&&r.jsx("p",{className:"text-xs text-[var(--color-fg-muted)]",children:re.detail}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:new Date(re.timestamp).toLocaleString()})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ht,{variant:"secondary",size:"sm",onClick:()=>Pe(re.id),children:G?"Resolved":"Resolve"}),r.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>E(ze=>ze.map(Gt=>Gt.id===re.id?{...Gt,status:"in_progress"}:Gt)),children:"Triage"})]})]},re.id)})})]})]}),r.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 xl:col-span-2`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"Projects at a glance"}),r.jsx("p",{className:"text-xs sm:text-sm text-[var(--color-fg-muted)]",children:"Highlights: new, erroring, and power users."})]}),r.jsx("span",{className:"text-xs text-[var(--color-fg-default)]0",children:"Based on recent logs"})]}),wt.length===0?r.jsx("p",{className:"text-sm text-[var(--color-fg-muted)]",children:"No project traffic captured yet."}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm text-left min-w-[650px]",children:[r.jsx("thead",{className:"text-[var(--color-fg-muted)]",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-2 pr-3",children:"Project"}),r.jsx("th",{className:"py-2 pr-3",children:"Requests"}),r.jsx("th",{className:"py-2 pr-3",children:"Collections"}),r.jsx("th",{className:"py-2 pr-3",children:"App users"}),r.jsx("th",{className:"py-2 pr-3",children:"Errors"}),r.jsx("th",{className:"py-2 pr-3",children:"Last activity"}),r.jsx("th",{className:"py-2 pr-3",children:"Flags"})]})}),r.jsx("tbody",{className:"divide-y divide-slate-800",children:wt.map(re=>{const G=[re.isNew?"ð New":null,re.errorRate>
6137.08?"â ï¸ Errors":null,re.isPower?"ð Power":null].filter(Boolean);return r.jsxs("tr",{className:"text-[var(--color-fg-default)]",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium",children:re.label}),r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:re.owner||"Owner unknown"})]})}),r.jsx("td",{className:"py-2 pr-3",children:re.requests.toLocaleString()}),r.jsx("td",{className:"py-2 pr-3",children:re.collectionsCount??"-"}),r.jsx("td",{className:"py-2 pr-3",children:re.appUsersCount??"-"}),r.jsxs("td",{className:`py-2 pr-3 ${re.errorRate>.08?"text-rose-200":"text-emerald-200"}`,children:[Math.round((re.errorRate||0)*100),"%"]}),r.jsx("td",{className:"py-2 pr-3 text-[var(--color-fg-muted)]",children:re.lastActivity?new Date(re.lastActivity).toLocaleString():"-"}),r.jsx("td",{className:"py-2 pr-3",children:r.jsx("div",{className:"flex gap-1 flex-wrap",children:G.length?G.map(ge=>r.jsx("span",{className:"text-[11px] px-2 py-1 rounded-full bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] border border-[var(--color-border-default)]",children:ge},ge)):r.jsx("span",{className:"text-[11px] text-[var(--color-fg-default)]0",children:"Calm"})})})]},re.id)})})]})})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-3`,children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"Support & intervention"}),r.jsxs("form",{onSubmit:Ge,className:"space-y-2",children:[r.jsx("label",{className:"text-xs uppercase text-[var(--color-fg-default)]0",children:"Lookup by email"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Is,{placeholder:"[email protected]",value:u,onChange:re=>f(re.target.value)}),r.jsx(ht,{type:"submit",children:"Lookup"})]})]}),h&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs uppercase text-[var(--color-fg-default)]0",children:"API key"}),r.jsx("div",{className:`${ud.dark} text-xs`,children:h})]}),v&&r.jsx("p",{className:"text-sm text-rose-300",children:v}),He.length>0&&r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs uppercase text-[var(--color-fg-default)]0",children:"Recent activity"}),r.jsx("ul",{className:"space-y-1 text-xs text-[var(--color-fg-secondary)]",children:He.slice(0,5).map(re=>r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`px-2 py-0.5 rounded-full ${re.status>=400?"bg-rose-500/10 text-rose-200":"bg-emerald-500/10 text-emerald-100"}`,children:re.status}),r.jsx("span",{className:"font-mono",children:re.method}),r.jsx("span",{className:"truncate",children:re.path})]},`${re.id}-lookup`))})]}),r.jsxs("details",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-default)]/50 p-3",open:X,onToggle:re=>W(re.target.open),children:[r.jsx("summary",{className:"cursor-pointer text-sm text-[var(--color-fg-default)]",children:"Advanced tools"}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("form",{onSubmit:Nt,className:"space-y-2",children:[r.jsx("label",{className:"text-xs uppercase text-[var(--color-fg-default)]0",children:"Regenerate project API key"}),r.jsx(Is,{placeholder:"Project ID",value:_,onChange:re=>j(re.target.value)}),r.jsx(ht,{type:"submit",children:"Rotate key"})]}),w&&r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:w}),r.jsx("p",{className:"text-[11px] text-[var(--color-fg-default)]0",children:"Clerk admin required. Use only when a project is compromised or rotated on request."})]})]})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[r.jsxs("details",{className:`${Mt.dark} border border-[var(--color-border-default)] xl:col-span-2`,open:vt,onToggle:re=>gt(re.target.open),children:[r.jsxs("summary",{className:"p-4 cursor-pointer flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-semibold text-[var(--color-fg-default)]",children:"Live request tail"}),r.jsxs("span",{className:"text-xs text-[var(--color-fg-default)]0",children:[n.length," requests · Click to ",vt?"collapse":"expand"]})]}),r.jsx("div",{className:"p-3 sm:p-4 pt-0 overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm text-left min-w-[600px]",children:[r.jsx("thead",{className:"text-[var(--color-fg-muted)]",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-2 pr-3",children:"Path"}),r.jsx("th",{className:"py-2 pr-3",children:"Method"}),r.jsx("th",{className:"py-2 pr-3",children:"Status"}),r.jsx("th",{className:"py-2 pr-3",children:"Latency"}),r.jsx("th",{className:"py-2 pr-3",children:"Project"}),r.jsx("th",{className:"py-2",children:"Timestamp"})]})}),r.jsx("tbody",{className:"divide-y divide-slate-800",children:n.slice(0,60).map(re=>r.jsxs("tr",{className:"text-[var(--color-fg-default)]",children:[r.jsx("td",{className:"py-2 pr-3 font-mono text-xs",children:re.path}),r.jsx("td",{className:"py-2 pr-3",children:re.method}),r.jsx("td",{className:`py-2 pr-3 ${re.status>=500?"text-rose-300":re.status>=400?"text-amber-300":"text-emerald-300"}`,children:re.status}),r.jsxs("td",{className:"py-2 pr-3",children:[re.latency_ms??"-"," ms"]}),r.jsx("td",{className:"py-2 pr-3",children:re.project_id??"-"}),r.jsx("td",{className:"py-2 text-[var(--color-fg-muted)]",children:new Date(re.created_at).toLocaleStr
6137ing()})]},re.id))})]})})]}),r.jsxs("div",{className:`${Mt.dark} border border-[var(--color-border-default)] p-3 sm:p-4 space-y-3`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold text-[var(--color-fg-default)]",children:"Decision queue"}),r.jsx(ht,{variant:"secondary",onClick:ie,children:"Add item"})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[r.jsx(Is,{placeholder:'Add a queue item (e.g. "Email user hitting limits")',value:T,onChange:re=>A(re.target.value)}),r.jsxs("select",{className:"text-sm bg-[var(--color-bg-card)] border border-[var(--color-border-default)] rounded px-2 py-2 text-[var(--color-fg-default)]",value:R,onChange:re=>I(re.target.value),children:[r.jsx("option",{value:"info",children:"Info"}),r.jsx("option",{value:"warn",children:"Warn"}),r.jsx("option",{value:"critical",children:"Critical"})]})]}),r.jsxs("ul",{className:"divide-y divide-slate-800",children:[S.length===0&&r.jsx("li",{className:"py-2 text-sm text-[var(--color-fg-muted)]",children:"Empty queue. Add what you need to resolve today."}),S.map(re=>r.jsxs("li",{className:"py-3 flex items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[var(--color-fg-default)]",children:re.title}),r.jsxs("p",{className:"text-xs text-[var(--color-fg-default)]0 flex items-center gap-2",children:[r.jsx("span",{className:`px-2 py-0.5 rounded-full ${re.severity==="critical"?"bg-rose-500/15 text-rose-100 border border-rose-500/30":re.severity==="warn"?"bg-amber-500/15 text-amber-100 border border-amber-500/30":"bg-sky-500/10 text-sky-100 border border-sky-500/20"}`,children:re.severity}),re.status.replace("_"," ")," ·"," ",new Date(re.createdAt).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{className:"text-sm bg-[var(--color-bg-card)] border border-[var(--color-border-default)] rounded px-2 py-1 text-[var(--color-fg-default)]",value:re.status,onChange:G=>Ce(re.id,G.target.value),children:[r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In progress"}),r.jsx("option",{value:"done",children:"Done"})]}),r.jsx(ht,{variant:"ghost",onClick:()=>Ye(re.id),className:"text-sm text-rose-300",children:"Delete"})]})]},re.id))]})]})]})]})}const XMe={"/dashboard":[{question:'Account showing as "inactive"?',answer:"This means your email verification is incomplete. Check for a verification email from Clerk (our auth provider) - including spam/junk folders. Try signing out and back in to trigger a new one. Once verified, your projects and features will work normally."}],"/projects":[{question:'"Could not load projects" or "Action not allowed"?',answer:"This usually means your email is not yet verified. Check for a verification email from Clerk (our auth provider), including your spam folder. Try signing out and back in to trigger a new verification email. This is not a subscription issue."},{question:"How do I set up a project?",answer:"Create a project to get a slug and persistent storage. Then create collections (data tables) and generate API keys. Include your API key as an x-api-key header in all project API requests."}],"/api-keys":[{question:"How do I use my API key?",answer:"Copy a key from this page and include it as an x-api-key header in your HTTP requests. Each project has separate prod and dev key sets. For App User sessions, use Authorization: Bearer <session_token> instead."},{question:"Getting 403 errors on classic endpoints?",answer:"Classic endpoints (like /api/users) require an x-api-key header for POST, PUT, PATCH, and DELETE requests. GET requests work without a key. If you are already sending a key, you may be rate limited - add delays between requests."}],"/collections":[{question:"Why is my data not persisting?",answer:"If you are using classic endpoints like /api/users, data is never stored - those are echo-only for testing. To persist data, create a project and a collection, then use /api/collections/<slug>/records with your x-api-key header."},{question:'"Slug already taken"?',answer:"Collection slugs must be unique within a project. Choose a different name, or delete the existing collection if you no longer need it."}],"/data-explorer":[{question:"Why is my data not persisting?",answer:"If you are using classic endpoints like /api/users, data is never stored - those are echo-only for testing. To persist data, create a project and a collection, then use /api/collections/<slug>/records with your x-api-key header."}],"/app-users":[{question:"How does magic-link authentication work?",answer:"App Users are real users of YOUR app. The flow: 1) POST /api/app-users/login with your x-api-key and an email. 2) The user receives a magic code by email. 3) POST /api/app-users/verify with the code to get a session token. 4) Use that token as Authorization: Bearer <token> for user-scoped data."}],"/billing":[{question:"Do I need to upgrade to use projects?",answer:"No. Free plan users can create projects, collections, API keys, and App Users. Paid plans provide higher rate limits and more storage, but all core features work on the free plan."}],"/upgrade":[{question:"Do I need to upgrade to use projects?",answer:"No. Free plan users can create projects, collections, API keys, and App Users. Paid plans provide higher rate limits and more storage, but all core features work on the free plan."}],"/logs":[{question:"What do the request logs show?",answer:"Logs show API requests made to your project endpoints, including the method, path, status code, and timestamp. Use these to debug integration issues. Only project API requests are logged - classic endpoint usage is not tracked here."}]},QMe=[{question:"Classic endpoints vs Projects - what's the difference?",answer:"Classic endpoints like /api/users return fake data for learning and testing - nothing is stored. Projects give you persistent storage with collections (like database tables) and real user authentication. Use classic endpoints to practice HTTP methods; use projects when you need data to persist."},{question:"Do I need a paid plan to use ReqRes?",answer:"No. Classic endpoints are completely free with no API key needed for GET requests. Free plan users can also create projects, collections, and API keys. Paid plans increase rate limits and storage."}];function ZMe(e){let t=[];for(const[s,n]of Object.entries(XMe))if(e===s||e.startsWith(s+"/")){t=n;break}return[...t,...QMe]}const _U=["General","Billing","Bug","Feature request"];function eOe(){var E;const{user:e,isLoaded:t,isSignedIn:s}=_r(),{getToken:n}=zt(),a=Wr(),[o,i]=x.useState(!1),[l,c]=x.useState(_U[0]),[u,f]=x.use
6137State(""),[h,g]=x.useState(null),[v,y]=x.useState(!1),[_,j]=x.useState(null),w=x.useMemo(()=>`${a.pathname}${a.search||""}`,[a.pathname,a.search]),k=x.useMemo(()=>ZMe(a.pathname),[a.pathname]);if(!t||!e||!s)return null;const S=async T=>{if(T.preventDefault(),!u.trim()){g({type:"error",message:"Tell us what you need help with."});return}g(null),y(!0);try{const A=await Ue(n);if(!A)throw new Error("We could not verify your session. Please try again.");await ue.post("/support",{message:u.trim(),category:l,page:w,userAgent:typeof window<"u"?window.navigator.userAgent:""},{authToken:A}),g({type:"success",message:"Sent! We will get back to you shortly."}),f("")}catch(A){A instanceof yt?g({type:"error",message:A.message}):A instanceof Error?g({type:"error",message:A.message}):g({type:"error",message:"Unable to send your message right now."})}finally{y(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"support-widget-toggle","aria-label":"Contact support",onClick:()=>{i(T=>!T),g(null)},children:"?"}),o&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"support-widget-backdrop",onClick:()=>i(!1)}),r.jsxs("div",{className:"support-widget-panel",children:[r.jsxs("div",{className:"support-widget-header",children:[r.jsxs("div",{children:[r.jsx("p",{className:"support-widget-label",children:"Email support"}),r.jsx("h4",{className:"support-widget-title",children:"We're here to help"})]}),r.jsx("button",{className:"support-widget-close",type:"button",onClick:()=>i(!1),"aria-label":"Close support form",children:"â"})]}),r.jsx("p",{className:"support-widget-subtitle",children:"We'll reply by email and include your account and page details automatically so we can help faster."}),r.jsxs("div",{className:"support-widget-meta",children:[r.jsx("span",{children:(E=e.emailAddresses[0])==null?void 0:E.emailAddress}),r.jsx("span",{children:w})]}),r.jsx("p",{className:"support-widget-meta-note",children:"Replies will be sent to this email address."}),k.length>0&&r.jsxs("div",{className:"support-widget-help",children:[r.jsx("p",{className:"support-widget-help-heading",children:"Quick answers"}),k.map((T,A)=>r.jsxs("div",{className:"support-widget-help-item",children:[r.jsxs("button",{type:"button",className:`support-widget-help-question${_===A?" is-expanded":""}`,onClick:()=>j(_===A?null:A),children:[r.jsx("span",{children:T.question}),r.jsx("span",{className:"support-widget-help-chevron","aria-hidden":"true",children:_===A?"â":"+"})]}),_===A&&r.jsx("p",{className:"support-widget-help-answer",children:T.answer})]},A))]}),r.jsxs("form",{className:"support-widget-form",onSubmit:S,children:[r.jsxs("label",{className:"support-widget-field",children:[r.jsx("span",{children:"Topic"}),r.jsx("select",{value:l,onChange:T=>c(T.target.value),children:_U.map(T=>r.jsx("option",{value:T,children:T},T))})]}),r.jsxs("label",{className:"support-widget-field",children:[r.jsx("span",{children:"How can we help?"}),r.jsx("textarea",{value:u,onChange:T=>f(T.target.value),placeholder:"Tell us what you were trying to do or where you got stuck.",rows:3})]}),r.jsx("p",{className:"support-widget-hint",children:"We'll include your current page and browser info to help us reply accurately."}),h&&r.jsx("div",{className:`support-widget-status support-widget-status--${h.type}`,children:h.message}),r.jsxs("div",{className:"support-widget-actions",children:[r.jsx("button",{type:"button",className:"support-widget-secondary",onClick:()=>i(!1),children:"Close"}),r.jsx("button",{type:"submit",className:"support-widget-primary",disabled:v,children:v?"Sendingâ¦":"Send email to support"})]})]})]})]})]})}const OY="rr_limit_modal_dismissed_until",tOe=12*60*60*1e3,sOe=()=>{if(typeof window>"u")return!1;try{const e=window.localStorage.getItem(OY);return e?Date.now()>=Number(e):!0}catch{return!0}},rOe=()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(OY,String(Date.now()+tOe))}catch{}},nOe=e=>{if(!e)return"soon";const t=e*1e3-Date.now();if(t<=0)return"soon";const s=Math.floor(t/6e4),n=Math.floor(s/60),a=s%60;if(n>=24){const o=Math.floor(n/24),i=n%24;return`${o}
6137d ${i}h`}return n>0?`${n}h ${a}m`:`${a}m`};function aOe(){const[e,t]=x.useState(!1),[s,n]=x.useState(null),a=x.useCallback(()=>{t(!1),rOe()},[]);x.useEffect(()=>{if(typeof window>"u")return;const v=y=>{const j=y.detail||{},w=typeof j.limit=="number"&&typeof j.remaining=="number"?Math.max(0,j.limit-j.remaining):null;Z.track("limit_hit",{used:w,limit:j.limit??null,remaining:j.remaining??null,reset_at:j.reset_at??null,surface:j.surface||"api_client",tier:j.tier||"free",endpoint:j.endpoint}),sOe()&&(n(j),t(!0))};return window.addEventListener("reqres:limit-hit",v),()=>{window.removeEventListener("reqres:limit-hit",v)}},[]);const o=(s==null?void 0:s.limit)??null,i=(s==null?void 0:s.remaining)??null,l=typeof o=="number"&&typeof i=="number"?Math.max(0,o-i):null,c=(s==null?void 0:s.reset_at)!==void 0&&(s==null?void 0:s.reset_at)!==null?Number(s.reset_at):void 0,u=(s==null?void 0:s.tier)||"free",f=()=>{Z.upgradeClicked("limit_hit",u)},h=u==="free"?`You've hit the free tier limit for today (${o?o.toLocaleString():"250"} requests)`:"You hit today's request limit",g=u==="free"?"Your requests will work again tomorrow, or you can upgrade now. Lite is $5/month for 10,000 requests/day with a commercial use license.":"Looks like you're scaling up. Upgrade to unlock higher limits and longer logs.";return r.jsx(wv,{open:e,onOpenChange:v=>{v?t(!0):a()},children:r.jsxs(Ph,{className:`${Mt.dark} max-w-lg text-[var(--color-fg-default)]`,children:[r.jsxs(Ih,{className:"space-y-2",children:[r.jsx(Oh,{children:h}),r.jsx(Lh,{className:"text-[var(--color-fg-secondary)]",children:g})]}),r.jsxs("div",{className:"rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-3 space-y-2 text-sm text-[var(--color-fg-default)]",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Requests today"}),r.jsx("span",{className:"font-semibold",children:l!==null&&o!==null?`${l.toLocaleString()} / ${o.toLocaleString()}`:"n/a"})]}),r.jsxs("div",{className:"flex items-center justify-between text-[var(--color-fg-muted)] text-xs",children:[r.jsxs("span",{children:["Resets in ",nOe(c)," ",r.jsx("span",{className:"text-[var(--color-fg-faint)]",children:"(midnight UTC)"})]}),r.jsx("a",{className:"underline underline-offset-4 hover:text-[var(--color-fg-default)]",href:"https://reqres.in/documentation#requests",target:"_blank",rel:"noreferrer",children:"How limits work"})]})]}),r.jsxs(Mh,{className:"sm:items-center sm:justify-between",children:[r.jsx($h,{className:Jt.secondaryEmphasis,children:"Wait until reset"}),r.jsx(Dh,{asChild:!0,children:r.jsx(dt,{className:Jt.primaryEmphasis,to:"/upgrade?source=limit_hit",onClick:f,children:u==="free"?"Upgrade to Dev - $12/mo":"Upgrade for more requests"})})]})]})})}const jU="rr_welcome_seen_v2";function oOe(e){const t=e.match(/^([a-z]+_[a-z]+_|[a-z]+_)/i);return t?{prefix:t[1],value:e.slice(t[1].length)}:{prefix:"",value:e}}function iOe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]*(?:\\.[^"\\]*)*)"\s*:/g,'<span class="rr-json-key">"$1"</span>:').replace(/:\s*"([^"\\]*(?:\\.[^"\\]*)*)"/g,': <span class="rr-json-string">"$1"</span>').replace(/:\s*(-?\d+(?:\.\d+)?)/g,': <span class="rr-json-number">$1</span>').replace(/:\s*(true|false)/g,': <span class="rr-json-boolean">$1</span>').replace(/:\s*(null)/g,': <span class="rr-json-null">$1</span>')}function wU({value:e}){const t=x.useMemo(()=>{try{return iOe(JSON.stringify(e,null,2))}catch{return""}},[e]);return r.jsx("pre",{className:"rr-json-preview m-0 overflow-auto max-h-44 text-[11px] leading-[1.55] font-mono whitespace-pre text-[var(--color-fg-default)]",dangerouslySetInnerHTML:{__html:t}})}function NU({method:e,domain:t,path:s,query:n}){return r.jsxs("div",{className:"rounded-md border border-[var(--color-border-default)]/60 bg-[var(--color-bg-alt)] px-3 py-2 font-mono text-[12px]",children:[r.jsx("span",{className:"mr-2 font-semibold text-[var(--color-accent-blue)]",children:e}),r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:t}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:s}),n?r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:n}):null]})}function kU({loading:e,hasResponse:t,disabled:s,variant:n,onClick:a,initialLabel:o="Run request",againLabel:i="Run again"}){const l=e?"Fetchingâ¦":t?i:o,c="w-full rounded-lg px-3 py-2 text-[13px] font-semibold transition disabled:opacity-60 disabled:cursor-wait",u=n==="primary"?`${c} bg-[var(--color-accent-blue)] text-white hover:bg-[var(--color-accent-blue-hover)]`:`${c} border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[var(--color-fg-default)] hover:border-[var(--color-border-secondary)] hover:bg-[var(--color-bg-hover)]`;return r.jsx("button",{type:"button",onClick:a,disabled:e||s,className:u,children:l})}function lOe(){const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),n=un(),{copyToClipboard:a}
6137=hm(),[o,i]=x.useState(!1),[l,c]=x.useState(null),[u,f]=x.useState(null),[h,g]=x.useState(!0),[v,y]=x.useState(!1),[_,j]=x.useState(!1),[w,k]=x.useState(null),[S,E]=x.useState(null),[T,A]=x.useState(!1),[R,I]=x.useState(!1),[L,M]=x.useState(!1),O=x.useRef(!1),z=x.useRef(!1),X=x.useRef(null);x.useEffect(()=>{if(!t||!e)return;let U=!1;try{U=localStorage.getItem(jU)==="true"}catch{}U||i(!0)},[t,e]),x.useEffect(()=>{if(!o)return;let U=!1;return(async()=>{var oe,fe;try{const Q=await Ue(s);if(!Q){g(!1);return}const[le,Se]=await Promise.all([ue.get("/api-keys/primary",{authToken:Q}).catch(()=>({data:{api_key:null}})),ue.get("/projects?limit=5",{authToken:Q}).catch(()=>({data:{projects:[]}}))]);if(U)return;c(((oe=le.data)==null?void 0:oe.api_key)??null);const we=((fe=Se.data)==null?void 0:fe.projects)||[],Le=we.find(xe=>{var de;return(de=xe.config)==null?void 0:de.is_starter})||we[0]||null;f(Le)}finally{U||g(!1)}})(),()=>{U=!0}},[o,s]),x.useEffect(()=>{!o||h||_||(Z.track("welcome_shown",{has_api_key:!!l,has_project:!!u}),j(!0))},[o,h,_,l,u]),x.useEffect(()=>{if(!o)return;const U=X.current;if(!U)return;const oe=new IntersectionObserver(fe=>{for(const Q of fe)Q.isIntersecting&&!z.current&&(Z.track("welcome_scroll_to_step2",{}),z.current=!0)},{threshold:.5});return oe.observe(U),()=>oe.disconnect()},[o]),x.useEffect(()=>{w!=null&&!L&&(M(!0),O.current||(Z.track("welcome_scroll_nudge_shown",{}),O.current=!0))},[w,L]);const W=()=>{try{localStorage.setItem(jU,"true")}catch{}},K=async()=>{if(!l)return;await a(l)&&(y(!0),Z.track("welcome_key_copied",{source:"header"}),setTimeout(()=>y(!1),2e3))},q=async()=>{if(!(!l||T)){A(!0),Z.track("welcome_classic_request_sent",{});try{const U=await fetch(`${$s}/api/users?page=2`,{headers:{"x-api-key":l}}),oe=await U.json().catch(()=>null);k(oe??{error:"Empty response"}),U.ok?Z.track("welcome_classic_request_succeeded",{status_code:U.status}):Z.track("welcome_classic_request_failed",{status_code:U.status,error:(oe==null?void 0:oe.error)||U.statusText||"http_error"})}catch(U){const oe=U instanceof Error?U.message:"network_error";k({error:"Request failed. Try the playground instead.",detail:oe}),Z.track("welcome_classic_request_failed",{status_code:0,error:oe})}finally{A(!1)}}},J=async()=>{if(R||!u)return;const U=u.public_api_key||u.api_key||l;if(!U){E({error:"No project key available. Open your project to view your data."}),Z.track("welcome_backend_request_failed",{status_code:0,error:"no_project_key"});return}I(!0),Z.track("welcome_backend_request_sent",{});try{const oe=await fetch(`${$s}/api/collections/products/records?project_id=${u.id}`,{headers:{"x-api-key":U,"X-Reqres-Env":"prod"}}),fe=await oe.json().catch(()=>null),Q=fe&&typeof fe=="object"&&"data"in fe?fe.data:fe;E(Q??{error:"Empty response"}),oe.ok?Z.track("welcome_backend_request_succeeded",{status_code:oe.status,record_count:Array.isArray(Q)?Q.length:0}):Z.track("welcome_backend_request_failed",{status_code:oe.status,error:(fe==null?void 0:fe.error)||oe.statusText||"http_error"})}catch(oe){const fe=oe instanceof Error?oe.message:"network_error";E({error:"Request failed. Try the playground instead.",detail:fe}),Z.track("welcome_backend_request_failed",{status_code:0,error:fe})}finally{I(!1)}},F=()=>{W(),Z.track("welcome_playground_clicked",{}),i(!1),n("/playground?path=/api/users&method=GET")},V=()=>{W(),Z.track("welcome_project_clicked",{}),i(!1);const U=u?`/projects/${u.id}`:"/projects";n(U)},$=()=>{W(),Z.track("welcome_dismissed",{}),i(!1)};if(!o)return null;const B=l?oOe(l):null,ae=!!(l&&u),H=Array.isArray(S)&&S.length>0;return r.jsxs("div",{className:"modal-overlay z-[75] items-start md:items-center overflow-hidden py-4 sm:py-8 min-h-screen",role:"dialog","aria-modal":"true","aria-labelledby":"welcome-interstitial-title",children:[r.jsx("style",{children:` 6138 .rr-json-key { color: #AFA9EC; } 6139 .rr-json-string { color: #5DCAA5; } 6140 .rr-json-number { color: #EF9F27; } 6141 .rr-json-boolean { color: #85B7EB; } 6142 .rr-json-null { color: var(--color-fg-muted); } 6143 @keyframes rr-fade-in { 6144 from { opacity: 0; transform: translateY(-4px); } 6145 to { opacity: 1; transform: translateY(0); } 6146 } 6147 .rr-fade-in { animation: rr-fade-in 0.5s ease-in; } 6148 @keyframes rr-bounce-arrow { 6149 0%, 100% { transform: translateY(0); } 6150 50% { transform: translateY(2px); } 6151 } 6152 .rr-bounce-arrow { animation: rr-bounce-arrow 1.4s ease-in-out infinite; display: inline-block; } 6153 `}),r.jsxs("div",{className:"modal-content relative w-full max-w-[540px] max-h-[88vh] flex flex-col overflow-hidden rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] backdrop-blur-xl shadow-[0_24px_80px_rgba(0,0,0,0.65)]",children:[r.jsxs("div",{className:"sticky top-0 z-10 px-6 pt-6 pb-4 bg-[var(--color-bg-card)] border-b border-[var(--color-border-default)]/60",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:"Welcome to ReqRes"}),r.jsx("h2",{id:"welcome-interstitial-title",className:"mt-1 text-xl font-semibold text-[var(--color-fg-default)]",children:"Your API key"})]}),r.jsx("button",{type:"button",onClick:$,className:"shrink-0 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-1.5 text-[var(--color-fg-secondary)] hover:text-[var(--color-fg-default)] hover:border-[var(--color-border-secondary)] transition","aria-label":"Close",children:r.jsx(Ir,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-3 py-2.5",children:[h?r.jsx("span",{className:"text-xs text-[var(--color-fg-muted)]",children:"Loadingâ¦"}):B?r.jsxs("code",{className:"flex-1 min-w-0 overflow-x-auto whitespace-nowrap text-[13px] font-mono",children:[r.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:B.prefix}),r.jsx("span",{className:"text-[var(--color-fg-default)]",children:B.value})]}):r.jsx("span",{className:"flex-1 text-xs text-[var(--color-fg-muted)]",children:"Still setting up. Refresh in a moment."}),r.jsx("button",{type:"button",onClick:K,disabled:!l,className:"shrink-0 inline-flex items-center gap-1.5 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-card)] px-2.5 py-1 text-[11px] font-semibold text-[var(--color-fg-default)] hover:border-[var(--color-accent-blue)]/60 hover:bg-[var(--color-bg-hover)] transition disabled:opacity-50",children:v?r.jsxs(r.Fragment,{children:[r.jsx(ts,{className:"h-3 w-3 text-emerald-500"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(is,{className:"h-3 w-3"}),"Copy"]})})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[r.jsxs("section",{className:"space-y-3",children:[r.jsxs("header",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] text-[11px] font-semibold text-[var(--color-fg-secondary)]",children:"1"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-[15px] font-semibold text-[var(--color-fg-default)]",children:"The classic API"}),r.jsx("p",{className:"mt-0.5 text-[12px] text-[var(--color-fg-secondary)]",children:"The sample data you already know."})]})]}),r.jsx(NU,{method:"GET",domain:"reqres.in",path:"/api/users",query:"?page=2"}),w!=null&&r.jsx("div",{className:"rounded-md border border-[var(--color-accent-blue)]/30 bg-[var(--color-bg-alt)] p-3",children:r.jsx(wU,{value:w})}),r.jsx(kU,{variant:w?"secondary":"primary",loading:T,hasResponse:w!=null,disabled:!l,onClick:q}),L&&r.jsx("div",{className:"rr-fade-in pt-2 pb-1 text-center",children:r.jsxs("p",{className:"text-[12px] text-[var(--color-fg-secondary)]",children:[r.jsx("span",{className:"rr-bounce-arrow",children:"â"})," ","That response is the same for everyone. Below is data only you can change."]})})]}),r.jsxs("section",{ref:X,className:"space-y-3",children:[r.jsxs("header",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full border border-[var(--color-accent-blue)]/40 bg-[var(--color-accent-blue)]/10 text-[11px] font-semibold text-[var(--color-accent-blue)]",children:"2"}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-[15px] font-semibold text-[var(--color-fg-default)]",children:["Your data (not sample data)",r.jsx("span",{className:"ml-2 align-middle inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase tracking-wider bg-[var(--color-accent-blue)]/15 text-[var(--color-accent-blue)]",children:"New"})]}),r.jsx("p",{className:"mt-0.5 text-[12px] text-[var(--color-fg-secondary)]",children:"3 products are already in your project. Run this, then try changing a price. It persists."})]})]}),r.jsx(NU,{method:"GET",domain:"reqres.in",path:"/api/collections/products/records"}),S!=null&&r.jsx("div",{className:"rounded-md border border-[var(--color-accent-blue)]/30 bg-[var(--color-bg-alt)] p-3",children:r.jsx(wU,{value:S})}),r.jsx(kU,{variant:"primary",loading:R,hasResponse:S!=null,disabled:!ae,onClick:J,initialLabel:"See my products",againLabel:"Refetch my products"}),H&&r.jsx("div",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/[0.06] px-3 py-2",children:r.jsx("p",{className:"text-[12px] text-emerald-300",children:"Now edit one. It sticks."})}
6153),!ae&&!h&&r.jsx("p",{className:"text-[11px] text-[var(--color-fg-muted)]",children:"Your starter project is still being prepared. Refresh in a few seconds."})]})]}),r.jsxs("div",{className:"flex border-t border-[var(--color-border-default)]/60",children:[r.jsx("button",{type:"button",onClick:F,className:"flex-1 px-3 py-3 text-[13px] font-semibold text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] border-r border-[var(--color-border-default)]/60 transition",children:"Open playground"}),r.jsx("button",{type:"button",onClick:V,className:"flex-1 px-3 py-3 text-[13px] font-semibold text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition",children:"See my project"})]})]})]})}var cOe=(e,t,s,n,a,o,i,l)=>{let c=document.documentElement,u=["light","dark"];function f(v){(Array.isArray(e)?e:[e]).forEach(y=>{let _=y==="class",j=_&&o?a.map(w=>o[w]||w):a;_?(c.classList.remove(...j),c.classList.add(o&&o[v]?o[v]:v)):c.setAttribute(y,v)}),h(v)}function h(v){l&&u.includes(v)&&(c.style.colorScheme=v)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)f(n);else try{let v=localStorage.getItem(t)||s,y=i&&v==="system"?g():v;f(y)}catch{}},dOe=x.createContext(void 0),uOe={setTheme:e=>{},themes:[]},pOe=()=>{var e;return(e=x.useContext(dOe))!=null?e:uOe};x.memo(({forcedTheme:e,storageKey:t,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:i,themes:l,nonce:c,scriptProps:u})=>{let f=JSON.stringify([s,t,o,e,l,i,n,a]).slice(1,-1);return x.createElement("script",{...u,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${cOe.toString()})(${f})`}})});const fOe=({...e})=>{const t=pOe(),s=(t==null?void 0:t.theme)??"system";return r.jsx(pve,{theme:s,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},hOe="pk_live_Y2xlcmsucmVxcmVzLmluJA",SU="rr_ph_signup_tracked",mOe=[{path:"/dashboard",element:r.jsx(A_e,{})},{path:"/projects",element:r.jsx(jTe,{})},{path:"/projects/:id",element:r.jsx(LTe,{})},{path:"/custom-endpoints",element:r.jsx(O_e,{})},{path:"/data-explorer",element:r.jsx(Lke,{})},{path:"/collections",element:r.jsx(h2e,{})},{path:"/logs",element:r.jsx(ATe,{})},{path:"/app-users",element:r.jsx(BRe,{})},{path:"/app-users/:appUserId",element:r.jsx(zRe,{})},{path:"/automations",element:r.jsx(GRe,{})},{path:"/organizations",element:r.jsx(KRe,{})},{path:"/classrooms",element:r.jsx(cAe,{})},{path:"/classrooms/new",element:r.jsx(dAe,{})},{path:"/classrooms/:id",element:r.jsx(uAe,{})},{path:"/agents",element:r.jsx(mAe,{})},{path:"/api-keys",element:r.jsx(y2e,{})},{path:"/billing",element:r.jsx(V2e,{})},{path:"/upgrade",element:r.jsx(YCe,{})},{path:"/upgrade-success",element:r.jsx(XCe,{})},{path:"/org/billing-success",element:r.jsx(QCe,{})},{path:"/manage",element:r.jsx(KCe,{})},{path:"/prompts",element:r.jsx(lAe,{})}];function gOe({children:e}){const{isLoaded:t,isSignedIn:s}=zt(),n=Wr();return x.useEffect(()=>{let a=document.querySelector('meta[name="robots"]');const o=!!a;return a||(a=document.createElement("meta"),a.name="robots",document.head.appendChild(a)),a.content="noindex, nofollow",()=>{!o&&a&&a.remove()}},[]),t?s?r.jsx(r.Fragment,{children:e}):r.jsx(sv,{to:"/",replace:!0,state:{from:n}}):null}function xOe(){const{user:e,isLoaded:t}=_r(),{getToken:s}=zt(),n=Wr(),[a,o]=x.useState(null),[i,l]=x.useState(!1),[c,u]=x.useState(!1),[f,h]=x.useState(()=>typeof window>"u"?!1:localStorage.getItem("floatingUpgradeCollapsed")==="true");if(x.useEffect(()=>{(async()=>{if(!(!e||!t))try{l(!0);const j=await Ue(s);if(!j)return;const w=await fetch("https://reqres.in/clerk/payment-status",{headers:{Authorization:`Bearer ${j}`,"Content-Type":"application/json"}});if(w.ok){const k=await w.json();o(k),Z.setPlanTier(k.subscriptionTier)}}catch(j){console.error("Error fetching payment status:",j)}finally{l(!1)}})()},[e,s,t]),x.useEffect(()=>{const _=()=>{const w=document.querySelectorAll(".modal-overlay");u(w.length>0)};_();const j=new MutationObserver(_);return j.observe(document.body,{childList:!0,subtree:!0}),()=>j.disconnect()},[]),!t||!e||n.pathname==="/upgrade")return null;const g=e!=null&&e.createdAt?Date.now()-new Date(e.createdAt).getTime():0;if(i||(a==null?void 0:a.subscriptionTier)==="premium"||c||f||g<24*60*60*1e3)return null;const y=(()=>{const _=a==null?void 0:a.subscriptionTier;return!(a!=null&&a.hasPaid)||_==="free"?{text:"Free plan - upgrade to Dev ($12/mo) for more collections, longer logs, and automations.",button:"Upgrade to Dev"}:_==="dev"?{text:"Dev plan - upgrade to Pro ($29/mo) for 20 collections, payload logs, and 30-day retention.",button:"Upgrade to Pro"}:_==="pro"?{text:"Need team features? Team plan ($79/mo) adds seats, org billing, and shared projects.",button:"See Team plans"}:{text:"Upgrade for higher limits and more features.",button:"See plans"}})();return r.jsx("div",{className:"fixed bottom-16 right-7 z-[999] max-w-[420px] animate-[slideInUp_0.5s_ease-out] sm:bottom-[4.5rem] sm:right-4 sm:left-4 sm:max-w-none lg:left-auto lg:right-7 lg:max-w-[420px]",children:r.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-[var(--color-bg-card)] border border-indigo-500/20 p-4",children:[r.jsxs("svg",{className:"pointer-events-none absolute -right-2 -top-1 w-28 h-18 opacity-[0.12]",viewBox:"0 0 240 100",fill:"none",children:[r.jsx("polygon",{points:"75,5 101,20 101,50 75,65 49,50 49,20",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"49",y1:"20",x2:"75",y2:"35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"101",y1:"20",x2:"75",y2:"35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"75",y1:"35",x2:"75",y2:"65",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("polygon",{points:"165,20 191,35 191,65 165,80 139,65 139,35",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"139",y1:"35",x2:"165",y2:"50",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"191",y1:"35",x2:"165",y2:"50",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"165",y1:"50",x2:"165",y2:"80",stroke:"#d4d4c8",strokeWidth:.75}),r.jsx("line",{x1:"101",y1:"35",x2:"139",y2:"35",stroke:"#d4d4c8",strokeWidth:.75,strokeDasharray:"4 3"})]}),r.jsxs("div",{className:"relative z-[1] flex flex-wrap items-center gap-3",children:[r.jsx("p",{className:"flex-1 min-w-0 text-sm text-[var(--color-fg-secondary)]",children:y.text}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx("a",{href:"/upgrade",className:"inline-flex items-center justify-center rounded-md bg-indigo-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-400 transition",onClick:()=>Z.upgradeClicked("floating_cta",a==null?void 0:a.subscriptionTier),children:y.button}),r.jsx("button",{type:"button",className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",onClick:()=>{h(!0),typeof window<"u"&&localStorage.setItem("floatingUpgradeCollapsed","true")},children:"Hide"})]})]})]})})}function LY(){const{isSignedIn:e,isLoaded:t}=zt(),s=Wr(),n=[{title:"Projects, not endpoints",copy:"Each project comes with keys, collections, app users, logs, and automations."},{title:"Frontend-first",copy:"Call everything with fetch(); no servers, migrations, or auth wiring to maintain."}
6153,{title:"App-user ready",copy:"Magic links create session tokens for client-side reads/writes per user."}];return r.jsx("div",{className:"space-y-10",children:r.jsxs("div",{className:"relative isolate overflow-hidden rounded-3xl border border-[var(--color-border-default)] bg-[var(--color-bg-card)] text-[var(--color-fg-default)] shadow-[0_20px_60px_var(--color-shadow)]",children:[r.jsx("div",{className:"absolute -left-32 top-0 h-64 w-64 rounded-full bg-indigo-500/20 blur-3xl"}),r.jsx("div",{className:"absolute -right-24 bottom-0 h-64 w-64 rounded-full bg-sky-500/10 blur-3xl"}),r.jsxs("div",{className:"relative max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12 space-y-10",children:[r.jsxs("section",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-[var(--color-fg-muted)]",children:"Frontend-first backend"}),r.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold leading-tight text-[var(--color-fg-default)]",children:"Build real projects with collections, app users, logs, and automations - no backend to run."}),r.jsx("p",{className:"text-base text-[var(--color-fg-secondary)] max-w-3xl",children:"This is the dashboard entry point. Create a project, grab keys, and connect your UI. For full marketing copy, templates, and examples, head to reqres.in."})]}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[r.jsx(Gi,{children:r.jsx(Xf,{mode:"modal",children:r.jsx("button",{type:"button",className:"inline-flex items-center justify-center rounded-xl bg-indigo-500 px-4 py-2 text-sm font-semibold text-white shadow-[0_18px_40px_rgba(79,70,229,0.35)] hover:bg-indigo-400 transition","data-visitors-event":"Signup CTA","data-visitors-source":"app_project_landing",onClick:()=>Z.track("signup_started",{path:s.pathname}),children:"Start free"})})}),r.jsx("a",{href:"/documentation?section=quickstart",className:"inline-flex items-center justify-center rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-2 text-sm font-semibold text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition","data-visitors-event":"Docs CTA","data-visitors-source":"app_project_landing",children:"View docs"})]})]}),r.jsx("section",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:n.map(a=>r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-4 shadow-inner",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:a.title}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)] leading-relaxed",children:a.copy})]},a.title))}),r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-[var(--color-fg-muted)]",children:"See what you can build"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"Complete apps. Zero backend code. Fork them and make them yours."})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full border border-indigo-500/30 bg-indigo-500/10 text-indigo-400",children:"Auth + CRUD"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Task Manager"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] leading-relaxed",children:"Magic code login, scoped data per user, full CRUD with pagination. The complete app-user authentication flow."})]}),r.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[r.jsx("a",{href:"https://demo.reqres.in",target:"_blank",rel:"noreferrer",className:"text-xs font-medium text-indigo-400 hover:text-indigo-300 transition",children:"Live Demo â"}),r.jsx("a",{href:"https://github.com/benhowdle89/reqres-demo-app",target:"_blank",rel:"noreferrer",className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Source Code"})]})]}),r.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-5 space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full border border-purple-500/30 bg-purple-500/10 text-purple-400",children:"Signup + Admin"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Waitlist"}),r.jsx("p",{className:"text-xs text-[var(--color-fg-secondary)] leading-relaxed",children:"Public signup form, admin dashboard with search and filtering, duplicate detection, position tracking."})]}),r.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[r.jsx("a",{href:"https://reqres-waitlist-demo.reqres.workers.dev",target:"_blank",rel:"noreferrer",className:"text-xs font-medium text-indigo-400 hover:text-indigo-300 transition",children:"Live Demo â"}),r.jsx("a",{href:"https://github.com/benhowdle89/reqres-waitlist-demo",target:"_blank",rel:"noreferrer",className:"text-xs text-[var(--color-fg-muted)] hover:text-[var(--color-fg-default)] transition",children:"Source Code"})]})]})]})]}),t&&e?r.jsxs("section",{className:"rounded-2xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] p-6 space-y-3",children:[r.jsx("p",{className:"text-sm font-semibold text-[var(--color-fg-default)]",children:"Already signed in?"}),r.jsx("p",{className:"text-sm text-[var(--color-fg-secondary)]",children:"We'll redirect you to your dashboard. Otherwise, sign in or start a project to continue."}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("a",{href:"/dashboard",className:"inline-flex items-center justify-center rounded-xl bg-indigo-500 px-4 py-2 text-sm font-semibold text-white shadow-[0_12px_32px_rgba(79,70,229,0.35)] hover:bg-indigo-400 transition","data-visitors-event":"Dashboard CTA","data-visitors-source":"app_project_landing_returning",children:"Go to dashboard"}),r.jsx("a",{href:"/projects",className:"inline-flex items-center justify-center rounded-xl border border-[var(--color-border-default)] bg-[var(--color-bg-alt)] px-4 py-2 text-sm font-semibold text-[var(--color-fg-default)] hover:bg-[var(--color-bg-hover)] transition","data-visitors-event":"Projects CTA","data-visitors-source":"app_project_landing_returning",children:"Browse projects"})]})]}):null]})]})})}function vOe(){const{isSignedIn:e,isLoaded:t}=zt(),{openSignUp:s}=hle(),n=x.useRef(!1),a=Wr(),o=new URLSearchParams(a.search),i=o.get("next"),l=i&&i.startsWith("/")?i:null,c=hG(a.search),u=o.get("source");x.useEffect(()=>{c!=null&&c.plan&&!e&&ICe(c.plan,u||c.source)},[c,u,e]);const h=(()=>
6153{if(l)return l;if(c!=null&&c.plan){const g=new URLSearchParams;return g.set("plan",c.plan),(u||c.source)&&g.set("source",u||c.source||""),`/upgrade?${g.toString()}`}return"/dashboard"})();return x.useEffect(()=>{if(!t||e||n.current)return;n.current=!0,Z.track("auth_wall_shown",{referrer:document.referrer||"$direct",entry_url:window.location.href}),(async()=>{try{await s({fallbackRedirectUrl:h})}catch{n.current=!1}})()},[t,e,s,h]),t&&e?r.jsx(sv,{to:h,replace:!0,state:{from:a}}):r.jsx(LY,{})}function bOe(){const e=Wr(),t=un(),{ClipboardToast:s}=hm(),{user:n,isLoaded:a}=_r(),o=x.useRef(null),i=x.useRef(!1),l=x.useRef(!1);x.useEffect(()=>{Z.page(e.pathname)},[e]),x.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[e.pathname]);const c=u=>{if(typeof document>"u")return;const f=window.location.hostname,g=f.endsWith(".reqres.in")||f==="reqres.in"?"domain=.reqres.in; ":"",v=window.location.protocol==="https:"?"secure; ":"",y=u==="1"?60*60*24*30:0;document.cookie=`rr_signed_in=${u}; ${g}path=/; ${v}SameSite=Lax; max-age=${y}`};return x.useEffect(()=>{var g,v,y;if(!a)return;if(!n){o.current&&(Z.reset(),D3(null),localStorage.clear(),c("")),o.current=null,i.current=!1;return}c("1");const f=((g=n.publicMetadata)==null?void 0:g.plan_tier)||((v=n.publicMetadata)==null?void 0:v.subscriptionTier)||"free",h=n.createdAt?new Date(n.createdAt).toISOString():void 0;if(Z.identify(n.id,{plan_tier:f,created_at:h}),Z.setPlanTier(f),D3({id:n.id,email:(y=n.primaryEmailAddress)==null?void 0:y.emailAddress}),TQ("tier",f),o.current=n.id,!i.current)try{localStorage.getItem(SU)!==n.id&&(Z.clearAttribution(),localStorage.setItem(SU,n.id)),i.current=!0}catch{}if(!l.current){l.current=!0;const _=wAe();_&&!e.pathname.startsWith("/invite/")&&(OW(),t(`/invite/${_}`))}},[n,a,t,e.pathname]),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(o5e,{}),r.jsx(c5e,{}),r.jsx(u5e,{}),r.jsx(h5e,{}),r.jsx(Dhe,{}),r.jsxs("div",{className:"flex",children:[r.jsx(Uxe,{}),r.jsx("main",{className:"flex-1 min-w-0 overflow-x-hidden px-4 pt-6 pb-24 sm:px-6 lg:px-8",children:r.jsxs(yde,{children:[r.jsx(jr,{path:"/",element:r.jsx(vOe,{})}),r.jsx(jr,{path:"/home",element:r.jsx(LY,{})}),mOe.map(u=>r.jsx(jr,{path:u.path,element:r.jsx(gOe,{children:u.element})},u.path)),r.jsx(jr,{path:"/pack-thanks",element:r.jsx(ZCe,{})}),r.jsx(jr,{path:"/getting-started",element:r.jsx(s5e,{})}),r.jsx(jr,{path:"/documentation",element:r.jsx(DEe,{})}),r.jsx(jr,{path:"/guides",element:r.jsx(k5e,{})}),r.jsx(jr,{path:"/playground",element:r.jsx(rTe,{})}),r.jsx(jr,{path:"/console",element:r.jsx(gTe,{})}),r.jsx(jr,{path:"/examples/notes-app",element:r.jsx(I$,{})}),r.jsx(jr,{path:"/guides/notes-app",element:r.jsx(I$,{})}),r.jsx(jr,{path:"/guides/:slug",element:r.jsx(w5e,{})}),r.jsx(jr,{path:"/faq",element:r.jsx(HEe,{})}),r.jsx(jr,{path:"/templates",element:r.jsx(GEe,{})}),r.jsx(jr,{path:"/recipes",element:r.jsx(r5e,{})}),r.jsx(jr,{path:"/enterprise",element:r.jsx(n5e,{})}),r.jsx(jr,{path:"/ui",element:r.jsx($5e,{})}),r.jsx(jr,{path:"/signup",element:r.jsx(JCe,{})}),r.jsx(jr,{path:"/invite/:token",element:r.jsx(NAe,{})}),r.jsx(jr,{path:"/admin",element:r.jsx(e0,{children:r.jsx(JMe,{})})}),r.jsx(jr,{path:"/admin/briefings",element:r.jsx(e0,{children:r.jsx(CAe,{})})}),r.jsx(jr,{path:"/admin/traffic",element:r.jsx(e0,{children:r.jsx(yMe,{})})}),r.jsx(jr,{path:"/admin/outreach",element:r.jsx(e0,{children:r.jsx($Me,{})})}),r.jsx(jr,{path:"*",element:r.jsx(sv,{to:"/",replace:!0})})]})})]}),r.jsx(fOe,{position:"top-right",richColors:!0,closeButton:!0}),r.jsx(aOe,{}),r.jsx(m5e,{}),r.jsx(lOe,{}),r.jsx(eOe,{}),r.jsx(xOe,{}),r.jsx(s,{})]})}function yOe(){return r.jsx(VB,{publishableKey:hOe,children:r.jsx(zue,{children:r.jsx(Vde,{children:r.jsx(bOe,{})})})})}function _Oe(){[document.documentElement,document.body,document.getElementById("root")].forEach(t=>{t&&(t.setAttribute("translate","no"),t.classList.add("notranslate"))})}const jOe=["runtime.sendMessage","Tab not found","Extension context invalidated",/Object Not Found Matching Id:\d+, MethodName:(update|set), ParamCount:\d+/,"ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"],wOe=["extension://","chrome-extension://","moz-extension://","safari-extension://","safari-web-extension://"];Boe({dsn:"https://91422c118be7a1c83a10aa96b862941f@o4510556096299008.ingest.de.sentry.io/4510556125069392",enabled:!0,sendDefaultPii:!1,environment:"production",tracesSampleRate:.2,replaysSessionSampleRate:.01,replaysOnErrorSampleRate:1,ignoreErrors:jOe,integrations:[Loe(),xoe({maskAllText:!0,blockAllMedia:!0})],beforeSend(e){var n,a,o,i,l,c,u,f;if((l=(i=(o=(a=(n=e.exception)==null?void 0:n.values)==null?void 0:a[0])==null?void 0:o.stacktrace)==null?void 0:i.frames)==null?void 0:l.some(h=>{const g=h.filename||"";return wOe.some(v=>g.includes(v))}))return null;const s=((f=(u=(c=e.exception)==null?void 0:c.values)==null?void 0:u[0])==null?void 0:f.value)||e.message||"";if(typeof s=="string"){const h=s.toLowerCase();if(h.includes("runtime.sendmessage")||h.includes("tab not found")||h.includes("extension context invalidated")||h.includes("session has expired")||h.includes("dashboard session token is invali
6153d"))return null}return e}});Z.init();_Oe();function NOe(){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",fontFamily:"system-ui, sans-serif",color:"#e2e8f0",background:"#0f172a"},children:[r.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:600,marginBottom:"0.5rem"},children:"Something went wrong"}),r.jsx("p",{style:{fontSize:"0.875rem",color:"#94a3b8",marginBottom:"1.5rem"},children:"We've been notified and are looking into it."}),r.jsx("button",{type:"button",onClick:()=>window.location.reload(),style:{padding:"0.5rem 1rem",borderRadius:"0.5rem",border:"1px solid #334155",background:"#1e293b",color:"#e2e8f0",cursor:"pointer",fontSize:"0.875rem"},children:"Reload page"})]})}yJ.createRoot(document.getElementById("root")).render(r.jsx(x.StrictMode,{children:r.jsx(Goe,{fallback:r.jsx(NOe,{}),children:r.jsx(yOe,{})})})); 6154//# sourceMappingURL=index-C-ml3XR8.js.map
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.