@claroshq/claros 0.0.0-stage → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/assets/dashboard/apple-touch-icon.png +0 -0
  4. package/assets/dashboard/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  5. package/assets/dashboard/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  6. package/assets/dashboard/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  7. package/assets/dashboard/assets/index-Dvs1k10B.js +23 -0
  8. package/assets/dashboard/assets/index-gR64IOwq.css +1 -0
  9. package/assets/dashboard/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
  10. package/assets/dashboard/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
  11. package/assets/dashboard/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  12. package/assets/dashboard/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  13. package/assets/dashboard/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  14. package/assets/dashboard/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  15. package/assets/dashboard/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  16. package/assets/dashboard/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  17. package/assets/dashboard/assets/quicksand-latin-ext-wght-normal-CrJ75Ewg.woff2 +0 -0
  18. package/assets/dashboard/assets/quicksand-latin-wght-normal-Buj9m_3d.woff2 +0 -0
  19. package/assets/dashboard/assets/quicksand-vietnamese-wght-normal-ei70gACF.woff2 +0 -0
  20. package/assets/dashboard/claros.js +122 -0
  21. package/assets/dashboard/favicon-16.png +0 -0
  22. package/assets/dashboard/favicon-32.png +0 -0
  23. package/assets/dashboard/favicon.ico +0 -0
  24. package/assets/dashboard/favicon.svg +17 -0
  25. package/assets/dashboard/fonts-license.txt +119 -0
  26. package/assets/dashboard/index.html +34 -0
  27. package/assets/migrations/0000_baseline.sql +343 -0
  28. package/assets/migrations/0001_kb_fts.sql +22 -0
  29. package/assets/migrations/0002_instance_layer.sql +51 -0
  30. package/assets/migrations/0003_suppressions_lower_email.sql +22 -0
  31. package/assets/migrations/0004_claim_tokens.sql +9 -0
  32. package/assets/migrations/0005_topics_transports.sql +36 -0
  33. package/assets/migrations/0006_ops_alerts.sql +28 -0
  34. package/assets/migrations/0007_integration_surface.sql +46 -0
  35. package/assets/migrations/0008_p5_engine.sql +31 -0
  36. package/assets/migrations/0009_p5b_readiness.sql +11 -0
  37. package/assets/migrations/meta/0000_snapshot.json +2489 -0
  38. package/assets/migrations/meta/0002_snapshot.json +2645 -0
  39. package/assets/migrations/meta/0004_snapshot.json +2698 -0
  40. package/assets/migrations/meta/0005_snapshot.json +2959 -0
  41. package/assets/migrations/meta/0006_snapshot.json +3138 -0
  42. package/assets/migrations/meta/0007_snapshot.json +3469 -0
  43. package/assets/migrations/meta/0008_snapshot.json +3709 -0
  44. package/assets/migrations/meta/0009_snapshot.json +3785 -0
  45. package/assets/migrations/meta/_journal.json +76 -0
  46. package/assets/worker/index.js +57863 -0
  47. package/bin/claros.mjs +13 -0
  48. package/dist/apply.d.ts +10 -0
  49. package/dist/apply.d.ts.map +1 -0
  50. package/dist/apply.js +72 -0
  51. package/dist/apply.js.map +1 -0
  52. package/dist/assets.d.ts +15 -0
  53. package/dist/assets.d.ts.map +1 -0
  54. package/dist/assets.js +48 -0
  55. package/dist/assets.js.map +1 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.d.ts.map +1 -0
  58. package/dist/claim.js +26 -0
  59. package/dist/claim.js.map +1 -0
  60. package/dist/cli.d.ts +13 -0
  61. package/dist/cli.d.ts.map +1 -0
  62. package/dist/cli.js +158 -0
  63. package/dist/cli.js.map +1 -0
  64. package/dist/cloudflare-api.d.ts +48 -0
  65. package/dist/cloudflare-api.d.ts.map +1 -0
  66. package/dist/cloudflare-api.js +94 -0
  67. package/dist/cloudflare-api.js.map +1 -0
  68. package/dist/import.d.ts +16 -0
  69. package/dist/import.d.ts.map +1 -0
  70. package/dist/import.js +97 -0
  71. package/dist/import.js.map +1 -0
  72. package/dist/ops.d.ts +84 -0
  73. package/dist/ops.d.ts.map +1 -0
  74. package/dist/ops.js +552 -0
  75. package/dist/ops.js.map +1 -0
  76. package/dist/state.d.ts +53 -0
  77. package/dist/state.d.ts.map +1 -0
  78. package/dist/state.js +87 -0
  79. package/dist/state.js.map +1 -0
  80. package/dist/template.d.ts +77 -0
  81. package/dist/template.d.ts.map +1 -0
  82. package/dist/template.js +127 -0
  83. package/dist/template.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +36 -0
  87. package/dist/version.js.map +1 -0
  88. package/dist/wrangler.d.ts +116 -0
  89. package/dist/wrangler.d.ts.map +1 -0
  90. package/dist/wrangler.js +210 -0
  91. package/dist/wrangler.js.map +1 -0
  92. package/package.json +53 -4
@@ -0,0 +1,23 @@
1
+ (function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function Tv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ff={exports:{}},ti={};var vy;function zw(){if(vy)return ti;vy=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,d,f){var m=null;if(f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),"key"in d){f={};for(var p in d)p!=="key"&&(f[p]=d[p])}else f=d;return d=f.ref,{$$typeof:n,type:o,key:m,ref:d!==void 0?d:null,props:f}}return ti.Fragment=r,ti.jsx=i,ti.jsxs=i,ti}var by;function Mw(){return by||(by=1,ff.exports=zw()),ff.exports}var a=Mw(),mf={exports:{}},Se={};var jy;function Dw(){if(jy)return Se;jy=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),S=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=S&&T[S]||T["@@iterator"],typeof T=="function"?T:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,A={};function C(T,q,ae){this.props=T,this.context=q,this.refs=A,this.updater=ae||k}C.prototype.isReactComponent={},C.prototype.setState=function(T,q){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,q,"setState")},C.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function B(){}B.prototype=C.prototype;function V(T,q,ae){this.props=T,this.context=q,this.refs=A,this.updater=ae||k}var F=V.prototype=new B;F.constructor=V,_(F,C.prototype),F.isPureReactComponent=!0;var U=Array.isArray;function Z(){}var Q={H:null,A:null,T:null,S:null},xe=Object.prototype.hasOwnProperty;function he(T,q,ae){var fe=ae.ref;return{$$typeof:n,type:T,key:q,ref:fe!==void 0?fe:null,props:ae}}function Ne(T,q){return he(T.type,q,T.props)}function Ae(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function ee(T){var q={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ae){return q[ae]})}var ze=/\/+/g;function Ee(T,q){return typeof T=="object"&&T!==null&&T.key!=null?ee(""+T.key):q.toString(36)}function G(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(Z,Z):(T.status="pending",T.then(function(q){T.status==="pending"&&(T.status="fulfilled",T.value=q)},function(q){T.status==="pending"&&(T.status="rejected",T.reason=q)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function Y(T,q,ae,fe,Me){var me=typeof T;(me==="undefined"||me==="boolean")&&(T=null);var ke=!1;if(T===null)ke=!0;else switch(me){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(T.$$typeof){case n:case r:ke=!0;break;case v:return ke=T._init,Y(ke(T._payload),q,ae,fe,Me)}}if(ke)return Me=Me(T),ke=fe===""?"."+Ee(T,0):fe,U(Me)?(ae="",ke!=null&&(ae=ke.replace(ze,"$&/")+"/"),Y(Me,q,ae,"",function(Ot){return Ot})):Me!=null&&(Ae(Me)&&(Me=Ne(Me,ae+(Me.key==null||T&&T.key===Me.key?"":(""+Me.key).replace(ze,"$&/")+"/")+ke)),q.push(Me)),1;ke=0;var ce=fe===""?".":fe+":";if(U(T))for(var ve=0;ve<T.length;ve++)fe=T[ve],me=ce+Ee(fe,ve),ke+=Y(fe,q,ae,me,Me);else if(ve=w(T),typeof ve=="function")for(T=ve.call(T),ve=0;!(fe=T.next()).done;)fe=fe.value,me=ce+Ee(fe,ve++),ke+=Y(fe,q,ae,me,Me);else if(me==="object"){if(typeof T.then=="function")return Y(G(T),q,ae,fe,Me);throw q=String(T),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return ke}function re(T,q,ae){if(T==null)return T;var fe=[],Me=0;return Y(T,fe,"","",function(me){return q.call(ae,me,Me++)}),fe}function He(T){if(T._status===-1){var q=T._result,ae=q();ae.then(function(fe){(T._status===0||T._status===-1)&&(T._status=1,T._result=fe,ae.status===void 0&&(ae.status="fulfilled",ae.value=fe))},function(fe){(T._status===0||T._status===-1)&&(T._status=2,T._result=fe,ae.status===void 0&&(ae.status="rejected",ae.reason=fe))}),T._status===-1&&(T._status=0,T._result=ae)}if(T._status===1)return T._result.default;throw T._result}var W=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)};function X(T){var q=Q.T,ae={};ae.types=q!==null?q.types:null,Q.T=ae;try{var fe=T(),Me=Q.S;Me!==null&&Me(ae,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(Z,W)}catch(me){W(me)}finally{q!==null&&ae.types!==null&&(q.types=ae.types),Q.T=q}}function je(T){var q=Q.T;if(q!==null){var ae=q.types;ae===null?q.types=[T]:ae.indexOf(T)===-1&&ae.push(T)}else X(je.bind(null,T))}var J={map:re,forEach:function(T,q,ae){re(T,function(){q.apply(this,arguments)},ae)},count:function(T){var q=0;return re(T,function(){q++}),q},toArray:function(T){return re(T,function(q){return q})||[]},only:function(T){if(!Ae(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Se.Activity=y,Se.Children=J,Se.Component=C,Se.Fragment=i,Se.Profiler=d,Se.PureComponent=V,Se.StrictMode=o,Se.Suspense=h,Se.ViewTransition=b,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,Se.__COMPILER_RUNTIME={__proto__:null,c:function(T){return Q.H.useMemoCache(T)}},Se.addTransitionType=je,Se.cache=function(T){return function(){return T.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(T,q,ae){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var fe=_({},T.props),Me=T.key;if(q!=null)for(me in q.key!==void 0&&(Me=""+q.key),q)!xe.call(q,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&q.ref===void 0||(fe[me]=q[me]);var me=arguments.length-2;if(me===1)fe.children=ae;else if(1<me){for(var ke=Array(me),ce=0;ce<me;ce++)ke[ce]=arguments[ce+2];fe.children=ke}return he(T.type,Me,fe)},Se.createContext=function(T){return T={$$typeof:m,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},Se.createElement=function(T,q,ae){var fe,Me={},me=null;if(q!=null)for(fe in q.key!==void 0&&(me=""+q.key),q)xe.call(q,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(Me[fe]=q[fe]);var ke=arguments.length-2;if(ke===1)Me.children=ae;else if(1<ke){for(var ce=Array(ke),ve=0;ve<ke;ve++)ce[ve]=arguments[ve+2];Me.children=ce}if(T&&T.defaultProps)for(fe in ke=T.defaultProps,ke)Me[fe]===void 0&&(Me[fe]=ke[fe]);return he(T,me,Me)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(T){return{$$typeof:p,render:T}},Se.isValidElement=Ae,Se.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:He}},Se.memo=function(T,q){return{$$typeof:g,type:T,compare:q===void 0?null:q}},Se.startTransition=X,Se.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},Se.use=function(T){return Q.H.use(T)},Se.useActionState=function(T,q,ae){return Q.H.useActionState(T,q,ae)},Se.useCallback=function(T,q){return Q.H.useCallback(T,q)},Se.useContext=function(T){return Q.H.useContext(T)},Se.useDebugValue=function(){},Se.useDeferredValue=function(T,q){return Q.H.useDeferredValue(T,q)},Se.useEffect=function(T,q){return Q.H.useEffect(T,q)},Se.useEffectEvent=function(T){return Q.H.useEffectEvent(T)},Se.useId=function(){return Q.H.useId()},Se.useImperativeHandle=function(T,q,ae){return Q.H.useImperativeHandle(T,q,ae)},Se.useInsertionEffect=function(T,q){return Q.H.useInsertionEffect(T,q)},Se.useLayoutEffect=function(T,q){return Q.H.useLayoutEffect(T,q)},Se.useMemo=function(T,q){return Q.H.useMemo(T,q)},Se.useOptimistic=function(T,q){return Q.H.useOptimistic(T,q)},Se.useReducer=function(T,q,ae){return Q.H.useReducer(T,q,ae)},Se.useRef=function(T){return Q.H.useRef(T)},Se.useState=function(T){return Q.H.useState(T)},Se.useSyncExternalStore=function(T,q,ae){return Q.H.useSyncExternalStore(T,q,ae)},Se.useTransition=function(){return Q.H.useTransition()},Se.version="19.3.1",Se}var Ny;function lm(){return Ny||(Ny=1,mf.exports=Dw()),mf.exports}var j=lm();const im=Tv(j);var hf={exports:{}},ni={},xf={exports:{}},pf={};var wy;function Lw(){return wy||(wy=1,(function(n){function r(G,Y){var re=G.length;G.push(Y);e:for(;0<re;){var He=re-1>>>1,W=G[He];if(0<d(W,Y))G[He]=Y,G[re]=W,re=He;else break e}}function i(G){return G.length===0?null:G[0]}function o(G){if(G.length===0)return null;var Y=G[0],re=G.pop();if(re!==Y){G[0]=re;e:for(var He=0,W=G.length,X=W>>>1;He<X;){var je=2*(He+1)-1,J=G[je],T=je+1,q=G[T];if(0>d(J,re))T<W&&0>d(q,J)?(G[He]=q,G[T]=re,He=T):(G[He]=J,G[je]=re,He=je);else if(T<W&&0>d(q,re))G[He]=q,G[T]=re,He=T;else break e}}return Y}function d(G,Y){var re=G.sortIndex-Y.sortIndex;return re!==0?re:G.id-Y.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var h=[],g=[],v=1,y=null,b=3,S=!1,w=!1,k=!1,_=!1,A=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function V(G){for(var Y=i(g);Y!==null;){if(Y.callback===null)o(g);else if(Y.startTime<=G)o(g),Y.sortIndex=Y.expirationTime,r(h,Y);else break;Y=i(g)}}function F(G){if(k=!1,V(G),!w)if(i(h)!==null)w=!0,U||(U=!0,Ae());else{var Y=i(g);Y!==null&&Ee(F,Y.startTime-G)}}var U=!1,Z=-1,Q=5,xe=-1;function he(){return _?!0:!(n.unstable_now()-xe<Q)}function Ne(){if(_=!1,U){var G=n.unstable_now();xe=G;var Y=!0;try{e:{w=!1,k&&(k=!1,C(Z),Z=-1),S=!0;var re=b;try{t:{for(V(G),y=i(h);y!==null&&!(y.expirationTime>G&&he());){var He=y.callback;if(typeof He=="function"){y.callback=null,b=y.priorityLevel;var W=He(y.expirationTime<=G);if(G=n.unstable_now(),typeof W=="function"){y.callback=W,V(G),Y=!0;break t}y===i(h)&&o(h),V(G)}else o(h);y=i(h)}if(y!==null)Y=!0;else{var X=i(g);X!==null&&Ee(F,X.startTime-G),Y=!1}}break e}finally{y=null,b=re,S=!1}Y=void 0}}finally{Y?Ae():U=!1}}}var Ae;if(typeof B=="function")Ae=function(){B(Ne)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,ze=ee.port2;ee.port1.onmessage=Ne,Ae=function(){ze.postMessage(null)}}else Ae=function(){A(Ne,0)};function Ee(G,Y){Z=A(function(){G(n.unstable_now())},Y)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(G){G.callback=null},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(G){switch(b){case 1:case 2:case 3:var Y=3;break;default:Y=b}var re=b;b=Y;try{return G()}finally{b=re}},n.unstable_requestPaint=function(){_=!0},n.unstable_runWithPriority=function(G,Y){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var re=b;b=G;try{return Y()}finally{b=re}},n.unstable_scheduleCallback=function(G,Y,re){var He=n.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?He+re:He):re=He,G){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=re+W,G={id:v++,callback:Y,priorityLevel:G,startTime:re,expirationTime:W,sortIndex:-1},re>He?(G.sortIndex=re,r(g,G),i(h)===null&&G===i(g)&&(k?(C(Z),Z=-1):k=!0,Ee(F,re-He))):(G.sortIndex=W,r(h,G),w||S||(w=!0,U||(U=!0,Ae()))),G},n.unstable_shouldYield=he,n.unstable_wrapCallback=function(G){var Y=b;return function(){var re=b;b=Y;try{return G.apply(this,arguments)}finally{b=re}}}})(pf)),pf}var Sy;function Uw(){return Sy||(Sy=1,xf.exports=Lw()),xf.exports}var gf={exports:{}},Ht={};var _y;function qw(){if(_y)return Ht;_y=1;var n=lm();function r(v){var y="https://react.dev/errors/"+v;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)y+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+v+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},d=Symbol.for("react.portal"),f=Symbol.for("react.recoverable"),m=Symbol.for("react.optimistic_key");function p(v,y,b){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:S==null?null:S===m?m:""+S,children:v,containerInfo:y,implementation:b}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,y){if(v==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return Ht.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Ht.browser=function(v){return{$$typeof:f,_reason:v}},Ht.createPortal=function(v,y){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(r(299));return p(v,y,null,b)},Ht.flushSync=function(v){var y=h.T,b=o.p;try{if(h.T=null,o.p=2,v)return v()}finally{h.T=y,o.p=b,o.d.f()}},Ht.preconnect=function(v,y){typeof v=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,o.d.C(v,y))},Ht.prefetchDNS=function(v){typeof v=="string"&&o.d.D(v)},Ht.preinit=function(v,y){if(typeof v=="string"&&y&&typeof y.as=="string"){var b=y.as,S=g(b,y.crossOrigin),w=typeof y.integrity=="string"?y.integrity:void 0,k=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;b==="style"?o.d.S(v,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:S,integrity:w,fetchPriority:k}):b==="script"&&o.d.X(v,{crossOrigin:S,integrity:w,fetchPriority:k,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},Ht.preinitModule=function(v,y){if(typeof v=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var b=g(y.as,y.crossOrigin);o.d.M(v,{crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0})}}else y==null&&o.d.M(v)},Ht.preload=function(v,y){if(typeof v=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var b=y.as,S=g(b,y.crossOrigin);o.d.L(v,b,{crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},Ht.preloadModule=function(v,y){if(typeof v=="string")if(y){var b=g(y.as,y.crossOrigin);o.d.m(v,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0})}else o.d.m(v)},Ht.requestFormReset=function(v){o.d.r(v)},Ht.unstable_batchedUpdates=function(v,y){return v(y)},Ht.useFormState=function(v,y,b){return h.H.useFormState(v,y,b)},Ht.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ht.version="19.3.1",Ht}var ky;function Hw(){if(ky)return gf.exports;ky=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),gf.exports=qw(),gf.exports}var Ey;function $w(){if(Ey)return ni;Ey=1;var n=Uw(),r=lm(),i=Hw();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){for(var t=e,s=t;s&&!s.alternate;)t=s,(t.flags&4098)!==0&&(e=t.return),s=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(f(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var s=e,l=t;;){var c=s.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){s=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===s)return h(c),e;if(u===l)return h(c),t;u=u.sibling}throw Error(o(188))}if(s.return!==l.return)s=c,l=u;else{for(var x=!1,N=c.child;N;){if(N===s){x=!0,s=c,l=u;break}if(N===l){x=!0,l=c,s=u;break}N=N.sibling}if(!x){for(N=u.child;N;){if(N===s){x=!0,s=u,l=c;break}if(N===l){x=!0,l=u,s=c;break}N=N.sibling}if(!x)throw Error(o(189))}}if(s.alternate!==l)throw Error(o(190))}if(s.tag!==3)throw Error(o(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}function y(e,t,s,l,c,u){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&s(e,l,c,u)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&y(e.child,t,s,l,c,u))return!0;e=e.sibling}return!1}function b(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function S(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function w(e){var t=[null,null],s=b(e);return s===null||k(t,e,s.child,{foundSelf:!1}),t}function k(e,t,s,l){for(;s!==null;){if(s===t)l.foundSelf=!0;else if(s.tag===5||s.tag===27||s.tag===6){if(l.foundSelf)return e[1]=s,!0;e[0]=s}else if((s.tag!==22||s.memoizedState===null)&&k(e,t,s.child,l))return!0;s=s.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var A=null,C=null;function B(e,t,s){return e===s?!0:e===t?(A=e,!0):!1}function V(e,t,s){return e===s?(C=e,!1):e===t?(C!==null&&(A=e),!0):!1}function F(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function U(e,t,s){for(var l=0,c=e;c;c=s(c))l++;c=0;for(var u=t;u;u=s(u))c++;for(;0<l-c;)e=s(e),l--;for(;0<c-l;)t=s(t),c--;for(;l--;){if(e===t||t!==null&&e===t.alternate)return e;e=s(e),t=s(t)}return null}var Z=Object.assign,Q=Symbol.for("react.element"),xe=Symbol.for("react.transitional.element"),he=Symbol.for("react.portal"),Ne=Symbol.for("react.fragment"),Ae=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),ze=Symbol.for("react.consumer"),Ee=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),He=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),je=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.memo_cache_sentinel"),T=Symbol.for("react.view_transition"),q=Symbol.for("react.recoverable"),ae=Symbol.iterator;function fe(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var Me=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ne:return"Fragment";case ee:return"Profiler";case Ae:return"StrictMode";case Y:return"Suspense";case re:return"SuspenseList";case X:return"Activity";case T:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case he:return"Portal";case Ee:return e.displayName||"Context";case ze:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case He:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var ke=Array.isArray,ce=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ot={pending:!1,data:null,method:null,action:null},Mn=[],Ca=-1;function bn(e){return{current:e}}function vt(e){0>Ca||(e.current=Mn[Ca],Mn[Ca]=null,Ca--)}function Ie(e,t){Ca++,Mn[Ca]=e.current,e.current=t}var nt=bn(null),Ta=bn(null),Dn=bn(null),Xs=bn(null);function Zs(e,t){switch(Ie(Dn,t),Ie(Ta,e),Ie(nt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Cg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Cg(t),e=Tg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}vt(nt),Ie(nt,e)}function Vn(){vt(nt),vt(Ta),vt(Dn)}function Is(e){var t=e.memoizedState;t!==null&&(Hr._currentValue=t.memoizedState,Ie(Xs,e)),t=nt.current;var s=Tg(t,e.type);t!==s&&(Ie(Ta,e),Ie(nt,s))}function cs(e){Ta.current===e&&(vt(nt),vt(Ta)),Xs.current===e&&(vt(Xs),Hr._currentValue=Ot)}var ye,bt;function ft(e){if(ye===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);ye=t&&t[1]||"",bt=-1<s.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+ye+e+bt}var Ln=!1;function us(e,t){if(!e||Ln)return"";Ln=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(ne){var O=ne}Reflect.construct(e,[],K)}else{try{K.call()}catch(ne){O=ne}K=!1;try{var L=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),K=!0,new e}finally{K&&(L!==void 0?Object.defineProperty(e.prototype,"props",L):delete e.prototype.props)}}}else{try{throw Error()}catch(ne){O=ne}(K=e())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(ne){if(ne&&O&&typeof ne.stack=="string")return[ne.stack,O.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),x=u[0],N=u[1];if(x&&N){var E=x.split(`
4
+ `),M=N.split(`
5
+ `);for(c=l=0;l<E.length&&!E[l].includes("DetermineComponentFrameRoot");)l++;for(;c<M.length&&!M[c].includes("DetermineComponentFrameRoot");)c++;if(l===E.length||c===M.length)for(l=E.length-1,c=M.length-1;1<=l&&0<=c&&E[l]!==M[c];)c--;for(;1<=l&&0<=c;l--,c--)if(E[l]!==M[c]){if(l!==1||c!==1)do if(l--,c--,0>c||E[l]!==M[c]){var $=`
6
+ `+E[l].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=l&&0<=c);break}}}finally{Ln=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?ft(s):""}function il(e,t){switch(e.tag){case 26:case 27:case 5:return ft(e.type);case 16:return ft("Lazy");case 13:return e.child!==t&&t!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return us(e.type,!1);case 11:return us(e.type.render,!1);case 1:return us(e.type,!0);case 31:return ft("Activity");case 30:return ft("ViewTransition");default:return""}}function Js(e){try{var t="",s=null;do t+=il(e,s),s=e,e=e.return;while(e);return t}catch(l){return`
7
+ Error generating stack: `+l.message+`
8
+ `+l.stack}}var Dc=Object.prototype.hasOwnProperty,Lc=n.unstable_scheduleCallback,Uc=n.unstable_cancelCallback,q1=n.unstable_shouldYield,H1=n.unstable_requestPaint,rn=n.unstable_now,$1=n.unstable_getCurrentPriorityLevel,Im=n.unstable_ImmediatePriority,Jm=n.unstable_UserBlockingPriority,yi=n.unstable_NormalPriority,B1=n.unstable_LowPriority,Wm=n.unstable_IdlePriority,Q1=n.log,F1=n.unstable_setDisableYieldValue,ol=null,ln=null;function Aa(e){if(typeof Q1=="function"&&F1(e),ln&&typeof ln.setStrictMode=="function")try{ln.setStrictMode(ol,e)}catch{}}var on=Math.clz32?Math.clz32:Y1,P1=Math.log,K1=Math.LN2;function Y1(e){return e>>>=0,e===0?32:31-(P1(e)/K1|0)|0}var vi=256,bi=262144,ji=4194304;function ds(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ni(e,t,s){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var N=l&134217727;return N!==0?(l=N&~u,l!==0?c=ds(l):(x&=N,x!==0?c=ds(x):s||(s=N&~e,s!==0&&(c=ds(s))))):(N=l&~u,N!==0?c=ds(N):x!==0?c=ds(x):s||(s=l&~e,s!==0&&(c=ds(s)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,s=t&-t,u>=s||u===32&&(s&4194048)!==0)?t:c}function cl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function eh(e,t){(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var l=31-on(s),c=1<<l;t|=e[l],s&=~c}return t}function G1(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+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 th(){var e=ji;return ji<<=1,(ji&62914560)===0&&(ji=4194304),e}function qc(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function ul(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function V1(e,t,s,l,c,u){var x=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var N=e.entanglements,E=e.expirationTimes,M=e.hiddenUpdates;for(s=x&~s;0<s;){var $=31-on(s),K=1<<$;N[$]=0,E[$]=-1;var O=M[$];if(O!==null)for(M[$]=null,$=0;$<O.length;$++){var L=O[$];L!==null&&(L.lane&=-536870913)}s&=~K}l!==0&&nh(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(x&~t))}function nh(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-on(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|s&261930}function ah(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var l=31-on(s),c=1<<l;c&t|e[l]&t&&(e[l]|=t),s&=~c}}function sh(e,t){var s=t&-t;return s=(s&42)!==0?1:Hc(s),(s&(e.suspendedLanes|t))!==0?0:s}function Hc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $c(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rh(){var e=ve.p;return e!==0?e:(e=window.event,e===void 0?32:fy(e.type))}function lh(e,t){var s=ve.p;try{return ve.p=e,t()}finally{ve.p=s}}var oa=Math.random().toString(36).slice(2),zt="__reactFiber$"+oa,Jt="__reactProps$"+oa,Ws="__reactContainer$"+oa,ih="__reactEvents$"+oa,X1="__reactListeners$"+oa,Z1="__reactHandles$"+oa,oh="__reactResources$"+oa,dl="__reactMarker$"+oa,wi="__reactLoad$"+oa;function Si(e){delete e[zt],delete e[Jt],delete e[X1],delete e[Z1]}function fs(e){var t;if(t=e[zt])return t;for(var s=e.parentNode;s;){if(t=s[Ws]||s[zt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Yg(e);e!==null;){if(s=e[zt])return s;e=Yg(e)}return t}e=s,s=e.parentNode}return null}function er(e){if(e=e[zt]||e[Ws]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function fl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function tr(e){var t=e[oh];return t||(t=e[oh]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ct(e){e[dl]=!0}function ch(e){e[wi]=void 0}var uh=new Set,dh={};function ms(e,t){nr(e,t),nr(e+"Capture",t)}function nr(e,t){for(dh[e]=t,e=0;e<t.length;e++)uh.add(t[e])}var I1=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fh={},mh={};function J1(e){return Dc.call(mh,e)?!0:Dc.call(fh,e)?!1:I1.test(e)?mh[e]=!0:(fh[e]=!0,!1)}var Ve=!1;function hh(){var e=Ve;return Ve=!1,e}function _i(e,t,s){if(J1(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,s)}}function ki(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,s)}}function ca(e,t,s,l){if(l===null)e.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,l)}}function cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function W1(e,t,s){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(x){s=""+x,u.call(this,x)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bc(e){if(!e._valueTracker){var t=xh(e)?"checked":"value";e._valueTracker=W1(e,t,""+e[t])}}function ph(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),l="";return e&&(l=xh(e)?e.checked?"true":"false":e.value),e=l,e!==s?(t.setValue(e),!0):!1}var e0=/[\n"\\]/g;function jn(e){return e.replace(e0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Qc(e,t,s,l,c,u,x,N){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+cn(t)):e.value!==""+cn(t)&&(e.value=""+cn(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?x==="number"&&e.value==t?Fc(e,cn(e.value)):Fc(e,cn(t)):s!=null?Fc(e,cn(s)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+cn(N):e.removeAttribute("name")}function gh(e,t,s,l,c,u,x,N){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||s!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Bc(e);return}s=s!=null?""+cn(s):"",t=t!=null?""+cn(t):s,N||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=N?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Bc(e)}function Fc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function ar(e,t,s,l){if(e=e.options,t){t={};for(var c=0;c<s.length;c++)t["$"+s[c]]=!0;for(s=0;s<e.length;s++)c=t.hasOwnProperty("$"+e[s].value),e[s].selected!==c&&(e[s].selected=c),c&&l&&(e[s].defaultSelected=!0)}else{for(s=""+cn(s),t=null,c=0;c<e.length;c++){if(e[c].value===s){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function yh(e,t,s){if(t!=null&&(t=""+cn(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+cn(s):""}function vh(e,t,s,l){if(t==null){if(l!=null){if(s!=null)throw Error(o(92));if(ke(l)){if(1<l.length)throw Error(o(93));l=l[0]}s=l}s==null&&(s=""),t=s}s=cn(t),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),Bc(e)}function sr(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var t0=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 bh(e,t,s){var l=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,s):typeof s!="number"||s===0||t0.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function jh(e,t,s){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="",Ve=!0);for(var c in t)l=t[c],t.hasOwnProperty(c)&&s[c]!==l&&(bh(e,c,l),Ve=!0)}else for(var u in t)t.hasOwnProperty(u)&&bh(e,u,t[u])}function Pc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 n0=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"],["maskType","mask-type"],["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"]]),a0=/^[\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 Ei(e){return a0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Xn(){}var Kc=null;function Yc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rr=null,lr=null;function Nh(e){var t=er(e);if(t&&(e=t.stateNode)){var s=e[Jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Qc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+jn(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var l=s[t];if(l!==e&&l.form===e.form){var c=l[Jt]||null;if(!c)throw Error(o(90));Qc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<s.length;t++)l=s[t],l.form===e.form&&ph(l)}break e;case"textarea":yh(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&ar(e,!!s.multiple,t,!1)}}}var Gc=!1;function wh(e,t,s){if(Gc)return e(t,s);Gc=!0;try{var l=e(t);return l}finally{if(Gc=!1,(rr!==null||lr!==null)&&(Co(),rr&&(t=rr,e=lr,lr=rr=null,Nh(t),e)))for(t=0;t<e.length;t++)Nh(e[t])}}function ml(e,t){var s=e.stateNode;if(s===null)return null;var l=s[Jt]||null;if(l===null)return null;s=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(o(231,t,typeof s));return s}var ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vc=!1;if(ua)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Vc=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Vc=!1}var Ra=null,Xc=null,Ci=null;function Sh(){if(Ci)return Ci;var e,t=Xc,s=t.length,l,c="value"in Ra?Ra.value:Ra.textContent,u=c.length;for(e=0;e<s&&t[e]===c[e];e++);var x=s-e;for(l=1;l<=x&&t[s-l]===c[u-l];l++);return Ci=c.slice(e,1<l?1-l:void 0)}function Ti(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ai(){return!0}function _h(){return!1}function Kt(e){function t(s,l,c,u,x){this._reactName=s,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=x,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(s=e[N],this[N]=s?s(u):u[N]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ai:_h,this.isPropagationStopped=_h,this}return Z(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ai)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ai)},persist:function(){},isPersistent:Ai}),t}var Oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ri=Kt(Oa),xl=Z({},Oa,{view:0,detail:0}),s0=Kt(xl),Zc,Ic,pl,Oi=Z({},xl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==pl&&(pl&&e.type==="mousemove"?(Zc=e.screenX-pl.screenX,Ic=e.screenY-pl.screenY):Ic=Zc=0,pl=e),Zc)},movementY:function(e){return"movementY"in e?e.movementY:Ic}}),kh=Kt(Oi),r0=Z({},Oi,{dataTransfer:0}),l0=Kt(r0),i0=Z({},xl,{relatedTarget:0}),Jc=Kt(i0),o0=Z({},Oa,{animationName:0,elapsedTime:0,pseudoElement:0}),c0=Kt(o0),u0=Z({},Oa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),d0=Kt(u0),f0=Z({},Oa,{data:0}),Eh=Kt(f0),m0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},h0={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"},x0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function p0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=x0[e])?!!t[e]:!1}function Wc(){return p0}var g0=Z({},xl,{key:function(e){if(e.key){var t=m0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ti(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?h0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?Ti(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ti(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),y0=Kt(g0),v0=Z({},Oi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ch=Kt(v0),b0=Z({},Oa,{submitter:0}),j0=Kt(b0),N0=Z({},xl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),w0=Kt(N0),S0=Z({},Oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),_0=Kt(S0),k0=Z({},Oi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),E0=Kt(k0),C0=Z({},Oa,{newState:0,oldState:0,source:0}),T0=Kt(C0),A0=[9,13,27,32],eu=ua&&"CompositionEvent"in window,gl=null;ua&&"documentMode"in document&&(gl=document.documentMode);var R0=ua&&"TextEvent"in window&&!gl,Th=ua&&(!eu||gl&&8<gl&&11>=gl),Ah=" ",Rh=!1;function Oh(e,t){switch(e){case"keyup":return A0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ir=!1;function O0(e,t){switch(e){case"compositionend":return zh(t);case"keypress":return t.which!==32?null:(Rh=!0,Ah);case"textInput":return e=t.data,e===Ah&&Rh?null:e;default:return null}}function z0(e,t){if(ir)return e==="compositionend"||!eu&&Oh(e,t)?(e=Sh(),Ci=Xc=Ra=null,ir=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Th&&t.locale!=="ko"?null:t.data;default:return null}}var M0={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 Mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!M0[e.type]:t==="textarea"}function Dh(e,t,s,l){rr?lr?lr.push(l):lr=[l]:rr=l,t=Mo(t,"onChange"),0<t.length&&(s=new Ri("onChange","change",null,s,l),e.push({event:s,listeners:t}))}var yl=null,vl=null;function D0(e){Ng(e,0)}function zi(e){var t=fl(e);if(ph(t))return e}function Lh(e,t){if(e==="change")return t}var Uh=!1;if(ua){var tu;if(ua){var nu="oninput"in document;if(!nu){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),nu=typeof qh.oninput=="function"}tu=nu}else tu=!1;Uh=tu&&(!document.documentMode||9<document.documentMode)}function Hh(){yl&&(yl.detachEvent("onpropertychange",$h),vl=yl=null)}function $h(e){if(e.propertyName==="value"&&zi(vl)){var t=[];Dh(t,vl,e,Yc(e)),wh(D0,t)}}function L0(e,t,s){e==="focusin"?(Hh(),yl=t,vl=s,yl.attachEvent("onpropertychange",$h)):e==="focusout"&&Hh()}function U0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zi(vl)}function q0(e,t){if(e==="click")return zi(t)}function H0(e,t){if(e==="input"||e==="change")return zi(t)}function $0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var un=typeof Object.is=="function"?Object.is:$0;function bl(e,t){if(un(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),l=Object.keys(t);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var c=s[l];if(!Dc.call(t,c)||!un(e[c],t[c]))return!1}return!0}function au(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Bh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qh(e,t){var s=Bh(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=t&&l>=t)return{node:s,offset:t-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Bh(s)}}function Fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ph(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=au(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=au(e.document)}return t}function su(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var B0=ua&&"documentMode"in document&&11>=document.documentMode,or=null,ru=null,jl=null,lu=!1;function Kh(e,t,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;lu||or==null||or!==au(l)||(l=or,"selectionStart"in l&&su(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),jl&&bl(jl,l)||(jl=l,l=Mo(ru,"onSelect"),0<l.length&&(t=new Ri("onSelect","select",null,t,s),e.push({event:t,listeners:l}),t.target=or)))}function hs(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var cr={animationend:hs("Animation","AnimationEnd"),animationiteration:hs("Animation","AnimationIteration"),animationstart:hs("Animation","AnimationStart"),transitionrun:hs("Transition","TransitionRun"),transitionstart:hs("Transition","TransitionStart"),transitioncancel:hs("Transition","TransitionCancel"),transitionend:hs("Transition","TransitionEnd")},iu={},Yh={};ua&&(Yh=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function xs(e){if(iu[e])return iu[e];if(!cr[e])return e;var t=cr[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Yh)return iu[e]=t[s];return e}var Gh=xs("animationend"),Vh=xs("animationiteration"),Xh=xs("animationstart"),Q0=xs("transitionrun"),F0=xs("transitionstart"),P0=xs("transitioncancel"),Zh=xs("transitionend"),Ih=new Map,ou="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ou.push("scrollEnd");function Un(e,t){Ih.set(e,t),ms(t,[e])}var K0=0;function da(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Bn.identifierPrefix;var s=K0++;return e="_"+e+"t_"+s.toString(32)+"_",t.autoName=e}function Jh(e){if(e==null||typeof e=="string")return e;var t=null,s=Tr;if(s!==null)for(var l=0;l<s.length;l++){var c=e[s[l]];if(c!=null){if(c==="none")return"none";t=t==null?c:t+(" "+c)}}return t??e.default}function fa(e,t){return e=Jh(e),t=Jh(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Mi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Nn=[],ur=0,cu=0;function Di(){for(var e=ur,t=cu=ur=0;t<e;){var s=Nn[t];Nn[t++]=null;var l=Nn[t];Nn[t++]=null;var c=Nn[t];Nn[t++]=null;var u=Nn[t];if(Nn[t++]=null,l!==null&&c!==null){var x=l.pending;x===null?c.next=c:(c.next=x.next,x.next=c),l.pending=c}u!==0&&Wh(s,c,u)}}function Li(e,t,s,l){Nn[ur++]=e,Nn[ur++]=t,Nn[ur++]=s,Nn[ur++]=l,cu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function uu(e,t,s,l){return Li(e,t,s,l),Ui(e)}function ps(e,t){return Li(e,null,null,t),Ui(e)}function Wh(e,t,s){e.lanes|=s;var l=e.alternate;l!==null&&(l.lanes|=s);for(var c=!1,u=e.return;u!==null;)u.childLanes|=s,l=u.alternate,l!==null&&(l.childLanes|=s),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-on(s),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=s|536870912),u):null}function Ui(e){if(50<Fl)throw Fl=0,Eo=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var dr={};function Y0(e,t,s,l){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wt(e,t,s,l){return new Y0(e,t,s,l)}function du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ma(e,t){var s=e.alternate;return s===null?(s=Wt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&1206910976,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function ex(e,t){e.flags&=1206910978;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function qi(e,t,s,l,c,u){var x=0;if(l=e,typeof l=="function")du(l)&&(x=1);else if(typeof l=="string")x=bw(e,s,nt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(l){case X:return e=Wt(31,s,t,c),e.elementType=X,e.lanes=u,e;case Ne:return gs(s.children,c,u,t);case Ae:x=8,c|=24;break;case ee:return e=Wt(12,s,t,c|2),e.elementType=ee,e.lanes=u,e;case Y:return e=Wt(13,s,t,c),e.elementType=Y,e.lanes=u,e;case re:return e=Wt(19,s,t,c),e.elementType=re,e.lanes=u,e;case je:case T:return e=c|32,e=Wt(30,s,t,e),e.elementType=T,e.lanes=u,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Ee:x=10;break e;case ze:x=9;break e;case G:x=11;break e;case He:x=14;break e;case W:x=16,l=null;break e}x=29,s=Error(o(130,e===null?"null":typeof e,"")),l=null}return t=Wt(x,s,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function gs(e,t,s,l){return e=Wt(7,e,l,t),e.lanes=s,e}function fu(e,t,s){return e=Wt(6,e,null,t),e.lanes=s,e}function tx(e){var t=Wt(18,null,null,0);return t.stateNode=e,t}function mu(e,t,s){return t=Wt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var nx=new WeakMap;function wn(e,t){if(typeof e=="object"&&e!==null){var s=nx.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Js(t)},nx.set(e,t),t)}return{value:e,source:t,stack:Js(t)}}var fr=[],mr=0,Hi=null,Nl=0,Sn=[],_n=0,za=null,Zn=1,In="";function ha(e,t){fr[mr++]=Nl,fr[mr++]=Hi,Hi=e,Nl=t}function ax(e,t,s){Sn[_n++]=Zn,Sn[_n++]=In,Sn[_n++]=za,za=e;var l=Zn;e=In;var c=32-on(l)-1;l&=~(1<<c),s+=1;var u=32-on(t)+c;if(30<u){var x=c-c%5;u=(l&(1<<x)-1).toString(32),l>>=x,c-=x,Zn=1<<32-on(t)+c|s<<c|l,In=u+e}else Zn=1<<u|s<<c|l,In=e}function $i(e){e.return!==null&&(ha(e,1),ax(e,1,0))}function hu(e){for(;e===Hi;)Hi=fr[--mr],fr[mr]=null,Nl=fr[--mr],fr[mr]=null;for(;e===za;)za=Sn[--_n],Sn[_n]=null,In=Sn[--_n],Sn[_n]=null,Zn=Sn[--_n],Sn[_n]=null}function sx(e,t){Sn[_n++]=Zn,Sn[_n++]=In,Sn[_n++]=za,Zn=t.id,In=t.overflow,za=e}var Tt=null,rt=null,De=!1,Ma=null,kn=!1,xu=Error(o(519));function Da(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wl(wn(t,e)),xu}function rx(e){var t=e.stateNode,s=e.type,l=e.memoizedProps;switch(t[zt]=e,t[Jt]=l,s){case"dialog":Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":case"embed":Qe("load",t);break;case"video":case"audio":for(s=0;s<Kl.length;s++)Qe(Kl[s],t);break;case"source":Qe("error",t);break;case"img":case"image":case"link":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"input":Qe("invalid",t),gh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Qe("invalid",t);break;case"textarea":Qe("invalid",t),vh(t,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||l.suppressHydrationWarning===!0||kg(t.textContent,s)?(l.popover!=null&&(Qe("beforetoggle",t),Qe("toggle",t)),l.onScroll!=null&&Qe("scroll",t),l.onScrollEnd!=null&&Qe("scrollend",t),l.onClick!=null&&(t.onclick=Xn),t=!0):t=!1,t||Da(e,!0)}function Bi(e){for(Tt=e.return;Tt;)switch(Tt.tag){case 5:case 31:case 13:kn=!1;return;case 27:case 3:kn=!0;return;default:Tt=Tt.return}}function hr(e){if(e!==Tt)return!1;if(!De)return Bi(e),De=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Kd(e.type,e.memoizedProps)),s=!s),s&&rt&&Da(e),Bi(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));rt=Kg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));rt=Kg(e)}else t===27?(t=rt,Ia(e.type)?(e=ef,ef=null,rt=e):rt=t):rt=Tt?Cn(e.stateNode.nextSibling):null;return!0}function ys(){rt=Tt=null,De=!1}function pu(){var e=Ma;return e!==null&&(nn===null?nn=e:nn.push.apply(nn,e),Ma=null),e}function wl(e){Ma===null?Ma=[e]:Ma.push(e)}var gu=bn(null),vs=null,xa=null;function La(e,t,s){Ie(gu,t._currentValue),t._currentValue=s}function pa(e){e._currentValue=gu.current,vt(gu)}function Qi(e,t,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===s)break;e=e.return}}function yu(e,t,s,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var x=c.child;u=u.firstContext;e:for(;u!==null;){var N=u;u=c;for(var E=0;E<t.length;E++)if(N.context===t[E]){u.lanes|=s,N=u.alternate,N!==null&&(N.lanes|=s),Qi(u.return,s,e),l||(x=null);break e}u=N.next}}else if(c.tag===18){if(x=c.return,x===null)throw Error(o(341));x.lanes|=s,u=x.alternate,u!==null&&(u.lanes|=s),Qi(x,s,e),x=null}else c.tag===13&&c.memoizedState!==null&&c.memoizedState.dehydrated===null?(c.lanes|=s,x=c.alternate,x!==null&&(x.lanes|=s),Qi(c.return,s,e),x=c.child,x=x!==null?x.sibling:null):x=c.child;if(x!==null)x.return=c;else for(x=c;x!==null;){if(x===e){x=null;break}if(c=x.sibling,c!==null){c.return=x.return,x=c;break}x=x.return}c=x}}function bs(e,t,s,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var x=c.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var N=c.type;un(c.pendingProps.value,x.value)||(e!==null?e.push(N):e=[N])}}else if(c===Xs.current){if(x=c.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Hr):e=[Hr])}c=c.return}return e!==null&&yu(t,e,s,l),t.flags|=262144,e!==null}function Fi(e){for(e=e.firstContext;e!==null;){if(!un(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function js(e){vs=e,xa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Mt(e){return lx(vs,e)}function Pi(e,t){return vs===null&&js(e),lx(e,t)}function lx(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},xa===null){if(e===null)throw Error(o(308));xa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else xa=xa.next=t;return s}var G0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},V0=n.unstable_scheduleCallback,X0=n.unstable_NormalPriority,jt={$$typeof:Ee,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vu(){return{controller:new G0,data:new Map,refCount:0}}function Sl(e){e.refCount--,e.refCount===0&&V0(X0,function(){e.controller.abort()})}function ix(e,t){if((e.pendingLanes&4194048)!==0){var s=e.transitionTypes;for(s===null&&(s=e.transitionTypes=[]),e=0;e<t.length;e++){var l=t[e];s.indexOf(l)===-1&&s.push(l)}}}var _l=null;function Z0(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var kl=null,bu=0,Ns=0,xr=null;function I0(e,t){if(kl===null){var s=kl=[];bu=0,Ns=Ld(),xr={status:"pending",value:void 0,then:function(l){s.push(l)}}}return bu++,t.then(ox,ox),t}function ox(){if(--bu===0&&(_l=null,kl!==null)){xr!==null&&(xr.status="fulfilled");var e=kl;kl=null,Ns=0,xr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function J0(e,t){var s=[],l={status:"pending",value:null,reason:null,then:function(c){s.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<s.length;c++)(0,s[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<s.length;c++)(0,s[c])(void 0)}),l}var cx=ce.S;ce.S=function(e,t){if(tg=rn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),_l!==null)for(var s=zr;s!==null;)ix(s,_l),s=s.next;if(s=e.types,s!==null){for(var l=zr;l!==null;)ix(l,s),l=l.next;if(Ns!==0){l=_l,l===null&&(l=_l=[]);for(var c=0;c<s.length;c++){var u=s[c];l.indexOf(u)===-1&&l.push(u)}}}cx!==null&&cx(e,t)};var ws=bn(null);function ju(){var e=ws.current;return e!==null?e:at.pooledCache}function Ki(e,t){t===null?Ie(ws,ws.current):Ie(ws,t.pool)}function ux(){var e=ju();return e===null?null:{parent:jt._currentValue,pool:e}}var pr=Error(o(460)),Nu=Error(o(474)),Yi=Error(o(542)),Gi={then:function(){}};function dx(e){return e=e.status,e==="fulfilled"||e==="rejected"}function fx(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Xn,Xn),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hx(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(Xn,Xn);else{if(e=at,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hx(e),e}throw _s=t,pr}}function Ss(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(_s=s,pr):s}}var _s=null;function mx(){if(_s===null)throw Error(o(459));var e=_s;return _s=null,e}function hx(e){if(e===pr||e===Yi)throw Error(o(483))}var gr=null,El=0;function Vi(e){var t=El;return El+=1,gr===null&&(gr=[]),fx(gr,e,t)}function Ua(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Xi(e,t){throw t.$$typeof===Q?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function xx(e){function t(z,R){if(e){var D=z.deletions;D===null?(z.deletions=[R],z.flags|=16):D.push(R)}}function s(z,R){if(!e)return null;for(;R!==null;)t(z,R),R=R.sibling;return null}function l(z){for(var R=new Map;z!==null;)z.key===null?R.set(z.index,z):R.set(z.key,z),z=z.sibling;return R}function c(z,R){return z=ma(z,R),z.index=0,z.sibling=null,z}function u(z,R,D){return z.index=D,e?(D=z.alternate,D!==null?(D=D.index,D<R?(z.flags|=2,R):D):(z.flags|=134217730,R)):(z.flags|=1048576,R)}function x(z){return e&&z.alternate===null&&(z.flags|=134217730),z}function N(z,R,D,P){return R===null||R.tag!==6?(R=fu(D,z.mode,P),R.return=z,R):(R=c(R,D),R.return=z,R)}function E(z,R,D,P){var ie=D.type;return ie===Ne?(z=$(z,R,D.props.children,P,D.key),Ua(z,D),z):R!==null&&(R.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===W&&Ss(ie)===R.type)?(R=c(R,D.props),Ua(R,D),R.return=z,R):(R=qi(D.type,D.key,D.props,null,z.mode,P),Ua(R,D),R.return=z,R)}function M(z,R,D,P){return R===null||R.tag!==4||R.stateNode.containerInfo!==D.containerInfo||R.stateNode.implementation!==D.implementation?(R=mu(D,z.mode,P),R.return=z,R):(R=c(R,D.children||[]),R.return=z,R)}function $(z,R,D,P,ie){return R===null||R.tag!==7?(R=gs(D,z.mode,P,ie),R.return=z,R):(R=c(R,D),R.return=z,R)}function K(z,R,D){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=fu(""+R,z.mode,D),R.return=z,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case xe:return D=qi(R.type,R.key,R.props,null,z.mode,D),Ua(D,R),D.return=z,D;case he:return R=mu(R,z.mode,D),R.return=z,R;case W:return R=Ss(R),K(z,R,D)}if(ke(R)||fe(R))return R=gs(R,z.mode,D,null),R.return=z,R;if(typeof R.then=="function")return K(z,Vi(R),D);if(R.$$typeof===Ee)return K(z,Pi(z,R),D);Xi(z,R)}return null}function O(z,R,D,P){var ie=R!==null?R.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ie!==null?null:N(z,R,""+D,P);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case xe:return D.key===ie?E(z,R,D,P):null;case he:return D.key===ie?M(z,R,D,P):null;case W:return D=Ss(D),O(z,R,D,P)}if(ke(D)||fe(D))return ie!==null?null:$(z,R,D,P,null);if(typeof D.then=="function")return O(z,R,Vi(D),P);if(D.$$typeof===Ee)return O(z,R,Pi(z,D),P);Xi(z,D)}return null}function L(z,R,D,P,ie){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return z=z.get(D)||null,N(R,z,""+P,ie);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case xe:return z=z.get(P.key===null?D:P.key)||null,E(R,z,P,ie);case he:return z=z.get(P.key===null?D:P.key)||null,M(R,z,P,ie);case W:return P=Ss(P),L(z,R,D,P,ie)}if(ke(P)||fe(P))return z=z.get(D)||null,$(R,z,P,ie,null);if(typeof P.then=="function")return L(z,R,D,Vi(P),ie);if(P.$$typeof===Ee)return L(z,R,D,Pi(R,P),ie);Xi(R,P)}return null}function ne(z,R,D,P){for(var ie=null,Pe=null,ge=R,we=R=0,St=null;ge!==null&&we<D.length;we++){ge.index>we?(St=ge,ge=null):St=ge.sibling;var Ge=O(z,ge,D[we],P);if(Ge===null){ge===null&&(ge=St);break}e&&ge&&Ge.alternate===null&&t(z,ge),R=u(Ge,R,we),Pe===null?ie=Ge:Pe.sibling=Ge,Pe=Ge,ge=St}if(we===D.length)return s(z,ge),De&&ha(z,we),ie;if(ge===null){for(;we<D.length;we++)ge=K(z,D[we],P),ge!==null&&(R=u(ge,R,we),Pe===null?ie=ge:Pe.sibling=ge,Pe=ge);return De&&ha(z,we),ie}for(ge=l(ge);we<D.length;we++)St=L(ge,z,we,D[we],P),St!==null&&(e&&(Ge=St.alternate,Ge!==null&&ge.delete(Ge.key===null?we:Ge.key)),R=u(St,R,we),Pe===null?ie=St:Pe.sibling=St,Pe=St);return e&&ge.forEach(function(ns){return t(z,ns)}),De&&ha(z,we),ie}function de(z,R,D,P){if(D==null)throw Error(o(151));for(var ie=null,Pe=null,ge=R,we=R=0,St=null,Ge=D.next();ge!==null&&!Ge.done;we++,Ge=D.next()){ge.index>we?(St=ge,ge=null):St=ge.sibling;var ns=O(z,ge,Ge.value,P);if(ns===null){ge===null&&(ge=St);break}e&&ge&&ns.alternate===null&&t(z,ge),R=u(ns,R,we),Pe===null?ie=ns:Pe.sibling=ns,Pe=ns,ge=St}if(Ge.done)return s(z,ge),De&&ha(z,we),ie;if(ge===null){for(;!Ge.done;we++,Ge=D.next())Ge=K(z,Ge.value,P),Ge!==null&&(R=u(Ge,R,we),Pe===null?ie=Ge:Pe.sibling=Ge,Pe=Ge);return De&&ha(z,we),ie}for(ge=l(ge);!Ge.done;we++,Ge=D.next())Ge=L(ge,z,we,Ge.value,P),Ge!==null&&(e&&(St=Ge.alternate,St!==null&&ge.delete(St.key===null?we:St.key)),R=u(Ge,R,we),Pe===null?ie=Ge:Pe.sibling=Ge,Pe=Ge);return e&&ge.forEach(function(Ow){return t(z,Ow)}),De&&ha(z,we),ie}function Te(z,R,D,P){if(typeof D=="object"&&D!==null&&D.type===Ne&&D.key===null&&D.props.ref===void 0&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case xe:e:{for(var ie=D.key;R!==null;){if(R.key===ie){if(ie=D.type,ie===Ne){if(R.tag===7){s(z,R.sibling),P=c(R,D.props.children),Ua(P,D),P.return=z,z=P;break e}}else if(R.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===W&&Ss(ie)===R.type){s(z,R.sibling),P=c(R,D.props),Ua(P,D),P.return=z,z=P;break e}s(z,R);break}else t(z,R);R=R.sibling}D.type===Ne?(P=gs(D.props.children,z.mode,P,D.key),Ua(P,D),P.return=z,z=P):(P=qi(D.type,D.key,D.props,null,z.mode,P),Ua(P,D),P.return=z,z=P)}return x(z);case he:e:{for(ie=D.key;R!==null;){if(R.key===ie)if(R.tag===4&&R.stateNode.containerInfo===D.containerInfo&&R.stateNode.implementation===D.implementation){s(z,R.sibling),P=c(R,D.children||[]),P.return=z,z=P;break e}else{s(z,R);break}else t(z,R);R=R.sibling}P=mu(D,z.mode,P),P.return=z,z=P}return x(z);case W:return D=Ss(D),Te(z,R,D,P)}if(ke(D))return ne(z,R,D,P);if(fe(D)){if(ie=fe(D),typeof ie!="function")throw Error(o(150));return D=ie.call(D),de(z,R,D,P)}if(typeof D.then=="function")return Te(z,R,Vi(D),P);if(D.$$typeof===Ee)return Te(z,R,Pi(z,D),P);Xi(z,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,R!==null&&R.tag===6?(s(z,R.sibling),P=c(R,D),P.return=z,z=P):(s(z,R),P=fu(D,z.mode,P),P.return=z,z=P),x(z)):s(z,R)}return function(z,R,D,P){try{El=0;var ie=Te(z,R,D,P);return gr=null,ie}catch(ge){if(ge===pr||ge===Yi)throw ge;var Pe=Wt(29,ge,null,z.mode);return Pe.lanes=P,Pe.return=z,Pe}}}var ks=xx(!0),px=xx(!1),qa=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Su(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $a(e,t,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Xe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=Ui(e),Wh(e,null,s),t}return Li(e,l,t,s),Ui(e)}function Cl(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,ah(e,s)}}function _u(e,t){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var c=null,u=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};u===null?c=u=x:u=u.next=x,s=s.next}while(s!==null);u===null?c=u=t:u=u.next=t}else c=u=t;s={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var ku=!1;function Tl(){if(ku){var e=xr;if(e!==null)throw e}}function Al(e,t,s,l){ku=!1;var c=e.updateQueue;qa=!1;var u=c.firstBaseUpdate,x=c.lastBaseUpdate,N=c.shared.pending;if(N!==null){c.shared.pending=null;var E=N,M=E.next;E.next=null,x===null?u=M:x.next=M,x=E;var $=e.alternate;$!==null&&($=$.updateQueue,N=$.lastBaseUpdate,N!==x&&(N===null?$.firstBaseUpdate=M:N.next=M,$.lastBaseUpdate=E))}if(u!==null){var K=c.baseState;x=0,$=M=E=null,N=u;do{var O=N.lane&-536870913,L=O!==N.lane;if(L?(Fe&O)===O:(l&O)===O){O!==0&&O===Ns&&(ku=!0),$!==null&&($=$.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var ne=e,de=N;O=t;var Te=s;switch(de.tag){case 1:if(ne=de.payload,typeof ne=="function"){K=ne.call(Te,K,O);break e}K=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=de.payload,O=typeof ne=="function"?ne.call(Te,K,O):ne,O==null)break e;K=Z({},K,O);break e;case 2:qa=!0}}O=N.callback,O!==null&&(e.flags|=64,L&&(e.flags|=8192),L=c.callbacks,L===null?c.callbacks=[O]:L.push(O))}else L={lane:O,tag:N.tag,payload:N.payload,callback:N.callback,next:null},$===null?(M=$=L,E=K):$=$.next=L,x|=O;if(N=N.next,N===null){if(N=c.shared.pending,N===null)break;L=N,N=L.next,L.next=null,c.lastBaseUpdate=L,c.shared.pending=null}}while(!0);$===null&&(E=K),c.baseState=E,c.firstBaseUpdate=M,c.lastBaseUpdate=$,u===null&&(c.shared.lanes=0),Ga|=x,e.lanes=x,e.memoizedState=K}}function gx(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function yx(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)gx(s[e],t)}var Ba=bn(null),Zi=bn(0);function vx(e,t){e=ja,Ie(Zi,e),Ie(Ba,t),ja=e|t.baseLanes}function Eu(){Ie(Zi,ja),Ie(Ba,Ba.current)}function Cu(){ja=Zi.current,vt(Ba),vt(Zi)}var Dt=bn(null),$t=null;function Qa(e){var t=e.alternate;Ie(Lt,Lt.current&1),Ie(Dt,e),$t===null&&(t===null||Ba.current!==null||t.memoizedState!==null)&&($t=e)}function Tu(e){Ie(Lt,Lt.current),Ie(Dt,e),$t===null&&($t=e)}function bx(e){e.tag===22?(Ie(Lt,Lt.current),Ie(Dt,e),$t===null&&($t=e)):Fa()}function Fa(){Ie(Lt,Lt.current),Ie(Dt,Dt.current)}function dn(e){vt(Dt),$t===e&&($t=null),vt(Lt)}var Lt=bn(0);function Rl(e,t){Ie(Dt,Dt.current),Ie(Lt,t)}function Au(e){vt(Lt),vt(Dt),$t===e&&($t=null)}function Ii(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Jd(s)||Wd(s)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ga=0,Ce=null,tt=null,Nt=null,Ji=!1,yr=!1,Es=!1,Wi=0,Ol=0,vr=null,W0=0;function ht(){throw Error(o(321))}function Ru(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!un(e[s],t[s]))return!1;return!0}function Ou(e,t,s,l,c,u){return ga=u,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ce.H=e===null||e.memoizedState===null?ap:sp,Es=!1,u=s(l,c),Es=!1,yr&&(u=Nx(t,s,l,c)),jx(e),u}function jx(e){ce.H=lo;var t=tt!==null&&tt.next!==null;if(ga=0,Nt=tt=Ce=null,Ji=!1,Ol=0,vr=null,t)throw Error(o(300));e===null||wt||(e=e.dependencies,e!==null&&Fi(e)&&(wt=!0))}function Nx(e,t,s,l){Ce=e;var c=0;do{if(yr&&(vr=null),Ol=0,yr=!1,25<=c)throw Error(o(301));if(c+=1,Nt=tt=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}ce.H=iN,u=t(s,l)}while(yr);return u}function eN(){var e=ce.H,t=e.useState()[0];return t=typeof t.then=="function"?zl(t):t,e=e.useState()[0],(tt!==null?tt.memoizedState:null)!==e&&(Ce.flags|=1024),t}function zu(){var e=Wi!==0;return Wi=0,e}function Mu(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Du(e){if(Ji){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ji=!1}ga=0,Nt=tt=Ce=null,yr=!1,Ol=Wi=0,vr=null}function Yt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nt===null?Ce.memoizedState=Nt=e:Nt=Nt.next=e,Nt}function gt(){if(tt===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=tt.next;var t=Nt===null?Ce.memoizedState:Nt.next;if(t!==null)Nt=t,tt=e;else{if(e===null)throw Ce.alternate===null?Error(o(467)):Error(o(310));tt=e,e={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},Nt===null?Ce.memoizedState=Nt=e:Nt=Nt.next=e}return Nt}function eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zl(e){var t=Ol;return Ol+=1,vr===null&&(vr=[]),e=fx(vr,e,t),t=Ce,(Nt===null?t.memoizedState:Nt.next)===null&&(t=t.alternate,ce.H=t===null||t.memoizedState===null?ap:sp),e}function to(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zl(e);if(e.$$typeof===q)return;if(e.$$typeof===Ee)return Mt(e)}throw Error(o(438,String(e)))}function Lu(e){var t=null,s=Ce.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var l=Ce.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=eo(),Ce.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),l=0;l<e;l++)s[l]=J;return t.index++,s}function ya(e,t){return typeof t=="function"?t(e):t}function no(e){var t=gt();return Uu(t,tt,e)}function Uu(e,t,s){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=s;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var x=c.next;c.next=u.next,u.next=x}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var N=x=null,E=null,M=t,$=!1;do{var K=M.lane&-536870913;if(K!==M.lane?(Fe&K)===K:(ga&K)===K){var O=M.revertLane;if(O===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),K===Ns&&($=!0);else if((ga&O)===O){M=M.next,O===Ns&&($=!0);continue}else K={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(N=E=K,x=u):E=E.next=K,Ce.lanes|=O,Ga|=O;K=M.action,Es&&s(u,K),u=M.hasEagerState?M.eagerState:s(u,K)}else O={lane:K,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(N=E=O,x=u):E=E.next=O,Ce.lanes|=K,Ga|=K;M=M.next}while(M!==null&&M!==t);if(E===null?x=u:E.next=N,!un(u,e.memoizedState)&&(wt=!0,$&&(s=xr,s!==null)))throw s;e.memoizedState=u,e.baseState=x,e.baseQueue=E,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function qu(e){var t=gt(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var l=s.dispatch,c=s.pending,u=t.memoizedState;if(c!==null){s.pending=null;var x=c=c.next;do u=e(u,x.action),x=x.next;while(x!==c);un(u,t.memoizedState)||(wt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),s.lastRenderedState=u}return[u,l]}function wx(e,t,s){var l=Ce,c=gt(),u=De;if(u){if(s===void 0)throw Error(o(407));s=s()}else s=t();var x=!un((tt||c).memoizedState,s);if(x&&(c.memoizedState=s,wt=!0),c=c.queue,Bu(kx.bind(null,l,c,e),[e]),e=c.getSnapshot!==t||x||Nt!==null&&(Nt.memoizedState.tag&1)!==0,br(e?9:8,{destroy:void 0},_x.bind(null,l,c,s,t),null),e){if(l.flags|=2048,at===null)throw Error(o(349));u||(ga&127)!==0||Sx(l,t,s)}return s}function Sx(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ce.updateQueue,t===null?(t=eo(),Ce.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function _x(e,t,s,l){t.value=s,t.getSnapshot=l,Ex(t)&&Cx(e)}function kx(e,t,s){return s(function(){Ex(t)&&Cx(e)})}function Ex(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!un(e,s)}catch{return!0}}function Cx(e){var t=ps(e,2);t!==null&&an(t,e,2)}function Hu(e){var t=Yt();if(typeof e=="function"){var s=e;if(e=s(),Es){Aa(!0);try{s()}finally{Aa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:e},t}function Tx(e,t,s,l){return e.baseState=s,Uu(e,tt,typeof l=="function"?l:ya)}function tN(e,t,s,l,c){if(ro(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){u.listeners.push(x)}};ce.T!==null?s(!0):u.isTransition=!1,l(u),s=t.pending,s===null?(u.next=t.pending=u,Ax(t,u)):(u.next=s.next,t.pending=s.next=u)}}function Ax(e,t){var s=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=ce.T,x={};x.types=u!==null?u.types:null,ce.T=x;try{var N=s(c,l),E=ce.S;E!==null&&E(x,N),Rx(e,t,N)}catch(M){$u(e,t,M)}finally{u!==null&&x.types!==null&&(u.types=x.types),ce.T=u}}else try{u=s(c,l),Rx(e,t,u)}catch(M){$u(e,t,M)}}function Rx(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){Ox(e,t,l)},function(l){return $u(e,t,l)}):Ox(e,t,s)}function Ox(e,t,s){t.status="fulfilled",t.value=s,zx(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Ax(e,s)))}function $u(e,t,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=s,zx(t),t=t.next;while(t!==l)}e.action=null}function zx(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mx(e,t){return t}function Dx(e,t){if(De){var s=at.formState;if(s!==null){e:{var l=Ce;if(De){if(rt){t:{for(var c=rt,u=kn;c.nodeType!==8;){if(!u){c=null;break t}if(c=Cn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){rt=Cn(c.nextSibling),l=c.data==="F!";break e}}Da(l)}l=!1}l&&(t=s[0])}}return s=Yt(),s.memoizedState=s.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mx,lastRenderedState:t},s.queue=l,s=ep.bind(null,Ce,l),l.dispatch=s,l=Hu(!1),u=Yu.bind(null,Ce,!1,l.queue),l=Yt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,s=tN.bind(null,Ce,c,u,s),c.dispatch=s,l.memoizedState=e,[t,s,!1]}function Lx(e){var t=gt();return Ux(t,tt,e)}function Ux(e,t,s){if(t=Uu(e,t,Mx)[0],e=no(ya)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=zl(t)}catch(x){throw x===pr?Yi:x}else l=t;t=gt();var c=t.queue,u=c.dispatch;return s!==t.memoizedState&&(Ce.flags|=2048,br(9,{destroy:void 0},nN.bind(null,c,s),null)),[l,u,e]}function nN(e,t){e.action=t}function qx(e){var t=gt(),s=tt;if(s!==null)return Ux(t,s,e);gt(),t=t.memoizedState,s=gt();var l=s.queue.dispatch;return s.memoizedState=e,[t,l,!1]}function br(e,t,s,l){return e={tag:e,create:s,deps:l,inst:t,next:null},t=Ce.updateQueue,t===null&&(t=eo(),Ce.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,t.lastEffect=e),e}function Hx(){return gt().memoizedState}function ao(e,t,s,l){var c=Yt();Ce.flags|=e,c.memoizedState=br(1|t,{destroy:void 0},s,l===void 0?null:l)}function so(e,t,s,l){var c=gt();l=l===void 0?null:l;var u=c.memoizedState.inst;tt!==null&&l!==null&&Ru(l,tt.memoizedState.deps)?c.memoizedState=br(t,u,s,l):(Ce.flags|=e,c.memoizedState=br(1|t,u,s,l))}function $x(e,t){ao(8390656,8,e,t)}function Bu(e,t){so(2048,8,e,t)}function aN(e){Ce.flags|=4;var t=Ce.updateQueue;if(t===null)t=eo(),Ce.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Bx(e){var t=gt().memoizedState;return aN({ref:t,nextImpl:e}),function(){if((Xe&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Qx(e,t){return so(4,2,e,t)}function Fx(e,t){return so(4,4,e,t)}function Px(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Kx(e,t,s){s=s!=null?s.concat([e]):null,so(4,4,Px.bind(null,t,e),s)}function Qu(){}function Yx(e,t){var s=gt();t=t===void 0?null:t;var l=s.memoizedState;return t!==null&&Ru(t,l[1])?l[0]:(s.memoizedState=[e,t],e)}function Gx(e,t){var s=gt();t=t===void 0?null:t;var l=s.memoizedState;if(t!==null&&Ru(t,l[1]))return l[0];if(l=e(),Es){Aa(!0);try{e()}finally{Aa(!1)}}return s.memoizedState=[l,t],l}function Fu(e,t,s){return s===void 0||(ga&1073741824)!==0&&(Fe&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=ag(),Ce.lanes|=e,Ga|=e,s)}function Vx(e,t,s,l){return un(s,t)?s:Ba.current!==null?(e=Fu(e,s,l),un(e,t)||(wt=!0),e):(ga&106)===0||(ga&1073741824)!==0&&(Fe&261930)===0?(wt=!0,e.memoizedState=s):(e=ag(),Ce.lanes|=e,Ga|=e,t)}function Xx(e,t,s,l,c){var u=ve.p;ve.p=u!==0&&8>u?u:8;var x=ce.T,N={};N.types=x!==null?x.types:null,ce.T=N,Yu(e,!1,t,s);try{var E=c(),M=ce.S;if(M!==null&&M(N,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var $=J0(E,l);Ml(e,t,$,xn(e))}else Ml(e,t,l,xn(e))}catch(K){Ml(e,t,{then:function(){},status:"rejected",reason:K},xn())}finally{ve.p=u,x!==null&&N.types!==null&&(x.types=N.types),ce.T=x}}function sN(){}function Pu(e,t,s,l){if(e.tag!==5)throw Error(o(476));var c=Zx(e).queue;Xx(e,c,t,Ot,s===null?sN:function(){return Ix(e),s(l)})}function Zx(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ot,baseState:Ot,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:Ot},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ix(e){var t=Zx(e);t.next===null&&(t=e.alternate.memoizedState),Ml(e,t.next.queue,{},xn())}function Ku(){return Mt(Hr)}function Jx(){return gt().memoizedState}function Wx(){return gt().memoizedState}function rN(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=xn();e=Ha(s);var l=$a(t,e,s);l!==null&&(an(l,t,s),Cl(l,t,s)),t={cache:vu()},e.payload=t;return}t=t.return}}function lN(e,t,s){var l=xn();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ro(e)?tp(t,s):(s=uu(e,t,s,l),s!==null&&(an(s,e,l),np(s,t,l)))}function ep(e,t,s){var l=xn();Ml(e,t,s,l)}function Ml(e,t,s,l){var c={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(ro(e))tp(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var x=t.lastRenderedState,N=u(x,s);if(c.hasEagerState=!0,c.eagerState=N,un(N,x))return Li(e,t,c,0),at===null&&Di(),!1}catch{}if(s=uu(e,t,c,l),s!==null)return an(s,e,l),np(s,t,l),!0}return!1}function Yu(e,t,s,l){if(l={lane:2,revertLane:Ld(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ro(e)){if(t)throw Error(o(479))}else t=uu(e,s,l,2),t!==null&&an(t,e,2)}function ro(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function tp(e,t){yr=Ji=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function np(e,t,s){if((s&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,s|=l,t.lanes=s,ah(e,s)}}var lo={readContext:Mt,use:to,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht,useEffectEvent:ht},ap={readContext:Mt,use:to,useCallback:function(e,t){return Yt().memoizedState=[e,t===void 0?null:t],e},useContext:Mt,useEffect:$x,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,ao(4194308,4,Px.bind(null,t,e),s)},useLayoutEffect:function(e,t){return ao(4194308,4,e,t)},useInsertionEffect:function(e,t){ao(4,2,e,t)},useMemo:function(e,t){var s=Yt();t=t===void 0?null:t;var l=e();if(Es){Aa(!0);try{e()}finally{Aa(!1)}}return s.memoizedState=[l,t],l},useReducer:function(e,t,s){var l=Yt();if(s!==void 0){var c=s(t);if(Es){Aa(!0);try{s(t)}finally{Aa(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=lN.bind(null,Ce,e),[l.memoizedState,e]},useRef:function(e){var t=Yt();return e={current:e},t.memoizedState=e},useState:function(e){e=Hu(e);var t=e.queue,s=ep.bind(null,Ce,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Qu,useDeferredValue:function(e,t){var s=Yt();return Fu(s,e,t)},useTransition:function(){var e=Hu(!1);return e=Xx.bind(null,Ce,e.queue,!0,!1),Yt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var l=Ce,c=Yt();if(De){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),at===null)throw Error(o(349));(Fe&127)!==0||Sx(l,t,s)}c.memoizedState=s;var u={value:s,getSnapshot:t};return c.queue=u,$x(kx.bind(null,l,u,e),[e]),l.flags|=2048,br(9,{destroy:void 0},_x.bind(null,l,u,s,t),null),s},useId:function(){var e=Yt(),t=at.identifierPrefix;if(De){var s=In,l=Zn;s=(l&~(1<<32-on(l)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Wi++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=W0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ku,useFormState:Dx,useActionState:Dx,useOptimistic:function(e){var t=Yt();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=Yu.bind(null,Ce,!0,s),s.dispatch=t,[e,t]},useMemoCache:Lu,useCacheRefresh:function(){return Yt().memoizedState=rN.bind(null,Ce)},useEffectEvent:function(e){var t=Yt(),s={impl:e};return t.memoizedState=s,function(){if((Xe&2)!==0)throw Error(o(440));return s.impl.apply(void 0,arguments)}}},sp={readContext:Mt,use:to,useCallback:Yx,useContext:Mt,useEffect:Bu,useImperativeHandle:Kx,useInsertionEffect:Qx,useLayoutEffect:Fx,useMemo:Gx,useReducer:no,useRef:Hx,useState:function(){return no(ya)},useDebugValue:Qu,useDeferredValue:function(e,t){var s=gt();return Vx(s,tt.memoizedState,e,t)},useTransition:function(){var e=no(ya)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:zl(e),t]},useSyncExternalStore:wx,useId:Jx,useHostTransitionStatus:Ku,useFormState:Lx,useActionState:Lx,useOptimistic:function(e,t){var s=gt();return Tx(s,tt,e,t)},useMemoCache:Lu,useCacheRefresh:Wx,useEffectEvent:Bx},iN={readContext:Mt,use:to,useCallback:Yx,useContext:Mt,useEffect:Bu,useImperativeHandle:Kx,useInsertionEffect:Qx,useLayoutEffect:Fx,useMemo:Gx,useReducer:qu,useRef:Hx,useState:function(){return qu(ya)},useDebugValue:Qu,useDeferredValue:function(e,t){var s=gt();return tt===null?Fu(s,e,t):Vx(s,tt.memoizedState,e,t)},useTransition:function(){var e=qu(ya)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:zl(e),t]},useSyncExternalStore:wx,useId:Jx,useHostTransitionStatus:Ku,useFormState:qx,useActionState:qx,useOptimistic:function(e,t){var s=gt();return tt!==null?Tx(s,tt,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Lu,useCacheRefresh:Wx,useEffectEvent:Bx};function Gu(e,t,s,l){t=e.memoizedState,s=s(l,t),s=s==null?t:Z({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Vu={enqueueSetState:function(e,t,s){e=e._reactInternals;var l=xn(),c=Ha(l);c.payload=t,s!=null&&(c.callback=s),t=$a(e,c,l),t!==null&&(an(t,e,l),Cl(t,e,l))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var l=xn(),c=Ha(l);c.tag=1,c.payload=t,s!=null&&(c.callback=s),t=$a(e,c,l),t!==null&&(an(t,e,l),Cl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=xn(),l=Ha(s);l.tag=2,t!=null&&(l.callback=t),t=$a(e,l,s),t!==null&&(an(t,e,s),Cl(t,e,s))}};function rp(e,t,s,l,c,u,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,x):t.prototype&&t.prototype.isPureReactComponent?!bl(s,l)||!bl(c,u):!0}function lp(e,t,s,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,l),t.state!==e&&Vu.enqueueReplaceState(t,t.state,null)}function Cs(e,t){var s=t;if("ref"in t){s={};for(var l in t)l!=="ref"&&(s[l]=t[l])}if(e=e.defaultProps){s===t&&(s=Z({},s));for(var c in e)s[c]===void 0&&(s[c]=e[c])}return s}function ip(e){Mi(e)}function op(e){console.error(e)}function cp(e){Mi(e)}function io(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function up(e,t,s){try{var l=e.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Xu(e,t,s){return s=Ha(s),s.tag=3,s.payload={element:null},s.callback=function(){io(e,t)},s}function dp(e){return e=Ha(e),e.tag=3,e}function fp(e,t,s,l){var c=s.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){up(t,s,l)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){up(t,s,l),typeof c!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}function oN(e,t,s,l,c){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=s.alternate,t!==null&&bs(t,s,c,!0),s=Dt.current,s!==null){switch(s.tag){case 31:case 13:case 19:return $t===null?To():s.alternate===null&&xt===0&&(xt=3),s.flags&=-257,s.flags|=65536,s.lanes=c,l===Gi?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([l]):t.add(l),zd(e,l,c)),!1;case 22:return s.flags|=65536,l===Gi?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([l]):s.add(l)),zd(e,l,c)),!1}throw Error(o(435,s.tag))}return zd(e,l,c),To(),!1}if(De)return t=Dt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==xu&&(e=Error(o(422),{cause:l}),wl(wn(e,s)))):(l!==xu&&(t=Error(o(423),{cause:l}),wl(wn(t,s))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=wn(l,s),c=Xu(e.stateNode,l,c),_u(e,c),xt!==4&&(xt=2)),!1;var u=Error(o(520),{cause:l});if(u=wn(u,s),Ql===null?Ql=[u]:Ql.push(u),xt!==4&&(xt=2),t===null)return!0;l=wn(l,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=c&-c,s.lanes|=e,e=Xu(s.stateNode,l,e),_u(s,e),!1;case 1:if(t=s.type,u=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Va===null||!Va.has(u))))return s.flags|=65536,c&=-c,s.lanes|=c,c=dp(c),fp(c,e,s,l),_u(s,c),!1;break;case 22:if(s.memoizedState!==null)return s.flags|=65536,!1}s=s.return}while(s!==null);return!1}var Zu=Error(o(461)),wt=!1;function kt(e,t,s,l){t.child=e===null?px(t,null,s,l):ks(t,e.child,s,l)}function mp(e,t,s,l,c){s=s.render;var u=t.ref;if("ref"in l){var x={};for(var N in l)N!=="ref"&&(x[N]=l[N])}else x=l;return js(t),l=Ou(e,t,s,x,u,c),N=zu(),e!==null&&!wt?(Mu(e,t,c),va(e,t,c)):(De&&N&&$i(t),t.flags|=1,kt(e,t,l,c),t.child)}function hp(e,t,s,l,c){if(e===null){var u=s.type;return typeof u=="function"&&!du(u)&&u.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=u,xp(e,t,u,l,c)):(e=qi(s.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!sd(e,c)){var x=u.memoizedProps;if(s=s.compare,s=s!==null?s:bl,s(x,l)&&e.ref===t.ref)return va(e,t,c)}return t.flags|=1,e=ma(u,l),e.ref=t.ref,e.return=t,t.child=e}function xp(e,t,s,l,c){if(e!==null){var u=e.memoizedProps;if(bl(u,l)&&e.ref===t.ref)if(wt=!1,t.pendingProps=l=u,sd(e,c))(e.flags&131072)!==0&&(wt=!0);else return t.lanes=e.lanes,va(e,t,c)}return Iu(e,t,s,l,c)}function pp(e,t,s,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|s:s,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return gp(e,t,u,s,l)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ki(t,u!==null?u.cachePool:null),u!==null?vx(t,u):Eu(),bx(t);else return l=t.lanes=536870912,gp(e,t,u!==null?u.baseLanes|s:s,s,l)}else u!==null?(Ki(t,u.cachePool),vx(t,u),Fa(),t.memoizedState=null):(e!==null&&Ki(t,null),Eu(),Fa());return kt(e,t,c,s),t.child}function Dl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function gp(e,t,s,l,c){var u=ju();return u=u===null?null:{parent:jt._currentValue,pool:u},t.memoizedState={baseLanes:s,cachePool:u},e!==null&&Ki(t,null),Eu(),bx(t),e!==null&&bs(e,t,l,!0),t.childLanes=c,null}function oo(e,t){return t=co({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function yp(e,t,s){return ks(t,e.child,null,s),e=oo(t,t.pendingProps),e.flags|=2,dn(t),t.memoizedState=null,e}function cN(e,t,s){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(De){if(l.mode==="hidden")return e=oo(t,l),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Dl(null,e);if(Tu(t),(e=rt)?(e=Pg(e,kn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:za!==null?{id:Zn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=tx(e),s.return=t,t.child=s,Tt=t,rt=null)):e=null,e===null)throw Da(t);return t.lanes=536870912,null}return oo(t,l)}var u=e.memoizedState;if(u!==null){var x=u.dehydrated;if(Tu(t),c)if(t.flags&256)t.flags&=-257,t=yp(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(wt||bs(e,t,s,!1),c=(s&e.childLanes)!==0,wt||c){if(Ba.current===null){if(l=at,l!==null&&(x=sh(l,s),x!==0&&x!==u.retryLane))throw u.retryLane=x,ps(e,x),an(l,e,x),Zu;To()}t=yp(e,t,s)}else e=u.treeContext,rt=Cn(x.nextSibling),Tt=t,De=!0,Ma=null,kn=!1,e!==null&&sx(t,e),t=oo(t,l),t.flags|=134221824;return t}return e=ma(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jr(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(o(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function Iu(e,t,s,l,c){return js(t),s=Ou(e,t,s,l,void 0,c),l=zu(),e!==null&&!wt?(Mu(e,t,c),va(e,t,c)):(De&&l&&$i(t),t.flags|=1,kt(e,t,s,c),t.child)}function vp(e,t,s,l,c,u){return js(t),t.updateQueue=null,s=Nx(t,l,s,c),jx(e),l=zu(),e!==null&&!wt?(Mu(e,t,u),va(e,t,u)):(De&&l&&$i(t),t.flags|=1,kt(e,t,s,u),t.child)}function bp(e,t,s,l,c){if(js(t),t.stateNode===null){var u=dr,x=s.contextType;typeof x=="object"&&x!==null&&(u=Mt(x)),u=new s(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Vu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},wu(t),x=s.contextType,u.context=typeof x=="object"&&x!==null?Mt(x):dr,u.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Gu(t,s,x,l),u.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(x=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),x!==u.state&&Vu.enqueueReplaceState(u,u.state,null),Al(t,l,u,c),Tl(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var N=t.memoizedProps,E=Cs(s,N);u.props=E;var M=u.context,$=s.contextType;x=dr,typeof $=="object"&&$!==null&&(x=Mt($));var K=s.getDerivedStateFromProps;$=typeof K=="function"||typeof u.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,$||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(N||M!==x)&&lp(t,u,l,x),qa=!1;var O=t.memoizedState;u.state=O,Al(t,l,u,c),Tl(),M=t.memoizedState,N||O!==M||qa?(typeof K=="function"&&(Gu(t,s,K,l),M=t.memoizedState),(E=qa||rp(t,s,E,l,O,M,x))?($||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=M),u.props=l,u.state=M,u.context=x,l=E):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Su(e,t),x=t.memoizedProps,$=Cs(s,x),u.props=$,K=t.pendingProps,O=u.context,M=s.contextType,E=dr,typeof M=="object"&&M!==null&&(E=Mt(M)),N=s.getDerivedStateFromProps,(M=typeof N=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(x!==K||O!==E)&&lp(t,u,l,E),qa=!1,O=t.memoizedState,u.state=O,Al(t,l,u,c),Tl();var L=t.memoizedState;x!==K||O!==L||qa||e!==null&&e.dependencies!==null&&Fi(e.dependencies)?(typeof N=="function"&&(Gu(t,s,N,l),L=t.memoizedState),($=qa||rp(t,s,$,l,O,L,E)||e!==null&&e.dependencies!==null&&Fi(e.dependencies))?(M||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,L,E),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,L,E)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||x===e.memoizedProps&&O===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&O===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=L),u.props=l,u.state=L,u.context=E,l=$):(typeof u.componentDidUpdate!="function"||x===e.memoizedProps&&O===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&O===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,jr(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=ks(t,e.child,null,c),t.child=ks(t,null,s,c)):kt(e,t,s,c),t.memoizedState=u.state,e=t.child):e=va(e,t,c),e}function jp(e,t,s,l){return ys(),t.flags|=256,kt(e,t,s,l),t.child}var Ju={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:ux()}}function ed(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=hn),e}function Np(e,t,s){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,x;if((x=u)||(x=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),x&&(c=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(De){if(c?Qa(t):Fa(),(e=rt)?(e=Pg(e,kn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:za!==null?{id:Zn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=tx(e),s.return=t,t.child=s,Tt=t,rt=null)):e=null,e===null)throw Da(t);return Wd(e)?t.lanes=32:t.lanes=536870912,null}return u=l.children,l=l.fallback,c?(Fa(),c=t.mode,u=co({mode:"hidden",children:u},c),l=gs(l,c,s,null),u.return=t,l.return=t,u.sibling=l,t.child=u,l=t.child,l.memoizedState=Wu(s),l.childLanes=ed(e,x,s),t.memoizedState=Ju,Dl(null,l)):(Qa(t),td(t,u))}var N=e.memoizedState;if(N!==null){var E=N.dehydrated;if(E!==null)return uN(e,t,u,x,l,E,N,s)}return c?(Fa(),c=l.fallback,u=t.mode,N=e.child,E=N.sibling,l=ma(N,{mode:"hidden",children:l.children}),l.subtreeFlags=N.subtreeFlags&1206910976,E!==null?c=ma(E,c):(c=gs(c,u,s,null),c.flags|=2),c.return=t,l.return=t,l.sibling=c,t.child=l,Dl(null,l),l=t.child,c=e.child.memoizedState,c===null?c=Wu(s):(u=c.cachePool,u!==null?(N=jt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=ux(),c={baseLanes:c.baseLanes|s,cachePool:u}),l.memoizedState=c,l.childLanes=ed(e,x,s),t.memoizedState=Ju,Dl(e.child,l)):(Qa(t),s=e.child,e=s.sibling,s=ma(s,{mode:"visible",children:l.children}),s.return=t,s.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=s,t.memoizedState=null,s)}function td(e,t){return t=co({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function co(e,t){return e=Wt(22,e,null,t),e.lanes=0,e}function uo(e,t,s){return ks(t,e.child,null,s),e=td(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function uN(e,t,s,l,c,u,x,N){if(s)return t.flags&256?(Qa(t),t.flags&=-257,uo(e,t,N)):t.memoizedState!==null?(Fa(),t.child=e.child,t.flags|=128,null):(Fa(),u=c.fallback,x=t.mode,c=co({mode:"visible",children:c.children},x),u=gs(u,x,N,null),u.flags|=2,c.return=t,u.return=t,c.sibling=u,t.child=c,ks(t,e.child,null,N),c=t.child,c.memoizedState=Wu(N),c.childLanes=ed(e,l,N),t.memoizedState=Ju,Dl(null,c));if(Qa(t),Wd(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var E=l.dgst;return l=E,l!==""&&(c=Error(o(419)),c.stack="",c.digest=l,wl({value:c,source:null,stack:null})),uo(e,t,N)}if(wt||bs(e,t,N,!1),l=(N&e.childLanes)!==0,wt||l){if(Ba.current!==null)return uo(e,t,N);if(l=at,l!==null&&(c=sh(l,N),c!==0&&c!==x.retryLane))throw x.retryLane=c,ps(e,c),an(l,e,c),Zu;return Jd(u)||To(),uo(e,t,N)}return Jd(u)?(t.flags|=192,t.child=e.child,null):(e=x.treeContext,rt=Cn(u.nextSibling),Tt=t,De=!0,Ma=null,kn=!1,e!==null&&sx(t,e),t=td(t,c.children),t.flags|=134221824,t)}function wp(e,t,s){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Qi(e.return,t,s)}function Sp(e){for(var t=null;e!==null;){var s=e.alternate;s!==null&&Ii(s)===null&&(t=e),e=e.sibling}return t}function fo(e,t,s,l,c,u){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:c,treeForkCount:u}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=s,x.tailMode=c,x.treeForkCount=u)}function nd(e){var t=e.child;for(e.child=null;t!==null;){var s=t.sibling;t.sibling=e.child,e.child=t,t=s}}function ad(e,t,s){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var x=Lt.current;if(t.flags&128)return Rl(t,x),null;var N=(x&2)!==0;if(N?(x=x&1|2,t.flags|=128):x&=1,Rl(t,x),c==="backwards"&&e!==null?(nd(e),kt(e,t,l,s),nd(e)):kt(e,t,l,s),l=De?Nl:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wp(e,s,t);else if(e.tag===19)wp(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"backwards":s=Sp(t.child),s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null,nd(t)),fo(t,!0,c,null,u,l);break;case"unstable_legacy-backwards":for(s=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Ii(e)===null){t.child=c;break}e=c.sibling,c.sibling=s,s=c,c=e}fo(t,!0,s,null,u,l);break;case"together":fo(t,!1,null,null,void 0,l);break;case"independent":t.memoizedState=null;break;default:s=Sp(t.child),s===null?(c=t.child,t.child=null):(c=s.sibling,s.sibling=null),fo(t,!1,c,s,u,l)}return t.child}function _p(e,t,s){var l=t.pendingProps;return La(t,t.type,l.value),kt(e,t,l.children,s),t.child}function va(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Ga|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(bs(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,s=ma(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=ma(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function sd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Fi(e)))}function dN(e,t,s){switch(t.tag){case 3:Zs(t,t.stateNode.containerInfo),La(t,jt,e.memoizedState.cache),ys();break;case 27:case 5:Is(t);break;case 4:Zs(t,t.stateNode.containerInfo);break;case 10:La(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Tu(t),null;break;case 13:var l=t.memoizedState;if(l!==null){if(l.dehydrated!==null)return Qa(t),t.flags|=128,null;l=bs(e,t,s,!1);var c=t.child.childLanes;return l||(s&c)!==0?Np(e,t,s):(Qa(t),e=va(e,t,s),e!==null?e.sibling:null)}Qa(t);break;case 19:if(t.flags&128)return ad(e,t,s);if(c=(e.flags&128)!==0,l=(s&t.childLanes)!==0,l||(bs(e,t,s,!1),l=(s&t.childLanes)!==0),c){if(l)return ad(e,t,s);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Rl(t,Lt.current),l)break;return null;case 22:return t.lanes=0,pp(e,t,s,t.pendingProps);case 24:La(t,jt,e.memoizedState.cache)}return va(e,t,s)}function kp(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)wt=!0;else{if(!sd(e,s)&&(t.flags&128)===0)return wt=!1,dN(e,t,s);wt=(e.flags&131072)!==0}else wt=!1,De&&(t.flags&1048576)!==0&&ax(t,Nl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ss(t.elementType),t.type=e,typeof e=="function")du(e)?(l=Cs(e,l),t.tag=1,t=bp(null,t,e,l,s)):(t.tag=0,t=Iu(null,t,e,l,s));else{if(e!=null){var c=e.$$typeof;if(c===G){t.tag=11,t=mp(null,t,e,l,s);break e}else if(c===He){t.tag=14,t=hp(null,t,e,l,s);break e}else if(c===Ee){t.tag=10,t.type=e,t=_p(null,t,s);break e}}throw t=me(e)||e,Error(o(306,t,""))}}return t;case 0:return Iu(e,t,t.type,t.pendingProps,s);case 1:return l=t.type,c=Cs(l,t.pendingProps),bp(e,t,l,c,s);case 3:e:{if(Zs(t,t.stateNode.containerInfo),e===null)throw Error(o(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Su(e,t),Al(t,l,null,s);var x=t.memoizedState;if(l=x.cache,La(t,jt,l),l!==u.cache&&yu(t,[jt],s,!0),Tl(),l=x.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=jp(e,t,l,s);break e}else if(l!==c){c=wn(Error(o(424)),t),wl(c),t=jp(e,t,l,s);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,rt=Cn(e.firstChild),Tt=t,De=!0,Ma=null,kn=!0,s=px(t,null,l,s),t.child=s;s;)s.flags=s.flags&-3|134221824,s=s.sibling;else{if(ys(),l===c){t=va(e,t,s);break e}kt(e,t,l,s)}t=t.child}return t;case 26:return jr(e,t),e===null?(s=Ig(t.type,null,t.pendingProps,null))?t.memoizedState=s:De||(t.stateNode=Ag(t.type,t.pendingProps,Dn.current,t)):t.memoizedState=Ig(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Is(t),e===null&&De&&(l=t.stateNode=Gg(t.type,t.pendingProps,Dn.current),Tt=t,kn=!0,c=rt,Ia(t.type)?(ef=c,rt=Cn(l.firstChild)):rt=c),kt(e,t,t.pendingProps.children,s),jr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&De&&((c=l=rt)&&(l=rw(l,t.type,t.pendingProps,kn),l!==null?(t.stateNode=l,Tt=t,rt=Cn(l.firstChild),kn=!1,c=!0):c=!1),c||Da(t)),Is(t),c=t.type,u=t.pendingProps,x=e!==null?e.memoizedProps:null,l=u.children,Kd(c,u)?l=null:x!==null&&Kd(c,x)&&(t.flags|=32),t.memoizedState!==null&&(c=Ou(e,t,eN,null,null,s),Hr._currentValue=c),jr(e,t),kt(e,t,l,s),t.child;case 6:return e===null&&De&&((e=s=rt)&&(s=lw(s,t.pendingProps,kn),s!==null?(t.stateNode=s,Tt=t,rt=null,e=!0):e=!1),e||Da(t)),null;case 13:return Np(e,t,s);case 4:return Zs(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ks(t,null,l,s):kt(e,t,l,s),t.child;case 11:return mp(e,t,t.type,t.pendingProps,s);case 7:return l=t.pendingProps,jr(e,t),kt(e,t,l,s),t.child;case 8:return kt(e,t,t.pendingProps.children,s),t.child;case 12:return kt(e,t,t.pendingProps.children,s),t.child;case 10:return _p(e,t,s);case 9:return c=t.type._context,l=t.pendingProps.children,js(t),c=Mt(c),l=l(c),t.flags|=1,kt(e,t,l,s),t.child;case 14:return hp(e,t,t.type,t.pendingProps,s);case 15:return xp(e,t,t.type,t.pendingProps,s);case 19:return ad(e,t,s);case 31:return cN(e,t,s);case 22:return pp(e,t,s,t.pendingProps);case 24:return js(t),l=Mt(jt),e===null?(c=ju(),c===null&&(c=at,u=vu(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=s),c=u),t.memoizedState={parent:l,cache:c},wu(t),La(t,jt,c)):((e.lanes&s)!==0&&(Su(e,t),Al(t,null,null,s),Tl()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),La(t,jt,l)):(l=u.cache,La(t,jt,l),l!==c.cache&&yu(t,[jt],s,!0))),kt(e,t,t.pendingProps.children,s),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),l=t.pendingProps,l.name!=null&&l.name!=="auto"?t.flags|=e===null?18882560:18874368:De&&$i(t),e!==null&&e.memoizedProps.name!==l.name?t.flags|=4194816:jr(e,t),kt(e,t,l.children,s),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ba(e){e.flags|=4}function rd(e,t,s,l,c){var u;if((u=(e.mode&32)!==0)&&(u=s===null?ty(t,l):ty(t,l)&&(l.src!==s.src||l.srcSet!==s.srcSet)),u){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(ig())e.flags|=8192;else throw _s=Gi,Nu}else e.flags&=-16777217}function Ep(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ny(t))if(ig())e.flags|=8192;else throw _s=Gi,Nu}function mo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?th():536870912,e.lanes|=t,kr|=t)}function Ll(e,t){if(!De)switch(e.tailMode){case"visible":break;case"collapsed":for(var s=e.tail,l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null;break;default:for(t=e.tail,s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null}}function lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(t)for(var c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags&1206910976,l|=c.flags&1206910976,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)s|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=s,t}function fN(e,t,s){var l=t.pendingProps;switch(hu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return lt(t),null;case 3:return s=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),pa(jt),Vn(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(hr(t)?ba(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,pu())),lt(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ba(t),u!==null?(lt(t),Ep(t,u)):(lt(t),rd(t,c,null,l,s))):u?u!==e.memoizedState?(ba(t),lt(t),Ep(t,u)):(lt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ba(t),lt(t),rd(t,c,e,l,s)),null;case 27:if(cs(t),s=Dn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return lt(t),t.subtreeFlags&=-33554433,null}e=nt.current,hr(t)?rx(t):(e=Gg(c,l,s),t.stateNode=e,ba(t))}return lt(t),t.subtreeFlags&=-33554433,null;case 5:if(cs(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return lt(t),t.subtreeFlags&=-33554433,null}if(u=nt.current,hr(t))rx(t);else{var x=Gl(Dn.current);switch(u){case 1:u=x.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=x.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=x.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=x.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=x.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?x.createElement(c,{is:l.is}):x.createElement(c)}}u[zt]=t,u[Jt]=l;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)u.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=u;e:switch(qt(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ba(t)}}return lt(t),t.subtreeFlags&=-33554433,rd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=Dn.current,hr(t)){if(e=t.stateNode,s=t.memoizedProps,l=null,c=Tt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[zt]=t,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||kg(e.nodeValue,s)),e||Da(t,!0)}else e=Gl(e).createTextNode(l),e[zt]=t,t.stateNode=e}return lt(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(l=hr(t),s!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[zt]=t}else ys(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),e=!1}else s=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(dn(t),t):(dn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return lt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=hr(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[zt]=t}else ys(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),c=!1}else c=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(dn(t),t):(dn(t),null)}return dn(t),(t.flags&128)!==0?(t.lanes=s,t):(s=l!==null,e=e!==null&&e.memoizedState!==null,s&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),mo(t,t.updateQueue),lt(t),null);case 4:return Vn(),e===null&&$d(t.stateNode.containerInfo),t.flags|=67108864,lt(t),null;case 10:return pa(t.type),lt(t),null;case 19:if(Au(t),l=t.memoizedState,l===null)return lt(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)Ll(l,!1);else{if(xt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ii(e),u!==null){for(t.flags|=128,Ll(l,!1),e=u.updateQueue,t.updateQueue=e,mo(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)ex(s,e),s=s.sibling;return Rl(t,Lt.current&1|2),De&&ha(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&rn()>_o&&(t.flags|=128,c=!0,Ll(l,!1),t.lanes=4194304)}else{if(!c)if(e=Ii(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,mo(t,e),Ll(l,!0),l.tail===null&&l.tailMode!=="collapsed"&&l.tailMode!=="visible"&&!u.alternate&&!De)return lt(t),null}else 2*rn()-l.renderingStartTime>_o&&s!==536870912&&(t.flags|=128,c=!0,Ll(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}if(l.tail!==null){e=l.tail;e:{for(s=e;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return l.rendering=e,l.tail=e.sibling,l.renderingStartTime=rn(),e.sibling=null,u=Lt.current,u=c?u&1|2:u&1,l.tailMode==="visible"||l.tailMode==="collapsed"||!s||De?Rl(t,u):(s=u,Ie(Dt,t),Ie(Lt,s),$t===null&&($t=t)),De&&ha(t,l.treeForkCount),e}return lt(t),null;case 22:case 23:return dn(t),Cu(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(s&536870912)!==0&&(t.flags&128)===0&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),s=t.updateQueue,s!==null&&mo(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==s&&(t.flags|=2048),e!==null&&vt(ws),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),pa(jt),lt(t),null;case 25:return null;case 30:return t.flags|=33554432,lt(t),null}throw Error(o(156,t.tag))}function mN(e,t){switch(hu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pa(jt),Vn(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return cs(t),null;case 31:if(t.memoizedState!==null){if(dn(t),t.alternate===null)throw Error(o(340));ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(dn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Au(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Vn(),null;case 10:return pa(t.type),null;case 22:case 23:return dn(t),Cu(),e!==null&&vt(ws),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return pa(jt),null;case 25:return null;default:return null}}function Cp(e,t){switch(hu(t),t.tag){case 3:pa(jt),Vn();break;case 26:case 27:case 5:cs(t);break;case 4:Vn();break;case 31:t.memoizedState!==null&&dn(t);break;case 13:dn(t);break;case 19:Au(t);break;case 10:pa(t.type);break;case 22:case 23:dn(t),Cu(),e!==null&&vt(ws);break;case 24:pa(jt)}}function Ul(e,t){try{var s=t.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var c=l.next;s=c;do{if((s.tag&e)===e){l=void 0;var u=s.create,x=s.inst;l=u(),x.destroy=l}s=s.next}while(s!==c)}}catch(N){We(t,t.return,N)}}function Pa(e,t,s){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var x=l.inst,N=x.destroy;if(N!==void 0){x.destroy=void 0,c=t;var E=s,M=N;try{M()}catch($){We(c,E,$)}}}l=l.next}while(l!==u)}}catch($){We(t,t.return,$)}}function Tp(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{yx(t,s)}catch(l){We(e,e.return,l)}}}function Ap(e,t,s){s.props=Cs(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){We(e,t,l)}}function Jn(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:var c=e.stateNode,u=da(e.memoizedProps,c);(c.ref===null||c.ref.name!==u)&&(c.ref=Ug(u)),l=c.ref;break;case 7:if(e.stateNode===null){var x=new pn(e);y(e.child,!1,aw,x,void 0,void 0),e.stateNode=x}l=e.stateNode;break;default:l=e.stateNode}typeof s=="function"?e.refCleanup=s(l):s.current=l}}catch(N){We(e,t,N)}}function Ut(e,t){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(c){We(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(c){We(e,t,c)}else s.current=null}function ho(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var s=0;s<t.length;s++)Fg(e.stateNode,t[s])}function Rp(e){for(var t=e.return;t!==null&&(id(t)&&Fg(e.stateNode,t.stateNode),!ld(t));)t=t.return}function ql(e){for(var t=e.return;t!==null&&(id(t)&&sw(e.stateNode,t.stateNode),!ld(t));)t=t.return}function ld(e){return e.tag===5||e.tag===3||e.tag===27}function id(e){return e&&e.tag===7&&e.stateNode!==null}function od(e){var t=e.type,s=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(c){We(e,e.return,c)}}function cd(e,t,s){try{var l=e.stateNode;HN(l,e.type,s,t),l[Jt]=t}catch(c){We(e,e.return,c)}}function Op(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Op(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ia(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function dd(e,t,s,l){var c=e.tag;if(c===5||c===6)c=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(c,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(c),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Xn)),ho(e,l),Ve=!0;else if(c!==4&&(c===27&&(ho(e,l),l=null,Ia(e.type)&&(s=e.stateNode,t=null)),e=e.child,e!==null))for(dd(e,t,s,l),e=e.sibling;e!==null;)dd(e,t,s,l),e=e.sibling}function xo(e,t,s,l){var c=e.tag;if(c===5||c===6)c=e.stateNode,t?s.insertBefore(c,t):s.appendChild(c),ho(e,l),Ve=!0;else if(c!==4&&(c===27&&(ho(e,l),l=null,Ia(e.type)&&(s=e.stateNode)),e=e.child,e!==null))for(xo(e,t,s,l),e=e.sibling;e!==null;)xo(e,t,s,l),e=e.sibling}function zp(e){var t=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);qt(t,l,s),t[zt]=e,t[Jt]=s}catch(u){We(e,e.return,u)}}var po=!1,fn=null;function Mp(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(po=!0)}var Wn=null;function Dp(){var e=Wn;return Wn=null,e}var en=0;function Nr(e,t,s,l,c){return en=0,Lp(e.child,t,s,l,c)}function Lp(e,t,s,l,c){for(var u=!1;e!==null;){if(e.tag===5){var x=e.stateNode;if(l!==null){var N=Vd(x);l.push(N),N.view&&(u=!0)}else u||Vd(x).view&&(u=!0);po=!0,Dg(x,en===0?t:t+"_"+en,s),en++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&c||Lp(e.child,t,s,l,c)&&(u=!0));e=e.sibling}return u}function ea(e,t){for(;e!==null;)e.tag===5?Lg(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||ea(e.child,t)),e=e.sibling}function go(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(go(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(o(544));var s=t.name;t=fa(t.default,t.share),t!=="none"&&(Nr(e,s,t,null,!1)||ea(e.child,!1))}e=e.sibling}}function fd(e,t){if(e.tag===30){var s=e.stateNode,l=e.memoizedProps,c=da(l,s),u=fa(l.default,s.paired?l.share:l.enter);u!=="none"?Nr(e,c,u,null,!1)?(go(e),s.paired||t||Ar(e,l.onEnter)):ea(e.child,!1):go(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)fd(e,t),e=e.sibling;else go(e)}function md(e){if(fn!==null&&fn.size!==0){var t=fn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var s=e.memoizedProps,l=s.name;if(l!=null&&l!=="auto"){var c=t.get(l);if(c!==void 0){var u=fa(s.default,s.share);if(u!=="none"&&(Nr(e,l,u,null,!1)?(u=e.stateNode,c.paired=u,u.paired=c,Ar(e,s.onShare)):ea(e.child,!1)),t.delete(l),t.size===0)break}}}md(e)}e=e.sibling}}}function hd(e){if(e.tag===30){var t=e.memoizedProps,s=da(t,e.stateNode),l=fn!==null?fn.get(s):void 0,c=fa(t.default,l!==void 0?t.share:t.exit);c!=="none"&&(Nr(e,s,c,null,!1)?l!==void 0?(c=e.stateNode,l.paired=c,c.paired=l,fn.delete(s),Ar(e,t.onShare)):Ar(e,t.onExit):ea(e.child,!1)),fn!==null&&md(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)hd(e),e=e.sibling;else fn!==null&&md(e)}function Up(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,s=da(t,e.stateNode);t=fa(t.default,t.update),e.flags&=-5,t!=="none"&&Nr(e,s,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Up(e);e=e.sibling}}function xd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,ea(e.child,!1))}xd(e)}e=e.sibling}}function yo(e){if(e.tag===30)e.stateNode.paired=null,ea(e.child,!1),xd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)yo(e),e=e.sibling;else xd(e)}function qp(e){for(e=e.child;e!==null;)e.tag===30?ea(e.child,!1):(e.subtreeFlags&33554432)!==0&&qp(e),e=e.sibling}function pd(e,t,s,l,c,u,x){for(var N=!1;t!==null;){if(t.tag===5){var E=t.stateNode;if(u!==null&&en<u.length){var M=u[en],$=Vd(E);(M.view||$.view)&&(N=!0);var K;if(K=(e.flags&4)===0)if($.clip)K=!0;else{K=M.rect;var O=$.rect;K=K.y!==O.y||K.x!==O.x||K.height!==O.height||K.width!==O.width}K&&(e.flags|=4),$.abs?$=!M.abs:(M=M.rect,$=$.rect,$=M.height!==$.height||M.width!==$.width),$&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Dg(E,en===0?s:s+"_"+en,c),N&&(e.flags&4)!==0||(Wn===null&&(Wn=[]),Wn.push(E,en===0?l:l+"_"+en,t.memoizedProps)),en++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&x?e.flags|=t.flags&32:pd(e,t.child,s,l,c,u,x)&&(N=!0));t=t.sibling}return N}function Hp(e,t){for(e=e.child;e!==null;){if(e.tag===30){var s=e.memoizedProps,l=e.stateNode,c=da(s,l),u=fa(s.default,s.update),x;x=e.memoizedState,e.memoizedState=null,l=e;var N=e.child;en=0,c=pd(l,N,c,c,u,x,!1),(e.flags&4)!==0&&c&&Ar(e,s.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Hp(e);e=e.sibling}}var At=!1,Ze=!1,ta=!1,gd=!1,$p=typeof WeakSet=="function"?WeakSet:Set,Rt=null,na=!1,Hl=!1,vo=!1,yd=!1;function hN(e,t,s){if(e=e.containerInfo,Fd=$r,e=Ph(e),su(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var u=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var N=0,E=-1,M=-1,$=0,K=0,O=e,L=null;t:for(;;){for(var ne;O!==l||u!==0&&O.nodeType!==3||(E=N+u),O!==x||c!==0&&O.nodeType!==3||(M=N+c),O.nodeType===3&&(N+=O.nodeValue.length),(ne=O.firstChild)!==null;)L=O,O=ne;for(;;){if(O===e)break t;if(L===l&&++$===u&&(E=N),L===x&&++K===c&&(M=N),(ne=O.nextSibling)!==null)break;O=L,L=O.parentNode}O=ne}l=E===-1||M===-1?null:{start:E,end:M}}else l=null}l=l||{start:0,end:0}}else l=null;for(Pd={focusedElem:e,selectionRange:l},$r=!1,s=(s&335544064)===s,Rt=t,t=s?9270:1024;Rt!==null;){if(e=Rt,s&&(l=e.deletions,l!==null))for(u=0;u<l.length;u++)s&&hd(l[u]);if(e.alternate===null&&(e.flags&2)!==0)s&&Mp(e),bo(s);else{if(e.tag===22){if(l=e.alternate,e.memoizedState!==null){l!==null&&l.memoizedState===null&&s&&hd(l),bo(s);continue}else if(l!==null&&l.memoizedState!==null){s&&Mp(e),bo(s);continue}}l=e.child,(e.subtreeFlags&t)!==0&&l!==null?(l.return=e,Rt=l):(s&&Up(e),bo(s))}}fn=null}function bo(e){for(;Rt!==null;){var t=Rt,s=e,l=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((c&1024)!==0&&l!==null){s=void 0,c=l.memoizedProps,l=l.memoizedState;var u=t.stateNode;try{var x=Cs(t.type,c);s=u.getSnapshotBeforeUpdate(x,l),u.__reactInternalSnapshotBeforeUpdate=s}catch(N){We(t,t.return,N)}}break;case 3:if((c&1024)!==0){if(l=t.stateNode.containerInfo,s=l.nodeType,s===9)Id(l);else if(s===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":Id(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:s&&l!==null&&(s=da(l.memoizedProps,l.stateNode),c=t.memoizedProps,c=fa(c.default,c.update),c!=="none"&&Nr(l,s,c,l.memoizedState=[],!0));break;default:if((c&1024)!==0)throw Error(o(163))}if(l=t.sibling,l!==null){l.return=t.return,Rt=l;break}Rt=t.return}}function Bp(e,t,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:aa(e,s),l&4&&Ul(5,s);break;case 1:if(aa(e,s),l&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(x){We(s,s.return,x)}else{var c=Cs(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){We(s,s.return,x)}}l&64&&Tp(s),l&512&&Jn(s,s.return);break;case 3:if(aa(e,s),l&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{yx(e,t)}catch(x){We(s,s.return,x)}}break;case 27:t===null&&l&4&&zp(s);case 26:case 5:aa(e,s),t===null&&l&4&&od(s),l&512&&Jn(s,s.return);break;case 12:aa(e,s);break;case 31:aa(e,s),l&4&&Kp(e,s);break;case 13:aa(e,s),l&4&&Yp(e,s),l&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=kN.bind(null,s),iw(e,s))));break;case 22:if(l=s.memoizedState!==null||At,!l){var u=t!==null&&t.memoizedState!==null||Ze;t=At,c=Ze,At=l,(Ze=u)&&!c?(l=2,(s.subtreeFlags&8772)!==0&&(l|=1),$n(e,s,l)):aa(e,s),At=t,Ze=c}break;case 30:aa(e,s),l&512&&Jn(s,s.return);break;case 7:l&512&&Jn(s,s.return);default:aa(e,s)}}function vd(e,t){for(e=e.child;e!==null;)Qp(e,t),e=e.sibling}function Qp(e,t){switch(e.tag){case 5:case 26:try{var s=e.stateNode;if(t){var l=s.style;typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"}else{var c=e.stateNode,u=e.memoizedProps.style,x=u!=null&&u.hasOwnProperty("display")?u.display:null;c.style.display=x==null||typeof x=="boolean"?"":(""+x).trim()}}catch(E){We(e,e.return,E)}bd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,Ve=!0}catch(E){We(e,e.return,E)}break;case 18:try{var N=e.stateNode;t?Mg(N,!0):Mg(e.stateNode,!1)}catch(E){We(e,e.return,E)}break;case 22:case 23:e.memoizedState===null&&vd(e,t);break;default:vd(e,t)}}function bd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var s=e,l=t;switch(s.tag){case 4:Qp(s,l);break e;case 22:s.memoizedState===null&&bd(s,l);break e;default:bd(s,l)}}e=e.sibling}}function Fp(e){var t=e.alternate;t!==null&&(e.alternate=null,Fp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Si(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ct=null,tn=!1;function qn(e,t,s){for(s=s.child;s!==null;)Pp(e,t,s),s=s.sibling}function Pp(e,t,s){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(ol,s)}catch{}switch(s.tag){case 26:Ze||Ut(s,t),qn(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&!Ze&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Ze||Ut(s,t),ql(s);var l=ct,c=tn;Ia(s.type)&&(ct=s.stateNode,tn=!1),qn(e,t,s),Vg(s.stateNode,s.type,s.memoizedProps),ct=l,tn=c;break;case 5:Ze||Ut(s,t),ql(s);case 6:if(s.tag===6&&ql(s),l=ct,c=tn,ct=null,qn(e,t,s),ct=l,tn=c,ct!==null)if(tn)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(s.stateNode),Ve=!0}catch(u){We(s,t,u)}else try{ct.removeChild(s.stateNode),Ve=!0}catch(u){We(s,t,u)}break;case 18:ct!==null&&(tn?(e=ct,zg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Br(e)):zg(ct,s.stateNode));break;case 4:l=ct,c=tn,ct=s.stateNode.containerInfo,tn=!0,qn(e,t,s),ct=l,tn=c;break;case 0:case 11:case 14:case 15:Pa(2,s,t),Ze||Pa(4,s,t),qn(e,t,s);break;case 1:Ze||(Ut(s,t),l=s.stateNode,typeof l.componentWillUnmount=="function"&&Ap(s,t,l)),qn(e,t,s);break;case 21:qn(e,t,s);break;case 22:Ze=(l=Ze)||s.memoizedState!==null,qn(e,t,s),Ze=l;break;case 30:Ut(s,t),qn(e,t,s);break;case 7:Ze||Ut(s,t),qn(e,t,s);break;default:qn(e,t,s)}}function Kp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Br(e)}catch(s){We(t,t.return,s)}}}function Yp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Br(e)}catch(s){We(t,t.return,s)}}function xN(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $p),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $p),t;default:throw Error(o(435,e.tag))}}function jo(e,t){var s=xN(e);t.forEach(function(l){if(!s.has(l)){s.add(l);var c=EN.bind(null,e,l);l.then(c,c)}})}function Gt(e,t,s){var l=t.deletions;if(l!==null)for(var c=0;c<l.length;c++){var u=l[c],x=e,N=t,E=N;e:for(;E!==null;){switch(E.tag){case 27:if(Ia(E.type)){ct=E.stateNode,tn=!1;break e}break;case 5:ct=E.stateNode,tn=!1;break e;case 3:case 4:ct=E.stateNode.containerInfo,tn=!0;break e}E=E.return}if(ct===null)throw Error(o(160));Pp(x,N,u),ct=null,tn=!1,x=u.alternate,x!==null&&(x.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Gp(t,e,s),t=t.sibling}var Hn=null;function Gp(e,t,s){var l=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(c&4&&(l=e.updateQueue,l=l!==null?l.events:null,l!==null))for(var u=0;u<l.length;u++){var x=l[u];x.ref.impl=x.nextImpl}Gt(t,e,s),Vt(e),c&4&&(Pa(3,e,e.return),Ul(3,e),Pa(5,e,e.return));break;case 1:Gt(t,e,s),Vt(e),c&512&&(Ze||l===null||Ut(l,l.return)),c&64&&At&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?t:s.concat(t))));break;case 26:if(u=Hn,Gt(t,e,s),Vt(e),c&512&&(Ze||l===null||Ut(l,l.return)),c&4)if(c=l!==null?l.memoizedState:null,s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null)if(At)e.stateNode=Ag(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,s=e.memoizedProps,c=u.ownerDocument||u;t:switch(t){case"title":l=c.getElementsByTagName("title")[0],(!l||l[dl]||l[zt]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=c.createElement(t),c.head.insertBefore(l,c.querySelector("head > title"))),qt(l,t,s),l[zt]=e,Ct(l),t=l;break e;case"link":if(u=ey("link","href",c).get(t+(s.href||""))){for(x=0;x<u.length;x++)if(l=u[x],l.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&l.getAttribute("rel")===(s.rel==null?null:s.rel)&&l.getAttribute("title")===(s.title==null?null:s.title)&&l.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){u.splice(x,1);break t}}l=c.createElement(t),qt(l,t,s),c.head.appendChild(l);break;case"meta":if(u=ey("meta","content",c).get(t+(s.content||""))){for(x=0;x<u.length;x++)if(l=u[x],l.getAttribute("content")===(s.content==null?null:""+s.content)&&l.getAttribute("name")===(s.name==null?null:s.name)&&l.getAttribute("property")===(s.property==null?null:s.property)&&l.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&l.getAttribute("charset")===(s.charSet==null?null:s.charSet)){u.splice(x,1);break t}}l=c.createElement(t),qt(l,t,s),c.head.appendChild(l);break;default:throw Error(o(468,t))}l[zt]=e,Ct(l),t=l}e.stateNode=t}else At||sf(u,e.type,e.stateNode);else e.stateNode=Wg(u,s,e.memoizedProps);else c!==s?(c===null?(t=l.stateNode,t===null||Ze||t.parentNode.removeChild(t)):c.count--,s===null?At||sf(u,e.type,e.stateNode):Wg(u,s,e.memoizedProps)):s===null&&e.stateNode!==null&&cd(e,e.memoizedProps,l.memoizedProps);break;case 27:Gt(t,e,s),Vt(e),c&512&&(Ze||l===null||Ut(l,l.return)),l!==null&&c&4&&cd(e,e.memoizedProps,l.memoizedProps);break;case 5:if(u=ta,ta=!1,Gt(t,e,s),ta=u,Vt(e),c&512&&(Ze||l===null||Ut(l,l.return)),e.flags&32){t=e.stateNode;try{sr(t,""),Ve=!0}catch($){We(e,e.return,$)}}c&4&&e.stateNode!=null&&(t=e.memoizedProps,cd(e,t,l!==null?l.memoizedProps:t)),c&1024&&(gd=!0);break;case 6:if(Gt(t,e,s),Vt(e),c&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,s=e.stateNode;try{s.nodeValue=t,Ve=!0}catch($){We(e,e.return,$)}}break;case 3:if(Ve=!1,Lo=null,u=Hn,Hn=Vl(t.containerInfo),Gt(t,e,s),Hn=u,Vt(e),c&4&&l!==null&&l.memoizedState.isDehydrated)try{Br(t.containerInfo)}catch($){We(e,e.return,$)}gd&&(gd=!1,Vp(e)),Ve=!1;break;case 4:c=ta,ta=At,l=hh(),u=Hn,Hn=Vl(e.stateNode.containerInfo),Gt(t,e,s),Vt(e),Hn=u,Ve&&Hl&&(vo=!0),Ve=l,ta=c;break;case 12:Gt(t,e,s),Vt(e);break;case 31:Gt(t,e,s),Vt(e),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 13:Gt(t,e,s),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(So=rn()),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 22:u=e.memoizedState!==null,x=l!==null&&l.memoizedState!==null;var N=At,E=Ze,M=ta;At=N||u,ta=M||u,Ze=E||x,Gt(t,e,s),Ze=E,ta=M,At=N,Vt(e),c&8192&&(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,!u||l===null||x||At||Ze||(t=x||Ze,s=At,l=Ze,At=u||At,Ze=t,Ka(e,2),At=s,Ze=l),!u&&ta||vd(e,u)),c&4&&(t=e.updateQueue,t!==null&&(s=t.retryQueue,s!==null&&(t.retryQueue=null,jo(e,s))));break;case 19:Gt(t,e,s),Vt(e),c&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 30:c&512&&(Ze||l===null||Ut(l,l.return)),c=hh(),u=Hl,x=(s&335544064)===s,N=e.memoizedProps,Hl=x&&fa(N.default,N.update)!=="none",Gt(t,e,s),Vt(e),x&&l!==null&&Ve&&(e.flags|=4),Hl=u,Ve=c;break;case 21:break;case 7:c&512&&(Ze||l===null||Ut(l,l.return)),l&&l.stateNode!==null&&(l.stateNode._fragmentFiber=e);default:Gt(t,e,s),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{for(var s,l=e.return;l!==null;){if(Op(l)){s=l;break}l=l.return}l=null;for(var c=e.return;c!==null;){if(id(c)){var u=c.stateNode;l===null?l=[u]:l.push(u)}if(ld(c))break;c=c.return}var x=l;if(s==null)throw Error(o(160));switch(s.tag){case 27:var N=s.stateNode,E=ud(e);xo(e,E,N,x);break;case 5:var M=s.stateNode;s.flags&32&&(sr(M,""),s.flags&=-33);var $=ud(e);xo(e,$,M,x);break;case 3:case 4:var K=s.stateNode.containerInfo,O=ud(e);dd(e,O,K,x);break;default:throw Error(o(161))}}catch(L){We(e,e.return,L)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Vp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Vp(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,$r=!0,t.reset(),$r=!1),e=e.sibling}}function wr(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Xp(t,e),t=t.sibling;else Hp(t)}function Xp(e,t){var s=e.alternate;if(s===null)fd(e,!1);else switch(e.tag){case 3:if(yd=na=!1,Dp(),wr(t,e),!na&&!vo){if(e=Wn,e!==null)for(var l=0;l<e.length;l+=3){s=e[l];var c=e[l+1];Lg(s,e[l+2]),s=s.ownerDocument.documentElement,s!==null&&s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+c+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),yd=!0}Wn=null;break;case 5:wr(t,e);break;case 4:l=na,na=!1,wr(t,e),na&&(vo=!0),na=l;break;case 22:e.memoizedState===null&&(s.memoizedState!==null?fd(e,!1):wr(t,e));break;case 30:l=na,c=Dp(),na=!1,wr(t,e),na&&(e.flags|=4);var u=e.memoizedProps,x=e.stateNode;t=da(u,x),x=da(s.memoizedProps,x);var N=fa(u.default,u.update);N==="none"?t=!1:(u=s.memoizedState,s.memoizedState=null,s=e.child,en=0,t=pd(e,s,t,x,N,u,!0),en!==(u===null?0:u.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Ar(e,e.memoizedProps.onUpdate),Wn=c):c!==null&&(c.push.apply(c,Wn),Wn=c),na=(e.flags&32)!==0?!0:l;break;default:wr(t,e)}}function aa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Bp(e,t.alternate,t),t=t.sibling}function Ka(e,t){for(e=e.child;e!==null;){var s=e,l=t;switch(s.tag){case 0:case 11:case 14:case 15:Pa(4,s,s.return),Ka(s,l);break;case 1:Ut(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&Ap(s,s.return,c),Ka(s,l);break;case 27:(l&2)!==0&&Vg(s.stateNode,s.type,s.memoizedProps);case 5:Ut(s,s.return),s.tag!==5&&s.tag!==27||ql(s),Ka(s,l);break;case 6:ql(s);break;case 26:Ut(s,s.return),c=s.stateNode,s.memoizedState!==null||c===null||Ze||c.parentNode.removeChild(c),Ka(s,l);break;case 22:s.memoizedState===null&&Ka(s,l);break;case 30:Ut(s,s.return),Ka(s,l);break;case 7:Ut(s,s.return);default:Ka(s,l)}e=e.sibling}}function $n(e,t,s){for(s=(t.subtreeFlags&8772)!==0?s:s&-2,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,x=u.flags,N=(s&1)!==0;switch(u.tag){case 0:case 11:case 15:$n(c,u,s),Ul(4,u);break;case 1:if($n(c,u,s),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch($){We(l,l.return,$)}if(l=u,c=l.updateQueue,c!==null){var E=l.stateNode;try{var M=c.shared.hiddenCallbacks;if(M!==null)for(c.shared.hiddenCallbacks=null,c=0;c<M.length;c++)gx(M[c],E)}catch($){We(l,l.return,$)}}N&&x&64&&Tp(u),Jn(u,u.return);break;case 27:(s&2)!==0&&zp(u);case 5:u.tag!==5&&u.tag!==27||Rp(u),$n(c,u,s),N&&l===null&&x&4&&od(u),Jn(u,u.return);break;case 6:Rp(u);break;case 26:E=u.stateNode,u.memoizedState!==null||E===null||At||sf(Vl(E.ownerDocument),u.type,E),$n(c,u,s),N&&l===null&&x&4&&od(u),Jn(u,u.return);break;case 12:$n(c,u,s);break;case 31:$n(c,u,s),N&&x&4&&Kp(c,u);break;case 13:$n(c,u,s),N&&x&4&&Yp(c,u);break;case 22:u.memoizedState===null&&$n(c,u,s),Jn(u,u.return);break;case 30:$n(c,u,s),Jn(u,u.return);break;case 7:Jn(u,u.return);default:$n(c,u,s)}t=t.sibling}}function jd(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Sl(s))}function Nd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sl(e))}function En(e,t,s,l){var c=(s&335544064)===s;if(t.subtreeFlags&(c?10262:10256))for(t=t.child;t!==null;)Zp(e,t,s,l),t=t.sibling;else c&&qp(t)}function Zp(e,t,s,l){var c=(s&335544064)===s;c&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&yo(t);var u=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,s,l),u&2048&&Ul(9,t);break;case 1:En(e,t,s,l);break;case 3:En(e,t,s,l),c&&yd&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),u&2048&&(u=null,t.alternate!==null&&(u=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==u&&(t.refCount++,u!=null&&Sl(u)));break;case 12:if(u&2048){En(e,t,s,l),u=t.stateNode;try{var x=t.memoizedProps,N=x.id,E=x.onPostCommit;typeof E=="function"&&E(N,t.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(M){We(t,t.return,M)}}else En(e,t,s,l);break;case 31:En(e,t,s,l);break;case 13:En(e,t,s,l);break;case 23:break;case 22:x=t.stateNode,N=t.alternate,t.memoizedState!==null?(c&&N!==null&&N.memoizedState===null&&yo(N),x._visibility&2?En(e,t,s,l):$l(e,t)):(c&&N!==null&&N.memoizedState!==null&&yo(t),x._visibility&2?En(e,t,s,l):(x._visibility|=2,Sr(e,t,s,l,(t.subtreeFlags&10256)!==0||!1))),u&2048&&jd(N,t);break;case 24:En(e,t,s,l),u&2048&&Nd(t.alternate,t);break;case 30:c&&(u=t.alternate,u!==null&&(ea(u.child,!0),ea(t.child,!0))),En(e,t,s,l);break;default:En(e,t,s,l)}}function Sr(e,t,s,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,x=t,N=s,E=l,M=x.flags;switch(x.tag){case 0:case 11:case 15:Sr(u,x,N,E,c),Ul(8,x);break;case 23:break;case 22:var $=x.stateNode;x.memoizedState!==null?$._visibility&2?Sr(u,x,N,E,c):$l(u,x):($._visibility|=2,Sr(u,x,N,E,c)),c&&M&2048&&jd(x.alternate,x);break;case 24:Sr(u,x,N,E,c),c&&M&2048&&Nd(x.alternate,x);break;default:Sr(u,x,N,E,c)}t=t.sibling}}function $l(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,l=t,c=l.flags;switch(l.tag){case 22:$l(s,l),c&2048&&jd(l.alternate,l);break;case 24:$l(s,l),c&2048&&Nd(l.alternate,l);break;default:$l(s,l)}t=t.sibling}}var Ts=8192;function As(e,t,s){if(e.subtreeFlags&Ts)for(e=e.child;e!==null;)Ip(e,t,s),e=e.sibling}function Ip(e,t,s){switch(e.tag){case 26:As(e,t,s),e.flags&Ts&&(e.memoizedState!==null?jw(s,Hn,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&sy(s,e)));break;case 5:As(e,t,s),e.flags&Ts&&(e=e.stateNode,(t&335544128)===t&&sy(s,e));break;case 3:case 4:var l=Hn;Hn=Vl(e.stateNode.containerInfo),As(e,t,s),Hn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ts,Ts=16777216,As(e,t,s),Ts=l):As(e,t,s));break;case 30:if((e.flags&Ts)!==0&&(l=e.memoizedProps.name,l!=null&&l!=="auto")){var c=e.stateNode;c.paired=null,fn===null&&(fn=new Map),fn.set(l,c)}As(e,t,s);break;default:As(e,t,s)}}function Jp(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var l=t[s];Rt=l,eg(l,e)}Jp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wp(e),e=e.sibling}function Wp(e){switch(e.tag){case 0:case 11:case 15:Bl(e),e.flags&2048&&Pa(9,e,e.return);break;case 3:Bl(e);break;case 12:Bl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,No(e)):Bl(e);break;default:Bl(e)}}function No(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var l=t[s];Rt=l,eg(l,e)}Jp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pa(8,t,t.return),No(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,No(t));break;default:No(t)}e=e.sibling}}function eg(e,t){for(;Rt!==null;){var s=Rt;switch(s.tag){case 0:case 11:case 15:Pa(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Sl(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,Rt=l;else e:for(s=e;Rt!==null;){l=Rt;var c=l.sibling,u=l.return;if(Fp(l),l===s){Rt=null;break e}if(c!==null){c.return=u,Rt=c;break e}Rt=u}}}var pN={getCacheForType:function(e){var t=Mt(jt),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return Mt(jt).controller.signal}},gN=typeof WeakMap=="function"?WeakMap:Map,Xe=0,at=null,Be=null,Fe=0,Je=0,mn=null,Ya=!1,_r=!1,wd=!1,ja=0,xt=0,Ga=0,Rs=0,wo=0,hn=0,kr=0,Ql=null,nn=null,Sd=!1,So=0,tg=0,_o=1/0,ko=null,Va=null,mt=0,Bn=null,Os=null,sa=0,_d=0,kd=null,ng=null,Er=null,Cr=null,Tr=null,Fl=0,Eo=null;function xn(){return(Xe&2)!==0&&Fe!==0?Fe&-Fe:ce.T!==null?Ld():rh()}function ag(){if(hn===0)if((Fe&536870912)===0||De){var e=bi;bi<<=1,(bi&3932160)===0&&(bi=262144),hn=e}else hn=536870912;return e=Dt.current,e!==null&&(e.flags|=32),hn}function Ar(e,t){if(t!=null){var s=e.stateNode,l=s.ref;l===null&&(l=s.ref=Ug(da(e.memoizedProps,s))),Cr===null&&(Cr=[]),Cr.push(t.bind(null,l))}}function an(e,t,s){(e===at&&(Je===2||Je===9)||e.cancelPendingCommit!==null)&&(Rr(e,0),Xa(e,Fe,hn,!1)),ul(e,s),((Xe&2)===0||e!==at)&&(e===at&&((Xe&2)===0&&(Rs|=s),xt===4&&Xa(e,Fe,hn,!1)),ra(e))}function sg(e,t,s){if((Xe&6)!==0)throw Error(o(327));var l=!s&&(t&127)===0&&(t&e.expiredLanes)===0||cl(e,t),c=l?bN(e,t):Cd(e,t,!0),u=l;do{if(c===0){_r&&!l&&Xa(e,t,0,!1);break}else{if(s=e.current.alternate,u&&!yN(s)){c=Cd(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var N=e;c=Ql;var E=N.current.memoizedState.isDehydrated;if(E&&(Rr(N,x).flags|=256),x=Cd(N,x,!1),x!==2&&x!==6){if(wd&&!E){N.errorRecoveryDisabledLanes|=u,Rs|=u,c=4;break e}u=nn,nn=c,u!==null&&(nn===null?nn=u:nn.push.apply(nn,u))}c=x}if(u=!1,c!==2)continue}}if(c===1){Rr(e,0),Xa(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Xa(l,t,hn,!Ya);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=So+300-rn(),10<c)){if(Xa(l,t,hn,!Ya),Ni(l,0,!0)!==0)break e;sa=t,l.timeoutHandle=Gd(rg.bind(null,l,s,nn,ko,Sd,t,hn,Rs,kr,Ya,u,"Throttled",-0,0),c);break e}rg(l,s,nn,ko,Sd,t,hn,Rs,kr,Ya,u,null,-0,0)}}break}while(!0);ra(e)}function rg(e,t,s,l,c,u,x,N,E,M,$,K,O,L){e.timeoutHandle=-1;var ne=t.subtreeFlags,de=(u&335544064)===u;if(K=null,(de||ne&8192||(ne&16785408)===16785408)&&(K={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xn},fn=null,Ip(t,u,K),de&&(ne=K,de=e.containerInfo,de=(de.nodeType===9?de:de.ownerDocument).__reactViewTransition,de!=null&&(ne.count++,ne.waitingForViewTransition=!0,ne=Il.bind(ne),de.finished.then(ne,ne))),ne=(u&62914560)===u?So-rn():(u&4194048)===u?tg-rn():0,ne=Nw(K,ne),ne!==null)){sa=u,e.cancelPendingCommit=ne(mg.bind(null,e,t,u,s,l,c,x,N,E,M,$,K,null,O,L)),Xa(e,u,x,!M);return}mg(e,t,u,s,l,c,x,N,E,M,$,K)}function yN(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var c=s[l],u=c.getSnapshot;c=c.value;try{if(!un(u(),c))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Xa(e,t,s,l){t=eh(e,t),t&=~wo,t&=~Rs,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-on(c),x=1<<u;l[u]=-1,c&=~x}s!==0&&nh(e,s,t)}function Co(){return(Xe&6)===0?(Pl(0),!1):!0}function Ed(){if(Be!==null){if(Je===0)var e=Be.return;else e=Be,xa=vs=null,Du(e),gr=null,El=0,e=Be;for(;e!==null;)Cp(e.alternate,e),e=e.return;Be=null}}function Rr(e,t){var s=e.timeoutHandle;return s!==-1&&(e.timeoutHandle=-1,QN(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),sa=0,Ed(),at=e,Be=s=ma(e.current,null),Fe=t,Je=0,mn=null,Ya=!1,_r=cl(e,t),wd=!1,kr=hn=wo=Rs=Ga=xt=0,nn=Ql=null,Sd=!1,ja=eh(e,t),Di(),s}function lg(e,t){Ce=null,ce.H=lo,t===pr||t===Yi?(t=mx(),Je=3):t===Nu?(t=mx(),Je=4):Je=t===Zu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,mn=t,Be===null&&(xt=1,io(e,wn(t,e.current)))}function ig(){var e=Dt.current;return e===null?!0:(Fe&4194048)===Fe?$t===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?e===$t:!1}function og(){var e=ce.H;return ce.H=lo,e===null?lo:e}function cg(){var e=ce.A;return ce.A=pN,e}function To(){xt=4,Ya||(Fe&4194048)!==Fe&&Dt.current!==null||(_r=!0),(Ga&134217727)===0&&(Rs&134217727)===0||at===null||Xa(at,Fe,hn,!1)}function Cd(e,t,s){var l=Xe;Xe|=2;var c=og(),u=cg();(at!==e||Fe!==t)&&(ko=null,Rr(e,t)),t=!1;var x=xt;e:do try{if(Je!==0&&Be!==null){var N=Be,E=mn;switch(Je){case 8:Ed(),x=6;break e;case 3:case 2:case 9:case 6:Dt.current===null&&(t=!0);var M=Je;if(Je=0,mn=null,Or(e,N,E,M),s&&_r){x=0;break e}break;default:M=Je,Je=0,mn=null,Or(e,N,E,M)}}vN(),x=xt;break}catch($){lg(e,$)}while(!0);return t&&e.shellSuspendCounter++,xa=vs=null,Xe=l,ce.H=c,ce.A=u,Be===null&&(at=null,Fe=0,Di()),x}function vN(){for(;Be!==null;)ug(Be)}function bN(e,t){var s=Xe;Xe|=2;var l=og(),c=cg();at!==e||Fe!==t?(ko=null,_o=rn()+500,Rr(e,t)):_r=cl(e,t);e:do try{if(Je!==0&&Be!==null){t=Be;var u=mn;t:switch(Je){case 1:Je=0,mn=null,Or(e,t,u,1);break;case 2:case 9:if(dx(u)){Je=0,mn=null,dg(t);break}t=function(){Je!==2&&Je!==9||at!==e||(Je=7),ra(e)},u.then(t,t);break e;case 3:Je=7;break e;case 4:Je=5;break e;case 7:dx(u)?(Je=0,mn=null,dg(t)):(Je=0,mn=null,Or(e,t,u,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var N=Be;if(x?ny(x):N.stateNode.complete){Je=0,mn=null;var E=N.sibling;if(E!==null)Be=E;else{var M=N.return;M!==null?(Be=M,Ao(M)):Be=null}break t}}Je=0,mn=null,Or(e,t,u,5);break;case 6:Je=0,mn=null,Or(e,t,u,6);break;case 8:Ed(),xt=6;break e;default:throw Error(o(462))}}jN();break}catch($){lg(e,$)}while(!0);return xa=vs=null,ce.H=l,ce.A=c,Xe=s,Be!==null?0:(at=null,Fe=0,Di(),xt)}function jN(){for(;Be!==null&&!q1();)ug(Be)}function ug(e){var t=kp(e.alternate,e,ja);e.memoizedProps=e.pendingProps,t===null?Ao(e):Be=t}function dg(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=vp(s,t,t.pendingProps,t.type,void 0,Fe);break;case 11:t=vp(s,t,t.pendingProps,t.type.render,t.ref,Fe);break;case 5:Du(t);var l=t;l===Tt&&(De?(Bi(l),l.tag===5&&l.stateNode!=null&&(rt=l.stateNode)):(Bi(l),De=!0));default:Cp(s,t),t=Be=ex(t,ja),t=kp(s,t,ja)}e.memoizedProps=e.pendingProps,t===null?Ao(e):Be=t}function Or(e,t,s,l){xa=vs=null,Du(t),gr=null,El=0;var c=t.return;try{if(oN(e,c,t,s,Fe)){xt=1,io(e,wn(s,e.current)),Be=null;return}}catch(u){if(c!==null)throw Be=c,u;xt=1,io(e,wn(s,e.current)),Be=null;return}t.flags&32768?(De||l===1?e=!0:_r||(Fe&536870912)!==0?e=!1:(Ya=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dt.current,l!==null&&l.tag===13&&(l.flags|=16384))),fg(t,e)):Ao(t)}function Ao(e){var t=e;do{if((t.flags&32768)!==0){fg(t,Ya);return}e=t.return;var s=fN(t.alternate,t,ja);if(s!==null){Be=s;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);xt===0&&(xt=5)}function fg(e,t){do{var s=mN(e.alternate,e);if(s!==null){s.flags&=32767,Be=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Be=e;return}Be=e=s}while(e!==null);xt=6,Be=null}function mg(e,t,s,l,c,u,x,N,E,M,$,K){e.cancelPendingCommit=null;do Ro();while(mt!==0);if((Xe&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===at&&(Be=at=null,Fe=0),Os=t,Bn=e,sa=s,kd=c,ng=l,NN(e,t,s,x,N,E,K)}}function NN(e,t,s,l,c,u,x){var N=t.lanes|t.childLanes;if(_d=N,N|=cu,V1(e,s,N,l,c,u),Cr=null,(s&335544064)===s?(Tr=Z0(e),l=10262):(Tr=null,l=10256),(t.subtreeFlags&l)!==0||(t.flags&l)!==0?(e.callbackNode=null,e.callbackPriority=0,CN(yi,function(){return Od(),null})):(e.callbackNode=null,e.callbackPriority=0),po=!1,l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=ce.T,ce.T=null,c=ve.p,ve.p=2,u=Xe,Xe|=4;try{hN(e,t,s)}finally{Xe=u,ve.p=c,ce.T=l}}mt=1,po?Er=VN(x,e.containerInfo,Tr,Td,Ad,SN,Rd,Od,wN):(Td(),Ad(),Rd())}function wN(e){if(mt!==0){var t=Bn.onRecoverableError;t(e,{componentStack:null})}}function SN(){mt===3&&(mt=0,Xp(Os,Bn),mt=4)}function Td(){if(mt===1){mt=0;var e=Bn,t=Os,s=sa,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=ce.T,ce.T=null;var c=ve.p;ve.p=2;var u=Xe;Xe|=4;try{Hl=vo=!1,Gp(t,e,s),s=Pd;var x=Ph(e.containerInfo),N=s.focusedElem,E=s.selectionRange;if(x!==N&&N&&N.ownerDocument&&Fh(N.ownerDocument.documentElement,N)){if(E!==null&&su(N)){var M=E.start,$=E.end;if($===void 0&&($=M),"selectionStart"in N)N.selectionStart=M,N.selectionEnd=Math.min($,N.value.length);else{var K=N.ownerDocument||document,O=K&&K.defaultView||window;if(O.getSelection){var L=O.getSelection(),ne=N.textContent.length,de=Math.min(E.start,ne),Te=E.end===void 0?de:Math.min(E.end,ne);!L.extend&&de>Te&&(x=Te,Te=de,de=x);var z=Qh(N,de),R=Qh(N,Te);if(z&&R&&(L.rangeCount!==1||L.anchorNode!==z.node||L.anchorOffset!==z.offset||L.focusNode!==R.node||L.focusOffset!==R.offset)){var D=K.createRange();D.setStart(z.node,z.offset),L.removeAllRanges(),de>Te?(L.addRange(D),L.extend(R.node,R.offset)):(D.setEnd(R.node,R.offset),L.addRange(D))}}}}for(K=[],L=N;L=L.parentNode;)L.nodeType===1&&K.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<K.length;N++){var P=K[N];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}$r=!!Fd,Pd=Fd=null}finally{Xe=u,ve.p=c,ce.T=l}}e.current=t,mt=2}}function Ad(){if(mt===2){mt=0;var e=Bn,t=Os,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=ce.T,ce.T=null;var l=ve.p;ve.p=2;var c=Xe;Xe|=4;try{Bp(e,t.alternate,t)}finally{Xe=c,ve.p=l,ce.T=s}}mt=3}}function Rd(){if(mt===4||mt===3){mt=0;var e=Er;Er=null,H1();var t=Bn,s=Os,l=sa,c=ng,u=(l&335544064)===l?10262:10256;if((s.subtreeFlags&u)!==0||(s.flags&u)!==0?mt=5:(mt=0,Os=Bn=null,hg(t,t.pendingLanes)),u=t.pendingLanes,u===0&&(Va=null),$c(l),s=s.stateNode,ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(ol,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=ce.T,u=ve.p,ve.p=2,ce.T=null;try{for(var x=t.onRecoverableError,N=0;N<c.length;N++){var E=c[N];x(E.value,{componentStack:E.stack})}}finally{ce.T=s,ve.p=u}}if(c=Cr,x=Tr,Tr=null,c!==null&&(Cr=null,x===null&&(x=[]),e!==null))for(E=0;E<c.length;E++)s=(0,c[E])(x),s!==void 0&&e.finished.finally(s);(sa&3)!==0&&Ro(),ra(t),u=t.pendingLanes,(l&261930)!==0&&(u&42)!==0?t===Eo?Fl++:(Fl=0,Eo=t):(Fl=0,Eo=null),Pl(0)}}function hg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Sl(t)))}function Ro(){return Er!==null&&(Er.skipTransition(),Er=null),Td(),Ad(),Rd(),Od()}function Od(){if(mt!==5)return!1;var e=Bn,t=_d;_d=0;var s=$c(sa),l=ce.T,c=ve.p;try{ve.p=32>s?32:s,ce.T=null,s=kd,kd=null;var u=Bn,x=sa;if(mt=0,Os=Bn=null,sa=0,(Xe&6)!==0)throw Error(o(331));var N=Xe;if(Xe|=4,Wp(u.current),Zp(u,u.current,x,s),Xe=N,Pl(0,!1),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(ol,u)}catch{}return!0}finally{ve.p=c,ce.T=l,hg(e,t)}}function xg(e,t,s){t=wn(s,t),t=Xu(e.stateNode,t,2),e=$a(e,t,2),e!==null&&(ul(e,2),ra(e))}function We(e,t,s){if(e.tag===3)xg(e,e,s);else for(;t!==null;){if(t.tag===3){xg(t,e,s);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Va===null||!Va.has(l))){e=wn(s,e),s=dp(2),l=$a(t,s,2),l!==null&&(fp(s,l,t,e),ul(l,2),ra(l));break}}t=t.return}}function zd(e,t,s){var l=e.pingCache;if(l===null){l=e.pingCache=new gN;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(s)||(wd=!0,c.add(s),e=_N.bind(null,e,t,s),t.then(e,e))}function _N(e,t,s){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,at===e&&(Fe&s)===s&&((xt===4||xt===3&&(Fe&62914560)===Fe&&300>rn()-So)&&(Xe&2)===0?Rr(e,0):wo|=s,kr===Fe&&(kr=0)),ra(e)}function pg(e,t){t===0&&(t=th()),e=ps(e,t),e!==null&&(ul(e,t),ra(e))}function kN(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),pg(e,s)}function EN(e,t){var s=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),pg(e,s)}function CN(e,t){return Lc(e,t)}var zr=null,Mr=null,Md=!1,Oo=!1,Dd=!1,Za=0;function ra(e){e!==Mr&&e.next===null&&(Mr===null?zr=Mr=e:Mr=Mr.next=e),Oo=!0,Md||(Md=!0,AN())}function Pl(e,t){if(!Dd&&Oo){Dd=!0;do for(var s=!1,l=zr;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var x=l.suspendedLanes,N=l.pingedLanes;u=(1<<31-on(42|e)+1)-1,u&=c&~(x&~N),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(s=!0,bg(l,u))}else u=Fe,u=Ni(l,l===at?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||cl(l,u)||(s=!0,bg(l,u));l=l.next}while(s);Dd=!1}}function TN(){gg()}function gg(){Oo=Md=!1;var e=0;Za!==0&&BN()&&(e=Za);for(var t=rn(),s=null,l=zr;l!==null;){var c=l.next,u=yg(l,t);u===0?(l.next=null,s===null?zr=c:s.next=c,c===null&&(Mr=s)):(s=l,(e!==0||(u&3)!==0)&&(Oo=!0)),l=c}mt!==0&&mt!==5||Pl(e),Za!==0&&(Za=0)}function yg(e,t){for(var s=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var x=31-on(u),N=1<<x,E=c[x];E===-1?((N&s)===0||(N&l)!==0)&&(c[x]=G1(N,t)):E<=t&&(e.expiredLanes|=N),u&=~N}if(t=at,s=Fe,s=Ni(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===t&&(Je===2||Je===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Uc(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||cl(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(l!==null&&Uc(l),$c(s)){case 2:case 8:s=Jm;break;case 32:s=yi;break;case 268435456:s=Wm;break;default:s=yi}return l=vg.bind(null,e),s=Lc(s,l),e.callbackPriority=t,e.callbackNode=s,t}return l!==null&&l!==null&&Uc(l),e.callbackPriority=2,e.callbackNode=null,2}function vg(e,t){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Ro()&&e.callbackNode!==s)return null;var l=Fe;return l=Ni(e,e===at?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(sg(e,l,t),yg(e,rn()),e.callbackNode!=null&&e.callbackNode===s?vg.bind(null,e):null)}function bg(e,t){if(Ro())return null;sg(e,t,!0)}function AN(){FN(function(){(Xe&6)!==0?Lc(Im,TN):gg()})}function Ld(){if(Za===0){var e=Ns;e===0&&(e=vi,vi<<=1,(vi&261888)===0&&(vi=256)),Za=e}return Za}function jg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ei(e)}function RN(e,t,s,l,c){if(t==="submit"&&s&&s.stateNode===c){var u=jg((c[Jt]||null).action),x=l.submitter;x&&(t=(t=x[Jt]||null)?jg(t.formAction):x.getAttribute("formAction"),t!==null&&(u=t,x=null));var N=new Ri("action","action",null,l,c);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Za!==0){var E=new FormData(c,x);Pu(s,{pending:!0,data:E,method:c.method,action:u},null,E)}}else typeof u=="function"&&(N.preventDefault(),E=new FormData(c,x),Pu(s,{pending:!0,data:E,method:c.method,action:u},u,E))},currentTarget:c}]})}}for(var Ud=0;Ud<ou.length;Ud++){var qd=ou[Ud],ON=qd.toLowerCase(),zN=qd[0].toUpperCase()+qd.slice(1);Un(ON,"on"+zN)}Un(Gh,"onAnimationEnd"),Un(Vh,"onAnimationIteration"),Un(Xh,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(Q0,"onTransitionRun"),Un(F0,"onTransitionStart"),Un(P0,"onTransitionCancel"),Un(Zh,"onTransitionEnd"),nr("onMouseEnter",["mouseout","mouseover"]),nr("onMouseLeave",["mouseout","mouseover"]),nr("onPointerEnter",["pointerout","pointerover"]),nr("onPointerLeave",["pointerout","pointerover"]),ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ms("onBeforeInput",["compositionend","keypress","textInput","paste"]),ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kl="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(" "),MN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kl));function Ng(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var x=l.length-1;0<=x;x--){var N=l[x],E=N.instance,M=N.currentTarget;if(N=N.listener,E!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=M;try{u(c)}catch($){Mi($)}c.currentTarget=null,u=E}else for(x=0;x<l.length;x++){if(N=l[x],E=N.instance,M=N.currentTarget,N=N.listener,E!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=M;try{u(c)}catch($){Mi($)}c.currentTarget=null,u=E}}}}function Qe(e,t){var s=t[ih];s===void 0&&(s=t[ih]=new Set);var l=e+"__bubble";s.has(l)||(wg(t,e,2,!1),s.add(l))}function Hd(e,t,s){var l=0;t&&(l|=4),wg(s,e,l,t)}var zo="_reactListening"+Math.random().toString(36).slice(2);function $d(e){if(!e[zo]){e[zo]=!0,uh.forEach(function(s){s!=="selectionchange"&&(MN.has(s)||Hd(s,!1,e),Hd(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zo]||(t[zo]=!0,Hd("selectionchange",!1,t))}}function wg(e,t,s,l){switch(fy(t)){case 2:var c=kw;break;case 8:c=Ew;break;default:c=lf}s=c.bind(null,t,s,e),c=void 0,!Vc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,s,{capture:!0,passive:c}):e.addEventListener(t,s,!0):c!==void 0?e.addEventListener(t,s,{passive:c}):e.addEventListener(t,s,!1)}function Bd(e,t,s,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var N=l.stateNode.containerInfo;if(N===c)break;if(x===4)for(x=l.return;x!==null;){var E=x.tag;if((E===3||E===4)&&x.stateNode.containerInfo===c)return;x=x.return}for(;N!==null;){if(x=fs(N),x===null)return;if(E=x.tag,E===5||E===6||E===26||E===27){l=u=x;continue e}N=N.parentNode}}l=l.return}wh(function(){var M=u,$=Yc(s),K=[];e:{var O=Ih.get(e);if(O!==void 0){var L=Ri,ne=e;switch(e){case"keypress":if(Ti(s)===0)break e;case"keydown":case"keyup":L=y0;break;case"focusin":ne="focus",L=Jc;break;case"focusout":ne="blur",L=Jc;break;case"beforeblur":case"afterblur":L=Jc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=kh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=l0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=w0;break;case Gh:case Vh:case Xh:L=c0;break;case Zh:L=_0;break;case"scroll":case"scrollend":L=s0;break;case"wheel":L=E0;break;case"copy":case"cut":case"paste":L=d0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Ch;break;case"submit":L=j0;break;case"toggle":case"beforetoggle":L=T0}var de=(t&4)!==0,Te=!de&&(e==="scroll"||e==="scrollend"),z=de?O!==null?O+"Capture":null:O;de=[];for(var R=M,D;R!==null;){var P=R;if(D=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||D===null||z===null||(P=ml(R,z),P!=null&&de.push(Yl(R,P,D))),Te)break;R=R.return}0<de.length&&(O=new L(O,ne,null,s,$),K.push({event:O,listeners:de}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",L&&s!==Kc&&(ne=s.relatedTarget||s.fromElement)&&(fs(ne)||ne[Ws]))break e;(O||L)&&(ne=$.window===$?$:(L=$.ownerDocument)?L.defaultView||L.parentWindow:window,O?(L=s.relatedTarget||s.toElement,O=M,L=L?fs(L):null,L!==null&&(Te=f(L),de=L.tag,L!==Te||de!==5&&de!==27&&de!==6)&&(L=null)):(O=null,L=M),O!==L&&(de=kh,P="onMouseLeave",z="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(de=Ch,P="onPointerLeave",z="onPointerEnter",R="pointer"),Te=O==null?ne:fl(O),D=L==null?ne:fl(L),ne=new de(P,R+"leave",O,s,$),ne.target=Te,ne.relatedTarget=D,P=null,fs($)===M&&(de=new de(z,R+"enter",L,s,$),de.target=D,de.relatedTarget=Te,P=de),Te=P,de=O&&L?U(O,L,DN):null,O!==null&&Sg(K,ne,O,de,!1),L!==null&&Te!==null&&Sg(K,Te,L,de,!0)))}e:{if(O=M?fl(M):window,L=O.nodeName&&O.nodeName.toLowerCase(),L==="select"||L==="input"&&O.type==="file")var ie=Lh;else if(Mh(O))if(Uh)ie=H0;else{ie=U0;var Pe=L0}else L=O.nodeName,!L||L.toLowerCase()!=="input"||O.type!=="checkbox"&&O.type!=="radio"?M&&Pc(M.elementType)&&(ie=Lh):ie=q0;if(ie&&(ie=ie(e,M))){Dh(K,ie,s,$);break e}Pe&&Pe(e,O,M)}switch(Pe=M?fl(M):window,e){case"focusin":(Mh(Pe)||Pe.contentEditable==="true")&&(or=Pe,ru=M,jl=null);break;case"focusout":jl=ru=or=null;break;case"mousedown":lu=!0;break;case"contextmenu":case"mouseup":case"dragend":lu=!1,Kh(K,s,$);break;case"selectionchange":if(B0)break;case"keydown":case"keyup":Kh(K,s,$)}var ge;if(eu)e:{switch(e){case"compositionstart":var we="onCompositionStart";break e;case"compositionend":we="onCompositionEnd";break e;case"compositionupdate":we="onCompositionUpdate";break e}we=void 0}else ir?Oh(e,s)&&(we="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(we="onCompositionStart");we&&(Th&&s.locale!=="ko"&&(ir||we!=="onCompositionStart"?we==="onCompositionEnd"&&ir&&(ge=Sh()):(Ra=$,Xc="value"in Ra?Ra.value:Ra.textContent,ir=!0)),Pe=Mo(M,we),0<Pe.length&&(we=new Eh(we,e,null,s,$),K.push({event:we,listeners:Pe}),ge?we.data=ge:(ge=zh(s),ge!==null&&(we.data=ge)))),(ge=R0?O0(e,s):z0(e,s))&&(we=Mo(M,"onBeforeInput"),0<we.length&&(Pe=new Eh("onBeforeInput","beforeinput",null,s,$),K.push({event:Pe,listeners:we}),Pe.data=ge)),RN(K,e,M,s,$)}Ng(K,t)})}function Yl(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Mo(e,t){for(var s=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=ml(e,s),c!=null&&l.unshift(Yl(e,c,u)),c=ml(e,t),c!=null&&l.push(Yl(e,c,u))),e.tag===3)return l;e=e.return}return[]}function DN(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Sg(e,t,s,l,c){for(var u=t._reactName,x=[];s!==null&&s!==l;){var N=s,E=N.alternate,M=N.stateNode;if(N=N.tag,E!==null&&E===l)break;N!==5&&N!==26&&N!==27||M===null||(E=M,c?(M=ml(s,u),M!=null&&x.unshift(Yl(s,M,E))):c||(M=ml(s,u),M!=null&&x.push(Yl(s,M,E)))),s=s.return}x.length!==0&&e.push({event:t,listeners:x})}var LN=/\r\n?/g,UN=/\u0000|\uFFFD/g;function _g(e){return(typeof e=="string"?e:""+e).replace(LN,`
9
+ `).replace(UN,"")}function kg(e,t){return t=_g(t),_g(e)===t}function et(e,t,s,l,c,u){switch(s){case"children":if(typeof l=="string")t==="body"||t==="textarea"&&l===""||sr(e,l);else if(typeof l=="number"||typeof l=="bigint")t!=="body"&&sr(e,""+l);else return;break;case"className":ki(e,"class",l);break;case"tabIndex":ki(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ki(e,s,l);break;case"style":jh(e,l,u);return;case"data":if(t!=="object"){ki(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Ei(l),e.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(s,"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 u=="function"&&(s==="formAction"?(t!=="input"&&et(e,t,"name",c.name,c,null),et(e,t,"formEncType",c.formEncType,c,null),et(e,t,"formMethod",c.formMethod,c,null),et(e,t,"formTarget",c.formTarget,c,null)):(et(e,t,"encType",c.encType,c,null),et(e,t,"method",c.method,c,null),et(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Ei(l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=Xn);return;case"onScroll":l!=null&&Qe("scroll",e);return;case"onScrollEnd":l!=null&&Qe("scrollend",e);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(s=l.__html,s!=null){if(c.children!=null)throw Error(o(60));u?.__html!==s&&(e.innerHTML=s)}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}s=Ei(l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":l===!0?e.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(s,l):e.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(s):e.setAttribute(s,l);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),_i(e,"popover",l);break;case"xlinkActuate":ca(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ca(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ca(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ca(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ca(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ca(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ca(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ca(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ca(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_i(e,"is",l);break;case"innerText":case"textContent":return;default:if(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")s=n0.get(s)||s,_i(e,s,l);else return}Ve=!0}function Qd(e,t,s,l,c,u){switch(s){case"style":jh(e,l,u);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(s=l.__html,s!=null){if(c.children!=null)throw Error(o(60));u?.__html!==s&&(e.innerHTML=s)}}break;case"children":if(typeof l=="string")sr(e,l);else if(typeof l=="number"||typeof l=="bigint")sr(e,""+l);else return;break;case"onScroll":l!=null&&Qe("scroll",e);return;case"onScrollEnd":l!=null&&Qe("scrollend",e);return;case"onClick":l!=null&&(e.onclick=Xn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!dh.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(c=s.endsWith("Capture"),u=s.slice(2,c?s.length-7:void 0),t=e[Jt]||null,t=t!=null?t[s]:null,typeof t=="function"&&e.removeEventListener(u,t,c),typeof l=="function")){typeof t!="function"&&t!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(u,l,c);break e}Ve=!0,s in e?e[s]=l:l===!0?e.setAttribute(s,""):_i(e,s,l)}return}Ve=!0}function qt(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var l=!1,c=!1,u;for(u in s)if(s.hasOwnProperty(u)){var x=s[u];if(x!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:et(e,t,u,x,s,null)}}c&&et(e,t,"srcSet",s.srcSet,s,null),l&&et(e,t,"src",s.src,s,null);return;case"input":Qe("invalid",e);var N=u=x=c=null,E=null,M=null;for(l in s)if(s.hasOwnProperty(l)){var $=s[l];if($!=null)switch(l){case"name":c=$;break;case"type":x=$;break;case"checked":E=$;break;case"defaultChecked":M=$;break;case"value":u=$;break;case"defaultValue":N=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(o(137,t));break;default:et(e,t,l,$,s,null)}}gh(e,u,N,E,M,x,c,!1);return;case"select":Qe("invalid",e),l=x=u=null;for(c in s)if(s.hasOwnProperty(c)&&(N=s[c],N!=null))switch(c){case"value":u=N;break;case"defaultValue":x=N;break;case"multiple":l=N;default:et(e,t,c,N,s,null)}t=u,s=x,e.multiple=!!l,t!=null?ar(e,!!l,t,!1):s!=null&&ar(e,!!l,s,!0);return;case"textarea":Qe("invalid",e),u=c=l=null;for(x in s)if(s.hasOwnProperty(x)&&(N=s[x],N!=null))switch(x){case"value":l=N;break;case"defaultValue":c=N;break;case"children":u=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(o(91));break;default:et(e,t,x,N,s,null)}vh(e,l,c,u);return;case"option":for(E in s)s.hasOwnProperty(E)&&(l=s[E],l!=null)&&(E==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":et(e,t,E,l,s,null));return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(l=0;l<Kl.length;l++)Qe(Kl[l],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(M in s)if(s.hasOwnProperty(M)&&(l=s[M],l!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:et(e,t,M,l,s,null)}return;default:if(Pc(t)){for($ in s)s.hasOwnProperty($)&&(l=s[$],l!==void 0&&Qd(e,t,$,l,s,void 0));return}}for(N in s)s.hasOwnProperty(N)&&(l=s[N],l!=null&&et(e,t,N,l,s,null))}var qN={};function HN(e,t,s,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,x=null,N=null,E=null,M=null,$=null;for(L in s){var K=s[L];if(s.hasOwnProperty(L)&&K!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":E=K;default:l.hasOwnProperty(L)||et(e,t,L,null,l,K)}}for(var O in l){var L=l[O];if(K=s[O],l.hasOwnProperty(O)&&(L!=null||K!=null))switch(O){case"type":L!==K&&(Ve=!0),u=L;break;case"name":L!==K&&(Ve=!0),c=L;break;case"checked":L!==K&&(Ve=!0),M=L;break;case"defaultChecked":L!==K&&(Ve=!0),$=L;break;case"value":L!==K&&(Ve=!0),x=L;break;case"defaultValue":L!==K&&(Ve=!0),N=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:L!==K&&et(e,t,O,L,l,K)}}Qc(e,x,N,E,M,$,u,c);return;case"select":L=x=N=O=null;for(u in s)if(E=s[u],s.hasOwnProperty(u)&&E!=null)switch(u){case"value":break;case"multiple":L=E;default:l.hasOwnProperty(u)||et(e,t,u,null,l,E)}for(c in l)if(u=l[c],E=s[c],l.hasOwnProperty(c)&&(u!=null||E!=null))switch(c){case"value":u!==E&&(Ve=!0),O=u;break;case"defaultValue":u!==E&&(Ve=!0),N=u;break;case"multiple":u!==E&&(Ve=!0),x=u;default:u!==E&&et(e,t,c,u,l,E)}t=N,s=x,l=L,O!=null?ar(e,!!s,O,!1):!!l!=!!s&&(t!=null?ar(e,!!s,t,!0):ar(e,!!s,s?[]:"",!1));return;case"textarea":L=O=null;for(N in s)if(c=s[N],s.hasOwnProperty(N)&&c!=null&&!l.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:et(e,t,N,null,l,c)}for(x in l)if(c=l[x],u=s[x],l.hasOwnProperty(x)&&(c!=null||u!=null))switch(x){case"value":c!==u&&(Ve=!0),O=c;break;case"defaultValue":c!==u&&(Ve=!0),L=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==u&&et(e,t,x,c,l,u)}yh(e,O,L);return;case"option":for(var ne in s)O=s[ne],s.hasOwnProperty(ne)&&O!=null&&!l.hasOwnProperty(ne)&&(ne==="selected"?e.selected=!1:et(e,t,ne,null,l,O));for(E in l)O=l[E],L=s[E],l.hasOwnProperty(E)&&O!==L&&(O!=null||L!=null)&&(E==="selected"?(O!==L&&(Ve=!0),e.selected=O&&typeof O!="function"&&typeof O!="symbol"):et(e,t,E,O,l,L));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 de in s)O=s[de],s.hasOwnProperty(de)&&O!=null&&!l.hasOwnProperty(de)&&et(e,t,de,null,l,O);for(M in l)if(O=l[M],L=s[M],l.hasOwnProperty(M)&&O!==L&&(O!=null||L!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(o(137,t));break;default:et(e,t,M,O,l,L)}return;default:if(Pc(t)){for(var Te in s)O=s[Te],s.hasOwnProperty(Te)&&O!==void 0&&!l.hasOwnProperty(Te)&&Qd(e,t,Te,void 0,l,O);for($ in l)O=l[$],L=s[$],!l.hasOwnProperty($)||O===L||O===void 0&&L===void 0||Qd(e,t,$,O,l,L);return}}for(var z in s)O=s[z],s.hasOwnProperty(z)&&O!=null&&!l.hasOwnProperty(z)&&et(e,t,z,null,l,O);for(K in l)O=l[K],L=s[K],!l.hasOwnProperty(K)||O===L||O==null&&L==null||et(e,t,K,O,l,L)}function Eg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $N(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var c=s[l],u=c.transferSize,x=c.initiatorType,N=c.duration;if(u&&N&&Eg(x)){for(x=0,N=c.responseEnd,l+=1;l<s.length;l++){var E=s[l],M=E.startTime;if(M>N)break;var $=E.transferSize,K=E.initiatorType;$&&Eg(K)&&(E=E.responseEnd,x+=$*(E<N?1:(N-M)/(E-M)))}if(--l,t+=8*(u+x)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Fd=null,Pd=null;function Gl(e){return e.nodeType===9?e:e.ownerDocument}function Cg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ag(e,t,s,l){return s=Gl(s).createElement(e),s[zt]=l,s[Jt]=t,qt(s,e,t),Ct(s),s}function Kd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yd=null;function BN(){var e=window.event;return e&&e.type==="popstate"?e===Yd?!1:(Yd=e,!0):(Yd=null,!1)}var Gd=typeof setTimeout=="function"?setTimeout:void 0,QN=typeof clearTimeout=="function"?clearTimeout:void 0,Rg=typeof Promise=="function"?Promise:void 0,Og=typeof requestAnimationFrame=="function"?requestAnimationFrame:Gd,FN=typeof queueMicrotask=="function"?queueMicrotask:typeof Rg<"u"?function(e){return Rg.resolve(null).then(e).catch(PN)}:Gd;function PN(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function zg(e,t){var s=t,l=0;do{var c=s.nextSibling;if(e.removeChild(s),c&&c.nodeType===8)if(s=c.data,s==="/$"||s==="/&"){if(l===0){e.removeChild(c),Br(t);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")tf(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,tf(s);for(var u=s.firstChild;u;){var x=u.nextSibling,N=u.nodeName;u[dl]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&u.rel.toLowerCase()==="stylesheet"||s.removeChild(u),u=x}}else s==="body"&&tf(e.ownerDocument.body);s=c}while(s);Br(t)}function Mg(e,t){var s=e;e=0;do{var l=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=l}while(s)}function Dg(e,t,s){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,s!=null&&(e.style.viewTransitionClass=s),s=getComputedStyle(e),s.display==="inline"){if(t=e.getClientRects(),t.length===1)var l=1;else for(var c=l=0;c<t.length;c++){var u=t[c];0<u.width&&0<u.height&&l++}l===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+s.paddingTop,e.marginBottom="-"+s.paddingBottom)}}function Lg(e,t){e=e.style,t=t.style;var s=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=s==null||typeof s=="boolean"?"":(""+s).trim(),s=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=s==null||typeof s=="boolean"?"":(""+s).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(s=t.display,e.display=s==null||typeof s=="boolean"?"":s,s=t.margin,s!=null?e.margin=s:(s=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=s==null||typeof s=="boolean"?"":s,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function KN(e,t,s){return s=s.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=s.innerHeight&&e.left<=s.innerWidth}}function Vd(e){var t=e.getBoundingClientRect(),s=getComputedStyle(e);return KN(t,s,e)}function YN(e){return e.documentElement.clientHeight}function GN(e){this.addEventListener("load",e),this.addEventListener("error",e)}function VN(e,t,s,l,c,u,x,N,E){var M=t.nodeType===9?t:t.ownerDocument;try{var $=M.startViewTransition({update:function(){var O=M.defaultView,L=O.navigation&&O.navigation.transition,ne=M.fonts.status;l();var de=[];if(ne==="loaded"&&(YN(M),M.fonts.status==="loading"&&de.push(M.fonts.ready)),ne=de.length,e!==null)for(var Te=e.suspenseyImages,z=0,R=0;R<Te.length;R++){var D=Te[R];if(!D.complete){var P=D.getBoundingClientRect();if(0<P.bottom&&0<P.right&&P.top<O.innerHeight&&P.left<O.innerWidth){if(z+=ay(D),z>Uo){de.length=ne;break}D=new Promise(GN.bind(D)),de.push(D)}}}if(0<de.length)return O=Promise.race([Promise.all(de),new Promise(function(ie){return setTimeout(ie,500)})]).then(c,c),(L?Promise.allSettled([L.finished,O]):O).then(u,u);if(c(),L)return L.finished.then(u,u);u()},types:s});M.__reactViewTransition=$;var K=[];return $.ready.then(function(){for(var O=M.documentElement.getAnimations({subtree:!0}),L=0;L<O.length;L++){var ne=O[L],de=ne.effect,Te=de.pseudoElement;if(Te!=null&&Te.startsWith("::view-transition")){K.push(ne),ne=de.getKeyframes();for(var z=Te=void 0,R=!0,D=0;D<ne.length;D++){var P=ne[D],ie=P.width;if(Te===void 0)Te=ie;else if(Te!==ie){R=!1;break}if(ie=P.height,z===void 0)z=ie;else if(z!==ie){R=!1;break}delete P.width,delete P.height,P.transform==="none"&&delete P.transform}R&&Te!==void 0&&z!==void 0&&(de.setKeyframes(ne),R=getComputedStyle(de.target,de.pseudoElement),R.width!==Te||R.height!==z)&&(R=ne[0],R.width=Te,R.height=z,R=ne[ne.length-1],R.width=Te,R.height=z,de.setKeyframes(ne))}}x()},function(O){M.__reactViewTransition===$&&(M.__reactViewTransition=null);try{typeof O=="object"&&O!==null&&O.name==="InvalidStateError"&&(O.message==="View transition was skipped because document visibility state is hidden."||O.message==="Skipping view transition because document visibility state has become hidden."||O.message==="Skipping view transition because viewport size changed."||O.message==="Transition was aborted because of invalid state")&&(O=null),O!==null&&E(O)}finally{l(),c(),x()}}),$.finished.finally(function(){for(var O=0;O<K.length;O++)K[O].cancel();M.__reactViewTransition===$&&(M.__reactViewTransition=null),N()}),$}catch{return l(),c(),x(),null}}function zs(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}zs.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:Z({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},zs.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,s=e.getAnimations({subtree:!0}),l=[],c=0;c<s.length;c++){var u=s[c].effect;u!==null&&u.target===e&&u.pseudoElement===t&&l.push(s[c])}return l},zs.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Ug(e){return{name:e,group:new zs("group",e),imagePair:new zs("image-pair",e),old:new zs("old",e),new:new zs("new",e)}}function pn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}pn.prototype.addEventListener=function(e,t,s){var l=null,c=null;if(!(s!=null&&typeof s!="boolean"&&(l=s.signal||null,l!==null&&l.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var u=this._eventListeners;if(Hg(u,e,t,s)===-1){var x=this,N=t;s!=null&&typeof s!="boolean"&&s.once===!0&&(N=function(E){x.removeEventListener(e,t,s),typeof t=="function"?t.call(this,E):t.handleEvent(E)}),l!==null&&(c=x.removeEventListener.bind(x,e,t,s),l.addEventListener("abort",c,{once:!0}),c=l.removeEventListener.bind(l,"abort",c)),l=Dr(s),u.push({type:e,listener:t,optionsOrUseCapture:s,attachedListener:N,cleanup:c}),y(this._fragmentFiber.child,!1,XN,e,N,l)}this._eventListeners=u}};function XN(e,t,s,l){return _(e).addEventListener(t,s,l),!1}pn.prototype.removeEventListener=function(e,t,s){var l=this._eventListeners;if(l!==null&&(t=Hg(l,e,t,s),t!==-1)){var c=l[t];s=c.attachedListener;var u=c.cleanup;c=Dr(c.optionsOrUseCapture),y(this._fragmentFiber.child,!1,ZN,e,s,c),l.splice(t,1),u!==null&&u()}};function ZN(e,t,s,l){return _(e).removeEventListener(t,s,l),!1}function Dr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function qg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Hg(e,t,s,l){if(e.length===0)return-1;l=qg(l);for(var c=0;c<e.length;c++){var u=e[c];if(u.type===t&&u.listener===s&&qg(u.optionsOrUseCapture)===l)return c}return-1}pn.prototype.dispatchEvent=function(e){var t=b(this._fragmentFiber);if(t===null)return!0;t=_(t);var s=this._eventListeners;if(s!==null&&0<s.length||!e.bubbles){var l=t.nodeType===9?t.createComment(""):document.createTextNode("");if(s)for(var c=0;c<s.length;c++){var u=s[c];l.addEventListener(u.type,u.attachedListener,Dr(u.optionsOrUseCapture))}if(t.appendChild(l),e=l.dispatchEvent(e),s)for(c=0;c<s.length;c++)u=s[c],l.removeEventListener(u.type,u.attachedListener,Dr(u.optionsOrUseCapture));return t.removeChild(l),e}return t.dispatchEvent(e)},pn.prototype.focus=function(e){y(this._fragmentFiber.child,!0,$g,e,void 0,void 0)};function $g(e,t){return e.tag===6?!1:(e=_(e),ow(e,t))}pn.prototype.focusLast=function(e){var t=[];y(this._fragmentFiber.child,!0,Xd,t,void 0,void 0);for(var s=t.length-1;0<=s&&!$g(t[s],e);s--);};function Xd(e,t){return t.push(e),!1}pn.prototype.blur=function(){var e=b(this._fragmentFiber);e!==null&&(e=_(e),e=Gl(e).activeElement,e!==null&&y(this._fragmentFiber.child,!1,IN,e,void 0,void 0))};function IN(e,t){return e.tag===6?!1:(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}pn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),y(this._fragmentFiber.child,!1,JN,e,void 0,void 0)};function JN(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}pn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),y(this._fragmentFiber.child,!1,WN,e,void 0,void 0);for(var s=t=0;s<Qn.length;s++){var l=Qn[s];l.fragmentInstance===this&&l.observer===e?e.unobserve(l.instance):Qn[t++]=l}Qn.length=t}};function WN(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var Qn=[],Zd=!1;function ew(e,t,s){Qn.push({fragmentInstance:e,observer:t,instance:s}),Zd||(Zd=!0,cw(function(){Zd=!1;var l=Qn;Qn=[];for(var c=0;c<l.length;c++){var u=l[c];u.observer.unobserve(u.instance)}}))}pn.prototype.getClientRects=function(){var e=[];return y(this._fragmentFiber.child,!1,tw,e,void 0,void 0),e};function tw(e,t){if(e.tag===6){e=e.stateNode;var s=e.ownerDocument.createRange();s.selectNodeContents(e),t.push.apply(t,s.getClientRects())}else e=_(e),t.push.apply(t,e.getClientRects());return!1}pn.prototype.getRootNode=function(e){var t=b(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},pn.prototype.compareDocumentPosition=function(e){var t=b(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var s=[];y(this._fragmentFiber.child,!1,Xd,s,void 0,void 0);var l=_(t);if(s.length===0){if(s=l,S(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(s=t)}t=this._fragmentFiber;var c=l=s.compareDocumentPosition(e);return s===e?c=Node.DOCUMENT_POSITION_CONTAINS:l&Node.DOCUMENT_POSITION_CONTAINED_BY&&(s=w(t)[1],s===null?c=Node.DOCUMENT_POSITION_PRECEDING:(e=_(s).compareDocumentPosition(e),c=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),c|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(s[0]),c=_(s[s.length-1]);var u=S(this._fragmentFiber)?t.parentElement:l;if(u==null)return Node.DOCUMENT_POSITION_DISCONNECTED;l=u.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,u=u.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_CONTAINED_BY;var x=t.compareDocumentPosition(e),N=c.compareDocumentPosition(e),E=x&Node.DOCUMENT_POSITION_CONTAINED_BY||N&Node.DOCUMENT_POSITION_CONTAINED_BY;return N=l&&u&&x&Node.DOCUMENT_POSITION_FOLLOWING&&N&Node.DOCUMENT_POSITION_PRECEDING,t=l&&t===e||u&&c===e||E||N?Node.DOCUMENT_POSITION_CONTAINED_BY:!l&&t===e||!u&&c===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:x,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||nw(t,this._fragmentFiber,s[0],s[s.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function nw(e,t,s,l,c){var u=fs(c);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(s=!!u)e:{for(;u!==null;){if(u.tag===7&&(u===t||u.alternate===t)){s=!0;break e}u=u.return}s=!1}return s}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(u===null)return u=c.ownerDocument,c===u||c===u.documentElement||c===u.body;e:{for(u=t,t=b(t);u!==null;){if(!(u.tag!==5&&u.tag!==3&&u.tag!==27||u!==t&&u.alternate!==t)){u=!0;break e}u=u.return}u=!1}return u}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!u)&&!(t=u===s)&&(t=U(s,u,F),t===null?t=!1:(y(t,!0,B,u,s),u=A,A=null,t=u!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!u)&&!(t=u===l)&&(t=U(l,u,F),t===null?t=!1:(y(t,!0,V,u,l),u=A,C=A=null,t=u!==null)),t):!1}function Bg(e,t){var s=e.ownerDocument.createRange();s.selectNodeContents(e),e=s.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}pn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];y(this._fragmentFiber.child,!1,Xd,t,void 0,void 0);var s=e!==!1;if(t.length===0){var l=w(this._fragmentFiber);if(l=s?l[1]||l[0]||b(this._fragmentFiber):l[0]||l[1],l===null)return;if(l.tag===6){e=_(l),Bg(e,s);return}if(l=_(l),l.nodeType!==9){if(l.nodeType===11){s="host"in l?l.host:null,s!==null&&s.scrollIntoView(e);return}l.scrollIntoView(e)}}for(l=s?t.length-1:0;l!==(s?-1:t.length);){var c=t[l];c.tag===6?(c=_(c),Bg(c,s)):_(c).scrollIntoView(e),l+=s?-1:1}};function aw(e,t){return e=_(e),Qg(e,t),!1}function Qg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Fg(e,t){var s=t._eventListeners;if(s!==null)for(var l=0;l<s.length;l++){var c=s[l];e.addEventListener(c.type,c.attachedListener,Dr(c.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(u){for(var x=0,N=0;N<Qn.length;N++){var E=Qn[N];(E.fragmentInstance!==t||E.observer!==u||E.instance!==e)&&(Qn[x++]=E)}Qn.length=x,u.observe(e)}),Qg(e,t))}function sw(e,t){var s=t._eventListeners;if(s!==null)for(var l=0;l<s.length;l++){var c=s[l];e.removeEventListener(c.type,c.attachedListener,Dr(c.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(u){typeof u.rootMargin=="string"?ew(t,u,e):u.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Id(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Id(s),Si(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function rw(e,t,s,l){for(;e.nodeType===1;){var c=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[dl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Cn(e.nextSibling),e===null)break}return null}function lw(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=Cn(e.nextSibling),e===null))return null;return e}function Pg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Cn(e.nextSibling),e===null))return null;return e}function Jd(e){return e.data==="$?"||e.data==="$~"}function Wd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function iw(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var l=function(){t(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Cn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ef=null;function Kg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return Cn(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function Yg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function ow(e,t){function s(){l=!0}if(e.ownerDocument.activeElement===e)return!0;var l=!1;try{e.ownerDocument.addEventListener("focus",s,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",s,!0)}return l}function cw(e){Og(function(){Og(function(t){return e(t)})})}function Gg(e,t,s){switch(t=Gl(s),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Vg(e,t,s){for(var l in s){var c=s[l];s.hasOwnProperty(l)&&c!=null&&et(e,t,l,null,qN,c)}s.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Xn&&(e.onclick=null),Si(e)}function tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Si(e)}var Tn=new Map,Xg=new Set;function Vl(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Na=ve.d;ve.d={f:uw,r:dw,D:fw,C:mw,L:hw,m:xw,X:gw,S:pw,M:yw};function uw(){var e=Na.f(),t=Co();return e||t}function dw(e){var t=er(e);t!==null&&t.tag===5&&t.type==="form"?Ix(t):Na.r(e)}var Lr=typeof document>"u"?null:document;function Zg(e,t,s){var l=Lr;if(l&&typeof t=="string"&&t){var c=jn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof s=="string"&&(c+='[crossorigin="'+s+'"]'),Xg.has(c)||(Xg.add(c),e={rel:e,crossOrigin:s,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),qt(t,"link",e),Ct(t),l.head.appendChild(t)))}}function fw(e){Na.D(e),Zg("dns-prefetch",e,null)}function mw(e,t){Na.C(e,t),Zg("preconnect",e,t)}function hw(e,t,s){Na.L(e,t,s);var l=Lr;if(l&&e&&t){var c='link[rel="preload"][as="'+jn(t)+'"]';t==="image"&&s&&s.imageSrcSet?(c+='[imagesrcset="'+jn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(c+='[imagesizes="'+jn(s.imageSizes)+'"]')):c+='[href="'+jn(e)+'"]';var u=c;switch(t){case"style":u=Ur(e);break;case"script":u=qr(e)}if(!(Tn.has(u)||(e=Z({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),Tn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(Xl(u))||t==="script"&&l.querySelector(Zl(u))))){var x=l.createElement("link");qt(x,"link",e),t==="style"&&(x[wi]=!0,x.onload=x.onerror=function(){ch(x)}),Ct(x),l.head.appendChild(x)}}}function xw(e,t){Na.m(e,t);var s=Lr;if(s&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+jn(l)+'"][href="'+jn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=qr(e)}if(!Tn.has(u)&&(e=Z({rel:"modulepreload",href:e},t),Tn.set(u,e),s.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Zl(u)))return}l=s.createElement("link"),qt(l,"link",e),Ct(l),s.head.appendChild(l)}}}function pw(e,t,s){Na.S(e,t,s);var l=Lr;if(l&&e){var c=tr(l).hoistableStyles,u=Ur(e);t=t||"default";var x=c.get(u);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(Xl(u)))N.loading=5;else{e=Z({rel:"stylesheet",href:e,"data-precedence":t},s),(s=Tn.get(u))&&nf(e,s);var E=x=l.createElement("link");Ct(E),qt(E,"link",e),E._p=new Promise(function(M,$){E.onload=M,E.onerror=$}),E.addEventListener("load",function(){N.loading|=1}),E.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Do(x,t,l)}x={type:"stylesheet",instance:x,count:1,state:N},c.set(u,x)}}}function gw(e,t){Na.X(e,t);var s=Lr;if(s&&e){var l=tr(s).hoistableScripts,c=qr(e),u=l.get(c);u||(u=s.querySelector(Zl(c)),u||(e=Z({src:e,async:!0},t),(t=Tn.get(c))&&af(e,t),u=s.createElement("script"),Ct(u),qt(u,"link",e),s.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function yw(e,t){Na.M(e,t);var s=Lr;if(s&&e){var l=tr(s).hoistableScripts,c=qr(e),u=l.get(c);u||(u=s.querySelector(Zl(c)),u||(e=Z({src:e,async:!0,type:"module"},t),(t=Tn.get(c))&&af(e,t),u=s.createElement("script"),Ct(u),qt(u,"link",e),s.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Ig(e,t,s,l){var c=(c=Dn.current)?Vl(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=Ur(s.href),t=tr(c).hoistableStyles,l=t.get(s),l||(l={type:"style",instance:null,count:0,state:null},t.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Ur(s.href);var u=tr(c).hoistableStyles,x=u.get(e);if(x||(c=c.ownerDocument||c,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,x),(u=c.querySelector(Xl(e)))?u._p||(x.instance=u,x.state.loading=5):(u=Tn.get(e),u||(u={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Tn.set(e,u)),vw(c,e,u,x.state))),t&&l===null)throw Error(o(528,""));return x}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(s=qr(s),t=tr(c).hoistableScripts,l=t.get(s),l||(l={type:"script",instance:null,count:0,state:null},t.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ur(e){return'href="'+jn(e)+'"'}function Xl(e){return'link[rel="stylesheet"]['+e+"]"}function Jg(e){return Z({},e,{"data-precedence":e.precedence,precedence:null})}function vw(e,t,s,l){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[wi]!==!0){l.loading=1;return}}else t=e.createElement("link"),t[wi]=!0,t.onload=t.onerror=ch.bind(null,t),qt(t,"link",s),Ct(t),e.head.appendChild(t);l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2})}function qr(e){return'[src="'+jn(e)+'"]'}function Zl(e){return"script[async]"+e}function Wg(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+jn(s.href)+'"]');if(l)return t.instance=l,Ct(l),l;var c=Z({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ct(l),qt(l,"style",c),Do(l,s.precedence,e),t.instance=l;case"stylesheet":c=Ur(s.href);var u=e.querySelector(Xl(c));if(u)return t.state.loading|=4,t.instance=u,Ct(u),u;l=Jg(s),(c=Tn.get(c))&&nf(l,c),u=(e.ownerDocument||e).createElement("link"),Ct(u);var x=u;return x._p=new Promise(function(N,E){x.onload=N,x.onerror=E}),qt(u,"link",l),t.state.loading|=4,Do(u,s.precedence,e),t.instance=u;case"script":return u=qr(s.src),(c=e.querySelector(Zl(u)))?(t.instance=c,Ct(c),c):(l=s,(c=Tn.get(u))&&(l=Z({},s),af(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ct(c),qt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Do(l,s.precedence,e));return t.instance}function Do(e,t,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,x=0;x<l.length;x++){var N=l[x];if(N.dataset.precedence===t)u=N;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function nf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function af(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Lo=null;function ey(e,t,s){if(Lo===null){var l=new Map,c=Lo=new Map;c.set(s,l)}else c=Lo,l=c.get(s),l||(l=new Map,c.set(s,l));if(l.has(e))return l;for(l.set(e,null),s=s.getElementsByTagName(e),c=0;c<s.length;c++){var u=s[c];if(!(u[dl]||u[zt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var x=u.getAttribute(t)||"";x=e+x;var N=l.get(x);N?N.push(u):l.set(x,[u])}}return l}function sf(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function bw(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ty(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function ny(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ay(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function sy(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=ay(t),e.suspenseyImages.push(t)),e=ww.bind(e),t.decode().then(e,e))}function jw(e,t,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var c=Ur(l.href),u=t.querySelector(Xl(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Il.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=u,Ct(u);return}u=t.ownerDocument||t,l=Jg(l),(c=Tn.get(c))&&nf(l,c),u=u.createElement("link"),Ct(u);var x=u;x._p=new Promise(function(N,E){x.onload=N,x.onerror=E}),qt(u,"link",l),s.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Il.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Uo=0;function Nw(e,t){return e.stylesheets&&e.count===0&&Ho(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Uo===0&&(Uo=62500*$N());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Uo?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function ry(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Ho(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Il(){this.count--,ry(this)}function ww(){this.imgCount--,ry(this)}var qo=null;function Ho(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,qo=new Map,t.forEach(Sw,e),qo=null,Il.call(e))}function Sw(e,t){if(!(t.state.loading&4)){var s=qo.get(e);if(s)var l=s.get(null);else{s=new Map,qo.set(e,s);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var x=c[u];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(s.set(x.dataset.precedence,x),l=x)}l&&s.set(null,l)}c=t.instance,x=c.getAttribute("data-precedence"),u=s.get(x)||l,u===l&&s.set(null,c),s.set(x,c),this.count++,l=Il.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Hr={$$typeof:Ee,Provider:null,Consumer:null,_currentValue:Ot,_currentValue2:Ot,_threadCount:0};function _w(e,t,s,l,c,u,x,N,E){this.tag=1,this.containerInfo=e,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=qc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qc(0),this.hiddenUpdates=qc(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.transitionTypes=null,this.incompleteTransitions=new Map}function ly(e,t,s,l,c,u,x,N,E,M,$,K){return e=new _w(e,t,s,x,E,M,$,K,N),t=1,u===!0&&(t|=24),u=Wt(3,null,null,t),e.current=u,u.stateNode=e,t=vu(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:s,cache:t},wu(u),e}function iy(e){return e?(e=dr,e):dr}function oy(e,t,s,l,c,u){c=iy(c),l.context===null?l.context=c:l.pendingContext=c,l=Ha(t),l.payload={element:s},u=u===void 0?null:u,u!==null&&(l.callback=u),s=$a(e,l,t),s!==null&&(an(s,e,t),Cl(s,e,t))}function cy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function rf(e,t){cy(e,t),(e=e.alternate)&&cy(e,t)}function uy(e){if(e.tag===13||e.tag===31){var t=ps(e,67108864);t!==null&&an(t,e,67108864),rf(e,67108864)}}function dy(e){if(e.tag===13||e.tag===31){var t=xn();t=Hc(t);var s=ps(e,t);s!==null&&an(s,e,t),rf(e,t)}}var $r=!0;function kw(e,t,s,l){var c=ce.T;ce.T=null;var u=ve.p;try{ve.p=2,lf(e,t,s,l)}finally{ve.p=u,ce.T=c}}function Ew(e,t,s,l){var c=ce.T;ce.T=null;var u=ve.p;try{ve.p=8,lf(e,t,s,l)}finally{ve.p=u,ce.T=c}}function lf(e,t,s,l){if($r){var c=of(l);if(c===null)Bd(e,t,l,$o,s),my(e,l);else if(Tw(c,e,t,s,l))l.stopPropagation();else if(my(e,l),t&4&&-1<Cw.indexOf(e)){for(;c!==null;){var u=er(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var x=ds(u.pendingLanes);if(x!==0){var N=u;for(N.pendingLanes|=2,N.entangledLanes|=2;x;){var E=1<<31-on(x);N.entanglements[1]|=E,x&=~E}ra(u),(Xe&6)===0&&(_o=rn()+500,Pl(0))}}break;case 31:case 13:N=ps(u,2),N!==null&&an(N,u,2),Co(),rf(u,2)}if(u=of(l),u===null&&Bd(e,t,l,$o,s),u===c)break;c=u}c!==null&&l.stopPropagation()}else Bd(e,t,l,null,s)}}function of(e){return e=Yc(e),cf(e)}var $o=null;function cf(e){if($o=null,e=fs(e),e!==null){var t=f(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=m(t),e!==null)return e;e=null}else if(s===31){if(e=p(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return $o=e,null}function fy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($1()){case Im:return 2;case Jm:return 8;case yi:case B1:return 32;case Wm:return 268435456;default:return 32}default:return 32}}var uf=!1,Ja=null,Wa=null,es=null,Jl=new Map,Wl=new Map,ts=[],Cw="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 my(e,t){switch(e){case"focusin":case"focusout":Ja=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":es=null;break;case"pointerover":case"pointerout":Jl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wl.delete(t.pointerId)}}function ei(e,t,s,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:s,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=er(t),t!==null&&uy(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Tw(e,t,s,l,c){switch(t){case"focusin":return Ja=ei(Ja,e,t,s,l,c),!0;case"dragenter":return Wa=ei(Wa,e,t,s,l,c),!0;case"mouseover":return es=ei(es,e,t,s,l,c),!0;case"pointerover":var u=c.pointerId;return Jl.set(u,ei(Jl.get(u)||null,e,t,s,l,c)),!0;case"gotpointercapture":return u=c.pointerId,Wl.set(u,ei(Wl.get(u)||null,e,t,s,l,c)),!0}return!1}function hy(e){var t=fs(e.target);if(t!==null){var s=f(t);if(s!==null){if(t=s.tag,t===13){if(t=m(s),t!==null){e.blockedOn=t,lh(e.priority,function(){dy(s)});return}}else if(t===31){if(t=p(s),t!==null){e.blockedOn=t,lh(e.priority,function(){dy(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Bo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=of(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);Kc=l,s.target.dispatchEvent(l),Kc=null}else return t=er(s),t!==null&&uy(t),e.blockedOn=s,!1;t.shift()}return!0}function xy(e,t,s){Bo(e)&&s.delete(t)}function Aw(){uf=!1,Ja!==null&&Bo(Ja)&&(Ja=null),Wa!==null&&Bo(Wa)&&(Wa=null),es!==null&&Bo(es)&&(es=null),Jl.forEach(xy),Wl.forEach(xy)}function Qo(e,t){e.blockedOn===t&&(e.blockedOn=null,uf||(uf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Aw)))}var Fo=null;function py(e){Fo!==e&&(Fo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Fo===e&&(Fo=null);for(var t=0;t<e.length;t+=3){var s=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(cf(l||s)===null)continue;break}var u=er(s);u!==null&&(e.splice(t,3),t-=3,Pu(u,{pending:!0,data:c,method:s.method,action:l},l,c))}}))}function Br(e){function t(E){return Qo(E,e)}Ja!==null&&Qo(Ja,e),Wa!==null&&Qo(Wa,e),es!==null&&Qo(es,e),Jl.forEach(t),Wl.forEach(t);for(var s=0;s<ts.length;s++){var l=ts[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ts.length&&(s=ts[0],s.blockedOn===null);)hy(s),s.blockedOn===null&&ts.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var c=s[l],u=s[l+1],x=c[Jt]||null;if(typeof u=="function")x||py(s);else if(x){var N=null;if(u&&u.hasAttribute("formAction")){if(c=u,x=u[Jt]||null)N=x.formAction;else if(cf(c)!==null)continue}else N=x.action;typeof N=="function"?s[l+1]=N:(s.splice(l,3),l-=3),py(s)}}}function gy(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(x){return c=x})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function df(e){this._internalRoot=e}Po.prototype.render=df.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var s=t.current,l=xn();oy(s,l,e,t,null,null)},Po.prototype.unmount=df.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;oy(e.current,2,null,e,null,null),Co(),t[Ws]=null}};function Po(e){this._internalRoot=e}Po.prototype.unstable_scheduleHydration=function(e){if(e){var t=rh();e={blockedOn:null,target:e,priority:t};for(var s=0;s<ts.length&&t!==0&&t<ts[s].priority;s++);ts.splice(s,0,e),s===0&&hy(e)}};var yy=r.version;if(yy!=="19.3.1")throw Error(o(527,yy,"19.3.1"));ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var Rw={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ce,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ko.isDisabled&&Ko.supportsFiber)try{ol=Ko.inject(Rw),ln=Ko}catch{}}return ni.createRoot=function(e,t){if(!d(e))throw Error(o(299));var s=!1,l="",c=ip,u=op,x=cp;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=ly(e,1,!1,null,null,s,l,null,c,u,x,gy),e[Ws]=t.current,$d(e),new df(t)},ni.hydrateRoot=function(e,t,s){if(!d(e))throw Error(o(299));var l=!1,c="",u=ip,x=op,N=cp,E=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(N=s.onRecoverableError),s.formState!==void 0&&(E=s.formState)),t=ly(e,1,!0,t,s??null,l,c,E,u,x,N,gy),t.context=iy(null),s=t.current,l=xn(),l=Hc(l),c=Ha(l),c.callback=null,$a(s,c,l),s=l,t.current.lanes=s,ul(t,s),ra(t),e[Ws]=t.current,$d(e),new Po(t)},ni.version="19.3.1",ni}var Cy;function Bw(){if(Cy)return hf.exports;Cy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),hf.exports=$w(),hf.exports}var Qw=Bw();const Fw=Tv(Qw),Av=j.createContext(!1),Rv=()=>j.useContext(Av);Av.Provider;const Ov=j.createContext(void 0),_e=n=>{const r=j.useContext(Ov);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},Pw=({client:n,children:r})=>(j.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),a.jsx(Ov.Provider,{value:n,children:r}));function Kw(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const Yw=j.createContext(Kw()),zv=()=>j.useContext(Yw);var Qs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gw=class extends Qs{#t;#e;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(n){this.#n=n,this.#e?.(),this.#e=n(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(n){this.#t!==n&&(this.#t=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}};const om=new Gw,Vw={setTimeout:(n,r)=>setTimeout(n,r),clearTimeout:n=>clearTimeout(n),setInterval:(n,r)=>setInterval(n,r),clearInterval:n=>clearInterval(n)};var Xw=class{#t=Vw;#e=!1;setTimeoutProvider(n){this.#t=n}setTimeout(n,r){return this.#t.setTimeout(n,r)}clearTimeout(n){this.#t.clearTimeout(n)}setInterval(n,r){return this.#t.setInterval(n,r)}clearInterval(n){this.#t.clearInterval(n)}};const Us=new Xw;function Zw(n){setTimeout(n,0)}const Iw=typeof window>"u"||"Deno"in globalThis;function Qt(){}function Jw(n,r){return typeof n=="function"?n(r):n}function Mv(n){return typeof n=="number"&&n>=0&&n!==1/0}function Dv(n,r){return Math.max(n+(r||0)-Date.now(),0)}function ut(n,r){return typeof n=="function"?n(r):n}function Ty(n,r){const{type:i="all",exact:o,fetchStatus:d,predicate:f,queryKey:m,stale:p}=n;if(m){if(o){if(r.queryHash!==cm(m,r.options))return!1}else if(!Xr(r.queryKey,m))return!1}if(i!=="all"){const h=r.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof p=="boolean"&&r.isStale()!==p||d&&d!==r.state.fetchStatus||f&&!f(r))}function Ay(n,r){const{exact:i,status:o,predicate:d,mutationKey:f}=n;if(f){if(!r.options.mutationKey)return!1;if(i){if(Hs(r.options.mutationKey)!==Hs(f))return!1}else if(!Xr(r.options.mutationKey,f))return!1}return!(o&&r.state.status!==o||d&&!d(r))}function cm(n,r){return(r?.queryKeyHashFn||Hs)(n)}function Hs(n){return JSON.stringify(n,(r,i)=>Lf(i)?Object.keys(i).sort().reduce((o,d)=>(o[d]=i[d],o),{}):i)}function Xr(n,r){if(n===r)return!0;if(typeof n!=typeof r)return!1;if(n&&r&&typeof n=="object"&&typeof r=="object"){if(Array.isArray(n)!==Array.isArray(r))return!1;if(Array.isArray(n)&&Array.isArray(r)){if(r.length>n.length)return!1;for(let o=0;o<r.length;o++)if(!Xr(n[o],r[o]))return!1;return!0}const i=Object.keys(r);for(const o of i)if(!Xr(n[o],r[o]))return!1;return!0}return!1}const Lv=Object.prototype.hasOwnProperty;function um(n,r,i=0){if(n===r)return n;if(i>500)return r;const o=Ry(n)&&Ry(r);if(!o&&!(Lf(n)&&Lf(r)))return r;const d=(o?n:Object.keys(n)).length,f=o?r:Object.keys(r),m=f.length,p=o?new Array(m):{};let h=0;for(let g=0;g<m;g++){const v=o?g:f[g],y=n[v],b=r[v];if(y===b){p[v]=y,(o?g<d:Lv.call(n,v))&&h++;continue}if(y===null||b===null||typeof y!="object"||typeof b!="object"){p[v]=b;continue}const S=um(y,b,i+1);p[v]=S,S===y&&h++}return d===m&&h===d?n:p}function ii(n,r){if(!r||Object.keys(n).length!==Object.keys(r).length)return!1;for(const i of Object.keys(n))if(!Lv.call(r,i)||n[i]!==r[i])return!1;return!0}function Ry(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function Lf(n){if(!Oy(n))return!1;const r=Object.getPrototypeOf(n),i=r?.constructor;if(i===void 0)return!0;if(typeof i!="function")return!1;const o=i.prototype;return!(!Oy(o)||!o.hasOwnProperty("isPrototypeOf")||r!==Object.prototype)}function Oy(n){return Object.prototype.toString.call(n)==="[object Object]"}function Ww(n){return new Promise(r=>{Us.setTimeout(r,n)})}function Uf(n,r,i){return typeof i.structuralSharing=="function"?i.structuralSharing(n,r):i.structuralSharing!==!1?um(n,r):r}function zy(n,r,i,o){const d=o?[r,...n]:[...n,r];return i&&d.length>i?o?d.slice(0,i):d.slice(-i):d}const dm=Symbol();function Uv(n,r){return!n.queryFn&&r?.initialPromise?()=>r.initialPromise:!n.queryFn||n.queryFn===dm?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function fm(n,r){return typeof n=="function"?n(...r):!!n}const mm=Symbol();function eS(n,r,i,o){let d=!1,f;return Object.defineProperties(n,{[mm]:{value:o},signal:{enumerable:!0,get:()=>(f??=r(),d||(d=!0,f.aborted?i():f.addEventListener("abort",i,{once:!0})),f)}}),n}let tS=()=>Iw;const hm=()=>tS();function nS(n){return{onFetch:(r,i)=>{const o=r.options,d=r.fetchOptions?.meta?.fetchMore?.direction,f=r.state.data?.pages||[],m=r.state.data?.pageParams||[];let p={pages:[],pageParams:[]},h=0;const g=async()=>{let v=!1;const y=r,b=k=>{eS(k,()=>r.signal,()=>v=!0,y[mm])},S=Uv(r.options,r.fetchOptions),w=async(k,_,A)=>{if(v)return Promise.reject(r.signal.reason);if(_==null&&k.pages.length)return Promise.resolve(k);const B=(()=>{const U={client:r.client,queryKey:r.queryKey,pageParam:_,direction:A?"backward":"forward",meta:r.options.meta};return b(U),U})(),V=await S(B),{maxPages:F}=r.options;return{pages:zy(k.pages,V,F,A),pageParams:zy(k.pageParams,_,F,A)}};if(d&&f.length){const k=d==="backward",_=k?qv:qf,A={pages:f,pageParams:m};p=await w(A,_(o,A),k)}else{const k=n??f.length;do{const _=h===0?m[0]===void 0?o.initialPageParam:m[0]:qf(o,p);if(h>0&&_==null)break;p=await w(p,_),h++}while(h<k)}return p};r.options.persister?r.fetchFn=()=>r.options.persister?.(g,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},i):r.fetchFn=g}}}function qf(n,{pages:r,pageParams:i}){const o=r.length-1;return r.length>0?n.getNextPageParam(r[o],r,i[o],i):void 0}function qv(n,{pages:r,pageParams:i}){return r.length>0?n.getPreviousPageParam?.(r[0],r,i[0],i):void 0}function aS(n,r){return r?qf(n,r)!=null:!1}function sS(n,r){return!r||!n.getPreviousPageParam?!1:qv(n,r)!=null}const rS=Zw;function lS(){let n=[],r=0,i=p=>{p()},o=p=>{p()},d=rS;const f=p=>{r?n.push(p):d(()=>{i(p)})},m=()=>{const p=n;n=[],p.length&&d(()=>{o(()=>{p.forEach(h=>{i(h)})})})};return{batch:p=>{let h;r++;try{h=p()}finally{r--,r||m()}return h},batchCalls:p=>(...h)=>{f(()=>{p(...h)})},schedule:f,setNotifyFunction:p=>{i=p},setBatchNotifyFunction:p=>{o=p},setScheduler:p=>{d=p}}}const pt=lS();var Hv=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mv(this.gcTime)&&(this.#t=Us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(hm()?1/0:3e5))}clearGcTimeout(){this.#t!==void 0&&(Us.clearTimeout(this.#t),this.#t=void 0)}},iS=class extends Qs{#t=!0;#e;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(n){this.#n=n,this.#e?.(),this.#e=n(this.setOnline.bind(this))}setOnline(n){this.#t!==n&&(this.#t=n,this.listeners.forEach(r=>{r(n)}))}isOnline(){return this.#t}};const sc=new iS;function oS(n){return Math.min(1e3*2**n,3e4)}function $v(n){return(n??"online")==="online"?sc.isOnline():!0}var Hf=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function Bv(n){let r=!1,i=0,o,d="pending",f,m;const p=new Promise((C,B)=>{f=C,m=B});p.catch(Qt);const h=()=>d!=="pending",g=C=>{if(!h()){const B=new Hf(C);k(B),n.onCancel?.(B)}},v=()=>{r=!0},y=()=>{r=!1},b=()=>om.isFocused()&&(n.networkMode==="always"||sc.isOnline())&&n.canRun(),S=()=>$v(n.networkMode)&&n.canRun(),w=C=>{h()||(o?.(),d="resolved",f(C))},k=C=>{h()||(o?.(),d="rejected",m(C))},_=C=>new Promise(B=>{o=V=>{(h()||C())&&B(V)},n.onPause?.()}).then(()=>{o=void 0,h()||n.onContinue?.()}),A=()=>{if(h())return;let C;const B=i===0?n.initialPromise:void 0;try{C=B??n.fn()}catch(V){C=Promise.reject(V)}Promise.resolve(C).then(w).catch(V=>{if(h())return;const F=n.retry??(hm()?0:3),U=n.retryDelay??oS,Z=typeof U=="function"?U(i,V):U,Q=F===!0||typeof F=="number"&&i<F||typeof F=="function"&&F(i,V);if(r||!Q){k(V);return}i++,n.onFail?.(i,V),Ww(Z).then(()=>h()||b()?void 0:_(b)).then(()=>{r?k(V):A()})})};return{promise:p,status:()=>d,cancel:g,continue:()=>(o?.(),p),cancelRetry:v,continueRetry:y,canStart:S,start:()=>(S()?A():_(S).then(A),p)}}var cS=class extends Hv{#t;#e;#n;#a;#s;#r;#l;#o;#c;constructor(n){super(),this.#c=!1,this.#o=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#s=n.client,this.#a=this.#s.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#e=Dy(this.options),this.state=n.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#r?.promise}setOptions(n){if(this.options={...this.#o,...n},n?._type&&(this.#t=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Dy(this.options);r.data!==void 0&&(this.setState(My(r.data,r.dataUpdatedAt)),this.#e=r)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(n,r){const i=Uf(this.state.data,n,this.options);return this.#i({data:i,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),i}setState(n){this.#i({type:"setState",state:n})}cancel(n){const r=this.#r?.promise;return this.#r?.cancel(n),r?r.then(Qt).catch(Qt):Promise.resolve()}destroy(){this.cancel({silent:!0}),super.destroy()}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>ut(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===dm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(n=>ut(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!Dv(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const r=this.observers.indexOf(n);r!==-1&&(this.observers.splice(r,1),this.observers.length||(this.#r&&(this.#c||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.#u()),this.#a.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(n,r){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#r&&this.#l)return this.#r.continueRetry(),this.#l}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(v=>v.options.queryFn);g&&this.setOptions(g.options)}const i=new AbortController,o=g=>{Object.defineProperties(g,{[mm]:{value:i.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,i.signal)}})},d=()=>{const g=Uv(this.options,r),y=(()=>{const b={client:this.#s,queryKey:this.queryKey,meta:this.meta};return o(b),b})();return this.#c=!1,this.options.persister?this.options.persister(g,y,this):g(y)},m=(()=>{const g={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:d};return o(g),g})();(this.#t==="infinite"?nS(this.options.pages):this.options.behavior)?.onFetch(m,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==m.fetchOptions?.meta)&&this.#i({type:"fetch",meta:m.fetchOptions?.meta});const p=this.#r=Bv({initialPromise:r?.initialPromise,fn:m.fetchFn,onCancel:g=>{g instanceof Hf&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),i.abort()},onFail:(g,v)=>{this.#i({type:"failed",failureCount:g,error:v})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}),h=(async()=>{try{const g=await p.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#a.config.onSuccess?.(g,this),this.#a.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Hf){if(g.silent){if(this.#r!==p&&this.#l)return this.#l;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#i({type:"error",error:g}),this.#a.config.onError?.(g,this),this.#a.config.onSettled?.(this.state.data,g,this),g}finally{this.#r===p&&(this.#r=void 0,this.#l=void 0),this.#u()}})();return this.#l=h,p.start(),h}#u(){this.#a.get(this.queryHash)===this&&this.scheduleGc()}#i(n){const r=i=>{switch(n.type){case"failed":return{...i,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Qv(i.data,this.options),fetchMeta:n.meta??null};case"success":{const o={...i,...My(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?o:void 0,o}case"error":{const o=n.error;return{...i,error:o,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0}}case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...n.state}}};this.state=r(this.state),pt.batch(()=>{this.observers.slice().forEach(i=>{i.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:n})})}};function Qv(n,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$v(r.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function My(n,r){return{data:n,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Dy(n){const r=typeof n.initialData=="function"?n.initialData():n.initialData,i=r!==void 0,o=i?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:i?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var mc=class extends Qs{#t;#e=void 0;#n=void 0;#a=void 0;#s;#r;#l;#o;#c;#u;#i;#d;#f;#h=new Set;constructor(n,r){super(),this.options=r,this.#t=n,this.#r=null,this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ly(this.#e,this.options)?this.#m():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $f(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $f(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#j(),this.#e.removeObserver(this)}setOptions(n){const r=this.options,i=this.#e;if(this.options=this.#t.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ut(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#N(),this.#e.setOptions(this.options),r._defaulted&&!ii(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const o=this.hasListeners();o&&Uy(this.#e,i,this.options,r)&&this.#m(),this.updateResult(),o&&(this.#e!==i||ut(this.options.enabled,this.#e)!==ut(r.enabled,this.#e)||ut(this.options.staleTime,this.#e)!==ut(r.staleTime,this.#e))&&this.#x();const d=this.#g();o&&(this.#e!==i||ut(this.options.enabled,this.#e)!==ut(r.enabled,this.#e)||d!==this.#f)&&this.#y(d)}getOptimisticResult(n){const r=this.#t.getQueryCache().build(this.#t,n),i=this.createResult(r,n);return ii(this.getCurrentResult(),i)||(this.#a=i,this.#s=n),i}getCurrentResult(){return this.#a}trackResult(n,r){return new Proxy(n,{get:(i,o)=>(this.trackProp(o),r?.(o),Reflect.get(i,o))})}trackProp(n){this.#h.add(n)}getCurrentQuery(){return this.#e}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const r=this.#t.defaultQueryOptions(n),i=this.#t.getQueryCache().build(this.#t,r);let o=()=>{},d;const f=new Promise(m=>{d=m,o=this.#t.getQueryCache().subscribe(p=>{p.type==="updated"&&p.query.queryHash===i.queryHash&&i.state.data!==void 0&&(o(),m(this.createResult(i,r)))})});return Promise.race([i.fetch(r).then(()=>{const m=this.createResult(i,r);return d?.(m),m}).finally(()=>{o()}),f])}fetch(n){return this.#m({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#m(n){this.#N();let r=this.#e.fetch(this.options,n);return n?.throwOnError||(r=r.catch(Qt)),r}#p(n){return!hm()&&ut(this.options.enabled,this.#e)!==!1&&Mv(n)}#x(){this.#b();const n=ut(this.options.staleTime,this.#e);if(this.#a.isStale||!this.#p(n))return;const r=Dv(this.#a.dataUpdatedAt,n)+1;this.#i=Us.setTimeout(()=>{this.#a.isStale||this.updateResult()},r)}#g(){return ut(this.options.refetchInterval,this.#e)??!1}#y(n){this.#j(),this.#f=n,!(this.#f===0||!this.#p(this.#f))&&(this.#d=Us.setInterval(()=>{(this.options.refetchIntervalInBackground||om.isFocused())&&this.#m()},this.#f))}#v(){this.#x(),this.#y(this.#g())}#b(){this.#i!==void 0&&(Us.clearTimeout(this.#i),this.#i=void 0)}#j(){this.#d!==void 0&&(Us.clearInterval(this.#d),this.#d=void 0)}createResult(n,r){const i=this.#e,o=this.options,d=this.#a,f=this.#s,m=n!==i?n.state:this.#n,{state:p}=n;let h={...p},g=!1,v;if(r._optimisticResults){const V=this.hasListeners(),F=!V&&Ly(n,r),U=V&&Uy(n,i,r,o);(F||U)&&(h={...h,...Qv(p.data,n.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:y,errorUpdatedAt:b,status:S}=h;v=h.data;let w=!1;if(r.placeholderData!==void 0&&v===void 0&&S==="pending"){let V;const F=d?.isPlaceholderData&&r.placeholderData===f?.placeholderData;F?(V=d.data,w=!0):V=typeof r.placeholderData=="function"?r.placeholderData(this.#u?.state.data,this.#u):r.placeholderData,(F||V!==void 0)&&(S="success",v=Uf(r.select&&!w?this.#o:d?.data,V,r),g=!0)}if(r.select&&v!==void 0&&!w)if(v===this.#o&&r.select===this.#l)v=this.#c;else try{this.#l=r.select,this.#o=v,v=r.select(v),v=Uf(d?.data,v,r),this.#c=v,this.#r=null}catch(V){this.#r=V}else v===void 0&&(this.#o=void 0,this.#r=null);this.#r&&(y=this.#r,v=this.#c,b=d?.error===y?d.errorUpdatedAt:Date.now(),S="error",g=!1);const k=h.fetchStatus==="fetching",_=S==="pending",A=S==="error",C=_&&k,B=v!==void 0;return{status:S,fetchStatus:h.fetchStatus,isPending:_,isSuccess:S==="success",isError:A,isInitialLoading:C,isLoading:C,data:v,dataUpdatedAt:h.dataUpdatedAt,error:y,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:h.dataUpdateCount>m.dataUpdateCount||h.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!_,isLoadingError:A&&!B,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:A&&B,isStale:xm(n,r),refetch:this.refetch,isEnabled:ut(r.enabled,n)!==!1}}updateResult(){const n=this.#a,r=this.createResult(this.#e,this.options);if(this.#s=this.options,this.#e.state.data!==void 0&&(this.#u=this.#e),ii(r,n))return;this.#a=r;const o=(()=>{if(!n)return!0;const{notifyOnChangeProps:d}=this.options,f=typeof d=="function"?d():d;if(f==="all"||!f&&!this.#h.size||this.options.throwOnError&&this.#a.error!==n.error)return!0;for(const m of f??this.#h)if(this.#a[m]!==n[m])return!0;return!1})();pt.batch(()=>{o&&this.listeners.forEach(d=>{d(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}#N(){const n=this.#t.getQueryCache().build(this.#t,this.options);if(n===this.#e)return;const r=this.#e;this.#e=n,this.#n=n.state,this.hasListeners()&&(r?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}};function uS(n,r){return ut(r.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&ut(r.retryOnMount,n)===!1)}function Ly(n,r){return uS(n,r)||n.state.data!==void 0&&$f(n,r,r.refetchOnMount)}function $f(n,r,i){if(ut(r.enabled,n)!==!1&&ut(r.staleTime,n)!=="static"){const o=ut(i,n);return o==="always"||o!==!1&&xm(n,r)}return!1}function Uy(n,r,i,o){return(n!==r||ut(o.enabled,n)===!1)&&(!i.suspense||n.state.status!=="error")&&xm(n,i)}function xm(n,r){return ut(r.enabled,n)!==!1&&n.isStaleByTime(ut(r.staleTime,n))}var dS=class extends mc{constructor(n,r){super(n,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(n){n._type="infinite",super.setOptions(n)}getOptimisticResult(n){return n._type="infinite",super.getOptimisticResult(n)}fetchNextPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"backward"}}})}createResult(n,r){const{state:i}=n,o=super.createResult(n,r),{isFetching:d,isRefetching:f,isError:m,isRefetchError:p}=o,h=i.fetchMeta?.fetchMore?.direction,g=m&&h==="forward",v=d&&h==="forward",y=m&&h==="backward",b=d&&h==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:aS(r,i.data),hasPreviousPage:sS(r,i.data),isFetchNextPageError:g,isFetchingNextPage:v,isFetchPreviousPageError:y,isFetchingPreviousPage:b,isRefetchError:p&&!g&&!y,isRefetching:f&&!v&&!b}}},fS=class extends Hv{#t;#e;#n;#a;constructor(n){super(),this.#t=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#e=[],this.state=n.state||Fv(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#e.includes(n)||(this.#e.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#e=this.#e.filter(r=>r!==n),this.#n.has(this)&&this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const r=()=>{this.#s({type:"continue"})},i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey},o=this.#a=Bv({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(m,p)=>{this.#s({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#s({type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),d=this.state.status==="pending",f=!o.canStart();try{if(d)r();else{this.#s({type:"pending",variables:n,isPaused:f}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,i);const p=await this.options.onMutate?.(n,i);p!==this.state.context&&this.#s({type:"pending",context:p,variables:n,isPaused:f})}this.state.isPaused&&o.canStart()&&r();const m=await o.start();return await this.#n.config.onSuccess?.(m,n,this.state.context,this,i),await this.options.onSuccess?.(m,n,this.state.context,i),await this.#n.config.onSettled?.(m,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(m,null,n,this.state.context,i),this.#s({type:"success",data:m}),m}catch(m){try{await this.#n.config.onError?.(m,n,this.state.context,this,i)}catch(p){Promise.reject(p)}try{await this.options.onError?.(m,n,this.state.context,i)}catch(p){Promise.reject(p)}try{await this.#n.config.onSettled?.(void 0,m,this.state.variables,this.state.context,this,i)}catch(p){Promise.reject(p)}try{await this.options.onSettled?.(void 0,m,n,this.state.context,i)}catch(p){Promise.reject(p)}throw this.#s({type:"error",error:m}),m}finally{this.#a===o&&(this.#a=void 0),this.#n.runNext(this)}}#s(n){const r=i=>{switch(n.type){case"failed":return{...i,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...i,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:n.error,failureCount:i.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=r(this.state),pt.batch(()=>{this.#e.forEach(i=>{i.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function Fv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mS=class extends Qs{#t;#e;#n;constructor(n={}){super(),this.config=n,this.#t=new Set,this.#e=new Map,this.#n=0}build(n,r,i){const o=new fS({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){this.#t.add(n);const r=Yo(n);if(typeof r=="string"){const i=this.#e.get(r);i?i.push(n):this.#e.set(r,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#t.delete(n)){n.destroy();const r=Yo(n);if(typeof r=="string"){const i=this.#e.get(r);if(i)if(i.length>1){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}else i[0]===n&&this.#e.delete(r)}}this.notify({type:"removed",mutation:n})}has(n){return this.#t.has(n)}canRun(n){const r=Yo(n);if(typeof r=="string"){const i=this.#e.get(r)?.find(o=>o.state.status==="pending");return!i||i===n}else return!0}runNext(n){const r=Yo(n);return typeof r=="string"?this.#e.get(r)?.find(i=>i!==n&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){pt.batch(()=>{const n=this.getAll();this.#t.clear(),this.#e.clear(),n.forEach(r=>r.destroy()),n.forEach(r=>{this.notify({type:"removed",mutation:r})})})}getAll(){return Array.from(this.#t)}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Ay(r,i))}findAll(n={}){return this.getAll().filter(r=>Ay(n,r))}notify(n){pt.batch(()=>{this.listeners.forEach(r=>{r(n)})})}resumePausedMutations(){const n=this.getAll().filter(r=>r.state.isPaused);return pt.batch(()=>Promise.all(n.map(r=>r.continue().catch(Qt))))}};function Yo(n){return n.options.scope?.id}var hS=class extends Qs{#t;#e=void 0;#n;#a;constructor(r,i){super(),this.#t=r,this.setOptions(i),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){const i=this.options;this.options=this.#t.defaultMutationOptions(r),ii(this.options,i)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),i?.mutationKey&&this.options.mutationKey&&Hs(i.mutationKey)!==Hs(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#s())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(r){this.#s(),this.#r(r)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#r()}mutate(r,i){return this.#a=i,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(r)}#s(){const r=this.#n?.state??Fv();this.#e={...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset}}#r(r){pt.batch(()=>{const i=this.#a;if(i&&this.hasListeners()){const o=this.#e.variables,d=this.#e.context,f={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{i.onSuccess?.(r.data,o,d,f)}catch(m){Promise.reject(m)}try{i.onSettled?.(r.data,null,o,d,f)}catch(m){Promise.reject(m)}}else if(r?.type==="error"){try{i.onError?.(r.error,o,d,f)}catch(m){Promise.reject(m)}try{i.onSettled?.(void 0,r.error,o,d,f)}catch(m){Promise.reject(m)}}}this.listeners.forEach(o=>{o(this.#e)})})}};function qy(n,r){const i=new Set(r);return n.filter(o=>!i.has(o))}var xS=class extends Qs{#t;#e;#n;#a;#s;#r;#l;#o;#c;#u=[];constructor(n,r,i){super(),this.#t=n,this.#a=i,this.#n=[],this.#s=[],this.#e=[],this.setQueries(r)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(n=>this.#m(n))}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(n=>{n.destroy()})}setQueries(n,r){this.#n=n,this.#a=r,pt.batch(()=>{const i=this.#s,o=this.#h(this.#n);o.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const d=o.map(v=>v.observer),f=d.map(v=>v.getCurrentResult()),m=i.length!==d.length,p=d.some((v,y)=>v!==i[y]),h=m||p,g=h?!0:f.some((v,y)=>{const b=this.#e[y];return!b||!ii(v,b)});!h&&!g||(h&&(this.#u=o,this.#s=d),this.#e=f,this.hasListeners()&&(h&&(qy(i,d).forEach(v=>{v.destroy()}),qy(d,i).forEach(v=>this.#m(v))),this.#x()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(n=>n.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(n,r){const i=this.#h(n),o=i.map(f=>f.observer.getOptimisticResult(f.defaultedQueryOptions));i.length===this.#s.length&&i.some((f,m)=>f.observer.getCurrentResult()!==this.#e[m])&&i.every((f,m)=>f.observer===this.#s[m])&&(this.#e=i.map(f=>f.observer.getCurrentResult()));const d=i.map(f=>f.defaultedQueryOptions.queryHash);return[o,f=>this.#d(f??o,r,d),()=>this.#i(o,i)]}#i(n,r){const i=new Set;return r.map((o,d)=>{const f=n[d];return o.defaultedQueryOptions.notifyOnChangeProps?f:o.observer.trackResult(f,m=>{i.has(m)||(i.add(m),r.forEach(p=>{p.observer.trackProp(m)}))})})}#d(n,r,i){if(r){const o=this.#c,d=i!==void 0&&o!==void 0&&(o.length!==i.length||i.some((f,m)=>f!==o[m]));return(this.#e!==this.#o||d||r!==this.#l)&&(this.#l=r,this.#o=this.#e,i!==void 0&&(this.#c=i),this.#r=um(this.#r,r(n))),this.#r}return n}#f(){return!this.#a?.combine||this.#s.some((n,r)=>n.options.suspense&&this.#e[r]?.data===void 0)}#h(n){const r=new Map;this.#s.forEach(o=>{const d=o.options.queryHash;if(!d)return;const f=r.get(d);f?f.push(o):r.set(d,[o])});const i=[];return n.forEach(o=>{const d=this.#t.defaultQueryOptions(o),f=r.get(d.queryHash)?.shift()??new mc(this.#t,d);i.push({defaultedQueryOptions:d,observer:f})}),i}#m(n){n.subscribe(r=>{this.#p(n,r)})}#p(n,r){const i=this.#s.indexOf(n);i!==-1&&(this.#e=this.#e.slice(),this.#e[i]=r,this.#x())}#x(){if(this.hasListeners()){const n=this.#f(),r=this.#r,i=n?r:this.#d(this.#i(this.#e,this.#u),this.#a?.combine,this.#u.map(o=>o.defaultedQueryOptions.queryHash));(n||r!==i)&&pt.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}},pS=class extends Qs{#t;constructor(n={}){super(),this.config=n,this.#t=new Map}build(n,r,i){const o=r.queryKey,d=r.queryHash??cm(o,r);let f=this.get(d);return f||(f=new cS({client:n,queryKey:o,queryHash:d,options:n.defaultQueryOptions(r),state:i,defaultOptions:n.getQueryDefaults(o)}),this.add(f)),f}add(n){this.#t.has(n.queryHash)||(this.#t.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){this.#t.get(n.queryHash)===n&&(n.destroy(),this.#t.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){pt.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#t.get(n)}getAll(){return[...this.#t.values()]}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Ty(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>Ty(n,i)):r}notify(n){pt.batch(()=>{this.listeners.forEach(r=>{r(n)})})}onFocus(){pt.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){pt.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},gS=class{#t;#e;#n;#a;#s;#r;#l;#o;constructor(n={}){this.#t=n.queryCache||new pS,this.#e=n.mutationCache||new mS,this.#n=n.defaultOptions||{},this.#a=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=om.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#o=sc.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#o?.(),this.#o=void 0)}isFetching(n){return this.#t.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#e.findAll({...n,status:"pending"}).length}getQueryData(n){const r=this.defaultQueryOptions({queryKey:n});return this.#t.get(r.queryHash)?.state.data}ensureQueryData(n){const r=this.defaultQueryOptions(n),i=this.#t.build(this,r),o=i.state.data;return o===void 0?this.fetchQuery(n):(n.revalidateIfStale&&i.isStaleByTime(ut(r.staleTime,i))&&this.prefetchQuery(r),Promise.resolve(o))}getQueriesData(n){return this.#t.findAll(n).map(({queryKey:r,state:i})=>[r,i.data])}setQueryData(n,r,i){const o=this.defaultQueryOptions({queryKey:n}),d=this.#t.get(o.queryHash)?.state.data,f=Jw(r,d);if(f!==void 0)return this.#t.build(this,o).setData(f,{...i,manual:!0})}setQueriesData(n,r,i){return pt.batch(()=>this.#t.findAll(n).map(({queryKey:o})=>[o,this.setQueryData(o,r,i)]))}getQueryState(n){const r=this.defaultQueryOptions({queryKey:n});return this.#t.get(r.queryHash)?.state}removeQueries(n){const r=this.#t;pt.batch(()=>{r.findAll(n).forEach(i=>{r.remove(i)})})}resetQueries(n,r){const i=this.#t;return pt.batch(()=>{const o=i.findAll(n),d=new Set(o);return o.forEach(f=>{f.reset()}),this.refetchQueries({type:"active",predicate:f=>d.has(f)},r)})}cancelQueries(n,r={}){const i={revert:!0,...r},o=pt.batch(()=>this.#t.findAll(n).map(d=>d.cancel(i)));return Promise.all(o).then(Qt).catch(Qt)}invalidateQueries(n,r={}){return pt.batch(()=>(this.#t.findAll(n).forEach(i=>{i.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},r)))}refetchQueries(n,r={}){const i={...r,cancelRefetch:r.cancelRefetch??!0},o=pt.batch(()=>this.#t.findAll(n).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let f=d.fetch(void 0,i);const m=d.state.fetchStatus==="paused";return(!i.throwOnError||m)&&(f=f.catch(Qt)),m?Promise.resolve():f}));return Promise.all(o).then(Qt)}async query(n){const r=this.defaultQueryOptions(n);r.retry===void 0&&(r.retry=!1);const i=this.#t.build(this,r),o=i.isStaleByTime(ut(r.staleTime,i))?await i.fetch(r):i.state.data,d=r.select;return d?d(o):o}fetchQuery(n){const r=this.defaultQueryOptions(n);r.retry===void 0&&(r.retry=!1);const i=this.#t.build(this,r);return i.isStaleByTime(ut(r.staleTime,i))?i.fetch(r):Promise.resolve(i.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Qt).catch(Qt)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Qt).catch(Qt)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return sc.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,r){this.#a.set(Hs(n),{queryKey:n,defaultOptions:r})}getQueryDefaults(n){const r=[...this.#a.values()],i={};return r.forEach(o=>{Xr(n,o.queryKey)&&Object.assign(i,o.defaultOptions)}),i}setMutationDefaults(n,r){this.#s.set(Hs(n),{mutationKey:n,defaultOptions:r})}getMutationDefaults(n){const r=[...this.#s.values()],i={};return r.forEach(o=>{Xr(n,o.mutationKey)&&Object.assign(i,o.defaultOptions)}),i}defaultQueryOptions(n){if(n._defaulted)return n;const r={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return r.queryHash||(r.queryHash=cm(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===dm&&(r.enabled=!1),r}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};const Pv=(n,r,i)=>{const o=i?.state.status==="error"&&typeof n.throwOnError=="function"?fm(n.throwOnError,[i.state.error,i]):n.throwOnError;(n.suspense||o)&&(r.isReset()||(n.retryOnMount=!1))},Kv=n=>{j.useEffect(()=>{n.clearReset()},[n])},Yv=({result:n,errorResetBoundary:r,throwOnError:i,query:o,suspense:d})=>n.isError&&!r.isReset()&&!n.isFetching&&o&&(d&&n.data===void 0||fm(i,[n.error,o])),Gv=n=>{if(n.suspense){const i=d=>d==="static"?d:Math.max(d??1e3,1e3),o=n.staleTime;n.staleTime=typeof o=="function"?(...d)=>i(o(...d)):i(o),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},Bf=(n,r)=>n?.suspense&&r.isPending,Vv=(n,r,i)=>r.fetchOptimistic(n).catch(()=>{i.clearReset()});function yS({queries:n,...r},i){const o=_e(),d=Rv(),f=zv(),m=r.subscribed!==!1,p=j.useMemo(()=>n.map(k=>{const _=o.defaultQueryOptions(k);return _._optimisticResults=d?"isRestoring":m?"optimistic":void 0,_}),[n,o,d,m]);p.forEach(k=>{Gv(k);const _=o.getQueryCache().get(k.queryHash);Pv(k,f,_)}),Kv(f);const[h]=j.useState(()=>new xS(o,p,r)),[g,v,y]=h.getOptimisticResult(p,r.combine);j.useEffect(()=>{h.setQueries(p,r)},[p,r,h]);const b=!d&&m;j.useSyncExternalStore(j.useCallback(k=>b?h.subscribe(pt.batchCalls(k)):Qt,[h,b]),()=>h.getCurrentResult(),()=>h.getCurrentResult());const S=g.some((k,_)=>Bf(p[_],k))?g.flatMap((k,_)=>{const A=p[_];if(A&&Bf(A,k)){const C=new mc(o,A);return Vv(A,C,f)}return[]}):[];if(S.length>0)throw Promise.all(S);const w=g.find((k,_)=>{const A=p[_];return A&&Yv({result:k,errorResetBoundary:f,throwOnError:A.throwOnError,query:o.getQueryCache().get(A.queryHash),suspense:A.suspense})});if(w)throw w.error;return v(y())}function Xv(n,r,i){const o=Rv(),d=zv(),f=_e(),m=f.defaultQueryOptions(n),p=f.getQueryCache().get(m.queryHash),h=n.subscribed!==!1;m._optimisticResults=o?"isRestoring":h?"optimistic":void 0,Gv(m),Pv(m,d,p),Kv(d);const[g]=j.useState(()=>new r(f,m)),v=g.getOptimisticResult(m);j.useEffect(()=>{g.setOptions(m)},[m,g]);const y=!o&&h;if(j.useSyncExternalStore(j.useCallback(b=>{const S=y?g.subscribe(pt.batchCalls(b)):Qt;return g.updateResult(),S},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),Bf(m,v))throw Vv(m,g,d);if(Yv({result:v,errorResetBoundary:d,throwOnError:m.throwOnError,query:p,suspense:m.suspense}))throw v.error;return m.notifyOnChangeProps?v:g.trackResult(v)}function Ye(n,r){return Xv(n,mc)}function pe(n,r){const i=_e(),[o]=j.useState(()=>new hS(i,n));j.useEffect(()=>{o.setOptions(n)},[o,n]);const d=j.useSyncExternalStore(j.useCallback(m=>o.subscribe(pt.batchCalls(m)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),f=j.useCallback((...m)=>{o.mutate(m[0],m[1]).catch(Qt)},[o]);if(d.error&&fm(o.options.throwOnError,[d.error]))throw d.error;return{...d,mutate:f,mutateAsync:d.mutate}}function el(n,r){return Xv(n,dS)}var hc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Zv=/^[\\/]{2}/;function vS(n,r){return r+n.replace(/\\/g,"/")}var Hy="popstate";function $y(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function bS(n={}){function r(o,d){let f=d.state?.masked,{pathname:m,search:p,hash:h}=f||o.location;return Qf("",{pathname:m,search:p,hash:h},d.state&&d.state.usr||null,d.state&&d.state.key||"default",f?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,d){return typeof d=="string"?d:$s(d)}return NS(r,i,null,n)}function dt(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function An(n,r){if(!n){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function jS(){return Math.random().toString(36).substring(2,10)}function By(n,r){return{usr:n.state,key:n.key,idx:r,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Qf(n,r,i=null,o,d){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof r=="string"?tl(r):r,state:i,key:r&&r.key||o||jS(),mask:d}}function $s({pathname:n="/",search:r="",hash:i=""}){return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function tl(n){let r={};if(n){let i=n.indexOf("#");i>=0&&(r.hash=n.substring(i),n=n.substring(0,i));let o=n.indexOf("?");o>=0&&(r.search=n.substring(o),n=n.substring(0,o)),n&&(r.pathname=n)}return r}function NS(n,r,i,o={}){let{window:d=document.defaultView,v5Compat:f=!1}=o,m=d.history,p="POP",h=null,g=v();g==null&&(g=0,m.replaceState({...m.state,idx:g},""));function v(){return(m.state||{idx:null}).idx}function y(){p="POP";let _=v(),A=_==null?null:_-g;g=_,h&&h({action:p,location:k.location,delta:A})}function b(_,A){p="PUSH";let C=$y(_)?_:Qf(k.location,_,A);g=v()+1;let B=By(C,g),V=k.createHref(C.mask||C);try{m.pushState(B,"",V)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;d.location.assign(V)}f&&h&&h({action:p,location:k.location,delta:1})}function S(_,A){p="REPLACE";let C=$y(_)?_:Qf(k.location,_,A);g=v();let B=By(C,g),V=k.createHref(C.mask||C);m.replaceState(B,"",V),f&&h&&h({action:p,location:k.location,delta:0})}function w(_){return wS(d,_)}let k={get action(){return p},get location(){return n(d,m)},listen(_){if(h)throw new Error("A history only accepts one active listener");return d.addEventListener(Hy,y),h=_,()=>{d.removeEventListener(Hy,y),h=null}},createHref(_){return r(d,_)},createURL:w,encodeLocation(_){let A=w(_);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:b,replace:S,go(_){return m.go(_)}};return k}function wS(n,r,i=!1){let o="http://localhost";n&&(o=n.location.origin!=="null"?n.location.origin:n.location.href),dt(o,"No window.location.(origin|href) available to create URL");let d=typeof r=="string"?r:$s(r);return d=d.replace(/ $/,"%20"),!i&&Zv.test(d)&&(d=o+d),new URL(d,o)}var Ff=new URL("http://localhost");function pm(n){if(n.createURL)return n.createURL("/");try{return new URL(n.createHref("/"),Ff)}catch{return Ff}}function yf(n,r){return n.origin===r.origin&&(n.origin!=="null"||n.protocol===r.protocol&&n.host===r.host)}function Iv(n,r){if(n.startsWith("//"))return!0;let i=r.protocol.toLowerCase();return n.toLowerCase().startsWith(i)?r.host===""||n.slice(i.length).startsWith("//"):!1}function Jv(n){let r=n.replace(/[\t\n\r]/g,""),i=0;for(;r.charCodeAt(i)<=32;)i++;if(r=r.slice(i),!hc.test(r))return;let o;try{o=new URL(n,Ff)}catch{return}if(!Iv(n,o))throw new Error("External navigation is not allowed")}function gm(n,r,i,o){let d=null;try{d=n==null?null:new URL(n,i)}catch{}let f=new URL(r,i),m=d!=null&&!yf(d,i),p=!yf(f,i);if(o==="reject"){if(m||p)throw new Error("External navigation is not allowed")}else if(p&&(d==null||!Iv(n,d)||!yf(d,f)))throw new Error("External navigation is not allowed")}function Wv(n,r,i="/"){return SS(n,r,i,!1)}function SS(n,r,i,o,d){let f=typeof r=="string"?tl(r):r,m=_a(f.pathname||"/",i);if(m==null)return null;let p=_S(n),h=null,g=LS(m);for(let v=0;h==null&&v<p.length;++v)h=DS(p[v],g,o);return h}function _S(n){let r=eb(n);return kS(r),r}function eb(n,r=[],i=[],o="",d=!1){let f=(m,p,h=d,g)=>{let v={relativePath:g===void 0?m.path||"":g,caseSensitive:m.caseSensitive===!0,childrenIndex:p,route:m};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;dt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let y=Pn([o,v.relativePath]),b=i.concat(v);m.children&&m.children.length>0&&(dt(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),eb(m.children,r,b,y,h)),!(m.path==null&&!m.index)&&r.push({path:y,score:zS(y,m.index),routesMeta:b.map((S,w)=>{let[k,_]=ab(S.relativePath,S.caseSensitive,w===b.length-1);return{...S,matcher:k,compiledParams:_}})})};return n.forEach((m,p)=>{if(m.path===""||!m.path?.includes("?"))f(m,p);else for(let h of tb(m.path))f(m,p,!0,h)}),r}function tb(n){let r=n.split("/");if(r.length===0)return[];let[i,...o]=r,d=i.endsWith("?"),f=i.replace(/\?$/,"");if(o.length===0)return d?[f,""]:[f];let m=tb(o.join("/")),p=[];return p.push(...m.map(h=>h===""?f:[f,h].join("/"))),d&&p.push(...m),p.map(h=>n.startsWith("/")&&h===""?"/":h)}function kS(n){n.sort((r,i)=>r.score!==i.score?i.score-r.score:MS(r.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var ES=/^:[\w-]+$/,CS=3,TS=2,AS=1,RS=10,OS=-2,Qy=n=>n==="*";function zS(n,r){let i=n.split("/"),o=i.length;return i.some(Qy)&&(o+=OS),r&&(o+=TS),i.filter(d=>!Qy(d)).reduce((d,f)=>d+(ES.test(f)?CS:f===""?AS:RS),o)}function MS(n,r){return n.length===r.length&&n.slice(0,-1).every((o,d)=>o===r[d])?n[n.length-1]-r[r.length-1]:0}function DS(n,r,i=!1){let{routesMeta:o}=n,d={},f="/",m=[];for(let p=0;p<o.length;++p){let h=o[p],g=p===o.length-1,v=f==="/"?r:r.slice(f.length)||"/",y={path:h.relativePath,caseSensitive:h.caseSensitive,end:g},b=h.matcher&&h.compiledParams?nb(y,v,h.matcher,h.compiledParams):rc(y,v),S=h.route;if(!b&&g&&i&&!o[o.length-1].route.index&&(b=rc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!b)return null;Object.assign(d,b.params),m.push({params:d,pathname:Pn([f,b.pathname]),pathnameBase:HS(Pn([f,b.pathnameBase])),route:S}),b.pathnameBase!=="/"&&(f=Pn([f,b.pathnameBase]))}return m}var Fy=12;function rc(n,r){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let{path:i}=n,o=0;for(let m=i.indexOf("?");m!==-1;m=i.indexOf("?",m+1))if(++o>Fy)throw new Error(`Path pattern ${JSON.stringify(i)} exceeds the limit of ${Fy} optional segments.`);let[d,f]=ab(i,n.caseSensitive,n.end);return nb(n,r,d,f)}function nb(n,r,i,o){let d=r.match(i);if(!d)return null;let f=d[0],m=Zr(f,1),p=d.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:y},b)=>{if(v==="*"){let w=p[b]||"";m=Zr(f.slice(0,f.length-w.length),1)}const S=p[b];return y&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:f,pathnameBase:m,pattern:n}}function ab(n,r=!1,i=!0){An(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],d="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,p,h,g,v)=>{if(o.push({paramName:p,isOptional:h!=null}),h){let y=v.charAt(g+m.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),d+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?d+="\\/*$":n!==""&&n!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,r?void 0:"i"),o]}function LS(n){try{return n.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return An(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),n}}function _a(n,r){if(r==="/")return n;if(!n.toLowerCase().startsWith(r.toLowerCase()))return null;let i=r.endsWith("/")?r.length-1:r.length,o=n.charAt(i);return o&&o!=="/"?null:n.slice(i)||"/"}function US(n,r="/"){let{pathname:i,search:o="",hash:d=""}=typeof n=="string"?tl(n):n,f;return i?(i=sb(i),i.startsWith("/")||i.startsWith("\\")?f=Py(i.substring(1),"/"):f=Py(i,r)):f=r,{pathname:f,search:$S(o),hash:BS(d)}}function Py(n,r){let i=Zr(r).split("/");return n.split("/").forEach(d=>{d===".."?i.length>1&&i.pop():d!=="."&&i.push(d)}),i.length>1?i.join("/"):"/"}function vf(n,r,i,o){return`Cannot include a '${n}' character in a manually specified \`to.${r}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function qS(n){return n.filter((r,i)=>i===0||r.route.path&&r.route.path.length>0)}function ym(n){let r=qS(n);return r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase)}function xc(n,r,i,o=!1){let d;typeof n=="string"?d=tl(n):(d={...n},dt(!d.pathname||!d.pathname.includes("?"),vf("?","pathname","search",d)),dt(!d.pathname||!d.pathname.includes("#"),vf("#","pathname","hash",d)),dt(!d.search||!d.search.includes("#"),vf("#","search","hash",d)));let f=n===""||d.pathname==="",m=f?"/":d.pathname,p;if(m==null)p=i;else{let y=r.length-1;if(!o&&m.startsWith("..")){let b=m.split("/");for(;b[0]==="..";)b.shift(),y-=1;d.pathname=b.join("/")}p=y>=0?r[y]:"/"}let h=US(d,p),g=m&&m!=="/"&&m.endsWith("/"),v=(f||m===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var sb=n=>n.replace(/[\\/]{2,}/g,"/"),Pn=n=>sb(n.join("/"));function Zr(n,r=0){let i=n.length;for(;i>r&&n.charCodeAt(i-1)===47;)i--;return i===n.length?n:n.slice(0,i)}var HS=n=>Zr(n).replace(/^\/*/,"/"),$S=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,BS=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,QS=class{constructor(n,r,i,o=!1){this.status=n,this.statusText=r||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function FS(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function PS(n){let r=n.map(i=>i.route.path).filter(Boolean);return Pn(r)||"/"}var rb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lb(n,r){let i=n;if(typeof i!="string"||!hc.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,d=!1;if(rb)try{let f=new URL(window.location.href),m=Zv.test(i)?new URL(vS(i,f.protocol)):new URL(i),p=_a(m.pathname,r);m.origin===f.origin&&p!=null?i=p+m.search+m.hash:d=!0}catch{An(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:d,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ib=["POST","PUT","PATCH","DELETE"];new Set(ib);var KS=["GET",...ib];new Set(KS);var YS=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function GS(n){try{return YS.includes(new URL(n).protocol)}catch{return!1}}var nl=j.createContext(null);nl.displayName="DataRouter";var pc=j.createContext(null);pc.displayName="DataRouterState";var ob=j.createContext(!1);function VS(){return j.useContext(ob)}var cb=j.createContext({isTransitioning:!1});cb.displayName="ViewTransition";var XS=j.createContext(new Map);XS.displayName="Fetchers";var ZS=j.createContext(null);ZS.displayName="Await";var vn=j.createContext(null);vn.displayName="Navigation";var mi=j.createContext(null);mi.displayName="Location";var On=j.createContext({outlet:null,matches:[],isDataRoute:!1});On.displayName="Route";var vm=j.createContext(null);vm.displayName="RouteError";var ub="REACT_ROUTER_ERROR",IS="REDIRECT",JS="ROUTE_ERROR_RESPONSE";function WS(n){if(n.startsWith(`${ub}:${IS}:{`))try{let r=JSON.parse(n.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function e2(n){if(n.startsWith(`${ub}:${JS}:{`))try{let r=JSON.parse(n.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new QS(r.status,r.statusText,r.data)}catch{}}function t2(n,{relative:r}={}){dt(al(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=j.useContext(vn),{hash:d,pathname:f,search:m}=hi(n,{relative:r}),p=f;return i!=="/"&&(p=f==="/"?i:Pn([i,f])),o.createHref({pathname:p,search:m,hash:d})}function al(){return j.useContext(mi)!=null}function zn(){return dt(al(),"useLocation() may be used only in the context of a <Router> component."),j.useContext(mi).location}var db="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function fb(n){j.useContext(vn).static||j.useLayoutEffect(n)}function Gn(){let{isDataRoute:n}=j.useContext(On);return n?p2():n2()}function n2(){dt(al(),"useNavigate() may be used only in the context of a <Router> component.");let n=j.useContext(nl),{basename:r,navigator:i}=j.useContext(vn),{matches:o}=j.useContext(On),{pathname:d}=zn(),f=JSON.stringify(ym(o)),m=j.useRef(!1);return fb(()=>{m.current=!0}),j.useCallback((h,g={})=>{if(An(m.current,db),!m.current)return;if(typeof h=="number"){i.go(h);return}let v=xc(h,JSON.parse(f),d,g.relative==="path");n==null&&r!=="/"&&(v.pathname=v.pathname==="/"?r:Pn([r,v.pathname])),gm(typeof h=="string"?h:$s(h),i.createHref(v),pm(i),"reject"),(g.replace?i.replace:i.push)(v,g.state,g)},[r,i,f,d,n])}var a2=j.createContext(null);function s2(n){let r=j.useContext(On).outlet;return j.useMemo(()=>r&&j.createElement(a2.Provider,{value:n},r),[r,n])}function gc(){let{matches:n}=j.useContext(On);return n[n.length-1]?.params??{}}function hi(n,{relative:r}={}){let{matches:i}=j.useContext(On),{pathname:o}=zn(),d=JSON.stringify(ym(i));return j.useMemo(()=>xc(n,JSON.parse(d),o,r==="path"),[n,d,o,r])}function r2(n,r){return mb(n,r)}function mb(n,r,i){dt(al(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=j.useContext(vn),{matches:d}=j.useContext(On),f=d[d.length-1],m=f?f.params:{},p=f?f.pathname:"/",h=f?f.pathnameBase:"/",g=f&&f.route;{let _=g&&g.path||"";xb(p,!g||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${_}">) 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.
10
+
11
+ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let v=zn(),y;if(r){let _=typeof r=="string"?tl(r):r;dt(h==="/"||_.pathname?.startsWith(h),`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 "${h}" but pathname "${_.pathname}" was given in the \`location\` prop.`),y=_}else y=v;let b=y.pathname||"/",S=b;if(h!=="/"){let _=h.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(_.length).join("/")}let w=i&&i.state.matches.length?i.state.matches.map(_=>Object.assign(_,{route:i.manifest[_.route.id]||_.route})):Wv(n,{pathname:S});An(g||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),An(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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 k=u2(w&&w.map(_=>Object.assign({},_,{params:Object.assign({},m,_.params),pathname:Pn([h,o.encodeLocation?o.encodeLocation(_.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:Pn([h,o.encodeLocation?o.encodeLocation(_.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),d,i);return r&&k?j.createElement(mi.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},k):k}function l2(){let n=x2(),r=FS(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:f},"ErrorBoundary")," or"," ",j.createElement("code",{style:f},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},r),i?j.createElement("pre",{style:d},i):null,m)}var i2=j.createElement(l2,null),hb=class extends j.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){return r.location!==n.location||r.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:r.error,location:r.location,revalidation:n.revalidation||r.revalidation}}componentDidCatch(n,r){this.props.onError?this.props.onError(n,r):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=e2(n.digest);i&&(n=i)}let r=n!==void 0?j.createElement(On.Provider,{value:this.props.routeContext},j.createElement(vm.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?j.createElement(o2,{error:n},r):r}};hb.contextType=ob;var bf=new WeakMap;function o2({children:n,error:r}){let{basename:i,navigator:o}=j.useContext(vn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let d=WS(r.digest);if(d){let f=bf.get(r);if(f)throw f;let m=lb(d.location,i),p=m.absoluteURL||m.to;if(gm(d.location,p,pm(o),"allow-explicit"),GS(p))throw new Error("Invalid redirect location");if(rb&&!bf.get(r))if(m.isExternal||d.reloadDocument)window.location.href=p;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(m.to,{replace:d.replace}));throw bf.set(r,h),h}return j.createElement("meta",{httpEquiv:"refresh",content:`0;url=${p}`})}}return n}function c2({routeContext:n,match:r,children:i}){let o=j.useContext(nl);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),j.createElement(On.Provider,{value:n},i)}function u2(n,r=[],i){let o=i?.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(r.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let d=n,f=o?.errors;if(f!=null){let v=d.findIndex(y=>y.route.id&&f?.[y.route.id]!==void 0);dt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),d=d.slice(0,Math.min(d.length,v+1))}let m=!1,p=-1;if(i&&o){m=o.renderFallback;for(let v=0;v<d.length;v++){let y=d[v];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(p=v),y.route.id){let{loaderData:b,errors:S}=o,w=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!S||S[y.route.id]===void 0);if(y.route.lazy||w){i.isStatic&&(m=!0),p>=0?d=d.slice(0,p+1):d=[d[0]];break}}}}let h=i?.onError,g=o&&h?(v,y)=>{h(v,{location:o.location,params:o.matches?.[0]?.params??{},pattern:PS(o.matches),errorInfo:y})}:void 0;return d.reduceRight((v,y,b)=>{let S,w=!1,k=null,_=null;o&&(S=f&&y.route.id?f[y.route.id]:void 0,k=y.route.errorElement||i2,m&&(p<0&&b===0?(xb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,_=null):p===b&&(w=!0,_=y.route.hydrateFallbackElement||null)));let A=r.concat(d.slice(0,b+1)),C=()=>{let B;return S?B=k:w?B=_:y.route.Component?B=j.createElement(y.route.Component,null):y.route.element?B=y.route.element:B=v,j.createElement(c2,{match:y,routeContext:{outlet:v,matches:A,isDataRoute:o!=null},children:B})};return o&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?j.createElement(hb,{location:o.location,revalidation:o.revalidation,component:k,error:S,children:C(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:g}):C()},null)}function bm(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function d2(n){let r=j.useContext(nl);return dt(r,bm(n)),r}function f2(n){let r=j.useContext(pc);return dt(r,bm(n)),r}function m2(n){let r=j.useContext(On);return dt(r,bm(n)),r}function jm(n){let r=m2(n),i=r.matches[r.matches.length-1];return dt(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function h2(){return jm("useRouteId")}function x2(){let n=j.useContext(vm),r=f2("useRouteError"),i=jm("useRouteError");return n!==void 0?n:r.errors?.[i]}function p2(){let{router:n}=d2("useNavigate"),r=jm("useNavigate"),i=j.useRef(!1);return fb(()=>{i.current=!0}),j.useCallback(async(d,f={})=>{An(i.current,db),i.current&&(typeof d=="number"?await n.navigate(d):await n.navigate(d,{fromRouteId:r,...f}))},[n,r])}var Ky={};function xb(n,r,i){!r&&!Ky[n]&&(Ky[n]=!0,An(!1,i))}j.memo(g2);function g2({routes:n,manifest:r,future:i,state:o,isStatic:d,onError:f}){return mb(n,void 0,{manifest:r,state:o,isStatic:d,onError:f})}function ec({to:n,replace:r,state:i,relative:o}){dt(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:d,navigator:f}=j.useContext(vn);An(!d,"<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:m}=j.useContext(On),{pathname:p}=zn(),h=Gn(),g=xc(n,ym(m),p,o==="path");gm(typeof n=="string"?n:$s(n),f.createHref(g),pm(f),"reject");let v=JSON.stringify(g);return j.useEffect(()=>{h(JSON.parse(v),{replace:r,state:i,relative:o})},[h,v,o,r,i]),null}function pb(n){return s2(n.context)}function Ke(n){dt(!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 y2({basename:n="/",children:r=null,location:i,navigationType:o="POP",navigator:d,static:f=!1,useTransitions:m}){dt(!al(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=n.replace(/^\/*/,"/"),h=j.useMemo(()=>({basename:p,navigator:d,static:f,useTransitions:m,future:{}}),[p,d,f,m]);typeof i=="string"&&(i=tl(i));let{pathname:g="/",search:v="",hash:y="",state:b=null,key:S="default",mask:w}=i,k=j.useMemo(()=>{let _=_a(g,p);return _==null?null:{location:{pathname:_,search:v,hash:y,state:b,key:S,mask:w},navigationType:o}},[p,g,v,y,b,S,o,w]);return An(k!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:j.createElement(vn.Provider,{value:h},j.createElement(mi.Provider,{children:r,value:k}))}function v2({children:n,location:r}){return r2(Pf(n),r)}function Pf(n,r=[]){let i=[];return j.Children.forEach(n,(o,d)=>{if(!j.isValidElement(o))return;let f=[...r,d];if(o.type===j.Fragment){i.push.apply(i,Pf(o.props.children,f));return}dt(o.type===Ke,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),dt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let m={id:o.props.id||f.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(m.children=Pf(o.props.children,f)),i.push(m)}),i}var tc="get",nc="application/x-www-form-urlencoded";function yc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function b2(n){return yc(n)&&n.tagName.toLowerCase()==="button"}function j2(n){return yc(n)&&n.tagName.toLowerCase()==="form"}function N2(n){return yc(n)&&n.tagName.toLowerCase()==="input"}function w2(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function S2(n,r){return n.button===0&&(!r||r==="_self")&&!w2(n)}function Kf(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((r,i)=>{let o=n[i];return r.concat(Array.isArray(o)?o.map(d=>[i,d]):[[i,o]])},[]))}function _2(n,r){let i=Kf(n);return r&&r.forEach((o,d)=>{i.has(d)||r.getAll(d).forEach(f=>{i.append(d,f)})}),i}var Go=null;function k2(){if(Go===null)try{new FormData(document.createElement("form"),0),Go=!1}catch{Go=!0}return Go}var E2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jf(n){return n!=null&&!E2.has(n)?(An(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${nc}"`),null):n}function C2(n,r){let i,o,d,f,m;if(j2(n)){let p=n.getAttribute("action");o=p?_a(p,r):null,i=n.getAttribute("method")||tc,d=jf(n.getAttribute("enctype"))||nc,f=new FormData(n)}else if(b2(n)||N2(n)&&(n.type==="submit"||n.type==="image")){let p=n.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=n.getAttribute("formaction")||p.getAttribute("action");if(o=h?_a(h,r):null,i=n.getAttribute("formmethod")||p.getAttribute("method")||tc,d=jf(n.getAttribute("formenctype"))||jf(p.getAttribute("enctype"))||nc,f=new FormData(p,n),!k2()){let{name:g,type:v,value:y}=n;if(v==="image"){let b=g?`${g}.`:"";f.append(`${b}x`,"0"),f.append(`${b}y`,"0")}else g&&f.append(g,y)}}else{if(yc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=tc,o=null,d=nc,m=n}return f&&d==="text/plain"&&(m=f,f=void 0),{action:o,method:i.toLowerCase(),encType:d,formData:f,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nm(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function gb(n,r,i,o){let d=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${o}`:d.pathname=`${d.pathname}.${o}`:d.pathname==="/"?d.pathname=`_root.${o}`:r&&_a(d.pathname,r)==="/"?d.pathname=`${Zr(r)}/_root.${o}`:d.pathname=`${Zr(d.pathname)}.${o}`,d}async function T2(n,r){if(n.id in r)return r[n.id];try{let i=await import(n.module);return r[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function A2(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function R2(n,r,i){let o=await Promise.all(n.map(async d=>{let f=r.routes[d.route.id];if(f){let m=await T2(f,i);return m.links?m.links():[]}return[]}));return D2(o.flat(1).filter(A2).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function Yy(n,r,i,o,d,f){let m=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,p=(h,g)=>i[g].pathname!==h.pathname||i[g].route.path?.endsWith("*")&&i[g].params["*"]!==h.params["*"];return f==="assets"?r.filter((h,g)=>m(h,g)||p(h,g)):f==="data"?r.filter((h,g)=>{let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(m(h,g)||p(h,g))return!0;if(h.route.shouldRevalidate){let y=h.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function O2(n,r,{includeHydrateFallback:i}={}){return z2(n.map(o=>{let d=r.routes[o.route.id];if(!d)return[];let f=[d.module];return d.clientActionModule&&(f=f.concat(d.clientActionModule)),d.clientLoaderModule&&(f=f.concat(d.clientLoaderModule)),i&&d.hydrateFallbackModule&&(f=f.concat(d.hydrateFallbackModule)),d.imports&&(f=f.concat(d.imports)),f}).flat(1))}function z2(n){return[...new Set(n)]}function M2(n){let r={},i=Object.keys(n).sort();for(let o of i)r[o]=n[o];return r}function D2(n,r){let i=new Set;return new Set(r),n.reduce((o,d)=>{let f=JSON.stringify(M2(d));return i.has(f)||(i.add(f),o.push({key:f,link:d})),o},[])}function wm(){let n=j.useContext(nl);return Nm(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function L2(){let n=j.useContext(pc);return Nm(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Sm=j.createContext(void 0);Sm.displayName="FrameworkContext";function vc(){let n=j.useContext(Sm);return Nm(n,"You must render this element inside a <HydratedRouter> element"),n}function U2(n,r){let i=j.useContext(Sm),[o,d]=j.useState(!1),[f,m]=j.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:y}=r,b=j.useRef(null);j.useEffect(()=>{if(n==="render"&&m(!0),n==="viewport"){let k=A=>{A.forEach(C=>{m(C.isIntersecting)})},_=new IntersectionObserver(k,{threshold:.5});return b.current&&_.observe(b.current),()=>{_.disconnect()}}},[n]),j.useEffect(()=>{if(o){let k=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(k)}}},[o]);let S=()=>{d(!0)},w=()=>{d(!1),m(!1)};return i?n!=="intent"?[f,b,{}]:[f,b,{onFocus:ai(p,S),onBlur:ai(h,w),onMouseEnter:ai(g,S),onMouseLeave:ai(v,w),onTouchStart:ai(y,S)}]:[!1,b,{}]}function ai(n,r){return i=>{n&&n(i),i.defaultPrevented||r(i)}}function q2({page:n,...r}){let i=VS(),{nonce:o}=vc(),{router:d}=wm(),f=j.useMemo(()=>Wv(d.routes,n,d.basename),[d.routes,n,d.basename]);return f?(r.nonce==null&&o&&(r={...r,nonce:o}),i?j.createElement($2,{page:n,matches:f,...r}):j.createElement(B2,{page:n,matches:f,...r})):null}function H2(n){let{manifest:r,routeModules:i}=vc(),[o,d]=j.useState([]);return j.useEffect(()=>{let f=!1;return R2(n,r,i).then(m=>{f||d(m)}),()=>{f=!0}},[n,r,i]),o}function $2({page:n,matches:r,...i}){let o=zn(),{future:d}=vc(),{basename:f}=wm(),m=j.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let p=gb(n,f,d.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,g=[];for(let v of r)typeof v.route.shouldRevalidate=="function"?h=!0:g.push(v.route.id);return h&&g.length>0&&p.searchParams.set("_routes",g.join(",")),[p.pathname+p.search]},[f,d.v8_trailingSlashAwareDataRequests,n,o,r]);return j.createElement(j.Fragment,null,m.map(p=>j.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...i})))}function B2({page:n,matches:r,...i}){let o=zn(),{future:d,manifest:f,routeModules:m}=vc(),{basename:p}=wm(),{loaderData:h,matches:g}=L2(),v=j.useMemo(()=>Yy(n,r,g,f,o,"data"),[n,r,g,f,o]),y=j.useMemo(()=>Yy(n,r,g,f,o,"assets"),[n,r,g,f,o]),b=j.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let k=new Set,_=!1;if(r.forEach(C=>{let B=f.routes[C.route.id];!B||!B.hasLoader||(!v.some(V=>V.route.id===C.route.id)&&C.route.id in h&&m[C.route.id]?.shouldRevalidate||B.hasClientLoader?_=!0:k.add(C.route.id))}),k.size===0)return[];let A=gb(n,p,d.v8_trailingSlashAwareDataRequests,"data");return _&&k.size>0&&A.searchParams.set("_routes",r.filter(C=>k.has(C.route.id)).map(C=>C.route.id).join(",")),[A.pathname+A.search]},[p,d.v8_trailingSlashAwareDataRequests,h,o,f,v,r,n,m]),S=j.useMemo(()=>O2(y,f),[y,f]),w=H2(y);return j.createElement(j.Fragment,null,b.map(k=>j.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...i})),S.map(k=>j.createElement("link",{key:k,rel:"modulepreload",href:k,...i})),w.map(({key:k,link:_})=>j.createElement("link",{key:k,nonce:i.nonce,..._,crossOrigin:_.crossOrigin??i.crossOrigin})))}function Q2(...n){return r=>{n.forEach(i=>{typeof i=="function"?i(r):i!=null&&(i.current=r)})}}var F2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{F2&&(window.__reactRouterVersion="7.18.7")}catch{}function P2({basename:n,children:r,useTransitions:i,window:o}){let d=j.useRef();d.current==null&&(d.current=bS({window:o,v5Compat:!0}));let f=d.current,[m,p]=j.useState({action:f.action,location:f.location}),h=j.useCallback(g=>{i===!1?p(g):j.startTransition(()=>p(g))},[i]);return j.useLayoutEffect(()=>f.listen(h),[f,h]),j.createElement(y2,{basename:n,children:r,location:m.location,navigationType:m.action,navigator:f,useTransitions:i})}var $e=j.forwardRef(function({onClick:r,discover:i="render",prefetch:o="none",relative:d,reloadDocument:f,replace:m,mask:p,state:h,target:g,to:v,preventScrollReset:y,viewTransition:b,defaultShouldRevalidate:S,...w},k){let{basename:_,navigator:A,useTransitions:C}=j.useContext(vn),B=typeof v=="string"&&hc.test(v),V=lb(v,_);v=V.to;let F=t2(v,{relative:d}),U=zn(),Z=null;if(p){let G=xc(p,[],U.mask?U.mask.pathname:"/",!0);_!=="/"&&(G.pathname=G.pathname==="/"?_:Pn([_,G.pathname])),Z=A.createHref(G)}let[Q,xe,he]=U2(o,w),Ne=G2(v,{replace:m,mask:p,state:h,target:g,preventScrollReset:y,relative:d,viewTransition:b,defaultShouldRevalidate:S,useTransitions:C});function Ae(G){r&&r(G),G.defaultPrevented||Ne(G)}let ee=!(V.isExternal||f),ze=(ee?Z:void 0)||V.absoluteURL||F;Jv(ze);let Ee=j.createElement("a",{...w,...he,href:ze,onClick:ee?Ae:r,ref:Q2(k,xe),target:g,"data-discover":!B&&i==="render"?"true":void 0});return Q&&!B?j.createElement(j.Fragment,null,Ee,j.createElement(q2,{page:F})):Ee});$e.displayName="Link";var _m=j.forwardRef(function({"aria-current":r="page",caseSensitive:i=!1,className:o="",end:d=!1,style:f,to:m,viewTransition:p,children:h,...g},v){let y=hi(m,{relative:g.relative}),b=zn(),S=j.useContext(pc),{navigator:w,basename:k}=j.useContext(vn),_=S!=null&&J2(y)&&p===!0,A=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,C=b.pathname,B=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(C=C.toLowerCase(),B=B?B.toLowerCase():null,A=A.toLowerCase()),B&&k&&(B=_a(B,k)||B);const V=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let F=C===A||!d&&C.startsWith(A)&&C.charAt(V)==="/",U=B!=null&&(B===A||!d&&B.startsWith(A)&&B.charAt(A.length)==="/"),Z={isActive:F,isPending:U,isTransitioning:_},Q=F?r:void 0,xe;typeof o=="function"?xe=o(Z):xe=[o,F?"active":null,U?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let he=typeof f=="function"?f(Z):f;return j.createElement($e,{...g,"aria-current":Q,className:xe,ref:v,style:he,to:m,viewTransition:p},typeof h=="function"?h(Z):h)});_m.displayName="NavLink";var K2=j.forwardRef(({discover:n="render",fetcherKey:r,navigate:i,reloadDocument:o,replace:d,state:f,method:m=tc,action:p,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:y,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:k}=j.useContext(vn),_=Z2(),A=I2(p,{relative:g}),C=m.toLowerCase()==="get"?"get":"post",B=typeof p=="string"&&hc.test(p),V=F=>{if(h&&h(F),F.defaultPrevented)return;F.preventDefault();let U=F.nativeEvent.submitter,Z=U?.getAttribute("formmethod")||m,Q=()=>_(U||F.currentTarget,{fetcherKey:r,method:Z,navigate:i,replace:d,state:f,relative:g,preventScrollReset:v,viewTransition:y,defaultShouldRevalidate:b});k&&i!==!1?j.startTransition(()=>Q()):Q()};return j.createElement("form",{ref:w,method:C,action:A,onSubmit:o?h:V,...S,"data-discover":!B&&n==="render"?"true":void 0})});K2.displayName="Form";function Y2(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yb(n){let r=j.useContext(nl);return dt(r,Y2(n)),r}function G2(n,{target:r,replace:i,mask:o,state:d,preventScrollReset:f,relative:m,viewTransition:p,defaultShouldRevalidate:h,useTransitions:g}={}){let v=Gn(),y=zn(),b=hi(n,{relative:m});return j.useCallback(S=>{if(S2(S,r)){S.preventDefault();let w=i!==void 0?i:$s(y)===$s(b),k=()=>v(n,{replace:w,mask:o,state:d,preventScrollReset:f,relative:m,viewTransition:p,defaultShouldRevalidate:h});g?j.startTransition(()=>k()):k()}},[y,v,b,i,o,d,r,n,f,m,p,h,g])}function km(n){An(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 r=j.useRef(Kf(n)),i=j.useRef(!1),o=zn(),d=j.useMemo(()=>_2(o.search,i.current?null:r.current),[o.search]),f=Gn(),m=j.useCallback((p,h)=>{const g=Kf(typeof p=="function"?p(new URLSearchParams(d)):p);i.current=!0,f("?"+g,h)},[f,d]);return[d,m]}var V2=0,X2=()=>`__${String(++V2)}__`;function Z2(){let{router:n}=yb("useSubmit"),{basename:r}=j.useContext(vn),i=h2(),o=n.fetch,d=n.navigate;return j.useCallback(async(f,m={})=>{let{action:p,method:h,encType:g,formData:v,body:y}=C2(f,r);if(m.navigate===!1){let b=m.fetcherKey||X2();await o(b,i,m.action||p,{defaultShouldRevalidate:m.defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:v,body:y,formMethod:m.method||h,formEncType:m.encType||g,flushSync:m.flushSync})}else await d(m.action||p,{defaultShouldRevalidate:m.defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:v,body:y,formMethod:m.method||h,formEncType:m.encType||g,replace:m.replace,state:m.state,fromRouteId:i,flushSync:m.flushSync,viewTransition:m.viewTransition})},[o,d,r,i])}function I2(n,{relative:r}={}){let{basename:i}=j.useContext(vn),o=j.useContext(On);dt(o,"useFormAction must be used inside a RouteContext");let[d]=o.matches.slice(-1),f={...hi(n||".",{relative:r})},m=zn();if(n==null){f.search=m.search;let h=new URLSearchParams(f.search),g=h.getAll("index");if(g.some(y=>y==="")){h.delete("index"),g.filter(b=>b).forEach(b=>h.append("index",b));let y=h.toString();f.search=y?`?${y}`:""}}(!n||n===".")&&d.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(f.pathname=f.pathname==="/"?i:Pn([i,f.pathname]));let p=$s(f);return Jv(p),p}function J2(n,{relative:r}={}){let i=j.useContext(cb);dt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=yb("useViewTransitionState"),d=hi(n,{relative:r});if(!i.isTransitioning)return!1;let f=_a(i.currentLocation.pathname,o)||i.currentLocation.pathname,m=_a(i.nextLocation.pathname,o)||i.nextLocation.pathname;return rc(d.pathname,m)!=null||rc(d.pathname,f)!=null}const W2="X-Claros-Product",Yf="claros-product";function Gy(){try{return localStorage.getItem(Yf)}catch{return null}}function Em(n){try{n?localStorage.setItem(Yf,n):localStorage.removeItem(Yf)}catch{}}function Cm(){const n=new URLSearchParams(window.location.search).get("product")?.trim();return n?(n!==Gy()&&Em(n),n):Gy()}function bc(n={}){const r=Cm();if(!r)return{credentials:"include",...n};const i=new Headers(n.headers);return i.set(W2,r),{credentials:"include",...n,headers:i}}function vb(n){Em(n),window.location.assign("/home")}function e_(){return Cm()?(Em(null),!0):!1}async function te(n,r){const i=await fetch(n,bc(r));if(i.status===401&&e_())return window.location.assign("/home"),i;if(i.status===401){try{sessionStorage.setItem("claros-session-expired","1")}catch{}window.location.assign("/login")}return i}async function t_(){const n=await fetch("/auth/me",bc());if(!n.ok)throw new Error(`/auth/me returned ${n.status}`);return n.json()}async function n_(n){const r=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:n})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.message??`Login failed (${r.status})`)}return r.json()}async function a_(){await fetch("/auth/logout",{method:"POST",credentials:"include"})}async function s_(){const n=await te("/v1/flows");if(!n.ok)throw new Error(`/v1/flows returned ${n.status}`);return n.json()}async function r_(n){const r=await te(`/v1/flows/${n}`);if(!r.ok)throw new Error(`/v1/flows/${n} returned ${r.status}`);return r.json()}async function l_(){const n=await te("/v1/events/names");if(!n.ok)return[];const r=await n.json();return Array.isArray(r.event_names)?r.event_names.filter(i=>typeof i=="string"):[]}function It(n,r){return n===400&&r!==null&&typeof r=="object"&&"issues"in r&&Array.isArray(r.issues)?{kind:"validation",issues:r.issues}:n===422&&r!==null&&typeof r=="object"&&"error"in r?{kind:"unprocessable",message:String(r.error)}:{kind:"unknown",message:r!==null&&typeof r=="object"&&"error"in r?String(r.error):`HTTP ${n}`}}async function i_(n){const r=await te("/v1/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function Tm(n,r){const i=await te(`/v1/flows/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await i.json().catch(()=>null);if(!i.ok)throw It(i.status,o);return o}async function o_(n){const r=await te(`/v1/flows/${n}/compile`,{method:"POST"}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function c_(n){const r=await te(`/v1/flows/${n}`,{method:"DELETE"}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function u_(n,r){const i=await te(`/v1/flows/${n}/plan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await i.json().catch(()=>null);if(!i.ok)throw It(i.status,o);return o}async function d_(n,r){const i=await te(`/v1/flows/${n}/steps`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await i.json().catch(()=>null);if(!i.ok)throw It(i.status,o);return o}async function f_(n,r){const i=await te(`/v1/flows/${n}/draft-step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await i.json().catch(()=>null);if(!i.ok)throw It(i.status,o);return o}async function sl(n,r){const i=new URLSearchParams;n&&i.set("after",n),r&&i.set("status",r);const o=i.size>0?`?${i.toString()}`:"",d=await te(`/v1/messages${o}`);if(!d.ok)throw new Error(`/v1/messages returned ${d.status}`);return d.json()}async function m_(){return sl(void 0,"failed")}async function h_(n){const r=await te(`/v1/messages/${n}/retry`,{method:"POST"});if(!r.ok){const i=await r.json().catch(()=>null);throw new Error(i?.error??`Retry failed (${r.status})`)}}async function xi(n,r,i){const o=await te(`/v1/messages/${n}/${r}`,i?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)}:{method:"POST"});if(!o.ok){const d=await o.json().catch(()=>null);throw{status:o.status,message:d?.error??`HTTP ${o.status}`,currentStatus:d?.status}}}async function x_(n){return xi(n,"approve")}async function p_(n){return xi(n,"reject")}async function g_(n,r){return xi(n,"regenerate",r?{action_type:r}:{})}async function y_(n){return xi(n,"cancel")}async function v_(n){return xi(n,"unapprove")}async function b_(n,r){const i=await te(`/v1/messages/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!i.ok){const o=await i.json().catch(()=>null);throw{status:i.status,message:o?.error??`HTTP ${i.status}`,currentStatus:o?.status}}}async function j_(n){const r=await te(`/v1/contacts/${n}/exclude`,{method:"POST"});if(!r.ok){const i=await r.json().catch(()=>null);throw new Error(i?.error??`Exclude failed (${r.status})`)}return r.json()}async function bb(n,r){const i=await te(`/v1/messages/bulk/${r}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:n})});if(!i.ok){const d=await i.json().catch(()=>null);throw new Error(d?.error??`Bulk ${r} failed (${i.status})`)}const o=await i.json();return{acted:o[r==="approve"?"approved":"rejected"]??[],skipped:o.skipped??[]}}async function N_(n){return bb(n,"approve")}async function w_(n){return bb(n,"reject")}async function S_(n,r=!1){const i=new URLSearchParams;n&&i.set("after",n),r&&i.set("include_inactive","true");const o=i.size>0?`?${i.toString()}`:"",d=await te(`/v1/kb${o}`);if(!d.ok)throw new Error(`/v1/kb returned ${d.status}`);return d.json()}async function __(n){const r=await te(`/v1/kb/${n}`);if(!r.ok)throw new Error(`/v1/kb/${n} returned ${r.status}`);return r.json()}async function k_(n){const r=await te("/v1/kb",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function E_(n,r){const i=await te(`/v1/kb/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await i.json().catch(()=>null);if(!i.ok)throw It(i.status,o);return o}async function C_(n){const r=await te(`/v1/kb/${n}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>null);throw It(r.status,i)}}async function T_(){const n=await te("/v1/kb/re-embed",{method:"POST"}),r=await n.json().catch(()=>null);if(!n.ok)throw It(n.status,r);return r}async function A_(){const n=await te("/v1/settings/transport");if(!n.ok)throw new Error(`/v1/settings/transport returned ${n.status}`);return n.json()}async function is(n){const r=await n.json().catch(()=>null);if(!n.ok)throw It(n.status,r);return r}async function R_(){return is(await te("/v1/settings/transports"))}async function O_(n){return is(await te("/v1/settings/transports",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}))}async function z_(n){await is(await te(`/v1/settings/transports/${n}`,{method:"DELETE"}))}async function M_(n,r){return is(await te(`/v1/settings/transports/${n}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:r})}))}async function D_(n){return is(await te("/v1/settings/transport-routing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}))}async function L_(){return is(await te("/v1/topics"))}async function U_(n){return is(await te("/v1/topics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}))}async function q_(n,r){return is(await te(`/v1/topics/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}))}async function jb(){const n=await te("/v1/settings/llm");if(!n.ok)throw new Error(`/v1/settings/llm returned ${n.status}`);return n.json()}async function H_(n){const r=await te("/v1/settings/llm",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function $_(){const n=await te("/v1/settings/tenant");if(!n.ok)throw new Error(`/v1/settings/tenant returned ${n.status}`);return n.json()}async function B_(n){const r=await te("/v1/settings/tenant",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function Q_(n){const r=await te("/v1/settings/test-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:n})}),i=await r.json().catch(()=>null);if(!r.ok){const o=i&&typeof i=="object"&&"error"in i?String(i.error):`Send failed (${r.status})`;throw new Error(o)}return i}async function F_(){const n=await te("/v1/settings/throttle");if(!n.ok)throw new Error(`/v1/settings/throttle returned ${n.status}`);return n.json()}async function P_(n){const r=await te("/v1/settings/throttle",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r.json().catch(()=>null);if(!r.ok){const o=i&&typeof i=="object"&&"error"in i?String(i.error):`Update failed (${r.status})`;throw new Error(o)}return i}async function K_(){const n=await te("/v1/templates");if(!n.ok)throw new Error(`/v1/templates returned ${n.status}`);return n.json()}async function Y_(n){const r=await te(`/v1/templates/${n}/apply`,{method:"POST"}),i=await r.json().catch(()=>null);if(!r.ok)throw It(r.status,i);return i}async function G_(n,r){const i=new URLSearchParams;n&&i.set("after",n),r.lifecycle_state&&i.set("lifecycle_state",r.lifecycle_state),r.engagement_depth&&i.set("engagement_depth",r.engagement_depth),r.tenure_bucket&&i.set("tenure_bucket",r.tenure_bucket),r.recency_bucket&&i.set("recency_bucket",r.recency_bucket),r.search&&i.set("search",r.search);const o=i.size>0?`?${i.toString()}`:"",d=await te(`/v1/contacts${o}`);if(!d.ok)throw new Error(`/v1/contacts returned ${d.status}`);return d.json()}async function V_(n){const r=await te(`/v1/contacts/${n}`);if(!r.ok)throw new Error(`/v1/contacts/${n} returned ${r.status}`);return r.json()}async function X_(n,r){const i=r?`?after=${encodeURIComponent(r)}`:"",o=await te(`/v1/contacts/${n}/timeline${i}`);if(!o.ok)throw new Error(`/v1/contacts/${n}/timeline returned ${o.status}`);return o.json()}async function Nb(n){const r=await te(`/v1/analytics/lifecycle?days=${n}`);if(!r.ok)throw new Error(`/v1/analytics/lifecycle returned ${r.status}`);return r.json()}async function Gf(n){const r=await te(`/v1/analytics/sending?days=${n}`);if(!r.ok)throw new Error(`/v1/analytics/sending returned ${r.status}`);return r.json()}async function Z_(){const n=await te("/v1/analytics/retention-grid");if(!n.ok)throw new Error(`/v1/analytics/retention-grid returned ${n.status}`);return n.json()}async function I_(n,r,i){const o=await te(`/v1/analytics/retention-grid/${n}/${r}/trend?days=${i}`);if(!o.ok)throw new Error(`/v1/analytics/retention-grid/${n}/${r}/trend returned ${o.status}`);return o.json()}const J_=["config","suppressions","messages","contacts:read","contacts:delete","broadcasts","kb"];async function W_(){const n=await te("/v1/ingestion/keys");if(!n.ok)throw new Error(`/v1/ingestion/keys returned ${n.status}`);return n.json()}async function e4(n){const r=await te("/v1/ingestion/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Create key failed (${r.status})`)}return r.json()}async function t4(n,r){const i=await te(`/v1/ingestion/keys/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`Update key failed (${i.status})`)}return i.json()}async function n4(n){const r=await te(`/v1/ingestion/keys/${n}/revoke`,{method:"POST"});if(!r.ok)throw new Error(`Revoke key failed (${r.status})`)}async function a4(){const n=await te("/v1/ingestion/status");if(!n.ok)throw new Error(`/v1/ingestion/status returned ${n.status}`);return n.json()}async function s4(){const n=await te("/v1/diagnostics");if(!n.ok)throw new Error(`/v1/diagnostics returned ${n.status}`);return n.json()}async function r4(){const n=await te("/v1/library");if(!n.ok)throw new Error(`/v1/library returned ${n.status}`);return n.json()}async function l4(){const n=await te("/v1/library/install",{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??`Install failed (${n.status})`)}return n.json()}async function i4(n,r){const i=new URLSearchParams;n&&i.set("after",n),r.status&&i.set("status",r.status),r.flow_id&&i.set("flow_id",r.flow_id),r.recipient&&i.set("recipient",r.recipient),r.from&&i.set("from",r.from),r.to&&i.set("to",r.to),r.feedback&&i.set("feedback",r.feedback);const o=i.size>0?`?${i.toString()}`:"",d=await te(`/v1/sent-log${o}`);if(!d.ok)throw new Error(`/v1/sent-log returned ${d.status}`);return d.json()}async function o4(n){const r=await te(`/v1/sent-log/${n}`);if(!r.ok)throw new Error(`/v1/sent-log/${n} returned ${r.status}`);return r.json()}async function c4(n){const r=new URLSearchParams;n&&r.set("after",n);const i=r.size>0?`?${r.toString()}`:"",o=await te(`/v1/suppressions${i}`);if(!o.ok)throw new Error(`/v1/suppressions returned ${o.status}`);return o.json()}async function u4(n){const r=await te("/v1/suppressions/import",{method:"POST",headers:{"Content-Type":"text/csv"},body:n});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Import failed (${r.status})`)}return r.json()}async function d4(n){const r=await te("/v1/suppressions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Add failed (${r.status})`)}return r.json()}async function f4(){const n=await te("/v1/profile");if(!n.ok)throw new Error(`/v1/profile returned ${n.status}`);return n.json()}async function m4(n){const r=await te("/v1/profile",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Update failed (${r.status})`)}return r.json()}async function h4(n){const r=await te("/v1/profile/email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Request failed (${r.status})`)}return r.json()}async function x4(){const n=await te("/v1/team");if(!n.ok)throw new Error(`/v1/team returned ${n.status}`);return n.json()}async function p4(n,r){const i=await te("/v1/team/invites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,role:r})});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`Invite failed (${i.status})`)}return i.json()}async function g4(n,r){const i=await te(`/v1/team/${n}/role`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:r})});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error??`Role change failed (${i.status})`)}return i.json()}async function y4(n){const r=await te(`/v1/team/${n}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`Remove failed (${r.status})`)}return r.json()}async function ka(n,r){const i=await n.json().catch(()=>null);return i?.issues?.length?new Error(i.issues.map(o=>o.path?`${o.path}: ${o.message}`:o.message).join("; ")):new Error(i?.error??`${r} (${n.status})`)}async function v4(){const n=await te("/v1/products");if(!n.ok)throw new Error(`/v1/products returned ${n.status}`);return n.json()}async function b4(n){const r=await te("/v1/products",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await ka(r,"Could not create the product");return(await r.json()).product}async function j4(n,r){const i=await te(`/v1/products/${encodeURIComponent(n)}/${r?"archive":"unarchive"}`,{method:"POST"});if(!i.ok)throw await ka(i,"Could not update the product");return(await i.json()).product}async function N4(){const n=await te("/v1/instance/health");if(!n.ok)throw await ka(n,"Could not load health");return n.json()}async function w4(n){const r=await te(`/v1/instance/alerts/${encodeURIComponent(n)}/resolve`,{method:"POST"});if(!r.ok)throw await ka(r,"Could not resolve the alert");return(await r.json()).alert}async function S4(n,r){const i=await te(`/v1/instance/alerts/${encodeURIComponent(n)}/mute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:r})});if(!i.ok)throw await ka(i,"Could not mute the alert");return(await i.json()).alert}async function Nf(n,r){const i=await te(`/v1/instance/settings/${encodeURIComponent(n)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:r})});if(!i.ok)throw await ka(i,"Could not save the setting")}async function _4(){const n=await te("/v1/instance/keys");if(!n.ok)throw await ka(n,"Could not load instance keys");return n.json()}async function k4(n){const r=await te("/v1/instance/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await ka(r,"Could not create the key");return r.json()}async function E4(n){const r=await te(`/v1/instance/keys/${encodeURIComponent(n)}/revoke`,{method:"POST"});if(!r.ok)throw await ka(r,"Could not revoke the key")}const wb=["auth","me"],C4=new gS({defaultOptions:{queries:{retry:!1,staleTime:3e4}}});function jc(){return Ye({queryKey:wb,queryFn:t_,retry:!1,throwOnError:!1})}function T4(){return pe({mutationFn:n=>n_(n)})}function A4(){const n=_e();return pe({mutationFn:a_,onSuccess:()=>{n.removeQueries({queryKey:wb})}})}function R4({size:n=18,className:r}){const i=typeof n=="number"?`${n}px`:n;return a.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:r,children:a.jsx("g",{transform:"translate(12 12) rotate(90)",children:a.jsx("path",{d:"M0 -10.8 C0 -10.8 -7.8 -2.5 -7.8 1.6 a7.8 7.8 0 0 0 15.6 0 C7.8 -2.5 0 -10.8 0 -10.8 Z M0 -2.4 a3.7 3.7 0 1 0 0.001 0 Z",fill:"currentColor",fillRule:"evenodd"})})})}function lc({markSize:n=24,className:r}){const i=Math.round(n/1.15*10)/10,o=Math.round(n*.09*10)/10,d=Math.round(n*.05*10)/10;return a.jsxs("span",{className:["flex items-center",r].filter(Boolean).join(" "),style:{gap:`${o}px`},children:[a.jsx("span",{style:{transform:`translateY(${d}px)`,display:"flex"},children:a.jsx(R4,{size:n,className:"text-accent"})}),a.jsx("span",{className:"font-brand font-bold tracking-[0.03em] text-foreground",style:{fontSize:`${i}px`},children:"claros"})]})}const O4=n=>(n.match(/\d+[xX]\d+|[A-Z]?[a-z]+|[A-Z]|\d+/g)??[]).join("-").toLowerCase();function z4(n,r,i=[]){if(r==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:O4(n),size:24,node:r,...i.length>0?{aliases:i}:{}}}const M4=n=>{let r="",i=!1;for(const o of n){if(o==="-"||o==="_"||o<=" "){i=r.length>0;continue}r.length===0?r+=o.toLowerCase():r+=i?o.toUpperCase():o,i=!1}return r};const D4=n=>{const r=M4(n);return r.charAt(0).toUpperCase()+r.slice(1)};const Vf=(...n)=>{const r=new Set;for(const i of n)if(typeof i=="string")for(const o of i.split(/\s+/))o&&r.add(o);return[...r].join(" ")};const Qr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function wf(n){return n!=null}function L4(n,r={}){const i=r.attributeNames??{},o=b=>i[b]??b,d=n.size??n.width??Qr.width,f=n.size??n.height??Qr.height,m=n.aliases?.filter(b=>typeof b=="string"&&b.trim()!=="").map(b=>`lucide-${b}`)??[],p=[...n.name?[`lucide-${n.name}`]:[],...m],h=r.className?.split(" ").filter(Boolean)??[],g=r.includeDefaultClasses===!1?Vf(...h):Vf("lucide",...p,...h);let v=r.strokeWidth??Qr["stroke-width"];if(r.absoluteStrokeWidth){const b=Number(v)*Number(n.size??n.width??Qr.width)/Number(r.size??r.width??Qr.width);Number.isFinite(b)&&(v=b)}return["svg",{...Object.entries(Qr).reduce((b,[S,w])=>(b[o(S)]=w,b),{}),..."color"in r&&r.color&&{[o("stroke")]:r.color},..."size"in r&&wf(r.size)&&{[o("width")]:r.size,[o("height")]:r.size},..."width"in r&&wf(r.width)&&{[o("width")]:r.width},..."height"in r&&wf(r.height)&&{[o("height")]:r.height},[o("stroke-width")]:v,...g&&{[o("class")]:g},[o("viewBox")]:`0 0 ${d} ${f}`,...r.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in r&&r.attributes},n.node.map(b=>{const[S,w,k]=b,_=r.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...w}:w;return k?[S,_,k]:[S,_]})]}function U4(n,r={}){return L4(n,{...r,attributeNames:{...r.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const q4=n=>{if(n==null||typeof n!="object")return!1;for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&(r.startsWith("aria-")||r==="role"||r==="title")&&n[r]!=null)return!0;return!1},H4=j.createContext({}),$4=()=>j.useContext(H4),B4=j.forwardRef(({color:n,size:r,width:i,height:o,strokeWidth:d,absoluteStrokeWidth:f,nonScalingStroke:m,className:p="",children:h,iconNode:g=[],icon:v={node:g,aliases:[],size:24},...y},b)=>{const{size:S=24,strokeWidth:w=2,absoluteStrokeWidth:k=!1,nonScalingStroke:_=!1,color:A="currentColor",className:C=""}=$4()??{},B=!!h||q4(y),[V,F,U=[]]=U4(v,{color:n??A,width:i??r??S,height:o??r??S,strokeWidth:d??w,absoluteStrokeWidth:f??k,nonScalingStroke:m??_,className:Vf(C,p),hasA11yProp:B,attributes:y});return j.createElement(V,{ref:b,...F},[...U.map(([Z,Q])=>j.createElement(Z,Q)),...Array.isArray(h)?h:[h]])});function be(n,r=[],i=[]){const o=typeof n=="string"?z4(n,r,i):n,d=j.forwardRef(({className:f,...m},p)=>j.createElement(B4,{ref:p,icon:o,className:f,...m}));return o.name&&(d.displayName=D4(o.name)),d}const Sb={name:"activity",size:24,node:[["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"}]]};Sb.node;const Am=be(Sb);const _b={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};_b.node;const Q4=be(_b);const kb={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};kb.node;const Xf=be(kb);const Eb={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Eb.node;const Cb=be(Eb);const Tb={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};Tb.node;const F4=be(Tb);const Ab={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Ab.node;const P4=be(Ab);const Rb={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};Rb.node;const Rm=be(Rb);const Ob={name:"boxes",size:24,node:[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]};Ob.node;const K4=be(Ob);const zb={name:"chart-column",size:24,node:[["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"}]],aliases:["bar-chart-3"]};zb.node;const Y4=be(zb);const Mb={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Mb.node;const rl=be(Mb);const Db={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Db.node;const Om=be(Db);const Lb={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Lb.node;const Ub=be(Lb);const qb={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};qb.node;const G4=be(qb);const Hb={name:"circle-x",size:24,node:[["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"}]],aliases:["x-circle"]};Hb.node;const $b=be(Hb);const Bb={name:"code-xml",size:24,node:[["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"}]],aliases:["code-2"]};Bb.node;const V4=be(Bb);const Qb={name:"copy",size:24,node:[["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"}]]};Qb.node;const Fb=be(Qb);const Pb={name:"eye",size:24,node:[["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"}]]};Pb.node;const X4=be(Pb);const Kb={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],aliases:["file-json"]};Kb.node;const Z4=be(Kb);const Yb={name:"gauge",size:24,node:[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]};Yb.node;const I4=be(Yb);const Gb={name:"house",size:24,node:[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};Gb.node;const J4=be(Gb);const Vb={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["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"}]]};Vb.node;const zm=be(Vb);const Xb={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};Xb.node;const W4=be(Xb);const Zb={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};Zb.node;const ek=be(Zb);const Ib={name:"lightbulb",size:24,node:[["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"}]]};Ib.node;const tk=be(Ib);const Jb={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};Jb.node;const nk=be(Jb);const Wb={name:"mail",size:24,node:[["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"}]]};Wb.node;const Mm=be(Wb);const ej={name:"map-pin",size:24,node:[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]};ej.node;const ak=be(ej);const tj={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]};tj.node;const sk=be(tj);const nj={name:"messages-square",size:24,node:[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]};nj.node;const rk=be(nj);const aj={name:"monitor",size:24,node:[["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"}]]};aj.node;const lk=be(aj);const sj={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};sj.node;const ik=be(sj);const rj={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};rj.node;const ok=be(rj);const lj={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};lj.node;const ck=be(lj);const ij={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};ij.node;const uk=be(ij);const oj={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};oj.node;const Kn=be(oj);const cj={name:"refresh-cw",size:24,node:[["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"}]]};cj.node;const dk=be(cj);const uj={name:"search-x",size:24,node:[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]};uj.node;const dj=be(uj);const fj={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};fj.node;const mj=be(fj);const hj={name:"send",size:24,node:[["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"}]]};hj.node;const Bs=be(hj);const xj={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};xj.node;const fk=be(xj);const pj={name:"shield-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]};pj.node;const mk=be(pj);const gj={name:"shield",size:24,node:[["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"}]]};gj.node;const hk=be(gj);const yj={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};yj.node;const xk=be(yj);const vj={name:"sun",size:24,node:[["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"}]]};vj.node;const pk=be(vj);const bj={name:"tags",size:24,node:[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]};bj.node;const gk=be(bj);const jj={name:"triangle-exclamation-point",size:24,node:[["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"}]],aliases:["alert-triangle","triangle-alert"]};jj.node;const Nc=be(jj);const Nj={name:"upload",size:24,node:[["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"}]]};Nj.node;const yk=be(Nj);const wj={name:"user",size:24,node:[["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"}]]};wj.node;const vk=be(wj);const Sj={name:"users",size:24,node:[["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"}]]};Sj.node;const Dm=be(Sj);const _j={name:"webhook",size:24,node:[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]};_j.node;const bk=be(_j);const kj={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};kj.node;const Ej=be(kj);const Cj={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Cj.node;const wc=be(Cj);const Tj={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};Tj.node;const Lm=be(Tj),Aj="claros-ui-theme",Rj=window.matchMedia("(prefers-color-scheme: dark)");let ui=jk();const ic=new Set;function jk(){try{const n=localStorage.getItem(Aj);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}function Oj(){const n=ui==="dark"||ui==="system"&&Rj.matches;document.documentElement.classList.toggle("dark",n)}function Nk(){return ui}function wk(n){ui=n;try{localStorage.setItem(Aj,n)}catch{}Oj(),ic.forEach(r=>r())}function Sk(n){return ic.add(n),()=>{ic.delete(n)}}Rj.addEventListener("change",()=>{ui==="system"&&(Oj(),ic.forEach(n=>n()))});function _k(){return[j.useSyncExternalStore(Sk,Nk),wk]}function zj(n){var r,i,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var d=n.length;for(r=0;r<d;r++)n[r]&&(i=zj(n[r]))&&(o&&(o+=" "),o+=i)}else for(i in n)n[i]&&(o&&(o+=" "),o+=i);return o}function Mj(){for(var n,r,i=0,o="",d=arguments.length;i<d;i++)(n=arguments[i])&&(r=zj(n))&&(o&&(o+=" "),o+=r);return o}const kk=(n,r)=>{const i=new Array(n.length+r.length);for(let o=0;o<n.length;o++)i[o]=n[o];for(let o=0;o<r.length;o++)i[n.length+o]=r[o];return i},Ek=(n,r)=>({classGroupId:n,validator:r}),Dj=(n=new Map,r=null,i)=>({nextPart:n,validators:r,classGroupId:i}),oc="-",Vy=[],Ck="arbitrary..",Tk=n=>{const r=Rk(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:o}=n;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return Ak(m);const p=m.split(oc),h=p[0]===""&&p.length>1?1:0;return Lj(p,h,r)},getConflictingClassGroupIds:(m,p)=>{if(p){const h=o[m],g=i[m];return h?g?kk(g,h):h:g||Vy}return i[m]||Vy}}},Lj=(n,r,i)=>{if(n.length-r===0)return i.classGroupId;const d=n[r],f=i.nextPart.get(d);if(f){const g=Lj(n,r+1,f);if(g)return g}const m=i.validators;if(m===null)return;const p=r===0?n.join(oc):n.slice(r).join(oc),h=m.length;for(let g=0;g<h;g++){const v=m[g];if(v.validator(p))return v.classGroupId}},Ak=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),i=r.indexOf(":"),o=r.slice(0,i);return o?Ck+o:void 0})(),Rk=n=>{const{theme:r,classGroups:i}=n;return Ok(i,r)},Ok=(n,r)=>{const i=Dj();for(const o in n){const d=n[o];Um(d,i,o,r)}return i},Um=(n,r,i,o)=>{const d=n.length;for(let f=0;f<d;f++){const m=n[f];zk(m,r,i,o)}},zk=(n,r,i,o)=>{if(typeof n=="string"){Mk(n,r,i);return}if(typeof n=="function"){Dk(n,r,i,o);return}Lk(n,r,i,o)},Mk=(n,r,i)=>{const o=n===""?r:Uj(r,n);o.classGroupId=i},Dk=(n,r,i,o)=>{if(Uk(n)){Um(n(o),r,i,o);return}r.validators===null&&(r.validators=[]),r.validators.push(Ek(i,n))},Lk=(n,r,i,o)=>{const d=Object.entries(n),f=d.length;for(let m=0;m<f;m++){const[p,h]=d[m];Um(h,Uj(r,p),i,o)}},Uj=(n,r)=>{let i=n;const o=r.split(oc),d=o.length;for(let f=0;f<d;f++){const m=o[f];let p=i.nextPart.get(m);p||(p=Dj(),i.nextPart.set(m,p)),i=p}return i},Uk=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,qk=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,i=Object.create(null),o=Object.create(null);const d=(f,m)=>{i[f]=m,r++,r>n&&(r=0,o=i,i=Object.create(null))};return{get(f){let m=i[f];if(m!==void 0)return m;if((m=o[f])!==void 0)return d(f,m),m},set(f,m){f in i?i[f]=m:d(f,m)}}},li="!",Xy=":",Hk=[],Zy=(n,r,i,o,d)=>({modifiers:n,hasImportantModifier:r,baseClassName:i,maybePostfixModifierPosition:o,isExternal:d}),$k=n=>{const{prefix:r,experimentalParseClassName:i}=n;let o=d=>{const f=[];let m=0,p=0,h=0,g;const v=d.length;for(let _=0;_<v;_++){const A=d[_];if(m===0&&p===0){if(A===Xy){f.push(d.slice(h,_)),h=_+1;continue}if(A==="/"){g=_;continue}}if(A==="[")m++;else if(A==="]")m--;else if(A==="(")p++;else if(A===")")p--;else if(A==="\\")_++;else if(A==='"'||A==="'")for(;++_<v;){const C=d[_];if(C==="\\")_++;else if(C===A)break}}const y=f.length===0?d:d.slice(h);let b=y,S=!1;y.endsWith(li)?(b=y.slice(0,-1),S=!0):y.startsWith(li)&&(b=y.slice(1),S=!0);const w=S&&y.startsWith(li)?li.length:0,k=g&&g>h?g-h-w:void 0;return Zy(f,S,b,k)};if(r){const d=r+Xy,f=o;o=m=>m.startsWith(d)?f(m.slice(d.length)):Zy(Hk,!1,m,void 0,!0)}if(i){const d=o;o=f=>i({className:f,parseClassName:d})}return o},Bk=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((i,o)=>{r.set(i,1e6+o)}),i=>{const o=[];let d=[];for(let f=0;f<i.length;f++){const m=i[f],p=m[0]==="[",h=r.has(m);p||h?(d.length>0&&(d.sort(),o.push(...d),d=[]),o.push(m)):d.push(m)}return d.length>0&&(d.sort(),o.push(...d)),o}},Qk=n=>({cache:qk(n.cacheSize),parseClassName:$k(n),sortModifiers:Bk(n),postfixLookupClassGroupIds:Fk(n),...Tk(n)}),Fk=n=>{const r=Object.create(null),i=n.postfixLookupClassGroups;if(i)for(let o=0;o<i.length;o++)r[i[o]]=!0;return r},Pk=/\s+/,Kk=(n,r)=>{const{parseClassName:i,getClassGroupId:o,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:m}=r,p=[],h=n.trim().split(Pk);let g="";for(let v=h.length-1;v>=0;v-=1){const y=h[v],{isExternal:b,modifiers:S,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:_}=i(y);if(b){g=y+(g.length>0?" "+g:g);continue}let A=!!_,C;if(A){const Z=k.substring(0,_);C=o(Z);const Q=C&&m[C]?o(k):void 0;Q&&Q!==C&&(C=Q,A=!1)}else C=o(k);if(!C){if(!A){g=y+(g.length>0?" "+g:g);continue}if(C=o(k),!C){g=y+(g.length>0?" "+g:g);continue}A=!1}const B=S.length===0?"":S.length===1?S[0]:f(S).join(":"),V=w?B+li:B,F=V+C;if(p.indexOf(F)>-1)continue;p.push(F);const U=d(C,A);for(let Z=0;Z<U.length;++Z){const Q=U[Z];p.push(V+Q)}g=y+(g.length>0?" "+g:g)}return g},Yk=(...n)=>{let r=0,i,o,d="";for(;r<n.length;)(i=n[r++])&&(o=qj(i))&&(d&&(d+=" "),d+=o);return d},qj=n=>{if(typeof n=="string")return n;let r,i="";for(let o=0;o<n.length;o++)n[o]&&(r=qj(n[o]))&&(i&&(i+=" "),i+=r);return i},Gk=(n,...r)=>{let i,o,d,f;const m=h=>{const g=r.reduce((v,y)=>y(v),n());return i=Qk(g),o=i.cache.get,d=i.cache.set,f=p,p(h)},p=h=>{const g=o(h);if(g)return g;const v=Kk(h,i);return d(h,v),v};return f=m,(...h)=>f(Yk(...h))},Vk=[],Et=n=>{const r=i=>i[n]||Vk;return r.isThemeGetter=!0,r.themeKey=n,r},Hj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,$j=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Xk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Zk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ik=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|Q|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^--spacing\(.+\)|^0$/,Bj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark|contrast-color|device-cmyk|--alpha)\(.+\)$/i,Jk=/^(?:_*[+-]?(?:\d|\.\d)|[\w-]+\(|_*(?:inherit|initial|revert(?:-layer)?|unset)_*$)/i,Wk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,eE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,as=n=>Xk.test(n),Le=n=>!!n&&!Number.isNaN(Number(n)),la=n=>!!n&&Number.isInteger(Number(n)),Sf=n=>n.endsWith("%")&&Le(n.slice(0,-1)),wa=n=>Zk.test(n),Qj=()=>!0,tE=n=>Ik.test(n)&&!Bj.test(n),nE=n=>Jk.test(n)&&!Bj.test(n),qm=()=>!1,aE=n=>Wk.test(n),sE=n=>eE.test(n),rE=n=>!oe(n)&&!ue(n),lE=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),iE=n=>Ea(n,Kj,qm),oe=n=>Hj.test(n),Ms=n=>Ea(n,Yj,tE),oE=n=>Ea(n,Gj,nE),cE=n=>Ea(n,vE,Le),uE=n=>Ea(n,Xj,Qj),dE=n=>Ea(n,Vj,qm),fE=n=>Ea(n,Fj,qm),mE=n=>Ea(n,Pj,sE),Vo=n=>Ea(n,Zj,aE),ue=n=>$j.test(n),Fr=n=>os(n,Yj),hE=n=>os(n,Gj,!0),xE=n=>os(n,Vj),Iy=n=>os(n,Fj),pE=n=>os(n,Kj),gE=n=>os(n,Pj),Xo=n=>os(n,Zj,!0),yE=n=>os(n,Xj,!0),Ea=(n,r,i)=>{const o=Hj.exec(n);return o?o[1]?r(o[1]):i(o[2]):!1},os=(n,r,i=!1)=>{const o=$j.exec(n);return o?o[1]?r(o[1]):i:!1},Fj=n=>n==="position"||n==="percentage",Pj=n=>n==="image"||n==="url",Kj=n=>n==="length"||n==="size"||n==="bg-size",Yj=n=>n==="length",Gj=n=>n!=="color",vE=n=>n==="number",Vj=n=>n==="family-name",Xj=n=>n==="number"||n==="weight",Zj=n=>n==="shadow",bE=()=>{const n=Et("color"),r=Et("font"),i=Et("text"),o=Et("font-weight"),d=Et("tracking"),f=Et("leading"),m=Et("breakpoint"),p=Et("container"),h=Et("spacing"),g=Et("radius"),v=Et("shadow"),y=Et("inset-shadow"),b=Et("text-shadow"),S=Et("drop-shadow"),w=Et("blur"),k=Et("perspective"),_=Et("aspect"),A=Et("ease"),C=Et("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...V(),ue,oe],U=()=>["auto","hidden","clip","visible","scroll"],Z=()=>["auto","contain","none"],Q=()=>[ue,oe,h],xe=()=>[as,"full","auto",...Q()],he=()=>[la,"none","subgrid",ue,oe],Ne=()=>["auto",{span:["full",la,ue,oe]},la,ue,oe],Ae=()=>[la,"auto",ue,oe],ee=()=>["auto","min","max","fr",ue,oe],ze=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ee=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...Q()],Y=()=>[as,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],re=()=>[p,as,"screen","full","dvw","lvw","svw","min","max","fit",...Q()],He=()=>[as,"screen","full","lh","dvh","lvh","svh","min","max","fit",...Q()],W=()=>[n,ue,oe],X=()=>[...V(),Iy,fE,{position:[ue,oe]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",pE,iE,{size:[ue,oe]}],T=()=>[Sf,Fr,Ms],q=()=>["","none","full",g,ue,oe],ae=()=>["",Le,Fr,Ms],fe=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[Le,Sf,hE,oE],ke=()=>["","none",w,ue,oe],ce=()=>["none",Le,ue,oe],ve=()=>["none",Le,ue,oe],Ot=()=>[Le,ue,oe],Mn=()=>[as,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wa],breakpoint:[wa],color:[Qj],container:[wa],"drop-shadow":[wa],ease:["in","out","in-out"],font:[rE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wa],shadow:[wa],spacing:["px",Le],text:[wa],"text-shadow":[wa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",as,oe,ue,_]}],container:["container"],"container-type":[{"@container":["","normal","size",ue,oe]}],"container-named":[lE],columns:[{columns:[Le,"auto",oe,ue,p]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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":["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:F()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:xe()}],"inset-x":[{"inset-x":xe()}],"inset-y":[{"inset-y":xe()}],start:[{"inset-s":xe(),start:xe()}],end:[{"inset-e":xe(),end:xe()}],"inset-bs":[{"inset-bs":xe()}],"inset-be":[{"inset-be":xe()}],top:[{top:xe()}],right:[{right:xe()}],bottom:[{bottom:xe()}],left:[{left:xe()}],visibility:["visible","invisible","collapse"],z:[{z:[la,"auto",ue,oe]}],basis:[{basis:[as,"full","auto",p,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,as,"auto","initial","none",ue,oe]}],grow:[{grow:["",Le,ue,oe]}],shrink:[{shrink:["",Le,ue,oe]}],order:[{order:[la,"first","last","none",ue,oe]}],"grid-cols":[{"grid-cols":he()}],"col-start-end":[{col:Ne()}],"col-start":[{"col-start":Ae()}],"col-end":[{"col-end":Ae()}],"grid-rows":[{"grid-rows":he()}],"row-start-end":[{row:Ne()}],"row-start":[{"row-start":Ae()}],"row-end":[{"row-end":Ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...ze(),"normal"]}],"justify-items":[{"justify-items":[...Ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ee()]}],"align-content":[{content:["normal",...ze()]}],"align-items":[{items:[...Ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":ze()}],"place-items":[{"place-items":[...Ee(),"baseline"]}],"place-self":[{"place-self":["auto",...Ee()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pbs:[{pbs:Q()}],pbe:[{pbe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...He()]}],"min-block-size":[{"min-block":["auto",...He()]}],"max-block-size":[{"max-block":["none",...He()]}],w:[{w:[p,"screen",...Y()]}],"min-w":[{"min-w":[p,"screen","none",...Y()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh","none",...Y()]}],"font-size":[{text:["base",i,Fr,Ms]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,yE,uE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Sf,oe]}],"font-family":[{font:[xE,dE,r]}],"font-features":[{"font-features":[oe]}],"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:[d,ue,oe]}],"line-clamp":[{"line-clamp":[Le,"none",ue,oe]}],leading:[{leading:["none",f,...Q()]}],"list-image":[{"list-image":["none",ue,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ue,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",Fr,Iy,Ms]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Le,"auto",ue,oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"tab-size":[{tab:[la,ue,oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ue,oe]}],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",ue,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},la,ue,oe],radial:["",ue,oe],conic:["",la,ue,oe]},gE,mE]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:T()}],"gradient-via-pos":[{via:T()}],"gradient-to-pos":[{to:T()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,ue,oe]}],"outline-w":[{outline:["",Le,Fr,Ms]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","inner","none",v,Xo,Vo]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",y,Xo,Vo]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Le,Ms]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",b,Xo,Vo]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Le,ue,oe]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"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":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ue,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{mask:["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":V()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ue,oe]}],filter:[{filter:["","none",ue,oe]}],blur:[{blur:ke()}],brightness:[{brightness:[Le,ue,oe]}],contrast:[{contrast:[Le,ue,oe]}],"drop-shadow":[{"drop-shadow":["","none",S,Xo,Vo]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Le,ue,oe]}],"hue-rotate":[{"hue-rotate":[Le,ue,oe]}],invert:[{invert:["",Le,ue,oe]}],saturate:[{saturate:[Le,ue,oe]}],sepia:[{sepia:["",Le,ue,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",ue,oe]}],"backdrop-blur":[{"backdrop-blur":ke()}],"backdrop-brightness":[{"backdrop-brightness":[Le,ue,oe]}],"backdrop-contrast":[{"backdrop-contrast":[Le,ue,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,ue,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,ue,oe]}],"backdrop-invert":[{"backdrop-invert":["",Le,ue,oe]}],"backdrop-opacity":[{"backdrop-opacity":[Le,ue,oe]}],"backdrop-saturate":[{"backdrop-saturate":[Le,ue,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,ue,oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ue,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",ue,oe]}],ease:[{ease:["linear","initial",A,ue,oe]}],delay:[{delay:[Le,ue,oe]}],animate:[{animate:["none",C,ue,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,ue,oe]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:Ot()}],"skew-x":[{"skew-x":Ot()}],"skew-y":[{"skew-y":Ot()}],transform:[{transform:[ue,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Mn()}],"translate-x":[{"translate-x":Mn()}],"translate-y":[{"translate-y":Mn()}],"translate-z":[{"translate-z":Mn()}],"translate-none":["translate-none"],zoom:[{zoom:[la,ue,oe]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ue,oe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mbs":[{"scroll-mbs":Q()}],"scroll-mbe":[{"scroll-mbe":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pbs":[{"scroll-pbs":Q()}],"scroll-pbe":[{"scroll-pbe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",ue,oe]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Le,Fr,Ms,cE]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],"place-content":["align-content","justify-content"],"place-items":["align-items","justify-items"],"place-self":["align-self","justify-self"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"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"],sr:["not-sr","position","size","w","h","p","px","py","ps","pe","pbs","pbe","pt","pr","pb","pl","m","mx","my","ms","me","mbs","mbe","mt","mr","mb","ml","overflow","overflow-x","overflow-y","whitespace"],"not-sr":["sr"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],"mask-image-x-from-pos":["mask-image-r-from-pos","mask-image-l-from-pos"],"mask-image-x-to-pos":["mask-image-r-to-pos","mask-image-l-to-pos"],"mask-image-x-from-color":["mask-image-r-from-color","mask-image-l-from-color"],"mask-image-x-to-color":["mask-image-r-to-color","mask-image-l-to-color"],"mask-image-y-from-pos":["mask-image-t-from-pos","mask-image-b-from-pos"],"mask-image-y-to-pos":["mask-image-t-to-pos","mask-image-b-to-pos"],"mask-image-y-from-color":["mask-image-t-from-color","mask-image-b-from-color"],"mask-image-y-to-color":["mask-image-t-to-color","mask-image-b-to-color"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jE=Gk(bE);function qe(...n){return jE(Mj(n))}const NE=[{mode:"light",label:"Light theme",icon:pk},{mode:"system",label:"System theme",icon:lk},{mode:"dark",label:"Dark theme",icon:ik}];function Ij({className:n}){const[r,i]=_k();return a.jsx("div",{role:"radiogroup","aria-label":"Theme",className:qe("inline-flex items-center gap-0.5 rounded-md border border-border bg-background p-0.5",n),children:NE.map(({mode:o,label:d,icon:f})=>a.jsx("button",{type:"button",role:"radio","aria-checked":r===o,title:d,onClick:()=>i(o),className:qe("flex h-6 w-6 items-center justify-center rounded-sm transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",r===o?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"),children:a.jsx(f,{size:14,strokeWidth:1.5,"aria-hidden":"true"})},o))})}const Jy=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Wy=Mj,Hm=(n,r)=>i=>{var o;if(r?.variants==null)return Wy(n,i?.class,i?.className);const{variants:d,defaultVariants:f}=r,m=Object.keys(d).map(g=>{const v=i?.[g],y=f?.[g];if(v===null)return null;const b=Jy(v)||Jy(y);return d[g][b]}),p=i&&Object.entries(i).reduce((g,v)=>{let[y,b]=v;return b===void 0||(g[y]=b),g},{}),h=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((g,v)=>{let{class:y,className:b,...S}=v;return Object.entries(S).every(w=>{let[k,_]=w;return Array.isArray(_)?_.includes({...f,...p}[k]):{...f,...p}[k]===_})?[...g,y,b]:g},[]);return Wy(n,m,h,i?.class,i?.className)},wE=Hm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-[15px] font-medium transition-[color,background-color,border-color,box-shadow] duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/85 disabled:bg-sunken disabled:text-muted-foreground",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:bg-sunken disabled:text-muted-foreground",outline:"border border-input bg-transparent text-foreground hover:bg-secondary disabled:text-muted-foreground disabled:border-border",secondary:"bg-secondary text-secondary-foreground border border-border hover:bg-sunken disabled:text-muted-foreground",ghost:"text-muted-foreground hover:bg-secondary hover:text-foreground disabled:text-subtle-foreground",link:"text-accent-text underline-offset-4 hover:underline disabled:text-muted-foreground disabled:no-underline"},size:{default:"h-9 px-4",sm:"h-8 px-3 text-[14px]",lg:"h-10 px-6",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),H=j.forwardRef(({className:n,variant:r,size:i,...o},d)=>a.jsx("button",{className:qe(wE({variant:r,size:i,className:n})),ref:d,...o}));H.displayName="Button";const I=j.forwardRef(({className:n,type:r="text",...i},o)=>a.jsx("input",{type:r,ref:o,className:qe("flex h-9 w-full rounded-md border border-input bg-background px-3 text-[15px] text-foreground transition-[border-color,box-shadow] duration-(--dur-fast) placeholder:text-subtle-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:border-border disabled:bg-sunken disabled:text-muted-foreground",n),...i}));I.displayName="Input";function SE(){return a.jsxs("div",{className:"relative hidden w-[44%] flex-col justify-between border-r border-border bg-sunken p-12 lg:flex",children:[a.jsx(lc,{markSize:26}),a.jsxs("div",{children:[a.jsxs("svg",{width:"150",height:"24",viewBox:"0 0 150 24",fill:"none","aria-hidden":"true",className:"mb-8",children:[a.jsx("circle",{cx:"4",cy:"12",r:"3",className:"fill-accent"}),a.jsx("path",{d:"M16 12 H128",className:"stroke-border-strong",strokeWidth:"1.5",strokeDasharray:"1 6",strokeLinecap:"round"}),a.jsx("circle",{cx:"139",cy:"12",r:"6",className:"stroke-accent",strokeWidth:"2"})]}),a.jsxs("p",{className:"font-display text-[40px] font-bold leading-[46px] tracking-[-0.02em] text-foreground",children:["Lifecycle email,",a.jsx("br",{}),"compiled."]}),a.jsx("p",{className:"mt-4 max-w-[320px] text-[15px] leading-relaxed text-muted-foreground",children:"Describe the flow in plain language. Claros compiles it into a deterministic plan, drafts the emails, and waits for your approval."})]}),a.jsx("p",{className:"text-[13px] text-subtle-foreground",children:"Open-source lifecycle email for SaaS."})]})}function _E(){const[n,r]=j.useState(""),[i,o]=j.useState(!1),[d,f]=j.useState(null),[m]=km(),p=T4(),[h]=j.useState(()=>{try{const b=sessionStorage.getItem("claros-session-expired");return b&&sessionStorage.removeItem("claros-session-expired"),b==="1"}catch{return!1}}),g=m.get("error")==="invalid_link"?"That login link was invalid or has expired. Please request a new one.":null,v=d??g;async function y(b){b.preventDefault(),f(null);try{await p.mutateAsync(n.trim()),o(!0)}catch(S){f(S instanceof Error?S.message:"Something went wrong. Please try again.")}}return a.jsxs("div",{className:"flex h-full min-h-screen overflow-y-auto overscroll-contain bg-background",children:[a.jsx(SE,{}),a.jsxs("div",{className:"relative flex flex-1 items-center justify-center p-6",children:[a.jsx(Ij,{className:"absolute right-6 top-6"}),a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsx("div",{className:"mb-10 lg:hidden",children:a.jsx(lc,{markSize:24})}),i?a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold tracking-[-0.015em] text-foreground",children:"Check your inbox"}),a.jsxs("p",{className:"mt-3 text-[15px] leading-relaxed text-muted-foreground",children:["A login link has been sent to"," ",a.jsx("strong",{className:"font-medium text-foreground",children:n}),". Click it to sign in. The link expires in 10 minutes."]}),a.jsxs("p",{className:"mt-6 text-[15px] text-muted-foreground",children:["No email? Check your spam folder, or"," ",a.jsx("button",{className:"cursor-pointer border-none bg-transparent p-0 text-[15px] text-accent-text underline underline-offset-4",onClick:()=>{o(!1),f(null)},children:"try again"}),"."]})]}):a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold tracking-[-0.015em] text-foreground",children:"Sign in"}),a.jsx("p",{className:"mt-2 text-[15px] text-muted-foreground",children:"Enter your email to receive a login link."}),h&&!v&&a.jsx("p",{className:"mt-6 rounded-md border border-border bg-secondary px-3.5 py-2.5 text-[15px] text-foreground",role:"status",children:"Your session has expired. Sign in again to continue."}),v&&a.jsx("p",{className:"mt-6 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5 text-[15px] text-foreground",role:"alert",children:v}),a.jsxs("form",{onSubmit:y,noValidate:!0,className:"mt-8",children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",htmlFor:"email",children:"Email"}),a.jsx(I,{id:"email",type:"email",autoComplete:"email",required:!0,value:n,onChange:b=>r(b.target.value),disabled:p.isPending,placeholder:"you@example.com"}),a.jsx(H,{type:"submit",className:"mt-4 w-full",disabled:p.isPending||n.trim().length===0,children:p.isPending?"Sending...":"Send login link"})]})]})]})]})]})}const Zf=["products"];function pi(){return Ye({queryKey:Zf,queryFn:v4,staleTime:6e4})}const Oe=j.forwardRef(({className:n,children:r,...i},o)=>a.jsxs("div",{className:"relative",children:[a.jsx("select",{ref:o,className:qe("flex h-9 w-full appearance-none rounded-md border border-input bg-background pl-3 pr-9 text-[15px] text-foreground transition-[border-color,box-shadow] duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:border-border disabled:bg-sunken disabled:text-muted-foreground",n),...i,children:r}),a.jsx(Om,{size:16,strokeWidth:1.5,"aria-hidden":"true",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground"})]}));Oe.displayName="Select";function kE({currentProductId:n}){const{data:r}=pi();if(!r||r.products.length<=1)return null;const i=r.products.find(o=>o.id===n);return a.jsxs("div",{className:"px-3 pb-3",children:[a.jsx("label",{htmlFor:"product-switcher",className:"mb-1 block px-3 text-[11px] font-semibold uppercase tracking-[0.06em] text-subtle-foreground",children:"Product"}),a.jsxs(Oe,{id:"product-switcher",value:i?.slug??"",onChange:o=>vb(o.target.value),className:"h-8 text-[14px]",children:[!i&&a.jsx("option",{value:"",children:"Select a product"}),r.products.map(o=>a.jsx("option",{value:o.slug,children:o.archived?`${o.name} (archived)`:o.name},o.id))]})]})}const EE=[{label:"Home",path:"/home",icon:J4,enabled:!0},{label:"Integrate",path:"/integrate",icon:uk,enabled:!0},{label:"Flows",path:"/flows",icon:Ej,enabled:!0},{label:"Lifecycle",path:"/lifecycle",icon:Am,enabled:!0},{label:"People",path:"/people",icon:Dm,enabled:!0},{label:"Approvals",path:"/approvals",icon:zm,enabled:!0},{label:"Sent Mail",path:"/sent",icon:Bs,enabled:!0},{label:"Knowledge Base",path:"/kb",icon:Rm,enabled:!0},{label:"Analytics",path:"/analytics",icon:Y4,enabled:!0},{label:"Settings",path:"/settings",icon:fk,enabled:!0}];function CE({me:n}){const r=A4(),i=zn(),[o,d]=j.useState(!1);j.useEffect(()=>{d(!1)},[i.pathname]),j.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]);const f=j.useCallback(()=>d(!1),[]);function m(){r.mutate(void 0,{onSuccess:()=>{window.location.href="/login"}})}const p=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between px-6",children:[a.jsx(lc,{markSize:26}),a.jsx("button",{type:"button",onClick:f,"aria-label":"Close menu",className:"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors duration-(--dur-fast) hover:bg-secondary hover:text-foreground lg:hidden",children:a.jsx(wc,{size:20,strokeWidth:1.5})})]}),a.jsx(kE,{currentProductId:n.user.tenantId}),a.jsx("nav",{className:"flex-1 space-y-0.5 overflow-y-auto px-3 py-3",children:EE.map(h=>{const g=h.icon;return h.enabled?a.jsxs(_m,{to:h.path,className:({isActive:v})=>["flex items-center gap-3 rounded-md px-3 py-2 text-[14px] transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",v?"bg-selected font-semibold text-foreground":"font-medium text-muted-foreground hover:bg-sunken hover:text-foreground"].join(" "),children:[a.jsx(g,{size:16,strokeWidth:1.75}),h.label]},h.path):a.jsxs("span",{"aria-disabled":"true",className:"flex items-center gap-3 rounded-md px-3 py-2 text-[14px] text-subtle-foreground select-none",children:[a.jsx(g,{size:16,strokeWidth:1.75}),h.label]},h.path)})}),a.jsxs("div",{className:"shrink-0 border-t border-border px-3 py-3",children:[a.jsxs("div",{className:"flex items-center justify-between px-1 pb-2",children:[a.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Theme"}),a.jsx(Ij,{})]}),a.jsxs("div",{className:"flex items-center gap-1 rounded-md px-1 py-1",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-[14px] text-muted-foreground",title:n.user.email,children:n.user.email}),a.jsx("button",{type:"button",onClick:m,disabled:r.isPending,title:r.isPending?"Signing out...":"Sign out","aria-label":"Sign out",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors duration-(--dur-fast) hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:text-subtle-foreground",children:a.jsx(nk,{size:16,strokeWidth:1.5})})]})]})]});return a.jsxs("div",{className:"flex h-full min-h-0 bg-background text-foreground",children:[a.jsx("aside",{className:"hidden w-60 flex-col bg-sunken lg:flex",children:p}),o&&a.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-foreground/20",onClick:f,"aria-hidden":"true"}),a.jsx("aside",{className:"relative flex w-72 max-w-[85vw] flex-col bg-sunken shadow-overlay",children:p})]}),a.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-4 lg:hidden",children:[a.jsx("button",{type:"button",onClick:()=>d(!0),"aria-label":"Open menu",className:"flex h-9 w-9 items-center justify-center rounded-md text-foreground transition-colors duration-(--dur-fast) hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(sk,{size:20,strokeWidth:1.5})}),a.jsx(lc,{markSize:22})]}),a.jsx("main",{className:"flex-1 min-h-0 min-w-0 overflow-x-hidden overflow-y-auto overscroll-contain px-4 py-6 sm:px-6 sm:py-7 lg:px-8 lg:py-8",children:a.jsx(pb,{})})]})]})}function Zt({eyebrow:n,title:r,subtitle:i,actions:o}){return a.jsxs("div",{className:"mb-8 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between sm:gap-6",children:[a.jsxs("div",{className:"min-w-0",children:[n&&a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.06em] text-accent-text",children:n}),a.jsx("h1",{className:"mt-1 font-display text-[24px] leading-[30px] font-bold tracking-[-0.02em] text-foreground sm:text-[28px] sm:leading-[34px]",children:r}),i&&a.jsx("p",{className:"mt-2 text-[14px] leading-[22px] text-muted-foreground",children:i})]}),o&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:o})]})}const TE=Hm("inline-flex h-6 items-center gap-1.5 rounded-full px-2.5 text-[13px] font-medium",{variants:{variant:{accent:"bg-accent-soft text-accent-text",neutral:"bg-sunken text-muted-foreground",muted:"bg-sunken text-subtle-foreground",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger"}},defaultVariants:{variant:"neutral"}}),AE=Hm("h-1.5 w-1.5 shrink-0 rounded-full",{variants:{variant:{accent:"bg-accent",neutral:"bg-muted-foreground",muted:"bg-subtle-foreground",success:"bg-success",warning:"bg-warning",danger:"bg-danger"}},defaultVariants:{variant:"neutral"}});function le({className:n,variant:r="neutral",pulse:i=!1,children:o,...d}){return a.jsxs("span",{className:qe(TE({variant:r}),n),...d,children:[a.jsx("span",{"aria-hidden":"true",className:qe(AE({variant:r}),i&&"animate-pulse")}),o]})}function se({className:n,...r}){return a.jsx("div",{className:qe("animate-pulse rounded-md bg-skeleton",n),...r})}const ia=["flows"];function Fs(n){return["flows",n]}function Ps(){return Ye({queryKey:ia,queryFn:s_})}function RE(n){return Ye({queryKey:Fs(n),queryFn:()=>r_(n),staleTime:0,refetchInterval:r=>r.state.data?.compile_status==="pending"?3e3:!1})}function OE(){const n=_e();return pe({mutationFn:r=>i_(r),onSuccess:()=>{n.invalidateQueries({queryKey:ia})}})}function zE(){return Ye({queryKey:["events","names"],queryFn:l_,staleTime:6e4})}function Sc(n){const r=_e();return pe({mutationFn:i=>Tm(n,i),onSuccess:()=>{r.invalidateQueries({queryKey:ia}),r.invalidateQueries({queryKey:Fs(n)})}})}function ME(n){const r=_e();return pe({mutationFn:()=>o_(n),onSuccess:()=>{r.invalidateQueries({queryKey:Fs(n)})}})}function DE(n){const r=_e();return pe({mutationFn:i=>Tm(n,{status:i}),onSuccess:()=>{r.invalidateQueries({queryKey:ia}),r.invalidateQueries({queryKey:Fs(n)})}})}function LE(n){const r=_e();return pe({mutationFn:()=>c_(n),onSuccess:()=>{r.invalidateQueries({queryKey:ia}),r.invalidateQueries({queryKey:Fs(n)})}})}function UE(n){const r=_e();return pe({mutationFn:i=>u_(n,i),onSuccess:()=>{r.invalidateQueries({queryKey:ia}),r.invalidateQueries({queryKey:Fs(n)})}})}function qE(n){const r=_e();return pe({mutationFn:i=>d_(n,i),onSuccess:()=>{r.invalidateQueries({queryKey:ia}),r.invalidateQueries({queryKey:Fs(n)})}})}const Jj=["settings","transport"],$m=["settings","llm"],Bm=["settings","tenant"],HE=["templates"];function $E(){return Ye({queryKey:$m,queryFn:jb})}function BE(){const n=_e();return pe({mutationFn:r=>H_(r),onSuccess:()=>{n.invalidateQueries({queryKey:$m})}})}function Wj(){const n=_e();return pe({mutationFn:r=>B_(r),onSuccess:()=>{n.invalidateQueries({queryKey:Bm})}})}function QE(){return pe({mutationFn:n=>Q_(n)})}const e1=["settings","throttle"];function FE(){return Ye({queryKey:e1,queryFn:F_})}function PE(){const n=_e();return pe({mutationFn:r=>P_(r),onSuccess:()=>{n.invalidateQueries({queryKey:e1})}})}function KE(){return Ye({queryKey:HE,queryFn:K_})}function YE(){const n=_e();return pe({mutationFn:r=>Y_(r),onSuccess:()=>{n.invalidateQueries({queryKey:ia}),n.invalidateQueries({queryKey:Bm})}})}function ll(){const[n,r,i]=yS({queries:[{queryKey:$m,queryFn:jb},{queryKey:Jj,queryFn:A_},{queryKey:Bm,queryFn:$_}]}),o=n.isLoading||r.isLoading||i.isLoading,d=n.isError||r.isError||i.isError,f={llm:n.data?.llm!==null&&n.data!==void 0,transport:r.data?.transport!==null&&r.data!==void 0,postalAddress:i.data!==void 0&&(i.data.tenant.postal_address??"")!==""};return{isLoading:o,isError:d,checks:f,complete:f.llm&&f.transport&&f.postalAddress,llm:n.data?.llm??null,transport:r.data?.transport??null,tenant:i.data?.tenant??null}}const _c=["ingestion","keys"],GE=["ingestion","status"];function t1(){return Ye({queryKey:_c,queryFn:W_})}function n1(){const n=_e();return pe({mutationFn:r=>e4(r),onSuccess:()=>{n.invalidateQueries({queryKey:_c})}})}function VE(){const n=_e();return pe({mutationFn:({id:r,...i})=>t4(r,i),onSuccess:()=>{n.invalidateQueries({queryKey:_c})}})}function XE(){const n=_e();return pe({mutationFn:r=>n4(r),onSuccess:()=>{n.invalidateQueries({queryKey:_c})}})}function kc(n){return Ye({queryKey:GE,queryFn:a4,refetchInterval:n?3e3:!1})}const ZE=["diagnostics"],a1=["library"],IE=["home","pending"],JE=["home","failed"],WE=["home","sending"],e3=["home","lifecycle"];function t3(){return Ye({queryKey:ZE,queryFn:s4,staleTime:6e4})}function n3(){return Ye({queryKey:a1,queryFn:r4})}function a3(){const n=_e();return pe({mutationFn:()=>l4(),onSuccess:()=>{n.invalidateQueries({queryKey:ia}),n.invalidateQueries({queryKey:a1})}})}function s3(){return Ye({queryKey:IE,queryFn:()=>sl(void 0,"pending_approval"),refetchInterval:3e4})}function r3(){return Ye({queryKey:JE,queryFn:()=>sl(void 0,"failed"),refetchInterval:3e4})}function l3(){return Ye({queryKey:WE,queryFn:async()=>{const[n,r]=await Promise.all([Gf(7),Gf(14)]);return{current:n,prior:r}},staleTime:6e4})}function i3(){return Ye({queryKey:e3,queryFn:()=>Nb(7),staleTime:6e4})}function o3({check:n}){return a.jsxs("li",{className:"flex items-start gap-3 py-2.5",children:[a.jsx("span",{"aria-hidden":"true",className:qe("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",n.done?"border-success bg-success-soft text-success":"border-border-strong"),children:n.done&&a.jsx(rl,{size:12,strokeWidth:2.5})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:qe("text-[14px] leading-[20px]",n.done?"text-muted-foreground":"text-foreground"),children:n.label}),n.fixLocation==="env"&&!n.done&&a.jsx("span",{className:"rounded bg-sunken px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:"env file"})]}),a.jsx("p",{className:"mt-0.5 text-[13px] leading-[18px] text-muted-foreground",children:n.reason}),!n.done&&n.linkTo&&a.jsx($e,{to:n.linkTo,className:"mt-1 inline-block text-[13px] text-accent-text underline underline-offset-4",children:n.linkLabel})]})]})}function _f({title:n,description:r,checks:i,defaultOpen:o,prominent:d}){const f=i.every(g=>g.done),m=i.filter(g=>g.done).length,[p,h]=j.useState(o??!f);return a.jsxs("div",{className:qe("rounded-lg border bg-card",d&&!f?"border-border-strong":"border-border"),children:[a.jsxs("button",{type:"button",onClick:()=>h(!p),className:"flex w-full items-center justify-between px-5 py-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset rounded-lg",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("h3",{className:qe("text-[15px] text-foreground",d?"font-semibold":"font-medium"),children:n}),f?a.jsx(le,{variant:"success",children:"Done"}):a.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[m,"/",i.length]})]}),a.jsx("p",{className:"mt-0.5 text-[13px] text-muted-foreground",children:r})]}),a.jsx("span",{className:"ml-3 shrink-0 text-muted-foreground",children:p?a.jsx(Om,{size:16}):a.jsx(Ub,{size:16})})]}),p&&a.jsx("div",{className:"border-t border-border px-5 pb-4 pt-2",children:a.jsx("ul",{children:i.map(g=>a.jsx(o3,{check:g},g.key))})})]})}function c3({hasActiveFlow:n,hasTransport:r}){const i=n3(),o=a3(),d=Ps(),[f,m]=j.useState(!1),p=i.data?.flows[0],h=d.data?.flows.some(b=>b.source==="library"&&b.name==="Welcome Onboarding"),g=d.data?.flows.find(b=>b.source==="library"&&b.name==="Welcome Onboarding"),v=g?.status==="active";function y(){o.mutate(void 0)}return i.isLoading?a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx(se,{className:"h-5 w-48"}),a.jsx(se,{className:"mt-2 h-4 w-80"})]}):p?a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("div",{className:"flex items-start justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Mm,{size:16,className:"text-accent-text"}),a.jsx("h3",{className:"text-[15px] font-medium text-foreground",children:p.name}),v&&a.jsx(le,{variant:"success",children:"Active"}),h&&!v&&a.jsx(le,{variant:"neutral",children:"Installed"})]}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:p.description}),a.jsxs("p",{className:"mt-2 text-[13px] text-muted-foreground",children:[p.emails," emails over 3 days, triggered by a"," ",a.jsx("code",{className:"rounded bg-sunken px-1 py-0.5 font-mono text-[12px]",children:p.trigger})," ","event. No LLM required."]})]})}),a.jsxs("div",{className:"mt-4",children:[a.jsxs("button",{type:"button",onClick:()=>m(!f),className:"flex items-center gap-1.5 text-[13px] text-accent-text hover:underline",children:[f?a.jsx(Om,{size:14}):a.jsx(Ub,{size:14}),f?"Hide emails":"Preview the emails"]}),f&&a.jsx("div",{className:"mt-3 space-y-3",children:p.templates.map((b,S)=>a.jsxs("div",{className:"rounded-md border border-border bg-background p-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-sunken text-[11px] font-medium text-muted-foreground",children:S+1}),a.jsx("span",{className:"text-[14px] font-medium text-foreground",children:b.name}),a.jsx("span",{className:"text-[12px] text-muted-foreground",children:S===0?"Immediate":S===1?"After 1 day":"After 3 days"})]}),a.jsxs("p",{className:"mt-1.5 pl-7 text-[13px] text-muted-foreground",children:["Subject: ",b.subject]})]},b.slug))})]}),a.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[!h&&a.jsx(H,{size:"sm",variant:"outline",onClick:y,disabled:o.isPending,children:o.isPending?"Installing...":"Install flow"}),h&&!v&&a.jsx($e,{to:`/flows/${g.id}/edit`,children:a.jsx(H,{size:"sm",children:"Review and activate"})}),v&&!r&&a.jsx("p",{className:"text-[13px] text-warning",children:"Flow is active but no transport is configured - emails cannot be delivered yet."}),v&&r&&a.jsx("p",{className:"text-[13px] text-success",children:"Active and ready to send when a contact fires the trigger event."})]}),o.isError&&a.jsx("p",{className:"mt-3 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5 text-[13px] text-foreground",children:o.error instanceof Error?o.error.message:"Install failed."})]}):null}function Pr({icon:n,tone:r,title:i,description:o,linkTo:d,linkLabel:f,badge:m}){const p={accent:"bg-accent-soft text-accent-text",danger:"bg-danger-soft text-danger",warning:"bg-warning-soft text-warning",pop:"bg-pop-soft text-pop-text"};return a.jsxs($e,{to:d,className:"group flex items-start gap-4 rounded-lg border border-border bg-card p-5 transition-colors duration-(--dur-fast) hover:bg-secondary",children:[a.jsx("span",{className:qe("flex h-9 w-9 shrink-0 items-center justify-center rounded-md",p[r]),children:a.jsx(n,{size:18,strokeWidth:1.5})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-[14px] font-medium text-foreground",children:i}),m]}),a.jsx("p",{className:"mt-1 text-[13px] leading-[20px] text-muted-foreground",children:o}),a.jsxs("span",{className:"mt-2 inline-flex items-center gap-1 text-[13px] text-accent-text",children:[f,a.jsx(Cb,{size:12,className:"transition-transform duration-(--dur-fast) group-hover:translate-x-0.5"})]})]})]})}function u3({doneCount:n,totalCount:r,onShowSetup:i}){const o=Math.round(n/r*100);return a.jsxs("div",{className:"mb-6 flex flex-col gap-4 rounded-lg border border-border bg-card p-5 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-[15px] font-medium text-foreground",children:"Finish setup"}),a.jsxs("p",{className:"mt-0.5 text-[13px] text-muted-foreground",children:[n," of ",r," requirements met. The remaining items unlock everything this install can do."]}),a.jsx("div",{role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":r,"aria-label":"Setup progress",className:"mt-3 h-1.5 w-full max-w-sm overflow-hidden rounded-full bg-sunken",children:a.jsx("div",{className:"h-full rounded-full bg-accent transition-[width] duration-(--dur-med)",style:{width:`${o}%`}})})]}),a.jsx(H,{className:"shrink-0",onClick:i,children:"Finish setup"})]})}const ev=["Install the library Welcome flow first. It sends real email with no LLM configured, so you can verify the whole pipeline end to end.",'Use window_policy "immediate" for dunning and welcome emails. Delays there cost money; newsletters can wait for the send window.',"Only one nurture-class flow can be active per contact. Splitting onboarding into nurture and critical classes keeps receipts and alerts flowing in parallel.",`Set a flow's reentry_policy to "cooldown" when contacts can legitimately trigger it twice, like a trial that converts then churns and returns.`,"Approvals are the trust layer. Keep auto-approve off until a flow has drafted emails you would sign your name to.","The Knowledge Base is read at draft time. Add your pricing page and cancellation policy so drafts stop inventing answers.","At-risk contacts stopped engaging but have not churned. A short, personal re-engagement flow beats a discount blast.","Critical-class messages bypass the throttle but never fairness. A big tenant cannot starve a small tenant's dunning emails.","Every outgoing email carries List-Unsubscribe headers automatically. Never remove the footer; the drain refuses to send without it.","Rotate ingest keys without downtime: create the new key, deploy it, then revoke the old one from the Integrate page.","Bounces and complaints compound. If this week's count rises above last week's, pause and review content before the next drain cycle.","Flow compile happens at save time, not send time. Fix compile errors early; a failed flow silently stops enrolling contacts."];function d3(){const n=new Date,r=new Date(n.getFullYear(),0,0),i=Math.floor((n.getTime()-r.getTime())/864e5);return ev[i%ev.length]}function tv({icon:n,title:r,description:i,href:o,linkLabel:d}){return a.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:"group rounded-lg border border-border bg-card p-5 transition-colors duration-(--dur-fast) hover:bg-secondary",children:[a.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-accent-soft text-accent-text",children:a.jsx(n,{size:18,strokeWidth:1.5})}),a.jsx("p",{className:"mt-3 text-[14px] font-medium text-foreground",children:r}),a.jsx("p",{className:"mt-1 text-[13px] leading-[20px] text-muted-foreground",children:i}),a.jsxs("span",{className:"mt-2 inline-flex items-center gap-1 text-[13px] text-accent-text",children:[d,a.jsx(F4,{size:12,className:"transition-transform duration-(--dur-fast) group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})]})}function s1(){return a.jsxs("div",{className:"mt-8",children:[a.jsx("h2",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Resources"}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[a.jsx(tv,{icon:Rm,title:"Documentation",description:"Setup guides, the flow model, ingestion API reference, and self-hosting notes.",href:"https://claros.org/docs",linkLabel:"claros.org/docs"}),a.jsx(tv,{icon:rk,title:"Ask the community",description:"Questions, flow recipes, and deliverability war stories from other Claros operators.",href:"https://claros.org/community",linkLabel:"claros.org/community"}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 sm:col-span-2 lg:col-span-1",children:[a.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-accent-soft text-accent-text",children:a.jsx(tk,{size:18,strokeWidth:1.5})}),a.jsx("p",{className:"mt-3 text-[14px] font-medium text-foreground",children:"Tip of the day"}),a.jsx("p",{className:"mt-1 text-[13px] leading-[20px] text-muted-foreground",children:d3()})]})]})]})}function f3({flows:n,onShowSetup:r,setupIncomplete:i,setupDoneCount:o,setupTotalCount:d}){const f=s3(),m=r3(),p=kc(!1),h=l3(),g=i3();if(f.isLoading||m.isLoading||p.isLoading)return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{title:"Home"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(se,{className:"h-20 w-full rounded-lg"}),a.jsx(se,{className:"h-20 w-full rounded-lg"}),a.jsx(se,{className:"h-20 w-full rounded-lg"})]})]});const y=[],b=f.data?.messages.length??0;b>0&&y.push(a.jsx(Pr,{icon:zm,tone:"accent",title:`${b} message${b===1?"":"s"} waiting for approval`,description:"Review and approve to send, or reject to discard.",linkTo:"/approvals",linkLabel:"Approvals",badge:a.jsx(le,{variant:"accent",children:b})},"pending"));const S=m.data?.messages.length??0;if(S>0){const C=m.data.messages.slice(0,3).map(B=>B.brain_reasoning).filter(Boolean)[0]??"Check the Approvals page for details.";y.push(a.jsx(Pr,{icon:$b,tone:"danger",title:`${S} message${S===1?"":"s"} failed`,description:C,linkTo:"/approvals",linkLabel:"Approvals",badge:a.jsx(le,{variant:"danger",children:S})},"failed"))}const w=n.filter(A=>A.compile_status==="failed"&&A.status!=="archived");w.length>0&&y.push(a.jsx(Pr,{icon:Nc,tone:"warning",title:`${w.length} flow${w.length===1?"":"s"} failed to compile`,description:w[0].compile_error??`"${w[0].name}" needs attention.`,linkTo:`/flows/${w[0].id}/edit`,linkLabel:"Flow editor"},"compile-errors"));const k=p.data?.last_event!=null,_=p.data?.events_last_24h??0;if(k&&_===0&&y.push(a.jsx(Pr,{icon:Lm,tone:"warning",title:"No events received in the last 24 hours",description:"Events were arriving before. Check your integration or confirm the source is still sending.",linkTo:"/integrate",linkLabel:"Integrate"},"events-stopped")),h.data){const{current:A,prior:C}=h.data,B=A.totals.bounced+A.totals.complained,V=C.totals.bounced+C.totals.complained-B,F=Math.max(0,V);B>0&&B>F*1.5&&B>=3&&y.push(a.jsx(Pr,{icon:hk,tone:"warning",title:`${B} bounce${B===1?"":"s"}/complaint${B===1?"":"s"} this week`,description:F>0?`Up from ${F} in the prior 7 days. Review sending patterns.`:"New this week. Check email content and recipient quality.",linkTo:"/analytics",linkLabel:"Analytics"},"deliverability"))}if(g.data){const C=g.data.movement.per_state.find(B=>B.state==="at_risk")?.entered??0;C>=3&&y.push(a.jsx(Pr,{icon:Am,tone:"pop",title:`${C} contact${C===1?"":"s"} moved to at-risk this week`,description:"These contacts have stopped engaging. Consider reaching out before they go dormant.",linkTo:"/lifecycle",linkLabel:"Lifecycle"},"at-risk"))}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Overview",title:"Home",subtitle:y.length>0?`${y.length} thing${y.length===1?"":"s"} need${y.length===1?"s":""} attention`:void 0}),i&&a.jsx(u3,{doneCount:o,totalCount:d,onShowSetup:r}),y.length>0?a.jsx("div",{className:"space-y-3",children:y}):a.jsx(m3,{flows:n,eventsLast24h:_,sending:h.data}),a.jsx(s1,{})]})}function m3({flows:n,eventsLast24h:r,sending:i}){const o=n.filter(m=>m.status==="active"),d=o.length,f=i?.current.totals.sent??0;return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border border-border bg-card px-5 py-4",children:a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3",children:[a.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-success-soft text-success",children:a.jsx(rl,{size:14,strokeWidth:2.5})}),a.jsx("p",{className:"text-[14px] font-medium text-foreground",children:"Nothing needs attention"}),a.jsx("span",{className:"text-[13px] text-muted-foreground sm:ml-auto",children:"All systems operating normally."})]})}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[a.jsx(kf,{label:"Active flows",value:d,linkTo:"/flows"}),a.jsx(kf,{label:"Events (24h)",value:r,linkTo:"/integrate"}),a.jsx(kf,{label:"Sent (7d)",value:f,linkTo:"/analytics"})]}),o.length>0&&a.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[a.jsx("div",{className:"border-b border-border px-5 py-3",children:a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Active flows"})}),a.jsx("ul",{children:o.map((m,p)=>a.jsxs("li",{className:qe("flex items-center justify-between px-5 py-3",p<o.length-1&&"border-b border-border"),children:[a.jsxs("div",{children:[a.jsx($e,{to:`/flows/${m.id}/edit`,className:"text-[14px] font-medium text-foreground hover:text-accent-text",children:m.name}),a.jsx("p",{className:"mt-0.5 text-[12px] font-mono text-muted-foreground",children:m.trigger_type==="event"?`on ${String(m.trigger_config.event??"event")}`:m.trigger_type.replace(/_/g," ")})]}),a.jsx(le,{variant:"success",children:"Active"})]},m.id))})]})]})}function kf({label:n,value:r,linkTo:i}){return a.jsxs($e,{to:i,className:"group rounded-lg border border-border bg-card px-4 py-3 transition-colors duration-(--dur-fast) hover:bg-secondary sm:px-5 sm:py-4",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground sm:text-[12px]",children:n}),a.jsxs("div",{className:"mt-2 flex items-end justify-between",children:[a.jsx("p",{className:"font-display text-[22px] font-bold leading-none tracking-[-0.02em] text-foreground sm:text-[28px]",children:r.toLocaleString()}),a.jsx(Cb,{size:14,className:"mb-0.5 text-muted-foreground opacity-0 transition-opacity duration-(--dur-fast) group-hover:opacity-100"})]})]})}function h3({onSkip:n,checks:r}){const i=[{key:"encryption",done:r.encryptionKey,label:"ENCRYPTION_KEY environment variable",reason:"Encrypts transport credentials at rest. Without it the server cannot store or read API keys.",fixLocation:"env"},{key:"signing",done:r.signingKey,label:"UNSUBSCRIBE_SIGNING_KEY environment variable",reason:"Signs unsubscribe tokens. Without it every email would violate RFC 8058.",fixLocation:"env"},{key:"transport",done:r.transport,label:"Email transport (Resend, SES, SMTP)",reason:"The service that delivers approved emails to recipients.",fixLocation:"settings",linkTo:"/settings/transport",linkLabel:"Configure in Settings"},{key:"postal",done:r.postalAddress,label:"Postal address",reason:"Required by CAN-SPAM in every email footer. The drain refuses to send without it.",fixLocation:"settings",linkTo:"/settings/postal",linkLabel:"Set in Settings"}],o=[{key:"llm",done:r.llm,label:"LLM provider (OpenAI, Anthropic, or compatible)",reason:"Compiles prompt-defined flows and drafts personalized emails. Library flows work without this.",fixLocation:"settings",linkTo:"/settings/llm",linkLabel:"Configure in Settings"}],d=[{key:"flow",done:r.activeFlow,label:"At least one active flow",reason:"Flows define what emails get sent and when. Install one from the library below, or write your own.",fixLocation:"home",linkTo:"/flows",linkLabel:"Go to Flows"},{key:"ingest-key",done:r.ingestKey,label:"Ingest API key",reason:"Your app uses this key to send events to Claros. No key means no data.",fixLocation:"integrate",linkTo:"/integrate",linkLabel:"Create in Integrate"},{key:"event",done:r.firstEvent,label:"First event received",reason:"Proves the integration is working. Events trigger flows and create contacts.",fixLocation:"code",linkTo:"/integrate",linkLabel:"Integration guide"}],f=[...i,...o,...d],m=f.filter(g=>g.done).length,p=f.length,h=m===p;return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{title:"Home",subtitle:h?"Setup complete. Your install is ready to send lifecycle email.":`${m} of ${p} requirements met. Complete the remaining items to unlock sending.`,actions:a.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Skip setup"})}),(!r.encryptionKey||!r.signingKey)&&a.jsxs("div",{className:"mb-5 flex items-start gap-2.5 rounded-md border border-warning bg-warning-soft px-4 py-3",children:[a.jsx(Nc,{size:14,className:"mt-0.5 shrink-0 text-warning"}),a.jsxs("p",{className:"text-[13px] text-foreground",children:["Some items require environment variables set before the container starts and cannot be changed from the dashboard. Edit your"," ",a.jsx("code",{className:"rounded bg-sunken px-1 py-0.5 font-mono text-[12px]",children:".env"})," ","file or Docker Compose config and restart."]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(_f,{title:"Required for sending",description:"Without these four, the engine cannot deliver a single email.",checks:i,defaultOpen:!0,prominent:!0}),a.jsx(_f,{title:"Required for AI features",description:"Library flows work without an LLM. Add one when you want prompt-defined flows or personalized drafts.",checks:o}),a.jsx(_f,{title:"Ready to go",description:"A flow to run, a key to receive events, and a first event to prove it works.",checks:d,defaultOpen:!0}),a.jsxs("div",{className:"pt-2",children:[a.jsx("h2",{className:"mb-3 text-[13px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Fastest path to a working install"}),a.jsx(c3,{hasActiveFlow:r.activeFlow,hasTransport:r.transport})]})]}),a.jsx(s1,{})]})}const If="claros-home-setup-dismissed";function x3(){try{return localStorage.getItem(If)==="1"}catch{return!1}}function nv(n){try{n?localStorage.setItem(If,"1"):localStorage.removeItem(If)}catch{}}function p3(){const n=ll(),r=t3(),i=kc(!1),o=t1(),d=Ps(),[f,m]=j.useState(x3),[p,h]=j.useState(!1);if(n.isLoading||r.isLoading||i.isLoading||d.isLoading||o.isLoading)return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{title:"Home"}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(se,{className:"h-32 w-full rounded-lg"}),a.jsx(se,{className:"h-24 w-full rounded-lg"}),a.jsx(se,{className:"h-24 w-full rounded-lg"})]})]});const g=r.data?.keys.ENCRYPTION_KEY.present??!1,v=r.data?.keys.UNSUBSCRIBE_SIGNING_KEY.present??!1,y=n.checks.transport,b=n.checks.postalAddress,S=n.checks.llm,w=(d.data?.flows??[]).some(U=>U.status==="active"),k=(o.data?.keys??[]).some(U=>U.revoked_at===null),_=i.data?.last_event!=null,A={encryptionKey:g,signingKey:v,transport:y,postalAddress:b,llm:S,activeFlow:w,ingestKey:k,firstEvent:_,hasTransport:y},C=g&&v&&y&&b&&w&&_;if(p||!C&&!f)return a.jsx(h3,{checks:A,onSkip:()=>{h(!1),C||(m(!0),nv(!0))}});const V=8,F=[g,v,y,b,S,w,k,_].filter(Boolean).length;return a.jsx(f3,{flows:d.data?.flows??[],onShowSetup:()=>{h(!0),m(!1),nv(!1)},setupIncomplete:!C||!S,setupDoneCount:F,setupTotalCount:V})}const Jf="claros-setup-dismissed";function g3(){try{return localStorage.getItem(Jf)==="1"}catch{return!1}}function y3({done:n,label:r,action:i}){return a.jsxs("li",{className:"flex items-center gap-3 py-1.5",children:[a.jsx("span",{"aria-hidden":"true",className:qe("flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",n?"border-success bg-success-soft text-success":"border-border-strong"),children:n&&a.jsx(rl,{size:11,strokeWidth:2.5})}),a.jsx("span",{className:qe("text-[14px]",n?"text-muted-foreground":"text-foreground"),children:r}),!n&&i&&a.jsx("span",{className:"ml-auto",children:i})]})}function v3(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function b3(n){const r=ll(),[i,o]=j.useState(g3),d=!r.isLoading&&!r.isError&&(!r.complete||n===0);function f(){try{localStorage.setItem(Jf,"1")}catch{}o(!0)}function m(){try{localStorage.removeItem(Jf)}catch{}o(!1)}return{setup:r,visible:d&&!i,showReopen:d&&i,dismiss:f,reopen:m}}function j3({setup:n,flowCount:r,onDismiss:i}){const o=KE(),d=YE(),f=kc(!1),[m,p]=j.useState(""),[h,g]=j.useState(null),[v,y]=j.useState(null),b=[{key:"llm",done:n.checks.llm,label:"Add an LLM provider so flows can compile and drafts can be written",to:"/settings/llm",linkLabel:"Settings"},{key:"transport",done:n.checks.transport,label:"Add an email transport so approved messages can be delivered",to:"/settings/transport",linkLabel:"Settings"},{key:"postal",done:n.checks.postalAddress,label:"Set a postal address, required by law on every outgoing email",to:"/settings/postal",linkLabel:"Settings"},{key:"events",done:f.data?.last_event!=null,label:"Send your first event so contacts and flows have something to act on",to:"/integrate",linkLabel:"Integrate"}],S=b.filter(A=>A.done).length,w=b.length,k=r===0;function _(){m&&(g(null),y(null),d.mutate(m,{onSuccess:A=>{g(`Applied "${A.template_name}": ${A.flows_created.length} draft flows created. Review them in the list below.`)},onError:A=>{y(v3(A))}}))}return a.jsxs("div",{className:"mb-8 rounded-lg border border-border bg-card p-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-[16px] font-medium text-foreground",children:"Finish setting up"}),a.jsx("p",{className:"mt-1 text-[14px] text-muted-foreground",children:S===0?"This install cannot compile, send, or legally deliver email yet, and no events are arriving. Four things fix that.":S<w?`${S} of ${w} done. The product works when all four are in place.`:"The install is ready. Start with a set of proven flows, or write your own."})]}),a.jsx("button",{type:"button",onClick:i,title:"Dismiss","aria-label":"Dismiss setup checklist",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors duration-(--dur-fast) hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(wc,{size:16,strokeWidth:1.5})})]}),a.jsx("ul",{className:"mt-4",children:b.map(A=>a.jsx(y3,{done:A.done,label:A.label,action:a.jsx($e,{to:A.to,className:"text-[14px] text-accent-text underline underline-offset-4",children:A.linkLabel})},A.key))}),k&&a.jsxs("div",{className:"mt-5 border-t border-border pt-5",children:[a.jsx("p",{className:"text-[14px] font-medium text-foreground",children:"Start from a template"}),a.jsx("p",{className:"mt-1 text-[14px] text-muted-foreground",children:"A business-model template installs a set of draft flows matched to how your SaaS charges. They are drafts: nothing sends until you compile and activate them."}),a.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[a.jsx("div",{className:"w-72",children:a.jsxs(Oe,{"aria-label":"Business model template",value:m,onChange:A=>p(A.target.value),disabled:d.isPending||o.isLoading,children:[a.jsx("option",{value:"",children:o.isLoading?"Loading templates...":"Choose a template"}),(o.data?.templates??[]).map(A=>a.jsxs("option",{value:A.id,children:[A.name," (",A.flow_count," flows)"]},A.id))]})}),a.jsx(H,{variant:"outline",size:"sm",disabled:!m||d.isPending,onClick:_,children:d.isPending?"Applying...":"Apply template"})]}),m&&a.jsx("p",{className:"mt-2 text-[13px] text-muted-foreground",children:(o.data?.templates??[]).find(A=>A.id===m)?.description}),h&&a.jsx("p",{className:"mt-3 rounded-md border border-border bg-secondary px-3.5 py-2.5 text-[14px] text-foreground",role:"status",children:h}),v&&a.jsx("div",{className:"mt-3 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5",role:"alert",children:a.jsx("p",{className:"text-[14px] text-foreground",children:v})})]})]})}function ls({icon:n,title:r,description:i,action:o,compact:d=!1}){return a.jsxs("div",{className:`flex flex-col items-center justify-center rounded-lg border border-dashed border-border-strong text-center ${d?"px-6 py-12":"px-6 py-24"}`,children:[a.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-lg bg-accent-soft text-accent-text",children:a.jsx(n,{size:20,strokeWidth:1.5})}),a.jsx("p",{className:"mt-4 text-[16px] font-medium text-foreground",children:r}),a.jsx("p",{className:"mt-2 max-w-md text-[14px] leading-relaxed text-muted-foreground",children:i}),o&&a.jsx("div",{className:"mt-6",children:o})]})}const Ks=j.forwardRef(({className:n,...r},i)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:i,className:qe("w-full text-[14px] [&_td]:first:pl-0 [&_td]:last:pr-0 [&_th]:first:pl-0 [&_th]:last:pr-0",n),...r})}));Ks.displayName="Table";const Ys=j.forwardRef(({className:n,...r},i)=>a.jsx("thead",{ref:i,className:qe("[&_tr]:border-b [&_tr]:border-border",n),...r}));Ys.displayName="TableHeader";const Gs=j.forwardRef(({className:n,...r},i)=>a.jsx("tbody",{ref:i,className:qe("[&_tr:last-child]:border-0",n),...r}));Gs.displayName="TableBody";const sn=j.forwardRef(({className:n,...r},i)=>a.jsx("tr",{ref:i,className:qe("border-b border-border transition-colors duration-(--dur-fast) hover:bg-secondary data-[state=selected]:bg-accent-soft",n),...r}));sn.displayName="TableRow";const Ue=j.forwardRef(({className:n,...r},i)=>a.jsx("th",{ref:i,className:qe("h-10 px-3 text-left align-middle text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...r}));Ue.displayName="TableHead";const Re=j.forwardRef(({className:n,...r},i)=>a.jsx("td",{ref:i,className:qe("px-3 py-3 align-middle [&:has([role=checkbox])]:pr-0",n),...r}));Re.displayName="TableCell";function av(n){return n.source==="library"?{label:"Fixed copy",variant:"muted"}:n.content_mode==="fixed_content"?{label:"Person-written",variant:"muted"}:{label:"AI-drafted",variant:"neutral"}}function N3(n){switch(n){case"active":return"success";case"draft":return"neutral";case"paused":return"warning";case"archived":return"muted"}}function w3(n){switch(n){case null:return"muted";case"pending":return"warning";case"ready":return"success";case"failed":return"danger"}}function S3({count:n}){return a.jsx(Zt,{eyebrow:"Automation",title:"Flows",subtitle:n===null||n===0?"AI-drafted email sequences, compiled from plain language.":`${n} ${n===1?"flow":"flows"}`,actions:a.jsx($e,{to:"/flows/new",children:a.jsxs(H,{size:"sm",children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"New flow"]})})})}function _3(){return a.jsxs("div",{children:[a.jsx("div",{className:"border-b border-border pb-3",children:a.jsx(se,{className:"h-3 w-full max-w-xl"})}),a.jsx("div",{className:"divide-y divide-border",children:Array.from({length:5}).map((n,r)=>a.jsxs("div",{className:"flex items-center gap-6 py-4",children:[a.jsx(se,{className:"h-4 w-44"}),a.jsx(se,{className:"h-5 w-16 rounded-full"}),a.jsx(se,{className:"h-5 w-16 rounded-full"}),a.jsx(se,{className:"h-4 w-36"}),a.jsx(se,{className:"h-4 w-16"}),a.jsx(se,{className:"h-4 w-24"})]},r))})]})}function k3(){return a.jsx(ls,{icon:Ej,title:"No flows yet",description:"Flows define the automated email sequences your contacts receive based on lifecycle transitions and events. Create your first flow to start engaging your users.",action:a.jsx($e,{to:"/flows/new",children:a.jsxs(H,{size:"sm",children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"New flow"]})})})}function E3({message:n,onRetry:r}){return a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load flows: ",n]}),a.jsx(H,{variant:"outline",size:"sm",onClick:r,children:"Try again"})]})}function C3(n){return new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function T3(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function A3(n){return n.status==="active"?{label:"Pause",status:"paused"}:n.status==="paused"?n.compile_status==="ready"&&n.compiled_plan!==null?{label:"Resume",status:"active"}:null:n.status==="draft"&&n.compile_status==="ready"&&n.compiled_plan!==null?{label:"Activate",status:"active"}:null}function R3(){const{data:n,isLoading:r,isError:i,error:o,refetch:d}=Ps(),f=Gn(),m=_e(),[p,h]=j.useState(null),g=pe({mutationFn:({id:S,status:w})=>Tm(S,{status:w}),onSuccess:()=>{h(null),m.invalidateQueries({queryKey:ia})},onError:S=>{h(T3(S))}}),v=n?.flows??[],y=r||i?null:v.length,b=b3(y);return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(S3,{count:y}),b.visible&&a.jsx(j3,{setup:b.setup,flowCount:y,onDismiss:b.dismiss}),b.showReopen&&a.jsx("div",{className:"mb-6 -mt-4 flex justify-end",children:a.jsx(H,{variant:"ghost",size:"sm",onClick:b.reopen,children:"Finish setup"})}),p&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:p})}),r&&a.jsx(_3,{}),i&&a.jsx(E3,{message:o instanceof Error?o.message:"Unknown error",onRetry:()=>d()}),!r&&!i&&v.length===0&&a.jsx(k3,{}),!r&&!i&&v.length>0&&a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{className:"hover:bg-transparent",children:[a.jsx(Ue,{children:"Name"}),a.jsx(Ue,{children:"Content"}),a.jsx(Ue,{children:"Status"}),a.jsx(Ue,{children:"Compiled"}),a.jsx(Ue,{children:"Trigger"}),a.jsx(Ue,{children:"Approval"}),a.jsx(Ue,{className:"text-right",children:"Created"}),a.jsx(Ue,{children:a.jsx("span",{className:"sr-only",children:"Actions"})})]})}),a.jsx(Gs,{children:v.map(S=>{const w=A3(S);return a.jsxs(sn,{className:"cursor-pointer",onClick:()=>f(`/flows/${S.id}/edit`),children:[a.jsx(Re,{className:"font-medium text-foreground",children:a.jsx($e,{to:`/flows/${S.id}/edit`,className:"text-foreground",onClick:k=>k.stopPropagation(),children:S.name})}),a.jsx(Re,{children:a.jsx(le,{variant:av(S).variant,children:av(S).label})}),a.jsx(Re,{children:a.jsx(le,{variant:N3(S.status),children:S.status})}),a.jsx(Re,{children:a.jsx(le,{variant:w3(S.compile_status),pulse:S.compile_status==="pending",children:S.compile_status??"not compiled"})}),a.jsx(Re,{className:"font-mono text-[13px] text-muted-foreground",children:S.trigger_type}),a.jsx(Re,{className:"text-muted-foreground",children:S.approval_mode}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:C3(S.created_at)}),a.jsx(Re,{className:"w-px whitespace-nowrap text-right",onClick:k=>k.stopPropagation(),children:w&&a.jsx(H,{variant:"ghost",size:"sm",disabled:g.isPending,onClick:()=>g.mutate({id:S.id,status:w.status}),children:w.label})})]},S.id)})})]})]})}const yn=j.forwardRef(({className:n,...r},i)=>a.jsx("textarea",{ref:i,className:qe("flex min-h-24 w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-[15px] text-foreground transition-[border-color,box-shadow] duration-(--dur-fast) placeholder:text-subtle-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:border-border disabled:bg-sunken disabled:text-muted-foreground",n),...r}));yn.displayName="Textarea";const r1=["email-templates"];async function O3(){const n=await fetch("/v1/email-templates",bc());if(!n.ok)throw new Error(`Failed to load templates (${n.status})`);return n.json()}async function z3(n,r){const i=await fetch(`/v1/email-templates/${n}`,bc({method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}));if(!i.ok){const o=await i.json().catch(()=>null),d=o&&typeof o=="object"&&"error"in o?String(o.error):`Save failed (${i.status})`;throw new Error(d)}return i.json()}function M3({variables:n}){return a.jsxs("div",{className:"rounded-md border border-border bg-sunken p-3",children:[a.jsx("p",{className:"mb-2 text-[12px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Available variables"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(r=>a.jsx("code",{className:"rounded bg-bg-raised px-2 py-0.5 font-mono text-[12px] text-foreground border border-border",children:`{{${r}}}`},r))}),a.jsxs("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["Use the pipe syntax for fallbacks: ","{{contact.first_name|there}}"]})]})}function D3({template:n,variables:r,onClose:i}){const o=_e(),[d,f]=j.useState(n.subject),[m,p]=j.useState(n.body_html),[h,g]=j.useState(n.body_text??""),[v,y]=j.useState(!1),[b,S]=j.useState(null),[w,k]=j.useState("html"),_=pe({mutationFn:()=>z3(n.id,{subject:d.trim(),body_html:m.trim(),body_text:h.trim()||null}),onSuccess:()=>{o.invalidateQueries({queryKey:r1}),y(!0)},onError:C=>{S(C.message)}});j.useEffect(()=>{f(n.subject),p(n.body_html),g(n.body_text??""),y(!1),S(null)},[n.id,n.subject,n.body_html,n.body_text]);function A(C){C.preventDefault(),S(null),y(!1),_.mutate()}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"text-[16px] font-semibold text-foreground",children:n.name}),a.jsx(le,{variant:"muted",children:n.slug}),n.category&&a.jsx(le,{variant:"neutral",children:n.category})]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:i,children:"Close"})]}),a.jsx(M3,{variables:r}),a.jsxs("form",{onSubmit:A,className:"space-y-4",noValidate:!0,children:[a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Subject line"}),a.jsx(I,{value:d,onChange:C=>{f(C.target.value),y(!1)},disabled:_.isPending})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[a.jsx("label",{className:"text-[14px] font-medium text-foreground",children:"Body (HTML)"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>k("html"),className:`rounded px-2 py-1 text-[12px] ${w==="html"?"bg-selected font-semibold text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Code"}),a.jsx("button",{type:"button",onClick:()=>k("text"),className:`rounded px-2 py-1 text-[12px] ${w==="text"?"bg-selected font-semibold text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Plain text"})]})]}),w==="html"?a.jsx(yn,{value:m,onChange:C=>{p(C.target.value),y(!1)},disabled:_.isPending,rows:14,className:"font-mono text-[13px]"}):a.jsx(yn,{value:h,onChange:C=>{g(C.target.value),y(!1)},disabled:_.isPending,rows:14,placeholder:"Optional plain-text version. If empty, the system derives it from HTML."})]}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-1.5 text-[14px] font-medium text-foreground",children:"Preview"}),a.jsx("div",{className:"rounded-md border border-border bg-white p-4 text-[14px]",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:m}})})]}),b&&a.jsx("p",{className:"rounded-md border border-danger bg-danger-soft px-3.5 py-2.5 text-[14px] text-foreground",children:b}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{type:"submit",size:"sm",disabled:_.isPending||!d.trim()||!m.trim(),children:_.isPending?"Saving...":"Save template"}),v&&a.jsx("span",{className:"text-[14px] text-muted-foreground",role:"status",children:"Saved."})]})]})]})}function sv({slug:n,onClose:r}){const{data:i,isLoading:o}=Ye({queryKey:r1,queryFn:O3});if(o)return a.jsxs("div",{className:"space-y-3 p-4",children:[a.jsx(se,{className:"h-5 w-40"}),a.jsx(se,{className:"h-64 w-full"})]});const d=i?.templates??[],f=i?.supported_variables??[],m=d.find(p=>p.slug===n);return m?a.jsx(D3,{template:m,variables:f,onClose:r}):a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-[14px] text-muted-foreground",children:["Template ",a.jsx("code",{className:"font-mono",children:n})," not found."]}),a.jsx(H,{variant:"ghost",size:"sm",onClick:r,children:"Close"})]})})}const L3=["contact.first_name","contact.name","contact.email","contact.company","tenant.name"],U3=[{value:"onboard_welcome",label:"Welcome"},{value:"onboard_getting_started",label:"Getting started"},{value:"nurture_value",label:"Value nurture"},{value:"nurture_education",label:"Education"},{value:"reengage_check_in",label:"Check-in"},{value:"reengage_offer",label:"Win-back offer"},{value:"critical_dunning",label:"Dunning"},{value:"critical_security",label:"Security alert"}],q3=[{value:"0m",label:"Immediately"},{value:"1h",label:"1 hour"},{value:"2h",label:"2 hours"},{value:"1d",label:"1 day"},{value:"2d",label:"2 days"},{value:"3d",label:"3 days"},{value:"5d",label:"5 days"},{value:"7d",label:"7 days"},{value:"14d",label:"14 days"}],H3={"contact.first_name":"Ada","contact.name":"Ada Lovelace","contact.email":"ada@example.com","contact.company":"Acme Inc.","tenant.name":"Claros"};function rv(n){return n.replace(/\{\{\s*([a-zA-Z0-9_.]+)\s*(?:\|([^}]*))?\}\}/g,(r,i,o)=>{const d=H3[i.trim()];return d!==void 0?d:o!==void 0?o.trim():r})}function $3({onInsert:n,disabled:r}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{className:"mr-1 text-[12px] font-medium text-muted-foreground",children:"Insert variable:"}),L3.map(i=>a.jsx("button",{type:"button",disabled:r,onMouseDown:o=>o.preventDefault(),onClick:()=>n(i),title:`Insert {{${i}}} at the cursor`,className:"rounded border border-border bg-sunken px-2 py-0.5 font-mono text-[12px] text-foreground transition-colors hover:border-border-strong hover:bg-bg-raised disabled:opacity-50",children:`{{${i}}}`},i))]}),a.jsxs("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:["Inserts at the cursor of the field you last typed in. Use the pipe syntax for fallbacks: ","{{contact.first_name|there}}"]})]})}function B3({step:n,totalSteps:r,onUpdate:i,onRemove:o,onMoveUp:d,onMoveDown:f,disabled:m,flowId:p,hasLlm:h}){const[g,v]=j.useState("html"),[y,b]=j.useState(null),[S,w]=j.useState(!1),k=j.useRef(null),_=j.useRef(null),A=j.useRef(null),C=j.useRef("body");function B(U){const Z=`{{${U}}}`,Q=C.current==="subject"?"subject":g==="text"?"body_text":"body_html",xe=Q==="subject"?k.current:Q==="body_text"?A.current:_.current,he=n[Q],Ne=xe?.selectionStart??he.length,Ae=xe?.selectionEnd??he.length,ee=he.slice(0,Ne)+Z+he.slice(Ae);i({...n,[Q]:ee}),requestAnimationFrame(()=>{xe&&(xe.focus(),xe.setSelectionRange(Ne+Z.length,Ne+Z.length))})}const V=pe({mutationFn:U=>f_(p,U),onSuccess:U=>{n.subject||n.body_html?i({...n,subject:U.subject,body_html:U.body_html}):i({...n,subject:U.subject,body_html:U.body_html}),b(null)},onError:U=>{const Z=U!==null&&typeof U=="object"&&"message"in U?String(U.message):"AI draft failed.";b(Z)}});function F(){p&&(b(null),V.mutate({step_order:n.order,subject:n.subject||void 0,body_html:n.body_html||void 0}))}return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-sunken font-mono text-[12px] text-muted-foreground",children:n.order}),a.jsxs("span",{className:"text-[14px] font-medium text-foreground",children:["Step ",n.order]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:d,disabled:m||n.order===1,className:"rounded p-1 text-muted-foreground hover:text-foreground disabled:opacity-30",title:"Move up",children:a.jsx(P4,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:f,disabled:m||n.order===r,className:"rounded p-1 text-muted-foreground hover:text-foreground disabled:opacity-30",title:"Move down",children:a.jsx(Q4,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:o,disabled:m||r<=1,className:"ml-2 rounded p-1 text-muted-foreground hover:text-danger disabled:opacity-30",title:"Remove step",children:a.jsx(wc,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"mb-4 flex gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"mb-1 block text-[13px] font-medium text-foreground",children:"Send after"}),a.jsx(Oe,{value:n.delay,onChange:U=>i({...n,delay:U.target.value}),disabled:m,children:q3.map(U=>a.jsx("option",{value:U.value,children:U.label},U.value))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"mb-1 block text-[13px] font-medium text-foreground",children:"Email type"}),a.jsx(Oe,{value:n.action_type,onChange:U=>i({...n,action_type:U.target.value}),disabled:m,children:U3.map(U=>a.jsx("option",{value:U.value,children:U.label},U.value))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"mb-1 block text-[13px] font-medium text-foreground",children:"Send window"}),a.jsxs(Oe,{value:n.window_policy,onChange:U=>i({...n,window_policy:U.target.value}),disabled:m,children:[a.jsx("option",{value:"respect_window",children:"Respect send window"}),a.jsx("option",{value:"immediate",children:"Send immediately (bypass window)"})]})]})]}),a.jsx("div",{className:"mb-4",children:a.jsx($3,{onInsert:B,disabled:m})}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"mb-1 block text-[13px] font-medium text-foreground",children:"Subject line"}),a.jsx(I,{ref:k,value:n.subject,onChange:U=>i({...n,subject:U.target.value}),onFocus:()=>{C.current="subject"},placeholder:"e.g. {{contact.first_name|Hi there}}, here is your next step",disabled:m})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[a.jsx("label",{className:"text-[13px] font-medium text-foreground",children:"Body"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{type:"button",onClick:()=>v("html"),className:`rounded px-2 py-1 text-[12px] ${g==="html"?"bg-selected font-semibold text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"HTML"}),a.jsx("button",{type:"button",onClick:()=>v("text"),className:`rounded px-2 py-1 text-[12px] ${g==="text"?"bg-selected font-semibold text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Plain text"})]})]}),g==="html"?a.jsx(yn,{ref:_,value:n.body_html,onChange:U=>i({...n,body_html:U.target.value}),onFocus:()=>{C.current="body"},disabled:m,rows:8,className:"font-mono text-[13px]",placeholder:`<p>Hi {{contact.first_name|there}},</p>
12
+ <p>Write your email content here...</p>`}):a.jsx(yn,{ref:A,value:n.body_text,onChange:U=>i({...n,body_text:U.target.value}),onFocus:()=>{C.current="body"},disabled:m,rows:8,placeholder:"Optional plain-text version. If empty, the system derives it from HTML."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[h&&p?a.jsx(H,{type:"button",variant:"outline",size:"sm",disabled:m||V.isPending,onClick:F,children:V.isPending?"Drafting...":"AI draft"}):h?null:a.jsx("span",{className:"text-[13px] text-muted-foreground",children:"AI drafting requires an LLM provider (Settings)"}),a.jsx("button",{type:"button",onClick:()=>w(!S),className:"text-[13px] text-accent-text hover:underline",children:S?"Hide preview":"Preview"})]}),y&&a.jsx("p",{className:"mt-2 rounded-md border border-danger bg-danger-soft px-3 py-2 text-[13px] text-foreground",children:y}),S&&(n.subject||n.body_html)&&a.jsxs("div",{className:"mt-3 rounded-md border border-border bg-sunken p-4",children:[a.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Preview with sample data"}),a.jsxs("div",{className:"rounded-md border border-border bg-white",children:[a.jsx("div",{className:"border-b border-border px-5 py-3",children:a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:n.subject?rv(n.subject):"(no subject)"})}),a.jsx("div",{className:"px-5 py-4 text-[14px] leading-relaxed text-foreground",dangerouslySetInnerHTML:{__html:rv(n.body_html)}})]})]})]})}function Q3({flowId:n,steps:r,onStepsChange:i,disabled:o,hasLlm:d}){function f(){const g=r.length+1,v=g===1?"0m":"2d";i([...r,{order:g,delay:v,action_type:"nurture_value",subject:"",body_html:"",body_text:"",window_policy:"respect_window"}])}function m(g){const y=r.filter(b=>b.order!==g).map((b,S)=>({...b,order:S+1}));i(y)}function p(g,v){i(r.map(y=>y.order===g?v:y))}function h(g,v){const y=r.findIndex(k=>k.order===g);if(y<0)return;const b=v==="up"?y-1:y+1;if(b<0||b>=r.length)return;const S=[...r];[S[y],S[b]]=[S[b],S[y]];const w=S.map((k,_)=>({...k,order:_+1}));i(w)}return a.jsxs("div",{className:"space-y-6",children:[r.length===0&&a.jsx("div",{className:"rounded-md border border-border bg-sunken px-4 py-6 text-center",children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No steps yet. Add your first email below."})}),r.map(g=>a.jsx(B3,{step:g,totalSteps:r.length,onUpdate:v=>p(g.order,v),onRemove:()=>m(g.order),onMoveUp:()=>h(g.order,"up"),onMoveDown:()=>h(g.order,"down"),disabled:o,flowId:n,hasLlm:d},g.order)),a.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:o,children:"Add step"})]})}function F3(n){return{steps:n.map(r=>({order:r.order,delay:r.delay,action_type:r.action_type,window_policy:r.window_policy,subject:r.subject,body_html:r.body_html,...r.body_text?{body_text:r.body_text}:{}}))}}const l1=["settings","transports"],Qm=["topics"];function P3(){return Ye({queryKey:l1,queryFn:R_})}function Fm(){const n=_e();return()=>{n.invalidateQueries({queryKey:l1}),n.invalidateQueries({queryKey:Jj})}}function K3(){const n=Fm();return pe({mutationFn:r=>O_(r),onSuccess:n})}function Y3(){const n=Fm();return pe({mutationFn:r=>z_(r),onSuccess:n})}function G3(){return pe({mutationFn:({id:n,to:r})=>M_(n,r)})}function V3(){const n=Fm();return pe({mutationFn:r=>D_(r),onSuccess:n})}function i1(){return Ye({queryKey:Qm,queryFn:L_})}function X3(){const n=_e();return pe({mutationFn:r=>U_(r),onSuccess:()=>{n.invalidateQueries({queryKey:Qm})}})}function Z3(){const n=_e();return pe({mutationFn:({id:r,input:i})=>q_(r,i),onSuccess:()=>{n.invalidateQueries({queryKey:Qm})}})}function I3({flow:n,disabled:r}){const i=i1(),o=Sc(n.id),[d,f]=j.useState(null),m=i.data?.topics??[];if(m.length===0)return null;async function p(h){f(null);try{await o.mutateAsync({topic_id:h===""?null:h})}catch(g){f(g instanceof Error?g.message:"The topic could not be saved.")}}return a.jsxs("div",{className:"mt-6",children:[a.jsx("label",{htmlFor:"flow-topic",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Topic"}),a.jsxs(Oe,{id:"flow-topic",value:n.topic_id??"",onChange:h=>{p(h.target.value)},disabled:r||o.isPending,className:"max-w-sm",children:[a.jsx("option",{value:"",children:"No topic"}),m.map(h=>a.jsxs("option",{value:h.id,children:[h.name," (",h.kind,")"]},h.id))]}),a.jsxs("p",{className:"mt-1 text-[13px] text-muted-foreground",children:["Contacts unsubscribed from the topic do not get this flow's mail. New messages take the topic; manage topics in ",a.jsx($e,{to:"/settings/topics",className:"text-accent-text hover:underline",children:"Settings"}),"."]}),d&&a.jsx("p",{className:"mt-1 text-[13px] text-danger",role:"alert",children:d})]})}const oi=["signed_up","activated","engaged","at_risk","dormant","churned","resurrected"],J3=["power","regular","casual","minimal"],W3=["eq","neq","in","exists","not_exists","gt","lt"],eC=["none","any","count_lt"],lv=[{value:"nurture",label:"Nurture",hint:"One nurture flow per contact at a time; throttled and inside the send window."},{value:"scheduled",label:"Scheduled",hint:"Runs alongside other flows (long date schedules); still throttled and inside the send window."},{value:"critical",label:"Critical",hint:"Runs alongside other flows and bypasses frequency caps (billing, security)."}],Wf=4;function tC(n){const r=["trait","history","first_contact","lifecycle_state","lifecycle_state_not","all","any","not"];return n==="step"?[...r,"event_since_step","date_unchanged"]:n==="exit"?[...r,"event","lifecycle_state_change"]:r}const o1={all:"All of",any:"Any of",not:"Not",trait:"Trait",history:"Send history",first_contact:"First contact",lifecycle_state:"Lifecycle state is",lifecycle_state_not:"Lifecycle state is not",event_since_step:"Event since previous step",date_unchanged:"Date unchanged",event:"Event received",lifecycle_state_change:"Becomes lifecycle state"};function Pm(n){if(n===null||typeof n!="object"||Array.isArray(n))return null;const r=Object.keys(n);if(r.length===1){const i=r[0];if(i in o1)return i}return null}function em(n){switch(n){case"all":case"any":return{[n]:[]};case"not":return{not:{trait:{key:"",op:"eq",value:""}}};case"trait":return{trait:{key:"",op:"eq",value:""}};case"history":return{history:{op:"none"}};case"first_contact":return{first_contact:!0};case"lifecycle_state":case"lifecycle_state_not":return{[n]:"engaged"};case"event_since_step":case"event":return{[n]:""};case"date_unchanged":return{date_unchanged:!0};case"lifecycle_state_change":return{lifecycle_state_change:{to:"churned"}}}}function Rn(n){return n==null?[]:Array.isArray(n)?n.filter(r=>r!==null&&typeof r=="object"):typeof n=="object"?[n]:[]}function nC(n){if(n.length!==0)return n.length===1?n[0]:n}function it(n){return Array.isArray(n)?n.map(it).join(", "):typeof n=="string"?n:JSON.stringify(n)}const aC={eq:"is",neq:"is not",in:"is one of",gt:"is greater than",lt:"is less than"};function Fn(n){if(Array.isArray(n))return n.length===0?"always":n.length===1?Fn(n[0]):n.map(o=>`(${Fn(o)})`).join(" and ");const r=Pm(n);if(!r)return JSON.stringify(n);const i=n[r];switch(r){case"all":case"any":{const o=Array.isArray(i)?i:[];return o.length===0?r==="all"?"always":"never":o.map(d=>`(${Fn(d)})`).join(r==="all"?" and ":" or ")}case"not":return`not (${Fn(i)})`;case"trait":{const o=i??{},d=String(o.key??"");return o.op==="exists"?`${d} is set`:o.op==="not_exists"?`${d} is not set`:`${d} ${aC[String(o.op)]??String(o.op)} ${it(o.value)}`}case"history":{const o=i??{},d=o.flow?`flow ${it(o.flow)}`:o.action_type?`action ${it(o.action_type)}`:o.topic?`topic ${it(o.topic)}`:"anything",f=o.within?` in the last ${it(o.within)}`:"";return o.op==="any"?`was sent ${d}${f}`:o.op==="count_lt"?`was sent ${d} fewer than ${it(o.value)} times${f}`:`was never sent ${d}${f}`}case"first_contact":return i===!1?"has received mail before":"has never received mail";case"lifecycle_state":return`lifecycle state is ${it(i)}`;case"lifecycle_state_not":return`lifecycle state is not ${it(i)}`;case"event_since_step":return`${it(i)} happened since the previous step`;case"date_unchanged":return"the date is unchanged";case"event":return`${it(i)} occurs`;case"lifecycle_state_change":return`becomes ${it(i?.to)}`}}function di(n,r=1){if(r>Wf)return[`conditions nest at most ${Wf} levels`];const i=Pm(n);if(!i)return[`unknown condition ${JSON.stringify(n)}`];const o=n[i];switch(i){case"all":case"any":return(Array.isArray(o)?o:[]).flatMap(d=>di(d,r+1));case"not":return di(o,r+1);case"trait":{const d=o??{},f=[];return(typeof d.key!="string"||d.key.trim()==="")&&f.push("a trait condition needs a key"),d.op==="in"&&!Array.isArray(d.value)&&f.push("'is one of' needs a list"),["eq","neq","gt","lt"].includes(String(d.op))&&(d.value===void 0||d.value==="")&&f.push(`trait ${String(d.key??"")}: a value is needed`),f}case"history":{const d=o??{};return d.op==="count_lt"&&typeof d.value!="number"?["'fewer than' needs a number"]:d.within!==void 0&&!/^\d+(m|h|d)$/.test(String(d.within))?["within must look like 7d, 12h or 30m"]:[]}case"event_since_step":case"event":return typeof o=="string"&&o.trim()!==""?[]:["an event condition needs an event name"];default:return[]}}function iv(n,r){return r==="in"?n.split(",").map(i=>ov(i.trim())).filter(i=>i!==""):ov(n)}function ov(n){return n==="true"?!0:n==="false"?!1:n!==""&&/^-?\d+(\.\d+)?$/.test(n)?Number(n):n}function sC(n){return n==null?"":Array.isArray(n)?n.map(r=>String(r)).join(", "):String(n)}const cc=/^\d+(m|h|d)$/,rC=/^[+-]?\d+(m|h|d)$/,lC=/^([01]\d|2[0-3]):[0-5]\d$/;function Ec(n){const r=n.event;return Array.isArray(r)?r.filter(i=>typeof i=="string"):typeof r=="string"&&r!==""?[r]:[]}function Gr(n){return Array.isArray(n.lifecycle_states)}function c1(n){const r=n.config,i=[];switch(n.type){case"lifecycle_transition":r.to||i.push("Pick the state the contact moves to.");break;case"event":Ec(r).length===0&&i.push("Name at least one event.");break;case"segment":Gr(r)?r.lifecycle_states.length===0&&i.push("Pick at least one lifecycle state."):(!r.tenure_bucket||!r.recency_bucket)&&i.push("Pick a tenure and a recency.");break;case"manual":break;case"date_property":r.property||i.push("Name the date trait."),(typeof r.offset!="string"||!rC.test(r.offset))&&i.push("The offset looks like -3d, 0d or 2h.");break;case"date_schedule":{r.anchor||i.push("Name the anchor date trait.");const o=Array.isArray(r.offsets)?r.offsets:[];(o.length===0||o.some(d=>typeof d!="string"||!cc.test(d)))&&i.push("Offsets look like 1d, 3d, 7d."),r.repeat!==void 0&&(typeof r.repeat!="string"||!cc.test(r.repeat))&&i.push("Repeat looks like 30d."),(typeof r.max_sends!="number"||r.max_sends<1)&&i.push("Set the maximum number of sends.");break}}(n.type==="date_property"||n.type==="date_schedule")&&r.send_at_local!==void 0&&!lC.test(String(r.send_at_local))&&i.push("Send time looks like 09:00.");for(const o of Rn(r.where))i.push(...di(o));return i}function u1(n){const r={};for(const[o,d]of Object.entries(n.config))d==null||d===""||Array.isArray(d)&&d.length===0&&o!=="lifecycle_states"||(r[o]=d);if(n.type==="event"){const o=Ec(n.config);o.length===1?r.event=o[0]:o.length>1&&(r.event=o)}n.type==="segment"&&(Gr(n.config)?(delete r.tenure_bucket,delete r.recency_bucket):(delete r.lifecycle_states,delete r.engagement_depths));const i=Rn(n.config.where);return i.length===0?delete r.where:r.where=i.length===1?i[0]:i,r}function iC(n,r){const i=Rn(r.where),o=i.length>0?`, if ${Fn(i)}`:"";switch(n){case"lifecycle_transition":return`A contact moves ${r.from?`from ${it(r.from)} `:""}to ${it(r.to)}${o}`;case"event":{const d=Ec(r);return`${d.length>1?"One of the events":"The event"} ${d.join(", ")} is received${o}`}case"segment":if(Gr(r)){const d=Array.isArray(r.engagement_depths)&&r.engagement_depths.length>0?` with engagement ${it(r.engagement_depths)}`:"";return`A contact is ${it(r.lifecycle_states)}${d}${o}`}return`A contact is in the ${it(r.tenure_bucket)} / ${it(r.recency_bucket)} retention cell${o}`;case"manual":return`Contacts are enrolled by hand (POST /v1/flows/:id/enroll)${o}`;case"date_property":return`The date trait ${it(r.property)} is ${it(r.offset)} away${r.send_at_local?`, at ${it(r.send_at_local)} local time`:""}${o}`;case"date_schedule":return`Scheduled from ${it(r.anchor)} at ${it(r.offsets)}${r.repeat?`, then every ${it(r.repeat)}`:""}, up to ${it(r.max_sends)} sends${r.send_at_local?`, at ${it(r.send_at_local)} local time`:""}${o}`;default:return n}}function oC(n){switch(n){case"event":return{event:""};case"segment":return{tenure_bucket:"",recency_bucket:""};case"date_property":return{property:"",offset:"-3d"};case"date_schedule":return{anchor:"",offsets:["1d","3d","7d"],max_sends:3};default:return{}}}const cC=["order","action_type","type","delay","window_policy","template_ref","kb_ref","brain_instruction","from_name","reply_to","eyebrow","preheader","allowed_links","single_cta","condition","exit_condition","expires_after","context","on_empty","on_error","kb_select","candidates","allow_none"];function d1(n){return n==null||n===""?!0:Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:!1}function Kr(n){const r={};for(const[i,o]of Object.entries(n))d1(o)||(r[i]=o);return r}function uC(n){const r={...n};for(const d of["condition","exit_condition"])r[d]=nC(Rn(r[d]));r.single_cta===!1&&delete r.single_cta,r.type==="send"&&delete r.type,r.type!=="choose"?(delete r.candidates,delete r.allow_none):Array.isArray(r.candidates)&&(r.candidates=r.candidates.map(d=>{const f=Kr({...d,when:Rn(d.when)});return f.kb_select&&(f.kb_select=Kr(f.kb_select)),Array.isArray(f.context)&&(f.context=f.context.map(Kr)),f})),r.kb_select&&typeof r.kb_select=="object"&&(r.kb_select=Kr(r.kb_select)),Array.isArray(r.context)&&(r.context=r.context.map(Kr).filter(d=>!d1(d)));const i=Kr(r);n.allow_none===!1&&r.type==="choose"&&(i.allow_none=!1);const o={};for(const d of cC)d in i&&(o[d]=i[d]);for(const d of Object.keys(i))d in o||(o[d]=i[d]);return o}function dC(n){const r=[],i=new Set;for(const o of n){const d=`Step ${String(o.order??"?")}`;typeof o.order!="number"||o.order<1?r.push(`${d}: order is a whole number from 1.`):i.has(o.order)?r.push(`${d}: the order is used twice.`):i.add(o.order),(typeof o.action_type!="string"||o.action_type.trim()==="")&&r.push(`${d}: name the action type.`),(typeof o.delay!="string"||!cc.test(o.delay))&&r.push(`${d}: delay looks like 0m, 2h or 3d.`),o.expires_after!==void 0&&o.expires_after!==""&&!cc.test(String(o.expires_after))&&r.push(`${d}: expires after looks like 2d.`),o.type==="choose"&&(!Array.isArray(o.candidates)||o.candidates.length===0)&&r.push(`${d}: a choose step needs candidates.`),typeof o.reply_to=="string"&&o.reply_to!==""&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.reply_to)&&r.push(`${d}: reply-to is an email address.`);for(const f of["condition","exit_condition"])for(const m of Rn(o[f]))r.push(...di(m).map(p=>`${d}: ${p}`));if(Array.isArray(o.candidates)){const f=new Set;for(const m of o.candidates){typeof m.action_type!="string"||m.action_type===""?r.push(`${d}: every candidate needs an action type.`):f.has(m.action_type)?r.push(`${d}: candidate ${m.action_type} is listed twice.`):f.add(m.action_type);for(const p of Rn(m.when))r.push(...di(p).map(h=>`${d}: ${h}`))}}}return r}function fC(n){return n.reduce((r,i)=>typeof i.order=="number"&&i.order>r?i.order:r,0)+1}const gn="h-8 text-[13px]",mC={eq:"is",neq:"is not",in:"is one of",exists:"is set",not_exists:"is not set",gt:"greater than",lt:"less than"},hC={none:"never sent",any:"sent at least once",count_lt:"sent fewer than"};function f1({value:n,onChange:r,onRemove:i,scope:o,depth:d=1,disabled:f}){const m=Pm(n),p=tC(o).filter(v=>d<Wf||!["all","any","not"].includes(v)),h=m?n[m]:void 0,g=v=>r({[m]:v});return a.jsxs("div",{className:"rounded-md border border-border bg-card p-2.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(Oe,{"aria-label":"Condition kind",className:`${gn} w-48`,value:m??"",disabled:f,onChange:v=>r(em(v.target.value)),children:[m===null&&a.jsx("option",{value:"",children:"Unknown shape"}),p.map(v=>a.jsx("option",{value:v,children:o1[v]},v))]}),m==="trait"&&a.jsx(xC,{value:h??{},onChange:g,disabled:f}),m==="history"&&a.jsx(pC,{value:h??{},onChange:g,disabled:f}),m==="first_contact"&&a.jsxs(Oe,{"aria-label":"First contact",className:`${gn} w-56`,value:h===!1?"false":"true",disabled:f,onChange:v=>g(v.target.value==="true"),children:[a.jsx("option",{value:"true",children:"nothing sent yet"}),a.jsx("option",{value:"false",children:"something was sent"})]}),(m==="lifecycle_state"||m==="lifecycle_state_not")&&a.jsx(Oe,{"aria-label":"Lifecycle state",className:`${gn} w-40`,value:String(h??""),disabled:f,onChange:v=>g(v.target.value),children:oi.map(v=>a.jsx("option",{value:v,children:v},v))}),m==="lifecycle_state_change"&&a.jsx(Oe,{"aria-label":"Becomes lifecycle state",className:`${gn} w-40`,value:String(h?.to??""),disabled:f,onChange:v=>g({to:v.target.value}),children:oi.map(v=>a.jsx("option",{value:v,children:v},v))}),(m==="event_since_step"||m==="event")&&a.jsx(I,{"aria-label":"Event name",className:`${gn} w-56`,value:String(h??""),placeholder:"event_name",disabled:f,onChange:v=>g(v.target.value)}),m==="date_unchanged"&&a.jsx("span",{className:"text-[13px] text-muted-foreground",children:"the enrolled date still equals the trait"}),m===null&&a.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:JSON.stringify(n)}),i&&a.jsx(H,{type:"button",size:"sm",variant:"ghost",className:"ml-auto h-8",disabled:f,onClick:i,children:"Remove"})]}),(m==="all"||m==="any")&&a.jsx("div",{className:"mt-2 pl-4",children:a.jsx(m1,{items:Array.isArray(h)?h:[],onChange:v=>g(v),scope:o,depth:d+1,disabled:f})}),m==="not"&&a.jsx("div",{className:"mt-2 pl-4",children:a.jsx(f1,{value:h??em("trait"),onChange:g,scope:o,depth:d+1,disabled:f})})]})}function xC({value:n,onChange:r,disabled:i}){const o=String(n.op??"eq"),d=o!=="exists"&&o!=="not_exists",[f,m]=j.useState(sC(n.value));return a.jsxs(a.Fragment,{children:[a.jsx(I,{"aria-label":"Trait key",className:`${gn} w-40`,placeholder:"plan_tier",value:String(n.key??""),disabled:i,onChange:p=>r({...n,key:p.target.value})}),a.jsx(Oe,{"aria-label":"Trait operator",className:`${gn} w-36`,value:o,disabled:i,onChange:p=>{const h=p.target.value,g={key:n.key,op:h};h!=="exists"&&h!=="not_exists"&&(g.value=iv(f,h)),r(g)},children:W3.map(p=>a.jsx("option",{value:p,children:mC[p]},p))}),d&&a.jsx(I,{"aria-label":"Trait value",className:`${gn} w-44`,placeholder:o==="in"?"pro, business":"value",value:f,disabled:i,onChange:p=>{m(p.target.value),r({...n,value:iv(p.target.value,o)})}})]})}function pC({value:n,onChange:r,disabled:i}){const o=n.flow!==void 0?"flow":n.action_type!==void 0?"action_type":n.topic!==void 0?"topic":"",d=String(n.op??"none"),f=()=>{const{flow:m,action_type:p,topic:h,...g}=n;return g};return a.jsxs(a.Fragment,{children:[a.jsx(Oe,{"aria-label":"History operator",className:`${gn} w-44`,value:d,disabled:i,onChange:m=>{const p={...n,op:m.target.value};m.target.value!=="count_lt"?delete p.value:p.value=1,r(p)},children:eC.map(m=>a.jsx("option",{value:m,children:hC[m]},m))}),d==="count_lt"&&a.jsx(I,{"aria-label":"Count",type:"number",min:1,className:`${gn} w-20`,value:String(n.value??1),disabled:i,onChange:m=>r({...n,value:Number(m.target.value)})}),a.jsxs(Oe,{"aria-label":"History filter",className:`${gn} w-36`,value:o,disabled:i,onChange:m=>{const p=f();m.target.value&&(p[m.target.value]=""),r(p)},children:[a.jsx("option",{value:"",children:"any mail"}),a.jsx("option",{value:"flow",children:"of flow"}),a.jsx("option",{value:"action_type",children:"of action type"}),a.jsx("option",{value:"topic",children:"of topic"})]}),o&&a.jsx(I,{"aria-label":"History filter value",className:`${gn} w-36`,value:String(n[o]??""),placeholder:"slug",disabled:i,onChange:m=>r({...n,[o]:m.target.value})}),a.jsx(I,{"aria-label":"Within",className:`${gn} w-24`,placeholder:"within 7d",value:String(n.within??""),disabled:i,onChange:m=>{const p={...n};m.target.value===""?delete p.within:p.within=m.target.value,r(p)}})]})}function m1({items:n,onChange:r,scope:i,depth:o,disabled:d}){return a.jsxs("div",{className:"space-y-2",children:[n.map((f,m)=>a.jsx(f1,{value:f,scope:i,depth:o,disabled:d,onChange:p=>r(n.map((h,g)=>g===m?p:h)),onRemove:()=>r(n.filter((p,h)=>h!==m))},m)),a.jsx(H,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:d,onClick:()=>r([...n,em("trait")]),children:"Add condition"})]})}function fi({value:n,onChange:r,scope:i,label:o,hint:d,disabled:f,anyOf:m}){const[p,h]=j.useState(null),[g,v]=j.useState(null);return a.jsxs("div",{children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:o}),a.jsx("button",{type:"button",className:"text-[12px] text-accent-text hover:underline",disabled:f,onClick:()=>{p===null?(h(JSON.stringify(n,null,2)),v(null)):h(null)},children:p===null?"Edit as JSON":"Back to the form"})]}),d&&a.jsx("p",{className:"mb-1.5 text-[12px] text-muted-foreground",children:d}),p!==null?a.jsxs("div",{children:[a.jsx(yn,{"aria-label":`${o} as JSON`,className:"min-h-28 font-mono text-[12px]",value:p,disabled:f,onChange:y=>{h(y.target.value);try{const b=JSON.parse(y.target.value),S=Array.isArray(b)?b:b&&typeof b=="object"?[b]:null;if(!S)throw new Error("a condition object or a list of them");v(null),r(S)}catch(b){v(b instanceof Error?b.message:"invalid JSON")}}}),g&&a.jsx("p",{className:"mt-1 text-[12px] text-danger",children:g})]}):a.jsxs(a.Fragment,{children:[a.jsx(m1,{items:n,onChange:r,scope:i,depth:1,disabled:f}),n.length>0&&a.jsxs("p",{className:"mt-1.5 text-[12px] text-muted-foreground",children:["Reads: ",m?n.map(y=>`(${Fn(y)})`).join(" or "):Fn(n)]})]})]})}const gC=[{value:"lifecycle_transition",label:"Lifecycle transition",description:"Starts when a contact moves between lifecycle states, e.g. engaged to at_risk."},{value:"event",label:"Event",description:"Starts when your app sends one of these events, e.g. plan_upgraded."},{value:"segment",label:"Segment",description:"Everyone in a lifecycle state or retention-grid cell now, and anyone who enters it later."},{value:"date_property",label:"Date",description:"A date trait is due, e.g. three days before trial_ends_at."},{value:"date_schedule",label:"Date schedule",description:"A series of sends anchored on a date trait, e.g. 1, 3 and 7 days after first payment."},{value:"manual",label:"Manual",description:"You enroll contacts (POST /v1/flows/:id/enroll), optionally filtered by conditions."}],yC=[{value:"new",label:"New (< 30 days)"},{value:"growing",label:"Growing (30-89 days)"},{value:"established",label:"Established (90-179 days)"},{value:"loyal",label:"Loyal (180+ days)"}],vC=[{value:"active",label:"Active (inside the natural rhythm)"},{value:"cooling",label:"Cooling (1-2x the rhythm quiet)"},{value:"idle",label:"Idle (2-4x the rhythm quiet)"},{value:"dormant",label:"Dormant (4x+ the rhythm quiet)"}],Xt="mb-1.5 block text-[14px] font-medium text-foreground",si="mt-1.5 text-[13px] text-muted-foreground";function cv({options:n,selected:r,onChange:i,disabled:o,idPrefix:d}){return a.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:n.map(f=>a.jsxs("label",{htmlFor:`${d}-${f}`,className:"flex items-center gap-1.5 text-[14px] text-foreground",children:[a.jsx("input",{id:`${d}-${f}`,type:"checkbox",checked:r.includes(f),disabled:o,onChange:m=>i(m.target.checked?[...r,f]:r.filter(p=>p!==f)),className:"rounded border-input"}),a.jsx("span",{className:"font-mono text-[13px]",children:f})]},f))})}function uv({id:n,value:r,onChange:i,placeholder:o,disabled:d}){const[f,m]=j.useState(r.join(", "));return a.jsx(I,{id:n,value:f,placeholder:o,disabled:d,autoComplete:"off",onChange:p=>{m(p.target.value),i(p.target.value.split(",").map(h=>h.trim()).filter(h=>h!==""))}})}function h1({draft:n,onChange:r,disabled:i,eventSuggestions:o=[],showTypePicker:d=!0}){const f=n.config,m=h=>r({type:n.type,config:{...f,...h}}),p=h=>typeof f[h]=="string"?f[h]:"";return a.jsxs("div",{className:"space-y-4",children:[d&&a.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:gC.map(h=>{const g=n.type===h.value;return a.jsxs("button",{type:"button",disabled:i,"aria-pressed":g,onClick:()=>r({type:h.value,config:oC(h.value)}),className:`rounded-lg border p-4 text-left transition-colors ${g?"border-accent bg-accent/5":"border-border bg-card hover:border-border-strong"}`,children:[a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:h.label}),a.jsx("p",{className:"mt-1 text-[14px] leading-relaxed text-muted-foreground",children:h.description})]},h.value)})}),a.jsxs("div",{className:"space-y-4 rounded-lg border border-border bg-card p-5",children:[n.type==="lifecycle_transition"&&a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-from",className:Xt,children:"From state (optional)"}),a.jsxs(Oe,{id:"tc-from",value:p("from"),disabled:i,onChange:h=>m({from:h.target.value||void 0}),children:[a.jsx("option",{value:"",children:"Any state"}),oi.map(h=>a.jsx("option",{value:h,children:h},h))]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-to",className:Xt,children:"To state"}),a.jsxs(Oe,{id:"tc-to",value:p("to"),disabled:i,onChange:h=>m({to:h.target.value}),children:[a.jsx("option",{value:"",children:"Select state"}),oi.map(h=>a.jsx("option",{value:h,children:h},h))]})]})]}),n.type==="event"&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-event",className:Xt,children:"Event names"}),a.jsx(uv,{id:"tc-event",value:Ec(f),onChange:h=>m({event:h}),placeholder:"plan_upgraded, plan_downgraded",disabled:i}),a.jsxs("p",{className:si,children:["One or more, comma separated: any of them starts the flow.",o.length>0&&a.jsxs(a.Fragment,{children:[" Recently received: ",o.slice(0,12).join(", "),"."]})]})]}),n.type==="segment"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-4 text-[14px] text-foreground",children:[a.jsxs("label",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"radio",name:"seg-mode",checked:Gr(f),disabled:i,onChange:()=>r({type:"segment",config:{lifecycle_states:[],where:f.where}})}),"By lifecycle state"]}),a.jsxs("label",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"radio",name:"seg-mode",checked:!Gr(f),disabled:i,onChange:()=>r({type:"segment",config:{tenure_bucket:"",recency_bucket:"",where:f.where}})}),"By retention-grid cell"]})]}),Gr(f)?a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("p",{className:Xt,children:"Lifecycle states"}),a.jsx(cv,{options:oi,selected:f.lifecycle_states??[],onChange:h=>m({lifecycle_states:h}),disabled:i,idPrefix:"seg-state"})]}),a.jsxs("div",{children:[a.jsx("p",{className:Xt,children:"Engagement depth (optional)"}),a.jsx(cv,{options:J3,selected:f.engagement_depths??[],onChange:h=>m({engagement_depths:h}),disabled:i,idPrefix:"seg-depth"}),a.jsx("p",{className:si,children:"None checked: any depth."})]})]}):a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-tenure",className:Xt,children:"Tenure"}),a.jsxs(Oe,{id:"tc-tenure",value:p("tenure_bucket"),disabled:i,onChange:h=>m({tenure_bucket:h.target.value}),children:[a.jsx("option",{value:"",children:"Select tenure"}),yC.map(h=>a.jsx("option",{value:h.value,children:h.label},h.value))]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-recency",className:Xt,children:"Recency"}),a.jsxs(Oe,{id:"tc-recency",value:p("recency_bucket"),disabled:i,onChange:h=>m({recency_bucket:h.target.value}),children:[a.jsx("option",{value:"",children:"Select recency"}),vC.map(h=>a.jsx("option",{value:h.value,children:h.label},h.value))]})]})]}),a.jsx("p",{className:si,children:"Matching contacts enroll on the next scan, and whenever they match again later (re-entry rules apply)."})]}),n.type==="manual"&&a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Contacts enter when you enroll them through the API. The conditions below filter who may enter."}),n.type==="date_property"&&a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-prop",className:Xt,children:"Date trait"}),a.jsx(I,{id:"tc-prop",value:p("property"),placeholder:"trial_ends_at",disabled:i,onChange:h=>m({property:h.target.value})})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-offset",className:Xt,children:"Offset"}),a.jsx(I,{id:"tc-offset",value:p("offset"),placeholder:"-3d",disabled:i,onChange:h=>m({offset:h.target.value})})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-local",className:Xt,children:"Local send time (optional)"}),a.jsx(I,{id:"tc-local",value:p("send_at_local"),placeholder:"09:00",disabled:i,onChange:h=>m({send_at_local:h.target.value||void 0})})]}),a.jsx("p",{className:`${si} sm:col-span-3`,children:"The trait must be listed in settings.date_traits. A negative offset is before the date."})]}),n.type==="date_schedule"&&a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-anchor",className:Xt,children:"Anchor date trait"}),a.jsx(I,{id:"tc-anchor",value:p("anchor"),placeholder:"first_paid_at",disabled:i,onChange:h=>m({anchor:h.target.value})})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-offsets",className:Xt,children:"Offsets"}),a.jsx(uv,{id:"tc-offsets",value:Array.isArray(f.offsets)?f.offsets:[],onChange:h=>m({offsets:h}),placeholder:"1d, 3d, 7d, 14d, 30d",disabled:i})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-repeat",className:Xt,children:"Then repeat every (optional)"}),a.jsx(I,{id:"tc-repeat",value:p("repeat"),placeholder:"30d",disabled:i,onChange:h=>m({repeat:h.target.value||void 0})})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-max",className:Xt,children:"Maximum sends"}),a.jsx(I,{id:"tc-max",type:"number",min:1,value:typeof f.max_sends=="number"?String(f.max_sends):"",disabled:i,onChange:h=>m({max_sends:h.target.value===""?void 0:Number(h.target.value)})})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tc-local",className:Xt,children:"Local send time (optional)"}),a.jsx(I,{id:"tc-local",value:p("send_at_local"),placeholder:"09:30",disabled:i,onChange:h=>m({send_at_local:h.target.value||void 0})})]}),a.jsx("p",{className:`${si} sm:col-span-2`,children:"For a long schedule, use the Scheduled flow class so it runs alongside nurture flows."})]}),a.jsx(fi,{label:"Only when (optional)",hint:"Every condition must hold when the contact would enter.",value:Rn(f.where),onChange:h=>m({where:h}),scope:"contact",disabled:i})]})]})}const bC="mb-1 block text-[13px] font-medium text-foreground",jC="mt-1 text-[12px] text-muted-foreground";function NC(n,r){const i=n&&Array.isArray(n.steps)?n.steps:Array.isArray(r)?r:[],o=n&&Array.isArray(n.exit_conditions)?n.exit_conditions:[];return{steps:i.map(d=>({...d})),exit_conditions:o}}function dv(n){const r=n.steps.map(uC);return n.exit_conditions.length>0?{steps:r,exit_conditions:n.exit_conditions}:{steps:r}}function ot({label:n,hint:r,children:i,className:o}){return a.jsxs("div",{className:o,children:[a.jsx("p",{className:bC,children:n}),i,r&&a.jsx("p",{className:jC,children:r})]})}function st(n){return typeof n=="string"?n:typeof n=="number"?String(n):""}function x1({value:n,onChange:r,placeholder:i,disabled:o,label:d}){const[f,m]=j.useState(Array.isArray(n)?n.join(", "):"");return a.jsx(I,{"aria-label":d,className:"h-9 text-[13px]",value:f,placeholder:i,disabled:o,onChange:p=>{m(p.target.value);const h=p.target.value.split(",").map(g=>g.trim()).filter(g=>g!=="");r(h.length>0?h:void 0)}})}function p1({value:n,onChange:r,disabled:i}){const o=Array.isArray(n)?n:[],d=f=>r(f.length>0?f:void 0);return a.jsxs("div",{className:"space-y-2",children:[o.map((f,m)=>a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(I,{"aria-label":"Data source",className:"h-8 w-36 text-[13px]",placeholder:"source",value:st(f.source),disabled:i,onChange:p=>d(o.map((h,g)=>g===m?{...h,source:p.target.value}:h))}),a.jsx(I,{"aria-label":"Mode",className:"h-8 w-32 text-[13px]",placeholder:"mode",value:st(f.mode),disabled:i,onChange:p=>d(o.map((h,g)=>g===m?{...h,mode:p.target.value||void 0}:h))}),a.jsx(I,{"aria-label":"Limit",type:"number",min:1,max:100,className:"h-8 w-24 text-[13px]",placeholder:"limit",value:st(f.limit),disabled:i,onChange:p=>d(o.map((h,g)=>g===m?{...h,limit:p.target.value===""?void 0:Number(p.target.value)}:h))}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",className:"h-8",disabled:i,onClick:()=>d(o.filter((p,h)=>h!==m)),children:"Remove"})]},m)),a.jsx(H,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:i||o.length>=5,onClick:()=>d([...o,{source:""}]),children:"Add context source"})]})}function g1({value:n,onChange:r,disabled:i}){const o=n&&typeof n=="object"?n:null;return o?a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(I,{"aria-label":"KB category",className:"h-8 w-36 text-[13px]",placeholder:"category",value:st(o.category),disabled:i,onChange:d=>r({...o,category:d.target.value})}),a.jsxs(Oe,{"aria-label":"KB pick",className:"h-8 w-40 text-[13px]",value:st(o.pick)||"oldest_unused",disabled:i,onChange:d=>r({...o,pick:d.target.value}),children:[a.jsx("option",{value:"oldest_unused",children:"oldest unused"}),a.jsx("option",{value:"best_match",children:"best match"})]}),a.jsx(I,{"aria-label":"Tags from trait",className:"h-8 w-40 text-[13px]",placeholder:"tags from trait",value:st(o.tags_any_from_trait),disabled:i,onChange:d=>r({...o,tags_any_from_trait:d.target.value||void 0})}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[13px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:o.exclude_used!==!1,disabled:i,onChange:d=>r({...o,exclude_used:d.target.checked?void 0:!1})}),"never the same entry twice"]}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",className:"h-8",disabled:i,onClick:()=>r(void 0),children:"Remove"})]}):a.jsx(H,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:i,onClick:()=>r({category:""}),children:"Pick a knowledge base entry"})}function wC({value:n,onChange:r,onRemove:i,disabled:o}){const d=f=>r({...n,...f});return a.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-sunken p-3",children:[a.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[a.jsx(ot,{label:"Action type",children:a.jsx(I,{"aria-label":"Candidate action type",className:"h-8 w-44 text-[13px]",value:st(n.action_type),placeholder:"tip_trick",disabled:o,onChange:f=>d({action_type:f.target.value})})}),a.jsx(ot,{label:"Cooldown",children:a.jsx(I,{"aria-label":"Cooldown",className:"h-8 w-24 text-[13px]",value:st(n.cooldown),placeholder:"14d",disabled:o,onChange:f=>d({cooldown:f.target.value||void 0})})}),a.jsx(ot,{label:"Template (fixed copy)",children:a.jsx(I,{"aria-label":"Candidate template",className:"h-8 w-40 text-[13px]",value:st(n.template_ref),placeholder:"template slug",disabled:o,onChange:f=>d({template_ref:f.target.value||void 0})})}),a.jsx(ot,{label:"Eyebrow",children:a.jsx(I,{"aria-label":"Candidate eyebrow",className:"h-8 w-36 text-[13px]",value:st(n.eyebrow),maxLength:60,disabled:o,onChange:f=>d({eyebrow:f.target.value||void 0})})}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",className:"ml-auto h-8",disabled:o,onClick:i,children:"Remove candidate"})]}),a.jsx(ot,{label:"Instruction (default: the step's)",children:a.jsx(yn,{"aria-label":"Candidate instruction",className:"min-h-16 text-[13px]",value:st(n.brain_instruction),disabled:o,onChange:f=>d({brain_instruction:f.target.value||void 0})})}),a.jsx(ot,{label:"Allowed links",hint:"Names from settings.links, comma separated.",children:a.jsx(x1,{label:"Candidate allowed links",value:n.allowed_links,onChange:f=>d({allowed_links:f}),placeholder:"dashboard_url",disabled:o})}),a.jsx(ot,{label:"Knowledge base",children:a.jsx(g1,{value:n.kb_select,onChange:f=>d({kb_select:f}),disabled:o})}),a.jsx(ot,{label:"Context sources",children:a.jsx(p1,{value:n.context,onChange:f=>d({context:f}),disabled:o})}),a.jsx(fi,{label:"Eligible when",value:Rn(n.when),onChange:f=>d({when:f.length>0?f:void 0}),scope:"contact",disabled:o})]})}function SC({step:n,onChange:r,onRemove:i,disabled:o}){const[d,f]=j.useState(!1),m=g=>r({...n,...g}),p=n.type==="choose",h=Array.isArray(n.candidates)?n.candidates:[];return a.jsxs("li",{className:"rounded-lg border border-border bg-card",children:[a.jsxs("button",{type:"button",className:"flex w-full flex-wrap items-center gap-2 px-4 py-3 text-left",onClick:()=>f(g=>!g),"aria-expanded":d,children:[a.jsx("span",{className:"flex h-[23px] w-[23px] shrink-0 items-center justify-center rounded-full border border-border-strong font-mono text-[12px] text-muted-foreground",children:st(n.order)}),a.jsx("code",{className:"font-mono text-[13px] text-foreground",children:st(n.action_type)||"(no action type)"}),a.jsxs("span",{className:"text-[13px] text-muted-foreground",children:["after ",st(n.delay)||"?"]}),p&&a.jsx(le,{variant:"accent",children:"choose"}),typeof n.template_ref=="string"&&a.jsx(le,{variant:"muted",children:"fixed copy"}),n.condition!==void 0&&a.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["if ",Fn(n.condition)]}),a.jsx("span",{className:"ml-auto text-[12px] text-accent-text",children:d?"Close":"Edit"})]}),d&&a.jsxs("div",{className:"space-y-4 px-4 pb-4 pt-1",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[a.jsx(ot,{label:"Order",children:a.jsx(I,{"aria-label":"Order",type:"number",min:1,className:"h-9 text-[13px]",value:st(n.order),disabled:o,onChange:g=>m({order:Number(g.target.value)})})}),a.jsx(ot,{label:"Action type",children:a.jsx(I,{"aria-label":"Action type",className:"h-9 text-[13px]",value:st(n.action_type),disabled:o,onChange:g=>m({action_type:g.target.value})})}),a.jsx(ot,{label:"Delay",children:a.jsx(I,{"aria-label":"Delay",className:"h-9 text-[13px]",value:st(n.delay),placeholder:"0m, 2h, 3d",disabled:o,onChange:g=>m({delay:g.target.value})})}),a.jsx(ot,{label:"Send window",children:a.jsxs(Oe,{"aria-label":"Window policy",className:"h-9 text-[13px]",value:st(n.window_policy)||"respect_window",disabled:o,onChange:g=>m({window_policy:g.target.value}),children:[a.jsx("option",{value:"respect_window",children:"inside the window"}),a.jsx("option",{value:"immediate",children:"immediately"})]})}),a.jsx(ot,{label:"Step type",children:a.jsxs(Oe,{"aria-label":"Step type",className:"h-9 text-[13px]",value:p?"choose":"send",disabled:o,onChange:g=>m(g.target.value==="choose"?{type:"choose",candidates:h.length>0?h:[{action_type:""}]}:{type:void 0,candidates:void 0,allow_none:void 0}),children:[a.jsx("option",{value:"send",children:"send"}),a.jsx("option",{value:"choose",children:"choose (the AI picks a candidate)"})]})}),a.jsx(ot,{label:"Template (fixed copy)",children:a.jsx(I,{"aria-label":"Template",className:"h-9 text-[13px]",value:st(n.template_ref),placeholder:"template slug",disabled:o,onChange:g=>m({template_ref:g.target.value||void 0})})}),a.jsx(ot,{label:"Expires after",children:a.jsx(I,{"aria-label":"Expires after",className:"h-9 text-[13px]",value:st(n.expires_after),placeholder:"2d",disabled:o,onChange:g=>m({expires_after:g.target.value||void 0})})})]}),a.jsx(ot,{label:"Instruction for the AI",hint:"Without a template the AI drafts the email from this. Variables such as {{links.icp_url}} and {{event.plan}} work here.",children:a.jsx(yn,{"aria-label":"Instruction",className:"min-h-20 text-[13px]",value:st(n.brain_instruction),disabled:o,onChange:g=>m({brain_instruction:g.target.value||void 0})})}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[a.jsx(ot,{label:"From name",hint:"Display name only; the address stays the product's sender.",children:a.jsx(I,{"aria-label":"From name",className:"h-9 text-[13px]",value:st(n.from_name),maxLength:120,disabled:o,onChange:g=>m({from_name:g.target.value||void 0})})}),a.jsx(ot,{label:"Reply-to",children:a.jsx(I,{"aria-label":"Reply-to",className:"h-9 text-[13px]",value:st(n.reply_to),placeholder:"founder@example.com",disabled:o,onChange:g=>m({reply_to:g.target.value||void 0})})}),a.jsx(ot,{label:"Eyebrow",hint:"Small label above the heading.",children:a.jsx(I,{"aria-label":"Eyebrow",className:"h-9 text-[13px]",value:st(n.eyebrow),maxLength:60,disabled:o,onChange:g=>m({eyebrow:g.target.value||void 0})})}),a.jsx(ot,{label:"Preheader",hint:"Hidden inbox preview text.",children:a.jsx(I,{"aria-label":"Preheader",className:"h-9 text-[13px]",value:st(n.preheader),maxLength:200,disabled:o,onChange:g=>m({preheader:g.target.value||void 0})})}),a.jsx(ot,{label:"Allowed links",hint:"Names from settings.links, comma separated. Empty: every named link.",children:a.jsx(x1,{label:"Allowed links",value:n.allowed_links,onChange:g=>m({allowed_links:g}),placeholder:"icp_url, settings_url",disabled:o})}),a.jsx("div",{className:"flex items-end",children:a.jsxs("label",{className:"flex items-center gap-2 pb-2 text-[13px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:n.single_cta===!0,disabled:o,onChange:g=>m({single_cta:g.target.checked?!0:void 0})}),"At most one link (besides footer and unsubscribe)"]})})]}),a.jsx(ot,{label:"Knowledge base",children:a.jsx(g1,{value:n.kb_select,onChange:g=>m({kb_select:g}),disabled:o})}),a.jsx(ot,{label:"Context sources",hint:"Data fetched from your app when the email is written (settings.data_sources).",children:a.jsx(p1,{value:n.context,onChange:g=>m({context:g}),disabled:o})}),Array.isArray(n.context)&&n.context.length>0&&a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:w-1/2",children:[a.jsx(ot,{label:"When empty",children:a.jsxs(Oe,{"aria-label":"On empty",className:"h-9 text-[13px]",value:st(n.on_empty)||"send",disabled:o,onChange:g=>m({on_empty:g.target.value}),children:[a.jsx("option",{value:"send",children:"send anyway"}),a.jsx("option",{value:"skip",children:"skip the email"})]})}),a.jsx(ot,{label:"On error",children:a.jsxs(Oe,{"aria-label":"On error",className:"h-9 text-[13px]",value:st(n.on_error)||"defer",disabled:o,onChange:g=>m({on_error:g.target.value}),children:[a.jsx("option",{value:"defer",children:"retry later"}),a.jsx("option",{value:"skip",children:"skip the email"}),a.jsx("option",{value:"fail",children:"fail the email"})]})})]}),a.jsx(fi,{label:"Send only if",value:Rn(n.condition),onChange:g=>m({condition:g.length>0?g:void 0}),scope:"step",disabled:o}),a.jsx(fi,{label:"Exit the flow if",value:Rn(n.exit_condition),onChange:g=>m({exit_condition:g.length>0?g:void 0}),scope:"step",disabled:o}),p&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Candidates"}),a.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:n.allow_none!==!1,disabled:o,onChange:g=>m({allow_none:g.target.checked?void 0:!1})}),"The AI may choose none"]})]}),h.map((g,v)=>a.jsx(wC,{value:g,disabled:o,onChange:y=>m({candidates:h.map((b,S)=>S===v?y:b)}),onRemove:()=>m({candidates:h.filter((y,b)=>b!==v)})},v)),a.jsx(H,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:o||h.length>=20,onClick:()=>m({candidates:[...h,{action_type:""}]}),children:"Add candidate"})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(H,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:i,children:"Remove step"})})]})]})}function _C(n){if(n&&typeof n=="object"&&"kind"in n){const r=n;if(r.kind==="validation"&&r.issues)return r.issues.map(i=>i.path?`${i.path}: ${i.message}`:i.message);if(r.message)return[r.message]}return[n instanceof Error?n.message:"Saving failed."]}function kC({initial:n,onSave:r,saving:i,disabled:o}){const[d,f]=j.useState(n),[m,p]=j.useState(null),[h,g]=j.useState([]),[v,y]=j.useState(!1);async function b(){y(!1);let S=d;if(m!==null)try{const k=JSON.parse(m);if(!Array.isArray(k.steps))throw new Error("the JSON needs a steps list");S={steps:k.steps,exit_conditions:Rn(k.exit_conditions)},f(S)}catch(k){g([k instanceof Error?k.message:"invalid JSON"]);return}const w=dC(S.steps);if(S.steps.length===0&&w.push("Add at least one step."),g(w),!(w.length>0))try{await r(dv(S)),y(!0)}catch(k){g(_C(k))}}return a.jsxs("div",{children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Every step field, written out. Saving stores these steps as the flow's plan."}),a.jsx("button",{type:"button",className:"shrink-0 text-[13px] text-accent-text hover:underline",onClick:()=>p(m===null?JSON.stringify(dv(d),null,2):null),children:m===null?"Edit as JSON":"Back to the form"})]}),m!==null?a.jsx(yn,{"aria-label":"Plan as JSON",className:"min-h-96 font-mono text-[12px]",value:m,disabled:o,onChange:S=>p(S.target.value)}):a.jsxs(a.Fragment,{children:[a.jsx("ol",{className:"space-y-3",children:d.steps.map((S,w)=>a.jsx(SC,{step:S,disabled:o,onChange:k=>f({...d,steps:d.steps.map((_,A)=>A===w?k:_)}),onRemove:()=>f({...d,steps:d.steps.filter((k,_)=>_!==w)})},w))}),a.jsx(H,{type:"button",size:"sm",variant:"outline",className:"mt-3",disabled:o,onClick:()=>f({...d,steps:[...d.steps,{order:fC(d.steps),action_type:"",delay:d.steps.length===0?"0m":"1d",window_policy:"respect_window"}]}),children:"Add step"}),a.jsx("div",{className:"mt-5",children:a.jsx(fi,{label:"The flow ends early if (any of these)",value:d.exit_conditions,onChange:S=>f({...d,exit_conditions:S}),scope:"exit",anyOf:!0,disabled:o})})]}),h.length>0&&a.jsx("div",{className:"mt-4 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("ul",{className:"list-disc space-y-0.5 pl-5 text-[14px] text-foreground",children:h.map((S,w)=>a.jsx("li",{children:S},w))})}),a.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[a.jsx(H,{type:"button",onClick:()=>{b()},disabled:i||o,children:i?"Saving...":"Save steps"}),v&&h.length===0&&a.jsx("span",{className:"text-[14px] text-muted-foreground",role:"status",children:"Saved."})]})]})}const fv=["signed_up","activated","engaged","at_risk","dormant","churned","resurrected"],EC=[{value:"new",label:"New (< 30 days)"},{value:"growing",label:"Growing (30-89 days)"},{value:"established",label:"Established (90-179 days)"},{value:"loyal",label:"Loyal (180+ days)"}],CC=[{value:"active",label:"Active (inside the natural rhythm)"},{value:"cooling",label:"Cooling (1-2x the rhythm quiet)"},{value:"idle",label:"Idle (2-4x the rhythm quiet)"},{value:"dormant",label:"Dormant (4x+ the rhythm quiet)"}];function ac({message:n}){return n?a.jsx("p",{className:"mt-1 text-[13px] text-danger",role:"alert",children:n}):null}function TC({htmlFor:n,children:r,required:i}){return a.jsxs("label",{htmlFor:n,className:"mb-1.5 block text-[14px] font-medium text-foreground",children:[r,i&&a.jsx("span",{className:"ml-0.5 text-danger","aria-hidden":"true",children:"*"})]})}function mv(n){switch(n){case"active":return"success";case"draft":return"neutral";case"paused":return"warning";case"archived":return"muted"}}function AC(n){switch(n){case null:return"muted";case"pending":return"warning";case"ready":return"success";case"failed":return"danger"}}function RC(n){switch(n){case null:return"not compiled";case"pending":return"compiling";case"ready":return"ready";case"failed":return"failed"}}function ri(n){return new Date(n).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ef({step:n,title:r,description:i}){return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{"aria-hidden":"true",className:"mt-0.5 flex h-[23px] w-[23px] shrink-0 items-center justify-center rounded-full border border-border-strong bg-background font-mono text-[12px] text-muted-foreground",children:n}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:r}),i&&a.jsx("p",{className:"mt-1 text-[14px] leading-relaxed text-muted-foreground",children:i})]})]})}function hv({value:n,onChange:r,disabled:i,error:o}){return a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("input",{id:"flow-name",type:"text",value:n,onChange:d=>r(d.target.value),placeholder:"Untitled flow",disabled:i,"aria-label":"Flow name",className:"-ml-2 w-full min-w-0 rounded-md bg-transparent px-2 py-1 font-display text-[28px] font-bold leading-[34px] tracking-[-0.02em] text-foreground outline-none transition-colors placeholder:text-muted-foreground/50 hover:bg-sunken focus:bg-sunken disabled:hover:bg-transparent"}),a.jsx(ac,{message:o})]})}function OC({flow:n,onEdit:r}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card px-5 py-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Starts when"}),r&&a.jsx(H,{type:"button",size:"sm",variant:"ghost",className:"h-7",onClick:r,children:"Edit trigger"})]}),a.jsx("p",{className:"mt-1.5 text-[15px] text-foreground",children:iC(n.trigger_type,n.trigger_config??{})})]})}function zC({flow:n,suggestions:r,onDone:i}){const o=Sc(n.id),[d,f]=j.useState({type:n.trigger_type,config:{...n.trigger_config??{}}}),[m,p]=j.useState(null),h=c1(d);async function g(){p(null);try{await o.mutateAsync({trigger_type:d.type,trigger_config:u1(d)}),i()}catch(v){p(ci(v))}}return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-3 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Edit trigger"}),a.jsx("p",{className:"mb-4 text-[13px] text-muted-foreground",children:"Contacts already in the flow stay; the new trigger decides who enters from now on."}),a.jsx(h1,{draft:d,onChange:f,disabled:o.isPending,eventSuggestions:r}),h.length>0&&a.jsx("ul",{className:"mt-3 list-disc pl-5 text-[13px] text-muted-foreground",children:h.map(v=>a.jsx("li",{children:v},v))}),m&&a.jsx("p",{className:"mt-3 text-[14px] text-danger",role:"alert",children:m}),a.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[a.jsx(H,{type:"button",size:"sm",disabled:o.isPending||h.length>0,onClick:()=>{g()},children:o.isPending?"Saving...":"Save trigger"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:i,children:"Cancel"})]})]})}function MC({flow:n,disabled:r}){const i=Sc(n.id),[o,d]=j.useState(String(n.priority??0)),[f,m]=j.useState(String(n.reentry_cooldown_days??30)),[p,h]=j.useState(null),g=i.isPending||r;async function v(b){h(null);try{await i.mutateAsync(b)}catch(S){h(ci(S))}}const y=lv.find(b=>b.value===n.flow_class)?.hint;return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-4 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Flow settings"}),a.jsxs("div",{className:"space-y-4 text-[14px]",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"flow-class",className:"mb-1 block text-muted-foreground",children:"Class"}),a.jsx(Oe,{id:"flow-class",value:n.flow_class,disabled:g,onChange:b=>{v({flow_class:b.target.value})},children:lv.map(b=>a.jsx("option",{value:b.value,children:b.label},b.value))}),y&&a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:y})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"flow-priority",className:"mb-1 block text-muted-foreground",children:"Priority"}),a.jsx(I,{id:"flow-priority",type:"number",value:o,disabled:g,onChange:b=>d(b.target.value),onBlur:()=>{const b=Number(o);Number.isInteger(b)&&b!==n.priority&&v({priority:b})}})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"flow-reentry",className:"mb-1 block text-muted-foreground",children:"Re-entry"}),a.jsxs(Oe,{id:"flow-reentry",value:n.reentry_policy,disabled:g,onChange:b=>{v({reentry_policy:b.target.value})},children:[a.jsx("option",{value:"once",children:"once"}),a.jsx("option",{value:"cooldown",children:"after a cooldown"}),a.jsx("option",{value:"every_time",children:"every time"})]})]}),n.reentry_policy==="cooldown"&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"flow-cooldown",className:"mb-1 block text-muted-foreground",children:"Cooldown (days)"}),a.jsx(I,{id:"flow-cooldown",type:"number",min:1,value:f,disabled:g,onChange:b=>m(b.target.value),onBlur:()=>{const b=Number(f);Number.isInteger(b)&&b>=1&&b!==n.reentry_cooldown_days&&v({reentry_cooldown_days:b})}})]}),p&&a.jsx("p",{className:"text-[13px] text-danger",role:"alert",children:p})]})]})}function Cf(){return{name:"",trigger:{type:"lifecycle_transition",config:{}},prompt_source:"",approval_mode:"require",content_mode:"ai_drafted",steps_data:[]}}function DC(n){return{name:n.name,trigger:{type:n.trigger_type,config:{...n.trigger_config??{}}},prompt_source:n.prompt_source??"",approval_mode:n.approval_mode,content_mode:n.content_mode??"ai_drafted",steps_data:[]}}function xv(n){return u1(n.trigger)}function LC(n){const r={};for(const i of n){const o=i.path===""?"_form":i.path;r[o]=i.message}return r}function ci(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function UC(){return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(se,{className:"h-4 w-16"}),a.jsx(se,{className:"mt-4 h-8 w-64"}),a.jsxs("div",{className:"mt-8 flex gap-8",children:[a.jsxs("div",{className:"min-w-0 flex-1 space-y-4",children:[a.jsx(se,{className:"h-24 w-full"}),a.jsx(se,{className:"h-44 w-full"}),a.jsx(se,{className:"h-9 w-40"})]}),a.jsx("div",{className:"hidden w-72 shrink-0 lg:block",children:a.jsx(se,{className:"h-28 w-full"})})]})]})}function qC(n){const r=/^(\d+)([mhd])$/.exec(n);if(!r)return a.jsx("code",{className:"font-mono text-[13px]",children:n});const i=Number(r[1]);if(i===0)return"right away";const o=r[2]==="m"?"minute":r[2]==="h"?"hour":"day";return`after ${i} ${o}${i===1?"":"s"}`}function pv(n){return a.jsx("span",{children:Fn(n)})}function HC(n){return a.jsx("span",{children:Fn(n)})}function $C({step:n}){const r=[];typeof n.from_name=="string"&&r.push(`from ${n.from_name}`),typeof n.reply_to=="string"&&r.push(`reply-to ${n.reply_to}`),typeof n.eyebrow=="string"&&r.push(`eyebrow "${n.eyebrow}"`),typeof n.preheader=="string"&&r.push(`preheader "${n.preheader}"`),Array.isArray(n.allowed_links)&&r.push(`links ${n.allowed_links.join(", ")}`),n.single_cta===!0&&r.push("one call to action"),typeof n.expires_after=="string"&&r.push(`expires after ${n.expires_after}`),Array.isArray(n.context)&&r.push(`context ${n.context.map(d=>String(d.source??"")).join(", ")}`);const i=n.kb_select;i&&typeof i=="object"&&r.push(`knowledge base ${String(i.category??"")}`);const o=Array.isArray(n.candidates)?n.candidates:[];return r.length===0&&o.length===0?null:a.jsxs(a.Fragment,{children:[r.length>0&&a.jsx("p",{className:"text-[13px] text-muted-foreground",children:r.join(" · ")}),o.length>0&&a.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["the AI chooses ",n.allow_none===!1?"one of":"one of (or none)",":"," ",o.map((d,f)=>a.jsxs(im.Fragment,{children:[f>0&&", ",a.jsx("code",{className:"font-mono text-[13px]",children:String(d.action_type??"")}),d.when!==void 0?` if ${Fn(d.when)}`:""]},f))]})]})}function gv({plan:n,onEditTemplate:r}){const i=n.trigger,o=Array.isArray(n.steps)?n.steps:[],d=Array.isArray(n.exit_conditions)?n.exit_conditions:[];return a.jsxs("div",{className:"space-y-6",children:[i&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Fires when"}),a.jsxs("p",{className:"mt-1.5 text-[14px] text-foreground",children:[a.jsx("code",{className:"font-mono text-[13px]",children:String(i.type??"")}),i.condition!==null&&i.condition!==void 0&&typeof i.condition=="object"&&a.jsxs("span",{className:"text-muted-foreground",children:[" ","matching"," ",a.jsx("code",{className:"font-mono text-[13px]",children:JSON.stringify(i.condition)})]})]})]}),o.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Then, in order"}),a.jsx("ol",{className:"mt-2 list-none space-y-0",children:o.map((f,m)=>a.jsxs("li",{className:"relative flex gap-4 pb-5 last:pb-0",children:[m<o.length-1&&a.jsx("span",{"aria-hidden":"true",className:"absolute left-[11px] top-6 h-full w-px bg-border"}),a.jsx("span",{"aria-hidden":"true",className:"z-10 mt-0.5 flex h-[23px] w-[23px] shrink-0 items-center justify-center rounded-full border border-border-strong bg-background font-mono text-[12px] text-muted-foreground",children:typeof f.order=="number"?f.order:m+1}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1 pt-0.5",children:[a.jsxs("p",{className:"text-[14px] text-foreground",children:[a.jsx("code",{className:"font-mono text-[13px]",children:String(f.action_type??"")}),typeof f.delay=="string"&&a.jsxs("span",{className:"text-muted-foreground",children:[" ",qC(f.delay)]}),typeof f.window_policy=="string"&&a.jsx("span",{className:"text-muted-foreground",children:f.window_policy==="immediate"?", outside the send window":", within the send window"})]}),(typeof f.template_ref=="string"||typeof f.kb_ref=="string")&&a.jsxs("p",{className:"text-[13px] text-muted-foreground",children:[typeof f.template_ref=="string"&&(r?a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[13px] text-accent-text transition-colors hover:bg-sunken",onClick:()=>r(f.template_ref),children:["template ",a.jsx("code",{className:"font-mono",children:f.template_ref}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:"(edit)"})]}):a.jsxs(a.Fragment,{children:["template ",a.jsx("code",{className:"font-mono text-[13px]",children:f.template_ref})]})),typeof f.template_ref=="string"&&typeof f.kb_ref=="string"&&" · ",typeof f.kb_ref=="string"&&a.jsxs(a.Fragment,{children:["kb ",a.jsx("code",{className:"font-mono text-[13px]",children:f.kb_ref})]})]}),typeof f.brain_instruction=="string"&&a.jsx("p",{className:"text-[13px] italic text-muted-foreground",children:f.brain_instruction}),a.jsx($C,{step:f}),f.condition!==void 0&&f.condition!==null&&a.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["only if ",pv(f.condition)]}),f.exit_condition!==void 0&&f.exit_condition!==null&&a.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["exit the flow if ",pv(f.exit_condition)]})]})]},m))})]}),d.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"The flow ends early if"}),a.jsx("ul",{className:"mt-1.5 list-none space-y-1",children:d.map((f,m)=>a.jsx("li",{className:"text-[14px] text-muted-foreground",children:HC(f)},m))})]})]})}function yv({flow:n,busy:r,onTransition:i,onArchive:o}){const[d,f]=j.useState(!1);if(n.status==="archived")return null;if(d)return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[14px] text-muted-foreground",children:"Archive permanently? There is no way back."}),a.jsx(H,{variant:"destructive",size:"sm",disabled:r,onClick:o,children:"Archive"}),a.jsx(H,{variant:"ghost",size:"sm",disabled:r,onClick:()=>f(!1),children:"Cancel"})]});const m=n.compile_status==="ready"&&n.compiled_plan!==null;return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(H,{variant:"ghost",size:"sm",disabled:r,onClick:()=>f(!0),children:"Archive"}),(n.status==="draft"||n.status==="paused")&&a.jsx(H,{size:"sm",disabled:r||!m,title:m?void 0:"Compile the flow and wait for compile status 'ready' before activating.",onClick:()=>i("active"),children:n.status==="paused"?"Resume":"Activate"}),n.status==="active"&&a.jsx(H,{variant:"outline",size:"sm",disabled:r,onClick:()=>i("paused"),children:"Pause"})]})}function vv(){const{id:n}=gc(),r=!n,i=Gn(),[o]=km(),d=RE(n??""),f=OE(),m=Sc(n??""),p=ME(n??""),h=DE(n??""),g=LE(n??""),v=UE(n??""),y=qE(n??""),b=$E(),S=zE(),[w,k]=j.useState(Cf),[_,A]=j.useState(!1),[C,B]=j.useState(!1),[V,F]=j.useState({}),[U,Z]=j.useState(null),[Q,xe]=j.useState(null),[he,Ne]=j.useState(!1),[Ae,ee]=j.useState(!1),[ze,Ee]=j.useState(null),[G,Y]=j.useState(!1),[re,He]=j.useState(!1),W=j.useRef(null),X=j.useRef(null),je=j.useRef(null);j.useEffect(()=>{!r&&d.data&&!Ae&&(k(DC(d.data)),ee(!0))},[r,d.data,Ae]),j.useEffect(()=>{if(r&&!Ae){const ye=o.get("segment"),bt=o.get("transition");if(ye){const[ft,Ln]=ye.split(":"),us=EC.find(Js=>Js.value===ft),il=CC.find(Js=>Js.value===Ln);us&&il&&k({...Cf(),name:`${us.label.split(" (")[0]} · ${il.label.split(" (")[0]}`,trigger:{type:"segment",config:{tenure_bucket:us.value,recency_bucket:il.value}}})}else if(bt){const[ft,Ln]=bt.split(":");fv.includes(ft??"")&&fv.includes(Ln??"")&&k({...Cf(),name:o.get("name")??"",trigger:{type:"lifecycle_transition",config:{from:ft,to:Ln}}})}ee(!0)}},[r,Ae,o]);const J=r?void 0:d.data,T=c1(w.trigger).length===0;j.useEffect(()=>{r&&T&&!_&&A(!0)},[r,T,_]),j.useEffect(()=>{const ye=je.current;je.current=T,ye!==null&&r&&!ye&&T&&W.current?.scrollIntoView({behavior:"smooth",block:"start"})},[r,T]);const q=J?.source==="library",ae=J?.content_mode==="fixed_content"&&!q,fe=b.data?.llm!==null&&b.data?.llm!==void 0,Me=J!==void 0&&(J.status==="active"||J.status==="archived"),me=J?.status==="archived";if(!r&&(d.isLoading||!Ae))return a.jsx(UC,{});if(!r&&d.isError)return a.jsx("div",{className:"mx-auto max-w-6xl",children:a.jsx("div",{className:"rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load flow:"," ",d.error instanceof Error?d.error.message:"Unknown error"]})})});function ke(ye,bt){k(ft=>({...ft,[ye]:bt})),ye in V&&F(ft=>{const Ln={...ft};return delete Ln[ye],Ln})}function ce(ye){ke("prompt_source",ye),!C&&J&&J.prompt_source!==ye&&B(!0)}function ve(){F({}),Z(null),Ne(!1)}function Ot(ye){if(ye!==null&&typeof ye=="object"&&"kind"in ye){const bt=ye;bt.kind==="validation"?F(LC(bt.issues)):Z(bt.message)}else Z(ye instanceof Error?ye.message:"An unexpected error occurred.")}async function Mn(ye){ye.preventDefault(),ve();const bt=xv(w);if(r)try{const ft=await f.mutateAsync({name:w.name,trigger_type:w.trigger.type,trigger_config:bt,prompt_source:w.content_mode==="ai_drafted"?w.prompt_source:void 0,content_mode:w.content_mode,steps:[],approval_mode:w.approval_mode});i(`/flows/${ft.id}/edit`)}catch(ft){Ot(ft)}else try{await m.mutateAsync({name:w.name,prompt_source:w.content_mode==="ai_drafted"?w.prompt_source:void 0,approval_mode:w.approval_mode}),B(!1),Ne(!0)}catch(ft){Ot(ft)}}async function Ca(){if(!n)return;ve();const ye=w.steps_data.filter(bt=>!bt.subject.trim()||!bt.body_html.trim());if(ye.length>0){Z(`Step ${ye[0].order} is missing a subject or body.`);return}if(w.steps_data.length===0){Z("Add at least one step before saving the plan.");return}try{await v.mutateAsync(F3(w.steps_data)),Ne(!0)}catch(bt){Ot(bt)}}async function bn(){xe(null);try{await p.mutateAsync()}catch(ye){xe(ci(ye))}}async function vt(ye){Z(null);try{await h.mutateAsync(ye)}catch(bt){Z(ci(bt))}}async function Ie(){Z(null);try{await g.mutateAsync(),i("/flows")}catch(ye){Z(ci(ye))}}const nt=f.isPending||m.isPending||v.isPending,Ta=h.isPending||g.isPending||nt,Dn=p.isPending||J?.compile_status==="pending",Xs=!Me&&C&&J!==void 0&&J.compiled_plan!==null,Zs=!r&&J?.compile_status==="ready"&&J.compiled_plan!==null;if(q&&J)return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx($e,{to:"/flows",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← Flows"}),a.jsxs("div",{className:"mt-2 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",children:[a.jsx("h1",{className:"font-display text-[24px] font-bold leading-[30px] tracking-[-0.02em] text-foreground sm:text-[28px] sm:leading-[34px]",children:J.name}),a.jsx(le,{variant:mv(J.status),children:J.status}),a.jsx(le,{variant:"muted",children:"Fixed copy"})]}),a.jsx(yv,{flow:J,busy:Ta,onTransition:vt,onArchive:Ie})]})]}),U&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:U})}),a.jsx("div",{className:"mb-6 rounded-md border border-border bg-sunken px-4 py-3",children:a.jsx("p",{className:"text-[14px] leading-relaxed text-foreground",children:"This is a ready-made flow that sends fixed email copy from templates. It works without an LLM key. Click any template below to edit its content."})}),a.jsxs("div",{className:"flex flex-col gap-10 lg:flex-row lg:gap-8",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[J.compiled_plan&&a.jsxs("div",{children:[a.jsx("p",{className:"mb-4 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Email sequence"}),a.jsx(gv,{plan:J.compiled_plan,onEditTemplate:ye=>Ee(ye)})]}),ze&&a.jsx("div",{className:"mt-6 rounded-lg border border-border bg-card p-6",children:a.jsx(sv,{slug:ze,onClose:()=>Ee(null)})}),a.jsxs("div",{className:"mt-8 rounded-md border border-border bg-sunken px-4 py-4",children:[a.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"What changes with an LLM key"}),a.jsx("p",{className:"mt-2 text-[14px] leading-relaxed text-muted-foreground",children:"With an LLM configured, you can create flows where the AI drafts each email for each contact individually, using your knowledge base for context. Every person gets a message written for their situation instead of the same copy."}),a.jsx("p",{className:"mt-2 text-[14px] leading-relaxed text-muted-foreground",children:"This flow keeps working as-is. The AI is for new flows you write from a prompt."}),a.jsx($e,{to:"/settings/llm",className:"mt-3 inline-block text-[14px] text-accent-text transition-colors hover:underline",children:"Configure LLM provider"})]})]}),a.jsxs("div",{className:"w-full shrink-0 space-y-6 lg:w-72",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-4 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Details"}),a.jsxs("dl",{className:"space-y-3 text-[14px]",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Name"}),a.jsx("dd",{className:"mt-0.5 font-medium text-foreground",children:J.name})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Trigger"}),a.jsx("dd",{className:"mt-0.5 font-mono text-[13px] text-foreground",children:J.trigger_type})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Content"}),a.jsx("dd",{className:"mt-0.5 text-foreground",children:"Fixed templates (no AI)"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Approval"}),a.jsx("dd",{className:"mt-0.5 text-foreground",children:J.approval_mode==="auto"?"Automatic":"Manual review"})]})]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-3 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Meta"}),a.jsxs("dl",{className:"space-y-2 text-[14px]",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"ID"}),a.jsx("dd",{className:"mt-0.5 truncate font-mono text-[13px] text-muted-foreground",title:J.id,children:J.id})]}),a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("dt",{className:"text-muted-foreground",children:"Created"}),a.jsx("dd",{className:"font-mono text-[13px] text-muted-foreground",children:ri(J.created_at)})]}),a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("dt",{className:"text-muted-foreground",children:"Updated"}),a.jsx("dd",{className:"font-mono text-[13px] text-muted-foreground",children:ri(J.updated_at)})]})]})]})]})]})]});const Vn=r?w.content_mode==="fixed_content":ae,Is=a.jsxs("div",{children:[a.jsxs("p",{className:"mb-3 text-[14px] leading-relaxed text-muted-foreground",children:["Write each email in the sequence below. Use ","{{variables}}"," for personalisation - the same copy goes to everyone with their details filled in. Save the plan when you are done, then activate the flow to start sending."]}),a.jsx("div",{className:"mb-6 rounded-md border border-border bg-sunken px-4 py-3",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[14px] font-medium text-foreground",children:w.approval_mode==="require"?"You review each message before it sends":"Approval is off"}),a.jsx("p",{className:"mt-1 text-[14px] leading-relaxed text-muted-foreground",children:w.approval_mode==="require"?"Each message waits for your approval before sending. Turn this off only if you fully trust the copy and the variable fallbacks.":"Since you wrote the copy, each message does not need individual review. Variables and fallbacks can still produce unexpected results - preview against real contacts before activating."})]}),a.jsxs("label",{className:"flex shrink-0 items-center gap-2 whitespace-nowrap text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:w.approval_mode==="require",onChange:ye=>ke("approval_mode",ye.target.checked?"require":"auto"),disabled:nt||me,className:"h-4 w-4 accent-(--accent-deep)"}),"Require per-message review"]})]})}),a.jsx(Q3,{flowId:n,steps:w.steps_data,onStepsChange:ye=>ke("steps_data",ye),disabled:nt||me,hasLlm:fe,triggerType:w.trigger.type,triggerConfig:xv(w),flowName:w.name}),!r&&!me&&a.jsx("div",{className:"mt-6 border-t border-border pt-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{type:"button",onClick:Ca,disabled:nt||w.steps_data.length===0,children:v.isPending?"Saving plan...":"Save plan"}),J?.compile_status==="ready"&&a.jsx(le,{variant:"success",children:"ready"}),he&&!U&&a.jsx("span",{className:"text-[14px] text-muted-foreground",role:"status",children:"Saved."})]})})]}),cs=a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[!r&&a.jsx(TC,{htmlFor:"prompt-source",children:"Prompt"}),a.jsx("p",{className:"mb-3 text-[14px] leading-relaxed text-muted-foreground",children:"Describe what this flow should do, in your own words. Claros compiles it into a deterministic plan you review before anything is sent. The AI then drafts each email for each contact individually."}),J?.status==="active"&&a.jsx("p",{className:"mb-3 rounded-md border border-border bg-secondary px-3.5 py-2.5 text-[14px] text-muted-foreground",role:"note",children:"The prompt is locked while the flow is active. Pause the flow to make changes."}),J?.status==="archived"&&a.jsx("p",{className:"mb-3 rounded-md border border-border bg-secondary px-3.5 py-2.5 text-[14px] text-muted-foreground",role:"note",children:"This flow is archived. Archived is terminal; nothing here can be edited."}),Xs&&a.jsx("p",{className:"mb-3 rounded-md border border-warning bg-warning-soft px-3.5 py-2.5 text-[14px] text-foreground",role:"note",children:"Saving will clear the existing compiled plan and reset compile status. You will need to recompile before activating the flow."}),a.jsx(yn,{id:"prompt-source",value:w.prompt_source,onChange:ye=>ce(ye.target.value),className:"min-h-44 text-[16px] leading-relaxed",placeholder:"When a contact becomes at-risk, send a short check-in email after two days, then a win-back offer after seven.",disabled:nt||Me}),a.jsx(ac,{message:V.prompt_source}),a.jsxs("div",{className:"mt-5",children:[a.jsxs("label",{htmlFor:"approval-mode",className:"flex items-center gap-2.5 text-[14px] font-medium text-foreground",children:[a.jsx("input",{id:"approval-mode",type:"checkbox",checked:w.approval_mode==="require",onChange:ye=>ke("approval_mode",ye.target.checked?"require":"auto"),disabled:nt||me,className:"h-4 w-4 shrink-0 accent-(--accent-deep)"}),"Require my review before anything sends"]}),w.approval_mode==="auto"&&a.jsx("div",{className:"mt-3 rounded-md border border-warning bg-warning-soft px-3.5 py-2.5",role:"note",children:a.jsx("p",{className:"text-[14px] leading-relaxed text-foreground",children:"Review is off. Drafts from this flow will send without a human ever seeing them. The AI drafts from your knowledge base and can still get things wrong - wrong tone, wrong fact, wrong moment. What goes out is your responsibility."})}),a.jsx(ac,{message:V.approval_mode})]})]}),!r&&J&&J.status!=="archived"&&a.jsxs("div",{className:"mt-6 border-t border-border pt-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{type:"button",variant:"outline",size:"sm",disabled:Dn||nt||!J.prompt_source,onClick:bn,children:Dn?"Compiling...":"Compile"}),a.jsx(le,{variant:AC(J.compile_status),pulse:J.compile_status==="pending",children:RC(J.compile_status)}),J.compiled_at&&a.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:ri(J.compiled_at)})]}),J.compile_status==="failed"&&J.compile_error&&a.jsx("div",{className:"mt-3 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5",role:"alert",children:a.jsx("p",{className:"whitespace-pre-wrap break-words font-mono text-[13px] text-foreground",children:J.compile_error})}),Q&&a.jsx("div",{className:"mt-3 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5",role:"alert",children:a.jsx("p",{className:"text-[14px] text-foreground",children:Q})})]}),Zs&&a.jsxs("div",{className:"mt-6 border-t border-border pt-6",children:[a.jsx("p",{className:"mb-4 text-[14px] font-medium text-foreground",children:"Compiled plan"}),a.jsx(gv,{plan:J.compiled_plan,onEditTemplate:ye=>Ee(ye)})]}),ze&&a.jsx("div",{className:"mt-6 rounded-lg border border-border bg-card p-6",children:a.jsx(sv,{slug:ze,onClose:()=>Ee(null)})})]});return r?a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsxs("div",{className:"mb-10",children:[a.jsx($e,{to:"/flows",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← Flows"}),a.jsx("p",{className:"mt-6 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"New flow"}),a.jsx("div",{className:"mt-1",children:a.jsx(hv,{value:w.name,onChange:ye=>ke("name",ye),disabled:nt,error:V.name})})]}),U&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:U})}),a.jsxs("form",{onSubmit:Mn,noValidate:!0,children:[a.jsxs("section",{children:[a.jsx(Ef,{step:1,title:"When does this flow start?",description:"The trigger decides which contacts enter the flow. You can change it later from the flow's page."}),a.jsx("div",{className:"mt-4",children:a.jsx(h1,{draft:w.trigger,onChange:ye=>ke("trigger",ye),disabled:nt,eventSuggestions:S.data??[]})}),a.jsx(ac,{message:V.trigger_type??V.trigger_config})]}),T&&a.jsxs("section",{ref:W,className:"mt-10 scroll-mt-8",children:[a.jsx(Ef,{step:2,title:"Who writes the emails?"}),a.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[a.jsxs("button",{type:"button","aria-pressed":w.content_mode==="fixed_content",onClick:()=>{ke("content_mode","fixed_content"),A(!0)},className:`rounded-lg border p-4 text-left transition-colors ${w.content_mode==="fixed_content"?"border-accent bg-accent/5":"border-border bg-card hover:border-border-strong"}`,children:[a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:"I write them"}),a.jsx("p",{className:"mt-1 text-[14px] leading-relaxed text-muted-foreground",children:"Write each email once. Everyone gets the same copy, personalised with variables. No LLM provider needed."})]}),a.jsxs("button",{type:"button","aria-pressed":w.content_mode==="ai_drafted",onClick:()=>{ke("content_mode","ai_drafted"),A(!0)},className:`rounded-lg border p-4 text-left transition-colors ${w.content_mode==="ai_drafted"?"border-accent bg-accent/5":"border-border bg-card hover:border-border-strong"}`,children:[a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:"AI drafts each one"}),a.jsx("p",{className:"mt-1 text-[14px] leading-relaxed text-muted-foreground",children:"Describe what you want. The AI drafts a unique email for each contact using their context. Requires an LLM provider."})]})]})]}),T&&_&&a.jsxs("section",{ref:X,className:"mt-10 scroll-mt-8",children:[a.jsx(Ef,{step:3,title:Vn?"Write the sequence":"Describe the flow"}),a.jsx("div",{className:"mt-5",children:Vn?Is:cs})]}),T&&_&&a.jsxs("div",{className:"mt-10 flex items-center gap-3 border-t border-border pt-6",children:[a.jsx(H,{type:"submit",disabled:nt,children:nt?"Creating...":"Create flow"}),a.jsx(H,{type:"button",variant:"ghost",onClick:()=>i("/flows"),disabled:nt,children:"Cancel"})]})]})]}):a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx($e,{to:"/flows",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← Flows"}),a.jsxs("div",{className:"mt-2 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-start gap-3",children:[a.jsx(hv,{value:w.name,onChange:ye=>ke("name",ye),disabled:nt||me,error:V.name}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2 pt-2",children:[J&&a.jsx(le,{variant:mv(J.status),children:J.status}),J&&!ae&&a.jsx(le,{variant:"neutral",children:"AI-drafted"}),ae&&a.jsx(le,{variant:"muted",children:"Person-written"})]})]}),J&&a.jsx("div",{className:"shrink-0 pt-0 sm:pt-2",children:a.jsx(yv,{flow:J,busy:Ta,onTransition:vt,onArchive:Ie})})]})]}),U&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:U})}),a.jsx("form",{onSubmit:Mn,noValidate:!0,children:a.jsxs("div",{className:"flex flex-col gap-10 lg:flex-row lg:gap-8",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[J&&!G&&a.jsx(OC,{flow:J,onEdit:me?void 0:()=>Y(!0)}),J&&G&&a.jsx(zC,{flow:J,suggestions:S.data??[],onDone:()=>Y(!1)}),J&&a.jsx(I3,{flow:J,disabled:me}),a.jsx("div",{className:"mt-8",children:Vn?Is:cs}),J&&!me&&a.jsxs("div",{className:"mt-8 rounded-lg border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[15px] font-semibold text-foreground",children:"Plan editor"}),a.jsxs("p",{className:"mt-0.5 text-[13px] text-muted-foreground",children:["Write the steps out: choose steps, context sources, knowledge base, sender name, eyebrow and preheader, links, expiry and conditions.",J.prompt_source?" Saving replaces the compiled plan until the prompt is compiled again.":""]})]}),a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:()=>He(ye=>!ye),children:re?"Close":"Open"})]}),re&&a.jsx("div",{className:"mt-5",children:a.jsx(kC,{initial:NC(J.compiled_plan,J.steps),saving:y.isPending,onSave:async ye=>{await y.mutateAsync(ye)}},J.compiled_at??"none")})]}),!me&&a.jsxs("div",{className:"mt-8 flex items-center gap-3 border-t border-border pt-6",children:[a.jsx(H,{type:"submit",disabled:nt,children:nt?"Saving...":"Save changes"}),a.jsx(H,{type:"button",variant:"ghost",onClick:()=>i("/flows"),disabled:nt,children:"Cancel"}),he&&!U&&a.jsx("span",{className:"text-[14px] text-muted-foreground",role:"status",children:"Saved."})]})]}),J&&a.jsxs("div",{className:"w-full shrink-0 space-y-6 lg:w-72",children:[a.jsx(MC,{flow:J,disabled:me}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-3 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Meta"}),a.jsxs("dl",{className:"space-y-2 text-[14px]",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"ID"}),a.jsx("dd",{className:"mt-0.5 truncate font-mono text-[13px] text-muted-foreground",title:J.id,children:J.id})]}),a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("dt",{className:"text-muted-foreground",children:"Created"}),a.jsx("dd",{className:"font-mono text-[13px] text-muted-foreground",children:ri(J.created_at)})]}),a.jsxs("div",{className:"flex justify-between gap-4",children:[a.jsx("dt",{className:"text-muted-foreground",children:"Updated"}),a.jsx("dd",{className:"font-mono text-[13px] text-muted-foreground",children:ri(J.updated_at)})]})]})]})]})]})})]})}const gi=["messages"],y1=["messages","failed"],Cc=["messages","approved"];function BC(){return el({queryKey:gi,queryFn:({pageParam:n})=>sl(n),initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0})}function Tc(n,r){n.setQueryData(gi,i=>i&&{...i,pages:i.pages.map(o=>({...o,messages:o.messages.filter(d=>d.id!==r)}))})}function QC(){const n=_e();return pe({mutationFn:r=>x_(r),onSuccess:(r,i)=>Tc(n,i)})}function FC(){const n=_e();return pe({mutationFn:r=>p_(r),onSuccess:(r,i)=>Tc(n,i)})}function Km(n,r){const i=new Set(r);n.setQueryData(gi,o=>o&&{...o,pages:o.pages.map(d=>({...d,messages:d.messages.filter(f=>!i.has(f.id))}))})}function PC(){const n=_e();return pe({mutationFn:r=>N_(r),onSuccess:r=>Km(n,r.acted)})}function KC(){const n=_e();return pe({mutationFn:r=>w_(r),onSuccess:r=>Km(n,r.acted)})}function YC(){return Ye({queryKey:y1,queryFn:m_,refetchInterval:3e4})}function GC(){const n=_e();return pe({mutationFn:r=>h_(r),onSuccess:()=>{n.invalidateQueries({queryKey:y1})}})}function VC(){const n=_e();return pe({mutationFn:r=>b_(r.id,{subject:r.subject,body_markdown:r.body_markdown}),onSuccess:()=>{n.invalidateQueries({queryKey:gi,exact:!0})}})}function XC(){const n=_e();return pe({mutationFn:r=>g_(r.id,r.actionType),onSuccess:(r,i)=>Tc(n,i.id)})}function ZC(){const n=_e();return pe({mutationFn:r=>j_(r),onSuccess:r=>{Km(n,r.cancelled),n.invalidateQueries({queryKey:Cc})}})}function IC(){return Ye({queryKey:Cc,queryFn:()=>sl(void 0,"approved"),refetchInterval:3e4})}function JC(){const n=_e();return pe({mutationFn:r=>y_(r),onSettled:()=>{n.invalidateQueries({queryKey:Cc})}})}function WC(){const n=_e();return pe({mutationFn:r=>v_(r),onSettled:()=>{n.invalidateQueries({queryKey:Cc}),n.invalidateQueries({queryKey:gi,exact:!0})}})}function Ym(n){return new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function eT(n){return n.slice(0,8)}function Ir(n){return n.contact.name??n.contact.email??n.contact.external_id??eT(n.contact_id)}function tT({message:n,flowName:r,active:i,checked:o,onPreview:d,onToggleCheck:f}){return a.jsxs("div",{className:qe("flex items-start gap-2.5 rounded-md px-2.5 py-2.5 transition-colors duration-(--dur-fast)",i?"bg-accent-soft":"hover:bg-secondary"),children:[a.jsx("input",{type:"checkbox",checked:o,onChange:f,onClick:m=>m.stopPropagation(),"aria-label":`Select draft for ${Ir(n)}`,className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-(--accent-deep)"}),a.jsxs("button",{type:"button",onClick:d,className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[a.jsx("span",{className:qe("block truncate text-[14px] font-medium",i?"text-accent-text":"text-foreground"),children:Ir(n)}),a.jsxs("span",{className:"mt-0.5 block truncate text-[13px] text-foreground",children:[n.flow?.class==="critical"&&a.jsx("span",{className:"mr-1.5 rounded-sm bg-danger-soft px-1 text-[11px] font-medium text-danger",children:"critical"}),n.subject??"(no subject)"]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[12px] text-muted-foreground",children:[r??"Unknown flow",n.flow_step_order!==null&&` · step ${n.flow_step_order}`," · ",a.jsx("span",{className:"font-mono",children:Ym(n.created_at)})]})]})]})}function nT({message:n}){return n.body_html?a.jsx("iframe",{sandbox:"",referrerPolicy:"no-referrer",title:"Draft preview",srcDoc:n.body_html,className:"h-[300px] w-full rounded-md border border-border bg-white sm:h-[420px]"}):n.body_text?a.jsx("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap rounded-md border border-border bg-card p-4 font-mono text-[13px] text-foreground",children:n.body_text}):a.jsx("p",{className:"rounded-md border border-border bg-card p-4 text-[14px] text-muted-foreground",children:"This draft has no body content."})}function aT(){return a.jsxs("div",{className:"flex gap-6",children:[a.jsx("div",{className:"w-80 shrink-0 space-y-2",children:Array.from({length:6}).map((n,r)=>a.jsx(se,{className:"h-16 w-full"},r))}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-4",children:[a.jsx(se,{className:"h-6 w-64"}),a.jsx(se,{className:"h-96 w-full"})]})]})}function sT(){const n=YC(),r=GC(),i=Ps(),o=j.useMemo(()=>{const f=new Map;for(const m of i.data?.flows??[])f.set(m.id,m.name);return f},[i.data]),d=n.data?.messages??[];return n.isLoading||d.length===0?null:a.jsxs("details",{className:"group mt-10 rounded-lg border border-border bg-card",children:[a.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-3 px-6 py-4",children:[a.jsx("span",{className:"text-[15px] font-medium text-foreground",children:"Needs attention"}),a.jsxs(le,{variant:"danger",children:[d.length," failed"]}),a.jsx("span",{className:"flex-1"}),a.jsx("span",{className:"text-[13px] text-muted-foreground transition-transform duration-(--dur-fast) group-open:rotate-90",children:"›"})]}),a.jsxs("div",{className:"border-t border-border px-6 pb-6",children:[a.jsx("p",{className:"mt-4 text-[14px] text-muted-foreground",children:"These messages stopped permanently. The reason is recorded on each; fix the cause, then retry generation failures."}),a.jsx("ul",{className:"mt-4 divide-y divide-border",children:d.map(f=>{const m=f.brain_reasoning?.startsWith("generation_failed:")??!1;return a.jsxs("li",{className:"flex items-start justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"text-[14px] font-medium text-foreground",children:[o.get(f.flow_id)??"Unknown flow",a.jsxs("span",{className:"ml-2 text-[13px] text-muted-foreground",children:["to ",Ir(f)]})]}),a.jsx("p",{className:"mt-0.5 text-[14px] text-muted-foreground",children:f.brain_reasoning??"Send failed permanently after retries."}),a.jsx("p",{className:"mt-0.5 font-mono text-[13px] text-subtle-foreground",children:Ym(f.updated_at)})]}),m&&a.jsx(H,{variant:"outline",size:"sm",onClick:()=>r.mutate(f.id),disabled:r.isPending,children:"Retry generation"})]},f.id)})}),r.isError&&a.jsx("p",{className:"mt-3 text-[14px] text-danger",children:r.error instanceof Error?r.error.message:"Retry failed."})]})]})}function rT(){const n=IC(),r=JC(),i=WC(),[o,d]=j.useState(null),f=n.data?.messages??[];if(n.isLoading||f.length===0)return null;const m=p=>{const h=p;d(h?.status===409?`Already ${h.currentStatus??"moved on"}; nothing changed.`:h?.message??"Action failed.")};return a.jsxs("details",{className:"group mt-6 rounded-lg border border-border bg-card",children:[a.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-3 px-6 py-4",children:[a.jsx("span",{className:"text-[15px] font-medium text-foreground",children:"Approved, not sent yet"}),a.jsx(le,{variant:"neutral",children:f.length}),a.jsx("span",{className:"flex-1"}),a.jsx("span",{className:"text-[13px] text-muted-foreground transition-transform duration-(--dur-fast) group-open:rotate-90",children:"›"})]}),a.jsxs("div",{className:"border-t border-border px-6 pb-6",children:[a.jsx("ul",{className:"mt-2 divide-y divide-border",children:f.map(p=>a.jsxs("li",{className:"flex items-center justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-[14px] font-medium text-foreground",children:p.subject??"(no subject)"}),a.jsxs("p",{className:"mt-0.5 truncate text-[13px] text-muted-foreground",children:["to ",Ir(p),p.waiting_reason?` · ${p.waiting_reason}`:""]})]}),a.jsxs("div",{className:"flex shrink-0 gap-2",children:[a.jsx(H,{variant:"outline",size:"sm",disabled:i.isPending,onClick:()=>{d(null),i.mutate(p.id,{onError:m})},children:"Back to review"}),a.jsx(H,{variant:"outline",size:"sm",disabled:r.isPending,onClick:()=>{d(null),r.mutate(p.id,{onError:m})},children:"Cancel send"})]})]},p.id))}),o&&a.jsx("p",{className:"mt-3 text-[14px] text-muted-foreground",role:"status",children:o})]})]})}function lT({message:n,onDone:r}){const i=VC(),[o,d]=j.useState(n.subject??""),[f,m]=j.useState(n.body_text??"");function p(){i.mutate({id:n.id,subject:o.trim(),body_markdown:f},{onSuccess:()=>r("Draft updated. The drafted version is kept on the message."),onError:h=>{const g=h;r(g?.status===409?`That draft is already ${g.currentStatus??"handled"}; the edit was not saved.`:`Could not save: ${g?.message??"unexpected error"}.`)}})}return a.jsxs("div",{className:"mt-5 space-y-3",children:[a.jsxs("label",{className:"block text-[13px] font-medium text-muted-foreground",children:["Subject",a.jsx("input",{value:o,onChange:h=>d(h.target.value),className:"mt-1 h-9 w-full rounded-md border border-border bg-card px-3 text-[14px] text-foreground"})]}),a.jsxs("label",{className:"block text-[13px] font-medium text-muted-foreground",children:["Body (Markdown)",a.jsx("textarea",{value:f,onChange:h=>m(h.target.value),rows:14,className:"mt-1 w-full rounded-md border border-border bg-card p-3 font-mono text-[13px] text-foreground"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(H,{size:"sm",onClick:p,disabled:i.isPending||o.trim().length===0||f.trim().length===0,children:i.isPending?"Saving...":"Save edit"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>r(null),disabled:i.isPending,children:"Discard"})]})]})}function iT(){const n=BC(),r=Ps(),i=QC(),o=FC(),d=PC(),f=KC(),m=XC(),p=ZC(),h=_e(),[g,v]=j.useState(!1),[y,b]=j.useState(""),S=j.useMemo(()=>n.data?.pages.flatMap(X=>X.messages)??[],[n.data]),w=j.useMemo(()=>{const X=new Map;for(const je of r.data?.flows??[])X.set(je.id,je.name);return X},[r.data]),[k,_]=j.useState(null),[A,C]=j.useState(new Set),[B,V]=j.useState(null);j.useEffect(()=>{if(S.length===0){k!==null&&_(null),A.size>0&&C(new Set);return}(!k||!S.some(X=>X.id===k))&&_(S[0].id),C(X=>{const je=new Set([...X].filter(J=>S.some(T=>T.id===J)));return je.size===X.size?X:je})},[S,k,A.size]);const F=S.find(X=>X.id===k)??null,U=i.isPending||o.isPending||m.isPending||p.isPending;j.useEffect(()=>{v(!1),b("")},[k]);const Z=d.isPending||f.isPending;function Q(X,je){const J=X;if(J&&J.status===409&&F){Tc(h,F.id),V(`That draft was already ${J.currentStatus??"handled"} elsewhere. It has been removed from your queue.`);return}V(`Could not ${je} the draft: ${J?.message??"unexpected error"}. It is still in your queue.`)}function xe(){F&&(V(null),i.mutate(F.id,{onError:X=>Q(X,"approve")}))}function he(){F&&(V(null),o.mutate(F.id,{onError:X=>Q(X,"reject")}))}function Ne(){if(!F)return;V(null);const X=y.trim()||void 0;m.mutate({id:F.id,actionType:X},{onSuccess:()=>V(X?`Sent back for a new draft as "${X}".`:"Sent back for a new draft."),onError:je=>Q(je,"regenerate")})}function Ae(){if(!F)return;const X=Ir(F);window.confirm(`Exclude ${X} from lifecycle mail? Their address is suppressed and every message not sent yet is cancelled.`)&&(V(null),p.mutate(F.contact_id,{onSuccess:je=>V(`${X} excluded. ${je.cancelled.length} unsent ${je.cancelled.length===1?"message":"messages"} cancelled.`),onError:je=>V(`Could not exclude: ${je instanceof Error?je.message:"unexpected error"}.`)}))}const ee=j.useCallback(X=>{const je=X.target;if(je&&(je.tagName==="INPUT"||je.tagName==="TEXTAREA"||je.isContentEditable)||X.metaKey||X.ctrlKey||X.altKey||S.length===0)return;const J=S.findIndex(T=>T.id===k);if(X.key==="j"||X.key==="k"){const T=X.key==="j"?Math.min(J+1,S.length-1):Math.max(J-1,0);_(S[T].id),V(null),X.preventDefault()}else X.key==="a"&&!g&&!U?(xe(),X.preventDefault()):X.key==="r"&&!g&&!U?(he(),X.preventDefault()):X.key==="e"&&!g&&(v(!0),X.preventDefault())},[S,k,g,U]);j.useEffect(()=>(window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)),[ee]);function ze(X){C(je=>{const J=new Set(je);return J.has(X)?J.delete(X):J.add(X),J})}const Ee=S.length>0&&A.size===S.length;function G(){C(Ee?new Set:new Set(S.map(X=>X.id)))}function Y(X){const je=[...A];if(je.length===0)return;V(null),(X==="approve"?d:f).mutate(je,{onSuccess:T=>{C(new Set),T.skipped.length>0&&V(`${T.acted.length} ${X==="approve"?"approved":"rejected"}. ${T.skipped.length} could not be moved (already handled elsewhere) and stayed in the queue.`)},onError:T=>{V(`Bulk ${X} failed: ${T instanceof Error?T.message:"unexpected error"}. Nothing was changed.`)}})}const re=S.length,He=n.hasNextPage,W=Ye({queryKey:["messages","pending_generation","llm_budget"],queryFn:()=>sl(void 0,"pending_generation"),select:X=>X.messages.filter(je=>je.status_reason==="llm_budget").length,refetchInterval:6e4});return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Review",title:"Approvals",subtitle:n.isLoading?"Loading the review queue.":re===0?"Nothing is waiting for review.":`${re}${He?"+":""} ${re===1?"draft":"drafts"} waiting for review`}),(W.data??0)>0&&a.jsxs("p",{className:"mb-4 rounded-md border border-border bg-muted px-4 py-3 text-[14px] text-foreground",role:"status",children:[W.data," ",W.data===1?"draft waits":"drafts wait"," for tomorrow's LLM budget (status reason ",a.jsx("code",{className:"font-mono text-[13px]",children:"llm_budget"}),"): the product's daily token budget (settings.llm_daily_token_budget) is spent. They are drafted after midnight UTC."]}),n.isLoading&&a.jsx(aT,{}),n.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load the queue:"," ",n.error instanceof Error?n.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>n.refetch(),children:"Try again"})]}),!n.isLoading&&!n.isError&&re===0&&a.jsx(ls,{icon:zm,title:"Nothing is waiting for review",description:'When a flow with approval mode "require" produces a draft, it lands here: the queue on the left, the email preview on the right.'}),!n.isLoading&&!n.isError&&re>0&&a.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[a.jsxs("div",{className:"w-full shrink-0 lg:w-80",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-md border border-border bg-card px-2.5 py-2",children:[a.jsx("input",{type:"checkbox",checked:Ee,onChange:G,"aria-label":"Select all drafts",className:"h-4 w-4 shrink-0 cursor-pointer accent-(--accent-deep) disabled:cursor-default"}),A.size===0?a.jsx("span",{className:"text-[13px] text-muted-foreground",children:"Select drafts to act on many at once"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-[13px] font-medium text-foreground",children:[A.size," selected"]}),a.jsx("span",{className:"flex-1"}),a.jsx(H,{size:"sm",onClick:()=>Y("approve"),disabled:Z,children:d.isPending?"Approving...":"Approve all"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>Y("reject"),disabled:Z,children:f.isPending?"Rejecting...":"Reject all"})]})]}),a.jsx("div",{className:"space-y-0.5",children:S.map(X=>a.jsx(tT,{message:X,flowName:w.get(X.flow_id),active:X.id===k,checked:A.has(X.id),onPreview:()=>{_(X.id),V(null)},onToggleCheck:()=>ze(X.id)},X.id))}),He&&a.jsx(H,{variant:"ghost",size:"sm",className:"mt-2 w-full",disabled:n.isFetchingNextPage,onClick:()=>n.fetchNextPage(),children:n.isFetchingNextPage?"Loading...":"Load more"})]}),F&&a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:F.subject??"(no subject)"}),a.jsxs("p",{className:"mt-1 text-[14px] text-muted-foreground",children:["to ",a.jsx("span",{className:"text-foreground",children:Ir(F)}),F.contact.email&&F.contact.name&&a.jsxs(a.Fragment,{children:[" (",F.contact.email,")"]})," · ",w.get(F.flow_id)??"Unknown flow",F.flow_step_order!==null&&` · step ${F.flow_step_order}`," · ",a.jsx("span",{className:"font-mono text-[13px]",children:Ym(F.created_at)})]})]}),a.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[F.flow?.class==="critical"&&a.jsx(le,{variant:"danger",children:"critical"}),F.brain_action_type&&a.jsx("span",{className:"rounded-full bg-sunken px-2.5 py-1 font-mono text-[12px] text-muted-foreground",children:F.brain_action_type}),F.edited_at&&a.jsx("span",{className:"text-[12px] text-muted-foreground",children:"edited"})]})]}),g?a.jsx(lT,{message:F,onDone:X=>{v(!1),X&&V(X)}}):a.jsx("div",{className:"mt-5",children:a.jsx(nT,{message:F})}),F.original&&!g&&a.jsxs("details",{className:"group mt-4 rounded-md border border-border bg-card px-4 py-3",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[14px] font-medium text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"As drafted"}),a.jsx("p",{className:"mt-2 text-[14px] font-medium text-foreground",children:F.original.subject}),a.jsx("pre",{className:"mt-1 max-h-60 overflow-auto whitespace-pre-wrap font-mono text-[13px] text-muted-foreground",children:F.original.body_text})]}),F.brain_reasoning&&a.jsxs("details",{className:"group mt-4 rounded-md border border-border bg-card px-4 py-3",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[14px] font-medium text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"Why the AI wrote it this way"}),a.jsx("p",{className:"mt-2 whitespace-pre-wrap text-[14px] leading-relaxed text-muted-foreground",children:F.brain_reasoning})]}),F.choose&&a.jsxs("details",{open:!0,className:"group mt-4 rounded-md border border-border bg-card px-4 py-3",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[14px] font-medium text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"Why this action (choose step)"}),a.jsxs("p",{className:"mt-2 text-[14px] text-foreground",children:["Picked ",a.jsx("code",{className:"font-mono text-[13px]",children:F.choose.choice}),F.choose.forced?" (forced by a reviewer)":"",": ",F.choose.reason]}),F.choose.warning&&a.jsxs("p",{className:"mt-1 text-[14px] text-foreground",children:["Warning: ",F.choose.warning]}),a.jsxs("p",{className:"mt-2 text-[13px] text-muted-foreground",children:["Eligible: ",F.choose.eligible.length>0?F.choose.eligible.join(", "):"none"]}),F.choose.filtered_out.length>0&&a.jsx("ul",{className:"mt-1 text-[13px] text-muted-foreground",children:F.choose.filtered_out.map(X=>a.jsxs("li",{children:[X.action_type,": ",X.reason]},X.action_type))})]}),F.opening_line&&a.jsxs("details",{className:"group mt-4 rounded-md border border-border bg-card px-4 py-3",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[14px] font-medium text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"AI opening line"}),a.jsx("p",{className:"mt-2 text-[14px] leading-relaxed text-foreground",children:F.opening_line})]}),F.context_snapshot&&a.jsxs("details",{className:"group mt-4 rounded-md border border-border bg-card px-4 py-3",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[14px] font-medium text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"Context data used"}),a.jsx("pre",{className:"mt-2 max-h-60 overflow-auto whitespace-pre-wrap font-mono text-[13px] text-muted-foreground",children:JSON.stringify(F.context_snapshot,null,2)})]}),B&&a.jsx("p",{className:"mt-4 rounded-md border border-border bg-secondary px-3.5 py-2.5 text-[14px] text-foreground",role:"status",children:B}),a.jsxs("div",{className:"mt-6 flex items-center gap-3 border-t border-border pt-5",children:[a.jsx(H,{onClick:xe,disabled:U,children:i.isPending?"Approving...":"Approve"}),a.jsx(H,{variant:"outline",onClick:he,disabled:U,children:o.isPending?"Rejecting...":"Reject"}),a.jsx(H,{variant:"ghost",onClick:()=>v(X=>!X),disabled:U,children:"Edit"}),a.jsx("span",{className:"text-[13px] text-muted-foreground",children:"Approval queues it to send. Rejection is final. Keys: j/k, a, r, e."})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[a.jsx("input",{value:y,onChange:X=>b(X.target.value),placeholder:"Force action type (optional)",className:"h-8 w-56 rounded-md border border-border bg-card px-2.5 font-mono text-[13px] text-foreground"}),a.jsx(H,{variant:"outline",size:"sm",onClick:Ne,disabled:U,children:m.isPending?"Sending back...":"Regenerate"}),a.jsx("span",{className:"flex-1"}),a.jsx(H,{variant:"outline",size:"sm",onClick:Ae,disabled:U,children:"Exclude person"})]})]})]}),a.jsx(rT,{}),a.jsx(sT,{}),re>0&&a.jsx("p",{className:"mt-8 text-[13px] text-subtle-foreground",children:'Flows with approval mode "auto" skip this queue. Approval mode is set per flow in the flow editor.'})]})}const oT=["contacts"];function cT(n){return["contacts",n]}function uT(n){return["contacts",n,"timeline"]}function dT(n){return el({queryKey:[...oT,n],queryFn:({pageParam:r})=>G_(r,n),initialPageParam:void 0,getNextPageParam:r=>r.next_cursor??void 0})}function fT(n){return Ye({queryKey:cT(n),queryFn:()=>V_(n)})}function mT(n){return el({queryKey:uT(n),queryFn:({pageParam:r})=>X_(n,r),initialPageParam:void 0,getNextPageParam:r=>r.next_cursor??void 0})}const hT=["signed_up","activated","engaged","at_risk","dormant","churned","resurrected"],xT=["power","regular","casual","minimal"],pT=["new","growing","established","loyal"],gT=["active","cooling","idle","dormant"],yT={new:"New",growing:"Growing",established:"Established",loyal:"Loyal"};function vT(n){return n!==null&&pT.includes(n)}function bT(n){return n!==null&&gT.includes(n)}function jT(n){switch(n){case"signed_up":return"neutral";case"activated":return"accent";case"engaged":return"success";case"at_risk":return"warning";case"dormant":return"muted";case"churned":return"danger";case"resurrected":return"success"}}function NT(n){switch(n){case"power":return"accent";case"regular":return"success";case"casual":return"neutral";default:return"muted"}}function wT(n){switch(n){case"paid":return"success";case"trial":return"accent";case"past_due":return"danger";default:return"neutral"}}function v1(n){return n.name??n.email??n.external_id}function ST(n){return v1(n).trim().charAt(0).toUpperCase()||"?"}function _T(n){if(!n)return"-";const r=new Date(n).getTime(),i=Math.floor((Date.now()-r)/864e5);return i<=0?"Today":i===1?"Yesterday":i<7?`${i}d ago`:new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function kT(){return a.jsx("div",{className:"divide-y divide-border border-t border-b border-border",children:Array.from({length:8}).map((n,r)=>a.jsxs("div",{className:"flex items-center gap-6 py-3.5",children:[a.jsx(se,{className:"h-4 w-40"}),a.jsx(se,{className:"h-4 w-48"}),a.jsx(se,{className:"h-5 w-20 rounded-full"}),a.jsx(se,{className:"h-4 w-16"}),a.jsx(se,{className:"h-4 w-14"}),a.jsx(se,{className:"h-4 w-16"})]},r))})}function ET(){return a.jsx(ls,{icon:Dm,title:"No contacts yet",description:"Contacts are created automatically when your events start flowing: an identify call creates the person, track calls fill their timeline. Once ingestion is connected, this table fills itself.",action:a.jsx($e,{to:"/integrate",children:a.jsx(H,{size:"sm",variant:"outline",children:"Connect ingestion"})})})}function CT({onClear:n}){return a.jsx(ls,{icon:dj,title:"No contacts match",description:"Nothing in this workspace matches the current search and filters.",compact:!0,action:a.jsx(H,{variant:"outline",size:"sm",onClick:n,children:"Clear search and filters"})})}function TT(){const n=Gn(),[r,i]=km(),[o,d]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState(""),[g,v]=j.useState(""),y=r.get("tenure_bucket"),b=r.get("recency_bucket"),S=vT(y)?y:null,w=bT(b)?b:null,k=S!==null||w!==null;j.useEffect(()=>{const U=setTimeout(()=>m(o.trim()),300);return()=>clearTimeout(U)},[o]);const _=j.useMemo(()=>({...f?{search:f}:{},...p?{lifecycle_state:p}:{},...g?{engagement_depth:g}:{},...S?{tenure_bucket:S}:{},...w?{recency_bucket:w}:{}}),[f,p,g,S,w]),A=f!==""||p!==""||g!==""||k,C=dT(_),B=j.useMemo(()=>C.data?.pages.flatMap(U=>U.contacts)??[],[C.data]);function V(){d(""),m(""),h(""),v(""),i({},{replace:!0})}function F(){i(U=>{const Z=new URLSearchParams(U);return Z.delete("tenure_bucket"),Z.delete("recency_bucket"),Z},{replace:!0})}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Contacts",title:"People",subtitle:C.isLoading?"Every contact your events have created.":A?`${B.length} ${B.length===1?"match":"matches"}`:B.length===0?"Every contact your events have created.":`${B.length}${C.hasNextPage?"+":""} ${B.length===1?"contact":"contacts"}`}),k&&a.jsxs("div",{role:"status",className:"animate-rise-in mb-4 flex flex-wrap items-center justify-between gap-3 rounded-md bg-accent-soft px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.06em] text-accent-text",children:"From the retention grid"}),a.jsxs("p",{className:"mt-0.5 text-[14px] text-foreground",children:["Showing the cell"," ",a.jsxs("span",{className:"font-semibold",children:[S?yT[S]:"Any tenure"," ·"," ",a.jsx("span",{className:"capitalize",children:w??"any recency"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx($e,{to:"/lifecycle",className:"text-[13px] text-accent-text underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Back to Lifecycle"}),a.jsx(H,{variant:"outline",size:"sm",onClick:F,children:"Clear filter"})]})]}),a.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-3 border-b border-border pb-5",children:[a.jsxs("div",{className:"relative w-full sm:w-72",children:[a.jsx(mj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx(I,{type:"search","aria-label":"Search contacts",placeholder:"Search email, name, or user id",value:o,onChange:U=>d(U.target.value),className:"pl-9"})]}),a.jsx("div",{className:"w-[calc(50%-6px)] sm:w-48",children:a.jsxs(Oe,{"aria-label":"Filter by lifecycle state",value:p,onChange:U=>h(U.target.value),children:[a.jsx("option",{value:"",children:"All states"}),hT.map(U=>a.jsx("option",{value:U,children:U},U))]})}),a.jsx("div",{className:"w-[calc(50%-6px)] sm:w-44",children:a.jsxs(Oe,{"aria-label":"Filter by engagement depth",value:g,onChange:U=>v(U.target.value),children:[a.jsx("option",{value:"",children:"Any depth"}),xT.map(U=>a.jsx("option",{value:U,children:U},U))]})}),A&&a.jsx(H,{variant:"ghost",size:"sm",onClick:V,children:"Clear"})]}),C.isLoading&&a.jsx(kT,{}),C.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load contacts:"," ",C.error instanceof Error?C.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>C.refetch(),children:"Try again"})]}),!C.isLoading&&!C.isError&&B.length===0&&(A?a.jsx(CT,{onClear:V}):a.jsx(ET,{})),B.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{className:"hover:bg-transparent",children:[a.jsx(Ue,{children:"Name"}),a.jsx(Ue,{children:"Email"}),a.jsx(Ue,{children:"Lifecycle"}),a.jsx(Ue,{children:"Depth"}),a.jsx(Ue,{children:"Payment"}),a.jsx(Ue,{className:"text-right",children:"Last seen"})]})}),a.jsx(Gs,{children:B.map(U=>a.jsxs(sn,{className:"cursor-pointer",onClick:()=>n(`/people/${U.id}`),children:[a.jsx(Re,{children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{"aria-hidden":"true",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-accent-soft text-[11px] font-semibold text-accent-text",children:ST(U)}),a.jsxs("span",{className:"font-medium text-foreground",children:[v1(U),U.company&&a.jsx("span",{className:"ml-2 text-[14px] font-normal text-muted-foreground",children:U.company})]})]})}),a.jsx(Re,{className:"font-mono text-[13px] text-muted-foreground",children:U.email??"-"}),a.jsx(Re,{children:a.jsx(le,{variant:jT(U.lifecycle_state),children:U.lifecycle_state})}),a.jsx(Re,{children:U.engagement_depth?a.jsx(le,{variant:NT(U.engagement_depth),children:U.engagement_depth}):a.jsx("span",{className:"text-subtle-foreground",children:"-"})}),a.jsx(Re,{children:U.payment_status?a.jsx(le,{variant:wT(U.payment_status),children:U.payment_status}):a.jsx("span",{className:"text-subtle-foreground",children:"-"})}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:_T(U.last_seen_at)})]},U.id))})]}),C.hasNextPage&&a.jsx("div",{className:"mt-4 flex justify-center",children:a.jsx(H,{variant:"ghost",size:"sm",disabled:C.isFetchingNextPage,onClick:()=>C.fetchNextPage(),children:C.isFetchingNextPage?"Loading...":"Load more"})})]})]})}function AT(n){switch(n){case"signed_up":return"neutral";case"activated":return"accent";case"engaged":return"success";case"at_risk":return"warning";case"dormant":return"muted";case"churned":return"danger";case"resurrected":return"success"}}function RT(n){switch(n){case"active":return"success";case"paused":return"warning";case"completed":return"muted";case"exited":return"neutral";default:return"neutral"}}function OT(n){switch(n){case"sent":return"success";case"approved":return"accent";case"pending_approval":return"warning";case"rejected":case"failed":case"suppressed":return"danger";case"skipped":case"value_gated":return"muted";default:return"neutral"}}function zT(n){return n?new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"}function Ds(n){return n?new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"-"}const MT={event:Lm,transition:dk,message:Mm},DT={event:"border-transparent bg-accent-soft text-accent-text",transition:"border-transparent bg-sunken text-muted-foreground",message:"border-transparent bg-success-soft text-success"};function bv(n){if(!n)return null;const r=[];for(const[i,o]of Object.entries(n))if(!(o==null||typeof o=="object")&&(r.push(`${i}: ${String(o)}`),r.length>=3))break;return r.length>0?r.join(" · "):null}function jv(n){return n?n.trigger==="scan"?"via scan":typeof n.trigger=="string"?`via ${n.trigger}`:null:null}function Nv({state:n}){return a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-foreground",children:n})}function LT({item:n,last:r}){const i=MT[n.kind];return a.jsxs("li",{className:"relative flex gap-4 pb-5 last:pb-0",children:[!r&&a.jsx("span",{"aria-hidden":"true",className:"absolute left-[11px] top-6 h-full w-px bg-border"}),a.jsx("span",{"aria-hidden":"true",className:qe("z-10 mt-1 flex h-[23px] w-[23px] shrink-0 items-center justify-center rounded-full border",DT[n.kind]),children:a.jsx(i,{size:12,strokeWidth:1.5})}),a.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[n.kind==="event"&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[14px] text-foreground",children:a.jsx("code",{className:"font-mono text-[13px]",children:n.event_name??n.event_type})}),bv(n.context)&&a.jsx("p",{className:"mt-0.5 font-mono text-[12px] text-subtle-foreground",children:bv(n.context)}),n.properties&&Object.keys(n.properties).length>0&&a.jsxs("details",{className:"mt-1",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[13px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"payload"}),a.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-card p-3 font-mono text-[12px] text-muted-foreground",children:JSON.stringify(n.properties,null,2)})]})]}),n.kind==="transition"&&a.jsx("div",{children:a.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-[14px] text-foreground",children:[a.jsx(Nv,{state:n.from_state}),a.jsx("span",{"aria-hidden":"true",className:"text-subtle-foreground",children:"->"}),a.jsx(Nv,{state:n.to_state}),jv(n.metadata)&&a.jsx("span",{className:"text-[13px] text-muted-foreground",children:jv(n.metadata)})]})}),n.kind==="message"&&a.jsxs("div",{children:[a.jsx("p",{className:"text-[14px] text-foreground",children:a.jsx($e,{to:`/sent/${n.id}`,className:"hover:underline underline-offset-4",children:n.subject??"(no subject)"})}),a.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-2 text-[13px] text-muted-foreground",children:[a.jsx(le,{variant:OT(n.status),children:n.status}),n.feedback&&a.jsx("span",{className:"font-mono",children:n.feedback}),a.jsx($e,{to:`/flows/${n.flow_id}/edit`,className:"text-accent-text underline underline-offset-4",children:n.flow_name}),n.flow_step_order!==null&&a.jsxs("span",{children:["step ",n.flow_step_order]})]})]}),a.jsx("p",{className:"mt-1 font-mono text-[12px] text-subtle-foreground",children:zT(n.occurred_at)})]})]})}function Zo({title:n,children:r}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("p",{className:"mb-3 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:n}),r]})}function ss({label:n,value:r,mono:i=!0}){return a.jsxs("div",{className:"flex justify-between gap-4 py-1",children:[a.jsx("dt",{className:"text-muted-foreground",children:n}),a.jsx("dd",{className:qe("text-right",i?"font-mono text-[13px] text-muted-foreground":"text-foreground"),children:r})]})}function UT(){const{id:n}=gc(),r=fT(n??""),i=mT(n??""),o=j.useMemo(()=>i.data?.pages.flatMap(v=>v.items)??[],[i.data]);if(r.isLoading)return a.jsxs("div",{className:"mx-auto max-w-6xl space-y-4",children:[a.jsx(se,{className:"h-4 w-20"}),a.jsx(se,{className:"h-7 w-64"}),a.jsxs("div",{className:"flex gap-8",children:[a.jsx(se,{className:"h-96 flex-1"}),a.jsx(se,{className:"hidden h-96 w-72 lg:block"})]})]});if(r.isError||!r.data)return a.jsx("div",{className:"mx-auto max-w-6xl",children:a.jsx("div",{className:"rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load this person:"," ",r.error instanceof Error?r.error.message:"Unknown error"]})})});const{contact:d,memberships:f,suppression:m}=r.data,p=r.data.topics??[],h=d.name??d.email??d.external_id,g=Object.entries(d.properties??{});return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx($e,{to:"/people",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← People"}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3",children:[a.jsx("h1",{className:"font-display text-[28px] font-bold leading-[34px] tracking-[-0.02em] text-foreground",children:h}),a.jsx(le,{variant:AT(d.lifecycle_state),children:d.lifecycle_state}),d.engagement_depth&&a.jsx("span",{className:"text-[14px] text-muted-foreground",children:d.engagement_depth}),d.payment_status&&a.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:d.payment_status})]}),a.jsxs("p",{className:"mt-1 text-[14px] text-muted-foreground",children:[d.company?a.jsxs(a.Fragment,{children:[d.company," · "]}):null,a.jsx("span",{className:"font-mono text-[13px]",children:d.external_id})]})]}),m&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[15px] text-foreground",children:["This address is suppressed (",m.reason,m.source?` via ${m.source}`:"",","," ",Ds(m.created_at),"). The engine will not send to it."]})}),a.jsxs("div",{className:"flex flex-col gap-10 lg:flex-row lg:gap-8",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"mb-4 text-[14px] font-medium text-foreground",children:"Timeline"}),i.isLoading&&a.jsx("div",{className:"space-y-4",children:Array.from({length:5}).map((v,y)=>a.jsx(se,{className:"h-10 w-full"},y))}),i.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsx("p",{className:"text-[15px] text-foreground",children:"Failed to load the timeline."}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>i.refetch(),children:"Try again"})]}),!i.isLoading&&!i.isError&&o.length===0&&a.jsx("div",{className:"rounded-lg border border-dashed border-border-strong px-6 py-12 text-center",children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Nothing has happened to this person yet. Events, lifecycle changes, and messages will appear here in order."})}),o.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("ol",{className:"list-none",children:o.map((v,y)=>a.jsx(LT,{item:v,last:y===o.length-1},`${v.kind}-${v.id}`))}),i.hasNextPage&&a.jsx("div",{className:"mt-4",children:a.jsx(H,{variant:"ghost",size:"sm",disabled:i.isFetchingNextPage,onClick:()=>i.fetchNextPage(),children:i.isFetchingNextPage?"Loading...":"Load earlier"})})]})]}),a.jsxs("div",{className:"w-full shrink-0 space-y-6 lg:w-72",children:[a.jsx(Zo,{title:"Profile",children:a.jsxs("dl",{children:[a.jsx(ss,{label:"Email",value:d.email??"-"}),a.jsx(ss,{label:"User id",value:d.external_id}),d.company&&a.jsx(ss,{label:"Company",value:d.company,mono:!1}),a.jsx(ss,{label:"First seen",value:Ds(d.first_seen_at)}),a.jsx(ss,{label:"Last seen",value:Ds(d.last_seen_at)}),a.jsx(ss,{label:"Activated",value:Ds(d.activated_at)}),a.jsx(ss,{label:"Recorded",value:Ds(d.created_at)})]})}),a.jsx(Zo,{title:"Properties",children:g.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No properties recorded. Anything sent with identify calls or event payloads lands here."}):a.jsx("dl",{children:g.map(([v,y])=>a.jsx(ss,{label:v,value:typeof y=="string"?y:JSON.stringify(y)},v))})}),p.length>0&&a.jsx(Zo,{title:"Topics",children:a.jsx("ul",{className:"space-y-2.5",children:p.map(v=>a.jsxs("li",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"min-w-0 truncate text-[14px] text-foreground",children:v.name}),v.kind==="transactional"?a.jsx(le,{variant:"muted",children:"transactional"}):a.jsxs(le,{variant:v.status==="subscribed"?"success":"neutral",title:v.default?"Topic default (no choice recorded)":v.source?`Set via ${v.source}`:void 0,children:[v.status,v.default?" (default)":""]})]},v.topic_id))})}),a.jsx(Zo,{title:"Flows",children:f.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Not enrolled in any flow."}):a.jsx("ul",{className:"space-y-3",children:f.map(v=>a.jsxs("li",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($e,{to:`/flows/${v.flow_id}/edit`,className:"text-[14px] font-medium text-accent-text underline underline-offset-4",children:v.flow_name}),a.jsx(le,{variant:RT(v.status),children:v.status})]}),a.jsxs("p",{className:"mt-0.5 text-[13px] text-muted-foreground",children:["step ",v.current_step," · entered ",a.jsx("span",{className:"font-mono",children:Ds(v.entered_at)}),v.completed_at&&a.jsxs(a.Fragment,{children:[" · completed ",a.jsx("span",{className:"font-mono",children:Ds(v.completed_at)})]}),v.exit_reason&&` · exited: ${v.exit_reason}`]})]},v.id))})})]})]})]})}function qT(n){return Ye({queryKey:["analytics","lifecycle",n],queryFn:()=>Nb(n)})}function wv(n){return Ye({queryKey:["analytics","sending",n],queryFn:()=>Gf(n)})}function HT(){return Ye({queryKey:["analytics","retention-grid"],queryFn:Z_})}function $T(n,r,i){return Ye({queryKey:["analytics","retention-grid",n,r,"trend",i],queryFn:()=>I_(n,r,i),enabled:n!==null&&r!==null})}function b1(n){const r=j.useRef(null),[i,o]=j.useState(null);function d(f){const m=r.current;if(!m)return;const p=m.getBoundingClientRect(),h=f.clientX-p.left,g=Math.floor(h/p.width*n);g>=0&&g<n?o({index:g,x:h}):o(null)}return{ref:r,hover:i,onMouseMove:d,onMouseLeave:()=>o(null)}}function j1({hover:n,containerWidth:r,children:i}){const o=Math.min(Math.max(n.x,70),r-70);return a.jsx("div",{role:"status",className:"pointer-events-none absolute -top-2 z-10 -translate-x-1/2 -translate-y-full whitespace-nowrap rounded-md border border-border bg-card px-2.5 py-1.5 text-[13px] text-foreground",style:{left:`${o}px`},children:i})}const BT=[7,30,90];function N1({value:n,onChange:r}){return a.jsx("div",{role:"radiogroup","aria-label":"Time range",className:"inline-flex items-center gap-0.5 rounded-md border border-border bg-background p-0.5",children:BT.map(i=>a.jsxs("button",{type:"button",role:"radio","aria-checked":n===i,onClick:()=>r(i),className:n===i?"h-6 rounded-sm bg-secondary px-2.5 text-[13px] font-medium text-foreground transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring":"h-6 rounded-sm px-2.5 text-[13px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[i,"d"]},i))})}function QT(n){return n.toISOString().slice(0,10)}function uc(n){return new Date(`${n}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Yr(n,r,i){const o=new Map(n.map(m=>[m.day.slice(0,10),m])),d=[],f=new Date;for(let m=r-1;m>=0;m--){const p=new Date(f.getTime()-m*864e5),h=QT(p);d.push(o.get(h)??i(h))}return d}function Gm({first:n,last:r}){return a.jsxs("div",{className:"mt-1 flex justify-between font-mono text-[12px] text-subtle-foreground",children:[a.jsx("span",{children:uc(n)}),a.jsx("span",{children:uc(r)})]})}function Tf({rows:n,rangeDays:r,emptyNote:i,ariaLabel:o}){const d=Yr(n,r,w=>({day:w,count:0})),f=Math.max(1,...d.map(w=>w.count)),m=d.reduce((w,k)=>w+k.count,0),{ref:p,hover:h,onMouseMove:g,onMouseLeave:v}=b1(d.length),y=640,b=96,S=y/d.length;return a.jsxs("figure",{className:"m-0",children:[a.jsxs("div",{className:"flex items-baseline justify-between",children:[a.jsxs("span",{className:"font-mono text-[12px] text-subtle-foreground",children:["max ",f===1&&m===0?0:f]}),a.jsxs("span",{className:"font-mono text-[12px] text-subtle-foreground",children:[m," total"]})]}),a.jsxs("div",{ref:p,className:"relative",onMouseMove:g,onMouseLeave:v,children:[h&&a.jsxs(j1,{hover:h,containerWidth:p.current?.getBoundingClientRect().width??y,children:[a.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:uc(d[h.index].day)})," ",a.jsx("span",{className:"font-medium",children:d[h.index].count})]}),a.jsx("div",{role:"img","aria-label":o,children:a.jsxs("svg",{viewBox:`0 0 ${y} ${b}`,className:"mt-1 block h-[96px] w-full",preserveAspectRatio:"none","aria-hidden":"true",children:[h&&a.jsx("rect",{x:h.index*S*100/100,y:0,width:S,height:b,fill:"var(--bg-sunken)"}),a.jsx("line",{x1:"0",y1:b-1,x2:y,y2:b-1,stroke:"var(--border)",strokeWidth:"1"}),d.map((w,k)=>{if(w.count===0)return null;const _=Math.max(2,(b-10)*w.count/f);return a.jsx("rect",{x:k*S+S*.25,y:b-1-_,width:Math.max(1,S*.5),height:_,rx:Math.min(1.5,S*.2),fill:"var(--accent)",style:h?.index===k?{filter:"brightness(1.18)"}:void 0},w.day)})]})})]}),a.jsx(Gm,{first:d[0].day,last:d[d.length-1].day}),m===0&&a.jsx("p",{className:"mt-2 text-center text-[14px] text-muted-foreground",children:i}),a.jsx("div",{className:"sr-only",children:a.jsxs("table",{children:[a.jsx("caption",{children:o}),a.jsx("tbody",{children:d.map(w=>a.jsxs("tr",{children:[a.jsx("td",{children:w.day}),a.jsx("td",{children:w.count})]},w.day))})]})})]})}function FT({rows:n,rangeDays:r,emptyNote:i,ariaLabel:o}){const d=Yr(n,r,B=>({day:B,positive:0,negative:0})),f=Math.max(1,...d.map(B=>B.positive)),m=Math.max(1,...d.map(B=>B.negative)),p=d.reduce((B,V)=>B+V.positive,0),h=d.reduce((B,V)=>B+V.negative,0),g=p-h,{ref:v,hover:y,onMouseMove:b,onMouseLeave:S}=b1(d.length),w=640,k=120,_=k/2,A=_-8,C=w/d.length;return a.jsxs("figure",{className:"m-0",children:[a.jsxs("div",{className:"flex items-baseline justify-between",children:[a.jsxs("div",{className:"flex gap-4 font-mono text-[12px] text-subtle-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{"aria-hidden":"true",className:"h-2 w-2 rounded-full bg-chart-positive"}),p," into good states"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{"aria-hidden":"true",className:"h-2 w-2 rounded-full bg-chart-negative"}),h," into bad states"]})]}),a.jsxs("span",{className:"font-mono text-[12px] text-subtle-foreground",children:[p+h," total"," · net ",a.jsx("span",{className:g>0?"text-success":g<0?"text-danger":"text-subtle-foreground",children:g>0?`+${g}`:g})]})]}),a.jsxs("div",{ref:v,className:"relative",onMouseMove:b,onMouseLeave:S,children:[y&&a.jsxs(j1,{hover:y,containerWidth:v.current?.getBoundingClientRect().width??w,children:[a.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:uc(d[y.index].day)})," ",a.jsx("span",{className:"text-success",children:d[y.index].positive})," / ",a.jsx("span",{className:"text-danger",children:d[y.index].negative})]}),a.jsx("div",{role:"img","aria-label":o,children:a.jsxs("svg",{viewBox:`0 0 ${w} ${k}`,className:"mt-1 block h-[120px] w-full",preserveAspectRatio:"none","aria-hidden":"true",children:[y&&a.jsx("rect",{x:y.index*C,y:0,width:C,height:k,fill:"var(--bg-sunken)"}),a.jsx("line",{x1:"0",y1:_-.5,x2:w,y2:_-.5,stroke:"var(--border-strong)",strokeWidth:"1"}),d.map((B,V)=>{if(B.positive===0&&B.negative===0)return null;const F=V*C+C*.3,U=Math.max(1,C*.4),Z=Math.min(1.5,U*.25),Q=B.positive===0?0:Math.max(2,A*B.positive/f),xe=B.negative===0?0:Math.max(2,A*B.negative/m);return a.jsxs("g",{children:[B.positive>0&&a.jsx("rect",{x:F,y:_-1-Q,width:U,height:Q,rx:Z,fill:"var(--chart-positive)",style:y?.index===V?{filter:"brightness(1.18)"}:void 0}),B.negative>0&&a.jsx("rect",{x:F,y:_+1,width:U,height:xe,rx:Z,fill:"var(--chart-negative)",style:y?.index===V?{filter:"brightness(1.18)"}:void 0})]},B.day)})]})})]}),a.jsx(Gm,{first:d[0].day,last:d[d.length-1].day}),p+h===0&&a.jsx("p",{className:"mt-2 text-center text-[14px] text-muted-foreground",children:i}),a.jsx("div",{className:"sr-only",children:a.jsxs("table",{children:[a.jsx("caption",{children:o}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"day"}),a.jsx("th",{children:"into good states"}),a.jsx("th",{children:"into bad states"})]})}),a.jsx("tbody",{children:d.map(B=>a.jsxs("tr",{children:[a.jsx("td",{children:B.day}),a.jsx("td",{children:B.positive}),a.jsx("td",{children:B.negative})]},B.day))})]})})]})}const w1=7;function S1({rows:n,emptyNote:r,ariaLabel:i,frameLabels:o=!0,height:d=56}){if(n.length<w1)return a.jsxs("figure",{className:"m-0",children:[a.jsx("p",{className:"text-[12px] text-subtle-foreground",children:r}),a.jsx("div",{className:"sr-only",children:a.jsxs("table",{children:[a.jsx("caption",{children:i}),a.jsx("tbody",{children:n.map(S=>a.jsxs("tr",{children:[a.jsx("td",{children:S.day}),a.jsx("td",{children:S.count})]},S.day))})]})})]});const f=320,m=d,p=3,h=Math.max(1,...n.map(S=>S.count)),g=S=>p+S*(f-2*p)/(n.length-1),v=S=>m-p-(m-2*p)*S/h,y=n.map((S,w)=>`${g(w)},${v(S.count)}`).join(" "),b=n[n.length-1];return a.jsxs("figure",{className:"m-0",children:[a.jsx("div",{role:"img","aria-label":i,children:a.jsxs("svg",{viewBox:`0 0 ${f} ${m}`,className:"block w-full",style:{height:`${m}px`},preserveAspectRatio:"none","aria-hidden":"true",children:[a.jsx("line",{x1:0,y1:m-1,x2:f,y2:m-1,stroke:"var(--border)",strokeWidth:"1"}),a.jsx("polyline",{points:y,fill:"none",stroke:"var(--accent)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}),a.jsx("circle",{cx:g(n.length-1),cy:v(b.count),r:"2.5",fill:"var(--accent)"})]})}),o&&a.jsx(Gm,{first:n[0].day,last:b.day}),a.jsx("div",{className:"sr-only",children:a.jsxs("table",{children:[a.jsx("caption",{children:i}),a.jsx("tbody",{children:n.map(S=>a.jsxs("tr",{children:[a.jsx("td",{children:S.day}),a.jsx("td",{children:S.count})]},S.day))})]})})]})}const _1=[{id:"new",label:"New",desc:"just arrived"},{id:"growing",label:"Growing",desc:"finding their rhythm"},{id:"established",label:"Established",desc:"proven"},{id:"loyal",label:"Loyal",desc:"your oldest contacts"}],PT={active:"No rescue needed. A nurture flow keeps the rhythm alive.",cooling:"A gentle nudge before they drift further.",idle:"A re-engagement flow with a real reason to come back.",dormant:"A win-back with your strongest offer, or a graceful sunset."},KT={cooling:{from:"engaged",to:"at_risk"},idle:{from:"at_risk",to:"dormant"},dormant:{from:"dormant",to:"churned"}},YT={active:"bg-success-soft hover:bg-success-soft-hover",cooling:"bg-warning-soft hover:bg-warning-soft-hover",idle:"bg-warning-soft hover:bg-warning-soft-hover",dormant:"bg-danger-soft hover:bg-danger-soft-hover"};function k1(n,r){switch(n){case"new":return`< ${r.growing} days`;case"growing":return`${r.growing}-${r.established-1} days`;case"established":return`${r.established}-${r.loyal-1} days`;case"loyal":return`${r.loyal}+ days`}}function E1(n,r){switch(n){case"active":return`quiet < ${r.cooling}d`;case"cooling":return`quiet ${r.cooling}-${r.idle-1}d`;case"idle":return`quiet ${r.idle}-${r.dormant-1}d`;case"dormant":return`quiet ${r.dormant}d+`}}const Sv=["active","cooling","idle","dormant"];function GT({grid:n,selected:r,onSelect:i}){const o=j.useMemo(()=>{const d=new Map;for(const f of n.cells)d.set(`${f.tenure}:${f.recency}`,{count:f.count,paying:f.paying});return d},[n.cells]);return a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs("div",{role:"grid","aria-label":"Retention grid: tenure by recency",className:"grid gap-1.5",style:{gridTemplateColumns:"minmax(90px, auto) repeat(4, minmax(80px, 1fr))"},children:[a.jsx("div",{}),Sv.map(d=>a.jsxs("div",{className:"px-2 pb-1 text-center",children:[a.jsx("p",{className:"text-[12px] font-semibold capitalize text-foreground",children:d}),a.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:E1(d,n.recency_thresholds_days)})]},d)),_1.map(d=>a.jsxs(im.Fragment,{children:[a.jsxs("div",{className:"flex flex-col justify-center pr-2",children:[a.jsx("p",{className:"text-[12px] font-semibold text-foreground",children:d.label}),a.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:k1(d.id,n.tenure_thresholds_days)})]}),Sv.map(f=>{const m=o.get(`${d.id}:${f}`),p=m?.count??0,h=m?.paying??0,g=r?.tenure===d.id&&r?.recency===f;return a.jsxs("button",{type:"button",onClick:()=>i(d.id,f),"aria-label":`${d.label} ${f}: ${p} contacts`,className:qe("rounded-md px-3 py-3 text-center transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",p===0?"bg-sunken hover:bg-sunken-hover":YT[f],g&&"ring-2 ring-ring"),children:[a.jsx("span",{className:qe("block text-[20px] font-semibold leading-none tracking-[-0.01em]",p===0?"text-subtle-foreground":"text-foreground"),children:p===0?"·":p}),h>0&&a.jsxs("span",{className:"mt-1 block text-[11px] font-medium text-muted-foreground",children:[h," paying"]})]},f)})]},d.id))]})})}const tm=30;function VT(n){return new Date(`${n}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function XT(n,r,i){const o=n.cells.find(y=>y.tenure===r&&y.recency===i),d=o?.count??0,f=o?.paying??0,m=$T(r,i,tm),p=new Date().toISOString().slice(0,10),h=j.useMemo(()=>{const y=(m.data?.days??[]).map(b=>({day:b.day,count:b.count}));return y[y.length-1]?.day!==p&&y.push({day:p,count:d}),y},[m.data,d,p]),g=h.length>=w1?d-h[0].count:null,v=g!==null&&g!==0&&(i==="active"?g>0:g<0);return{count:d,paying:f,trendQuery:m,trendRows:h,delta:g,deltaGood:v}}function ZT({grid:n,tenure:r,recency:i}){const o=Ps(),d=Gn(),f=_1.find(_=>_.id===r),{count:m,paying:p,trendQuery:h,trendRows:g,delta:v,deltaGood:y}=XT(n,r,i),b=KT[i]??null,S=o.data?.flows??[],w=S.find(_=>{if(_.trigger_type!=="segment")return!1;const A=_.trigger_config??{};return A.tenure_bucket===r&&A.recency_bucket===i}),k=b?S.find(_=>{if(_.trigger_type!=="lifecycle_transition")return!1;const A=_.trigger_config??{};return A.from===b.from&&A.to===b.to}):void 0;return a.jsx("section",{className:"mt-6 rounded-lg border border-border bg-card p-5",children:a.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)_240px]",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.06em] text-accent-text",children:"Selected cell"}),a.jsxs("h3",{className:"mt-1 text-[18px] font-semibold tracking-[-0.01em] text-foreground",children:[f.label," · ",a.jsx("span",{className:"capitalize",children:i})]}),a.jsxs("p",{className:"mt-2 text-[14px] leading-relaxed text-muted-foreground",children:[f.desc.charAt(0).toUpperCase()+f.desc.slice(1)," ","(",k1(r,n.tenure_thresholds_days),"),"," ",E1(i,n.recency_thresholds_days),"."]}),a.jsx("p",{className:"mt-3 text-[14px] leading-relaxed text-muted-foreground",children:PT[i]})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"font-display text-[28px] font-bold leading-none tracking-[-0.02em] text-foreground",children:[m,a.jsxs("span",{className:"ml-2 text-[14px] font-normal text-muted-foreground",children:[m===1?"contact":"contacts",p>0&&` · ${p} paying`]})]}),v!==null&&a.jsxs("p",{className:"mt-1.5 text-[13px]",children:[a.jsx("span",{className:qe("font-mono font-medium",v===0?"text-muted-foreground":y?"text-success":"text-danger"),children:v>0?`+${v}`:v})," ",a.jsxs("span",{className:"text-muted-foreground",children:["since ",VT(g[0].day)]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsxs("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:["Population, last ",tm," days"]}),h.isError?a.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Could not load the trend."}):a.jsx(S1,{rows:g,emptyNote:"The trend appears after a week of daily snapshots.",ariaLabel:`Daily population of the ${f.label} ${i} cell over the last ${tm} days`})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[!w&&a.jsx(H,{className:"w-full",disabled:m===0,onClick:()=>d(`/flows/new?segment=${r}:${i}`),children:"Create flow for this segment"}),a.jsx(H,{variant:"outline",className:"w-full",disabled:m===0,onClick:()=>d(`/people?tenure_bucket=${r}&recency_bucket=${i}`),children:"Show users"}),w?a.jsxs("p",{className:"text-[13px] leading-relaxed text-muted-foreground",children:["A segment flow already targets this cell:"," ",a.jsx($e,{to:`/flows/${w.id}/edit`,className:"text-accent-text underline underline-offset-4",children:w.name})]}):a.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground",children:m===0?"This cell is empty right now.":`Reaches the ${m} ${m===1?"contact":"contacts"} already here, and everyone who enters this cell later.`}),b&&a.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground",children:k?a.jsxs(a.Fragment,{children:["The ",b.from," → ",b.to," transition is covered by"," ",a.jsx($e,{to:`/flows/${k.id}/edit`,className:"text-accent-text underline underline-offset-4",children:k.name}),"."]}):a.jsxs(a.Fragment,{children:["Or"," ",a.jsxs($e,{to:`/flows/new?transition=${b.from}:${b.to}&name=${encodeURIComponent(`${f.label} · ${i}`)}`,className:"text-accent-text underline underline-offset-4",children:["start from the ",b.from," → ",b.to," transition"]})," ","instead: catches only contacts who drift here from now on."]})})]})]})})}function IT(){return a.jsxs("div",{className:"space-y-8",children:[a.jsx(se,{className:"h-72 w-full"}),a.jsx(se,{className:"h-28 w-full"})]})}const JT=new Set(["at_risk","dormant","churned"]),WT=[{id:"grid",label:"Retention grid"},{id:"movement",label:"Movement"}];function e5({tab:n,onChange:r}){return a.jsx("div",{role:"tablist","aria-label":"Lifecycle views",className:"mb-8 inline-flex items-center gap-0.5 rounded-md border border-border bg-background p-0.5",children:WT.map(i=>a.jsx("button",{type:"button",role:"tab","aria-selected":n===i.id,onClick:()=>r(i.id),className:qe("h-7 rounded-sm px-3 text-[13px] transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n===i.id?"bg-secondary font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:i.label},i.id))})}function t5(){const[n,r]=j.useState("grid"),[i,o]=j.useState(30),d=HT(),f=qT(i),[m,p]=j.useState(null),h=n==="grid"?d:f,g=h.isLoading,v=h.isError;return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Retention",title:"Lifecycle",subtitle:d.data?`${d.data.contacts_total} ${d.data.contacts_total===1?"contact":"contacts"} on the grid, right now`:"Who your contacts are, how long they have been quiet, and where to act."}),a.jsx(e5,{tab:n,onChange:r}),g&&a.jsx(IT,{}),v&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsx("p",{className:"text-[15px] text-foreground",children:"Failed to load lifecycle data."}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>{d.refetch(),f.refetch()},children:"Try again"})]}),n==="grid"&&d.data&&a.jsxs("section",{className:"mb-10",children:[a.jsx(GT,{grid:d.data,selected:m,onSelect:(y,b)=>{p(m?.tenure===y&&m?.recency===b?null:{tenure:y,recency:b})}}),a.jsxs("p",{className:"mt-3 text-[12px] text-subtle-foreground",children:["Recency thresholds follow your natural rhythm of"," ",d.data.natural_frequency_days," days. Cell populations are snapshotted daily - click a cell for its trend and actions."]}),m?a.jsx(ZT,{grid:d.data,tenure:m.tenure,recency:m.recency}):a.jsx("div",{className:"mt-6 rounded-lg border border-dashed border-border-strong px-5 py-4",children:a.jsxs("p",{className:"text-[14px] leading-relaxed text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"Pick a cell to act on it."})," ","Each cell is a group of contacts with the same story: how long they have been around and how long they have been quiet."]})})]}),n==="movement"&&f.data&&a.jsxs("div",{className:"space-y-8",children:[a.jsx("p",{className:"max-w-2xl text-[12px] leading-relaxed text-subtle-foreground",children:`Two vocabularies, one contact base: the retention grid is your strategic map (tenure x quiet time, actionable per cell). The seven lifecycle states below are the engine's mechanics - they drive flow triggers, step conditions, and the movement data. They overlap by design but measure differently, so a contact can be "engaged" and "cooling" at once.`}),a.jsxs("section",{children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-4",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Movement"}),a.jsx(N1,{value:i,onChange:o})]}),a.jsxs("p",{className:"mb-3 text-[13px] text-muted-foreground",children:["Lifecycle transitions per day over the last ",i," days, split by direction."]}),a.jsx(FT,{rows:f.data.movement.days.map(y=>({day:y.day,positive:y.positive,negative:y.negative})),rangeDays:i,emptyNote:"No lifecycle changes in this range.",ariaLabel:`Lifecycle transitions per day over the last ${i} days, split by direction`})]}),a.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[a.jsxs("section",{children:[a.jsx("h2",{className:"mb-4 text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Entries and exits per state"}),f.data.movement.per_state.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No movement in this range."}):a.jsxs("table",{className:"w-full table-fixed text-[14px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left",children:[a.jsx("th",{className:"w-[40%] pb-2 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"State"}),a.jsx("th",{className:"w-[20%] pb-2 text-right text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Entered"}),a.jsx("th",{className:"w-[20%] pb-2 text-right text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Left"}),a.jsx("th",{className:"w-[20%] pb-2 text-right text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Net"})]})}),a.jsx("tbody",{children:f.data.movement.per_state.map(y=>{const b=y.entered-y.exited,S=JT.has(y.state),w=b!==0&&(S?b>0:y.state==="engaged"&&b<0),k=b!==0&&!w&&(S?b<0:y.state!=="signed_up"&&b>0);return a.jsxs("tr",{className:"h-9 border-b border-border last:border-0",children:[a.jsx("td",{children:a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-foreground",children:y.state})}),a.jsx("td",{className:"text-right font-mono text-[13px] text-muted-foreground",children:y.entered}),a.jsx("td",{className:"text-right font-mono text-[13px] text-muted-foreground",children:y.exited}),a.jsx("td",{className:qe("text-right font-mono text-[13px]",w?"text-danger":k?"text-success":"text-muted-foreground"),children:b>0?`+${b}`:b})]},y.state)})})]})]}),a.jsxs("section",{children:[a.jsx("h2",{className:"mb-4 text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Most frequent transitions"}),f.data.movement.edges.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No movement in this range."}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border pb-2 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("span",{children:"Transition"}),a.jsx("span",{children:"Count"})]}),a.jsx("ul",{children:(()=>{const y=f.data.movement.edges.slice(0,7),b=Math.max(1,...y.map(S=>S.count));return y.map(S=>a.jsx("li",{className:"border-b border-border last:border-0",children:a.jsxs("div",{className:"flex h-9 items-center gap-2.5 text-[14px]",children:[a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-muted-foreground",children:S.from_state}),a.jsx("span",{"aria-hidden":"true",className:"text-subtle-foreground",children:"->"}),a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-foreground",children:S.to_state}),a.jsx("div",{className:"h-1 min-w-0 flex-1 rounded-full bg-sunken",children:a.jsx("div",{className:"h-1 rounded-full bg-accent",style:{width:`${S.count/b*100}%`}})}),a.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[13px] text-muted-foreground",children:S.count})]})},`${S.from_state}-${S.to_state}`))})()})]})]})]})]})]})}const qs=20;function nm(n,r){return r===0?"-":`${Math.round(n/r*100)}%`}function Af(n,r){return r<qs?"-":nm(n,r)}function Io({label:n,value:r,sub:i,delta:o,spark:d,sparkLabel:f}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 sm:p-5",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground sm:text-[12px]",children:n}),a.jsx("p",{className:"mt-2 font-display text-[22px] font-bold leading-none tracking-[-0.02em] text-foreground sm:text-[28px]",children:r}),o&&a.jsx("p",{className:qe("mt-1.5 font-mono text-[11px] font-medium sm:text-[12px]",o.tone==="good"?"text-success":o.tone==="bad"?"text-danger":"text-muted-foreground"),children:o.text}),i&&a.jsx("p",{className:"mt-1.5 font-mono text-[11px] text-muted-foreground sm:text-[12px]",children:i}),d&&f&&a.jsx("div",{className:"mt-3",children:d.reduce((m,p)=>m+p.count,0)===0?a.jsx("p",{className:"flex items-center text-[12px] text-subtle-foreground",style:{height:"36px"},children:"No data in this range"}):a.jsx(S1,{rows:d,frameLabels:!1,height:36,emptyNote:"",ariaLabel:f})})]})}function n5(){return a.jsxs("div",{className:"space-y-8",children:[a.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:Array.from({length:4}).map((n,r)=>a.jsx(se,{className:"h-24 w-full"},r))}),a.jsx(se,{className:"h-32 w-full"}),a.jsx(se,{className:"h-48 w-full"})]})}function Rf(n,r){return`${n} of ${r}`}function Of(n,r,i,o,d,f){if(r<qs||o<qs)return null;const m=Math.round((n/r-i/o)*100);if(m===0)return{text:`level vs previous ${d}d`,tone:"neutral"};const p=m>0===f?"good":"bad";return{text:`${m>0?"+":""}${m} pts vs previous ${d}d`,tone:p}}function a5(){const[n,r]=j.useState(30),i=wv(n),o=wv(n*2);return a.jsxs("div",{className:"mx-auto w-full max-w-6xl min-w-0",children:[a.jsx(Zt,{eyebrow:"Performance",title:"Analytics",subtitle:`Sending performance over the last ${n} days.`,actions:a.jsx(N1,{value:n,onChange:r})}),i.isLoading&&a.jsx(n5,{}),i.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load analytics:"," ",i.error instanceof Error?i.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>i.refetch(),children:"Try again"})]}),i.data&&a.jsxs("div",{className:"min-w-0 space-y-8",children:[a.jsxs("section",{children:[(()=>{const d=i.data.totals,f=o.data?.totals??null,m=f?{sent:f.sent-d.sent,opened:f.opened-d.opened,clicked:f.clicked-d.clicked,bounced:f.bounced-d.bounced}:null,p=i.data.engagement_since!==null&&new Date(i.data.engagement_since).getTime()<=Date.now()-n*2*864e5,h=m===null?null:d.sent-m.sent===0?{text:`level vs previous ${n}d`,tone:"neutral"}:{text:`${d.sent-m.sent>0?"+":""}${d.sent-m.sent} vs previous ${n}d`,tone:"neutral"},g=w=>({day:w,count:0}),v=Yr(i.data.days.map(w=>({day:w.day,count:w.sent})),n,g),y=Yr(i.data.engagement_days.map(w=>({day:w.day,count:w.opens})),n,g),b=Yr(i.data.engagement_days.map(w=>({day:w.day,count:w.clicks})),n,g),S=Yr(i.data.engagement_days.map(w=>({day:w.day,count:w.bounces})),n,g);return a.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[a.jsx(Io,{label:"Sent",value:String(d.sent),sub:`last ${n} days`,delta:h,spark:v,sparkLabel:`Messages sent per day over the last ${n} days`}),a.jsx(Io,{label:"Open rate",value:Af(d.opened,d.sent),sub:Rf(d.opened,d.sent),delta:m&&p?Of(d.opened,d.sent,m.opened,m.sent,n,!0):null,spark:y,sparkLabel:`Opens per day over the last ${n} days`}),a.jsx(Io,{label:"Click rate",value:Af(d.clicked,d.sent),sub:Rf(d.clicked,d.sent),delta:m&&p?Of(d.clicked,d.sent,m.clicked,m.sent,n,!0):null,spark:b,sparkLabel:`Clicks per day over the last ${n} days`}),a.jsx(Io,{label:"Bounce rate",value:Af(d.bounced,d.sent),sub:Rf(d.bounced,d.sent),delta:m&&p?Of(d.bounced,d.sent,m.bounced,m.sent,n,!1):null,spark:S,sparkLabel:`Bounces per day over the last ${n} days`})]})})(),i.data.totals.sent>0&&i.data.totals.sent<qs&&a.jsxs("p",{className:"mt-3 text-[13px] text-muted-foreground",children:["Rates are hidden below ",qs," sends; a percentage over a handful of messages is noise. Read the counts."]}),(i.data.totals.suppressed>0||i.data.totals.failed>0)&&a.jsxs("p",{className:"mt-3 text-[14px] text-muted-foreground",children:["Also in range:"," ",a.jsx("span",{className:"font-mono text-[13px]",children:i.data.totals.suppressed})," ","suppressed,"," ",a.jsx("span",{className:"font-mono text-[13px]",children:i.data.totals.failed})," ","failed."]})]}),a.jsxs("section",{className:"min-w-0 overflow-hidden rounded-lg border border-border bg-card p-5 sm:p-6",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Sends per day"}),a.jsx("div",{className:"mt-4",children:a.jsx(Tf,{rows:i.data.days.map(d=>({day:d.day,count:d.sent})),rangeDays:n,emptyNote:"Nothing was sent in this range.",ariaLabel:`Messages sent per day over the last ${n} days`})})]}),i.data.engagement_days.length>0&&a.jsxs("section",{className:"min-w-0 overflow-hidden rounded-lg border border-border bg-card p-5 sm:p-6",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Opens and clicks per day"}),a.jsxs("div",{className:"mt-4",children:[a.jsx(Tf,{rows:i.data.engagement_days.map(d=>({day:d.day,count:d.opens})),rangeDays:n,emptyNote:"No open events in this range.",ariaLabel:`Opens per day over the last ${n} days`}),a.jsx("p",{className:"mt-2 mb-4 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Opens"}),a.jsx(Tf,{rows:i.data.engagement_days.map(d=>({day:d.day,count:d.clicks})),rangeDays:n,emptyNote:"No click events in this range.",ariaLabel:`Clicks per day over the last ${n} days`}),a.jsx("p",{className:"mt-2 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Clicks"})]}),i.data.engagement_since&&a.jsxs("p",{className:"mt-4 border-t border-border pt-3 text-[13px] text-muted-foreground",children:["Event tracking data available since"," ",a.jsx("span",{className:"font-mono text-[12px]",children:i.data.engagement_since}),". Older messages are not included in these trends."]})]}),i.data.engagement_days.length===0&&i.data.totals.sent>0&&a.jsxs("section",{className:"min-w-0 overflow-hidden rounded-lg border border-border bg-card p-5 sm:p-6",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Opens and clicks per day"}),a.jsx("div",{className:"mt-4 rounded-md border border-dashed border-border-strong px-6 py-10 text-center",children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No delivery events recorded yet. Open and click trends appear here once your transport provider reports engagement events via webhooks."})})]}),a.jsxs("section",{className:"min-w-0 overflow-hidden rounded-lg border border-border bg-card p-5 sm:p-6",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:"Per flow"}),a.jsx("div",{className:"mt-4 min-w-0 overflow-x-auto",children:i.data.per_flow.length===0?a.jsx("div",{className:"rounded-md border border-dashed border-border-strong px-6 py-10 text-center",children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No flow activity in this range. When flows send, their performance breaks down here."})}):a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{className:"hover:bg-transparent",children:[a.jsx(Ue,{children:"Flow"}),a.jsx(Ue,{className:"text-right",children:"Sent"}),a.jsx(Ue,{className:"text-right",children:"Opened"}),a.jsx(Ue,{className:"text-right",children:"Clicked"}),a.jsx(Ue,{className:"text-right",children:"Bounced"}),a.jsx(Ue,{className:"text-right",children:"Suppressed"}),a.jsx(Ue,{className:"text-right",children:"Failed"})]})}),a.jsx(Gs,{children:i.data.per_flow.map(d=>a.jsxs(sn,{children:[a.jsx(Re,{className:"font-medium",children:a.jsx($e,{to:`/flows/${d.flow_id}/edit`,className:"text-accent-text underline underline-offset-4",children:d.flow_name})}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-foreground",children:d.sent}),a.jsxs(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:[d.opened," ",d.sent>=qs&&a.jsxs("span",{className:"text-subtle-foreground",children:["(",nm(d.opened,d.sent),")"]})]}),a.jsxs(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:[d.clicked," ",d.sent>=qs&&a.jsxs("span",{className:"text-subtle-foreground",children:["(",nm(d.clicked,d.sent),")"]})]}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:d.bounced}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:d.suppressed}),a.jsx(Re,{className:"text-right font-mono text-[13px] text-muted-foreground",children:d.failed})]},d.flow_id))})]})})]})]})]})}const C1=["kb"];function T1(n){return["kb",n]}function s5(n){return el({queryKey:[...C1,{includeInactive:n}],queryFn:({pageParam:r})=>S_(r,n),initialPageParam:void 0,getNextPageParam:r=>r.next_cursor??void 0})}function r5(n){return Ye({queryKey:T1(n),queryFn:()=>__(n)})}function Ac(){const n=_e();return r=>{n.invalidateQueries({queryKey:C1}),r&&n.invalidateQueries({queryKey:T1(r)})}}function l5(){const n=Ac();return pe({mutationFn:r=>k_(r),onSuccess:()=>n()})}function i5(n){const r=Ac();return pe({mutationFn:i=>E_(n,i),onSuccess:()=>r(n)})}function o5(n){const r=Ac();return pe({mutationFn:()=>C_(n),onSuccess:()=>r()})}function c5(){const n=Ac();return pe({mutationFn:()=>T_(),onSuccess:()=>n()})}function u5(n){switch(n){case"pending":return"warning";case"failed":return"danger";case null:return"success"}}function d5(n){switch(n){case"pending":return"embedding";case"failed":return"embed failed";case null:return"embedded"}}function f5(n){return new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function m5(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function h5(){return a.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((n,r)=>a.jsx(se,{className:"h-20 w-full"},r))})}function x5({includeInactive:n}){return a.jsx(ls,{icon:Rm,title:n?"No entries at all":"No active entries",description:"The knowledge base is the corpus the AI writes from: your product facts, your playbooks, your voice. Add the first entry so drafts have something true to say.",action:a.jsx($e,{to:"/kb/new",children:a.jsxs(H,{size:"sm",children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"New entry"]})})})}function p5(){const[n,r]=j.useState(!1),i=s5(n),o=c5(),d=Gn(),[f,m]=j.useState(null),[p,h]=j.useState(null),g=j.useMemo(()=>i.data?.pages.flatMap(b=>b.entries)??[],[i.data]),v=g.filter(b=>b.embedding_status==="failed").length;function y(){m(null),h(null),o.mutate(void 0,{onSuccess:b=>{b.enqueued===0?m("Nothing to retry. No failed or stuck entries right now."):b.remaining>0?m(`Re-embedding started for ${b.enqueued} ${b.enqueued===1?"entry":"entries"}. ${b.remaining} more ${b.remaining===1?"is":"are"} waiting - run it again for the next batch. Badges flip to "embedded" as jobs finish.`):m(`Re-embedding started for ${b.enqueued} ${b.enqueued===1?"entry":"entries"}. Badges flip to "embedded" as jobs finish.`)},onError:b=>h(m5(b))})}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Corpus",title:"Knowledge Base",subtitle:i.isLoading?"The corpus the AI writes from.":`${g.length} ${g.length===1?"entry":"entries"}${i.hasNextPage?" loaded, more available":""}`,actions:a.jsxs(a.Fragment,{children:[a.jsx(H,{variant:"outline",size:"sm",disabled:o.isPending,onClick:y,title:"Enqueue embedding jobs for entries that failed or were orphaned",children:o.isPending?"Retrying...":"Retry failed embeddings"}),a.jsx($e,{to:"/kb/new",children:a.jsxs(H,{size:"sm",children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"New entry"]})})]})}),f&&a.jsx("p",{className:"mb-6 rounded-md border border-border bg-secondary px-4 py-3 text-[14px] text-foreground",role:"status",children:f}),p&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:p})}),a.jsxs("label",{className:"mb-4 flex w-fit cursor-pointer items-center gap-2 text-[14px] text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:n,onChange:b=>r(b.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),"Show inactive entries"]}),i.isLoading&&a.jsx(h5,{}),i.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load entries:"," ",i.error instanceof Error?i.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>i.refetch(),children:"Try again"})]}),!i.isLoading&&!i.isError&&g.length===0&&a.jsx(x5,{includeInactive:n}),g.length>0&&a.jsxs(a.Fragment,{children:[v>0&&a.jsxs("p",{className:"mb-4 text-[14px] text-muted-foreground",children:[v," ",v===1?"entry":"entries"," failed to embed and will not inform drafts. Use"," ",a.jsx("span",{className:"font-medium text-foreground",children:"Retry failed embeddings"})," ","above to reprocess them."]}),a.jsx("div",{className:"divide-y divide-border border-t border-b border-border",children:g.map(b=>a.jsxs("button",{type:"button",onClick:()=>d(`/kb/${b.id}`),className:"block w-full px-1 py-4 text-left transition-colors duration-(--dur-fast) hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:qe("text-[14px] font-medium",b.is_active?"text-foreground":"text-muted-foreground"),children:b.title}),!b.is_active&&a.jsx(le,{variant:"muted",children:"inactive"}),b.pinned&&a.jsx(le,{variant:"neutral",children:"pinned"}),a.jsx(le,{variant:u5(b.embedding_status),pulse:b.embedding_status==="pending",children:d5(b.embedding_status)}),a.jsx("span",{className:"ml-auto font-mono text-[13px] text-muted-foreground",children:f5(b.updated_at)})]}),a.jsx("p",{className:"mt-1.5 line-clamp-2 text-[14px] leading-relaxed text-muted-foreground",children:b.content_preview}),a.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-[12px] text-subtle-foreground",children:b.content_type}),b.category&&a.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:b.category}),b.tags.map(S=>a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-muted-foreground",children:S},S))]})]},b.id))}),i.hasNextPage&&a.jsx("div",{className:"mt-4 flex justify-center",children:a.jsx(H,{variant:"ghost",size:"sm",disabled:i.isFetchingNextPage,onClick:()=>i.fetchNextPage(),children:i.isFetchingNextPage?"Loading...":"Load more"})})]})]})}function g5(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function y5(){const n=Gn(),r=l5(),[i,o]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(""),[h,g]=j.useState(!1),[v,y]=j.useState(null);async function b(w){w.preventDefault(),y(null);try{const k=await r.mutateAsync({title:i.trim(),content:d,source:"manual",...m.trim()!==""?{category:m.trim()}:{},...h?{pinned:!0}:{}});n(`/kb/${k.id}`)}catch(k){y(g5(k))}}const S=r.isPending;return a.jsxs("div",{className:"mx-auto max-w-3xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx($e,{to:"/kb",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← Knowledge Base"}),a.jsx("h1",{className:"mt-2 font-display text-[28px] font-bold leading-[34px] tracking-[-0.02em] text-foreground",children:"New entry"}),a.jsx("p",{className:"mt-2 max-w-xl text-[14px] leading-relaxed text-muted-foreground",children:"Something true about your product the AI should write from: a playbook, a pricing fact, a voice guide. Write it like you would explain it to a new teammate - the AI drafts emails from this material and nothing else."})]}),v&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:v})}),a.jsxs("form",{onSubmit:b,noValidate:!0,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"kb-title",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Title ",a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"})]}),a.jsx(I,{id:"kb-title",value:i,onChange:w=>o(w.target.value),placeholder:"e.g. Win-back playbook",disabled:S,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"kb-content",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Content ",a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"})]}),a.jsx(yn,{id:"kb-content",value:d,onChange:w=>f(w.target.value),className:"min-h-72 font-mono text-[13px]",placeholder:`Write or paste the material here.
13
+
14
+ Markdown works: headings, lists, bold. Keep it factual - the closer this reads to truth, the better the drafts.`,disabled:S,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"kb-category",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Category ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional, used by a step's kb_select)"})]}),a.jsx(I,{id:"kb-category",value:m,onChange:w=>p(w.target.value),placeholder:"e.g. tip_trick",maxLength:120,disabled:S})]}),a.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:h,onChange:w=>g(w.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]",disabled:S}),"Pinned (always given to the drafting model)"]}),a.jsxs("div",{className:"flex items-center gap-3 border-t border-border pt-5",children:[a.jsx(H,{type:"submit",disabled:S||i.trim().length===0||d.trim().length===0,children:S?"Creating...":"Create entry"}),a.jsx(H,{type:"button",variant:"ghost",disabled:S,onClick:()=>n("/kb"),children:"Cancel"})]})]})]})}const v5=["markdown","html","text"];function b5(n){switch(n){case"pending":return"warning";case"failed":return"danger";case null:return"success"}}function j5(n){switch(n){case"pending":return"embedding";case"failed":return"embed failed";case null:return"embedded"}}function N5(n){return new Date(n).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function _v(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function w5({entry:n}){return n.content_type==="html"?a.jsx("iframe",{sandbox:"",referrerPolicy:"no-referrer",title:"Entry content",srcDoc:n.content,className:"h-[420px] w-full rounded-md border border-border bg-white"}):a.jsx("pre",{className:"max-h-[480px] overflow-auto whitespace-pre-wrap rounded-md border border-border bg-card p-4 font-mono text-[13px] leading-relaxed text-foreground",children:n.content})}function S5(){const{id:n}=gc(),r=Gn(),i=r5(n??""),o=i5(n??""),d=o5(n??""),[f,m]=j.useState(!1),[p,h]=j.useState(!1),[g,v]=j.useState(null),[y,b]=j.useState(!1),[S,w]=j.useState(""),[k,_]=j.useState("markdown"),[A,C]=j.useState(""),[B,V]=j.useState(""),[F,U]=j.useState(!0),[Z,Q]=j.useState(""),[xe,he]=j.useState(""),[Ne,Ae]=j.useState(!1),ee=i.data;if(j.useEffect(()=>{ee&&!f&&(w(ee.title),_(ee.content_type),C(ee.source_url??""),V(ee.tags.join(", ")),U(ee.is_active),Q(ee.content),he(ee.category??""),Ae(ee.pinned===!0))},[ee,f]),i.isLoading)return a.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[a.jsx(se,{className:"h-4 w-24"}),a.jsx(se,{className:"h-7 w-64"}),a.jsx(se,{className:"h-72 w-full"})]});if(i.isError||!ee)return a.jsx("div",{className:"mx-auto max-w-4xl",children:a.jsx("div",{className:"rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load entry:"," ",i.error instanceof Error?i.error.message:"Unknown error"]})})});async function ze(Y){Y.preventDefault(),v(null),b(!1);try{await o.mutateAsync({title:S.trim(),content:Z,content_type:k,source_url:A.trim()===""?void 0:A.trim(),tags:B.split(",").map(re=>re.trim()).filter(re=>re.length>0),is_active:F,category:xe.trim()===""?null:xe.trim(),pinned:Ne}),m(!1),b(!0)}catch(re){v(_v(re))}}async function Ee(){v(null);try{await d.mutateAsync(),r("/kb")}catch(Y){v(_v(Y)),h(!1)}}const G=o.isPending||d.isPending;return a.jsxs("div",{className:"mx-auto max-w-4xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx($e,{to:"/kb",className:"text-[14px] text-muted-foreground transition-colors duration-(--dur-fast) hover:text-foreground",children:"← Knowledge Base"}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[a.jsx("h1",{className:"truncate font-display text-[28px] font-bold leading-[34px] tracking-[-0.02em] text-foreground",children:ee.title}),!ee.is_active&&a.jsx(le,{variant:"muted",children:"inactive"}),ee.pinned&&a.jsx(le,{variant:"neutral",children:"pinned"}),a.jsx(le,{variant:b5(ee.embedding_status),pulse:ee.embedding_status==="pending",children:j5(ee.embedding_status)})]}),!f&&a.jsx("div",{className:"flex shrink-0 items-center gap-2",children:p?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[14px] text-muted-foreground",children:"Delete permanently? This is a hard delete."}),a.jsx(H,{variant:"destructive",size:"sm",disabled:G,onClick:Ee,children:"Delete"}),a.jsx(H,{variant:"ghost",size:"sm",disabled:G,onClick:()=>h(!1),children:"Cancel"})]}):a.jsxs(a.Fragment,{children:[a.jsx(H,{variant:"ghost",size:"sm",disabled:G,onClick:()=>h(!0),children:"Delete"}),a.jsx(H,{variant:"outline",size:"sm",disabled:G,onClick:()=>{m(!0),b(!1)},children:"Edit"})]})})]})]}),g&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:g})}),ee.embedding_status==="failed"&&ee.embedding_error&&a.jsx("div",{className:"mb-6 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5",role:"alert",children:a.jsx("p",{className:"whitespace-pre-wrap break-words font-mono text-[13px] text-foreground",children:ee.embedding_error})}),y&&!f&&a.jsx("p",{className:"mb-6 rounded-md border border-border bg-secondary px-4 py-3 text-[14px] text-foreground",role:"status",children:"Saved. The entry will be re-embedded automatically."}),f?a.jsxs("form",{onSubmit:ze,noValidate:!0,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"kb-title",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Title"}),a.jsx(I,{id:"kb-title",value:S,onChange:Y=>w(Y.target.value),disabled:G,required:!0})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"kb-type",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Content type"}),a.jsx(Oe,{id:"kb-type",value:k,onChange:Y=>_(Y.target.value),disabled:G,children:v5.map(Y=>a.jsx("option",{value:Y,children:Y},Y))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"kb-source-url",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Source URL"}),a.jsx(I,{id:"kb-source-url",value:A,onChange:Y=>C(Y.target.value),placeholder:"https://...",disabled:G})]})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"kb-tags",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Tags ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(comma separated)"})]}),a.jsx(I,{id:"kb-tags",value:B,onChange:Y=>V(Y.target.value),placeholder:"pricing, onboarding",disabled:G})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"kb-category",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Category ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(used by a step's kb_select)"})]}),a.jsx(I,{id:"kb-category",value:xe,onChange:Y=>he(Y.target.value),placeholder:"tip_trick",maxLength:120,disabled:G})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"kb-content",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Content"}),a.jsx(yn,{id:"kb-content",value:Z,onChange:Y=>Q(Y.target.value),className:"min-h-56 font-mono text-[13px]",disabled:G,required:!0})]}),a.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:Y=>U(Y.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]",disabled:G}),"Active (inactive entries are not used by the AI)"]}),a.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:Ne,onChange:Y=>Ae(Y.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]",disabled:G}),"Pinned (always given to the drafting model)"]}),a.jsxs("div",{className:"flex items-center gap-3 border-t border-border pt-5",children:[a.jsx(H,{type:"submit",disabled:G||S.trim().length===0||Z.trim().length===0,children:o.isPending?"Saving...":"Save changes"}),a.jsx(H,{type:"button",variant:"ghost",disabled:G,onClick:()=>m(!1),children:"Cancel"})]})]}):a.jsxs("div",{children:[a.jsxs("dl",{className:"mb-6 flex flex-wrap gap-x-8 gap-y-2 text-[14px] text-muted-foreground",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"Type: "}),a.jsx("dd",{className:"inline font-mono text-[13px]",children:ee.content_type})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"Source: "}),a.jsx("dd",{className:"inline font-mono text-[13px]",children:ee.source})]}),ee.source_url&&a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"URL: "}),a.jsx("dd",{className:"inline",children:a.jsx("a",{href:ee.source_url,target:"_blank",rel:"noreferrer",className:"text-accent-text underline underline-offset-4",children:ee.source_url})})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"Category: "}),a.jsx("dd",{className:"inline font-mono text-[13px]",children:ee.category??"none"})]}),ee.external_key&&a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"External key: "}),a.jsx("dd",{className:"inline font-mono text-[13px]",children:ee.external_key})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"inline",children:"Updated: "}),a.jsx("dd",{className:"inline font-mono text-[13px]",children:N5(ee.updated_at)})]})]}),ee.tags.length>0&&a.jsx("div",{className:"mb-6 flex flex-wrap gap-2",children:ee.tags.map(Y=>a.jsx("span",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[12px] text-muted-foreground",children:Y},Y))}),a.jsx(w5,{entry:ee}),ee.data!==void 0&&ee.data!==null&&a.jsxs("div",{className:"mt-8",children:[a.jsx("p",{className:"mb-2 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Source data (read-only)"}),a.jsx("pre",{className:"max-h-96 overflow-auto rounded-md border border-border bg-sunken p-4 font-mono text-[12px] leading-relaxed text-foreground",children:JSON.stringify(ee.data,null,2)})]})]})]})}function _5(){const{llm:n,transport:r,tenant:i}=ll(),o=pi(),d=[{label:"Account",items:[{to:"/settings/profile",label:"Profile",icon:vk},{to:"/settings/team",label:"Team",icon:Dm}]},{label:"Engine",items:[{to:"/settings/llm",label:"LLM provider",icon:xk,warn:n===null},{to:"/settings/transport",label:"Transports",icon:Mm,warn:r===null},{to:"/settings/pace",label:"Sending pace",icon:I4}]},{label:"Email",items:[{to:"/settings/topics",label:"Topics",icon:gk},{to:"/settings/branding",label:"Branding",icon:ck},{to:"/settings/postal",label:"Postal address",icon:ak,warn:i!==null&&(i.postal_address??"")===""}]},{label:"Integration",items:[{to:"/settings/webhooks",label:"Webhooks",icon:bk},{to:"/settings/config",label:"Config as code",icon:Z4}]}];return o.data?.instance_admin&&d.push({label:"Instance",items:[{to:"/settings/products",label:"Products",icon:K4},{to:"/settings/health",label:"Health",icon:Am}]}),a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Workspace",title:"Settings",subtitle:"What this install needs to compile, send, and stay legal."}),a.jsxs("div",{className:"flex flex-col gap-8 lg:flex-row lg:gap-12",children:[a.jsx("nav",{"aria-label":"Settings sections",className:"w-full shrink-0 lg:sticky lg:top-8 lg:max-h-[calc(100vh-6rem)] lg:w-60 lg:self-start lg:overflow-y-auto",children:a.jsx("div",{className:"flex gap-6 overflow-x-auto pb-1 lg:flex-col lg:gap-6 lg:overflow-visible lg:pb-0",children:d.map(f=>a.jsxs("div",{className:"shrink-0",children:[a.jsx("p",{className:"mb-1.5 hidden px-3 text-[11px] font-semibold uppercase tracking-[0.06em] text-subtle-foreground lg:block",children:f.label}),a.jsx("div",{className:"flex gap-1 lg:flex-col",children:f.items.map(m=>a.jsxs(_m,{to:m.to,className:({isActive:p})=>qe("flex items-center gap-2.5 whitespace-nowrap rounded-md px-3 py-2 text-[14px] transition-colors duration-(--dur-fast) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",p?"bg-selected font-medium text-foreground":"text-muted-foreground hover:bg-sunken hover:text-foreground"),children:[a.jsx(m.icon,{size:16,strokeWidth:1.5,className:"shrink-0"}),m.label,m.warn&&a.jsx("span",{"aria-label":"not configured",className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-warning"})]},m.to))})]},f.label))})}),a.jsx("div",{className:"min-w-0 max-w-3xl flex-1",children:a.jsx(pb,{})})]})]})}function Rc(n){return new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function yt(n){if(n!==null&&typeof n=="object"&&"kind"in n){const r=n;return r.kind==="validation"?r.issues.map(i=>i.message).join("; "):r.message}return n instanceof Error?n.message:"An unexpected error occurred."}function _t({title:n,description:r,configured:i,actions:o,children:d}){return a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:n}),i!==null&&a.jsx(le,{variant:i?"success":"warning",children:i?"configured":"not configured"})]}),r&&a.jsx("p",{className:"mt-1 max-w-prose text-[14px] leading-relaxed text-muted-foreground",children:r})]}),o&&a.jsx("div",{className:"shrink-0",children:o})]}),d]})}const k5={warning:{box:"border-warning bg-warning-soft",icon:Nc},info:{box:"border-border bg-sunken",icon:W4}};function Yn({variant:n="warning",children:r,className:i}){const{box:o,icon:d}=k5[n];return a.jsxs("div",{role:n==="warning"?"alert":"note",className:qe("flex items-start gap-2.5 rounded-md border px-4 py-3",o,i),children:[a.jsx(d,{size:14,className:qe("mt-0.5 shrink-0",n==="warning"?"text-warning":"text-muted-foreground")}),a.jsx("p",{className:"text-[14px] leading-relaxed text-foreground",children:r})]})}function Oc({children:n,className:r}){return a.jsx("dl",{className:qe("grid grid-cols-2 gap-x-8 gap-y-4 sm:grid-cols-3",r),children:n})}function Ft({label:n,mono:r=!1,span:i=!1,children:o}){return a.jsxs("div",{className:i?"col-span-full":void 0,children:[a.jsx("dt",{className:"text-[13px] text-muted-foreground",children:n}),a.jsx("dd",{className:qe("mt-0.5 text-[14px] text-foreground",r&&"font-mono text-[13px]"),children:o})]})}function Pt({message:n}){return n?a.jsx("div",{className:"mt-4 rounded-md border border-danger bg-danger-soft px-3.5 py-2.5",role:"alert",children:a.jsx("p",{className:"text-[14px] text-foreground",children:n})}):null}function E5(){const n=_e(),r=Ye({queryKey:["profile"],queryFn:f4}),[i,o]=j.useState(!1),[d,f]=j.useState(""),[m,p]=j.useState(""),[h,g]=j.useState(null),v=pe({mutationFn:S=>m4({name:S}),onSuccess:()=>{n.invalidateQueries({queryKey:["profile"]}),o(!1)}}),y=pe({mutationFn:S=>h4(S),onSuccess:S=>{g(S.message),p(""),n.invalidateQueries({queryKey:["profile"]})},onError:S=>{g(S instanceof Error?S.message:"Failed")}}),b=r.data?.profile;return r.isLoading||!b?a.jsx(_t,{title:"Profile",configured:null,children:a.jsx(se,{className:"h-20 w-full"})}):a.jsxs(_t,{title:"Profile",configured:null,description:"Your account on this install. The display name appears in the team roster; the email is how you sign in.",children:[a.jsxs(Oc,{children:[a.jsx(Ft,{label:"Email",children:a.jsxs("span",{className:"flex items-center gap-2",children:[b.email,a.jsx(le,{variant:"neutral",children:b.role})]})}),a.jsx(Ft,{label:"Name",children:i?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(I,{value:d,onChange:S=>f(S.target.value),placeholder:"Display name",className:"h-8 max-w-56",autoFocus:!0}),a.jsx(H,{size:"sm",onClick:()=>v.mutate(d||null),disabled:v.isPending,children:"Save"}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>o(!1),children:"Cancel"})]}):a.jsxs("span",{className:"flex items-center gap-2",children:[b.name||a.jsx("span",{className:"text-muted-foreground",children:"Not set"}),a.jsx(H,{size:"sm",variant:"ghost",onClick:()=>{f(b.name??""),o(!0)},children:"Edit"})]})})]}),b.pending_email&&a.jsxs(Yn,{variant:"info",className:"mt-4",children:["A change to ",a.jsx("span",{className:"font-mono text-[13px]",children:b.pending_email})," is pending. Your login switches once you confirm from that inbox."]}),a.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[a.jsx("h3",{className:"text-[14px] font-medium text-foreground",children:"Change login email"}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"A verification link goes to the new address. Nothing switches until you confirm."}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx(I,{type:"email",value:m,onChange:S=>p(S.target.value),placeholder:"new@email.com",className:"max-w-xs"}),a.jsx(H,{size:"sm",onClick:()=>y.mutate(m),disabled:!m||y.isPending,children:"Request change"})]}),h&&a.jsx("p",{className:"mt-2 text-[13px] text-muted-foreground",role:"status",children:h})]})]})}function C5(){const n=_e(),{data:r}=jc(),i=Ye({queryKey:["team"],queryFn:x4}),[o,d]=j.useState(""),[f,m]=j.useState("member"),[p,h]=j.useState(null),[g,v]=j.useState(null),y=r?.user.role==="owner",b=i.data?.members??[],S=pe({mutationFn:()=>p4(o,f),onSuccess:_=>{h(_.invite.invite_url),d(""),v(null),n.invalidateQueries({queryKey:["team"]})},onError:_=>{v(_ instanceof Error?_.message:"Failed")}}),w=pe({mutationFn:_=>y4(_),onSuccess:()=>{n.invalidateQueries({queryKey:["team"]})}}),k=pe({mutationFn:({id:_,role:A})=>g4(_,A),onSuccess:()=>{n.invalidateQueries({queryKey:["team"]})}});return a.jsx(_t,{title:"Team",configured:null,description:"Everyone who can sign in to this install. Owners manage settings and members; members get read-only access here.",children:i.isLoading?a.jsx(se,{className:"h-16 w-full"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[14px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Member"}),a.jsx("th",{className:"px-4 py-2",children:"Role"}),a.jsx("th",{className:"px-4 py-2",children:"Last login"}),y&&a.jsx("th",{className:"px-4 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:b.map(_=>a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsxs("p",{className:"text-foreground",children:[_.name||_.email,_.id===r?.user.id&&a.jsx("span",{className:"ml-2 text-[12px] text-muted-foreground",children:"(you)"})]}),_.name&&a.jsx("p",{className:"text-[12px] text-muted-foreground",children:_.email})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx(le,{variant:"neutral",children:_.role})}),a.jsx("td",{className:"px-4 py-2.5 text-[13px] text-muted-foreground",children:_.lastLoginAt?Rc(_.lastLoginAt):"never"}),y&&a.jsx("td",{className:"px-4 py-2.5 text-right",children:_.id!==r?.user.id&&a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(H,{size:"sm",variant:"outline",onClick:()=>k.mutate({id:_.id,role:_.role==="owner"?"member":"owner"}),disabled:k.isPending,children:_.role==="owner"?"Demote":"Promote"}),a.jsx(H,{size:"sm",variant:"outline",onClick:()=>{confirm(`Remove ${_.email}?`)&&w.mutate(_.id)},disabled:w.isPending,children:"Remove"})]})})]},_.id))})]})}),y&&a.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[a.jsx("h3",{className:"text-[14px] font-medium text-foreground",children:"Invite a team member"}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"An invite link is generated. It is emailed automatically when a transport is configured; otherwise share it directly."}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[a.jsx(I,{type:"email",value:o,onChange:_=>d(_.target.value),placeholder:"email@example.com",className:"max-w-xs"}),a.jsxs(Oe,{value:f,onChange:_=>m(_.target.value),className:"w-auto",children:[a.jsx("option",{value:"member",children:"Member"}),a.jsx("option",{value:"owner",children:"Owner"})]}),a.jsx(H,{size:"sm",onClick:()=>S.mutate(),disabled:!o||S.isPending,children:S.isPending?"Sending...":"Send invite"})]}),p&&a.jsxs("div",{className:"mt-3 rounded-md border border-border bg-sunken px-3.5 py-2.5",children:[a.jsx("p",{className:"mb-1 text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Invite link"}),a.jsx("p",{className:"break-all font-mono text-[12px] text-foreground",children:p})]}),g&&a.jsx("p",{className:"mt-2 text-[13px] text-danger",children:g})]})]})})}const T5={openai:{baseUrl:"https://api.openai.com/v1",model:"gpt-4o-mini",embeddingModel:"text-embedding-3-small",keyOptional:!1},anthropic:{baseUrl:"https://api.anthropic.com/v1",model:"claude-sonnet-4-6",embeddingModel:null,keyOptional:!1},ollama:{baseUrl:"http://localhost:11434/v1",model:"llama3",embeddingModel:null,keyOptional:!0},custom:{baseUrl:null,model:null,embeddingModel:null,keyOptional:!0}};function A5(n){return T5[n]??{baseUrl:null,model:null,embeddingModel:null,keyOptional:!0}}const kv=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"ollama",label:"Ollama"},{value:"custom",label:"Custom (OpenAI-compatible)"}];function R5(){const{llm:n,isLoading:r}=ll(),i=BE(),[o,d]=j.useState(!1),[f,m]=j.useState("openai"),[p,h]=j.useState(""),[g,v]=j.useState(""),[y,b]=j.useState(""),[S,w]=j.useState(""),[k,_]=j.useState(null),[A,C]=j.useState(!1);if(r)return a.jsx(se,{className:"h-40 w-full"});const B=A5(f),V=f==="custom",F=y.trim()||B.model,U=g.trim()||B.baseUrl;async function Z(he){he.preventDefault(),_(null);try{await i.mutateAsync({provider:f,api_key:p,base_url:g.trim()===""?void 0:g.trim(),model:y.trim()===""?void 0:y.trim(),embedding_model:S.trim()===""?void 0:S.trim()}),d(!1),C(!0),h("")}catch(Ne){_(yt(Ne))}}const Q=o||n===null,xe=(p!==""||B.keyOptional)&&(!V||U!==null&&F!==null);return a.jsxs(_t,{title:"LLM provider",configured:n!==null,actions:!Q&&n?a.jsx(H,{variant:"outline",size:"sm",onClick:()=>{d(!0),C(!1)},children:"Replace"}):void 0,children:[!Q&&n&&a.jsxs(a.Fragment,{children:[a.jsxs(Oc,{children:[a.jsx(Ft,{label:"Provider",children:kv.find(he=>he.value===n.provider)?.label??n.provider}),a.jsx(Ft,{label:"Model",mono:!0,children:n.model??"default"}),a.jsx(Ft,{label:"Configured",children:Rc(n.created_at)}),n.base_url&&a.jsx(Ft,{label:"Endpoint",mono:!0,span:!0,children:n.base_url}),n.embedding_model&&a.jsx(Ft,{label:"Embedding model",mono:!0,children:n.embedding_model})]}),a.jsx("p",{className:"mt-4 text-[13px] text-muted-foreground",children:"Drafts and compiles run on this provider. The key is stored encrypted and never displayed."})]}),A&&!Q&&a.jsx("p",{className:"mt-3 text-[13px] text-success",role:"status",children:"Saved. The key was verified with the provider before storing."}),n===null&&a.jsx(Yn,{className:"mb-4",children:"Without an LLM provider every flow compile returns 422. Nothing in the product can draft or compile until this is set."}),Q&&a.jsxs("form",{onSubmit:Z,noValidate:!0,className:"mt-2 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"llm-provider",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Provider"}),a.jsx(Oe,{id:"llm-provider",value:f,onChange:he=>{m(he.target.value),v(""),b(""),w("")},disabled:i.isPending,children:kv.map(he=>a.jsx("option",{value:he.value,children:he.label},he.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"llm-api-key",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["API key"," ",B.keyOptional?a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional for a local install)"}):a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"})]}),a.jsx(I,{id:"llm-api-key",type:"password",value:p,onChange:he=>h(he.target.value),autoComplete:"off",disabled:i.isPending,required:!B.keyOptional})]})]}),V&&a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"llm-base-url",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Base URL ",a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"})]}),a.jsx(I,{id:"llm-base-url",value:g,onChange:he=>v(he.target.value),placeholder:"https://your-endpoint.example.com/v1",disabled:i.isPending,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"llm-model",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:["Model ",a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"})]}),a.jsx(I,{id:"llm-model",value:y,onChange:he=>b(he.target.value),disabled:i.isPending,required:!0})]})]}),!V&&F!==null&&U!==null&&a.jsxs("p",{className:"text-[14px] text-muted-foreground",children:["Claros will use ",a.jsx("span",{className:"font-mono text-[13px]",children:F})," via ",a.jsx("span",{className:"font-mono text-[13px]",children:U}),"."]}),a.jsxs("details",{className:"rounded-md border border-border px-3.5 py-2.5",children:[a.jsx("summary",{className:"cursor-pointer text-[14px] font-medium text-foreground",children:"Advanced"}),a.jsx("p",{className:"mt-2 text-[14px] text-muted-foreground",children:"The defaults work for almost everyone. Only change these if you know why."}),a.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-4",children:[!V&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"llm-model-adv",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Model"}),a.jsx(I,{id:"llm-model-adv",value:y,onChange:he=>b(he.target.value),placeholder:B.model??"",disabled:i.isPending})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"llm-base-url-adv",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Base URL"}),a.jsx(I,{id:"llm-base-url-adv",value:g,onChange:he=>v(he.target.value),placeholder:B.baseUrl??"",disabled:i.isPending})]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"llm-embedding-model",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Embedding model"}),a.jsx(I,{id:"llm-embedding-model",value:S,onChange:he=>w(he.target.value),placeholder:B.embeddingModel??"text-embedding-3-small",disabled:i.isPending}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"Used for knowledge base search. Must produce 1536-dimension vectors."})]})]})]}),a.jsx(Pt,{message:k}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsx(H,{type:"submit",disabled:i.isPending||!xe,children:i.isPending?"Verifying...":n===null?"Verify and save":"Verify and replace"}),n!==null&&a.jsx(H,{type:"button",variant:"ghost",disabled:i.isPending,onClick:()=>d(!1),children:"Cancel"})]})]})]})}const Jr={resend:"Resend",smtp:"SMTP",cloudflare:"Cloudflare Email Service"},Bt="mb-1.5 block text-[14px] font-medium text-foreground",Sa=a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"}),Jo=a.jsx("span",{className:"text-danger","aria-hidden":"true",children:"*"});function am(n){return n.name?`${n.name} (${Jr[n.kind]??n.kind})`:`${Jr[n.kind]??n.kind}, ${n.from_email}`}function O5(){const{data:n,isLoading:r,error:i}=P3(),[o,d]=j.useState(!1);if(r)return a.jsx(se,{className:"h-40 w-full"});if(i||!n)return a.jsx(Pt,{message:i?yt(i):"Transports could not be loaded."});const f=n.transports,m=o||f.length===0;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(_t,{title:"Transports",description:"Every outgoing message leaves through one of these. Credentials are stored encrypted and never displayed.",configured:f.length>0,actions:m?void 0:a.jsx(H,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"Add transport"}),children:[f.length===0&&a.jsx(Yn,{className:"mb-4",children:"Without a transport, approved messages cannot be delivered. The product can draft and compile, but nothing sends."}),f.length>0&&a.jsx("ul",{className:"space-y-4",children:f.map(p=>a.jsx(z5,{transport:p,effective:n.effective},p.id))}),m&&a.jsx(M5,{canCancel:f.length>0,onDone:()=>d(!1)})]}),f.length>0&&a.jsx(D5,{transports:f,routing:n.routing,effective:n.effective})]})}function z5({transport:n,effective:r}){const i=Y3(),o=G3(),[d,f]=j.useState(""),[m,p]=j.useState(!1),[h,g]=j.useState(null),[v,y]=j.useState(null);async function b(w){w.preventDefault(),y(null),g(null);try{const k=await o.mutateAsync({id:n.id,to:d.trim()});g(`Test email sent to ${k.to}.`)}catch(k){y(yt(k))}}async function S(){if(y(null),!!window.confirm(`Remove ${am(n)}? Mail routed to it falls back to the default rules.`))try{await i.mutateAsync(n.id)}catch(w){y(yt(w))}}return a.jsxs("li",{className:"rounded-md border border-border p-4",children:[a.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-[15px] font-medium text-foreground",children:n.name??Jr[n.kind]??n.kind}),a.jsx(le,{variant:"neutral",children:Jr[n.kind]??n.kind}),r.default===n.id&&a.jsx(le,{variant:"accent",children:"default"}),r.transactional===n.id&&a.jsx(le,{variant:"accent",children:"transactional"}),n.kind==="cloudflare"&&a.jsx(le,{variant:"muted",children:"transactional only"})]}),a.jsxs(Oc,{children:[a.jsx(Ft,{label:"From",mono:!0,children:n.from_name?`${n.from_name} <${n.from_email}>`:n.from_email}),a.jsx(Ft,{label:"Reply-To",mono:!0,children:n.reply_to??"Not set"}),a.jsx(Ft,{label:"Daily limit",mono:!0,children:n.daily_limit!==null?`${n.daily_limit.toLocaleString("en-US")} / day`:"No limit"}),a.jsx(Ft,{label:"Configured",children:Rc(n.created_at)})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[m?a.jsxs("form",{onSubmit:b,className:"flex flex-wrap items-center gap-2",children:[a.jsx("label",{htmlFor:`test-${n.id}`,className:"sr-only",children:"Test recipient"}),a.jsx(I,{id:`test-${n.id}`,type:"email",value:d,onChange:w=>f(w.target.value),placeholder:"you@yourdomain.com",className:"w-64",disabled:o.isPending}),a.jsx(H,{type:"submit",size:"sm",disabled:o.isPending||d.trim()==="",children:o.isPending?"Sending...":"Send test"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(!1),children:"Cancel"})]}):a.jsx(H,{size:"sm",variant:"outline",onClick:()=>p(!0),children:"Send test email"}),a.jsx(H,{size:"sm",variant:"ghost",onClick:S,disabled:i.isPending,children:"Remove"})]}),h&&a.jsx("p",{className:"mt-3 text-[13px] text-success",role:"status",children:h}),a.jsx(Pt,{message:v})]})}function M5({canCancel:n,onDone:r}){const i=K3(),[o,d]=j.useState("resend"),[f,m]=j.useState(""),[p,h]=j.useState(""),[g,v]=j.useState(""),[y,b]=j.useState(""),[S,w]=j.useState(""),[k,_]=j.useState(""),[A,C]=j.useState(""),[B,V]=j.useState(""),[F,U]=j.useState("587"),[Z,Q]=j.useState(!1),[xe,he]=j.useState(""),[Ne,Ae]=j.useState(""),[ee,ze]=j.useState(!0),[Ee,G]=j.useState(""),[Y,re]=j.useState(""),[He,W]=j.useState(null),X=i.isPending,je=q=>q.trim()===""?void 0:q.trim();async function J(q){q.preventDefault(),W(null);try{await i.mutateAsync({kind:o,name:je(f)??null,from_email:p.trim(),from_name:je(g)??null,reply_to:je(y)??null,daily_limit:S.trim()===""?null:Number(S),...o==="resend"?{api_key:k,webhook_secret:je(A)}:{},...o==="smtp"?{host:B.trim(),port:Number(F),secure:Z,username:je(xe),password:Ne===""?void 0:Ne,reject_unauthorized:ee}:{},...o==="cloudflare"?{account_id:je(Ee),api_token:je(Y)}:{}}),r()}catch(ae){W(yt(ae))}}const T=p.trim()!==""&&(o==="resend"?k!=="":o==="smtp"?B.trim()!==""&&F!=="":!0);return a.jsxs("form",{onSubmit:J,noValidate:!0,className:"mt-6 space-y-4 rounded-md border border-border p-4",children:[a.jsx("h3",{className:"text-[16px] font-semibold text-foreground",children:"Add transport"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"tp-kind",className:Bt,children:"Provider"}),a.jsx(Oe,{id:"tp-kind",value:o,onChange:q=>d(q.target.value),disabled:X,children:Object.keys(Jr).map(q=>a.jsx("option",{value:q,children:Jr[q]},q))})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-name",className:Bt,children:["Name ",Sa]}),a.jsx(I,{id:"tp-name",value:f,onChange:q=>m(q.target.value),placeholder:"Receipts",disabled:X})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-from-email",className:Bt,children:["From email ",Jo]}),a.jsx(I,{id:"tp-from-email",type:"email",value:p,onChange:q=>h(q.target.value),placeholder:"hello@yourdomain.com",disabled:X,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-from-name",className:Bt,children:["From name ",Sa]}),a.jsx(I,{id:"tp-from-name",value:g,onChange:q=>v(q.target.value),disabled:X})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-reply-to",className:Bt,children:["Reply-To ",Sa]}),a.jsx(I,{id:"tp-reply-to",type:"email",value:y,onChange:q=>b(q.target.value),placeholder:"support@yourdomain.com",disabled:X})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-daily-limit",className:Bt,children:["Daily limit ",Sa]}),a.jsx(I,{id:"tp-daily-limit",type:"number",min:1,value:S,onChange:q=>w(q.target.value),disabled:X})]})]}),o==="cloudflare"&&a.jsx(Yn,{variant:"info",children:"Cloudflare Email Service is for transactional mail only. Use it for the transactional route; Claros fails any other message routed to it. On Workers with the send_email binding EMAIL, the account id and API token can stay empty."}),o==="smtp"&&a.jsx(Yn,{variant:"info",children:"SMTP does not provide delivery feedback. Open, click, bounce, and complaint events will not be tracked."}),o==="resend"&&a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-api-key",className:Bt,children:["API key ",Jo]}),a.jsx(I,{id:"tp-api-key",type:"password",value:k,onChange:q=>_(q.target.value),autoComplete:"off",disabled:X,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-webhook-secret",className:Bt,children:["Webhook secret ",Sa]}),a.jsx(I,{id:"tp-webhook-secret",type:"password",value:A,onChange:q=>C(q.target.value),autoComplete:"off",disabled:X})]})]}),o==="smtp"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsxs("label",{htmlFor:"tp-smtp-host",className:Bt,children:["SMTP host ",Jo]}),a.jsx(I,{id:"tp-smtp-host",value:B,onChange:q=>V(q.target.value),placeholder:"smtp.example.com",disabled:X,required:!0})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-smtp-port",className:Bt,children:["Port ",Jo]}),a.jsx(I,{id:"tp-smtp-port",type:"number",min:1,max:65535,value:F,onChange:q=>U(q.target.value),disabled:X,required:!0})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-smtp-username",className:Bt,children:["Username ",Sa]}),a.jsx(I,{id:"tp-smtp-username",value:xe,onChange:q=>he(q.target.value),autoComplete:"off",disabled:X})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-smtp-password",className:Bt,children:["Password ",Sa]}),a.jsx(I,{id:"tp-smtp-password",type:"password",value:Ne,onChange:q=>Ae(q.target.value),autoComplete:"off",disabled:X})]})]}),a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:Z,onChange:q=>Q(q.target.checked),disabled:X,className:"rounded border-input"}),"Implicit TLS (port 465)"]}),a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:!ee,onChange:q=>ze(!q.target.checked),disabled:X,className:"rounded border-input"}),"Accept self-signed certificates"]})]})]}),o==="cloudflare"&&a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-cf-account",className:Bt,children:["Account id ",Sa]}),a.jsx(I,{id:"tp-cf-account",value:Ee,onChange:q=>G(q.target.value),autoComplete:"off",disabled:X})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"tp-cf-token",className:Bt,children:["API token ",Sa]}),a.jsx(I,{id:"tp-cf-token",type:"password",value:Y,onChange:q=>re(q.target.value),autoComplete:"off",disabled:X})]})]}),a.jsx(Pt,{message:He}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsx(H,{type:"submit",disabled:X||!T,children:X?"Saving...":"Add transport"}),n&&a.jsx(H,{type:"button",variant:"ghost",disabled:X,onClick:r,children:"Cancel"})]})]})}const rs="";function D5({transports:n,routing:r,effective:i}){const o=V3(),[d,f]=j.useState(r.default??rs),[m,p]=j.useState(r.transactional??rs),[h,g]=j.useState(null),[v,y]=j.useState([]),[b,S]=j.useState(!1);j.useEffect(()=>{f(r.default??rs),p(r.transactional??rs)},[r.default,r.transactional]);const w=A=>n.find(C=>C.id===A);async function k(A){A.preventDefault(),g(null),S(!1);try{const C=await o.mutateAsync({default:d===rs?null:d,transactional:m===rs?null:m});y(C.warnings),S(!0)}catch(C){g(yt(C))}}const _=w(i.default);return a.jsx(_t,{title:"Routing",description:"Transactional-topic mail uses the transactional route; all other mail uses the default route.",configured:null,children:a.jsxs("form",{onSubmit:k,className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"rt-default",className:Bt,children:"Default"}),a.jsxs(Oe,{id:"rt-default",value:d,onChange:A=>f(A.target.value),disabled:o.isPending,children:[a.jsx("option",{value:rs,children:"Automatic (oldest transport)"}),n.filter(A=>A.kind!=="cloudflare").map(A=>a.jsx("option",{value:A.id,children:am(A)},A.id))]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"rt-transactional",className:Bt,children:"Transactional"}),a.jsxs(Oe,{id:"rt-transactional",value:m,onChange:A=>p(A.target.value),disabled:o.isPending,children:[a.jsx("option",{value:rs,children:"Same as default"}),n.map(A=>a.jsx("option",{value:A.id,children:am(A)},A.id))]})]})]}),_?.kind==="cloudflare"&&a.jsx(Yn,{children:"The default route currently falls back to a Cloudflare transport. Non-transactional mail will fail until another transport is the default."}),v.map(A=>a.jsx(Yn,{children:A},A)),a.jsx(Pt,{message:h}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{type:"submit",disabled:o.isPending,children:o.isPending?"Saving...":"Save routing"}),b&&a.jsx("span",{className:"text-[13px] text-success",role:"status",children:"Saved."})]})]})})}function L5(){const n=FE(),r=n.data?.throttle,i=n.isLoading,o=PE(),[d,f]=j.useState(!1),[m,p]=j.useState(""),[h,g]=j.useState(""),[v,y]=j.useState(""),[b,S]=j.useState(""),[w,k]=j.useState(""),[_,A]=j.useState([]),[C,B]=j.useState("contact_local"),[V,F]=j.useState(""),[U,Z]=j.useState(""),[Q,xe]=j.useState(null),[he,Ne]=j.useState(!1),[Ae,ee]=j.useState(!1);if(j.useEffect(()=>{!r||Ae||(p(String(r.max_emails_per_user_per_day)),g(String(r.max_emails_per_user_per_week)),y(String(r.min_interval_between_emails_hours)),S(r.send_window_start),k(r.send_window_end),A([...r.send_window_days]),B(r.send_window_timezone),F(r.tenant_timezone??""),Z(String(r.batch_size_per_tick)),ee(!0))},[r,Ae]),i||!r)return a.jsx(se,{className:"h-48 w-full"});const ze=[{value:"mon",label:"Mon"},{value:"tue",label:"Tue"},{value:"wed",label:"Wed"},{value:"thu",label:"Thu"},{value:"fri",label:"Fri"},{value:"sat",label:"Sat"},{value:"sun",label:"Sun"}];function Ee(Y){_.includes(Y)?A(_.filter(re=>re!==Y)):A([..._,Y]),Ne(!1)}async function G(Y){Y.preventDefault(),xe(null);try{await o.mutateAsync({max_emails_per_user_per_day:m===""?void 0:Number(m),max_emails_per_user_per_week:h===""?void 0:Number(h),min_interval_between_emails_hours:v===""?void 0:Number(v),send_window_start:b||void 0,send_window_end:w||void 0,send_window_days:_,send_window_timezone:C,tenant_timezone:V||void 0,batch_size_per_tick:U===""?void 0:Number(U)}),f(!1),Ne(!0)}catch(re){xe(yt(re))}}return a.jsxs(_t,{title:"Sending pace",configured:!0,description:"How fast email leaves your relay and when it is allowed to send. These limits protect your sender reputation - getting them wrong lands you in spam or gets the domain blocked.",actions:d?void 0:a.jsx(H,{variant:"outline",size:"sm",onClick:()=>{f(!0),Ne(!1)},children:"Modify"}),children:[!d&&a.jsx(a.Fragment,{children:a.jsxs(Oc,{children:[a.jsx(Ft,{label:"Max per contact / day",mono:!0,children:r.max_emails_per_user_per_day}),a.jsx(Ft,{label:"Max per contact / week",mono:!0,children:r.max_emails_per_user_per_week}),a.jsxs(Ft,{label:"Min gap between emails",mono:!0,children:[r.min_interval_between_emails_hours," hours"]}),a.jsxs(Ft,{label:"Batch size per tick",mono:!0,children:[r.batch_size_per_tick," messages"]}),a.jsxs(Ft,{label:"Send window",mono:!0,span:!0,children:[r.send_window_start," - ",r.send_window_end," (",r.send_window_days.join(", "),")"," via ",r.send_window_timezone==="contact_local"?"contact timezone":`tenant timezone (${r.tenant_timezone??"not set"})`]})]})}),he&&!d&&a.jsx("p",{className:"mt-3 text-[13px] text-success",role:"status",children:"Saved."}),d&&a.jsxs("form",{onSubmit:G,noValidate:!0,className:"mt-2 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-daily",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Max per contact per day"}),a.jsx(I,{id:"th-daily",type:"number",min:0,max:100,value:m,onChange:Y=>{p(Y.target.value),Ne(!1)},disabled:o.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"0 = no limit, 100 = max"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-weekly",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Max per contact per week"}),a.jsx(I,{id:"th-weekly",type:"number",min:0,max:500,value:h,onChange:Y=>{g(Y.target.value),Ne(!1)},disabled:o.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"0 = no limit, 500 = max"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-interval",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Minimum gap (hours)"}),a.jsx(I,{id:"th-interval",type:"number",min:0,max:168,value:v,onChange:Y=>{y(Y.target.value),Ne(!1)},disabled:o.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"0 = no minimum, 168 = 1 week"})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-window-start",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Window start"}),a.jsx(I,{id:"th-window-start",type:"time",value:b,onChange:Y=>{S(Y.target.value),Ne(!1)},disabled:o.isPending})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-window-end",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Window end"}),a.jsx(I,{id:"th-window-end",type:"time",value:w,onChange:Y=>{k(Y.target.value),Ne(!1)},disabled:o.isPending})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-batch",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Batch size per tick"}),a.jsx(I,{id:"th-batch",type:"number",min:1,max:100,value:U,onChange:Y=>{Z(Y.target.value),Ne(!1)},disabled:o.isPending})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-2 block text-[14px] font-medium text-foreground",children:"Send days"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ze.map(Y=>a.jsxs("label",{className:"flex items-center gap-1.5 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:_.includes(Y.value),onChange:()=>Ee(Y.value),disabled:o.isPending,className:"rounded border-input"}),Y.label]},Y.value))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-tz-mode",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Timezone for send window"}),a.jsxs(Oe,{id:"th-tz-mode",value:C,onChange:Y=>{B(Y.target.value),Ne(!1)},disabled:o.isPending,children:[a.jsx("option",{value:"contact_local",children:"Contact local time"}),a.jsx("option",{value:"tenant_fixed",children:"Tenant fixed timezone"})]})]}),C==="tenant_fixed"&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"th-tenant-tz",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Tenant timezone"}),a.jsx(I,{id:"th-tenant-tz",value:V,onChange:Y=>{F(Y.target.value),Ne(!1)},placeholder:"America/New_York",disabled:o.isPending})]})]}),a.jsx(Pt,{message:Q}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsx(H,{type:"submit",disabled:o.isPending,children:o.isPending?"Saving...":"Save"}),a.jsx(H,{type:"button",variant:"ghost",disabled:o.isPending,onClick:()=>f(!1),children:"Cancel"})]})]})]})}function U5(){const{tenant:n,isLoading:r}=ll(),i=Wj(),o=QE(),[d,f]=j.useState(""),[m,p]=j.useState(""),[h,g]=j.useState(""),[v,y]=j.useState(""),[b,S]=j.useState(""),[w,k]=j.useState(""),[_,A]=j.useState(null),[C,B]=j.useState(!1),[V,F]=j.useState(!1),[U,Z]=j.useState(null),[Q,xe]=j.useState(!1);if(j.useEffect(()=>{if(!n||Q)return;const ee=n.brand;f(ee.brand_name??""),p(ee.logo_url??""),g(ee.accent_color??""),y(ee.footer_text??""),S(ee.reply_to??""),xe(!0)},[n,Q]),r||!n)return a.jsx(se,{className:"h-48 w-full"});const he=!!(n.brand.brand_name||n.brand.logo_url||n.brand.accent_color);async function Ne(ee){ee.preventDefault(),A(null),B(!1);try{const ze={};ze.brand_name=d.trim()||null,ze.logo_url=m.trim()||null,ze.accent_color=h.trim()||null,ze.footer_text=v.trim()||null,ze.reply_to=b.trim()||null,await i.mutateAsync({brand:ze}),B(!0)}catch(ze){A(yt(ze))}}async function Ae(ee){ee.preventDefault(),Z(null),F(!1);try{await o.mutateAsync(w.trim()),F(!0)}catch(ze){Z(ze instanceof Error?ze.message:"Send failed")}}return a.jsxs(_t,{title:"Email branding",configured:he?!0:null,description:"Every outgoing email is wrapped in a branded shell. All fields are optional - a fresh install produces clean emails with sensible defaults.",children:[a.jsxs("form",{onSubmit:Ne,className:"space-y-4",noValidate:!0,children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Brand name"}),a.jsx(I,{value:d,onChange:ee=>{f(ee.target.value),B(!1)},placeholder:n.name,disabled:i.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"Shown in the email header. Defaults to workspace name."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Accent color"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(I,{value:h,onChange:ee=>{g(ee.target.value),B(!1)},placeholder:"#2563eb",disabled:i.isPending,className:"flex-1"}),h&&/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(h)&&a.jsx("span",{className:"inline-block h-8 w-8 shrink-0 rounded-md border border-border",style:{backgroundColor:h},"aria-hidden":!0})]}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"Hex color for the top accent bar. Default: blue."})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Logo URL"}),a.jsx(I,{value:m,onChange:ee=>{p(ee.target.value),B(!1)},placeholder:"https://example.com/logo.png",disabled:i.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"Absolute URL to your logo image (PNG or SVG, max 64px height). If empty, brand name is shown as text."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Footer text"}),a.jsx(I,{value:v,onChange:ee=>{y(ee.target.value),B(!1)},placeholder:"You are receiving this because you have an account with us.",disabled:i.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"Custom explanation in the email footer. Default: generic account message."})]}),a.jsx("div",{className:"grid grid-cols-2 gap-4",children:a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Reply-to address"}),a.jsx(I,{value:b,onChange:ee=>{S(ee.target.value),B(!1)},placeholder:"support@example.com",disabled:i.isPending}),a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:"If set, replies go here instead of the from address."})]})}),a.jsx(Pt,{message:_}),a.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[a.jsx(H,{type:"submit",size:"sm",disabled:i.isPending,children:i.isPending?"Saving...":"Save brand"}),C&&a.jsx("span",{className:"text-[13px] text-success",role:"status",children:"Saved."})]})]}),a.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[a.jsx("h3",{className:"text-[14px] font-medium text-foreground",children:"Send a test email"}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"See what your emails look like in a real inbox. Requires transport and postal address to be configured."}),a.jsxs("form",{onSubmit:Ae,className:"mt-3 flex items-end gap-3",children:[a.jsx("div",{className:"flex-1",children:a.jsx(I,{value:w,onChange:ee=>{k(ee.target.value),F(!1)},placeholder:"your@email.com",type:"email",disabled:o.isPending})}),a.jsx(H,{type:"submit",variant:"outline",size:"sm",disabled:o.isPending||!w.includes("@"),children:o.isPending?"Sending...":"Send test"})]}),V&&a.jsxs("p",{className:"mt-2 text-[13px] text-success",role:"status",children:["Test email sent to ",w,". Check your inbox."]}),U&&a.jsx("p",{className:"mt-2 text-[13px] text-danger",children:U})]})]})}function q5(){const{tenant:n,isLoading:r}=ll(),i=Wj(),[o,d]=j.useState(null),[f,m]=j.useState(null),[p,h]=j.useState(!1);if(r||!n)return a.jsx(se,{className:"h-32 w-full"});const g=o??n.postal_address??"",v=(n.postal_address??"")!=="";async function y(b){b.preventDefault(),m(null);try{await i.mutateAsync({postal_address:g}),h(!0)}catch(S){m(yt(S))}}return a.jsxs(_t,{title:"Postal address",configured:v,description:"A physical postal address is a legal requirement on commercial email (CAN-SPAM). It appears in the footer of every message the product sends.",children:[!v&&a.jsx(Yn,{className:"mb-4",children:"Outgoing mail is blocked until this is set. The drain refuses to send anything."}),a.jsxs("form",{onSubmit:y,noValidate:!0,children:[a.jsx(yn,{"aria-label":"Postal address",rows:4,value:g,onChange:b=>{d(b.target.value),h(!1)},placeholder:`Company name
15
+ Street address
16
+ City, State, ZIP
17
+ Country`,disabled:i.isPending}),a.jsx(Pt,{message:f}),a.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[a.jsx(H,{type:"submit",size:"sm",disabled:i.isPending||g.trim().length===0,children:i.isPending?"Saving...":"Save address"}),p&&a.jsx("span",{className:"text-[13px] text-success",role:"status",children:"Saved."})]})]})]})}const zf=["instance-keys"],Ev={"products:write":"create, update, archive products","keys:write":"manage a product's admin keys","transports:write":"manage a product's transports and routing","instance:read":"read instance settings, health, products","people:erase":"erase a person in every product"};function H5(){const n=_e(),r=Ye({queryKey:zf,queryFn:_4}),[i,o]=j.useState(""),[d,f]=j.useState([]),[m,p]=j.useState(null),[h,g]=j.useState(null),v=pe({mutationFn:()=>k4({label:i.trim()||void 0,scopes:d}),onSuccess:w=>{p(w.key),o(""),f([]),g(null),n.invalidateQueries({queryKey:zf})},onError:w=>g(w instanceof Error?w.message:"Could not create the key.")}),y=pe({mutationFn:w=>E4(w),onSuccess:()=>n.invalidateQueries({queryKey:zf})}),b=r.data?.scopes??Object.keys(Ev),S=r.data?.keys??[];return a.jsx(_t,{title:"Instance keys",configured:null,description:"Keys for automating this install from scripts and CI: Authorization: Bearer clr_ik_... Product-level routes take the product from the X-Claros-Product header.",children:r.isLoading?a.jsx(se,{className:"h-16 w-full"}):a.jsxs(a.Fragment,{children:[S.length>0&&a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[14px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Key"}),a.jsx("th",{className:"px-4 py-2",children:"Scopes"}),a.jsx("th",{className:"px-4 py-2",children:"Last used"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:S.map(w=>a.jsxs("tr",{children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsx("p",{className:"text-foreground",children:w.label??"Unnamed key"}),a.jsxs("p",{className:"font-mono text-[12px] text-muted-foreground",children:[w.prefix,"..."]})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:w.scopes.map(k=>a.jsx(le,{variant:"neutral",children:k},k))})}),a.jsx("td",{className:"px-4 py-2.5 text-[13px] text-muted-foreground",children:w.last_used_at?Rc(w.last_used_at):"never"}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:w.revoked_at?a.jsx(le,{variant:"warning",children:"revoked"}):a.jsx(H,{size:"sm",variant:"outline",disabled:y.isPending,onClick:()=>{confirm(`Revoke ${w.label??w.prefix}? Requests with it stop working at once.`)&&y.mutate(w.id)},children:"Revoke"})})]},w.id))})]})}),m&&a.jsxs("div",{className:"mt-4 rounded-md border border-border bg-sunken p-3",children:[a.jsx("p",{className:"text-[13px] text-foreground",children:"Copy this key now. It is not shown again."}),a.jsx("p",{className:"mt-1 break-all font-mono text-[13px] text-foreground",children:m}),a.jsx(H,{size:"sm",variant:"outline",className:"mt-2",onClick:()=>p(null),children:"Done"})]}),a.jsxs("form",{className:"mt-6",onSubmit:w=>{w.preventDefault(),v.mutate()},children:[a.jsx("h3",{className:"text-[14px] font-medium text-foreground",children:"Create an instance key"}),a.jsx("div",{className:"mt-3 flex flex-col gap-2",children:b.map(w=>a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:d.includes(w),onChange:k=>f(_=>k.target.checked?[..._,w]:_.filter(A=>A!==w))}),a.jsx("span",{className:"font-mono text-[13px]",children:w}),a.jsx("span",{className:"text-[13px] text-muted-foreground",children:Ev[w]??""})]},w))}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[a.jsx(I,{value:i,onChange:w=>o(w.target.value),placeholder:"Label (e.g. CI deploy)","aria-label":"Key label",className:"max-w-[16rem]"}),a.jsx(H,{size:"sm",type:"submit",disabled:d.length===0||v.isPending,children:v.isPending?"Creating...":"Create key"})]}),h&&a.jsx("p",{className:"mt-2 text-[13px] text-danger",children:h})]})]})})}function $5(n){return n.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63)}function B5(){const n=_e(),{data:r}=jc(),i=pi(),[o,d]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState(!1),[g,v]=j.useState(""),[y,b]=j.useState(null),S=pe({mutationFn:()=>b4({name:o.trim(),slug:f,locale:g.trim()||null}),onSuccess:()=>{d(""),m(""),h(!1),v(""),b(null),n.invalidateQueries({queryKey:Zf})},onError:_=>b(_ instanceof Error?_.message:"Could not create the product.")}),w=pe({mutationFn:({slug:_,archived:A})=>j4(_,A),onSuccess:()=>n.invalidateQueries({queryKey:Zf})});if(i.data&&!i.data.instance_admin)return a.jsx(_t,{title:"Products",configured:null,children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Only instance admins manage products."})});const k=i.data?.products??[];return a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx(_t,{title:"Products",configured:null,description:"Each product has its own contacts, flows, settings and team. Archived products stay readable and refuse changes.",children:i.isLoading?a.jsx(se,{className:"h-16 w-full"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[14px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Product"}),a.jsx("th",{className:"px-4 py-2",children:"Status"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:k.map(_=>a.jsxs("tr",{children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsxs("p",{className:"text-foreground",children:[_.name,_.id===r?.user.tenantId&&a.jsx("span",{className:"ml-2 text-[12px] text-muted-foreground",children:"(current)"})]}),a.jsx("p",{className:"font-mono text-[12px] text-muted-foreground",children:_.slug})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx(le,{variant:_.archived?"warning":"neutral",children:_.archived?"archived":"active"})}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[_.id!==r?.user.tenantId&&a.jsx(H,{size:"sm",variant:"outline",onClick:()=>vb(_.slug),children:"Open"}),a.jsx(H,{size:"sm",variant:"outline",disabled:w.isPending,onClick:()=>{(_.archived||confirm(`Archive ${_.name}? Its data stays readable; changes are refused until you unarchive it.`))&&w.mutate({slug:_.slug,archived:!_.archived})},children:_.archived?"Unarchive":"Archive"})]})})]},_.id))})]})}),a.jsxs("form",{className:"mt-6",onSubmit:_=>{_.preventDefault(),S.mutate()},children:[a.jsx("h3",{className:"text-[14px] font-medium text-foreground",children:"Create a product"}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"You become its owner. Invite its team from Settings, Team after switching to it."}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[a.jsx(I,{value:o,onChange:_=>{d(_.target.value),p||m($5(_.target.value))},placeholder:"Name","aria-label":"Product name",className:"max-w-[14rem]"}),a.jsx(I,{value:f,onChange:_=>{m(_.target.value),h(!0)},placeholder:"slug","aria-label":"Product slug",className:"max-w-[12rem] font-mono"}),a.jsx(I,{value:g,onChange:_=>v(_.target.value),placeholder:"Locale (optional, e.g. en)","aria-label":"Locale",className:"max-w-[13rem]"}),a.jsx(H,{size:"sm",type:"submit",disabled:!o.trim()||!f||S.isPending,children:S.isPending?"Creating...":"Create product"})]}),y&&a.jsx("p",{className:"mt-2 text-[13px] text-danger",children:y})]})]})}),a.jsx(H5,{})]})}const sm=[{value:"marketing",label:"Marketing",hint:"Newsletters and announcements."},{value:"lifecycle",label:"Lifecycle",hint:"Onboarding, nudges and re-engagement."},{value:"transactional",label:"Transactional",hint:"Receipts and account mail. Topic unsubscribes do not apply; no List-Unsubscribe headers."}],Wo="mb-1.5 block text-[14px] font-medium text-foreground";function Q5(){const{data:n,isLoading:r,error:i}=i1(),[o,d]=j.useState(!1);if(r)return a.jsx(se,{className:"h-40 w-full"});if(i||!n)return a.jsx(Pt,{message:i?yt(i):"Topics could not be loaded."});const f=n.topics;return a.jsxs(_t,{title:"Topics",description:"Let contacts choose which kinds of email they receive. Assign a topic to a flow to gate its mail.",configured:null,actions:o?void 0:a.jsx(H,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New topic"}),children:[f.length===0&&!o&&a.jsx(Yn,{variant:"info",children:"No topics yet. Without topics every message carries List-Unsubscribe and an unsubscribe stops all mail of this product."}),f.length>0&&a.jsx("ul",{className:"divide-y divide-border rounded-md border border-border",children:f.map(m=>a.jsx(F5,{topic:m},m.id))}),o&&a.jsx(P5,{onDone:()=>d(!1)})]})}function F5({topic:n}){const r=Z3(),[i,o]=j.useState(null);async function d(f){o(null);try{await r.mutateAsync({id:n.id,input:f})}catch(m){o(yt(m))}}return a.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-4 px-4 py-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[15px] font-medium text-foreground",children:n.name}),a.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:n.slug}),!n.default_subscribed&&a.jsx(le,{variant:"muted",children:"opt-in"}),n.mirror_only&&a.jsx(le,{variant:"muted",children:"mirror only"})]}),n.description&&a.jsx("p",{className:"mt-0.5 text-[13px] text-muted-foreground",children:n.description}),a.jsx(Pt,{message:i})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{htmlFor:`kind-${n.id}`,className:"sr-only",children:["Kind of ",n.name]}),a.jsx(Oe,{id:`kind-${n.id}`,value:n.kind,onChange:f=>{d({kind:f.target.value})},disabled:r.isPending,className:"w-40",children:sm.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))}),a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:n.default_subscribed,onChange:f=>{d({default_subscribed:f.target.checked})},disabled:r.isPending,className:"rounded border-input"}),"Subscribed by default"]}),a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",title:"The topic only mirrors consent (for example a newsletter tool's list). No flow may send on it.",children:[a.jsx("input",{type:"checkbox",checked:n.mirror_only===!0,onChange:f=>{d({mirror_only:f.target.checked})},disabled:r.isPending,className:"rounded border-input"}),"Mirror only"]})]})]})}function P5({onDone:n}){const r=X3(),[i,o]=j.useState(""),[d,f]=j.useState(""),[m,p]=j.useState(!1),[h,g]=j.useState("marketing"),[v,y]=j.useState(""),[b,S]=j.useState(!0),[w,k]=j.useState(null),_=C=>C.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63);async function A(C){C.preventDefault(),k(null);try{await r.mutateAsync({name:i.trim(),slug:d.trim(),kind:h,description:v.trim()===""?null:v.trim(),default_subscribed:b}),n()}catch(B){k(yt(B))}}return a.jsxs("form",{onSubmit:A,noValidate:!0,className:"mt-6 space-y-4 rounded-md border border-border p-4",children:[a.jsx("h3",{className:"text-[16px] font-semibold text-foreground",children:"New topic"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"topic-name",className:Wo,children:"Name"}),a.jsx(I,{id:"topic-name",value:i,onChange:C=>{o(C.target.value),m||f(_(C.target.value))},placeholder:"Product news",disabled:r.isPending})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"topic-slug",className:Wo,children:"Slug"}),a.jsx(I,{id:"topic-slug",value:d,onChange:C=>{f(C.target.value),p(!0)},className:"font-mono",disabled:r.isPending}),a.jsxs("p",{className:"mt-1 text-[13px] text-muted-foreground",children:["Used in identify traits: topics: ","{",' "',d||"slug",'": true ',"}",". Fixed after creation."]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"topic-kind",className:Wo,children:"Kind"}),a.jsx(Oe,{id:"topic-kind",value:h,onChange:C=>g(C.target.value),disabled:r.isPending,children:sm.map(C=>a.jsx("option",{value:C.value,children:C.label},C.value))}),a.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:sm.find(C=>C.value===h)?.hint})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"topic-description",className:Wo,children:["Description ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(I,{id:"topic-description",value:v,onChange:C=>y(C.target.value),disabled:r.isPending})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:C=>S(C.target.checked),disabled:r.isPending,className:"rounded border-input"}),"Subscribed by default (clear for opt-in topics)"]}),a.jsx(Pt,{message:w}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{type:"submit",disabled:r.isPending||i.trim()===""||d.trim()==="",children:r.isPending?"Saving...":"Create topic"}),a.jsx(H,{type:"button",variant:"ghost",onClick:n,disabled:r.isPending,children:"Cancel"})]})]})}const Vm=["instance-health"];function A1(n){return n==="critical"||n==="error"?"danger":n==="warning"?"warning":"neutral"}function dc(n){return n?new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"never"}function fc(n){return n?n.name??n.slug??n.id:null}function K5(){const n=pi(),r=n.data?.instance_admin===!0,i=Ye({queryKey:Vm,queryFn:N4,enabled:r,refetchInterval:6e4});return n.data&&!r?a.jsx(_t,{title:"Health",configured:null,children:a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Only instance admins see the health of this install."})}):a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx(_t,{title:"Health",configured:null,description:"Failures that need a person: dead jobs, late periodic jobs, send and webhook errors, missing configuration. Error and critical alerts are mailed; warnings show here and in the daily digest.",children:i.isLoading||!i.data?i.isError?a.jsx(Yn,{children:yt(i.error)}):a.jsx(se,{className:"h-24 w-full"}):a.jsx(Y5,{data:i.data})}),i.data&&a.jsxs(a.Fragment,{children:[a.jsx(_t,{title:"Periodic jobs",configured:null,description:"Last completed run of each periodic job. A job is late after three missed intervals.",children:a.jsx(G5,{data:i.data})}),a.jsx(_t,{title:"Recent events",configured:null,description:"The last 100 events of the past 7 days. Events are kept 30 days.",children:a.jsx(V5,{data:i.data})}),a.jsx(X5,{data:i.data})]})]})}function Y5({data:n}){const r=_e(),[i,o]=j.useState(null),d=()=>r.invalidateQueries({queryKey:Vm}),f=pe({mutationFn:h=>w4(h),onSuccess:d,onError:h=>o(yt(h))}),m=pe({mutationFn:({fingerprint:h,hours:g})=>S4(h,g),onSuccess:d,onError:h=>o(yt(h))}),p=n.alerts.open;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-4 flex flex-wrap gap-6 text-[14px]",children:[a.jsxs("p",{children:[a.jsx("span",{className:"font-mono text-[13px] text-foreground",children:p.length})," ",a.jsxs("span",{className:"text-muted-foreground",children:["open alert",p.length===1?"":"s"]})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-mono text-[13px] text-foreground",children:n.failed_jobs_24h})," ",a.jsx("span",{className:"text-muted-foreground",children:"failed jobs in 24 hours"})]}),!n.settings.enabled&&a.jsx(le,{variant:"warning",children:"alert mail off"})]}),p.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No open alerts."}):a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[13px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Alert"}),a.jsx("th",{className:"px-4 py-2",children:"Severity"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Count"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Last seen"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:p.map(h=>a.jsxs("tr",{className:"border-t border-border align-top",children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsx("p",{className:"text-foreground",children:h.message}),a.jsxs("p",{className:"mt-0.5 font-mono text-[12px] text-muted-foreground",children:[h.kind,fc(h.product)?` · ${fc(h.product)}`:"",h.muted_until?` · muted until ${dc(h.muted_until)}`:""]})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx(le,{variant:A1(h.severity),children:h.severity})}),a.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-[12px] text-muted-foreground",children:h.count}),a.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-[12px] text-muted-foreground",children:dc(h.last_at)}),a.jsx("td",{className:"px-4 py-2.5 text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(H,{size:"sm",variant:"outline",disabled:m.isPending,onClick:()=>m.mutate({fingerprint:h.fingerprint,hours:24}),children:"Mute 24h"}),a.jsx(H,{size:"sm",variant:"outline",disabled:f.isPending,onClick:()=>f.mutate(h.fingerprint),children:"Resolve"})]})})]},h.fingerprint))})]})}),i&&a.jsx("p",{className:"mt-2 text-[13px] text-danger",children:i})]})}function G5({data:n}){return a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[13px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Job"}),a.jsx("th",{className:"px-4 py-2",children:"Status"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Every"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"Last run"})]})}),a.jsx("tbody",{children:n.ticks.map(r=>a.jsxs("tr",{className:"border-t border-border",children:[a.jsx("td",{className:"px-4 py-2.5 font-mono text-[12px] text-foreground",children:r.name}),a.jsx("td",{className:"px-4 py-2.5",children:r.last_run_at===null?a.jsx(le,{variant:"muted",children:"not run yet"}):r.late?a.jsx(le,{variant:"danger",children:"late"}):a.jsx(le,{variant:"success",children:"on time"})}),a.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-[12px] text-muted-foreground",children:r.interval_minutes>=60?`${r.interval_minutes/60}h`:`${r.interval_minutes}m`}),a.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-[12px] text-muted-foreground",children:dc(r.last_run_at)})]},r.name))})]})})}function V5({data:n}){return n.events.length===0?a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"No events in the past 7 days."}):a.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[13px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-sunken text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-2",children:"Event"}),a.jsx("th",{className:"px-4 py-2",children:"Severity"}),a.jsx("th",{className:"px-4 py-2 text-right",children:"At"})]})}),a.jsx("tbody",{children:n.events.map(r=>a.jsxs("tr",{className:"border-t border-border align-top",children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsx("p",{className:"text-foreground",children:r.message}),a.jsxs("p",{className:"mt-0.5 font-mono text-[12px] text-muted-foreground",children:[r.kind,fc(r.product)?` · ${fc(r.product)}`:""]})]}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsx(le,{variant:A1(r.severity),children:r.severity})}),a.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-[12px] text-muted-foreground",children:dc(r.at)})]},r.id))})]})})}function X5({data:n}){const r=_e(),i=pi(),[o,d]=j.useState(n.settings.email??""),[f,m]=j.useState(n.settings.enabled),[p,h]=j.useState(n.settings.via_product??""),[g,v]=j.useState(null),[y,b]=j.useState(!1);j.useEffect(()=>{d(n.settings.email??""),m(n.settings.enabled),h(n.settings.via_product??"")},[n.settings.email,n.settings.enabled,n.settings.via_product]);const S=pe({mutationFn:async()=>{await Nf("alerts.enabled",f),await Nf("alerts.email",o.trim()),await Nf("alerts.via_product",p)},onSuccess:()=>{v(null),b(!0),r.invalidateQueries({queryKey:Vm})},onError:w=>{b(!1),v(yt(w))}});return a.jsx(_t,{title:"Alert mail",configured:null,description:"Where alert mail and the daily digest (07:00 UTC) go. Alert mail is transactional: it uses the transactional route of the chosen product's transports.",children:a.jsxs("form",{className:"flex flex-col gap-4",onSubmit:w=>{w.preventDefault(),b(!1),S.mutate()},children:[a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:w=>m(w.target.checked)}),"Send alert mail and the daily digest"]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"alerts-email",className:"text-[13px] font-medium text-foreground",children:"Recipient"}),a.jsx(I,{id:"alerts-email",type:"email",value:o,onChange:w=>d(w.target.value),placeholder:n.settings.default_email??"ops@example.com",className:"mt-1 max-w-[22rem]"}),a.jsxs("p",{className:"mt-1 text-[13px] text-muted-foreground",children:["Empty: the oldest instance admin",n.settings.default_email?` (${n.settings.default_email})`:"","."]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"alerts-via",className:"text-[13px] font-medium text-foreground",children:"Send through"}),a.jsx("div",{className:"mt-1 max-w-[22rem]",children:a.jsxs(Oe,{id:"alerts-via",value:p,onChange:w=>h(w.target.value),children:[a.jsx("option",{value:"",children:"The oldest product with a transport"}),(i.data?.products??[]).map(w=>a.jsx("option",{value:w.slug,children:w.name},w.id))]})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{size:"sm",type:"submit",disabled:S.isPending,children:S.isPending?"Saving...":"Save alert settings"}),y&&a.jsx("span",{className:"text-[13px] text-muted-foreground",children:"Saved."})]}),g&&a.jsx("p",{className:"text-[13px] text-danger",children:g})]})})}class Z5 extends Error{constructor(r,i){super(r),this.status=i}status}async function Vs(n){const r=await n.json().catch(()=>null);if(!n.ok){const o=(Array.isArray(r?.issues)?r.issues.map(d=>d.path?`${d.path}: ${d.message}`:d.message).join("; "):"")||(typeof r?.error=="string"?r.error:`HTTP ${n.status}`);throw new Z5(o,n.status)}return r}const zc=(n,r)=>({method:n,...r!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}:{}}),I5=async()=>Vs(await te("/v1/webhooks")),J5=async n=>Vs(await te("/v1/webhooks",zc("POST",n))),W5=async(n,r)=>Vs(await te(`/v1/webhooks/${encodeURIComponent(n)}`,zc("PATCH",r))),eA=async n=>{await Vs(await te(`/v1/webhooks/${encodeURIComponent(n)}`,zc("DELETE")))},tA=async n=>Vs(await te(`/v1/webhooks/${encodeURIComponent(n)}/rotate`,zc("POST"))),nA=async n=>Vs(await te(`/v1/webhooks/${encodeURIComponent(n)}/deliveries`)),aA=async()=>Vs(await te("/v1/config")),Xm=["webhooks"];function sA(){return Ye({queryKey:Xm,queryFn:I5})}function rA(n){return Ye({queryKey:[...Xm,"deliveries",n],queryFn:()=>nA(n),enabled:n!==null,refetchInterval:15e3})}function Mc(){const n=_e();return()=>{n.invalidateQueries({queryKey:Xm})}}function lA(){const n=Mc();return pe({mutationFn:J5,onSuccess:n})}function iA(){const n=Mc();return pe({mutationFn:({slug:r,patch:i})=>W5(r,i),onSuccess:n})}function oA(){const n=Mc();return pe({mutationFn:eA,onSuccess:n})}function cA(){const n=Mc();return pe({mutationFn:tA,onSuccess:n})}function uA(n,r){const i=new Blob([`${JSON.stringify(r,null,2)}
18
+ `],{type:"application/json"}),o=URL.createObjectURL(i),d=document.createElement("a");d.href=o,d.download=n,document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(o)}const Vr="mb-1.5 block text-[14px] font-medium text-foreground",dA=/^[a-z0-9][a-z0-9_-]{0,62}$/;function Mf(n){return n?new Date(n).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}function fA(n){return n==="delivered"?"success":n==="dead"?"danger":"warning"}function R1({secret:n,onDismiss:r}){const[i,o]=j.useState(!1);return a.jsxs("div",{className:"mt-3 rounded-md border border-warning bg-warning-soft px-4 py-3",role:"status",children:[a.jsx("p",{className:"text-[14px] text-foreground",children:"Signing secret. Copy it now: it is not shown again."}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[a.jsx("code",{className:"break-all rounded bg-card px-2 py-1 font-mono text-[13px] text-foreground",children:n}),a.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:()=>{navigator.clipboard?.writeText(n).then(()=>o(!0))},children:i?"Copied":"Copy"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:r,children:"Done"})]})]})}function O1({all:n,selected:r,onChange:i,disabled:o,idPrefix:d}){return a.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:n.map(f=>a.jsxs("label",{htmlFor:`${d}-${f}`,className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{id:`${d}-${f}`,type:"checkbox",checked:r.includes(f),disabled:o,onChange:m=>i(m.target.checked?[...r,f]:r.filter(p=>p!==f)),className:"rounded border-input"}),a.jsx("span",{className:"font-mono text-[13px]",children:f})]},f))})}function mA({slug:n}){const{data:r,isLoading:i,error:o}=rA(n);return i?a.jsx(se,{className:"mt-3 h-20 w-full"}):o||!r?a.jsx(Pt,{message:o?yt(o):"Deliveries could not be loaded."}):r.deliveries.length===0?a.jsx("p",{className:"mt-3 text-[14px] text-muted-foreground",children:"No deliveries yet."}):a.jsx("div",{className:"mt-3 overflow-x-auto rounded-md border border-border",children:a.jsxs("table",{className:"w-full text-left text-[13px]",children:[a.jsx("thead",{className:"bg-sunken text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 font-medium",children:"Event"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Attempts"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Created"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Delivered or next try"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Last error"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:r.deliveries.map(d=>a.jsxs("tr",{children:[a.jsx("td",{className:"px-3 py-2 font-mono",children:d.event}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(le,{variant:fA(d.status),children:d.status})}),a.jsx("td",{className:"px-3 py-2 font-mono",children:d.attempts}),a.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:Mf(d.created_at)}),a.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:d.delivered_at?Mf(d.delivered_at):d.status==="pending"?Mf(d.next_attempt_at):""}),a.jsx("td",{className:"max-w-64 truncate px-3 py-2 text-muted-foreground",title:d.last_error??"",children:d.last_error??""})]},d.id))})]})})}function hA({endpoint:n,allEvents:r}){const i=iA(),o=oA(),d=cA(),[f,m]=j.useState(!1),[p,h]=j.useState(!1),[g,v]=j.useState(!1),[y,b]=j.useState(null),[S,w]=j.useState(null),[k,_]=j.useState(n.url),[A,C]=j.useState(n.events),[B,V]=j.useState(String(n.batch_interval_minutes)),F=i.isPending||o.isPending||d.isPending;async function U(Q){w(null);try{await Q()}catch(xe){w(yt(xe))}}async function Z(){const Q=Number(B);if(!Number.isInteger(Q)||Q<1||Q>1440){w("The batch window is a whole number of minutes from 1 to 1440.");return}await U(async()=>{await i.mutateAsync({slug:n.slug,patch:{url:k,events:A,batch_interval_minutes:Q}}),m(!1)})}return a.jsxs("li",{className:"px-4 py-4",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"font-mono text-[14px] font-medium text-foreground",children:n.slug}),n.read_only&&a.jsx(le,{variant:"muted",children:"analytics sink"}),a.jsx(le,{variant:n.enabled?"success":"muted",children:n.enabled?"enabled":"disabled"})]}),a.jsx("p",{className:"mt-0.5 break-all text-[13px] text-muted-foreground",children:n.url}),!n.read_only&&a.jsxs("p",{className:"mt-1 text-[13px] text-muted-foreground",children:[n.events.length," event",n.events.length===1?"":"s",n.events.includes("message.pending_approval")?`, approval pings batched every ${n.batch_interval_minutes} min`:""]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(Q=>!Q),children:p?"Hide deliveries":"Deliveries"}),!n.read_only&&a.jsxs(a.Fragment,{children:[a.jsx(H,{type:"button",size:"sm",variant:"outline",disabled:F,onClick:()=>{U(()=>i.mutateAsync({slug:n.slug,patch:{enabled:!n.enabled}}))},children:n.enabled?"Disable":"Enable"}),a.jsx(H,{type:"button",size:"sm",variant:"outline",disabled:F,onClick:()=>m(Q=>!Q),children:"Edit"}),a.jsx(H,{type:"button",size:"sm",variant:"outline",disabled:F,onClick:()=>{U(async()=>b((await d.mutateAsync(n.slug)).secret))},children:"Rotate secret"}),g?a.jsxs(a.Fragment,{children:[a.jsx(H,{type:"button",size:"sm",variant:"destructive",disabled:F,onClick:()=>{U(()=>o.mutateAsync(n.slug))},children:"Delete"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:()=>v(!1),children:"Cancel"})]}):a.jsx(H,{type:"button",size:"sm",variant:"ghost",disabled:F,onClick:()=>v(!0),children:"Delete"})]})]})]}),a.jsx(Pt,{message:S}),y&&a.jsx(R1,{secret:y,onDismiss:()=>b(null)}),f&&a.jsxs("div",{className:"mt-4 space-y-4 rounded-md border border-border bg-sunken p-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:`url-${n.id}`,className:Vr,children:"URL"}),a.jsx(I,{id:`url-${n.id}`,value:k,onChange:Q=>_(Q.target.value),disabled:F})]}),a.jsxs("div",{children:[a.jsx("p",{className:Vr,children:"Events"}),a.jsx(O1,{all:r,selected:A,onChange:C,disabled:F,idPrefix:`ev-${n.id}`})]}),a.jsxs("div",{className:"max-w-56",children:[a.jsx("label",{htmlFor:`batch-${n.id}`,className:Vr,children:"Approval ping window (minutes)"}),a.jsx(I,{id:`batch-${n.id}`,type:"number",min:1,max:1440,value:B,onChange:Q=>V(Q.target.value),disabled:F})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(H,{type:"button",size:"sm",disabled:F||A.length===0,onClick:()=>{Z()},children:i.isPending?"Saving...":"Save"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(!1),children:"Cancel"})]})]}),p&&a.jsx(mA,{slug:n.slug})]})}function xA({allEvents:n,onDone:r}){const i=lA(),[o,d]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState([]),[g,v]=j.useState(null),[y,b]=j.useState(null);async function S(w){if(w.preventDefault(),b(null),!dA.test(o)){b("Slug: 1-63 characters of a-z, 0-9, _ and -, starting with a letter or digit.");return}try{const k=await i.mutateAsync({slug:o,url:f.trim(),events:p});v(k.secret)}catch(k){b(yt(k))}}return g?a.jsxs("div",{className:"mt-4",children:[a.jsxs("p",{className:"text-[14px] text-foreground",children:["Webhook ",a.jsx("span",{className:"font-mono",children:o})," created."]}),a.jsx(R1,{secret:g,onDismiss:r})]}):a.jsxs("form",{onSubmit:w=>{S(w)},noValidate:!0,className:"mt-4 space-y-4 rounded-md border border-border p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"wh-slug",className:Vr,children:"Slug"}),a.jsx(I,{id:"wh-slug",value:o,onChange:w=>d(w.target.value),placeholder:"app",disabled:i.isPending})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"wh-url",className:Vr,children:"URL"}),a.jsx(I,{id:"wh-url",value:f,onChange:w=>m(w.target.value),placeholder:"https://app.example.com/claros/webhook",disabled:i.isPending})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:Vr,children:"Events"}),a.jsx(O1,{all:n,selected:p,onChange:h,disabled:i.isPending,idPrefix:"new-ev"})]}),a.jsx(Pt,{message:y}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(H,{type:"submit",size:"sm",disabled:i.isPending||p.length===0||f.trim()==="",children:i.isPending?"Creating...":"Create webhook"}),a.jsx(H,{type:"button",size:"sm",variant:"ghost",onClick:r,children:"Cancel"})]})]})}function pA(){const{data:n,isLoading:r,error:i}=sA(),[o,d]=j.useState(!1);return r?a.jsx(se,{className:"h-40 w-full"}):i||!n?a.jsx(Pt,{message:i?yt(i):"Webhooks could not be loaded."}):a.jsxs(_t,{title:"Webhooks",description:"Signed POST requests to your app when something happens: messages sent or failed, approvals waiting, unsubscribes, enrollments. Verify them with the Standard Webhooks signature.",configured:null,actions:o?void 0:a.jsx(H,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New webhook"}),children:[a.jsx(Yn,{variant:"info",children:"A config document that lists webhooks replaces what you change here on its next apply."}),n.webhooks.length>0&&a.jsx("ul",{className:"mt-4 divide-y divide-border rounded-md border border-border",children:n.webhooks.map(f=>a.jsx(hA,{endpoint:f,allEvents:n.events},f.id))}),n.webhooks.length===0&&!o&&a.jsx("p",{className:"mt-4 text-[14px] text-muted-foreground",children:"No webhooks yet."}),o&&a.jsx(xA,{allEvents:n.events,onDone:()=>d(!1)})]})}function gA(){const[n,r]=j.useState(!1),[i,o]=j.useState(null),d=Cm();async function f(){o(null),r(!0);try{const m=await aA();uA("claros.config.json",{$schema:"https://github.com/claroshq/claros/blob/main/docs/reference/claros.config.schema.json",...m})}catch(m){o(yt(m))}finally{r(!1)}}return a.jsx(_t,{title:"Config as code",description:"Keep this product's flows, templates, topics, routing, settings and webhooks in one JSON file in your repository and apply it with one command.",configured:null,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] leading-relaxed text-muted-foreground",children:["The export holds the current configuration",d?` of ${d}`:""," without secrets (webhook, analytics and data source secrets stay on the server). Edit it, then preview and apply it:"]}),a.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-sunken p-4 font-mono text-[13px] text-foreground",children:`npx @claroshq/claros apply -f claros.config.json --dry-run
19
+ npx @claroshq/claros apply -f claros.config.json`}),a.jsx(Pt,{message:i}),a.jsx(H,{type:"button",onClick:()=>{f()},disabled:n,children:n?"Exporting...":"Download claros.config.json"})]})})}function yA(){return a.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[a.jsx("p",{className:"font-mono text-[13px] text-muted-foreground",children:"404"}),a.jsx("h1",{className:"mt-2 text-[22px] font-semibold tracking-[-0.015em] text-foreground",children:"This page does not exist"}),a.jsx("p",{className:"mt-2 max-w-sm text-[14px] leading-relaxed text-muted-foreground",children:"The route you opened matches nothing in this workspace. It may have moved, or the link may be wrong."}),a.jsx($e,{to:"/",className:"mt-6 text-[15px] text-accent-text underline underline-offset-4",children:"Back to home"})]})}function z1(){const[n,r]=j.useState(null);function i(o,d){navigator.clipboard?.writeText(d).then(()=>{r(o),window.setTimeout(()=>r(f=>f===o?null:f),1500)})}return{copied:n,copy:i}}function M1(n){return n?new Date(n).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"never"}function Wr({icon:n,title:r}){return a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-accent-soft text-accent-text",children:a.jsx(n,{size:16,strokeWidth:1.5})}),a.jsx("h2",{className:"text-[20px] font-semibold leading-[28px] tracking-[-0.015em] text-foreground",children:r})]})}function vA(){const{data:n,isLoading:r}=kc(!0),i=!n?.last_event;return a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Wr,{icon:Lm,title:"Your first event"}),r?a.jsx(se,{className:"h-6 w-28 rounded-full"}):i?a.jsx(le,{variant:"warning",pulse:!0,children:"Waiting for events"}):a.jsx(le,{variant:"success",children:"Receiving events"})]}),r?a.jsxs("div",{className:"mt-4 space-y-2",children:[a.jsx(se,{className:"h-4 w-64"}),a.jsx(se,{className:"h-4 w-40"})]}):i?a.jsx("p",{className:"mt-3 text-[14px] text-muted-foreground",children:"Send an event with the snippet or curl command below. This panel checks every few seconds and confirms the moment one arrives."}):a.jsxs("div",{className:"mt-4 space-y-2",children:[a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"Latest event received. Your integration is working."}),a.jsxs("dl",{className:"grid grid-cols-[96px_1fr] gap-y-1.5 text-[14px]",children:[a.jsx("dt",{className:"text-muted-foreground",children:"Type"}),a.jsx("dd",{className:"font-mono text-[13px] text-foreground",children:n.last_event.type}),n.last_event.event_name&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Event"}),a.jsx("dd",{className:"font-mono text-[13px] text-foreground",children:n.last_event.event_name})]}),a.jsx("dt",{className:"text-muted-foreground",children:"User"}),a.jsx("dd",{className:"font-mono text-[13px] text-foreground",children:n.last_event.user_id}),a.jsx("dt",{className:"text-muted-foreground",children:"Received"}),a.jsx("dd",{className:"font-mono text-[13px] text-foreground",children:M1(n.last_event.received_at)}),a.jsx("dt",{className:"text-muted-foreground",children:"Last 24h"}),a.jsxs("dd",{className:"font-mono text-[13px] text-foreground",children:[n.events_last_24h," ",n.events_last_24h===1?"event":"events"]})]})]})]})}function bA(n,r){const i=r??"PASTE_YOUR_PUBLISHABLE_KEY";return["<script>"," window.claros = window.claros || function () {"," (window.claros.q = window.claros.q || []).push(arguments);"," };","<\/script>",`<script async src="${n}/claros.js"><\/script>`,"<script>",` claros("init", "${i}", { endpoint: "${n}" });`,' claros("identify", "user_123", { email: "user@example.com" });',' claros("track", "signed_up");',"<\/script>"].join(`
20
+ `)}function jA(n){return[`curl -X POST ${n}/v1/track \\`,' -H "Authorization: Bearer PASTE_YOUR_KEY" \\',' -H "Content-Type: application/json" \\',` -d '{"userId": "user_123", "event": "signed_up"}'`].join(`
21
+ `)}function Cv({id:n,code:r}){const{copied:i,copy:o}=z1();return a.jsxs("div",{className:"relative",children:[a.jsx("pre",{className:"overflow-x-auto rounded-md bg-sunken p-4 font-mono text-[13px] leading-5 text-foreground",children:r}),a.jsxs(H,{variant:"secondary",size:"sm",className:"absolute right-3 top-3",onClick:()=>o(n,r),children:[i===n?a.jsx(rl,{size:16,strokeWidth:1.5}):a.jsx(Fb,{size:16,strokeWidth:1.5}),i===n?"Copied":"Copy"]})]})}function NA({publishableKey:n,rawKey:r,onCreateKey:i,creating:o}){const d=window.location.origin,f=j.useMemo(()=>bA(d,r),[d,r]),m=j.useMemo(()=>jA(d),[d]);return a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsx(Wr,{icon:V4,title:"Browser snippet"}),a.jsx("p",{className:"mt-1 text-[14px] text-muted-foreground",children:"Paste this into your site's HTML, before the closing body tag. It identifies a user and tracks an event."}),n===null?a.jsxs("div",{className:"mt-4 rounded-md border border-dashed border-border-strong p-4",children:[a.jsx("p",{className:"text-[14px] text-muted-foreground",children:"You need a publishable key first. Publishable keys are safe to embed in a web page: they can write events and nothing else."}),a.jsxs(H,{size:"sm",className:"mt-3",onClick:i,disabled:o,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),o?"Creating...":"Create publishable key"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-4",children:a.jsx(Cv,{id:"snippet",code:f})}),a.jsx("p",{className:"mt-3 text-[14px] text-muted-foreground",children:"The snippet sends events without a CORS preflight and survives page unloads. It can only write events, never read your data."}),!r&&n&&a.jsxs("p",{className:"mt-2 text-[14px] text-muted-foreground",children:["Paste the publishable key you saved at creation (",a.jsxs("span",{className:"font-mono text-[13px]",children:[n.prefix,"..."]}),") into the init line, or create a new publishable key below to get a snippet with the key already in it."]}),a.jsx("p",{className:"mt-5 text-[14px] font-medium text-foreground",children:"Or send one with curl"}),a.jsx("div",{className:"mt-2",children:a.jsx(Cv,{id:"curl",code:m})})]})]})}function wA({created:n,onDismiss:r}){const{copied:i,copy:o}=z1();return a.jsx("div",{className:"rounded-md border border-success bg-success-soft p-4",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-[14px] font-medium text-foreground",children:[n.kind==="publishable"?"Publishable":n.kind==="admin"?"Admin":"Secret"," key created"]}),a.jsx("p",{className:"mt-1 text-[14px] text-foreground",children:"Copy it now. For your security it is stored as a hash and will never be shown again."}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx("code",{className:"rounded-md bg-card px-3 py-2 font-mono text-[13px] text-foreground",children:n.key}),a.jsxs(H,{variant:"secondary",size:"sm",onClick:()=>o("newkey",n.key),children:[i==="newkey"?a.jsx(rl,{size:16,strokeWidth:1.5}):a.jsx(Fb,{size:16,strokeWidth:1.5}),i==="newkey"?"Copied":"Copy"]})]})]}),a.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors duration-(--dur-fast) hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(wc,{size:16,strokeWidth:1.5})})]})})}function SA({apiKey:n}){const r=VE(),[i,o]=j.useState(n.allowed_origins.join(`
22
+ `));function d(){const f=i.split(`
23
+ `).map(m=>m.trim()).filter(m=>m.length>0);r.mutate({id:n.id,allowed_origins:f},{onError:()=>{}})}return a.jsxs("div",{className:"py-2",children:[a.jsx("label",{htmlFor:`origins-${n.id}`,className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Allowed origins"}),a.jsx("p",{className:"mb-2 text-[14px] text-muted-foreground",children:"One origin per line, for example https://app.example.com. Browsers on other origins are rejected. Leave empty to allow any origin."}),a.jsx("textarea",{id:`origins-${n.id}`,rows:3,value:i,onChange:f=>o(f.target.value),placeholder:"https://app.example.com",className:"w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-[13px] text-foreground placeholder:text-subtle-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),r.isError&&a.jsx("p",{className:"mt-2 text-[14px] text-danger",children:r.error instanceof Error?r.error.message:"Could not save origins."}),a.jsx("div",{className:"mt-2",children:a.jsx(H,{size:"sm",variant:"secondary",onClick:d,disabled:r.isPending,children:r.isPending?"Saving...":"Save origins"})})]})}function _A({keys:n,onCreated:r}){const i=n1(),o=XE(),[d,f]=j.useState(null),[m,p]=j.useState(!1),[h,g]=j.useState(""),[v,y]=j.useState(new Set(["config","suppressions","messages","contacts:read"]));function b(w){i.mutate({kind:w},{onSuccess:k=>r(k)})}function S(){i.mutate({kind:"admin",label:h.trim()||void 0,scopes:[...v]},{onSuccess:w=>{p(!1),g(""),r(w)}})}return a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx(Wr,{icon:ek,title:"API keys"}),a.jsx("p",{className:"mt-1 text-[14px] text-muted-foreground",children:"Publishable keys go in web pages. Secret keys go in your backend and never in browser code."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(H,{variant:"secondary",size:"sm",onClick:()=>b("publishable"),disabled:i.isPending,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"Publishable key"]}),a.jsxs(H,{variant:"secondary",size:"sm",onClick:()=>b("secret"),disabled:i.isPending,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"Secret key"]}),a.jsxs(H,{variant:"secondary",size:"sm",onClick:()=>p(w=>!w),disabled:i.isPending,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),"Admin key"]})]})]}),m&&a.jsxs("div",{className:"mt-4 rounded-md border border-border bg-secondary p-4",children:[a.jsx("p",{className:"text-[14px] text-foreground",children:"Admin keys call the management API (config, suppressions, approvals) from your backend or CI. Owners only. Pick the scopes it needs."}),a.jsx("div",{className:"mt-3 flex flex-wrap gap-x-5 gap-y-2",children:J_.map(w=>a.jsxs("label",{className:"flex items-center gap-2 text-[14px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:v.has(w),onChange:()=>y(k=>{const _=new Set(k);return _.has(w)?_.delete(w):_.add(w),_}),className:"h-4 w-4 accent-(--accent-deep)"}),a.jsx("span",{className:"font-mono text-[13px]",children:w})]},w))}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx("input",{value:h,onChange:w=>g(w.target.value),placeholder:"Label (e.g. CI deploy)",className:"h-8 w-64 rounded-md border border-border bg-card px-2.5 text-[14px] text-foreground"}),a.jsx(H,{size:"sm",onClick:S,disabled:i.isPending||v.size===0,children:"Create admin key"})]})]}),i.isError&&a.jsx("p",{className:"mt-3 text-[14px] text-danger",children:i.error instanceof Error?i.error.message:"Could not create the key."}),n.length===0?a.jsx("p",{className:"mt-6 text-[14px] text-muted-foreground",children:"No keys yet. Create a publishable key for the browser snippet, or a secret key for server-side sending."}):a.jsx("div",{className:"mt-4",children:a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{children:[a.jsx(Ue,{children:"Key"}),a.jsx(Ue,{children:"Kind"}),a.jsx(Ue,{children:"Label"}),a.jsx(Ue,{children:"Origins"}),a.jsx(Ue,{children:"Last used"}),a.jsx(Ue,{children:"Status"}),a.jsx(Ue,{})]})}),a.jsx(Gs,{children:n.map(w=>a.jsxs(j.Fragment,{children:[a.jsxs(sn,{children:[a.jsxs(Re,{className:"font-mono text-[13px] text-muted-foreground",children:[w.prefix,"..."]}),a.jsx(Re,{children:a.jsx(le,{variant:w.kind==="publishable"?"accent":"neutral",children:w.kind})}),a.jsx(Re,{className:"text-[14px] text-foreground",children:w.label??a.jsx("span",{className:"text-subtle-foreground",children:"-"})}),a.jsx(Re,{className:"text-[14px] text-muted-foreground",children:w.kind==="admin"?a.jsx("span",{className:"font-mono text-[12px]",children:(w.scopes??[]).join(", ")}):w.kind!=="publishable"?a.jsx("span",{className:"text-subtle-foreground",children:"-"}):w.allowed_origins.length===0?"Any":w.allowed_origins.length}),a.jsx(Re,{className:"font-mono text-[13px] text-muted-foreground",children:M1(w.last_used_at)}),a.jsx(Re,{children:w.revoked_at?a.jsx(le,{variant:"muted",children:"revoked"}):a.jsx(le,{variant:"success",children:"active"})}),a.jsx(Re,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-1",children:[w.kind==="publishable"&&!w.revoked_at&&a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>f(d===w.id?null:w.id),children:"Origins"}),!w.revoked_at&&a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>o.mutate(w.id),disabled:o.isPending,children:"Revoke"})]})})]}),d===w.id&&a.jsx(sn,{children:a.jsx(Re,{colSpan:7,className:"bg-sunken",children:a.jsx(SA,{apiKey:w})})})]},w.id))})]})})]})}function kA({secretKey:n}){const{data:r}=jc(),[i,o]=j.useState(""),[d,f]=j.useState(!1),[m,p]=j.useState(null),h=r?.user?.email??"",g=i||h;if(!n)return null;async function v(){if(!g||!g.includes("@")){p({ok:!1,message:"Enter a valid email address."});return}f(!0),p(null);const y=window.location.origin,b="test-event-user",S={Authorization:`Bearer ${n}`,"Content-Type":"application/json"};try{const w=await fetch(`${y}/v1/identify`,{method:"POST",headers:S,body:JSON.stringify({userId:b,traits:{email:g,name:"Test User"}})});if(!w.ok){const _=await w.text();p({ok:!1,message:`Identify failed (${w.status}): ${_.slice(0,100)}`}),f(!1);return}const k=await fetch(`${y}/v1/track`,{method:"POST",headers:S,body:JSON.stringify({userId:b,event:"signed_up"})});if(!k.ok){const _=await k.text();p({ok:!1,message:`Track failed (${k.status}): ${_.slice(0,100)}`}),f(!1);return}p({ok:!0,message:`Test event sent. Check People for "${g}" and Sent for the email.`})}catch(w){p({ok:!1,message:`Network error: ${w instanceof Error?w.message:String(w)}`})}finally{f(!1)}}return a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsx(Wr,{icon:Bs,title:"Send a test event"}),a.jsxs("p",{className:"mt-2 text-[14px] text-muted-foreground",children:["Send a real ",a.jsx("code",{className:"rounded bg-sunken px-1 text-[13px]",children:"signed_up"})," event through the ingestion API using your secret key. If you have a welcome flow active, this triggers it and sends an email to the address below."]}),a.jsxs("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-end",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{htmlFor:"test-email",className:"mb-1.5 block text-[14px] font-medium text-foreground",children:"Recipient email"}),a.jsx(I,{id:"test-email",type:"email",value:i,onChange:y=>o(y.target.value),placeholder:h||"you@company.com"})]}),a.jsxs(H,{onClick:v,disabled:d,children:[a.jsx(Bs,{size:16,strokeWidth:1.5}),d?"Sending...":"Send test event"]})]}),m&&a.jsx("div",{className:`mt-3 rounded-md border px-3.5 py-2.5 text-[14px] ${m.ok?"border-success bg-success-soft text-foreground":"border-danger bg-danger-soft text-foreground"}`,role:"status",children:m.message})]})}function EA(){const{data:n,isLoading:r}=t1(),i=n1(),[o,d]=j.useState(null),f=n?.keys??[],m=f.find(b=>b.kind==="publishable"&&!b.revoked_at)??null,p=o&&o.kind==="publishable"?o.key:null,h=o&&o.kind==="secret"?o.key:null;function g(){i.mutate({kind:"publishable"},{onSuccess:b=>d(b)})}const v=f.find(b=>b.kind==="secret"&&!b.revoked_at)??null;function y(){i.mutate({kind:"secret",label:"Test event key"},{onSuccess:b=>d(b)})}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Ingestion",title:"Integrate",subtitle:"Get events flowing into Claros: grab a key, paste the snippet, watch the first event arrive."}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vA,{}),o&&a.jsx(wA,{created:o,onDismiss:()=>d(null)}),h?a.jsx(kA,{secretKey:h}):v&&!h?a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsx(Wr,{icon:Bs,title:"Send a test event"}),a.jsx("p",{className:"mt-2 text-[14px] text-muted-foreground",children:"Create a secret key to send a test event through the real API. The key is shown once at creation and used to send the event."}),a.jsxs(H,{size:"sm",className:"mt-3",onClick:y,disabled:i.isPending,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),i.isPending?"Creating...":"Create secret key for testing"]})]}):v?null:a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6",children:[a.jsx(Wr,{icon:Bs,title:"Send a test event"}),a.jsx("p",{className:"mt-2 text-[14px] text-muted-foreground",children:"Create a secret key to send a test event through the real API."}),a.jsxs(H,{size:"sm",className:"mt-3",onClick:y,disabled:i.isPending,children:[a.jsx(Kn,{size:16,strokeWidth:1.5}),i.isPending?"Creating...":"Create secret key"]})]}),r?a.jsx(se,{className:"h-64 w-full rounded-lg"}):a.jsxs(a.Fragment,{children:[a.jsx(NA,{publishableKey:m,rawKey:p,onCreateKey:g,creating:i.isPending}),a.jsx(_A,{keys:f,onCreated:d})]})]})]})}const D1=["sent-log"];function CA(n){return el({queryKey:[...D1,n],queryFn:({pageParam:r})=>i4(r,n),initialPageParam:void 0,getNextPageParam:r=>r.next_cursor??void 0})}function TA(n){return Ye({queryKey:[...D1,n],queryFn:()=>o4(n),enabled:!!n})}function AA(n){switch(n){case"sent":return"success";case"sending":return"warning";case"failed":return"danger";case"suppressed":return"muted";default:return"neutral"}}function RA(n){switch(n){case"opened":return"accent";case"clicked":return"success";case"bounced":return"danger";case"complained":return"danger";default:return"neutral"}}function OA(n){return n?new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"}function zA(n){return n.contact.name?n.contact.name:n.recipient_address?n.recipient_address:n.contact.email?n.contact.email:"(unknown)"}function MA(){const n=Gn(),[r,i]=j.useState(""),[o,d]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState(""),[g,v]=j.useState("");j.useEffect(()=>{const C=setTimeout(()=>d(r.trim()),300);return()=>clearTimeout(C)},[r]);const y=j.useMemo(()=>({...f&&{status:f},...p&&{flow_id:p},...o&&{recipient:o},...g&&{feedback:g}}),[f,p,o,g]),b=CA(y),{data:S}=Ps(),w=S?.flows??[],k=b.data?.pages.flatMap(C=>C.messages)??[],_=f||p||o||g;function A(){i(""),d(""),m(""),h(""),v("")}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsx(Zt,{eyebrow:"Delivery",title:"Sent Mail",subtitle:"Every message that left the pipeline: who received it, when, and what happened after.",actions:a.jsx($e,{to:"/sent/suppressions",children:a.jsx(H,{variant:"outline",size:"sm",children:"Suppressions"})})}),a.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-3 border-b border-border pb-5",children:[a.jsxs("div",{className:"relative w-full sm:w-72",children:[a.jsx(mj,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx(I,{placeholder:"Search recipient...",value:r,onChange:C=>i(C.target.value),className:"pl-9"})]}),a.jsxs(Oe,{value:f,onChange:C=>m(C.target.value),className:"w-[calc(50%-6px)] sm:w-36",children:[a.jsx("option",{value:"",children:"All statuses"}),a.jsx("option",{value:"sent",children:"Sent"}),a.jsx("option",{value:"sending",children:"Sending"}),a.jsx("option",{value:"failed",children:"Failed"}),a.jsx("option",{value:"suppressed",children:"Suppressed"})]}),a.jsxs(Oe,{value:g,onChange:C=>v(C.target.value),className:"w-[calc(50%-6px)] sm:w-36",children:[a.jsx("option",{value:"",children:"All feedback"}),a.jsx("option",{value:"opened",children:"Opened"}),a.jsx("option",{value:"clicked",children:"Clicked"}),a.jsx("option",{value:"bounced",children:"Bounced"}),a.jsx("option",{value:"complained",children:"Complained"})]}),a.jsxs(Oe,{value:p,onChange:C=>h(C.target.value),className:"w-full sm:w-48",children:[a.jsx("option",{value:"",children:"All flows"}),w.map(C=>a.jsx("option",{value:C.id,children:C.name},C.id))]}),_&&a.jsx(H,{variant:"ghost",size:"sm",onClick:A,children:"Clear"})]}),b.isLoading&&a.jsx(DA,{}),b.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load messages:"," ",b.error instanceof Error?b.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>b.refetch(),children:"Try again"})]}),b.isSuccess&&k.length===0&&!_&&a.jsx(ls,{icon:Bs,title:"No messages sent yet",description:"Every message that leaves the pipeline lands here: who received it, when, and what happened after. Messages appear once they clear the approval queue."}),b.isSuccess&&k.length===0&&_&&a.jsx(ls,{icon:dj,title:"No messages match",description:"Nothing in the log matches the current search and filters.",compact:!0,action:a.jsx(H,{variant:"outline",size:"sm",onClick:A,children:"Clear search and filters"})}),b.isSuccess&&k.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{className:"hover:bg-transparent",children:[a.jsx(Ue,{children:"Recipient"}),a.jsx(Ue,{children:"Subject"}),a.jsx(Ue,{children:"Flow"}),a.jsx(Ue,{children:"Status"}),a.jsx(Ue,{children:"Feedback"}),a.jsx(Ue,{className:"text-right",children:"Sent"})]})}),a.jsx(Gs,{children:k.map(C=>a.jsxs(sn,{className:"cursor-pointer",onClick:()=>n(`/sent/${C.id}`),children:[a.jsx(Re,{className:"max-w-[220px]",children:C.contact.name?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block truncate font-medium text-foreground",children:C.contact.name}),a.jsx("span",{className:"block truncate font-mono text-[12px] text-muted-foreground",children:C.recipient_address??C.contact.email??""})]}):a.jsx("span",{className:"block truncate font-mono text-[13px]",children:zA(C)})}),a.jsx(Re,{className:"max-w-[250px] truncate",children:C.subject??"(no subject)"}),a.jsx(Re,{className:"max-w-[150px] truncate",children:C.flow_name?a.jsx($e,{to:`/flows/${C.flow_id}/edit`,onClick:B=>B.stopPropagation(),className:"text-accent-text underline-offset-4 hover:underline",children:C.flow_name}):a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(Re,{children:a.jsx(le,{variant:AA(C.status),children:C.status})}),a.jsx(Re,{children:C.feedback?a.jsx(le,{variant:RA(C.feedback),children:C.feedback}):a.jsx("span",{className:"text-subtle-foreground",children:"-"})}),a.jsx(Re,{className:"whitespace-nowrap text-right font-mono text-[13px] text-muted-foreground",children:OA(C.sent_at)})]},C.id))})]}),b.hasNextPage&&a.jsx("div",{className:"mt-4 flex justify-center",children:a.jsx(H,{variant:"ghost",size:"sm",onClick:()=>b.fetchNextPage(),disabled:b.isFetchingNextPage,children:b.isFetchingNextPage?"Loading...":"Load more"})})]})]})}function DA(){return a.jsx("div",{className:"space-y-3",children:Array.from({length:8}).map((n,r)=>a.jsxs("div",{className:"flex gap-4",children:[a.jsx(se,{className:"h-5 w-40"}),a.jsx(se,{className:"h-5 w-56"}),a.jsx(se,{className:"h-5 w-28"}),a.jsx(se,{className:"h-5 w-16"}),a.jsx(se,{className:"h-5 w-16"}),a.jsx(se,{className:"h-5 w-24"})]},r))})}function LA(n){switch(n){case"sent":return"success";case"sending":return"warning";case"failed":return"danger";case"suppressed":return"muted";default:return"neutral"}}function rm(n){return n?new Date(n).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}const UA={delivered:G4,opened:X4,clicked:ok,bounced:$b,complained:Nc},qA={delivered:"Delivered",opened:"Opened",clicked:"Clicked",bounced:"Bounced",complained:"Complained"};function L1(n){switch(n){case"delivered":return"success";case"opened":return"accent";case"clicked":return"success";case"bounced":return"danger";case"complained":return"danger";default:return"neutral"}}function HA(){const{id:n}=gc(),r=TA(n??"");if(r.isLoading)return a.jsxs("div",{className:"mx-auto max-w-4xl",children:[a.jsx("div",{className:"mb-6",children:a.jsx(se,{className:"h-5 w-32"})}),a.jsx(se,{className:"h-8 w-64 mb-4"}),a.jsx(se,{className:"h-96 w-full"})]});if(r.isError||!r.data)return a.jsxs("div",{className:"mx-auto max-w-4xl",children:[a.jsxs($e,{to:"/sent",className:"mb-4 inline-flex items-center gap-1.5 text-[14px] text-muted-foreground hover:text-foreground",children:[a.jsx(Xf,{size:14})," Back to Sent Mail"]}),a.jsx("div",{className:"rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:"Message not found or failed to load."})})]});const{message:i,events:o}=r.data;return a.jsxs("div",{className:"mx-auto max-w-4xl",children:[a.jsxs($e,{to:"/sent",className:"mb-4 inline-flex items-center gap-1.5 text-[14px] text-muted-foreground hover:text-foreground",children:[a.jsx(Xf,{size:14})," Back to Sent Mail"]}),a.jsx(Zt,{eyebrow:"Message Detail",title:i.subject??"(no subject)"}),a.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-x-8 gap-y-3 rounded-lg border border-border bg-card p-5",children:[a.jsx(Ls,{label:"To",value:i.recipient_address??i.contact.email??"-"}),a.jsx(Ls,{label:"Contact",value:i.contact.name??i.contact.external_id??"-"}),a.jsx(Ls,{label:"Flow",value:i.flow_name??"-",link:`/flows/${i.flow_id}/edit`}),a.jsx(Ls,{label:"Step",value:i.flow_step_order!==null?`#${i.flow_step_order}`:"-"}),a.jsx(Ls,{label:"Sent",value:rm(i.sent_at)}),a.jsx(Ls,{label:"Created",value:rm(i.created_at)}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Status"}),a.jsx(le,{variant:LA(i.status),children:i.status}),i.feedback&&a.jsx(le,{variant:L1(i.feedback),children:i.feedback})]}),i.retry_count>0&&a.jsx(Ls,{label:"Retries",value:String(i.retry_count)})]}),i.brain_reasoning&&a.jsxs("details",{className:"mb-6",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[13px] font-medium text-muted-foreground hover:text-foreground",children:"Brain reasoning"}),a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-border bg-card p-4 font-mono text-[12px] text-muted-foreground",children:i.brain_reasoning})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"mb-4 text-[14px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:"Timeline"}),o.length===0?a.jsx("p",{className:"text-[13px] text-subtle-foreground",children:i.feedback?`Highest engagement: ${i.feedback} (no event-level timestamps available for this message).`:"No delivery events recorded. The transport may not report events, or the message was sent before event logging was enabled."}):a.jsx("ol",{className:"relative space-y-0",children:o.map((d,f)=>a.jsx($A,{event:d,last:f===o.length-1},d.id))})]}),a.jsx(BA,{bodyHtml:i.body_html,bodyText:i.body_text}),i.status==="failed"&&a.jsx("div",{className:"mt-6 rounded-md border border-warning bg-warning-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[14px] text-foreground",children:["This message failed."," ",i.brain_reasoning&&a.jsxs("span",{children:["Reason: ",i.brain_reasoning,". "]}),a.jsx($e,{to:"/approvals",className:"text-accent-text underline underline-offset-4",children:"View Approvals"})," ","for retry options."]})})]})}function Ls({label:n,value:r,link:i}){return a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.06em] text-muted-foreground",children:n}),i?a.jsx($e,{to:i,className:"truncate font-mono text-[13px] text-accent-text underline underline-offset-4",children:r}):a.jsx("span",{className:"truncate font-mono text-[13px] text-foreground",children:r})]})}function $A({event:n,last:r}){const i=UA[n.event_type]??Bs,o=qA[n.event_type]??n.event_type,f={delivered:"border-transparent bg-success-soft text-success",opened:"border-transparent bg-accent-soft text-accent-text",clicked:"border-transparent bg-success-soft text-success",bounced:"border-transparent bg-danger-soft text-danger",complained:"border-transparent bg-danger-soft text-danger"}[n.event_type]??"border-border-strong bg-background text-muted-foreground";return a.jsxs("li",{className:"relative flex gap-4 pb-5 last:pb-0",children:[!r&&a.jsx("span",{"aria-hidden":"true",className:"absolute left-[11px] top-6 h-full w-px bg-border"}),a.jsx("span",{"aria-hidden":"true",className:`z-10 mt-1 flex h-[23px] w-[23px] shrink-0 items-center justify-center rounded-full border ${f}`,children:a.jsx(i,{size:12,strokeWidth:1.5})}),a.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[a.jsxs("p",{className:"text-[14px] text-foreground",children:[a.jsx(le,{variant:L1(n.event_type),className:"mr-2",children:o}),n.metadata&&typeof n.metadata.url=="string"?a.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:n.metadata.url}):null,n.metadata&&typeof n.metadata.bounce_type=="string"?a.jsxs("span",{className:"font-mono text-[12px] text-muted-foreground",children:[n.metadata.bounce_type,typeof n.metadata.bounce_message=="string"?` - ${n.metadata.bounce_message}`:null]}):null]}),a.jsx("p",{className:"mt-1 font-mono text-[12px] text-subtle-foreground",children:rm(n.occurred_at)})]})]})}function BA({bodyHtml:n,bodyText:r}){const[i,o]=j.useState("preview");return!n&&!r?a.jsx("p",{className:"text-[13px] text-subtle-foreground",children:"No content available (message may have been suppressed or skipped before content generation)."}):a.jsxs("section",{children:[a.jsxs("div",{className:"mb-3 flex items-center gap-1 border-b border-border",children:[n&&a.jsx(Df,{active:i==="preview",onClick:()=>o("preview"),children:"Preview"}),r&&a.jsx(Df,{active:i==="text",onClick:()=>o("text"),children:"Plain Text"}),n&&a.jsx(Df,{active:i==="html",onClick:()=>o("html"),children:"HTML Source"})]}),i==="preview"&&n&&a.jsx("iframe",{sandbox:"",referrerPolicy:"no-referrer",title:"Message preview",srcDoc:n,className:"h-[500px] w-full rounded-md border border-border bg-white"}),i==="text"&&r&&a.jsx("pre",{className:"max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border bg-card p-4 font-mono text-[13px] text-foreground",children:r}),i==="html"&&n&&a.jsx("pre",{className:"max-h-[500px] overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-card p-4 font-mono text-[12px] text-muted-foreground",children:n})]})}function Df({active:n,onClick:r,children:i}){return a.jsx("button",{onClick:r,className:`px-3 pb-2 pt-1 text-[13px] font-medium transition-colors duration-150 ${n?"border-b-2 border-foreground text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i})}const Zm=["suppressions"];function QA(){return el({queryKey:Zm,queryFn:({pageParam:n})=>c4(n),initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0})}function FA(){const n=_e();return pe({mutationFn:r=>u4(r),onSuccess:()=>{n.invalidateQueries({queryKey:Zm})}})}function PA(){const n=_e();return pe({mutationFn:r=>d4(r),onSuccess:()=>{n.invalidateQueries({queryKey:Zm})}})}function KA(n){switch(n){case"hard_bounce":return"Hard bounce";case"complaint":return"Complaint";case"unsubscribe":return"Unsubscribed";case"manual":return"Manual";case"imported":return"Imported";default:return n}}function YA(n){return new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function GA(){const n=QA(),r=FA(),i=PA(),o=j.useRef(null),[d,f]=j.useState(""),[m,p]=j.useState(null),[h,g]=j.useState(null),[v,y]=j.useState(null),b=n.data?.pages.flatMap(k=>k.suppressions)??[];function S(k){k.preventDefault();const _=d.trim();_&&(p(null),g(null),i.mutate(_,{onSuccess:A=>{f(""),p(A.added?`${A.email} is now suppressed. It will never receive mail.`:`${A.email} was already suppressed.`)},onError:A=>g(A.message)}))}async function w(k){const _=k.target.files?.[0];if(!_)return;const A=await _.text();r.mutate(A,{onSuccess:C=>{y(C)}}),k.target.value=""}return a.jsxs("div",{className:"mx-auto max-w-6xl",children:[a.jsxs($e,{to:"/sent",className:"mb-4 inline-flex items-center gap-1.5 text-[14px] text-muted-foreground hover:text-foreground",children:[a.jsx(Xf,{size:14})," Back to Sent Mail"]}),a.jsx(Zt,{eyebrow:"Delivery",title:"Suppressions",subtitle:"Addresses that will never receive mail. Hard bounces, complaints, unsubscribes, and manual blocks.",actions:a.jsxs(H,{variant:"outline",size:"sm",onClick:()=>o.current?.click(),disabled:r.isPending,children:[a.jsx(yk,{size:14}),r.isPending?"Importing...":"Import CSV"]})}),a.jsxs("form",{onSubmit:S,className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsx(I,{type:"email",value:d,onChange:k=>f(k.target.value),placeholder:"Add an address to suppress",className:"w-full sm:max-w-xs","aria-label":"Email address to suppress"}),a.jsxs(H,{type:"submit",variant:"outline",size:"sm",disabled:i.isPending||d.trim().length===0,children:[a.jsx(Kn,{size:14}),i.isPending?"Adding...":"Suppress address"]})]}),m&&a.jsx("div",{className:"mb-4 rounded-md border border-border bg-secondary px-4 py-3",role:"status",children:a.jsx("p",{className:"text-[14px] text-foreground",children:m})}),h&&a.jsx("div",{className:"mb-4 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsx("p",{className:"text-[15px] text-foreground",children:h})}),a.jsx("input",{ref:o,type:"file",accept:".csv,.txt,text/csv,text/plain",className:"hidden",onChange:w}),v&&a.jsxs("div",{className:"mb-4 flex items-start gap-3 rounded-md border border-success bg-success-soft px-4 py-3",role:"status",children:[a.jsx(rl,{size:16,className:"mt-0.5 shrink-0 text-success"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[14px] text-foreground",children:["Import complete: ",v.imported," added, ",v.skipped," already suppressed, ",v.invalid," invalid",v.total_rows>0&&` (${v.total_rows} total rows)`,"."]}),a.jsx("button",{onClick:()=>y(null),className:"mt-1 text-[13px] text-muted-foreground underline underline-offset-4",children:"Dismiss"})]})]}),r.isError&&a.jsx("div",{className:"mb-4 rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:a.jsxs("p",{className:"text-[15px] text-foreground",children:["Import failed: ",r.error.message]})}),n.isLoading&&a.jsx("div",{className:"space-y-3",children:Array.from({length:6}).map((k,_)=>a.jsxs("div",{className:"flex gap-4",children:[a.jsx(se,{className:"h-5 w-48"}),a.jsx(se,{className:"h-5 w-24"}),a.jsx(se,{className:"h-5 w-20"}),a.jsx(se,{className:"h-5 w-32"})]},_))}),n.isError&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-danger bg-danger-soft px-4 py-3",role:"alert",children:[a.jsxs("p",{className:"text-[15px] text-foreground",children:["Failed to load suppressions:"," ",n.error instanceof Error?n.error.message:"Unknown error"]}),a.jsx(H,{variant:"outline",size:"sm",onClick:()=>n.refetch(),children:"Try again"})]}),n.isSuccess&&b.length===0&&a.jsx(ls,{icon:mk,title:"No suppressed addresses",description:"Hard bounces and complaints land here automatically. Add a single address above, or import a suppression list from a previous provider."}),n.isSuccess&&b.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(Ks,{children:[a.jsx(Ys,{children:a.jsxs(sn,{children:[a.jsx(Ue,{children:"Email"}),a.jsx(Ue,{children:"Reason"}),a.jsx(Ue,{children:"Source"}),a.jsx(Ue,{children:"Added"})]})}),a.jsx(Gs,{children:b.map(k=>a.jsxs(sn,{children:[a.jsx(Re,{className:"font-mono text-[13px]",children:k.email}),a.jsx(Re,{children:a.jsx(le,{variant:k.reason==="hard_bounce"||k.reason==="complaint"?"danger":k.reason==="unsubscribe"?"warning":"neutral",children:KA(k.reason)})}),a.jsx(Re,{className:"text-[13px] text-muted-foreground",children:k.source??"-"}),a.jsx(Re,{className:"whitespace-nowrap font-mono text-[13px] text-muted-foreground",children:YA(k.created_at)})]},k.id))})]}),n.hasNextPage&&a.jsx("div",{className:"mt-4 flex justify-center",children:a.jsx(H,{variant:"outline",size:"sm",onClick:()=>n.fetchNextPage(),disabled:n.isFetchingNextPage,children:n.isFetchingNextPage?"Loading...":"Load more"})})]})]})}function VA(){return a.jsx(ec,{to:"/home",replace:!0})}function XA(){const{data:n,isLoading:r}=jc();return r?null:a.jsxs(v2,{children:[a.jsx(Ke,{path:"/login",element:n?a.jsx(ec,{to:"/",replace:!0}):a.jsx(_E,{})}),a.jsxs(Ke,{path:"/",element:n?a.jsx(CE,{me:n}):a.jsx(ec,{to:"/login",replace:!0}),children:[a.jsx(Ke,{index:!0,element:a.jsx(VA,{})}),a.jsx(Ke,{path:"home",element:a.jsx(p3,{})}),a.jsx(Ke,{path:"integrate",element:a.jsx(EA,{})}),a.jsx(Ke,{path:"flows",element:a.jsx(R3,{})}),a.jsx(Ke,{path:"flows/new",element:a.jsx(vv,{})}),a.jsx(Ke,{path:"flows/:id/edit",element:a.jsx(vv,{})}),a.jsx(Ke,{path:"approvals",element:a.jsx(iT,{})}),a.jsx(Ke,{path:"people",element:a.jsx(TT,{})}),a.jsx(Ke,{path:"people/:id",element:a.jsx(UT,{})}),a.jsx(Ke,{path:"lifecycle",element:a.jsx(t5,{})}),a.jsx(Ke,{path:"analytics",element:a.jsx(a5,{})}),a.jsx(Ke,{path:"sent",element:a.jsx(MA,{})}),a.jsx(Ke,{path:"sent/:id",element:a.jsx(HA,{})}),a.jsx(Ke,{path:"sent/suppressions",element:a.jsx(GA,{})}),a.jsx(Ke,{path:"kb",element:a.jsx(p5,{})}),a.jsx(Ke,{path:"kb/new",element:a.jsx(y5,{})}),a.jsx(Ke,{path:"kb/:id",element:a.jsx(S5,{})}),a.jsxs(Ke,{path:"settings",element:a.jsx(_5,{}),children:[a.jsx(Ke,{index:!0,element:a.jsx(ec,{to:"/settings/profile",replace:!0})}),a.jsx(Ke,{path:"profile",element:a.jsx(E5,{})}),a.jsx(Ke,{path:"team",element:a.jsx(C5,{})}),a.jsx(Ke,{path:"llm",element:a.jsx(R5,{})}),a.jsx(Ke,{path:"transport",element:a.jsx(O5,{})}),a.jsx(Ke,{path:"topics",element:a.jsx(Q5,{})}),a.jsx(Ke,{path:"pace",element:a.jsx(L5,{})}),a.jsx(Ke,{path:"branding",element:a.jsx(U5,{})}),a.jsx(Ke,{path:"postal",element:a.jsx(q5,{})}),a.jsx(Ke,{path:"products",element:a.jsx(B5,{})}),a.jsx(Ke,{path:"health",element:a.jsx(K5,{})}),a.jsx(Ke,{path:"webhooks",element:a.jsx(pA,{})}),a.jsx(Ke,{path:"config",element:a.jsx(gA,{})})]}),a.jsx(Ke,{path:"*",element:a.jsx(yA,{})})]})]})}const U1=document.getElementById("root");if(!U1)throw new Error("No #root element found");Fw.createRoot(U1).render(a.jsx(im.StrictMode,{children:a.jsx(Pw,{client:C4,children:a.jsx(P2,{children:a.jsx(XA,{})})})}));